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
This commit is contained in:
Axel Dörfler
2007-09-26 14:01:28 +00:00
parent e97e022aa7
commit 8a25e1293b
+12
View File
@@ -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");