Blob Blame History Raw
From ee81072e75bcc796b1154c315e2eb0371928a922 Mon Sep 17 00:00:00 2001
From: Jerome Marchand <jmarchan@redhat.com>
Date: Wed, 23 Feb 2022 16:04:30 +0100
Subject: [PATCH] tools: include blk-mq.h in bio tools

Kernel commit 24b83deb29b ("block: move struct request to blk-mq.h")
has moved struct request  from blkdev.h to blk-mq.h. It results in
several bio tools to fail with errors of the following type:

error: incomplete definition of type 'struct request'

Since blk-mq.h had always included blkdev.h. it is safe to simply
replace the inclusion of blkdev.h by blk-mq-h. It works on both older
and newer kernel.

Fixes: #3869

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
 tools/biolatency.py | 2 +-
 tools/biosnoop.py   | 2 +-
 tools/biotop.py     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/biolatency.py b/tools/biolatency.py
index f4e2c9ea..427cee47 100755
--- a/tools/biolatency.py
+++ b/tools/biolatency.py
@@ -64,7 +64,7 @@ debug = 0
 # define BPF program
 bpf_text = """
 #include <uapi/linux/ptrace.h>
-#include <linux/blkdev.h>
+#include <linux/blk-mq.h>
 
 typedef struct disk_key {
     char disk[DISK_NAME_LEN];
diff --git a/tools/biosnoop.py b/tools/biosnoop.py
index 2b954ac9..ae38e384 100755
--- a/tools/biosnoop.py
+++ b/tools/biosnoop.py
@@ -37,7 +37,7 @@ debug = 0
 # define BPF program
 bpf_text="""
 #include <uapi/linux/ptrace.h>
-#include <linux/blkdev.h>
+#include <linux/blk-mq.h>
 
 // for saving the timestamp and __data_len of each request
 struct start_req_t {
diff --git a/tools/biotop.py b/tools/biotop.py
index eac4dab9..b3e3ea00 100755
--- a/tools/biotop.py
+++ b/tools/biotop.py
@@ -54,7 +54,7 @@ diskstats = "/proc/diskstats"
 # load BPF program
 bpf_text = """
 #include <uapi/linux/ptrace.h>
-#include <linux/blkdev.h>
+#include <linux/blk-mq.h>
 
 // for saving the timestamp and __data_len of each request
 struct start_req_t {
-- 
2.35.1