Re: [PATCH v2 06/10] btrfs: relocation: Use wrapper to replace open-coded edge linking

Nikolay Borisov
2020-03-04T13:02:51Z

On 2.03.20 г. 11:45 ч., Qu Wenruo wrote:
> Since backref_edge is used to connect upper and lower backref nodes, and
> need to access both nodes, some code can look pretty nasty:
>
> list_add_tail(&edge->list[LOWER], &cur->upper);
>
> The above code will link @cur to the LOWER side of the edge, while both
> "LOWER" and "upper" words show up.
> This can sometimes be very confusing for reader to grasp.
>
> This patch introduce a new wrapper, link_backref_edge(), to handle the
> linking behavior.
> Which also has extra ASSERT() to ensure caller won't pass wrong nodes
> in.
>
> Also, this updates the comment of related lists of backref_node and
> backref_edge, to make it more clear that each list points to what.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Apart from David's comment I don't have anything else to add and also
the code is functionally the same so:

Reviewed-by: Nikolay Borisov <nborisov@suse.com>