From 707f0716e0fde011b0a84edef3fc747b9ab71423 Mon Sep 17 00:00:00 2001 From: Naohiro Aota Date: Mon, 26 Apr 2021 15:27:24 +0900 Subject: [PATCH] btrfs-progs: zoned: disallow mixed-bg in ZONED mode Placing both data and metadata in a block group is impossible in ZONED mode. For data, we can allocate a space for it and write it immediately after the allocation. For metadata, however, we cannot do that, because the logical addresses are recorded in other metadata buffers to build up the trees. As a result, a data buffer can be placed after a metadata buffer, which is not written yet. Writing out the data buffer will break the sequential write rule. Check and disallow MIXED_BG with ZONED mode. Reviewed-by: Johannes Thumshirn Signed-off-by: Naohiro Aota Signed-off-by: David Sterba --- kernel-shared/zoned.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel-shared/zoned.c b/kernel-shared/zoned.c index d4f524d4..6d343bf6 100644 --- a/kernel-shared/zoned.c +++ b/kernel-shared/zoned.c @@ -345,6 +345,12 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info) goto out; } + if (btrfs_fs_incompat(fs_info, MIXED_GROUPS)) { + error("zoned: mixed block groups not supported"); + ret = -EINVAL; + goto out; + } + fs_info->zone_size = zone_size; fs_info->max_zone_append_size = max_zone_append_size;