aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/backref.c
diff options
context:
space:
mode:
authorQu Wenruo2020-03-03 13:21:30 +0800
committerDavid Sterba2020-05-25 11:25:19 +0200
commitb1818dab9bda1da8f3ea5a13230b5d91ae964f00 (patch)
tree4a314d9f7d44d391688e8463156f9b580c5caf4f /fs/btrfs/backref.c
parent584fb12187f087f4909f74fa91dbb61856107684 (diff)
btrfs: backref: rename and move alloc_backref_node()
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/backref.c')
-rw-r--r--fs/btrfs/backref.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 9c5097dcd5a3..dbe170de3516 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -2482,3 +2482,24 @@ void btrfs_backref_init_cache(struct btrfs_fs_info *fs_info,
cache->fs_info = fs_info;
cache->is_reloc = is_reloc;
}
+
+struct btrfs_backref_node *btrfs_backref_alloc_node(
+ struct btrfs_backref_cache *cache, u64 bytenr, int level)
+{
+ struct btrfs_backref_node *node;
+
+ ASSERT(level >= 0 && level < BTRFS_MAX_LEVEL);
+ node = kzalloc(sizeof(*node), GFP_NOFS);
+ if (!node)
+ return node;
+
+ INIT_LIST_HEAD(&node->list);
+ INIT_LIST_HEAD(&node->upper);
+ INIT_LIST_HEAD(&node->lower);
+ RB_CLEAR_NODE(&node->rb_node);
+ cache->nr_nodes++;
+ node->level = level;
+ node->bytenr = bytenr;
+
+ return node;
+}