btrfs-progs: scrub status: print percents of scrubbed bytes

Add ratio of the bytes scrubbed to total in the status output, like:

  Total to scrub:   2.54TiB
  Bytes scrubbed:   1.59TiB  (62.58%)

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2020-11-04 20:28:31 +01:00
parent 2e1fa48230
commit d9e9198485
1 changed files with 3 additions and 1 deletions

View File

@ -174,7 +174,9 @@ static void print_scrub_summary(struct btrfs_scrub_progress *p, struct scrub_sta
sec_left / 3600, (sec_left / 60) % 60, sec_left % 60);
printf("ETA: %s\n", t);
printf("Total to scrub: %s\n", pretty_size(bytes_total));
printf("Bytes scrubbed: %s\n", pretty_size(bytes_scrubbed));
printf("Bytes scrubbed: %s (%.2f%%)\n",
pretty_size(bytes_scrubbed),
100.0 * bytes_scrubbed / bytes_total);
printf("Rate: %s/s\n", pretty_size(bytes_per_sec));
} else {
printf("Total to scrub: %s\n", pretty_size(bytes_total));