const volatile bool targ_queued = false;
const volatile dev_t targ_dev = -1;
+extern __u32 LINUX_KERNEL_VERSION __kconfig;
+
struct piddata {
char comm[TASK_COMM_LEN];
u32 pid;
}
SEC("tp_btf/block_rq_insert")
-int BPF_PROG(block_rq_insert, struct request_queue *q, struct request *rq)
+int BPF_PROG(block_rq_insert)
{
- return trace_rq_start(rq, true);
+ /**
+ * commit a54895fa (v5.11-rc1) changed tracepoint argument list
+ * from TP_PROTO(struct request_queue *q, struct request *rq)
+ * to TP_PROTO(struct request *rq)
+ */
+ if (LINUX_KERNEL_VERSION > KERNEL_VERSION(5, 10, 0))
+ return trace_rq_start((void *)ctx[0], true);
+ else
+ return trace_rq_start((void *)ctx[1], true);
}
SEC("tp_btf/block_rq_issue")
-int BPF_PROG(block_rq_issue, struct request_queue *q, struct request *rq)
+int BPF_PROG(block_rq_issue)
{
- return trace_rq_start(rq, false);
+ /**
+ * commit a54895fa (v5.11-rc1) changed tracepoint argument list
+ * from TP_PROTO(struct request_queue *q, struct request *rq)
+ * to TP_PROTO(struct request *rq)
+ */
+ if (LINUX_KERNEL_VERSION > KERNEL_VERSION(5, 10, 0))
+ return trace_rq_start((void *)ctx[0], false);
+ else
+ return trace_rq_start((void *)ctx[1], false);
}
SEC("tp_btf/block_rq_complete")
const volatile char targ_comm[TASK_COMM_LEN] = {};
const volatile dev_t targ_dev = -1;
+extern __u32 LINUX_KERNEL_VERSION __kconfig;
+
struct {
__uint(type, BPF_MAP_TYPE_HASH);
__uint(max_entries, 10240);
return true;
}
-SEC("tp_btf/block_rq_issue")
-int BPF_PROG(block_rq_issue, struct request_queue *q, struct request *rq)
+static int trace_rq_issue(struct request *rq)
{
struct hist_key hkey;
struct hist *histp;
return 0;
}
+SEC("tp_btf/block_rq_issue")
+int BPF_PROG(block_rq_issue)
+{
+ /**
+ * commit a54895fa (v5.11-rc1) changed tracepoint argument list
+ * from TP_PROTO(struct request_queue *q, struct request *rq)
+ * to TP_PROTO(struct request *rq)
+ */
+ if (LINUX_KERNEL_VERSION > KERNEL_VERSION(5, 10, 0))
+ return trace_rq_issue((void *)ctx[0]);
+ else
+ return trace_rq_issue((void *)ctx[1]);
+}
+
char LICENSE[] SEC("license") = "GPL";