args->flags |= BTRFS_BALANCE_ARGS_CONVERT;
} else if (!strcmp(this_char, "soft")) {
args->flags |= BTRFS_BALANCE_ARGS_SOFT;
+ } else if (!strcmp(this_char, "limit")) {
+ if (!value || !*value) {
+ fprintf(stderr,
+ "the limit filter requires an argument\n");
+ return 1;
+ }
+ if (parse_u64(value, &args->limit)) {
+ fprintf(stderr, "Invalid limit argument: %s\n",
+ value);
+ return 1;
+ }
+ args->flags |= BTRFS_BALANCE_ARGS_LIMIT;
} else {
fprintf(stderr, "Unrecognized balance option '%s'\n",
this_char);
printf(", vrange=%llu..%llu",
(unsigned long long)args->vstart,
(unsigned long long)args->vend);
+ if (args->flags & BTRFS_BALANCE_ARGS_LIMIT)
+ printf(", limit=%llu", (unsigned long long)args->limit);
printf("\n");
}
#define BTRFS_BALANCE_ARGS_DEVID (1ULL << 2)
#define BTRFS_BALANCE_ARGS_DRANGE (1ULL << 3)
#define BTRFS_BALANCE_ARGS_VRANGE (1ULL << 4)
+#define BTRFS_BALANCE_ARGS_LIMIT (1ULL << 5)
/*
* Profile changing flags. When SOFT is set we won't relocate chunk if