Skip to content

Commit abd0e04

Browse files
sandeenJaegeuk Kim
authored andcommitted
f2fs: factor out an f2fs_default_check function
The current options parsing function both parses options and validates them - factor the validation out to reduce the size of the function and make transition to the new mount API possible, because under the new mount API, options are parsed one at a time, and cannot all be tested at the end of the parsing function. 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 277352b commit abd0e04

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

fs/f2fs/super.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
690690
int ret;
691691

692692
if (!options)
693-
goto default_check;
693+
return 0;
694694

695695
while ((p = strsep(&options, ",")) != NULL) {
696696
int token;
@@ -1324,7 +1324,11 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
13241324
return -EINVAL;
13251325
}
13261326
}
1327-
default_check:
1327+
return 0;
1328+
}
1329+
1330+
static int f2fs_default_check(struct f2fs_sb_info *sbi)
1331+
{
13281332
#ifdef CONFIG_QUOTA
13291333
if (f2fs_check_quota_options(sbi))
13301334
return -EINVAL;
@@ -2384,6 +2388,10 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
23842388
}
23852389
#endif
23862390

2391+
err = f2fs_default_check(sbi);
2392+
if (err)
2393+
goto restore_opts;
2394+
23872395
/* flush outstanding errors before changing fs state */
23882396
flush_work(&sbi->s_error_work);
23892397

@@ -4539,6 +4547,10 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
45394547
if (err)
45404548
goto free_options;
45414549

4550+
err = f2fs_default_check(sbi);
4551+
if (err)
4552+
goto free_options;
4553+
45424554
sb->s_maxbytes = max_file_blocks(NULL) <<
45434555
le32_to_cpu(raw_super->log_blocksize);
45444556
sb->s_max_links = F2FS_LINK_MAX;

0 commit comments

Comments
 (0)