1dnl # 2dnl # 2.6.39 API change, 3dnl # blk_start_plug() and blk_finish_plug() 4dnl # 5AC_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 16AC_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 25dnl # 26dnl # 2.6.32 - 4.11: statically allocated bdi in request_queue 27dnl # 4.12: dynamically allocated bdi in request_queue 28dnl # 29AC_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 39AC_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 50dnl # 51dnl # 5.9: added blk_queue_update_readahead(), 52dnl # 5.15: renamed to disk_update_readahead() 53dnl # 54AC_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 70AC_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 ],[ 77 AC_MSG_RESULT(no) 78 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 90dnl # 91dnl # 5.19: bdev_max_discard_sectors() available 92dnl # 2.6.32: blk_queue_discard() available 93dnl # 94AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [ 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 104 ZFS_LINUX_TEST_SRC([blk_queue_discard], [ 105 #include <linux/blkdev.h> 106 ],[ 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]) 113]) 114 115AC_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], [ 118 AC_MSG_RESULT(yes) 119 AC_DEFINE(HAVE_BDEV_MAX_DISCARD_SECTORS, 1, 120 [bdev_max_discard_sectors() is available]) 121 ],[ 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 ]) 132 ]) 133]) 134 135dnl # 136dnl # 5.19: bdev_max_secure_erase_sectors() available 137dnl # 4.8: blk_queue_secure_erase() available 138dnl # 2.6.36: blk_queue_secdiscard() available 139dnl # 140AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE], [ 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 150 ZFS_LINUX_TEST_SRC([blk_queue_secure_erase], [ 151 #include <linux/blkdev.h> 152 ],[ 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]) 159 160 ZFS_LINUX_TEST_SRC([blk_queue_secdiscard], [ 161 #include <linux/blkdev.h> 162 ],[ 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); 168 ]) 169]) 170 171AC_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], [ 174 AC_MSG_RESULT(yes) 175 AC_DEFINE(HAVE_BDEV_MAX_SECURE_ERASE_SECTORS, 1, 176 [bdev_max_secure_erase_sectors() is available]) 177 ],[ 178 AC_MSG_RESULT(no) 179 180 AC_MSG_CHECKING([whether blk_queue_secure_erase() is available]) 181 ZFS_LINUX_TEST_RESULT([blk_queue_secure_erase], [ 182 AC_MSG_RESULT(yes) 183 AC_DEFINE(HAVE_BLK_QUEUE_SECURE_ERASE, 1, 184 [blk_queue_secure_erase() is available]) 185 ],[ 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 ]) 196 ]) 197 ]) 198]) 199 200dnl # 201dnl # 4.16 API change, 202dnl # Introduction of blk_queue_flag_set and blk_queue_flag_clear 203dnl # 204AC_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 214AC_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 225AC_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 235AC_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 246dnl # 247dnl # 2.6.36 API change, 248dnl # Added blk_queue_flush() interface, while the previous interface 249dnl # was available to all the new one is GPL-only. Thus in addition to 250dnl # detecting if this function is available we determine if it is 251dnl # GPL-only. If the GPL-only interface is there we implement our own 252dnl # compatibility function, otherwise we use the function. The hope 253dnl # is that long term this function will be opened up. 254dnl # 255dnl # 4.7 API change, 256dnl # Replace blk_queue_flush with blk_queue_write_cache 257dnl # 258AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [ 259 ZFS_LINUX_TEST_SRC([blk_queue_flush], [ 260 #include <linux/blkdev.h> 261 ], [ 262 struct request_queue *q __attribute__ ((unused)) = NULL; 263 (void) blk_queue_flush(q, REQ_FLUSH); 264 ], [], [ZFS_META_LICENSE]) 265 266 ZFS_LINUX_TEST_SRC([blk_queue_write_cache], [ 267 #include <linux/kernel.h> 268 #include <linux/blkdev.h> 269 ], [ 270 struct request_queue *q __attribute__ ((unused)) = NULL; 271 blk_queue_write_cache(q, true, true); 272 ], [], [ZFS_META_LICENSE]) 273]) 274 275AC_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 317dnl # 318dnl # 2.6.34 API change 319dnl # blk_queue_max_hw_sectors() replaces blk_queue_max_sectors(). 320dnl # 321AC_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 ], [ 325 struct request_queue *q __attribute__ ((unused)) = NULL; 326 (void) blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS); 327 ], []) 328]) 329 330AC_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 AC_MSG_RESULT(no) 336 ]) 337]) 338 339dnl # 340dnl # 2.6.34 API change 341dnl # blk_queue_max_segments() consolidates blk_queue_max_hw_segments() 342dnl # and blk_queue_max_phys_segments(). 343dnl # 344AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS], [ 345 ZFS_LINUX_TEST_SRC([blk_queue_max_segments], [ 346 #include <linux/blkdev.h> 347 ], [ 348 struct request_queue *q __attribute__ ((unused)) = NULL; 349 (void) blk_queue_max_segments(q, BLK_MAX_SEGMENTS); 350 ], []) 351]) 352 353AC_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 AC_MSG_RESULT(no) 359 ]) 360]) 361 362dnl # 363dnl # See if kernel supports block multi-queue and blk_status_t. 364dnl # blk_status_t represents the new status codes introduced in the 4.13 365dnl # kernel patch: 366dnl # 367dnl # block: introduce new block status code type 368dnl # 369dnl # We do not currently support the "old" block multi-queue interfaces from 370dnl # prior kernels. 371dnl # 372AC_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 ZFS_LINUX_TEST_SRC([blk_mq_rq_hctx], [ 381 #include <linux/blk-mq.h> 382 #include <linux/blkdev.h> 383 ], [ 384 struct request rq = {0}; 385 struct blk_mq_hw_ctx *hctx = NULL; 386 rq.mq_hctx = hctx; 387 ], []) 388]) 389 390AC_DEFUN([ZFS_AC_KERNEL_BLK_MQ], [ 391 AC_MSG_CHECKING([whether block multiqueue with blk_status_t is available]) 392 ZFS_LINUX_TEST_RESULT([blk_mq], [ 393 AC_MSG_RESULT(yes) 394 AC_DEFINE(HAVE_BLK_MQ, 1, [block multiqueue is available]) 395 AC_MSG_CHECKING([whether block multiqueue hardware context is cached in struct request]) 396 ZFS_LINUX_TEST_RESULT([blk_mq_rq_hctx], [ 397 AC_MSG_RESULT(yes) 398 AC_DEFINE(HAVE_BLK_MQ_RQ_HCTX, 1, [block multiqueue hardware context is cached in struct request]) 399 ], [ 400 AC_MSG_RESULT(no) 401 ]) 402 ], [ 403 AC_MSG_RESULT(no) 404 ]) 405]) 406 407AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE], [ 408 ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG 409 ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI 410 ZFS_AC_KERNEL_SRC_BLK_QUEUE_UPDATE_READAHEAD 411 ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD 412 ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE 413 ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET 414 ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR 415 ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH 416 ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS 417 ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS 418 ZFS_AC_KERNEL_SRC_BLK_MQ 419]) 420 421AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE], [ 422 ZFS_AC_KERNEL_BLK_QUEUE_PLUG 423 ZFS_AC_KERNEL_BLK_QUEUE_BDI 424 ZFS_AC_KERNEL_BLK_QUEUE_UPDATE_READAHEAD 425 ZFS_AC_KERNEL_BLK_QUEUE_DISCARD 426 ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE 427 ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET 428 ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR 429 ZFS_AC_KERNEL_BLK_QUEUE_FLUSH 430 ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS 431 ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS 432 ZFS_AC_KERNEL_BLK_MQ 433]) 434