f2fs-tools: set segment_count in super block correctly
PATCH 1/1 f2fs-tools: set segment_count in super block correctly
Now f2fs will check statistics recorded in super block in sanity_check_area_boundary() during mount,if number of segments per section is greater than 1, and disk space isn't aligned with section, mount will fail due to following condition:
main_blkaddr + (segment_count_main << log_blocks_per_seg) !=
segment0_blkaddr + (segment_count << log_blocks_per_seg)
this is because when the length of main area isn't aligned with section, mkfs didn't add the number of excess segments to segment_count_main, but add it to segment_count.
Here align segment_count with section size to prevent such problem.
--- mkfs/f2fs_format.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mkfs/f2fs_format.c +2 -1
@@ -174,7 +174,8 @@ static int f2fs_prepare_super_block(void) }set_sb (segment_count, (config.total_sectors * config.sector_size - - zone_align_start_offset) / segment_size_bytes); + zone_align_start_offset) / segment_size_bytes/ + config.segs_per_sec*config.segs_per_sec);set_sb (segment0_blkaddr, zone_align_start_offset / blk_size_bytes); sb->cp_blkaddr = sb->segment0_blkaddr;
Signature · 9 lines
1.7.9.5 ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
Hi Fan,
Quoted 22 lines · Fan Li
Now f2fs will check statistics recorded in super block in
sanity_check_area_boundary()during mount,if number of segments per section is greater than 1, and disk space isn't aligned with section, mount will fail due to following condition:
main_blkaddr+ (segment_count_main<<log_blocks_per_seg) !=
segment0_blkaddr+ (segment_count<<log_blocks_per_seg)this is because when the length of main area isn't aligned with section, mkfs didn't add the number of excess segments to
segment_count_main, but add it tosegment_count.
Here alignsegment_countwith section size to prevent such problem.Signed-off-by Fan Li <[email protected]>--- mkfs/f2fs_format.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)mkfs/f2fs_format.c +0
-0
mkfs/f2fs_format.c static int f2fs_prepare_super_block(void) · line 178
Quoted 6 lines
mkfs/f2fs_format.c +2
-1@@ -174,7 +174,8 @@ static int f2fs_prepare_super_block(void) }set_sb (segment_count, (config.total_sectors * config.sector_size - - zone_align_start_offset) / segment_size_bytes); + zone_align_start_offset) / segment_size_bytes/ + config.segs_per_sec*config.segs_per_sec);
Please follow the coding style.
Thanks,
Quoted 5 lines
mkfs/f2fs_format.c +0
-0set_sb (segment0_blkaddr, zone_align_start_offset / blk_size_bytes); sb->cp_blkaddr = sb->segment0_blkaddr;Signature · 1 line
1.7.9.5
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140