mkfs.f2fs: fix wrong segment assignment
PATCH 1/1 mkfs.f2fs: fix wrong segment assignment
We must guarantee that current segments should be different between different logs.
This should resolve xfstests/generic/015 panic.
Fixes 8f9327c0c02ee1 ("mkfs.f2fs: use noheap by default")
Signed-off-by Jaegeuk Kim <[email protected]>
--- mkfs/f2fs_format.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
mkfs/f2fs_format.c +21 -0
@@ -117,6 +117,24 @@ next:free (c.extension_list); } +static void verify_cur_segs (void ) +{ +int i, j; + +for (i =0 ; i <NR_CURSEG_TYPE ; i++) { +for (j =0 ; j <NR_CURSEG_TYPE ; j++) +if (c.cur_seg[i] == c.cur_seg[j]) +break ; + } + +if (i ==NR_CURSEG_TYPE && j ==NR_CURSEG_TYPE ) +return ; + + c.cur_seg[0 ] =0 ; +for (i =1 ; i <NR_CURSEG_TYPE ; i++) + c.cur_seg[i] =next_zone (i -1 ); +} +static int f2fs_prepare_super_block (void ) {u_int32_t blk_size_bytes;
@@ -384,6 +402,9 @@ static int f2fs_prepare_super_block(void) next_zone(CURSEG_COLD_DATA)); } +/* if there is redundancy, reassign it */ +verify_cur_segs (); +cure_extension_list ();/* get kernel version */
Signature · 6 lines
2.11.0 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot