bcachefs: Add tracepoint & counter for btree split race

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2023-02-20 16:41:03 -05:00
parent 930256d4fb
commit e151580d30
3 changed files with 11 additions and 2 deletions

View File

@ -1478,7 +1478,8 @@ struct bch_sb_field_disk_groups {
x(transaction_commit, 72) \
x(write_super, 73) \
x(trans_restart_would_deadlock_recursion_limit, 74) \
x(trans_restart_write_buffer_flush, 75)
x(trans_restart_write_buffer_flush, 75) \
x(trans_restart_split_race, 76)
enum bch_persistent_counters {
#define x(t, n, ...) BCH_COUNTER_##t,

View File

@ -1717,8 +1717,10 @@ split:
* We could attempt to avoid the transaction restart, by calling
* bch2_btree_path_upgrade() and allocating more nodes:
*/
if (b->c.level >= as->update_level)
if (b->c.level >= as->update_level) {
trace_and_count(c, trans_restart_split_race, trans, _THIS_IP_);
return btree_trans_restart(trans, BCH_ERR_transaction_restart_split_race);
}
return btree_split(as, trans, path, b, keys, flags);
}

View File

@ -837,6 +837,12 @@ DEFINE_EVENT(transaction_event, trans_restart_injected,
TP_ARGS(trans, caller_ip)
);
DEFINE_EVENT(transaction_event, trans_restart_split_race,
TP_PROTO(struct btree_trans *trans,
unsigned long caller_ip),
TP_ARGS(trans, caller_ip)
);
DEFINE_EVENT(transaction_event, trans_blocked_journal_reclaim,
TP_PROTO(struct btree_trans *trans,
unsigned long caller_ip),