@@ -63,8 +63,10 @@ $hists:{hist|
6363BPF_HASH($hist.name$, io_hist_key_t, u64);
6464}$
6565
66- int disk_io_start(struct pt_regs *ctx, struct request *reqp )
66+ int disk_io_start(struct bpf_raw_tracepoint_args *ctx)
6767{
68+ struct request *reqp = (struct request *)ctx->args[0];
69+
6870 io_data_t data = {};
6971 struct gendisk *diskp = reqp->q->disk;
7072 data.ts = bpf_ktime_get_ns();
@@ -101,8 +103,10 @@ static int aggregate_data(io_data_t *data, u64 ts, char *opstr)
101103 return 0;
102104}
103105
104- int disk_io_done(struct pt_regs *ctx, struct request *reqp )
106+ int disk_io_done(struct bpf_raw_tracepoint_args *ctx)
105107{
108+ struct request *reqp = (struct request *)ctx->args[0];
109+
106110 u64 ts = bpf_ktime_get_ns();
107111 io_data_t *data = io_base_data.lookup((u64 *) &reqp);
108112 struct bio *bp = reqp->bio;
@@ -126,10 +130,8 @@ int disk_io_done(struct pt_regs *ctx, struct request *reqp)
126130""" # noqa: W293
127131b = BPF(text=bpf_text)
128132
129- if BPF.get_kprobe_functions(b'blk_start_request'):
130- b.attach_kprobe(event="blk_start_request", fn_name="disk_io_start")
131- b.attach_kprobe(event="blk_mq_start_request", fn_name="disk_io_start")
132- b.attach_kprobe(event="blk_mq_end_request", fn_name="disk_io_done")
133+ b.attach_raw_tracepoint("block_io_start", fn_name="disk_io_start")
134+ b.attach_raw_tracepoint("block_io_done", fn_name="disk_io_done")
133135
134136
135137helper = BCCHelper(b, BCCHelper.ANALYTICS_PRINT_MODE)
0 commit comments