Commit f39911e5 authored by Qu Wenruo's avatar Qu Wenruo Committed by David Sterba

btrfs: backref: rename and move link_backref_edge()

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>
parent 47254d07
...@@ -275,4 +275,20 @@ struct btrfs_backref_node *btrfs_backref_alloc_node( ...@@ -275,4 +275,20 @@ struct btrfs_backref_node *btrfs_backref_alloc_node(
struct btrfs_backref_edge *btrfs_backref_alloc_edge( struct btrfs_backref_edge *btrfs_backref_alloc_edge(
struct btrfs_backref_cache *cache); struct btrfs_backref_cache *cache);
#define LINK_LOWER (1 << 0)
#define LINK_UPPER (1 << 1)
static inline void btrfs_backref_link_edge(struct btrfs_backref_edge *edge,
struct btrfs_backref_node *lower,
struct btrfs_backref_node *upper,
int link_which)
{
ASSERT(upper && lower && upper->level == lower->level + 1);
edge->node[LOWER] = lower;
edge->node[UPPER] = upper;
if (link_which & LINK_LOWER)
list_add_tail(&edge->list[LOWER], &lower->upper);
if (link_which & LINK_UPPER)
list_add_tail(&edge->list[UPPER], &upper->lower);
}
#endif #endif
...@@ -218,21 +218,6 @@ static void free_backref_node(struct btrfs_backref_cache *cache, ...@@ -218,21 +218,6 @@ static void free_backref_node(struct btrfs_backref_cache *cache,
} }
} }
#define LINK_LOWER (1 << 0)
#define LINK_UPPER (1 << 1)
static void link_backref_edge(struct btrfs_backref_edge *edge,
struct btrfs_backref_node *lower,
struct btrfs_backref_node *upper,
int link_which)
{
ASSERT(upper && lower && upper->level == lower->level + 1);
edge->node[LOWER] = lower;
edge->node[UPPER] = upper;
if (link_which & LINK_LOWER)
list_add_tail(&edge->list[LOWER], &lower->upper);
if (link_which & LINK_UPPER)
list_add_tail(&edge->list[UPPER], &upper->lower);
}
static void free_backref_edge(struct btrfs_backref_cache *cache, static void free_backref_edge(struct btrfs_backref_cache *cache,
struct btrfs_backref_edge *edge) struct btrfs_backref_edge *edge)
...@@ -595,7 +580,7 @@ static int handle_direct_tree_backref(struct btrfs_backref_cache *cache, ...@@ -595,7 +580,7 @@ static int handle_direct_tree_backref(struct btrfs_backref_cache *cache,
ASSERT(upper->checked); ASSERT(upper->checked);
INIT_LIST_HEAD(&edge->list[UPPER]); INIT_LIST_HEAD(&edge->list[UPPER]);
} }
link_backref_edge(edge, cur, upper, LINK_LOWER); btrfs_backref_link_edge(edge, cur, upper, LINK_LOWER);
return 0; return 0;
} }
...@@ -740,7 +725,7 @@ static int handle_indirect_tree_backref(struct btrfs_backref_cache *cache, ...@@ -740,7 +725,7 @@ static int handle_indirect_tree_backref(struct btrfs_backref_cache *cache,
if (!upper->owner) if (!upper->owner)
upper->owner = btrfs_header_owner(eb); upper->owner = btrfs_header_owner(eb);
} }
link_backref_edge(edge, lower, upper, LINK_LOWER); btrfs_backref_link_edge(edge, lower, upper, LINK_LOWER);
if (rb_node) { if (rb_node) {
btrfs_put_root(root); btrfs_put_root(root);
...@@ -1256,8 +1241,8 @@ static int clone_backref_node(struct btrfs_trans_handle *trans, ...@@ -1256,8 +1241,8 @@ static int clone_backref_node(struct btrfs_trans_handle *trans,
if (!new_edge) if (!new_edge)
goto fail; goto fail;
link_backref_edge(new_edge, edge->node[LOWER], new_node, btrfs_backref_link_edge(new_edge, edge->node[LOWER],
LINK_UPPER); new_node, LINK_UPPER);
} }
} else { } else {
list_add_tail(&new_node->lower, &cache->leaves); list_add_tail(&new_node->lower, &cache->leaves);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment