mkfs: fix the wrong nat bitmap size

We should consider checksum bytes in the checkpoint block.
Previously, this bug incured very critical panics for node entry handling.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
Jaegeuk Kim 2014-01-28 19:23:57 +09:00
parent 4f267323a2
commit 0255d52ebf

View File

@ -299,7 +299,7 @@ static int f2fs_prepare_super_block(void)
*/
sit_bitmap_size = ((le32_to_cpu(super_block.segment_count_sit) / 2) <<
log_blks_per_seg) / 8;
max_nat_bitmap_size = 4096 - sizeof(struct f2fs_checkpoint) + 1 -
max_nat_bitmap_size = CHECKSUM_OFFSET - sizeof(struct f2fs_checkpoint) + 1 -
sit_bitmap_size;
max_nat_segments = (max_nat_bitmap_size * 8) >> log_blks_per_seg;