* File::_UpdateLevelInfos(): Fixed child count computation. Was incorrect (0)
for multiple of kFileBlockMaxCount block counts. * File::_GrowTree(): The inner loop of the level addition part was bogus. Apparently I never tested with files >= 2 MB before. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37683 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5cdadcae91
commit
539ec8ff1e
|
@ -450,10 +450,16 @@ File::_DepthForBlockCount(uint64 blockCount)
|
|||
/*static*/ void
|
||||
File::_UpdateLevelInfos(LevelInfo* infos, int32 levelCount, uint64 blockCount)
|
||||
{
|
||||
if (blockCount == 0) {
|
||||
infos[0].addressableShift = 0;
|
||||
infos[0].childCount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
uint64 addressableShift = 0;
|
||||
for (int32 i = levelCount - 1; i >= 0; i--) {
|
||||
infos[i].addressableShift = addressableShift;
|
||||
infos[i].childCount = blockCount % kFileBlockMaxCount;
|
||||
infos[i].childCount = (blockCount - 1) % kFileBlockMaxCount + 1;
|
||||
addressableShift += kFileBlockShift;
|
||||
blockCount = (blockCount + kFileBlockMaxCount - 1) / kFileBlockMaxCount;
|
||||
}
|
||||
|
@ -616,7 +622,6 @@ File::_GrowTree(uint64 blockCount, uint64 newBlockCount,
|
|||
|
||||
// allocate a block per new level
|
||||
for (int32 i = newDepth - depth - 1; i >= 0; i--) {
|
||||
while (depth < newDepth) {
|
||||
// allocate a new block
|
||||
AllocatedBlock allocatedBlock(GetVolume()->GetBlockAllocator(),
|
||||
transaction);
|
||||
|
@ -643,7 +648,6 @@ File::_GrowTree(uint64 blockCount, uint64 newBlockCount,
|
|||
childCount = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
depth = newDepth;
|
||||
|
||||
|
|
Loading…
Reference in New Issue