Re: [PATCH v2 05/10] btrfs: relocation: Refactor tree backref processing into its own function

Qu Wenruo
2020-03-04T01:00:43Z

[-- Attachment #1.1: Type: text/plain, Size: 1393 bytes --]

On 2020/3/4 上午1:29, David Sterba wrote:
> On Mon, Mar 02, 2020 at 05:45:48PM +0800, Qu Wenruo wrote:
>> build_backref_tree() function is painfully long, as it has 3 big parts:
>> - Tree backref handling
>> - Weaving backref nodes
>> - Useless nodes pruning
>
> So this is the first patch that mentions the 'useless' nodes. This seems
> like a misnomer or confusing at best but I haven't read enough code to
> see if it's really the right name.

The 'useless' is from the original code, there is a list called 'useless'.

It's not that useless, those nodes are just ignored, but still cached to
prevent extra lookup.

Hopes there would be a better name.

>
> Also the term 'weaving', that seems to be added by you. Did you mean
> splicing or merging?
>

It's complex, but definitely not splicing or merge.

The overall workflow looks like this:

1) Iteration works build a map like this: (start point is X)

A B
^ ^
\ /
C
^
|
X

At this stage, it's single directional, means we can only go
X->C, C->A, C->B

2) Weaving part makes the map bi-directional
A B
^ ^
\ /
v v
C
^
|
v
X

That's the weaving part.
Any better naming is welcomed.

Thanks,
Qu

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]