diff options
author | Eric Sandeen <sandeen@sandeen.net> | 2025-03-03 20:12:13 +0300 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2025-03-13 21:16:06 +0300 |
commit | abd0e040e9a516fe1205d12ee33e1778ec546941 (patch) | |
tree | d583d40c55ccc9816da3fdf9e5c0d401e764e20c | |
parent | 277352b6cbeda5c0976e56d25e3fcd775db96305 (diff) | |
download | linux-abd0e040e9a516fe1205d12ee33e1778ec546941.tar.xz |
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>
-rw-r--r-- | fs/f2fs/super.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 1d48900d8cd3..bdce7940fe20 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -690,7 +690,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) int ret; if (!options) - goto default_check; + return 0; while ((p = strsep(&options, ",")) != NULL) { int token; @@ -1324,7 +1324,11 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) return -EINVAL; } } -default_check: + return 0; +} + +static int f2fs_default_check(struct f2fs_sb_info *sbi) +{ #ifdef CONFIG_QUOTA if (f2fs_check_quota_options(sbi)) return -EINVAL; @@ -2384,6 +2388,10 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) } #endif + err = f2fs_default_check(sbi); + if (err) + goto restore_opts; + /* flush outstanding errors before changing fs state */ flush_work(&sbi->s_error_work); @@ -4539,6 +4547,10 @@ try_onemore: if (err) goto free_options; + err = f2fs_default_check(sbi); + if (err) + goto free_options; + sb->s_maxbytes = max_file_blocks(NULL) << le32_to_cpu(raw_super->log_blocksize); sb->s_max_links = F2FS_LINK_MAX; |