Linux compat: Minimum kernel version 3.10

Increase the minimum supported kernel version from 2.6.32 to 3.10.
This removes support for the following Linux enterprise distributions.

    Distribution     | Kernel | End of Life
    ---------------- | ------ | -------------
    Ubuntu 12.04 LTS | 3.2    | Apr 28, 2017
    SLES 11          | 3.0    | Mar 32, 2019
    RHEL / CentOS 6  | 2.6.32 | Nov 30, 2020

The following changes were made as part of removing support.

* Updated `configure` to enforce a minimum kernel version as
  specified in the META file (Linux-Minimum: 3.10).

    configure: error:
        *** Cannot build against kernel version 2.6.32.
        *** The minimum supported kernel version is 3.10.

* Removed all `configure` kABI checks and matching C code for
  interfaces which solely predate the Linux 3.10 kernel.

* Updated all `configure` kABI checks to fail when an interface is
  missing which was in the 3.10 kernel up to the latest 5.1 kernel.
  Removed the HAVE_* preprocessor defines for these checks and
  updated the code to unconditionally use the verified interface.

* Inverted the detection logic in several kABI checks to match
  the new interface as it appears in 3.10 and newer and not the
  legacy interface.

* Consolidated the following checks in to individual files. Due
  the large number of changes in the checks it made sense to handle
  this now.  It would be desirable to group other related checks in
  the same fashion, but this as left as future work.

  - config/kernel-blkdev.m4 - Block device kABI checks
  - config/kernel-blk-queue.m4 - Block queue kABI checks
  - config/kernel-bio.m4 - Bio interface kABI checks

* Removed the kABI checks for sops->nr_cached_objects() and
  sops->free_cached_objects().  These interfaces are currently unused.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #9566
This commit is contained in:
Brian Behlendorf 2019-11-12 08:59:06 -08:00 committed by GitHub
parent 035ebb3653
commit 066e825221
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
102 changed files with 1136 additions and 2965 deletions

2
META
View File

@ -7,4 +7,4 @@ Release-Tags: relext
License: CDDL License: CDDL
Author: OpenZFS on Linux Author: OpenZFS on Linux
Linux-Maximum: 5.1 Linux-Maximum: 5.1
Linux-Minimum: 2.6.32 Linux-Minimum: 3.10

View File

@ -66,11 +66,10 @@ AC_DEFUN([ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE], [
dnl # dnl #
dnl # 3.1 API change, dnl # 3.1 API change,
dnl # posix_acl_chmod_masq() is not exported anymore and posix_acl_chmod() dnl # posix_acl_chmod() was added as the preferred interface.
dnl # was introduced to replace it.
dnl # dnl #
dnl # 3.14 API change, 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 # dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD], [ AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD], [
ZFS_LINUX_TEST_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_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]) AC_MSG_CHECKING([whether __posix_acl_chmod exists])
ZFS_LINUX_TEST_RESULT([__posix_acl_chmod], [ ZFS_LINUX_TEST_RESULT([__posix_acl_chmod], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
@ -104,12 +95,21 @@ AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [
[__posix_acl_chmod() exists]) [__posix_acl_chmod() exists])
],[ ],[
AC_MSG_RESULT(no) 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 #
dnl # 3.1 API change, 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 # dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [ AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
ZFS_LINUX_TEST_SRC([posix_acl_equiv_mode], [ 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> #include <linux/posix_acl.h>
],[ ],[
umode_t tmp; 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]) AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t])
ZFS_LINUX_TEST_RESULT([posix_acl_equiv_mode], [ ZFS_LINUX_TEST_RESULT([posix_acl_equiv_mode], [
AC_MSG_RESULT(yes) 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()])
]) ])
]) ])
@ -160,123 +158,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 #
dnl # 3.1 API change, dnl # 3.1 API change,
dnl # Check if inode_operations contains the function get_acl dnl # Check if inode_operations contains the function get_acl
@ -299,9 +180,8 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
AC_MSG_CHECKING([whether iops->get_acl() exists]) AC_MSG_CHECKING([whether iops->get_acl() exists])
ZFS_LINUX_TEST_RESULT([inode_operations_get_acl], [ ZFS_LINUX_TEST_RESULT([inode_operations_get_acl], [
AC_MSG_RESULT(yes) 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_CHMOD
ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
ZFS_AC_KERNEL_SRC_POSIX_ACL_VALID_WITH_NS 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_GET_ACL
ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL
ZFS_AC_KERNEL_SRC_GET_ACL_HANDLE_CACHE 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_CHMOD
ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS 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_GET_ACL
ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL
ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE

View File

@ -12,15 +12,14 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_AUTOMOUNT], [
struct dentry_operations dops __attribute__ ((unused)) = { struct dentry_operations dops __attribute__ ((unused)) = {
.d_automount = d_automount, .d_automount = d_automount,
}; };
],[]) ])
]) ])
AC_DEFUN([ZFS_AC_KERNEL_AUTOMOUNT], [ AC_DEFUN([ZFS_AC_KERNEL_AUTOMOUNT], [
AC_MSG_CHECKING([whether dops->d_automount() exists]) AC_MSG_CHECKING([whether dops->d_automount() exists])
ZFS_LINUX_TEST_RESULT([dentry_operations_d_automount], [ ZFS_LINUX_TEST_RESULT([dentry_operations_d_automount], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_AUTOMOUNT, 1, [dops->automount() exists])
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([dops->d_automount()])
]) ])
]) ])

View File

@ -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)
])
])

View File

@ -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 <martin.petersen@oracle.com>
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)
])
])

View File

@ -72,11 +72,7 @@ AC_DEFUN([ZFS_AC_KERNEL_BDI], [
AC_DEFINE(HAVE_3ARGS_BDI_SETUP_AND_REGISTER, 1, AC_DEFINE(HAVE_3ARGS_BDI_SETUP_AND_REGISTER, 1,
[bdi_setup_and_register() wants 3 args]) [bdi_setup_and_register() wants 3 args])
], [ ], [
dnl # ZFS_LINUX_TEST_ERROR([bdi_setup])
dnl # 2.6.32 - 2.6.33, bdi_setup_and_register()
dnl # is not exported.
dnl #
AC_MSG_RESULT(no)
]) ])
]) ])
]) ])

View File

@ -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)
])
])

View File

@ -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)
])
])

View File

@ -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
])

View File

@ -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
])

View File

@ -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)
])
])

View File

@ -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)
])
])

363
config/kernel-bio.m4 Normal file
View File

@ -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
])

View File

@ -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)
])
])

View File

@ -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)
])
])

View File

@ -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)
])
])
])

View File

@ -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
])

View File

@ -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)
])
])

View File

@ -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)
])
])

View File

@ -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)
])
])

View File

@ -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
])

302
config/kernel-blk-queue.m4 Normal file
View File

@ -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
])

View File

@ -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)
])
])

View File

@ -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)
])
])

207
config/kernel-blkdev.m4 Normal file
View File

@ -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
])

View File

@ -19,10 +19,8 @@ AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [
AC_MSG_CHECKING([whether bops->check_events() exists]) AC_MSG_CHECKING([whether bops->check_events() exists])
ZFS_LINUX_TEST_RESULT([block_device_operations_check_events], [ ZFS_LINUX_TEST_RESULT([block_device_operations_check_events], [
AC_MSG_RESULT(yes) 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]) AC_MSG_CHECKING([whether bops->release() is void])
ZFS_LINUX_TEST_RESULT([block_device_operations_release_void], [ ZFS_LINUX_TEST_RESULT([block_device_operations_release_void], [
AC_MSG_RESULT(yes) 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()])
]) ])
]) ])

View File

@ -18,9 +18,7 @@ AC_DEFUN([ZFS_AC_KERNEL_COMMIT_METADATA], [
AC_MSG_CHECKING([whether eops->commit_metadata() exists]) AC_MSG_CHECKING([whether eops->commit_metadata() exists])
ZFS_LINUX_TEST_RESULT([export_operations_commit_metadata], [ ZFS_LINUX_TEST_RESULT([export_operations_commit_metadata], [
AC_MSG_RESULT(yes) 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()])
]) ])
]) ])

View File

@ -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)
])
])

View File

@ -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)
])
])

View File

@ -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])
])
])
])

View File

@ -38,10 +38,8 @@ AC_DEFUN([ZFS_AC_KERNEL_D_OBTAIN_ALIAS], [
ZFS_LINUX_TEST_RESULT_SYMBOL([d_obtain_alias], ZFS_LINUX_TEST_RESULT_SYMBOL([d_obtain_alias],
[d_obtain_alias], [fs/dcache.c], [ [d_obtain_alias], [fs/dcache.c], [
AC_MSG_RESULT(yes) 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, AC_DEFINE(HAVE_D_PRUNE_ALIASES, 1,
[d_prune_aliases() is available]) [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], ZFS_LINUX_TEST_RESULT_SYMBOL([d_set_d_op],
[d_set_d_op], [fs/dcache.c], [ [d_set_d_op], [fs/dcache.c], [
AC_MSG_RESULT(yes) 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, AC_DEFINE(HAVE_CONST_DENTRY_OPERATIONS, 1,
[dentry uses const struct dentry_operations]) [dentry uses const struct dentry_operations])
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([const dentry_operations])
]) ])
]) ])

View File

@ -15,9 +15,7 @@ AC_DEFUN([ZFS_AC_KERNEL_DISCARD_GRANULARITY], [
AC_MSG_CHECKING([whether ql->discard_granularity is available]) AC_MSG_CHECKING([whether ql->discard_granularity is available])
ZFS_LINUX_TEST_RESULT([discard_granularity], [ ZFS_LINUX_TEST_RESULT([discard_granularity], [
AC_MSG_RESULT(yes) 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])
]) ])
]) ])

View File

@ -19,6 +19,6 @@ AC_DEFUN([ZFS_AC_KERNEL_EVICT_INODE], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_EVICT_INODE, 1, [sops->evict_inode() exists]) AC_DEFINE(HAVE_EVICT_INODE, 1, [sops->evict_inode() exists])
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([evict_inode])
]) ])
]) ])

View File

@ -1,10 +1,9 @@
dnl # dnl #
dnl # Linux 2.6.38 - 3.x API
dnl # The fallocate callback was moved from the inode_operations dnl # The fallocate callback was moved from the inode_operations
dnl # structure to the file_operations structure. dnl # structure to the file_operations structure.
dnl # dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_FALLOCATE], [ AC_DEFUN([ZFS_AC_KERNEL_SRC_FALLOCATE], [
dnl # Linux 2.6.38 - 3.x API
ZFS_LINUX_TEST_SRC([file_fallocate], [ ZFS_LINUX_TEST_SRC([file_fallocate], [
#include <linux/fs.h> #include <linux/fs.h>
@ -16,35 +15,13 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FALLOCATE], [
.fallocate = test_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_DEFUN([ZFS_AC_KERNEL_FALLOCATE], [
AC_MSG_CHECKING([whether fops->fallocate() exists]) AC_MSG_CHECKING([whether fops->fallocate() exists])
ZFS_LINUX_TEST_RESULT([file_fallocate], [ ZFS_LINUX_TEST_RESULT([file_fallocate], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([file_fallocate])
])
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)
]) ])
]) ])

View File

@ -14,8 +14,7 @@ AC_DEFUN([ZFS_AC_KERNEL_FMODE_T], [
AC_MSG_CHECKING([whether kernel defines fmode_t]) AC_MSG_CHECKING([whether kernel defines fmode_t])
ZFS_LINUX_TEST_RESULT([type_fmode_t], [ ZFS_LINUX_TEST_RESULT([type_fmode_t], [
AC_MSG_RESULT([yes]) 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])
]) ])
]) ])

View File

@ -16,9 +16,7 @@ AC_DEFUN([ZFS_AC_KERNEL_FOLLOW_DOWN_ONE], [
AC_MSG_CHECKING([whether follow_down_one() is available]) AC_MSG_CHECKING([whether follow_down_one() is available])
ZFS_LINUX_TEST_RESULT([follow_down_one], [ ZFS_LINUX_TEST_RESULT([follow_down_one], [
AC_MSG_RESULT(yes) 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()])
]) ])
]) ])

View File

@ -24,8 +24,7 @@ AC_DEFUN([ZFS_AC_KERNEL_FST_MOUNT], [
AC_MSG_CHECKING([whether fst->mount() exists]) AC_MSG_CHECKING([whether fst->mount() exists])
ZFS_LINUX_TEST_RESULT([file_system_type_mount], [ ZFS_LINUX_TEST_RESULT([file_system_type_mount], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FST_MOUNT, 1, [fst->mount() exists])
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([fst->mount()])
]) ])
]) ])

View File

@ -2,18 +2,6 @@ dnl #
dnl # Check file_operations->fsync interface. dnl # Check file_operations->fsync interface.
dnl # dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_FSYNC], [ 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], [ ZFS_LINUX_TEST_SRC([fsync_without_dentry], [
#include <linux/fs.h> #include <linux/fs.h>
@ -39,17 +27,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FSYNC], [
]) ])
AC_DEFUN([ZFS_AC_KERNEL_FSYNC], [ AC_DEFUN([ZFS_AC_KERNEL_FSYNC], [
dnl #
dnl # Linux 2.6.x - 2.6.34 API
dnl #
AC_MSG_CHECKING([whether fops->fsync() wants dentry])
ZFS_LINUX_TEST_RESULT([fsync_with_dentry], [
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_FSYNC_WITH_DENTRY, 1,
[fops->fsync() with dentry])
],[
AC_MSG_RESULT([no])
dnl # dnl #
dnl # Linux 2.6.35 - Linux 3.0 API dnl # Linux 2.6.35 - Linux 3.0 API
dnl # dnl #
@ -73,5 +50,4 @@ AC_DEFUN([ZFS_AC_KERNEL_FSYNC], [
ZFS_LINUX_TEST_ERROR([fops->fsync]) ZFS_LINUX_TEST_ERROR([fops->fsync])
]) ])
]) ])
])
]) ])

View File

@ -14,8 +14,7 @@ AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_RO], [
AC_MSG_CHECKING([whether get_disk_ro() is available]) AC_MSG_CHECKING([whether get_disk_ro() is available])
ZFS_LINUX_TEST_RESULT([get_disk_ro], [ ZFS_LINUX_TEST_RESULT([get_disk_ro], [
AC_MSG_RESULT(yes) 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()])
]) ])
]) ])

View File

@ -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()])
])
])

View File

@ -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()])
])
])

View File

@ -15,9 +15,7 @@ AC_DEFUN([ZFS_AC_KERNEL_INSERT_INODE_LOCKED], [
ZFS_LINUX_TEST_RESULT_SYMBOL([insert_inode_locked], ZFS_LINUX_TEST_RESULT_SYMBOL([insert_inode_locked],
[insert_inode_locked], [fs/inode.c], [ [insert_inode_locked], [fs/inode.c], [
AC_MSG_RESULT(yes) 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()])
]) ])
]) ])

View File

@ -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)
])
])

View File

@ -11,33 +11,13 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OWNER_OR_CAPABLE], [
struct inode *ip = NULL; struct inode *ip = NULL;
(void) inode_owner_or_capable(ip); (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_DEFUN([ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE], [
AC_MSG_CHECKING([whether inode_owner_or_capable() exists]) AC_MSG_CHECKING([whether inode_owner_or_capable() exists])
ZFS_LINUX_TEST_RESULT([inode_owner_or_capable], [ ZFS_LINUX_TEST_RESULT([inode_owner_or_capable], [
AC_MSG_RESULT(yes) 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])
]) ])
])
]) ])

View File

@ -16,9 +16,7 @@ AC_DEFUN([ZFS_AC_KERNEL_KMAP_ATOMIC_ARGS], [
AC_MSG_CHECKING([whether kmap_atomic wants 1 args]) AC_MSG_CHECKING([whether kmap_atomic wants 1 args])
ZFS_LINUX_TEST_RESULT([kmap_atomic], [ ZFS_LINUX_TEST_RESULT([kmap_atomic], [
AC_MSG_RESULT(yes) 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()])
]) ])
]) ])

View File

@ -1,46 +1,3 @@
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 #
dnl # grsecurity API change, dnl # grsecurity API change,
dnl # kmem_cache_create() with SLAB_USERCOPY flag replaced by dnl # kmem_cache_create() with SLAB_USERCOPY flag replaced by
@ -76,11 +33,9 @@ AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY], [
]) ])
AC_DEFUN([ZFS_AC_KERNEL_SRC_KMEM_CACHE], [ AC_DEFUN([ZFS_AC_KERNEL_SRC_KMEM_CACHE], [
ZFS_AC_KERNEL_SRC_KMEM_CACHE_ALLOCFLAGS
ZFS_AC_KERNEL_SRC_KMEM_CACHE_CREATE_USERCOPY ZFS_AC_KERNEL_SRC_KMEM_CACHE_CREATE_USERCOPY
]) ])
AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE], [ AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE], [
ZFS_AC_KERNEL_KMEM_CACHE_ALLOCFLAGS
ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY
]) ])

View File

@ -1,8 +1,6 @@
dnl # dnl #
dnl # 2.6.39 API change dnl # 2.6.39 API change
dnl # dnl # Added kstrtoul()
dnl # If kstrtoul() doesn't exist, fallback to use strict_strtoul() which has
dnl # existed since 2.6.25.
dnl # dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_KSTRTOUL], [ AC_DEFUN([ZFS_AC_KERNEL_SRC_KSTRTOUL], [
ZFS_LINUX_TEST_SRC([kstrtoul], [ ZFS_LINUX_TEST_SRC([kstrtoul], [
@ -18,6 +16,6 @@ AC_DEFUN([ZFS_AC_KERNEL_KSTRTOUL], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_KSTRTOUL, 1, [kstrtoul() exists]) AC_DEFINE(HAVE_KSTRTOUL, 1, [kstrtoul() exists])
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([kstrtoul()])
]) ])
]) ])

View File

@ -18,9 +18,7 @@ AC_DEFUN([ZFS_AC_KERNEL_KUID_HELPERS], [
AC_MSG_CHECKING([whether i_(uid|gid)_(read|write) exist]) AC_MSG_CHECKING([whether i_(uid|gid)_(read|write) exist])
ZFS_LINUX_TEST_RESULT([i_uid_read], [ ZFS_LINUX_TEST_RESULT([i_uid_read], [
AC_MSG_RESULT(yes) 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])
]) ])
]) ])

View File

@ -1,34 +1,21 @@
dnl # dnl #
dnl # User namespaces, use kuid_t in place of uid_t dnl # 3.8 API change,
dnl # where available. Not strictly a user namespaces thing dnl # User namespaces, use kuid_t in place of uid_t where available.
dnl # but it should prevent surprises
dnl # dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_KUIDGID_T], [ 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> #include <linux/uidgid.h>
], [ ], [
kuid_t userid __attribute__ ((unused)) = KUIDT_INIT(0); kuid_t userid __attribute__ ((unused)) = KUIDT_INIT(0);
kgid_t groupid __attribute__ ((unused)) = KGIDT_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_DEFUN([ZFS_AC_KERNEL_KUIDGID_T], [
AC_MSG_CHECKING([whether kuid_t/kgid_t is available]) AC_MSG_CHECKING([whether kuid_t/kgid_t is available])
ZFS_LINUX_TEST_RESULT([kuidgid_t_init], [
ZFS_LINUX_TEST_RESULT([kuidgid_t], [ ZFS_LINUX_TEST_RESULT([kuidgid_t], [
AC_MSG_RESULT(yes; optional) AC_MSG_RESULT(yes)
],[ ],[
AC_MSG_RESULT(yes; mandatory) ZFS_LINUX_TEST_ERROR([kuid_t/kgid_t])
AC_DEFINE(HAVE_KUIDGID_T, 1, [kuid_t/kgid_t in use])
])
],[
AC_MSG_RESULT(no)
]) ])
]) ])

View File

@ -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)
])
])
])

View File

@ -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)
])
])

View File

@ -2,14 +2,6 @@ dnl #
dnl # Check for make_request_fn interface. dnl # Check for make_request_fn interface.
dnl # dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN], [ 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], [ ZFS_LINUX_TEST_SRC([make_request_fn_void], [
#include <linux/blkdev.h> #include <linux/blkdev.h>
void make_request(struct request_queue *q, void make_request(struct request_queue *q,
@ -28,20 +20,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN], [
]) ])
AC_DEFUN([ZFS_AC_KERNEL_MAKE_REQUEST_FN], [ AC_DEFUN([ZFS_AC_KERNEL_MAKE_REQUEST_FN], [
dnl #
dnl # Legacy API
dnl # make_request_fn returns int.
dnl #
AC_MSG_CHECKING([whether make_request_fn() returns int])
ZFS_LINUX_TEST_RESULT([make_request_fn_int], [
AC_MSG_RESULT(yes)
AC_DEFINE(MAKE_REQUEST_FN_RET, int,
[make_request_fn() return type])
AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_INT, 1,
[Noting that make_request_fn() returns int])
],[
AC_MSG_RESULT(no)
dnl # dnl #
dnl # Linux 3.2 API Change dnl # Linux 3.2 API Change
dnl # make_request_fn returns void. dnl # make_request_fn returns void.
@ -73,5 +51,4 @@ AC_DEFUN([ZFS_AC_KERNEL_MAKE_REQUEST_FN], [
ZFS_LINUX_TEST_ERROR([make_request_fn]) ZFS_LINUX_TEST_ERROR([make_request_fn])
]) ])
]) ])
])
]) ])

View File

@ -27,6 +27,6 @@ AC_DEFUN([ZFS_AC_KERNEL_MKDIR_UMODE_T], [
AC_DEFINE(HAVE_MKDIR_UMODE_T, 1, AC_DEFINE(HAVE_MKDIR_UMODE_T, 1,
[iops->create()/mkdir()/mknod() take umode_t]) [iops->create()/mkdir()/mknod() take umode_t])
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([mkdir()])
]) ])
]) ])

View File

@ -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)
])
])

View File

@ -14,8 +14,7 @@ AC_DEFUN([ZFS_AC_KERNEL_PDE_DATA], [
AC_MSG_CHECKING([whether PDE_DATA() is available]) AC_MSG_CHECKING([whether PDE_DATA() is available])
ZFS_LINUX_TEST_RESULT_SYMBOL([pde_data], [PDE_DATA], [], [ ZFS_LINUX_TEST_RESULT_SYMBOL([pde_data], [PDE_DATA], [], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PDE_DATA, 1, [PDE_DATA is available])
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([PDE_DATA])
]) ])
]) ])

View File

@ -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]) AC_MSG_CHECKING([whether struct rw_semaphore member wait_lock is raw])
ZFS_LINUX_TEST_RESULT([rwsem_spinlock_is_raw], [ ZFS_LINUX_TEST_RESULT([rwsem_spinlock_is_raw], [
AC_MSG_RESULT(yes) 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])
]) ])
]) ])

View File

@ -14,10 +14,9 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SCHED_RT_HEADER], [
AC_DEFUN([ZFS_AC_KERNEL_SCHED_RT_HEADER], [ AC_DEFUN([ZFS_AC_KERNEL_SCHED_RT_HEADER], [
AC_MSG_CHECKING([whether header linux/sched/rt.h exists]) AC_MSG_CHECKING([whether header linux/sched/rt.h exists])
ZFS_LINUX_TEST_RESULT([sched_rt_header], [ 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(yes)
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([sched_rt_header])
]) ])
]) ])

View File

@ -1,36 +1,3 @@
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 #
dnl # 3.2 API change dnl # 3.2 API change
dnl # The security_inode_init_security() API has been changed to include dnl # The security_inode_init_security() API has been changed to include
@ -55,19 +22,15 @@ AC_DEFUN([ZFS_AC_KERNEL_SECURITY_INODE_INIT_SECURITY_CALLBACK], [
AC_MSG_CHECKING([whether security_inode_init_security wants callback]) AC_MSG_CHECKING([whether security_inode_init_security wants callback])
ZFS_LINUX_TEST_RESULT([security_inode_init_security], [ ZFS_LINUX_TEST_RESULT([security_inode_init_security], [
AC_MSG_RESULT(yes) 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], [ 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 ZFS_AC_KERNEL_SRC_SECURITY_INODE_INIT_SECURITY_CALLBACK
]) ])
AC_DEFUN([ZFS_AC_KERNEL_SECURITY_INODE], [ AC_DEFUN([ZFS_AC_KERNEL_SECURITY_INODE], [
ZFS_AC_KERNEL_SECURITY_INODE_INIT_SECURITY_6ARGS
ZFS_AC_KERNEL_SECURITY_INODE_INIT_SECURITY_CALLBACK ZFS_AC_KERNEL_SECURITY_INODE_INIT_SECURITY_CALLBACK
]) ])

View File

@ -1,6 +1,6 @@
dnl # dnl #
dnl # Linux v3.2-rc1 API change dnl # Linux 3.2 API change
dnl # SHA: bfe8684869601dacfcb2cd69ef8cfd9045f62170 dnl # set_nlink()
dnl # dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_SET_NLINK], [ AC_DEFUN([ZFS_AC_KERNEL_SRC_SET_NLINK], [
ZFS_LINUX_TEST_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]) AC_MSG_CHECKING([whether set_nlink() is available])
ZFS_LINUX_TEST_RESULT([set_nlink], [ ZFS_LINUX_TEST_RESULT([set_nlink], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SET_NLINK, 1, [set_nlink() is available])
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([set_nlink()])
]) ])
]) ])

View File

@ -19,8 +19,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SGET], [
AC_MSG_CHECKING([whether sget() wants 5 args]) AC_MSG_CHECKING([whether sget() wants 5 args])
ZFS_LINUX_TEST_RESULT([sget_5args], [ ZFS_LINUX_TEST_RESULT([sget_5args], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_5ARG_SGET, 1, [sget() wants 5 args])
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([sget()])
]) ])
]) ])

View File

@ -19,9 +19,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SHOW_OPTIONS], [
AC_MSG_CHECKING([whether sops->show_options() wants dentry]) AC_MSG_CHECKING([whether sops->show_options() wants dentry])
ZFS_LINUX_TEST_RESULT([super_operations_show_options], [ ZFS_LINUX_TEST_RESULT([super_operations_show_options], [
AC_MSG_RESULT([yes]) 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()])
]) ])
]) ])

View File

@ -13,7 +13,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK], [
static const struct super_block static const struct super_block
sb __attribute__ ((unused)) = { sb __attribute__ ((unused)) = {
.s_shrink.shrink = shrink,
.s_shrink.seeks = DEFAULT_SEEKS, .s_shrink.seeks = DEFAULT_SEEKS,
.s_shrink.batch = 0, .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]) AC_MSG_CHECKING([whether super_block has s_shrink])
ZFS_LINUX_TEST_RESULT([super_block_s_shrink], [ ZFS_LINUX_TEST_RESULT([super_block_s_shrink], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SHRINK, 1, [struct super_block has s_shrink])
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([sb->s_shrink()])
])
])
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)
]) ])
]) ])
@ -149,29 +55,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID], [
]) ])
AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER_CALLBACK], [ 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], [ ZFS_LINUX_TEST_SRC([shrinker_cb_shrink_control], [
#include <linux/mm.h> #include <linux/mm.h>
int shrinker_cb(struct shrinker *shrink, int shrinker_cb(struct shrinker *shrink,
@ -199,41 +82,14 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER_CALLBACK], [
]) ])
AC_DEFUN([ZFS_AC_KERNEL_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 #
AC_MSG_CHECKING([whether old 2-argument shrinker exists])
ZFS_LINUX_TEST_RESULT([shrinker_cb_2arg], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_2ARGS_OLD_SHRINKER_CALLBACK, 1,
[old 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 #
AC_MSG_CHECKING([whether old 3-argument shrinker exists])
ZFS_LINUX_TEST_RESULT([shrinker_cb_3arg], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1,
[old shrinker callback wants 3 args])
],[
AC_MSG_RESULT(no)
dnl # dnl #
dnl # 3.0 - 3.11 API change dnl # 3.0 - 3.11 API change
dnl # ->shrink(struct shrinker *, dnl # ->shrink(struct shrinker *, struct shrink_control *sc)
dnl # struct shrink_control *sc)
dnl # dnl #
AC_MSG_CHECKING( AC_MSG_CHECKING([whether new 2-argument shrinker exists])
[whether new 2-argument shrinker exists])
ZFS_LINUX_TEST_RESULT([shrinker_cb_shrink_control], [ ZFS_LINUX_TEST_RESULT([shrinker_cb_shrink_control], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_2ARGS_NEW_SHRINKER_CALLBACK, 1, AC_DEFINE(HAVE_SINGLE_SHRINKER_CALLBACK, 1,
[new shrinker callback wants 2 args]) [new shrinker callback wants 2 args])
],[ ],[
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
@ -243,19 +99,15 @@ AC_DEFUN([ZFS_AC_KERNEL_SHRINKER_CALLBACK],[
dnl # ->shrink() is logically split in to dnl # ->shrink() is logically split in to
dnl # ->count_objects() and ->scan_objects() dnl # ->count_objects() and ->scan_objects()
dnl # dnl #
AC_MSG_CHECKING( AC_MSG_CHECKING([whether ->count_objects callback exists])
[whether ->count_objects callback exists]) ZFS_LINUX_TEST_RESULT([shrinker_cb_shrink_control_split], [
ZFS_LINUX_TEST_RESULT(
[shrinker_cb_shrink_control_split], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK, AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK, 1,
1, [->count_objects exists]) [->count_objects exists])
],[ ],[
ZFS_LINUX_TEST_ERROR([shrinker]) ZFS_LINUX_TEST_ERROR([shrinker])
]) ])
]) ])
])
])
]) ])
dnl # dnl #
@ -280,15 +132,12 @@ AC_DEFUN([ZFS_AC_KERNEL_SHRINK_CONTROL_STRUCT], [
AC_DEFINE(HAVE_SHRINK_CONTROL_STRUCT, 1, AC_DEFINE(HAVE_SHRINK_CONTROL_STRUCT, 1,
[struct shrink_control exists]) [struct shrink_control exists])
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([shrink_control])
]) ])
]) ])
AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER], [ AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER], [
ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK 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_SHRINK_CONTROL_HAS_NID
ZFS_AC_KERNEL_SRC_SHRINKER_CALLBACK ZFS_AC_KERNEL_SRC_SHRINKER_CALLBACK
ZFS_AC_KERNEL_SRC_SHRINK_CONTROL_STRUCT ZFS_AC_KERNEL_SRC_SHRINK_CONTROL_STRUCT
@ -296,9 +145,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER], [
AC_DEFUN([ZFS_AC_KERNEL_SHRINKER], [ AC_DEFUN([ZFS_AC_KERNEL_SHRINKER], [
ZFS_AC_KERNEL_SUPER_BLOCK_S_SHRINK 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_SHRINK_CONTROL_HAS_NID
ZFS_AC_KERNEL_SHRINKER_CALLBACK ZFS_AC_KERNEL_SHRINKER_CALLBACK
ZFS_AC_KERNEL_SHRINK_CONTROL_STRUCT ZFS_AC_KERNEL_SHRINK_CONTROL_STRUCT

View File

@ -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)
])
])

View File

@ -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)
])
])

View File

@ -15,9 +15,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TRUNCATE_SETSIZE], [
ZFS_LINUX_TEST_RESULT_SYMBOL([truncate_setsize], ZFS_LINUX_TEST_RESULT_SYMBOL([truncate_setsize],
[truncate_setsize], [mm/truncate.c], [ [truncate_setsize], [mm/truncate.c], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_TRUNCATE_SETSIZE, 1,
[truncate_setsize() is available])
], [ ], [
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([truncate_setsize])
]) ])
]) ])

View File

@ -14,17 +14,14 @@ AC_DEFUN([ZFS_AC_KERNEL_NS_CAPABLE], [
AC_MSG_CHECKING([whether ns_capable exists]) AC_MSG_CHECKING([whether ns_capable exists])
ZFS_LINUX_TEST_RESULT([ns_capable], [ ZFS_LINUX_TEST_RESULT([ns_capable], [
AC_MSG_RESULT(yes) 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 #
dnl # 2.6.39 API change dnl # 2.6.39 API change
dnl # struct user_namespace was added to struct cred_t as dnl # struct user_namespace was added to struct cred_t as cred->user_ns member
dnl # cred->user_ns member
dnl # Note that current_user_ns() was added in 2.6.28.
dnl # dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_CRED_USER_NS], [ AC_DEFUN([ZFS_AC_KERNEL_SRC_CRED_USER_NS], [
ZFS_LINUX_TEST_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]) AC_MSG_CHECKING([whether cred_t->user_ns exists])
ZFS_LINUX_TEST_RESULT([cred_user_ns], [ ZFS_LINUX_TEST_RESULT([cred_user_ns], [
AC_MSG_RESULT(yes) 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]) AC_MSG_CHECKING([whether kuid_has_mapping/kgid_has_mapping exist])
ZFS_LINUX_TEST_RESULT([kuid_has_mapping], [ ZFS_LINUX_TEST_RESULT([kuid_has_mapping], [
AC_MSG_RESULT(yes) 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()])
]) ])
]) ])

View File

@ -17,8 +17,7 @@ AC_DEFUN([ZFS_AC_KERNEL_USLEEP_RANGE], [
AC_MSG_CHECKING([whether usleep_range() is available]) AC_MSG_CHECKING([whether usleep_range() is available])
ZFS_LINUX_TEST_RESULT([usleep_range], [ ZFS_LINUX_TEST_RESULT([usleep_range], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_USLEEP_RANGE, 1, [usleep_range is available])
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([usleep_range()])
]) ])
]) ])

View File

@ -14,8 +14,7 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_FSYNC_2ARGS], [
AC_MSG_CHECKING([whether vfs_fsync() wants 2 args]) AC_MSG_CHECKING([whether vfs_fsync() wants 2 args])
ZFS_LINUX_TEST_RESULT([vfs_fsync_2args], [ ZFS_LINUX_TEST_RESULT([vfs_fsync_2args], [
AC_MSG_RESULT(yes) 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()])
]) ])
]) ])

View File

@ -28,10 +28,8 @@ AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER], [
AC_MSG_CHECKING([whether super_block uses const struct xattr_handler]) AC_MSG_CHECKING([whether super_block uses const struct xattr_handler])
ZFS_LINUX_TEST_RESULT([const_xattr_handler], [ ZFS_LINUX_TEST_RESULT([const_xattr_handler], [
AC_MSG_RESULT([yes]) 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, .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], [ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
@ -154,24 +141,11 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1, AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1,
[xattr_handler->get() wants dentry]) [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()])
]) ])
]) ])
]) ])
])
]) ])
dnl # dnl #
@ -216,18 +190,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [
.set = 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], [ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
@ -269,24 +231,11 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1, AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
[xattr_handler->set() wants dentry]) [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()])
]) ])
]) ])
]) ])
])
]) ])
dnl # dnl #
@ -327,18 +276,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST], [
.list = 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], [ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
@ -378,24 +315,11 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1, AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1,
[xattr_handler->list() wants dentry]) [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()])
]) ])
]) ])
]) ])
])
]) ])
dnl # dnl #
@ -420,7 +344,7 @@ AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1, AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
[posix_acl_from_xattr() needs user_ns]) [posix_acl_from_xattr() needs user_ns])
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([posix_acl_from_xattr()])
]) ])
]) ])

View File

@ -21,6 +21,6 @@ AC_DEFUN([ZFS_AC_KERNEL_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE], [
AC_DEFINE(HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE, 1, AC_DEFINE(HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE, 1,
[zlib_deflate_workspacesize() wants 2 args]) [zlib_deflate_workspacesize() wants 2 args])
],[ ],[
AC_MSG_RESULT(no) ZFS_LINUX_TEST_ERROR([zlib_deflate_workspacesize()])
]) ])
]) ])

View File

@ -37,7 +37,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
ZFS_AC_KERNEL_SRC_OBJTOOL ZFS_AC_KERNEL_SRC_OBJTOOL
ZFS_AC_KERNEL_SRC_GLOBAL_PAGE_STATE ZFS_AC_KERNEL_SRC_GLOBAL_PAGE_STATE
ZFS_AC_KERNEL_SRC_ACCESS_OK_TYPE ZFS_AC_KERNEL_SRC_ACCESS_OK_TYPE
ZFS_AC_KERNEL_SRC_CTL_NAME
ZFS_AC_KERNEL_SRC_PDE_DATA ZFS_AC_KERNEL_SRC_PDE_DATA
ZFS_AC_KERNEL_SRC_FALLOCATE ZFS_AC_KERNEL_SRC_FALLOCATE
ZFS_AC_KERNEL_SRC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE 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_GROUP_INFO_GID
ZFS_AC_KERNEL_SRC_RW ZFS_AC_KERNEL_SRC_RW
ZFS_AC_KERNEL_SRC_TIMER_SETUP ZFS_AC_KERNEL_SRC_TIMER_SETUP
ZFS_AC_KERNEL_SRC_CURRENT_BIO_TAIL
ZFS_AC_KERNEL_SRC_SUPER_USER_NS ZFS_AC_KERNEL_SRC_SUPER_USER_NS
ZFS_AC_KERNEL_SRC_SUBMIT_BIO
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS
ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH ZFS_AC_KERNEL_SRC_BIO
ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART ZFS_AC_KERNEL_SRC_BLKDEV
ZFS_AC_KERNEL_SRC_INVALIDATE_BDEV ZFS_AC_KERNEL_SRC_BLK_QUEUE
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_GET_DISK_AND_MODULE ZFS_AC_KERNEL_SRC_GET_DISK_AND_MODULE
ZFS_AC_KERNEL_SRC_GET_DISK_RO ZFS_AC_KERNEL_SRC_GET_DISK_RO
ZFS_AC_KERNEL_SRC_GENERIC_READLINK_GLOBAL 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_DIRTY_INODE
ZFS_AC_KERNEL_SRC_SHRINKER ZFS_AC_KERNEL_SRC_SHRINKER
ZFS_AC_KERNEL_SRC_MKDIR_UMODE_T ZFS_AC_KERNEL_SRC_MKDIR_UMODE_T
ZFS_AC_KERNEL_SRC_LOOKUP_NAMEIDATA ZFS_AC_KERNEL_SRC_LOOKUP_FLAGS
ZFS_AC_KERNEL_SRC_CREATE_NAMEIDATA ZFS_AC_KERNEL_SRC_CREATE_FLAGS
ZFS_AC_KERNEL_SRC_GET_LINK ZFS_AC_KERNEL_SRC_GET_LINK
ZFS_AC_KERNEL_SRC_PUT_LINK ZFS_AC_KERNEL_SRC_PUT_LINK
ZFS_AC_KERNEL_SRC_TMPFILE ZFS_AC_KERNEL_SRC_TMPFILE
ZFS_AC_KERNEL_SRC_TRUNCATE_RANGE
ZFS_AC_KERNEL_SRC_AUTOMOUNT ZFS_AC_KERNEL_SRC_AUTOMOUNT
ZFS_AC_KERNEL_SRC_ENCODE_FH_WITH_INODE ZFS_AC_KERNEL_SRC_ENCODE_FH_WITH_INODE
ZFS_AC_KERNEL_SRC_COMMIT_METADATA 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_ACCESS_OK_TYPE
ZFS_AC_KERNEL_GLOBAL_PAGE_STATE ZFS_AC_KERNEL_GLOBAL_PAGE_STATE
ZFS_AC_KERNEL_OBJTOOL ZFS_AC_KERNEL_OBJTOOL
ZFS_AC_KERNEL_CTL_NAME
ZFS_AC_KERNEL_PDE_DATA ZFS_AC_KERNEL_PDE_DATA
ZFS_AC_KERNEL_FALLOCATE ZFS_AC_KERNEL_FALLOCATE
ZFS_AC_KERNEL_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE 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_GROUP_INFO_GID
ZFS_AC_KERNEL_RW ZFS_AC_KERNEL_RW
ZFS_AC_KERNEL_TIMER_SETUP ZFS_AC_KERNEL_TIMER_SETUP
ZFS_AC_KERNEL_CURRENT_BIO_TAIL
ZFS_AC_KERNEL_SUPER_USER_NS ZFS_AC_KERNEL_SUPER_USER_NS
ZFS_AC_KERNEL_SUBMIT_BIO
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS
ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH ZFS_AC_KERNEL_BIO
ZFS_AC_KERNEL_BLKDEV_REREAD_PART ZFS_AC_KERNEL_BLKDEV
ZFS_AC_KERNEL_INVALIDATE_BDEV ZFS_AC_KERNEL_BLK_QUEUE
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_GET_DISK_AND_MODULE ZFS_AC_KERNEL_GET_DISK_AND_MODULE
ZFS_AC_KERNEL_GET_DISK_RO ZFS_AC_KERNEL_GET_DISK_RO
ZFS_AC_KERNEL_GENERIC_READLINK_GLOBAL 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_DIRTY_INODE
ZFS_AC_KERNEL_SHRINKER ZFS_AC_KERNEL_SHRINKER
ZFS_AC_KERNEL_MKDIR_UMODE_T ZFS_AC_KERNEL_MKDIR_UMODE_T
ZFS_AC_KERNEL_LOOKUP_NAMEIDATA ZFS_AC_KERNEL_LOOKUP_FLAGS
ZFS_AC_KERNEL_CREATE_NAMEIDATA ZFS_AC_KERNEL_CREATE_FLAGS
ZFS_AC_KERNEL_GET_LINK ZFS_AC_KERNEL_GET_LINK
ZFS_AC_KERNEL_PUT_LINK ZFS_AC_KERNEL_PUT_LINK
ZFS_AC_KERNEL_TMPFILE ZFS_AC_KERNEL_TMPFILE
ZFS_AC_KERNEL_TRUNCATE_RANGE
ZFS_AC_KERNEL_AUTOMOUNT ZFS_AC_KERNEL_AUTOMOUNT
ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE
ZFS_AC_KERNEL_COMMIT_METADATA ZFS_AC_KERNEL_COMMIT_METADATA
@ -391,6 +343,13 @@ AC_DEFUN([ZFS_AC_KERNEL], [
AC_MSG_RESULT([$kernsrcver]) 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=${kernelsrc}
LINUX_OBJ=${kernelbuild} LINUX_OBJ=${kernelbuild}
LINUX_VERSION=${kernsrcver} LINUX_VERSION=${kernsrcver}

View File

@ -35,10 +35,6 @@
#include <linux/hdreg.h> #include <linux/hdreg.h>
#include <linux/msdos_fs.h> /* for SECTOR_* */ #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 #ifndef HAVE_BLK_QUEUE_FLAG_SET
static inline void static inline void
blk_queue_flag_set(unsigned int flag, struct request_queue *q) 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 * 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 * new one is GPL-only. Thus if the GPL-only version is detected we
* implement our own trivial helper. * implement our own trivial helper.
*
* 2.6.x - 2.6.35
* Legacy blk_queue_ordered() interface.
*/ */
static inline void static inline void
blk_queue_set_write_cache(struct request_queue *q, bool wc, bool fua) blk_queue_set_write_cache(struct request_queue *q, bool wc, bool fua)
@ -92,48 +85,10 @@ blk_queue_set_write_cache(struct request_queue *q, bool wc, bool fua)
#elif defined(HAVE_BLK_QUEUE_FLUSH) #elif defined(HAVE_BLK_QUEUE_FLUSH)
blk_queue_flush(q, (wc ? REQ_FLUSH : 0) | (fua ? REQ_FUA : 0)); blk_queue_flush(q, (wc ? REQ_FLUSH : 0) | (fua ? REQ_FUA : 0));
#else #else
blk_queue_ordered(q, QUEUE_ORDERED_DRAIN, NULL); #error "Unsupported kernel"
#endif #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)
#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 static inline void
blk_queue_set_read_ahead(struct request_queue *q, unsigned long ra_pages) 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 #endif
} }
#ifndef HAVE_GET_DISK_AND_MODULE #if !defined(HAVE_GET_DISK_AND_MODULE)
static inline struct kobject * static inline struct kobject *
get_disk_and_module(struct gendisk *disk) get_disk_and_module(struct gendisk *disk)
{ {
@ -152,19 +107,6 @@ get_disk_and_module(struct gendisk *disk)
} }
#endif #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 #ifdef HAVE_BIO_BVEC_ITER
#define BIO_BI_SECTOR(bio) (bio)->bi_iter.bi_sector #define BIO_BI_SECTOR(bio) (bio)->bi_iter.bi_sector
#define BIO_BI_SIZE(bio) (bio)->bi_iter.bi_size #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; typedef int bvec_iterator_t;
#endif #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 static inline void
bio_set_flags_failfast(struct block_device *bdev, int *flags) 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 /* BLOCK_EXT_MAJOR */
#endif /* CONFIG_BUG */ #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; *flags |= REQ_FAILFAST_MASK;
#else
#error "Undefined block IO FAILFAST interface."
#endif
} }
/* /*
* Maximum disk label length, it may be undefined for some kernels. * 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 #define DISK_NAME_LEN 32
#endif /* DISK_NAME_LEN */ #endif /* DISK_NAME_LEN */
@ -337,33 +261,6 @@ bio_set_bi_error(struct bio *bio, int error)
#define BIO_END_IO(bio, error) bio_endio(bio, error); #define BIO_END_IO(bio, error) bio_endio(bio, error);
#endif /* HAVE_1ARG_BIO_END_IO_T */ #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, * 4.1 - x.y.z API,
* 3.10.0 CentOS 7.x API, * 3.10.0 CentOS 7.x API,
@ -378,17 +275,6 @@ bio_set_bi_error(struct bio *bio, int error)
#define vdev_bdev_reread_part(bdev) check_disk_change(bdev) #define vdev_bdev_reread_part(bdev) check_disk_change(bdev)
#endif /* HAVE_BLKDEV_REREAD_PART */ #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 * 2.6.27 API change
* The function was exported for use, prior to this it existed but the * The function was exported for use, prior to this it existed but the
@ -403,38 +289,14 @@ bio_set_bi_error(struct bio *bio, int error)
#ifdef HAVE_2ARGS_LOOKUP_BDEV #ifdef HAVE_2ARGS_LOOKUP_BDEV
#define vdev_lookup_bdev(path) lookup_bdev(path, 0) #define vdev_lookup_bdev(path) lookup_bdev(path, 0)
#else #else
#define vdev_lookup_bdev(path) ERR_PTR(-ENOTSUP) #error "Unsupported kernel"
#endif /* HAVE_2ARGS_LOOKUP_BDEV */ #endif /* HAVE_2ARGS_LOOKUP_BDEV */
#endif /* HAVE_1ARG_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. * Kernels without bio_set_op_attrs use bi_rw for the bio flags.
*/ */
#if !defined(HAVE_BIO_SET_OP_ATTRS)
static inline void static inline void
bio_set_op_attrs(struct bio *bio, unsigned rw, unsigned flags) bio_set_op_attrs(struct bio *bio, unsigned rw, unsigned flags)
{ {
@ -446,12 +308,6 @@ bio_set_op_attrs(struct bio *bio, unsigned rw, unsigned flags)
* bio_set_flush - Set the appropriate flags in a bio to guarantee * bio_set_flush - Set the appropriate flags in a bio to guarantee
* data are on non-volatile media on completion. * 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, * 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 * replacement for WRITE_BARRIER to allow expressing richer semantics
@ -471,12 +327,10 @@ bio_set_op_attrs(struct bio *bio, unsigned rw, unsigned flags)
static inline void static inline void
bio_set_flush(struct bio *bio) 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); bio_set_op_attrs(bio, 0, REQ_PREFLUSH);
#elif defined(WRITE_FLUSH_FUA) /* >= 2.6.37 and <= 4.9 */ #elif defined(WRITE_FLUSH_FUA) /* >= 2.6.37 and <= 4.9 */
bio_set_op_attrs(bio, 0, WRITE_FLUSH_FUA); 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 #else
#error "Allowing the build will cause bio_set_flush requests to be ignored." #error "Allowing the build will cause bio_set_flush requests to be ignored."
#endif #endif
@ -492,12 +346,6 @@ bio_set_flush(struct bio *bio)
* 2.6.36 - 4.7 API, * 2.6.36 - 4.7 API,
* REQ_FLUSH * 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 * 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. * 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) #if defined(HAVE_REQ_OP_FLUSH) && defined(HAVE_BIO_BI_OPF)
return ((bio_op(bio) == REQ_OP_FLUSH) || (bio->bi_opf & REQ_PREFLUSH)); 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); 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); return (bio->bi_rw & REQ_PREFLUSH);
#elif defined(REQ_FLUSH) #elif defined(HAVE_REQ_FLUSH)
return (bio->bi_rw & REQ_FLUSH); return (bio->bi_rw & REQ_FLUSH);
#elif defined(HAVE_BIO_RW_BARRIER)
return (bio->bi_rw & (1 << BIO_RW_BARRIER));
#else #else
#error "Allowing the build will cause flush requests to be ignored." #error "Unsupported kernel"
#endif #endif
} }
@ -546,28 +392,18 @@ bio_is_fua(struct bio *bio)
* 2.6.36 - 4.7 API, * 2.6.36 - 4.7 API,
* REQ_DISCARD * 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 * 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. * 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 static inline boolean_t
bio_is_discard(struct bio *bio) bio_is_discard(struct bio *bio)
{ {
#if defined(HAVE_REQ_OP_DISCARD) #if defined(HAVE_REQ_OP_DISCARD)
return (bio_op(bio) == REQ_OP_DISCARD); return (bio_op(bio) == REQ_OP_DISCARD);
#elif defined(HAVE_BIO_RW_DISCARD) #elif defined(HAVE_REQ_DISCARD)
return (bio->bi_rw & (1 << BIO_RW_DISCARD));
#elif defined(REQ_DISCARD)
return (bio->bi_rw & REQ_DISCARD); return (bio->bi_rw & REQ_DISCARD);
#else #else
/* potentially triggering the DMU_MAX_ACCESS assertion. */ #error "Unsupported kernel"
#error "Allowing the build will cause discard requests to become writes."
#endif #endif
} }
@ -577,9 +413,6 @@ bio_is_discard(struct bio *bio)
* *
* 2.6.36 - 4.7 API, * 2.6.36 - 4.7 API,
* REQ_SECURE * REQ_SECURE
*
* 2.6.x - 2.6.35 API,
* Unsupported by kernel
*/ */
static inline boolean_t static inline boolean_t
bio_is_secure_erase(struct bio *bio) 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 * Discard granularity and alignment restrictions may now be set. For
* older kernels which do not support this it is safe to skip it. * older kernels which do not support this it is safe to skip it.
*/ */
#ifdef HAVE_DISCARD_GRANULARITY
static inline void static inline void
blk_queue_discard_granularity(struct request_queue *q, unsigned int dg) blk_queue_discard_granularity(struct request_queue *q, unsigned int dg)
{ {
q->limits.discard_granularity = 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, * 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, * 2.6.36 - 4.7 API,
* blk_queue_secdiscard() * blk_queue_secdiscard()
*
* 2.6.x - 2.6.35 API,
* Unsupported by kernel
*/ */
static inline int static inline int
blk_queue_discard_secure(struct request_queue *q) blk_queue_discard_secure(struct request_queue *q)

View File

@ -41,24 +41,7 @@
* the dentry structure. To handle this we define an appropriate * the dentry structure. To handle this we define an appropriate
* dentry_operations_t typedef which can be used. * dentry_operations_t typedef which can be used.
*/ */
#ifdef HAVE_CONST_DENTRY_OPERATIONS
typedef const struct dentry_operations dentry_operations_t; 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, * 2.6.38 API addition,
@ -72,12 +55,10 @@ d_set_d_op(struct dentry *dentry, dentry_operations_t *op)
static inline void static inline void
d_clear_d_op(struct dentry *dentry) d_clear_d_op(struct dentry *dentry)
{ {
#ifdef HAVE_D_SET_D_OP
dentry->d_op = NULL; dentry->d_op = NULL;
dentry->d_flags &= ~( dentry->d_flags &= ~(
DCACHE_OP_HASH | DCACHE_OP_COMPARE | DCACHE_OP_HASH | DCACHE_OP_COMPARE |
DCACHE_OP_REVALIDATE | DCACHE_OP_DELETE); DCACHE_OP_REVALIDATE | DCACHE_OP_DELETE);
#endif /* HAVE_D_SET_D_OP */
} }
#endif /* _ZFS_DCACHE_H */ #endif /* _ZFS_DCACHE_H */

View File

@ -29,14 +29,9 @@
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#ifdef HAVE_1ARG_KMAP_ATOMIC
/* 2.6.37 API change */ /* 2.6.37 API change */
#define zfs_kmap_atomic(page, km_type) kmap_atomic(page) #define zfs_kmap_atomic(page, km_type) kmap_atomic(page)
#define zfs_kunmap_atomic(addr, km_type) kunmap_atomic(addr) #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() */ /* 5.0 API change - no more 'type' argument for access_ok() */
#ifdef HAVE_ACCESS_OK_TYPE #ifdef HAVE_ACCESS_OK_TYPE

View File

@ -33,43 +33,6 @@
#include <linux/compat.h> #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. * 2.6.34 - 3.19, bdi_setup_and_register() takes 3 arguments.
* 4.0 - 4.11, bdi_setup_and_register() takes 2 arguments. * 4.0 - 4.11, bdi_setup_and_register() takes 2 arguments.
* 4.12 - x.y, super_setup_bdi_name() new interface. * 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; sb->s_bdi = NULL;
} }
#else #else
extern atomic_long_t zfs_bdi_seq; #error "Unsupported kernel"
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;
}
#endif #endif
/* /*
@ -211,41 +136,6 @@ zpl_bdi_destroy(struct super_block *sb)
#define SB_NOATIME MS_NOATIME #define SB_NOATIME MS_NOATIME
#endif #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, * 3.5 API change,
* The clear_inode() function replaces end_writeback() and introduces an * The clear_inode() function replaces end_writeback() and introduces an
@ -256,16 +146,6 @@ typedef int zpl_umode_t;
#define clear_inode(ip) end_writeback(ip) #define clear_inode(ip) end_writeback(ip)
#endif /* HAVE_EVICT_INODE && !HAVE_CLEAR_INODE */ #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) #if defined(SEEK_HOLE) && defined(SEEK_DATA) && !defined(HAVE_LSEEK_EXECUTE)
static inline loff_t static inline loff_t
lseek_execute( lseek_execute(
@ -361,65 +241,22 @@ zpl_forget_cached_acl(struct inode *ip, int type)
} }
#endif /* HAVE_SET_CACHED_ACL_USABLE */ #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 #ifndef HAVE___POSIX_ACL_CHMOD
#ifdef 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_chmod(acl, gfp, mode) posix_acl_chmod(acl, gfp, mode)
#define __posix_acl_create(acl, gfp, mode) posix_acl_create(acl, gfp, mode) #define __posix_acl_create(acl, gfp, mode) posix_acl_create(acl, gfp, mode)
#else #else
static inline int #error "Unsupported kernel"
__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);
}
#endif /* HAVE_POSIX_ACL_CHMOD */ #endif /* HAVE_POSIX_ACL_CHMOD */
#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, * 4.8 API change,
* posix_acl_valid() now must be passed a namespace, the namespace from * posix_acl_valid() now must be passed a namespace, the namespace from
@ -433,16 +270,6 @@ typedef mode_t zpl_equivmode_t;
#endif /* CONFIG_FS_POSIX_ACL */ #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 * 3.19 API change
* struct access f->f_dentry->d_inode was replaced by accessor function * struct access f->f_dentry->d_inode was replaced by accessor function
@ -467,7 +294,6 @@ static inline struct dentry *file_dentry(const struct file *f)
} }
#endif /* HAVE_FILE_DENTRY */ #endif /* HAVE_FILE_DENTRY */
#ifdef HAVE_KUID_HELPERS
static inline uid_t zfs_uid_read_impl(struct inode *ip) static inline uid_t zfs_uid_read_impl(struct inode *ip)
{ {
#ifdef HAVE_SUPER_USER_NS #ifdef HAVE_SUPER_USER_NS
@ -514,39 +340,6 @@ static inline void zfs_gid_write(struct inode *ip, gid_t gid)
#endif #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 * 4.9 API change
*/ */

View File

@ -35,24 +35,7 @@
* appropriate xattr_handler_t typedef which can be used. This was * appropriate xattr_handler_t typedef which can be used. This was
* the preferred solution because it keeps the code clean and readable. * the preferred solution because it keeps the code clean and readable.
*/ */
#ifdef HAVE_CONST_XATTR_HANDLER
typedef const struct xattr_handler xattr_handler_t; 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, * 4.5 API change,
@ -88,17 +71,8 @@ fn(const struct xattr_handler *handler, struct dentry *dentry, \
return (__ ## fn(dentry->d_inode, \ return (__ ## fn(dentry->d_inode, \
list, list_size, name, name_len)); \ list, list_size, name, name_len)); \
} }
/* #else
* 2.6.32 API #error "Unsupported kernel"
*/
#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)); \
}
#endif #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)); \ return (__ ## fn(dentry->d_inode, name, buffer, size)); \
} }
/* #else
* 2.6.32 API #error "Unsupported kernel"
*/
#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)); \
}
#endif #endif
/* /*
@ -194,33 +160,15 @@ fn(struct dentry *dentry, const char *name, const void *buffer, \
{ \ { \
return (__ ## fn(dentry->d_inode, name, buffer, size, flags)); \ 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 #else
#define zpl_security_inode_init_security(ip, dip, qstr, nm, val, len) \ #error "Unsupported kernel"
security_inode_init_security(ip, dip, nm, val, len) #endif
#endif /* HAVE_6ARGS_SECURITY_INODE_INIT_SECURITY */
/* /*
* Linux 3.7 API change. posix_acl_{from,to}_xattr gained the user_ns * 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 * parameter. All callers are expected to pass the &init_user_ns which
* is available through the init credential (kcred). * is available through the init credential (kcred).
*/ */
#ifdef HAVE_POSIX_ACL_FROM_XATTR_USERNS
static inline struct posix_acl * static inline struct posix_acl *
zpl_acl_from_xattr(const void *value, int size) 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)); 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 */ #endif /* _ZFS_XATTR_H */

View File

@ -40,24 +40,12 @@ typedef struct cred cred_t;
#define GROUP_AT(gi, i) ((gi)->gid[i]) #define GROUP_AT(gi, i) ((gi)->gid[i])
#endif #endif
#ifdef HAVE_KUIDGID_T
#define KUID_TO_SUID(x) (__kuid_val(x)) #define KUID_TO_SUID(x) (__kuid_val(x))
#define KGID_TO_SGID(x) (__kgid_val(x)) #define KGID_TO_SGID(x) (__kgid_val(x))
#define SUID_TO_KUID(x) (KUIDT_INIT(x)) #define SUID_TO_KUID(x) (KUIDT_INIT(x))
#define SGID_TO_KGID(x) (KGIDT_INIT(x)) #define SGID_TO_KGID(x) (KGIDT_INIT(x))
#define KGIDP_TO_SGIDP(x) (&(x)->val) #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 crhold(cred_t *cr);
extern void crfree(cred_t *cr); extern void crfree(cred_t *cr);
extern uid_t crgetuid(const cred_t *cr); extern uid_t crgetuid(const cred_t *cr);

View File

@ -27,10 +27,6 @@
#include <linux/proc_fs.h> #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; extern struct proc_dir_entry *proc_spl_kstat;
int spl_proc_init(void); int spl_proc_init(void);

View File

@ -28,13 +28,6 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/fs.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 * Due to frequent changes in the shrinker API the following
* compatibility wrappers should be used. They are as follows: * compatibility wrappers should be used. They are as follows:
@ -84,60 +77,10 @@ struct shrink_control {
#define spl_register_shrinker(x) register_shrinker(x) #define spl_register_shrinker(x) register_shrinker(x)
#define spl_unregister_shrinker(x) unregister_shrinker(x) #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. * 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) \ #define SPL_SHRINKER_DECLARE(s, x, y) \
static struct shrinker s = { \ static struct shrinker s = { \
.shrink = x, \ .shrink = x, \

View File

@ -28,8 +28,4 @@
#define bcopy(src, dest, size) memmove(dest, src, size) #define bcopy(src, dest, size) memmove(dest, src, size)
#define bcmp(src, dest, size) memcmp((src), (dest), (size_t)(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 */ #endif /* _SPL_SYS_STRINGS_H */

View File

@ -27,15 +27,13 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/sched/rt.h>
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <sys/debug.h> #include <sys/debug.h>
#include <sys/zone.h> #include <sys/zone.h>
#include <sys/signal.h> #include <sys/signal.h>
#include <asm/page.h> #include <asm/page.h>
#ifdef HAVE_SCHED_RT_HEADER
#include <linux/sched/rt.h>
#endif
#ifndef _KERNEL #ifndef _KERNEL
#define _KERNEL __KERNEL__ #define _KERNEL __KERNEL__

View File

@ -53,20 +53,6 @@
#define delay(ticks) schedule_timeout_uninterruptible(ticks) #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 SEC_TO_TICK(sec) ((sec) * HZ)
#define MSEC_TO_TICK(ms) msecs_to_jiffies(ms) #define MSEC_TO_TICK(ms) msecs_to_jiffies(ms)
#define USEC_TO_TICK(us) usecs_to_jiffies(us) #define USEC_TO_TICK(us) usecs_to_jiffies(us)

View File

@ -59,14 +59,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <linux/zlib.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, extern int z_compress_level(void *dest, size_t *destLen, const void *source,
size_t sourceLen, int level); size_t sourceLen, int level);
extern int z_uncompress(void *dest, size_t *destLen, const void *source, extern int z_uncompress(void *dest, size_t *destLen, const void *source,

View File

@ -39,7 +39,7 @@
/* zpl_inode.c */ /* zpl_inode.c */
extern void zpl_vap_init(vattr_t *vap, struct inode *dir, 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_inode_operations;
extern const struct inode_operations zpl_dir_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, extern ssize_t zpl_write_common(struct inode *ip, const char *buf,
size_t len, loff_t *ppos, uio_seg_t segment, int flags, size_t len, loff_t *ppos, uio_seg_t segment, int flags,
cred_t *cr); 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 address_space_operations zpl_address_space_operations;
extern const struct file_operations zpl_file_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, extern int zpl_xattr_security_init(struct inode *ip, struct inode *dip,
const struct qstr *qstr); const struct qstr *qstr);
#if defined(CONFIG_FS_POSIX_ACL) #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); 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); 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_init_acl(struct inode *ip, struct inode *dir);
extern int zpl_chmod_acl(struct inode *ip); extern int zpl_chmod_acl(struct inode *ip);
#else #else
@ -112,11 +98,7 @@ extern const struct inode_operations zpl_ops_root;
extern const struct file_operations zpl_fops_snapdir; extern const struct file_operations zpl_fops_snapdir;
extern const struct inode_operations zpl_ops_snapdir; extern const struct inode_operations zpl_ops_snapdir;
#ifdef HAVE_AUTOMOUNT
extern const struct dentry_operations zpl_dops_snapdirs; 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 file_operations zpl_fops_shares;
extern const struct inode_operations zpl_ops_shares; extern const struct inode_operations zpl_ops_shares;

View File

@ -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) #define VOP_FSYNC(vp, f, cr, ct) fsync((vp)->v_fd)
#if defined(HAVE_FILE_FALLOCATE) && \ #if defined(FALLOC_FL_PUNCH_HOLE) && defined(FALLOC_FL_KEEP_SIZE)
defined(FALLOC_FL_PUNCH_HOLE) && \
defined(FALLOC_FL_KEEP_SIZE)
#define VOP_SPACE(vp, cmd, flck, fl, off, cr, ct) \ #define VOP_SPACE(vp, cmd, flck, fl, off, cr, ct) \
fallocate((vp)->v_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, \ fallocate((vp)->v_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, \
(flck)->l_start, (flck)->l_len) (flck)->l_start, (flck)->l_len)

View File

@ -27,11 +27,7 @@
#include <sys/cred.h> #include <sys/cred.h>
static int static int
#ifdef HAVE_KUIDGID_T
cr_groups_search(const struct group_info *group_info, kgid_t grp) 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; unsigned int left, right, mid;
int cmp; int cmp;

View File

@ -1030,11 +1030,6 @@ spl_kmem_cache_create(char *name, size_t size, size_t align,
goto out; 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; skc->skc_flags |= KMC_NOMAGAZINE;
} }

View File

@ -712,9 +712,6 @@ static struct ctl_table spl_dir[] = {
static struct ctl_table spl_root[] = { static struct ctl_table spl_root[] = {
{ {
#ifdef HAVE_CTL_NAME
.ctl_name = CTL_KERN,
#endif
.procname = "kernel", .procname = "kernel",
.mode = 0555, .mode = 0555,
.child = spl_dir, .child = spl_dir,

View File

@ -48,17 +48,8 @@ spl_filp_fallocate(struct file *fp, int mode, loff_t offset, loff_t len)
{ {
int error = -EOPNOTSUPP; int error = -EOPNOTSUPP;
#ifdef HAVE_FILE_FALLOCATE
if (fp->f_op->fallocate) if (fp->f_op->fallocate)
error = fp->f_op->fallocate(fp, mode, offset, len); 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); return (error);
} }
@ -66,11 +57,7 @@ spl_filp_fallocate(struct file *fp, int mode, loff_t offset, loff_t len)
static int static int
spl_filp_fsync(struct file *fp, int sync) spl_filp_fsync(struct file *fp, int sync)
{ {
#ifdef HAVE_2ARGS_VFS_FSYNC
return (vfs_fsync(fp, sync)); return (vfs_fsync(fp, sync));
#else
return (vfs_fsync(fp, (fp)->f_dentry, sync));
#endif /* HAVE_2ARGS_VFS_FSYNC */
} }
static ssize_t static ssize_t
@ -456,31 +443,6 @@ int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag,
if (error == 0) if (error == 0)
return (0); return (0);
#endif #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); return (error);
} }
EXPORT_SYMBOL(vn_space); EXPORT_SYMBOL(vn_space);

View File

@ -196,7 +196,7 @@ spl_zlib_init(void)
{ {
int size; 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_inflate_workspacesize());
zlib_workspace_cache = kmem_cache_create( zlib_workspace_cache = kmem_cache_create(

View File

@ -1043,20 +1043,6 @@ abd_release_ownership_of_buf(abd_t *abd)
ABDSTAT_INCR(abdstat_linear_data_size, -(int)abd->abd_size); 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 { struct abd_iter {
/* public interface */ /* public interface */
void *iter_mapaddr; /* addr corresponding to iter_pos */ 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, */ size_t iter_offset; /* offset in current sg/abd_buf, */
/* abd_offset included */ /* abd_offset included */
struct scatterlist *iter_sg; /* current sg */ 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_offset = ABD_SCATTER(abd).abd_offset;
aiter->iter_sg = ABD_SCATTER(abd).abd_sgl; 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
} }
/* /*

View File

@ -50,7 +50,7 @@ priv_policy_ns(const cred_t *cr, int capability, boolean_t all, int err,
if (cr != CRED() && (cr != kcred)) if (cr != CRED() && (cr != kcred))
return (err); return (err);
#if defined(CONFIG_USER_NS) && defined(HAVE_NS_CAPABLE) #if defined(CONFIG_USER_NS)
if (!(ns ? ns_capable(ns, capability) : capable(capability))) if (!(ns ? ns_capable(ns, capability) : capable(capability)))
#else #else
if (!capable(capability)) 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() * 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() * 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 * 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 * namespace.
* we shouldn't need to re-check for HAVE_CRED_USER_NS
*/ */
#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)); return (priv_policy_ns(cr, capability, all, err, cr->user_ns));
#else #else
return (priv_policy_ns(cr, capability, all, err, NULL)); 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) if (crgetfsuid(cr) == owner)
return (0); return (0);
if (zpl_inode_owner_or_capable(ip)) if (inode_owner_or_capable(ip))
return (0); 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))) if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner)))
return (EPERM); return (EPERM);
#endif #endif
@ -153,7 +152,7 @@ secpolicy_vnode_chown(const cred_t *cr, uid_t owner)
if (crgetfsuid(cr) == owner) if (crgetfsuid(cr) == owner)
return (0); 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))) if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner)))
return (EPERM); return (EPERM);
#endif #endif
@ -190,7 +189,7 @@ secpolicy_vnode_setdac(const cred_t *cr, uid_t owner)
if (crgetfsuid(cr) == owner) if (crgetfsuid(cr) == owner)
return (0); 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))) if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner)))
return (EPERM); return (EPERM);
#endif #endif
@ -218,7 +217,7 @@ secpolicy_vnode_setid_retain(const cred_t *cr, boolean_t issuidroot)
int int
secpolicy_vnode_setids_setgids(const cred_t *cr, gid_t gid) 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))) if (!kgid_has_mapping(cr->user_ns, SGID_TO_KGID(gid)))
return (EPERM); return (EPERM);
#endif #endif
@ -269,7 +268,7 @@ secpolicy_vnode_setid_modify(const cred_t *cr, uid_t owner)
if (crgetfsuid(cr) == owner) if (crgetfsuid(cr) == owner)
return (0); 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))) if (!kuid_has_mapping(cr->user_ns, SUID_TO_KUID(owner)))
return (EPERM); return (EPERM);
#endif #endif

View File

@ -54,8 +54,6 @@ typedef struct dio_request {
struct bio *dr_bio[0]; /* Attached bio's */ struct bio *dr_bio[0]; /* Attached bio's */
} dio_request_t; } dio_request_t;
#if defined(HAVE_OPEN_BDEV_EXCLUSIVE) || defined(HAVE_BLKDEV_GET_BY_PATH)
static fmode_t static fmode_t
vdev_bdev_mode(int smode) vdev_bdev_mode(int smode)
{ {
@ -71,20 +69,6 @@ vdev_bdev_mode(int smode)
return (mode); 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. * 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; reread_part = B_TRUE;
} }
vdev_bdev_close(bdev, mode); blkdev_put(bdev, mode | FMODE_EXCL);
} }
if (reread_part) { 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)) { if (!IS_ERR(bdev)) {
int error = vdev_bdev_reread_part(bdev); int error = vdev_bdev_reread_part(bdev);
vdev_bdev_close(bdev, mode); blkdev_put(bdev, mode | FMODE_EXCL);
if (error == 0) if (error == 0)
bdev_retry_count = 100; 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); bdev = ERR_PTR(-ENXIO);
while (IS_ERR(bdev) && count < bdev_retry_count) { 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)) { if (unlikely(PTR_ERR(bdev) == -ENOENT)) {
schedule_timeout(MSEC_TO_TICK(10)); schedule_timeout(MSEC_TO_TICK(10));
count++; 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); struct request_queue *q = bdev_get_queue(vd->vd_bdev);
/* Determine the physical block size */ /* 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. */ /* Clear the nowritecache bit, causes vdev_reopen() to try again. */
v->vdev_nowritecache = B_FALSE; v->vdev_nowritecache = B_FALSE;
@ -374,8 +360,8 @@ vdev_disk_close(vdev_t *v)
return; return;
if (vd->vd_bdev != NULL) { if (vd->vd_bdev != NULL) {
vdev_bdev_close(vd->vd_bdev, blkdev_put(vd->vd_bdev,
vdev_bdev_mode(spa_mode(v->vdev_spa))); vdev_bdev_mode(spa_mode(v->vdev_spa)) | FMODE_EXCL);
} }
rw_destroy(&vd->vd_lock); rw_destroy(&vd->vd_lock);
@ -563,17 +549,10 @@ bio_set_dev(struct bio *bio, struct block_device *bdev)
static inline void static inline void
vdev_submit_bio(struct bio *bio) 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; struct bio_list *bio_list = current->bio_list;
current->bio_list = NULL; current->bio_list = NULL;
vdev_submit_bio_impl(bio); vdev_submit_bio_impl(bio);
current->bio_list = bio_list; current->bio_list = bio_list;
#endif
} }
static int static int
@ -585,9 +564,8 @@ __vdev_disk_physio(struct block_device *bdev, zio_t *zio,
uint64_t bio_offset; uint64_t bio_offset;
int bio_size, bio_count = 16; int bio_size, bio_count = 16;
int i = 0, error = 0; int i = 0, error = 0;
#if defined(HAVE_BLK_QUEUE_HAVE_BLK_PLUG)
struct blk_plug plug; struct blk_plug plug;
#endif
/* /*
* Accessing outside the block device is never allowed. * Accessing outside the block device is never allowed.
*/ */
@ -666,20 +644,16 @@ retry:
/* Extra reference to protect dio_request during vdev_submit_bio */ /* Extra reference to protect dio_request during vdev_submit_bio */
vdev_disk_dio_get(dr); vdev_disk_dio_get(dr);
#if defined(HAVE_BLK_QUEUE_HAVE_BLK_PLUG)
if (dr->dr_bio_count > 1) if (dr->dr_bio_count > 1)
blk_start_plug(&plug); blk_start_plug(&plug);
#endif
/* Submit all bio's associated with this dio */ /* Submit all bio's associated with this dio */
for (i = 0; i < dr->dr_bio_count; i++) for (i = 0; i < dr->dr_bio_count; i++)
if (dr->dr_bio[i]) if (dr->dr_bio[i])
vdev_submit_bio(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) if (dr->dr_bio_count > 1)
blk_finish_plug(&plug); blk_finish_plug(&plug);
#endif
(void) vdev_disk_dio_put(dr); (void) vdev_disk_dio_put(dr);
@ -736,7 +710,7 @@ vdev_disk_io_start(zio_t *zio)
vdev_t *v = zio->io_vd; vdev_t *v = zio->io_vd;
vdev_disk_t *vd = v->vdev_tsd; vdev_disk_t *vd = v->vdev_tsd;
unsigned long trim_flags = 0; 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. * 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; return;
case ZIO_TYPE_WRITE: case ZIO_TYPE_WRITE:
rw = 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; break;
case ZIO_TYPE_READ: case ZIO_TYPE_READ:
rw = 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; break;
case ZIO_TYPE_TRIM: case ZIO_TYPE_TRIM:
@ -843,7 +803,7 @@ vdev_disk_io_start(zio_t *zio)
zio->io_target_timestamp = zio_handle_io_delay(zio); zio->io_target_timestamp = zio_handle_io_delay(zio);
error = __vdev_disk_physio(vd->vd_bdev, 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); rw_exit(&vd->vd_lock);
if (error) { if (error) {
@ -866,7 +826,7 @@ vdev_disk_io_done(zio_t *zio)
vdev_disk_t *vd = v->vdev_tsd; vdev_disk_t *vd = v->vdev_tsd;
if (check_disk_change(vd->vd_bdev)) { if (check_disk_change(vd->vd_bdev)) {
vdev_bdev_invalidate(vd->vd_bdev); invalidate_bdev(vd->vd_bdev);
v->vdev_remove_wanted = B_TRUE; v->vdev_remove_wanted = B_TRUE;
spa_async_request(zio->io_spa, SPA_ASYNC_REMOVE); spa_async_request(zio->io_spa, SPA_ASYNC_REMOVE);
} }

View File

@ -1106,7 +1106,7 @@ zfsctl_snapshot_mount(struct path *path, int flags)
*/ */
spath = *path; spath = *path;
path_get(&spath); path_get(&spath);
if (zpl_follow_down_one(&spath)) { if (follow_down_one(&spath)) {
snap_zfsvfs = ITOZSB(spath.dentry->d_inode); snap_zfsvfs = ITOZSB(spath.dentry->d_inode);
snap_zfsvfs->z_parent = zfsvfs; snap_zfsvfs->z_parent = zfsvfs;
dentry = spath.dentry; dentry = spath.dentry;

View File

@ -1608,7 +1608,6 @@ zfs_root(zfsvfs_t *zfsvfs, struct inode **ipp)
return (error); return (error);
} }
#ifdef HAVE_D_PRUNE_ALIASES
/* /*
* Linux kernels older than 3.1 do not support a per-filesystem shrinker. * 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 * 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); return (objects);
} }
#endif /* HAVE_D_PRUNE_ALIASES */
/* /*
* The ARC has requested that the filesystem drop entries from the dentry * 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; zfsvfs_t *zfsvfs = sb->s_fs_info;
int error = 0; int error = 0;
#if defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK)
struct shrinker *shrinker = &sb->s_shrink; struct shrinker *shrinker = &sb->s_shrink;
struct shrink_control sc = { struct shrink_control sc = {
.nr_to_scan = nr_to_scan, .nr_to_scan = nr_to_scan,
.gfp_mask = GFP_KERNEL, .gfp_mask = GFP_KERNEL,
}; };
#endif
ZFS_ENTER(zfsvfs); 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) #elif defined(HAVE_SPLIT_SHRINKER_CALLBACK)
*objects = (*shrinker->scan_objects)(shrinker, &sc); *objects = (*shrinker->scan_objects)(shrinker, &sc);
#elif defined(HAVE_SHRINK) #elif defined(HAVE_SINGLE_SHRINKER_CALLBACK)
*objects = (*shrinker->shrink)(shrinker, &sc); *objects = (*shrinker->shrink)(shrinker, &sc);
#elif defined(HAVE_D_PRUNE_ALIASES) #elif defined(HAVE_D_PRUNE_ALIASES)
#define D_PRUNE_ALIASES_IS_DEFAULT #define D_PRUNE_ALIASES_IS_DEFAULT
@ -1877,8 +1873,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
return (0); return (0);
} }
#if !defined(HAVE_2ARGS_BDI_SETUP_AND_REGISTER) && \ #if defined(HAVE_SUPER_SETUP_BDI_NAME)
!defined(HAVE_3ARGS_BDI_SETUP_AND_REGISTER)
atomic_long_t zfs_bdi_seq = ATOMIC_LONG_INIT(0); atomic_long_t zfs_bdi_seq = ATOMIC_LONG_INIT(0);
#endif #endif

View File

@ -114,11 +114,7 @@ zpl_root_getattr_impl(const struct path *path, struct kstat *stat,
ZPL_GETATTR_WRAPPER(zpl_root_getattr); ZPL_GETATTR_WRAPPER(zpl_root_getattr);
static struct dentry * 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) zpl_root_lookup(struct inode *dip, struct dentry *dentry, unsigned int flags)
#endif
{ {
cred_t *cr = CRED(); cred_t *cr = CRED();
struct inode *ip; struct inode *ip;
@ -160,7 +156,6 @@ const struct inode_operations zpl_ops_root = {
.getattr = zpl_root_getattr, .getattr = zpl_root_getattr,
}; };
#ifdef HAVE_AUTOMOUNT
static struct vfsmount * static struct vfsmount *
zpl_snapdir_automount(struct path *path) zpl_snapdir_automount(struct path *path)
{ {
@ -179,7 +174,6 @@ zpl_snapdir_automount(struct path *path)
*/ */
return (NULL); return (NULL);
} }
#endif /* HAVE_AUTOMOUNT */
/* /*
* Negative dentries must always be revalidated so newly created snapshots * 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 * name space. While it might be possible to add compatibility
* code to accomplish this it would require considerable care. * code to accomplish this it would require considerable care.
*/ */
#ifdef HAVE_AUTOMOUNT
.d_automount = zpl_snapdir_automount, .d_automount = zpl_snapdir_automount,
#endif /* HAVE_AUTOMOUNT */
.d_revalidate = zpl_snapdir_revalidate, .d_revalidate = zpl_snapdir_revalidate,
}; };
static struct dentry * 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, zpl_snapdir_lookup(struct inode *dip, struct dentry *dentry,
unsigned int flags) unsigned int flags)
#endif
{ {
fstrans_cookie_t cookie; fstrans_cookie_t cookie;
cred_t *cr = CRED(); cred_t *cr = CRED();
@ -241,9 +227,7 @@ zpl_snapdir_lookup(struct inode *dip, struct dentry *dentry,
ASSERT(error == 0 || ip == NULL); ASSERT(error == 0 || ip == NULL);
d_clear_d_op(dentry); d_clear_d_op(dentry);
d_set_d_op(dentry, &zpl_dops_snapdirs); d_set_d_op(dentry, &zpl_dops_snapdirs);
#ifdef HAVE_AUTOMOUNT
dentry->d_flags |= DCACHE_NEED_AUTOMOUNT; dentry->d_flags |= DCACHE_NEED_AUTOMOUNT;
#endif
return (d_splice_alias(ip, dentry)); return (d_splice_alias(ip, dentry));
} }
@ -348,7 +332,7 @@ zpl_snapdir_rmdir(struct inode *dip, struct dentry *dentry)
} }
static int 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(); cred_t *cr = CRED();
vattr_t *vap; vattr_t *vap;
@ -433,13 +417,8 @@ const struct inode_operations zpl_ops_snapdir = {
}; };
static struct dentry * 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, zpl_shares_lookup(struct inode *dip, struct dentry *dentry,
unsigned int flags) unsigned int flags)
#endif
{ {
fstrans_cookie_t cookie; fstrans_cookie_t cookie;
cred_t *cr = CRED(); cred_t *cr = CRED();

View File

@ -64,25 +64,6 @@ zpl_encode_fh(struct dentry *dentry, __u32 *fh, int *max_len, int connectable)
return (rc == 0 ? FILEID_INO32_GEN : 255); return (rc == 0 ? FILEID_INO32_GEN : 255);
} }
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 * static struct dentry *
zpl_fh_to_dentry(struct super_block *sb, struct fid *fh, zpl_fh_to_dentry(struct super_block *sb, struct fid *fh,
int fh_len, int fh_type) 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)); ASSERT((ip != NULL) && !IS_ERR(ip));
return (zpl_dentry_obtain_alias(ip)); return (d_obtain_alias(ip));
} }
static struct dentry * static struct dentry *
@ -142,10 +123,9 @@ zpl_get_parent(struct dentry *child)
if (error) if (error)
return (ERR_PTR(error)); return (ERR_PTR(error));
return (zpl_dentry_obtain_alias(ip)); return (d_obtain_alias(ip));
} }
#ifdef HAVE_COMMIT_METADATA
static int static int
zpl_commit_metadata(struct inode *inode) zpl_commit_metadata(struct inode *inode)
{ {
@ -165,13 +145,10 @@ zpl_commit_metadata(struct inode *inode)
return (error); return (error);
} }
#endif /* HAVE_COMMIT_METADATA */
const struct export_operations zpl_export_operations = { const struct export_operations zpl_export_operations = {
.encode_fh = zpl_encode_fh, .encode_fh = zpl_encode_fh,
.fh_to_dentry = zpl_fh_to_dentry, .fh_to_dentry = zpl_fh_to_dentry,
.get_parent = zpl_get_parent, .get_parent = zpl_get_parent,
#ifdef HAVE_COMMIT_METADATA
.commit_metadata = zpl_commit_metadata, .commit_metadata = zpl_commit_metadata,
#endif /* HAVE_COMMIT_METADATA */
}; };

View File

@ -108,40 +108,7 @@ zpl_readdir(struct file *filp, void *dirent, filldir_t filldir)
} }
#endif /* !HAVE_VFS_ITERATE && !HAVE_VFS_ITERATE_SHARED */ #endif /* !HAVE_VFS_ITERATE && !HAVE_VFS_ITERATE_SHARED */
#if defined(HAVE_FSYNC_WITH_DENTRY) #if defined(HAVE_FSYNC_WITHOUT_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)
/* /*
* Linux 2.6.35 - 3.0 API, * Linux 2.6.35 - 3.0 API,
* As of 2.6.35 the dentry argument to the fops->fsync() hook was deemed * 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 * is FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE. The FALLOC_FL_PUNCH_HOLE
* flag was introduced in the 2.6.38 kernel. * flag was introduced in the 2.6.38 kernel.
*/ */
#if defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE) static long
long
zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len) zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len)
{ {
int error = -EOPNOTSUPP; int error = -EOPNOTSUPP;
@ -803,16 +769,13 @@ zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len)
ASSERT3S(error, <=, 0); ASSERT3S(error, <=, 0);
return (error); return (error);
} }
#endif /* defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE) */
#ifdef HAVE_FILE_FALLOCATE
static long static long
zpl_fallocate(struct file *filp, int mode, loff_t offset, loff_t len) zpl_fallocate(struct file *filp, int mode, loff_t offset, loff_t len)
{ {
return zpl_fallocate_common(file_inode(filp), return zpl_fallocate_common(file_inode(filp),
mode, offset, len); mode, offset, len);
} }
#endif /* HAVE_FILE_FALLOCATE */
#define ZFS_FL_USER_VISIBLE (FS_FL_USER_VISIBLE | ZFS_PROJINHERIT_FL) #define ZFS_FL_USER_VISIBLE (FS_FL_USER_VISIBLE | ZFS_PROJINHERIT_FL)
#define ZFS_FL_USER_MODIFIABLE (FS_FL_USER_MODIFIABLE | 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)) !capable(CAP_LINUX_IMMUTABLE))
return (-EACCES); return (-EACCES);
if (!zpl_inode_owner_or_capable(ip)) if (!inode_owner_or_capable(ip))
return (-EACCES); return (-EACCES);
xva_init(xva); xva_init(xva);
@ -1048,9 +1011,7 @@ const struct file_operations zpl_file_operations = {
#ifdef HAVE_FILE_AIO_FSYNC #ifdef HAVE_FILE_AIO_FSYNC
.aio_fsync = zpl_aio_fsync, .aio_fsync = zpl_aio_fsync,
#endif #endif
#ifdef HAVE_FILE_FALLOCATE
.fallocate = zpl_fallocate, .fallocate = zpl_fallocate,
#endif /* HAVE_FILE_FALLOCATE */
.unlocked_ioctl = zpl_ioctl, .unlocked_ioctl = zpl_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = zpl_compat_ioctl, .compat_ioctl = zpl_compat_ioctl,

View File

@ -35,11 +35,7 @@
static struct dentry * 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) zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
#endif
{ {
cred_t *cr = CRED(); cred_t *cr = CRED();
struct inode *ip; struct inode *ip;
@ -113,7 +109,7 @@ zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
} }
void 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_mask = ATTR_MODE;
vap->va_mode = 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 static int
#ifdef HAVE_CREATE_NAMEIDATA zpl_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool flag)
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
{ {
cred_t *cr = CRED(); cred_t *cr = CRED();
struct inode *ip; struct inode *ip;
@ -169,7 +159,7 @@ zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
} }
static int 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) dev_t rdev)
{ {
cred_t *cr = CRED(); cred_t *cr = CRED();
@ -213,7 +203,7 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
#ifdef HAVE_TMPFILE #ifdef HAVE_TMPFILE
static int 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(); cred_t *cr = CRED();
struct inode *ip; struct inode *ip;
@ -277,7 +267,7 @@ zpl_unlink(struct inode *dir, struct dentry *dentry)
} }
static int 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(); cred_t *cr = CRED();
vattr_t *vap; vattr_t *vap;
@ -612,46 +602,6 @@ out:
return (error); 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 = { const struct inode_operations zpl_inode_operations = {
.setattr = zpl_setattr, .setattr = zpl_setattr,
.getattr = zpl_getattr, .getattr = zpl_getattr,
@ -661,23 +611,11 @@ const struct inode_operations zpl_inode_operations = {
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#endif #endif
.listxattr = zpl_xattr_list, .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(CONFIG_FS_POSIX_ACL)
#if defined(HAVE_SET_ACL) #if defined(HAVE_SET_ACL)
.set_acl = zpl_set_acl, .set_acl = zpl_set_acl,
#endif #endif /* HAVE_SET_ACL */
#if defined(HAVE_GET_ACL)
.get_acl = zpl_get_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 */ #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(CONFIG_FS_POSIX_ACL)
#if defined(HAVE_SET_ACL) #if defined(HAVE_SET_ACL)
.set_acl = zpl_set_acl, .set_acl = zpl_set_acl,
#endif #endif /* HAVE_SET_ACL */
#if defined(HAVE_GET_ACL)
.get_acl = zpl_get_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 */ #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(CONFIG_FS_POSIX_ACL)
#if defined(HAVE_SET_ACL) #if defined(HAVE_SET_ACL)
.set_acl = zpl_set_acl, .set_acl = zpl_set_acl,
#endif #endif /* HAVE_SET_ACL */
#if defined(HAVE_GET_ACL)
.get_acl = zpl_get_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 */ #endif /* CONFIG_FS_POSIX_ACL */
}; };

View File

@ -81,18 +81,6 @@ zpl_dirty_inode(struct inode *ip)
* unhashed and has no links the default policy is to evict it * unhashed and has no links the default policy is to evict it
* immediately. * 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, * The ->evict_inode() callback must minimally truncate the inode pages,
* and call clear_inode(). For 2.6.35 and later kernels this will * and call clear_inode(). For 2.6.35 and later kernels this will
* simply update the inode state, with the sync occurring before the * 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(). * any remaining inode specific data via zfs_inactive().
* remaining filesystem specific data. * remaining filesystem specific data.
*/ */
#ifdef HAVE_EVICT_INODE
static void static void
zpl_evict_inode(struct inode *ip) zpl_evict_inode(struct inode *ip)
{ {
@ -115,32 +102,6 @@ zpl_evict_inode(struct inode *ip)
spl_fstrans_unmark(cookie); 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 static void
zpl_put_super(struct super_block *sb) zpl_put_super(struct super_block *sb)
{ {
@ -241,19 +202,11 @@ __zpl_show_options(struct seq_file *seq, zfsvfs_t *zfsvfs)
return (0); return (0);
} }
#ifdef HAVE_SHOW_OPTIONS_WITH_DENTRY
static int static int
zpl_show_options(struct seq_file *seq, struct dentry *root) zpl_show_options(struct seq_file *seq, struct dentry *root)
{ {
return (__zpl_show_options(seq, root->d_sb->s_fs_info)); 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 static int
zpl_fill_super(struct super_block *sb, void *data, int silent) 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. * this can prevent the pool sync and cause a deadlock.
*/ */
dsl_pool_rele(dmu_objset_pool(os), FTAG); 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); dsl_dataset_rele(dmu_objset_ds(os), FTAG);
if (IS_ERR(s)) 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); return (s);
} }
#ifdef HAVE_FST_MOUNT
static struct dentry * static struct dentry *
zpl_mount(struct file_system_type *fs_type, int flags, zpl_mount(struct file_system_type *fs_type, int flags,
const char *osname, void *data) const char *osname, void *data)
@ -335,32 +287,12 @@ zpl_mount(struct file_system_type *fs_type, int flags,
return (dget(sb->s_root)); 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 static void
zpl_kill_sb(struct super_block *sb) zpl_kill_sb(struct super_block *sb)
{ {
zfs_preumount(sb); zfs_preumount(sb);
kill_anon_super(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 void
@ -372,55 +304,23 @@ zpl_prune_sb(int64_t nr_to_scan, void *arg)
(void) -zfs_prune(sb, nr_to_scan, &objects); (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 = { const struct super_operations zpl_super_operations = {
.alloc_inode = zpl_inode_alloc, .alloc_inode = zpl_inode_alloc,
.destroy_inode = zpl_inode_destroy, .destroy_inode = zpl_inode_destroy,
.dirty_inode = zpl_dirty_inode, .dirty_inode = zpl_dirty_inode,
.write_inode = NULL, .write_inode = NULL,
#ifdef HAVE_EVICT_INODE
.evict_inode = zpl_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, .put_super = zpl_put_super,
.sync_fs = zpl_sync_fs, .sync_fs = zpl_sync_fs,
.statfs = zpl_statfs, .statfs = zpl_statfs,
.remount_fs = zpl_remount_fs, .remount_fs = zpl_remount_fs,
.show_options = zpl_show_options, .show_options = zpl_show_options,
.show_stats = NULL, .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 = { struct file_system_type zpl_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = ZFS_DRIVER, .name = ZFS_DRIVER,
#ifdef HAVE_FST_MOUNT
.mount = zpl_mount, .mount = zpl_mount,
#else
.get_sb = zpl_get_sb,
#endif /* HAVE_FST_MOUNT */
.kill_sb = zpl_kill_sb, .kill_sb = zpl_kill_sb,
}; };

Some files were not shown because too many files have changed in this diff Show More