diff --git a/config/kernel-bio.m4 b/config/kernel-bio.m4 index 6d3a020ed..85d26bae6 100644 --- a/config/kernel-bio.m4 +++ b/config/kernel-bio.m4 @@ -93,31 +93,6 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV], [ ]) ]) -dnl # -dnl # 4.13 API change -dnl # The bio->bi_error field was replaced with bio->bi_status which is an -dnl # enum which describes all possible error types. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_BI_STATUS], [ - ZFS_LINUX_TEST_SRC([bio_bi_status], [ - #include - ], [ - struct bio bio __attribute__ ((unused)); - blk_status_t status __attribute__ ((unused)) = BLK_STS_OK; - bio.bi_status = status; - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_STATUS], [ - AC_MSG_CHECKING([whether bio->bi_status exists]) - ZFS_LINUX_TEST_RESULT([bio_bi_status], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BIO_BI_STATUS, 1, [bio->bi_status exists]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - dnl # dnl # 2.6.34 API change dnl # current->bio_list @@ -269,7 +244,6 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO_ALLOC_4ARG], [ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [ ZFS_AC_KERNEL_SRC_BIO_OPS ZFS_AC_KERNEL_SRC_BIO_SET_DEV - ZFS_AC_KERNEL_SRC_BIO_BI_STATUS ZFS_AC_KERNEL_SRC_BIO_CURRENT_BIO_LIST ZFS_AC_KERNEL_SRC_BLKG_TRYGET ZFS_AC_KERNEL_SRC_BIO_BDEV_DISK @@ -281,7 +255,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [ AC_DEFUN([ZFS_AC_KERNEL_BIO], [ 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 ZFS_AC_KERNEL_BLKG_TRYGET ZFS_AC_KERNEL_BIO_BDEV_DISK diff --git a/include/os/linux/kernel/linux/blkdev_compat.h b/include/os/linux/kernel/linux/blkdev_compat.h index 51e478b66..4a479ece3 100644 --- a/include/os/linux/kernel/linux/blkdev_compat.h +++ b/include/os/linux/kernel/linux/blkdev_compat.h @@ -166,7 +166,6 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags, bool dev, #define DISK_NAME_LEN 32 #endif /* DISK_NAME_LEN */ -#ifdef HAVE_BIO_BI_STATUS static inline int bi_status_to_errno(blk_status_t status) { @@ -240,31 +239,6 @@ errno_to_bi_status(int error) return (BLK_STS_IOERR); } } -#endif /* HAVE_BIO_BI_STATUS */ - -#ifdef HAVE_BIO_BI_STATUS -#define BIO_END_IO_ERROR(bio) bi_status_to_errno(bio->bi_status) -#define BIO_END_IO_PROTO(fn, x, z) static void fn(struct bio *x) -#define BIO_END_IO(bio, error) bio_set_bi_status(bio, error) -static inline void -bio_set_bi_status(struct bio *bio, int error) -{ - ASSERT3S(error, <=, 0); - bio->bi_status = errno_to_bi_status(-error); - bio_endio(bio); -} -#else -#define BIO_END_IO_ERROR(bio) (-(bio->bi_error)) -#define BIO_END_IO_PROTO(fn, x, z) static void fn(struct bio *x) -#define BIO_END_IO(bio, error) bio_set_bi_error(bio, error) -static inline void -bio_set_bi_error(struct bio *bio, int error) -{ - ASSERT3S(error, <=, 0); - bio->bi_error = error; - bio_endio(bio); -} -#endif /* HAVE_BIO_BI_STATUS */ /* * 5.15 MACRO, diff --git a/module/os/linux/zfs/vdev_disk.c b/module/os/linux/zfs/vdev_disk.c index abab81c86..8ce92290c 100644 --- a/module/os/linux/zfs/vdev_disk.c +++ b/module/os/linux/zfs/vdev_disk.c @@ -697,7 +697,7 @@ vbio_alloc(zio_t *zio, struct block_device *bdev, int flags) return (vbio); } -BIO_END_IO_PROTO(vbio_completion, bio, error); +static void vbio_completion(struct bio *bio); static int vbio_add_page(vbio_t *vbio, struct page *page, uint_t size, uint_t offset) @@ -793,7 +793,8 @@ vbio_submit(vbio_t *vbio, abd_t *abd, uint64_t size) } /* IO completion callback */ -BIO_END_IO_PROTO(vbio_completion, bio, error) +static void +vbio_completion(struct bio *bio) { vbio_t *vbio = bio->bi_private; zio_t *zio = vbio->vbio_zio; @@ -801,7 +802,7 @@ BIO_END_IO_PROTO(vbio_completion, bio, error) ASSERT(zio); /* Capture and log any errors */ - zio->io_error = BIO_END_IO_ERROR(bio); + zio->io_error = bi_status_to_errno(bio->bi_status); ASSERT3U(zio->io_error, >=, 0); if (zio->io_error) @@ -1052,12 +1053,13 @@ vdev_classic_dio_put(dio_request_t *dr) } } -BIO_END_IO_PROTO(vdev_classic_physio_completion, bio, error) +static void +vdev_classic_physio_completion(struct bio *bio) { dio_request_t *dr = bio->bi_private; if (dr->dr_error == 0) { - dr->dr_error = BIO_END_IO_ERROR(bio); + dr->dr_error = bi_status_to_errno(bio->bi_status); } /* Drop reference acquired by vdev_classic_physio */ @@ -1196,10 +1198,11 @@ retry: /* ========== */ -BIO_END_IO_PROTO(vdev_disk_io_flush_completion, bio, error) +static void +vdev_disk_io_flush_completion(struct bio *bio) { zio_t *zio = bio->bi_private; - zio->io_error = BIO_END_IO_ERROR(bio); + zio->io_error = bi_status_to_errno(bio->bi_status); if (zio->io_error && (zio->io_error == EOPNOTSUPP)) zio->io_vd->vdev_nowritecache = B_TRUE; @@ -1234,10 +1237,11 @@ vdev_disk_io_flush(struct block_device *bdev, zio_t *zio) return (0); } -BIO_END_IO_PROTO(vdev_disk_discard_end_io, bio, error) +static void +vdev_disk_discard_end_io(struct bio *bio) { zio_t *zio = bio->bi_private; - zio->io_error = BIO_END_IO_ERROR(bio); + zio->io_error = bi_status_to_errno(bio->bi_status); bio_put(bio); if (zio->io_error) diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c index d1e3061b5..f84dd2175 100644 --- a/module/os/linux/zfs/zvol_os.c +++ b/module/os/linux/zfs/zvol_os.c @@ -99,13 +99,17 @@ static unsigned int zvol_num_taskqs = 0; #ifdef HAVE_BLK_MQ #define END_IO(zv, bio, rq, error) do { \ if (bio) { \ - BIO_END_IO(bio, error); \ + bio->bi_status = errno_to_bi_status(-error); \ + bio_endio(bio); \ } else { \ blk_mq_end_request(rq, errno_to_bi_status(error)); \ } \ } while (0) #else -#define END_IO(zv, bio, rq, error) BIO_END_IO(bio, error) +#define END_IO(zv, bio, rq, error) do { \ + bio->bi_status = errno_to_bi_status(-error); \ + bio_endio(bio); \ +} while (0) #endif #ifdef HAVE_BLK_MQ