]>
Commit | Line | Data |
---|---|---|
066e8252 BB |
1 | dnl # |
2 | dnl # 2.6.39 API change, | |
3 | dnl # blk_start_plug() and blk_finish_plug() | |
4 | dnl # | |
5 | AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG], [ | |
6 | ZFS_LINUX_TEST_SRC([blk_plug], [ | |
7 | #include <linux/blkdev.h> | |
8 | ],[ | |
9 | struct blk_plug plug __attribute__ ((unused)); | |
10 | ||
11 | blk_start_plug(&plug); | |
12 | blk_finish_plug(&plug); | |
13 | ]) | |
14 | ]) | |
15 | ||
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], [ | |
19 | AC_MSG_RESULT(yes) | |
20 | ],[ | |
21 | ZFS_LINUX_TEST_ERROR([blk_plug]) | |
22 | ]) | |
23 | ]) | |
24 | ||
25 | dnl # | |
69cbd0a3 AZ |
26 | dnl # 2.6.32 - 4.11: statically allocated bdi in request_queue |
27 | dnl # 4.12: dynamically allocated bdi in request_queue | |
066e8252 BB |
28 | dnl # |
29 | AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI], [ | |
30 | ZFS_LINUX_TEST_SRC([blk_queue_bdi], [ | |
31 | #include <linux/blkdev.h> | |
32 | ],[ | |
33 | struct request_queue q; | |
34 | struct backing_dev_info bdi; | |
35 | q.backing_dev_info = &bdi; | |
36 | ]) | |
37 | ]) | |
38 | ||
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], [ | |
42 | AC_MSG_RESULT(yes) | |
43 | AC_DEFINE(HAVE_BLK_QUEUE_BDI_DYNAMIC, 1, | |
44 | [blk queue backing_dev_info is dynamic]) | |
45 | ],[ | |
46 | AC_MSG_RESULT(no) | |
47 | ]) | |
48 | ]) | |
49 | ||
f6166058 BB |
50 | dnl # |
51 | dnl # 5.9: added blk_queue_update_readahead(), | |
52 | dnl # 5.15: renamed to disk_update_readahead() | |
53 | dnl # | |
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> | |
57 | ],[ | |
58 | struct request_queue q; | |
59 | blk_queue_update_readahead(&q); | |
60 | ]) | |
61 | ||
62 | ZFS_LINUX_TEST_SRC([disk_update_readahead], [ | |
63 | #include <linux/blkdev.h> | |
64 | ],[ | |
65 | struct gendisk disk; | |
66 | disk_update_readahead(&disk); | |
67 | ]) | |
68 | ]) | |
69 | ||
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], [ | |
73 | AC_MSG_RESULT(yes) | |
74 | AC_DEFINE(HAVE_BLK_QUEUE_UPDATE_READAHEAD, 1, | |
75 | [blk_queue_update_readahead() exists]) | |
76 | ],[ | |
5e4aedac BB |
77 | AC_MSG_RESULT(no) |
78 | ||
f6166058 BB |
79 | AC_MSG_CHECKING([whether disk_update_readahead() exists]) |
80 | ZFS_LINUX_TEST_RESULT([disk_update_readahead], [ | |
81 | AC_MSG_RESULT(yes) | |
82 | AC_DEFINE(HAVE_DISK_UPDATE_READAHEAD, 1, | |
83 | [disk_update_readahead() exists]) | |
84 | ],[ | |
85 | AC_MSG_RESULT(no) | |
86 | ]) | |
87 | ]) | |
88 | ]) | |
89 | ||
066e8252 | 90 | dnl # |
5e4aedac BB |
91 | dnl # 5.19: bdev_max_discard_sectors() available |
92 | dnl # 2.6.32: blk_queue_discard() available | |
066e8252 BB |
93 | dnl # |
94 | AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [ | |
5e4aedac BB |
95 | ZFS_LINUX_TEST_SRC([bdev_max_discard_sectors], [ |
96 | #include <linux/blkdev.h> | |
97 | ],[ | |
98 | struct block_device *bdev __attribute__ ((unused)) = NULL; | |
99 | unsigned int error __attribute__ ((unused)); | |
100 | ||
101 | error = bdev_max_discard_sectors(bdev); | |
102 | ]) | |
103 | ||
066e8252 BB |
104 | ZFS_LINUX_TEST_SRC([blk_queue_discard], [ |
105 | #include <linux/blkdev.h> | |
106 | ],[ | |
c0cf6ed6 CK |
107 | struct request_queue r; |
108 | struct request_queue *q = &r; | |
066e8252 | 109 | int value __attribute__ ((unused)); |
c0cf6ed6 | 110 | memset(q, 0, sizeof(r)); |
066e8252 BB |
111 | value = blk_queue_discard(q); |
112 | ]) | |
113 | ]) | |
114 | ||
115 | AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [ | |
5e4aedac BB |
116 | AC_MSG_CHECKING([whether bdev_max_discard_sectors() is available]) |
117 | ZFS_LINUX_TEST_RESULT([bdev_max_discard_sectors], [ | |
066e8252 | 118 | AC_MSG_RESULT(yes) |
5e4aedac BB |
119 | AC_DEFINE(HAVE_BDEV_MAX_DISCARD_SECTORS, 1, |
120 | [bdev_max_discard_sectors() is available]) | |
066e8252 | 121 | ],[ |
5e4aedac BB |
122 | AC_MSG_RESULT(no) |
123 | ||
124 | AC_MSG_CHECKING([whether blk_queue_discard() is available]) | |
125 | ZFS_LINUX_TEST_RESULT([blk_queue_discard], [ | |
126 | AC_MSG_RESULT(yes) | |
127 | AC_DEFINE(HAVE_BLK_QUEUE_DISCARD, 1, | |
128 | [blk_queue_discard() is available]) | |
129 | ],[ | |
130 | ZFS_LINUX_TEST_ERROR([blk_queue_discard]) | |
131 | ]) | |
066e8252 BB |
132 | ]) |
133 | ]) | |
134 | ||
135 | dnl # | |
e2c31f2b BB |
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 | |
066e8252 BB |
139 | dnl # |
140 | AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE], [ | |
e2c31f2b BB |
141 | ZFS_LINUX_TEST_SRC([bdev_max_secure_erase_sectors], [ |
142 | #include <linux/blkdev.h> | |
143 | ],[ | |
144 | struct block_device *bdev __attribute__ ((unused)) = NULL; | |
145 | unsigned int error __attribute__ ((unused)); | |
146 | ||
147 | error = bdev_max_secure_erase_sectors(bdev); | |
148 | ]) | |
149 | ||
066e8252 BB |
150 | ZFS_LINUX_TEST_SRC([blk_queue_secure_erase], [ |
151 | #include <linux/blkdev.h> | |
152 | ],[ | |
c0cf6ed6 CK |
153 | struct request_queue r; |
154 | struct request_queue *q = &r; | |
066e8252 | 155 | int value __attribute__ ((unused)); |
c0cf6ed6 | 156 | memset(q, 0, sizeof(r)); |
066e8252 BB |
157 | value = blk_queue_secure_erase(q); |
158 | ]) | |
159 | ||
160 | ZFS_LINUX_TEST_SRC([blk_queue_secdiscard], [ | |
161 | #include <linux/blkdev.h> | |
162 | ],[ | |
c0cf6ed6 CK |
163 | struct request_queue r; |
164 | struct request_queue *q = &r; | |
066e8252 | 165 | int value __attribute__ ((unused)); |
c0cf6ed6 | 166 | memset(q, 0, sizeof(r)); |
066e8252 BB |
167 | value = blk_queue_secdiscard(q); |
168 | ]) | |
169 | ]) | |
170 | ||
171 | AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [ | |
e2c31f2b BB |
172 | AC_MSG_CHECKING([whether bdev_max_secure_erase_sectors() is available]) |
173 | ZFS_LINUX_TEST_RESULT([bdev_max_secure_erase_sectors], [ | |
066e8252 | 174 | AC_MSG_RESULT(yes) |
e2c31f2b BB |
175 | AC_DEFINE(HAVE_BDEV_MAX_SECURE_ERASE_SECTORS, 1, |
176 | [bdev_max_secure_erase_sectors() is available]) | |
066e8252 BB |
177 | ],[ |
178 | AC_MSG_RESULT(no) | |
179 | ||
e2c31f2b BB |
180 | AC_MSG_CHECKING([whether blk_queue_secure_erase() is available]) |
181 | ZFS_LINUX_TEST_RESULT([blk_queue_secure_erase], [ | |
066e8252 | 182 | AC_MSG_RESULT(yes) |
e2c31f2b BB |
183 | AC_DEFINE(HAVE_BLK_QUEUE_SECURE_ERASE, 1, |
184 | [blk_queue_secure_erase() is available]) | |
066e8252 | 185 | ],[ |
e2c31f2b BB |
186 | AC_MSG_RESULT(no) |
187 | ||
188 | AC_MSG_CHECKING([whether blk_queue_secdiscard() is available]) | |
189 | ZFS_LINUX_TEST_RESULT([blk_queue_secdiscard], [ | |
190 | AC_MSG_RESULT(yes) | |
191 | AC_DEFINE(HAVE_BLK_QUEUE_SECDISCARD, 1, | |
192 | [blk_queue_secdiscard() is available]) | |
193 | ],[ | |
194 | ZFS_LINUX_TEST_ERROR([blk_queue_secure_erase]) | |
195 | ]) | |
066e8252 BB |
196 | ]) |
197 | ]) | |
198 | ]) | |
199 | ||
200 | dnl # | |
201 | dnl # 4.16 API change, | |
202 | dnl # Introduction of blk_queue_flag_set and blk_queue_flag_clear | |
203 | dnl # | |
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> | |
208 | ],[ | |
209 | struct request_queue *q = NULL; | |
210 | blk_queue_flag_set(0, q); | |
211 | ]) | |
212 | ]) | |
213 | ||
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], [ | |
217 | AC_MSG_RESULT(yes) | |
218 | AC_DEFINE(HAVE_BLK_QUEUE_FLAG_SET, 1, | |
219 | [blk_queue_flag_set() exists]) | |
220 | ],[ | |
221 | AC_MSG_RESULT(no) | |
222 | ]) | |
223 | ]) | |
224 | ||
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> | |
229 | ],[ | |
230 | struct request_queue *q = NULL; | |
231 | blk_queue_flag_clear(0, q); | |
232 | ]) | |
233 | ]) | |
234 | ||
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], [ | |
238 | AC_MSG_RESULT(yes) | |
239 | AC_DEFINE(HAVE_BLK_QUEUE_FLAG_CLEAR, 1, | |
240 | [blk_queue_flag_clear() exists]) | |
241 | ],[ | |
242 | AC_MSG_RESULT(no) | |
243 | ]) | |
244 | ]) | |
245 | ||
246 | dnl # | |
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. | |
254 | dnl # | |
255 | dnl # 4.7 API change, | |
256 | dnl # Replace blk_queue_flush with blk_queue_write_cache | |
257 | dnl # | |
258 | AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [ | |
259 | ZFS_LINUX_TEST_SRC([blk_queue_flush], [ | |
260 | #include <linux/blkdev.h> | |
261 | ], [ | |
72154bd6 | 262 | struct request_queue *q __attribute__ ((unused)) = NULL; |
066e8252 | 263 | (void) blk_queue_flush(q, REQ_FLUSH); |
72154bd6 | 264 | ], [], [ZFS_META_LICENSE]) |
066e8252 BB |
265 | |
266 | ZFS_LINUX_TEST_SRC([blk_queue_write_cache], [ | |
267 | #include <linux/kernel.h> | |
268 | #include <linux/blkdev.h> | |
269 | ], [ | |
72154bd6 | 270 | struct request_queue *q __attribute__ ((unused)) = NULL; |
066e8252 | 271 | blk_queue_write_cache(q, true, true); |
72154bd6 | 272 | ], [], [ZFS_META_LICENSE]) |
066e8252 BB |
273 | ]) |
274 | ||
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], [ | |
278 | AC_MSG_RESULT(yes) | |
279 | AC_DEFINE(HAVE_BLK_QUEUE_FLUSH, 1, | |
280 | [blk_queue_flush() is available]) | |
281 | ||
282 | AC_MSG_CHECKING([whether blk_queue_flush() is GPL-only]) | |
283 | ZFS_LINUX_TEST_RESULT([blk_queue_flush_license], [ | |
284 | AC_MSG_RESULT(no) | |
285 | ],[ | |
286 | AC_MSG_RESULT(yes) | |
287 | AC_DEFINE(HAVE_BLK_QUEUE_FLUSH_GPL_ONLY, 1, | |
288 | [blk_queue_flush() is GPL-only]) | |
289 | ]) | |
290 | ],[ | |
291 | AC_MSG_RESULT(no) | |
292 | ]) | |
293 | ||
294 | dnl # | |
295 | dnl # 4.7 API change | |
296 | dnl # Replace blk_queue_flush with blk_queue_write_cache | |
297 | dnl # | |
298 | AC_MSG_CHECKING([whether blk_queue_write_cache() exists]) | |
299 | ZFS_LINUX_TEST_RESULT([blk_queue_write_cache], [ | |
300 | AC_MSG_RESULT(yes) | |
301 | AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE, 1, | |
302 | [blk_queue_write_cache() exists]) | |
303 | ||
304 | AC_MSG_CHECKING([whether blk_queue_write_cache() is GPL-only]) | |
305 | ZFS_LINUX_TEST_RESULT([blk_queue_write_cache_license], [ | |
306 | AC_MSG_RESULT(no) | |
307 | ],[ | |
308 | AC_MSG_RESULT(yes) | |
309 | AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY, 1, | |
310 | [blk_queue_write_cache() is GPL-only]) | |
311 | ]) | |
312 | ],[ | |
313 | AC_MSG_RESULT(no) | |
314 | ]) | |
315 | ]) | |
316 | ||
317 | dnl # | |
318 | dnl # 2.6.34 API change | |
319 | dnl # blk_queue_max_hw_sectors() replaces blk_queue_max_sectors(). | |
320 | dnl # | |
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> | |
324 | ], [ | |
72154bd6 | 325 | struct request_queue *q __attribute__ ((unused)) = NULL; |
066e8252 | 326 | (void) blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS); |
72154bd6 | 327 | ], []) |
066e8252 BB |
328 | ]) |
329 | ||
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], [ | |
333 | AC_MSG_RESULT(yes) | |
334 | ],[ | |
335 | ZFS_LINUX_TEST_ERROR([blk_queue_max_hw_sectors]) | |
336 | ]) | |
337 | ]) | |
338 | ||
339 | dnl # | |
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(). | |
343 | dnl # | |
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> | |
347 | ], [ | |
72154bd6 | 348 | struct request_queue *q __attribute__ ((unused)) = NULL; |
066e8252 | 349 | (void) blk_queue_max_segments(q, BLK_MAX_SEGMENTS); |
72154bd6 | 350 | ], []) |
066e8252 BB |
351 | ]) |
352 | ||
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], [ | |
356 | AC_MSG_RESULT(yes) | |
357 | ], [ | |
358 | ZFS_LINUX_TEST_ERROR([blk_queue_max_segments]) | |
359 | ]) | |
360 | ]) | |
361 | ||
6f73d021 TH |
362 | dnl # |
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 | |
365 | dnl # kernel patch: | |
366 | dnl # | |
367 | dnl # block: introduce new block status code type | |
368 | dnl # | |
369 | dnl # We do not currently support the "old" block multi-queue interfaces from | |
370 | dnl # prior kernels. | |
371 | dnl # | |
372 | AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_MQ], [ | |
373 | ZFS_LINUX_TEST_SRC([blk_mq], [ | |
374 | #include <linux/blk-mq.h> | |
375 | ], [ | |
376 | struct blk_mq_tag_set tag_set __attribute__ ((unused)) = {0}; | |
377 | (void) blk_mq_alloc_tag_set(&tag_set); | |
378 | return BLK_STS_OK; | |
379 | ], []) | |
380 | ]) | |
381 | ||
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], [ | |
385 | AC_MSG_RESULT(yes) | |
386 | AC_DEFINE(HAVE_BLK_MQ, 1, [block multiqueue is available]) | |
387 | ], [ | |
388 | AC_MSG_RESULT(no) | |
389 | ]) | |
390 | ]) | |
391 | ||
066e8252 BB |
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 | |
f6166058 | 395 | ZFS_AC_KERNEL_SRC_BLK_QUEUE_UPDATE_READAHEAD |
066e8252 BB |
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 | |
6f73d021 | 403 | ZFS_AC_KERNEL_SRC_BLK_MQ |
066e8252 BB |
404 | ]) |
405 | ||
406 | AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE], [ | |
407 | ZFS_AC_KERNEL_BLK_QUEUE_PLUG | |
408 | ZFS_AC_KERNEL_BLK_QUEUE_BDI | |
f6166058 | 409 | ZFS_AC_KERNEL_BLK_QUEUE_UPDATE_READAHEAD |
066e8252 BB |
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 | |
6f73d021 | 417 | ZFS_AC_KERNEL_BLK_MQ |
066e8252 | 418 | ]) |