summaryrefslogtreecommitdiff
path: root/libbcachefs/counters.c
diff options
context:
space:
mode:
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 = {