Skip to contentSkip to conversation

resize.f2fs: correct checkpoint_ver of new checkpoint

PATCH New Sheng Yong 1 participant 1 message Feb 4, 2017

lore
Share & tools
lore

Sheng Yong

author
#0 lore raw

PATCH 1/1 resize.f2fs: correct checkpoint_ver of new checkpoint

resize.f2fs rebuilds a new checkpoint at the new position. Its checkpoint_ver should be increased.

---
 fsck/resize.c | 2 ++
 1 file changed, 2 insertions(+)
fsck/resize.c +2 -0
index 29cb1c0..4791f74 100644
@@ -415,6 +415,7 @@ static void rebuild_checkpoint(struct f2fs_sb_info *sbi,
 			struct f2fs_super_block *new_sb, unsigned int offset)
 {
 	struct f2fs_checkpoint *cp = F2FS_CKPT(sbi);
+	unsigned long long cp_ver = get_cp(checkpoint_ver);
 	struct f2fs_checkpoint *new_cp;
 	struct f2fs_super_block *sb = F2FS_RAW_SUPER(sbi);
 	unsigned int free_segment_count, new_segment_count;
@@ -476,6 +477,7 @@ static void rebuild_checkpoint(struct f2fs_sb_info *sbi,
 
 	memcpy(new_cp, cp, (unsigned char *)cp->sit_nat_version_bitmap -
 						(unsigned char *)cp);
+	new_cp->checkpoint_ver = cpu_to_le64(cp_ver + 1);
 
 	crc = f2fs_cal_crc32(F2FS_SUPER_MAGIC, new_cp, CHECKSUM_OFFSET);
 	*((__le32 *)((unsigned char *)new_cp + CHECKSUM_OFFSET)) = cpu_to_le32(crc);
Signature · 6 lines
2.10.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot