diff options
author | Rob N <[email protected]> | 2024-04-09 04:38:49 +1000 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2024-04-17 10:10:24 -0700 |
commit | 3c5f354a8c3af6b1f23dcb6b998d82ac64d0e1fe (patch) | |
tree | ab0a4c4eb145d18901451d0b40d2e87b0cf8bddc /module | |
parent | 5c0fe099ec743c979c08964a8ae68322a79ab9bb (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 'module')
-rw-r--r-- | module/os/linux/zfs/zvol_os.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c index 0121f17bb..e1ede9851 100644 --- a/module/os/linux/zfs/zvol_os.c +++ b/module/os/linux/zfs/zvol_os.c @@ -551,7 +551,12 @@ zvol_request_impl(zvol_state_t *zv, struct bio *bio, struct request *rq, uint_t taskq_hash; #ifdef HAVE_BLK_MQ if (rq) +#ifdef HAVE_BLK_MQ_RQ_HCTX blk_mq_hw_queue = rq->mq_hctx->queue_num; +#else + blk_mq_hw_queue = + rq->q->queue_hw_ctx[rq->q->mq_map[rq->cpu]]->queue_num; +#endif #endif taskq_hash = cityhash4((uintptr_t)zv, offset >> ZVOL_TASKQ_OFFSET_SHIFT, blk_mq_hw_queue, 0); |