fixed some traces

cache_abort_sub_transaction now doesn't crash if parent_cache is NULL (happens in low memory situations)
Axel, please review and fix if needed


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16105 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2006-01-26 16:42:12 +00:00
parent 421b932509
commit 2e5ac35292

View File

@ -699,7 +699,7 @@ cache_start_transaction(void *_cache)
transaction->id = atomic_add(&cache->next_transaction_id, 1); transaction->id = atomic_add(&cache->next_transaction_id, 1);
cache->last_transaction = transaction; cache->last_transaction = transaction;
TRACE(("cache_transaction_start(): id %ld started\n", transaction->id)); TRACE(("cache_start_transaction(): id %ld started\n", transaction->id));
hash_insert(cache->transaction_hash, transaction); hash_insert(cache->transaction_hash, transaction);
@ -838,11 +838,11 @@ cache_detach_sub_transaction(void *_cache, int32 id,
block_cache *cache = (block_cache *)_cache; block_cache *cache = (block_cache *)_cache;
BenaphoreLocker locker(&cache->lock); BenaphoreLocker locker(&cache->lock);
TRACE(("cache_end_transaction(id = %ld)\n", id)); TRACE(("cache_detach_sub_transaction(id = %ld)\n", id));
cache_transaction *transaction = lookup_transaction(cache, id); cache_transaction *transaction = lookup_transaction(cache, id);
if (transaction == NULL) { if (transaction == NULL) {
panic("cache_end_transaction(): invalid transaction ID\n"); panic("cache_detach_sub_transaction(): invalid transaction ID\n");
return B_BAD_VALUE; return B_BAD_VALUE;
} }
if (!transaction->has_sub_transaction) if (!transaction->has_sub_transaction)
@ -924,6 +924,9 @@ cache_abort_sub_transaction(void *_cache, int32 id)
for (; block != NULL; block = next) { for (; block != NULL; block = next) {
next = block->transaction_next; next = block->transaction_next;
if (!block->parent_data)
continue;
if (block->parent_data != block->data) { if (block->parent_data != block->data) {
// the block has been changed and must be restored // the block has been changed and must be restored
TRACE(("cache_abort_sub_transaction(id = %ld): restored contents of block %Ld\n", TRACE(("cache_abort_sub_transaction(id = %ld): restored contents of block %Ld\n",