From nobody Thu Apr 9 12:47:26 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 101DD14A8E for ; Mon, 9 Mar 2026 02:33:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773023595; cv=none; b=Ag+fYCKNU8PF10AJHES70f6sAzd6t33qTRadXbaQE7aTmAxFO69pfbFmXBtZRmKNFiGBliTnOvw0faGd/kSHJ71gCflDhgKoCakhosIhVuVn81mdUgX3krEoOnnTRt7FN1gQLCNJI0fla0zgeQR2ps4Dwswtr4A4ZEeyoqfzoYI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773023595; c=relaxed/simple; bh=UHRXakrTsc1OnCQv6OjdV+IhrIi1MUaKGJuHYt9KXeQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=utkrL63+lXLgZGZXi7hnA8r4nFdT0YgEK0OFh/NV1GubxsyATJGU8XXnHHQ0vniStNqbQarxQM/gWytAgfiZmWTq3NZzInqxMZdkLdSuRxQhTahQ0fbguMiSNrisnUiMKqJV1N8cDkdFZrvXzHxW+8mDzDE78y1OSLqYhYCZmwg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XFcW3XHB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XFcW3XHB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4815CC116C6; Mon, 9 Mar 2026 02:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773023594; bh=UHRXakrTsc1OnCQv6OjdV+IhrIi1MUaKGJuHYt9KXeQ=; h=From:To:Cc:Subject:Date:From; b=XFcW3XHBvVitVs7wcNZ8765c72X8hjCd4D5CzQ8WC3T746MqJmVcsCtmfUd33VqLv 229Pqj3TQOGPpxJ8QXHfXm/IxFwQge1Q/qeuHdRunZxT3yFNkHSwcAtAxOlvJHm3c0 dw3dwKyurfPEB42cXSemghcQnh9TjdL6qlC3ndg3CXqDb6lRFVaFk3KoQPo/yiawaK sDbm3mzVyq45k44Jq1IuB49ipYjyBshejPimx0L/OL9bOaIfPn5l5fwwO/SwAsjP8c ciljk3QR06ekuRJgrk7bHeGZKL30xhowx9KU4uZXSRfSH3x/lx1TxcCF/oSlgtkm/e bNPLTGnLq2zQw== From: Chao Yu To: xiang@kernel.org Cc: linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, Yue Hu , Jeffle Xu , Sandeep Dhavale , Chunhai Guo , Hongbo Li , Chao Yu Subject: [PATCH] erofs: introduce nolargefolio mount option Date: Mon, 9 Mar 2026 02:30:53 +0000 Message-ID: <20260309023053.1685839-1-chao@kernel.org> X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This patch introduces a new mount option 'nolargefolio' for EROFS. When this option is specified, large folio will be disabled by default for all inodes, this option can be used for environments where large folio resources are limited, it's necessary to only let specified user to allocate large folios on demand. Signed-off-by: Chao Yu --- Documentation/filesystems/erofs.rst | 1 + fs/erofs/inode.c | 3 ++- fs/erofs/internal.h | 1 + fs/erofs/super.c | 8 +++++++- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Documentation/filesystems/erofs.rst b/Documentation/filesystem= s/erofs.rst index fe06308e546c..d692a1d9f32c 100644 --- a/Documentation/filesystems/erofs.rst +++ b/Documentation/filesystems/erofs.rst @@ -137,6 +137,7 @@ fsoffset=3D%llu Specify block-aligned filesyst= em offset for the primary d inode_share Enable inode page sharing for this filesystem. Ino= des with identical content within the same domain ID can sha= re the page cache. +nolargefolio Disable large folio support for all files. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D =20 Sysfs Entries diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c index 4b3d21402e10..26361e86a354 100644 --- a/fs/erofs/inode.c +++ b/fs/erofs/inode.c @@ -254,7 +254,8 @@ static int erofs_fill_inode(struct inode *inode) return 0; } =20 - mapping_set_large_folios(inode->i_mapping); + if (!test_opt(&EROFS_SB(inode->i_sb)->opt, NO_LARGE_FOLIO)) + mapping_set_large_folios(inode->i_mapping); aops =3D erofs_get_aops(inode, false); if (IS_ERR(aops)) return PTR_ERR(aops); diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index a4f0a42cf8c3..b5d98410c699 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -177,6 +177,7 @@ struct erofs_sb_info { #define EROFS_MOUNT_DAX_NEVER 0x00000080 #define EROFS_MOUNT_DIRECT_IO 0x00000100 #define EROFS_MOUNT_INODE_SHARE 0x00000200 +#define EROFS_MOUNT_NO_LARGE_FOLIO 0x00000400 =20 #define clear_opt(opt, option) ((opt)->mount_opt &=3D ~EROFS_MOUNT_##optio= n) #define set_opt(opt, option) ((opt)->mount_opt |=3D EROFS_MOUNT_##option) diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 972a0c82198d..a353369d4db8 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -390,7 +390,7 @@ static void erofs_default_options(struct erofs_sb_info = *sbi) enum { Opt_user_xattr, Opt_acl, Opt_cache_strategy, Opt_dax, Opt_dax_enum, Opt_device, Opt_fsid, Opt_domain_id, Opt_directio, Opt_fsoffset, - Opt_inode_share, + Opt_inode_share, Opt_nolargefolio, }; =20 static const struct constant_table erofs_param_cache_strategy[] =3D { @@ -419,6 +419,7 @@ static const struct fs_parameter_spec erofs_fs_paramete= rs[] =3D { fsparam_flag_no("directio", Opt_directio), fsparam_u64("fsoffset", Opt_fsoffset), fsparam_flag("inode_share", Opt_inode_share), + fsparam_flag("nolargefolio", Opt_nolargefolio), {} }; =20 @@ -541,6 +542,9 @@ static int erofs_fc_parse_param(struct fs_context *fc, else set_opt(&sbi->opt, INODE_SHARE); break; + case Opt_nolargefolio: + set_opt(&sbi->opt, NO_LARGE_FOLIO); + break; } return 0; } @@ -1105,6 +1109,8 @@ static int erofs_show_options(struct seq_file *seq, s= truct dentry *root) seq_printf(seq, ",fsoffset=3D%llu", sbi->dif0.fsoff); if (test_opt(opt, INODE_SHARE)) seq_puts(seq, ",inode_share"); + if (test_opt(opt, NO_LARGE_FOLIO)) + seq_puts(seq, ",nolargefolio"); return 0; } =20 --=20 2.49.0