]> git.proxmox.com Git - mirror_zfs-debian.git/blobdiff - config/kernel.m4
New upstream version 0.7.2
[mirror_zfs-debian.git] / config / kernel.m4
index 4a8eeab2ae10153ce93fce2c7f69daafd52f9dde..c3ed5cf3320b377a7362b91f866ac0b1a20b41d3 100644 (file)
@@ -1,18 +1,20 @@
 dnl #
-dnl # Default ZFS kernel configuration 
+dnl # Default ZFS kernel configuration
 dnl #
 AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
        ZFS_AC_KERNEL
        ZFS_AC_SPL
+       ZFS_AC_QAT
        ZFS_AC_TEST_MODULE
+       ZFS_AC_KERNEL_OBJTOOL
        ZFS_AC_KERNEL_CONFIG
        ZFS_AC_KERNEL_DECLARE_EVENT_CLASS
        ZFS_AC_KERNEL_CURRENT_BIO_TAIL
+       ZFS_AC_KERNEL_SUPER_USER_NS
        ZFS_AC_KERNEL_SUBMIT_BIO
        ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS
        ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
        ZFS_AC_KERNEL_TYPE_FMODE_T
-       ZFS_AC_KERNEL_KOBJ_NAME_LEN
        ZFS_AC_KERNEL_3ARG_BLKDEV_GET
        ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH
        ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE
@@ -22,14 +24,17 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
        ZFS_AC_KERNEL_BDEV_PHYSICAL_BLOCK_SIZE
        ZFS_AC_KERNEL_BIO_BVEC_ITER
        ZFS_AC_KERNEL_BIO_FAILFAST_DTD
+       ZFS_AC_KERNEL_BIO_SET_DEV
        ZFS_AC_KERNEL_REQ_FAILFAST_MASK
        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_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_FLUSH
        ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS
        ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS
@@ -59,9 +64,11 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
        ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL
        ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL
        ZFS_AC_KERNEL_INODE_OPERATIONS_GETATTR
+       ZFS_AC_KERNEL_INODE_SET_FLAGS
        ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE
        ZFS_AC_KERNEL_SHOW_OPTIONS
        ZFS_AC_KERNEL_FILE_INODE
+       ZFS_AC_KERNEL_FILE_DENTRY
        ZFS_AC_KERNEL_FSYNC
        ZFS_AC_KERNEL_EVICT_INODE
        ZFS_AC_KERNEL_DIRTY_INODE_WITH_FLAGS
@@ -74,6 +81,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
        ZFS_AC_KERNEL_CREATE_NAMEIDATA
        ZFS_AC_KERNEL_GET_LINK
        ZFS_AC_KERNEL_PUT_LINK
+       ZFS_AC_KERNEL_TMPFILE
        ZFS_AC_KERNEL_TRUNCATE_RANGE
        ZFS_AC_KERNEL_AUTOMOUNT
        ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE
@@ -87,7 +95,6 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
        ZFS_AC_KERNEL_D_SET_D_OP
        ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA
        ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS
-       ZFS_AC_KERNEL_CHECK_DISK_SIZE_CHANGE
        ZFS_AC_KERNEL_TRUNCATE_SETSIZE
        ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY
        ZFS_AC_KERNEL_CALLBACK_SECURITY_INODE_INIT_SECURITY
@@ -107,10 +114,15 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
        ZFS_AC_KERNEL_KMAP_ATOMIC_ARGS
        ZFS_AC_KERNEL_FOLLOW_DOWN_ONE
        ZFS_AC_KERNEL_MAKE_REQUEST_FN
-       ZFS_AC_KERNEL_GENERIC_IO_ACCT
+       ZFS_AC_KERNEL_GENERIC_IO_ACCT_3ARG
+       ZFS_AC_KERNEL_GENERIC_IO_ACCT_4ARG
+       ZFS_AC_KERNEL_FPU
+       ZFS_AC_KERNEL_KUID_HELPERS
+       ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST
        ZFS_AC_KERNEL_RENAME_WANTS_FLAGS
        ZFS_AC_KERNEL_HAVE_GENERIC_SETXATTR
        ZFS_AC_KERNEL_CURRENT_TIME
+       ZFS_AC_KERNEL_VM_NODE_STAT
 
        AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
                KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
@@ -120,6 +132,8 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
 
        dnl # -Wall -fno-strict-aliasing -Wstrict-prototypes and other
        dnl # compiler options are added by the kernel build system.
+       KERNELCPPFLAGS="$KERNELCPPFLAGS -std=gnu99"
+       KERNELCPPFLAGS="$KERNELCPPFLAGS -Wno-declaration-after-statement"
        KERNELCPPFLAGS="$KERNELCPPFLAGS $NO_UNUSED_BUT_SET_VARIABLE"
        KERNELCPPFLAGS="$KERNELCPPFLAGS $NO_BOOL_COMPARE"
        KERNELCPPFLAGS="$KERNELCPPFLAGS -DHAVE_SPL -D_KERNEL"
@@ -192,6 +206,7 @@ AC_DEFUN([ZFS_AC_KERNEL], [
                AS_IF([test "$kernelsrc" = "NONE"], [
                        kernsrcver=NONE
                ])
+               withlinux=yes
        ])
 
        AC_MSG_RESULT([$kernelsrc])
@@ -204,7 +219,7 @@ AC_DEFUN([ZFS_AC_KERNEL], [
 
        AC_MSG_CHECKING([kernel build directory])
        AS_IF([test -z "$kernelbuild"], [
-               AS_IF([test -e "/lib/modules/$(uname -r)/build"], [
+               AS_IF([test x$withlinux != xyes -a -e "/lib/modules/$(uname -r)/build"], [
                        kernelbuild=`readlink -f /lib/modules/$(uname -r)/build`
                ], [test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}], [
                        kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
@@ -272,7 +287,9 @@ AC_DEFUN([ZFS_AC_SPL], [
        AC_ARG_WITH([spl],
                AS_HELP_STRING([--with-spl=PATH],
                [Path to spl source]),
-               [splsrc="$withval"])
+               AS_IF([test "$withval" = "yes"],
+                       AC_MSG_ERROR([--with-spl=PATH requires a PATH]),
+                       [splsrc="$withval"]))
 
        AC_ARG_WITH([spl-obj],
                AS_HELP_STRING([--with-spl-obj=PATH],
@@ -298,6 +315,14 @@ AC_DEFUN([ZFS_AC_SPL], [
 
        AC_MSG_CHECKING([spl source directory])
        AS_IF([test -z "${splsrc}"], [
+               [all_spl_sources="
+               ${splsrc0}
+               ${splsrc1}
+               ${splsrc2}
+               ${splsrc3}
+               ${splsrc4}
+               ${splsrc5}
+               ${splsrc6}"],
                AS_IF([ test -e "${splsrc0}/spl.release.in"], [
                        splsrc=${splsrc0}
                ], [ test -e "${splsrc1}/spl.release.in"], [
@@ -316,6 +341,7 @@ AC_DEFUN([ZFS_AC_SPL], [
                        splsrc="[Not found]"
                ])
        ], [
+               [all_spl_sources="$withval"],
                AS_IF([test "$splsrc" = "NONE"], [
                        splbuild=NONE
                        splsrcver=NONE
@@ -327,7 +353,10 @@ AC_DEFUN([ZFS_AC_SPL], [
                AC_MSG_ERROR([
        *** Please make sure the kmod spl devel package for your distribution
        *** is installed then try again.  If that fails you can specify the
-       *** location of the spl source with the '--with-spl=PATH' option.])
+       *** location of the spl source with the '--with-spl=PATH' option.
+       *** The spl version must match the version of ZFS you are building,
+       *** ${VERSION}.  Failed to find spl.release.in in the following:
+       $all_spl_sources])
        ])
 
        dnl #
@@ -343,6 +372,10 @@ AC_DEFUN([ZFS_AC_SPL], [
        dnl # SPL package.
        dnl #
        AC_MSG_CHECKING([spl build directory])
+
+       all_spl_config_locs="${splsrc}/${LINUX_VERSION}
+       ${splsrc}"
+
        while true; do
                AS_IF([test -z "$splbuild"], [
                        AS_IF([ test -e "${splsrc}/${LINUX_VERSION}/spl_config.h" ], [
@@ -369,7 +402,9 @@ AC_DEFUN([ZFS_AC_SPL], [
        *** Please make sure the kmod spl devel <kernel> package for your
        *** distribution is installed then try again.  If that fails you
        *** can specify the location of the spl objects with the
-       *** '--with-spl-obj=PATH' option.])
+       *** '--with-spl-obj=PATH' option.  Failed to find spl_config.h in
+       *** any of the following:
+       $all_spl_config_locs])
        ])
 
        AC_MSG_CHECKING([spl source version])
@@ -442,6 +477,95 @@ AC_DEFUN([ZFS_AC_SPL], [
        AC_SUBST(SPL_SYMBOLS)
 ])
 
+dnl #
+dnl # Detect the QAT module to be built against
+dnl # QAT provides hardware acceleration for data compression:
+dnl #  https://01.org/intel-quickassist-technology
+dnl # * Download and install QAT driver from the above link
+dnl # * Start QAT driver in your system:
+dnl #  service qat_service start
+dnl # * Enable QAT in ZFS, e.g.:
+dnl #  ./configure --with-qat=<qat-driver-path>/QAT1.6
+dnl #  make
+dnl # * Set GZIP compression in ZFS dataset:
+dnl #  zfs set compression = gzip <dataset>
+dnl # Then the data written to this ZFS pool is compressed
+dnl # by QAT accelerator automatically, and de-compressed by
+dnl # QAT when read from the pool.
+dnl # * Get QAT hardware statistics by:
+dnl #  cat /proc/icp_dh895xcc_dev/qat
+dnl # * To disable QAT:
+dnl #  insmod zfs.ko zfs_qat_disable=1
+dnl #
+AC_DEFUN([ZFS_AC_QAT], [
+       AC_ARG_WITH([qat],
+               AS_HELP_STRING([--with-qat=PATH],
+               [Path to qat source]),
+               AS_IF([test "$withval" = "yes"],
+                       AC_MSG_ERROR([--with-qat=PATH requires a PATH]),
+                       [qatsrc="$withval"]))
+
+       AC_ARG_WITH([qat-obj],
+               AS_HELP_STRING([--with-qat-obj=PATH],
+               [Path to qat build objects]),
+               [qatbuild="$withval"])
+
+       AS_IF([test ! -z "${qatsrc}"], [
+               AC_MSG_CHECKING([qat source directory])
+               AC_MSG_RESULT([$qatsrc])
+               QAT_SRC="${qatsrc}/quickassist"
+               AS_IF([ test ! -e "$QAT_SRC/include/cpa.h"], [
+                       AC_MSG_ERROR([
+               *** Please make sure the qat driver package is installed
+               *** and specify the location of the qat source with the
+               *** '--with-qat=PATH' option then try again. Failed to
+               *** find cpa.h in:
+               ${QAT_SRC}/include])
+               ])
+       ])
+
+       AS_IF([test ! -z "${qatsrc}"], [
+               AC_MSG_CHECKING([qat build directory])
+               AS_IF([test -z "$qatbuild"], [
+                       qatbuild="${qatsrc}/build"
+               ])
+
+               AC_MSG_RESULT([$qatbuild])
+               QAT_OBJ=${qatbuild}
+               AS_IF([ ! test -e "$QAT_OBJ/icp_qa_al.ko"], [
+                       AC_MSG_ERROR([
+               *** Please make sure the qat driver is installed then try again.
+               *** Failed to find icp_qa_al.ko in:
+               $QAT_OBJ])
+               ])
+
+               AC_SUBST(QAT_SRC)
+               AC_SUBST(QAT_OBJ)
+
+               AC_DEFINE(HAVE_QAT, 1,
+               [qat is enabled and existed])
+       ])
+
+       dnl #
+       dnl # Detect the name used for the QAT Module.symvers file.
+       dnl #
+       AS_IF([test ! -z "${qatsrc}"], [
+               AC_MSG_CHECKING([qat file for module symbols])
+               QAT_SYMBOLS=$QAT_SRC/lookaside/access_layer/src/Module.symvers
+
+               AS_IF([test -r $QAT_SYMBOLS], [
+                       AC_MSG_RESULT([$QAT_SYMBOLS])
+                       AC_SUBST(QAT_SYMBOLS)
+               ],[
+                       AC_MSG_ERROR([
+                       *** Please make sure the qat driver is installed then try again.
+                       *** Failed to find Module.symvers in:
+                       $QAT_SYMBOLS])
+                       ])
+               ])
+       ])
+])
+
 dnl #
 dnl # Basic toolchain sanity check.
 dnl #