[PATCH 3/5] xfs: add mount options as a way to change the AF layout

zhangshida posted 5 patches 2 weeks, 6 days ago
[PATCH 3/5] xfs: add mount options as a way to change the AF layout
Posted by zhangshida 2 weeks, 6 days ago
From: Shida Zhang <zhangshida@kylinos.cn>

Except for mount options, maybe there are other ways like ioctl()
to pass the layout from user to the filesystem.

Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>
---
 fs/xfs/xfs_super.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 0975ad55557e..09dc44480d16 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -105,7 +105,7 @@ enum {
 	Opt_filestreams, Opt_quota, Opt_noquota, Opt_usrquota, Opt_grpquota,
 	Opt_prjquota, Opt_uquota, Opt_gquota, Opt_pquota,
 	Opt_uqnoenforce, Opt_gqnoenforce, Opt_pqnoenforce, Opt_qnoenforce,
-	Opt_discard, Opt_nodiscard, Opt_dax, Opt_dax_enum,
+	Opt_discard, Opt_nodiscard, Opt_dax, Opt_dax_enum, Opt_af1, Opt_af2,
 };
 
 static const struct fs_parameter_spec xfs_fs_parameters[] = {
@@ -150,6 +150,8 @@ static const struct fs_parameter_spec xfs_fs_parameters[] = {
 	fsparam_flag("nodiscard",	Opt_nodiscard),
 	fsparam_flag("dax",		Opt_dax),
 	fsparam_enum("dax",		Opt_dax_enum, dax_param_enums),
+	fsparam_u32("af1",		Opt_af1),
+	fsparam_u32("af2",		Opt_af2),
 	{}
 };
 
@@ -1396,6 +1398,12 @@ xfs_fs_parse_param(
 		xfs_fs_warn_deprecated(fc, param, XFS_FEAT_NOATTR2, true);
 		parsing_mp->m_features |= XFS_FEAT_NOATTR2;
 		return 0;
+	case Opt_af1:
+		parsing_mp->m_af[0] = result.uint_32;
+		return 0;
+	case Opt_af2:
+		parsing_mp->m_af[1] = result.uint_32;
+		return 0;
 	default:
 		xfs_warn(parsing_mp, "unknown mount option [%s].", param->key);
 		return -EINVAL;
-- 
2.33.0