btrfs-progs: mkfs: do not set zone size on non-zoned mode

Since zone_size() returns an emulated zone size even for non-zoned
device, we cannot use cfg.zone_size to determine the device is zoned or
not. Set zone_size = 0 on non-zoned mode.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Naohiro Aota 2021-10-05 15:22:59 +09:00 committed by David Sterba
parent b2dc5d0037
commit c9c36aaf5b

View File

@ -1357,7 +1357,10 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
mkfs_cfg.features = features;
mkfs_cfg.runtime_features = runtime_features;
mkfs_cfg.csum_type = csum_type;
mkfs_cfg.zone_size = zone_size(file);
if (zoned)
mkfs_cfg.zone_size = zone_size(file);
else
mkfs_cfg.zone_size = 0;
ret = make_btrfs(fd, &mkfs_cfg);
if (ret) {