diff options
author | Qu Wenruo <wqu@suse.com> | 2020-03-03 13:35:27 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-05-25 11:25:20 +0200 |
commit | b0fe7078d62c23bc94d0203887d9ad7b128f684b (patch) | |
tree | 688f3771f9506e512aca4ca0361b728b647a989e /fs/btrfs/relocation.c | |
parent | 741188d3a549af328cc7946ce9650dd33a25087b (diff) |
btrfs: backref: rename and move drop_backref_node()
With extra comment for drop_backref_node() as it has some similarity
with remove_backref_node(), thus we need extra comment explaining the
difference.
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r-- | fs/btrfs/relocation.c | 45 |
1 files changed, 7 insertions, 38 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index ec35348c0fae..d23b9a54e002 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -268,37 +268,6 @@ static struct btrfs_backref_node *walk_down_backref( *index = 0; return NULL; } - -static void unlock_node_buffer(struct btrfs_backref_node *node) -{ - if (node->locked) { - btrfs_tree_unlock(node->eb); - node->locked = 0; - } -} - -static void drop_node_buffer(struct btrfs_backref_node *node) -{ - if (node->eb) { - unlock_node_buffer(node); - free_extent_buffer(node->eb); - node->eb = NULL; - } -} - -static void drop_backref_node(struct btrfs_backref_cache *tree, - struct btrfs_backref_node *node) -{ - BUG_ON(!list_empty(&node->upper)); - - drop_node_buffer(node); - list_del(&node->list); - list_del(&node->lower); - if (!RB_EMPTY_NODE(&node->rb_node)) - rb_erase(&node->rb_node, &tree->rb_root); - btrfs_backref_free_node(tree, node); -} - /* * remove a backref node from the backref cache */ @@ -322,7 +291,7 @@ static void remove_backref_node(struct btrfs_backref_cache *cache, if (RB_EMPTY_NODE(&upper->rb_node)) { BUG_ON(!list_empty(&node->upper)); - drop_backref_node(cache, node); + btrfs_backref_drop_node(cache, node); node = upper; node->lowest = 1; continue; @@ -337,7 +306,7 @@ static void remove_backref_node(struct btrfs_backref_cache *cache, } } - drop_backref_node(cache, node); + btrfs_backref_drop_node(cache, node); } static void update_backref_node(struct btrfs_backref_cache *cache, @@ -2859,7 +2828,7 @@ static int do_relocation(struct btrfs_trans_handle *trans, if (node->eb->start == bytenr) goto next; } - drop_node_buffer(upper); + btrfs_backref_drop_node_buffer(upper); } if (!upper->eb) { @@ -2958,15 +2927,15 @@ static int do_relocation(struct btrfs_trans_handle *trans, } next: if (!upper->pending) - drop_node_buffer(upper); + btrfs_backref_drop_node_buffer(upper); else - unlock_node_buffer(upper); + btrfs_backref_unlock_node_buffer(upper); if (err) break; } if (!err && node->pending) { - drop_node_buffer(node); + btrfs_backref_drop_node_buffer(node); list_move_tail(&node->list, &rc->backref_cache.changed); node->pending = 0; } @@ -4591,7 +4560,7 @@ int btrfs_reloc_cow_block(struct btrfs_trans_handle *trans, BUG_ON(node->bytenr != buf->start && node->new_bytenr != buf->start); - drop_node_buffer(node); + btrfs_backref_drop_node_buffer(node); atomic_inc(&cow->refs); node->eb = cow; node->new_bytenr = cow->start; |