aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2010-02-28 05:59:11 -0500
committerChris Mason <chris.mason@oracle.com>2010-03-15 11:00:14 -0400
commit91748467a5c5884e44ad5cf58630c0c28474f1f6 (patch)
tree593f2449e069e34fe96ba0e59efa8bf71242ad46 /fs/btrfs/super.c
parent1406e4327be3a533a2b18582f715ce2cfbcf6804 (diff)
btrfs: use memparse
Use memparse() instead of its own private implementation. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Chris Mason <chris.mason@oracle.com> Cc: linux-btrfs@vger.kernel.org Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c31
1 files changed, 3 insertions, 28 deletions
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
99u64 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",