btrfs: backref: distinguish reloc and non-reloc use of indirect resolution
authorQu Wenruo <wqu@suse.com>
Mon, 16 Mar 2020 06:10:01 +0000 (14:10 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 May 2020 09:25:22 +0000 (11:25 +0200)
commit876de781b0da240fcf8d29514c34607e147e5a94
treeeb237233e0737f5069edc5967a0eacd5d956b4ac
parent1b23ea180b6b4186ff79db767dcbec612477968f
btrfs: backref: distinguish reloc and non-reloc use of indirect resolution

For relocation tree detection, relocation backref cache uses
btrfs_should_ignore_reloc_root() which uses relocation-specific checks
like checking the DEAD_RELOC_ROOT bit.

However for general purpose backref cache, we can rely on that check, as
it's possible that relocation is also running.

For generic purposed backref cache, we detect reloc root by
SHARED_BLOCK_REF item.  Only reloc root node has its parent bytenr
pointing back to itself.

And in that case, backref cache will mark the reloc root node useless,
dropping any child orphan nodes.

So only call btrfs_should_ignore_reloc_root() if the backref cache is
for relocation.

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