summaryrefslogtreecommitdiff
path: root/libbcachefs/counters.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-05-30 22:36:00 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-05-30 23:24:10 -0400
commit46b2c553aa462cf2c25b1fe017c164c2da471a98 (patch)
treee8e375ff2dd066764c76cf70af15f5834631fa6b /libbcachefs/counters.c
parent962390c0b2e90c1c85abfe69b8b76fd7ef3925ee (diff)
Update bcachefs sources to fad6d13aa5 fixup! bcachefs: Add persistent counters
Diffstat (limited to 'libbcachefs/counters.c')
-rw-r--r--libbcachefs/counters.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libbcachefs/counters.c b/libbcachefs/counters.c
index 25a6b38b..6bf267df 100644
--- a/libbcachefs/counters.c
+++ b/libbcachefs/counters.c
@@ -87,18 +87,18 @@ int bch2_sb_counters_from_cpu(struct bch_fs *c)
return 0;
}
-int bch2_fs_counters_init(struct bch_fs *c)
+void bch2_fs_counters_exit(struct bch_fs *c)
{
- int ret = 0;
+ free_percpu(c->counters);
+}
+int bch2_fs_counters_init(struct bch_fs *c)
+{
c->counters = __alloc_percpu(sizeof(u64) * BCH_COUNTER_NR, sizeof(u64));
-
if (!c->counters)
return -ENOMEM;
- ret = bch2_sb_counters_to_cpu(c);
-
- return ret;
+ return bch2_sb_counters_to_cpu(c);
}
const struct bch_sb_field_ops bch_sb_field_ops_counters = {