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 edddf52d2c5e..4e4e727302d4 100644 --- a/fs/btrfs/hmzoned.c +++ b/fs/btrfs/hmzoned.c @@ -253,5 +253,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.23.0