btrfs-progs: Increase running state's priority in stat output
authorZhao Lei <zhaolei@cn.fujitsu.com>
Tue, 28 Jul 2015 07:53:58 +0000 (15:53 +0800)
committerDavid Sterba <dsterba@suse.com>
Fri, 2 Oct 2015 15:55:14 +0000 (17:55 +0200)
commitcde38029bdfa7acc43ec91877d8e89cda6cedb11
tree53c5873411d437a027f39c7f0319a0f0bb06cfa8
parent54fdddfdc14fa6e9ddf6960cb22d668d83cdf65e
btrfs-progs: Increase running state's priority in stat output

Anthony Plack <anthony@plack.net> reported a output bug in maillist:
  title: btrfs-progs SCRUB reporting aborted but still running - minor

btrfs scrub status report it was aborted but still runs to completion.
  # btrfs scrub status /mnt/data
  scrub status for f591ac13-1a69-476d-bd30-346f87a491da
scrub started at Mon Apr 27 06:48:44 2015 and was aborted after 1089 seconds
total bytes scrubbed: 1.02TiB with 0 errors
  #
  # btrfs scrub status /mnt/data
  scrub status for f591ac13-1a69-476d-bd30-346f87a491da
scrub started at Mon Apr 27 06:48:44 2015 and was aborted after 1664 seconds
total bytes scrubbed: 1.53TiB with 0 errors
  #
  ...

Reason:
  When scrub multi-device simultaneously, if some device canceled,
  and some device is still running, cancel state have higher priority to
  be outputed in global report.
  So we can see "scrub aborted" in status line, with running-time keeps
  increased.

Fix:
  We can increase running state's priority in output, if there is
  some device in scrub state, we output running state instead of
  cancelled state.

Reported-by: Anthony Plack <anthony@plack.net>
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-scrub.c