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 <[email protected]>
diff --git a/tools/biosnoop.py b/tools/biosnoop.py
index ae38e38..a2b636a 100755
--- a/tools/biosnoop.py
+++ b/tools/biosnoop.py
@@ -125,7 +125,7 @@
data.pid = valp->pid;
data.sector = req->__sector;
bpf_probe_read_kernel(&data.name, sizeof(data.name), valp->name);
- struct gendisk *rq_disk = req->rq_disk;
+ struct gendisk *rq_disk = req->__RQ_DISK__;
bpf_probe_read_kernel(&data.disk_name, sizeof(data.disk_name),
rq_disk->disk_name);
}
@@ -156,6 +156,10 @@
bpf_text = bpf_text.replace('##QUEUE##', '1')
else:
bpf_text = bpf_text.replace('##QUEUE##', '0')
+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')
if debug or args.ebpf:
print(bpf_text)
if args.ebpf: