[haiku-commits] r37632 - haiku/trunk/src/tests/system/kernel/file_corruption/fs

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 20 Jul 2010 23:11:56 +0200 (CEST)

Author: bonefish
Date: 2010-07-20 23:11:56 +0200 (Tue, 20 Jul 2010)
New Revision: 37632
Changeset: http://dev.haiku-os.org/changeset/37632

Modified:
   haiku/trunk/src/tests/system/kernel/file_corruption/fs/BlockAllocator.cpp
Log:
* _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.


Modified: 
haiku/trunk/src/tests/system/kernel/file_corruption/fs/BlockAllocator.cpp
===================================================================
--- haiku/trunk/src/tests/system/kernel/file_corruption/fs/BlockAllocator.cpp   
2010-07-20 20:38:53 UTC (rev 37631)
+++ haiku/trunk/src/tests/system/kernel/file_corruption/fs/BlockAllocator.cpp   
2010-07-20 21:11:56 UTC (rev 37632)
@@ -206,10 +206,8 @@
        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 @@
                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 @@
 
        // 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 @@
        if (remaining > 0) {
                uint32 mask = ((uint32)1 << remaining) - 1;
 
-               if ((*bits & mask) != mask) {
-                       block.Discard();
+               if ((*bits & mask) != mask)
                        return B_BUSY;
-               }
 
                *bits &= ~mask;
        }


Other related posts:

  • » [haiku-commits] r37632 - haiku/trunk/src/tests/system/kernel/file_corruption/fs - ingo_weinhold