diff options
-rw-r--r-- | config/kernel-bio-bvec-iter.m4 | 20 | ||||
-rw-r--r-- | config/kernel.m4 | 1 | ||||
-rw-r--r-- | include/linux/blkdev_compat.h | 10 | ||||
-rw-r--r-- | module/zfs/vdev_disk.c | 10 |
4 files changed, 36 insertions, 5 deletions
diff --git a/config/kernel-bio-bvec-iter.m4 b/config/kernel-bio-bvec-iter.m4 new file mode 100644 index 000000000..64c989386 --- /dev/null +++ b/config/kernel-bio-bvec-iter.m4 @@ -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) + ]) +]) + diff --git a/config/kernel.m4 b/config/kernel.m4 index 62a9b4299..2557033ad 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -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 diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h index e45601bc8..be22ae700 100644 --- a/include/linux/blkdev_compat.h +++ b/include/linux/blkdev_compat.h @@ -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. diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c index 5bd38e983..cb0cdd7bb 100644 --- a/module/zfs/vdev_disk.c +++ b/module/zfs/vdev_disk.c @@ -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 */ |