@@ -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);
@@ -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 feature are incompatible");
+ exit(1);
+ }
+
+ if (features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) {
+ error("cannot enable mixed-bg with zoned feature");
+ exit(1);
+ }
+
+ if (features & BTRFS_FEATURE_INCOMPAT_RAID56) {
+ error("cannot enable RAID5/6 with zoned feature");
+ 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 on zoned mode");
+ goto error;
+ }
+
dev_cnt--;
/*
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> --- mkfs/common.c | 5 ++++- mkfs/main.c | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-)