mkfs.f2fs: fix incorrect cold data location
PATCH 1/1 mkfs.f2fs: fix incorrect cold data location
If last_zone((total_zones >> 2)) is equal or less than next_zone(CURSEG_COLD_NODE), cold data area will be located in the same position with hot data, fixes it.
--- mkfs/f2fs_format.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mkfs/f2fs_format.c +1 -1
@@ -471,7 +471,7 @@ static int f2fs_prepare_super_block(void) c.cur_seg[CURSEG_HOT_DATA ] =next_zone (CURSEG_COLD_NODE ); c.cur_seg[CURSEG_COLD_DATA ] =max (last_zone ((total_zones >>2 )), -next_zone (CURSEG_COLD_NODE )); +next_zone (CURSEG_HOT_DATA )); c.cur_seg[CURSEG_WARM_DATA ] =max (last_zone ((total_zones >>1 )),next_zone (CURSEG_COLD_DATA ));
Signature · 6 lines
2.15.0.55.gc2ece9dc4de6 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Quoted 3 lines · Chao Yu
If
last_zone((total_zones >> 2))is equal or less thannext_zone(CURSEG_COLD_NODE), cold data area will be located in the same position with hot data, fixes it.
verify_cur_segs() will rearrage this?
Quoted 21 lines
Signed-off-by Chao Yu <[email protected]>--- mkfs/f2fs_format.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mkfs/f2fs_format.c +1
-1@@ -471,7 +471,7 @@ static int f2fs_prepare_super_block(void) c.cur_seg[CURSEG_HOT_DATA ] =next_zone (CURSEG_COLD_NODE ); c.cur_seg[CURSEG_COLD_DATA ] =max (last_zone ((total_zones >>2 )), -next_zone (CURSEG_COLD_NODE )); +next_zone (CURSEG_HOT_DATA )); c.cur_seg[CURSEG_WARM_DATA ] =max (last_zone ((total_zones >>1 )),next_zone (CURSEG_COLD_DATA ));Signature · 1 line
2.15.0.55.gc2ece9dc4de6
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Quoted 6 lines · Jaegeuk Kim
Quoted 3 lines · Chao Yu
If
last_zone((total_zones >> 2))is equal or less thannext_zone(CURSEG_COLD_NODE), cold data area will be located in the same position with hot data, fixes it.
verify_cur_segs()will rearrage this?
Yes, finally, verify_cur_segs() will make sure there is no redundant segment used by different log headers. But we'd better ensure log initial position is correct at the first time, otherwise, verify_cur_segs() will use sequential allocating to initialize log position, which is not match to our original design.
Thanks,
Quoted 17 lines
Quoted 17 lines
Signed-off-by Chao Yu <[email protected]>--- mkfs/f2fs_format.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mkfs/f2fs_format.c +0
-1@@ -471,7 +471,7 @@ static int f2fs_prepare_super_block(void) c.cur_seg[CURSEG_HOT_DATA ] =next_zone (CURSEG_COLD_NODE ); c.cur_seg[CURSEG_COLD_DATA ] = max(last_zone((total_zones >> 2)), -next_zone (CURSEG_COLD_NODE ));
Quoted 9 lines
Quoted 6 lines
mkfs/f2fs_format.c +1
-0+ next_zone(CURSEG_HOT_DATA)); c.cur_seg[CURSEG_WARM_DATA ] =max (last_zone ((total_zones >>1 )),next_zone (CURSEG_COLD_DATA ));Signature · 1 line
2.15.0.55.gc2ece9dc4de6.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot