mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
Linux 3.14 compat: Immutable biovec changes in vdev_disk.c
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
This commit is contained in:
parent
408ec0d2e1
commit
d4541210f3
20
config/kernel-bio-bvec-iter.m4
Normal file
20
config/kernel-bio-bvec-iter.m4
Normal file
@ -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)
|
||||
])
|
||||
])
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user