btrfs-progs: scrub start: consider the lowest non-zero limit

On multi-device filesystems, a scrub limit may be applied to any of the
devices. Ensure that any limit found is not disregarded.

Since it's more intuitive, keep the lowest non-zero limit found, even
though at the present we don't actually use the exact value.

Pull-request: #733
Issue: #727
Fixes: 7e4a235df1 ("btrfs-progs: scrub status: print device speed limit in status if set")
Signed-off-by: Jonas Malaco <jonas@protocubo.io>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Jonas Malaco 2024-01-15 08:29:04 -03:00 committed by David Sterba
parent 96011debe4
commit 1d37d3ef91

View File

@ -1634,8 +1634,10 @@ static int scrub_start(const struct cmd_struct *cmd, int argc, char **argv,
struct btrfs_scrub_progress *cur_progress =
&sp[i].scrub_args.progress;
/* Save last limit only, works for single device filesystem. */
/* On a multi-device filesystem, keep the lowest limit only. */
if (!limit || (sp[i].limit && sp[i].limit < limit))
limit = sp[i].limit;
if (do_stats_per_dev) {
print_scrub_dev(&di_args[i],
cur_progress,