On Fri, Sep 28, 2018 at 10:04:40AM +0800, Qu Wenruo wrote: > This patchset can be fetched from github: > https://github.com/adam900710/btrfs-progs/tree/dump_tree_enhance > > The main point of this patchset is to allow "btrfs ins dump-tree" to > print tree blocks in breadth-first order when level is higher than 2. > > The 1st patch is just a minor cleanup, to remove some unused and > meaningless output. > > The 2nd patch does a root<->fs_info cleanup, provides the basis for > later btrfs_next_sibling_tree_block(). > > The 3rd patch implements a new function, btrfs_next_sibling_tree_block() > to find next sibling tree block, other than leaf. > > The 4th patch implements BFS as bfs_print_children(). > > The BFS search itself is implemented using path along with > path::lowest_level and btrfs_next_sibling_tree_block() to iterate all > sibling tree blocks in a level. > > The 5th patch adds --bfs/--dfs options for dump-tree. > > The final patch changes @follow type from int to bool. > > Changelog: > v2: > Make bfs/dfs selectable by adding --bfs and --dfs options. > Still keep dfs as default (although I really don't see any > compatibility problem) Let's do it in two steps: first introduce the bfs/dfs modes and switch the default eventually if it proves more useful over time. I'm going to apply the patches, with Nikolay's reviewed-by for patches 1-5 as the code is equivalent to what he acked in v1.
