Commit 47254d07 authored by Qu Wenruo's avatar Qu Wenruo Committed by David Sterba

btrfs: backref: rename and move alloc_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 b1818dab
...@@ -2503,3 +2503,14 @@ struct btrfs_backref_node *btrfs_backref_alloc_node( ...@@ -2503,3 +2503,14 @@ struct btrfs_backref_node *btrfs_backref_alloc_node(
return node; return node;
} }
struct btrfs_backref_edge *btrfs_backref_alloc_edge(
struct btrfs_backref_cache *cache)
{
struct btrfs_backref_edge *edge;
edge = kzalloc(sizeof(*edge), GFP_NOFS);
if (edge)
cache->nr_edges++;
return edge;
}
...@@ -272,5 +272,7 @@ void btrfs_backref_init_cache(struct btrfs_fs_info *fs_info, ...@@ -272,5 +272,7 @@ void btrfs_backref_init_cache(struct btrfs_fs_info *fs_info,
struct btrfs_backref_cache *cache, int is_reloc); struct btrfs_backref_cache *cache, int is_reloc);
struct btrfs_backref_node *btrfs_backref_alloc_node( struct btrfs_backref_node *btrfs_backref_alloc_node(
struct btrfs_backref_cache *cache, u64 bytenr, int level); struct btrfs_backref_cache *cache, u64 bytenr, int level);
struct btrfs_backref_edge *btrfs_backref_alloc_edge(
struct btrfs_backref_cache *cache);
#endif #endif
...@@ -218,17 +218,6 @@ static void free_backref_node(struct btrfs_backref_cache *cache, ...@@ -218,17 +218,6 @@ static void free_backref_node(struct btrfs_backref_cache *cache,
} }
} }
static struct btrfs_backref_edge *alloc_backref_edge(
struct btrfs_backref_cache *cache)
{
struct btrfs_backref_edge *edge;
edge = kzalloc(sizeof(*edge), GFP_NOFS);
if (edge)
cache->nr_edges++;
return edge;
}
#define LINK_LOWER (1 << 0) #define LINK_LOWER (1 << 0)
#define LINK_UPPER (1 << 1) #define LINK_UPPER (1 << 1)
static void link_backref_edge(struct btrfs_backref_edge *edge, static void link_backref_edge(struct btrfs_backref_edge *edge,
...@@ -581,7 +570,7 @@ static int handle_direct_tree_backref(struct btrfs_backref_cache *cache, ...@@ -581,7 +570,7 @@ static int handle_direct_tree_backref(struct btrfs_backref_cache *cache,
return 0; return 0;
} }
edge = alloc_backref_edge(cache); edge = btrfs_backref_alloc_edge(cache);
if (!edge) if (!edge)
return -ENOMEM; return -ENOMEM;
...@@ -698,7 +687,7 @@ static int handle_indirect_tree_backref(struct btrfs_backref_cache *cache, ...@@ -698,7 +687,7 @@ static int handle_indirect_tree_backref(struct btrfs_backref_cache *cache,
break; break;
} }
edge = alloc_backref_edge(cache); edge = btrfs_backref_alloc_edge(cache);
if (!edge) { if (!edge) {
btrfs_put_root(root); btrfs_put_root(root);
ret = -ENOMEM; ret = -ENOMEM;
...@@ -1263,7 +1252,7 @@ static int clone_backref_node(struct btrfs_trans_handle *trans, ...@@ -1263,7 +1252,7 @@ static int clone_backref_node(struct btrfs_trans_handle *trans,
if (!node->lowest) { if (!node->lowest) {
list_for_each_entry(edge, &node->lower, list[UPPER]) { list_for_each_entry(edge, &node->lower, list[UPPER]) {
new_edge = alloc_backref_edge(cache); new_edge = btrfs_backref_alloc_edge(cache);
if (!new_edge) if (!new_edge)
goto fail; goto fail;
......
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