btrfs-progs: mkfs: zoned: check incompatible features with zoned btrfs

This commit disables some features which are incompatible with zoned btrfs.

RAID/DUP is disabled because we cannot handle two zone append writes to
different zones in the kernel. MIXED_BG is disabled because the allocated
metadata region will be write holes for data writes. Space-cache (v1)
require in-place updatings.

It also disables the "--rootdir" option for now. The copying from a
directory needs some tweaks for zoned btrfs (e.g. zone size aware space
calculation), and we do not implement them yet.

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-04-26 15:27:37 +09:00 committed by David Sterba
parent 39a855f1d0
commit efc6b5126a
2 changed files with 27 additions and 1 deletions

View file

@ -204,7 +204,10 @@ int make_btrfs(int fd, struct btrfs_mkfs_config *cfg)
btrfs_set_super_stripesize(&super, cfg->stripesize);
btrfs_set_super_csum_type(&super, cfg->csum_type);
btrfs_set_super_chunk_root_generation(&super, 1);
btrfs_set_super_cache_generation(&super, -1);
if (cfg->features & BTRFS_FEATURE_INCOMPAT_ZONED)
btrfs_set_super_cache_generation(&super, 0);
else
btrfs_set_super_cache_generation(&super, -1);
btrfs_set_super_incompat_flags(&super, cfg->features);
if (cfg->label)
__strncpy_null(super.label, cfg->label, BTRFS_LABEL_SIZE - 1);

View file

@ -1191,6 +1191,23 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
features |= BTRFS_FEATURE_INCOMPAT_RAID1C34;
}
if (zoned) {
if (source_dir_set) {
error("the option -r and zoned mode are incompatible");
exit(1);
}
if (features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) {
error("cannot enable mixed-bg in zoned mode");
exit(1);
}
if (features & BTRFS_FEATURE_INCOMPAT_RAID56) {
error("cannot enable RAID5/6 in zoned mode");
exit(1);
}
}
if (btrfs_check_nodesize(nodesize, sectorsize,
features))
goto error;
@ -1280,6 +1297,12 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
if (ret)
goto error;
if (zoned && ((metadata_profile | data_profile) &
BTRFS_BLOCK_GROUP_PROFILE_MASK)) {
error("cannot use RAID/DUP profile in zoned mode");
goto error;
}
dev_cnt--;
/*