Skip to content

btrfs: trace: Trace events for btrfs tree locking

Qu Wenruo linux-btrfs 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 1 replyIn review
  2. v21 patch 4 repliesSuperseded
  3. v11 patch 0 repliesSuperseded

Changes in v3 from the cover letter

- More output for human to take a glance
- More trace events for later bcc usage
Like lock leakage and deadlock detection.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: trace: Introduce trace events for sleepable tree lockfs/btrfs/locking.c include/trace/events/btrfs.h+56 -00 replies
2/2btrfs: trace: Introduce trace events for all btrfs tree locking eventsfs/btrfs/locking.c include/trace/events/btrfs.h+52 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/2] btrfs: trace: Trace events for btrfs tree locking

This branch can be fetched from github:
https://github.com/adam900710/linux/tree/trace_locking
Which is based on v5.1-rc4 tag.

This patchset will introduce the following trace events for corresponding functions:
btrfs_tree_lock (sleepable)
btrfs_tree_unlock
btrfs_tree_read_lock (sleepable)
btrfs_tree_read_unlock
btrfs_tree_read_unlock_blocking btrfs_set_lock_blocking_read
btrfs_set_lock_blocking_write btrfs_clear_lock_blocking_read btrfs_clear_lock_blocking_write
btrfs_try_tree_read_lock
btrfs_try_tree_write_lock
btrfs_tree_read_lock_atomic

The two sleepable ones will have extra info like start_ns, end_ns, diff_ns.
Those two can be specially useful for tree lock wait time. There is tool to utilize those two events already:
https://github.com/adam900710/btrfs-profiler/blob/master/tree_lock_wait.py

The non-sleepable can be useful for possible user space based lock leakage/dead lock detector.

Changelog:
v2:
- Hide all ktime_get_ns() call out of trace events
So there will be no overhead if trace events are not enabled.

v3:
- More output for human to take a glance
- More trace events for later bcc usage
Like lock leakage and deadlock detection.

Qu Wenruo (2):
btrfs: trace: Introduce trace events for sleepable tree lock
btrfs: trace: Introduce trace events for all btrfs tree locking events

 fs/btrfs/locking.c           | 22 +++++++++
 include/trace/events/btrfs.h | 86 ++++++++++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+)
Signature · 1 line
2.21.0