diff options
author | Fan Li <fanofcode.li@samsung.com> | 2016-03-16 10:25:36 +0800 |
---|---|---|
committer | luca020400 <luca.stefani.ge1@gmail.com> | 2016-04-04 17:17:56 +0200 |
commit | 31365f7046d3458705dd9ccd398825a978d6d8ba (patch) | |
tree | 0e16ca6a32aa24f84a9eed4a80c331cc7eb01c56 | |
parent | 3cf98bdf8492078a68fd64c67a1e1b193a35e084 (diff) | |
download | android_external_f2fs-tools-31365f7046d3458705dd9ccd398825a978d6d8ba.tar.gz android_external_f2fs-tools-31365f7046d3458705dd9ccd398825a978d6d8ba.tar.bz2 android_external_f2fs-tools-31365f7046d3458705dd9ccd398825a978d6d8ba.zip |
mkfs.f2fs: set segment_count in super block correctly
Now f2fs will check statistics recorded in super block in
sanity_check_area_boundary() during mount. If the number of segments
per zone is greater than 1, and the disk space isn't aligned with zone,
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 zone,
mkfs doesn't add those excess segments to segment_count_main, but adds
them to segment_count.
Here align segment_count with zone size as well as segment_count_main
to prevent such problem.
Signed-off-by: Fan Li <fanofcode.li@samsung.com>
Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | mkfs/f2fs_format.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c index 8fe6b70..3a928b7 100644 --- a/mkfs/f2fs_format.c +++ b/mkfs/f2fs_format.c @@ -175,7 +175,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_zone * config.segs_per_zone); set_sb(segment0_blkaddr, zone_align_start_offset / blk_size_bytes); sb->cp_blkaddr = sb->segment0_blkaddr; |