OSDN Git Service

btrfs: reloc: refactor finishing part of upper linkage into finish_upper_links()
authorQu Wenruo <wqu@suse.com>
Tue, 25 Feb 2020 06:20:13 +0000 (14:20 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 May 2020 09:25:18 +0000 (11:25 +0200)
commit1f872924663f9a15924cc7169932608c1d697ee1
tree15047e703f9a39ef78b593814c965527187fc58c
parente7d571c7b004dc20f385d53d0c89e99d078e0415
btrfs: reloc: refactor finishing part of upper linkage into finish_upper_links()

After handle_one_tree_backref(), all newly added (not cached) edges and
nodes have the following features:

- Only backref_edge::list[LOWER] is linked.
  This means, we can only iterate from botton to top, not the other
  direction.

- Newly added nodes are not added to cache rb_tree yet

So to finish the backref cache, we still need to finish the links and
add all nodes into backref cache rb_tree.

This patch will refactor the existing code into finish_upper_links(),
add more comments of each branch, and why we need to do all the work.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
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/relocation.c