[v3,22/27] btrfs: disallow mixed-bg in HMZONED mode
diff mbox series

Message ID 20190808093038.4163421-23-naohiro.aota@wdc.com
State New
Headers show
  • btrfs zoned block device support
Related show

Commit Message

Naohiro Aota Aug. 8, 2019, 9:30 a.m. UTC
Placing both data and metadata in a block group is impossible in HMZONED
mode. For data, we can allocate a space for it and write it immediately
after the allocation. For metadata, however, we cannot do so, 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.

This commit check and disallow MIXED_BG with HMZONED mode.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
 fs/btrfs/hmzoned.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff mbox series

diff --git a/fs/btrfs/hmzoned.c b/fs/btrfs/hmzoned.c
index 4b13c6c47849..123d9c804c21 100644
--- a/fs/btrfs/hmzoned.c
+++ b/fs/btrfs/hmzoned.c
@@ -235,6 +235,13 @@  int btrfs_check_hmzoned_mode(struct btrfs_fs_info *fs_info)
 		goto out;
+	if (btrfs_fs_incompat(fs_info, MIXED_GROUPS)) {
+		btrfs_err(fs_info,
+			  "HMZONED mode is not allowed for mixed block groups");
+		ret = -EINVAL;
+		goto out;
+	}
 	btrfs_info(fs_info, "HMZONED mode enabled, zone size %llu B",