From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Nikolay Borisov <nborisov@suse.com>, Qu Wenruo <wqu@suse.com>,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: dump-tree: Introduce --breadth-first option
Date: Thu, 23 Aug 2018 15:45:07 +0800 [thread overview]
Message-ID: <26f5f933-7b8d-40e8-16bb-5269867bbc71@gmx.com> (raw)
In-Reply-To: <2d6c65be-6b54-95d7-29a7-fa24f98989fb@suse.com>
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
next prev parent reply other threads:[~2018-08-23 11:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-23 7:31 [PATCH] btrfs-progs: dump-tree: Introduce --breadth-first option Qu Wenruo
2018-08-23 7:36 ` Nikolay Borisov
2018-08-23 7:45 ` Qu Wenruo [this message]
2018-09-04 12:39 ` Qu Wenruo
2018-09-11 15:52 ` David Sterba
2018-09-11 23:50 ` Qu Wenruo
2018-08-23 7:48 ` Su Yue
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=26f5f933-7b8d-40e8-16bb-5269867bbc71@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=nborisov@suse.com \
--cc=wqu@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox