diff options
author | Wang Shilong <wangsl.fnst@cn.fujitsu.com> | 2013-07-24 10:29:20 +0800 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-09-01 08:04:29 -0400 |
commit | 1493381f2f95a7d7383eeeb490ce0da9d9a7368f (patch) | |
tree | a6173e35ee8e66a47da79150ca13f79a04fb9b2d | |
parent | 2c334e87f31783ca80b7ce265b25ba5489bfad1a (diff) |
Btrfs: use u64 for subvolid when parsing mount options
Although for most time, int is enough for subvolid, we should
ensure safety in theory.
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
-rw-r--r-- | fs/btrfs/super.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index cc002959493c..d82391d48974 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -327,7 +327,7 @@ enum { static match_table_t tokens = { {Opt_degraded, "degraded"}, {Opt_subvol, "subvol=%s"}, - {Opt_subvolid, "subvolid=%d"}, + {Opt_subvolid, "subvolid=%s"}, {Opt_device, "device=%s"}, {Opt_nodatasum, "nodatasum"}, {Opt_nodatacow, "nodatacow"}, @@ -673,8 +673,8 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, { substring_t args[MAX_OPT_ARGS]; char *device_name, *opts, *orig, *p; + char *num = NULL; int error = 0; - int intarg; if (!options) return 0; @@ -704,16 +704,14 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, } break; case Opt_subvolid: - error = match_int(&args[0], &intarg); - if (!error) { - goto out; - } else if (intarg >= 0) { + num = match_strdup(&args[0]); + if (num) { + *subvol_objectid = memparse(num, NULL); + kfree(num); /* we want the original fs_tree */ - if (!intarg) + if (!*subvol_objectid) *subvol_objectid = BTRFS_FS_TREE_OBJECTID; - else - *subvol_objectid = intarg; } else { error = -EINVAL; goto out; |