diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-08-23 08:20:24 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:39 +0300 |
commit | c240c3a94427346f27a7ff48f02cbe03f2c2ebd6 (patch) | |
tree | 8cff7106c897d4263258f6820831117286949749 | |
parent | 14599cce443323ce23b4b266068b7018e42bd30c (diff) | |
download | linux-c240c3a94427346f27a7ff48f02cbe03f2c2ebd6.tar.xz |
bcachefs: Print lock counts in debugs btree_transactions
Improve our debugfs output, to help in debugging deadlocks: this shows,
for every btree node we print, the current number of readers/intent
locks/write locks held.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/btree_iter.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c index ce9437916cf2..99422e29c704 100644 --- a/fs/bcachefs/btree_iter.c +++ b/fs/bcachefs/btree_iter.c @@ -3024,9 +3024,21 @@ bch2_btree_path_node_to_text(struct printbuf *out, struct btree_bkey_cached_common *b, bool cached) { + struct six_lock_count c = six_lock_counts(&b->lock); + struct task_struct *owner; + pid_t pid; + + rcu_read_lock(); + owner = READ_ONCE(b->lock.owner); + pid = owner ? owner->pid : 0;; + rcu_read_unlock(); + prt_printf(out, " l=%u %s:", b->level, bch2_btree_ids[b->btree_id]); bch2_bpos_to_text(out, btree_node_pos(b, cached)); + + prt_printf(out, " locks %u:%u:%u held by pid %u", + c.n[0], c.n[1], c.n[2], pid); } #ifdef CONFIG_BCACHEFS_DEBUG_TRANSACTIONS |