Commit e215772c authored by Misono, Tomohiro's avatar Misono, Tomohiro Committed by David Sterba

btrfs: cleanup unnecessary string dup in btrfs_parse_options()

Long ago, commit edf24abe ("btrfs: sanity mount option parsing and
early mount code") split the btrfs_parse_options() into two parts
(btrfs_parse_early_options() and btrfs_parse_options()). As a result,
btrfs_parse_optins no longer gets called twice and is the last one to
parse mount option string. Therefore there is no need to dup it.
Signed-off-by: default avatarTomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 203e02d9
...@@ -414,7 +414,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, ...@@ -414,7 +414,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
unsigned long new_flags) unsigned long new_flags)
{ {
substring_t args[MAX_OPT_ARGS]; substring_t args[MAX_OPT_ARGS];
char *p, *num, *orig = NULL; char *p, *num;
u64 cache_gen; u64 cache_gen;
int intarg; int intarg;
int ret = 0; int ret = 0;
...@@ -437,16 +437,6 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, ...@@ -437,16 +437,6 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
if (!options) if (!options)
goto check; goto check;
/*
* strsep changes the string, duplicate it because parse_options
* gets called twice
*/
options = kstrdup(options, GFP_KERNEL);
if (!options)
return -ENOMEM;
orig = options;
while ((p = strsep(&options, ",")) != NULL) { while ((p = strsep(&options, ",")) != NULL) {
int token; int token;
if (!*p) if (!*p)
...@@ -887,7 +877,6 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, ...@@ -887,7 +877,6 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
btrfs_info(info, "disk space caching is enabled"); btrfs_info(info, "disk space caching is enabled");
if (!ret && btrfs_test_opt(info, FREE_SPACE_TREE)) if (!ret && btrfs_test_opt(info, FREE_SPACE_TREE))
btrfs_info(info, "using free space tree"); btrfs_info(info, "using free space tree");
kfree(orig);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment