Merge tag 'for-5.18-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
[linux-block.git] / fs / btrfs / disk-io.c
index ed8e288cc3694117bef9cb6ed8dfdb3dd4abab79..31c3f592e5875ec8f10279e1c6a3a0b65e627dd4 100644 (file)
@@ -3658,6 +3658,17 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
        if (sectorsize < PAGE_SIZE) {
                struct btrfs_subpage_info *subpage_info;
 
+               /*
+                * V1 space cache has some hardcoded PAGE_SIZE usage, and is
+                * going to be deprecated.
+                *
+                * Force to use v2 cache for subpage case.
+                */
+               btrfs_clear_opt(fs_info->mount_opt, SPACE_CACHE);
+               btrfs_set_and_info(fs_info, FREE_SPACE_TREE,
+                       "forcing free space tree for sector size %u with page size %lu",
+                       sectorsize, PAGE_SIZE);
+
                btrfs_warn(fs_info,
                "read-write for sector size %u with page size %lu is experimental",
                           sectorsize, PAGE_SIZE);