From 37bd67edb804460caf762801cf5efed5f38031f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 16 Dec 2005 13:53:34 +0000 Subject: [PATCH] Now also flushes dirty blocks correctly (cannot happen if transactions are used, ie. never happens with BFS). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15562 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/cache/block_cache.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/cache/block_cache.cpp b/src/system/kernel/cache/block_cache.cpp index c77d641a3f..4b1230d2ac 100644 --- a/src/system/kernel/cache/block_cache.cpp +++ b/src/system/kernel/cache/block_cache.cpp @@ -54,7 +54,8 @@ struct cache_transaction { bool has_sub_transaction; }; -static status_t write_cached_block(block_cache *cache, cached_block *block, bool deleteTransaction = true); +static status_t write_cached_block(block_cache *cache, cached_block *block, + bool deleteTransaction = true); // #pragma mark - private transaction @@ -329,6 +330,10 @@ block_cache::RemoveUnusedBlocks(int32 maxAccessed, int32 count) dprintf(" remove block %Ld, accessed %ld times\n", block->block_number, block->accessed); + // this can only happen if no transactions are used + if (block->is_dirty) + write_cached_block(this, block, false); + // remove block from lists unused_blocks.Remove(block); hash_remove(hash, block);