diff mbox series

[f2fs-dev,5/9] f2fs: make LAZYTIME a mount option flag

Message ID 20250303172127.298602-6-sandeen@redhat.com (mailing list archive)
State New
Headers show
Series f2fs: first steps towards mount API conversion | expand

Commit Message

Eric Sandeen March 3, 2025, 5:12 p.m. UTC
Set LAZYTIME into sbi during parsing, and transfer it to the sb in
fill_super, so that an sb is not required during option parsing.

(Note: While lazytime is normally handled via mount flag in the vfs,
some f2fs users do expect to be able to use it as an explicit mount
option string via the mount syscall, so this option must remain.)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 fs/f2fs/f2fs.h  |  5 +++++
 fs/f2fs/super.c | 11 ++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

Comments

Chao Yu March 12, 2025, 3:30 a.m. UTC | #1
On 3/4/25 01:12, Eric Sandeen wrote:
> Set LAZYTIME into sbi during parsing, and transfer it to the sb in
> fill_super, so that an sb is not required during option parsing.
> 
> (Note: While lazytime is normally handled via mount flag in the vfs,
> some f2fs users do expect to be able to use it as an explicit mount
> option string via the mount syscall, so this option must remain.)
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,
diff mbox series

Patch

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 15e4f5a77eb5..5c83e3a558f9 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -115,6 +115,11 @@  extern const char *f2fs_fault_name[FAULT_MAX];
 #define F2FS_MOUNT_COMPRESS_CACHE	0x04000000
 #define F2FS_MOUNT_AGE_EXTENT_CACHE	0x08000000
 #define F2FS_MOUNT_INLINECRYPT		0x10000000
+/*
+ * Some f2fs environments expect to be able to pass the "lazytime" option
+ * string rather than using the MS_LAZYTIME flag, so this must remain.
+ */
+#define F2FS_MOUNT_LAZYTIME		0x20000000
 
 #define F2FS_OPTION(sbi)	((sbi)->mount_opt)
 #define clear_opt(sbi, option)	(F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 643d19bbc156..e63b3bd75f85 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -917,10 +917,10 @@  static int parse_options(struct super_block *sb, char *options, bool is_remount)
 			break;
 #endif
 		case Opt_lazytime:
-			sb->s_flags |= SB_LAZYTIME;
+			set_opt(sbi, LAZYTIME);
 			break;
 		case Opt_nolazytime:
-			sb->s_flags &= ~SB_LAZYTIME;
+			clear_opt(sbi, LAZYTIME);
 			break;
 #ifdef CONFIG_QUOTA
 		case Opt_quota:
@@ -2169,8 +2169,8 @@  static void default_options(struct f2fs_sb_info *sbi, bool remount)
 	set_opt(sbi, INLINE_DATA);
 	set_opt(sbi, INLINE_DENTRY);
 	set_opt(sbi, MERGE_CHECKPOINT);
+	set_opt(sbi, LAZYTIME);
 	F2FS_OPTION(sbi).unusable_cap = 0;
-	sbi->sb->s_flags |= SB_LAZYTIME;
 	if (!f2fs_is_readonly(sbi))
 		set_opt(sbi, FLUSH_MERGE);
 	if (f2fs_sb_has_blkzoned(sbi))
@@ -4538,6 +4538,11 @@  static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 	if (test_opt(sbi, INLINECRYPT))
 		sb->s_flags |= SB_INLINECRYPT;
 
+	if (test_opt(sbi, LAZYTIME))
+		sb->s_flags |= SB_LAZYTIME;
+	else
+		sb->s_flags &= ~SB_LAZYTIME;
+
 	super_set_uuid(sb, (void *) raw_super->uuid, sizeof(raw_super->uuid));
 	super_set_sysfs_name_bdev(sb);
 	sb->s_iflags |= SB_I_CGROUPWB;