aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Malaco <jonas@protocubo.io>2024-01-15 08:28:56 -0300
committerDavid Sterba <dsterba@suse.com>2024-01-15 17:07:22 +0100
commit96011debe45d8924bbb0a90cf5c521c79b8bfeaa (patch)
tree40f3ddb03efaa7bc9484ace8b855218280c8cbcf
parent8bca55d1e75d23a6fbb942ebd0525e105b982d9b (diff)
downloadbtrfs-progs-96011debe45d8924bbb0a90cf5c521c79b8bfeaa.tar.gz
btrfs-progs: scrub status: 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: 7e4a235df1ac ("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>
-rw-r--r--cmds/scrub.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmds/scrub.c b/cmds/scrub.c
index 36017135..59845622 100644
--- a/cmds/scrub.c
+++ b/cmds/scrub.c
@@ -1947,8 +1947,10 @@ static int cmd_scrub_status(const struct cmd_struct *cmd, int argc, char **argv)
init_fs_stat(&fs_stat);
fs_stat.s.in_progress = in_progress;
for (i = 0; i < fi_args.num_devices; ++i) {
- /* Save the last limit only, works for a single device filesystem. */
- limit = read_scrub_device_limit(fdmnt, di_args[i].devid);
+ /* On a multi-device filesystem, keep the lowest limit only. */
+ u64 this_limit = read_scrub_device_limit(fdmnt, di_args[i].devid);
+ if (!limit || (this_limit && this_limit < limit))
+ limit = this_limit;
last_scrub = last_dev_scrub(past_scrubs,
di_args[i].devid);