]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Linux 4.8 compat: submit_bio()
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 27 Jul 2016 02:23:53 +0000 (02:23 +0000)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 29 Jul 2016 21:48:00 +0000 (14:48 -0700)
The rw argument has been removed from submit_bio/submit_bio_wait.
Callers are now expected to set bio->bi_rw instead of passing it
in.  See https://github.com/torvalds/linux/commit/4e49ea4a for
complete details.

Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #4892
Issue #4899

config/kernel-submit_bio.m4 [new file with mode: 0644]
config/kernel.m4
module/zfs/vdev_disk.c

diff --git a/config/kernel-submit_bio.m4 b/config/kernel-submit_bio.m4
new file mode 100644 (file)
index 0000000..da5f85c
--- /dev/null
@@ -0,0 +1,20 @@
+dnl #
+dnl # 4.8 API change
+dnl # The rw argument has been removed from submit_bio/submit_bio_wait.
+dnl # Callers are now expected to set bio->bi_rw instead of passing it in.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_SUBMIT_BIO], [
+       AC_MSG_CHECKING([whether submit_bio() wants 1 arg])
+       ZFS_LINUX_TRY_COMPILE([
+               #include <linux/bio.h>
+       ],[
+               blk_qc_t blk_qc;
+               struct bio *bio = NULL;
+               blk_qc = submit_bio(bio);
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_1ARG_SUBMIT_BIO, 1, [submit_bio() wants 1 arg])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+])
index ac6c08ffe9e0ca5e4931a25d2c968f14140e6a26..7edafee0fc2096c7ee1533fe0fb8bf9b53cd8dd4 100644 (file)
@@ -8,6 +8,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
        ZFS_AC_KERNEL_CONFIG
        ZFS_AC_KERNEL_DECLARE_EVENT_CLASS
        ZFS_AC_KERNEL_CURRENT_BIO_TAIL
+       ZFS_AC_KERNEL_SUBMIT_BIO
        ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS
        ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
        ZFS_AC_KERNEL_TYPE_FMODE_T
index 205f78d78c66a68908f4f798c7de5963d6e8f32a..28f145d049fb73341e23b44894a4d886c3a3c640 100644 (file)
@@ -484,18 +484,29 @@ bio_map(struct bio *bio, void *bio_ptr, unsigned int bio_size)
        return (bio_size);
 }
 
+static inline void
+vdev_submit_bio_impl(int rw, struct bio *bio)
+{
+#ifdef HAVE_1ARG_SUBMIT_BIO
+       bio->bi_rw |= rw;
+       submit_bio(bio);
+#else
+       submit_bio(rw, bio);
+#endif
+}
+
 static inline void
 vdev_submit_bio(int rw, struct bio *bio)
 {
 #ifdef HAVE_CURRENT_BIO_TAIL
        struct bio **bio_tail = current->bio_tail;
        current->bio_tail = NULL;
-       submit_bio(rw, bio);
+       vdev_submit_bio_impl(rw, bio);
        current->bio_tail = bio_tail;
 #else
        struct bio_list *bio_list = current->bio_list;
        current->bio_list = NULL;
-       submit_bio(rw, bio);
+       vdev_submit_bio_impl(rw, bio);
        current->bio_list = bio_list;
 #endif
 }