diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-02-20 22:41:03 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:09:54 +0200 |
commit | e151580d3072e7326732edcaf2a77ea423c695f5 (patch) | |
tree | ef9e75a7c1e7e3b1fe7d71eecde8c271bbcc5de3 | |
parent | bcachefs: __bch2_btree_insert uses BTREE_INSERT_CACHED (diff) | |
download | linux-e151580d3072e7326732edcaf2a77ea423c695f5.tar.xz linux-e151580d3072e7326732edcaf2a77ea423c695f5.zip |
bcachefs: Add tracepoint & counter for btree split race
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/bcachefs_format.h | 3 | ||||
-rw-r--r-- | fs/bcachefs/btree_update_interior.c | 4 | ||||
-rw-r--r-- | fs/bcachefs/trace.h | 6 |
3 files changed, 11 insertions, 2 deletions
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h index 9524ff02f2d7..4d3c5e2f7ea6 100644 --- a/fs/bcachefs/bcachefs_format.h +++ b/fs/bcachefs/bcachefs_format.h @@ -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, diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c index ad86c0b9e42e..79be89006403 100644 --- a/fs/bcachefs/btree_update_interior.c +++ b/fs/bcachefs/btree_update_interior.c @@ -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); } diff --git a/fs/bcachefs/trace.h b/fs/bcachefs/trace.h index 30b10908ced0..f608baec294a 100644 --- a/fs/bcachefs/trace.h +++ b/fs/bcachefs/trace.h @@ -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), |