Re: [PATCH] btrfs: relocation: Use btrfs_find_all_leaves() to locate parent tree leaves of a data extent

Qu Wenruo
2020-03-11T01:10:57Z

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

On 2020/3/11 上午8:50, David Sterba wrote:
> On Tue, Mar 10, 2020 at 04:14:15PM +0800, Qu Wenruo wrote:
>> In relocation, we need to locate all parent tree leaves referring one
>> data extent, thus we have a complex mechanism to iterate throught extent
>> tree and subvolume trees to locate related leaves.
>>
>> However this is already done in backref.c, we have
>> btrfs_find_all_leaves(), which can return a ulist containing all leaves
>> referring to that data extent.
>>
>> Use btrfs_find_all_leaves() to replace find_data_references().
>>
>> There is a special handling for v1 space cache data extents, where we
>> need to delete the v1 space cache data extents, to avoid those data
>> extents to hang the data relocation.
>>
>> In this patch, the special handling is done by re-iterating the root
>> tree leaf.
>> Although it's a little less efficient than the old handling, considering
>> we can reuse a lot of code, it should be acceptable.
>>
>> Signed-off-by: Qu Wenruo <wqu@suse.com>
>> ---
>> This patch is originally in my backref cache branch, but since it's
>> pretty independent from other backref cache code, and straightforward to
>> test/review, it's sent for more comprehensive test/review/merge.
>
> I'll add the patch to for-next, looks a bit scary.
>

Thanks.

It survives the regular balance/replace/volume groups run.

And any behavior change in the v1 space cache handling would lead to
100% reproducible hang in btrfs/061, so it shouldn't be that scary.

Thanks,
Qu

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