btrfs-progs/cmds
David Sterba 780355d225 btrfs-progs: fi usage: print zone unusable in the overview
Print the total zone_unusable size in the summary for 'fi usage' for a
filesystem in zoned mode. It's a sum of all the zone_unusable values
from 'fi df'. Per-device stats are not implemented and would need more
complicated calculations from raw data, kernel does not export that (but
it could).

As of 5.12, the zone_unusable is stored only in memory so we'd have to
map raw block device zones to the block groups and the live extents in
the associated block groups to get the exact numbers.

Example:

  # btrfs fi usage /mnt
  Overall:
      Device size:                   2.00GiB
      Device allocated:            768.00MiB
      Device unallocated:            1.25GiB
      Device missing:                  0.00B
      Device zone unusable:        320.00KiB
      Used:                        128.00KiB
      Free (estimated):              1.50GiB      (min: 1.50GiB)
      Free (statfs, df):             1.50GiB
      Data ratio:                       1.00
      Metadata ratio:                   1.00
      Global reserve:                3.25MiB      (used: 32.00KiB)
      Multiple profiles:                  no

  Data,single: Size:256.00MiB, Used:0.00B (0.00%)
     /dev/nullb0   256.00MiB

  Metadata,single: Size:256.00MiB, Used:112.00KiB (0.04%)
     /dev/nullb0   256.00MiB

  System,single: Size:256.00MiB, Used:16.00KiB (0.01%)
     /dev/nullb0   256.00MiB

  Unallocated:
     /dev/nullb0     1.25GiB

  # btrfs fi df
  Data, single: total=256.00MiB, used=0.00B, zone_unusable=0.00B
  System, single: total=256.00MiB, used=16.00KiB, zone_unusable=160.00KiB
  Metadata, single: total=256.00MiB, used=112.00KiB, zone_unusable=160.00KiB
  GlobalReserve, single: total=3.25MiB, used=32.00KiB

Signed-off-by: David Sterba <dsterba@suse.com>
2021-05-08 00:58:50 +02:00
..
balance.c btrfs-progs: split open/close helpers from utils.c 2021-05-06 16:41:47 +02:00
commands.h btrfs-progs: help: define helper for command with flags 2019-07-03 20:49:04 +02:00
device.c btrfs-progs: split unit related helpers from utils.c 2021-05-06 16:41:47 +02:00
filesystem-du.c btrfs-progs: split unit related helpers from utils.c 2021-05-06 16:41:47 +02:00
filesystem-usage.c btrfs-progs: fi usage: print zone unusable in the overview 2021-05-08 00:58:50 +02:00
filesystem-usage.h btrfs-progs: move all cmds-fi*.c to cmds/ 2019-07-03 20:49:03 +02:00
filesystem.c btrfs-progs: export get_zone_unusable and move to utils.c 2021-05-08 00:58:50 +02:00
inspect-dump-super.c btrfs-progs: zoned: implement log-structured superblock 2021-05-06 16:41:45 +02:00
inspect-dump-tree.c btrfs-progs: factor open_ctree parameters to a structure 2021-03-24 22:20:19 +01:00
inspect-tree-stats.c btrfs-progs: split unit related helpers from utils.c 2021-05-06 16:41:47 +02:00
inspect.c btrfs-progs: split unit related helpers from utils.c 2021-05-06 16:41:47 +02:00
property.c btrfs-progs: move ctree.c to kernel-shared/ 2020-08-31 17:01:05 +02:00
qgroup.c btrfs-progs: split unit related helpers from utils.c 2021-05-06 16:41:47 +02:00
quota.c btrfs-progs: split open/close helpers from utils.c 2021-05-06 16:41:47 +02:00
receive-dump.c btrfs-progs: move send-utils.c to common/ 2020-08-31 17:01:04 +02:00
receive-dump.h btrfs-progs: move send-dump.c to cmds/receive-dump.c 2020-08-31 17:01:04 +02:00
receive.c btrfs-progs: build: remove incomplete android support 2021-05-06 16:41:47 +02:00
replace.c btrfs-progs: split open/close helpers from utils.c 2021-05-06 16:41:47 +02:00
rescue-chunk-recover.c btrfs-progs: build: remove incomplete android support 2021-05-06 16:41:47 +02:00
rescue-super-recover.c btrfs-progs: move volumes.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
rescue.c btrfs-progs: split open/close helpers from utils.c 2021-05-06 16:41:47 +02:00
rescue.h btrfs-progs: super-recover: add global verbose option 2020-06-12 19:31:37 +02:00
restore.c btrfs-progs: split open/close helpers from utils.c 2021-05-06 16:41:47 +02:00
scrub.c btrfs-progs: split unit related helpers from utils.c 2021-05-06 16:41:47 +02:00
send.c btrfs-progs: send: fix crash on unknown option 2021-01-13 22:33:09 +01:00
subvolume.c btrfs-progs: split unit related helpers from utils.c 2021-05-06 16:41:47 +02:00