Extent buffers for tree-log tree are allocated scattered between other
metadata's extent buffers, and btrfs_sync_log() writes out only the
tree-log buffers. This behavior breaks sequential writing rule, which is
mandatory in sequential required zones.
Actually, we don't have much benefit using tree-logging with HMZONED mode,
until we can allocate tree-log buffer sequentially. So, disable tree-log
entirely in HMZONED mode.
Signed-off-by: Naohiro Aota <naohiro.aota@xxxxxxx>
---
fs/btrfs/hmzoned.c | 6 ++++++
fs/btrfs/super.c | 4 ++++
2 files changed, 10 insertions(+)
diff --git a/fs/btrfs/hmzoned.c b/fs/btrfs/hmzoned.c
index 0770b1f58bd9..e07e76af1e82 100644
--- a/fs/btrfs/hmzoned.c
+++ b/fs/btrfs/hmzoned.c
@@ -256,5 +256,11 @@ int btrfs_check_mountopts_hmzoned(struct btrfs_fs_info *info)
return -EINVAL;
}
+ if (!btrfs_test_opt(info, NOTREELOG)) {
+ btrfs_err(info,
+ "cannot enable tree log with HMZONED mode");
+ return -EINVAL;
+ }
+
return 0;
}
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 496d8b74f9a2..396238e099bc 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -447,6 +447,10 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
btrfs_set_opt(info->mount_opt, SPACE_CACHE);
}
+ if (btrfs_fs_incompat(info, HMZONED))
+ btrfs_set_and_info(info, NOTREELOG,
+ "disabling tree log with HMZONED mode");
+
/*
* Even the options are empty, we still need to do extra check
* against new flags
--
2.22.0