mkfs: write the cp page 2 of the checkpoint pack 2 during format

Currently mkfs followed by fsck will fail with

  [f2fs_crc_valid: 351] CRC validation failed: cal_crc = 4076150800 blk_crc = 0 buff_size = 0x0

This is because the validatie_checkpoint() tries to read and checksum the
cp page 2, and it is invoked on both cp packs.
But format only writes the page 1 of the 2nd checkpoint pack.

Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
JP Abgrall 2014-01-09 17:53:18 -08:00 committed by Jaegeuk Kim
parent cb54e79739
commit 6da30100ee

View File

@ -703,6 +703,13 @@ static int f2fs_write_check_point_pack(void)
return -1;
}
/* 10. cp page 2 of check point pack 2 */
cp_seg_blk_offset += blk_size_bytes * (le32_to_cpu(ckp->cp_pack_total_block_count) - 1);
if (dev_write(ckp, cp_seg_blk_offset, F2FS_BLKSIZE)) {
MSG(1, "\tError: While writing the ckp to disk!!!\n");
return -1;
}
free(sum) ;
free(ckp) ;
return 0;