* more cleanup
* more fixes in BitmapBlock::FindNextMarked() and BitmapBlock::FindPreviousMarked() git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39242 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
bea74c0911
commit
25a55b41c7
@ -403,6 +403,7 @@ BitmapBlock::FindNextMarked(uint32& pos)
|
||||
"bits: %lX\n", index, bit, mask, bits);
|
||||
|
||||
bits = bits & ~mask;
|
||||
uint32 maxBit = 32;
|
||||
|
||||
if (bits == 0) {
|
||||
// Find a block of 32 bits that has a marked bit
|
||||
@ -414,18 +415,23 @@ BitmapBlock::FindNextMarked(uint32& pos)
|
||||
} while (index < maxIndex && data[index] == 0);
|
||||
|
||||
if (index >= maxIndex) {
|
||||
// Not found
|
||||
TRACE("BitmapBlock::FindNextMarked(): reached end of block, num "
|
||||
"bits: %lu\n", fNumBits);
|
||||
pos = fNumBits;
|
||||
return;
|
||||
maxBit = fNumBits & 0x1F;
|
||||
|
||||
if (maxBit == 0) {
|
||||
// Not found
|
||||
TRACE("BitmapBlock::FindNextMarked(): reached end of block, "
|
||||
"num bits: %lu\n", fNumBits);
|
||||
pos = fNumBits;
|
||||
return;
|
||||
}
|
||||
maxBit++;
|
||||
}
|
||||
|
||||
bits = B_LENDIAN_TO_HOST_INT32(data[index]);
|
||||
bit = 0;
|
||||
}
|
||||
|
||||
for (; bit < 32; ++bit) {
|
||||
for (; bit < maxBit; ++bit) {
|
||||
// Find the marked bit
|
||||
if ((bits >> bit & 1) != 0) {
|
||||
pos = index << 5 | bit;
|
||||
@ -520,18 +526,18 @@ BitmapBlock::FindPreviousMarked(uint32& pos)
|
||||
uint32 index = pos >> 5;
|
||||
int32 bit = pos & 0x1F;
|
||||
|
||||
uint32 mask = (1 << (bit + 1)) - 1;
|
||||
uint32 mask = (1 << bit) - 1;
|
||||
uint32 bits = B_LENDIAN_TO_HOST_INT32(data[index]);
|
||||
bits = bits & mask;
|
||||
|
||||
TRACE("BitmapBlock::FindPreviousMarked(): index: %lu, bit: %lu\n", index,
|
||||
bit);
|
||||
TRACE("BitmapBlock::FindPreviousMarked(): index: %lu bit: %lu bits: %lx\n",
|
||||
index, bit, bits);
|
||||
|
||||
if (bits == 0) {
|
||||
// Find an block of 32 bits that has a marked bit
|
||||
do {
|
||||
index--;
|
||||
} while (data[index] == 0 && index >= 0);
|
||||
} while (data[index] == 0 && index > 0);
|
||||
|
||||
bits = B_LENDIAN_TO_HOST_INT32(data[index]);
|
||||
if (bits == 0) {
|
||||
@ -543,11 +549,11 @@ BitmapBlock::FindPreviousMarked(uint32& pos)
|
||||
bit = 31;
|
||||
}
|
||||
|
||||
TRACE("BitmapBlock::FindPreviousMarked(): index: %lu bit: %lu bits: %lx\n",
|
||||
TRACE("BitmapBlock::FindPreviousMarked(): index: %lu bit: %lu bits: %lx\n",
|
||||
index, bit, bits);
|
||||
|
||||
for (; bit >= 0; --bit) {
|
||||
// Find the unmarked bit
|
||||
// Find the marked bit
|
||||
if ((bits >> bit & 1) != 0) {
|
||||
pos = index << 5 | bit;
|
||||
return;
|
||||
|
@ -938,7 +938,7 @@ Inode::_ShrinkDataStream(Transaction& transaction, off_t size)
|
||||
if (size > minSize) {
|
||||
// No need to allocate more blocks
|
||||
TRACE("Inode::_ShrinkDataStream(): No need to allocate more blocks\n");
|
||||
TRACE("Inode::_ShrinkDataStream(): Setting size to %ld\n", (long)size);
|
||||
TRACE("Inode::_ShrinkDataStream(): Setting size to %lld\n", size);
|
||||
fNode.SetSize(size);
|
||||
return B_OK;
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ Journal::_WriteTransactionToLog()
|
||||
if (size > FreeLogBlocks()) {
|
||||
panic("Transaction fits, but sync didn't result in enough"
|
||||
"free space.\n\tGot %ld when at least %ld was expected.",
|
||||
(long)FreeLogBlocks(), (long)size);
|
||||
FreeLogBlocks(), size);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user