btrfs: disable bs > ps support if no transparent hugepage support

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: 98077f7f21 ("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>
This commit is contained in:
Qu Wenruo
2026-07-30 16:37:39 +09:30
committed by David Sterba
parent d2a4e4e626
commit 4c375ac546
2 changed files with 12 additions and 3 deletions

View 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

View 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;