btrfs-progs: copy functionality of btrfs-debug-tree to inspect-internal subcommand
Subsystems (3)
PATCH 1/2 btrfs-progs: copy functionality of btrfs-debug-tree to inspect-internal subcommand
The long-term plan is to merge the features of standalone tools into the btrfs binary, reducing the number of shipped binaries.
Signed-off-by Alexander Fougner <[email protected]>
--- Makefile.in | 2 +- btrfs-debug-tree.c | 424 +------------------------------------------- cmds-inspect-dump-tree.c | 451 +++++++++++++++++++++++++++++++++++++++++++++++ cmds-inspect-dump-tree.h | 15 ++ cmds-inspect.c | 8 + 5 files changed, 481 insertions(+), 419 deletions(-) create mode 100644 cmds-inspect-dump-tree.c create mode 100644 cmds-inspect-dump-tree.h
Makefile.in +1 -1
@@ -70,7 +70,7 @@ objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \ extent-cache.o extent_io.o volumes.o utils.o repair.o \ qgroup.o raid6.o free-space-cache.o list_sort.o props.o \ ulist.o qgroup-verify.o backref.o string-table.o task-utils.o \ - inode.o file.o find-root.o free-space-tree.o help.o + inode.o file.o find-root.o free-space-tree.o help.o cmds-inspect-dump-tree.o cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \ cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \ cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
btrfs-debug-tree.c +6 -418
439 lines not on this page · raw message
cmds-inspect-dump-tree.c new file +451 -0
451 lines not on this page · raw message
cmds-inspect-dump-tree.h new file +15 -0
@@ -0,0 +1,15 @@ +int cmd_inspect_dump_tree (int ac,char **av); + + +static const char *const cmd_inspect_dump_tree_usage[] = { +"btrfs inspect-internal dump-tree [options] device" , +"Dump structures from a device" , +"-e|--extents print detailed extents info" , +"-d|--device print info of btrfs device and root tree dir only" , +"-r|--roots print info of roots only" , +"-R|--backups print info of roots and root backups" , +"-u|--uuid print info of uuid tree only" , +"-b|--block <block_num> print info of the specified block only" , +"-t|--tree <tree_id> print only the tree with the given id" , +NULL +};
cmds-inspect.c +8 -0
@@ -31,6 +31,7 @@#include "disk-io.h" #include "commands.h" #include "btrfs-list.h" +#include "cmds-inspect-dump-tree.h" static const char *const inspect_cmd_group_usage[] = {"btrfs inspect-internal <command> <args>" ,
@@ -619,6 +620,11 @@ out:return !!ret; } +static int cmd_inspect_dump_tree_hook (int ac,char **av) +{ +return cmd_inspect_dump_tree (ac, av); +} +static const char inspect_cmd_group_info[] ="query various internal information" ;
@@ -634,6 +640,8 @@ const struct cmd_group inspect_cmd_group = { 0 }, {"min-dev-size" , cmd_inspect_min_dev_size, cmd_inspect_min_dev_size_usage, NULL, 0 }, + { "dump-tree", cmd_inspect_dump_tree_hook, + cmd_inspect_dump_tree_usage, NULL, 0 },NULL_CMD_STRUCT } };
Signature · 1 line
2.7.1
PATCH 2/2 btrfs-progs: update docs for inspect-internal dump-tree
Signed-off-by Alexander Fougner <[email protected]>
--- Documentation/btrfs-debug-tree.asciidoc | 7 +++++++ Documentation/btrfs-inspect-internal.asciidoc | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+)
Documentation/btrfs-debug-tree.asciidoc +7 -0
@@ -25,8 +25,15 @@ Print detailed extents info. Print info of btrfs device and root tree dirs only. -r:: Print info of roots only. +-R:: +Print info of roots and root backups. +-u:: +Print info of UUID tree only. -b <block_num>:: Print info of the specified block only. +-t <tree_id>:: +Print only the tree with the specified ID. + EXIT STATUS -----------
Documentation/btrfs-inspect-internal.asciidoc +26 -0
@@ -67,6 +67,32 @@ inode number 2), but such subvolume does not contain any files anyway + resolve the absolute path of a the subvolume id 'subvolid' +*dump-tree* [options] <device>:: +(needs root privileges) ++ +Dump the whole tree of the given device. +This is useful for analyzing filesystem state or inconsistence and has +a positive educational effect on understanding the internal structure. +<device> is the device file where the filesystem is stored. ++ +`Options` ++ +-e:::: +Print detailed extents info. +-d:::: +Print info of btrfs device and root tree dirs only. +-r:::: +Print info of roots only. +-R:::: +Print info of roots and root backups. +-u:::: +Print info of UUID tree only. +-b <block_num>:::: +Print info of the specified block only. +-t <tree_id>:::: +Print only the tree with the specified ID. + + EXIT STATUS ----------- *btrfs inspect-internal* returns a zero exit status if it succeeds. Non zero is
Signature · 1 line
2.7.1
David Sterba
AppliedQuoted 4 lines · Alexander Fougner
The long-term plan is to merge the features of standalone tools into the btrfs binary, reducing the number of shipped binaries.
Signed-off-by Alexander Fougner <[email protected]>
Applied, thanks.