btrfs-progs: fi usage, fix reporting space for degraded mounts
commit7a81861b5903251376c2abeb659610f61256f548
authorDavid Sterba <dsterba@suse.cz>
Tue, 17 Mar 2015 13:41:01 +0000 (17 14:41 +0100)
committerDavid Sterba <dsterba@suse.cz>
Tue, 17 Mar 2015 13:53:08 +0000 (17 14:53 +0100)
treef5420fc70a2aff175a78e2233526f73468e6dc0d
parent514c5689bd672b21fa8033a7a48eae56a6e36b7f
btrfs-progs: fi usage, fix reporting space for degraded mounts

The total size of devices was summed from raw partition size which is
wrong in two ways:

- if the device is missing, the size is 0 and it mismatches the size
  summed from chunks, leading to bogus numbers like

    Device unallocated:   16.00EiB
    Used:    1.88TiB
    Free (estimated):    8.00EiB (min: 8.00EiB)

- we should really account the device size that's occupied by btrfs, not
  the real partition size altough it's the same most of the time

The sum of missing devices is now printed in the summary and any missing
device path is replaced with 'missing' instead of blank:

Data,RAID1: Size:972.00GiB, Used:962.15GiB
     972.00GiB
   /dev/sdb1  972.00GiB

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94911
Reported-by: <raffix@web.de>
Signed-off-by: David Sterba <dsterba@suse.cz>
cmds-fi-disk_usage.c