2022-09-27 11:07:42 +00:00
|
|
|
From 5e7543d35596fabd9e5b02b58f8910bf572ca2fa Mon Sep 17 00:00:00 2001
|
2021-12-07 18:21:21 +00:00
|
|
|
From: Jerome Marchand <jmarchan@redhat.com>
|
|
|
|
Date: Thu, 7 Oct 2021 17:31:53 +0200
|
2022-09-27 11:07:42 +00:00
|
|
|
Subject: [PATCH] C9S: Fix mdflush
|
2021-12-07 18:21:21 +00:00
|
|
|
|
|
|
|
Since kernel commit 309dca309fc ("block: store a block_device pointer
|
|
|
|
in struct bio") struct bio points again to a block_device and not to a
|
|
|
|
gendisk directly. However mdflush is looking at the presence or not of
|
|
|
|
the bio_dev macro to check whether to get the gendisk directly from
|
|
|
|
the bio or not, which doesn't work anymore since the bio_dev macro
|
|
|
|
still exists. Since we don't have to deal other ekrnel kernel version
|
|
|
|
but our own, just use the definition that we use in our kernels.
|
2022-09-27 11:07:42 +00:00
|
|
|
|
|
|
|
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
|
2021-12-07 18:21:21 +00:00
|
|
|
---
|
|
|
|
tools/mdflush.py | 11 -----------
|
|
|
|
1 file changed, 11 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/tools/mdflush.py b/tools/mdflush.py
|
2022-09-27 11:07:42 +00:00
|
|
|
index 8a23520b..3581d1bf 100755
|
2021-12-07 18:21:21 +00:00
|
|
|
--- a/tools/mdflush.py
|
|
|
|
+++ b/tools/mdflush.py
|
|
|
|
@@ -35,18 +35,7 @@ int kprobe__md_flush_request(struct pt_regs *ctx, void *mddev, struct bio *bio)
|
2022-09-27 11:07:42 +00:00
|
|
|
u32 pid = bpf_get_current_pid_tgid() >> 32;
|
2021-12-07 18:21:21 +00:00
|
|
|
data.pid = pid;
|
|
|
|
bpf_get_current_comm(&data.comm, sizeof(data.comm));
|
|
|
|
-/*
|
|
|
|
- * The following deals with a kernel version change (in mainline 4.14, although
|
|
|
|
- * it may be backported to earlier kernels) with how the disk name is accessed.
|
|
|
|
- * We handle both pre- and post-change versions here. Please avoid kernel
|
|
|
|
- * version tests like this as much as possible: they inflate the code, test,
|
|
|
|
- * and maintenance burden.
|
|
|
|
- */
|
|
|
|
-#ifdef bio_dev
|
|
|
|
- struct gendisk *bi_disk = bio->bi_disk;
|
|
|
|
-#else
|
|
|
|
struct gendisk *bi_disk = bio->bi_bdev->bd_disk;
|
|
|
|
-#endif
|
|
|
|
bpf_probe_read_kernel(&data.disk, sizeof(data.disk), bi_disk->disk_name);
|
|
|
|
events.perf_submit(ctx, &data, sizeof(data));
|
|
|
|
return 0;
|
|
|
|
--
|
2022-09-27 11:07:42 +00:00
|
|
|
2.35.1
|
2021-12-07 18:21:21 +00:00
|
|
|
|