biolatency, biolatpcts, biosnoop, biotop: Build fix for v5.17+
During 5.17 dev cycle, the kernel dropped request->rq_disk. It can now be
accessed through request->q->disk. Fix the python ones in tools/. There are
more usages in other places which need to be fixed too.
Signed-off-by: Tejun Heo <tj@kernel.org>
diff --git a/tools/biotop.py b/tools/biotop.py
index b3e3ea0..882835f 100755
--- a/tools/biotop.py
+++ b/tools/biotop.py
@@ -129,8 +129,8 @@
// setup info_t key
struct info_t info = {};
- info.major = req->rq_disk->major;
- info.minor = req->rq_disk->first_minor;
+ info.major = req->__RQ_DISK__->major;
+ info.minor = req->__RQ_DISK__->first_minor;
/*
* The following deals with a kernel version change (in mainline 4.7, although
* it may be backported to earlier kernels) with how block request write flags
@@ -174,6 +174,11 @@
print(bpf_text)
exit()
+if BPF.kernel_struct_has_field(b'request', b'rq_disk'):
+ bpf_text = bpf_text.replace('__RQ_DISK__', 'rq_disk')
+else:
+ bpf_text = bpf_text.replace('__RQ_DISK__', 'q->disk')
+
b = BPF(text=bpf_text)
if BPF.get_kprobe_functions(b'__blk_account_io_start'):
b.attach_kprobe(event="__blk_account_io_start", fn_name="trace_pid_start")