[PATCH] btrfs: disable bs > ps support if no transparent hugepage support
Qu Wenruo <[email protected]> Thu, 30 Jul 2026 16:37:39 +0930
| Newsgroups | org.kernel.vger.linux-btrfs |
|---|---|
| Message-ID | <7a79cac71ca43f63cdcf21ee9bba95be05f16230.1785395252.git.wqu@suse.com> |
Btrfs relies one mapping_set_folio_order_range() to set the minimal
folio order for all its data inodes, but that function will be nop 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")
Signed-off-by: Qu Wenruo <[email protected]>
---
fs/btrfs/Kconfig | 3 ++-
fs/btrfs/fs.c | 6 +++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/Kconfig b/fs/btrfs/Kconfig
index 9de04c37e11a..4b10d78ed99b 100644
--- a/fs/btrfs/Kconfig
+++ b/fs/btrfs/Kconfig
@@ -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
diff --git a/fs/btrfs/fs.c b/fs/btrfs/fs.c
index 5015d0148841..77544ee5e6db 100644
--- a/fs/btrfs/fs.c
+++ b/fs/btrfs/fs.c
@@ -155,8 +155,12 @@ 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)
+ if (blocksize > PAGE_SIZE &&
+ (IS_ENABLED(CONFIG_HIGHMEM) || !IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)))
return false;
return true;
#endif
--
2.54.0