Skip to content

Commit 7e98d30

Browse files
robnbehlendorf
authored andcommitted
Linux 6.11: get backing_dev_info through queue gendisk
It's no longer available directly on the request queue, but its easy to get from the attached disk. Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/ Closes #16400
1 parent e95b732 commit 7e98d30

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

config/kernel-blk-queue.m4

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_PLUG], [
2525
dnl #
2626
dnl # 2.6.32 - 4.11: statically allocated bdi in request_queue
2727
dnl # 4.12: dynamically allocated bdi in request_queue
28+
dnl # 6.11: bdi no longer available through request_queue, so get it from
29+
dnl # the gendisk attached to the queue
2830
dnl #
2931
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI], [
3032
ZFS_LINUX_TEST_SRC([blk_queue_bdi], [
@@ -47,6 +49,30 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_BDI], [
4749
])
4850
])
4951

52+
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISK_BDI], [
53+
ZFS_LINUX_TEST_SRC([blk_queue_disk_bdi], [
54+
#include <linux/blkdev.h>
55+
#include <linux/backing-dev.h>
56+
], [
57+
struct request_queue q;
58+
struct gendisk disk;
59+
struct backing_dev_info bdi __attribute__ ((unused));
60+
q.disk = &disk;
61+
q.disk->bdi = &bdi;
62+
])
63+
])
64+
65+
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISK_BDI], [
66+
AC_MSG_CHECKING([whether backing_dev_info is available through queue gendisk])
67+
ZFS_LINUX_TEST_RESULT([blk_queue_disk_bdi], [
68+
AC_MSG_RESULT(yes)
69+
AC_DEFINE(HAVE_BLK_QUEUE_DISK_BDI, 1,
70+
[backing_dev_info is available through queue gendisk])
71+
],[
72+
AC_MSG_RESULT(no)
73+
])
74+
])
75+
5076
dnl #
5177
dnl # 5.9: added blk_queue_update_readahead(),
5278
dnl # 5.15: renamed to disk_update_readahead()
@@ -407,6 +433,7 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_MQ], [
407433
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE], [
408434
ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG
409435
ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI
436+
ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISK_BDI
410437
ZFS_AC_KERNEL_SRC_BLK_QUEUE_UPDATE_READAHEAD
411438
ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD
412439
ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE
@@ -421,6 +448,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE], [
421448
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE], [
422449
ZFS_AC_KERNEL_BLK_QUEUE_PLUG
423450
ZFS_AC_KERNEL_BLK_QUEUE_BDI
451+
ZFS_AC_KERNEL_BLK_QUEUE_DISK_BDI
424452
ZFS_AC_KERNEL_BLK_QUEUE_UPDATE_READAHEAD
425453
ZFS_AC_KERNEL_BLK_QUEUE_DISCARD
426454
ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE

include/os/linux/kernel/linux/blkdev_compat.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ blk_queue_set_read_ahead(struct request_queue *q, unsigned long ra_pages)
133133
{
134134
#if !defined(HAVE_BLK_QUEUE_UPDATE_READAHEAD) && \
135135
!defined(HAVE_DISK_UPDATE_READAHEAD)
136-
#ifdef HAVE_BLK_QUEUE_BDI_DYNAMIC
136+
#if defined(HAVE_BLK_QUEUE_BDI_DYNAMIC)
137137
q->backing_dev_info->ra_pages = ra_pages;
138+
#elif defined(HAVE_BLK_QUEUE_DISK_BDI)
139+
q->disk->bdi->ra_pages = ra_pages;
138140
#else
139141
q->backing_dev_info.ra_pages = ra_pages;
140142
#endif

0 commit comments

Comments
 (0)