On Wed, Dec 04, 2019 at 05:17:12PM +0900, Naohiro Aota wrote: [...] > diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c > index 616f5abec267..d411574298f4 100644 > --- a/fs/btrfs/super.c > +++ b/fs/btrfs/super.c > @@ -442,8 +442,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, > cache_gen = btrfs_super_cache_generation(info->super_copy); > if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE)) > btrfs_set_opt(info->mount_opt, FREE_SPACE_TREE); > - else if (cache_gen) > - btrfs_set_opt(info->mount_opt, SPACE_CACHE); > + else if (cache_gen) { > + if (btrfs_fs_incompat(info, HMZONED)) > + WARN_ON(1); > + else > + btrfs_set_opt(info->mount_opt, SPACE_CACHE); > + } I would probably write this as follows: else if (cache_gen) if (!WARN_ON(btrfs_fs_incompat(info, HMZONED))) btrfs_set_opt(info->mount_opt, SPACE_CACHE);