diff options
author | Coleman Kane <[email protected]> | 2021-12-02 22:54:05 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2021-12-07 12:27:27 -0800 |
commit | 435a451e5c5ecb7cc773ea68f7f05b1e0a9659c3 (patch) | |
tree | fff5ead066948021159cb95957469373a6a40442 | |
parent | 376027331d7edaf0bb7bd146f2f087108b7eeac5 (diff) |
Linux 5.16: block_device_operations->submit_bio now returns void
The return type for the submit_bio member of struct
block_device_operations was changed to no longer return a value.
Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Coleman Kane <[email protected]>
Closes #12819
-rw-r--r-- | config/kernel-bio.m4 | 29 | ||||
-rw-r--r-- | module/os/linux/zfs/zvol_os.c | 10 |
2 files changed, 37 insertions, 2 deletions
diff --git a/config/kernel-bio.m4 b/config/kernel-bio.m4 index aad4d31cf..1d715b2de 100644 --- a/config/kernel-bio.m4 +++ b/config/kernel-bio.m4 @@ -395,6 +395,33 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO_BDEV_DISK], [ ]) ]) +dnl # +dnl # Linux 5.16 API +dnl # +dnl # The Linux 5.16 API for submit_bio changed the return type to be +dnl # void instead of int +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BDEV_SUBMIT_BIO_RETURNS_VOID], [ + ZFS_LINUX_TEST_SRC([bio_bdev_submit_bio_void], [ + #include <linux/blkdev.h> + ],[ + struct block_device_operations *bdev = NULL; + __attribute__((unused)) void(*f)(struct bio *) = bdev->submit_bio; + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BDEV_SUBMIT_BIO_RETURNS_VOID], [ + AC_MSG_CHECKING( + [whether block_device_operations->submit_bio() returns void]) + ZFS_LINUX_TEST_RESULT([bio_bdev_submit_bio_void], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BDEV_SUBMIT_BIO_RETURNS_VOID, 1, + [block_device_operations->submit_bio() returns void]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [ ZFS_AC_KERNEL_SRC_REQ ZFS_AC_KERNEL_SRC_BIO_OPS @@ -406,6 +433,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [ ZFS_AC_KERNEL_SRC_BIO_CURRENT_BIO_LIST ZFS_AC_KERNEL_SRC_BLKG_TRYGET ZFS_AC_KERNEL_SRC_BIO_BDEV_DISK + ZFS_AC_KERNEL_SRC_BDEV_SUBMIT_BIO_RETURNS_VOID ]) AC_DEFUN([ZFS_AC_KERNEL_BIO], [ @@ -428,4 +456,5 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO], [ ZFS_AC_KERNEL_BIO_CURRENT_BIO_LIST ZFS_AC_KERNEL_BLKG_TRYGET ZFS_AC_KERNEL_BIO_BDEV_DISK + ZFS_AC_KERNEL_BDEV_SUBMIT_BIO_RETURNS_VOID ]) diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c index 75a31b38d..44caadd58 100644 --- a/module/os/linux/zfs/zvol_os.c +++ b/module/os/linux/zfs/zvol_os.c @@ -337,8 +337,13 @@ zvol_read_task(void *arg) } #ifdef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS +#ifdef HAVE_BDEV_SUBMIT_BIO_RETURNS_VOID +static void +zvol_submit_bio(struct bio *bio) +#else static blk_qc_t zvol_submit_bio(struct bio *bio) +#endif #else static MAKE_REQUEST_FN_RET zvol_request(struct request_queue *q, struct bio *bio) @@ -479,8 +484,9 @@ zvol_request(struct request_queue *q, struct bio *bio) out: spl_fstrans_unmark(cookie); -#if defined(HAVE_MAKE_REQUEST_FN_RET_QC) || \ - defined(HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS) +#if (defined(HAVE_MAKE_REQUEST_FN_RET_QC) || \ + defined(HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS)) && \ + !defined(HAVE_BDEV_SUBMIT_BIO_RETURNS_VOID) return (BLK_QC_T_NONE); #endif } |