summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2018-02-15 17:53:18 -0800
committerBrian Behlendorf <[email protected]>2018-05-29 16:00:33 -0700
commit93ce2b4ca5a40c41ac945cd3aaf4a4a22bb751e1 (patch)
tree6832f5c9dfdbe0f0bd5c8708344a769676b1f95d /config
parent1272941f49321bcb7b26025670720c98785427ee (diff)
Update build system and packaging
Minimal changes required to integrate the SPL sources in to the ZFS repository build infrastructure and packaging. Build system and packaging: * Renamed SPL_* autoconf m4 macros to ZFS_*. * Removed redundant SPL_* autoconf m4 macros. * Updated the RPM spec files to remove SPL package dependency. * The zfs package obsoletes the spl package, and the zfs-kmod package obsoletes the spl-kmod package. * The zfs-kmod-devel* packages were updated to add compatibility symlinks under /usr/src/spl-x.y.z until all dependent packages can be updated. They will be removed in a future release. * Updated copy-builtin script for in-kernel builds. * Updated DKMS package to include the spl.ko. * Updated stale AUTHORS file to include all contributors. * Updated stale COPYRIGHT and included the SPL as an exception. * Renamed README.markdown to README.md * Renamed OPENSOLARIS.LICENSE to LICENSE. * Renamed DISCLAIMER to NOTICE. Required code changes: * Removed redundant HAVE_SPL macro. * Removed _BOOT from nvpairs since it doesn't apply for Linux. * Initial header cleanup (removal of empty headers, refactoring). * Remove SPL repository clone/build from zimport.sh. * Use of DEFINE_RATELIMIT_STATE and DEFINE_SPINLOCK removed due to build issues when forcing C99 compilation. * Replaced legacy ACCESS_ONCE with READ_ONCE. * Include needed headers for `current` and `EXPORT_SYMBOL`. Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Olaf Faaland <[email protected]> Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Pavel Zakharov <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> TEST_ZIMPORT_SKIP="yes" Closes #7556
Diffstat (limited to 'config')
-rw-r--r--config/kernel-ctl-table-name.m44
-rw-r--r--config/kernel-fallocate-pax.m44
-rw-r--r--config/kernel-group-info.m44
-rw-r--r--config/kernel-inode-lock.m44
-rw-r--r--config/kernel-kmem-cache.m410
-rw-r--r--config/kernel-kuidgid.m414
-rw-r--r--config/kernel-pde-data.m44
-rw-r--r--config/kernel-rw.m48
-rw-r--r--config/kernel-rwsem.m412
-rw-r--r--config/kernel-sched.m412
-rw-r--r--config/kernel-set-fs-pwd.m46
-rw-r--r--config/kernel-shrink.m4127
-rw-r--r--config/kernel-shrinker.m4125
-rw-r--r--config/kernel-spinlock.m44
-rw-r--r--config/kernel-timer.m44
-rw-r--r--config/kernel-trim-unused-symbols.m419
-rw-r--r--config/kernel-urange-sleep.m44
-rw-r--r--config/kernel-vfs-fsync.m44
-rw-r--r--config/kernel-vfs-getattr.m412
-rw-r--r--config/kernel-wait.m412
-rw-r--r--config/kernel-zlib.m412
-rw-r--r--config/kernel.m4253
-rw-r--r--config/zfs-build.m462
-rw-r--r--config/zfs-meta.m426
24 files changed, 324 insertions, 422 deletions
diff --git a/config/kernel-ctl-table-name.m4 b/config/kernel-ctl-table-name.m4
index 8dd2e77cb..3ce499968 100644
--- a/config/kernel-ctl-table-name.m4
+++ b/config/kernel-ctl-table-name.m4
@@ -2,9 +2,9 @@ dnl #
dnl # 2.6.33 API change,
dnl # Removed .ctl_name from struct ctl_table.
dnl #
-AC_DEFUN([SPL_AC_CTL_NAME], [
+AC_DEFUN([ZFS_AC_KERNEL_CTL_NAME], [
AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/sysctl.h>
],[
struct ctl_table ctl __attribute__ ((unused));
diff --git a/config/kernel-fallocate-pax.m4 b/config/kernel-fallocate-pax.m4
index ac75a4c8e..e8948be17 100644
--- a/config/kernel-fallocate-pax.m4
+++ b/config/kernel-fallocate-pax.m4
@@ -1,9 +1,9 @@
dnl #
dnl # PaX Linux 2.6.38 - 3.x API
dnl #
-AC_DEFUN([SPL_AC_PAX_KERNEL_FILE_FALLOCATE], [
+AC_DEFUN([ZFS_AC_PAX_KERNEL_FILE_FALLOCATE], [
AC_MSG_CHECKING([whether fops->fallocate() exists])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
diff --git a/config/kernel-group-info.m4 b/config/kernel-group-info.m4
index 4db2bba5c..849a1e246 100644
--- a/config/kernel-group-info.m4
+++ b/config/kernel-group-info.m4
@@ -2,11 +2,11 @@ dnl #
dnl # 4.9 API change
dnl # group_info changed from 2d array via >blocks to 1d array via ->gid
dnl #
-AC_DEFUN([SPL_AC_GROUP_INFO_GID], [
+AC_DEFUN([ZFS_AC_KERNEL_GROUP_INFO_GID], [
AC_MSG_CHECKING([whether group_info->gid exists])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/cred.h>
],[
struct group_info *gi = groups_alloc(1);
diff --git a/config/kernel-inode-lock.m4 b/config/kernel-inode-lock.m4
index 2cc06a5ec..8dee01422 100644
--- a/config/kernel-inode-lock.m4
+++ b/config/kernel-inode-lock.m4
@@ -4,11 +4,11 @@ dnl # i_mutex is changed to i_rwsem. Instead of directly using
dnl # i_mutex/i_rwsem, we should use inode_lock() and inode_lock_shared()
dnl # We test inode_lock_shared because inode_lock is introduced earlier.
dnl #
-AC_DEFUN([SPL_AC_INODE_LOCK], [
+AC_DEFUN([ZFS_AC_KERNEL_INODE_LOCK], [
AC_MSG_CHECKING([whether inode_lock_shared() exists])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
struct inode *inode = NULL;
diff --git a/config/kernel-kmem-cache.m4 b/config/kernel-kmem-cache.m4
index 50a7fdb4b..21cc53d34 100644
--- a/config/kernel-kmem-cache.m4
+++ b/config/kernel-kmem-cache.m4
@@ -5,9 +5,9 @@ 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([SPL_AC_KMEM_CACHE_ALLOCFLAGS], [
+AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE_ALLOCFLAGS], [
AC_MSG_CHECKING([whether struct kmem_cache has allocflags])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/slab.h>
],[
struct kmem_cache cachep __attribute__ ((unused));
@@ -20,7 +20,7 @@ AC_DEFUN([SPL_AC_KMEM_CACHE_ALLOCFLAGS], [
AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether struct kmem_cache has gfpflags])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/slab.h>
],[
struct kmem_cache cachep __attribute__ ((unused));
@@ -40,11 +40,11 @@ dnl # grsecurity API change,
dnl # kmem_cache_create() with SLAB_USERCOPY flag replaced by
dnl # kmem_cache_create_usercopy().
dnl #
-AC_DEFUN([SPL_AC_KMEM_CACHE_CREATE_USERCOPY], [
+AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY], [
AC_MSG_CHECKING([whether kmem_cache_create_usercopy() exists])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/slab.h>
static void ctor(void *foo)
{
diff --git a/config/kernel-kuidgid.m4 b/config/kernel-kuidgid.m4
index 47d193783..82685d263 100644
--- a/config/kernel-kuidgid.m4
+++ b/config/kernel-kuidgid.m4
@@ -3,19 +3,19 @@ dnl # User namespaces, use kuid_t in place of uid_t
dnl # where available. Not strictly a user namespaces thing
dnl # but it should prevent surprises
dnl #
-AC_DEFUN([SPL_AC_KUIDGID_T], [
+AC_DEFUN([ZFS_AC_KERNEL_KUIDGID_T], [
AC_MSG_CHECKING([whether kuid_t/kgid_t is available])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/uidgid.h>
], [
- kuid_t userid = KUIDT_INIT(0);
- kgid_t groupid = KGIDT_INIT(0);
+ kuid_t userid __attribute__ ((unused)) = KUIDT_INIT(0);
+ kgid_t groupid __attribute__ ((unused)) = KGIDT_INIT(0);
],[
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/uidgid.h>
], [
- kuid_t userid = 0;
- kgid_t groupid = 0;
+ kuid_t userid __attribute__ ((unused)) = 0;
+ kgid_t groupid __attribute__ ((unused)) = 0;
],[
AC_MSG_RESULT(yes; optional)
],[
diff --git a/config/kernel-pde-data.m4 b/config/kernel-pde-data.m4
index 6aa5765c3..8aa4c2204 100644
--- a/config/kernel-pde-data.m4
+++ b/config/kernel-pde-data.m4
@@ -2,9 +2,9 @@ dnl #
dnl # 3.10 API change,
dnl # PDE is replaced by PDE_DATA
dnl #
-AC_DEFUN([SPL_AC_PDE_DATA], [
+AC_DEFUN([ZFS_AC_KERNEL_PDE_DATA], [
AC_MSG_CHECKING([whether PDE_DATA() is available])
- SPL_LINUX_TRY_COMPILE_SYMBOL([
+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/proc_fs.h>
], [
PDE_DATA(NULL);
diff --git a/config/kernel-rw.m4 b/config/kernel-rw.m4
index 23c14b70f..1c8a265e0 100644
--- a/config/kernel-rw.m4
+++ b/config/kernel-rw.m4
@@ -3,11 +3,11 @@ dnl # 4.14 API change
dnl # kernel_write() which was introduced in 3.9 was updated to take
dnl # the offset as a pointer which is needed by vn_rdwr().
dnl #
-AC_DEFUN([SPL_AC_KERNEL_WRITE], [
+AC_DEFUN([ZFS_AC_KERNEL_WRITE], [
AC_MSG_CHECKING([whether kernel_write() takes loff_t pointer])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
struct file *file = NULL;
@@ -32,11 +32,11 @@ dnl # 4.14 API change
dnl # kernel_read() which has existed for forever was updated to take
dnl # the offset as a pointer which is needed by vn_rdwr().
dnl #
-AC_DEFUN([SPL_AC_KERNEL_READ], [
+AC_DEFUN([ZFS_AC_KERNEL_READ], [
AC_MSG_CHECKING([whether kernel_read() takes loff_t pointer])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
struct file *file = NULL;
diff --git a/config/kernel-rwsem.m4 b/config/kernel-rwsem.m4
index aee20ae90..532c22718 100644
--- a/config/kernel-rwsem.m4
+++ b/config/kernel-rwsem.m4
@@ -4,11 +4,11 @@ dnl #
dnl # The rw_semaphore.wait_lock member was changed from spinlock_t to
dnl # raw_spinlock_t at commit ddb6c9b58a19edcfac93ac670b066c836ff729f1.
dnl #
-AC_DEFUN([SPL_AC_RWSEM_SPINLOCK_IS_RAW], [
+AC_DEFUN([ZFS_AC_KERNEL_RWSEM_SPINLOCK_IS_RAW], [
AC_MSG_CHECKING([whether struct rw_semaphore member wait_lock is raw])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/rwsem.h>
],[
struct rw_semaphore dummy_semaphore __attribute__ ((unused));
@@ -30,11 +30,11 @@ dnl # 3.16 API Change
dnl #
dnl # rwsem-spinlock "->activity" changed to "->count"
dnl #
-AC_DEFUN([SPL_AC_RWSEM_ACTIVITY], [
+AC_DEFUN([ZFS_AC_KERNEL_RWSEM_ACTIVITY], [
AC_MSG_CHECKING([whether struct rw_semaphore has member activity])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/rwsem.h>
],[
struct rw_semaphore dummy_semaphore __attribute__ ((unused));
@@ -54,12 +54,12 @@ dnl # 4.8 API Change
dnl #
dnl # rwsem "->count" changed to atomic_long_t type
dnl #
-AC_DEFUN([SPL_AC_RWSEM_ATOMIC_LONG_COUNT], [
+AC_DEFUN([ZFS_AC_KERNEL_RWSEM_ATOMIC_LONG_COUNT], [
AC_MSG_CHECKING(
[whether struct rw_semaphore has atomic_long_t member count])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/rwsem.h>
],[
DECLARE_RWSEM(dummy_semaphore);
diff --git a/config/kernel-sched.m4 b/config/kernel-sched.m4
index 5ae21676e..640b008aa 100644
--- a/config/kernel-sched.m4
+++ b/config/kernel-sched.m4
@@ -2,9 +2,9 @@ dnl #
dnl # 3.9 API change,
dnl # Moved things from linux/sched.h to linux/sched/rt.h
dnl #
-AC_DEFUN([SPL_AC_SCHED_RT_HEADER],
+AC_DEFUN([ZFS_AC_KERNEL_SCHED_RT_HEADER],
[AC_MSG_CHECKING([whether header linux/sched/rt.h exists])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/sched.h>
#include <linux/sched/rt.h>
],[
@@ -21,9 +21,9 @@ dnl #
dnl # 4.11 API change,
dnl # Moved things from linux/sched.h to linux/sched/signal.h
dnl #
-AC_DEFUN([SPL_AC_SCHED_SIGNAL_HEADER],
+AC_DEFUN([ZFS_AC_KERNEL_SCHED_SIGNAL_HEADER],
[AC_MSG_CHECKING([whether header linux/sched/signal.h exists])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/sched.h>
#include <linux/sched/signal.h>
],[
@@ -41,9 +41,9 @@ dnl # The io_schedule_timeout() function is present in all 2.6.32 kernels
dnl # but it was not exported until Linux 3.19. The RHEL 7.x kernels which
dnl # are based on a 3.10 kernel do export this symbol.
dnl #
-AC_DEFUN([SPL_AC_IO_SCHEDULE_TIMEOUT], [
+AC_DEFUN([ZFS_AC_KERNEL_IO_SCHEDULE_TIMEOUT], [
AC_MSG_CHECKING([whether io_schedule_timeout() is available])
- SPL_LINUX_TRY_COMPILE_SYMBOL([
+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/sched.h>
], [
(void) io_schedule_timeout(1);
diff --git a/config/kernel-set-fs-pwd.m4 b/config/kernel-set-fs-pwd.m4
index 849e7e6cb..d5565b42c 100644
--- a/config/kernel-set-fs-pwd.m4
+++ b/config/kernel-set-fs-pwd.m4
@@ -2,11 +2,11 @@ dnl #
dnl # 3.9 API change
dnl # set_fs_pwd takes const struct path *
dnl #
-AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST],
+AC_DEFUN([ZFS_AC_KERNEL_SET_FS_PWD_WITH_CONST],
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
[AC_MSG_CHECKING([whether set_fs_pwd() requires const struct path *])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/spinlock.h>
#include <linux/fs_struct.h>
#include <linux/path.h>
@@ -20,7 +20,7 @@ AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST],
AC_DEFINE(HAVE_SET_FS_PWD_WITH_CONST, 1,
[set_fs_pwd() needs const path *])
],[
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/spinlock.h>
#include <linux/fs_struct.h>
#include <linux/path.h>
diff --git a/config/kernel-shrink.m4 b/config/kernel-shrink.m4
index a57c2afb0..37da0ec72 100644
--- a/config/kernel-shrink.m4
+++ b/config/kernel-shrink.m4
@@ -131,3 +131,130 @@ AC_DEFUN([ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID], [
AC_MSG_RESULT(no)
])
])
+
+
+AC_DEFUN([ZFS_AC_KERNEL_SHRINKER_CALLBACK],[
+ tmp_flags="$EXTRA_KCFLAGS"
+ EXTRA_KCFLAGS="-Werror"
+ 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_TRY_COMPILE([
+ #include <linux/mm.h>
+
+ int shrinker_cb(int nr_to_scan, gfp_t gfp_mask);
+ ],[
+ struct shrinker cache_shrinker = {
+ .shrink = shrinker_cb,
+ .seeks = DEFAULT_SEEKS,
+ };
+ register_shrinker(&cache_shrinker);
+ ],[
+ 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_TRY_COMPILE([
+ #include <linux/mm.h>
+
+ int shrinker_cb(struct shrinker *, int nr_to_scan,
+ gfp_t gfp_mask);
+ ],[
+ struct shrinker cache_shrinker = {
+ .shrink = shrinker_cb,
+ .seeks = DEFAULT_SEEKS,
+ };
+ register_shrinker(&cache_shrinker);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1,
+ [old shrinker callback wants 3 args])
+ ],[
+ AC_MSG_RESULT(no)
+ dnl #
+ dnl # 3.0 - 3.11 API change
+ dnl # ->shrink(struct shrinker *,
+ dnl # struct shrink_control *sc)
+ dnl #
+ AC_MSG_CHECKING(
+ [whether new 2-argument shrinker exists])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/mm.h>
+
+ int shrinker_cb(struct shrinker *,
+ struct shrink_control *sc);
+ ],[
+ struct shrinker cache_shrinker = {
+ .shrink = shrinker_cb,
+ .seeks = DEFAULT_SEEKS,
+ };
+ register_shrinker(&cache_shrinker);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_2ARGS_NEW_SHRINKER_CALLBACK, 1,
+ [new shrinker callback wants 2 args])
+ ],[
+ AC_MSG_RESULT(no)
+ dnl #
+ dnl # 3.12 API change,
+ dnl # ->shrink() is logically split in to
+ dnl # ->count_objects() and ->scan_objects()
+ dnl #
+ AC_MSG_CHECKING(
+ [whether ->count_objects callback exists])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/mm.h>
+
+ unsigned long shrinker_cb(
+ struct shrinker *,
+ struct shrink_control *sc);
+ ],[
+ struct shrinker cache_shrinker = {
+ .count_objects = shrinker_cb,
+ .scan_objects = shrinker_cb,
+ .seeks = DEFAULT_SEEKS,
+ };
+ register_shrinker(&cache_shrinker);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK,
+ 1, [->count_objects exists])
+ ],[
+ AC_MSG_ERROR(error)
+ ])
+ ])
+ ])
+ ])
+ EXTRA_KCFLAGS="$tmp_flags"
+])
+
+dnl #
+dnl # 2.6.39 API change,
+dnl # Shrinker adjust to use common shrink_control structure.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_SHRINK_CONTROL_STRUCT], [
+ AC_MSG_CHECKING([whether struct shrink_control exists])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/mm.h>
+ ],[
+ struct shrink_control sc __attribute__ ((unused));
+
+ sc.nr_to_scan = 0;
+ sc.gfp_mask = GFP_KERNEL;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_SHRINK_CONTROL_STRUCT, 1,
+ [struct shrink_control exists])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
diff --git a/config/kernel-shrinker.m4 b/config/kernel-shrinker.m4
deleted file mode 100644
index 6fc9b5422..000000000
--- a/config/kernel-shrinker.m4
+++ /dev/null
@@ -1,125 +0,0 @@
-AC_DEFUN([SPL_AC_SHRINKER_CALLBACK],[
- tmp_flags="$EXTRA_KCFLAGS"
- EXTRA_KCFLAGS="-Werror"
- 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])
- SPL_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
-
- int shrinker_cb(int nr_to_scan, gfp_t gfp_mask);
- ],[
- struct shrinker cache_shrinker = {
- .shrink = shrinker_cb,
- .seeks = DEFAULT_SEEKS,
- };
- register_shrinker(&cache_shrinker);
- ],[
- 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])
- SPL_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
-
- int shrinker_cb(struct shrinker *, int nr_to_scan,
- gfp_t gfp_mask);
- ],[
- struct shrinker cache_shrinker = {
- .shrink = shrinker_cb,
- .seeks = DEFAULT_SEEKS,
- };
- register_shrinker(&cache_shrinker);
- ],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1,
- [old shrinker callback wants 3 args])
- ],[
- AC_MSG_RESULT(no)
- dnl #
- dnl # 3.0 - 3.11 API change
- dnl # ->shrink(struct shrinker *,
- dnl # struct shrink_control *sc)
- dnl #
- AC_MSG_CHECKING(
- [whether new 2-argument shrinker exists])
- SPL_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
-
- int shrinker_cb(struct shrinker *,
- struct shrink_control *sc);
- ],[
- struct shrinker cache_shrinker = {
- .shrink = shrinker_cb,
- .seeks = DEFAULT_SEEKS,
- };
- register_shrinker(&cache_shrinker);
- ],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_2ARGS_NEW_SHRINKER_CALLBACK, 1,
- [new shrinker callback wants 2 args])
- ],[
- AC_MSG_RESULT(no)
- dnl #
- dnl # 3.12 API change,
- dnl # ->shrink() is logically split in to
- dnl # ->count_objects() and ->scan_objects()
- dnl #
- AC_MSG_CHECKING(
- [whether ->count_objects callback exists])
- SPL_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
-
- unsigned long shrinker_cb(
- struct shrinker *,
- struct shrink_control *sc);
- ],[
- struct shrinker cache_shrinker = {
- .count_objects = shrinker_cb,
- .scan_objects = shrinker_cb,
- .seeks = DEFAULT_SEEKS,
- };
- register_shrinker(&cache_shrinker);
- ],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK,
- 1, [->count_objects exists])
- ],[
- AC_MSG_ERROR(error)
- ])
- ])
- ])
- ])
- EXTRA_KCFLAGS="$tmp_flags"
-])
-
-dnl #
-dnl # 2.6.39 API change,
-dnl # Shrinker adjust to use common shrink_control structure.
-dnl #
-AC_DEFUN([SPL_AC_SHRINK_CONTROL_STRUCT], [
- AC_MSG_CHECKING([whether struct shrink_control exists])
- SPL_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
- ],[
- struct shrink_control sc __attribute__ ((unused));
-
- sc.nr_to_scan = 0;
- sc.gfp_mask = GFP_KERNEL;
- ],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SHRINK_CONTROL_STRUCT, 1,
- [struct shrink_control exists])
- ],[
- AC_MSG_RESULT(no)
- ])
-])
diff --git a/config/kernel-spinlock.m4 b/config/kernel-spinlock.m4
index 136262d0e..d6d664007 100644
--- a/config/kernel-spinlock.m4
+++ b/config/kernel-spinlock.m4
@@ -3,11 +3,11 @@ dnl # 2.6.36 API change,
dnl # The 'struct fs_struct->lock' was changed from a rwlock_t to
dnl # a spinlock_t to improve the fastpath performance.
dnl #
-AC_DEFUN([SPL_AC_FS_STRUCT_SPINLOCK], [
+AC_DEFUN([ZFS_AC_KERNEL_FS_STRUCT_SPINLOCK], [
AC_MSG_CHECKING([whether struct fs_struct uses spinlock_t])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/sched.h>
#include <linux/fs_struct.h>
],[
diff --git a/config/kernel-timer.m4 b/config/kernel-timer.m4
index 93b5158b9..4dc3f84ed 100644
--- a/config/kernel-timer.m4
+++ b/config/kernel-timer.m4
@@ -6,11 +6,11 @@ dnl # (older kernels). Also sanity check the from_timer() and timer_setup()
dnl # macros are available as well, since they will be used in the same newer
dnl # kernels that support the new timer_list.func signature.
dnl #
-AC_DEFUN([SPL_AC_KERNEL_TIMER_FUNCTION_TIMER_LIST], [
+AC_DEFUN([ZFS_AC_KERNEL_TIMER_FUNCTION_TIMER_LIST], [
AC_MSG_CHECKING([whether timer_list.function gets a timer_list])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/timer.h>
void task_expire(struct timer_list *tl) {}
],[
diff --git a/config/kernel-trim-unused-symbols.m4 b/config/kernel-trim-unused-symbols.m4
deleted file mode 100644
index d1ac2f3c8..000000000
--- a/config/kernel-trim-unused-symbols.m4
+++ /dev/null
@@ -1,19 +0,0 @@
-dnl #
-dnl # config trim unused symbols,
-dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS DISABLED.
-dnl #
-AC_DEFUN([SPL_AC_CONFIG_TRIM_UNUSED_KSYMS], [
- AC_MSG_CHECKING([whether CONFIG_TRIM_UNUSED_KSYM is disabled])
- SPL_LINUX_TRY_COMPILE([
- #if defined(CONFIG_TRIM_UNUSED_KSYMS)
- #error CONFIG_TRIM_UNUSED_KSYMS not defined
- #endif
- ],[ ],[
- AC_MSG_RESULT([yes])
- ],[
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([
- *** This kernel has unused symbols trimming enabled, please disable.
- *** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.])
- ])
-])
diff --git a/config/kernel-urange-sleep.m4 b/config/kernel-urange-sleep.m4
index 85beca6dd..b5764de3e 100644
--- a/config/kernel-urange-sleep.m4
+++ b/config/kernel-urange-sleep.m4
@@ -5,9 +5,9 @@ dnl # usleep_range is a finer precision implementation of msleep
dnl # designed to be a drop-in replacement for udelay where a precise
dnl # sleep / busy-wait is unnecessary.
dnl #
-AC_DEFUN([SPL_AC_USLEEP_RANGE], [
+AC_DEFUN([ZFS_AC_KERNEL_USLEEP_RANGE], [
AC_MSG_CHECKING([whether usleep_range() is available])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/delay.h>
],[
usleep_range(0, 0);
diff --git a/config/kernel-vfs-fsync.m4 b/config/kernel-vfs-fsync.m4
index 3c42bf1a0..a474f9f17 100644
--- a/config/kernel-vfs-fsync.m4
+++ b/config/kernel-vfs-fsync.m4
@@ -2,9 +2,9 @@ dnl #
dnl # 2.6.35 API change,
dnl # Unused 'struct dentry *' removed from vfs_fsync() prototype.
dnl #
-AC_DEFUN([SPL_AC_2ARGS_VFS_FSYNC], [
+AC_DEFUN([ZFS_AC_KERNEL_2ARGS_VFS_FSYNC], [
AC_MSG_CHECKING([whether vfs_fsync() wants 2 args])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
vfs_fsync(NULL, 0);
diff --git a/config/kernel-vfs-getattr.m4 b/config/kernel-vfs-getattr.m4
index 7772cb514..b13723538 100644
--- a/config/kernel-vfs-getattr.m4
+++ b/config/kernel-vfs-getattr.m4
@@ -2,9 +2,9 @@ dnl #
dnl # 4.11 API, a528d35e@torvalds/linux
dnl # vfs_getattr(const struct path *p, struct kstat *s, u32 m, unsigned int f)
dnl #
-AC_DEFUN([SPL_AC_4ARGS_VFS_GETATTR], [
+AC_DEFUN([ZFS_AC_KERNEL_4ARGS_VFS_GETATTR], [
AC_MSG_CHECKING([whether vfs_getattr() wants 4 args])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
vfs_getattr((const struct path *)NULL,
@@ -24,9 +24,9 @@ dnl #
dnl # 3.9 API
dnl # vfs_getattr(struct path *p, struct kstat *s)
dnl #
-AC_DEFUN([SPL_AC_2ARGS_VFS_GETATTR], [
+AC_DEFUN([ZFS_AC_KERNEL_2ARGS_VFS_GETATTR], [
AC_MSG_CHECKING([whether vfs_getattr() wants 2 args])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
vfs_getattr((struct path *) NULL,
@@ -44,9 +44,9 @@ dnl #
dnl # <3.9 API
dnl # vfs_getattr(struct vfsmount *v, struct dentry *d, struct kstat *k)
dnl #
-AC_DEFUN([SPL_AC_3ARGS_VFS_GETATTR], [
+AC_DEFUN([ZFS_AC_KERNEL_3ARGS_VFS_GETATTR], [
AC_MSG_CHECKING([whether vfs_getattr() wants 3 args])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
vfs_getattr((struct vfsmount *)NULL,
diff --git a/config/kernel-wait.m4 b/config/kernel-wait.m4
index 5f718a160..d6442c1df 100644
--- a/config/kernel-wait.m4
+++ b/config/kernel-wait.m4
@@ -8,9 +8,9 @@ dnl # of just two functions: one which uses io_schedule() and one which just
dnl # uses schedule(). This API change was made to consolidate all of those
dnl # redundant wait functions.
dnl #
-AC_DEFUN([SPL_AC_WAIT_ON_BIT], [
+AC_DEFUN([ZFS_AC_KERNEL_WAIT_ON_BIT], [
AC_MSG_CHECKING([whether wait_on_bit() takes an action])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/wait.h>
],[
int (*action)(void *) = NULL;
@@ -26,9 +26,9 @@ dnl #
dnl # 4.13 API change
dnl # Renamed struct wait_queue -> struct wait_queue_entry.
dnl #
-AC_DEFUN([SPL_AC_WAIT_QUEUE_ENTRY_T], [
+AC_DEFUN([ZFS_AC_KERNEL_WAIT_QUEUE_ENTRY_T], [
AC_MSG_CHECKING([whether wait_queue_entry_t exists])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/wait.h>
],[
wait_queue_entry_t *entry __attribute__ ((unused));
@@ -46,9 +46,9 @@ dnl # 4.13 API change
dnl # Renamed wait_queue_head::task_list -> wait_queue_head::head
dnl # Renamed wait_queue_entry::task_list -> wait_queue_entry::entry
dnl #
-AC_DEFUN([SPL_AC_WAIT_QUEUE_HEAD_ENTRY], [
+AC_DEFUN([ZFS_AC_KERNEL_WAIT_QUEUE_HEAD_ENTRY], [
AC_MSG_CHECKING([whether wq_head->head and wq_entry->entry exist])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/wait.h>
#ifdef HAVE_WAIT_QUEUE_ENTRY_T
diff --git a/config/kernel-zlib.m4 b/config/kernel-zlib.m4
index bb236466a..3ca7cf682 100644
--- a/config/kernel-zlib.m4
+++ b/config/kernel-zlib.m4
@@ -2,9 +2,9 @@ dnl #
dnl # zlib inflate compat,
dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
dnl #
-AC_DEFUN([SPL_AC_CONFIG_ZLIB_INFLATE], [
+AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE], [
AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#if !defined(CONFIG_ZLIB_INFLATE) && \
!defined(CONFIG_ZLIB_INFLATE_MODULE)
#error CONFIG_ZLIB_INFLATE not defined
@@ -23,9 +23,9 @@ dnl #
dnl # zlib deflate compat,
dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled.
dnl #
-AC_DEFUN([SPL_AC_CONFIG_ZLIB_DEFLATE], [
+AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE], [
AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#if !defined(CONFIG_ZLIB_DEFLATE) && \
!defined(CONFIG_ZLIB_DEFLATE_MODULE)
#error CONFIG_ZLIB_DEFLATE not defined
@@ -47,9 +47,9 @@ dnl # This was done to avoid always having to allocate the maximum size
dnl # workspace (268K). The caller can now specific the windowBits and
dnl # memLevel compression parameters to get a smaller workspace.
dnl #
-AC_DEFUN([SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE],
+AC_DEFUN([ZFS_AC_KERNEL_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE],
[AC_MSG_CHECKING([whether zlib_deflate_workspacesize() wants 2 args])
- SPL_LINUX_TRY_COMPILE([
+ ZFS_LINUX_TRY_COMPILE([
#include <linux/zlib.h>
],[
return zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL);
diff --git a/config/kernel.m4 b/config/kernel.m4
index e3daeffa8..8151cdc22 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -3,12 +3,39 @@ 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_MISC_MINOR
ZFS_AC_KERNEL_OBJTOOL
ZFS_AC_KERNEL_CONFIG
+ ZFS_AC_KERNEL_CTL_NAME
+ ZFS_AC_KERNEL_PDE_DATA
+ ZFS_AC_KERNEL_SET_FS_PWD_WITH_CONST
+ ZFS_AC_KERNEL_2ARGS_VFS_FSYNC
+ ZFS_AC_KERNEL_FS_STRUCT_SPINLOCK
+ ZFS_AC_KERNEL_KUIDGID_T
+ ZFS_AC_KERNEL_FALLOCATE
+ ZFS_AC_KERNEL_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
+ ZFS_AC_KERNEL_RWSEM_SPINLOCK_IS_RAW
+ ZFS_AC_KERNEL_RWSEM_ACTIVITY
+ ZFS_AC_KERNEL_RWSEM_ATOMIC_LONG_COUNT
+ ZFS_AC_KERNEL_SCHED_RT_HEADER
+ ZFS_AC_KERNEL_SCHED_SIGNAL_HEADER
+ ZFS_AC_KERNEL_IO_SCHEDULE_TIMEOUT
+ ZFS_AC_KERNEL_4ARGS_VFS_GETATTR
+ ZFS_AC_KERNEL_3ARGS_VFS_GETATTR
+ ZFS_AC_KERNEL_2ARGS_VFS_GETATTR
+ ZFS_AC_KERNEL_USLEEP_RANGE
+ ZFS_AC_KERNEL_KMEM_CACHE_ALLOCFLAGS
+ ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY
+ ZFS_AC_KERNEL_WAIT_ON_BIT
+ ZFS_AC_KERNEL_WAIT_QUEUE_ENTRY_T
+ ZFS_AC_KERNEL_WAIT_QUEUE_HEAD_ENTRY
+ ZFS_AC_KERNEL_INODE_LOCK
+ ZFS_AC_KERNEL_GROUP_INFO_GID
+ ZFS_AC_KERNEL_WRITE
+ ZFS_AC_KERNEL_READ
+ ZFS_AC_KERNEL_TIMER_FUNCTION_TIMER_LIST
ZFS_AC_KERNEL_DECLARE_EVENT_CLASS
ZFS_AC_KERNEL_CURRENT_BIO_TAIL
ZFS_AC_KERNEL_SUPER_USER_NS
@@ -106,6 +133,8 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_FST_MOUNT
ZFS_AC_KERNEL_SHRINK
ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID
+ ZFS_AC_KERNEL_SHRINK_CONTROL_STRUCT
+ ZFS_AC_KERNEL_SHRINKER_CALLBACK
ZFS_AC_KERNEL_S_INSTANCES_LIST_HEAD
ZFS_AC_KERNEL_S_D_OP
ZFS_AC_KERNEL_BDI
@@ -275,204 +304,6 @@ AC_DEFUN([ZFS_AC_KERNEL], [
ZFS_AC_MODULE_SYMVERS
])
-
-dnl #
-dnl # Detect the SPL module to be built against
-dnl #
-AC_DEFUN([ZFS_AC_SPL], [
- AC_ARG_WITH([spl],
- AS_HELP_STRING([--with-spl=PATH],
- [Path to spl source]),
- 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],
- [Path to spl build objects]),
- [splbuild="$withval"])
-
- AC_ARG_WITH([spl-timeout],
- AS_HELP_STRING([--with-spl-timeout=SECS],
- [Wait SECS for SPL header and symver file @<:@default=0@:>@]),
- [timeout="$withval"], [timeout=0])
-
- dnl #
- dnl # The existence of spl.release.in is used to identify a valid
- dnl # source directory. In order of preference:
- dnl #
- splsrc0="/var/lib/dkms/spl/${VERSION}/build"
- splsrc1="/usr/local/src/spl-${VERSION}/${LINUX_VERSION}"
- splsrc2="/usr/local/src/spl-${VERSION}"
- splsrc3="/usr/src/spl-${VERSION}/${LINUX_VERSION}"
- splsrc4="/usr/src/spl-${VERSION}"
- splsrc5="../spl/"
- splsrc6="$LINUX"
-
- 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"], [
- splsrc=${splsrc1}
- ], [ test -e "${splsrc2}/spl.release.in"], [
- splsrc=${splsrc2}
- ], [ test -e "${splsrc3}/spl.release.in"], [
- splsrc=$(readlink -f "${splsrc3}")
- ], [ test -e "${splsrc4}/spl.release.in" ], [
- splsrc=${splsrc4}
- ], [ test -e "${splsrc5}/spl.release.in"], [
- splsrc=$(readlink -f "${splsrc5}")
- ], [ test -e "${splsrc6}/spl.release.in" ], [
- splsrc=${splsrc6}
- ], [
- splsrc="[Not found]"
- ])
- ], [
- [all_spl_sources="$withval"],
- AS_IF([test "$splsrc" = "NONE"], [
- splbuild=NONE
- splsrcver=NONE
- ])
- ])
-
- AC_MSG_RESULT([$splsrc])
- AS_IF([ test ! -e "$splsrc/spl.release.in"], [
- 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.
- *** 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 #
- dnl # The existence of the spl_config.h is used to identify a valid
- dnl # spl object directory. In many cases the object and source
- dnl # directory are the same, however the objects may also reside
- dnl # is a subdirectory named after the kernel version.
- dnl #
- dnl # This file is supposed to be available after DKMS finishes
- dnl # building the SPL kernel module for the target kernel. The
- dnl # '--with-spl-timeout' option can be passed to pause here,
- dnl # waiting for the file to appear from a concurrently building
- 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" ], [
- splbuild="${splsrc}/${LINUX_VERSION}"
- ], [ test -e "${splsrc}/spl_config.h" ], [
- splbuild="${splsrc}"
- ], [ find -L "${splsrc}" -name spl_config.h 2> /dev/null | grep -wq spl_config.h ], [
- splbuild=$(find -L "${splsrc}" -name spl_config.h | sed 's,/spl_config.h,,')
- ], [
- splbuild="[Not found]"
- ])
- ])
- AS_IF([test -e "$splbuild/spl_config.h" -o $timeout -le 0], [
- break;
- ], [
- sleep 1
- timeout=$((timeout-1))
- ])
- done
-
- AC_MSG_RESULT([$splbuild])
- AS_IF([ ! test -e "$splbuild/spl_config.h"], [
- AC_MSG_ERROR([
- *** 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. Failed to find spl_config.h in
- *** any of the following:
- $all_spl_config_locs])
- ])
-
- AC_MSG_CHECKING([spl source version])
- AS_IF([test -r $splbuild/spl_config.h &&
- fgrep -q SPL_META_VERSION $splbuild/spl_config.h], [
-
- splsrcver=`(echo "#include <spl_config.h>";
- echo "splsrcver=SPL_META_VERSION-SPL_META_RELEASE") |
- cpp -I $splbuild |
- grep "^splsrcver=" | tr -d \" | cut -d= -f2`
- ])
-
- AS_IF([test -z "$splsrcver"], [
- AC_MSG_RESULT([Not found])
- AC_MSG_ERROR([
- *** Cannot determine the version of the spl source.
- *** Please prepare the spl source before running this script])
- ])
-
- AC_MSG_RESULT([$splsrcver])
-
- SPL=${splsrc}
- SPL_OBJ=${splbuild}
- SPL_VERSION=${splsrcver}
-
- AC_SUBST(SPL)
- AC_SUBST(SPL_OBJ)
- AC_SUBST(SPL_VERSION)
-
- dnl #
- dnl # Detect the name used for the SPL Module.symvers file. If one
- dnl # does not exist this is likely because the SPL has been configured
- dnl # but not built. The '--with-spl-timeout' option can be passed
- dnl # to pause here, waiting for the file to appear from a concurrently
- dnl # building SPL package. If the file does not appear in time, a good
- dnl # guess is made as to what this file will be named based on what it
- dnl # is named in the kernel build products. This file will first be
- dnl # used at link time so if the guess is wrong the build will fail
- dnl # then. This unfortunately means the ZFS package does not contain a
- dnl # reliable mechanism to detect symbols exported by the SPL at
- dnl # configure time.
- dnl #
- AC_MSG_CHECKING([spl file name for module symbols])
- SPL_SYMBOLS=NONE
-
- while true; do
- AS_IF([test -r $SPL_OBJ/Module.symvers], [
- SPL_SYMBOLS=Module.symvers
- ], [test -r $SPL_OBJ/Modules.symvers], [
- SPL_SYMBOLS=Modules.symvers
- ], [test -r $SPL_OBJ/module/Module.symvers], [
- SPL_SYMBOLS=Module.symvers
- ], [test -r $SPL_OBJ/module/Modules.symvers], [
- SPL_SYMBOLS=Modules.symvers
- ])
-
- AS_IF([test $SPL_SYMBOLS != NONE -o $timeout -le 0], [
- break;
- ], [
- sleep 1
- timeout=$((timeout-1))
- ])
- done
-
- AS_IF([test "$SPL_SYMBOLS" = NONE], [
- SPL_SYMBOLS=$LINUX_SYMBOLS
- ])
-
- AC_MSG_RESULT([$SPL_SYMBOLS])
- AC_SUBST(SPL_SYMBOLS)
-])
-
dnl #
dnl # Detect the QAT module to be built against
dnl # QAT provides hardware acceleration for data compression:
@@ -603,6 +434,9 @@ AC_DEFUN([ZFS_AC_KERNEL_CONFIG], [
ZFS_AC_KERNEL_CONFIG_THREAD_SIZE
ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC
+ ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS
+ ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE
+ ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE
])
dnl #
@@ -673,6 +507,27 @@ AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [
])
dnl #
+dnl # Check CONFIG_TRIM_UNUSED_KSYMS
+dnl #
+dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS disabled.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS], [
+ AC_MSG_CHECKING([whether CONFIG_TRIM_UNUSED_KSYM is disabled])
+ ZFS_LINUX_TRY_COMPILE([
+ #if defined(CONFIG_TRIM_UNUSED_KSYMS)
+ #error CONFIG_TRIM_UNUSED_KSYMS not defined
+ #endif
+ ],[ ],[
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([
+ *** This kernel has unused symbols trimming enabled, please disable.
+ *** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.])
+ ])
+])
+
+dnl #
dnl # ZFS_LINUX_CONFTEST_H
dnl #
AC_DEFUN([ZFS_LINUX_CONFTEST_H], [
diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
index 49a4096d6..1d47b0384 100644
--- a/config/zfs-build.m4
+++ b/config/zfs-build.m4
@@ -95,6 +95,63 @@ AC_DEFUN([ZFS_AC_DEBUGINFO], [
AC_MSG_RESULT([$enable_debuginfo])
])
+dnl #
+dnl # Disabled by default, provides basic memory tracking. Track the total
+dnl # number of bytes allocated with kmem_alloc() and freed with kmem_free().
+dnl # Then at module unload time if any bytes were leaked it will be reported
+dnl # on the console.
+dnl #
+AC_DEFUN([ZFS_AC_DEBUG_KMEM], [
+ AC_MSG_CHECKING([whether basic kmem accounting is enabled])
+ AC_ARG_ENABLE([debug-kmem],
+ [AS_HELP_STRING([--enable-debug-kmem],
+ [Enable basic kmem accounting @<:@default=no@:>@])],
+ [],
+ [enable_debug_kmem=no])
+
+ AS_IF([test "x$enable_debug_kmem" = xyes], [
+ KERNEL_DEBUG_CPPFLAGS+=" -DDEBUG_KMEM"
+ DEBUG_KMEM_ZFS="_with_debug_kmem"
+ ], [
+ DEBUG_KMEM_ZFS="_without_debug_kmem"
+ ])
+
+ AC_SUBST(KERNEL_DEBUG_CPPFLAGS)
+ AC_SUBST(DEBUG_KMEM_ZFS)
+
+ AC_MSG_RESULT([$enable_debug_kmem])
+])
+
+dnl #
+dnl # Disabled by default, provides detailed memory tracking. This feature
+dnl # also requires --enable-debug-kmem to be set. When enabled not only will
+dnl # total bytes be tracked but also the location of every kmem_alloc() and
+dnl # kmem_free(). When the module is unloaded a list of all leaked addresses
+dnl # and where they were allocated will be dumped to the console. Enabling
+dnl # this feature has a significant impact on performance but it makes finding
+dnl # memory leaks straight forward.
+dnl #
+AC_DEFUN([ZFS_AC_DEBUG_KMEM_TRACKING], [
+ AC_MSG_CHECKING([whether detailed kmem tracking is enabled])
+ AC_ARG_ENABLE([debug-kmem-tracking],
+ [AS_HELP_STRING([--enable-debug-kmem-tracking],
+ [Enable detailed kmem tracking @<:@default=no@:>@])],
+ [],
+ [enable_debug_kmem_tracking=no])
+
+ AS_IF([test "x$enable_debug_kmem_tracking" = xyes], [
+ KERNEL_DEBUG_CPPFLAGS+=" -DDEBUG_KMEM_TRACKING"
+ DEBUG_KMEM_TRACKING_ZFS="_with_debug_kmem_tracking"
+ ], [
+ DEBUG_KMEM_TRACKING_ZFS="_without_debug_kmem_tracking"
+ ])
+
+ AC_SUBST(KERNEL_DEBUG_CPPFLAGS)
+ AC_SUBST(DEBUG_KMEM_TRACKING_ZFS)
+
+ AC_MSG_RESULT([$enable_debug_kmem_tracking])
+])
+
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
ZFS_AC_CONFIG_ALWAYS_CC_NO_UNUSED_BUT_SET_VARIABLE
ZFS_AC_CONFIG_ALWAYS_CC_NO_BOOL_COMPARE
@@ -183,10 +240,11 @@ AC_DEFUN([ZFS_AC_RPM], [
])
RPM_DEFINE_COMMON='--define "$(DEBUG_ZFS) 1"'
+ RPM_DEFINE_COMMON+=' --define "$(DEBUG_KMEM_ZFS) 1"'
+ RPM_DEFINE_COMMON+=' --define "$(DEBUG_KMEM_TRACKING_ZFS) 1"'
RPM_DEFINE_COMMON+=' --define "$(DEBUGINFO_ZFS) 1"'
RPM_DEFINE_COMMON+=' --define "$(ASAN_ZFS) 1"'
-
RPM_DEFINE_UTIL=' --define "_initconfdir $(DEFAULT_INITCONF_DIR)"'
dnl # Make the next three RPM_DEFINE_UTIL additions conditional, since
@@ -221,8 +279,6 @@ AC_DEFUN([ZFS_AC_RPM], [
])
RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)"'
- RPM_DEFINE_KMOD+=' --define "require_spldir $(SPL)"'
- RPM_DEFINE_KMOD+=' --define "require_splobj $(SPL_OBJ)"'
RPM_DEFINE_KMOD+=' --define "ksrc $(LINUX)"'
RPM_DEFINE_KMOD+=' --define "kobj $(LINUX_OBJ)"'
RPM_DEFINE_KMOD+=' --define "_wrong_version_format_terminate_build 0"'
diff --git a/config/zfs-meta.m4 b/config/zfs-meta.m4
index 3e1429d99..aa0fc1420 100644
--- a/config/zfs-meta.m4
+++ b/config/zfs-meta.m4
@@ -60,9 +60,12 @@ AC_DEFUN([ZFS_AC_META], [
ZFS_META_VERSION=_ZFS_AC_META_GETVAL([Version]);
if test -n "$ZFS_META_VERSION"; then
- AC_DEFINE_UNQUOTED([ZFS_META_VERSION], ["$ZFS_META_VERSION"],
- [Define the project version.]
- )
+ AC_DEFINE_UNQUOTED([ZFS_META_VERSION],
+ ["$ZFS_META_VERSION"],
+ [Define the project version.])
+ AC_DEFINE_UNQUOTED([SPL_META_VERSION],
+ [ZFS_META_VERSION],
+ [Defined for legacy compatibility.])
AC_SUBST([ZFS_META_VERSION])
fi
@@ -86,9 +89,12 @@ AC_DEFUN([ZFS_AC_META], [
fi
if test -n "$ZFS_META_RELEASE"; then
- AC_DEFINE_UNQUOTED([ZFS_META_RELEASE], ["$ZFS_META_RELEASE"],
- [Define the project release.]
- )
+ AC_DEFINE_UNQUOTED([ZFS_META_RELEASE],
+ ["$ZFS_META_RELEASE"],
+ [Define the project release.])
+ AC_DEFINE_UNQUOTED([SPL_META_RELEASE],
+ [ZFS_META_RELEASE],
+ [Defined for legacy compatibility.])
AC_SUBST([ZFS_META_RELEASE])
RELEASE="$ZFS_META_RELEASE"
@@ -108,9 +114,11 @@ AC_DEFUN([ZFS_AC_META], [
test -n "$ZFS_META_RELEASE" &&
ZFS_META_ALIAS="$ZFS_META_ALIAS-$ZFS_META_RELEASE"
AC_DEFINE_UNQUOTED([ZFS_META_ALIAS],
- ["$ZFS_META_ALIAS"],
- [Define the project alias string.]
- )
+ ["$ZFS_META_ALIAS"],
+ [Define the project alias string.])
+ AC_DEFINE_UNQUOTED([SPL_META_ALIAS],
+ [ZFS_META_ALIAS],
+ [Defined for legacy compatibility.])
AC_SUBST([ZFS_META_ALIAS])
fi