Message ID | 20240514005133.44786-6-naohiro.aota@wdc.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | btrfs-progs: zoned: proper "mkfs.btrfs -b" support | expand |
diff --git a/mkfs/main.c b/mkfs/main.c index a437ecc40c7f..faf397848cc4 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1655,6 +1655,11 @@ int BOX_MAIN(mkfs)(int argc, char **argv) opt_zoned ? "zoned mode " : "", min_dev_size); goto error; } + if (byte_count && opt_zoned && !IS_ALIGNED(byte_count, zone_size(file))) { + error("size %llu is not aligned to zone size %llu", byte_count, + zone_size(file)); + goto error; + } for (i = saved_optind; i < saved_optind + device_count; i++) { char *path;
Creating a btrfs whose size is not aligned to the zone boundary is meaningless and allowing it can confuse users. Disallow creating it. Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> --- mkfs/main.c | 5 +++++ 1 file changed, 5 insertions(+)