kdave / btrfs-progs

Development of userspace BTRFS tools
GNU General Public License v2.0
527 stars 239 forks source link

scrub on one device shows incorrect status #690

Open espux opened 9 months ago

espux commented 9 months ago

When running scrub on one device in a multi device filesystem scrub status shows incorrect value for "Total to scrub". Instead it shows same value as "Bytes scrubbed". Also the "Time left" and "ETA" are wrong. This issue seems to have been introduced with V6.3.

Output from v6.2.2 (and earlier):

Scrub resumed:    Mon Oct  9 11:28:33 2023
Status:           running
Duration:         0:49:01
Time left:        15:40:00
ETA:              Tue Oct 10 03:36:02 2023
Total to scrub:   13.55TiB
Bytes scrubbed:   687.76GiB  (4.96%)
Rate:             239.46MiB/s
Error summary:    no errors found

Output from v6.3 (and later):

Scrub resumed:    Mon Oct  9 11:28:33 2023
Status:           running
Duration:         0:44:36
Time left:        0:00:00
ETA:              Mon Oct  9 11:51:38 2023
Total to scrub:   625.49GiB
Bytes scrubbed:   625.49GiB  (100.00%)
Rate:             239.35MiB/s
Error summary:    no errors found
adam900710 commented 8 months ago

Are you using btrfs scrub status -d? As without -d, at least for the latest code base, it's printing the total used bytes.

For per-device reporting, the output looks lacking the leading lines like Scrub device %s (id %llu).

Otherwise it's indeed a problem, and it looks like it's caused by commit c88ac0170b35 ("btrfs-progs: scrub: unify the output numbers for "Total to scrub""), which changed the print_scrub_dev() to use the real scrubbed bytes.

But that change unfortunately is not good for running scrubs. I can add extra checks to change it to output the old values for running scrubs.