diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-08-17 22:04:20 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:10:11 -0400 |
commit | 55d5276d2e7b7ac88a21a7ab89efd308734bb775 (patch) | |
tree | c5105598967b296bc2685460e79ca493eaef31f7 /fs/bcachefs/trace.h | |
parent | d0445e131e3ff1a68492f7f6e754cd672db4774d (diff) | |
download | linux-stable-55d5276d2e7b7ac88a21a7ab89efd308734bb775.tar.gz linux-stable-55d5276d2e7b7ac88a21a7ab89efd308734bb775.tar.bz2 linux-stable-55d5276d2e7b7ac88a21a7ab89efd308734bb775.zip |
bcachefs: Improve btree_path_relock_fail tracepoint
In https://github.com/koverstreet/bcachefs/issues/450, we're seeing
unexplained btree_path_relock_fail events - according to the information
currently in the tracepoint, it appears the relock should be succeeding.
This adds lock counts to the tracepoint to help track it down.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/trace.h')
-rw-r--r-- | fs/bcachefs/trace.h | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/fs/bcachefs/trace.h b/fs/bcachefs/trace.h index a743ab477966..97fe774237d0 100644 --- a/fs/bcachefs/trace.h +++ b/fs/bcachefs/trace.h @@ -403,29 +403,43 @@ TRACE_EVENT(btree_path_relock_fail, __field(u8, level ) TRACE_BPOS_entries(pos) __array(char, node, 24 ) + __field(u8, self_read_count ) + __field(u8, self_intent_count) + __field(u8, read_count ) + __field(u8, intent_count ) __field(u32, iter_lock_seq ) __field(u32, node_lock_seq ) ), TP_fast_assign( struct btree *b = btree_path_node(path, level); + struct six_lock_count c; strscpy(__entry->trans_fn, trans->fn, sizeof(__entry->trans_fn)); __entry->caller_ip = caller_ip; __entry->btree_id = path->btree_id; __entry->level = path->level; TRACE_BPOS_assign(pos, path->pos); - if (IS_ERR(b)) + + c = bch2_btree_node_lock_counts(trans, NULL, &path->l[level].b->c, level), + __entry->self_read_count = c.n[SIX_LOCK_read]; + __entry->self_intent_count = c.n[SIX_LOCK_intent]; + + if (IS_ERR(b)) { strscpy(__entry->node, bch2_err_str(PTR_ERR(b)), sizeof(__entry->node)); - else + } else { + c = six_lock_counts(&path->l[level].b->c.lock); + __entry->read_count = c.n[SIX_LOCK_read]; + __entry->intent_count = c.n[SIX_LOCK_intent]; scnprintf(__entry->node, sizeof(__entry->node), "%px", b); + } __entry->iter_lock_seq = path->l[level].lock_seq; __entry->node_lock_seq = is_btree_node(path, level) ? six_lock_seq(&path->l[level].b->c.lock) : 0; ), - TP_printk("%s %pS btree %s pos %llu:%llu:%u level %u node %s iter seq %u lock seq %u", + TP_printk("%s %pS btree %s pos %llu:%llu:%u level %u node %s held %u:%u lock count %u:%u iter seq %u lock seq %u", __entry->trans_fn, (void *) __entry->caller_ip, bch2_btree_ids[__entry->btree_id], @@ -434,6 +448,10 @@ TRACE_EVENT(btree_path_relock_fail, __entry->pos_snapshot, __entry->level, __entry->node, + __entry->self_read_count, + __entry->self_intent_count, + __entry->read_count, + __entry->intent_count, __entry->iter_lock_seq, __entry->node_lock_seq) ); @@ -475,7 +493,7 @@ TRACE_EVENT(btree_path_upgrade_fail, __entry->self_intent_count = c.n[SIX_LOCK_intent]; c = six_lock_counts(&path->l[level].b->c.lock); __entry->read_count = c.n[SIX_LOCK_read]; - __entry->intent_count = c.n[SIX_LOCK_read]; + __entry->intent_count = c.n[SIX_LOCK_intent]; __entry->iter_lock_seq = path->l[level].lock_seq; __entry->node_lock_seq = is_btree_node(path, level) ? six_lock_seq(&path->l[level].b->c.lock) |