xfs: disable large folios except for developers

Disable multi-page folios by default until we figure out why data
corruption keeps happening.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
diff --git a/fs/xfs/Kconfig b/fs/xfs/Kconfig
index 9fac5ea..8618ad0 100644
--- a/fs/xfs/Kconfig
+++ b/fs/xfs/Kconfig
@@ -166,3 +166,14 @@
 	  result in warnings.
 
 	  This behavior can be modified at runtime via sysfs.
+
+config XFS_LARGE_FOLIOS
+	bool "XFS large folios support"
+	default n
+	depends on XFS_FS && XFS_DEBUG
+	help
+	  Say Y here to get an XFS build that enables multi-page folios in
+	  the page cache.  This option is hidden by default due to unresolved
+	  file data corruption problems.
+
+	  Say N unless you are an XFS or mm developer.
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index e3b2304..977eceb 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -88,7 +88,9 @@ xfs_inode_alloc(
 	/* VFS doesn't initialise i_mode or i_state! */
 	VFS_I(ip)->i_mode = 0;
 	VFS_I(ip)->i_state = 0;
+#ifdef CONFIG_XFS_LARGE_FOLIOS
 	mapping_set_large_folios(VFS_I(ip)->i_mapping);
+#endif
 
 	XFS_STATS_INC(mp, vn_active);
 	ASSERT(atomic_read(&ip->i_pincount) == 0);
@@ -323,7 +325,9 @@ xfs_reinit_inode(
 	inode->i_rdev = dev;
 	inode->i_uid = uid;
 	inode->i_gid = gid;
+#ifdef CONFIG_XFS_LARGE_FOLIOS
 	mapping_set_large_folios(inode->i_mapping);
+#endif
 	return error;
 }