]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Linux 3.14 compat: Immutable biovec changes in vdev_disk.c
authorChunwei Chen <tuxoko@gmail.com>
Fri, 28 Mar 2014 07:08:21 +0000 (15:08 +0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 10 Apr 2014 21:28:38 +0000 (14:28 -0700)
bi_sector, bi_size and bi_idx are moved from bio to bio->bi_iter.
This patch creates BIO_BI_*(bio) macros to hide the differences.

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #2124

config/kernel-bio-bvec-iter.m4 [new file with mode: 0644]
config/kernel.m4
include/linux/blkdev_compat.h
module/zfs/vdev_disk.c

diff --git a/config/kernel-bio-bvec-iter.m4 b/config/kernel-bio-bvec-iter.m4
new file mode 100644 (file)
index 0000000..64c9893
--- /dev/null
@@ -0,0 +1,20 @@
+dnl #
+dnl # 3.14 API change,
+dnl # Immutable biovecs. A number of fields of struct bio are moved to
+dnl # struct bvec_iter.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_BIO_BVEC_ITER], [
+       AC_MSG_CHECKING([whether bio has bi_iter])
+       ZFS_LINUX_TRY_COMPILE([
+               #include <linux/bio.h>
+       ],[
+               struct bio bio;
+               bio.bi_iter.bi_sector = 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BIO_BVEC_ITER, 1, [bio has bi_iter])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+])
+
index 62a9b4299ef41d1d2c24171a27eddd919f9fbc6a..2557033adc086b7e56763bed28ba473cf1fbf6e3 100644 (file)
@@ -17,6 +17,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
        ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS
        ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE
        ZFS_AC_KERNEL_BDEV_PHYSICAL_BLOCK_SIZE
+       ZFS_AC_KERNEL_BIO_BVEC_ITER
        ZFS_AC_KERNEL_BIO_FAILFAST
        ZFS_AC_KERNEL_BIO_FAILFAST_DTD
        ZFS_AC_KERNEL_REQ_FAILFAST_MASK
index e45601bc8280410407e3be578cfaad74227bf6b6..be22ae700f0ce19ba0ee256423700c32fe6e53b8 100644 (file)
@@ -286,6 +286,16 @@ struct req_iterator {
                bio_for_each_segment(bvl, _iter.bio, _iter.i)
 #endif /* HAVE_RQ_FOR_EACH_SEGMENT */
 
+#ifdef HAVE_BIO_BVEC_ITER
+#define        BIO_BI_SECTOR(bio)      (bio)->bi_iter.bi_sector
+#define        BIO_BI_SIZE(bio)        (bio)->bi_iter.bi_size
+#define        BIO_BI_IDX(bio)         (bio)->bi_iter.bi_idx
+#else
+#define        BIO_BI_SECTOR(bio)      (bio)->bi_sector
+#define        BIO_BI_SIZE(bio)        (bio)->bi_size
+#define        BIO_BI_IDX(bio)         (bio)->bi_idx
+#endif
+
 /*
  * Portable helper for correctly setting the FAILFAST flags.  The
  * correct usage has changed 3 times from 2.6.12 to 2.6.38.
index 5bd38e9832e2016005c425c360d5975c722905a6..cb0cdd7bb56619fcfe51833d1d15a21e7f9d620d 100644 (file)
@@ -432,11 +432,11 @@ BIO_END_IO_PROTO(vdev_disk_physio_completion, bio, size, error)
                    "bi_next: %p, bi_flags: %lx, bi_rw: %lu, bi_vcnt: %d\n"
                    "bi_idx: %d, bi_size: %d, bi_end_io: %p, bi_cnt: %d\n",
                    bio->bi_next, bio->bi_flags, bio->bi_rw, bio->bi_vcnt,
-                   bio->bi_idx, bio->bi_size, bio->bi_end_io,
+                   BIO_BI_IDX(bio), BIO_BI_SIZE(bio), bio->bi_end_io,
                    atomic_read(&bio->bi_cnt));
 
 #ifndef HAVE_2ARGS_BIO_END_IO_T
-       if (bio->bi_size)
+       if (BIO_BI_SIZE(bio))
                return (1);
 #endif /* HAVE_2ARGS_BIO_END_IO_T */
 
@@ -556,7 +556,7 @@ retry:
                vdev_disk_dio_get(dr);
 
                dr->dr_bio[i]->bi_bdev = bdev;
-               dr->dr_bio[i]->bi_sector = bio_offset >> 9;
+               BIO_BI_SECTOR(dr->dr_bio[i]) = bio_offset >> 9;
                dr->dr_bio[i]->bi_rw = dr->dr_rw;
                dr->dr_bio[i]->bi_end_io = vdev_disk_physio_completion;
                dr->dr_bio[i]->bi_private = dr;
@@ -565,8 +565,8 @@ retry:
                bio_size = bio_map(dr->dr_bio[i], bio_ptr, bio_size);
 
                /* Advance in buffer and construct another bio if needed */
-               bio_ptr    += dr->dr_bio[i]->bi_size;
-               bio_offset += dr->dr_bio[i]->bi_size;
+               bio_ptr    += BIO_BI_SIZE(dr->dr_bio[i]);
+               bio_offset += BIO_BI_SIZE(dr->dr_bio[i]);
        }
 
        /* Extra reference to protect dio_request during submit_bio */