diff mbox series

[f2fs-dev,3/9] f2fs: move option validation into a separate helper

Message ID 20240814023912.3959299-4-lihongbo22@huawei.com (mailing list archive)
State New
Headers show
Series f2fs: new mount API conversion | expand

Commit Message

Hongbo Li Aug. 14, 2024, 2:39 a.m. UTC
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(-)
diff mbox series

Patch

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 013b1078653f..8c8cd06a6d9c 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -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)) {