diff options
102 files changed, 1136 insertions, 2965 deletions
@@ -7,4 +7,4 @@ Release-Tags: relext License: CDDL Author: OpenZFS on Linux Linux-Maximum: 5.1 -Linux-Minimum: 2.6.32 +Linux-Minimum: 3.10 diff --git a/config/kernel-acl.m4 b/config/kernel-acl.m4 index 68a72872d..0f1c24656 100644 --- a/config/kernel-acl.m4 +++ b/config/kernel-acl.m4 @@ -66,11 +66,10 @@ AC_DEFUN([ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE], [ dnl # dnl # 3.1 API change, -dnl # posix_acl_chmod_masq() is not exported anymore and posix_acl_chmod() -dnl # was introduced to replace it. +dnl # posix_acl_chmod() was added as the preferred interface. dnl # dnl # 3.14 API change, -dnl # posix_acl_chmod() is changed to __posix_acl_chmod() +dnl # posix_acl_chmod() was changed to __posix_acl_chmod() dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD], [ ZFS_LINUX_TEST_SRC([posix_acl_chmod], [ @@ -89,14 +88,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD], [ ]) AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [ - AC_MSG_CHECKING([whether posix_acl_chmod exists]) - ZFS_LINUX_TEST_RESULT([posix_acl_chmod], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_POSIX_ACL_CHMOD, 1, [posix_acl_chmod() exists]) - ],[ - AC_MSG_RESULT(no) - ]) - AC_MSG_CHECKING([whether __posix_acl_chmod exists]) ZFS_LINUX_TEST_RESULT([__posix_acl_chmod], [ AC_MSG_RESULT(yes) @@ -104,12 +95,21 @@ AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [ [__posix_acl_chmod() exists]) ],[ AC_MSG_RESULT(no) + + AC_MSG_CHECKING([whether posix_acl_chmod exists]) + ZFS_LINUX_TEST_RESULT([posix_acl_chmod], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_POSIX_ACL_CHMOD, 1, + [posix_acl_chmod() exists]) + ],[ + ZFS_LINUX_TEST_ERROR([posix_acl_chmod()]) + ]) ]) ]) dnl # dnl # 3.1 API change, -dnl # posix_acl_equiv_mode now wants an umode_t* instead of a mode_t* +dnl # posix_acl_equiv_mode now wants an umode_t instead of a mode_t dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [ ZFS_LINUX_TEST_SRC([posix_acl_equiv_mode], [ @@ -117,7 +117,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [ #include <linux/posix_acl.h> ],[ umode_t tmp; - posix_acl_equiv_mode(NULL,&tmp); + posix_acl_equiv_mode(NULL, &tmp); ]) ]) @@ -125,10 +125,8 @@ AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [ AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t]) ZFS_LINUX_TEST_RESULT([posix_acl_equiv_mode], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_POSIX_ACL_EQUIV_MODE_UMODE_T, 1, - [posix_acl_equiv_mode wants umode_t*]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([posix_acl_equiv_mode()]) ]) ]) @@ -161,123 +159,6 @@ AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS], [ ]) dnl # -dnl # 2.6.27 API change, -dnl # Check if inode_operations contains the function permission -dnl # and expects the nameidata structure to have been removed. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_PERMISSION], [ - ZFS_LINUX_TEST_SRC([inode_operations_permission], [ - #include <linux/fs.h> - - int permission_fn(struct inode *inode, int mask) { return 0; } - - static const struct inode_operations - iops __attribute__ ((unused)) = { - .permission = permission_fn, - }; - ],[]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION], [ - AC_MSG_CHECKING([whether iops->permission() exists]) - ZFS_LINUX_TEST_RESULT([inode_operations_permission], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -dnl # -dnl # 2.6.26 API change, -dnl # Check if inode_operations contains the function permission -dnl # and expects the nameidata structure to be passed. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [ - ZFS_LINUX_TEST_SRC([inode_operations_permission_with_nameidata], [ - #include <linux/fs.h> - #include <linux/sched.h> - - int permission_fn(struct inode *inode, int mask, - struct nameidata *nd) { return 0; } - - static const struct inode_operations - iops __attribute__ ((unused)) = { - .permission = permission_fn, - }; - ],[]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [ - AC_MSG_CHECKING([whether iops->permission() wants nameidata]) - ZFS_LINUX_TEST_RESULT([inode_operations_permission_with_nameidata], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists]) - AC_DEFINE(HAVE_PERMISSION_WITH_NAMEIDATA, 1, - [iops->permission() with nameidata exists]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -dnl # -dnl # 2.6.32 API change, -dnl # Check if inode_operations contains the function check_acl -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_CHECK_ACL], [ - ZFS_LINUX_TEST_SRC([inode_operations_check_acl], [ - #include <linux/fs.h> - - int check_acl_fn(struct inode *inode, int mask) { return 0; } - - static const struct inode_operations - iops __attribute__ ((unused)) = { - .check_acl = check_acl_fn, - }; - ],[]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL], [ - AC_MSG_CHECKING([whether iops->check_acl() exists]) - ZFS_LINUX_TEST_RESULT([inode_operations_check_acl], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -dnl # -dnl # 2.6.38 API change, -dnl # The function check_acl gained a new parameter: flags -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS], [ - ZFS_LINUX_TEST_SRC([inode_operations_check_acl_with_flags], [ - #include <linux/fs.h> - - int check_acl_fn(struct inode *inode, int mask, - unsigned int flags) { return 0; } - - static const struct inode_operations - iops __attribute__ ((unused)) = { - .check_acl = check_acl_fn, - }; - ],[]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS], [ - AC_MSG_CHECKING([whether iops->check_acl() wants flags]) - ZFS_LINUX_TEST_RESULT([inode_operations_check_acl_with_flags], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists]) - AC_DEFINE(HAVE_CHECK_ACL_WITH_FLAGS, 1, - [iops->check_acl() wants flags]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -dnl # dnl # 3.1 API change, dnl # Check if inode_operations contains the function get_acl dnl # @@ -299,9 +180,8 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [ AC_MSG_CHECKING([whether iops->get_acl() exists]) ZFS_LINUX_TEST_RESULT([inode_operations_get_acl], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([iops->get_acl()]) ]) ]) @@ -390,10 +270,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL], [ ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T ZFS_AC_KERNEL_SRC_POSIX_ACL_VALID_WITH_NS - ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_PERMISSION - ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA - ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_CHECK_ACL - ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL ZFS_AC_KERNEL_SRC_GET_ACL_HANDLE_CACHE @@ -406,10 +282,6 @@ AC_DEFUN([ZFS_AC_KERNEL_ACL], [ ZFS_AC_KERNEL_POSIX_ACL_CHMOD ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS - ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION - ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA - ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL - ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE diff --git a/config/kernel-automount.m4 b/config/kernel-automount.m4 index 93e14fa8d..f7bb63c68 100644 --- a/config/kernel-automount.m4 +++ b/config/kernel-automount.m4 @@ -12,15 +12,14 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_AUTOMOUNT], [ struct dentry_operations dops __attribute__ ((unused)) = { .d_automount = d_automount, }; - ],[]) + ]) ]) AC_DEFUN([ZFS_AC_KERNEL_AUTOMOUNT], [ AC_MSG_CHECKING([whether dops->d_automount() exists]) ZFS_LINUX_TEST_RESULT([dentry_operations_d_automount], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_AUTOMOUNT, 1, [dops->automount() exists]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([dops->d_automount()]) ]) ]) diff --git a/config/kernel-bdev-logical-size.m4 b/config/kernel-bdev-logical-size.m4 deleted file mode 100644 index 0de9afd88..000000000 --- a/config/kernel-bdev-logical-size.m4 +++ /dev/null @@ -1,26 +0,0 @@ -dnl # -dnl # 2.6.30 API change -dnl # bdev_hardsect_size() replaced with bdev_logical_block_size(). While -dnl # it has been true for a while that there was no strict 1:1 mapping -dnl # between physical sector size and logical block size this change makes -dnl # it explicit. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BDEV_LOGICAL_BLOCK_SIZE], [ - ZFS_LINUX_TEST_SRC([bdev_logical_block_size], [ - #include <linux/blkdev.h> - ],[ - struct block_device *bdev = NULL; - bdev_logical_block_size(bdev); - ], [$NO_UNUSED_BUT_SET_VARIABLE]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE], [ - AC_MSG_CHECKING([whether bdev_logical_block_size() is available]) - ZFS_LINUX_TEST_RESULT([bdev_logical_block_size], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BDEV_LOGICAL_BLOCK_SIZE, 1, - [bdev_logical_block_size() is available]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-bdev-physical-size.m4 b/config/kernel-bdev-physical-size.m4 deleted file mode 100644 index 94d8172d3..000000000 --- a/config/kernel-bdev-physical-size.m4 +++ /dev/null @@ -1,40 +0,0 @@ -dnl # -dnl # 2.6.30 API change -dnl # -dnl # The bdev_physical_block_size() interface was added to provide a way -dnl # to determine the smallest write which can be performed without a -dnl # read-modify-write operation. From the kernel documentation: -dnl # -dnl # What: /sys/block/<disk>/queue/physical_block_size -dnl # Date: May 2009 -dnl # Contact: Martin K. Petersen <[email protected]> -dnl # Description: -dnl # This is the smallest unit the storage device can write -dnl # without resorting to read-modify-write operation. It is -dnl # usually the same as the logical block size but may be -dnl # bigger. One example is SATA drives with 4KB sectors -dnl # that expose a 512-byte logical block size to the -dnl # operating system. -dnl # -dnl # Unfortunately, this interface isn't entirely reliable because -dnl # drives are sometimes known to misreport this value. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BDEV_PHYSICAL_BLOCK_SIZE], [ - ZFS_LINUX_TEST_SRC([bdev_physical_block_size], [ - #include <linux/blkdev.h> - ],[ - struct block_device *bdev = NULL; - bdev_physical_block_size(bdev); - ], [$NO_UNUSED_BUT_SET_VARIABLE]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BDEV_PHYSICAL_BLOCK_SIZE], [ - AC_MSG_CHECKING([whether bdev_physical_block_size() is available]) - ZFS_LINUX_TEST_RESULT([bdev_physical_block_size], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BDEV_PHYSICAL_BLOCK_SIZE, 1, - [bdev_physical_block_size() is available]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-bdi.m4 b/config/kernel-bdi.m4 index 51516332a..9351df71b 100644 --- a/config/kernel-bdi.m4 +++ b/config/kernel-bdi.m4 @@ -72,11 +72,7 @@ AC_DEFUN([ZFS_AC_KERNEL_BDI], [ AC_DEFINE(HAVE_3ARGS_BDI_SETUP_AND_REGISTER, 1, [bdi_setup_and_register() wants 3 args]) ], [ - dnl # - dnl # 2.6.32 - 2.6.33, bdi_setup_and_register() - dnl # is not exported. - dnl # - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([bdi_setup]) ]) ]) ]) diff --git a/config/kernel-bio-bvec-iter.m4 b/config/kernel-bio-bvec-iter.m4 deleted file mode 100644 index f9a99cee6..000000000 --- a/config/kernel-bio-bvec-iter.m4 +++ /dev/null @@ -1,23 +0,0 @@ -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_SRC_BIO_BVEC_ITER], [ - ZFS_LINUX_TEST_SRC([bio_bvec_iter], [ - #include <linux/bio.h> - ],[ - struct bio bio; - bio.bi_iter.bi_sector = 0; - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BIO_BVEC_ITER], [ - AC_MSG_CHECKING([whether bio has bi_iter]) - ZFS_LINUX_TEST_RESULT([bio_bvec_iter], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BIO_BVEC_ITER, 1, [bio has bi_iter]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-bio-end-io-t-args.m4 b/config/kernel-bio-end-io-t-args.m4 deleted file mode 100644 index 80a1fbeda..000000000 --- a/config/kernel-bio-end-io-t-args.m4 +++ /dev/null @@ -1,50 +0,0 @@ -dnl # -dnl # 4.3 API change -dnl # Error argument dropped from bio_endio in favor of newly introduced -dnl # bio->bi_error. This also replaces bio->bi_flags value BIO_UPTODATE. -dnl # Introduced by torvalds/linux@4246a0b63bd8f56a1469b12eafeb875b1041a451 -dnl # ("block: add a bi_error field to struct bio"). -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_END_IO_T_ARGS], [ - ZFS_LINUX_TEST_SRC([bio_end_io_t_args], [ - #include <linux/bio.h> - void wanted_end_io(struct bio *bio) { return; } - bio_end_io_t *end_io __attribute__ ((unused)) = wanted_end_io; - ], []) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BIO_END_IO_T_ARGS], [ - AC_MSG_CHECKING([whether bio_end_io_t wants 1 arg]) - ZFS_LINUX_TEST_RESULT([bio_end_io_t_args], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_1ARG_BIO_END_IO_T, 1, - [bio_end_io_t wants 1 arg]) - ], [ - AC_MSG_RESULT(no) - ]) -]) - -dnl # -dnl # 4.13 API change -dnl # The bio->bi_error field was replaced with bio->bi_status which is an -dnl # enum which describes all possible error types. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_BI_STATUS], [ - ZFS_LINUX_TEST_SRC([bio_bi_status], [ - #include <linux/bio.h> - ], [ - struct bio bio __attribute__ ((unused)); - blk_status_t status __attribute__ ((unused)) = BLK_STS_OK; - bio.bi_status = status; - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_STATUS], [ - AC_MSG_CHECKING([whether bio->bi_status exists]) - ZFS_LINUX_TEST_RESULT([bio_bi_status], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BIO_BI_STATUS, 1, [bio->bi_status exists]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-bio-failfast.m4 b/config/kernel-bio-failfast.m4 deleted file mode 100644 index 0c636f08c..000000000 --- a/config/kernel-bio-failfast.m4 +++ /dev/null @@ -1,56 +0,0 @@ -dnl # -dnl # Preferred interface for setting FAILFAST on a bio: -dnl # 2.6.28-2.6.35: BIO_RW_FAILFAST_{DEV|TRANSPORT|DRIVER} -dnl # >= 2.6.36: REQ_FAILFAST_{DEV|TRANSPORT|DRIVER} -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_FAILFAST_DTD], [ - ZFS_LINUX_TEST_SRC([bio_failfast_dtd], [ - #include <linux/bio.h> - ],[ - int flags __attribute__ ((unused)); - flags = ((1 << BIO_RW_FAILFAST_DEV) | - (1 << BIO_RW_FAILFAST_TRANSPORT) | - (1 << BIO_RW_FAILFAST_DRIVER)); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BIO_FAILFAST_DTD], [ - AC_MSG_CHECKING([whether BIO_RW_FAILFAST_* are defined]) - ZFS_LINUX_TEST_RESULT([bio_failfast_dtd], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BIO_RW_FAILFAST_DTD, 1, - [BIO_RW_FAILFAST_* are defined]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_SRC_REQ_FAILFAST_MASK], [ - ZFS_LINUX_TEST_SRC([bio_failfast_mask], [ - #include <linux/bio.h> - ],[ - int flags __attribute__ ((unused)); - flags = REQ_FAILFAST_MASK; - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_REQ_FAILFAST_MASK], [ - AC_MSG_CHECKING([whether REQ_FAILFAST_MASK is defined]) - ZFS_LINUX_TEST_RESULT([bio_failfast_mask], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_REQ_FAILFAST_MASK, 1, - [REQ_FAILFAST_MASK is defined]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_FAILFAST], [ - ZFS_AC_KERNEL_SRC_BIO_FAILFAST_DTD - ZFS_AC_KERNEL_SRC_REQ_FAILFAST_MASK -]) - -AC_DEFUN([ZFS_AC_KERNEL_BIO_FAILFAST], [ - ZFS_AC_KERNEL_BIO_FAILFAST_DTD - ZFS_AC_KERNEL_REQ_FAILFAST_MASK -]) diff --git a/config/kernel-bio-op.m4 b/config/kernel-bio-op.m4 deleted file mode 100644 index 1f2d23791..000000000 --- a/config/kernel-bio-op.m4 +++ /dev/null @@ -1,102 +0,0 @@ -dnl # -dnl # Linux 4.8 API, -dnl # -dnl # The bio_op() helper was introduced as a replacement for explicitly -dnl # checking the bio->bi_rw flags. The following checks are used to -dnl # detect if a specific operation is supported. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_OPS], [ - ZFS_LINUX_TEST_SRC([req_op_discard], [ - #include <linux/blk_types.h> - ],[ - int op __attribute__ ((unused)) = REQ_OP_DISCARD; - ]) - - ZFS_LINUX_TEST_SRC([req_op_secure_erase], [ - #include <linux/blk_types.h> - ],[ - int op __attribute__ ((unused)) = REQ_OP_SECURE_ERASE; - ]) - - ZFS_LINUX_TEST_SRC([req_op_flush], [ - #include <linux/blk_types.h> - ],[ - int op __attribute__ ((unused)) = REQ_OP_FLUSH; - ]) - - ZFS_LINUX_TEST_SRC([bio_bi_opf], [ - #include <linux/bio.h> - ],[ - struct bio bio __attribute__ ((unused)); - bio.bi_opf = 0; - ]) - - ZFS_LINUX_TEST_SRC([bio_set_op_attrs], [ - #include <linux/bio.h> - ],[ - struct bio *bio __attribute__ ((unused)) = NULL; - bio_set_op_attrs(bio, 0, 0); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_DISCARD], [ - AC_MSG_CHECKING([whether REQ_OP_DISCARD is defined]) - ZFS_LINUX_TEST_RESULT([req_op_discard], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_REQ_OP_DISCARD, 1, - [REQ_OP_DISCARD is defined]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_SECURE_ERASE], [ - AC_MSG_CHECKING([whether REQ_OP_SECURE_ERASE is defined]) - ZFS_LINUX_TEST_RESULT([req_op_secure_erase], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_REQ_OP_SECURE_ERASE, 1, - [REQ_OP_SECURE_ERASE is defined]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - - -AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_FLUSH], [ - AC_MSG_CHECKING([whether REQ_OP_FLUSH is defined]) - ZFS_LINUX_TEST_RESULT([req_op_flush], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_REQ_OP_FLUSH, 1, [REQ_OP_FLUSH is defined]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_OPF], [ - AC_MSG_CHECKING([whether bio->bi_opf is defined]) - ZFS_LINUX_TEST_RESULT([bio_bi_opf], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BIO_BI_OPF, 1, [bio->bi_opf is defined]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_HAVE_BIO_SET_OP_ATTRS], [ - AC_MSG_CHECKING([whether bio_set_op_attrs is available]) - ZFS_LINUX_TEST_RESULT([bio_set_op_attrs], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BIO_SET_OP_ATTRS, 1, - [bio_set_op_attrs is available]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BIO_OPS], [ - ZFS_AC_KERNEL_REQ_OP_DISCARD - ZFS_AC_KERNEL_REQ_OP_SECURE_ERASE - ZFS_AC_KERNEL_REQ_OP_FLUSH - ZFS_AC_KERNEL_BIO_BI_OPF - ZFS_AC_KERNEL_HAVE_BIO_SET_OP_ATTRS -]) diff --git a/config/kernel-bio-rw-barrier.m4 b/config/kernel-bio-rw-barrier.m4 deleted file mode 100644 index f667d4884..000000000 --- a/config/kernel-bio-rw-barrier.m4 +++ /dev/null @@ -1,30 +0,0 @@ -dnl # -dnl # Interface for issuing a discard bio: -dnl # 2.6.28-2.6.35: BIO_RW_BARRIER -dnl # 2.6.36-3.x: REQ_BARRIER -dnl # -dnl # -dnl # Since REQ_BARRIER is a preprocessor definition, there is no need for an -dnl # autotools check for it. Also, REQ_BARRIER existed in the request layer -dnl # until torvalds/linux@7b6d91daee5cac6402186ff224c3af39d79f4a0e unified the -dnl # request layer and bio layer flags, so it would be wrong to assume that -dnl # the APIs are mutually exclusive contrary to the typical case. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_RW_BARRIER], [ - ZFS_LINUX_TEST_SRC([bio_rw_barrier], [ - #include <linux/bio.h> - ],[ - int flags __attribute__ ((unused)); - flags = BIO_RW_BARRIER; - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_BARRIER], [ - AC_MSG_CHECKING([whether BIO_RW_BARRIER is defined]) - ZFS_LINUX_TEST_RESULT([bio_rw_barrier], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BIO_RW_BARRIER, 1, [BIO_RW_BARRIER is defined]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-bio-rw-discard.m4 b/config/kernel-bio-rw-discard.m4 deleted file mode 100644 index 34a89279c..000000000 --- a/config/kernel-bio-rw-discard.m4 +++ /dev/null @@ -1,30 +0,0 @@ -dnl # -dnl # Interface for issuing a discard bio: -dnl # 2.6.28-2.6.35: BIO_RW_DISCARD -dnl # 2.6.36-3.x: REQ_DISCARD -dnl # -dnl # -dnl # Since REQ_DISCARD is a preprocessor definition, there is no need for an -dnl # autotools check for it. Also, REQ_DISCARD existed in the request layer -dnl # until torvalds/linux@7b6d91daee5cac6402186ff224c3af39d79f4a0e unified the -dnl # request layer and bio layer flags, so it would be wrong to assume that -dnl # the APIs are mutually exclusive contrary to the typical case. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_RW_DISCARD], [ - ZFS_LINUX_TEST_SRC([bio_rw_discard], [ - #include <linux/bio.h> - ],[ - int flags __attribute__ ((unused)); - flags = BIO_RW_DISCARD; - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_DISCARD], [ - AC_MSG_CHECKING([whether BIO_RW_DISCARD is defined]) - ZFS_LINUX_TEST_RESULT([bio_rw_discard], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BIO_RW_DISCARD, 1, [BIO_RW_DISCARD is defined]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-bio.m4 b/config/kernel-bio.m4 new file mode 100644 index 000000000..75a4a6de4 --- /dev/null +++ b/config/kernel-bio.m4 @@ -0,0 +1,363 @@ +dnl # +dnl # 2.6.36 API change, +dnl # REQ_FAILFAST_{DEV|TRANSPORT|DRIVER} +dnl # REQ_DISCARD +dnl # REQ_FLUSH +dnl # +dnl # 4.8 - 4.9 API, +dnl # REQ_FLUSH was renamed to REQ_PREFLUSH +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_REQ], [ + ZFS_LINUX_TEST_SRC([req_failfast_mask], [ + #include <linux/bio.h> + ],[ + int flags __attribute__ ((unused)); + flags = REQ_FAILFAST_MASK; + ]) + + ZFS_LINUX_TEST_SRC([req_discard], [ + #include <linux/bio.h> + ],[ + int flags __attribute__ ((unused)); + flags = REQ_DISCARD; + ]) + + ZFS_LINUX_TEST_SRC([req_flush], [ + #include <linux/bio.h> + ],[ + int flags __attribute__ ((unused)); + flags = REQ_FLUSH; + ]) + + ZFS_LINUX_TEST_SRC([req_preflush], [ + #include <linux/bio.h> + ],[ + int flags __attribute__ ((unused)); + flags = REQ_PREFLUSH; + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_FAILFAST_MASK], [ + AC_MSG_CHECKING([whether REQ_FAILFAST_MASK is defined]) + ZFS_LINUX_TEST_RESULT([req_failfast_mask], [ + AC_MSG_RESULT(yes) + ],[ + ZFS_LINUX_TEST_ERROR([REQ_FAILFAST_MASK]) + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_DISCARD], [ + AC_MSG_CHECKING([whether REQ_DISCARD is defined]) + ZFS_LINUX_TEST_RESULT([req_discard], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_REQ_DISCARD, 1, [REQ_DISCARD is defined]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_FLUSH], [ + AC_MSG_CHECKING([whether REQ_FLUSH is defined]) + ZFS_LINUX_TEST_RESULT([req_flush], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_REQ_FLUSH, 1, [REQ_FLUSH is defined]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_PREFLUSH], [ + AC_MSG_CHECKING([whether REQ_PREFLUSH is defined]) + ZFS_LINUX_TEST_RESULT([req_preflush], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_REQ_PREFLUSH, 1, [REQ_PREFLUSH is defined]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +dnl # +dnl # Linux 4.8 API, +dnl # +dnl # The bio_op() helper was introduced as a replacement for explicitly +dnl # checking the bio->bi_rw flags. The following checks are used to +dnl # detect if a specific operation is supported. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_OPS], [ + ZFS_LINUX_TEST_SRC([req_op_discard], [ + #include <linux/blk_types.h> + ],[ + int op __attribute__ ((unused)) = REQ_OP_DISCARD; + ]) + + ZFS_LINUX_TEST_SRC([req_op_secure_erase], [ + #include <linux/blk_types.h> + ],[ + int op __attribute__ ((unused)) = REQ_OP_SECURE_ERASE; + ]) + + ZFS_LINUX_TEST_SRC([req_op_flush], [ + #include <linux/blk_types.h> + ],[ + int op __attribute__ ((unused)) = REQ_OP_FLUSH; + ]) + + ZFS_LINUX_TEST_SRC([bio_bi_opf], [ + #include <linux/bio.h> + ],[ + struct bio bio __attribute__ ((unused)); + bio.bi_opf = 0; + ]) + + ZFS_LINUX_TEST_SRC([bio_set_op_attrs], [ + #include <linux/bio.h> + ],[ + struct bio *bio __attribute__ ((unused)) = NULL; + bio_set_op_attrs(bio, 0, 0); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_OP_DISCARD], [ + AC_MSG_CHECKING([whether REQ_OP_DISCARD is defined]) + ZFS_LINUX_TEST_RESULT([req_op_discard], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_REQ_OP_DISCARD, 1, [REQ_OP_DISCARD is defined]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_OP_SECURE_ERASE], [ + AC_MSG_CHECKING([whether REQ_OP_SECURE_ERASE is defined]) + ZFS_LINUX_TEST_RESULT([req_op_secure_erase], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_REQ_OP_SECURE_ERASE, 1, + [REQ_OP_SECURE_ERASE is defined]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_REQ_OP_FLUSH], [ + AC_MSG_CHECKING([whether REQ_OP_FLUSH is defined]) + ZFS_LINUX_TEST_RESULT([req_op_flush], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_REQ_OP_FLUSH, 1, [REQ_OP_FLUSH is defined]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_OPF], [ + AC_MSG_CHECKING([whether bio->bi_opf is defined]) + ZFS_LINUX_TEST_RESULT([bio_bi_opf], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BIO_BI_OPF, 1, [bio->bi_opf is defined]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_OP_ATTRS], [ + AC_MSG_CHECKING([whether bio_set_op_attrs is available]) + ZFS_LINUX_TEST_RESULT([bio_set_op_attrs], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BIO_SET_OP_ATTRS, 1, + [bio_set_op_attrs is available]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +dnl # +dnl # Linux 4.14 API, +dnl # +dnl # The bio_set_dev() helper macro was introduced as part of the transition +dnl # to have struct gendisk in struct bio. +dnl # +dnl # Linux 5.0 API, +dnl # +dnl # The bio_set_dev() helper macro was updated to internally depend on +dnl # bio_associate_blkg() symbol which is exported GPL-only. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_SET_DEV], [ + ZFS_LINUX_TEST_SRC([bio_set_dev], [ + #include <linux/bio.h> + #include <linux/fs.h> + ],[ + struct block_device *bdev = NULL; + struct bio *bio = NULL; + bio_set_dev(bio, bdev); + ], [], [$ZFS_META_LICENSE]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV], [ + AC_MSG_CHECKING([whether bio_set_dev() is available]) + ZFS_LINUX_TEST_RESULT([bio_set_dev], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BIO_SET_DEV, 1, [bio_set_dev() is available]) + + AC_MSG_CHECKING([whether bio_set_dev() is GPL-only]) + ZFS_LINUX_TEST_RESULT([bio_set_dev_license], [ + AC_MSG_RESULT(no) + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BIO_SET_DEV_GPL_ONLY, 1, + [bio_set_dev() GPL-only]) + ]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +dnl # +dnl # 4.3 API change +dnl # Error argument dropped from bio_endio in favor of newly introduced +dnl # bio->bi_error. This also replaces bio->bi_flags value BIO_UPTODATE. +dnl # Introduced by torvalds/linux@4246a0b63bd8f56a1469b12eafeb875b1041a451 +dnl # ("block: add a bi_error field to struct bio"). +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_END_IO_T_ARGS], [ + ZFS_LINUX_TEST_SRC([bio_end_io_t_args], [ + #include <linux/bio.h> + void wanted_end_io(struct bio *bio) { return; } + bio_end_io_t *end_io __attribute__ ((unused)) = wanted_end_io; + ], []) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_END_IO_T_ARGS], [ + AC_MSG_CHECKING([whether bio_end_io_t wants 1 arg]) + ZFS_LINUX_TEST_RESULT([bio_end_io_t_args], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_1ARG_BIO_END_IO_T, 1, + [bio_end_io_t wants 1 arg]) + ], [ + AC_MSG_RESULT(no) + ]) +]) + +dnl # +dnl # 4.13 API change +dnl # The bio->bi_error field was replaced with bio->bi_status which is an +dnl # enum which describes all possible error types. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_BI_STATUS], [ + ZFS_LINUX_TEST_SRC([bio_bi_status], [ + #include <linux/bio.h> + ], [ + struct bio bio __attribute__ ((unused)); + blk_status_t status __attribute__ ((unused)) = BLK_STS_OK; + bio.bi_status = status; + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_STATUS], [ + AC_MSG_CHECKING([whether bio->bi_status exists]) + ZFS_LINUX_TEST_RESULT([bio_bi_status], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BIO_BI_STATUS, 1, [bio->bi_status exists]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +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_SRC_BIO_BVEC_ITER], [ + ZFS_LINUX_TEST_SRC([bio_bvec_iter], [ + #include <linux/bio.h> + ],[ + struct bio bio; + bio.bi_iter.bi_sector = 0; + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_BVEC_ITER], [ + AC_MSG_CHECKING([whether bio has bi_iter]) + ZFS_LINUX_TEST_RESULT([bio_bvec_iter], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BIO_BVEC_ITER, 1, [bio has bi_iter]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +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_SRC_BIO_SUBMIT_BIO], [ + ZFS_LINUX_TEST_SRC([submit_bio], [ + #include <linux/bio.h> + ],[ + blk_qc_t blk_qc; + struct bio *bio = NULL; + blk_qc = submit_bio(bio); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_SUBMIT_BIO], [ + AC_MSG_CHECKING([whether submit_bio() wants 1 arg]) + ZFS_LINUX_TEST_RESULT([submit_bio], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_1ARG_SUBMIT_BIO, 1, [submit_bio() wants 1 arg]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +dnl # +dnl # 2.6.34 API change +dnl # current->bio_list +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_CURRENT_BIO_LIST], [ + ZFS_LINUX_TEST_SRC([current_bio_list], [ + #include <linux/sched.h> + ], [ + current->bio_list = (struct bio_list *) NULL; + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_CURRENT_BIO_LIST], [ + AC_MSG_CHECKING([whether current->bio_list exists]) + ZFS_LINUX_TEST_RESULT([current_bio_list], [ + AC_MSG_RESULT(yes) + ],[ + ZFS_LINUX_TEST_ERROR([bio_list]) + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [ + ZFS_AC_KERNEL_SRC_REQ + ZFS_AC_KERNEL_SRC_BIO_OPS + ZFS_AC_KERNEL_SRC_BIO_SET_DEV + ZFS_AC_KERNEL_SRC_BIO_END_IO_T_ARGS + ZFS_AC_KERNEL_SRC_BIO_BI_STATUS + ZFS_AC_KERNEL_SRC_BIO_BVEC_ITER + ZFS_AC_KERNEL_SRC_BIO_SUBMIT_BIO + ZFS_AC_KERNEL_SRC_BIO_CURRENT_BIO_LIST +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO], [ + ZFS_AC_KERNEL_BIO_REQ_FAILFAST_MASK + ZFS_AC_KERNEL_BIO_REQ_DISCARD + ZFS_AC_KERNEL_BIO_REQ_FLUSH + ZFS_AC_KERNEL_BIO_REQ_PREFLUSH + + ZFS_AC_KERNEL_BIO_REQ_OP_DISCARD + ZFS_AC_KERNEL_BIO_REQ_OP_SECURE_ERASE + ZFS_AC_KERNEL_BIO_REQ_OP_FLUSH + ZFS_AC_KERNEL_BIO_BI_OPF + ZFS_AC_KERNEL_BIO_SET_OP_ATTRS + + ZFS_AC_KERNEL_BIO_SET_DEV + ZFS_AC_KERNEL_BIO_END_IO_T_ARGS + ZFS_AC_KERNEL_BIO_BI_STATUS + ZFS_AC_KERNEL_BIO_BVEC_ITER + ZFS_AC_KERNEL_BIO_SUBMIT_BIO + ZFS_AC_KERNEL_BIO_CURRENT_BIO_LIST +]) diff --git a/config/kernel-bio_set_dev.m4 b/config/kernel-bio_set_dev.m4 deleted file mode 100644 index b8e13f35a..000000000 --- a/config/kernel-bio_set_dev.m4 +++ /dev/null @@ -1,40 +0,0 @@ -dnl # -dnl # Linux 4.14 API, -dnl # -dnl # The bio_set_dev() helper macro was introduced as part of the transition -dnl # to have struct gendisk in struct bio. -dnl # -dnl # Linux 5.0 API, -dnl # -dnl # The bio_set_dev() helper macro was updated to internally depend on -dnl # bio_associate_blkg() symbol which is exported GPL-only. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_SET_DEV], [ - ZFS_LINUX_TEST_SRC([bio_set_dev], [ - #include <linux/bio.h> - #include <linux/fs.h> - ],[ - struct block_device *bdev = NULL; - struct bio *bio = NULL; - bio_set_dev(bio, bdev); - ], [], [$ZFS_META_LICENSE]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV], [ - AC_MSG_CHECKING([whether bio_set_dev() is available]) - ZFS_LINUX_TEST_RESULT([bio_set_dev], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BIO_SET_DEV, 1, [bio_set_dev() is available]) - - AC_MSG_CHECKING([whether bio_set_dev() is GPL-only]) - ZFS_LINUX_TEST_RESULT([bio_set_dev_license], [ - AC_MSG_RESULT(no) - ],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BIO_SET_DEV_GPL_ONLY, 1, - [bio_set_dev() GPL-only]) - ]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-blk-queue-bdi.m4 b/config/kernel-blk-queue-bdi.m4 deleted file mode 100644 index 28241c494..000000000 --- a/config/kernel-blk-queue-bdi.m4 +++ /dev/null @@ -1,24 +0,0 @@ -dnl # -dnl # 2.6.32 - 4.11, statically allocated bdi in request_queue -dnl # 4.12 - x.y, dynamically allocated bdi in request_queue -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI], [ - ZFS_LINUX_TEST_SRC([blk_queue_bdi], [ - #include <linux/blkdev.h> - ],[ - struct request_queue q; - struct backing_dev_info bdi; - q.backing_dev_info = &bdi; - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_BDI], [ - AC_MSG_CHECKING([whether blk_queue bdi is dynamic]) - ZFS_LINUX_TEST_RESULT([blk_queue_bdi], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_BDI_DYNAMIC, 1, - [blk queue backing_dev_info is dynamic]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-blk-queue-discard.m4 b/config/kernel-blk-queue-discard.m4 deleted file mode 100644 index 85a29356d..000000000 --- a/config/kernel-blk-queue-discard.m4 +++ /dev/null @@ -1,72 +0,0 @@ -dnl # -dnl # 2.6.32 - 4.x API, -dnl # blk_queue_discard() -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [ - ZFS_LINUX_TEST_SRC([blk_queue_discard], [ - #include <linux/blkdev.h> - ],[ - struct request_queue *q __attribute__ ((unused)) = NULL; - int value __attribute__ ((unused)); - value = blk_queue_discard(q); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [ - AC_MSG_CHECKING([whether blk_queue_discard() is available]) - ZFS_LINUX_TEST_RESULT([blk_queue_discard], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_DISCARD, 1, - [blk_queue_discard() is available]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -dnl # -dnl # 4.8 - 4.x API, -dnl # blk_queue_secure_erase() -dnl # -dnl # 2.6.36 - 4.7 API, -dnl # blk_queue_secdiscard() -dnl # -dnl # 2.6.x - 2.6.35 API, -dnl # Unsupported by kernel -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE], [ - ZFS_LINUX_TEST_SRC([blk_queue_secure_erase], [ - #include <linux/blkdev.h> - ],[ - struct request_queue *q __attribute__ ((unused)) = NULL; - int value __attribute__ ((unused)); - value = blk_queue_secure_erase(q); - ]) - - ZFS_LINUX_TEST_SRC([blk_queue_secdiscard], [ - #include <linux/blkdev.h> - ],[ - struct request_queue *q __attribute__ ((unused)) = NULL; - int value __attribute__ ((unused)); - value = blk_queue_secdiscard(q); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [ - AC_MSG_CHECKING([whether blk_queue_secure_erase() is available]) - ZFS_LINUX_TEST_RESULT([blk_queue_secure_erase], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_SECURE_ERASE, 1, - [blk_queue_secure_erase() is available]) - ],[ - AC_MSG_RESULT(no) - - AC_MSG_CHECKING([whether blk_queue_secdiscard() is available]) - ZFS_LINUX_TEST_RESULT([blk_queue_secdiscard], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_SECDISCARD, 1, - [blk_queue_secdiscard() is available]) - ],[ - AC_MSG_RESULT(no) - ]) - ]) -]) diff --git a/config/kernel-blk-queue-flags.m4 b/config/kernel-blk-queue-flags.m4 deleted file mode 100644 index 9d4dfc159..000000000 --- a/config/kernel-blk-queue-flags.m4 +++ /dev/null @@ -1,56 +0,0 @@ -dnl # -dnl # API change -dnl # https://github.com/torvalds/linux/commit/8814ce8 -dnl # Introduction of blk_queue_flag_set and blk_queue_flag_clear -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET], [ - ZFS_LINUX_TEST_SRC([blk_queue_flag_set], [ - #include <linux/kernel.h> - #include <linux/blkdev.h> - ],[ - struct request_queue *q = NULL; - blk_queue_flag_set(0, q); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET], [ - AC_MSG_CHECKING([whether blk_queue_flag_set() exists]) - ZFS_LINUX_TEST_RESULT([blk_queue_flag_set], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_FLAG_SET, 1, - [blk_queue_flag_set() exists]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR], [ - ZFS_LINUX_TEST_SRC([blk_queue_flag_clear], [ - #include <linux/kernel.h> - #include <linux/blkdev.h> - ],[ - struct request_queue *q = NULL; - blk_queue_flag_clear(0, q); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR], [ - AC_MSG_CHECKING([whether blk_queue_flag_clear() exists]) - ZFS_LINUX_TEST_RESULT([blk_queue_flag_clear], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_FLAG_CLEAR, 1, - [blk_queue_flag_clear() exists]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAGS], [ - ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET - ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR -]) - -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAGS], [ - ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET - ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR -]) diff --git a/config/kernel-blk-queue-flush.m4 b/config/kernel-blk-queue-flush.m4 deleted file mode 100644 index b546d9400..000000000 --- a/config/kernel-blk-queue-flush.m4 +++ /dev/null @@ -1,69 +0,0 @@ -dnl # -dnl # 2.6.36 API change -dnl # In 2.6.36 kernels the blk_queue_ordered() interface has been -dnl # replaced by the simpler blk_queue_flush(). However, while the -dnl # old interface was available to all the new one is GPL-only. -dnl # Thus in addition to detecting if this function is available -dnl # we determine if it is GPL-only. If the GPL-only interface is -dnl # there we implement our own compatibility function, otherwise -dnl # we use the function. The hope is that long term this function -dnl # will be opened up. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [ - ZFS_LINUX_TEST_SRC([blk_queue_flush], [ - #include <linux/blkdev.h> - ], [ - struct request_queue *q = NULL; - (void) blk_queue_flush(q, REQ_FLUSH); - ], [$NO_UNUSED_BUT_SET_VARIABLE], [$ZFS_META_LICENSE]) - - ZFS_LINUX_TEST_SRC([blk_queue_write_cache], [ - #include <linux/kernel.h> - #include <linux/blkdev.h> - ], [ - struct request_queue *q = NULL; - blk_queue_write_cache(q, true, true); - ], [$NO_UNUSED_BUT_SET_VARIABLE], [$ZFS_META_LICENSE]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [ - AC_MSG_CHECKING([whether blk_queue_flush() is available]) - ZFS_LINUX_TEST_RESULT([blk_queue_flush], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_FLUSH, 1, - [blk_queue_flush() is available]) - - AC_MSG_CHECKING([whether blk_queue_flush() is GPL-only]) - ZFS_LINUX_TEST_RESULT([blk_queue_flush_license], [ - AC_MSG_RESULT(no) - ],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_FLUSH_GPL_ONLY, 1, - [blk_queue_flush() is GPL-only]) - ]) - ],[ - AC_MSG_RESULT(no) - ]) - - dnl # - dnl # 4.7 API change - dnl # Replace blk_queue_flush with blk_queue_write_cache - dnl # - AC_MSG_CHECKING([whether blk_queue_write_cache() exists]) - ZFS_LINUX_TEST_RESULT([blk_queue_write_cache], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE, 1, - [blk_queue_write_cache() exists]) - - AC_MSG_CHECKING([whether blk_queue_write_cache() is GPL-only]) - ZFS_LINUX_TEST_RESULT([blk_queue_write_cache_license], [ - AC_MSG_RESULT(no) - ],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY, 1, - [blk_queue_write_cache() is GPL-only]) - ]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-blk-queue-max-hw-sectors.m4 b/config/kernel-blk-queue-max-hw-sectors.m4 deleted file mode 100644 index 7387f84de..000000000 --- a/config/kernel-blk-queue-max-hw-sectors.m4 +++ /dev/null @@ -1,23 +0,0 @@ -dnl # -dnl # 2.6.34 API change -dnl # blk_queue_max_hw_sectors() replaces blk_queue_max_sectors(). -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS], [ - ZFS_LINUX_TEST_SRC([blk_queue_max_hw_sectors], [ - #include <linux/blkdev.h> - ], [ - struct request_queue *q = NULL; - (void) blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS); - ], [$NO_UNUSED_BUT_SET_VARIABLE]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [ - AC_MSG_CHECKING([whether blk_queue_max_hw_sectors() is available]) - ZFS_LINUX_TEST_RESULT([blk_queue_max_hw_sectors], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_MAX_HW_SECTORS, 1, - [blk_queue_max_hw_sectors() is available]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-blk-queue-max-segments.m4 b/config/kernel-blk-queue-max-segments.m4 deleted file mode 100644 index 1e4092df9..000000000 --- a/config/kernel-blk-queue-max-segments.m4 +++ /dev/null @@ -1,24 +0,0 @@ -dnl # -dnl # 2.6.34 API change -dnl # blk_queue_max_segments() consolidates blk_queue_max_hw_segments() -dnl # and blk_queue_max_phys_segments(). -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS], [ - ZFS_LINUX_TEST_SRC([blk_queue_max_segments], [ - #include <linux/blkdev.h> - ], [ - struct request_queue *q = NULL; - (void) blk_queue_max_segments(q, BLK_MAX_SEGMENTS); - ], [$NO_UNUSED_BUT_SET_VARIABLE]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS], [ - AC_MSG_CHECKING([whether blk_queue_max_segments() is available]) - ZFS_LINUX_TEST_RESULT([blk_queue_max_segments], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1, - [blk_queue_max_segments() is available]) - ], [ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-blk-queue-unplug.m4 b/config/kernel-blk-queue-unplug.m4 deleted file mode 100644 index f5d1814b8..000000000 --- a/config/kernel-blk-queue-unplug.m4 +++ /dev/null @@ -1,54 +0,0 @@ -dnl # -dnl # 2.6.32-2.6.35 API - The BIO_RW_UNPLUG enum can be used as a hint -dnl # to unplug the queue. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_RW_UNPLUG], [ - ZFS_LINUX_TEST_SRC([blk_queue_bio_rw_unplug], [ - #include <linux/blkdev.h> - ],[ - enum bio_rw_flags rw __attribute__ ((unused)) = BIO_RW_UNPLUG; - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_UNPLUG], [ - AC_MSG_CHECKING([whether the BIO_RW_UNPLUG enum is available]) - ZFS_LINUX_TEST_RESULT([blk_queue_bio_rw_unplug], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_HAVE_BIO_RW_UNPLUG, 1, - [BIO_RW_UNPLUG is available]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_PLUG], [ - ZFS_LINUX_TEST_SRC([blk_plug], [ - #include <linux/blkdev.h> - ],[ - struct blk_plug plug __attribute__ ((unused)); - - blk_start_plug(&plug); - blk_finish_plug(&plug); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BLK_PLUG], [ - AC_MSG_CHECKING([whether struct blk_plug is available]) - ZFS_LINUX_TEST_RESULT([blk_plug], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_HAVE_BLK_PLUG, 1, - [struct blk_plug is available]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG], [ - ZFS_AC_KERNEL_SRC_BIO_RW_UNPLUG - ZFS_AC_KERNEL_SRC_BLK_PLUG -]) - -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_PLUG], [ - ZFS_AC_KERNEL_BIO_RW_UNPLUG - ZFS_AC_KERNEL_BLK_PLUG -]) diff --git a/config/kernel-blk-queue.m4 b/config/kernel-blk-queue.m4 new file mode 100644 index 000000000..382ebefd3 --- /dev/null +++ b/config/kernel-blk-queue.m4 @@ -0,0 +1,302 @@ +dnl # +dnl # 2.6.39 API change, +dnl # blk_start_plug() and blk_finish_plug() +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG], [ + ZFS_LINUX_TEST_SRC([blk_plug], [ + #include <linux/blkdev.h> + ],[ + struct blk_plug plug __attribute__ ((unused)); + + blk_start_plug(&plug); + blk_finish_plug(&plug); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_PLUG], [ + AC_MSG_CHECKING([whether struct blk_plug is available]) + ZFS_LINUX_TEST_RESULT([blk_plug], [ + AC_MSG_RESULT(yes) + ],[ + ZFS_LINUX_TEST_ERROR([blk_plug]) + ]) +]) + +dnl # +dnl # 2.6.32 - 4.11, statically allocated bdi in request_queue +dnl # 4.12 - x.y, dynamically allocated bdi in request_queue +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI], [ + ZFS_LINUX_TEST_SRC([blk_queue_bdi], [ + #include <linux/blkdev.h> + ],[ + struct request_queue q; + struct backing_dev_info bdi; + q.backing_dev_info = &bdi; + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_BDI], [ + AC_MSG_CHECKING([whether blk_queue bdi is dynamic]) + ZFS_LINUX_TEST_RESULT([blk_queue_bdi], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_QUEUE_BDI_DYNAMIC, 1, + [blk queue backing_dev_info is dynamic]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +dnl # +dnl # 2.6.32 - 4.x API, +dnl # blk_queue_discard() +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [ + ZFS_LINUX_TEST_SRC([blk_queue_discard], [ + #include <linux/blkdev.h> + ],[ + struct request_queue *q __attribute__ ((unused)) = NULL; + int value __attribute__ ((unused)); + value = blk_queue_discard(q); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [ + AC_MSG_CHECKING([whether blk_queue_discard() is available]) + ZFS_LINUX_TEST_RESULT([blk_queue_discard], [ + AC_MSG_RESULT(yes) + ],[ + ZFS_LINUX_TEST_ERROR([blk_queue_discard]) + ]) +]) + +dnl # +dnl # 4.8 - 4.x API, +dnl # blk_queue_secure_erase() +dnl # +dnl # 2.6.36 - 4.7 API, +dnl # blk_queue_secdiscard() +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE], [ + ZFS_LINUX_TEST_SRC([blk_queue_secure_erase], [ + #include <linux/blkdev.h> + ],[ + struct request_queue *q __attribute__ ((unused)) = NULL; + int value __attribute__ ((unused)); + value = blk_queue_secure_erase(q); + ]) + + ZFS_LINUX_TEST_SRC([blk_queue_secdiscard], [ + #include <linux/blkdev.h> + ],[ + struct request_queue *q __attribute__ ((unused)) = NULL; + int value __attribute__ ((unused)); + value = blk_queue_secdiscard(q); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [ + AC_MSG_CHECKING([whether blk_queue_secure_erase() is available]) + ZFS_LINUX_TEST_RESULT([blk_queue_secure_erase], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_QUEUE_SECURE_ERASE, 1, + [blk_queue_secure_erase() is available]) + ],[ + AC_MSG_RESULT(no) + + AC_MSG_CHECKING([whether blk_queue_secdiscard() is available]) + ZFS_LINUX_TEST_RESULT([blk_queue_secdiscard], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_QUEUE_SECDISCARD, 1, + [blk_queue_secdiscard() is available]) + ],[ + ZFS_LINUX_TEST_ERROR([blk_queue_secure_erase]) + ]) + ]) +]) + +dnl # +dnl # 4.16 API change, +dnl # Introduction of blk_queue_flag_set and blk_queue_flag_clear +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET], [ + ZFS_LINUX_TEST_SRC([blk_queue_flag_set], [ + #include <linux/kernel.h> + #include <linux/blkdev.h> + ],[ + struct request_queue *q = NULL; + blk_queue_flag_set(0, q); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET], [ + AC_MSG_CHECKING([whether blk_queue_flag_set() exists]) + ZFS_LINUX_TEST_RESULT([blk_queue_flag_set], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_QUEUE_FLAG_SET, 1, + [blk_queue_flag_set() exists]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR], [ + ZFS_LINUX_TEST_SRC([blk_queue_flag_clear], [ + #include <linux/kernel.h> + #include <linux/blkdev.h> + ],[ + struct request_queue *q = NULL; + blk_queue_flag_clear(0, q); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR], [ + AC_MSG_CHECKING([whether blk_queue_flag_clear() exists]) + ZFS_LINUX_TEST_RESULT([blk_queue_flag_clear], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_QUEUE_FLAG_CLEAR, 1, + [blk_queue_flag_clear() exists]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +dnl # +dnl # 2.6.36 API change, +dnl # Added blk_queue_flush() interface, while the previous interface +dnl # was available to all the new one is GPL-only. Thus in addition to +dnl # detecting if this function is available we determine if it is +dnl # GPL-only. If the GPL-only interface is there we implement our own +dnl # compatibility function, otherwise we use the function. The hope +dnl # is that long term this function will be opened up. +dnl # +dnl # 4.7 API change, +dnl # Replace blk_queue_flush with blk_queue_write_cache +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [ + ZFS_LINUX_TEST_SRC([blk_queue_flush], [ + #include <linux/blkdev.h> + ], [ + struct request_queue *q = NULL; + (void) blk_queue_flush(q, REQ_FLUSH); + ], [$NO_UNUSED_BUT_SET_VARIABLE], [$ZFS_META_LICENSE]) + + ZFS_LINUX_TEST_SRC([blk_queue_write_cache], [ + #include <linux/kernel.h> + #include <linux/blkdev.h> + ], [ + struct request_queue *q = NULL; + blk_queue_write_cache(q, true, true); + ], [$NO_UNUSED_BUT_SET_VARIABLE], [$ZFS_META_LICENSE]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [ + AC_MSG_CHECKING([whether blk_queue_flush() is available]) + ZFS_LINUX_TEST_RESULT([blk_queue_flush], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_QUEUE_FLUSH, 1, + [blk_queue_flush() is available]) + + AC_MSG_CHECKING([whether blk_queue_flush() is GPL-only]) + ZFS_LINUX_TEST_RESULT([blk_queue_flush_license], [ + AC_MSG_RESULT(no) + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_QUEUE_FLUSH_GPL_ONLY, 1, + [blk_queue_flush() is GPL-only]) + ]) + ],[ + AC_MSG_RESULT(no) + ]) + + dnl # + dnl # 4.7 API change + dnl # Replace blk_queue_flush with blk_queue_write_cache + dnl # + AC_MSG_CHECKING([whether blk_queue_write_cache() exists]) + ZFS_LINUX_TEST_RESULT([blk_queue_write_cache], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE, 1, + [blk_queue_write_cache() exists]) + + AC_MSG_CHECKING([whether blk_queue_write_cache() is GPL-only]) + ZFS_LINUX_TEST_RESULT([blk_queue_write_cache_license], [ + AC_MSG_RESULT(no) + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY, 1, + [blk_queue_write_cache() is GPL-only]) + ]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +dnl # +dnl # 2.6.34 API change +dnl # blk_queue_max_hw_sectors() replaces blk_queue_max_sectors(). +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS], [ + ZFS_LINUX_TEST_SRC([blk_queue_max_hw_sectors], [ + #include <linux/blkdev.h> + ], [ + struct request_queue *q = NULL; + (void) blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS); + ], [$NO_UNUSED_BUT_SET_VARIABLE]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [ + AC_MSG_CHECKING([whether blk_queue_max_hw_sectors() is available]) + ZFS_LINUX_TEST_RESULT([blk_queue_max_hw_sectors], [ + AC_MSG_RESULT(yes) + ],[ + ZFS_LINUX_TEST_ERROR([blk_queue_max_hw_sectors]) + ]) +]) + +dnl # +dnl # 2.6.34 API change +dnl # blk_queue_max_segments() consolidates blk_queue_max_hw_segments() +dnl # and blk_queue_max_phys_segments(). +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS], [ + ZFS_LINUX_TEST_SRC([blk_queue_max_segments], [ + #include <linux/blkdev.h> + ], [ + struct request_queue *q = NULL; + (void) blk_queue_max_segments(q, BLK_MAX_SEGMENTS); + ], [$NO_UNUSED_BUT_SET_VARIABLE]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS], [ + AC_MSG_CHECKING([whether blk_queue_max_segments() is available]) + ZFS_LINUX_TEST_RESULT([blk_queue_max_segments], [ + AC_MSG_RESULT(yes) + ], [ + ZFS_LINUX_TEST_ERROR([blk_queue_max_segments]) + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE], [ + ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG + ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI + ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD + ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE + ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET + ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR + ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH + ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS + ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE], [ + ZFS_AC_KERNEL_BLK_QUEUE_PLUG + ZFS_AC_KERNEL_BLK_QUEUE_BDI + ZFS_AC_KERNEL_BLK_QUEUE_DISCARD + ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE + ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET + ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR + ZFS_AC_KERNEL_BLK_QUEUE_FLUSH + ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS + ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS +]) diff --git a/config/kernel-blkdev-get-by-path.m4 b/config/kernel-blkdev-get-by-path.m4 deleted file mode 100644 index fb0cea6af..000000000 --- a/config/kernel-blkdev-get-by-path.m4 +++ /dev/null @@ -1,24 +0,0 @@ -dnl # -dnl # 2.6.38 API change -dnl # open_bdev_exclusive() changed to blkdev_get_by_path() -dnl # close_bdev_exclusive() changed to blkdev_put() -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH], [ - ZFS_LINUX_TEST_SRC([blkdev_get_by_path], [ - #include <linux/fs.h> - ], [ - blkdev_get_by_path(NULL, 0, NULL); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH], [ - AC_MSG_CHECKING([whether blkdev_get_by_path() is available]) - ZFS_LINUX_TEST_RESULT_SYMBOL([blkdev_get_by_path], - [blkdev_get_by_path], [fs/block_dev.c], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLKDEV_GET_BY_PATH, 1, - [blkdev_get_by_path() is available]) - ], [ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-blkdev-reread-part.m4 b/config/kernel-blkdev-reread-part.m4 deleted file mode 100644 index 1bf1e7c3a..000000000 --- a/config/kernel-blkdev-reread-part.m4 +++ /dev/null @@ -1,25 +0,0 @@ -dnl # -dnl # 4.1 API, exported blkdev_reread_part() symbol, backported to the -dnl # 3.10.0 CentOS 7.x enterprise kernels. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART], [ - ZFS_LINUX_TEST_SRC([blkdev_reread_part], [ - #include <linux/fs.h> - ], [ - struct block_device *bdev = NULL; - int error; - - error = blkdev_reread_part(bdev); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_REREAD_PART], [ - AC_MSG_CHECKING([whether blkdev_reread_part() is available]) - ZFS_LINUX_TEST_RESULT([blkdev_reread_part], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLKDEV_REREAD_PART, 1, - [blkdev_reread_part() is available]) - ], [ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-blkdev.m4 b/config/kernel-blkdev.m4 new file mode 100644 index 000000000..e21010654 --- /dev/null +++ b/config/kernel-blkdev.m4 @@ -0,0 +1,207 @@ +dnl # +dnl # 2.6.38 API change, +dnl # Added blkdev_get_by_path() +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH], [ + ZFS_LINUX_TEST_SRC([blkdev_get_by_path], [ + #include <linux/fs.h> + ], [ + struct block_device *bdev __attribute__ ((unused)) = NULL; + const char *path = "path"; + fmode_t mode = 0; + void *holder = NULL; + + bdev = blkdev_get_by_path(path, mode, holder); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH], [ + AC_MSG_CHECKING([whether blkdev_get_by_path() exists]) + ZFS_LINUX_TEST_RESULT([blkdev_get_by_path], [ + AC_MSG_RESULT(yes) + ], [ + ZFS_LINUX_TEST_ERROR([blkdev_get_by_path()]) + ]) +]) + +dnl # +dnl # 2.6.38 API change, +dnl # Added blkdev_put() +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_PUT], [ + ZFS_LINUX_TEST_SRC([blkdev_put], [ + #include <linux/fs.h> + ], [ + struct block_device *bdev = NULL; + fmode_t mode = 0; + + blkdev_put(bdev, mode); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_PUT], [ + AC_MSG_CHECKING([whether blkdev_put() exists]) + ZFS_LINUX_TEST_RESULT([blkdev_put], [ + AC_MSG_RESULT(yes) + ], [ + ZFS_LINUX_TEST_ERROR([blkdev_put()]) + ]) +]) + +dnl # +dnl # 4.1 API, exported blkdev_reread_part() symbol, back ported to the +dnl # 3.10.0 CentOS 7.x enterprise kernels. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART], [ + ZFS_LINUX_TEST_SRC([blkdev_reread_part], [ + #include <linux/fs.h> + ], [ + struct block_device *bdev = NULL; + int error; + + error = blkdev_reread_part(bdev); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_REREAD_PART], [ + AC_MSG_CHECKING([whether blkdev_reread_part() exists]) + ZFS_LINUX_TEST_RESULT([blkdev_reread_part], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLKDEV_REREAD_PART, 1, + [blkdev_reread_part() exists]) + ], [ + AC_MSG_RESULT(no) + ]) +]) + +dnl # +dnl # 2.6.22 API change +dnl # Single argument invalidate_bdev() +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_INVALIDATE_BDEV], [ + ZFS_LINUX_TEST_SRC([invalidate_bdev], [ + #include <linux/buffer_head.h> + ],[ + struct block_device *bdev = NULL; + invalidate_bdev(bdev); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_INVALIDATE_BDEV], [ + AC_MSG_CHECKING([whether invalidate_bdev() exists]) + ZFS_LINUX_TEST_RESULT([invalidate_bdev], [ + AC_MSG_RESULT(yes) + ],[ + ZFS_LINUX_TEST_ERROR([invalidate_bdev()]) + ]) +]) + +dnl # +dnl # 2.6.27, lookup_bdev() was exported. +dnl # 4.4.0-6.21 - lookup_bdev() takes 2 arguments. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_LOOKUP_BDEV], [ + ZFS_LINUX_TEST_SRC([lookup_bdev_1arg], [ + #include <linux/fs.h> + ], [ + lookup_bdev(NULL); + ]) + + ZFS_LINUX_TEST_SRC([lookup_bdev_2args], [ + #include <linux/fs.h> + ], [ + lookup_bdev(NULL, FMODE_READ); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_LOOKUP_BDEV], [ + AC_MSG_CHECKING([whether lookup_bdev() wants 1 arg]) + ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_1arg], + [lookup_bdev], [fs/block_dev.c], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_1ARG_LOOKUP_BDEV, 1, + [lookup_bdev() wants 1 arg]) + ], [ + AC_MSG_RESULT(no) + + AC_MSG_CHECKING([whether lookup_bdev() wants 2 args]) + ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_2args], + [lookup_bdev], [fs/block_dev.c], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_2ARGS_LOOKUP_BDEV, 1, + [lookup_bdev() wants 2 args]) + ], [ + ZFS_LINUX_TEST_ERROR([lookup_bdev()]) + ]) + ]) +]) + +dnl # +dnl # 2.6.30 API change +dnl # +dnl # The bdev_physical_block_size() interface was added to provide a way +dnl # to determine the smallest write which can be performed without a +dnl # read-modify-write operation. +dnl # +dnl # Unfortunately, this interface isn't entirely reliable because +dnl # drives are sometimes known to misreport this value. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE], [ + ZFS_LINUX_TEST_SRC([bdev_physical_block_size], [ + #include <linux/blkdev.h> + ],[ + struct block_device *bdev __attribute__ ((unused)) = NULL; + bdev_physical_block_size(bdev); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE], [ + AC_MSG_CHECKING([whether bdev_physical_block_size() is available]) + ZFS_LINUX_TEST_RESULT([bdev_physical_block_size], [ + AC_MSG_RESULT(yes) + ],[ + ZFS_LINUX_TEST_ERROR([bdev_physical_block_size()]) + ]) +]) + +dnl # +dnl # 2.6.30 API change +dnl # Added bdev_logical_block_size(). +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE], [ + ZFS_LINUX_TEST_SRC([bdev_logical_block_size], [ + #include <linux/blkdev.h> + ],[ + struct block_device *bdev __attribute__ ((unused)) = NULL; + bdev_logical_block_size(bdev); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE], [ + AC_MSG_CHECKING([whether bdev_logical_block_size() is available]) + ZFS_LINUX_TEST_RESULT([bdev_logical_block_size], [ + AC_MSG_RESULT(yes) + ],[ + ZFS_LINUX_TEST_ERROR([bdev_logical_block_size()]) + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV], [ + ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH + ZFS_AC_KERNEL_SRC_BLKDEV_PUT + ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART + ZFS_AC_KERNEL_SRC_BLKDEV_INVALIDATE_BDEV + ZFS_AC_KERNEL_SRC_BLKDEV_LOOKUP_BDEV + ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE + ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLKDEV], [ + ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH + ZFS_AC_KERNEL_BLKDEV_PUT + ZFS_AC_KERNEL_BLKDEV_REREAD_PART + ZFS_AC_KERNEL_BLKDEV_INVALIDATE_BDEV + ZFS_AC_KERNEL_BLKDEV_LOOKUP_BDEV + ZFS_AC_KERNEL_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE + ZFS_AC_KERNEL_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE +]) diff --git a/config/kernel-block-device-operations.m4 b/config/kernel-block-device-operations.m4 index c3d5eec52..8e64ecca9 100644 --- a/config/kernel-block-device-operations.m4 +++ b/config/kernel-block-device-operations.m4 @@ -19,10 +19,8 @@ AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [ AC_MSG_CHECKING([whether bops->check_events() exists]) ZFS_LINUX_TEST_RESULT([block_device_operations_check_events], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS, 1, - [bops->check_events() exists]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([bops->check_events()]) ]) ]) @@ -49,10 +47,8 @@ AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [ AC_MSG_CHECKING([whether bops->release() is void]) ZFS_LINUX_TEST_RESULT([block_device_operations_release_void], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID, 1, - [bops->release() returns void]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([bops->release()]) ]) ]) diff --git a/config/kernel-commit-metadata.m4 b/config/kernel-commit-metadata.m4 index 9bc3b6622..7df9b9802 100644 --- a/config/kernel-commit-metadata.m4 +++ b/config/kernel-commit-metadata.m4 @@ -18,9 +18,7 @@ AC_DEFUN([ZFS_AC_KERNEL_COMMIT_METADATA], [ AC_MSG_CHECKING([whether eops->commit_metadata() exists]) ZFS_LINUX_TEST_RESULT([export_operations_commit_metadata], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_COMMIT_METADATA, 1, - [eops->commit_metadata() exists]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([eops->commit_metadata()]) ]) ]) diff --git a/config/kernel-create-nameidata.m4 b/config/kernel-create-nameidata.m4 deleted file mode 100644 index c43ca5b85..000000000 --- a/config/kernel-create-nameidata.m4 +++ /dev/null @@ -1,33 +0,0 @@ -dnl # -dnl # 3.6 API change -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE_NAMEIDATA], [ - ZFS_LINUX_TEST_SRC([create_nameidata], [ - #include <linux/fs.h> - #include <linux/sched.h> - - #ifdef HAVE_MKDIR_UMODE_T - int inode_create(struct inode *inode ,struct dentry *dentry, - umode_t umode, struct nameidata *nidata) { return 0; } - #else - int inode_create(struct inode *inode,struct dentry *dentry, - int umode, struct nameidata * nidata) { return 0; } - #endif - - static const struct inode_operations - iops __attribute__ ((unused)) = { - .create = inode_create, - }; - ],[]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [ - AC_MSG_CHECKING([whether iops->create() passes nameidata]) - ZFS_LINUX_TEST_RESULT([create_nameidata], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_CREATE_NAMEIDATA, 1, - [iops->create() passes nameidata]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-ctl-table-name.m4 b/config/kernel-ctl-table-name.m4 deleted file mode 100644 index 16f2ad544..000000000 --- a/config/kernel-ctl-table-name.m4 +++ /dev/null @@ -1,22 +0,0 @@ -dnl # -dnl # 2.6.33 API change, -dnl # Removed .ctl_name from struct ctl_table. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_CTL_NAME], [ - ZFS_LINUX_TEST_SRC([ctl_name], [ - #include <linux/sysctl.h> - ],[ - struct ctl_table ctl __attribute__ ((unused)); - ctl.ctl_name = 0; - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_CTL_NAME], [ - AC_MSG_CHECKING([whether struct ctl_table has ctl_name]) - ZFS_LINUX_TEST_RESULT([ctl_name], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-current_bio_tail.m4 b/config/kernel-current_bio_tail.m4 deleted file mode 100644 index 9dfc3e6e0..000000000 --- a/config/kernel-current_bio_tail.m4 +++ /dev/null @@ -1,39 +0,0 @@ -dnl # -dnl # 2.6.34 API change -dnl # current->bio_tail and current->bio_list were struct bio pointers prior to -dnl # Linux 2.6.34. They were refactored into a struct bio_list pointer called -dnl # current->bio_list in Linux 2.6.34. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_CURRENT_BIO_TAIL], [ - ZFS_LINUX_TEST_SRC([current_bio_tail], [ - #include <linux/sched.h> - ], [ - current->bio_tail = (struct bio **) NULL; - ]) - - ZFS_LINUX_TEST_SRC([current_bio_list], [ - #include <linux/sched.h> - ], [ - current->bio_list = (struct bio_list *) NULL; - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_CURRENT_BIO_TAIL], [ - AC_MSG_CHECKING([whether current->bio_tail exists]) - ZFS_LINUX_TEST_RESULT([current_bio_tail], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_CURRENT_BIO_TAIL, 1, - [current->bio_tail exists]) - ],[ - AC_MSG_RESULT(no) - - AC_MSG_CHECKING([whether current->bio_list exists]) - ZFS_LINUX_TEST_RESULT([current_bio_list], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_CURRENT_BIO_LIST, 1, - [current->bio_list exists]) - ],[ - ZFS_LINUX_TEST_ERROR([bio_list]) - ]) - ]) -]) diff --git a/config/kernel-dentry-operations.m4 b/config/kernel-dentry-operations.m4 index de7482801..660d6260b 100644 --- a/config/kernel-dentry-operations.m4 +++ b/config/kernel-dentry-operations.m4 @@ -38,10 +38,8 @@ AC_DEFUN([ZFS_AC_KERNEL_D_OBTAIN_ALIAS], [ ZFS_LINUX_TEST_RESULT_SYMBOL([d_obtain_alias], [d_obtain_alias], [fs/dcache.c], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1, - [d_obtain_alias() is available]) ], [ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([d_obtain_alias()]) ]) ]) @@ -66,7 +64,7 @@ AC_DEFUN([ZFS_AC_KERNEL_D_PRUNE_ALIASES], [ AC_DEFINE(HAVE_D_PRUNE_ALIASES, 1, [d_prune_aliases() is available]) ], [ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([d_prune_aliases()]) ]) ]) @@ -87,9 +85,8 @@ AC_DEFUN([ZFS_AC_KERNEL_D_SET_D_OP], [ ZFS_LINUX_TEST_RESULT_SYMBOL([d_set_d_op], [d_set_d_op], [fs/dcache.c], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_D_SET_D_OP, 1, [d_set_d_op() is available]) ], [ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([d_set_d_op]) ]) ]) @@ -146,7 +143,7 @@ AC_DEFUN([ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS], [ AC_DEFINE(HAVE_CONST_DENTRY_OPERATIONS, 1, [dentry uses const struct dentry_operations]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([const dentry_operations]) ]) ]) diff --git a/config/kernel-discard-granularity.m4 b/config/kernel-discard-granularity.m4 index c830d9aa9..61326e677 100644 --- a/config/kernel-discard-granularity.m4 +++ b/config/kernel-discard-granularity.m4 @@ -15,9 +15,7 @@ AC_DEFUN([ZFS_AC_KERNEL_DISCARD_GRANULARITY], [ AC_MSG_CHECKING([whether ql->discard_granularity is available]) ZFS_LINUX_TEST_RESULT([discard_granularity], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_DISCARD_GRANULARITY, 1, - [ql->discard_granularity is available]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([ql->discard_granularity]) ]) ]) diff --git a/config/kernel-evict-inode.m4 b/config/kernel-evict-inode.m4 index cd91c6669..66f10492d 100644 --- a/config/kernel-evict-inode.m4 +++ b/config/kernel-evict-inode.m4 @@ -19,6 +19,6 @@ AC_DEFUN([ZFS_AC_KERNEL_EVICT_INODE], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_EVICT_INODE, 1, [sops->evict_inode() exists]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([evict_inode]) ]) ]) diff --git a/config/kernel-fallocate.m4 b/config/kernel-fallocate.m4 index 302957a6c..7a8550f7e 100644 --- a/config/kernel-fallocate.m4 +++ b/config/kernel-fallocate.m4 @@ -1,10 +1,9 @@ dnl # +dnl # Linux 2.6.38 - 3.x API dnl # The fallocate callback was moved from the inode_operations dnl # structure to the file_operations structure. dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_FALLOCATE], [ - - dnl # Linux 2.6.38 - 3.x API ZFS_LINUX_TEST_SRC([file_fallocate], [ #include <linux/fs.h> @@ -16,35 +15,13 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FALLOCATE], [ .fallocate = test_fallocate, }; ], []) - - dnl # Linux 2.6.x - 2.6.37 API - ZFS_LINUX_TEST_SRC([inode_fallocate], [ - #include <linux/fs.h> - - long test_fallocate(struct inode *inode, int mode, - loff_t offset, loff_t len) { return 0; } - - static const struct inode_operations - fops __attribute__ ((unused)) = { - .fallocate = test_fallocate, - }; - ], []) ]) AC_DEFUN([ZFS_AC_KERNEL_FALLOCATE], [ AC_MSG_CHECKING([whether fops->fallocate() exists]) ZFS_LINUX_TEST_RESULT([file_fallocate], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists]) - ],[ - AC_MSG_RESULT(no) - ]) - - AC_MSG_CHECKING([whether iops->fallocate() exists]) - ZFS_LINUX_TEST_RESULT([inode_fallocate], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_INODE_FALLOCATE, 1, [fops->fallocate() exists]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([file_fallocate]) ]) ]) diff --git a/config/kernel-fmode-t.m4 b/config/kernel-fmode-t.m4 index bc0001b9e..5f111e21b 100644 --- a/config/kernel-fmode-t.m4 +++ b/config/kernel-fmode-t.m4 @@ -14,8 +14,7 @@ AC_DEFUN([ZFS_AC_KERNEL_FMODE_T], [ AC_MSG_CHECKING([whether kernel defines fmode_t]) ZFS_LINUX_TEST_RESULT([type_fmode_t], [ AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_FMODE_T, 1, [kernel defines fmode_t]) ],[ - AC_MSG_RESULT([no]) + ZFS_LINUX_TEST_ERROR([type_fmode_t]) ]) ]) diff --git a/config/kernel-follow-down-one.m4 b/config/kernel-follow-down-one.m4 index 94e4aeb8d..38c460d35 100644 --- a/config/kernel-follow-down-one.m4 +++ b/config/kernel-follow-down-one.m4 @@ -16,9 +16,7 @@ AC_DEFUN([ZFS_AC_KERNEL_FOLLOW_DOWN_ONE], [ AC_MSG_CHECKING([whether follow_down_one() is available]) ZFS_LINUX_TEST_RESULT([follow_down_one], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_FOLLOW_DOWN_ONE, 1, - [follow_down_one() is available]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([follow_down_one()]) ]) ]) diff --git a/config/kernel-fst-mount.m4 b/config/kernel-fst-mount.m4 index cec1ed4d6..576f5f012 100644 --- a/config/kernel-fst-mount.m4 +++ b/config/kernel-fst-mount.m4 @@ -24,8 +24,7 @@ AC_DEFUN([ZFS_AC_KERNEL_FST_MOUNT], [ AC_MSG_CHECKING([whether fst->mount() exists]) ZFS_LINUX_TEST_RESULT([file_system_type_mount], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_FST_MOUNT, 1, [fst->mount() exists]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([fst->mount()]) ]) ]) diff --git a/config/kernel-fsync.m4 b/config/kernel-fsync.m4 index 0494e31ad..d198191d3 100644 --- a/config/kernel-fsync.m4 +++ b/config/kernel-fsync.m4 @@ -2,18 +2,6 @@ dnl # dnl # Check file_operations->fsync interface. dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_FSYNC], [ - ZFS_LINUX_TEST_SRC([fsync_with_dentry], [ - #include <linux/fs.h> - - int test_fsync(struct file *f, struct dentry *dentry, int x) - { return 0; } - - static const struct file_operations - fops __attribute__ ((unused)) = { - .fsync = test_fsync, - }; - ],[]) - ZFS_LINUX_TEST_SRC([fsync_without_dentry], [ #include <linux/fs.h> @@ -40,38 +28,26 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FSYNC], [ AC_DEFUN([ZFS_AC_KERNEL_FSYNC], [ dnl # - dnl # Linux 2.6.x - 2.6.34 API + dnl # Linux 2.6.35 - Linux 3.0 API dnl # - AC_MSG_CHECKING([whether fops->fsync() wants dentry]) - ZFS_LINUX_TEST_RESULT([fsync_with_dentry], [ + AC_MSG_CHECKING([whether fops->fsync() wants no dentry]) + ZFS_LINUX_TEST_RESULT([fsync_without_dentry], [ AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_FSYNC_WITH_DENTRY, 1, - [fops->fsync() with dentry]) + AC_DEFINE(HAVE_FSYNC_WITHOUT_DENTRY, 1, + [fops->fsync() without dentry]) ],[ AC_MSG_RESULT([no]) dnl # - dnl # Linux 2.6.35 - Linux 3.0 API + dnl # Linux 3.1 - 3.x API dnl # - AC_MSG_CHECKING([whether fops->fsync() wants no dentry]) - ZFS_LINUX_TEST_RESULT([fsync_without_dentry], [ - AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_FSYNC_WITHOUT_DENTRY, 1, - [fops->fsync() without dentry]) + AC_MSG_CHECKING([whether fops->fsync() wants range]) + ZFS_LINUX_TEST_RESULT([fsync_range], [ + AC_MSG_RESULT([range]) + AC_DEFINE(HAVE_FSYNC_RANGE, 1, + [fops->fsync() with range]) ],[ - AC_MSG_RESULT([no]) - - dnl # - dnl # Linux 3.1 - 3.x API - dnl # - AC_MSG_CHECKING([whether fops->fsync() wants range]) - ZFS_LINUX_TEST_RESULT([fsync_range], [ - AC_MSG_RESULT([range]) - AC_DEFINE(HAVE_FSYNC_RANGE, 1, - [fops->fsync() with range]) - ],[ - ZFS_LINUX_TEST_ERROR([fops->fsync]) - ]) + ZFS_LINUX_TEST_ERROR([fops->fsync]) ]) ]) ]) diff --git a/config/kernel-get-disk-ro.m4 b/config/kernel-get-disk-ro.m4 index 1e2abb475..8a379c766 100644 --- a/config/kernel-get-disk-ro.m4 +++ b/config/kernel-get-disk-ro.m4 @@ -14,8 +14,7 @@ AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_RO], [ AC_MSG_CHECKING([whether get_disk_ro() is available]) ZFS_LINUX_TEST_RESULT([get_disk_ro], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GET_DISK_RO, 1, [blk_disk_ro() is available]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([get_disk_ro()]) ]) ]) diff --git a/config/kernel-inode-create.m4 b/config/kernel-inode-create.m4 new file mode 100644 index 000000000..9f28bcbd4 --- /dev/null +++ b/config/kernel-inode-create.m4 @@ -0,0 +1,26 @@ +dnl # +dnl # 3.6 API change +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE_FLAGS], [ + ZFS_LINUX_TEST_SRC([create_flags], [ + #include <linux/fs.h> + #include <linux/sched.h> + + int inode_create(struct inode *inode ,struct dentry *dentry, + umode_t umode, bool flag) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .create = inode_create, + }; + ],[]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_CREATE_FLAGS], [ + AC_MSG_CHECKING([whether iops->create() passes flags]) + ZFS_LINUX_TEST_RESULT([create_flags], [ + AC_MSG_RESULT(yes) + ],[ + ZFS_LINUX_TEST_ERROR([iops->create()]) + ]) +]) diff --git a/config/kernel-inode-lookup.m4 b/config/kernel-inode-lookup.m4 new file mode 100644 index 000000000..1a56e69b0 --- /dev/null +++ b/config/kernel-inode-lookup.m4 @@ -0,0 +1,26 @@ +dnl # +dnl # 3.6 API change +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_LOOKUP_FLAGS], [ + ZFS_LINUX_TEST_SRC([lookup_flags], [ + #include <linux/fs.h> + #include <linux/sched.h> + + struct dentry *inode_lookup(struct inode *inode, + struct dentry *dentry, unsigned int flags) { return NULL; } + + static const struct inode_operations iops + __attribute__ ((unused)) = { + .lookup = inode_lookup, + }; + ],[]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_FLAGS], [ + AC_MSG_CHECKING([whether iops->lookup() passes flags]) + ZFS_LINUX_TEST_RESULT([lookup_flags], [ + AC_MSG_RESULT(yes) + ],[ + ZFS_LINUX_TEST_ERROR([iops->lookup()]) + ]) +]) diff --git a/config/kernel-insert-inode-locked.m4 b/config/kernel-insert-inode-locked.m4 index 4990399c3..348aff9a5 100644 --- a/config/kernel-insert-inode-locked.m4 +++ b/config/kernel-insert-inode-locked.m4 @@ -15,9 +15,7 @@ AC_DEFUN([ZFS_AC_KERNEL_INSERT_INODE_LOCKED], [ ZFS_LINUX_TEST_RESULT_SYMBOL([insert_inode_locked], [insert_inode_locked], [fs/inode.c], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_INSERT_INODE_LOCKED, 1, - [insert_inode_locked() is available]) ], [ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([insert_inode_locked()]) ]) ]) diff --git a/config/kernel-invalidate-bdev-args.m4 b/config/kernel-invalidate-bdev-args.m4 deleted file mode 100644 index 55a784dd9..000000000 --- a/config/kernel-invalidate-bdev-args.m4 +++ /dev/null @@ -1,23 +0,0 @@ -dnl # -dnl # 2.6.22 API change -dnl # Unused destroy_dirty_buffers arg removed from prototype. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_INVALIDATE_BDEV], [ - ZFS_LINUX_TEST_SRC([invalidate_bdev], [ - #include <linux/buffer_head.h> - ],[ - struct block_device *bdev = NULL; - invalidate_bdev(bdev); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_INVALIDATE_BDEV], [ - AC_MSG_CHECKING([whether invalidate_bdev() wants 1 arg]) - ZFS_LINUX_TEST_RESULT([invalidate_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-is_owner_or_cap.m4 b/config/kernel-is_owner_or_cap.m4 index ab8072409..3df6163da 100644 --- a/config/kernel-is_owner_or_cap.m4 +++ b/config/kernel-is_owner_or_cap.m4 @@ -11,33 +11,13 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OWNER_OR_CAPABLE], [ struct inode *ip = NULL; (void) inode_owner_or_capable(ip); ]) - - - ZFS_LINUX_TEST_SRC([is_owner_or_cap], [ - #include <linux/fs.h> - #include <linux/sched.h> - ],[ - struct inode *ip = NULL; - (void) is_owner_or_cap(ip); - ]) ]) AC_DEFUN([ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE], [ AC_MSG_CHECKING([whether inode_owner_or_capable() exists]) ZFS_LINUX_TEST_RESULT([inode_owner_or_capable], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1, - [inode_owner_or_capable() exists]) ],[ - AC_MSG_RESULT(no) - AC_MSG_CHECKING([whether is_owner_or_cap() exists]) - - ZFS_LINUX_TEST_RESULT([is_owner_or_cap], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_IS_OWNER_OR_CAP, 1, - [is_owner_or_cap() exists]) - ],[ - ZFS_LINUX_TEST_ERROR([capability]) - ]) + ZFS_LINUX_TEST_ERROR([capability]) ]) ]) diff --git a/config/kernel-kmap-atomic-args.m4 b/config/kernel-kmap-atomic-args.m4 index d09e93d7f..1172505af 100644 --- a/config/kernel-kmap-atomic-args.m4 +++ b/config/kernel-kmap-atomic-args.m4 @@ -16,9 +16,7 @@ AC_DEFUN([ZFS_AC_KERNEL_KMAP_ATOMIC_ARGS], [ AC_MSG_CHECKING([whether kmap_atomic wants 1 args]) ZFS_LINUX_TEST_RESULT([kmap_atomic], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_1ARG_KMAP_ATOMIC, 1, - [kmap_atomic wants 1 args]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([kmap_atomic()]) ]) ]) diff --git a/config/kernel-kmem-cache.m4 b/config/kernel-kmem-cache.m4 index 7576e6cfd..0e9fe9eb2 100644 --- a/config/kernel-kmem-cache.m4 +++ b/config/kernel-kmem-cache.m4 @@ -1,47 +1,4 @@ dnl # -dnl # 2.6.35 API change, -dnl # The cachep->gfpflags member was renamed cachep->allocflags. These are -dnl # private allocation flags which are applied when allocating a new slab -dnl # in kmem_getpages(). Unfortunately there is no public API for setting -dnl # non-default flags. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_KMEM_CACHE_ALLOCFLAGS], [ - ZFS_LINUX_TEST_SRC([kmem_cache_allocflags], [ - #include <linux/slab.h> - ],[ - struct kmem_cache cachep __attribute__ ((unused)); - cachep.allocflags = GFP_KERNEL; - ]) - - ZFS_LINUX_TEST_SRC([kmem_cache_gfpflags], [ - #include <linux/slab.h> - ],[ - struct kmem_cache cachep __attribute__ ((unused)); - cachep.gfpflags = GFP_KERNEL; - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE_ALLOCFLAGS], [ - AC_MSG_CHECKING([whether struct kmem_cache has allocflags]) - ZFS_LINUX_TEST_RESULT([kmem_cache_allocflags], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_KMEM_CACHE_ALLOCFLAGS, 1, - [struct kmem_cache has allocflags]) - ],[ - AC_MSG_RESULT(no) - - AC_MSG_CHECKING([whether struct kmem_cache has gfpflags]) - ZFS_LINUX_TEST_RESULT([kmem_cache_gfpflags], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_KMEM_CACHE_GFPFLAGS, 1, - [struct kmem_cache has gfpflags]) - ],[ - AC_MSG_RESULT(no) - ]) - ]) -]) - -dnl # dnl # grsecurity API change, dnl # kmem_cache_create() with SLAB_USERCOPY flag replaced by dnl # kmem_cache_create_usercopy(). @@ -76,11 +33,9 @@ AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY], [ ]) AC_DEFUN([ZFS_AC_KERNEL_SRC_KMEM_CACHE], [ - ZFS_AC_KERNEL_SRC_KMEM_CACHE_ALLOCFLAGS ZFS_AC_KERNEL_SRC_KMEM_CACHE_CREATE_USERCOPY ]) AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE], [ - ZFS_AC_KERNEL_KMEM_CACHE_ALLOCFLAGS ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY ]) diff --git a/config/kernel-kstrtoul.m4 b/config/kernel-kstrtoul.m4 index ef3c9843c..8e4b54297 100644 --- a/config/kernel-kstrtoul.m4 +++ b/config/kernel-kstrtoul.m4 @@ -1,8 +1,6 @@ dnl # dnl # 2.6.39 API change -dnl # -dnl # If kstrtoul() doesn't exist, fallback to use strict_strtoul() which has -dnl # existed since 2.6.25. +dnl # Added kstrtoul() dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_KSTRTOUL], [ ZFS_LINUX_TEST_SRC([kstrtoul], [ @@ -18,6 +16,6 @@ AC_DEFUN([ZFS_AC_KERNEL_KSTRTOUL], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_KSTRTOUL, 1, [kstrtoul() exists]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([kstrtoul()]) ]) ]) diff --git a/config/kernel-kuid-helpers.m4 b/config/kernel-kuid-helpers.m4 index 4bc4e039d..38a439fa6 100644 --- a/config/kernel-kuid-helpers.m4 +++ b/config/kernel-kuid-helpers.m4 @@ -18,9 +18,7 @@ AC_DEFUN([ZFS_AC_KERNEL_KUID_HELPERS], [ AC_MSG_CHECKING([whether i_(uid|gid)_(read|write) exist]) ZFS_LINUX_TEST_RESULT([i_uid_read], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_KUID_HELPERS, 1, - [i_(uid|gid)_(read|write) exist]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([i_uid_read]) ]) ]) diff --git a/config/kernel-kuidgid.m4 b/config/kernel-kuidgid.m4 index 15bf98154..b7e441408 100644 --- a/config/kernel-kuidgid.m4 +++ b/config/kernel-kuidgid.m4 @@ -1,34 +1,21 @@ dnl # -dnl # User namespaces, use kuid_t in place of uid_t -dnl # where available. Not strictly a user namespaces thing -dnl # but it should prevent surprises +dnl # 3.8 API change, +dnl # User namespaces, use kuid_t in place of uid_t where available. dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_KUIDGID_T], [ - ZFS_LINUX_TEST_SRC([kuidgid_t_init], [ + ZFS_LINUX_TEST_SRC([kuidgid_t], [ #include <linux/uidgid.h> ], [ kuid_t userid __attribute__ ((unused)) = KUIDT_INIT(0); kgid_t groupid __attribute__ ((unused)) = KGIDT_INIT(0); ]) - - ZFS_LINUX_TEST_SRC([kuidgid_t], [ - #include <linux/uidgid.h> - ], [ - kuid_t userid __attribute__ ((unused)) = 0; - kgid_t groupid __attribute__ ((unused)) = 0; - ]) ]) AC_DEFUN([ZFS_AC_KERNEL_KUIDGID_T], [ AC_MSG_CHECKING([whether kuid_t/kgid_t is available]) - ZFS_LINUX_TEST_RESULT([kuidgid_t_init], [ - ZFS_LINUX_TEST_RESULT([kuidgid_t], [ - AC_MSG_RESULT(yes; optional) - ],[ - AC_MSG_RESULT(yes; mandatory) - AC_DEFINE(HAVE_KUIDGID_T, 1, [kuid_t/kgid_t in use]) - ]) + ZFS_LINUX_TEST_RESULT([kuidgid_t], [ + AC_MSG_RESULT(yes) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([kuid_t/kgid_t]) ]) ]) diff --git a/config/kernel-lookup-bdev.m4 b/config/kernel-lookup-bdev.m4 deleted file mode 100644 index 72b4993e1..000000000 --- a/config/kernel-lookup-bdev.m4 +++ /dev/null @@ -1,39 +0,0 @@ -dnl # -dnl # 2.6.27, lookup_bdev() was exported. -dnl # 4.4.0-6.21 - x.y on Ubuntu, lookup_bdev() takes 2 arguments. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_LOOKUP_BDEV], [ - ZFS_LINUX_TEST_SRC([lookup_bdev_1arg], [ - #include <linux/fs.h> - ], [ - lookup_bdev(NULL); - ]) - - ZFS_LINUX_TEST_SRC([lookup_bdev_2args], [ - #include <linux/fs.h> - ], [ - lookup_bdev(NULL, FMODE_READ); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_BDEV], [ - AC_MSG_CHECKING([whether lookup_bdev() wants 1 arg]) - ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_1arg], - [lookup_bdev], [fs/block_dev.c], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_1ARG_LOOKUP_BDEV, 1, - [lookup_bdev() wants 1 arg]) - ], [ - AC_MSG_RESULT(no) - - AC_MSG_CHECKING([whether lookup_bdev() wants 2 args]) - ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_2args], - [lookup_bdev], [fs/block_dev.c], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_2ARGS_LOOKUP_BDEV, 1, - [lookup_bdev() wants 2 args]) - ], [ - AC_MSG_RESULT(no) - ]) - ]) -]) diff --git a/config/kernel-lookup-nameidata.m4 b/config/kernel-lookup-nameidata.m4 deleted file mode 100644 index 865b8aff8..000000000 --- a/config/kernel-lookup-nameidata.m4 +++ /dev/null @@ -1,29 +0,0 @@ -dnl # -dnl # 3.6 API change -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_LOOKUP_NAMEIDATA], [ - ZFS_LINUX_TEST_SRC([lookup_nameidata], [ - #include <linux/fs.h> - #include <linux/sched.h> - - struct dentry *inode_lookup(struct inode *inode, - struct dentry *dentry, struct nameidata *nidata) - { return NULL; } - - static const struct inode_operations iops - __attribute__ ((unused)) = { - .lookup = inode_lookup, - }; - ],[]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [ - AC_MSG_CHECKING([whether iops->lookup() passes nameidata]) - ZFS_LINUX_TEST_RESULT([lookup_nameidata], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_LOOKUP_NAMEIDATA, 1, - [iops->lookup() passes nameidata]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-make-request-fn.m4 b/config/kernel-make-request-fn.m4 index 86339aa04..5183176f5 100644 --- a/config/kernel-make-request-fn.m4 +++ b/config/kernel-make-request-fn.m4 @@ -2,14 +2,6 @@ dnl # dnl # Check for make_request_fn interface. dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN], [ - ZFS_LINUX_TEST_SRC([make_request_fn_int], [ - #include <linux/blkdev.h> - int make_request(struct request_queue *q, - struct bio *bio) { return (0); } - ],[ - blk_queue_make_request(NULL, &make_request); - ]) - ZFS_LINUX_TEST_SRC([make_request_fn_void], [ #include <linux/blkdev.h> void make_request(struct request_queue *q, @@ -29,49 +21,34 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN], [ AC_DEFUN([ZFS_AC_KERNEL_MAKE_REQUEST_FN], [ dnl # - dnl # Legacy API - dnl # make_request_fn returns int. + dnl # Linux 3.2 API Change + dnl # make_request_fn returns void. dnl # - AC_MSG_CHECKING([whether make_request_fn() returns int]) - ZFS_LINUX_TEST_RESULT([make_request_fn_int], [ + AC_MSG_CHECKING([whether make_request_fn() returns void]) + ZFS_LINUX_TEST_RESULT([make_request_fn_void], [ AC_MSG_RESULT(yes) - AC_DEFINE(MAKE_REQUEST_FN_RET, int, + AC_DEFINE(MAKE_REQUEST_FN_RET, void, [make_request_fn() return type]) - AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_INT, 1, - [Noting that make_request_fn() returns int]) + AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_VOID, 1, + [Noting that make_request_fn() returns void]) ],[ AC_MSG_RESULT(no) dnl # - dnl # Linux 3.2 API Change - dnl # make_request_fn returns void. + dnl # Linux 4.4 API Change + dnl # make_request_fn returns blk_qc_t. dnl # - AC_MSG_CHECKING([whether make_request_fn() returns void]) - ZFS_LINUX_TEST_RESULT([make_request_fn_void], [ + AC_MSG_CHECKING( + [whether make_request_fn() returns blk_qc_t]) + ZFS_LINUX_TEST_RESULT([make_request_fn_blk_qc_t], [ AC_MSG_RESULT(yes) - AC_DEFINE(MAKE_REQUEST_FN_RET, void, + AC_DEFINE(MAKE_REQUEST_FN_RET, blk_qc_t, [make_request_fn() return type]) - AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_VOID, 1, - [Noting that make_request_fn() returns void]) + AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_QC, 1, + [Noting that make_request_fn() ] + [returns blk_qc_t]) ],[ - AC_MSG_RESULT(no) - - dnl # - dnl # Linux 4.4 API Change - dnl # make_request_fn returns blk_qc_t. - dnl # - AC_MSG_CHECKING( - [whether make_request_fn() returns blk_qc_t]) - ZFS_LINUX_TEST_RESULT([make_request_fn_blk_qc_t], [ - AC_MSG_RESULT(yes) - AC_DEFINE(MAKE_REQUEST_FN_RET, blk_qc_t, - [make_request_fn() return type]) - AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_QC, 1, - [Noting that make_request_fn() ] - [returns blk_qc_t]) - ],[ - ZFS_LINUX_TEST_ERROR([make_request_fn]) - ]) + ZFS_LINUX_TEST_ERROR([make_request_fn]) ]) ]) ]) diff --git a/config/kernel-mkdir-umode-t.m4 b/config/kernel-mkdir-umode-t.m4 index f4dde29a3..19599670d 100644 --- a/config/kernel-mkdir-umode-t.m4 +++ b/config/kernel-mkdir-umode-t.m4 @@ -27,6 +27,6 @@ AC_DEFUN([ZFS_AC_KERNEL_MKDIR_UMODE_T], [ AC_DEFINE(HAVE_MKDIR_UMODE_T, 1, [iops->create()/mkdir()/mknod() take umode_t]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([mkdir()]) ]) ]) diff --git a/config/kernel-open-bdev-exclusive.m4 b/config/kernel-open-bdev-exclusive.m4 deleted file mode 100644 index 2e46b8876..000000000 --- a/config/kernel-open-bdev-exclusive.m4 +++ /dev/null @@ -1,23 +0,0 @@ -dnl # -dnl # 2.6.28 API change -dnl # open/close_bdev_excl() renamed to open/close_bdev_exclusive() -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BDEV_OPEN_EXCLUSIVE], [ - ZFS_LINUX_TEST_SRC([open_bdev_exclusive], [ - #include <linux/fs.h> - ], [ - open_bdev_exclusive(NULL, 0, NULL); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BDEV_OPEN_EXCLUSIVE], [ - AC_MSG_CHECKING([whether open_bdev_exclusive() is available]) - ZFS_LINUX_TEST_RESULT_SYMBOL([open_bdev_exclusive], - [open_bdev_exclusive], [fs/block_dev.c], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_OPEN_BDEV_EXCLUSIVE, 1, - [open_bdev_exclusive() is available]) - ], [ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-pde-data.m4 b/config/kernel-pde-data.m4 index 928c5ef0d..f866d77a1 100644 --- a/config/kernel-pde-data.m4 +++ b/config/kernel-pde-data.m4 @@ -14,8 +14,7 @@ AC_DEFUN([ZFS_AC_KERNEL_PDE_DATA], [ AC_MSG_CHECKING([whether PDE_DATA() is available]) ZFS_LINUX_TEST_RESULT_SYMBOL([pde_data], [PDE_DATA], [], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_PDE_DATA, 1, [PDE_DATA is available]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([PDE_DATA]) ]) ]) diff --git a/config/kernel-rwsem.m4 b/config/kernel-rwsem.m4 index 67c5cf908..824f4a3ff 100644 --- a/config/kernel-rwsem.m4 +++ b/config/kernel-rwsem.m4 @@ -19,10 +19,8 @@ AC_DEFUN([ZFS_AC_KERNEL_RWSEM_SPINLOCK_IS_RAW], [ AC_MSG_CHECKING([whether struct rw_semaphore member wait_lock is raw]) ZFS_LINUX_TEST_RESULT([rwsem_spinlock_is_raw], [ AC_MSG_RESULT(yes) - AC_DEFINE(RWSEM_SPINLOCK_IS_RAW, 1, - [struct rw_semaphore member wait_lock is raw_spinlock_t]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([rwsem_spinlock_is_raw]) ]) ]) diff --git a/config/kernel-sched.m4 b/config/kernel-sched.m4 index 4a7db970a..17e49fbdf 100644 --- a/config/kernel-sched.m4 +++ b/config/kernel-sched.m4 @@ -14,10 +14,9 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SCHED_RT_HEADER], [ AC_DEFUN([ZFS_AC_KERNEL_SCHED_RT_HEADER], [ AC_MSG_CHECKING([whether header linux/sched/rt.h exists]) ZFS_LINUX_TEST_RESULT([sched_rt_header], [ - AC_DEFINE(HAVE_SCHED_RT_HEADER, 1, [linux/sched/rt.h exists]) AC_MSG_RESULT(yes) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([sched_rt_header]) ]) ]) diff --git a/config/kernel-security-inode-init.m4 b/config/kernel-security-inode-init.m4 index 0dea7e392..4e4bfd29b 100644 --- a/config/kernel-security-inode-init.m4 +++ b/config/kernel-security-inode-init.m4 @@ -1,37 +1,4 @@ dnl # -dnl # 2.6.39 API change -dnl # The security_inode_init_security() function now takes an additional -dnl # qstr argument which must be passed in from the dentry if available. -dnl # Passing a NULL is safe when no qstr is available the relevant -dnl # security checks will just be skipped. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_SECURITY_INODE_INIT_SECURITY_6ARGS], [ - ZFS_LINUX_TEST_SRC([security_inode_init_security_6args], [ - #include <linux/security.h> - ],[ - struct inode *ip __attribute__ ((unused)) = NULL; - struct inode *dip __attribute__ ((unused)) = NULL; - const struct qstr *str __attribute__ ((unused)) = NULL; - char *name __attribute__ ((unused)) = NULL; - void *value __attribute__ ((unused)) = NULL; - size_t len __attribute__ ((unused)) = 0; - - security_inode_init_security(ip, dip, str, &name, &value, &len); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_SECURITY_INODE_INIT_SECURITY_6ARGS], [ - AC_MSG_CHECKING([whether security_inode_init_security wants 6 args]) - ZFS_LINUX_TEST_RESULT([security_inode_init_security_6args], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_6ARGS_SECURITY_INODE_INIT_SECURITY, 1, - [security_inode_init_security wants 6 args]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -dnl # dnl # 3.2 API change dnl # The security_inode_init_security() API has been changed to include dnl # a filesystem specific callback to write security extended attributes. @@ -55,19 +22,15 @@ AC_DEFUN([ZFS_AC_KERNEL_SECURITY_INODE_INIT_SECURITY_CALLBACK], [ AC_MSG_CHECKING([whether security_inode_init_security wants callback]) ZFS_LINUX_TEST_RESULT([security_inode_init_security], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_CALLBACK_SECURITY_INODE_INIT_SECURITY, 1, - [security_inode_init_security wants callback]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([security_inode_init_security callback]) ]) ]) AC_DEFUN([ZFS_AC_KERNEL_SRC_SECURITY_INODE], [ - ZFS_AC_KERNEL_SRC_SECURITY_INODE_INIT_SECURITY_6ARGS ZFS_AC_KERNEL_SRC_SECURITY_INODE_INIT_SECURITY_CALLBACK ]) AC_DEFUN([ZFS_AC_KERNEL_SECURITY_INODE], [ - ZFS_AC_KERNEL_SECURITY_INODE_INIT_SECURITY_6ARGS ZFS_AC_KERNEL_SECURITY_INODE_INIT_SECURITY_CALLBACK ]) diff --git a/config/kernel-set-nlink.m4 b/config/kernel-set-nlink.m4 index 63a5a8c0d..fa4f928b2 100644 --- a/config/kernel-set-nlink.m4 +++ b/config/kernel-set-nlink.m4 @@ -1,6 +1,6 @@ dnl # -dnl # Linux v3.2-rc1 API change -dnl # SHA: bfe8684869601dacfcb2cd69ef8cfd9045f62170 +dnl # Linux 3.2 API change +dnl # set_nlink() dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_SET_NLINK], [ ZFS_LINUX_TEST_SRC([set_nlink], [ @@ -16,8 +16,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SET_NLINK], [ AC_MSG_CHECKING([whether set_nlink() is available]) ZFS_LINUX_TEST_RESULT([set_nlink], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SET_NLINK, 1, [set_nlink() is available]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([set_nlink()]) ]) ]) diff --git a/config/kernel-sget-args.m4 b/config/kernel-sget-args.m4 index 13581399e..afa62c797 100644 --- a/config/kernel-sget-args.m4 +++ b/config/kernel-sget-args.m4 @@ -19,8 +19,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SGET], [ AC_MSG_CHECKING([whether sget() wants 5 args]) ZFS_LINUX_TEST_RESULT([sget_5args], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_5ARG_SGET, 1, [sget() wants 5 args]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([sget()]) ]) ]) diff --git a/config/kernel-show-options.m4 b/config/kernel-show-options.m4 index 9e426bc39..93bd5fbfb 100644 --- a/config/kernel-show-options.m4 +++ b/config/kernel-show-options.m4 @@ -19,9 +19,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SHOW_OPTIONS], [ AC_MSG_CHECKING([whether sops->show_options() wants dentry]) ZFS_LINUX_TEST_RESULT([super_operations_show_options], [ AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_SHOW_OPTIONS_WITH_DENTRY, 1, - [sops->show_options() with dentry]) ],[ - AC_MSG_RESULT([no]) + ZFS_LINUX_TEST_ERROR([sops->show_options()]) ]) ]) diff --git a/config/kernel-shrink.m4 b/config/kernel-shrink.m4 index 45b4b5d4b..a40c86d5c 100644 --- a/config/kernel-shrink.m4 +++ b/config/kernel-shrink.m4 @@ -13,7 +13,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK], [ static const struct super_block sb __attribute__ ((unused)) = { - .s_shrink.shrink = shrink, .s_shrink.seeks = DEFAULT_SEEKS, .s_shrink.batch = 0, }; @@ -24,101 +23,8 @@ AC_DEFUN([ZFS_AC_KERNEL_SUPER_BLOCK_S_SHRINK], [ AC_MSG_CHECKING([whether super_block has s_shrink]) ZFS_LINUX_TEST_RESULT([super_block_s_shrink], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SHRINK, 1, [struct super_block has s_shrink]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -dnl # -dnl # 3.3 API change -dnl # The super_block structure was changed to use an hlist_node instead -dnl # of a list_head for the .s_instance linkage. -dnl # -dnl # This was done in part to resolve a race in the iterate_supers_type() -dnl # function which was introduced in Linux 3.0 kernel. The iterator -dnl # was supposed to provide a safe way to call an arbitrary function on -dnl # all super blocks of a specific type. Unfortunately, because a -dnl # list_head was used it was possible for iterate_supers_type() to -dnl # get stuck spinning a super block which was just deactivated. -dnl # -dnl # This can occur because when the list head is removed from the -dnl # fs_supers list it is reinitialized to point to itself. If the -dnl # iterate_supers_type() function happened to be processing the -dnl # removed list_head it will get stuck spinning on that list_head. -dnl # -dnl # To resolve the issue for existing 3.0 - 3.2 kernels we detect when -dnl # a list_head is used. Then to prevent the spinning from occurring -dnl # the .next pointer is set to the fs_supers list_head which ensures -dnl # the iterate_supers_type() function will always terminate. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_INSTANCES_LIST_HEAD], [ - ZFS_LINUX_TEST_SRC([super_block_s_instances_list_head], [ - #include <linux/fs.h> - ],[ - struct super_block sb __attribute__ ((unused)); - INIT_LIST_HEAD(&sb.s_instances); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_SUPER_BLOCK_S_INSTANCES_LIST_HEAD], [ - AC_MSG_CHECKING([whether super_block has s_instances list_head]) - ZFS_LINUX_TEST_RESULT([super_block_s_instances_list_head], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_S_INSTANCES_LIST_HEAD, 1, - [struct super_block has s_instances list_head]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_SRC_NR_CACHED_OBJECTS], [ - ZFS_LINUX_TEST_SRC([nr_cached_objects], [ - #include <linux/fs.h> - - int nr_cached_objects(struct super_block *sb) { return 0; } - - static const struct super_operations - sops __attribute__ ((unused)) = { - .nr_cached_objects = nr_cached_objects, - }; - ],[]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_NR_CACHED_OBJECTS], [ - AC_MSG_CHECKING([whether sops->nr_cached_objects() exists]) - ZFS_LINUX_TEST_RESULT([nr_cached_objects], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_NR_CACHED_OBJECTS, 1, - [sops->nr_cached_objects() exists]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_SRC_FREE_CACHED_OBJECTS], [ - ZFS_LINUX_TEST_SRC([free_cached_objects], [ - #include <linux/fs.h> - - void free_cached_objects(struct super_block *sb, int x) - { return; } - - static const struct super_operations - sops __attribute__ ((unused)) = { - .free_cached_objects = free_cached_objects, - }; - ],[]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_FREE_CACHED_OBJECTS], [ - AC_MSG_CHECKING([whether sops->free_cached_objects() exists]) - ZFS_LINUX_TEST_RESULT([free_cached_objects], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_FREE_CACHED_OBJECTS, 1, - [sops->free_cached_objects() exists]) - ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([sb->s_shrink()]) ]) ]) @@ -149,29 +55,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID], [ ]) AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER_CALLBACK], [ - ZFS_LINUX_TEST_SRC([shrinker_cb_2arg], [ - #include <linux/mm.h> - int shrinker_cb(int nr_to_scan, gfp_t gfp_mask) { return 0; } - ],[ - struct shrinker cache_shrinker = { - .shrink = shrinker_cb, - .seeks = DEFAULT_SEEKS, - }; - register_shrinker(&cache_shrinker); - ]) - - ZFS_LINUX_TEST_SRC([shrinker_cb_3arg], [ - #include <linux/mm.h> - int shrinker_cb(struct shrinker *shrink, int nr_to_scan, - gfp_t gfp_mask) { return 0; } - ],[ - struct shrinker cache_shrinker = { - .shrink = shrinker_cb, - .seeks = DEFAULT_SEEKS, - }; - register_shrinker(&cache_shrinker); - ]) - ZFS_LINUX_TEST_SRC([shrinker_cb_shrink_control], [ #include <linux/mm.h> int shrinker_cb(struct shrinker *shrink, @@ -200,60 +83,29 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER_CALLBACK], [ AC_DEFUN([ZFS_AC_KERNEL_SHRINKER_CALLBACK],[ dnl # - dnl # 2.6.23 to 2.6.34 API change - dnl # ->shrink(int nr_to_scan, gfp_t gfp_mask) + dnl # 3.0 - 3.11 API change + dnl # ->shrink(struct shrinker *, struct shrink_control *sc) dnl # - AC_MSG_CHECKING([whether old 2-argument shrinker exists]) - ZFS_LINUX_TEST_RESULT([shrinker_cb_2arg], [ + AC_MSG_CHECKING([whether new 2-argument shrinker exists]) + ZFS_LINUX_TEST_RESULT([shrinker_cb_shrink_control], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_2ARGS_OLD_SHRINKER_CALLBACK, 1, - [old shrinker callback wants 2 args]) + AC_DEFINE(HAVE_SINGLE_SHRINKER_CALLBACK, 1, + [new shrinker callback wants 2 args]) ],[ AC_MSG_RESULT(no) dnl # - dnl # 2.6.35 - 2.6.39 API change - dnl # ->shrink(struct shrinker *, - dnl # int nr_to_scan, gfp_t gfp_mask) + dnl # 3.12 API change, + dnl # ->shrink() is logically split in to + dnl # ->count_objects() and ->scan_objects() dnl # - AC_MSG_CHECKING([whether old 3-argument shrinker exists]) - ZFS_LINUX_TEST_RESULT([shrinker_cb_3arg], [ + AC_MSG_CHECKING([whether ->count_objects callback exists]) + ZFS_LINUX_TEST_RESULT([shrinker_cb_shrink_control_split], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1, - [old shrinker callback wants 3 args]) + AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK, 1, + [->count_objects exists]) ],[ - AC_MSG_RESULT(no) - - dnl # - dnl # 3.0 - 3.11 API change - dnl # ->shrink(struct shrinker *, - dnl # struct shrink_control *sc) - dnl # - AC_MSG_CHECKING( - [whether new 2-argument shrinker exists]) - ZFS_LINUX_TEST_RESULT([shrinker_cb_shrink_control], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_2ARGS_NEW_SHRINKER_CALLBACK, 1, - [new shrinker callback wants 2 args]) - ],[ - AC_MSG_RESULT(no) - - dnl # - dnl # 3.12 API change, - dnl # ->shrink() is logically split in to - dnl # ->count_objects() and ->scan_objects() - dnl # - AC_MSG_CHECKING( - [whether ->count_objects callback exists]) - ZFS_LINUX_TEST_RESULT( - [shrinker_cb_shrink_control_split], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK, - 1, [->count_objects exists]) - ],[ - ZFS_LINUX_TEST_ERROR([shrinker]) - ]) - ]) + ZFS_LINUX_TEST_ERROR([shrinker]) ]) ]) ]) @@ -280,15 +132,12 @@ AC_DEFUN([ZFS_AC_KERNEL_SHRINK_CONTROL_STRUCT], [ AC_DEFINE(HAVE_SHRINK_CONTROL_STRUCT, 1, [struct shrink_control exists]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([shrink_control]) ]) ]) AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER], [ ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK - ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_INSTANCES_LIST_HEAD - ZFS_AC_KERNEL_SRC_NR_CACHED_OBJECTS - ZFS_AC_KERNEL_SRC_FREE_CACHED_OBJECTS ZFS_AC_KERNEL_SRC_SHRINK_CONTROL_HAS_NID ZFS_AC_KERNEL_SRC_SHRINKER_CALLBACK ZFS_AC_KERNEL_SRC_SHRINK_CONTROL_STRUCT @@ -296,9 +145,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER], [ AC_DEFUN([ZFS_AC_KERNEL_SHRINKER], [ ZFS_AC_KERNEL_SUPER_BLOCK_S_SHRINK - ZFS_AC_KERNEL_SUPER_BLOCK_S_INSTANCES_LIST_HEAD - ZFS_AC_KERNEL_NR_CACHED_OBJECTS - ZFS_AC_KERNEL_FREE_CACHED_OBJECTS ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID ZFS_AC_KERNEL_SHRINKER_CALLBACK ZFS_AC_KERNEL_SHRINK_CONTROL_STRUCT diff --git a/config/kernel-submit_bio.m4 b/config/kernel-submit_bio.m4 deleted file mode 100644 index cf80e9b83..000000000 --- a/config/kernel-submit_bio.m4 +++ /dev/null @@ -1,24 +0,0 @@ -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_SRC_SUBMIT_BIO], [ - ZFS_LINUX_TEST_SRC([submit_bio], [ - #include <linux/bio.h> - ],[ - blk_qc_t blk_qc; - struct bio *bio = NULL; - blk_qc = submit_bio(bio); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_SUBMIT_BIO], [ - AC_MSG_CHECKING([whether submit_bio() wants 1 arg]) - ZFS_LINUX_TEST_RESULT([submit_bio], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_1ARG_SUBMIT_BIO, 1, [submit_bio() wants 1 arg]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-truncate-range.m4 b/config/kernel-truncate-range.m4 deleted file mode 100644 index 8fdbb1086..000000000 --- a/config/kernel-truncate-range.m4 +++ /dev/null @@ -1,27 +0,0 @@ -dnl # -dnl # 3.5.0 API change -dnl # torvalds/linux@17cf28afea2a1112f240a3a2da8af883be024811 removed -dnl # truncate_range(). The file hole punching functionality is now -dnl # provided by fallocate() -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_TRUNCATE_RANGE], [ - ZFS_LINUX_TEST_SRC([inode_operations_truncate_range], [ - #include <linux/fs.h> - void truncate_range(struct inode *inode, loff_t start, - loff_t end) { return; } - static struct inode_operations iops __attribute__ ((unused)) = { - .truncate_range = truncate_range, - }; - ],[]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_TRUNCATE_RANGE], [ - AC_MSG_CHECKING([whether iops->truncate_range() exists]) - ZFS_LINUX_TEST_RESULT([inode_operations_truncate_range], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_INODE_TRUNCATE_RANGE, 1, - [iops->truncate_range() exists]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff --git a/config/kernel-truncate-setsize.m4 b/config/kernel-truncate-setsize.m4 index e719c1444..76c82ef30 100644 --- a/config/kernel-truncate-setsize.m4 +++ b/config/kernel-truncate-setsize.m4 @@ -15,9 +15,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TRUNCATE_SETSIZE], [ ZFS_LINUX_TEST_RESULT_SYMBOL([truncate_setsize], [truncate_setsize], [mm/truncate.c], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_TRUNCATE_SETSIZE, 1, - [truncate_setsize() is available]) ], [ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([truncate_setsize]) ]) ]) diff --git a/config/kernel-userns-capabilities.m4 b/config/kernel-userns-capabilities.m4 index 5dcbc03d3..68a7bd62c 100644 --- a/config/kernel-userns-capabilities.m4 +++ b/config/kernel-userns-capabilities.m4 @@ -14,17 +14,14 @@ AC_DEFUN([ZFS_AC_KERNEL_NS_CAPABLE], [ AC_MSG_CHECKING([whether ns_capable exists]) ZFS_LINUX_TEST_RESULT([ns_capable], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_NS_CAPABLE, 1, [ns_capable exists]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([ns_capable()]) ]) ]) dnl # dnl # 2.6.39 API change -dnl # struct user_namespace was added to struct cred_t as -dnl # cred->user_ns member -dnl # Note that current_user_ns() was added in 2.6.28. +dnl # struct user_namespace was added to struct cred_t as cred->user_ns member dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_CRED_USER_NS], [ ZFS_LINUX_TEST_SRC([cred_user_ns], [ @@ -39,9 +36,8 @@ AC_DEFUN([ZFS_AC_KERNEL_CRED_USER_NS], [ AC_MSG_CHECKING([whether cred_t->user_ns exists]) ZFS_LINUX_TEST_RESULT([cred_user_ns], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_CRED_USER_NS, 1, [cred_t->user_ns exists]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([cred_t->user_ns()]) ]) ]) @@ -63,10 +59,8 @@ AC_DEFUN([ZFS_AC_KERNEL_KUID_HAS_MAPPING], [ AC_MSG_CHECKING([whether kuid_has_mapping/kgid_has_mapping exist]) ZFS_LINUX_TEST_RESULT([kuid_has_mapping], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_KUID_HAS_MAPPING, 1, - [kuid_has_mapping/kgid_has_mapping exist]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([kuid_has_mapping()]) ]) ]) diff --git a/config/kernel-usleep_range.m4 b/config/kernel-usleep_range.m4 index 5bf051ab4..06eb381a3 100644 --- a/config/kernel-usleep_range.m4 +++ b/config/kernel-usleep_range.m4 @@ -17,8 +17,7 @@ AC_DEFUN([ZFS_AC_KERNEL_USLEEP_RANGE], [ AC_MSG_CHECKING([whether usleep_range() is available]) ZFS_LINUX_TEST_RESULT([usleep_range], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_USLEEP_RANGE, 1, [usleep_range is available]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([usleep_range()]) ]) ]) diff --git a/config/kernel-vfs-fsync.m4 b/config/kernel-vfs-fsync.m4 index 18a60d29a..159efca45 100644 --- a/config/kernel-vfs-fsync.m4 +++ b/config/kernel-vfs-fsync.m4 @@ -14,8 +14,7 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_FSYNC_2ARGS], [ AC_MSG_CHECKING([whether vfs_fsync() wants 2 args]) ZFS_LINUX_TEST_RESULT([vfs_fsync_2args], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_2ARGS_VFS_FSYNC, 1, [vfs_fsync() wants 2 args]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([vfs_fsync()]) ]) ]) diff --git a/config/kernel-xattr-handler.m4 b/config/kernel-xattr-handler.m4 index ed84c6390..137bf4a8a 100644 --- a/config/kernel-xattr-handler.m4 +++ b/config/kernel-xattr-handler.m4 @@ -28,10 +28,8 @@ AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER], [ AC_MSG_CHECKING([whether super_block uses const struct xattr_handler]) ZFS_LINUX_TEST_RESULT([const_xattr_handler], [ AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_CONST_XATTR_HANDLER, 1, - [super_block uses const struct xattr_handler]) ],[ - AC_MSG_RESULT([no]) + ZFS_LINUX_TEST_ERROR([const xattr_handler]) ]) ]) @@ -102,17 +100,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET], [ .get = get, }; ],[]) - - ZFS_LINUX_TEST_SRC([xattr_handler_get_inode], [ - #include <linux/xattr.h> - - int get(struct inode *ip, const char *name, - void *buffer, size_t size) { return 0; } - static const struct xattr_handler - xops __attribute__ ((unused)) = { - .get = get, - }; - ],[]) ]) AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [ @@ -155,20 +142,7 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [ AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1, [xattr_handler->get() wants dentry]) ],[ - dnl # - dnl # Legacy 2.6.32 API - dnl # - AC_MSG_RESULT(no) - AC_MSG_CHECKING( - [whether xattr_handler->get() wants inode]) - ZFS_LINUX_TEST_RESULT( - [xattr_handler_get_inode], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_XATTR_GET_INODE, 1, - [xattr_handler->get() wants inode]) - ],[ - ZFS_LINUX_TEST_ERROR([xattr get()]) - ]) + ZFS_LINUX_TEST_ERROR([xattr get()]) ]) ]) ]) @@ -216,18 +190,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [ .set = set, }; ],[]) - - ZFS_LINUX_TEST_SRC([xattr_handler_set_inode], [ - #include <linux/xattr.h> - - int set(struct inode *ip, const char *name, - const void *buffer, size_t size, int flags) - { return 0; } - static const struct xattr_handler - xops __attribute__ ((unused)) = { - .set = set, - }; - ],[]) ]) AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [ @@ -270,20 +232,7 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [ AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1, [xattr_handler->set() wants dentry]) ],[ - dnl # - dnl # Legacy 2.6.32 API - dnl # - AC_MSG_RESULT(no) - AC_MSG_CHECKING( - [whether xattr_handler->set() wants inode]) - ZFS_LINUX_TEST_RESULT( - [xattr_handler_set_inode], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_XATTR_SET_INODE, 1, - [xattr_handler->set() wants inode]) - ],[ - ZFS_LINUX_TEST_ERROR([xattr set()]) - ]) + ZFS_LINUX_TEST_ERROR([xattr set()]) ]) ]) ]) @@ -327,18 +276,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST], [ .list = list, }; ],[]) - - ZFS_LINUX_TEST_SRC([xattr_handler_list_inode], [ - #include <linux/xattr.h> - - size_t list(struct inode *ip, char *lst, - size_t list_size, const char *name, - size_t name_len) { return 0; } - static const struct xattr_handler - xops __attribute__ ((unused)) = { - .list = list, - }; - ],[]) ]) AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [ @@ -379,20 +316,7 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [ AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1, [xattr_handler->list() wants dentry]) ],[ - dnl # - dnl # Legacy 2.6.32 API - dnl # - AC_MSG_RESULT(no) - AC_MSG_CHECKING( - [whether xattr_handler->list() wants inode]) - ZFS_LINUX_TEST_RESULT( - [xattr_handler_list_inode], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_XATTR_LIST_INODE, 1, - [xattr_handler->list() wants inode]) - ],[ - ZFS_LINUX_TEST_ERROR([xattr list()]) - ]) + ZFS_LINUX_TEST_ERROR([xattr list()]) ]) ]) ]) @@ -420,7 +344,7 @@ AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [ AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1, [posix_acl_from_xattr() needs user_ns]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([posix_acl_from_xattr()]) ]) ]) diff --git a/config/kernel-zlib.m4 b/config/kernel-zlib.m4 index d554d1168..752d38838 100644 --- a/config/kernel-zlib.m4 +++ b/config/kernel-zlib.m4 @@ -21,6 +21,6 @@ AC_DEFUN([ZFS_AC_KERNEL_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE], [ AC_DEFINE(HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE, 1, [zlib_deflate_workspacesize() wants 2 args]) ],[ - AC_MSG_RESULT(no) + ZFS_LINUX_TEST_ERROR([zlib_deflate_workspacesize()]) ]) ]) diff --git a/config/kernel.m4 b/config/kernel.m4 index b22a00cdd..1e39c15ca 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -37,7 +37,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_OBJTOOL ZFS_AC_KERNEL_SRC_GLOBAL_PAGE_STATE ZFS_AC_KERNEL_SRC_ACCESS_OK_TYPE - ZFS_AC_KERNEL_SRC_CTL_NAME ZFS_AC_KERNEL_SRC_PDE_DATA ZFS_AC_KERNEL_SRC_FALLOCATE ZFS_AC_KERNEL_SRC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE @@ -51,33 +50,11 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_GROUP_INFO_GID ZFS_AC_KERNEL_SRC_RW ZFS_AC_KERNEL_SRC_TIMER_SETUP - ZFS_AC_KERNEL_SRC_CURRENT_BIO_TAIL ZFS_AC_KERNEL_SRC_SUPER_USER_NS - ZFS_AC_KERNEL_SRC_SUBMIT_BIO ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS - ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH - ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART - ZFS_AC_KERNEL_SRC_INVALIDATE_BDEV - ZFS_AC_KERNEL_SRC_LOOKUP_BDEV - ZFS_AC_KERNEL_SRC_BDEV_OPEN_EXCLUSIVE - ZFS_AC_KERNEL_SRC_BDEV_LOGICAL_BLOCK_SIZE - ZFS_AC_KERNEL_SRC_BDEV_PHYSICAL_BLOCK_SIZE - ZFS_AC_KERNEL_SRC_BIO_BVEC_ITER - ZFS_AC_KERNEL_SRC_BIO_FAILFAST - ZFS_AC_KERNEL_SRC_BIO_SET_DEV - ZFS_AC_KERNEL_SRC_BIO_OPS - ZFS_AC_KERNEL_SRC_BIO_END_IO_T_ARGS - ZFS_AC_KERNEL_SRC_BIO_BI_STATUS - ZFS_AC_KERNEL_SRC_BIO_RW_BARRIER - ZFS_AC_KERNEL_SRC_BIO_RW_DISCARD - ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI - ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD - ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE - ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAGS - ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH - ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS - ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS - ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG + ZFS_AC_KERNEL_SRC_BIO + ZFS_AC_KERNEL_SRC_BLKDEV + ZFS_AC_KERNEL_SRC_BLK_QUEUE ZFS_AC_KERNEL_SRC_GET_DISK_AND_MODULE ZFS_AC_KERNEL_SRC_GET_DISK_RO ZFS_AC_KERNEL_SRC_GENERIC_READLINK_GLOBAL @@ -97,12 +74,11 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_DIRTY_INODE ZFS_AC_KERNEL_SRC_SHRINKER ZFS_AC_KERNEL_SRC_MKDIR_UMODE_T - ZFS_AC_KERNEL_SRC_LOOKUP_NAMEIDATA - ZFS_AC_KERNEL_SRC_CREATE_NAMEIDATA + ZFS_AC_KERNEL_SRC_LOOKUP_FLAGS + ZFS_AC_KERNEL_SRC_CREATE_FLAGS ZFS_AC_KERNEL_SRC_GET_LINK ZFS_AC_KERNEL_SRC_PUT_LINK ZFS_AC_KERNEL_SRC_TMPFILE - ZFS_AC_KERNEL_SRC_TRUNCATE_RANGE ZFS_AC_KERNEL_SRC_AUTOMOUNT ZFS_AC_KERNEL_SRC_ENCODE_FH_WITH_INODE ZFS_AC_KERNEL_SRC_COMMIT_METADATA @@ -154,7 +130,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_ACCESS_OK_TYPE ZFS_AC_KERNEL_GLOBAL_PAGE_STATE ZFS_AC_KERNEL_OBJTOOL - ZFS_AC_KERNEL_CTL_NAME ZFS_AC_KERNEL_PDE_DATA ZFS_AC_KERNEL_FALLOCATE ZFS_AC_KERNEL_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE @@ -168,33 +143,11 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_GROUP_INFO_GID ZFS_AC_KERNEL_RW ZFS_AC_KERNEL_TIMER_SETUP - ZFS_AC_KERNEL_CURRENT_BIO_TAIL ZFS_AC_KERNEL_SUPER_USER_NS - ZFS_AC_KERNEL_SUBMIT_BIO ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS - ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH - ZFS_AC_KERNEL_BLKDEV_REREAD_PART - ZFS_AC_KERNEL_INVALIDATE_BDEV - ZFS_AC_KERNEL_LOOKUP_BDEV - ZFS_AC_KERNEL_BDEV_OPEN_EXCLUSIVE - 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_SET_DEV - ZFS_AC_KERNEL_BIO_OPS - ZFS_AC_KERNEL_BIO_END_IO_T_ARGS - ZFS_AC_KERNEL_BIO_BI_STATUS - ZFS_AC_KERNEL_BIO_RW_BARRIER - ZFS_AC_KERNEL_BIO_RW_DISCARD - ZFS_AC_KERNEL_BLK_QUEUE_BDI - ZFS_AC_KERNEL_BLK_QUEUE_DISCARD - ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE - ZFS_AC_KERNEL_BLK_QUEUE_FLAGS - ZFS_AC_KERNEL_BLK_QUEUE_FLUSH - ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS - ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS - ZFS_AC_KERNEL_BLK_QUEUE_PLUG + ZFS_AC_KERNEL_BIO + ZFS_AC_KERNEL_BLKDEV + ZFS_AC_KERNEL_BLK_QUEUE ZFS_AC_KERNEL_GET_DISK_AND_MODULE ZFS_AC_KERNEL_GET_DISK_RO ZFS_AC_KERNEL_GENERIC_READLINK_GLOBAL @@ -214,12 +167,11 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_DIRTY_INODE ZFS_AC_KERNEL_SHRINKER ZFS_AC_KERNEL_MKDIR_UMODE_T - ZFS_AC_KERNEL_LOOKUP_NAMEIDATA - ZFS_AC_KERNEL_CREATE_NAMEIDATA + ZFS_AC_KERNEL_LOOKUP_FLAGS + ZFS_AC_KERNEL_CREATE_FLAGS ZFS_AC_KERNEL_GET_LINK ZFS_AC_KERNEL_PUT_LINK ZFS_AC_KERNEL_TMPFILE - ZFS_AC_KERNEL_TRUNCATE_RANGE ZFS_AC_KERNEL_AUTOMOUNT ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE ZFS_AC_KERNEL_COMMIT_METADATA @@ -391,6 +343,13 @@ AC_DEFUN([ZFS_AC_KERNEL], [ AC_MSG_RESULT([$kernsrcver]) + AS_VERSION_COMPARE([$kernsrcver], [$ZFS_META_KVER_MIN], [ + AC_MSG_ERROR([ + *** Cannot build against kernel version $kernsrcver. + *** The minimum supported kernel version is $ZFS_META_KVER_MIN. + ]) + ]) + LINUX=${kernelsrc} LINUX_OBJ=${kernelbuild} LINUX_VERSION=${kernsrcver} diff --git a/include/os/linux/kernel/linux/blkdev_compat.h b/include/os/linux/kernel/linux/blkdev_compat.h index 084ea61cc..2de8a16e2 100644 --- a/include/os/linux/kernel/linux/blkdev_compat.h +++ b/include/os/linux/kernel/linux/blkdev_compat.h @@ -35,10 +35,6 @@ #include <linux/hdreg.h> #include <linux/msdos_fs.h> /* for SECTOR_* */ -#ifndef HAVE_FMODE_T -typedef unsigned __bitwise__ fmode_t; -#endif /* HAVE_FMODE_T */ - #ifndef HAVE_BLK_QUEUE_FLAG_SET static inline void blk_queue_flag_set(unsigned int flag, struct request_queue *q) @@ -66,9 +62,6 @@ blk_queue_flag_clear(unsigned int flag, struct request_queue *q) * interface. However, while the old interface was available to all the * new one is GPL-only. Thus if the GPL-only version is detected we * implement our own trivial helper. - * - * 2.6.x - 2.6.35 - * Legacy blk_queue_ordered() interface. */ static inline void blk_queue_set_write_cache(struct request_queue *q, bool wc, bool fua) @@ -92,47 +85,9 @@ blk_queue_set_write_cache(struct request_queue *q, bool wc, bool fua) #elif defined(HAVE_BLK_QUEUE_FLUSH) blk_queue_flush(q, (wc ? REQ_FLUSH : 0) | (fua ? REQ_FUA : 0)); #else - blk_queue_ordered(q, QUEUE_ORDERED_DRAIN, NULL); -#endif -} - -/* - * Most of the blk_* macros were removed in 2.6.36. Ostensibly this was - * done to improve readability and allow easier grepping. However, from - * a portability stand point the macros are helpful. Therefore the needed - * macros are redefined here if they are missing from the kernel. - */ -#ifndef blk_fs_request -#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) +#error "Unsupported kernel" #endif - -/* - * 2.6.34 API change, - * The blk_queue_max_hw_sectors() function replaces blk_queue_max_sectors(). - */ -#ifndef HAVE_BLK_QUEUE_MAX_HW_SECTORS -#define blk_queue_max_hw_sectors __blk_queue_max_hw_sectors -static inline void -__blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_sectors) -{ - blk_queue_max_sectors(q, max_hw_sectors); } -#endif - -/* - * 2.6.34 API change, - * The blk_queue_max_segments() function consolidates - * blk_queue_max_hw_segments() and blk_queue_max_phys_segments(). - */ -#ifndef HAVE_BLK_QUEUE_MAX_SEGMENTS -#define blk_queue_max_segments __blk_queue_max_segments -static inline void -__blk_queue_max_segments(struct request_queue *q, unsigned short max_segments) -{ - blk_queue_max_phys_segments(q, max_segments); - blk_queue_max_hw_segments(q, max_segments); -} -#endif static inline void blk_queue_set_read_ahead(struct request_queue *q, unsigned long ra_pages) @@ -144,7 +99,7 @@ blk_queue_set_read_ahead(struct request_queue *q, unsigned long ra_pages) #endif } -#ifndef HAVE_GET_DISK_AND_MODULE +#if !defined(HAVE_GET_DISK_AND_MODULE) static inline struct kobject * get_disk_and_module(struct gendisk *disk) { @@ -152,19 +107,6 @@ get_disk_and_module(struct gendisk *disk) } #endif -#ifndef HAVE_GET_DISK_RO -static inline int -get_disk_ro(struct gendisk *disk) -{ - int policy = 0; - - if (disk->part[0]) - policy = disk->part[0]->policy; - - return (policy); -} -#endif /* HAVE_GET_DISK_RO */ - #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 @@ -183,10 +125,6 @@ typedef struct bvec_iter bvec_iterator_t; typedef int bvec_iterator_t; #endif -/* - * Portable helper for correctly setting the FAILFAST flags. The - * correct usage has changed 3 times from 2.6.12 to 2.6.38. - */ static inline void bio_set_flags_failfast(struct block_device *bdev, int *flags) { @@ -210,27 +148,13 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags) #endif /* BLOCK_EXT_MAJOR */ #endif /* CONFIG_BUG */ -#if defined(HAVE_BIO_RW_FAILFAST_DTD) - /* BIO_RW_FAILFAST_* preferred interface from 2.6.28 - 2.6.35 */ - *flags |= ( - (1 << BIO_RW_FAILFAST_DEV) | - (1 << BIO_RW_FAILFAST_TRANSPORT) | - (1 << BIO_RW_FAILFAST_DRIVER)); -#elif defined(HAVE_REQ_FAILFAST_MASK) - /* - * REQ_FAILFAST_* preferred interface from 2.6.36 - 2.6.xx, - * the BIO_* and REQ_* flags were unified under REQ_* flags. - */ *flags |= REQ_FAILFAST_MASK; -#else -#error "Undefined block IO FAILFAST interface." -#endif } /* * Maximum disk label length, it may be undefined for some kernels. */ -#ifndef DISK_NAME_LEN +#if !defined(DISK_NAME_LEN) #define DISK_NAME_LEN 32 #endif /* DISK_NAME_LEN */ @@ -338,33 +262,6 @@ bio_set_bi_error(struct bio *bio, int error) #endif /* HAVE_1ARG_BIO_END_IO_T */ /* - * 2.6.38 - 2.6.x API, - * blkdev_get_by_path() - * blkdev_put() - * - * 2.6.28 - 2.6.37 API, - * open_bdev_exclusive() - * close_bdev_exclusive() - * - * 2.6.12 - 2.6.27 API, - * open_bdev_excl() - * close_bdev_excl() - * - * Used to exclusively open a block device from within the kernel. - */ -#if defined(HAVE_BLKDEV_GET_BY_PATH) -#define vdev_bdev_open(path, md, hld) blkdev_get_by_path(path, \ - (md) | FMODE_EXCL, hld) -#define vdev_bdev_close(bdev, md) blkdev_put(bdev, (md) | FMODE_EXCL) -#elif defined(HAVE_OPEN_BDEV_EXCLUSIVE) -#define vdev_bdev_open(path, md, hld) open_bdev_exclusive(path, md, hld) -#define vdev_bdev_close(bdev, md) close_bdev_exclusive(bdev, md) -#else -#define vdev_bdev_open(path, md, hld) open_bdev_excl(path, md, hld) -#define vdev_bdev_close(bdev, md) close_bdev_excl(bdev) -#endif /* HAVE_BLKDEV_GET_BY_PATH | HAVE_OPEN_BDEV_EXCLUSIVE */ - -/* * 4.1 - x.y.z API, * 3.10.0 CentOS 7.x API, * blkdev_reread_part() @@ -379,17 +276,6 @@ bio_set_bi_error(struct bio *bio, int error) #endif /* HAVE_BLKDEV_REREAD_PART */ /* - * 2.6.22 API change - * The function invalidate_bdev() lost it's second argument because - * it was unused. - */ -#ifdef HAVE_1ARG_INVALIDATE_BDEV -#define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev) -#else -#define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev, 1) -#endif /* HAVE_1ARG_INVALIDATE_BDEV */ - -/* * 2.6.27 API change * The function was exported for use, prior to this it existed but the * symbol was not exported. @@ -403,38 +289,14 @@ bio_set_bi_error(struct bio *bio, int error) #ifdef HAVE_2ARGS_LOOKUP_BDEV #define vdev_lookup_bdev(path) lookup_bdev(path, 0) #else -#define vdev_lookup_bdev(path) ERR_PTR(-ENOTSUP) +#error "Unsupported kernel" #endif /* HAVE_2ARGS_LOOKUP_BDEV */ #endif /* HAVE_1ARG_LOOKUP_BDEV */ /* - * 2.6.30 API change - * To ensure good performance preferentially use the physical block size - * for proper alignment. The physical size is supposed to be the internal - * sector size used by the device. This is often 4096 byte for AF devices, - * while a smaller 512 byte logical size is supported for compatibility. - * - * Unfortunately, many drives still misreport their physical sector size. - * For devices which are known to lie you may need to manually set this - * at pool creation time with 'zpool create -o ashift=12 ...'. - * - * When the physical block size interface isn't available, we fall back to - * the logical block size interface and then the older hard sector size. - */ -#ifdef HAVE_BDEV_PHYSICAL_BLOCK_SIZE -#define vdev_bdev_block_size(bdev) bdev_physical_block_size(bdev) -#else -#ifdef HAVE_BDEV_LOGICAL_BLOCK_SIZE -#define vdev_bdev_block_size(bdev) bdev_logical_block_size(bdev) -#else -#define vdev_bdev_block_size(bdev) bdev_hardsect_size(bdev) -#endif /* HAVE_BDEV_LOGICAL_BLOCK_SIZE */ -#endif /* HAVE_BDEV_PHYSICAL_BLOCK_SIZE */ - -#ifndef HAVE_BIO_SET_OP_ATTRS -/* * Kernels without bio_set_op_attrs use bi_rw for the bio flags. */ +#if !defined(HAVE_BIO_SET_OP_ATTRS) static inline void bio_set_op_attrs(struct bio *bio, unsigned rw, unsigned flags) { @@ -446,14 +308,8 @@ bio_set_op_attrs(struct bio *bio, unsigned rw, unsigned flags) * bio_set_flush - Set the appropriate flags in a bio to guarantee * data are on non-volatile media on completion. * - * 2.6.X - 2.6.36 API, - * WRITE_BARRIER - Tells the block layer to commit all previously submitted - * writes to stable storage before this one is started and that the current - * write is on stable storage upon completion. Also prevents reordering - * on both sides of the current operation. - * * 2.6.37 - 4.8 API, - * Introduce WRITE_FLUSH, WRITE_FUA, and WRITE_FLUSH_FUA flags as a + * Introduce WRITE_FLUSH, WRITE_FUA, and WRITE_FLUSH_FUA flags as a * replacement for WRITE_BARRIER to allow expressing richer semantics * to the block layer. It's up to the block layer to implement the * semantics correctly. Use the WRITE_FLUSH_FUA flag combination. @@ -471,12 +327,10 @@ bio_set_op_attrs(struct bio *bio, unsigned rw, unsigned flags) static inline void bio_set_flush(struct bio *bio) { -#if defined(REQ_PREFLUSH) /* >= 4.10 */ +#if defined(HAVE_REQ_PREFLUSH) /* >= 4.10 */ bio_set_op_attrs(bio, 0, REQ_PREFLUSH); #elif defined(WRITE_FLUSH_FUA) /* >= 2.6.37 and <= 4.9 */ bio_set_op_attrs(bio, 0, WRITE_FLUSH_FUA); -#elif defined(WRITE_BARRIER) /* < 2.6.37 */ - bio_set_op_attrs(bio, 0, WRITE_BARRIER); #else #error "Allowing the build will cause bio_set_flush requests to be ignored." #endif @@ -492,12 +346,6 @@ bio_set_flush(struct bio *bio) * 2.6.36 - 4.7 API, * REQ_FLUSH * - * 2.6.x - 2.6.35 API, - * HAVE_BIO_RW_BARRIER - * - * Used to determine if a cache flush has been requested. This check has - * been left intentionally broad in order to cover both a legacy flush - * and the new preflush behavior introduced in Linux 4.8. This is correct * in all cases but may have a performance impact for some kernels. It * has the advantage of minimizing kernel specific changes in the zvol code. * @@ -507,16 +355,14 @@ bio_is_flush(struct bio *bio) { #if defined(HAVE_REQ_OP_FLUSH) && defined(HAVE_BIO_BI_OPF) return ((bio_op(bio) == REQ_OP_FLUSH) || (bio->bi_opf & REQ_PREFLUSH)); -#elif defined(REQ_PREFLUSH) && defined(HAVE_BIO_BI_OPF) +#elif defined(HAVE_REQ_PREFLUSH) && defined(HAVE_BIO_BI_OPF) return (bio->bi_opf & REQ_PREFLUSH); -#elif defined(REQ_PREFLUSH) && !defined(HAVE_BIO_BI_OPF) +#elif defined(HAVE_REQ_PREFLUSH) && !defined(HAVE_BIO_BI_OPF) return (bio->bi_rw & REQ_PREFLUSH); -#elif defined(REQ_FLUSH) +#elif defined(HAVE_REQ_FLUSH) return (bio->bi_rw & REQ_FLUSH); -#elif defined(HAVE_BIO_RW_BARRIER) - return (bio->bi_rw & (1 << BIO_RW_BARRIER)); #else -#error "Allowing the build will cause flush requests to be ignored." +#error "Unsupported kernel" #endif } @@ -546,28 +392,18 @@ bio_is_fua(struct bio *bio) * 2.6.36 - 4.7 API, * REQ_DISCARD * - * 2.6.28 - 2.6.35 API, - * BIO_RW_DISCARD - * * In all cases the normal I/O path is used for discards. The only * difference is how the kernel tags individual I/Os as discards. - * - * Note that 2.6.32 era kernels provide both BIO_RW_DISCARD and REQ_DISCARD, - * where BIO_RW_DISCARD is the correct interface. Therefore, it is important - * that the HAVE_BIO_RW_DISCARD check occur before the REQ_DISCARD check. */ static inline boolean_t bio_is_discard(struct bio *bio) { #if defined(HAVE_REQ_OP_DISCARD) return (bio_op(bio) == REQ_OP_DISCARD); -#elif defined(HAVE_BIO_RW_DISCARD) - return (bio->bi_rw & (1 << BIO_RW_DISCARD)); -#elif defined(REQ_DISCARD) +#elif defined(HAVE_REQ_DISCARD) return (bio->bi_rw & REQ_DISCARD); #else -/* potentially triggering the DMU_MAX_ACCESS assertion. */ -#error "Allowing the build will cause discard requests to become writes." +#error "Unsupported kernel" #endif } @@ -577,9 +413,6 @@ bio_is_discard(struct bio *bio) * * 2.6.36 - 4.7 API, * REQ_SECURE - * - * 2.6.x - 2.6.35 API, - * Unsupported by kernel */ static inline boolean_t bio_is_secure_erase(struct bio *bio) @@ -598,23 +431,11 @@ bio_is_secure_erase(struct bio *bio) * Discard granularity and alignment restrictions may now be set. For * older kernels which do not support this it is safe to skip it. */ -#ifdef HAVE_DISCARD_GRANULARITY static inline void blk_queue_discard_granularity(struct request_queue *q, unsigned int dg) { q->limits.discard_granularity = dg; } -#else -#define blk_queue_discard_granularity(x, dg) ((void)0) -#endif /* HAVE_DISCARD_GRANULARITY */ - -/* - * 2.6.32 - 4.x API, - * blk_queue_discard() - */ -#if !defined(HAVE_BLK_QUEUE_DISCARD) -#define blk_queue_discard(q) (0); -#endif /* * 4.8 - 4.x API, @@ -622,9 +443,6 @@ blk_queue_discard_granularity(struct request_queue *q, unsigned int dg) * * 2.6.36 - 4.7 API, * blk_queue_secdiscard() - * - * 2.6.x - 2.6.35 API, - * Unsupported by kernel */ static inline int blk_queue_discard_secure(struct request_queue *q) diff --git a/include/os/linux/kernel/linux/dcache_compat.h b/include/os/linux/kernel/linux/dcache_compat.h index bdaa5db3e..d0588a82e 100644 --- a/include/os/linux/kernel/linux/dcache_compat.h +++ b/include/os/linux/kernel/linux/dcache_compat.h @@ -41,24 +41,7 @@ * the dentry structure. To handle this we define an appropriate * dentry_operations_t typedef which can be used. */ -#ifdef HAVE_CONST_DENTRY_OPERATIONS typedef const struct dentry_operations dentry_operations_t; -#else -typedef struct dentry_operations dentry_operations_t; -#endif - -/* - * 2.6.38 API change, - * Added d_set_d_op() helper function which sets some flags in - * dentry->d_flags based on which operations are defined. - */ -#ifndef HAVE_D_SET_D_OP -static inline void -d_set_d_op(struct dentry *dentry, dentry_operations_t *op) -{ - dentry->d_op = op; -} -#endif /* HAVE_D_SET_D_OP */ /* * 2.6.38 API addition, @@ -72,12 +55,10 @@ d_set_d_op(struct dentry *dentry, dentry_operations_t *op) static inline void d_clear_d_op(struct dentry *dentry) { -#ifdef HAVE_D_SET_D_OP dentry->d_op = NULL; dentry->d_flags &= ~( DCACHE_OP_HASH | DCACHE_OP_COMPARE | DCACHE_OP_REVALIDATE | DCACHE_OP_DELETE); -#endif /* HAVE_D_SET_D_OP */ } #endif /* _ZFS_DCACHE_H */ diff --git a/include/os/linux/kernel/linux/kmap_compat.h b/include/os/linux/kernel/linux/kmap_compat.h index b9c7f5bcc..a7e63944e 100644 --- a/include/os/linux/kernel/linux/kmap_compat.h +++ b/include/os/linux/kernel/linux/kmap_compat.h @@ -29,14 +29,9 @@ #include <linux/highmem.h> #include <linux/uaccess.h> -#ifdef HAVE_1ARG_KMAP_ATOMIC /* 2.6.37 API change */ #define zfs_kmap_atomic(page, km_type) kmap_atomic(page) #define zfs_kunmap_atomic(addr, km_type) kunmap_atomic(addr) -#else -#define zfs_kmap_atomic(page, km_type) kmap_atomic(page, km_type) -#define zfs_kunmap_atomic(addr, km_type) kunmap_atomic(addr, km_type) -#endif /* 5.0 API change - no more 'type' argument for access_ok() */ #ifdef HAVE_ACCESS_OK_TYPE diff --git a/include/os/linux/kernel/linux/vfs_compat.h b/include/os/linux/kernel/linux/vfs_compat.h index 28b454133..c35e80d31 100644 --- a/include/os/linux/kernel/linux/vfs_compat.h +++ b/include/os/linux/kernel/linux/vfs_compat.h @@ -33,43 +33,6 @@ #include <linux/compat.h> /* - * 2.6.28 API change, - * Added insert_inode_locked() helper function, prior to this most callers - * used insert_inode_hash(). The older method doesn't check for collisions - * in the inode_hashtable but it still acceptable for use. - */ -#ifndef HAVE_INSERT_INODE_LOCKED -static inline int -insert_inode_locked(struct inode *ip) -{ - insert_inode_hash(ip); - return (0); -} -#endif /* HAVE_INSERT_INODE_LOCKED */ - -/* - * 2.6.35 API change, - * Add truncate_setsize() if it is not exported by the Linux kernel. - * - * Truncate the inode and pages associated with the inode. The pages are - * unmapped and removed from cache. - */ -#ifndef HAVE_TRUNCATE_SETSIZE -static inline void -truncate_setsize(struct inode *ip, loff_t new) -{ - struct address_space *mapping = ip->i_mapping; - - i_size_write(ip, new); - - unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1); - truncate_inode_pages(mapping, new); - unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1); -} -#endif /* HAVE_TRUNCATE_SETSIZE */ - -/* - * 2.6.32 - 2.6.33, bdi_setup_and_register() is not available. * 2.6.34 - 3.19, bdi_setup_and_register() takes 3 arguments. * 4.0 - 4.11, bdi_setup_and_register() takes 2 arguments. * 4.12 - x.y, super_setup_bdi_name() new interface. @@ -142,45 +105,7 @@ zpl_bdi_destroy(struct super_block *sb) sb->s_bdi = NULL; } #else -extern atomic_long_t zfs_bdi_seq; - -static inline int -zpl_bdi_setup(struct super_block *sb, char *name) -{ - struct backing_dev_info *bdi; - int error; - - bdi = kmem_zalloc(sizeof (struct backing_dev_info), KM_SLEEP); - bdi->name = name; - bdi->capabilities = BDI_CAP_MAP_COPY; - - error = bdi_init(bdi); - if (error) { - kmem_free(bdi, sizeof (struct backing_dev_info)); - return (error); - } - - error = bdi_register(bdi, NULL, "%.28s-%ld", name, - atomic_long_inc_return(&zfs_bdi_seq)); - if (error) { - bdi_destroy(bdi); - kmem_free(bdi, sizeof (struct backing_dev_info)); - return (error); - } - - sb->s_bdi = bdi; - - return (0); -} -static inline void -zpl_bdi_destroy(struct super_block *sb) -{ - struct backing_dev_info *bdi = sb->s_bdi; - - bdi_destroy(bdi); - kmem_free(bdi, sizeof (struct backing_dev_info)); - sb->s_bdi = NULL; -} +#error "Unsupported kernel" #endif /* @@ -212,41 +137,6 @@ zpl_bdi_destroy(struct super_block *sb) #endif /* - * 2.6.38 API change, - * LOOKUP_RCU flag introduced to distinguish rcu-walk from ref-walk cases. - */ -#ifndef LOOKUP_RCU -#define LOOKUP_RCU 0x0 -#endif /* LOOKUP_RCU */ - -/* - * 3.2-rc1 API change, - * Add set_nlink() if it is not exported by the Linux kernel. - * - * i_nlink is read-only in Linux 3.2, but it can be set directly in - * earlier kernels. - */ -#ifndef HAVE_SET_NLINK -static inline void -set_nlink(struct inode *inode, unsigned int nlink) -{ - inode->i_nlink = nlink; -} -#endif /* HAVE_SET_NLINK */ - -/* - * 3.3 API change, - * The VFS .create, .mkdir and .mknod callbacks were updated to take a - * umode_t type rather than an int. To cleanly handle both definitions - * the zpl_umode_t type is introduced and set accordingly. - */ -#ifdef HAVE_MKDIR_UMODE_T -typedef umode_t zpl_umode_t; -#else -typedef int zpl_umode_t; -#endif - -/* * 3.5 API change, * The clear_inode() function replaces end_writeback() and introduces an * ordering change regarding when the inode_sync_wait() occurs. See the @@ -256,16 +146,6 @@ typedef int zpl_umode_t; #define clear_inode(ip) end_writeback(ip) #endif /* HAVE_EVICT_INODE && !HAVE_CLEAR_INODE */ -/* - * 3.6 API change, - * The sget() helper function now takes the mount flags as an argument. - */ -#ifdef HAVE_5ARG_SGET -#define zpl_sget(type, cmp, set, fl, mtd) sget(type, cmp, set, fl, mtd) -#else -#define zpl_sget(type, cmp, set, fl, mtd) sget(type, cmp, set, mtd) -#endif /* HAVE_5ARG_SGET */ - #if defined(SEEK_HOLE) && defined(SEEK_DATA) && !defined(HAVE_LSEEK_EXECUTE) static inline loff_t lseek_execute( @@ -361,65 +241,22 @@ zpl_forget_cached_acl(struct inode *ip, int type) } #endif /* HAVE_SET_CACHED_ACL_USABLE */ +/* + * 3.1 API change, + * posix_acl_chmod() was added as the preferred interface. + * + * 3.14 API change, + * posix_acl_chmod() was changed to __posix_acl_chmod() + */ #ifndef HAVE___POSIX_ACL_CHMOD #ifdef HAVE_POSIX_ACL_CHMOD #define __posix_acl_chmod(acl, gfp, mode) posix_acl_chmod(acl, gfp, mode) #define __posix_acl_create(acl, gfp, mode) posix_acl_create(acl, gfp, mode) #else -static inline int -__posix_acl_chmod(struct posix_acl **acl, int flags, umode_t umode) -{ - struct posix_acl *oldacl = *acl; - mode_t mode = umode; - int error; - - *acl = posix_acl_clone(*acl, flags); - zpl_posix_acl_release(oldacl); - - if (!(*acl)) - return (-ENOMEM); - - error = posix_acl_chmod_masq(*acl, mode); - if (error) { - zpl_posix_acl_release(*acl); - *acl = NULL; - } - - return (error); -} - -static inline int -__posix_acl_create(struct posix_acl **acl, int flags, umode_t *umodep) -{ - struct posix_acl *oldacl = *acl; - mode_t mode = *umodep; - int error; - - *acl = posix_acl_clone(*acl, flags); - zpl_posix_acl_release(oldacl); - - if (!(*acl)) - return (-ENOMEM); - - error = posix_acl_create_masq(*acl, &mode); - *umodep = mode; - - if (error < 0) { - zpl_posix_acl_release(*acl); - *acl = NULL; - } - - return (error); -} +#error "Unsupported kernel" #endif /* HAVE_POSIX_ACL_CHMOD */ #endif /* HAVE___POSIX_ACL_CHMOD */ -#ifdef HAVE_POSIX_ACL_EQUIV_MODE_UMODE_T -typedef umode_t zpl_equivmode_t; -#else -typedef mode_t zpl_equivmode_t; -#endif /* HAVE_POSIX_ACL_EQUIV_MODE_UMODE_T */ - /* * 4.8 API change, * posix_acl_valid() now must be passed a namespace, the namespace from @@ -434,16 +271,6 @@ typedef mode_t zpl_equivmode_t; #endif /* CONFIG_FS_POSIX_ACL */ /* - * 2.6.38 API change, - * The is_owner_or_cap() function was renamed to inode_owner_or_capable(). - */ -#ifdef HAVE_INODE_OWNER_OR_CAPABLE -#define zpl_inode_owner_or_capable(ip) inode_owner_or_capable(ip) -#else -#define zpl_inode_owner_or_capable(ip) is_owner_or_cap(ip) -#endif /* HAVE_INODE_OWNER_OR_CAPABLE */ - -/* * 3.19 API change * struct access f->f_dentry->d_inode was replaced by accessor function * file_inode(f) @@ -467,7 +294,6 @@ static inline struct dentry *file_dentry(const struct file *f) } #endif /* HAVE_FILE_DENTRY */ -#ifdef HAVE_KUID_HELPERS static inline uid_t zfs_uid_read_impl(struct inode *ip) { #ifdef HAVE_SUPER_USER_NS @@ -514,39 +340,6 @@ static inline void zfs_gid_write(struct inode *ip, gid_t gid) #endif } -#else -static inline uid_t zfs_uid_read(struct inode *ip) -{ - return (ip->i_uid); -} - -static inline gid_t zfs_gid_read(struct inode *ip) -{ - return (ip->i_gid); -} - -static inline void zfs_uid_write(struct inode *ip, uid_t uid) -{ - ip->i_uid = uid; -} - -static inline void zfs_gid_write(struct inode *ip, gid_t gid) -{ - ip->i_gid = gid; -} -#endif - -/* - * 2.6.38 API change - */ -#ifdef HAVE_FOLLOW_DOWN_ONE -#define zpl_follow_down_one(path) follow_down_one(path) -#define zpl_follow_up(path) follow_up(path) -#else -#define zpl_follow_down_one(path) follow_down(path) -#define zpl_follow_up(path) follow_up(path) -#endif - /* * 4.9 API change */ diff --git a/include/os/linux/kernel/linux/xattr_compat.h b/include/os/linux/kernel/linux/xattr_compat.h index b1c429307..8348e9919 100644 --- a/include/os/linux/kernel/linux/xattr_compat.h +++ b/include/os/linux/kernel/linux/xattr_compat.h @@ -35,24 +35,7 @@ * appropriate xattr_handler_t typedef which can be used. This was * the preferred solution because it keeps the code clean and readable. */ -#ifdef HAVE_CONST_XATTR_HANDLER typedef const struct xattr_handler xattr_handler_t; -#else -typedef struct xattr_handler xattr_handler_t; -#endif - -/* - * 3.7 API change, - * Preferred XATTR_NAME_* definitions introduced, these are mapped to - * the previous definitions for older kernels. - */ -#ifndef XATTR_NAME_POSIX_ACL_DEFAULT -#define XATTR_NAME_POSIX_ACL_DEFAULT POSIX_ACL_XATTR_DEFAULT -#endif - -#ifndef XATTR_NAME_POSIX_ACL_ACCESS -#define XATTR_NAME_POSIX_ACL_ACCESS POSIX_ACL_XATTR_ACCESS -#endif /* * 4.5 API change, @@ -88,17 +71,8 @@ fn(const struct xattr_handler *handler, struct dentry *dentry, \ return (__ ## fn(dentry->d_inode, \ list, list_size, name, name_len)); \ } -/* - * 2.6.32 API - */ -#elif defined(HAVE_XATTR_LIST_INODE) -#define ZPL_XATTR_LIST_WRAPPER(fn) \ -static size_t \ -fn(struct inode *ip, char *list, size_t list_size, \ - const char *name, size_t name_len) \ -{ \ - return (__ ## fn(ip, list, list_size, name, name_len)); \ -} +#else +#error "Unsupported kernel" #endif /* @@ -141,16 +115,8 @@ fn(struct dentry *dentry, const char *name, void *buffer, size_t size, \ { \ return (__ ## fn(dentry->d_inode, name, buffer, size)); \ } -/* - * 2.6.32 API - */ -#elif defined(HAVE_XATTR_GET_INODE) -#define ZPL_XATTR_GET_WRAPPER(fn) \ -static int \ -fn(struct inode *ip, const char *name, void *buffer, size_t size) \ -{ \ - return (__ ## fn(ip, name, buffer, size)); \ -} +#else +#error "Unsupported kernel" #endif /* @@ -194,33 +160,15 @@ fn(struct dentry *dentry, const char *name, const void *buffer, \ { \ return (__ ## fn(dentry->d_inode, name, buffer, size, flags)); \ } -/* - * 2.6.32 API - */ -#elif defined(HAVE_XATTR_SET_INODE) -#define ZPL_XATTR_SET_WRAPPER(fn) \ -static int \ -fn(struct inode *ip, const char *name, const void *buffer, \ - size_t size, int flags) \ -{ \ - return (__ ## fn(ip, name, buffer, size, flags)); \ -} -#endif - -#ifdef HAVE_6ARGS_SECURITY_INODE_INIT_SECURITY -#define zpl_security_inode_init_security(ip, dip, qstr, nm, val, len) \ - security_inode_init_security(ip, dip, qstr, nm, val, len) #else -#define zpl_security_inode_init_security(ip, dip, qstr, nm, val, len) \ - security_inode_init_security(ip, dip, nm, val, len) -#endif /* HAVE_6ARGS_SECURITY_INODE_INIT_SECURITY */ +#error "Unsupported kernel" +#endif /* * Linux 3.7 API change. posix_acl_{from,to}_xattr gained the user_ns * parameter. All callers are expected to pass the &init_user_ns which * is available through the init credential (kcred). */ -#ifdef HAVE_POSIX_ACL_FROM_XATTR_USERNS static inline struct posix_acl * zpl_acl_from_xattr(const void *value, int size) { @@ -233,19 +181,4 @@ zpl_acl_to_xattr(struct posix_acl *acl, void *value, int size) return (posix_acl_to_xattr(kcred->user_ns, acl, value, size)); } -#else - -static inline struct posix_acl * -zpl_acl_from_xattr(const void *value, int size) -{ - return (posix_acl_from_xattr(value, size)); -} - -static inline int -zpl_acl_to_xattr(struct posix_acl *acl, void *value, int size) -{ - return (posix_acl_to_xattr(acl, value, size)); -} -#endif /* HAVE_POSIX_ACL_FROM_XATTR_USERNS */ - #endif /* _ZFS_XATTR_H */ diff --git a/include/os/linux/spl/sys/cred.h b/include/os/linux/spl/sys/cred.h index fd063399b..0b07c4369 100644 --- a/include/os/linux/spl/sys/cred.h +++ b/include/os/linux/spl/sys/cred.h @@ -40,24 +40,12 @@ typedef struct cred cred_t; #define GROUP_AT(gi, i) ((gi)->gid[i]) #endif -#ifdef HAVE_KUIDGID_T - #define KUID_TO_SUID(x) (__kuid_val(x)) #define KGID_TO_SGID(x) (__kgid_val(x)) #define SUID_TO_KUID(x) (KUIDT_INIT(x)) #define SGID_TO_KGID(x) (KGIDT_INIT(x)) #define KGIDP_TO_SGIDP(x) (&(x)->val) -#else /* HAVE_KUIDGID_T */ - -#define KUID_TO_SUID(x) (x) -#define KGID_TO_SGID(x) (x) -#define SUID_TO_KUID(x) (x) -#define SGID_TO_KGID(x) (x) -#define KGIDP_TO_SGIDP(x) (x) - -#endif /* HAVE_KUIDGID_T */ - extern void crhold(cred_t *cr); extern void crfree(cred_t *cr); extern uid_t crgetuid(const cred_t *cr); diff --git a/include/os/linux/spl/sys/proc.h b/include/os/linux/spl/sys/proc.h index 05c44bca5..287683920 100644 --- a/include/os/linux/spl/sys/proc.h +++ b/include/os/linux/spl/sys/proc.h @@ -27,10 +27,6 @@ #include <linux/proc_fs.h> -#ifndef HAVE_PDE_DATA -#define PDE_DATA(x) (PDE(x)->data) -#endif - extern struct proc_dir_entry *proc_spl_kstat; int spl_proc_init(void); diff --git a/include/os/linux/spl/sys/shrinker.h b/include/os/linux/spl/sys/shrinker.h index 28c1fa78c..4193bc5c4 100644 --- a/include/os/linux/spl/sys/shrinker.h +++ b/include/os/linux/spl/sys/shrinker.h @@ -28,13 +28,6 @@ #include <linux/mm.h> #include <linux/fs.h> -#if !defined(HAVE_SHRINK_CONTROL_STRUCT) -struct shrink_control { - gfp_t gfp_mask; - unsigned long nr_to_scan; -}; -#endif /* HAVE_SHRINK_CONTROL_STRUCT */ - /* * Due to frequent changes in the shrinker API the following * compatibility wrappers should be used. They are as follows: @@ -85,59 +78,9 @@ struct shrink_control { #define spl_unregister_shrinker(x) unregister_shrinker(x) /* - * Linux 2.6.23 - 2.6.34 Shrinker API Compatibility. - */ -#if defined(HAVE_2ARGS_OLD_SHRINKER_CALLBACK) -#define SPL_SHRINKER_DECLARE(s, x, y) \ -static struct shrinker s = { \ - .shrink = x, \ - .seeks = y \ -} - -#define SPL_SHRINKER_CALLBACK_FWD_DECLARE(fn) \ -static int fn(int nr_to_scan, unsigned int gfp_mask) - -#define SPL_SHRINKER_CALLBACK_WRAPPER(fn) \ -static int \ -fn(int nr_to_scan, unsigned int gfp_mask) \ -{ \ - struct shrink_control sc; \ - \ - sc.nr_to_scan = nr_to_scan; \ - sc.gfp_mask = gfp_mask; \ - \ - return (__ ## fn(NULL, &sc)); \ -} - -/* - * Linux 2.6.35 to 2.6.39 Shrinker API Compatibility. - */ -#elif defined(HAVE_3ARGS_SHRINKER_CALLBACK) -#define SPL_SHRINKER_DECLARE(s, x, y) \ -static struct shrinker s = { \ - .shrink = x, \ - .seeks = y \ -} - -#define SPL_SHRINKER_CALLBACK_FWD_DECLARE(fn) \ -static int fn(struct shrinker *, int, unsigned int) - -#define SPL_SHRINKER_CALLBACK_WRAPPER(fn) \ -static int \ -fn(struct shrinker *shrink, int nr_to_scan, unsigned int gfp_mask) \ -{ \ - struct shrink_control sc; \ - \ - sc.nr_to_scan = nr_to_scan; \ - sc.gfp_mask = gfp_mask; \ - \ - return (__ ## fn(shrink, &sc)); \ -} - -/* * Linux 3.0 to 3.11 Shrinker API Compatibility. */ -#elif defined(HAVE_2ARGS_NEW_SHRINKER_CALLBACK) +#if defined(HAVE_SINGLE_SHRINKER_CALLBACK) #define SPL_SHRINKER_DECLARE(s, x, y) \ static struct shrinker s = { \ .shrink = x, \ diff --git a/include/os/linux/spl/sys/strings.h b/include/os/linux/spl/sys/strings.h index 8b810c9af..4fb803206 100644 --- a/include/os/linux/spl/sys/strings.h +++ b/include/os/linux/spl/sys/strings.h @@ -28,8 +28,4 @@ #define bcopy(src, dest, size) memmove(dest, src, size) #define bcmp(src, dest, size) memcmp((src), (dest), (size_t)(size)) -#ifndef HAVE_KSTRTOUL -#define kstrtoul strict_strtoul -#endif - #endif /* _SPL_SYS_STRINGS_H */ diff --git a/include/os/linux/spl/sys/sysmacros.h b/include/os/linux/spl/sys/sysmacros.h index c0bf4f531..c9d33f407 100644 --- a/include/os/linux/spl/sys/sysmacros.h +++ b/include/os/linux/spl/sys/sysmacros.h @@ -27,15 +27,13 @@ #include <linux/module.h> #include <linux/sched.h> +#include <linux/sched/rt.h> #include <linux/cpumask.h> #include <sys/debug.h> #include <sys/zone.h> #include <sys/signal.h> #include <asm/page.h> -#ifdef HAVE_SCHED_RT_HEADER -#include <linux/sched/rt.h> -#endif #ifndef _KERNEL #define _KERNEL __KERNEL__ diff --git a/include/os/linux/spl/sys/timer.h b/include/os/linux/spl/sys/timer.h index 31d89d3b9..40be12047 100644 --- a/include/os/linux/spl/sys/timer.h +++ b/include/os/linux/spl/sys/timer.h @@ -53,20 +53,6 @@ #define delay(ticks) schedule_timeout_uninterruptible(ticks) -/* usleep_range() introduced in 2.6.36 */ -#ifndef HAVE_USLEEP_RANGE -static inline void -usleep_range(unsigned long min, unsigned long max) -{ - unsigned int min_ms = min / USEC_PER_MSEC; - - if (min >= MAX_UDELAY_MS) - msleep(min_ms); - else - udelay(min); -} -#endif /* HAVE_USLEEP_RANGE */ - #define SEC_TO_TICK(sec) ((sec) * HZ) #define MSEC_TO_TICK(ms) msecs_to_jiffies(ms) #define USEC_TO_TICK(us) usecs_to_jiffies(us) diff --git a/include/os/linux/spl/sys/zmod.h b/include/os/linux/spl/sys/zmod.h index 95c1a3ed7..5380bd6fd 100644 --- a/include/os/linux/spl/sys/zmod.h +++ b/include/os/linux/spl/sys/zmod.h @@ -59,14 +59,6 @@ #include <sys/types.h> #include <linux/zlib.h> -#ifdef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE -#define spl_zlib_deflate_workspacesize(wb, ml) \ - zlib_deflate_workspacesize(wb, ml) -#else -#define spl_zlib_deflate_workspacesize(wb, ml) \ - zlib_deflate_workspacesize() -#endif /* HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */ - extern int z_compress_level(void *dest, size_t *destLen, const void *source, size_t sourceLen, int level); extern int z_uncompress(void *dest, size_t *destLen, const void *source, diff --git a/include/os/linux/zfs/sys/zpl.h b/include/os/linux/zfs/sys/zpl.h index 01f0f6f38..c5b347728 100644 --- a/include/os/linux/zfs/sys/zpl.h +++ b/include/os/linux/zfs/sys/zpl.h @@ -39,7 +39,7 @@ /* zpl_inode.c */ extern void zpl_vap_init(vattr_t *vap, struct inode *dir, - zpl_umode_t mode, cred_t *cr); + umode_t mode, cred_t *cr); extern const struct inode_operations zpl_inode_operations; extern const struct inode_operations zpl_dir_inode_operations; @@ -53,10 +53,6 @@ extern ssize_t zpl_read_common(struct inode *ip, const char *buf, extern ssize_t zpl_write_common(struct inode *ip, const char *buf, size_t len, loff_t *ppos, uio_seg_t segment, int flags, cred_t *cr); -#if defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE) -extern long zpl_fallocate_common(struct inode *ip, int mode, - loff_t offset, loff_t len); -#endif /* defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE) */ extern const struct address_space_operations zpl_address_space_operations; extern const struct file_operations zpl_file_operations; @@ -74,20 +70,10 @@ extern ssize_t zpl_xattr_list(struct dentry *dentry, char *buf, size_t size); extern int zpl_xattr_security_init(struct inode *ip, struct inode *dip, const struct qstr *qstr); #if defined(CONFIG_FS_POSIX_ACL) +#if defined(HAVE_SET_ACL) extern int zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type); +#endif /* HAVE_SET_ACL */ extern struct posix_acl *zpl_get_acl(struct inode *ip, int type); -#if !defined(HAVE_GET_ACL) -#if defined(HAVE_CHECK_ACL_WITH_FLAGS) -extern int zpl_check_acl(struct inode *inode, int mask, unsigned int flags); -#elif defined(HAVE_CHECK_ACL) -extern int zpl_check_acl(struct inode *inode, int mask); -#elif defined(HAVE_PERMISSION_WITH_NAMEIDATA) -extern int zpl_permission(struct inode *ip, int mask, struct nameidata *nd); -#elif defined(HAVE_PERMISSION) -extern int zpl_permission(struct inode *ip, int mask); -#endif /* HAVE_CHECK_ACL | HAVE_PERMISSION */ -#endif /* HAVE_GET_ACL */ - extern int zpl_init_acl(struct inode *ip, struct inode *dir); extern int zpl_chmod_acl(struct inode *ip); #else @@ -112,11 +98,7 @@ extern const struct inode_operations zpl_ops_root; extern const struct file_operations zpl_fops_snapdir; extern const struct inode_operations zpl_ops_snapdir; -#ifdef HAVE_AUTOMOUNT extern const struct dentry_operations zpl_dops_snapdirs; -#else -extern const struct inode_operations zpl_ops_snapdirs; -#endif /* HAVE_AUTOMOUNT */ extern const struct file_operations zpl_fops_shares; extern const struct inode_operations zpl_ops_shares; diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index 59846b1c8..e915f0a8f 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -601,9 +601,7 @@ extern int fop_getattr(vnode_t *vp, vattr_t *vap); #define VOP_FSYNC(vp, f, cr, ct) fsync((vp)->v_fd) -#if defined(HAVE_FILE_FALLOCATE) && \ - defined(FALLOC_FL_PUNCH_HOLE) && \ - defined(FALLOC_FL_KEEP_SIZE) +#if defined(FALLOC_FL_PUNCH_HOLE) && defined(FALLOC_FL_KEEP_SIZE) #define VOP_SPACE(vp, cmd, flck, fl, off, cr, ct) \ fallocate((vp)->v_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, \ (flck)->l_start, (flck)->l_len) diff --git a/module/os/linux/spl/spl-cred.c b/module/os/linux/spl/spl-cred.c index ea3e903f9..6e93a32e6 100644 --- a/module/os/linux/spl/spl-cred.c +++ b/module/os/linux/spl/spl-cred.c @@ -27,11 +27,7 @@ #include <sys/cred.h> static int -#ifdef HAVE_KUIDGID_T cr_groups_search(const struct group_info *group_info, kgid_t grp) -#else -cr_groups_search(const struct group_info *group_info, gid_t grp) -#endif { unsigned int left, right, mid; int cmp; diff --git a/module/os/linux/spl/spl-kmem-cache.c b/module/os/linux/spl/spl-kmem-cache.c index 865f2e2f8..88c7e2507 100644 --- a/module/os/linux/spl/spl-kmem-cache.c +++ b/module/os/linux/spl/spl-kmem-cache.c @@ -1030,11 +1030,6 @@ spl_kmem_cache_create(char *name, size_t size, size_t align, goto out; } -#if defined(HAVE_KMEM_CACHE_ALLOCFLAGS) - skc->skc_linux_cache->allocflags |= __GFP_COMP; -#elif defined(HAVE_KMEM_CACHE_GFPFLAGS) - skc->skc_linux_cache->gfpflags |= __GFP_COMP; -#endif skc->skc_flags |= KMC_NOMAGAZINE; } diff --git a/module/os/linux/spl/spl-proc.c b/module/os/linux/spl/spl-proc.c index 13eaa6301..2dce8cd70 100644 --- a/module/os/linux/spl/spl-proc.c +++ b/module/os/linux/spl/spl-proc.c @@ -712,9 +712,6 @@ static struct ctl_table spl_dir[] = { static struct ctl_table spl_root[] = { { -#ifdef HAVE_CTL_NAME - .ctl_name = CTL_KERN, -#endif .procname = "kernel", .mode = 0555, .child = spl_dir, diff --git a/module/os/linux/spl/spl-vnode.c b/module/os/linux/spl/spl-vnode.c index d9056c964..5de350f10 100644 --- a/module/os/linux/spl/spl-vnode.c +++ b/module/os/linux/spl/spl-vnode.c @@ -48,17 +48,8 @@ spl_filp_fallocate(struct file *fp, int mode, loff_t offset, loff_t len) { int error = -EOPNOTSUPP; -#ifdef HAVE_FILE_FALLOCATE if (fp->f_op->fallocate) error = fp->f_op->fallocate(fp, mode, offset, len); -#else -#ifdef HAVE_INODE_FALLOCATE - if (fp->f_dentry && fp->f_dentry->d_inode && - fp->f_dentry->d_inode->i_op->fallocate) - error = fp->f_dentry->d_inode->i_op->fallocate( - fp->f_dentry->d_inode, mode, offset, len); -#endif /* HAVE_INODE_FALLOCATE */ -#endif /* HAVE_FILE_FALLOCATE */ return (error); } @@ -66,11 +57,7 @@ spl_filp_fallocate(struct file *fp, int mode, loff_t offset, loff_t len) static int spl_filp_fsync(struct file *fp, int sync) { -#ifdef HAVE_2ARGS_VFS_FSYNC return (vfs_fsync(fp, sync)); -#else - return (vfs_fsync(fp, (fp)->f_dentry, sync)); -#endif /* HAVE_2ARGS_VFS_FSYNC */ } static ssize_t @@ -456,31 +443,6 @@ int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag, if (error == 0) return (0); #endif - -#ifdef HAVE_INODE_TRUNCATE_RANGE - if (vp->v_file->f_dentry && vp->v_file->f_dentry->d_inode && - vp->v_file->f_dentry->d_inode->i_op && - vp->v_file->f_dentry->d_inode->i_op->truncate_range) { - off_t end = bfp->l_start + bfp->l_len; - /* - * Judging from the code in shmem_truncate_range(), - * it seems the kernel expects the end offset to be - * inclusive and aligned to the end of a page. - */ - if (end % PAGE_SIZE != 0) { - end &= ~(off_t)(PAGE_SIZE - 1); - if (end <= bfp->l_start) - return (0); - } - --end; - - vp->v_file->f_dentry->d_inode->i_op->truncate_range( - vp->v_file->f_dentry->d_inode, bfp->l_start, end); - - return (0); - } -#endif - return (error); } EXPORT_SYMBOL(vn_space); diff --git a/module/os/linux/spl/spl-zlib.c b/module/os/linux/spl/spl-zlib.c index 62423343c..84026d710 100644 --- a/module/os/linux/spl/spl-zlib.c +++ b/module/os/linux/spl/spl-zlib.c @@ -196,7 +196,7 @@ spl_zlib_init(void) { int size; - size = MAX(spl_zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL), + size = MAX(zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL), zlib_inflate_workspacesize()); zlib_workspace_cache = kmem_cache_create( diff --git a/module/os/linux/zfs/abd.c b/module/os/linux/zfs/abd.c index ac6b0b742..40d73de0a 100644 --- a/module/os/linux/zfs/abd.c +++ b/module/os/linux/zfs/abd.c @@ -1043,20 +1043,6 @@ abd_release_ownership_of_buf(abd_t *abd) ABDSTAT_INCR(abdstat_linear_data_size, -(int)abd->abd_size); } -#ifndef HAVE_1ARG_KMAP_ATOMIC -#define NR_KM_TYPE (6) -#ifdef _KERNEL -int km_table[NR_KM_TYPE] = { - KM_USER0, - KM_USER1, - KM_BIO_SRC_IRQ, - KM_BIO_DST_IRQ, - KM_PTE0, - KM_PTE1, -}; -#endif -#endif - struct abd_iter { /* public interface */ void *iter_mapaddr; /* addr corresponding to iter_pos */ @@ -1068,9 +1054,6 @@ struct abd_iter { size_t iter_offset; /* offset in current sg/abd_buf, */ /* abd_offset included */ struct scatterlist *iter_sg; /* current sg */ -#ifndef HAVE_1ARG_KMAP_ATOMIC - int iter_km; /* KM_* for kmap_atomic */ -#endif }; /* @@ -1091,10 +1074,6 @@ abd_iter_init(struct abd_iter *aiter, abd_t *abd, int km_type) aiter->iter_offset = ABD_SCATTER(abd).abd_offset; aiter->iter_sg = ABD_SCATTER(abd).abd_sgl; } -#ifndef HAVE_1ARG_KMAP_ATOMIC - ASSERT3U(km_type, <, NR_KM_TYPE); - aiter->iter_km = km_type; -#endif } /* diff --git a/module/os/linux/zfs/policy.c b/module/os/linux/zfs/policy.c index 7f9456a67..8cfc6fdc9 100644 --- a/module/os/linux/zfs/policy.c +++ b/module/os/linux/zfs/policy.c @@ -50,7 +50,7 @@ priv_policy_ns(const cred_t *cr, int capability, boolean_t all, int err, if (cr != CRED() && (cr != kcred)) return (err); -#if defined(CONFIG_USER_NS) && defined(HAVE_NS_CAPABLE) +#if defined(CONFIG_USER_NS) if (!(ns ? ns_capable(ns, capability) : capable(capability))) #else if (!capable(capability)) @@ -73,10 +73,9 @@ priv_policy_user(const cred_t *cr, int capability, boolean_t all, int err) * All priv_policy_user checks are preceded by kuid/kgid_has_mapping() * checks. If we cannot do them, we shouldn't be using ns_capable() * since we don't know whether the affected files are valid in our - * namespace. Note that kuid_has_mapping() came after cred->user_ns, so - * we shouldn't need to re-check for HAVE_CRED_USER_NS + * namespace. */ -#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING) +#if defined(CONFIG_USER_NS) return (priv_policy_ns(cr, capability, all, err, cr->user_ns)); #else return (priv_policy_ns(cr, capability, all, err, NULL)); @@ -127,10 +126,10 @@ secpolicy_vnode_any_access(const cred_t *cr, struct inode *ip, uid_t owner) if (crgetfsuid(cr) == owner) return (0); - if (zpl_inode_owner_or_capable(ip)) + if (inode_owner_or_capable(ip)) return (0); -#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING) +#if defined(CONFIG_USER_NS) if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner))) return (EPERM); #endif @@ -153,7 +152,7 @@ secpolicy_vnode_chown(const cred_t *cr, uid_t owner) if (crgetfsuid(cr) == owner) return (0); -#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING) +#if defined(CONFIG_USER_NS) if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner))) return (EPERM); #endif @@ -190,7 +189,7 @@ secpolicy_vnode_setdac(const cred_t *cr, uid_t owner) if (crgetfsuid(cr) == owner) return (0); -#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING) +#if defined(CONFIG_USER_NS) if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner))) return (EPERM); #endif @@ -218,7 +217,7 @@ secpolicy_vnode_setid_retain(const cred_t *cr, boolean_t issuidroot) int secpolicy_vnode_setids_setgids(const cred_t *cr, gid_t gid) { -#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING) +#if defined(CONFIG_USER_NS) if (!kgid_has_mapping(cr->user_ns, SGID_TO_KGID(gid))) return (EPERM); #endif @@ -269,7 +268,7 @@ secpolicy_vnode_setid_modify(const cred_t *cr, uid_t owner) if (crgetfsuid(cr) == owner) return (0); -#if defined(CONFIG_USER_NS) && defined(HAVE_KUID_HAS_MAPPING) +#if defined(CONFIG_USER_NS) if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner))) return (EPERM); #endif diff --git a/module/os/linux/zfs/vdev_disk.c b/module/os/linux/zfs/vdev_disk.c index 6b4c035f0..ed0e7a173 100644 --- a/module/os/linux/zfs/vdev_disk.c +++ b/module/os/linux/zfs/vdev_disk.c @@ -54,8 +54,6 @@ typedef struct dio_request { struct bio *dr_bio[0]; /* Attached bio's */ } dio_request_t; - -#if defined(HAVE_OPEN_BDEV_EXCLUSIVE) || defined(HAVE_BLKDEV_GET_BY_PATH) static fmode_t vdev_bdev_mode(int smode) { @@ -71,20 +69,6 @@ vdev_bdev_mode(int smode) return (mode); } -#else -static int -vdev_bdev_mode(int smode) -{ - int mode = 0; - - ASSERT3S(smode & (FREAD | FWRITE), !=, 0); - - if ((smode & FREAD) && !(smode & FWRITE)) - mode = SB_RDONLY; - - return (mode); -} -#endif /* HAVE_OPEN_BDEV_EXCLUSIVE */ /* * Returns the usable capacity (in bytes) for the partition or disk. @@ -267,14 +251,15 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize, reread_part = B_TRUE; } - vdev_bdev_close(bdev, mode); + blkdev_put(bdev, mode | FMODE_EXCL); } if (reread_part) { - bdev = vdev_bdev_open(disk_name, mode, zfs_vdev_holder); + bdev = blkdev_get_by_path(disk_name, mode | FMODE_EXCL, + zfs_vdev_holder); if (!IS_ERR(bdev)) { int error = vdev_bdev_reread_part(bdev); - vdev_bdev_close(bdev, mode); + blkdev_put(bdev, mode | FMODE_EXCL); if (error == 0) bdev_retry_count = 100; } @@ -311,7 +296,8 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize, */ bdev = ERR_PTR(-ENXIO); while (IS_ERR(bdev) && count < bdev_retry_count) { - bdev = vdev_bdev_open(v->vdev_path, mode, zfs_vdev_holder); + bdev = blkdev_get_by_path(v->vdev_path, mode | FMODE_EXCL, + zfs_vdev_holder); if (unlikely(PTR_ERR(bdev) == -ENOENT)) { schedule_timeout(MSEC_TO_TICK(10)); count++; @@ -336,7 +322,7 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize, struct request_queue *q = bdev_get_queue(vd->vd_bdev); /* Determine the physical block size */ - block_size = vdev_bdev_block_size(vd->vd_bdev); + block_size = bdev_physical_block_size(vd->vd_bdev); /* Clear the nowritecache bit, causes vdev_reopen() to try again. */ v->vdev_nowritecache = B_FALSE; @@ -374,8 +360,8 @@ vdev_disk_close(vdev_t *v) return; if (vd->vd_bdev != NULL) { - vdev_bdev_close(vd->vd_bdev, - vdev_bdev_mode(spa_mode(v->vdev_spa))); + blkdev_put(vd->vd_bdev, + vdev_bdev_mode(spa_mode(v->vdev_spa)) | FMODE_EXCL); } rw_destroy(&vd->vd_lock); @@ -563,17 +549,10 @@ bio_set_dev(struct bio *bio, struct block_device *bdev) static inline void vdev_submit_bio(struct bio *bio) { -#ifdef HAVE_CURRENT_BIO_TAIL - struct bio **bio_tail = current->bio_tail; - current->bio_tail = NULL; - vdev_submit_bio_impl(bio); - current->bio_tail = bio_tail; -#else struct bio_list *bio_list = current->bio_list; current->bio_list = NULL; vdev_submit_bio_impl(bio); current->bio_list = bio_list; -#endif } static int @@ -585,9 +564,8 @@ __vdev_disk_physio(struct block_device *bdev, zio_t *zio, uint64_t bio_offset; int bio_size, bio_count = 16; int i = 0, error = 0; -#if defined(HAVE_BLK_QUEUE_HAVE_BLK_PLUG) struct blk_plug plug; -#endif + /* * Accessing outside the block device is never allowed. */ @@ -666,20 +644,16 @@ retry: /* Extra reference to protect dio_request during vdev_submit_bio */ vdev_disk_dio_get(dr); -#if defined(HAVE_BLK_QUEUE_HAVE_BLK_PLUG) if (dr->dr_bio_count > 1) blk_start_plug(&plug); -#endif /* Submit all bio's associated with this dio */ for (i = 0; i < dr->dr_bio_count; i++) if (dr->dr_bio[i]) vdev_submit_bio(dr->dr_bio[i]); -#if defined(HAVE_BLK_QUEUE_HAVE_BLK_PLUG) if (dr->dr_bio_count > 1) blk_finish_plug(&plug); -#endif (void) vdev_disk_dio_put(dr); @@ -736,7 +710,7 @@ vdev_disk_io_start(zio_t *zio) vdev_t *v = zio->io_vd; vdev_disk_t *vd = v->vdev_tsd; unsigned long trim_flags = 0; - int rw, flags, error; + int rw, error; /* * If the vdev is closed, it's likely in the REMOVED or FAULTED state. @@ -801,24 +775,10 @@ vdev_disk_io_start(zio_t *zio) return; case ZIO_TYPE_WRITE: rw = WRITE; -#if defined(HAVE_BLK_QUEUE_HAVE_BIO_RW_UNPLUG) - flags = (1 << BIO_RW_UNPLUG); -#elif defined(REQ_UNPLUG) - flags = REQ_UNPLUG; -#else - flags = 0; -#endif break; case ZIO_TYPE_READ: rw = READ; -#if defined(HAVE_BLK_QUEUE_HAVE_BIO_RW_UNPLUG) - flags = (1 << BIO_RW_UNPLUG); -#elif defined(REQ_UNPLUG) - flags = REQ_UNPLUG; -#else - flags = 0; -#endif break; case ZIO_TYPE_TRIM: @@ -843,7 +803,7 @@ vdev_disk_io_start(zio_t *zio) zio->io_target_timestamp = zio_handle_io_delay(zio); error = __vdev_disk_physio(vd->vd_bdev, zio, - zio->io_size, zio->io_offset, rw, flags); + zio->io_size, zio->io_offset, rw, 0); rw_exit(&vd->vd_lock); if (error) { @@ -866,7 +826,7 @@ vdev_disk_io_done(zio_t *zio) vdev_disk_t *vd = v->vdev_tsd; if (check_disk_change(vd->vd_bdev)) { - vdev_bdev_invalidate(vd->vd_bdev); + invalidate_bdev(vd->vd_bdev); v->vdev_remove_wanted = B_TRUE; spa_async_request(zio->io_spa, SPA_ASYNC_REMOVE); } diff --git a/module/os/linux/zfs/zfs_ctldir.c b/module/os/linux/zfs/zfs_ctldir.c index 3a53c75b1..909748f51 100644 --- a/module/os/linux/zfs/zfs_ctldir.c +++ b/module/os/linux/zfs/zfs_ctldir.c @@ -1106,7 +1106,7 @@ zfsctl_snapshot_mount(struct path *path, int flags) */ spath = *path; path_get(&spath); - if (zpl_follow_down_one(&spath)) { + if (follow_down_one(&spath)) { snap_zfsvfs = ITOZSB(spath.dentry->d_inode); snap_zfsvfs->z_parent = zfsvfs; dentry = spath.dentry; diff --git a/module/os/linux/zfs/zfs_vfsops.c b/module/os/linux/zfs/zfs_vfsops.c index 75840dfe7..c0acaab0b 100644 --- a/module/os/linux/zfs/zfs_vfsops.c +++ b/module/os/linux/zfs/zfs_vfsops.c @@ -1608,7 +1608,6 @@ zfs_root(zfsvfs_t *zfsvfs, struct inode **ipp) return (error); } -#ifdef HAVE_D_PRUNE_ALIASES /* * Linux kernels older than 3.1 do not support a per-filesystem shrinker. * To accommodate this we must improvise and manually walk the list of znodes @@ -1666,7 +1665,6 @@ zfs_prune_aliases(zfsvfs_t *zfsvfs, unsigned long nr_to_scan) return (objects); } -#endif /* HAVE_D_PRUNE_ALIASES */ /* * The ARC has requested that the filesystem drop entries from the dentry @@ -1678,13 +1676,11 @@ zfs_prune(struct super_block *sb, unsigned long nr_to_scan, int *objects) { zfsvfs_t *zfsvfs = sb->s_fs_info; int error = 0; -#if defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK) struct shrinker *shrinker = &sb->s_shrink; struct shrink_control sc = { .nr_to_scan = nr_to_scan, .gfp_mask = GFP_KERNEL, }; -#endif ZFS_ENTER(zfsvfs); @@ -1702,7 +1698,7 @@ zfs_prune(struct super_block *sb, unsigned long nr_to_scan, int *objects) #elif defined(HAVE_SPLIT_SHRINKER_CALLBACK) *objects = (*shrinker->scan_objects)(shrinker, &sc); -#elif defined(HAVE_SHRINK) +#elif defined(HAVE_SINGLE_SHRINKER_CALLBACK) *objects = (*shrinker->shrink)(shrinker, &sc); #elif defined(HAVE_D_PRUNE_ALIASES) #define D_PRUNE_ALIASES_IS_DEFAULT @@ -1877,8 +1873,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting) return (0); } -#if !defined(HAVE_2ARGS_BDI_SETUP_AND_REGISTER) && \ - !defined(HAVE_3ARGS_BDI_SETUP_AND_REGISTER) +#if defined(HAVE_SUPER_SETUP_BDI_NAME) atomic_long_t zfs_bdi_seq = ATOMIC_LONG_INIT(0); #endif diff --git a/module/os/linux/zfs/zpl_ctldir.c b/module/os/linux/zfs/zpl_ctldir.c index 6df367b81..052d937de 100644 --- a/module/os/linux/zfs/zpl_ctldir.c +++ b/module/os/linux/zfs/zpl_ctldir.c @@ -114,11 +114,7 @@ zpl_root_getattr_impl(const struct path *path, struct kstat *stat, ZPL_GETATTR_WRAPPER(zpl_root_getattr); static struct dentry * -#ifdef HAVE_LOOKUP_NAMEIDATA -zpl_root_lookup(struct inode *dip, struct dentry *dentry, struct nameidata *nd) -#else zpl_root_lookup(struct inode *dip, struct dentry *dentry, unsigned int flags) -#endif { cred_t *cr = CRED(); struct inode *ip; @@ -160,7 +156,6 @@ const struct inode_operations zpl_ops_root = { .getattr = zpl_root_getattr, }; -#ifdef HAVE_AUTOMOUNT static struct vfsmount * zpl_snapdir_automount(struct path *path) { @@ -179,7 +174,6 @@ zpl_snapdir_automount(struct path *path) */ return (NULL); } -#endif /* HAVE_AUTOMOUNT */ /* * Negative dentries must always be revalidated so newly created snapshots @@ -206,21 +200,13 @@ dentry_operations_t zpl_dops_snapdirs = { * name space. While it might be possible to add compatibility * code to accomplish this it would require considerable care. */ -#ifdef HAVE_AUTOMOUNT .d_automount = zpl_snapdir_automount, -#endif /* HAVE_AUTOMOUNT */ .d_revalidate = zpl_snapdir_revalidate, }; static struct dentry * -#ifdef HAVE_LOOKUP_NAMEIDATA -zpl_snapdir_lookup(struct inode *dip, struct dentry *dentry, - struct nameidata *nd) -#else zpl_snapdir_lookup(struct inode *dip, struct dentry *dentry, unsigned int flags) -#endif - { fstrans_cookie_t cookie; cred_t *cr = CRED(); @@ -241,9 +227,7 @@ zpl_snapdir_lookup(struct inode *dip, struct dentry *dentry, ASSERT(error == 0 || ip == NULL); d_clear_d_op(dentry); d_set_d_op(dentry, &zpl_dops_snapdirs); -#ifdef HAVE_AUTOMOUNT dentry->d_flags |= DCACHE_NEED_AUTOMOUNT; -#endif return (d_splice_alias(ip, dentry)); } @@ -348,7 +332,7 @@ zpl_snapdir_rmdir(struct inode *dip, struct dentry *dentry) } static int -zpl_snapdir_mkdir(struct inode *dip, struct dentry *dentry, zpl_umode_t mode) +zpl_snapdir_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode) { cred_t *cr = CRED(); vattr_t *vap; @@ -433,13 +417,8 @@ const struct inode_operations zpl_ops_snapdir = { }; static struct dentry * -#ifdef HAVE_LOOKUP_NAMEIDATA -zpl_shares_lookup(struct inode *dip, struct dentry *dentry, - struct nameidata *nd) -#else zpl_shares_lookup(struct inode *dip, struct dentry *dentry, unsigned int flags) -#endif { fstrans_cookie_t cookie; cred_t *cr = CRED(); diff --git a/module/os/linux/zfs/zpl_export.c b/module/os/linux/zfs/zpl_export.c index a264d664c..97e9283dd 100644 --- a/module/os/linux/zfs/zpl_export.c +++ b/module/os/linux/zfs/zpl_export.c @@ -65,25 +65,6 @@ zpl_encode_fh(struct dentry *dentry, __u32 *fh, int *max_len, int connectable) } static struct dentry * -zpl_dentry_obtain_alias(struct inode *ip) -{ - struct dentry *result; - -#ifdef HAVE_D_OBTAIN_ALIAS - result = d_obtain_alias(ip); -#else - result = d_alloc_anon(ip); - - if (result == NULL) { - iput(ip); - result = ERR_PTR(-ENOMEM); - } -#endif /* HAVE_D_OBTAIN_ALIAS */ - - return (result); -} - -static struct dentry * zpl_fh_to_dentry(struct super_block *sb, struct fid *fh, int fh_len, int fh_type) { @@ -121,7 +102,7 @@ zpl_fh_to_dentry(struct super_block *sb, struct fid *fh, ASSERT((ip != NULL) && !IS_ERR(ip)); - return (zpl_dentry_obtain_alias(ip)); + return (d_obtain_alias(ip)); } static struct dentry * @@ -142,10 +123,9 @@ zpl_get_parent(struct dentry *child) if (error) return (ERR_PTR(error)); - return (zpl_dentry_obtain_alias(ip)); + return (d_obtain_alias(ip)); } -#ifdef HAVE_COMMIT_METADATA static int zpl_commit_metadata(struct inode *inode) { @@ -165,13 +145,10 @@ zpl_commit_metadata(struct inode *inode) return (error); } -#endif /* HAVE_COMMIT_METADATA */ const struct export_operations zpl_export_operations = { .encode_fh = zpl_encode_fh, .fh_to_dentry = zpl_fh_to_dentry, .get_parent = zpl_get_parent, -#ifdef HAVE_COMMIT_METADATA .commit_metadata = zpl_commit_metadata, -#endif /* HAVE_COMMIT_METADATA */ }; diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c index acad4670d..b098703c2 100644 --- a/module/os/linux/zfs/zpl_file.c +++ b/module/os/linux/zfs/zpl_file.c @@ -108,40 +108,7 @@ zpl_readdir(struct file *filp, void *dirent, filldir_t filldir) } #endif /* !HAVE_VFS_ITERATE && !HAVE_VFS_ITERATE_SHARED */ -#if defined(HAVE_FSYNC_WITH_DENTRY) -/* - * Linux 2.6.x - 2.6.34 API, - * Through 2.6.34 the nfsd kernel server would pass a NULL 'file struct *' - * to the fops->fsync() hook. For this reason, we must be careful not to - * use filp unconditionally. - */ -static int -zpl_fsync(struct file *filp, struct dentry *dentry, int datasync) -{ - cred_t *cr = CRED(); - int error; - fstrans_cookie_t cookie; - - crhold(cr); - cookie = spl_fstrans_mark(); - error = -zfs_fsync(dentry->d_inode, datasync, cr); - spl_fstrans_unmark(cookie); - crfree(cr); - ASSERT3S(error, <=, 0); - - return (error); -} - -#ifdef HAVE_FILE_AIO_FSYNC -static int -zpl_aio_fsync(struct kiocb *kiocb, int datasync) -{ - struct file *filp = kiocb->ki_filp; - return (zpl_fsync(filp, file_dentry(filp), datasync)); -} -#endif - -#elif defined(HAVE_FSYNC_WITHOUT_DENTRY) +#if defined(HAVE_FSYNC_WITHOUT_DENTRY) /* * Linux 2.6.35 - 3.0 API, * As of 2.6.35 the dentry argument to the fops->fsync() hook was deemed @@ -758,8 +725,7 @@ zpl_writepage(struct page *pp, struct writeback_control *wbc) * is FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE. The FALLOC_FL_PUNCH_HOLE * flag was introduced in the 2.6.38 kernel. */ -#if defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE) -long +static long zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len) { int error = -EOPNOTSUPP; @@ -803,16 +769,13 @@ zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len) ASSERT3S(error, <=, 0); return (error); } -#endif /* defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE) */ -#ifdef HAVE_FILE_FALLOCATE static long zpl_fallocate(struct file *filp, int mode, loff_t offset, loff_t len) { return zpl_fallocate_common(file_inode(filp), mode, offset, len); } -#endif /* HAVE_FILE_FALLOCATE */ #define ZFS_FL_USER_VISIBLE (FS_FL_USER_VISIBLE | ZFS_PROJINHERIT_FL) #define ZFS_FL_USER_MODIFIABLE (FS_FL_USER_MODIFIABLE | ZFS_PROJINHERIT_FL) @@ -883,7 +846,7 @@ __zpl_ioctl_setflags(struct inode *ip, uint32_t ioctl_flags, xvattr_t *xva) !capable(CAP_LINUX_IMMUTABLE)) return (-EACCES); - if (!zpl_inode_owner_or_capable(ip)) + if (!inode_owner_or_capable(ip)) return (-EACCES); xva_init(xva); @@ -1048,9 +1011,7 @@ const struct file_operations zpl_file_operations = { #ifdef HAVE_FILE_AIO_FSYNC .aio_fsync = zpl_aio_fsync, #endif -#ifdef HAVE_FILE_FALLOCATE .fallocate = zpl_fallocate, -#endif /* HAVE_FILE_FALLOCATE */ .unlocked_ioctl = zpl_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = zpl_compat_ioctl, diff --git a/module/os/linux/zfs/zpl_inode.c b/module/os/linux/zfs/zpl_inode.c index 4c628f608..7912a5b3d 100644 --- a/module/os/linux/zfs/zpl_inode.c +++ b/module/os/linux/zfs/zpl_inode.c @@ -35,11 +35,7 @@ static struct dentry * -#ifdef HAVE_LOOKUP_NAMEIDATA -zpl_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) -#else zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) -#endif { cred_t *cr = CRED(); struct inode *ip; @@ -113,7 +109,7 @@ zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) } void -zpl_vap_init(vattr_t *vap, struct inode *dir, zpl_umode_t mode, cred_t *cr) +zpl_vap_init(vattr_t *vap, struct inode *dir, umode_t mode, cred_t *cr) { vap->va_mask = ATTR_MODE; vap->va_mode = mode; @@ -129,13 +125,7 @@ zpl_vap_init(vattr_t *vap, struct inode *dir, zpl_umode_t mode, cred_t *cr) } static int -#ifdef HAVE_CREATE_NAMEIDATA -zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode, - struct nameidata *nd) -#else -zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode, - bool flag) -#endif +zpl_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool flag) { cred_t *cr = CRED(); struct inode *ip; @@ -169,7 +159,7 @@ zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode, } static int -zpl_mknod(struct inode *dir, struct dentry *dentry, zpl_umode_t mode, +zpl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) { cred_t *cr = CRED(); @@ -213,7 +203,7 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, zpl_umode_t mode, #ifdef HAVE_TMPFILE static int -zpl_tmpfile(struct inode *dir, struct dentry *dentry, zpl_umode_t mode) +zpl_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) { cred_t *cr = CRED(); struct inode *ip; @@ -277,7 +267,7 @@ zpl_unlink(struct inode *dir, struct dentry *dentry) } static int -zpl_mkdir(struct inode *dir, struct dentry *dentry, zpl_umode_t mode) +zpl_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) { cred_t *cr = CRED(); vattr_t *vap; @@ -612,46 +602,6 @@ out: return (error); } -#ifdef HAVE_INODE_TRUNCATE_RANGE -static void -zpl_truncate_range(struct inode *ip, loff_t start, loff_t end) -{ - cred_t *cr = CRED(); - flock64_t bf; - fstrans_cookie_t cookie; - - ASSERT3S(start, <=, end); - - /* - * zfs_freesp() will interpret (len == 0) as meaning "truncate until - * the end of the file". We don't want that. - */ - if (start == end) - return; - - crhold(cr); - - bf.l_type = F_WRLCK; - bf.l_whence = SEEK_SET; - bf.l_start = start; - bf.l_len = end - start; - bf.l_pid = 0; - cookie = spl_fstrans_mark(); - zfs_space(ip, F_FREESP, &bf, FWRITE, start, cr); - spl_fstrans_unmark(cookie); - - crfree(cr); -} -#endif /* HAVE_INODE_TRUNCATE_RANGE */ - -#ifdef HAVE_INODE_FALLOCATE -static long -zpl_fallocate(struct inode *ip, int mode, loff_t offset, loff_t len) -{ - return (zpl_fallocate_common(ip, mode, offset, len)); -} -#endif /* HAVE_INODE_FALLOCATE */ - const struct inode_operations zpl_inode_operations = { .setattr = zpl_setattr, .getattr = zpl_getattr, @@ -661,23 +611,11 @@ const struct inode_operations zpl_inode_operations = { .removexattr = generic_removexattr, #endif .listxattr = zpl_xattr_list, -#ifdef HAVE_INODE_TRUNCATE_RANGE - .truncate_range = zpl_truncate_range, -#endif /* HAVE_INODE_TRUNCATE_RANGE */ -#ifdef HAVE_INODE_FALLOCATE - .fallocate = zpl_fallocate, -#endif /* HAVE_INODE_FALLOCATE */ #if defined(CONFIG_FS_POSIX_ACL) #if defined(HAVE_SET_ACL) .set_acl = zpl_set_acl, -#endif -#if defined(HAVE_GET_ACL) +#endif /* HAVE_SET_ACL */ .get_acl = zpl_get_acl, -#elif defined(HAVE_CHECK_ACL) - .check_acl = zpl_check_acl, -#elif defined(HAVE_PERMISSION) - .permission = zpl_permission, -#endif /* HAVE_GET_ACL | HAVE_CHECK_ACL | HAVE_PERMISSION */ #endif /* CONFIG_FS_POSIX_ACL */ }; @@ -709,14 +647,8 @@ const struct inode_operations zpl_dir_inode_operations = { #if defined(CONFIG_FS_POSIX_ACL) #if defined(HAVE_SET_ACL) .set_acl = zpl_set_acl, -#endif -#if defined(HAVE_GET_ACL) +#endif /* HAVE_SET_ACL */ .get_acl = zpl_get_acl, -#elif defined(HAVE_CHECK_ACL) - .check_acl = zpl_check_acl, -#elif defined(HAVE_PERMISSION) - .permission = zpl_permission, -#endif /* HAVE_GET_ACL | HAVE_CHECK_ACL | HAVE_PERMISSION */ #endif /* CONFIG_FS_POSIX_ACL */ }; @@ -754,13 +686,7 @@ const struct inode_operations zpl_special_inode_operations = { #if defined(CONFIG_FS_POSIX_ACL) #if defined(HAVE_SET_ACL) .set_acl = zpl_set_acl, -#endif -#if defined(HAVE_GET_ACL) +#endif /* HAVE_SET_ACL */ .get_acl = zpl_get_acl, -#elif defined(HAVE_CHECK_ACL) - .check_acl = zpl_check_acl, -#elif defined(HAVE_PERMISSION) - .permission = zpl_permission, -#endif /* HAVE_GET_ACL | HAVE_CHECK_ACL | HAVE_PERMISSION */ #endif /* CONFIG_FS_POSIX_ACL */ }; diff --git a/module/os/linux/zfs/zpl_super.c b/module/os/linux/zfs/zpl_super.c index 810ab2898..eafd4952b 100644 --- a/module/os/linux/zfs/zpl_super.c +++ b/module/os/linux/zfs/zpl_super.c @@ -81,18 +81,6 @@ zpl_dirty_inode(struct inode *ip) * unhashed and has no links the default policy is to evict it * immediately. * - * Prior to 2.6.36 this eviction was accomplished by the vfs calling - * ->delete_inode(). It was ->delete_inode()'s responsibility to - * truncate the inode pages and call clear_inode(). The call to - * clear_inode() synchronously invalidates all the buffers and - * calls ->clear_inode(). It was ->clear_inode()'s responsibility - * to cleanup and filesystem specific data before freeing the inode. - * - * This elaborate mechanism was replaced by ->evict_inode() which - * does the job of both ->delete_inode() and ->clear_inode(). It - * will be called exactly once, and when it returns the inode must - * be in a state where it can simply be freed.i - * * The ->evict_inode() callback must minimally truncate the inode pages, * and call clear_inode(). For 2.6.35 and later kernels this will * simply update the inode state, with the sync occurring before the @@ -102,7 +90,6 @@ zpl_dirty_inode(struct inode *ip) * any remaining inode specific data via zfs_inactive(). * remaining filesystem specific data. */ -#ifdef HAVE_EVICT_INODE static void zpl_evict_inode(struct inode *ip) { @@ -115,32 +102,6 @@ zpl_evict_inode(struct inode *ip) spl_fstrans_unmark(cookie); } -#else - -static void -zpl_drop_inode(struct inode *ip) -{ - generic_delete_inode(ip); -} - -static void -zpl_clear_inode(struct inode *ip) -{ - fstrans_cookie_t cookie; - - cookie = spl_fstrans_mark(); - zfs_inactive(ip); - spl_fstrans_unmark(cookie); -} - -static void -zpl_inode_delete(struct inode *ip) -{ - truncate_setsize(ip, 0); - clear_inode(ip); -} -#endif /* HAVE_EVICT_INODE */ - static void zpl_put_super(struct super_block *sb) { @@ -241,19 +202,11 @@ __zpl_show_options(struct seq_file *seq, zfsvfs_t *zfsvfs) return (0); } -#ifdef HAVE_SHOW_OPTIONS_WITH_DENTRY static int zpl_show_options(struct seq_file *seq, struct dentry *root) { return (__zpl_show_options(seq, root->d_sb->s_fs_info)); } -#else -static int -zpl_show_options(struct seq_file *seq, struct vfsmount *vfsp) -{ - return (__zpl_show_options(seq, vfsp->mnt_sb->s_fs_info)); -} -#endif /* HAVE_SHOW_OPTIONS_WITH_DENTRY */ static int zpl_fill_super(struct super_block *sb, void *data, int silent) @@ -301,7 +254,7 @@ zpl_mount_impl(struct file_system_type *fs_type, int flags, zfs_mnt_t *zm) * this can prevent the pool sync and cause a deadlock. */ dsl_pool_rele(dmu_objset_pool(os), FTAG); - s = zpl_sget(fs_type, zpl_test_super, set_anon_super, flags, os); + s = sget(fs_type, zpl_test_super, set_anon_super, flags, os); dsl_dataset_rele(dmu_objset_ds(os), FTAG); if (IS_ERR(s)) @@ -322,7 +275,6 @@ zpl_mount_impl(struct file_system_type *fs_type, int flags, zfs_mnt_t *zm) return (s); } -#ifdef HAVE_FST_MOUNT static struct dentry * zpl_mount(struct file_system_type *fs_type, int flags, const char *osname, void *data) @@ -335,32 +287,12 @@ zpl_mount(struct file_system_type *fs_type, int flags, return (dget(sb->s_root)); } -#else -static int -zpl_get_sb(struct file_system_type *fs_type, int flags, - const char *osname, void *data, struct vfsmount *mnt) -{ - zfs_mnt_t zm = { .mnt_osname = osname, .mnt_data = data }; - - struct super_block *sb = zpl_mount_impl(fs_type, flags, &zm); - if (IS_ERR(sb)) - return (PTR_ERR(sb)); - - (void) simple_set_mnt(mnt, sb); - - return (0); -} -#endif /* HAVE_FST_MOUNT */ static void zpl_kill_sb(struct super_block *sb) { zfs_preumount(sb); kill_anon_super(sb); - -#ifdef HAVE_S_INSTANCES_LIST_HEAD - sb->s_instances.next = &(zpl_fs_type.fs_supers); -#endif /* HAVE_S_INSTANCES_LIST_HEAD */ } void @@ -372,55 +304,23 @@ zpl_prune_sb(int64_t nr_to_scan, void *arg) (void) -zfs_prune(sb, nr_to_scan, &objects); } -#ifdef HAVE_NR_CACHED_OBJECTS -static int -zpl_nr_cached_objects(struct super_block *sb) -{ - return (0); -} -#endif /* HAVE_NR_CACHED_OBJECTS */ - -#ifdef HAVE_FREE_CACHED_OBJECTS -static void -zpl_free_cached_objects(struct super_block *sb, int nr_to_scan) -{ - /* noop */ -} -#endif /* HAVE_FREE_CACHED_OBJECTS */ - const struct super_operations zpl_super_operations = { .alloc_inode = zpl_inode_alloc, .destroy_inode = zpl_inode_destroy, .dirty_inode = zpl_dirty_inode, .write_inode = NULL, -#ifdef HAVE_EVICT_INODE .evict_inode = zpl_evict_inode, -#else - .drop_inode = zpl_drop_inode, - .clear_inode = zpl_clear_inode, - .delete_inode = zpl_inode_delete, -#endif /* HAVE_EVICT_INODE */ .put_super = zpl_put_super, .sync_fs = zpl_sync_fs, .statfs = zpl_statfs, .remount_fs = zpl_remount_fs, .show_options = zpl_show_options, .show_stats = NULL, -#ifdef HAVE_NR_CACHED_OBJECTS - .nr_cached_objects = zpl_nr_cached_objects, -#endif /* HAVE_NR_CACHED_OBJECTS */ -#ifdef HAVE_FREE_CACHED_OBJECTS - .free_cached_objects = zpl_free_cached_objects, -#endif /* HAVE_FREE_CACHED_OBJECTS */ }; struct file_system_type zpl_fs_type = { .owner = THIS_MODULE, .name = ZFS_DRIVER, -#ifdef HAVE_FST_MOUNT .mount = zpl_mount, -#else - .get_sb = zpl_get_sb, -#endif /* HAVE_FST_MOUNT */ .kill_sb = zpl_kill_sb, }; diff --git a/module/os/linux/zfs/zpl_xattr.c b/module/os/linux/zfs/zpl_xattr.c index 082287b00..fdcd77541 100644 --- a/module/os/linux/zfs/zpl_xattr.c +++ b/module/os/linux/zfs/zpl_xattr.c @@ -113,9 +113,6 @@ zpl_xattr_permission(xattr_filldir_t *xf, const char *name, int name_len) #elif defined(HAVE_XATTR_LIST_HANDLER) if (!handler->list(handler, d, NULL, 0, name, name_len)) return (0); -#elif defined(HAVE_XATTR_LIST_INODE) - if (!handler->list(d->d_inode, NULL, 0, name, name_len)) - return (0); #endif } @@ -870,9 +867,8 @@ __zpl_xattr_security_set(struct inode *ip, const char *name, } ZPL_XATTR_SET_WRAPPER(zpl_xattr_security_set); -#ifdef HAVE_CALLBACK_SECURITY_INODE_INIT_SECURITY static int -__zpl_xattr_security_init(struct inode *ip, const struct xattr *xattrs, +zpl_xattr_security_init_impl(struct inode *ip, const struct xattr *xattrs, void *fs_info) { const struct xattr *xattr; @@ -894,36 +890,8 @@ zpl_xattr_security_init(struct inode *ip, struct inode *dip, const struct qstr *qstr) { return security_inode_init_security(ip, dip, qstr, - &__zpl_xattr_security_init, NULL); -} - -#else -int -zpl_xattr_security_init(struct inode *ip, struct inode *dip, - const struct qstr *qstr) -{ - int error; - size_t len; - void *value; - char *name; - - error = zpl_security_inode_init_security(ip, dip, qstr, - &name, &value, &len); - if (error) { - if (error == -EOPNOTSUPP) - return (0); - - return (error); - } - - error = __zpl_xattr_security_set(ip, name, value, len, 0); - - kfree(name); - kfree(value); - - return (error); + &zpl_xattr_security_init_impl, NULL); } -#endif /* HAVE_CALLBACK_SECURITY_INODE_INIT_SECURITY */ /* * Security xattr namespace handlers. @@ -958,7 +926,7 @@ zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type) case ACL_TYPE_ACCESS: name = XATTR_NAME_POSIX_ACL_ACCESS; if (acl) { - zpl_equivmode_t mode = ip->i_mode; + umode_t mode = ip->i_mode; error = posix_acl_equiv_mode(acl, &mode); if (error < 0) { return (error); @@ -1073,53 +1041,6 @@ zpl_get_acl(struct inode *ip, int type) return (acl); } -#if !defined(HAVE_GET_ACL) -static int -__zpl_check_acl(struct inode *ip, int mask) -{ - struct posix_acl *acl; - int error; - - acl = zpl_get_acl(ip, ACL_TYPE_ACCESS); - if (IS_ERR(acl)) - return (PTR_ERR(acl)); - - if (acl) { - error = posix_acl_permission(ip, acl, mask); - zpl_posix_acl_release(acl); - return (error); - } - - return (-EAGAIN); -} - -#if defined(HAVE_CHECK_ACL_WITH_FLAGS) -int -zpl_check_acl(struct inode *ip, int mask, unsigned int flags) -{ - return (__zpl_check_acl(ip, mask)); -} -#elif defined(HAVE_CHECK_ACL) -int -zpl_check_acl(struct inode *ip, int mask) -{ - return (__zpl_check_acl(ip, mask)); -} -#elif defined(HAVE_PERMISSION_WITH_NAMEIDATA) -int -zpl_permission(struct inode *ip, int mask, struct nameidata *nd) -{ - return (generic_permission(ip, mask, __zpl_check_acl)); -} -#elif defined(HAVE_PERMISSION) -int -zpl_permission(struct inode *ip, int mask) -{ - return (generic_permission(ip, mask, __zpl_check_acl)); -} -#endif /* HAVE_CHECK_ACL | HAVE_PERMISSION */ -#endif /* !HAVE_GET_ACL */ - int zpl_init_acl(struct inode *ip, struct inode *dir) { @@ -1295,7 +1216,7 @@ __zpl_xattr_acl_set_access(struct inode *ip, const char *name, if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIXACL) return (-EOPNOTSUPP); - if (!zpl_inode_owner_or_capable(ip)) + if (!inode_owner_or_capable(ip)) return (-EPERM); if (value) { @@ -1335,7 +1256,7 @@ __zpl_xattr_acl_set_default(struct inode *ip, const char *name, if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIXACL) return (-EOPNOTSUPP); - if (!zpl_inode_owner_or_capable(ip)) + if (!inode_owner_or_capable(ip)) return (-EPERM); if (value) { diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c index f1ed4f04e..2b1c82e67 100644 --- a/module/os/linux/zfs/zvol_os.c +++ b/module/os/linux/zfs/zvol_os.c @@ -392,9 +392,7 @@ zvol_request(struct request_queue *q, struct bio *bio) out: spl_fstrans_unmark(cookie); -#ifdef HAVE_MAKE_REQUEST_FN_RET_INT - return (0); -#elif defined(HAVE_MAKE_REQUEST_FN_RET_QC) +#if defined(HAVE_MAKE_REQUEST_FN_RET_QC) return (BLK_QC_T_NONE); #endif } @@ -480,11 +478,7 @@ out_mutex: return (SET_ERROR(error)); } -#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID static void -#else -static int -#endif zvol_release(struct gendisk *disk, fmode_t mode) { zvol_state_t *zv; @@ -527,10 +521,6 @@ zvol_release(struct gendisk *disk, fmode_t mode) if (drop_suspend) rw_exit(&zv->zv_suspend_lock); - -#ifndef HAVE_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID - return (0); -#endif } static int @@ -579,10 +569,6 @@ zvol_compat_ioctl(struct block_device *bdev, fmode_t mode, #define zvol_compat_ioctl NULL #endif -/* - * Linux 2.6.38 preferred interface. - */ -#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS static unsigned int zvol_check_events(struct gendisk *disk, unsigned int clearing) { @@ -602,27 +588,6 @@ zvol_check_events(struct gendisk *disk, unsigned int clearing) return (mask); } -#else -static int -zvol_media_changed(struct gendisk *disk) -{ - int changed = 0; - - rw_enter(&zvol_state_lock, RW_READER); - - zvol_state_t *zv = disk->private_data; - if (zv != NULL) { - mutex_enter(&zv->zv_state_lock); - changed = zv->zv_changed; - zv->zv_changed = 0; - mutex_exit(&zv->zv_state_lock); - } - - rw_exit(&zvol_state_lock); - - return (changed); -} -#endif static int zvol_revalidate_disk(struct gendisk *disk) @@ -741,11 +706,7 @@ static struct block_device_operations zvol_ops = { .release = zvol_release, .ioctl = zvol_ioctl, .compat_ioctl = zvol_compat_ioctl, -#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS .check_events = zvol_check_events, -#else - .media_changed = zvol_media_changed, -#endif .revalidate_disk = zvol_revalidate_disk, .getgeo = zvol_getgeo, .owner = THIS_MODULE, @@ -803,9 +764,7 @@ zvol_alloc(dev_t dev, const char *name) rw_init(&zv->zv_suspend_lock, NULL, RW_DEFAULT, NULL); zv->zv_zso->zvo_disk->major = zvol_major; -#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS zv->zv_zso->zvo_disk->events = DISK_EVENT_MEDIA_CHANGE; -#endif if (volmode == ZFS_VOLMODE_DEV) { /* |