Skip to content

Commit f2091cc

Browse files
Hongbo LiJaegeuk Kim
authored andcommitted
f2fs: Add fs parameter specifications for mount options
Use an array of `fs_parameter_spec` called f2fs_param_specs to hold the mount option specifications for the new mount api. Add constant_table structures for several options to facilitate parsing. Signed-off-by: Hongbo Li <[email protected]> [sandeen: forward port, minor fixes and updates, more fsparam_enum] Signed-off-by: Eric Sandeen <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 5661998 commit f2091cc

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed

fs/f2fs/super.c

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/part_stat.h>
2828
#include <linux/zstd.h>
2929
#include <linux/lz4.h>
30+
#include <linux/fs_parser.h>
3031

3132
#include "f2fs.h"
3233
#include "node.h"
@@ -196,9 +197,130 @@ enum {
196197
Opt_age_extent_cache,
197198
Opt_errors,
198199
Opt_nat_bits,
200+
Opt_jqfmt,
201+
Opt_checkpoint,
199202
Opt_err,
200203
};
201204

205+
static const struct constant_table f2fs_param_background_gc[] = {
206+
{"on", BGGC_MODE_ON},
207+
{"off", BGGC_MODE_OFF},
208+
{"sync", BGGC_MODE_SYNC},
209+
{}
210+
};
211+
212+
static const struct constant_table f2fs_param_mode[] = {
213+
{"adaptive", FS_MODE_ADAPTIVE},
214+
{"lfs", FS_MODE_LFS},
215+
{"fragment:segment", FS_MODE_FRAGMENT_SEG},
216+
{"fragment:block", FS_MODE_FRAGMENT_BLK},
217+
{}
218+
};
219+
220+
static const struct constant_table f2fs_param_jqfmt[] = {
221+
{"vfsold", QFMT_VFS_OLD},
222+
{"vfsv0", QFMT_VFS_V0},
223+
{"vfsv1", QFMT_VFS_V1},
224+
{}
225+
};
226+
227+
static const struct constant_table f2fs_param_alloc_mode[] = {
228+
{"default", ALLOC_MODE_DEFAULT},
229+
{"reuse", ALLOC_MODE_REUSE},
230+
{}
231+
};
232+
static const struct constant_table f2fs_param_fsync_mode[] = {
233+
{"posix", FSYNC_MODE_POSIX},
234+
{"strict", FSYNC_MODE_STRICT},
235+
{"nobarrier", FSYNC_MODE_NOBARRIER},
236+
{}
237+
};
238+
239+
static const struct constant_table f2fs_param_compress_mode[] = {
240+
{"fs", COMPR_MODE_FS},
241+
{"user", COMPR_MODE_USER},
242+
{}
243+
};
244+
245+
static const struct constant_table f2fs_param_discard_unit[] = {
246+
{"block", DISCARD_UNIT_BLOCK},
247+
{"segment", DISCARD_UNIT_SEGMENT},
248+
{"section", DISCARD_UNIT_SECTION},
249+
{}
250+
};
251+
252+
static const struct constant_table f2fs_param_memory_mode[] = {
253+
{"normal", MEMORY_MODE_NORMAL},
254+
{"low", MEMORY_MODE_LOW},
255+
{}
256+
};
257+
258+
static const struct constant_table f2fs_param_errors[] = {
259+
{"remount-ro", MOUNT_ERRORS_READONLY},
260+
{"continue", MOUNT_ERRORS_CONTINUE},
261+
{"panic", MOUNT_ERRORS_PANIC},
262+
{}
263+
};
264+
265+
static const struct fs_parameter_spec f2fs_param_specs[] = {
266+
fsparam_enum("background_gc", Opt_gc_background, f2fs_param_background_gc),
267+
fsparam_flag("disable_roll_forward", Opt_disable_roll_forward),
268+
fsparam_flag("norecovery", Opt_norecovery),
269+
fsparam_flag_no("discard", Opt_discard),
270+
fsparam_flag("no_heap", Opt_noheap),
271+
fsparam_flag("heap", Opt_heap),
272+
fsparam_flag_no("user_xattr", Opt_user_xattr),
273+
fsparam_flag_no("acl", Opt_acl),
274+
fsparam_s32("active_logs", Opt_active_logs),
275+
fsparam_flag("disable_ext_identify", Opt_disable_ext_identify),
276+
fsparam_flag_no("inline_xattr", Opt_inline_xattr),
277+
fsparam_s32("inline_xattr_size", Opt_inline_xattr_size),
278+
fsparam_flag_no("inline_data", Opt_inline_data),
279+
fsparam_flag_no("inline_dentry", Opt_inline_dentry),
280+
fsparam_flag_no("flush_merge", Opt_flush_merge),
281+
fsparam_flag_no("barrier", Opt_barrier),
282+
fsparam_flag("fastboot", Opt_fastboot),
283+
fsparam_flag_no("extent_cache", Opt_extent_cache),
284+
fsparam_flag("data_flush", Opt_data_flush),
285+
fsparam_u32("reserve_root", Opt_reserve_root),
286+
fsparam_gid("resgid", Opt_resgid),
287+
fsparam_uid("resuid", Opt_resuid),
288+
fsparam_enum("mode", Opt_mode, f2fs_param_mode),
289+
fsparam_s32("fault_injection", Opt_fault_injection),
290+
fsparam_u32("fault_type", Opt_fault_type),
291+
fsparam_flag_no("lazytime", Opt_lazytime),
292+
fsparam_flag_no("quota", Opt_quota),
293+
fsparam_flag("usrquota", Opt_usrquota),
294+
fsparam_flag("grpquota", Opt_grpquota),
295+
fsparam_flag("prjquota", Opt_prjquota),
296+
fsparam_string_empty("usrjquota", Opt_usrjquota),
297+
fsparam_string_empty("grpjquota", Opt_grpjquota),
298+
fsparam_string_empty("prjjquota", Opt_prjjquota),
299+
fsparam_flag("nat_bits", Opt_nat_bits),
300+
fsparam_enum("jqfmt", Opt_jqfmt, f2fs_param_jqfmt),
301+
fsparam_enum("alloc_mode", Opt_alloc, f2fs_param_alloc_mode),
302+
fsparam_enum("fsync_mode", Opt_fsync, f2fs_param_fsync_mode),
303+
fsparam_string("test_dummy_encryption", Opt_test_dummy_encryption),
304+
fsparam_flag("test_dummy_encryption", Opt_test_dummy_encryption),
305+
fsparam_flag("inlinecrypt", Opt_inlinecrypt),
306+
fsparam_string("checkpoint", Opt_checkpoint),
307+
fsparam_flag_no("checkpoint_merge", Opt_checkpoint_merge),
308+
fsparam_string("compress_algorithm", Opt_compress_algorithm),
309+
fsparam_u32("compress_log_size", Opt_compress_log_size),
310+
fsparam_string("compress_extension", Opt_compress_extension),
311+
fsparam_string("nocompress_extension", Opt_nocompress_extension),
312+
fsparam_flag("compress_chksum", Opt_compress_chksum),
313+
fsparam_enum("compress_mode", Opt_compress_mode, f2fs_param_compress_mode),
314+
fsparam_flag("compress_cache", Opt_compress_cache),
315+
fsparam_flag("atgc", Opt_atgc),
316+
fsparam_flag_no("gc_merge", Opt_gc_merge),
317+
fsparam_enum("discard_unit", Opt_discard_unit, f2fs_param_discard_unit),
318+
fsparam_enum("memory", Opt_memory_mode, f2fs_param_memory_mode),
319+
fsparam_flag("age_extent_cache", Opt_age_extent_cache),
320+
fsparam_enum("errors", Opt_errors, f2fs_param_errors),
321+
{}
322+
};
323+
202324
static match_table_t f2fs_tokens = {
203325
{Opt_gc_background, "background_gc=%s"},
204326
{Opt_disable_roll_forward, "disable_roll_forward"},

0 commit comments

Comments
 (0)