linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] f2fs-tools: set segment_count in super block correctly
@ 2016-02-03  5:29 Fan Li
  2016-02-04  2:51 ` Junling Zheng
  0 siblings, 1 reply; 9+ messages in thread
From: Fan Li @ 2016-02-03  5:29 UTC (permalink / raw)
  To: 'Jaegeuk Kim'; +Cc: linux-f2fs-devel

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 the 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 first to prevent such problem.

Signed-off-by: Fan Li <fanofcode.li@samsung.com>
---
 mkfs/f2fs_format.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 66d7342..3366302 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -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;
-- 
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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-03-01  6:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-03  5:29 [PATCH v2] f2fs-tools: set segment_count in super block correctly Fan Li
2016-02-04  2:51 ` Junling Zheng
2016-02-04  9:33   ` Fan Li
2016-02-04  9:53     ` Junling Zheng
2016-02-06  4:08     ` Jaegeuk Kim
2016-02-24  7:57       ` Fan Li
2016-02-24  8:33         ` Junling Zheng
2016-03-01  5:58           ` Fan Li
2016-03-01  6:27             ` Junling Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).