[PATCH 06/19] btrfs: Move backref_cache_init() to backref.c

Qu Wenruo
2020-03-03T07:15:18Z

fs/btrfs/backref.c | 16 ++++++++++++++++
fs/btrfs/backref.h | 2 ++
fs/btrfs/relocation.c | 16 ----------------
3 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 01674be3beaa..8fc1d520695e 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -2444,3 +2444,19 @@ int btrfs_backref_iter_next(struct btrfs_backref_iter *iter)
path->slots[0]);
return 0;
}
+
+void backref_cache_init(struct btrfs_fs_info *fs_info,
+ struct backref_cache *cache, int is_reloc)
+{
+ int i;
+ cache->rb_root = RB_ROOT;
+ cache->fs_info = fs_info;
+ for (i = 0; i < BTRFS_MAX_LEVEL; i++)
+ INIT_LIST_HEAD(&cache->pending[i]);
+ INIT_LIST_HEAD(&cache->changed);
+ INIT_LIST_HEAD(&cache->detached);
+ INIT_LIST_HEAD(&cache->leaves);
+ cache->is_reloc = is_reloc;
+ INIT_LIST_HEAD(&cache->pending_edge);
+ INIT_LIST_HEAD(&cache->useless_node);
+}
diff --git a/fs/btrfs/backref.h b/fs/btrfs/backref.h
index e1438425cf59..65e886fb2008 100644
--- a/fs/btrfs/backref.h
+++ b/fs/btrfs/backref.h
@@ -290,4 +290,6 @@ struct backref_cache {
struct btrfs_fs_info *fs_info;
};

+void backref_cache_init(struct btrfs_fs_info *fs_info,
+ struct backref_cache *cache, int is_reloc);
#endif
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 0fb9ceb2665e..4ec2946f95ae 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -185,22 +185,6 @@ static void mapping_tree_init(struct mapping_tree *tree)
spin_lock_init(&tree->lock);
}

-static void backref_cache_init(struct btrfs_fs_info *fs_info,
- struct backref_cache *cache, int is_reloc)
-{
- int i;
- cache->rb_root = RB_ROOT;
- cache->fs_info = fs_info;
- for (i = 0; i < BTRFS_MAX_LEVEL; i++)
- INIT_LIST_HEAD(&cache->pending[i]);
- INIT_LIST_HEAD(&cache->changed);
- INIT_LIST_HEAD(&cache->detached);
- INIT_LIST_HEAD(&cache->leaves);
- cache->is_reloc = is_reloc;
- INIT_LIST_HEAD(&cache->pending_edge);
- INIT_LIST_HEAD(&cache->useless_node);
-}
-
static void backref_cache_cleanup(struct backref_cache *cache)
{
struct backref_node *node;
--
2.25.1