The computation of the number of blocks in the last allocation group was wrong; it

would usually be one block too small - this fixes bug #659.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18955 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-09-28 10:46:37 +00:00
parent a09f0db169
commit 85baf76e1a

View File

@ -420,7 +420,7 @@ BlockAllocator::InitializeAndClearBitmap(Transaction &transaction)
// the last allocation group may contain less blocks than the others
if (i == fNumGroups - 1) {
fGroups[i].fNumBits = fVolume->NumBlocks() - i * numBits;
fGroups[i].fNumBlocks = fGroups[i].fNumBits >> (blockShift + 3);
fGroups[i].fNumBlocks = 1 + ((fGroups[i].NumBits() - 1) >> (blockShift + 3));
} else {
fGroups[i].fNumBits = numBits;
fGroups[i].fNumBlocks = blocks;
@ -475,7 +475,7 @@ BlockAllocator::_Initialize(BlockAllocator *allocator)
// the last allocation group may contain less blocks than the others
if (i == num - 1) {
groups[i].fNumBits = volume->NumBlocks() - i * numBits;
groups[i].fNumBlocks = groups[i].fNumBits >> (blockShift + 3);
groups[i].fNumBlocks = 1 + ((groups[i].NumBits() - 1) >> (blockShift + 3));
} else {
groups[i].fNumBits = numBits;
groups[i].fNumBlocks = blocks;