aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorRob N <[email protected]>2024-04-09 04:38:49 +1000
committerTony Hutter <[email protected]>2024-04-17 10:10:24 -0700
commit3c5f354a8c3af6b1f23dcb6b998d82ac64d0e1fe (patch)
treeab0a4c4eb145d18901451d0b40d2e87b0cf8bddc /config
parent5c0fe099ec743c979c08964a8ae68322a79ab9bb (diff)
zvol_os: fix compile with blk-mq on Linux 4.x
99741bde5 accesses a cached blk-mq hardware context through the mq_hctx field of struct request. However, this field did not exist until 5.0. Before that, the private function blk_mq_map_queue() was used to dig it out of broader queue context. This commit detects this situation, and handles it with a poor-man's simulation of that function. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Ameer Hamza <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Rob Norris <[email protected]> Closes #16069
Diffstat (limited to 'config')
-rw-r--r--config/kernel-blk-queue.m415
1 files changed, 15 insertions, 0 deletions
diff --git a/config/kernel-blk-queue.m4 b/config/kernel-blk-queue.m4
index bb5903b31..15dbe1c7d 100644
--- a/config/kernel-blk-queue.m4
+++ b/config/kernel-blk-queue.m4
@@ -377,6 +377,14 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_MQ], [
(void) blk_mq_alloc_tag_set(&tag_set);
return BLK_STS_OK;
], [])
+ ZFS_LINUX_TEST_SRC([blk_mq_rq_hctx], [
+ #include <linux/blk-mq.h>
+ #include <linux/blkdev.h>
+ ], [
+ struct request rq = {0};
+ struct blk_mq_hw_ctx *hctx = NULL;
+ rq.mq_hctx = hctx;
+ ], [])
])
AC_DEFUN([ZFS_AC_KERNEL_BLK_MQ], [
@@ -384,6 +392,13 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_MQ], [
ZFS_LINUX_TEST_RESULT([blk_mq], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLK_MQ, 1, [block multiqueue is available])
+ AC_MSG_CHECKING([whether block multiqueue hardware context is cached in struct request])
+ ZFS_LINUX_TEST_RESULT([blk_mq_rq_hctx], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_BLK_MQ_RQ_HCTX, 1, [block multiqueue hardware context is cached in struct request])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
], [
AC_MSG_RESULT(no)
])