Skip to content

Commit

Permalink
examples: Fix disksnoop
Browse files Browse the repository at this point in the history
Kernel commit 24b83deb29b ("block: move struct request to blk-mq.h")
and be6bfe36db17 ("block: inline hot paths of blk_account_io_*()")
introduce changes which break disksnoop.

Like iovisor#3748 and iovisor#3877 but for disksnoop, this commit fixes those issues.

Closes iovisor#3825.

Signed-off-by: Hengqi Chen <[email protected]>
  • Loading branch information
chenhengqi authored and yonghong-song committed Feb 24, 2022
1 parent 3b5b686 commit 3a03901
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/tracing/disksnoop.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# load BPF program
b = BPF(text="""
#include <uapi/linux/ptrace.h>
#include <linux/blkdev.h>
#include <linux/blk-mq.h>
BPF_HASH(start, struct request *);
Expand All @@ -46,7 +46,10 @@
if BPF.get_kprobe_functions(b'blk_start_request'):
b.attach_kprobe(event="blk_start_request", fn_name="trace_start")
b.attach_kprobe(event="blk_mq_start_request", fn_name="trace_start")
b.attach_kprobe(event="blk_account_io_done", fn_name="trace_completion")
if BPF.get_kprobe_functions(b'__blk_account_io_done'):
b.attach_kprobe(event="__blk_account_io_done", fn_name="trace_completion")
else:
b.attach_kprobe(event="blk_account_io_done", fn_name="trace_completion")

# header
print("%-18s %-2s %-7s %8s" % ("TIME(s)", "T", "BYTES", "LAT(ms)"))
Expand Down

0 comments on commit 3a03901

Please sign in to comment.