Skip to content

Commit 6ba0594

Browse files
bbkzzgregkh
authored andcommitted
f2fs: fix to set flush_merge opt and show noflush_merge
[ Upstream commit 967eaad ] Some minor modifications to flush_merge and related parameters: 1.The FLUSH_MERGE opt is set by default only in non-ro mode. 2.When ro and merge are set at the same time, an error is reported. 3.Display noflush_merge mount opt. Suggested-by: Chao Yu <chao@kernel.org> Signed-off-by: Yangtao Li <frank.li@vivo.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Stable-dep-of: 458c15d ("f2fs: don't reset unchangable mount option in f2fs_remount()") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e355972 commit 6ba0594

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

fs/f2fs/super.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,12 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
13471347
return -EINVAL;
13481348
}
13491349

1350+
if ((f2fs_sb_has_readonly(sbi) || f2fs_readonly(sbi->sb)) &&
1351+
test_opt(sbi, FLUSH_MERGE)) {
1352+
f2fs_err(sbi, "FLUSH_MERGE not compatible with readonly mode");
1353+
return -EINVAL;
1354+
}
1355+
13501356
if (f2fs_sb_has_readonly(sbi) && !f2fs_readonly(sbi->sb)) {
13511357
f2fs_err(sbi, "Allow to mount readonly mode only");
13521358
return -EROFS;
@@ -1933,8 +1939,10 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
19331939
seq_puts(seq, ",inline_dentry");
19341940
else
19351941
seq_puts(seq, ",noinline_dentry");
1936-
if (!f2fs_readonly(sbi->sb) && test_opt(sbi, FLUSH_MERGE))
1942+
if (test_opt(sbi, FLUSH_MERGE))
19371943
seq_puts(seq, ",flush_merge");
1944+
else
1945+
seq_puts(seq, ",noflush_merge");
19381946
if (test_opt(sbi, NOBARRIER))
19391947
seq_puts(seq, ",nobarrier");
19401948
if (test_opt(sbi, FASTBOOT))
@@ -2063,7 +2071,8 @@ static void default_options(struct f2fs_sb_info *sbi)
20632071
set_opt(sbi, MERGE_CHECKPOINT);
20642072
F2FS_OPTION(sbi).unusable_cap = 0;
20652073
sbi->sb->s_flags |= SB_LAZYTIME;
2066-
set_opt(sbi, FLUSH_MERGE);
2074+
if (!f2fs_sb_has_readonly(sbi) && !f2fs_readonly(sbi->sb))
2075+
set_opt(sbi, FLUSH_MERGE);
20672076
if (f2fs_hw_support_discard(sbi) || f2fs_hw_should_discard(sbi))
20682077
set_opt(sbi, DISCARD);
20692078
if (f2fs_sb_has_blkzoned(sbi)) {

0 commit comments

Comments
 (0)