diff options
-rw-r--r-- | fs/btrfs/ctree.h | 1 | ||||
-rw-r--r-- | fs/btrfs/ioctl.c | 2 | ||||
-rw-r--r-- | fs/btrfs/super.c | 31 |
3 files changed, 4 insertions, 30 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 3f704a816137..11115847d875 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -2388,7 +2388,6 @@ void btrfs_sysfs_del_super(struct btrfs_fs_info *root); | |||
2388 | ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size); | 2388 | ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size); |
2389 | 2389 | ||
2390 | /* super.c */ | 2390 | /* super.c */ |
2391 | u64 btrfs_parse_size(char *str); | ||
2392 | int btrfs_parse_options(struct btrfs_root *root, char *options); | 2391 | int btrfs_parse_options(struct btrfs_root *root, char *options); |
2393 | int btrfs_sync_fs(struct super_block *sb, int wait); | 2392 | int btrfs_sync_fs(struct super_block *sb, int wait); |
2394 | 2393 | ||
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 9213d39d36cc..363e209679b6 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -776,7 +776,7 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root, | |||
776 | mod = 1; | 776 | mod = 1; |
777 | sizestr++; | 777 | sizestr++; |
778 | } | 778 | } |
779 | new_size = btrfs_parse_size(sizestr); | 779 | new_size = memparse(sizestr, NULL); |
780 | if (new_size == 0) { | 780 | if (new_size == 0) { |
781 | ret = -EINVAL; | 781 | ret = -EINVAL; |
782 | goto out_unlock; | 782 | goto out_unlock; |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index ff3dd55f294d..9ac612e6ca60 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -96,31 +96,6 @@ static match_table_t tokens = { | |||
96 | {Opt_err, NULL}, | 96 | {Opt_err, NULL}, |
97 | }; | 97 | }; |
98 | 98 | ||
99 | u64 btrfs_parse_size(char *str) | ||
100 | { | ||
101 | u64 res; | ||
102 | int mult = 1; | ||
103 | char *end; | ||
104 | char last; | ||
105 | |||
106 | res = simple_strtoul(str, &end, 10); | ||
107 | |||
108 | last = end[0]; | ||
109 | if (isalpha(last)) { | ||
110 | last = tolower(last); | ||
111 | switch (last) { | ||
112 | case 'g': | ||
113 | mult *= 1024; | ||
114 | case 'm': | ||
115 | mult *= 1024; | ||
116 | case 'k': | ||
117 | mult *= 1024; | ||
118 | } | ||
119 | res = res * mult; | ||
120 | } | ||
121 | return res; | ||
122 | } | ||
123 | |||
124 | /* | 99 | /* |
125 | * Regular mount options parser. Everything that is needed only when | 100 | * Regular mount options parser. Everything that is needed only when |
126 | * reading in a new superblock is parsed here. | 101 | * reading in a new superblock is parsed here. |
@@ -216,7 +191,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
216 | case Opt_max_extent: | 191 | case Opt_max_extent: |
217 | num = match_strdup(&args[0]); | 192 | num = match_strdup(&args[0]); |
218 | if (num) { | 193 | if (num) { |
219 | info->max_extent = btrfs_parse_size(num); | 194 | info->max_extent = memparse(num, NULL); |
220 | kfree(num); | 195 | kfree(num); |
221 | 196 | ||
222 | info->max_extent = max_t(u64, | 197 | info->max_extent = max_t(u64, |
@@ -228,7 +203,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
228 | case Opt_max_inline: | 203 | case Opt_max_inline: |
229 | num = match_strdup(&args[0]); | 204 | num = match_strdup(&args[0]); |
230 | if (num) { | 205 | if (num) { |
231 | info->max_inline = btrfs_parse_size(num); | 206 | info->max_inline = memparse(num, NULL); |
232 | kfree(num); | 207 | kfree(num); |
233 | 208 | ||
234 | if (info->max_inline) { | 209 | if (info->max_inline) { |
@@ -243,7 +218,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
243 | case Opt_alloc_start: | 218 | case Opt_alloc_start: |
244 | num = match_strdup(&args[0]); | 219 | num = match_strdup(&args[0]); |
245 | if (num) { | 220 | if (num) { |
246 | info->alloc_start = btrfs_parse_size(num); | 221 | info->alloc_start = memparse(num, NULL); |
247 | kfree(num); | 222 | kfree(num); |
248 | printk(KERN_INFO | 223 | printk(KERN_INFO |
249 | "btrfs: allocations start at %llu\n", | 224 | "btrfs: allocations start at %llu\n", |