diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp index b3dcd55d82..af6a3cdb37 100644 --- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp @@ -1514,7 +1514,7 @@ BlockAllocator::CheckBlocks(off_t start, off_t length, bool allocated) return B_BAD_VALUE; uint32 group = start >> fVolume->AllocationGroupShift(); - uint32 groupBlock = start % (fVolume->BlockSize() << 3); + uint32 groupBlock = start / (fVolume->BlockSize() << 3); uint32 blockOffset = start % fVolume->BlockSize(); AllocationBlock cached(fVolume); @@ -1530,6 +1530,8 @@ BlockAllocator::CheckBlocks(off_t start, off_t length, bool allocated) } } + blockOffset = 0; + if (++groupBlock >= fGroups[group].NumBlocks()) { groupBlock = 0; group++;