Make sure the drive has enough randomly writeable zones from the beginning of the partition to hold the meta data sections.
Signed-off-by: Damien Le Moal <[email protected]> --- mkfs/f2fs_format.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c index b40cd83..93b5c8f 100644 --- a/mkfs/f2fs_format.c +++ b/mkfs/f2fs_format.c @@ -183,6 +183,13 @@ static int f2fs_prepare_super_block(void) MSG(0, "Info: zone aligned segment0 blkaddr: %u\n", get_sb(segment0_blkaddr)); + if (config.zoned_mode && + get_sb(segment0_blkaddr) % config.zone_blocks) { + MSG(1, "\tError: Unaligned segment0 block address %u\n", + get_sb(segment0_blkaddr)); + return -1; + } + set_sb(segment_count_ckpt, F2FS_NUMBER_OF_CHECKPOINT_PACK); set_sb(sit_blkaddr, get_sb(segment0_blkaddr) + get_sb(segment_count_ckpt) * @@ -267,6 +274,21 @@ static int f2fs_prepare_super_block(void) set_sb(main_blkaddr, get_sb(segment0_blkaddr) + total_meta_zones * config.segs_per_zone * config.blks_per_seg); + if (config.zoned_mode) { + /* + * Make sure there is enough randomly writeable + * space at the beginning of the disk. + */ + unsigned long main_blkzone = get_sb(main_blkaddr) / config.zone_blocks; + + if (config.nr_rnd_zones < main_blkzone) { + MSG(1, "\tError: Device does not have enough random " + "write zones for F2FS volume (%lu needed)", + main_blkzone); + return -1; + } + } + total_zones = get_sb(segment_count) / (config.segs_per_zone) - total_meta_zones; -- 2.7.4 Western Digital Corporation (and its subsidiaries) E-mail Confidentiality Notice & Disclaimer: This e-mail and any files transmitted with it may contain confidential or legally privileged information of WDC and/or its affiliates, and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited. If you have received this e-mail in error, please notify the sender immediately and delete the e-mail in its entirety from your system. ------------------------------------------------------------------------------ The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
