mkfs.f2fs: not allow to format too small sized partition
PATCH 1/1 mkfs.f2fs: not allow to format too small sized partition
For example, if we want to format 40MB image, it'll give 12 segments for main area. And, it assigns 6 for current segments, 11 for ovp segments, and 10 for reserved segments. So, we have 5 free segments, which we can't handle:
# of free segments < # of reserved segments.
Reported-by Daniel Rosenberg <[email protected]>
Signed-off-by Jaegeuk Kim <[email protected]>
--- mkfs/f2fs_format.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
mkfs/f2fs_format.c +6 -5
@@ -408,18 +408,19 @@ static int f2fs_prepare_super_block(void)if (c.overprovision ==0 ) c.overprovision =get_best_overprovision (sb); + c.reserved_segments = + (2 * (100 / c.overprovision +1 ) +NR_CURSEG_TYPE ) + * c.segs_per_sec; +if (c.overprovision ==0 || c.total_segments <F2FS_MIN_SEGMENTS || (c.devices[0 ].total_sectors * c.sector_size < zone_align_start_offset) || - (get_sb (segment_count_main) -2 ) < c.reserved_segments) { + (get_sb (segment_count_main) -NR_CURSEG_TYPE ) < + c.reserved_segments) {MSG (0 ,"\tError: Device size is not sufficient for F2FS volume\n" );return -1 ; } - c.reserved_segments = - (2 * (100 / c.overprovision +1 ) +6 ) - * c.segs_per_sec; -uuid_generate (sb->uuid);/* precompute checksum seed for metadata */
Signature · 6 lines
2.17.0.441.gb46fe60e1d-goog ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Quoted 7 lines · Jaegeuk Kim
For example, if we want to format 40MB image, it'll give 12 segments for main area. And, it assigns 6 for current segments, 11 for ovp segments, and 10 for reserved segments. So, we have 5 free segments, which we can't handle:
# of free segments < # of reserved segments.Reported-by Daniel Rosenberg <[email protected]>Signed-off-by Jaegeuk Kim <[email protected]>
Reviewed-by Chao Yu <[email protected]>
Thanks,
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot