• Qu Wenruo's avatar
    btrfs: relocation: Use btrfs_find_all_leafs to locate data extent parent tree leaves · 19b546d7
    Qu Wenruo authored
    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: default avatarQu Wenruo <wqu@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    19b546d7
backref.h 2.52 KB