]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
btrfs: relocation: Use btrfs_find_all_leafs to locate data extent parent tree leaves
authorQu Wenruo <wqu@suse.com>
Tue, 10 Mar 2020 08:14:15 +0000 (16:14 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 23 Mar 2020 16:01:57 +0000 (17:01 +0100)
commit19b546d7a1b2eaf575d04a8434e32f679877c45e
tree837cb62b93ebf533043397fe984726feef1278c1
parentb39c8f5a393e7fc4459ac2aa1582409839eae2f6
btrfs: relocation: Use btrfs_find_all_leafs to locate data extent parent tree leaves

In relocation, we need to locate all parent tree leaves referring to one
data extent, thus we have a complex mechanism to iterate throught extent
tree and subvolume trees to locate the related leaves.

However this is already done in backref.c, we have
btrfs_find_all_leafs(), which can return a ulist containing all leaves
referring to that data extent.

Use btrfs_find_all_leafs() 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>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/backref.c
fs/btrfs/backref.h
fs/btrfs/relocation.c