diff mbox series

[10/17] ext4: clean up return values in handle_mount_opt()

Message ID 20191106101457.11237-11-lczerner@redhat.com
State Superseded
Headers show
Series [01/17] vfs: Handle fs_param_neg_with_empty | expand

Commit Message

Lukas Czerner Nov. 6, 2019, 10:14 a.m. UTC
Clean up return values in handle_mount_opt() and renabe to function to
ext4_parse_param()

Now we can use is in fs_context_operations as .parse_param.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
 fs/ext4/super.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 417a929cb0ab..dabb55bb999f 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -92,6 +92,7 @@  static int ext4_validate_options(struct fs_context *fc);
 static int ext4_check_opt_consistency(struct fs_context *fc,
 				      struct super_block *sb);
 static void ext4_apply_options(struct fs_context *fc, struct super_block *sb);
+static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param);
 
 /*
  * Lock ordering
@@ -121,6 +122,10 @@  static void ext4_apply_options(struct fs_context *fc, struct super_block *sb);
  * transaction start -> page lock(s) -> i_data_sem (rw)
  */
 
+static const struct fs_context_operations ext4_context_ops = {
+	.parse_param	= ext4_parse_param,
+};
+
 #if !defined(CONFIG_EXT2_FS) && !defined(CONFIG_EXT2_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT2)
 static struct file_system_type ext2_fs_type = {
 	.owner		= THIS_MODULE,
@@ -1943,7 +1948,7 @@  EXT4_SET_CTX(mount_opt2);
 EXT4_SET_CTX(mount_flags);
 
 
-static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
+static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param)
 {
 	struct ext4_fs_context *ctx = fc->fs_private;
 	const struct mount_opts *m;
@@ -1977,19 +1982,19 @@  static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
 	case Opt_removed:
 		ext4_msg(NULL, KERN_WARNING, "Ignoring removed %s option",
 			 param->key);
-		return 1;
+		return 0;
 	case Opt_abort:
 		set_mount_flags(ctx, EXT4_MF_FS_ABORTED);
-		return 1;
+		return 0;
 	case Opt_i_version:
 		set_flags(ctx, SB_I_VERSION);
-		return 1;
+		return 0;
 	case Opt_lazytime:
 		set_flags(ctx, SB_LAZYTIME);
-		return 1;
+		return 0;
 	case Opt_nolazytime:
 		clear_flags(ctx, SB_LAZYTIME);
-		return 1;
+		return 0;
 	case Opt_errors:
 	case Opt_data:
 	case Opt_data_err:
@@ -2185,7 +2190,7 @@  static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
 		else
 			clear_mount_opt(ctx, m->mount_opt);
 	}
-	return 1;
+	return 0;
 }
 
 static int parse_options(struct fs_context *fc, char *options)
@@ -2223,7 +2228,7 @@  static int parse_options(struct fs_context *fc, char *options)
 			}
 		}
 
-		ret = handle_mount_opt(fc, &param);
+		ret = ext4_parse_param(fc, &param);
 		kfree(param.string);
 		if (ret < 0)
 			return ret;