mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-27 10:24:22 +03:00
config: remove HAVE_REQ_OP_* and HAVE_REQ_*
Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #16479
This commit is contained in:
parent
95d85f032f
commit
846b598519
@ -1,81 +1,3 @@
|
||||
dnl #
|
||||
dnl # 2.6.36 API change,
|
||||
dnl # REQ_FAILFAST_{DEV|TRANSPORT|DRIVER}
|
||||
dnl # REQ_DISCARD
|
||||
dnl # REQ_FLUSH
|
||||
dnl #
|
||||
dnl # 4.8 - 4.9 API,
|
||||
dnl # REQ_FLUSH was renamed to REQ_PREFLUSH
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_REQ], [
|
||||
ZFS_LINUX_TEST_SRC([req_failfast_mask], [
|
||||
#include <linux/bio.h>
|
||||
],[
|
||||
int flags __attribute__ ((unused));
|
||||
flags = REQ_FAILFAST_MASK;
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([req_discard], [
|
||||
#include <linux/bio.h>
|
||||
],[
|
||||
int flags __attribute__ ((unused));
|
||||
flags = REQ_DISCARD;
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([req_flush], [
|
||||
#include <linux/bio.h>
|
||||
],[
|
||||
int flags __attribute__ ((unused));
|
||||
flags = REQ_FLUSH;
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([req_preflush], [
|
||||
#include <linux/bio.h>
|
||||
],[
|
||||
int flags __attribute__ ((unused));
|
||||
flags = REQ_PREFLUSH;
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_FAILFAST_MASK], [
|
||||
AC_MSG_CHECKING([whether REQ_FAILFAST_MASK is defined])
|
||||
ZFS_LINUX_TEST_RESULT([req_failfast_mask], [
|
||||
AC_MSG_RESULT(yes)
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([REQ_FAILFAST_MASK])
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_DISCARD], [
|
||||
AC_MSG_CHECKING([whether REQ_DISCARD is defined])
|
||||
ZFS_LINUX_TEST_RESULT([req_discard], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_REQ_DISCARD, 1, [REQ_DISCARD is defined])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_FLUSH], [
|
||||
AC_MSG_CHECKING([whether REQ_FLUSH is defined])
|
||||
ZFS_LINUX_TEST_RESULT([req_flush], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_REQ_FLUSH, 1, [REQ_FLUSH is defined])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_PREFLUSH], [
|
||||
AC_MSG_CHECKING([whether REQ_PREFLUSH is defined])
|
||||
ZFS_LINUX_TEST_RESULT([req_preflush], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_REQ_PREFLUSH, 1, [REQ_PREFLUSH is defined])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # Linux 4.8 API,
|
||||
dnl #
|
||||
@ -84,24 +6,6 @@ dnl # checking the bio->bi_rw flags. The following checks are used to
|
||||
dnl # detect if a specific operation is supported.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_OPS], [
|
||||
ZFS_LINUX_TEST_SRC([req_op_discard], [
|
||||
#include <linux/blk_types.h>
|
||||
],[
|
||||
int op __attribute__ ((unused)) = REQ_OP_DISCARD;
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([req_op_secure_erase], [
|
||||
#include <linux/blk_types.h>
|
||||
],[
|
||||
int op __attribute__ ((unused)) = REQ_OP_SECURE_ERASE;
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([req_op_flush], [
|
||||
#include <linux/blk_types.h>
|
||||
],[
|
||||
int op __attribute__ ((unused)) = REQ_OP_FLUSH;
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([bio_set_op_attrs], [
|
||||
#include <linux/bio.h>
|
||||
],[
|
||||
@ -110,37 +14,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_OPS], [
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_OP_DISCARD], [
|
||||
AC_MSG_CHECKING([whether REQ_OP_DISCARD is defined])
|
||||
ZFS_LINUX_TEST_RESULT([req_op_discard], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_REQ_OP_DISCARD, 1, [REQ_OP_DISCARD is defined])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_OP_SECURE_ERASE], [
|
||||
AC_MSG_CHECKING([whether REQ_OP_SECURE_ERASE is defined])
|
||||
ZFS_LINUX_TEST_RESULT([req_op_secure_erase], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_REQ_OP_SECURE_ERASE, 1,
|
||||
[REQ_OP_SECURE_ERASE is defined])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_OP_FLUSH], [
|
||||
AC_MSG_CHECKING([whether REQ_OP_FLUSH is defined])
|
||||
ZFS_LINUX_TEST_RESULT([req_op_flush], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_REQ_OP_FLUSH, 1, [REQ_OP_FLUSH is defined])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_OP_ATTRS], [
|
||||
AC_MSG_CHECKING([whether bio_set_op_attrs is available])
|
||||
ZFS_LINUX_TEST_RESULT([bio_set_op_attrs], [
|
||||
@ -394,7 +267,6 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO_ALLOC_4ARG], [
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [
|
||||
ZFS_AC_KERNEL_SRC_REQ
|
||||
ZFS_AC_KERNEL_SRC_BIO_OPS
|
||||
ZFS_AC_KERNEL_SRC_BIO_SET_DEV
|
||||
ZFS_AC_KERNEL_SRC_BIO_BI_STATUS
|
||||
@ -407,16 +279,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BIO], [
|
||||
ZFS_AC_KERNEL_BIO_REQ_FAILFAST_MASK
|
||||
ZFS_AC_KERNEL_BIO_REQ_DISCARD
|
||||
ZFS_AC_KERNEL_BIO_REQ_FLUSH
|
||||
ZFS_AC_KERNEL_BIO_REQ_PREFLUSH
|
||||
|
||||
ZFS_AC_KERNEL_BIO_REQ_OP_DISCARD
|
||||
ZFS_AC_KERNEL_BIO_REQ_OP_SECURE_ERASE
|
||||
ZFS_AC_KERNEL_BIO_REQ_OP_FLUSH
|
||||
ZFS_AC_KERNEL_BIO_SET_OP_ATTRS
|
||||
|
||||
ZFS_AC_KERNEL_BIO_SET_DEV
|
||||
ZFS_AC_KERNEL_BIO_BI_STATUS
|
||||
ZFS_AC_KERNEL_BIO_CURRENT_BIO_LIST
|
||||
|
@ -409,42 +409,17 @@ bio_set_op_attrs(struct bio *bio, unsigned rw, unsigned flags)
|
||||
/*
|
||||
* bio_set_flush - Set the appropriate flags in a bio to guarantee
|
||||
* data are on non-volatile media on completion.
|
||||
*
|
||||
* 2.6.37 - 4.8 API,
|
||||
* Introduce WRITE_FLUSH, WRITE_FUA, and WRITE_FLUSH_FUA flags as a
|
||||
* replacement for WRITE_BARRIER to allow expressing richer semantics
|
||||
* to the block layer. It's up to the block layer to implement the
|
||||
* semantics correctly. Use the WRITE_FLUSH_FUA flag combination.
|
||||
*
|
||||
* 4.8 - 4.9 API,
|
||||
* REQ_FLUSH was renamed to REQ_PREFLUSH. For consistency with previous
|
||||
* OpenZFS releases, prefer the WRITE_FLUSH_FUA flag set if it's available.
|
||||
*
|
||||
* 4.10 API,
|
||||
* The read/write flags and their modifiers, including WRITE_FLUSH,
|
||||
* WRITE_FUA and WRITE_FLUSH_FUA were removed from fs.h in
|
||||
* torvalds/linux@70fd7614 and replaced by direct flag modification
|
||||
* of the REQ_ flags in bio->bi_opf. Use REQ_PREFLUSH.
|
||||
*/
|
||||
static inline void
|
||||
bio_set_flush(struct bio *bio)
|
||||
{
|
||||
#if defined(HAVE_REQ_PREFLUSH) /* >= 4.10 */
|
||||
bio_set_op_attrs(bio, 0, REQ_PREFLUSH | REQ_OP_WRITE);
|
||||
#elif defined(WRITE_FLUSH_FUA) /* >= 2.6.37 and <= 4.9 */
|
||||
bio_set_op_attrs(bio, 0, WRITE_FLUSH_FUA);
|
||||
#else
|
||||
#error "Allowing the build will cause bio_set_flush requests to be ignored."
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* 4.8 API,
|
||||
* REQ_OP_FLUSH
|
||||
*
|
||||
* 4.8-rc0 - 4.8-rc1,
|
||||
* REQ_PREFLUSH
|
||||
*
|
||||
* in all cases but may have a performance impact for some kernels. It
|
||||
* has the advantage of minimizing kernel specific changes in the zvol code.
|
||||
*
|
||||
@ -452,13 +427,7 @@ bio_set_flush(struct bio *bio)
|
||||
static inline boolean_t
|
||||
bio_is_flush(struct bio *bio)
|
||||
{
|
||||
#if defined(HAVE_REQ_OP_FLUSH)
|
||||
return ((bio_op(bio) == REQ_OP_FLUSH) || (bio->bi_opf & REQ_PREFLUSH));
|
||||
#elif defined(HAVE_REQ_PREFLUSH)
|
||||
return (bio->bi_opf & REQ_PREFLUSH);
|
||||
#else
|
||||
#error "Unsupported kernel"
|
||||
#endif
|
||||
return (bio_op(bio) == REQ_OP_FLUSH);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -475,41 +444,23 @@ bio_is_fua(struct bio *bio)
|
||||
* 4.8 API,
|
||||
* REQ_OP_DISCARD
|
||||
*
|
||||
* 2.6.36 - 4.7 API,
|
||||
* REQ_DISCARD
|
||||
*
|
||||
* In all cases the normal I/O path is used for discards. The only
|
||||
* difference is how the kernel tags individual I/Os as discards.
|
||||
*/
|
||||
static inline boolean_t
|
||||
bio_is_discard(struct bio *bio)
|
||||
{
|
||||
#if defined(HAVE_REQ_OP_DISCARD)
|
||||
return (bio_op(bio) == REQ_OP_DISCARD);
|
||||
#elif defined(HAVE_REQ_DISCARD)
|
||||
return (bio->bi_rw & REQ_DISCARD);
|
||||
#else
|
||||
#error "Unsupported kernel"
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* 4.8 API,
|
||||
* REQ_OP_SECURE_ERASE
|
||||
*
|
||||
* 2.6.36 - 4.7 API,
|
||||
* REQ_SECURE
|
||||
*/
|
||||
static inline boolean_t
|
||||
bio_is_secure_erase(struct bio *bio)
|
||||
{
|
||||
#if defined(HAVE_REQ_OP_SECURE_ERASE)
|
||||
return (bio_op(bio) == REQ_OP_SECURE_ERASE);
|
||||
#elif defined(REQ_SECURE)
|
||||
return (bio->bi_rw & REQ_SECURE);
|
||||
#else
|
||||
return (0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user