The new block bitmap is now written using through the log for chkbfs.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2163 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -728,12 +728,30 @@ BlockAllocator::StopChecking(check_control *control)
|
|||||||
// Should we fix errors? Were there any errors we can fix?
|
// Should we fix errors? Were there any errors we can fix?
|
||||||
if (control->flags & BFS_FIX_BITMAP_ERRORS
|
if (control->flags & BFS_FIX_BITMAP_ERRORS
|
||||||
&& (control->stats.freed != 0 || control->stats.missing != 0)) {
|
&& (control->stats.freed != 0 || control->stats.missing != 0)) {
|
||||||
// if so, write the check bitmap back over the original one
|
// if so, write the check bitmap back over the original one,
|
||||||
|
// and use transactions here to play safe - we even use several
|
||||||
|
// transactions, so that we don't blow the maximum log size
|
||||||
|
// on large disks; since we don't need to make this atomic
|
||||||
fVolume->SuperBlock().used_blocks = usedBlocks;
|
fVolume->SuperBlock().used_blocks = usedBlocks;
|
||||||
ssize_t written = cached_write(fVolume->Device(), 1, fCheckBitmap, fNumGroups * fBlocksPerGroup, fVolume->BlockSize());
|
|
||||||
|
|
||||||
if (written != size)
|
int32 blocksInBitmap = fNumGroups * fBlocksPerGroup;
|
||||||
PRINT(("write bitmap failed: %ld, %s\n", written, strerror(written)));
|
int32 blockSize = fVolume->BlockSize();
|
||||||
|
|
||||||
|
for (int32 i = 0; i < blocksInBitmap; i += 512) {
|
||||||
|
Transaction transaction(fVolume, 1 + i);
|
||||||
|
|
||||||
|
int32 blocksToWrite = 512;
|
||||||
|
if (blocksToWrite + i > blocksInBitmap)
|
||||||
|
blocksToWrite = blocksInBitmap - i;
|
||||||
|
|
||||||
|
status_t status = transaction.WriteBlocks(1 + i,
|
||||||
|
(uint8 *)fCheckBitmap + i * blockSize, blocksToWrite);
|
||||||
|
if (status < B_OK) {
|
||||||
|
FATAL(("error writing bitmap: %s\n", strerror(status)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
transaction.Done();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
FATAL(("BlockAllocator::CheckNextNode() didn't run through\n"));
|
FATAL(("BlockAllocator::CheckNextNode() didn't run through\n"));
|
||||||
|
|||||||
Reference in New Issue
Block a user