* Resolved a TODO: determine the log size depending on the size of the volume.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24797 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-04-04 19:32:39 +00:00
parent 75ab36bd50
commit d6e60839e9

View File

@ -654,12 +654,18 @@ Volume::Initialize(int fd, const char *name, uint32 blockSize,
fBlockShift = fSuperBlock.BlockShift();
fAllocationGroupShift = fSuperBlock.AllocationGroupShift();
// determine log size depending on the size of the volume
off_t logSize = 2048;
if (numBlocks <= 20480)
logSize = 512;
if (deviceSize > 1LL * 1024 * 1024 * 1024)
logSize = 4096;
// since the allocator has not been initialized yet, we
// cannot use BlockAllocator::BitmapSize() here
fSuperBlock.log_blocks = ToBlockRun(AllocationGroups()
* fSuperBlock.BlocksPerAllocationGroup() + 1);
fSuperBlock.log_blocks.length = HOST_ENDIAN_TO_BFS_INT16(2048);
// ToDo: set the log size depending on the disk size
fSuperBlock.log_blocks.length = HOST_ENDIAN_TO_BFS_INT16(logSize);
fSuperBlock.log_start = fSuperBlock.log_end = HOST_ENDIAN_TO_BFS_INT64(
ToBlock(Log()));