summaryrefslogtreecommitdiff
path: root/libbcachefs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/super.c')
-rw-r--r--libbcachefs/super.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libbcachefs/super.c b/libbcachefs/super.c
index b33117dd..0212832a 100644
--- a/libbcachefs/super.c
+++ b/libbcachefs/super.c
@@ -405,8 +405,9 @@ static void bch2_fs_free(struct bch_fs *c)
bch2_io_clock_exit(&c->io_clock[WRITE]);
bch2_io_clock_exit(&c->io_clock[READ]);
bch2_fs_compress_exit(c);
- percpu_free_rwsem(&c->usage_lock);
+ percpu_free_rwsem(&c->mark_lock);
free_percpu(c->usage[0]);
+ free_percpu(c->pcpu);
mempool_exit(&c->btree_iters_pool);
mempool_exit(&c->btree_bounce_pool);
bioset_exit(&c->btree_bio);
@@ -414,7 +415,8 @@ static void bch2_fs_free(struct bch_fs *c)
mempool_exit(&c->btree_reserve_pool);
mempool_exit(&c->fill_iter);
percpu_ref_exit(&c->writes);
- kfree(rcu_dereference_protected(c->replicas, 1));
+ kfree(c->replicas.entries);
+ kfree(c->replicas_gc.entries);
kfree(rcu_dereference_protected(c->disk_groups, 1));
if (c->copygc_wq)
@@ -597,6 +599,9 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
bch2_fs_btree_cache_init_early(&c->btree_cache);
+ if (percpu_init_rwsem(&c->mark_lock))
+ goto err;
+
mutex_lock(&c->sb_lock);
if (bch2_sb_to_fs(c, sb)) {
@@ -640,7 +645,7 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
offsetof(struct btree_write_bio, wbio.bio)),
BIOSET_NEED_BVECS) ||
!(c->usage[0] = alloc_percpu(struct bch_fs_usage)) ||
- percpu_init_rwsem(&c->usage_lock) ||
+ !(c->pcpu = alloc_percpu(struct bch_fs_pcpu)) ||
mempool_init_kvpmalloc_pool(&c->btree_bounce_pool, 1,
btree_bytes(c)) ||
mempool_init_kmalloc_pool(&c->btree_iters_pool, 1,