[RFC v2 13/14] xfs: add an experimental CONFIG_XFS_LBS option

From: Pankaj Raghav (Samsung)
Date: Tue Feb 13 2024 - 04:43:26 EST


From: Pankaj Raghav <p.raghav@xxxxxxxxxxx>

Add an experimental CONFIG_XFS_LBS option to enable LBS support in XFS.
Retain the ASSERT for PAGE_SHIFT if CONFIG_XFS_LBS is not enabled.

Signed-off-by: Pankaj Raghav <p.raghav@xxxxxxxxxxx>
---
fs/xfs/Kconfig | 11 +++++++++++
fs/xfs/xfs_mount.c | 4 +++-
2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/Kconfig b/fs/xfs/Kconfig
index 567fb37274d3..6b0db2f7dc13 100644
--- a/fs/xfs/Kconfig
+++ b/fs/xfs/Kconfig
@@ -216,3 +216,14 @@ config XFS_ASSERT_FATAL
result in warnings.

This behavior can be modified at runtime via sysfs.
+
+config XFS_LBS
+ bool "XFS large block size support (EXPERIMENTAL)"
+ depends on XFS_FS
+ help
+ Set Y to enable support for filesystem block size > system's
+ base page size.
+
+ This feature is considered EXPERIMENTAL. Use with caution!
+
+ If unsure, say N.
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index bfbaaecaf668..596aa2cdefbc 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -131,11 +131,13 @@ xfs_sb_validate_fsb_count(
xfs_sb_t *sbp,
uint64_t nblocks)
{
- ASSERT(PAGE_SHIFT >= sbp->sb_blocklog);
ASSERT(sbp->sb_blocklog >= BBSHIFT);
unsigned long mapping_count;
uint64_t bytes = nblocks << sbp->sb_blocklog;

+ if (!IS_ENABLED(CONFIG_XFS_LBS))
+ ASSERT(PAGE_SHIFT >= sbp->sb_blocklog);
+
mapping_count = bytes >> PAGE_SHIFT;

/* Limited by ULONG_MAX of page cache index */
--
2.43.0