From 9cabcac1155308d72e09231ec59b082468534d16 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 29 Jul 2009 17:14:23 -0700 Subject: [PATCH] Required autoconf support for vdev_disk integration with 2.6.30 kernels. 2.6.22 API change Unused destroy_dirty_buffers arg removed from prototype. 2.6.24 API change Empty write barriers are now supported and we should use them. 2.6.24 API change Size argument dropped from bio_endio and bi_end_io, because the bi_end_io is only called once now when the request is complete. There is no longer any need for a size argument. This also means that partial IO's are no longer possibe and the end_io callback should not check bi->bi_size. Finally, the return type was updated to void. 2.6.28 API change open/close_bdev_excl() renamed to open/close_bdev_exclusive(). 2.6.29 API change BIO_RW_SYNC renamed to BIO_RW_SYNCIO. --- config/kernel-bio-args.m4 | 24 ---------------------- config/kernel-bio-empty-barrier.m4 | 20 ++++++++++++++++++ config/kernel-bio-end-io-t-args.m4 | 29 +++++++++++++++++++++++++++ config/kernel-bio-rw-syncio.m4 | 18 +++++++++++++++++ config/kernel-invalidate-bdev-args.m4 | 19 ++++++++++++++++++ config/kernel-open-bdev-exclusive.m4 | 12 +++++++++++ config/kernel.m4 | 6 +++++- 7 files changed, 103 insertions(+), 25 deletions(-) delete mode 100644 config/kernel-bio-args.m4 create mode 100644 config/kernel-bio-empty-barrier.m4 create mode 100644 config/kernel-bio-end-io-t-args.m4 create mode 100644 config/kernel-bio-rw-syncio.m4 create mode 100644 config/kernel-invalidate-bdev-args.m4 create mode 100644 config/kernel-open-bdev-exclusive.m4 diff --git a/config/kernel-bio-args.m4 b/config/kernel-bio-args.m4 deleted file mode 100644 index 0e652dbc40..0000000000 --- a/config/kernel-bio-args.m4 +++ /dev/null @@ -1,24 +0,0 @@ -dnl # -dnl # 2.6.x API change -dnl # bio_end_io_t uses 2 args (size was dropped from prototype) -dnl # -AC_DEFUN([ZFS_AC_CONFIG_KERNEL_BIO_ARGS], - [AC_MSG_CHECKING([whether bio_end_io_t wants 2 args]) - tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Werror" - ZFS_LINUX_TRY_COMPILE([ - #include - ],[ - void (*wanted_end_io)(struct bio *, int) = NULL; - bio_end_io_t *local_end_io; - - local_end_io = wanted_end_io; - ],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_2ARGS_BIO_END_IO_T, 1, - [bio_end_io_t wants 2 args]) - ],[ - AC_MSG_RESULT(no) - ]) - EXTRA_KCFLAGS="$tmp_flags" -]) diff --git a/config/kernel-bio-empty-barrier.m4 b/config/kernel-bio-empty-barrier.m4 new file mode 100644 index 0000000000..99549fe24a --- /dev/null +++ b/config/kernel-bio-empty-barrier.m4 @@ -0,0 +1,20 @@ +dnl # +dnl # 2.6.24 API change +dnl # Empty write barriers are now supported and we should use them. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_BIO_EMPTY_BARRIER], [ + AC_MSG_CHECKING([whether bio_empty_barrier() is defined]) + EXTRA_KCFLAGS="-Werror" + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + struct bio bio; + (void)bio_empty_barrier(&bio); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BIO_EMPTY_BARRIER, 1, + [bio_empy_barrier() is defined]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel-bio-end-io-t-args.m4 b/config/kernel-bio-end-io-t-args.m4 new file mode 100644 index 0000000000..ea69bdba56 --- /dev/null +++ b/config/kernel-bio-end-io-t-args.m4 @@ -0,0 +1,29 @@ +dnl # +dnl # 2.6.24 API change +dnl # Size argument dropped from bio_endio and bi_end_io, because the +dnl # bi_end_io is only called once now when the request is complete. +dnl # There is no longer any need for a size argument. This also means +dnl # that partial IO's are no longer possibe and the end_io callback +dnl # should not check bi->bi_size. Finally, the return type was updated +dnl # to void. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_BIO_END_IO_T_ARGS], [ + AC_MSG_CHECKING([whether bio_end_io_t wants 2 args]) + tmp_flags="$EXTRA_KCFLAGS" + EXTRA_KCFLAGS="-Werror" + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + void (*wanted_end_io)(struct bio *, int) = NULL; + bio_end_io_t *local_end_io; + + local_end_io = wanted_end_io; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_2ARGS_BIO_END_IO_T, 1, + [bio_end_io_t wants 2 args]) + ],[ + AC_MSG_RESULT(no) + ]) + EXTRA_KCFLAGS="$tmp_flags" +]) diff --git a/config/kernel-bio-rw-syncio.m4 b/config/kernel-bio-rw-syncio.m4 new file mode 100644 index 0000000000..93a32e659f --- /dev/null +++ b/config/kernel-bio-rw-syncio.m4 @@ -0,0 +1,18 @@ +dnl # +dnl # 2.6.29 API change +dnl # BIO_RW_SYNC renamed to BIO_RW_SYNCIO +dnl # +AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_SYNCIO], [ + AC_MSG_CHECKING([whether BIO_RW_SYNCIO is defined]) + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + int flags = BIO_RW_SYNCIO; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BIO_RW_SYNCIO, 1, + [BIO_RW_SYNCIO is defined]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel-invalidate-bdev-args.m4 b/config/kernel-invalidate-bdev-args.m4 new file mode 100644 index 0000000000..c768f6275f --- /dev/null +++ b/config/kernel-invalidate-bdev-args.m4 @@ -0,0 +1,19 @@ +dnl # +dnl # 2.6.22 API change +dnl # Unused destroy_dirty_buffers arg removed from prototype. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS], [ + AC_MSG_CHECKING([whether invalidate_bdev() wants 1 arg]) + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + struct block_device *bdev; + invalidate_bdev(bdev); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_1ARG_INVALIDATE_BDEV, 1, + [invalidate_bdev() wants 1 arg]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel-open-bdev-exclusive.m4 b/config/kernel-open-bdev-exclusive.m4 new file mode 100644 index 0000000000..734b2134cc --- /dev/null +++ b/config/kernel-open-bdev-exclusive.m4 @@ -0,0 +1,12 @@ +dnl # +dnl # 2.6.28 API change +dnl # open/close_bdev_excl() renamed to open/close_bdev_exclusive() +dnl # +AC_DEFUN([ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE], [ + ZFS_CHECK_SYMBOL_EXPORT( + [open_bdev_exclusive], + [fs/block_dev.c], + [AC_DEFINE(HAVE_OPEN_BDEV_EXCLUSIVE, 1, + [open_bdev_exclusive() is available])], + []) +]) diff --git a/config/kernel.m4 b/config/kernel.m4 index d79ccc4d6d..521e69f27b 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -4,7 +4,11 @@ dnl # AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ ZFS_AC_KERNEL ZFS_AC_SPL - ZFS_AC_CONFIG_KERNEL_BIO_ARGS + ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE + ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS + ZFS_AC_KERNEL_BIO_END_IO_T_ARGS + ZFS_AC_KERNEL_BIO_RW_SYNCIO + ZFS_AC_KERNEL_BIO_EMPTY_BARRIER dnl # Kernel build make options dnl # KERNELMAKE_PARAMS="V=1" # Enable verbose module build