btrfs-progs/cmds
David Sterba 5cdaf19529 btrfs-progs: inspect list-chunks: better sorting, updated output
Enhance the sorting capabilities of 'inspect list-chunks' to allow
multiple keys. Drop the gaps, this works only for pstart and it's hard
to make it work with arbitrary sort keys.

Usage is printed by default, assuming this is an interesting info and
even if it slows down the output (due to extra lookups) it's more
convenient to print it rather than not.

The options related to usage and empty were removed.

Output changes:

- rename Number to PNumber, meaning physical number on the device
- print Devid, device number, can be also sort key

Examples:

btrfs inspect list-chunks /mnt
btrfs inspect list-chunks --sort length,usage
btrfs inspect list-chunks --sort lstart

Depending on the sort key order, the output can be wild, for that the
PNumber and LNumber give some hint where the chunks lie in their space.

Example output:

$ sudo ./btrfs inspect list-chunks --sort length,usage /
Devid PNumber      Type/profile    PStart    Length      PEnd LNumber    LStart Usage%
----- ------- ----------------- --------- --------- --------- ------- --------- ------
    1       7       Data/single   1.52GiB  16.00MiB   1.54GiB      69 191.68GiB  86.04
    1       3     System/DUP    117.00MiB  32.00MiB 149.00MiB      40 140.17GiB   0.05
    1       2     System/DUP     85.00MiB  32.00MiB 117.00MiB      39 140.17GiB   0.05
    1      15       Data/single   8.04GiB  64.00MiB   8.10GiB      61 188.60GiB  94.46
    1       1       Data/single   1.00MiB  84.00MiB  85.00MiB      68 191.60GiB  74.24
    1       5   Metadata/DUP    341.00MiB 192.00MiB 533.00MiB      60 188.41GiB  82.58
    1       4   Metadata/DUP    149.00MiB 192.00MiB 341.00MiB      59 188.41GiB  82.58
    1      20   Metadata/DUP      9.29GiB 256.00MiB   9.54GiB      38 139.92GiB  57.76
    1      19   Metadata/DUP      9.04GiB 256.00MiB   9.29GiB      37 139.92GiB  57.76
    1      22   Metadata/DUP      9.79GiB 256.00MiB  10.04GiB      25 113.15GiB  57.93
    1      21   Metadata/DUP      9.54GiB 256.00MiB   9.79GiB      24 113.15GiB  57.93
    1      46   Metadata/DUP     29.29GiB 256.00MiB  29.54GiB      43 142.71GiB  62.38

Signed-off-by: David Sterba <dsterba@suse.com>
2024-06-20 10:15:52 +09:30
..
balance.c btrfs-progs: drop _fd from btrfs_open_dir_fd() 2024-02-20 12:56:24 +01:00
commands.h btrfs-progs: use unsigned type for bit shift values 2023-11-03 18:04:37 +01:00
device.c btrfs-progs: use strncpy_null everywhere 2024-06-20 10:15:52 +09:30
filesystem-du.c btrfs-progs: rename btrfs_open_fd2() to btrfs_open_path() 2024-02-20 12:59:29 +01:00
filesystem-usage.c btrfs-progs: reorder key initializations 2024-04-30 21:49:15 +02:00
filesystem-usage.h btrfs-progs: convert device info to struct array 2023-10-17 19:34:00 +02:00
filesystem.c btrfs-progs: fi df: extended information about profile types 2024-06-20 10:15:52 +09:30
inspect-dump-super.c btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
inspect-dump-tree.c btrfs-progs: reorder key initializations 2024-04-30 21:49:15 +02:00
inspect-tree-stats.c btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
inspect.c btrfs-progs: inspect list-chunks: better sorting, updated output 2024-06-20 10:15:52 +09:30
property.c btrfs-progs: property set: fix typo in help message 2024-04-30 19:34:52 +02:00
props.h btrfs-progs: use unsigned type for bit shift values 2023-11-03 18:04:37 +01:00
qgroup.c btrfs-progs: clarify unlinked and deleted terminology for subvolumes 2024-05-17 18:13:18 +02:00
qgroup.h btrfs-progs: qgroups: remove support for num_ref_copies/num_excl_copies 2024-03-04 22:55:07 +01:00
quota.c btrfs-progs: drop _fd from btrfs_open_dir_fd() 2024-02-20 12:56:24 +01:00
receive-dump.c btrfs-progs: receive dump: fix formatting of encoded write message 2024-06-20 10:15:52 +09:30
receive-dump.h btrfs-progs: cmds: update include lists 2022-10-11 09:07:59 +02:00
receive.c btrfs-progs: rename and move __strncpy_null to string-utils 2024-06-20 10:15:52 +09:30
reflink.c btrfs-progs: implement arg_strtou64_with_suffix() with a new helper 2024-01-18 02:14:23 +01:00
replace.c btrfs-progs: use strncpy_null everywhere 2024-06-20 10:15:52 +09:30
rescue-chunk-recover.c btrfs-progs: reorder key initializations 2024-04-30 21:49:15 +02:00
rescue-super-recover.c btrfs-progs: clean up includes, using include-what-you-use 2023-10-03 01:11:57 +02:00
rescue.c btrfs-progs: rescue: properly close the fs for clear-ino-cache 2024-02-08 08:30:37 +01:00
rescue.h btrfs-progs: unify GPL header comments 2021-09-07 13:58:44 +02:00
restore.c btrfs-progs: use strncpy_null everywhere 2024-06-20 10:15:52 +09:30
scrub.c btrfs-progs: use strncpy_null everywhere 2024-06-20 10:15:52 +09:30
send.c btrfs-progs: use get_sysfs_proto_supported() in get_sysfs_proto_supported() 2023-12-01 01:58:56 +01:00
subvolume-list.c btrfs-progs: use strncpy_null everywhere 2024-06-20 10:15:52 +09:30
subvolume.c btrfs-progs: rename and move __strncpy_null to string-utils 2024-06-20 10:15:52 +09:30
subvolume.h btrfs-progs: subvol: introduce rowspec definition for json output 2023-08-28 17:24:23 +02:00