1dnl # 2dnl # 2.6.36 API change, 3dnl # REQ_FAILFAST_{DEV|TRANSPORT|DRIVER} 4dnl # REQ_DISCARD 5dnl # REQ_FLUSH 6dnl # 7dnl # 4.8 - 4.9 API, 8dnl # REQ_FLUSH was renamed to REQ_PREFLUSH 9dnl # 10AC_DEFUN([ZFS_AC_KERNEL_SRC_REQ], [ 11 ZFS_LINUX_TEST_SRC([req_failfast_mask], [ 12 #include <linux/bio.h> 13 ],[ 14 int flags __attribute__ ((unused)); 15 flags = REQ_FAILFAST_MASK; 16 ]) 17 18 ZFS_LINUX_TEST_SRC([req_discard], [ 19 #include <linux/bio.h> 20 ],[ 21 int flags __attribute__ ((unused)); 22 flags = REQ_DISCARD; 23 ]) 24 25 ZFS_LINUX_TEST_SRC([req_flush], [ 26 #include <linux/bio.h> 27 ],[ 28 int flags __attribute__ ((unused)); 29 flags = REQ_FLUSH; 30 ]) 31 32 ZFS_LINUX_TEST_SRC([req_preflush], [ 33 #include <linux/bio.h> 34 ],[ 35 int flags __attribute__ ((unused)); 36 flags = REQ_PREFLUSH; 37 ]) 38]) 39 40AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_FAILFAST_MASK], [ 41 AC_MSG_CHECKING([whether REQ_FAILFAST_MASK is defined]) 42 ZFS_LINUX_TEST_RESULT([req_failfast_mask], [ 43 AC_MSG_RESULT(yes) 44 ],[ 45 ZFS_LINUX_TEST_ERROR([REQ_FAILFAST_MASK]) 46 ]) 47]) 48 49AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_DISCARD], [ 50 AC_MSG_CHECKING([whether REQ_DISCARD is defined]) 51 ZFS_LINUX_TEST_RESULT([req_discard], [ 52 AC_MSG_RESULT(yes) 53 AC_DEFINE(HAVE_REQ_DISCARD, 1, [REQ_DISCARD is defined]) 54 ],[ 55 AC_MSG_RESULT(no) 56 ]) 57]) 58 59AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_FLUSH], [ 60 AC_MSG_CHECKING([whether REQ_FLUSH is defined]) 61 ZFS_LINUX_TEST_RESULT([req_flush], [ 62 AC_MSG_RESULT(yes) 63 AC_DEFINE(HAVE_REQ_FLUSH, 1, [REQ_FLUSH is defined]) 64 ],[ 65 AC_MSG_RESULT(no) 66 ]) 67]) 68 69AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_PREFLUSH], [ 70 AC_MSG_CHECKING([whether REQ_PREFLUSH is defined]) 71 ZFS_LINUX_TEST_RESULT([req_preflush], [ 72 AC_MSG_RESULT(yes) 73 AC_DEFINE(HAVE_REQ_PREFLUSH, 1, [REQ_PREFLUSH is defined]) 74 ],[ 75 AC_MSG_RESULT(no) 76 ]) 77]) 78 79dnl # 80dnl # Linux 4.8 API, 81dnl # 82dnl # The bio_op() helper was introduced as a replacement for explicitly 83dnl # checking the bio->bi_rw flags. The following checks are used to 84dnl # detect if a specific operation is supported. 85dnl # 86AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_OPS], [ 87 ZFS_LINUX_TEST_SRC([req_op_discard], [ 88 #include <linux/blk_types.h> 89 ],[ 90 int op __attribute__ ((unused)) = REQ_OP_DISCARD; 91 ]) 92 93 ZFS_LINUX_TEST_SRC([req_op_secure_erase], [ 94 #include <linux/blk_types.h> 95 ],[ 96 int op __attribute__ ((unused)) = REQ_OP_SECURE_ERASE; 97 ]) 98 99 ZFS_LINUX_TEST_SRC([req_op_flush], [ 100 #include <linux/blk_types.h> 101 ],[ 102 int op __attribute__ ((unused)) = REQ_OP_FLUSH; 103 ]) 104 105 ZFS_LINUX_TEST_SRC([bio_bi_opf], [ 106 #include <linux/bio.h> 107 ],[ 108 struct bio bio __attribute__ ((unused)); 109 bio.bi_opf = 0; 110 ]) 111 112 ZFS_LINUX_TEST_SRC([bio_set_op_attrs], [ 113 #include <linux/bio.h> 114 ],[ 115 struct bio *bio __attribute__ ((unused)) = NULL; 116 bio_set_op_attrs(bio, 0, 0); 117 ]) 118]) 119 120AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_OP_DISCARD], [ 121 AC_MSG_CHECKING([whether REQ_OP_DISCARD is defined]) 122 ZFS_LINUX_TEST_RESULT([req_op_discard], [ 123 AC_MSG_RESULT(yes) 124 AC_DEFINE(HAVE_REQ_OP_DISCARD, 1, [REQ_OP_DISCARD is defined]) 125 ],[ 126 AC_MSG_RESULT(no) 127 ]) 128]) 129 130AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_OP_SECURE_ERASE], [ 131 AC_MSG_CHECKING([whether REQ_OP_SECURE_ERASE is defined]) 132 ZFS_LINUX_TEST_RESULT([req_op_secure_erase], [ 133 AC_MSG_RESULT(yes) 134 AC_DEFINE(HAVE_REQ_OP_SECURE_ERASE, 1, 135 [REQ_OP_SECURE_ERASE is defined]) 136 ],[ 137 AC_MSG_RESULT(no) 138 ]) 139]) 140 141AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_OP_FLUSH], [ 142 AC_MSG_CHECKING([whether REQ_OP_FLUSH is defined]) 143 ZFS_LINUX_TEST_RESULT([req_op_flush], [ 144 AC_MSG_RESULT(yes) 145 AC_DEFINE(HAVE_REQ_OP_FLUSH, 1, [REQ_OP_FLUSH is defined]) 146 ],[ 147 AC_MSG_RESULT(no) 148 ]) 149]) 150 151AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_OPF], [ 152 AC_MSG_CHECKING([whether bio->bi_opf is defined]) 153 ZFS_LINUX_TEST_RESULT([bio_bi_opf], [ 154 AC_MSG_RESULT(yes) 155 AC_DEFINE(HAVE_BIO_BI_OPF, 1, [bio->bi_opf is defined]) 156 ],[ 157 AC_MSG_RESULT(no) 158 ]) 159]) 160 161AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_OP_ATTRS], [ 162 AC_MSG_CHECKING([whether bio_set_op_attrs is available]) 163 ZFS_LINUX_TEST_RESULT([bio_set_op_attrs], [ 164 AC_MSG_RESULT(yes) 165 AC_DEFINE(HAVE_BIO_SET_OP_ATTRS, 1, 166 [bio_set_op_attrs is available]) 167 ],[ 168 AC_MSG_RESULT(no) 169 ]) 170]) 171 172dnl # 173dnl # Linux 4.14 API, 174dnl # 175dnl # The bio_set_dev() helper macro was introduced as part of the transition 176dnl # to have struct gendisk in struct bio. 177dnl # 178dnl # Linux 5.0 API, 179dnl # 180dnl # The bio_set_dev() helper macro was updated to internally depend on 181dnl # bio_associate_blkg() symbol which is exported GPL-only. 182dnl # 183AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_SET_DEV], [ 184 ZFS_LINUX_TEST_SRC([bio_set_dev], [ 185 #include <linux/bio.h> 186 #include <linux/fs.h> 187 ],[ 188 struct block_device *bdev = NULL; 189 struct bio *bio = NULL; 190 bio_set_dev(bio, bdev); 191 ], [], [$ZFS_META_LICENSE]) 192]) 193 194AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV], [ 195 AC_MSG_CHECKING([whether bio_set_dev() is available]) 196 ZFS_LINUX_TEST_RESULT([bio_set_dev], [ 197 AC_MSG_RESULT(yes) 198 AC_DEFINE(HAVE_BIO_SET_DEV, 1, [bio_set_dev() is available]) 199 200 AC_MSG_CHECKING([whether bio_set_dev() is GPL-only]) 201 ZFS_LINUX_TEST_RESULT([bio_set_dev_license], [ 202 AC_MSG_RESULT(no) 203 ],[ 204 AC_MSG_RESULT(yes) 205 AC_DEFINE(HAVE_BIO_SET_DEV_GPL_ONLY, 1, 206 [bio_set_dev() GPL-only]) 207 ]) 208 ],[ 209 AC_MSG_RESULT(no) 210 ]) 211]) 212 213dnl # 214dnl # 4.3 API change 215dnl # Error argument dropped from bio_endio in favor of newly introduced 216dnl # bio->bi_error. This also replaces bio->bi_flags value BIO_UPTODATE. 217dnl # Introduced by torvalds/linux@4246a0b63bd8f56a1469b12eafeb875b1041a451 218dnl # ("block: add a bi_error field to struct bio"). 219dnl # 220AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_END_IO_T_ARGS], [ 221 ZFS_LINUX_TEST_SRC([bio_end_io_t_args], [ 222 #include <linux/bio.h> 223 void wanted_end_io(struct bio *bio) { return; } 224 bio_end_io_t *end_io __attribute__ ((unused)) = wanted_end_io; 225 ], []) 226]) 227 228AC_DEFUN([ZFS_AC_KERNEL_BIO_END_IO_T_ARGS], [ 229 AC_MSG_CHECKING([whether bio_end_io_t wants 1 arg]) 230 ZFS_LINUX_TEST_RESULT([bio_end_io_t_args], [ 231 AC_MSG_RESULT(yes) 232 AC_DEFINE(HAVE_1ARG_BIO_END_IO_T, 1, 233 [bio_end_io_t wants 1 arg]) 234 ], [ 235 AC_MSG_RESULT(no) 236 ]) 237]) 238 239dnl # 240dnl # 4.13 API change 241dnl # The bio->bi_error field was replaced with bio->bi_status which is an 242dnl # enum which describes all possible error types. 243dnl # 244AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_BI_STATUS], [ 245 ZFS_LINUX_TEST_SRC([bio_bi_status], [ 246 #include <linux/bio.h> 247 ], [ 248 struct bio bio __attribute__ ((unused)); 249 blk_status_t status __attribute__ ((unused)) = BLK_STS_OK; 250 bio.bi_status = status; 251 ]) 252]) 253 254AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_STATUS], [ 255 AC_MSG_CHECKING([whether bio->bi_status exists]) 256 ZFS_LINUX_TEST_RESULT([bio_bi_status], [ 257 AC_MSG_RESULT(yes) 258 AC_DEFINE(HAVE_BIO_BI_STATUS, 1, [bio->bi_status exists]) 259 ],[ 260 AC_MSG_RESULT(no) 261 ]) 262]) 263 264dnl # 265dnl # 3.14 API change, 266dnl # Immutable biovecs. A number of fields of struct bio are moved to 267dnl # struct bvec_iter. 268dnl # 269AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_BVEC_ITER], [ 270 ZFS_LINUX_TEST_SRC([bio_bvec_iter], [ 271 #include <linux/bio.h> 272 ],[ 273 struct bio bio; 274 bio.bi_iter.bi_sector = 0; 275 ]) 276]) 277 278AC_DEFUN([ZFS_AC_KERNEL_BIO_BVEC_ITER], [ 279 AC_MSG_CHECKING([whether bio has bi_iter]) 280 ZFS_LINUX_TEST_RESULT([bio_bvec_iter], [ 281 AC_MSG_RESULT(yes) 282 AC_DEFINE(HAVE_BIO_BVEC_ITER, 1, [bio has bi_iter]) 283 ],[ 284 AC_MSG_RESULT(no) 285 ]) 286]) 287 288dnl # 289dnl # 4.8 API change 290dnl # The rw argument has been removed from submit_bio/submit_bio_wait. 291dnl # Callers are now expected to set bio->bi_rw instead of passing it in. 292dnl # 293AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_SUBMIT_BIO], [ 294 ZFS_LINUX_TEST_SRC([submit_bio], [ 295 #include <linux/bio.h> 296 ],[ 297 blk_qc_t blk_qc; 298 struct bio *bio = NULL; 299 blk_qc = submit_bio(bio); 300 ]) 301]) 302 303AC_DEFUN([ZFS_AC_KERNEL_BIO_SUBMIT_BIO], [ 304 AC_MSG_CHECKING([whether submit_bio() wants 1 arg]) 305 ZFS_LINUX_TEST_RESULT([submit_bio], [ 306 AC_MSG_RESULT(yes) 307 AC_DEFINE(HAVE_1ARG_SUBMIT_BIO, 1, [submit_bio() wants 1 arg]) 308 ],[ 309 AC_MSG_RESULT(no) 310 ]) 311]) 312 313dnl # 314dnl # 2.6.34 API change 315dnl # current->bio_list 316dnl # 317AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_CURRENT_BIO_LIST], [ 318 ZFS_LINUX_TEST_SRC([current_bio_list], [ 319 #include <linux/sched.h> 320 ], [ 321 current->bio_list = (struct bio_list *) NULL; 322 ]) 323]) 324 325AC_DEFUN([ZFS_AC_KERNEL_BIO_CURRENT_BIO_LIST], [ 326 AC_MSG_CHECKING([whether current->bio_list exists]) 327 ZFS_LINUX_TEST_RESULT([current_bio_list], [ 328 AC_MSG_RESULT(yes) 329 ],[ 330 ZFS_LINUX_TEST_ERROR([bio_list]) 331 ]) 332]) 333 334dnl # 335dnl # Linux 5.5 API, 336dnl # 337dnl # The Linux 5.5 kernel updated percpu_ref_tryget() which is inlined by 338dnl # blkg_tryget() to use rcu_read_lock() instead of rcu_read_lock_sched(). 339dnl # As a side effect the function was converted to GPL-only. 340dnl # 341AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKG_TRYGET], [ 342 ZFS_LINUX_TEST_SRC([blkg_tryget], [ 343 #include <linux/blk-cgroup.h> 344 #include <linux/bio.h> 345 #include <linux/fs.h> 346 ],[ 347 struct blkcg_gq blkg __attribute__ ((unused)); 348 bool rc __attribute__ ((unused)); 349 rc = blkg_tryget(&blkg); 350 ], [], [$ZFS_META_LICENSE]) 351]) 352 353AC_DEFUN([ZFS_AC_KERNEL_BLKG_TRYGET], [ 354 AC_MSG_CHECKING([whether blkg_tryget() is available]) 355 ZFS_LINUX_TEST_RESULT([blkg_tryget], [ 356 AC_MSG_RESULT(yes) 357 AC_DEFINE(HAVE_BLKG_TRYGET, 1, [blkg_tryget() is available]) 358 359 AC_MSG_CHECKING([whether blkg_tryget() is GPL-only]) 360 ZFS_LINUX_TEST_RESULT([blkg_tryget_license], [ 361 AC_MSG_RESULT(no) 362 ],[ 363 AC_MSG_RESULT(yes) 364 AC_DEFINE(HAVE_BLKG_TRYGET_GPL_ONLY, 1, 365 [blkg_tryget() GPL-only]) 366 ]) 367 ],[ 368 AC_MSG_RESULT(no) 369 ]) 370]) 371 372AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [ 373 ZFS_AC_KERNEL_SRC_REQ 374 ZFS_AC_KERNEL_SRC_BIO_OPS 375 ZFS_AC_KERNEL_SRC_BIO_SET_DEV 376 ZFS_AC_KERNEL_SRC_BIO_END_IO_T_ARGS 377 ZFS_AC_KERNEL_SRC_BIO_BI_STATUS 378 ZFS_AC_KERNEL_SRC_BIO_BVEC_ITER 379 ZFS_AC_KERNEL_SRC_BIO_SUBMIT_BIO 380 ZFS_AC_KERNEL_SRC_BIO_CURRENT_BIO_LIST 381 ZFS_AC_KERNEL_SRC_BLKG_TRYGET 382]) 383 384AC_DEFUN([ZFS_AC_KERNEL_BIO], [ 385 ZFS_AC_KERNEL_BIO_REQ_FAILFAST_MASK 386 ZFS_AC_KERNEL_BIO_REQ_DISCARD 387 ZFS_AC_KERNEL_BIO_REQ_FLUSH 388 ZFS_AC_KERNEL_BIO_REQ_PREFLUSH 389 390 ZFS_AC_KERNEL_BIO_REQ_OP_DISCARD 391 ZFS_AC_KERNEL_BIO_REQ_OP_SECURE_ERASE 392 ZFS_AC_KERNEL_BIO_REQ_OP_FLUSH 393 ZFS_AC_KERNEL_BIO_BI_OPF 394 ZFS_AC_KERNEL_BIO_SET_OP_ATTRS 395 396 ZFS_AC_KERNEL_BIO_SET_DEV 397 ZFS_AC_KERNEL_BIO_END_IO_T_ARGS 398 ZFS_AC_KERNEL_BIO_BI_STATUS 399 ZFS_AC_KERNEL_BIO_BVEC_ITER 400 ZFS_AC_KERNEL_BIO_SUBMIT_BIO 401 ZFS_AC_KERNEL_BIO_CURRENT_BIO_LIST 402 ZFS_AC_KERNEL_BLKG_TRYGET 403]) 404