From decde2b03037a9aa65bf7871caf26b12d7ced4f8 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 20 Jul 2010 21:11:56 +0000 Subject: [PATCH] * _Free[InBitmapBlock](): Don't use Block::Discard() (block_cache_discard()). It doesn't have the intended semantics (reverting the change). The caller is now expected to roll back the transaction. * AllocateExactly(): Don't try to revert a partially successful allocation. The caller is expected to roll back the transaction. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37632 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/file_corruption/fs/BlockAllocator.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/tests/system/kernel/file_corruption/fs/BlockAllocator.cpp b/src/tests/system/kernel/file_corruption/fs/BlockAllocator.cpp index dedc757b9a..f67cfe7bdc 100644 --- a/src/tests/system/kernel/file_corruption/fs/BlockAllocator.cpp +++ b/src/tests/system/kernel/file_corruption/fs/BlockAllocator.cpp @@ -206,10 +206,8 @@ dprintf("BlockAllocator::AllocateExactly(%llu, %llu)\n", base, count); if (error != B_OK) return error; - if (allocated < count) { - _Free(base, allocated, transaction); + if (allocated < count) return B_BUSY; - } return _UpdateSuperBlock(transaction); } @@ -672,10 +670,8 @@ dprintf("BlockAllocator::_FreeInBitmapBlock(%llu, %lu)\n", base, count); if (endOffset < 32) mask &= ((uint32)1 << endOffset) - 1; - if ((*bits & mask) != mask) { - block.Discard(); + if ((*bits & mask) != mask) RETURN_ERROR(B_BAD_VALUE); - } *bits &= ~mask; remaining -= endOffset - bitOffset; @@ -683,10 +679,8 @@ dprintf("BlockAllocator::_FreeInBitmapBlock(%llu, %lu)\n", base, count); // handle complete uint32s in the middle while (remaining >= 32) { - if (*bits != 0xffffffff) { - block.Discard(); + if (*bits != 0xffffffff) RETURN_ERROR(B_BUSY); - } *bits = 0; remaining -= 32; @@ -696,10 +690,8 @@ dprintf("BlockAllocator::_FreeInBitmapBlock(%llu, %lu)\n", base, count); if (remaining > 0) { uint32 mask = ((uint32)1 << remaining) - 1; - if ((*bits & mask) != mask) { - block.Discard(); + if ((*bits & mask) != mask) return B_BUSY; - } *bits &= ~mask; }