]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
Use block_rq_error if RHEL >= 9.1
authorEtienne Champetier <e.champetier@ateme.com>
Mon, 26 Feb 2024 20:02:01 +0000 (15:02 -0500)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Tue, 11 Jun 2024 07:34:16 +0000 (09:34 +0200)
The commit introducing block_rq_error tracepoint
has been backported in RHEL 9.1, so improve the check
for block_rq_error presence to use it.

Signed-off-by: Etienne Champetier <e.champetier@ateme.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
configure.ac
ras-events.c

index 163fa1776e1d17bf996f48d7c54bc3cd8bad4089..9d8a065a28962b8a2b11ae2fba94c79404adf423 100644 (file)
@@ -117,6 +117,19 @@ AS_IF([test "x$enable_diskerror" = "xyes" || test "x$enable_all" = "xyes"], [
 AM_CONDITIONAL([WITH_DISKERROR], [test x$enable_diskerror = xyes || test x$enable_all = xyes])
 AM_COND_IF([WITH_DISKERROR], [USE_DISKERROR="yes"], [USE_DISKERROR="no"])
 
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0)
+#ifdef RHEL_RELEASE_CODE
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(9, 1)
+# error kernel too old
+#endif
+#else
+# error kernel too old
+#endif
+#endif
+]])], [AC_DEFINE(HAVE_BLK_RQ_ERROR,1,"have block_rq_error tracepoint")])
+
 AC_ARG_ENABLE([memory_failure],
     AS_HELP_STRING([--enable-memory-failure], [enable memory failure events (currently experimental)]))
 
index a09723822bdfdb1904e686bcec3c2ca1710e702a..9e20ab4e94be67a878081008858328d9c67f62a2 100644 (file)
@@ -28,7 +28,6 @@
 #include <sys/poll.h>
 #include <signal.h>
 #include <sys/signalfd.h>
-#include <linux/version.h>
 #include <traceevent/kbuffer.h>
 #include <traceevent/event-parse.h>
 #include "ras-mc-handler.h"
@@ -250,7 +249,7 @@ int toggle_ras_mc_event(int enable)
 #endif
 
 #ifdef HAVE_DISKERROR
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+#ifdef HAVE_BLK_RQ_ERROR
        rc |= __toggle_ras_mc_event(ras, "block", "block_rq_error", enable);
 #else
        rc |= __toggle_ras_mc_event(ras, "block", "block_rq_complete", enable);
@@ -277,7 +276,7 @@ free_ras:
        return rc;
 }
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0)
+#ifndef HAVE_BLK_RQ_ERROR
 /*
  * Set kernel filter. libtrace doesn't provide an API for setting filters
  * in kernel, we have to implement it here.
@@ -1014,7 +1013,7 @@ int handle_ras_events(int record_events)
 #endif
 
 #ifdef HAVE_DISKERROR
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+#ifdef HAVE_BLK_RQ_ERROR
        rc = add_event_handler(ras, pevent, page_size, "block",
                               "block_rq_error", ras_diskerror_event_handler,
                                NULL, DISKERROR_EVENT);