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
29 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI], [
30 ZFS_LINUX_TEST_SRC([blk_queue_bdi], [
31 #include <linux/blkdev.h>
33 struct request_queue q;
34 struct backing_dev_info bdi;
35 q.backing_dev_info = &bdi;
39 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_BDI], [
40 AC_MSG_CHECKING([whether blk_queue bdi is dynamic])
41 ZFS_LINUX_TEST_RESULT([blk_queue_bdi], [
43 AC_DEFINE(HAVE_BLK_QUEUE_BDI_DYNAMIC, 1,
44 [blk queue backing_dev_info is dynamic])
51 dnl # 5.9: added blk_queue_update_readahead(),
52 dnl # 5.15: renamed to disk_update_readahead()
54 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_UPDATE_READAHEAD], [
55 ZFS_LINUX_TEST_SRC([blk_queue_update_readahead], [
56 #include <linux/blkdev.h>
58 struct request_queue q;
59 blk_queue_update_readahead(&q);
62 ZFS_LINUX_TEST_SRC([disk_update_readahead], [
63 #include <linux/blkdev.h>
66 disk_update_readahead(&disk);
70 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_UPDATE_READAHEAD], [
71 AC_MSG_CHECKING([whether blk_queue_update_readahead() exists])
72 ZFS_LINUX_TEST_RESULT([blk_queue_update_readahead], [
74 AC_DEFINE(HAVE_BLK_QUEUE_UPDATE_READAHEAD, 1,
75 [blk_queue_update_readahead() exists])
79 AC_MSG_CHECKING([whether disk_update_readahead() exists])
80 ZFS_LINUX_TEST_RESULT([disk_update_readahead], [
82 AC_DEFINE(HAVE_DISK_UPDATE_READAHEAD, 1,
83 [disk_update_readahead() exists])
91 dnl # 5.19: bdev_max_discard_sectors() available
92 dnl # 2.6.32: blk_queue_discard() available
94 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [
95 ZFS_LINUX_TEST_SRC([bdev_max_discard_sectors], [
96 #include <linux/blkdev.h>
98 struct block_device *bdev __attribute__ ((unused)) = NULL;
99 unsigned int error __attribute__ ((unused));
101 error = bdev_max_discard_sectors(bdev);
104 ZFS_LINUX_TEST_SRC([blk_queue_discard], [
105 #include <linux/blkdev.h>
107 struct request_queue r;
108 struct request_queue *q = &r;
109 int value __attribute__ ((unused));
110 memset(q, 0, sizeof(r));
111 value = blk_queue_discard(q);
112 ],[-Wframe-larger-than=8192])
115 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [
116 AC_MSG_CHECKING([whether bdev_max_discard_sectors() is available])
117 ZFS_LINUX_TEST_RESULT([bdev_max_discard_sectors], [
119 AC_DEFINE(HAVE_BDEV_MAX_DISCARD_SECTORS, 1,
120 [bdev_max_discard_sectors() is available])
124 AC_MSG_CHECKING([whether blk_queue_discard() is available])
125 ZFS_LINUX_TEST_RESULT([blk_queue_discard], [
127 AC_DEFINE(HAVE_BLK_QUEUE_DISCARD, 1,
128 [blk_queue_discard() is available])
130 ZFS_LINUX_TEST_ERROR([blk_queue_discard])
136 dnl # 5.19: bdev_max_secure_erase_sectors() available
137 dnl # 4.8: blk_queue_secure_erase() available
138 dnl # 2.6.36: blk_queue_secdiscard() available
140 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE], [
141 ZFS_LINUX_TEST_SRC([bdev_max_secure_erase_sectors], [
142 #include <linux/blkdev.h>
144 struct block_device *bdev __attribute__ ((unused)) = NULL;
145 unsigned int error __attribute__ ((unused));
147 error = bdev_max_secure_erase_sectors(bdev);
150 ZFS_LINUX_TEST_SRC([blk_queue_secure_erase], [
151 #include <linux/blkdev.h>
153 struct request_queue r;
154 struct request_queue *q = &r;
155 int value __attribute__ ((unused));
156 memset(q, 0, sizeof(r));
157 value = blk_queue_secure_erase(q);
158 ],[-Wframe-larger-than=8192])
160 ZFS_LINUX_TEST_SRC([blk_queue_secdiscard], [
161 #include <linux/blkdev.h>
163 struct request_queue r;
164 struct request_queue *q = &r;
165 int value __attribute__ ((unused));
166 memset(q, 0, sizeof(r));
167 value = blk_queue_secdiscard(q);
171 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [
172 AC_MSG_CHECKING([whether bdev_max_secure_erase_sectors() is available])
173 ZFS_LINUX_TEST_RESULT([bdev_max_secure_erase_sectors], [
175 AC_DEFINE(HAVE_BDEV_MAX_SECURE_ERASE_SECTORS, 1,
176 [bdev_max_secure_erase_sectors() is available])
180 AC_MSG_CHECKING([whether blk_queue_secure_erase() is available])
181 ZFS_LINUX_TEST_RESULT([blk_queue_secure_erase], [
183 AC_DEFINE(HAVE_BLK_QUEUE_SECURE_ERASE, 1,
184 [blk_queue_secure_erase() is available])
188 AC_MSG_CHECKING([whether blk_queue_secdiscard() is available])
189 ZFS_LINUX_TEST_RESULT([blk_queue_secdiscard], [
191 AC_DEFINE(HAVE_BLK_QUEUE_SECDISCARD, 1,
192 [blk_queue_secdiscard() is available])
194 ZFS_LINUX_TEST_ERROR([blk_queue_secure_erase])
201 dnl # 4.16 API change,
202 dnl # Introduction of blk_queue_flag_set and blk_queue_flag_clear
204 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET], [
205 ZFS_LINUX_TEST_SRC([blk_queue_flag_set], [
206 #include <linux/kernel.h>
207 #include <linux/blkdev.h>
209 struct request_queue *q = NULL;
210 blk_queue_flag_set(0, q);
214 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET], [
215 AC_MSG_CHECKING([whether blk_queue_flag_set() exists])
216 ZFS_LINUX_TEST_RESULT([blk_queue_flag_set], [
218 AC_DEFINE(HAVE_BLK_QUEUE_FLAG_SET, 1,
219 [blk_queue_flag_set() exists])
225 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR], [
226 ZFS_LINUX_TEST_SRC([blk_queue_flag_clear], [
227 #include <linux/kernel.h>
228 #include <linux/blkdev.h>
230 struct request_queue *q = NULL;
231 blk_queue_flag_clear(0, q);
235 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR], [
236 AC_MSG_CHECKING([whether blk_queue_flag_clear() exists])
237 ZFS_LINUX_TEST_RESULT([blk_queue_flag_clear], [
239 AC_DEFINE(HAVE_BLK_QUEUE_FLAG_CLEAR, 1,
240 [blk_queue_flag_clear() exists])
247 dnl # 2.6.36 API change,
248 dnl # Added blk_queue_flush() interface, while the previous interface
249 dnl # was available to all the new one is GPL-only. Thus in addition to
250 dnl # detecting if this function is available we determine if it is
251 dnl # GPL-only. If the GPL-only interface is there we implement our own
252 dnl # compatibility function, otherwise we use the function. The hope
253 dnl # is that long term this function will be opened up.
255 dnl # 4.7 API change,
256 dnl # Replace blk_queue_flush with blk_queue_write_cache
258 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [
259 ZFS_LINUX_TEST_SRC([blk_queue_flush], [
260 #include <linux/blkdev.h>
262 struct request_queue *q __attribute__ ((unused)) = NULL;
263 (void) blk_queue_flush(q, REQ_FLUSH);
264 ], [], [ZFS_META_LICENSE])
266 ZFS_LINUX_TEST_SRC([blk_queue_write_cache], [
267 #include <linux/kernel.h>
268 #include <linux/blkdev.h>
270 struct request_queue *q __attribute__ ((unused)) = NULL;
271 blk_queue_write_cache(q, true, true);
272 ], [], [ZFS_META_LICENSE])
275 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [
276 AC_MSG_CHECKING([whether blk_queue_flush() is available])
277 ZFS_LINUX_TEST_RESULT([blk_queue_flush], [
279 AC_DEFINE(HAVE_BLK_QUEUE_FLUSH, 1,
280 [blk_queue_flush() is available])
282 AC_MSG_CHECKING([whether blk_queue_flush() is GPL-only])
283 ZFS_LINUX_TEST_RESULT([blk_queue_flush_license], [
287 AC_DEFINE(HAVE_BLK_QUEUE_FLUSH_GPL_ONLY, 1,
288 [blk_queue_flush() is GPL-only])
296 dnl # Replace blk_queue_flush with blk_queue_write_cache
298 AC_MSG_CHECKING([whether blk_queue_write_cache() exists])
299 ZFS_LINUX_TEST_RESULT([blk_queue_write_cache], [
301 AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE, 1,
302 [blk_queue_write_cache() exists])
304 AC_MSG_CHECKING([whether blk_queue_write_cache() is GPL-only])
305 ZFS_LINUX_TEST_RESULT([blk_queue_write_cache_license], [
309 AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY, 1,
310 [blk_queue_write_cache() is GPL-only])
318 dnl # 2.6.34 API change
319 dnl # blk_queue_max_hw_sectors() replaces blk_queue_max_sectors().
321 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS], [
322 ZFS_LINUX_TEST_SRC([blk_queue_max_hw_sectors], [
323 #include <linux/blkdev.h>
325 struct request_queue *q __attribute__ ((unused)) = NULL;
326 (void) blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS);
330 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [
331 AC_MSG_CHECKING([whether blk_queue_max_hw_sectors() is available])
332 ZFS_LINUX_TEST_RESULT([blk_queue_max_hw_sectors], [
335 ZFS_LINUX_TEST_ERROR([blk_queue_max_hw_sectors])
340 dnl # 2.6.34 API change
341 dnl # blk_queue_max_segments() consolidates blk_queue_max_hw_segments()
342 dnl # and blk_queue_max_phys_segments().
344 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS], [
345 ZFS_LINUX_TEST_SRC([blk_queue_max_segments], [
346 #include <linux/blkdev.h>
348 struct request_queue *q __attribute__ ((unused)) = NULL;
349 (void) blk_queue_max_segments(q, BLK_MAX_SEGMENTS);
353 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS], [
354 AC_MSG_CHECKING([whether blk_queue_max_segments() is available])
355 ZFS_LINUX_TEST_RESULT([blk_queue_max_segments], [
358 ZFS_LINUX_TEST_ERROR([blk_queue_max_segments])
363 dnl # See if kernel supports block multi-queue and blk_status_t.
364 dnl # blk_status_t represents the new status codes introduced in the 4.13
367 dnl # block: introduce new block status code type
369 dnl # We do not currently support the "old" block multi-queue interfaces from
372 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_MQ], [
373 ZFS_LINUX_TEST_SRC([blk_mq], [
374 #include <linux/blk-mq.h>
376 struct blk_mq_tag_set tag_set __attribute__ ((unused)) = {0};
377 (void) blk_mq_alloc_tag_set(&tag_set);
382 AC_DEFUN([ZFS_AC_KERNEL_BLK_MQ], [
383 AC_MSG_CHECKING([whether block multiqueue with blk_status_t is available])
384 ZFS_LINUX_TEST_RESULT([blk_mq], [
386 AC_DEFINE(HAVE_BLK_MQ, 1, [block multiqueue is available])
392 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE], [
393 ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG
394 ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI
395 ZFS_AC_KERNEL_SRC_BLK_QUEUE_UPDATE_READAHEAD
396 ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD
397 ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE
398 ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET
399 ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR
400 ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH
401 ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS
402 ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS
403 ZFS_AC_KERNEL_SRC_BLK_MQ
406 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE], [
407 ZFS_AC_KERNEL_BLK_QUEUE_PLUG
408 ZFS_AC_KERNEL_BLK_QUEUE_BDI
409 ZFS_AC_KERNEL_BLK_QUEUE_UPDATE_READAHEAD
410 ZFS_AC_KERNEL_BLK_QUEUE_DISCARD
411 ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE
412 ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET
413 ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR
414 ZFS_AC_KERNEL_BLK_QUEUE_FLUSH
415 ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS
416 ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS