1dnl # 2dnl # 2.6.38 API change, 3dnl # Added blkdev_get_by_path() 4dnl # 5AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH], [ 6 ZFS_LINUX_TEST_SRC([blkdev_get_by_path], [ 7 #include <linux/fs.h> 8 #include <linux/blkdev.h> 9 ], [ 10 struct block_device *bdev __attribute__ ((unused)) = NULL; 11 const char *path = "path"; 12 fmode_t mode = 0; 13 void *holder = NULL; 14 15 bdev = blkdev_get_by_path(path, mode, holder); 16 ]) 17]) 18 19dnl # 20dnl # 6.5.x API change, 21dnl # blkdev_get_by_path() takes 4 args 22dnl # 23AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH_4ARG], [ 24 ZFS_LINUX_TEST_SRC([blkdev_get_by_path_4arg], [ 25 #include <linux/fs.h> 26 #include <linux/blkdev.h> 27 ], [ 28 struct block_device *bdev __attribute__ ((unused)) = NULL; 29 const char *path = "path"; 30 fmode_t mode = 0; 31 void *holder = NULL; 32 struct blk_holder_ops h; 33 34 bdev = blkdev_get_by_path(path, mode, holder, &h); 35 ]) 36]) 37 38dnl # 39dnl # 6.8.x API change 40dnl # bdev_open_by_path() replaces blkdev_get_by_path() 41dnl # 42AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_OPEN_BY_PATH], [ 43 ZFS_LINUX_TEST_SRC([bdev_open_by_path], [ 44 #include <linux/fs.h> 45 #include <linux/blkdev.h> 46 ], [ 47 struct bdev_handle *bdh __attribute__ ((unused)) = NULL; 48 const char *path = "path"; 49 fmode_t mode = 0; 50 void *holder = NULL; 51 struct blk_holder_ops h; 52 53 bdh = bdev_open_by_path(path, mode, holder, &h); 54 ]) 55]) 56 57dnl # 58dnl # 6.9.x API change 59dnl # bdev_file_open_by_path() replaced bdev_open_by_path(), 60dnl # and returns struct file* 61dnl # 62AC_DEFUN([ZFS_AC_KERNEL_SRC_BDEV_FILE_OPEN_BY_PATH], [ 63 ZFS_LINUX_TEST_SRC([bdev_file_open_by_path], [ 64 #include <linux/fs.h> 65 #include <linux/blkdev.h> 66 ], [ 67 struct file *file __attribute__ ((unused)) = NULL; 68 const char *path = "path"; 69 fmode_t mode = 0; 70 void *holder = NULL; 71 struct blk_holder_ops h; 72 73 file = bdev_file_open_by_path(path, mode, holder, &h); 74 ]) 75]) 76 77AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH], [ 78 AC_MSG_CHECKING([whether blkdev_get_by_path() exists and takes 3 args]) 79 ZFS_LINUX_TEST_RESULT([blkdev_get_by_path], [ 80 AC_MSG_RESULT(yes) 81 ], [ 82 AC_MSG_RESULT(no) 83 AC_MSG_CHECKING([whether blkdev_get_by_path() exists and takes 4 args]) 84 ZFS_LINUX_TEST_RESULT([blkdev_get_by_path_4arg], [ 85 AC_DEFINE(HAVE_BLKDEV_GET_BY_PATH_4ARG, 1, 86 [blkdev_get_by_path() exists and takes 4 args]) 87 AC_MSG_RESULT(yes) 88 ], [ 89 AC_MSG_RESULT(no) 90 AC_MSG_CHECKING([whether bdev_open_by_path() exists]) 91 ZFS_LINUX_TEST_RESULT([bdev_open_by_path], [ 92 AC_DEFINE(HAVE_BDEV_OPEN_BY_PATH, 1, 93 [bdev_open_by_path() exists]) 94 AC_MSG_RESULT(yes) 95 ], [ 96 AC_MSG_RESULT(no) 97 AC_MSG_CHECKING([whether bdev_file_open_by_path() exists]) 98 ZFS_LINUX_TEST_RESULT([bdev_file_open_by_path], [ 99 AC_DEFINE(HAVE_BDEV_FILE_OPEN_BY_PATH, 1, 100 [bdev_file_open_by_path() exists]) 101 AC_MSG_RESULT(yes) 102 ], [ 103 AC_MSG_RESULT(no) 104 ZFS_LINUX_TEST_ERROR([blkdev_get_by_path()]) 105 ]) 106 ]) 107 ]) 108 ]) 109]) 110 111dnl # 112dnl # 6.5.x API change 113dnl # blk_mode_t was added as a type to supercede some places where fmode_t 114dnl # is used 115dnl # 116AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BLK_MODE_T], [ 117 ZFS_LINUX_TEST_SRC([blk_mode_t], [ 118 #include <linux/fs.h> 119 #include <linux/blkdev.h> 120 ], [ 121 blk_mode_t m __attribute((unused)) = (blk_mode_t)0; 122 ]) 123]) 124 125AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BLK_MODE_T], [ 126 AC_MSG_CHECKING([whether blk_mode_t is defined]) 127 ZFS_LINUX_TEST_RESULT([blk_mode_t], [ 128 AC_MSG_RESULT(yes) 129 AC_DEFINE(HAVE_BLK_MODE_T, 1, [blk_mode_t is defined]) 130 ], [ 131 AC_MSG_RESULT(no) 132 ]) 133]) 134 135dnl # 136dnl # 2.6.38 API change, 137dnl # Added blkdev_put() 138dnl # 139AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_PUT], [ 140 ZFS_LINUX_TEST_SRC([blkdev_put], [ 141 #include <linux/fs.h> 142 #include <linux/blkdev.h> 143 ], [ 144 struct block_device *bdev = NULL; 145 fmode_t mode = 0; 146 147 blkdev_put(bdev, mode); 148 ]) 149]) 150 151dnl # 152dnl # 6.5.x API change. 153dnl # blkdev_put() takes (void* holder) as arg 2 154dnl # 155AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_PUT_HOLDER], [ 156 ZFS_LINUX_TEST_SRC([blkdev_put_holder], [ 157 #include <linux/fs.h> 158 #include <linux/blkdev.h> 159 ], [ 160 struct block_device *bdev = NULL; 161 void *holder = NULL; 162 163 blkdev_put(bdev, holder); 164 ]) 165]) 166 167dnl # 168dnl # 6.8.x API change 169dnl # bdev_release() replaces blkdev_put() 170dnl # 171AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_RELEASE], [ 172 ZFS_LINUX_TEST_SRC([bdev_release], [ 173 #include <linux/fs.h> 174 #include <linux/blkdev.h> 175 ], [ 176 struct bdev_handle *bdh = NULL; 177 bdev_release(bdh); 178 ]) 179]) 180 181dnl # 182dnl # 6.9.x API change 183dnl # 184dnl # bdev_release() now private, but because bdev_file_open_by_path() returns 185dnl # struct file*, we can just use fput(). So the blkdev_put test no longer 186dnl # fails if not found. 187dnl # 188 189AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_PUT], [ 190 AC_MSG_CHECKING([whether blkdev_put() exists]) 191 ZFS_LINUX_TEST_RESULT([blkdev_put], [ 192 AC_MSG_RESULT(yes) 193 AC_DEFINE(HAVE_BLKDEV_PUT, 1, [blkdev_put() exists]) 194 ], [ 195 AC_MSG_RESULT(no) 196 AC_MSG_CHECKING([whether blkdev_put() accepts void* as arg 2]) 197 ZFS_LINUX_TEST_RESULT([blkdev_put_holder], [ 198 AC_MSG_RESULT(yes) 199 AC_DEFINE(HAVE_BLKDEV_PUT_HOLDER, 1, 200 [blkdev_put() accepts void* as arg 2]) 201 ], [ 202 AC_MSG_RESULT(no) 203 AC_MSG_CHECKING([whether bdev_release() exists]) 204 ZFS_LINUX_TEST_RESULT([bdev_release], [ 205 AC_MSG_RESULT(yes) 206 AC_DEFINE(HAVE_BDEV_RELEASE, 1, 207 [bdev_release() exists]) 208 ], [ 209 AC_MSG_RESULT(no) 210 ]) 211 ]) 212 ]) 213]) 214 215dnl # 216dnl # 4.1 API, exported blkdev_reread_part() symbol, back ported to the 217dnl # 3.10.0 CentOS 7.x enterprise kernels. 218dnl # 219AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART], [ 220 ZFS_LINUX_TEST_SRC([blkdev_reread_part], [ 221 #include <linux/fs.h> 222 #include <linux/blkdev.h> 223 ], [ 224 struct block_device *bdev = NULL; 225 int error; 226 227 error = blkdev_reread_part(bdev); 228 ]) 229]) 230 231AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_REREAD_PART], [ 232 AC_MSG_CHECKING([whether blkdev_reread_part() exists]) 233 ZFS_LINUX_TEST_RESULT([blkdev_reread_part], [ 234 AC_MSG_RESULT(yes) 235 AC_DEFINE(HAVE_BLKDEV_REREAD_PART, 1, 236 [blkdev_reread_part() exists]) 237 ], [ 238 AC_MSG_RESULT(no) 239 ]) 240]) 241 242dnl # 243dnl # check_disk_change() was removed in 5.10 244dnl # 245AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_CHECK_DISK_CHANGE], [ 246 ZFS_LINUX_TEST_SRC([check_disk_change], [ 247 #include <linux/fs.h> 248 #include <linux/blkdev.h> 249 ], [ 250 struct block_device *bdev = NULL; 251 bool error; 252 253 error = check_disk_change(bdev); 254 ]) 255]) 256 257AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_CHECK_DISK_CHANGE], [ 258 AC_MSG_CHECKING([whether check_disk_change() exists]) 259 ZFS_LINUX_TEST_RESULT([check_disk_change], [ 260 AC_MSG_RESULT(yes) 261 AC_DEFINE(HAVE_CHECK_DISK_CHANGE, 1, 262 [check_disk_change() exists]) 263 ], [ 264 AC_MSG_RESULT(no) 265 ]) 266]) 267 268dnl # 269dnl # 6.5.x API change 270dnl # disk_check_media_change() was added 271dnl # 272AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_DISK_CHECK_MEDIA_CHANGE], [ 273 ZFS_LINUX_TEST_SRC([disk_check_media_change], [ 274 #include <linux/fs.h> 275 #include <linux/blkdev.h> 276 ], [ 277 struct block_device *bdev = NULL; 278 bool error; 279 280 error = disk_check_media_change(bdev->bd_disk); 281 ]) 282]) 283 284AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_DISK_CHECK_MEDIA_CHANGE], [ 285 AC_MSG_CHECKING([whether disk_check_media_change() exists]) 286 ZFS_LINUX_TEST_RESULT([disk_check_media_change], [ 287 AC_MSG_RESULT(yes) 288 AC_DEFINE(HAVE_DISK_CHECK_MEDIA_CHANGE, 1, 289 [disk_check_media_change() exists]) 290 ], [ 291 AC_MSG_RESULT(no) 292 ]) 293]) 294 295dnl # 296dnl # bdev_kobj() is introduced from 5.12 297dnl # 298AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_KOBJ], [ 299 ZFS_LINUX_TEST_SRC([bdev_kobj], [ 300 #include <linux/fs.h> 301 #include <linux/blkdev.h> 302 #include <linux/kobject.h> 303 ], [ 304 struct block_device *bdev = NULL; 305 struct kobject *disk_kobj; 306 disk_kobj = bdev_kobj(bdev); 307 ]) 308]) 309 310AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_KOBJ], [ 311 AC_MSG_CHECKING([whether bdev_kobj() exists]) 312 ZFS_LINUX_TEST_RESULT([bdev_kobj], [ 313 AC_MSG_RESULT(yes) 314 AC_DEFINE(HAVE_BDEV_KOBJ, 1, 315 [bdev_kobj() exists]) 316 ], [ 317 AC_MSG_RESULT(no) 318 ]) 319]) 320 321dnl # 322dnl # part_to_dev() was removed in 5.12 323dnl # 324AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_PART_TO_DEV], [ 325 ZFS_LINUX_TEST_SRC([part_to_dev], [ 326 #include <linux/fs.h> 327 #include <linux/blkdev.h> 328 ], [ 329 struct hd_struct *p = NULL; 330 struct device *pdev; 331 pdev = part_to_dev(p); 332 ]) 333]) 334 335AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_PART_TO_DEV], [ 336 AC_MSG_CHECKING([whether part_to_dev() exists]) 337 ZFS_LINUX_TEST_RESULT([part_to_dev], [ 338 AC_MSG_RESULT(yes) 339 AC_DEFINE(HAVE_PART_TO_DEV, 1, 340 [part_to_dev() exists]) 341 ], [ 342 AC_MSG_RESULT(no) 343 ]) 344]) 345 346dnl # 347dnl # 5.10 API, check_disk_change() is removed, in favor of 348dnl # bdev_check_media_change(), which doesn't force revalidation 349dnl # 350AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_CHECK_MEDIA_CHANGE], [ 351 ZFS_LINUX_TEST_SRC([bdev_check_media_change], [ 352 #include <linux/fs.h> 353 #include <linux/blkdev.h> 354 ], [ 355 struct block_device *bdev = NULL; 356 int error; 357 358 error = bdev_check_media_change(bdev); 359 ]) 360]) 361 362AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_CHECK_MEDIA_CHANGE], [ 363 AC_MSG_CHECKING([whether bdev_check_media_change() exists]) 364 ZFS_LINUX_TEST_RESULT([bdev_check_media_change], [ 365 AC_MSG_RESULT(yes) 366 AC_DEFINE(HAVE_BDEV_CHECK_MEDIA_CHANGE, 1, 367 [bdev_check_media_change() exists]) 368 ], [ 369 AC_MSG_RESULT(no) 370 ]) 371]) 372 373dnl # 374dnl # 2.6.22 API change 375dnl # Single argument invalidate_bdev() 376dnl # 377AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_INVALIDATE_BDEV], [ 378 ZFS_LINUX_TEST_SRC([invalidate_bdev], [ 379 #include <linux/buffer_head.h> 380 #include <linux/blkdev.h> 381 ],[ 382 struct block_device *bdev = NULL; 383 invalidate_bdev(bdev); 384 ]) 385]) 386 387AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_INVALIDATE_BDEV], [ 388 AC_MSG_CHECKING([whether invalidate_bdev() exists]) 389 ZFS_LINUX_TEST_RESULT([invalidate_bdev], [ 390 AC_MSG_RESULT(yes) 391 ],[ 392 ZFS_LINUX_TEST_ERROR([invalidate_bdev()]) 393 ]) 394]) 395 396dnl # 397dnl # 5.11 API, lookup_bdev() takes dev_t argument. 398dnl # 2.6.27 API, lookup_bdev() was first exported. 399dnl # 4.4.0-6.21 API, lookup_bdev() on Ubuntu takes mode argument. 400dnl # 401AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_LOOKUP_BDEV], [ 402 ZFS_LINUX_TEST_SRC([lookup_bdev_devt], [ 403 #include <linux/blkdev.h> 404 ], [ 405 int error __attribute__ ((unused)); 406 const char path[] = "/example/path"; 407 dev_t dev; 408 409 error = lookup_bdev(path, &dev); 410 ]) 411 412 ZFS_LINUX_TEST_SRC([lookup_bdev_1arg], [ 413 #include <linux/fs.h> 414 #include <linux/blkdev.h> 415 ], [ 416 struct block_device *bdev __attribute__ ((unused)); 417 const char path[] = "/example/path"; 418 419 bdev = lookup_bdev(path); 420 ]) 421 422 ZFS_LINUX_TEST_SRC([lookup_bdev_mode], [ 423 #include <linux/fs.h> 424 ], [ 425 struct block_device *bdev __attribute__ ((unused)); 426 const char path[] = "/example/path"; 427 428 bdev = lookup_bdev(path, FMODE_READ); 429 ]) 430]) 431 432AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_LOOKUP_BDEV], [ 433 AC_MSG_CHECKING([whether lookup_bdev() wants dev_t arg]) 434 ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_devt], 435 [lookup_bdev], [fs/block_dev.c], [ 436 AC_MSG_RESULT(yes) 437 AC_DEFINE(HAVE_DEVT_LOOKUP_BDEV, 1, 438 [lookup_bdev() wants dev_t arg]) 439 ], [ 440 AC_MSG_RESULT(no) 441 442 AC_MSG_CHECKING([whether lookup_bdev() wants 1 arg]) 443 ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_1arg], 444 [lookup_bdev], [fs/block_dev.c], [ 445 AC_MSG_RESULT(yes) 446 AC_DEFINE(HAVE_1ARG_LOOKUP_BDEV, 1, 447 [lookup_bdev() wants 1 arg]) 448 ], [ 449 AC_MSG_RESULT(no) 450 451 AC_MSG_CHECKING([whether lookup_bdev() wants mode arg]) 452 ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_mode], 453 [lookup_bdev], [fs/block_dev.c], [ 454 AC_MSG_RESULT(yes) 455 AC_DEFINE(HAVE_MODE_LOOKUP_BDEV, 1, 456 [lookup_bdev() wants mode arg]) 457 ], [ 458 ZFS_LINUX_TEST_ERROR([lookup_bdev()]) 459 ]) 460 ]) 461 ]) 462]) 463 464dnl # 465dnl # 2.6.30 API change 466dnl # 467dnl # The bdev_physical_block_size() interface was added to provide a way 468dnl # to determine the smallest write which can be performed without a 469dnl # read-modify-write operation. 470dnl # 471dnl # Unfortunately, this interface isn't entirely reliable because 472dnl # drives are sometimes known to misreport this value. 473dnl # 474AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE], [ 475 ZFS_LINUX_TEST_SRC([bdev_physical_block_size], [ 476 #include <linux/blkdev.h> 477 ],[ 478 struct block_device *bdev __attribute__ ((unused)) = NULL; 479 bdev_physical_block_size(bdev); 480 ]) 481]) 482 483AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE], [ 484 AC_MSG_CHECKING([whether bdev_physical_block_size() is available]) 485 ZFS_LINUX_TEST_RESULT([bdev_physical_block_size], [ 486 AC_MSG_RESULT(yes) 487 ],[ 488 ZFS_LINUX_TEST_ERROR([bdev_physical_block_size()]) 489 ]) 490]) 491 492dnl # 493dnl # 2.6.30 API change 494dnl # Added bdev_logical_block_size(). 495dnl # 496AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE], [ 497 ZFS_LINUX_TEST_SRC([bdev_logical_block_size], [ 498 #include <linux/blkdev.h> 499 ],[ 500 struct block_device *bdev __attribute__ ((unused)) = NULL; 501 bdev_logical_block_size(bdev); 502 ]) 503]) 504 505AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE], [ 506 AC_MSG_CHECKING([whether bdev_logical_block_size() is available]) 507 ZFS_LINUX_TEST_RESULT([bdev_logical_block_size], [ 508 AC_MSG_RESULT(yes) 509 ],[ 510 ZFS_LINUX_TEST_ERROR([bdev_logical_block_size()]) 511 ]) 512]) 513 514dnl # 515dnl # 5.11 API change 516dnl # Added bdev_whole() helper. 517dnl # 518AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_WHOLE], [ 519 ZFS_LINUX_TEST_SRC([bdev_whole], [ 520 #include <linux/blkdev.h> 521 ],[ 522 struct block_device *bdev = NULL; 523 bdev = bdev_whole(bdev); 524 ]) 525]) 526 527AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_WHOLE], [ 528 AC_MSG_CHECKING([whether bdev_whole() is available]) 529 ZFS_LINUX_TEST_RESULT([bdev_whole], [ 530 AC_MSG_RESULT(yes) 531 AC_DEFINE(HAVE_BDEV_WHOLE, 1, [bdev_whole() is available]) 532 ],[ 533 AC_MSG_RESULT(no) 534 ]) 535]) 536 537dnl # 538dnl # 5.20 API change, 539dnl # Removed bdevname(), snprintf(.., %pg) should be used. 540dnl # 541AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEVNAME], [ 542 ZFS_LINUX_TEST_SRC([bdevname], [ 543 #include <linux/fs.h> 544 #include <linux/blkdev.h> 545 ], [ 546 struct block_device *bdev __attribute__ ((unused)) = NULL; 547 char path[BDEVNAME_SIZE]; 548 549 (void) bdevname(bdev, path); 550 ]) 551]) 552 553AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEVNAME], [ 554 AC_MSG_CHECKING([whether bdevname() exists]) 555 ZFS_LINUX_TEST_RESULT([bdevname], [ 556 AC_DEFINE(HAVE_BDEVNAME, 1, [bdevname() is available]) 557 AC_MSG_RESULT(yes) 558 ], [ 559 AC_MSG_RESULT(no) 560 ]) 561]) 562 563dnl # 564dnl # TRIM support: discard and secure erase. We make use of asynchronous 565dnl # functions when available. 566dnl # 567dnl # 3.10: 568dnl # sync discard: blkdev_issue_discard(..., 0) 569dnl # sync erase: blkdev_issue_discard(..., BLKDEV_DISCARD_SECURE) 570dnl # async discard: [not available] 571dnl # async erase: [not available] 572dnl # 573dnl # 4.7: 574dnl # sync discard: blkdev_issue_discard(..., 0) 575dnl # sync erase: blkdev_issue_discard(..., BLKDEV_DISCARD_SECURE) 576dnl # async discard: __blkdev_issue_discard(..., 0) 577dnl # async erase: __blkdev_issue_discard(..., BLKDEV_DISCARD_SECURE) 578dnl # 579dnl # 5.19: 580dnl # sync discard: blkdev_issue_discard(...) 581dnl # sync erase: blkdev_issue_secure_erase(...) 582dnl # async discard: __blkdev_issue_discard(...) 583dnl # async erase: [not available] 584dnl # 585AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_ISSUE_DISCARD], [ 586 ZFS_LINUX_TEST_SRC([blkdev_issue_discard_noflags], [ 587 #include <linux/blkdev.h> 588 ],[ 589 struct block_device *bdev = NULL; 590 sector_t sector = 0; 591 sector_t nr_sects = 0; 592 int error __attribute__ ((unused)); 593 594 error = blkdev_issue_discard(bdev, 595 sector, nr_sects, GFP_KERNEL); 596 ]) 597 ZFS_LINUX_TEST_SRC([blkdev_issue_discard_flags], [ 598 #include <linux/blkdev.h> 599 ],[ 600 struct block_device *bdev = NULL; 601 sector_t sector = 0; 602 sector_t nr_sects = 0; 603 unsigned long flags = 0; 604 int error __attribute__ ((unused)); 605 606 error = blkdev_issue_discard(bdev, 607 sector, nr_sects, GFP_KERNEL, flags); 608 ]) 609 ZFS_LINUX_TEST_SRC([blkdev_issue_discard_async_noflags], [ 610 #include <linux/blkdev.h> 611 ],[ 612 struct block_device *bdev = NULL; 613 sector_t sector = 0; 614 sector_t nr_sects = 0; 615 struct bio *biop = NULL; 616 int error __attribute__ ((unused)); 617 618 error = __blkdev_issue_discard(bdev, 619 sector, nr_sects, GFP_KERNEL, &biop); 620 ]) 621 ZFS_LINUX_TEST_SRC([blkdev_issue_discard_async_flags], [ 622 #include <linux/blkdev.h> 623 ],[ 624 struct block_device *bdev = NULL; 625 sector_t sector = 0; 626 sector_t nr_sects = 0; 627 unsigned long flags = 0; 628 struct bio *biop = NULL; 629 int error __attribute__ ((unused)); 630 631 error = __blkdev_issue_discard(bdev, 632 sector, nr_sects, GFP_KERNEL, flags, &biop); 633 ]) 634 ZFS_LINUX_TEST_SRC([blkdev_issue_secure_erase], [ 635 #include <linux/blkdev.h> 636 ],[ 637 struct block_device *bdev = NULL; 638 sector_t sector = 0; 639 sector_t nr_sects = 0; 640 int error __attribute__ ((unused)); 641 642 error = blkdev_issue_secure_erase(bdev, 643 sector, nr_sects, GFP_KERNEL); 644 ]) 645]) 646 647AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_ISSUE_DISCARD], [ 648 AC_MSG_CHECKING([whether blkdev_issue_discard() is available]) 649 ZFS_LINUX_TEST_RESULT([blkdev_issue_discard_noflags], [ 650 AC_MSG_RESULT(yes) 651 AC_DEFINE(HAVE_BLKDEV_ISSUE_DISCARD_NOFLAGS, 1, 652 [blkdev_issue_discard() is available]) 653 ],[ 654 AC_MSG_RESULT(no) 655 ]) 656 AC_MSG_CHECKING([whether blkdev_issue_discard(flags) is available]) 657 ZFS_LINUX_TEST_RESULT([blkdev_issue_discard_flags], [ 658 AC_MSG_RESULT(yes) 659 AC_DEFINE(HAVE_BLKDEV_ISSUE_DISCARD_FLAGS, 1, 660 [blkdev_issue_discard(flags) is available]) 661 ],[ 662 AC_MSG_RESULT(no) 663 ]) 664 AC_MSG_CHECKING([whether __blkdev_issue_discard() is available]) 665 ZFS_LINUX_TEST_RESULT([blkdev_issue_discard_async_noflags], [ 666 AC_MSG_RESULT(yes) 667 AC_DEFINE(HAVE_BLKDEV_ISSUE_DISCARD_ASYNC_NOFLAGS, 1, 668 [__blkdev_issue_discard() is available]) 669 ],[ 670 AC_MSG_RESULT(no) 671 ]) 672 AC_MSG_CHECKING([whether __blkdev_issue_discard(flags) is available]) 673 ZFS_LINUX_TEST_RESULT([blkdev_issue_discard_async_flags], [ 674 AC_MSG_RESULT(yes) 675 AC_DEFINE(HAVE_BLKDEV_ISSUE_DISCARD_ASYNC_FLAGS, 1, 676 [__blkdev_issue_discard(flags) is available]) 677 ],[ 678 AC_MSG_RESULT(no) 679 ]) 680 AC_MSG_CHECKING([whether blkdev_issue_secure_erase() is available]) 681 ZFS_LINUX_TEST_RESULT([blkdev_issue_secure_erase], [ 682 AC_MSG_RESULT(yes) 683 AC_DEFINE(HAVE_BLKDEV_ISSUE_SECURE_ERASE, 1, 684 [blkdev_issue_secure_erase() is available]) 685 ],[ 686 AC_MSG_RESULT(no) 687 ]) 688]) 689 690dnl # 691dnl # 5.13 API change 692dnl # blkdev_get_by_path() no longer handles ERESTARTSYS 693dnl # 694dnl # Unfortunately we're forced to rely solely on the kernel version 695dnl # number in order to determine the expected behavior. This was an 696dnl # internal change to blkdev_get_by_dev(), see commit a8ed1a0607. 697dnl # 698AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_ERESTARTSYS], [ 699 AC_MSG_CHECKING([whether blkdev_get_by_path() handles ERESTARTSYS]) 700 AS_VERSION_COMPARE([$LINUX_VERSION], [5.13.0], [ 701 AC_MSG_RESULT(yes) 702 AC_DEFINE(HAVE_BLKDEV_GET_ERESTARTSYS, 1, 703 [blkdev_get_by_path() handles ERESTARTSYS]) 704 ],[ 705 AC_MSG_RESULT(no) 706 ],[ 707 AC_MSG_RESULT(no) 708 ]) 709]) 710 711dnl # 712dnl # 6.5.x API change 713dnl # BLK_STS_NEXUS replaced with BLK_STS_RESV_CONFLICT 714dnl # 715AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BLK_STS_RESV_CONFLICT], [ 716 ZFS_LINUX_TEST_SRC([blk_sts_resv_conflict], [ 717 #include <linux/blkdev.h> 718 ],[ 719 blk_status_t s __attribute__ ((unused)) = BLK_STS_RESV_CONFLICT; 720 ]) 721]) 722 723AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BLK_STS_RESV_CONFLICT], [ 724 AC_MSG_CHECKING([whether BLK_STS_RESV_CONFLICT is defined]) 725 ZFS_LINUX_TEST_RESULT([blk_sts_resv_conflict], [ 726 AC_DEFINE(HAVE_BLK_STS_RESV_CONFLICT, 1, [BLK_STS_RESV_CONFLICT is defined]) 727 AC_MSG_RESULT(yes) 728 ], [ 729 AC_MSG_RESULT(no) 730 ]) 731 ]) 732]) 733 734AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV], [ 735 ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH 736 ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH_4ARG 737 ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_OPEN_BY_PATH 738 ZFS_AC_KERNEL_SRC_BDEV_FILE_OPEN_BY_PATH 739 ZFS_AC_KERNEL_SRC_BLKDEV_PUT 740 ZFS_AC_KERNEL_SRC_BLKDEV_PUT_HOLDER 741 ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_RELEASE 742 ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART 743 ZFS_AC_KERNEL_SRC_BLKDEV_INVALIDATE_BDEV 744 ZFS_AC_KERNEL_SRC_BLKDEV_LOOKUP_BDEV 745 ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE 746 ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE 747 ZFS_AC_KERNEL_SRC_BLKDEV_CHECK_DISK_CHANGE 748 ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_CHECK_MEDIA_CHANGE 749 ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_WHOLE 750 ZFS_AC_KERNEL_SRC_BLKDEV_BDEVNAME 751 ZFS_AC_KERNEL_SRC_BLKDEV_ISSUE_DISCARD 752 ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_KOBJ 753 ZFS_AC_KERNEL_SRC_BLKDEV_PART_TO_DEV 754 ZFS_AC_KERNEL_SRC_BLKDEV_DISK_CHECK_MEDIA_CHANGE 755 ZFS_AC_KERNEL_SRC_BLKDEV_BLK_STS_RESV_CONFLICT 756 ZFS_AC_KERNEL_SRC_BLKDEV_BLK_MODE_T 757]) 758 759AC_DEFUN([ZFS_AC_KERNEL_BLKDEV], [ 760 ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH 761 ZFS_AC_KERNEL_BLKDEV_PUT 762 ZFS_AC_KERNEL_BLKDEV_REREAD_PART 763 ZFS_AC_KERNEL_BLKDEV_INVALIDATE_BDEV 764 ZFS_AC_KERNEL_BLKDEV_LOOKUP_BDEV 765 ZFS_AC_KERNEL_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE 766 ZFS_AC_KERNEL_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE 767 ZFS_AC_KERNEL_BLKDEV_CHECK_DISK_CHANGE 768 ZFS_AC_KERNEL_BLKDEV_BDEV_CHECK_MEDIA_CHANGE 769 ZFS_AC_KERNEL_BLKDEV_BDEV_WHOLE 770 ZFS_AC_KERNEL_BLKDEV_BDEVNAME 771 ZFS_AC_KERNEL_BLKDEV_GET_ERESTARTSYS 772 ZFS_AC_KERNEL_BLKDEV_ISSUE_DISCARD 773 ZFS_AC_KERNEL_BLKDEV_BDEV_KOBJ 774 ZFS_AC_KERNEL_BLKDEV_PART_TO_DEV 775 ZFS_AC_KERNEL_BLKDEV_DISK_CHECK_MEDIA_CHANGE 776 ZFS_AC_KERNEL_BLKDEV_BLK_STS_RESV_CONFLICT 777 ZFS_AC_KERNEL_BLKDEV_BLK_MODE_T 778]) 779