Skip to content

Commit

Permalink
btrfs: cleanup unnecessary string dup in btrfs_parse_options()
Browse files Browse the repository at this point in the history
Long ago, commit edf24ab ("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: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Misono, Tomohiro authored and David Sterba committed Jan 22, 2018
1 parent 203e02d commit e215772
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions fs/btrfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
unsigned long new_flags)
{
substring_t args[MAX_OPT_ARGS];
char *p, *num, *orig = NULL;
char *p, *num;
u64 cache_gen;
int intarg;
int ret = 0;
Expand All @@ -437,16 +437,6 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
if (!options)
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) {
int token;
if (!*p)
Expand Down Expand Up @@ -887,7 +877,6 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
btrfs_info(info, "disk space caching is enabled");
if (!ret && btrfs_test_opt(info, FREE_SPACE_TREE))
btrfs_info(info, "using free space tree");
kfree(orig);
return ret;
}

Expand Down

0 comments on commit e215772

Please sign in to comment.