Linux 7.0: blk_queue_nonrot() renamed to blk_queue_rot()

It does exactly the same thing, just inverts the return. Detect its
presence or absence and call the right one.

Sponsored-by: TrueNAS
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@truenas.com>
Closes #18216
This commit is contained in:
Rob Norris 2026-02-05 19:39:23 +11:00 committed by Brian Behlendorf
parent 7744f04962
commit 204de946eb
2 changed files with 30 additions and 0 deletions

View File

@ -226,6 +226,30 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [
])
])
dnl #
dnl # 7.0 API change
dnl # blk_queue_rot() replaces blk_queue_nonrot() (inverted meaning)
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_ROT], [
ZFS_LINUX_TEST_SRC([blk_queue_rot], [
#include <linux/blkdev.h>
], [
struct request_queue *q __attribute__ ((unused)) = NULL;
(void) blk_queue_rot(q);
], [])
])
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_ROT], [
AC_MSG_CHECKING([whether blk_queue_rot() is available])
ZFS_LINUX_TEST_RESULT([blk_queue_rot], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLK_QUEUE_ROT, 1,
[blk_queue_rot() is available])
],[
AC_MSG_RESULT(no)
])
])
dnl #
dnl # 2.6.34 API change
dnl # blk_queue_max_segments() consolidates blk_queue_max_hw_segments()
@ -279,6 +303,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE], [
ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE
ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS
ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS
ZFS_AC_KERNEL_SRC_BLK_QUEUE_ROT
ZFS_AC_KERNEL_SRC_BLK_MQ_RQ_HCTX
])
@ -291,5 +316,6 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE], [
ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE
ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS
ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS
ZFS_AC_KERNEL_BLK_QUEUE_ROT
ZFS_AC_KERNEL_BLK_MQ_RQ_HCTX
])

View File

@ -445,7 +445,11 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
v->vdev_has_securetrim = bdev_secure_discard_supported(bdev);
/* Inform the ZIO pipeline that we are non-rotational */
#ifdef HAVE_BLK_QUEUE_ROT
v->vdev_nonrot = !blk_queue_rot(bdev_get_queue(bdev));
#else
v->vdev_nonrot = blk_queue_nonrot(bdev_get_queue(bdev));
#endif
/* Is backed by a block device. */
v->vdev_is_blkdev = B_TRUE;