2 dnl # 2.6.39 API change,
3 dnl # blk_start_plug() and blk_finish_plug()
5 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG], [
6 ZFS_LINUX_TEST_SRC([blk_plug], [
7 #include <linux/blkdev.h>
9 struct blk_plug plug __attribute__ ((unused));
11 blk_start_plug(&plug);
12 blk_finish_plug(&plug);
16 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_PLUG], [
17 AC_MSG_CHECKING([whether struct blk_plug is available])
18 ZFS_LINUX_TEST_RESULT([blk_plug], [
21 ZFS_LINUX_TEST_ERROR([blk_plug])
26 dnl # 2.6.32 - 4.11: statically allocated bdi in request_queue
27 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
31 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI], [
32 ZFS_LINUX_TEST_SRC([blk_queue_bdi], [
33 #include <linux/blkdev.h>
35 struct request_queue q;
36 struct backing_dev_info bdi;
37 q.backing_dev_info = &bdi;
41 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_BDI], [
42 AC_MSG_CHECKING([whether blk_queue bdi is dynamic])
43 ZFS_LINUX_TEST_RESULT([blk_queue_bdi], [
45 AC_DEFINE(HAVE_BLK_QUEUE_BDI_DYNAMIC, 1,
46 [blk queue backing_dev_info is dynamic])
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>
57 struct request_queue q;
59 struct backing_dev_info bdi __attribute__ ((unused));
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], [
69 AC_DEFINE(HAVE_BLK_QUEUE_DISK_BDI, 1,
70 [backing_dev_info is available through queue gendisk])
77 dnl # 5.9: added blk_queue_update_readahead(),
78 dnl # 5.15: renamed to disk_update_readahead()
80 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_UPDATE_READAHEAD], [
81 ZFS_LINUX_TEST_SRC([blk_queue_update_readahead], [
82 #include <linux/blkdev.h>
84 struct request_queue q;
85 blk_queue_update_readahead(&q);
88 ZFS_LINUX_TEST_SRC([disk_update_readahead], [
89 #include <linux/blkdev.h>
92 disk_update_readahead(&disk);
96 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_UPDATE_READAHEAD], [
97 AC_MSG_CHECKING([whether blk_queue_update_readahead() exists])
98 ZFS_LINUX_TEST_RESULT([blk_queue_update_readahead], [
100 AC_DEFINE(HAVE_BLK_QUEUE_UPDATE_READAHEAD, 1,
101 [blk_queue_update_readahead() exists])
105 AC_MSG_CHECKING([whether disk_update_readahead() exists])
106 ZFS_LINUX_TEST_RESULT([disk_update_readahead], [
108 AC_DEFINE(HAVE_DISK_UPDATE_READAHEAD, 1,
109 [disk_update_readahead() exists])
117 dnl # 5.19: bdev_max_discard_sectors() available
118 dnl # 2.6.32: blk_queue_discard() available
120 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [
121 ZFS_LINUX_TEST_SRC([bdev_max_discard_sectors], [
122 #include <linux/blkdev.h>
124 struct block_device *bdev __attribute__ ((unused)) = NULL;
125 unsigned int error __attribute__ ((unused));
127 error = bdev_max_discard_sectors(bdev);
130 ZFS_LINUX_TEST_SRC([blk_queue_discard], [
131 #include <linux/blkdev.h>
133 struct request_queue r;
134 struct request_queue *q = &r;
135 int value __attribute__ ((unused));
136 memset(q, 0, sizeof(r));
137 value = blk_queue_discard(q);
138 ],[-Wframe-larger-than=8192])
141 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [
142 AC_MSG_CHECKING([whether bdev_max_discard_sectors() is available])
143 ZFS_LINUX_TEST_RESULT([bdev_max_discard_sectors], [
145 AC_DEFINE(HAVE_BDEV_MAX_DISCARD_SECTORS, 1,
146 [bdev_max_discard_sectors() is available])
150 AC_MSG_CHECKING([whether blk_queue_discard() is available])
151 ZFS_LINUX_TEST_RESULT([blk_queue_discard], [
153 AC_DEFINE(HAVE_BLK_QUEUE_DISCARD, 1,
154 [blk_queue_discard() is available])
156 ZFS_LINUX_TEST_ERROR([blk_queue_discard])
162 dnl # 5.19: bdev_max_secure_erase_sectors() available
163 dnl # 4.8: blk_queue_secure_erase() available
165 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE], [
166 ZFS_LINUX_TEST_SRC([bdev_max_secure_erase_sectors], [
167 #include <linux/blkdev.h>
169 struct block_device *bdev __attribute__ ((unused)) = NULL;
170 unsigned int error __attribute__ ((unused));
172 error = bdev_max_secure_erase_sectors(bdev);
175 ZFS_LINUX_TEST_SRC([blk_queue_secure_erase], [
176 #include <linux/blkdev.h>
178 struct request_queue r;
179 struct request_queue *q = &r;
180 int value __attribute__ ((unused));
181 memset(q, 0, sizeof(r));
182 value = blk_queue_secure_erase(q);
183 ],[-Wframe-larger-than=8192])
186 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [
187 AC_MSG_CHECKING([whether bdev_max_secure_erase_sectors() is available])
188 ZFS_LINUX_TEST_RESULT([bdev_max_secure_erase_sectors], [
190 AC_DEFINE(HAVE_BDEV_MAX_SECURE_ERASE_SECTORS, 1,
191 [bdev_max_secure_erase_sectors() is available])
195 AC_MSG_CHECKING([whether blk_queue_secure_erase() is available])
196 ZFS_LINUX_TEST_RESULT([blk_queue_secure_erase], [
198 AC_DEFINE(HAVE_BLK_QUEUE_SECURE_ERASE, 1,
199 [blk_queue_secure_erase() is available])
201 ZFS_LINUX_TEST_ERROR([blk_queue_secure_erase])
207 dnl # 2.6.34 API change
208 dnl # blk_queue_max_hw_sectors() replaces blk_queue_max_sectors().
210 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS], [
211 ZFS_LINUX_TEST_SRC([blk_queue_max_hw_sectors], [
212 #include <linux/blkdev.h>
214 struct request_queue *q __attribute__ ((unused)) = NULL;
215 (void) blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS);
219 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [
220 AC_MSG_CHECKING([whether blk_queue_max_hw_sectors() is available])
221 ZFS_LINUX_TEST_RESULT([blk_queue_max_hw_sectors], [
229 dnl # 2.6.34 API change
230 dnl # blk_queue_max_segments() consolidates blk_queue_max_hw_segments()
231 dnl # and blk_queue_max_phys_segments().
233 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS], [
234 ZFS_LINUX_TEST_SRC([blk_queue_max_segments], [
235 #include <linux/blkdev.h>
237 struct request_queue *q __attribute__ ((unused)) = NULL;
238 (void) blk_queue_max_segments(q, BLK_MAX_SEGMENTS);
242 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS], [
243 AC_MSG_CHECKING([whether blk_queue_max_segments() is available])
244 ZFS_LINUX_TEST_RESULT([blk_queue_max_segments], [
251 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_MQ_RQ_HCTX], [
252 ZFS_LINUX_TEST_SRC([blk_mq_rq_hctx], [
253 #include <linux/blk-mq.h>
254 #include <linux/blkdev.h>
256 struct request rq = {0};
257 struct blk_mq_hw_ctx *hctx = NULL;
262 AC_DEFUN([ZFS_AC_KERNEL_BLK_MQ_RQ_HCTX], [
263 AC_MSG_CHECKING([whether block multiqueue hardware context is cached in struct request])
264 ZFS_LINUX_TEST_RESULT([blk_mq_rq_hctx], [
266 AC_DEFINE(HAVE_BLK_MQ_RQ_HCTX, 1, [block multiqueue hardware context is cached in struct request])
272 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE], [
273 ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG
274 ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI
275 ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISK_BDI
276 ZFS_AC_KERNEL_SRC_BLK_QUEUE_UPDATE_READAHEAD
277 ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD
278 ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE
279 ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS
280 ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS
281 ZFS_AC_KERNEL_SRC_BLK_MQ_RQ_HCTX
284 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE], [
285 ZFS_AC_KERNEL_BLK_QUEUE_PLUG
286 ZFS_AC_KERNEL_BLK_QUEUE_BDI
287 ZFS_AC_KERNEL_BLK_QUEUE_DISK_BDI
288 ZFS_AC_KERNEL_BLK_QUEUE_UPDATE_READAHEAD
289 ZFS_AC_KERNEL_BLK_QUEUE_DISCARD
290 ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE
291 ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS
292 ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS
293 ZFS_AC_KERNEL_BLK_MQ_RQ_HCTX