@@ -79,6 +79,17 @@ struct prepare_device_progress {
int ret;
};
+/*
+ * 2 zones for the primary superblock
+ * 1 zone for the system block group
+ * 1 zone for a metadata block group
+ * 1 zone for a data block group
+ */
+static u64 min_zoned_fs_size(const char *filename)
+{
+ return 5 * zone_size(file);
+}
+
static int create_metadata_block_groups(struct btrfs_root *root, bool mixed,
struct mkfs_allocation *allocation)
{
@@ -1436,17 +1447,11 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
min_dev_size);
goto error;
}
- /*
- * 2 zones for the primary superblock
- * 1 zone for the system block group
- * 1 zone for a metadata block group
- * 1 zone for a data block group
- */
- if (opt_zoned && block_count && block_count < 5 * zone_size(file)) {
+ if (opt_zoned && block_count && block_count < min_zoned_fs_size(file)) {
error("size %llu is too small to make a usable filesystem",
block_count);
error("minimum size for a zoned btrfs filesystem is %llu",
- min_dev_size);
+ min_zoned_fs_size(file));
goto error;
}
While trying to get the ZNS testing running I ran into a problem with making a small file system for one of the tests, but the error output didn't make sense because it said the minimum size was 114294784 bytes, and I was trying to make a file system of size 419430400 bytes. The problem here is that we were spitting out min_dev_size, which isn't the minimum size for the ZNS configuration. Add a helper for calculating the minimum zoned fs size, and use that for the error output. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- mkfs/main.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)