summaryrefslogtreecommitdiff
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2010-02-28 13:59:11 +0300
committerChris Mason <chris.mason@oracle.com>2010-03-15 18:00:14 +0300
commit91748467a5c5884e44ad5cf58630c0c28474f1f6 (patch)
tree593f2449e069e34fe96ba0e59efa8bf71242ad46 /fs/btrfs/super.c
parent1406e4327be3a533a2b18582f715ce2cfbcf6804 (diff)
downloadlinux-91748467a5c5884e44ad5cf58630c0c28474f1f6.tar.xz
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 = {
{Opt_err, NULL},
};
-u64 btrfs_parse_size(char *str)
-{
- u64 res;
- int mult = 1;
- char *end;
- char last;
-
- res = simple_strtoul(str, &end, 10);
-
- last = end[0];
- if (isalpha(last)) {
- last = tolower(last);
- switch (last) {
- case 'g':
- mult *= 1024;
- case 'm':
- mult *= 1024;
- case 'k':
- mult *= 1024;
- }
- res = res * mult;
- }
- return res;
-}
-
/*
* Regular mount options parser. Everything that is needed only when
* reading in a new superblock is parsed here.
@@ -216,7 +191,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
case Opt_max_extent:
num = match_strdup(&args[0]);
if (num) {
- info->max_extent = btrfs_parse_size(num);
+ info->max_extent = memparse(num, NULL);
kfree(num);
info->max_extent = max_t(u64,
@@ -228,7 +203,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
case Opt_max_inline:
num = match_strdup(&args[0]);
if (num) {
- info->max_inline = btrfs_parse_size(num);
+ info->max_inline = memparse(num, NULL);
kfree(num);
if (info->max_inline) {
@@ -243,7 +218,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
case Opt_alloc_start:
num = match_strdup(&args[0]);
if (num) {
- info->alloc_start = btrfs_parse_size(num);
+ info->alloc_start = memparse(num, NULL);
kfree(num);
printk(KERN_INFO
"btrfs: allocations start at %llu\n",