f2fs: correct cp_ver for compatibility to old image
PATCH 1/1 f2fs: correct cp_ver for compatibility to old image
There is no CP_CRC_RECOVERY_FLAG tagged in checkpoint pack, calculate cp_version as old format.
--- fs/f2fs/node.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/node.c +3 -1
@@ -2507,7 +2507,9 @@ static int __get_nat_bitmaps(struct f2fs_sb_info *sbi)f2fs_put_page (page,1 ); } - cp_ver |= (cur_cp_crc (ckpt) <<32 ); +if (__is_set_ckpt_flags (ckpt,CP_CRC_RECOVERY_FLAG )) + cp_ver |= (cur_cp_crc (ckpt) <<32 ); +if (cpu_to_le64 (cp_ver) != *(__le64 *)nm_i->nat_bits) {disable_nat_bits (sbi, true);return 0 ;
Signature · 6 lines
2.8.2.295.g3f1c1d0 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Jaegeuk Kim
maintainerQuoted 13 lines · Chao Yu
There is no
CP_CRC_RECOVERY_FLAGtagged in checkpoint pack, calculatecp_versionas old format.Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/node.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)fs/f2fs/node.c +0
-0
fs/f2fs/node.c static int __get_nat_bitmaps(struct f2fs_sb_info *sbi) · line 2511
Quoted 6 lines
fs/f2fs/node.c +2
-1@@ -2507,7 +2507,9 @@ static int __get_nat_bitmaps(struct f2fs_sb_info *sbi)f2fs_put_page (page,1 ); } - cp_ver |= (cur_cp_crc (ckpt) <<32 ); +if (__is_set_ckpt_flags (ckpt,CP_CRC_RECOVERY_FLAG )) + cp_ver |= (cur_cp_crc (ckpt) <<32 );
Well, we always write nat_bits with crc. So if it's different, something is wrong and we need to drop it. CP-CRC_RECOVERY_FLAG is used for roll-forward recovery, which is a different context.
Quoted 6 lines
fs/f2fs/node.c +1
-0+if (cpu_to_le64 (cp_ver) != *(__le64 *)nm_i->nat_bits) {disable_nat_bits (sbi, true);return 0 ;Signature · 1 line
2.8.2.295.g3f1c1d0
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Quoted 17 lines · Jaegeuk Kim
Quoted 16 lines · Chao Yu
There is no
CP_CRC_RECOVERY_FLAGtagged in checkpoint pack, calculatecp_versionas old format.Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/node.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)fs/f2fs/node.c +0
-0@@ -2507,7 +2507,9 @@ static int __get_nat_bitmaps(struct f2fs_sb_info *sbi)f2fs_put_page (page,1 ); }
Quoted 6 lines
fs/f2fs/node.c static int __get_nat_bitmaps(struct f2fs_sb_info *sbi) · line 2511
Quoted 3 lines
fs/f2fs/node.c +2
-1- cp_ver |= (cur_cp_crc (ckpt) <<32 ); +if (__is_set_ckpt_flags (ckpt,CP_CRC_RECOVERY_FLAG )) + cp_ver |= (cur_cp_crc (ckpt) <<32 );Well, we always write
nat_bitswith crc. So if it's different, something is wrong and we need to drop it.
Got it. :)
Thanks,
Quoted 11 lines
CP-CRC_RECOVERY_FLAG is used for roll-forward recovery, which is a different context.
Quoted 6 lines
fs/f2fs/node.c +1
-0+if (cpu_to_le64 (cp_ver) != *(__le64 *)nm_i->nat_bits) {disable_nat_bits (sbi, true);return 0 ;Signature · 1 line
2.8.2.295.g3f1c1d0.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot