On 2024-03-02 04:14, Kent Overstreet wrote:
I'm currently updating the 'bcachefs fs usage' command for the disk
accounting rewrite, and looking for suggestions on any improements we
could make - ways to present the output that would be clearer and more
useful, possibly ideas on on new things to count...

I think a shorter form of the per-device section is in order, a table
with data type on the x axis and the device on the y axis; we also want
percentages.

The big thing I'm trying to figure out is how to present the snapshots
counters in a useful way.

Snapshot IDs form trees, where subvolumes correspond to leaf nodes in
snapshot trees and interior nodes represent data shared between multiple
subvolumes.

That means it's straightforward to print how much data each subvolumme
is using directly - look up the subvolume for a given snapshot ID, look
up the filesystem path of that subvolume - but I haven't come up with a
good way of presenting how data is shared; these trees can be
arbitrarily large.

Thoughts?


Short/long form human readable and something similar to json
Short form Size, Used, Free

Filesystem: 77d3a40d-58b6-46c9-a4d2-e59c8681e152
Size:                       11.0 GiB
Used:                       4.96 GiB
Online reserved:                 0 B
Inodes:                            4

Persistent reservations:
2x                          5.00 MiB


Option for show layout, warning if layout not optimal

Data type       Required/total  Durability    Devices
btree:          1/2             2             [vdb vdc]           14.0 MiB
btree:          1/2             2             [vdb vdd]           17.8 MiB
btree:          1/2             2             [vdc vdd]           14.3 MiB
user:           1/2             2             [vdb vdc]           1.64 GiB
user:           1/2             2             [vdb vdd]           1.63 GiB
user:           1/2             2             [vdc vdd]           1.64 GiB


Option for detailed

Compression:      compressed    uncompressed     average extent size
lz4                 4.63 GiB        6.57 GiB                 112 KiB
incompressible       328 MiB         328 MiB                 113 Ki >

Snapshots:
4294967295          4.91 GiB
Per snapshot/subvol all/mask info like Total, Exclusive, Short layout (replicas-size, EC-size)

Btrees:
extents             12.0 MiB
inodes               256 KiB
dirents              256 KiB
alloc               10.8 MiB
subvolumes           256 KiB
snapshots            256 KiB
lru                  256 KiB
freespace            256 KiB
need_discard         256 KiB
backpointers        20.5 MiB
bucket_gens          256 KiB
snapshot_trees       256 KiB
logged_ops           256 KiB
accounting           256 KiB

May be device label or device name from /dev/mapper/... Not dm-0, dm-1, etc
(no label) (device 0):           vdb              rw
                                 data         buckets    fragmented
   free:                     2.27 GiB           18627
   sb:                       3.00 MiB              25       124 KiB
   journal:                  32.0 MiB             256
   btree:                    15.9 MiB             127
   user:                     1.64 GiB           13733      41.1 MiB
   cached:                        0 B               0
   parity:                        0 B               0
   stripe:                        0 B               0
   need_gc_gens:                  0 B               0
   need_discard:                  0 B               0
   capacity:                 4.00 GiB           32768

(no label) (device 1):           vdc              rw
                                 data         buckets    fragmented
   free:                     2.28 GiB           18652
   sb:                       3.00 MiB              25       124 KiB
   journal:                  32.0 MiB             256
   btree:                    14.1 MiB             113
   user:                     1.64 GiB           13722      38.5 MiB
   cached:                        0 B               0
   parity:                        0 B               0
   stripe:                        0 B               0
   need_gc_gens:                  0 B               0
   need_discard:                  0 B               0
   capacity:                 4.00 GiB           32768

(no label) (device 2):           vdd              rw
                                 data         buckets    fragmented
   free:                     2.28 GiB           18640
   sb:                       3.00 MiB              25       124 KiB
   journal:                  32.0 MiB             256
   btree:                    16.0 MiB             128
   user:                     1.64 GiB           13719      38.6 MiB
   cached:                        0 B               0
   parity:                        0 B               0
   stripe:                        0 B               0
   need_gc_gens:                  0 B               0
   need_discard:                  0 B               0
   capacity:                 4.00 GiB           32768


And option for full info ))

--
Michael

Reply via email to