Skip to content

Commit 9100adf

Browse files
Eric SandeenJaegeuk Kim
authored andcommitted
f2fs: make LAZYTIME a mount option flag
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> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 7d6ee50 commit 9100adf

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

fs/f2fs/f2fs.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ extern const char *f2fs_fault_name[FAULT_MAX];
117117
#define F2FS_MOUNT_AGE_EXTENT_CACHE 0x08000000
118118
#define F2FS_MOUNT_NAT_BITS 0x10000000
119119
#define F2FS_MOUNT_INLINECRYPT 0x20000000
120+
/*
121+
* Some f2fs environments expect to be able to pass the "lazytime" option
122+
* string rather than using the MS_LAZYTIME flag, so this must remain.
123+
*/
124+
#define F2FS_MOUNT_LAZYTIME 0x40000000
120125

121126
#define F2FS_OPTION(sbi) ((sbi)->mount_opt)
122127
#define clear_opt(sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option)

fs/f2fs/super.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -920,10 +920,10 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
920920
break;
921921
#endif
922922
case Opt_lazytime:
923-
sb->s_flags |= SB_LAZYTIME;
923+
set_opt(sbi, LAZYTIME);
924924
break;
925925
case Opt_nolazytime:
926-
sb->s_flags &= ~SB_LAZYTIME;
926+
clear_opt(sbi, LAZYTIME);
927927
break;
928928
#ifdef CONFIG_QUOTA
929929
case Opt_quota:
@@ -2186,8 +2186,8 @@ static void default_options(struct f2fs_sb_info *sbi, bool remount)
21862186
set_opt(sbi, INLINE_DATA);
21872187
set_opt(sbi, INLINE_DENTRY);
21882188
set_opt(sbi, MERGE_CHECKPOINT);
2189+
set_opt(sbi, LAZYTIME);
21892190
F2FS_OPTION(sbi).unusable_cap = 0;
2190-
sbi->sb->s_flags |= SB_LAZYTIME;
21912191
if (!f2fs_is_readonly(sbi))
21922192
set_opt(sbi, FLUSH_MERGE);
21932193
if (f2fs_sb_has_blkzoned(sbi))
@@ -4588,6 +4588,11 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
45884588
if (test_opt(sbi, INLINECRYPT))
45894589
sb->s_flags |= SB_INLINECRYPT;
45904590

4591+
if (test_opt(sbi, LAZYTIME))
4592+
sb->s_flags |= SB_LAZYTIME;
4593+
else
4594+
sb->s_flags &= ~SB_LAZYTIME;
4595+
45914596
super_set_uuid(sb, (void *) raw_super->uuid, sizeof(raw_super->uuid));
45924597
super_set_sysfs_name_bdev(sb);
45934598
sb->s_iflags |= SB_I_CGROUPWB;

0 commit comments

Comments
 (0)