mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-25 07:32:22 +00:00
btrfs-progs: balance: enhance the limit fiter with range
We can do more with the balance filter. Enhance it so we can specify also the minimum number of block groups to process. The 'limit' filter now accepts a range (a..b, can be partial) and needs kernel support. The 'limit=value' filter is equivalent to 'limit=..value' but works on older kernels as well. The min/max values are 32bit, unlike the single-value limit which is 64bit. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
45e9bf8098
commit
7dff5c9c9b
@ -306,11 +306,19 @@ static int parse_filters(char *filters, struct btrfs_balance_args *args)
|
||||
return 1;
|
||||
}
|
||||
if (parse_u64(value, &args->limit)) {
|
||||
fprintf(stderr, "Invalid limit argument: %s\n",
|
||||
value);
|
||||
return 1;
|
||||
if (parse_range_u32(value, &args->limit_min,
|
||||
&args->limit_max)) {
|
||||
fprintf(stderr,
|
||||
"Invalid limit argument: %s\n",
|
||||
value);
|
||||
return 1;
|
||||
}
|
||||
args->flags &= ~BTRFS_BALANCE_ARGS_LIMIT;
|
||||
args->flags |= BTRFS_BALANCE_ARGS_LIMIT_RANGE;
|
||||
} else {
|
||||
args->flags &= ~BTRFS_BALANCE_ARGS_LIMIT_RANGE;
|
||||
args->flags |= BTRFS_BALANCE_ARGS_LIMIT;
|
||||
}
|
||||
args->flags |= BTRFS_BALANCE_ARGS_LIMIT;
|
||||
} else {
|
||||
fprintf(stderr, "Unrecognized balance option '%s'\n",
|
||||
this_char);
|
||||
|
Loading…
Reference in New Issue
Block a user