Skip to content

Commit d595df2

Browse files
Jaegeuk Kimpundiramit
authored andcommitted
f2fs: get io size bit from mount option
commit ec91538dccd44329ad83d3aae1aa6a8389b5c75f upstream. This patch adds to set io_size_bits from mount option. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent caa5a4a commit d595df2

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

Documentation/filesystems/f2fs.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ data_flush Enable data flushing before checkpoint in order to
157157
mode=%s Control block allocation mode which supports "adaptive"
158158
and "lfs". In "lfs" mode, there should be no random
159159
writes towards main area.
160+
io_bits=%u Set the bit size of write IO requests. It should be set
161+
with "mode=lfs".
160162

161163
================================================================================
162164
DEBUGFS ENTRIES

fs/f2fs/super.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ enum {
101101
Opt_noinline_data,
102102
Opt_data_flush,
103103
Opt_mode,
104+
Opt_io_size_bits,
104105
Opt_fault_injection,
105106
Opt_lazytime,
106107
Opt_nolazytime,
@@ -133,6 +134,7 @@ static match_table_t f2fs_tokens = {
133134
{Opt_noinline_data, "noinline_data"},
134135
{Opt_data_flush, "data_flush"},
135136
{Opt_mode, "mode=%s"},
137+
{Opt_io_size_bits, "io_bits=%u"},
136138
{Opt_fault_injection, "fault_injection=%u"},
137139
{Opt_lazytime, "lazytime"},
138140
{Opt_nolazytime, "nolazytime"},
@@ -535,6 +537,17 @@ static int parse_options(struct super_block *sb, char *options)
535537
}
536538
kfree(name);
537539
break;
540+
case Opt_io_size_bits:
541+
if (args->from && match_int(args, &arg))
542+
return -EINVAL;
543+
if (arg > __ilog2_u32(BIO_MAX_PAGES)) {
544+
f2fs_msg(sb, KERN_WARNING,
545+
"Not support %d, larger than %d",
546+
1 << arg, BIO_MAX_PAGES);
547+
return -EINVAL;
548+
}
549+
sbi->write_io_size_bits = arg;
550+
break;
538551
case Opt_fault_injection:
539552
if (args->from && match_int(args, &arg))
540553
return -EINVAL;
@@ -558,6 +571,13 @@ static int parse_options(struct super_block *sb, char *options)
558571
return -EINVAL;
559572
}
560573
}
574+
575+
if (F2FS_IO_SIZE_BITS(sbi) && !test_opt(sbi, LFS)) {
576+
f2fs_msg(sb, KERN_ERR,
577+
"Should set mode=lfs with %uKB-sized IO",
578+
F2FS_IO_SIZE_KB(sbi));
579+
return -EINVAL;
580+
}
561581
return 0;
562582
}
563583

@@ -918,6 +938,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
918938
else if (test_opt(sbi, LFS))
919939
seq_puts(seq, "lfs");
920940
seq_printf(seq, ",active_logs=%u", sbi->active_logs);
941+
if (F2FS_IO_SIZE_BITS(sbi))
942+
seq_printf(seq, ",io_size=%uKB", F2FS_IO_SIZE_KB(sbi));
921943

922944
return 0;
923945
}

0 commit comments

Comments
 (0)