btrfs: trace: Introduce trace events for sleepable tree lock
authorQu Wenruo <wqu@suse.com>
Mon, 15 Apr 2019 13:15:24 +0000 (21:15 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 29 Apr 2019 17:02:43 +0000 (19:02 +0200)
commit34e73cc930a8677426c9cbffdd3421e18f32e79f
treefa697652fe3dc42fc3e4afceeb047355c8710e5e
parent74f657d89c6734c260509338e88ad6d5f5a24e1d
btrfs: trace: Introduce trace events for sleepable tree lock

There are two tree lock events which can sleep:
- btrfs_tree_read_lock()
- btrfs_tree_lock()

Sometimes we may need to look into the concurrency picture of the fs.
For that case, we need the execution time of above two functions and the
owner of @eb.

Here we introduce a trace events for user space tools like bcc, to get
the execution time of above two functions, and get detailed owner info
where eBPF code can't.

All the overhead is hidden behind the trace events, so if events are not
enabled, there is no overhead.

These trace events also output bytenr and generation, allow them to be
pared with unlock events to pin down deadlock.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/locking.c
include/trace/events/btrfs.h