All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Nikolay Borisov <nborisov@suse.com>, Qu Wenruo <wqu@suse.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH RFC 0/2] Use new incompat feature BG_TREE to hugely reduce mount time
Date: Wed, 2 Jan 2019 17:21:13 +0100	[thread overview]
Message-ID: <20190102162113.GX23615@twin.jikos.cz> (raw)
In-Reply-To: <d4ee763f-19b4-e50f-1746-d2ca4152a3c5@gmx.com>

On Fri, Dec 28, 2018 at 05:28:13PM +0800, Qu Wenruo wrote:
> On 2018/12/28 下午5:15, Nikolay Borisov wrote:
> > On 28.12.18 г. 10:37 ч., Qu Wenruo wrote:
> >> This patchset can be fetched from:
> >> https://github.com/adam900710/linux/tree/bg_tree
> >> Which is based on v4.20-rc1 tag.
> >>
> >> This patchset will hugely reduce mount time of large fs by putting all
> >> block group items into its own tree.
> >>
> >> The old behavior will try to read out all block group items at mount
> >> time, however due to the key of block group items are scattered across
> >> tons of extent items, we must call btrfs_search_slot() for each block
> >> group.
> >>
> >> It works fine for small fs, but when number of block groups goes beyond
> >> 200, such tree search will become a random read, causing obvious slow
> >> down.
> >>
> >> On the other hand, btrfs_read_chunk_tree() is still very fast, since we
> >> put CHUNK_ITEMS into their own tree and package them next to each other.
> >>
> >>
> >> Following this idea, we could do the same thing for block group items,
> >> so instead of triggering btrfs_search_slot() for each block group, we
> >> just call btrfs_next_item() and under most case we could finish in
> >> memory, and hugely speed up mount (see BENCHMARK below).
> >>
> >> The only disadvantage is, this method introduce an incompatible feature,
> >> so existing fs can't use this feature directly.
> >> Either specify it at mkfs time, or use btrfs-progs offline convert tool
> >> (*).
> > 
> > What if we start recording block group items in the chunk tree?
> 
> Then chunk tree will be too hot.
> 
> Currently chunk tree is pretty stable, only get modified at bg
> creation/deletion time.
> 
> Considering how important chunk tree is, I prefer to make chunk root as
> cold as possible.
> 
> On the other hand, block group items are pretty hot (although less hot
> compared to old extent tree), so it still makes sense to put them into
> one tree, allow chunk tree to be as cold as ice, while keep block group
> items relatively safe compared to old extent tree.

A feature like this should come with an analysis of both approaches in
advance. Both have pros and cons that we need to weigh. Eg. I'm not more
for storing the items in an existing tree, possibly creating a new tree
item that would pack the bg items together at the beginning of the tree.

The update frequency of the tree is an aspect that I haven't considered
before but I think it's a good point.

The tree holding the bg items can be considered fundamental and requires
a backup pointer in the superblock. So this would need more work.

  reply	other threads:[~2019-01-02 16:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-28  8:37 [PATCH RFC 0/2] Use new incompat feature BG_TREE to hugely reduce mount time Qu Wenruo
2018-12-28  8:37 ` [PATCH RFC 1/2] btrfs: Refactor btrfs_read_block_groups() Qu Wenruo
2018-12-28  8:37 ` [PATCH RFC 2/2] btrfs: Introduce new incompat feature, BG_TREE Qu Wenruo
2018-12-28  9:15 ` [PATCH RFC 0/2] Use new incompat feature BG_TREE to hugely reduce mount time Nikolay Borisov
2018-12-28  9:28   ` Qu Wenruo
2019-01-02 16:21     ` David Sterba [this message]
2019-01-03  0:14       ` Qu Wenruo
2019-01-03  0:57         ` Hans van Kranenburg
2019-01-03  1:10           ` Qu Wenruo

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=20190102162113.GX23615@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=quwenruo.btrfs@gmx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.