diff options
author | Daniel Hill <daniel@gluo.nz> | 2022-03-15 09:36:33 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:09:32 +0200 |
commit | 104c69745fdf7e5f8aa022f60bc9d568987bd8b8 (patch) | |
tree | 09fc07cf3d1bbe991c7a586fbac4ee24c31d1b98 /fs/bcachefs/super-io.c | |
parent | bcachefs: Tracepoint improvements (diff) | |
download | linux-104c69745fdf7e5f8aa022f60bc9d568987bd8b8.tar.xz linux-104c69745fdf7e5f8aa022f60bc9d568987bd8b8.zip |
bcachefs: Add persistent counters
This adds a new superblock field for persisting counters
and adds a sysfs interface in counters/ exposing these counters.
The superblock field is ignored by older versions letting us avoid
an on disk version bump.
Each sysfs file outputs a counter that tracks since filesystem
creation and a counter for the current mount session.
Signed-off-by: Daniel Hill <daniel@gluo.nz>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super-io.c')
-rw-r--r-- | fs/bcachefs/super-io.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c index c3c7043d7426..56a6c925543a 100644 --- a/fs/bcachefs/super-io.c +++ b/fs/bcachefs/super-io.c @@ -18,6 +18,7 @@ #include "super.h" #include "trace.h" #include "vstructs.h" +#include "counters.h" #include <linux/backing-dev.h> #include <linux/sort.h> @@ -819,6 +820,8 @@ int bch2_write_super(struct bch_fs *c) SET_BCH_SB_BIG_ENDIAN(c->disk_sb.sb, CPU_BIG_ENDIAN); + bch2_sb_counters_from_cpu(c); + for_each_online_member(ca, c, i) bch2_sb_from_fs(c, ca); |