Re: [PATCH] btrfs-progs: dump-tree: Introduce --breadth-first option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2018/8/23 下午3:36, Nikolay Borisov wrote:
> 
> 
> On 23.08.2018 10:31, Qu Wenruo wrote:
>> Introduce --breadth-first option to do breadth-first tree dump.
>> This is especially handy to inspect high level trees, e.g. comparing
>> tree reloc tree with its source tree.
> 
> Will it make sense instead of exposing another option to just have a
> heuristics check that will switch to the BFS if the tree is higher than,
> say, 2 levels?

BFS has one obvious disadvantage here, so it may not be a good idea to
use it for default.

>> More memory usage <<
   It needs to alloc heap memory, and this can be pretty large for
   leaves.
   At level 1, it will need to alloc nr_leaves * sizeof(bfs_entry)
   memory at least.
   Compared to DFS, it only needs to iterate at most 8 times, and all of
   its memory usage is function call stack memory.

It only makes sense for my niche use case (compare tree reloc tree with
its source).
For real world use case the default DFS should works fine without all
the memory allocation burden.

So I still prefer to keep DFS as default and only provides BFS as a
niche option for weird guys like me.

Thanks,
Qu



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux