btrfs: disable bs > ps support if no transparent hugepage support
authorQu Wenruo <wqu@suse.com>
Thu, 30 Jul 2026 07:07:39 +0000 (16:37 +0930)
committerDavid Sterba <dsterba@suse.com>
Fri, 31 Jul 2026 14:55:50 +0000 (16:55 +0200)
Btrfs relies on mapping_set_folio_order_range() to set the minimal
folio order for all its data inodes, but that function will be no-op if
transparent hugepage is not enabled.

Guard the bs > ps support behind CONFIG_TRANSPARENT_HUGEPAGE, just like
all other filesystems.

Fixes: 98077f7f2180 ("btrfs: enable experimental bs > ps support")
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/Kconfig
fs/btrfs/fs.c

index 9de04c3..4b10d78 100644 (file)
@@ -106,7 +106,8 @@ config BTRFS_EXPERIMENTAL
 
          - extent tree v2 - complex rework of extent tracking
 
-         - block size > page size support
+         - block size > page size support - needs transparent huge page and
+                                            non-HIGHMEM system
 
          - huge folios for data - folios can be as large as 2MiB now
 
index 14d8356..dcf1297 100644 (file)
@@ -166,9 +166,17 @@ bool __attribute_const__ btrfs_supported_blocksize(u32 blocksize)
         *
         * Considering HIGHMEM is such a pain to deal with and it's going
         * to be deprecated eventually, just reject HIGHMEM && bs > ps cases.
+        *
+        * Finally, for bs > ps cases, we need to set the minimal folio order,
+        * which requires transparent hugepage.
         */
-       if (IS_ENABLED(CONFIG_HIGHMEM) && blocksize > PAGE_SIZE)
-               return false;
+       if (blocksize > PAGE_SIZE) {
+               if (IS_ENABLED(CONFIG_HIGHMEM))
+                       return false;
+
+               if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
+                       return false;
+       }
        return true;
 #endif
        return false;