diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-05-25 20:35:53 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:40 -0400 |
commit | c823c3390bd2f325f78bab493f84ea8a84f5ddc2 (patch) | |
tree | 63d99f308c88f24986136c9f3991e0bb6cdaf170 /fs/bcachefs/btree_update_interior.c | |
parent | 96e2aa1be5eebd81ed572baf69f8cb82d56e39bd (diff) | |
download | lwn-c823c3390bd2f325f78bab493f84ea8a84f5ddc2.tar.gz lwn-c823c3390bd2f325f78bab493f84ea8a84f5ddc2.zip |
bcachefs: Factor out bch2_fs_btree_interior_update_init()
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_update_interior.c')
-rw-r--r-- | fs/bcachefs/btree_update_interior.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c index 28568db5834a..1867d732afd4 100644 --- a/fs/bcachefs/btree_update_interior.c +++ b/fs/bcachefs/btree_update_interior.c @@ -2247,3 +2247,22 @@ size_t bch2_btree_interior_updates_nr_pending(struct bch_fs *c) return ret; } + +void bch2_fs_btree_interior_update_exit(struct bch_fs *c) +{ + mempool_exit(&c->btree_interior_update_pool); + mempool_exit(&c->btree_reserve_pool); +} + +int bch2_fs_btree_interior_update_init(struct bch_fs *c) +{ + mutex_init(&c->btree_reserve_cache_lock); + INIT_LIST_HEAD(&c->btree_interior_update_list); + INIT_LIST_HEAD(&c->btree_interior_updates_unwritten); + mutex_init(&c->btree_interior_update_lock); + + return mempool_init_kmalloc_pool(&c->btree_reserve_pool, 1, + sizeof(struct btree_reserve)) ?: + mempool_init_kmalloc_pool(&c->btree_interior_update_pool, 1, + sizeof(struct btree_update)); +} |