Skip to content

Commit 846b598

Browse files
robnbehlendorf
authored andcommitted
config: remove HAVE_REQ_OP_* and HAVE_REQ_*
Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Signed-off-by: Rob Norris <[email protected]> Closes openzfs#16479
1 parent 95d85f0 commit 846b598

File tree

2 files changed

+1
-187
lines changed

2 files changed

+1
-187
lines changed

config/kernel-bio.m4

Lines changed: 0 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,3 @@
1-
dnl #
2-
dnl # 2.6.36 API change,
3-
dnl # REQ_FAILFAST_{DEV|TRANSPORT|DRIVER}
4-
dnl # REQ_DISCARD
5-
dnl # REQ_FLUSH
6-
dnl #
7-
dnl # 4.8 - 4.9 API,
8-
dnl # REQ_FLUSH was renamed to REQ_PREFLUSH
9-
dnl #
10-
AC_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-
40-
AC_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-
49-
AC_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-
59-
AC_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-
69-
AC_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-
791
dnl #
802
dnl # Linux 4.8 API,
813
dnl #
@@ -84,24 +6,6 @@ dnl # checking the bio->bi_rw flags. The following checks are used to
846
dnl # detect if a specific operation is supported.
857
dnl #
868
AC_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-
1059
ZFS_LINUX_TEST_SRC([bio_set_op_attrs], [
10610
#include <linux/bio.h>
10711
],[
@@ -110,37 +14,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_OPS], [
11014
])
11115
])
11216

113-
AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_OP_DISCARD], [
114-
AC_MSG_CHECKING([whether REQ_OP_DISCARD is defined])
115-
ZFS_LINUX_TEST_RESULT([req_op_discard], [
116-
AC_MSG_RESULT(yes)
117-
AC_DEFINE(HAVE_REQ_OP_DISCARD, 1, [REQ_OP_DISCARD is defined])
118-
],[
119-
AC_MSG_RESULT(no)
120-
])
121-
])
122-
123-
AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_OP_SECURE_ERASE], [
124-
AC_MSG_CHECKING([whether REQ_OP_SECURE_ERASE is defined])
125-
ZFS_LINUX_TEST_RESULT([req_op_secure_erase], [
126-
AC_MSG_RESULT(yes)
127-
AC_DEFINE(HAVE_REQ_OP_SECURE_ERASE, 1,
128-
[REQ_OP_SECURE_ERASE is defined])
129-
],[
130-
AC_MSG_RESULT(no)
131-
])
132-
])
133-
134-
AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_OP_FLUSH], [
135-
AC_MSG_CHECKING([whether REQ_OP_FLUSH is defined])
136-
ZFS_LINUX_TEST_RESULT([req_op_flush], [
137-
AC_MSG_RESULT(yes)
138-
AC_DEFINE(HAVE_REQ_OP_FLUSH, 1, [REQ_OP_FLUSH is defined])
139-
],[
140-
AC_MSG_RESULT(no)
141-
])
142-
])
143-
14417
AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_OP_ATTRS], [
14518
AC_MSG_CHECKING([whether bio_set_op_attrs is available])
14619
ZFS_LINUX_TEST_RESULT([bio_set_op_attrs], [
@@ -394,7 +267,6 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO_ALLOC_4ARG], [
394267
])
395268

396269
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [
397-
ZFS_AC_KERNEL_SRC_REQ
398270
ZFS_AC_KERNEL_SRC_BIO_OPS
399271
ZFS_AC_KERNEL_SRC_BIO_SET_DEV
400272
ZFS_AC_KERNEL_SRC_BIO_BI_STATUS
@@ -407,16 +279,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [
407279
])
408280

409281
AC_DEFUN([ZFS_AC_KERNEL_BIO], [
410-
ZFS_AC_KERNEL_BIO_REQ_FAILFAST_MASK
411-
ZFS_AC_KERNEL_BIO_REQ_DISCARD
412-
ZFS_AC_KERNEL_BIO_REQ_FLUSH
413-
ZFS_AC_KERNEL_BIO_REQ_PREFLUSH
414-
415-
ZFS_AC_KERNEL_BIO_REQ_OP_DISCARD
416-
ZFS_AC_KERNEL_BIO_REQ_OP_SECURE_ERASE
417-
ZFS_AC_KERNEL_BIO_REQ_OP_FLUSH
418282
ZFS_AC_KERNEL_BIO_SET_OP_ATTRS
419-
420283
ZFS_AC_KERNEL_BIO_SET_DEV
421284
ZFS_AC_KERNEL_BIO_BI_STATUS
422285
ZFS_AC_KERNEL_BIO_CURRENT_BIO_LIST

include/os/linux/kernel/linux/blkdev_compat.h

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -409,56 +409,25 @@ bio_set_op_attrs(struct bio *bio, unsigned rw, unsigned flags)
409409
/*
410410
* bio_set_flush - Set the appropriate flags in a bio to guarantee
411411
* data are on non-volatile media on completion.
412-
*
413-
* 2.6.37 - 4.8 API,
414-
* Introduce WRITE_FLUSH, WRITE_FUA, and WRITE_FLUSH_FUA flags as a
415-
* replacement for WRITE_BARRIER to allow expressing richer semantics
416-
* to the block layer. It's up to the block layer to implement the
417-
* semantics correctly. Use the WRITE_FLUSH_FUA flag combination.
418-
*
419-
* 4.8 - 4.9 API,
420-
* REQ_FLUSH was renamed to REQ_PREFLUSH. For consistency with previous
421-
* OpenZFS releases, prefer the WRITE_FLUSH_FUA flag set if it's available.
422-
*
423-
* 4.10 API,
424-
* The read/write flags and their modifiers, including WRITE_FLUSH,
425-
* WRITE_FUA and WRITE_FLUSH_FUA were removed from fs.h in
426-
* torvalds/linux@70fd7614 and replaced by direct flag modification
427-
* of the REQ_ flags in bio->bi_opf. Use REQ_PREFLUSH.
428412
*/
429413
static inline void
430414
bio_set_flush(struct bio *bio)
431415
{
432-
#if defined(HAVE_REQ_PREFLUSH) /* >= 4.10 */
433416
bio_set_op_attrs(bio, 0, REQ_PREFLUSH | REQ_OP_WRITE);
434-
#elif defined(WRITE_FLUSH_FUA) /* >= 2.6.37 and <= 4.9 */
435-
bio_set_op_attrs(bio, 0, WRITE_FLUSH_FUA);
436-
#else
437-
#error "Allowing the build will cause bio_set_flush requests to be ignored."
438-
#endif
439417
}
440418

441419
/*
442420
* 4.8 API,
443421
* REQ_OP_FLUSH
444422
*
445-
* 4.8-rc0 - 4.8-rc1,
446-
* REQ_PREFLUSH
447-
*
448423
* in all cases but may have a performance impact for some kernels. It
449424
* has the advantage of minimizing kernel specific changes in the zvol code.
450425
*
451426
*/
452427
static inline boolean_t
453428
bio_is_flush(struct bio *bio)
454429
{
455-
#if defined(HAVE_REQ_OP_FLUSH)
456-
return ((bio_op(bio) == REQ_OP_FLUSH) || (bio->bi_opf & REQ_PREFLUSH));
457-
#elif defined(HAVE_REQ_PREFLUSH)
458-
return (bio->bi_opf & REQ_PREFLUSH);
459-
#else
460-
#error "Unsupported kernel"
461-
#endif
430+
return (bio_op(bio) == REQ_OP_FLUSH);
462431
}
463432

464433
/*
@@ -475,41 +444,23 @@ bio_is_fua(struct bio *bio)
475444
* 4.8 API,
476445
* REQ_OP_DISCARD
477446
*
478-
* 2.6.36 - 4.7 API,
479-
* REQ_DISCARD
480-
*
481447
* In all cases the normal I/O path is used for discards. The only
482448
* difference is how the kernel tags individual I/Os as discards.
483449
*/
484450
static inline boolean_t
485451
bio_is_discard(struct bio *bio)
486452
{
487-
#if defined(HAVE_REQ_OP_DISCARD)
488453
return (bio_op(bio) == REQ_OP_DISCARD);
489-
#elif defined(HAVE_REQ_DISCARD)
490-
return (bio->bi_rw & REQ_DISCARD);
491-
#else
492-
#error "Unsupported kernel"
493-
#endif
494454
}
495455

496456
/*
497457
* 4.8 API,
498458
* REQ_OP_SECURE_ERASE
499-
*
500-
* 2.6.36 - 4.7 API,
501-
* REQ_SECURE
502459
*/
503460
static inline boolean_t
504461
bio_is_secure_erase(struct bio *bio)
505462
{
506-
#if defined(HAVE_REQ_OP_SECURE_ERASE)
507463
return (bio_op(bio) == REQ_OP_SECURE_ERASE);
508-
#elif defined(REQ_SECURE)
509-
return (bio->bi_rw & REQ_SECURE);
510-
#else
511-
return (0);
512-
#endif
513464
}
514465

515466
/*

0 commit comments

Comments
 (0)