Balance filters are the second location which takes user input of replication levels. Update this to use the common parser so that we can provide nCmSpP-style names.
Signed-off-by: Hugo Mills <h...@carfax.org.uk> --- cmds-balance.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/cmds-balance.c b/cmds-balance.c index f5dc317..6186963 100644 --- a/cmds-balance.c +++ b/cmds-balance.c @@ -42,23 +42,16 @@ static const char balance_cmd_group_info[] = static int parse_one_profile(const char *profile, u64 *flags) { - if (!strcmp(profile, "raid0")) { - *flags |= BTRFS_BLOCK_GROUP_RAID0; - } else if (!strcmp(profile, "raid1")) { - *flags |= BTRFS_BLOCK_GROUP_RAID1; - } else if (!strcmp(profile, "raid10")) { - *flags |= BTRFS_BLOCK_GROUP_RAID10; - } else if (!strcmp(profile, "raid5")) { - *flags |= BTRFS_BLOCK_GROUP_RAID5; - } else if (!strcmp(profile, "raid6")) { - *flags |= BTRFS_BLOCK_GROUP_RAID6; - } else if (!strcmp(profile, "dup")) { - *flags |= BTRFS_BLOCK_GROUP_DUP; - } else if (!strcmp(profile, "single")) { - *flags |= BTRFS_AVAIL_ALLOC_BIT_SINGLE; - } else { + u64 result; + + result = parse_profile(profile); + if (result == (u64)-1) { fprintf(stderr, "Unknown profile '%s'\n", profile); return 1; + } else if (result == 0) { + *flags |= BTRFS_AVAIL_ALLOC_BIT_SINGLE; + } else { + *flags |= result; } return 0; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html