From 8a25e1293b0d8522f389c4ca01e474327128a243 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 26 Sep 2007 14:01:28 +0000 Subject: [PATCH] Implemented a part of block_cache_set_dirty() so that it can gracefully exit in case there is nothing to do. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22318 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/cache/block_cache.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/system/kernel/cache/block_cache.cpp b/src/system/kernel/cache/block_cache.cpp index 365c48afe5..adf4fce740 100644 --- a/src/system/kernel/cache/block_cache.cpp +++ b/src/system/kernel/cache/block_cache.cpp @@ -1420,6 +1420,18 @@ extern "C" status_t block_cache_set_dirty(void *_cache, off_t blockNumber, bool dirty, int32 transaction) { + block_cache *cache = (block_cache *)_cache; + BenaphoreLocker locker(&cache->lock); + + cached_block *block = (cached_block *)hash_lookup(cache->hash, + &blockNumber); + if (block == NULL) + return B_BAD_VALUE; + if (block->is_dirty == dirty) { + // there is nothing to do for us + return B_OK; + } + // TODO: not yet implemented if (dirty) panic("block_cache_set_dirty(): not yet implemented that way!\n");