[haiku-commits] haiku: hrev56232 - src/add-ons/kernel/file_systems/bfs

  • From: Jérôme Duval <jerome.duval@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 30 Jun 2022 08:25:16 +0000 (UTC)

hrev56232 adds 1 changeset to branch 'master'
old head: 2884a00088bb01b104d5181a1002dd4e197112f4
new head: 187f73dbf5a630f154c0cc8cbb36abb5ff8fcdcb
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=187f73dbf5a6+%5E2884a00088bb

----------------------------------------------------------------------------

187f73dbf5a6: bfs: take in account the block_run allocation group when 
computing reserved blocks.
  
  after hrev56221, the block bitmaps can span over multiple allocation groups.
  Blocks would be allocated in the block bitmaps, especially root indexes (for 
instance 2.5TB, blocksize 2k).
  
  Change-Id: I35d21d48e84945e5f949a272d530c466ae6506ac
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/5420
  Tested-by: Commit checker robot <no-reply+buildbot@xxxxxxxxxxxx>
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                                   [ Jérôme Duval <jerome.duval@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev56232
Commit:      187f73dbf5a630f154c0cc8cbb36abb5ff8fcdcb
URL:         https://git.haiku-os.org/haiku/commit/?id=187f73dbf5a6
Author:      Jérôme Duval <jerome.duval@xxxxxxxxx>
Date:        Wed Jun 29 07:15:39 2022 UTC

----------------------------------------------------------------------------

2 files changed, 7 insertions(+), 6 deletions(-)
src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp | 9 +++++----
src/add-ons/kernel/file_systems/bfs/CheckVisitor.cpp   | 4 ++--

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 
b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp
index 949e9a67ea..aa5245f84c 100644
--- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp
+++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp
@@ -596,7 +596,7 @@ BlockAllocator::InitializeAndClearBitmap(Transaction& 
transaction)
        free(buffer);
 
        // reserve the boot block, the log area, and the block bitmap itself
-       uint32 reservedBlocks = fVolume->Log().Start() + 
fVolume->Log().Length();
+       uint32 reservedBlocks = fVolume->ToBlock(fVolume->Log()) + 
fVolume->Log().Length();
        uint32 blocksToReserve = reservedBlocks;
        for (int32 i = 0; i < fNumGroups; i++) {
                int32 reservedBlocksInGroup = min_c(blocksToReserve, numBits);
@@ -680,7 +680,7 @@ BlockAllocator::_Initialize(BlockAllocator* allocator)
        free(buffer);
 
        // check if block bitmap and log area are reserved
-       uint32 reservedBlocks = volume->Log().Start() + volume->Log().Length();
+       uint32 reservedBlocks = volume->ToBlock(volume->Log()) + 
volume->Log().Length();
 
        if (allocator->CheckBlocks(0, reservedBlocks) != B_OK) {
                if (volume->IsReadOnly()) {
@@ -1023,8 +1023,9 @@ BlockAllocator::Free(Transaction& transaction, block_run 
run)
        }
        // check if someone tries to free reserved areas at the beginning of the
        // drive
-       if (group == 0
-               && start < uint32(fVolume->Log().Start() + 
fVolume->Log().Length())) {
+       if (group < fVolume->Log().AllocationGroup()
+               || (group == fVolume->Log().AllocationGroup()
+                       && start < uint32(fVolume->Log().Start()) + 
fVolume->Log().Length())) {
                FATAL(("tried to free a reserved block_run"
                        " (%" B_PRId32 ", %" B_PRIu16 ", %" B_PRIu16")\n",
                        group, start, length));
diff --git a/src/add-ons/kernel/file_systems/bfs/CheckVisitor.cpp 
b/src/add-ons/kernel/file_systems/bfs/CheckVisitor.cpp
index 1bd71c27f3..e5d562b6fe 100644
--- a/src/add-ons/kernel/file_systems/bfs/CheckVisitor.cpp
+++ b/src/add-ons/kernel/file_systems/bfs/CheckVisitor.cpp
@@ -65,8 +65,8 @@ CheckVisitor::StartBitmapPass()
 
        // initialize bitmap
        memset(fCheckBitmap, 0, size);
-       for (int32 block = GetVolume()->Log().Start() + 
GetVolume()->Log().Length();
-                       block-- > 0;) {
+       for (off_t block = GetVolume()->ToBlock(GetVolume()->Log())
+               + GetVolume()->Log().Length(); block-- > 0;) {
                _SetCheckBitmapAt(block);
        }
 


Other related posts:

  • » [haiku-commits] haiku: hrev56232 - src/add-ons/kernel/file_systems/bfs - Jérôme Duval