summaryrefslogtreecommitdiff
path: root/fs/bcachefs/replicas.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-04-24 00:24:25 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:54 -0400
commit9620c3ec2fa83e18f52e99b3dd2e8451446ca17e (patch)
tree6923afc85e76ef5f67b046b70f39bb46cc51d8b7 /fs/bcachefs/replicas.c
parente131b6aa0a316f9724e6e8ad2f9be091c07115a7 (diff)
bcachefs: Add a mempool for the replicas delta list
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/replicas.c')
-rw-r--r--fs/bcachefs/replicas.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/fs/bcachefs/replicas.c b/fs/bcachefs/replicas.c
index 15ff0d3c936a..ddaf833d0bf2 100644
--- a/fs/bcachefs/replicas.c
+++ b/fs/bcachefs/replicas.c
@@ -1033,11 +1033,27 @@ unsigned bch2_dev_has_data(struct bch_fs *c, struct bch_dev *ca)
return ret;
}
+void bch2_fs_replicas_exit(struct bch_fs *c)
+{
+ unsigned i;
+
+ kfree(c->usage_scratch);
+ for (i = 0; i < ARRAY_SIZE(c->usage); i++)
+ free_percpu(c->usage[i]);
+ kfree(c->usage_base);
+ kfree(c->replicas.entries);
+ kfree(c->replicas_gc.entries);
+
+ mempool_exit(&c->replicas_delta_pool);
+}
+
int bch2_fs_replicas_init(struct bch_fs *c)
{
bch2_journal_entry_res_resize(&c->journal,
&c->replicas_journal_res,
reserve_journal_replicas(c, &c->replicas));
- return replicas_table_update(c, &c->replicas);
+ return mempool_init_kmalloc_pool(&c->replicas_delta_pool, 1,
+ REPLICAS_DELTA_LIST_MAX) ?:
+ replicas_table_update(c, &c->replicas);
}