diff options
author | Qu Wenruo <wqu@suse.com> | 2018-09-28 09:44:34 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-10-31 18:24:14 +0100 |
commit | 0bbd407cbbd5746ac2f0f3ec4d89087276cf7510 (patch) | |
tree | 9345f460cf5d63b3e607795aad0aa4f2cec05b61 /Documentation | |
parent | 61c218756cd939ae5a475a593008f533931acba4 (diff) |
btrfs-progs: print-tree: Introduce --bfs and --dfs options
Originally print-tree uses depth first search to print trees.
This works fine until we reach 3 level trees (root node level is 2).
For tall trees whose root level is 2 or higher, DFS will mix nodes and
leaves like the following example:
Level 2 A
/ \
Level 1 B C
/ | | \
Level 0 D E F G
DFS will cause the following output sequence:
A B D E C F G
Which in term of node/leave is:
N N L L N L L
Such mixed node/leave result is sometimes hard for human to read.
This patch will introduce 2 new options, --bfs and --dfs.
--dfs: keeps the original output sequence, and to keep things
compatible it's the default behavior.
--bfs: uses breadth-first search, and will cause better output
sequence like:
A B C D E F G
Which in term of node/leave is:
N N N L L L L
Much better sorted and may become default in the future.
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/btrfs-inspect-internal.asciidoc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Documentation/btrfs-inspect-internal.asciidoc b/Documentation/btrfs-inspect-internal.asciidoc index e2db6466..381497d2 100644 --- a/Documentation/btrfs-inspect-internal.asciidoc +++ b/Documentation/btrfs-inspect-internal.asciidoc @@ -89,6 +89,12 @@ print only the uuid tree information, empty output if the tree does not exist print info of the specified block only --follow:::: use with '-b', print all children tree blocks of '<block_num>' +--dfs:::: +use depth-first search to print trees. (default) the nodes and leaves are +intermixed in the output +--bfs:::: +use breadth-first search to print trees. the nodes are printed before all +leaves -t <tree_id>:::: print only the tree with the specified ID, where the ID can be numerical or common name in a flexible human readable form |