Skip to contentSkip to conversation

mkfs.f2fs: give random checkpoint version

PATCH In review Jaegeuk Kim 2 participants 3 messages Nov 25, 2016 – Dec 12, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mkfs.f2fs: give random checkpoint version

This is to avoid wrong recovery during xfstests.

---
 mkfs/f2fs_format.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mkfs/f2fs_format.c +1 -1
index 9a536f0..d2254e7 100644
@@ -507,7 +507,7 @@ static int f2fs_write_check_point_pack(void)
 	}
 
 	/* 1. cp page 1 of checkpoint pack 1 */
-	set_cp(checkpoint_ver, 1);
+	cp->checkpoint_ver = rand();
 	set_cp(cur_node_segno[0], c.cur_seg[CURSEG_HOT_NODE]);
 	set_cp(cur_node_segno[1], c.cur_seg[CURSEG_WARM_NODE]);
 	set_cp(cur_node_segno[2], c.cur_seg[CURSEG_COLD_NODE]);
Signature · 4 lines
2.8.3


------------------------------------------------------------------------------
#1 lore raw

Hi Jaegeuk,

Quoted 12 lines · Jaegeuk Kim

This is to avoid wrong recovery during xfstests.

---
 mkfs/f2fs_format.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mkfs/f2fs_format.c +0 -0
index 9a536f0..d2254e7 100644

mkfs/f2fs_format.c static int f2fs_write_check_point_pack(void) · line 510

Quoted 5 lines
mkfs/f2fs_format.c +1 -1
@@ -507,7 +507,7 @@ static int f2fs_write_check_point_pack(void)
 	}
 
 	/* 1. cp page 1 of checkpoint pack 1 */
-	set_cp(checkpoint_ver, 1);
+	cp->checkpoint_ver = rand();

I can see the last patch merged in upstream is:

+ cp->checkpoint_ver = rand() | 0x1;

Any difference and why don't we use set_cp?

Thanks,

mkfs/f2fs_format.c static int f2fs_write_check_point_pack(void) · line 513

Quoted 4 lines
mkfs/f2fs_format.c +0 -0
 	set_cp(cur_node_segno[0], c.cur_seg[CURSEG_HOT_NODE]);
 	set_cp(cur_node_segno[1], c.cur_seg[CURSEG_WARM_NODE]);
 	set_cp(cur_node_segno[2], c.cur_seg[CURSEG_COLD_NODE]);

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi

#2 lore raw

Hi,

Quoted 25 lines · Chao Yu

Hi Jaegeuk,

Quoted 12 lines · Jaegeuk Kim

This is to avoid wrong recovery during xfstests.

---
 mkfs/f2fs_format.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mkfs/f2fs_format.c +0 -0
index 9a536f0..d2254e7 100644

mkfs/f2fs_format.c static int f2fs_write_check_point_pack(void) · line 510

Quoted 5 lines
mkfs/f2fs_format.c +1 -1
@@ -507,7 +507,7 @@ static int f2fs_write_check_point_pack(void)
 	}
 
 	/* 1. cp page 1 of checkpoint pack 1 */
-	set_cp(checkpoint_ver, 1);
+	cp->checkpoint_ver = rand();

I can see the last patch merged in upstream is:

(quoted diff) +1 -0
+	cp->checkpoint_ver = rand() | 0x1;
Quoted 1 line

Any difference and why don't we use set_cp?

In order to support old f2fs driver, we should at least keep the ordering by default, since such the version conversion would not be a normal case.

Thanks,

Quoted 7 lines

Thanks,

Quoted 4 lines
mkfs/f2fs_format.c +0 -0
 	set_cp(cur_node_segno[0], c.cur_seg[CURSEG_HOT_NODE]);
 	set_cp(cur_node_segno[1], c.cur_seg[CURSEG_WARM_NODE]);
 	set_cp(cur_node_segno[2], c.cur_seg[CURSEG_COLD_NODE]);

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