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

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

Commit Message

Naohiro Aota Aug. 23, 2019, 10:10 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 bfc95a0443d0..871befbbb23b 100644
--- a/fs/btrfs/hmzoned.c
+++ b/fs/btrfs/hmzoned.c
@@ -232,6 +232,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",