Re: [PATCH RFC 0/2] Use new incompat feature BG_TREE to hugely reduce mount time

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

 




On 2019/1/3 上午12:21, David Sterba wrote:
> 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.

Right, for backup root it indeed makes sense.

However for another key type method, I don't really think there is any pro.

To pack bg items together, new key type is needed anyway.
With new key type, no matter where the new bg items are, older kernel
won't be compatible, thus still INCOMPAT feature.

And for whatever the tree holding block group items, it will be as hot
as extent tree used to be, bring up the corruption possibility to the
whatever the existing is. Or slow down the tree.

So at least from my respect of view, storing (new) bg items in existing
tree doesn't make sense.

However I think we should put more discussion on the possible new block
group item structure design.
E.g. Remove chunk_objectid member, or even each block group has its own
tree.

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