aboutsummaryrefslogtreecommitdiff
path: root/fs/bcachefs/bcachefs.h
diff options
context:
space:
mode:
authorDaniel Hill <daniel@gluo.nz>2022-03-15 21:36:33 +1300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:32 -0400
commit104c69745fdf7e5f8aa022f60bc9d568987bd8b8 (patch)
tree09fc07cf3d1bbe991c7a586fbac4ee24c31d1b98 /fs/bcachefs/bcachefs.h
parent1f93726e6347938343190913cb959623e67ecf78 (diff)
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/bcachefs.h')
-rw-r--r--fs/bcachefs/bcachefs.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index e7300a9f427c..5dda57afa802 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -584,6 +584,7 @@ struct bch_fs {
struct list_head list;
struct kobject kobj;
+ struct kobject counters_kobj;
struct kobject internal;
struct kobject opts_dir;
struct kobject time_stats;
@@ -900,12 +901,15 @@ mempool_t bio_bounce_pages;
u64 last_bucket_seq_cleanup;
- /* The rest of this all shows up in sysfs */
+ /* TODO rewrite as counters - The rest of this all shows up in sysfs */
atomic_long_t read_realloc_races;
atomic_long_t extent_migrate_done;
atomic_long_t extent_migrate_raced;
atomic_long_t bucket_alloc_fail;
+ u64 counters_on_mount[BCH_COUNTER_NR];
+ u64 __percpu *counters;
+
unsigned btree_gc_periodic:1;
unsigned copy_gc_enabled:1;
bool promote_whole_extents;