@@ -41,6 +41,8 @@
#define CREATE_TRACE_POINTS
#include <trace/events/f2fs.h>
+static int f2fs_validate_options(struct super_block *sb);
+
static struct kmem_cache *f2fs_inode_cachep;
#ifdef CONFIG_F2FS_FAULT_INJECTION
@@ -1418,7 +1420,15 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
return ret;
}
}
+
default_check:
+ return f2fs_validate_options(sb);
+}
+
+static int f2fs_validate_options(struct super_block *sb)
+{
+ struct f2fs_sb_info *sbi = F2FS_SB(sb);
+
#ifdef CONFIG_QUOTA
if (f2fs_check_quota_options(sbi))
return -EINVAL;
@@ -1432,13 +1442,13 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
return -EINVAL;
}
#endif
-
- if (!IS_ENABLED(CONFIG_UNICODE) && f2fs_sb_has_casefold(sbi)) {
+#if !IS_ENABLED(CONFIG_UNICODE)
+ if (f2fs_sb_has_casefold(sbi)) {
f2fs_err(sbi,
"Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE");
return -EINVAL;
}
-
+#endif
/*
* The BLKZONED feature indicates that the drive was formatted with
* zone alignment optimization. This is optional for host-aware
@@ -1458,10 +1468,10 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
return -EINVAL;
}
#else
- f2fs_err(sbi, "Zoned block device support is not enabled");
- return -EINVAL;
+ f2fs_err(sbi, "Zoned block device support is not enabled");
+ return -EINVAL;
#endif
- }
+ }
#ifdef CONFIG_F2FS_FS_COMPRESSION
if (f2fs_test_compress_extension(sbi)) {
Just move option validation out of parse_options(), and the validation logic is enclosed within f2fs_validate_options. Signed-off-by: Hongbo Li <lihongbo22@huawei.com> --- fs/f2fs/super.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)