bcachefs: Improve btree_path_dowgrade tracepoint

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2023-11-12 21:47:15 -05:00
parent cb52d23e77
commit eb54e81f27
2 changed files with 21 additions and 6 deletions

View file

@ -665,7 +665,7 @@ void __bch2_btree_path_downgrade(struct btree_trans *trans,
struct btree_path *path,
unsigned new_locks_want)
{
unsigned l;
unsigned l, old_locks_want = path->locks_want;
if (trans->restarted)
return;
@ -690,7 +690,7 @@ void __bch2_btree_path_downgrade(struct btree_trans *trans,
bch2_btree_path_verify_locks(path);
path->downgrade_seq++;
trace_path_downgrade(trans, _RET_IP_, path);
trace_path_downgrade(trans, _RET_IP_, path, old_locks_want);
}
/* Btree transaction locking: */

View file

@ -1252,22 +1252,37 @@ TRACE_EVENT(trans_restart_key_cache_key_realloced,
TRACE_EVENT(path_downgrade,
TP_PROTO(struct btree_trans *trans,
unsigned long caller_ip,
struct btree_path *path),
TP_ARGS(trans, caller_ip, path),
struct btree_path *path,
unsigned old_locks_want),
TP_ARGS(trans, caller_ip, path, old_locks_want),
TP_STRUCT__entry(
__array(char, trans_fn, 32 )
__field(unsigned long, caller_ip )
__field(unsigned, old_locks_want )
__field(unsigned, new_locks_want )
__field(unsigned, btree )
TRACE_BPOS_entries(pos)
),
TP_fast_assign(
strscpy(__entry->trans_fn, trans->fn, sizeof(__entry->trans_fn));
__entry->caller_ip = caller_ip;
__entry->old_locks_want = old_locks_want;
__entry->new_locks_want = path->locks_want;
__entry->btree = path->btree_id;
TRACE_BPOS_assign(pos, path->pos);
),
TP_printk("%s %pS",
TP_printk("%s %pS locks_want %u -> %u %s %llu:%llu:%u",
__entry->trans_fn,
(void *) __entry->caller_ip)
(void *) __entry->caller_ip,
__entry->old_locks_want,
__entry->new_locks_want,
bch2_btree_id_str(__entry->btree),
__entry->pos_inode,
__entry->pos_offset,
__entry->pos_snapshot)
);
DEFINE_EVENT(transaction_event, trans_restart_write_buffer_flush,