Commit 74644030 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: count_event()

Small helper for event counters.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent cb13f471
......@@ -1674,7 +1674,7 @@ static int bch2_discard_one_bucket(struct btree_trans *trans,
if (ret)
goto out;
this_cpu_inc(c->counters[BCH_COUNTER_bucket_discard]);
count_event(c, bucket_discard);
(*discarded)++;
out:
(*seen)++;
......
......@@ -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)
......
......@@ -321,7 +321,7 @@ static int __bch2_data_update_index_update(struct btree_trans *trans,
&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;
......
......@@ -349,7 +349,8 @@ int bch2_move_extent(struct moving_context *ctxt,
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment