Blob Blame History Raw
From 617bb8501c091be2501b3abe4dad47804d5a4278 Mon Sep 17 00:00:00 2001
From: Viktor Malik <viktor.malik@gmail.com>
Date: Mon, 17 Jan 2022 11:15:26 +0100
Subject: [PATCH] Update bio* tools to work on RHEL9

Kernel commit:
    9e6c144e5fee block: inline hot paths of blk_account_io_*()
renamed some functions used in the tools.

Kernel commit:
    5f8d3bf600d2 block: move struct request to blk-mq.h
moved "struct request" to a different header.

This fixes both issues.
---
 tools/biolatency.bt | 4 ++--
 tools/biosnoop.bt   | 6 +++---
 tools/biostacks.bt  | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/biolatency.bt b/tools/biolatency.bt
index 4ea910b4..8fb0490d 100755
--- a/tools/biolatency.bt
+++ b/tools/biolatency.bt
@@ -16,12 +16,12 @@ BEGIN
 	printf("Tracing block device I/O... Hit Ctrl-C to end.\n");
 }
 
-kprobe:blk_account_io_start
+kprobe:__blk_account_io_start
 {
 	@start[arg0] = nsecs;
 }
 
-kprobe:blk_account_io_done
+kprobe:__blk_account_io_done
 /@start[arg0]/
 {
 	@usecs = hist((nsecs - @start[arg0]) / 1000);
diff --git a/tools/biosnoop.bt b/tools/biosnoop.bt
index 38ffeb52..6519054c 100755
--- a/tools/biosnoop.bt
+++ b/tools/biosnoop.bt
@@ -1,5 +1,5 @@
 #!/usr/bin/env bpftrace
-#include <linux/blkdev.h>
+#include <linux/blk-mq.h>
 /*
  * biosnoop.bt   Block I/O tracing tool, showing per I/O latency.
  *               For Linux, uses bpftrace, eBPF.
@@ -16,7 +16,7 @@ BEGIN
 	printf("%-12s %-7s %-16s %-6s %7s\n", "TIME(ms)", "DISK", "COMM", "PID", "LAT(ms)");
 }
 
-kprobe:blk_account_io_start
+kprobe:__blk_account_io_start
 {
 	@start[arg0] = nsecs;
 	@iopid[arg0] = pid;
@@ -24,7 +24,7 @@ kprobe:blk_account_io_start
 	@disk[arg0] = ((struct request *)arg0)->rq_disk->disk_name;
 }
 
-kprobe:blk_account_io_done
+kprobe:__blk_account_io_done
 /@start[arg0] != 0 && @iopid[arg0] != 0 && @iocomm[arg0] != ""/
 
 {
diff --git a/tools/biostacks.bt b/tools/biostacks.bt
index 58201cdf..fdd2efed 100755
--- a/tools/biostacks.bt
+++ b/tools/biostacks.bt
@@ -18,7 +18,7 @@ BEGIN
 	printf("Tracing block I/O with init stacks. Hit Ctrl-C to end.\n");
 }
 
-kprobe:blk_account_io_start
+kprobe:__blk_account_io_start
 {
 	@reqstack[arg0] = kstack;
 	@reqts[arg0] = nsecs;
-- 
2.34.1