diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-28 06:37:27 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-01 19:47:39 +0300 |
commit | 74644030098a0c4932e194fa1b2fa052226f3868 (patch) | |
tree | 8e1b35c2d9468810a419c58a421f1994162e9795 /fs | |
parent | cb13f471390ce646a3d5aa9c599f7eec43ddb2ac (diff) | |
download | linux-74644030098a0c4932e194fa1b2fa052226f3868.tar.xz |
bcachefs: count_event()
Small helper for event counters.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/alloc_background.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/bcachefs.h | 4 | ||||
-rw-r--r-- | fs/bcachefs/data_update.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/move.c | 3 |
4 files changed, 7 insertions, 4 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c index ccc3779dd366..6e719dd09e31 100644 --- a/fs/bcachefs/alloc_background.c +++ b/fs/bcachefs/alloc_background.c @@ -1674,7 +1674,7 @@ write: if (ret) goto out; - this_cpu_inc(c->counters[BCH_COUNTER_bucket_discard]); + count_event(c, bucket_discard); (*discarded)++; out: (*seen)++; diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h index 4186779f1e44..06b5cea9980e 100644 --- a/fs/bcachefs/bcachefs.h +++ b/fs/bcachefs/bcachefs.h @@ -223,9 +223,11 @@ #define race_fault(...) dynamic_fault("bcachefs:race") +#define count_event(_c, _name) this_cpu_inc((_c)->counters[BCH_COUNTER_##_name]) + #define trace_and_count(_c, _name, ...) \ do { \ - this_cpu_inc((_c)->counters[BCH_COUNTER_##_name]); \ + count_event(_c, _name); \ trace_##_name(__VA_ARGS__); \ } while (0) diff --git a/fs/bcachefs/data_update.c b/fs/bcachefs/data_update.c index 488279b3d08e..59b558c25977 100644 --- a/fs/bcachefs/data_update.c +++ b/fs/bcachefs/data_update.c @@ -321,7 +321,7 @@ nowork: &m->stats->sectors_raced); } - this_cpu_inc(c->counters[BCH_COUNTER_move_extent_fail]); + count_event(c, move_extent_fail); bch2_btree_iter_advance(&iter); goto next; diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c index eafa80c18ba4..a6db46a70f15 100644 --- a/fs/bcachefs/move.c +++ b/fs/bcachefs/move.c @@ -349,7 +349,8 @@ err: bch2_err_matches(ret, BCH_ERR_transaction_restart)) return ret; - this_cpu_inc(c->counters[BCH_COUNTER_move_extent_start_fail]); + count_event(c, move_extent_start_fail); + if (trace_move_extent_start_fail_enabled()) { struct printbuf buf = PRINTBUF; |