From 71d2034366bcc99bd33829a2c00892638117e19b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 28 Jul 2009 21:47:06 +0000 Subject: [PATCH] * Enhanced cache_blocks_in_main_transaction() to also return the correct number of blocks in case there is no sub-transaction at all. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31868 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/cache/block_cache.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/cache/block_cache.cpp b/src/system/kernel/cache/block_cache.cpp index 4bbbb7049e..6c68572893 100644 --- a/src/system/kernel/cache/block_cache.cpp +++ b/src/system/kernel/cache/block_cache.cpp @@ -2651,6 +2651,10 @@ cache_blocks_in_transaction(void* _cache, int32 id) } +/*! Returns the number of blocks that are part of the main transaction. If this + transaction does not have a sub transaction yet, this is the same value as + cache_blocks_in_transaction() would return. +*/ int32 cache_blocks_in_main_transaction(void* _cache, int32 id) { @@ -2661,7 +2665,10 @@ cache_blocks_in_main_transaction(void* _cache, int32 id) if (transaction == NULL) return B_BAD_VALUE; - return transaction->main_num_blocks; + if (transaction->has_sub_transaction) + return transaction->main_num_blocks; + + return transaction->num_blocks; }