aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/Makefile.in23
-rw-r--r--module/avl/avl.c4
-rw-r--r--module/icp/algs/edonr/edonr.c7
-rw-r--r--module/icp/algs/edonr/edonr_byteorder.h2
-rw-r--r--module/icp/algs/skein/skein.c2
-rw-r--r--module/icp/algs/skein/skein_impl.h9
-rw-r--r--module/icp/algs/skein/skein_port.h1
-rw-r--r--module/icp/api/kcf_cipher.c2
-rw-r--r--module/icp/api/kcf_ctxops.c2
-rw-r--r--module/icp/api/kcf_digest.c2
-rw-r--r--module/icp/api/kcf_mac.c2
-rw-r--r--module/icp/api/kcf_miscapi.c2
-rw-r--r--module/icp/illumos-crypto.c2
-rw-r--r--module/icp/io/edonr_mod.c1
-rw-r--r--module/icp/io/skein_mod.c1
-rw-r--r--module/lua/lapi.c2
-rw-r--r--module/lua/lauxlib.c2
-rw-r--r--module/lua/lbaselib.c2
-rw-r--r--module/lua/lcorolib.c2
-rw-r--r--module/lua/lstrlib.c2
-rw-r--r--module/lua/ltablib.c2
-rw-r--r--module/nvpair/fnvpair.c2
-rw-r--r--module/nvpair/nvpair.c19
-rw-r--r--module/nvpair/nvpair_alloc_fixed.c11
-rw-r--r--module/spl/Makefile.in28
-rw-r--r--module/spl/README.md16
-rw-r--r--module/spl/spl-condvar.c7
-rw-r--r--module/spl/spl-err.c13
-rw-r--r--module/spl/spl-generic.c17
-rw-r--r--module/spl/spl-kmem.c20
-rw-r--r--module/spl/spl-rwlock.c1
-rw-r--r--module/spl/spl-taskq.c3
-rw-r--r--module/spl/spl-vnode.c4
-rw-r--r--module/spl/spl-xdr.c2
-rw-r--r--module/unicode/u8_textprep.c9
-rw-r--r--module/unicode/uconv.c3
-rw-r--r--module/zcommon/zfeature_common.c6
-rw-r--r--module/zcommon/zfs_comutil.c7
-rw-r--r--module/zcommon/zfs_deleg.c5
-rw-r--r--module/zcommon/zfs_fletcher.c2
-rw-r--r--module/zcommon/zfs_fletcher_aarch64_neon.c2
-rw-r--r--module/zcommon/zfs_fletcher_avx512.c2
-rw-r--r--module/zcommon/zfs_fletcher_intel.c2
-rw-r--r--module/zcommon/zfs_fletcher_sse.c2
-rw-r--r--module/zcommon/zfs_fletcher_superscalar.c2
-rw-r--r--module/zcommon/zfs_fletcher_superscalar4.c2
-rw-r--r--module/zcommon/zfs_namecheck.c6
-rw-r--r--module/zcommon/zfs_prop.c6
-rw-r--r--module/zcommon/zfs_uio.c2
-rw-r--r--module/zcommon/zpool_prop.c6
-rw-r--r--module/zcommon/zprop_common.c7
-rw-r--r--module/zfs/abd.c2
-rw-r--r--module/zfs/arc.c10
-rw-r--r--module/zfs/dbuf.c6
-rw-r--r--module/zfs/dbuf_stats.c2
-rw-r--r--module/zfs/ddt.c2
-rw-r--r--module/zfs/ddt_zap.c1
-rw-r--r--module/zfs/dmu.c2
-rw-r--r--module/zfs/dmu_object.c2
-rw-r--r--module/zfs/dmu_objset.c2
-rw-r--r--module/zfs/dmu_traverse.c2
-rw-r--r--module/zfs/dmu_tx.c3
-rw-r--r--module/zfs/dmu_zfetch.c2
-rw-r--r--module/zfs/dsl_dataset.c2
-rw-r--r--module/zfs/dsl_deleg.c2
-rw-r--r--module/zfs/dsl_destroy.c2
-rw-r--r--module/zfs/dsl_dir.c2
-rw-r--r--module/zfs/dsl_pool.c2
-rw-r--r--module/zfs/dsl_prop.c2
-rw-r--r--module/zfs/dsl_scan.c2
-rw-r--r--module/zfs/dsl_synctask.c2
-rw-r--r--module/zfs/fm.c5
-rw-r--r--module/zfs/gzip.c5
-rw-r--r--module/zfs/metaslab.c4
-rw-r--r--module/zfs/mmp.c2
-rw-r--r--module/zfs/multilist.c2
-rw-r--r--module/zfs/pathname.c2
-rw-r--r--module/zfs/sa.c1
-rw-r--r--module/zfs/spa.c10
-rw-r--r--module/zfs/spa_config.c2
-rw-r--r--module/zfs/spa_errlog.c2
-rw-r--r--module/zfs/spa_history.c6
-rw-r--r--module/zfs/spa_misc.c2
-rw-r--r--module/zfs/spa_stats.c2
-rw-r--r--module/zfs/txg.c2
-rw-r--r--module/zfs/vdev.c2
-rw-r--r--module/zfs/vdev_cache.c2
-rw-r--r--module/zfs/vdev_disk.c1
-rw-r--r--module/zfs/vdev_indirect.c2
-rw-r--r--module/zfs/vdev_indirect_births.c2
-rw-r--r--module/zfs/vdev_indirect_mapping.c2
-rw-r--r--module/zfs/vdev_mirror.c2
-rw-r--r--module/zfs/vdev_queue.c2
-rw-r--r--module/zfs/vdev_raidz_math.c2
-rw-r--r--module/zfs/vdev_removal.c2
-rw-r--r--module/zfs/zap_micro.c2
-rw-r--r--module/zfs/zcp.c1
-rw-r--r--module/zfs/zfs_acl.c6
-rw-r--r--module/zfs/zfs_byteswap.c2
-rw-r--r--module/zfs/zfs_ctldir.c3
-rw-r--r--module/zfs/zfs_dir.c6
-rw-r--r--module/zfs/zfs_fm.c2
-rw-r--r--module/zfs/zfs_fuid.c1
-rw-r--r--module/zfs/zfs_ioctl.c13
-rw-r--r--module/zfs/zfs_log.c4
-rw-r--r--module/zfs/zfs_onexit.c4
-rw-r--r--module/zfs/zfs_replay.c1
-rw-r--r--module/zfs/zfs_rlock.c1
-rw-r--r--module/zfs/zfs_vfsops.c12
-rw-r--r--module/zfs/zfs_vnops.c13
-rw-r--r--module/zfs/zfs_znode.c10
-rw-r--r--module/zfs/zil.c3
-rw-r--r--module/zfs/zio.c2
-rw-r--r--module/zfs/zio_compress.c1
-rw-r--r--module/zfs/zio_crypt.c2
-rw-r--r--module/zfs/zio_inject.c2
-rw-r--r--module/zfs/zpl_file.c1
-rw-r--r--module/zfs/zpl_xattr.c2
-rw-r--r--module/zfs/zrlock.c2
119 files changed, 193 insertions, 309 deletions
diff --git a/module/Makefile.in b/module/Makefile.in
index 4cd6988bb..82d155dd3 100644
--- a/module/Makefile.in
+++ b/module/Makefile.in
@@ -2,6 +2,7 @@ subdir-m += avl
subdir-m += icp
subdir-m += lua
subdir-m += nvpair
+subdir-m += spl
subdir-m += unicode
subdir-m += zcommon
subdir-m += zfs
@@ -10,11 +11,11 @@ INSTALL_MOD_DIR ?= extra
ZFS_MODULE_CFLAGS += -std=gnu99 -Wno-declaration-after-statement
ZFS_MODULE_CFLAGS += @KERNEL_DEBUG_CFLAGS@
-ZFS_MODULE_CFLAGS += -include @SPL_OBJ@/spl_config.h
ZFS_MODULE_CFLAGS += -include @abs_top_builddir@/zfs_config.h
-ZFS_MODULE_CFLAGS += -I@abs_top_srcdir@/include -I@SPL@/include -I@SPL@
+ZFS_MODULE_CFLAGS += -I@abs_top_srcdir@/include/spl
+ZFS_MODULE_CFLAGS += -I@abs_top_srcdir@/include
-ZFS_MODULE_CPPFLAGS += -DHAVE_SPL -D_KERNEL
+ZFS_MODULE_CPPFLAGS += -D_KERNEL
ZFS_MODULE_CPPFLAGS += @KERNEL_DEBUG_CPPFLAGS@
@CONFIG_QAT_TRUE@ZFS_MODULE_CFLAGS += -I@QAT_SRC@/include
@@ -25,21 +26,6 @@ export ZFS_MODULE_CFLAGS ZFS_MODULE_CPPFLAGS
SUBDIR_TARGETS = icp lua
modules:
- @# Make the exported SPL symbols available to these modules.
- @# They may be in the root of SPL_OBJ when building against
- @# installed devel headers, or they may be in the module
- @# subdirectory when building against the spl source tree.
- @if [ -f @SPL_OBJ@/@SPL_SYMBOLS@ ]; then \
- cp @SPL_OBJ@/@SPL_SYMBOLS@ .; \
- elif [ -f @SPL_OBJ@/module/@SPL_SYMBOLS@ ]; then \
- cp @SPL_OBJ@/module/@SPL_SYMBOLS@ .; \
- else \
- echo -e "\n" \
- "*** Missing spl symbols ensure you have built the spl:\n" \
- "*** - @SPL_OBJ@/@SPL_SYMBOLS@, or\n" \
- "*** - @SPL_OBJ@/module/@SPL_SYMBOLS@\n"; \
- exit 1; \
- fi
list='$(SUBDIR_TARGETS)'; for targetdir in $$list; do \
$(MAKE) -C $$targetdir; \
done
@@ -50,7 +36,6 @@ clean:
@# is defined. This indicates that kernel modules should be built.
@CONFIG_KERNEL_TRUE@ $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNEL_MAKE@ $@
- if [ -f @SPL_SYMBOLS@ ]; then $(RM) @SPL_SYMBOLS@; fi
if [ -f @LINUX_SYMBOLS@ ]; then $(RM) @LINUX_SYMBOLS@; fi
if [ -f Module.markers ]; then $(RM) Module.markers; fi
diff --git a/module/avl/avl.c b/module/avl/avl.c
index f024cdf61..736dcee84 100644
--- a/module/avl/avl.c
+++ b/module/avl/avl.c
@@ -992,7 +992,9 @@ done:
return (AVL_NODE2DATA(node, off));
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
+#include <linux/module.h>
+
static int __init
avl_init(void)
{
diff --git a/module/icp/algs/edonr/edonr.c b/module/icp/algs/edonr/edonr.c
index 8ae989890..7c677095f 100644
--- a/module/icp/algs/edonr/edonr.c
+++ b/module/icp/algs/edonr/edonr.c
@@ -29,12 +29,7 @@
* Portions copyright (c) 2013, Saso Kiselkov, All rights reserved
*/
-/* determine where we can get bcopy/bzero declarations */
-#ifdef _KERNEL
-#include <sys/systm.h>
-#else
-#include <strings.h>
-#endif
+#include <sys/strings.h>
#include <sys/edonr.h>
#include <sys/debug.h>
diff --git a/module/icp/algs/edonr/edonr_byteorder.h b/module/icp/algs/edonr/edonr_byteorder.h
index d17e8f1fd..532dfd743 100644
--- a/module/icp/algs/edonr/edonr_byteorder.h
+++ b/module/icp/algs/edonr/edonr_byteorder.h
@@ -34,7 +34,7 @@
#ifndef _CRYPTO_EDONR_BYTEORDER_H
#define _CRYPTO_EDONR_BYTEORDER_H
-
+#include <sys/sysmacros.h>
#include <sys/param.h>
#if defined(__BYTE_ORDER)
diff --git a/module/icp/algs/skein/skein.c b/module/icp/algs/skein/skein.c
index 0981eee08..0187f7be6 100644
--- a/module/icp/algs/skein/skein.c
+++ b/module/icp/algs/skein/skein.c
@@ -7,8 +7,8 @@
#define SKEIN_PORT_CODE /* instantiate any code in skein_port.h */
+#include <sys/sysmacros.h>
#include <sys/types.h>
-#include <sys/note.h>
#include <sys/skein.h> /* get the Skein API definitions */
#include "skein_impl.h" /* get internal definitions */
diff --git a/module/icp/algs/skein/skein_impl.h b/module/icp/algs/skein/skein_impl.h
index e83a06971..ea834e619 100644
--- a/module/icp/algs/skein/skein_impl.h
+++ b/module/icp/algs/skein/skein_impl.h
@@ -25,16 +25,11 @@
#define _SKEIN_IMPL_H_
#include <sys/skein.h>
+#include <sys/strings.h>
+#include <sys/note.h>
#include "skein_impl.h"
#include "skein_port.h"
-/* determine where we can get bcopy/bzero declarations */
-#ifdef _KERNEL
-#include <sys/systm.h>
-#else
-#include <strings.h>
-#endif
-
/*
* "Internal" Skein definitions
* -- not needed for sequential hashing API, but will be
diff --git a/module/icp/algs/skein/skein_port.h b/module/icp/algs/skein/skein_port.h
index 1b0225236..4fe268bb5 100644
--- a/module/icp/algs/skein/skein_port.h
+++ b/module/icp/algs/skein/skein_port.h
@@ -16,7 +16,6 @@
#define _SKEIN_PORT_H_
#include <sys/types.h> /* get integer type definitions */
-#include <sys/systm.h> /* for bcopy() */
#ifndef RotL_64
#define RotL_64(x, N) (((x) << (N)) | ((x) >> (64 - (N))))
diff --git a/module/icp/api/kcf_cipher.c b/module/icp/api/kcf_cipher.c
index 2585b7fed..1c9f6873e 100644
--- a/module/icp/api/kcf_cipher.c
+++ b/module/icp/api/kcf_cipher.c
@@ -915,7 +915,7 @@ crypto_decrypt_single(crypto_context_t context, crypto_data_t *ciphertext,
return (error);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(crypto_cipher_init_prov);
EXPORT_SYMBOL(crypto_cipher_init);
EXPORT_SYMBOL(crypto_encrypt_prov);
diff --git a/module/icp/api/kcf_ctxops.c b/module/icp/api/kcf_ctxops.c
index 3f90674b0..b9b9cb74e 100644
--- a/module/icp/api/kcf_ctxops.c
+++ b/module/icp/api/kcf_ctxops.c
@@ -145,7 +145,7 @@ crypto_destroy_ctx_template(crypto_ctx_template_t tmpl)
kmem_free(ctx_tmpl, sizeof (kcf_ctx_template_t));
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(crypto_create_ctx_template);
EXPORT_SYMBOL(crypto_destroy_ctx_template);
#endif
diff --git a/module/icp/api/kcf_digest.c b/module/icp/api/kcf_digest.c
index b58d3b452..87090fd52 100644
--- a/module/icp/api/kcf_digest.c
+++ b/module/icp/api/kcf_digest.c
@@ -482,7 +482,7 @@ crypto_digest_single(crypto_context_t context, crypto_data_t *data,
return (error);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(crypto_digest_prov);
EXPORT_SYMBOL(crypto_digest);
EXPORT_SYMBOL(crypto_digest_init_prov);
diff --git a/module/icp/api/kcf_mac.c b/module/icp/api/kcf_mac.c
index 2b4691c03..21ab94fa5 100644
--- a/module/icp/api/kcf_mac.c
+++ b/module/icp/api/kcf_mac.c
@@ -635,7 +635,7 @@ crypto_mac_single(crypto_context_t context, crypto_data_t *data,
return (error);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(crypto_mac_prov);
EXPORT_SYMBOL(crypto_mac);
EXPORT_SYMBOL(crypto_mac_verify_prov);
diff --git a/module/icp/api/kcf_miscapi.c b/module/icp/api/kcf_miscapi.c
index 09d50f7be..c0f415b26 100644
--- a/module/icp/api/kcf_miscapi.c
+++ b/module/icp/api/kcf_miscapi.c
@@ -122,6 +122,6 @@ kcf_walk_ntfylist(uint32_t event, void *event_arg)
mutex_exit(&ntfy_list_lock);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(crypto_mech2id);
#endif
diff --git a/module/icp/illumos-crypto.c b/module/icp/illumos-crypto.c
index a3986a2e5..c2fcf1ff7 100644
--- a/module/icp/illumos-crypto.c
+++ b/module/icp/illumos-crypto.c
@@ -149,7 +149,7 @@ icp_init(void)
return (0);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
module_exit(icp_fini);
module_init(icp_init);
MODULE_AUTHOR(ZFS_META_AUTHOR);
diff --git a/module/icp/io/edonr_mod.c b/module/icp/io/edonr_mod.c
index cb748a954..544814a98 100644
--- a/module/icp/io/edonr_mod.c
+++ b/module/icp/io/edonr_mod.c
@@ -27,7 +27,6 @@
#include <sys/crypto/common.h>
#include <sys/crypto/spi.h>
#include <sys/sysmacros.h>
-#include <sys/systm.h>
#include <sys/edonr.h>
/*
diff --git a/module/icp/io/skein_mod.c b/module/icp/io/skein_mod.c
index 90e8a6a02..88215fe89 100644
--- a/module/icp/io/skein_mod.c
+++ b/module/icp/io/skein_mod.c
@@ -27,7 +27,6 @@
#include <sys/crypto/common.h>
#include <sys/crypto/spi.h>
#include <sys/sysmacros.h>
-#include <sys/systm.h>
#define SKEIN_MODULE_IMPL
#include <sys/skein.h>
diff --git a/module/lua/lapi.c b/module/lua/lapi.c
index 54c74d38e..81969673b 100644
--- a/module/lua/lapi.c
+++ b/module/lua/lapi.c
@@ -1279,7 +1279,7 @@ LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1,
luaC_objbarrier(L, f1, *up2);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
static int __init
lua_init(void)
diff --git a/module/lua/lauxlib.c b/module/lua/lauxlib.c
index 85ed00c64..1e0356e7c 100644
--- a/module/lua/lauxlib.c
+++ b/module/lua/lauxlib.c
@@ -788,7 +788,7 @@ LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver) {
lua_pop(L, 1);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(luaL_argerror);
EXPORT_SYMBOL(luaL_error);
diff --git a/module/lua/lbaselib.c b/module/lua/lbaselib.c
index 004a1939d..854649a0f 100644
--- a/module/lua/lbaselib.c
+++ b/module/lua/lbaselib.c
@@ -288,7 +288,7 @@ LUAMOD_API int luaopen_base (lua_State *L) {
return 1;
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(luaopen_base);
diff --git a/module/lua/lcorolib.c b/module/lua/lcorolib.c
index af8bea695..0300e7ee1 100644
--- a/module/lua/lcorolib.c
+++ b/module/lua/lcorolib.c
@@ -151,7 +151,7 @@ LUAMOD_API int luaopen_coroutine (lua_State *L) {
return 1;
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(luaopen_coroutine);
diff --git a/module/lua/lstrlib.c b/module/lua/lstrlib.c
index 24a3321bd..49ba70faf 100644
--- a/module/lua/lstrlib.c
+++ b/module/lua/lstrlib.c
@@ -1032,7 +1032,7 @@ LUAMOD_API int luaopen_string (lua_State *L) {
return 1;
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(luaopen_string);
diff --git a/module/lua/ltablib.c b/module/lua/ltablib.c
index d01b5ba07..be5b6375e 100644
--- a/module/lua/ltablib.c
+++ b/module/lua/ltablib.c
@@ -281,7 +281,7 @@ LUAMOD_API int luaopen_table (lua_State *L) {
return 1;
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(luaopen_table);
diff --git a/module/nvpair/fnvpair.c b/module/nvpair/fnvpair.c
index a91b9524d..ce151d692 100644
--- a/module/nvpair/fnvpair.c
+++ b/module/nvpair/fnvpair.c
@@ -508,7 +508,7 @@ fnvpair_value_nvlist(nvpair_t *nvp)
return (rv);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(fnvlist_alloc);
EXPORT_SYMBOL(fnvlist_free);
diff --git a/module/nvpair/nvpair.c b/module/nvpair/nvpair.c
index 512f9a998..97ab7de40 100644
--- a/module/nvpair/nvpair.c
+++ b/module/nvpair/nvpair.c
@@ -24,25 +24,20 @@
* Copyright (c) 2015, 2017 by Delphix. All rights reserved.
*/
-#include <sys/stropts.h>
#include <sys/debug.h>
#include <sys/isa_defs.h>
-#include <sys/int_limits.h>
#include <sys/nvpair.h>
#include <sys/nvpair_impl.h>
-#include <rpc/types.h>
+#include <sys/types.h>
+#include <sys/strings.h>
#include <rpc/xdr.h>
-#if defined(_KERNEL) && !defined(_BOOT)
-#include <sys/varargs.h>
-#include <sys/ddi.h>
+#if defined(_KERNEL)
#include <sys/sunddi.h>
#include <sys/sysmacros.h>
#else
#include <stdarg.h>
#include <stdlib.h>
-#include <string.h>
-#include <strings.h>
#include <stddef.h>
#endif
@@ -270,7 +265,7 @@ nvlist_nvflag(nvlist_t *nvl)
static nv_alloc_t *
nvlist_nv_alloc(int kmflag)
{
-#if defined(_KERNEL) && !defined(_BOOT)
+#if defined(_KERNEL)
switch (kmflag) {
case KM_SLEEP:
return (nv_alloc_sleep);
@@ -281,7 +276,7 @@ nvlist_nv_alloc(int kmflag)
}
#else
return (nv_alloc_nosleep);
-#endif /* _KERNEL && !_BOOT */
+#endif /* _KERNEL */
}
/*
@@ -1680,7 +1675,7 @@ nvlist_lookup_nvpair_ei_sep(nvlist_t *nvl, const char *name, const char sep,
sepp = idxp;
/* determine the index value */
-#if defined(_KERNEL) && !defined(_BOOT)
+#if defined(_KERNEL)
if (ddi_strtol(idxp, &idxep, 0, &idx))
goto fail;
#else
@@ -3320,7 +3315,7 @@ nvs_xdr(nvstream_t *nvs, nvlist_t *nvl, char *buf, size_t *buflen)
return (err);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
static int __init
nvpair_init(void)
{
diff --git a/module/nvpair/nvpair_alloc_fixed.c b/module/nvpair/nvpair_alloc_fixed.c
index 0d4e12b97..c8a604a2b 100644
--- a/module/nvpair/nvpair_alloc_fixed.c
+++ b/module/nvpair/nvpair_alloc_fixed.c
@@ -24,18 +24,9 @@
* Use is subject to license terms.
*/
-
-
-#include <sys/stropts.h>
#include <sys/isa_defs.h>
#include <sys/nvpair.h>
#include <sys/sysmacros.h>
-#if defined(_KERNEL) && !defined(_BOOT)
-#include <sys/varargs.h>
-#else
-#include <stdarg.h>
-#include <strings.h>
-#endif
/*
* This allocator is very simple.
@@ -119,6 +110,6 @@ const nv_alloc_ops_t nv_fixed_ops_def = {
const nv_alloc_ops_t *nv_fixed_ops = &nv_fixed_ops_def;
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(nv_fixed_ops);
#endif
diff --git a/module/spl/Makefile.in b/module/spl/Makefile.in
new file mode 100644
index 000000000..97a431f22
--- /dev/null
+++ b/module/spl/Makefile.in
@@ -0,0 +1,28 @@
+src = @abs_top_srcdir@/module/spl
+obj = @abs_builddir@
+
+MODULE := spl
+
+obj-$(CONFIG_ZFS) := $(MODULE).o
+
+ccflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)
+
+$(MODULE)-objs += spl-atomic.o
+$(MODULE)-objs += spl-condvar.o
+$(MODULE)-objs += spl-cred.o
+$(MODULE)-objs += spl-err.o
+$(MODULE)-objs += spl-generic.o
+$(MODULE)-objs += spl-kmem.o
+$(MODULE)-objs += spl-kmem-cache.o
+$(MODULE)-objs += spl-kobj.o
+$(MODULE)-objs += spl-kstat.o
+$(MODULE)-objs += spl-mutex.o
+$(MODULE)-objs += spl-proc.o
+$(MODULE)-objs += spl-rwlock.o
+$(MODULE)-objs += spl-taskq.o
+$(MODULE)-objs += spl-thread.o
+$(MODULE)-objs += spl-tsd.o
+$(MODULE)-objs += spl-vmem.o
+$(MODULE)-objs += spl-vnode.o
+$(MODULE)-objs += spl-xdr.o
+$(MODULE)-objs += spl-zlib.o
diff --git a/module/spl/README.md b/module/spl/README.md
new file mode 100644
index 000000000..57f635aed
--- /dev/null
+++ b/module/spl/README.md
@@ -0,0 +1,16 @@
+The Solaris Porting Layer, SPL, is a Linux kernel module which provides a
+compatibility layer used by the [ZFS on Linux](http://zfsonlinux.org) project.
+
+# Installation
+
+The latest version of the SPL is maintained as part of this repository.
+Only when building ZFS version 0.7.x or earlier must an external SPL release
+be used. These releases can be found at:
+
+ * Version 0.7.x: https://github.com/zfsonlinux/spl/tree/spl-0.7-release
+ * Version 0.6.5.x: https://github.com/zfsonlinux/spl/tree/spl-0.6.5-release
+
+# Release
+
+The SPL is released under a GPLv2 license.
+For more details see the NOTICE and THIRDPARTYLICENSE files; `UCRL-CODE-235197`
diff --git a/module/spl/spl-condvar.c b/module/spl/spl-condvar.c
index f0060bbdc..1e6e38b78 100644
--- a/module/spl/spl-condvar.c
+++ b/module/spl/spl-condvar.c
@@ -27,6 +27,7 @@
#include <sys/condvar.h>
#include <sys/time.h>
#include <linux/hrtimer.h>
+#include <linux/compiler_compat.h>
void
__cv_init(kcondvar_t *cvp, char *name, kcv_type_t type, void *arg)
@@ -89,7 +90,7 @@ cv_wait_common(kcondvar_t *cvp, kmutex_t *mp, int state, int io)
ASSERT(mutex_owned(mp));
atomic_inc(&cvp->cv_refs);
- m = ACCESS_ONCE(cvp->cv_mutex);
+ m = READ_ONCE(cvp->cv_mutex);
if (!m)
m = xchg(&cvp->cv_mutex, mp);
/* Ensure the same mutex is used by all callers */
@@ -202,7 +203,7 @@ __cv_timedwait_common(kcondvar_t *cvp, kmutex_t *mp, clock_t expire_time,
return (-1);
atomic_inc(&cvp->cv_refs);
- m = ACCESS_ONCE(cvp->cv_mutex);
+ m = READ_ONCE(cvp->cv_mutex);
if (!m)
m = xchg(&cvp->cv_mutex, mp);
/* Ensure the same mutex is used by all callers */
@@ -290,7 +291,7 @@ __cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t expire_time,
return (-1);
atomic_inc(&cvp->cv_refs);
- m = ACCESS_ONCE(cvp->cv_mutex);
+ m = READ_ONCE(cvp->cv_mutex);
if (!m)
m = xchg(&cvp->cv_mutex, mp);
/* Ensure the same mutex is used by all callers */
diff --git a/module/spl/spl-err.c b/module/spl/spl-err.c
index 6b71296e8..4c8f818a9 100644
--- a/module/spl/spl-err.c
+++ b/module/spl/spl-err.c
@@ -26,7 +26,6 @@
#include <sys/sysmacros.h>
#include <sys/cmn_err.h>
-#include <linux/ratelimit.h>
/*
* It is often useful to actually have the panic crash the node so you
@@ -40,19 +39,11 @@ module_param(spl_panic_halt, uint, 0644);
MODULE_PARM_DESC(spl_panic_halt, "Cause kernel panic on assertion failures");
/* END CSTYLED */
-/*
- * Limit the number of stack traces dumped to not more than 5 every
- * 60 seconds to prevent denial-of-service attacks from debug code.
- */
-DEFINE_RATELIMIT_STATE(dumpstack_ratelimit_state, 60 * HZ, 5);
-
void
spl_dumpstack(void)
{
- if (__ratelimit(&dumpstack_ratelimit_state)) {
- printk("Showing stack for process %d\n", current->pid);
- dump_stack();
- }
+ printk("Showing stack for process %d\n", current->pid);
+ dump_stack();
}
EXPORT_SYMBOL(spl_dumpstack);
diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c
index b38fe254c..7c1ad390b 100644
--- a/module/spl/spl-generic.c
+++ b/module/spl/spl-generic.c
@@ -46,12 +46,13 @@
#include <sys/strings.h>
#include <linux/kmod.h>
-char spl_version[32] = "SPL v" SPL_META_VERSION "-" SPL_META_RELEASE;
+char spl_version[32] = "SPL v" ZFS_META_VERSION "-" ZFS_META_RELEASE;
EXPORT_SYMBOL(spl_version);
/* BEGIN CSTYLED */
unsigned long spl_hostid = 0;
EXPORT_SYMBOL(spl_hostid);
+/* BEGIN CSTYLED */
module_param(spl_hostid, ulong, 0644);
MODULE_PARM_DESC(spl_hostid, "The system hostid.");
/* END CSTYLED */
@@ -719,8 +720,6 @@ spl_init(void)
if ((rc = spl_zlib_init()))
goto out10;
- printk(KERN_NOTICE "SPL: Loaded module v%s-%s%s\n", SPL_META_VERSION,
- SPL_META_RELEASE, SPL_DEBUG_STR);
return (rc);
out10:
@@ -742,18 +741,12 @@ out3:
out2:
spl_kvmem_fini();
out1:
- printk(KERN_NOTICE "SPL: Failed to Load Solaris Porting Layer "
- "v%s-%s%s, rc = %d\n", SPL_META_VERSION, SPL_META_RELEASE,
- SPL_DEBUG_STR, rc);
-
return (rc);
}
static void __exit
spl_fini(void)
{
- printk(KERN_NOTICE "SPL: Unloaded module v%s-%s%s\n",
- SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR);
spl_zlib_fini();
spl_kstat_fini();
spl_proc_fini();
@@ -770,6 +763,6 @@ module_init(spl_init);
module_exit(spl_fini);
MODULE_DESCRIPTION("Solaris Porting Layer");
-MODULE_AUTHOR(SPL_META_AUTHOR);
-MODULE_LICENSE(SPL_META_LICENSE);
-MODULE_VERSION(SPL_META_VERSION "-" SPL_META_RELEASE);
+MODULE_AUTHOR(ZFS_META_AUTHOR);
+MODULE_LICENSE("GPL");
+MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c
index e0d551041..1fdb61e6f 100644
--- a/module/spl/spl-kmem.c
+++ b/module/spl/spl-kmem.c
@@ -27,7 +27,6 @@
#include <sys/kmem.h>
#include <sys/vmem.h>
#include <linux/mm.h>
-#include <linux/ratelimit.h>
/*
* As a general rule kmem_alloc() allocations should be small, preferably
@@ -135,12 +134,6 @@ strfree(char *str)
EXPORT_SYMBOL(strfree);
/*
- * Limit the number of large allocation stack traces dumped to not more than
- * 5 every 60 seconds to prevent denial-of-service attacks from debug code.
- */
-DEFINE_RATELIMIT_STATE(kmem_alloc_ratelimit_state, 60 * HZ, 5);
-
-/*
* General purpose unified implementation of kmem_alloc(). It is an
* amalgamation of Linux and Illumos allocator design. It should never be
* exported to ensure that code using kmem_alloc()/kmem_zalloc() remains
@@ -160,7 +153,7 @@ spl_kmem_alloc_impl(size_t size, int flags, int node)
* through the vmem_alloc()/vmem_zalloc() interfaces.
*/
if ((spl_kmem_alloc_warn > 0) && (size > spl_kmem_alloc_warn) &&
- !(flags & KM_VMEM) && __ratelimit(&kmem_alloc_ratelimit_state)) {
+ !(flags & KM_VMEM)) {
printk(KERN_WARNING
"Large kmem_alloc(%lu, 0x%x), please file an issue at:\n"
"https://github.com/zfsonlinux/zfs/issues/new\n",
@@ -207,14 +200,6 @@ spl_kmem_alloc_impl(size_t size, int flags, int node)
continue;
}
- if (unlikely(__ratelimit(&kmem_alloc_ratelimit_state))) {
- printk(KERN_WARNING
- "Possible memory allocation deadlock: "
- "size=%lu lflags=0x%x",
- (unsigned long)size, lflags);
- dump_stack();
- }
-
/*
* Use cond_resched() instead of congestion_wait() to avoid
* deadlocking systems where there are no block devices.
@@ -535,9 +520,12 @@ spl_kmem_fini_tracking(struct list_head *list, spinlock_t *lock)
int
spl_kmem_init(void)
{
+
#ifdef DEBUG_KMEM
kmem_alloc_used_set(0);
+
+
#ifdef DEBUG_KMEM_TRACKING
spl_kmem_init_tracking(&kmem_list, &kmem_lock, KMEM_TABLE_SIZE);
#endif /* DEBUG_KMEM_TRACKING */
diff --git a/module/spl/spl-rwlock.c b/module/spl/spl-rwlock.c
index 9a992cc3a..cf03bc593 100644
--- a/module/spl/spl-rwlock.c
+++ b/module/spl/spl-rwlock.c
@@ -25,6 +25,7 @@
*/
#include <sys/rwlock.h>
+#include <linux/module.h>
#if defined(CONFIG_PREEMPT_RT_FULL)
diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c
index 2919a942a..7684257be 100644
--- a/module/spl/spl-taskq.c
+++ b/module/spl/spl-taskq.c
@@ -60,7 +60,7 @@ static taskq_thread_t *taskq_thread_create(taskq_t *);
/* List of all taskqs */
LIST_HEAD(tq_list);
-DECLARE_RWSEM(tq_list_sem);
+struct rw_semaphore tq_list_sem;
static uint_t taskq_tsd;
static int
@@ -1257,6 +1257,7 @@ MODULE_PARM_DESC(spl_taskq_kick,
int
spl_taskq_init(void)
{
+ init_rwsem(&tq_list_sem);
tsd_create(&taskq_tsd, NULL);
system_taskq = taskq_create("spl_system_taskq", MAX(boot_ncpus, 64),
diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c
index 28ce21276..aebee0a82 100644
--- a/module/spl/spl-vnode.c
+++ b/module/spl/spl-vnode.c
@@ -40,7 +40,7 @@ EXPORT_SYMBOL(rootdir);
static spl_kmem_cache_t *vn_cache;
static spl_kmem_cache_t *vn_file_cache;
-static DEFINE_SPINLOCK(vn_file_lock);
+static spinlock_t vn_file_lock;
static LIST_HEAD(vn_file_list);
static int
@@ -744,6 +744,8 @@ vn_file_cache_destructor(void *buf, void *cdrarg)
int
spl_vn_init(void)
{
+ vn_file_lock = __SPIN_LOCK_UNLOCKED(vn_file_lock);
+
vn_cache = kmem_cache_create("spl_vn_cache",
sizeof (struct vnode), 64, vn_cache_constructor,
vn_cache_destructor, NULL, NULL, NULL, 0);
diff --git a/module/spl/spl-xdr.c b/module/spl/spl-xdr.c
index 2cc3e2a03..1dd31ffc1 100644
--- a/module/spl/spl-xdr.c
+++ b/module/spl/spl-xdr.c
@@ -131,8 +131,6 @@
static struct xdr_ops xdrmem_encode_ops;
static struct xdr_ops xdrmem_decode_ops;
-typedef int bool_t;
-
void
xdrmem_create(XDR *xdrs, const caddr_t addr, const uint_t size,
const enum xdr_op op)
diff --git a/module/unicode/u8_textprep.c b/module/unicode/u8_textprep.c
index 0330032fa..4e6105b2e 100644
--- a/module/unicode/u8_textprep.c
+++ b/module/unicode/u8_textprep.c
@@ -36,18 +36,13 @@
*/
#include <sys/types.h>
-#ifdef _KERNEL
+#include <sys/strings.h>
#include <sys/param.h>
#include <sys/sysmacros.h>
-#include <sys/systm.h>
#include <sys/debug.h>
#include <sys/kmem.h>
-#include <sys/ddi.h>
#include <sys/sunddi.h>
-#else
#include <sys/u8_textprep.h>
-#include <strings.h>
-#endif /* _KERNEL */
#include <sys/byteorder.h>
#include <sys/errno.h>
#include <sys/u8_textprep_data.h>
@@ -2130,7 +2125,7 @@ u8_textprep_str(char *inarray, size_t *inlen, char *outarray, size_t *outlen,
return (ret_val);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
static int __init
unicode_init(void)
{
diff --git a/module/unicode/uconv.c b/module/unicode/uconv.c
index 7a8278322..d812d5f96 100644
--- a/module/unicode/uconv.c
+++ b/module/unicode/uconv.c
@@ -38,7 +38,6 @@
#ifdef _KERNEL
#include <sys/param.h>
#include <sys/sysmacros.h>
-#include <sys/systm.h>
#include <sys/debug.h>
#include <sys/kmem.h>
#include <sys/sunddi.h>
@@ -854,7 +853,7 @@ uconv_u8tou32(const uchar_t *u8s, size_t *utf8len,
return (0);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(uconv_u16tou32);
EXPORT_SYMBOL(uconv_u16tou8);
EXPORT_SYMBOL(uconv_u32tou16);
diff --git a/module/zcommon/zfeature_common.c b/module/zcommon/zfeature_common.c
index 6ab3abe11..ea1bccf50 100644
--- a/module/zcommon/zfeature_common.c
+++ b/module/zcommon/zfeature_common.c
@@ -26,9 +26,7 @@
* Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved.
*/
-#ifdef _KERNEL
-#include <sys/systm.h>
-#else
+#ifndef _KERNEL
#include <errno.h>
#include <string.h>
#endif
@@ -351,7 +349,7 @@ zpool_feature_init(void)
}
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(zfeature_lookup_name);
EXPORT_SYMBOL(zfeature_is_supported);
EXPORT_SYMBOL(zfeature_is_valid_guid);
diff --git a/module/zcommon/zfs_comutil.c b/module/zcommon/zfs_comutil.c
index 685a20c44..b31e0ab27 100644
--- a/module/zcommon/zfs_comutil.c
+++ b/module/zcommon/zfs_comutil.c
@@ -29,15 +29,12 @@
* then a separate file should to be created.
*/
-#if defined(_KERNEL)
-#include <sys/systm.h>
-#else
+#if !defined(_KERNEL)
#include <string.h>
#endif
#include <sys/types.h>
#include <sys/fs/zfs.h>
-#include <sys/int_limits.h>
#include <sys/nvpair.h>
#include "zfs_comutil.h"
#include <sys/zfs_ratelimit.h>
@@ -207,7 +204,7 @@ const char *zfs_history_event_names[ZFS_NUM_LEGACY_HISTORY_EVENTS] = {
"pool split",
};
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(zfs_allocatable_devs);
EXPORT_SYMBOL(zpool_get_rewind_policy);
EXPORT_SYMBOL(zfs_zpl_version_map);
diff --git a/module/zcommon/zfs_deleg.c b/module/zcommon/zfs_deleg.c
index c6ba278cf..8d98f720a 100644
--- a/module/zcommon/zfs_deleg.c
+++ b/module/zcommon/zfs_deleg.c
@@ -28,16 +28,15 @@
#include <sys/zfs_context.h>
#if defined(_KERNEL)
-#include <sys/systm.h>
#include <sys/sunddi.h>
#include <sys/ctype.h>
#else
#include <stdio.h>
#include <unistd.h>
-#include <strings.h>
#include <libnvpair.h>
#include <ctype.h>
#endif
+#include <sys/strings.h>
#include <sys/dsl_deleg.h>
#include "zfs_prop.h"
#include "zfs_deleg.h"
@@ -244,7 +243,7 @@ zfs_deleg_whokey(char *attr, zfs_deleg_who_type_t type,
}
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(zfs_deleg_verify_nvlist);
EXPORT_SYMBOL(zfs_deleg_whokey);
EXPORT_SYMBOL(zfs_deleg_canonicalize_perm);
diff --git a/module/zcommon/zfs_fletcher.c b/module/zcommon/zfs_fletcher.c
index 0cd992979..5a991ba60 100644
--- a/module/zcommon/zfs_fletcher.c
+++ b/module/zcommon/zfs_fletcher.c
@@ -867,7 +867,7 @@ zio_abd_checksum_func_t fletcher_4_abd_ops = {
};
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
#include <linux/mod_compat.h>
static int
diff --git a/module/zcommon/zfs_fletcher_aarch64_neon.c b/module/zcommon/zfs_fletcher_aarch64_neon.c
index b72c1bafd..bd2db2b20 100644
--- a/module/zcommon/zfs_fletcher_aarch64_neon.c
+++ b/module/zcommon/zfs_fletcher_aarch64_neon.c
@@ -45,8 +45,8 @@
#include <linux/simd_aarch64.h>
#include <sys/spa_checksum.h>
+#include <sys/strings.h>
#include <zfs_fletcher.h>
-#include <strings.h>
static void
fletcher_4_aarch64_neon_init(fletcher_4_ctx_t *ctx)
diff --git a/module/zcommon/zfs_fletcher_avx512.c b/module/zcommon/zfs_fletcher_avx512.c
index ed93c1159..7260a9864 100644
--- a/module/zcommon/zfs_fletcher_avx512.c
+++ b/module/zcommon/zfs_fletcher_avx512.c
@@ -28,8 +28,8 @@
#include <sys/byteorder.h>
#include <sys/frame.h>
#include <sys/spa_checksum.h>
+#include <sys/strings.h>
#include <zfs_fletcher.h>
-#include <strings.h>
#define __asm __asm__ __volatile__
diff --git a/module/zcommon/zfs_fletcher_intel.c b/module/zcommon/zfs_fletcher_intel.c
index a479b9d56..6dac047da 100644
--- a/module/zcommon/zfs_fletcher_intel.c
+++ b/module/zcommon/zfs_fletcher_intel.c
@@ -44,8 +44,8 @@
#include <linux/simd_x86.h>
#include <sys/spa_checksum.h>
+#include <sys/strings.h>
#include <zfs_fletcher.h>
-#include <strings.h>
static void
fletcher_4_avx2_init(fletcher_4_ctx_t *ctx)
diff --git a/module/zcommon/zfs_fletcher_sse.c b/module/zcommon/zfs_fletcher_sse.c
index 90b7d7d4e..a0b42e5f5 100644
--- a/module/zcommon/zfs_fletcher_sse.c
+++ b/module/zcommon/zfs_fletcher_sse.c
@@ -46,8 +46,8 @@
#include <linux/simd_x86.h>
#include <sys/spa_checksum.h>
#include <sys/byteorder.h>
+#include <sys/strings.h>
#include <zfs_fletcher.h>
-#include <strings.h>
static void
fletcher_4_sse2_init(fletcher_4_ctx_t *ctx)
diff --git a/module/zcommon/zfs_fletcher_superscalar.c b/module/zcommon/zfs_fletcher_superscalar.c
index 02c5d53c7..fbbbf8060 100644
--- a/module/zcommon/zfs_fletcher_superscalar.c
+++ b/module/zcommon/zfs_fletcher_superscalar.c
@@ -43,8 +43,8 @@
#include <sys/byteorder.h>
#include <sys/spa_checksum.h>
+#include <sys/strings.h>
#include <zfs_fletcher.h>
-#include <strings.h>
static void
fletcher_4_superscalar_init(fletcher_4_ctx_t *ctx)
diff --git a/module/zcommon/zfs_fletcher_superscalar4.c b/module/zcommon/zfs_fletcher_superscalar4.c
index 4fd37d91c..97fdb7b7d 100644
--- a/module/zcommon/zfs_fletcher_superscalar4.c
+++ b/module/zcommon/zfs_fletcher_superscalar4.c
@@ -43,8 +43,8 @@
#include <sys/byteorder.h>
#include <sys/spa_checksum.h>
+#include <sys/strings.h>
#include <zfs_fletcher.h>
-#include <strings.h>
static void
fletcher_4_superscalar4_init(fletcher_4_ctx_t *ctx)
diff --git a/module/zcommon/zfs_namecheck.c b/module/zcommon/zfs_namecheck.c
index 42a7c6c93..aefde9087 100644
--- a/module/zcommon/zfs_namecheck.c
+++ b/module/zcommon/zfs_namecheck.c
@@ -38,9 +38,7 @@
* Each function returns 0 on success, -1 on error.
*/
-#if defined(_KERNEL)
-#include <sys/systm.h>
-#else
+#if !defined(_KERNEL)
#include <string.h>
#endif
@@ -349,7 +347,7 @@ pool_namecheck(const char *pool, namecheck_err_t *why, char *what)
return (0);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(pool_namecheck);
EXPORT_SYMBOL(dataset_namecheck);
EXPORT_SYMBOL(zfs_component_namecheck);
diff --git a/module/zcommon/zfs_prop.c b/module/zcommon/zfs_prop.c
index 34b7228ec..698fb8e21 100644
--- a/module/zcommon/zfs_prop.c
+++ b/module/zcommon/zfs_prop.c
@@ -39,9 +39,7 @@
#include "zfs_deleg.h"
#include "zfs_fletcher.h"
-#if defined(_KERNEL)
-#include <sys/systm.h>
-#else
+#if !defined(_KERNEL)
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@@ -847,7 +845,7 @@ zfs_prop_align_right(zfs_prop_t prop)
#endif
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
static int __init
zcommon_init(void)
{
diff --git a/module/zcommon/zfs_uio.c b/module/zcommon/zfs_uio.c
index 7b4175bbe..af9716126 100644
--- a/module/zcommon/zfs_uio.c
+++ b/module/zcommon/zfs_uio.c
@@ -49,6 +49,8 @@
#include <sys/types.h>
#include <sys/uio_impl.h>
+#include <sys/sysmacros.h>
+#include <sys/strings.h>
#include <linux/kmap_compat.h>
/*
diff --git a/module/zcommon/zpool_prop.c b/module/zcommon/zpool_prop.c
index fd21f3117..bc38eca7d 100644
--- a/module/zcommon/zpool_prop.c
+++ b/module/zcommon/zpool_prop.c
@@ -32,9 +32,7 @@
#include "zfs_prop.h"
-#if defined(_KERNEL)
-#include <sys/systm.h>
-#else
+#if !defined(_KERNEL)
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@@ -244,7 +242,7 @@ zpool_prop_align_right(zpool_prop_t prop)
}
#endif
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/* zpool property functions */
EXPORT_SYMBOL(zpool_prop_init);
EXPORT_SYMBOL(zpool_prop_get_type);
diff --git a/module/zcommon/zprop_common.c b/module/zcommon/zprop_common.c
index a4528d248..838988a4c 100644
--- a/module/zcommon/zprop_common.c
+++ b/module/zcommon/zprop_common.c
@@ -41,8 +41,9 @@
#include "zfs_deleg.h"
#if defined(_KERNEL)
-#include <sys/systm.h>
-#include <util/qsort.h>
+#include <linux/sort.h>
+#define qsort(base, num, size, cmp) \
+ sort(base, num, size, cmp, NULL)
#else
#include <stdlib.h>
#include <string.h>
@@ -435,7 +436,7 @@ zprop_width(int prop, boolean_t *fixed, zfs_type_t type)
#endif
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/* Common routines to initialize property tables */
EXPORT_SYMBOL(zprop_register_impl);
EXPORT_SYMBOL(zprop_register_string);
diff --git a/module/zfs/abd.c b/module/zfs/abd.c
index 0bd7a262f..555e8c1d2 100644
--- a/module/zfs/abd.c
+++ b/module/zfs/abd.c
@@ -1466,7 +1466,7 @@ abd_raidz_rec_iterate(abd_t **cabds, abd_t **tabds,
local_irq_restore(flags);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/*
* bio_nr_pages for ABD.
* @off is the offset in @abd
diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index 6662e0fae..be9964bff 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -292,11 +292,9 @@
#include <sys/zil.h>
#include <sys/fm/fs/zfs.h>
#ifdef _KERNEL
+#include <sys/shrinker.h>
#include <sys/vmsystm.h>
-#include <vm/anon.h>
-#include <sys/fs/swapnode.h>
#include <sys/zpl.h>
-#include <linux/mm_compat.h>
#include <linux/page_compat.h>
#endif
#include <sys/callb.h>
@@ -1199,7 +1197,7 @@ buf_fini(void)
{
int i;
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/*
* Large allocations which do not require contiguous pages
* should be using vmem_free() in the linux kernel\
@@ -1360,7 +1358,7 @@ buf_init(void)
hsize <<= 1;
retry:
buf_hash_table.ht_mask = hsize - 1;
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/*
* Large allocations which do not require contiguous pages
* should be using vmem_alloc() in the linux kernel
@@ -9050,7 +9048,7 @@ l2arc_stop(void)
mutex_exit(&l2arc_feed_thr_lock);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(arc_buf_size);
EXPORT_SYMBOL(arc_write);
EXPORT_SYMBOL(arc_read);
diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c
index bc03317a2..a8c48167a 100644
--- a/module/zfs/dbuf.c
+++ b/module/zfs/dbuf.c
@@ -762,7 +762,7 @@ dbuf_init(void)
retry:
h->hash_table_mask = hsize - 1;
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/*
* Large allocations which do not require contiguous pages
* should be using vmem_alloc() in the linux kernel
@@ -847,7 +847,7 @@ dbuf_fini(void)
for (i = 0; i < DBUF_MUTEXES; i++)
mutex_destroy(&h->hash_mutexes[i]);
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/*
* Large allocations which do not require contiguous pages
* should be using vmem_free() in the linux kernel
@@ -4341,7 +4341,7 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx)
}
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(dbuf_find);
EXPORT_SYMBOL(dbuf_is_metadata);
EXPORT_SYMBOL(dbuf_destroy);
diff --git a/module/zfs/dbuf_stats.c b/module/zfs/dbuf_stats.c
index 6c26718f2..84232338f 100644
--- a/module/zfs/dbuf_stats.c
+++ b/module/zfs/dbuf_stats.c
@@ -225,7 +225,7 @@ dbuf_stats_destroy(void)
dbuf_stats_hash_table_destroy();
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
module_param(zfs_dbuf_state_index, int, 0644);
MODULE_PARM_DESC(zfs_dbuf_state_index, "Calculate arc header index");
#endif
diff --git a/module/zfs/ddt.c b/module/zfs/ddt.c
index 681033d71..f7fe2ae80 100644
--- a/module/zfs/ddt.c
+++ b/module/zfs/ddt.c
@@ -1236,7 +1236,7 @@ ddt_walk(spa_t *spa, ddt_bookmark_t *ddb, ddt_entry_t *dde)
return (SET_ERROR(ENOENT));
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
module_param(zfs_dedup_prefetch, int, 0644);
MODULE_PARM_DESC(zfs_dedup_prefetch, "Enable prefetching dedup-ed blks");
#endif
diff --git a/module/zfs/ddt_zap.c b/module/zfs/ddt_zap.c
index fc9cfec04..77c0784cc 100644
--- a/module/zfs/ddt_zap.c
+++ b/module/zfs/ddt_zap.c
@@ -29,7 +29,6 @@
#include <sys/ddt.h>
#include <sys/zap.h>
#include <sys/dmu_tx.h>
-#include <util/sscanf.h>
int ddt_zap_leaf_blockshift = 12;
int ddt_zap_indirect_blockshift = 12;
diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c
index 2d2586a8c..32a8fd319 100644
--- a/module/zfs/dmu.c
+++ b/module/zfs/dmu.c
@@ -2505,7 +2505,7 @@ dmu_fini(void)
abd_fini();
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(dmu_bonus_hold);
EXPORT_SYMBOL(dmu_buf_hold_array_by_bonus);
EXPORT_SYMBOL(dmu_buf_rele_array);
diff --git a/module/zfs/dmu_object.c b/module/zfs/dmu_object.c
index 1fc71d103..21e8e5a94 100644
--- a/module/zfs/dmu_object.c
+++ b/module/zfs/dmu_object.c
@@ -411,7 +411,7 @@ dmu_object_free_zapified(objset_t *mos, uint64_t object, dmu_tx_t *tx)
VERIFY0(dmu_object_free(mos, object, tx));
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(dmu_object_alloc);
EXPORT_SYMBOL(dmu_object_alloc_dnsize);
EXPORT_SYMBOL(dmu_object_claim);
diff --git a/module/zfs/dmu_objset.c b/module/zfs/dmu_objset.c
index b6371d382..92de37057 100644
--- a/module/zfs/dmu_objset.c
+++ b/module/zfs/dmu_objset.c
@@ -2950,7 +2950,7 @@ dmu_objset_willuse_space(objset_t *os, int64_t space, dmu_tx_t *tx)
}
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(dmu_objset_zil);
EXPORT_SYMBOL(dmu_objset_pool);
EXPORT_SYMBOL(dmu_objset_ds);
diff --git a/module/zfs/dmu_traverse.c b/module/zfs/dmu_traverse.c
index cffcd2d00..a5f468ac8 100644
--- a/module/zfs/dmu_traverse.c
+++ b/module/zfs/dmu_traverse.c
@@ -769,7 +769,7 @@ traverse_pool(spa_t *spa, uint64_t txg_start, int flags,
return (err);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(traverse_dataset);
EXPORT_SYMBOL(traverse_pool);
diff --git a/module/zfs/dmu_tx.c b/module/zfs/dmu_tx.c
index 861769b40..374bb710c 100644
--- a/module/zfs/dmu_tx.c
+++ b/module/zfs/dmu_tx.c
@@ -37,7 +37,6 @@
#include <sys/sa.h>
#include <sys/sa_impl.h>
#include <sys/zfs_context.h>
-#include <sys/varargs.h>
#include <sys/trace_dmu.h>
typedef void (*dmu_tx_hold_func_t)(dmu_tx_t *tx, struct dnode *dn,
@@ -1372,7 +1371,7 @@ dmu_tx_fini(void)
}
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(dmu_tx_create);
EXPORT_SYMBOL(dmu_tx_hold_write);
EXPORT_SYMBOL(dmu_tx_hold_write_by_dnode);
diff --git a/module/zfs/dmu_zfetch.c b/module/zfs/dmu_zfetch.c
index e22560ed1..2133518ff 100644
--- a/module/zfs/dmu_zfetch.c
+++ b/module/zfs/dmu_zfetch.c
@@ -357,7 +357,7 @@ dmu_zfetch(zfetch_t *zf, uint64_t blkid, uint64_t nblks, boolean_t fetch_data)
ZFETCHSTAT_BUMP(zfetchstat_hits);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/* BEGIN CSTYLED */
module_param(zfs_prefetch_disable, int, 0644);
MODULE_PARM_DESC(zfs_prefetch_disable, "Disable all ZFS prefetching");
diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c
index 9823f3183..7a4721e17 100644
--- a/module/zfs/dsl_dataset.c
+++ b/module/zfs/dsl_dataset.c
@@ -4237,7 +4237,7 @@ dsl_dataset_create_remap_deadlist(dsl_dataset_t *ds, dmu_tx_t *tx)
spa_feature_incr(spa, SPA_FEATURE_OBSOLETE_COUNTS, tx);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
#if defined(_LP64)
module_param(zfs_max_recordsize, int, 0644);
MODULE_PARM_DESC(zfs_max_recordsize, "Max allowed record size");
diff --git a/module/zfs/dsl_deleg.c b/module/zfs/dsl_deleg.c
index f17cedb08..cef460f02 100644
--- a/module/zfs/dsl_deleg.c
+++ b/module/zfs/dsl_deleg.c
@@ -768,7 +768,7 @@ dsl_delegation_on(objset_t *os)
return (!!spa_delegation(os->os_spa));
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(dsl_deleg_get);
EXPORT_SYMBOL(dsl_deleg_set);
#endif
diff --git a/module/zfs/dsl_destroy.c b/module/zfs/dsl_destroy.c
index e11508c90..b3296ceee 100644
--- a/module/zfs/dsl_destroy.c
+++ b/module/zfs/dsl_destroy.c
@@ -1095,7 +1095,7 @@ dsl_destroy_inconsistent(const char *dsname, void *arg)
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(dsl_destroy_head);
EXPORT_SYMBOL(dsl_destroy_head_sync_impl);
EXPORT_SYMBOL(dsl_dataset_user_hold_check_one);
diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c
index a866c3074..4b85208d8 100644
--- a/module/zfs/dsl_dir.c
+++ b/module/zfs/dsl_dir.c
@@ -2165,7 +2165,7 @@ dsl_dir_is_zapified(dsl_dir_t *dd)
return (doi.doi_type == DMU_OTN_ZAP_METADATA);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(dsl_dir_set_quota);
EXPORT_SYMBOL(dsl_dir_set_reservation);
#endif
diff --git a/module/zfs/dsl_pool.c b/module/zfs/dsl_pool.c
index 094b6bec0..1bb49c13a 100644
--- a/module/zfs/dsl_pool.c
+++ b/module/zfs/dsl_pool.c
@@ -1208,7 +1208,7 @@ dsl_pool_config_held_writer(dsl_pool_t *dp)
return (RRW_WRITE_HELD(&dp->dp_config_rwlock));
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(dsl_pool_config_enter);
EXPORT_SYMBOL(dsl_pool_config_exit);
diff --git a/module/zfs/dsl_prop.c b/module/zfs/dsl_prop.c
index 57b8eb794..9f892acdb 100644
--- a/module/zfs/dsl_prop.c
+++ b/module/zfs/dsl_prop.c
@@ -1251,7 +1251,7 @@ dsl_prop_nvlist_add_string(nvlist_t *nv, zfs_prop_t prop, const char *value)
nvlist_free(propval);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(dsl_prop_register);
EXPORT_SYMBOL(dsl_prop_unregister);
EXPORT_SYMBOL(dsl_prop_unregister_all);
diff --git a/module/zfs/dsl_scan.c b/module/zfs/dsl_scan.c
index c19a1b75c..2c3494746 100644
--- a/module/zfs/dsl_scan.c
+++ b/module/zfs/dsl_scan.c
@@ -3909,7 +3909,7 @@ dsl_scan_freed(spa_t *spa, const blkptr_t *bp)
dsl_scan_freed_dva(spa, bp, i);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/* CSTYLED */
module_param(zfs_scan_vdev_limit, ulong, 0644);
MODULE_PARM_DESC(zfs_scan_vdev_limit,
diff --git a/module/zfs/dsl_synctask.c b/module/zfs/dsl_synctask.c
index 28130d257..d8eb10d37 100644
--- a/module/zfs/dsl_synctask.c
+++ b/module/zfs/dsl_synctask.c
@@ -185,7 +185,7 @@ dsl_sync_task_sync(dsl_sync_task_t *dst, dmu_tx_t *tx)
kmem_free(dst, sizeof (*dst));
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(dsl_sync_task);
EXPORT_SYMBOL(dsl_sync_task_nowait);
#endif
diff --git a/module/zfs/fm.c b/module/zfs/fm.c
index 52d4acaa2..5c3006670 100644
--- a/module/zfs/fm.c
+++ b/module/zfs/fm.c
@@ -57,7 +57,6 @@
#include <sys/nvpair.h>
#include <sys/cmn_err.h>
#include <sys/sysmacros.h>
-#include <sys/compress.h>
#include <sys/sunddi.h>
#include <sys/systeminfo.h>
#include <sys/fm/util.h>
@@ -67,10 +66,6 @@
#ifdef _KERNEL
#include <sys/atomic.h>
#include <sys/condvar.h>
-#include <sys/cpuvar.h>
-#include <sys/systm.h>
-#include <sys/dumphdr.h>
-#include <sys/cpuvar.h>
#include <sys/console.h>
#include <sys/kobj.h>
#include <sys/time.h>
diff --git a/module/zfs/gzip.c b/module/zfs/gzip.c
index 40166b3fe..5cac2a7de 100644
--- a/module/zfs/gzip.c
+++ b/module/zfs/gzip.c
@@ -28,22 +28,19 @@
#include <sys/debug.h>
#include <sys/types.h>
+#include <sys/strings.h>
#include "qat.h"
#ifdef _KERNEL
-#include <sys/systm.h>
#include <sys/zmod.h>
-
typedef size_t zlen_t;
#define compress_func z_compress_level
#define uncompress_func z_uncompress
#else /* _KERNEL */
-#include <strings.h>
#include <zlib.h>
-
typedef uLongf zlen_t;
#define compress_func compress2
#define uncompress_func uncompress
diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c
index 9f0065b53..c11e459e0 100644
--- a/module/zfs/metaslab.c
+++ b/module/zfs/metaslab.c
@@ -3850,7 +3850,7 @@ metaslab_check_free(spa_t *spa, const blkptr_t *bp)
spa_config_exit(spa, SCL_VDEV, FTAG);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/* CSTYLED */
module_param(metaslab_aliquot, ulong, 0644);
MODULE_PARM_DESC(metaslab_aliquot,
@@ -3904,4 +3904,4 @@ MODULE_PARM_DESC(zfs_metaslab_switch_threshold,
module_param(metaslab_force_ganging, ulong, 0644);
MODULE_PARM_DESC(metaslab_force_ganging,
"blocks larger than this size are forced to be gang blocks");
-#endif /* _KERNEL && HAVE_SPL */
+#endif
diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
index f51952ee4..6fd5d3e9a 100644
--- a/module/zfs/mmp.c
+++ b/module/zfs/mmp.c
@@ -597,7 +597,7 @@ mmp_signal_all_threads(void)
mutex_exit(&spa_namespace_lock);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
#include <linux/mod_compat.h>
static int
diff --git a/module/zfs/multilist.c b/module/zfs/multilist.c
index 48137b3fc..2a594c56c 100644
--- a/module/zfs/multilist.c
+++ b/module/zfs/multilist.c
@@ -403,7 +403,7 @@ multilist_link_active(multilist_node_t *link)
return (list_link_active(link));
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/* BEGIN CSTYLED */
diff --git a/module/zfs/pathname.c b/module/zfs/pathname.c
index 4ec132066..e3e97c9bb 100644
--- a/module/zfs/pathname.c
+++ b/module/zfs/pathname.c
@@ -38,9 +38,9 @@
#include <sys/types.h>
-#include <sys/systm.h>
#include <sys/pathname.h>
#include <sys/kmem.h>
+#include <sys/sysmacros.h>
/*
* Pathname utilities.
diff --git a/module/zfs/sa.c b/module/zfs/sa.c
index 4a863f9a5..5b6b90642 100644
--- a/module/zfs/sa.c
+++ b/module/zfs/sa.c
@@ -28,7 +28,6 @@
#include <sys/zfs_context.h>
#include <sys/types.h>
#include <sys/param.h>
-#include <sys/systm.h>
#include <sys/sysmacros.h>
#include <sys/dmu.h>
#include <sys/dmu_impl.h>
diff --git a/module/zfs/spa.c b/module/zfs/spa.c
index dba6efe7b..50862adcd 100644
--- a/module/zfs/spa.c
+++ b/module/zfs/spa.c
@@ -85,11 +85,7 @@
#ifdef _KERNEL
#include <sys/fm/protocol.h>
#include <sys/fm/util.h>
-#include <sys/bootprops.h>
#include <sys/callb.h>
-#include <sys/cpupart.h>
-#include <sys/pool.h>
-#include <sys/sysdc.h>
#include <sys/zone.h>
#endif /* _KERNEL */
@@ -162,7 +158,6 @@ static int spa_load_impl(spa_t *spa, spa_import_type_t type, char **ereport,
static void spa_vdev_resilver_done(spa_t *spa);
uint_t zio_taskq_batch_pct = 75; /* 1 thread per cpu in pset */
-id_t zio_taskq_psrset_bind = PS_NONE;
boolean_t zio_taskq_sysdc = B_TRUE; /* use SDC scheduling class */
uint_t zio_taskq_basedc = 80; /* base duty cycle */
@@ -1088,6 +1083,7 @@ spa_create_zio_taskqs(spa_t *spa)
static void
spa_thread(void *arg)
{
+ psetid_t zio_taskq_psrset_bind = PS_NONE;
callb_cpr_t cprinfo;
spa_t *spa = arg;
@@ -7795,7 +7791,7 @@ spa_event_notify(spa_t *spa, vdev_t *vd, nvlist_t *hist_nvl, const char *name)
spa_event_post(spa_event_create(spa, vd, hist_nvl, name));
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/* state manipulation functions */
EXPORT_SYMBOL(spa_open);
EXPORT_SYMBOL(spa_open_rewind);
@@ -7852,7 +7848,7 @@ EXPORT_SYMBOL(spa_prop_clear_bootfs);
EXPORT_SYMBOL(spa_event_notify);
#endif
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
module_param(spa_load_verify_maxinflight, int, 0644);
MODULE_PARM_DESC(spa_load_verify_maxinflight,
"Max concurrent traversal I/Os while verifying pool during import -X");
diff --git a/module/zfs/spa_config.c b/module/zfs/spa_config.c
index 50bba2345..b94f0fc84 100644
--- a/module/zfs/spa_config.c
+++ b/module/zfs/spa_config.c
@@ -600,7 +600,7 @@ spa_config_update(spa_t *spa, int what)
spa_config_update(spa, SPA_CONFIG_UPDATE_VDEVS);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(spa_config_load);
EXPORT_SYMBOL(spa_all_configs);
EXPORT_SYMBOL(spa_config_set);
diff --git a/module/zfs/spa_errlog.c b/module/zfs/spa_errlog.c
index 1299faa58..e42f8a021 100644
--- a/module/zfs/spa_errlog.c
+++ b/module/zfs/spa_errlog.c
@@ -404,7 +404,7 @@ spa_errlog_sync(spa_t *spa, uint64_t txg)
mutex_exit(&spa->spa_errlog_lock);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/* error handling */
EXPORT_SYMBOL(spa_log_error);
EXPORT_SYMBOL(spa_get_errlog_size);
diff --git a/module/zfs/spa_history.c b/module/zfs/spa_history.c
index 511bf1094..969fdb000 100644
--- a/module/zfs/spa_history.c
+++ b/module/zfs/spa_history.c
@@ -183,12 +183,8 @@ static char *
spa_history_zone(void)
{
#ifdef _KERNEL
-#ifdef HAVE_SPL
return ("linux");
#else
- return (curproc->p_zone->zone_name);
-#endif
-#else
return (NULL);
#endif
}
@@ -626,7 +622,7 @@ spa_history_log_version(spa_t *spa, const char *operation, dmu_tx_t *tx)
u->nodename, u->release, u->version, u->machine);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(spa_history_create_obj);
EXPORT_SYMBOL(spa_history_get);
EXPORT_SYMBOL(spa_history_log);
diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c
index 234e5c60d..288e5378b 100644
--- a/module/zfs/spa_misc.c
+++ b/module/zfs/spa_misc.c
@@ -2254,7 +2254,7 @@ spa_set_missing_tvds(spa_t *spa, uint64_t missing)
spa->spa_missing_tvds = missing;
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
#include <linux/mod_compat.h>
diff --git a/module/zfs/spa_stats.c b/module/zfs/spa_stats.c
index f604836c8..3f137d9c7 100644
--- a/module/zfs/spa_stats.c
+++ b/module/zfs/spa_stats.c
@@ -1017,7 +1017,7 @@ spa_stats_destroy(spa_t *spa)
spa_mmp_history_destroy(spa);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/* CSTYLED */
module_param(zfs_read_history, int, 0644);
MODULE_PARM_DESC(zfs_read_history,
diff --git a/module/zfs/txg.c b/module/zfs/txg.c
index 2c7f5303b..30f251573 100644
--- a/module/zfs/txg.c
+++ b/module/zfs/txg.c
@@ -934,7 +934,7 @@ txg_list_next(txg_list_t *tl, void *p, uint64_t txg)
return (tn == NULL ? NULL : (char *)tn - tl->tl_offset);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(txg_init);
EXPORT_SYMBOL(txg_fini);
EXPORT_SYMBOL(txg_sync_start);
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
index 7bb27f0ec..388be3617 100644
--- a/module/zfs/vdev.c
+++ b/module/zfs/vdev.c
@@ -4237,7 +4237,7 @@ vdev_deadman(vdev_t *vd, char *tag)
}
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(vdev_fault);
EXPORT_SYMBOL(vdev_degrade);
EXPORT_SYMBOL(vdev_online);
diff --git a/module/zfs/vdev_cache.c b/module/zfs/vdev_cache.c
index 0570ceb2e..0f1d9448b 100644
--- a/module/zfs/vdev_cache.c
+++ b/module/zfs/vdev_cache.c
@@ -425,7 +425,7 @@ vdev_cache_stat_fini(void)
}
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
module_param(zfs_vdev_cache_max, int, 0644);
MODULE_PARM_DESC(zfs_vdev_cache_max, "Inflate reads small than max");
diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c
index 9c3a1ba80..5cdfd960c 100644
--- a/module/zfs/vdev_disk.c
+++ b/module/zfs/vdev_disk.c
@@ -33,7 +33,6 @@
#include <sys/abd.h>
#include <sys/fs/zfs.h>
#include <sys/zio.h>
-#include <sys/sunldi.h>
#include <linux/mod_compat.h>
char *zfs_vdev_scheduler = VDEV_SCHEDULER;
diff --git a/module/zfs/vdev_indirect.c b/module/zfs/vdev_indirect.c
index ff0968384..a93e41258 100644
--- a/module/zfs/vdev_indirect.c
+++ b/module/zfs/vdev_indirect.c
@@ -1687,7 +1687,7 @@ vdev_ops_t vdev_indirect_ops = {
B_FALSE /* leaf vdev */
};
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(rs_alloc);
EXPORT_SYMBOL(spa_condense_fini);
EXPORT_SYMBOL(spa_start_indirect_condensing_thread);
diff --git a/module/zfs/vdev_indirect_births.c b/module/zfs/vdev_indirect_births.c
index a0163b2e5..1c44a6428 100644
--- a/module/zfs/vdev_indirect_births.c
+++ b/module/zfs/vdev_indirect_births.c
@@ -213,7 +213,7 @@ vdev_indirect_births_physbirth(vdev_indirect_births_t *vib, uint64_t offset,
return (-1);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(vdev_indirect_births_add_entry);
EXPORT_SYMBOL(vdev_indirect_births_alloc);
EXPORT_SYMBOL(vdev_indirect_births_close);
diff --git a/module/zfs/vdev_indirect_mapping.c b/module/zfs/vdev_indirect_mapping.c
index dbd6a7635..d91f23383 100644
--- a/module/zfs/vdev_indirect_mapping.c
+++ b/module/zfs/vdev_indirect_mapping.c
@@ -596,7 +596,7 @@ vdev_indirect_mapping_free_obsolete_counts(vdev_indirect_mapping_t *vim,
vmem_free(counts, vim->vim_phys->vimp_num_entries * sizeof (uint32_t));
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(vdev_indirect_mapping_add_entries);
EXPORT_SYMBOL(vdev_indirect_mapping_alloc);
EXPORT_SYMBOL(vdev_indirect_mapping_bytes_mapped);
diff --git a/module/zfs/vdev_mirror.c b/module/zfs/vdev_mirror.c
index 1c591cd64..65357d841 100644
--- a/module/zfs/vdev_mirror.c
+++ b/module/zfs/vdev_mirror.c
@@ -774,7 +774,7 @@ vdev_ops_t vdev_spare_ops = {
B_FALSE /* not a leaf vdev */
};
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/* BEGIN CSTYLED */
module_param(zfs_vdev_mirror_rotating_inc, int, 0644);
MODULE_PARM_DESC(zfs_vdev_mirror_rotating_inc,
diff --git a/module/zfs/vdev_queue.c b/module/zfs/vdev_queue.c
index 3ac31a872..4f29d0043 100644
--- a/module/zfs/vdev_queue.c
+++ b/module/zfs/vdev_queue.c
@@ -883,7 +883,7 @@ vdev_queue_last_offset(vdev_t *vd)
return (vd->vdev_queue.vq_last_offset);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
module_param(zfs_vdev_aggregation_limit, int, 0644);
MODULE_PARM_DESC(zfs_vdev_aggregation_limit, "Max vdev I/O aggregation size");
diff --git a/module/zfs/vdev_raidz_math.c b/module/zfs/vdev_raidz_math.c
index ba4dcc480..e6112bc02 100644
--- a/module/zfs/vdev_raidz_math.c
+++ b/module/zfs/vdev_raidz_math.c
@@ -614,7 +614,7 @@ vdev_raidz_impl_set(const char *val)
return (err);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
#include <linux/mod_compat.h>
static int
diff --git a/module/zfs/vdev_removal.c b/module/zfs/vdev_removal.c
index 07c556ed0..f9084e8cf 100644
--- a/module/zfs/vdev_removal.c
+++ b/module/zfs/vdev_removal.c
@@ -2102,7 +2102,7 @@ spa_removal_get_stats(spa_t *spa, pool_removal_stat_t *prs)
return (0);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
module_param(zfs_remove_max_segment, int, 0644);
MODULE_PARM_DESC(zfs_remove_max_segment,
"Largest contiguous segment to allocate when removing device");
diff --git a/module/zfs/zap_micro.c b/module/zfs/zap_micro.c
index 791cbee88..6ab2551b6 100644
--- a/module/zfs/zap_micro.c
+++ b/module/zfs/zap_micro.c
@@ -1629,7 +1629,7 @@ zap_get_stats(objset_t *os, uint64_t zapobj, zap_stats_t *zs)
return (0);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(zap_create);
EXPORT_SYMBOL(zap_create_dnsize);
EXPORT_SYMBOL(zap_create_norm);
diff --git a/module/zfs/zcp.c b/module/zfs/zcp.c
index 31230dc52..e7194344b 100644
--- a/module/zfs/zcp.c
+++ b/module/zfs/zcp.c
@@ -100,7 +100,6 @@
#include <sys/zcp_iter.h>
#include <sys/zcp_prop.h>
#include <sys/zcp_global.h>
-#include <util/sscanf.h>
#ifndef KM_NORMALPRI
#define KM_NORMALPRI 0
diff --git a/module/zfs/zfs_acl.c b/module/zfs/zfs_acl.c
index 9fee47445..b1af4da2f 100644
--- a/module/zfs/zfs_acl.c
+++ b/module/zfs/zfs_acl.c
@@ -27,9 +27,7 @@
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
-#include <sys/systm.h>
#include <sys/sysmacros.h>
-#include <sys/resource.h>
#include <sys/vfs.h>
#include <sys/vnode.h>
#include <sys/sid.h>
@@ -38,7 +36,6 @@
#include <sys/kmem.h>
#include <sys/cmn_err.h>
#include <sys/errno.h>
-#include <sys/unistd.h>
#include <sys/sdt.h>
#include <sys/fs/zfs.h>
#include <sys/mode.h>
@@ -54,7 +51,6 @@
#include <sys/sa.h>
#include <sys/trace_acl.h>
#include <sys/zpl.h>
-#include "fs/fs_subr.h"
#define ALLOW ACE_ACCESS_ALLOWED_ACE_TYPE
#define DENY ACE_ACCESS_DENIED_ACE_TYPE
@@ -98,6 +94,8 @@
#define ALL_MODE_EXECS (S_IXUSR | S_IXGRP | S_IXOTH)
+#define IDMAP_WK_CREATOR_OWNER_UID 2147483648U
+
static uint16_t
zfs_ace_v0_get_type(void *acep)
{
diff --git a/module/zfs/zfs_byteswap.c b/module/zfs/zfs_byteswap.c
index 16327a225..7893bde4e 100644
--- a/module/zfs/zfs_byteswap.c
+++ b/module/zfs/zfs_byteswap.c
@@ -198,7 +198,7 @@ zfs_znode_byteswap(void *buf, size_t size)
}
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(zfs_oldacl_byteswap);
EXPORT_SYMBOL(zfs_acl_byteswap);
EXPORT_SYMBOL(zfs_znode_byteswap);
diff --git a/module/zfs/zfs_ctldir.c b/module/zfs/zfs_ctldir.c
index 2b7272d4f..f0720e58a 100644
--- a/module/zfs/zfs_ctldir.c
+++ b/module/zfs/zfs_ctldir.c
@@ -71,11 +71,9 @@
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
-#include <sys/systm.h>
#include <sys/sysmacros.h>
#include <sys/pathname.h>
#include <sys/vfs.h>
-#include <sys/vfs_opreg.h>
#include <sys/zfs_ctldir.h>
#include <sys/zfs_ioctl.h>
#include <sys/zfs_vfsops.h>
@@ -85,7 +83,6 @@
#include <sys/dmu_objset.h>
#include <sys/dsl_destroy.h>
#include <sys/dsl_deleg.h>
-#include <sys/mount.h>
#include <sys/zpl.h>
#include "zfs_namecheck.h"
diff --git a/module/zfs/zfs_dir.c b/module/zfs/zfs_dir.c
index 7eb426b78..8a591904f 100644
--- a/module/zfs/zfs_dir.c
+++ b/module/zfs/zfs_dir.c
@@ -28,9 +28,7 @@
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
-#include <sys/systm.h>
#include <sys/sysmacros.h>
-#include <sys/resource.h>
#include <sys/vfs.h>
#include <sys/vnode.h>
#include <sys/file.h>
@@ -41,7 +39,6 @@
#include <sys/cmn_err.h>
#include <sys/errno.h>
#include <sys/stat.h>
-#include <sys/unistd.h>
#include <sys/sunddi.h>
#include <sys/random.h>
#include <sys/policy.h>
@@ -49,7 +46,6 @@
#include <sys/zfs_acl.h>
#include <sys/zfs_vnops.h>
#include <sys/fs/zfs.h>
-#include "fs/fs_subr.h"
#include <sys/zap.h>
#include <sys/dmu.h>
#include <sys/atomic.h>
@@ -57,8 +53,6 @@
#include <sys/zfs_fuid.h>
#include <sys/sa.h>
#include <sys/zfs_sa.h>
-#include <sys/dnlc.h>
-#include <sys/extdirent.h>
/*
* zfs_match_find() is used by zfs_dirent_lock() to peform zap lookups
diff --git a/module/zfs/zfs_fm.c b/module/zfs/zfs_fm.c
index e28e46e7a..e604f33c8 100644
--- a/module/zfs/zfs_fm.c
+++ b/module/zfs/zfs_fm.c
@@ -1041,7 +1041,7 @@ zfs_post_state_change(spa_t *spa, vdev_t *vd, uint64_t laststate)
#endif
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(zfs_ereport_post);
EXPORT_SYMBOL(zfs_ereport_post_checksum);
EXPORT_SYMBOL(zfs_post_remove);
diff --git a/module/zfs/zfs_fuid.c b/module/zfs/zfs_fuid.c
index 5cfb0c975..e57753593 100644
--- a/module/zfs/zfs_fuid.c
+++ b/module/zfs/zfs_fuid.c
@@ -29,7 +29,6 @@
#include <sys/refcount.h>
#include <sys/nvpair.h>
#ifdef _KERNEL
-#include <sys/kidmap.h>
#include <sys/sid.h>
#include <sys/zfs_vfsops.h>
#include <sys/zfs_znode.h>
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c
index eacbf930d..f95b77db7 100644
--- a/module/zfs/zfs_ioctl.c
+++ b/module/zfs/zfs_ioctl.c
@@ -144,12 +144,8 @@
#include <sys/param.h>
#include <sys/errno.h>
#include <sys/uio.h>
-#include <sys/buf.h>
-#include <sys/modctl.h>
-#include <sys/open.h>
#include <sys/file.h>
#include <sys/kmem.h>
-#include <sys/conf.h>
#include <sys/cmn_err.h>
#include <sys/stat.h>
#include <sys/zfs_ioctl.h>
@@ -160,7 +156,6 @@
#include <sys/spa_impl.h>
#include <sys/vdev.h>
#include <sys/vdev_impl.h>
-#include <sys/priv_impl.h>
#include <sys/dmu.h>
#include <sys/dsl_dir.h>
#include <sys/dsl_dataset.h>
@@ -169,14 +164,11 @@
#include <sys/dmu_objset.h>
#include <sys/dmu_impl.h>
#include <sys/dmu_tx.h>
-#include <sys/ddi.h>
#include <sys/sunddi.h>
-#include <sys/sunldi.h>
#include <sys/policy.h>
#include <sys/zone.h>
#include <sys/nvpair.h>
#include <sys/pathname.h>
-#include <sys/mount.h>
#include <sys/sdt.h>
#include <sys/fs/zfs.h>
#include <sys/zfs_ctldir.h>
@@ -184,7 +176,6 @@
#include <sys/zfs_onexit.h>
#include <sys/zvol.h>
#include <sys/dsl_scan.h>
-#include <sharefs/share.h>
#include <sys/fm/util.h>
#include <sys/dsl_crypt.h>
@@ -7115,7 +7106,7 @@ _fini(void)
ZFS_META_VERSION, ZFS_META_RELEASE, ZFS_DEBUG_STR);
}
-#ifdef HAVE_SPL
+#if defined(_KERNEL)
module_init(_init);
module_exit(_fini);
@@ -7123,4 +7114,4 @@ MODULE_DESCRIPTION("ZFS");
MODULE_AUTHOR(ZFS_META_AUTHOR);
MODULE_LICENSE(ZFS_META_LICENSE);
MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
-#endif /* HAVE_SPL */
+#endif
diff --git a/module/zfs/zfs_log.c b/module/zfs/zfs_log.c
index ce7b84927..15c396ce0 100644
--- a/module/zfs/zfs_log.c
+++ b/module/zfs/zfs_log.c
@@ -26,7 +26,6 @@
#include <sys/types.h>
#include <sys/param.h>
-#include <sys/systm.h>
#include <sys/sysmacros.h>
#include <sys/cmn_err.h>
#include <sys/kmem.h>
@@ -45,7 +44,6 @@
#include <sys/dmu.h>
#include <sys/spa.h>
#include <sys/zfs_fuid.h>
-#include <sys/ddi.h>
#include <sys/dsl_dataset.h>
/*
@@ -720,7 +718,7 @@ zfs_log_acl(zilog_t *zilog, dmu_tx_t *tx, znode_t *zp,
zil_itx_assign(zilog, itx, tx);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
module_param(zfs_immediate_write_sz, long, 0644);
MODULE_PARM_DESC(zfs_immediate_write_sz, "Largest data block to write to zil");
#endif
diff --git a/module/zfs/zfs_onexit.c b/module/zfs/zfs_onexit.c
index bc3892645..31f77ce81 100644
--- a/module/zfs/zfs_onexit.c
+++ b/module/zfs/zfs_onexit.c
@@ -26,13 +26,9 @@
#include <sys/types.h>
#include <sys/param.h>
#include <sys/errno.h>
-#include <sys/open.h>
#include <sys/kmem.h>
-#include <sys/conf.h>
-#include <sys/ddi.h>
#include <sys/sunddi.h>
#include <sys/zfs_ioctl.h>
-#include <sys/mkdev.h>
#include <sys/zfs_onexit.h>
#include <sys/zvol.h>
diff --git a/module/zfs/zfs_replay.c b/module/zfs/zfs_replay.c
index e2ff00789..ba103084f 100644
--- a/module/zfs/zfs_replay.c
+++ b/module/zfs/zfs_replay.c
@@ -26,7 +26,6 @@
#include <sys/types.h>
#include <sys/param.h>
-#include <sys/systm.h>
#include <sys/sysmacros.h>
#include <sys/cmn_err.h>
#include <sys/kmem.h>
diff --git a/module/zfs/zfs_rlock.c b/module/zfs/zfs_rlock.c
index d7fc01496..7ecc353d2 100644
--- a/module/zfs/zfs_rlock.c
+++ b/module/zfs/zfs_rlock.c
@@ -96,6 +96,7 @@
*/
#include <sys/zfs_rlock.h>
+#include <sys/sysmacros.h>
/*
* Check if a write lock can be grabbed, or wait and recheck until available.
diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c
index 2577860ac..b890bbaf9 100644
--- a/module/zfs/zfs_vfsops.c
+++ b/module/zfs/zfs_vfsops.c
@@ -27,17 +27,13 @@
#include <sys/types.h>
#include <sys/param.h>
-#include <sys/systm.h>
#include <sys/sysmacros.h>
#include <sys/kmem.h>
#include <sys/pathname.h>
#include <sys/vnode.h>
#include <sys/vfs.h>
-#include <sys/vfs_opreg.h>
#include <sys/mntent.h>
-#include <sys/mount.h>
#include <sys/cmn_err.h>
-#include "fs/fs_subr.h"
#include <sys/zfs_znode.h>
#include <sys/zfs_vnops.h>
#include <sys/zfs_dir.h>
@@ -51,18 +47,12 @@
#include <sys/zap.h>
#include <sys/sa.h>
#include <sys/sa_impl.h>
-#include <sys/varargs.h>
#include <sys/policy.h>
#include <sys/atomic.h>
-#include <sys/mkdev.h>
-#include <sys/modctl.h>
-#include <sys/refstr.h>
#include <sys/zfs_ioctl.h>
#include <sys/zfs_ctldir.h>
#include <sys/zfs_fuid.h>
-#include <sys/bootconf.h>
#include <sys/sunddi.h>
-#include <sys/dnlc.h>
#include <sys/dmu_objset.h>
#include <sys/spa_boot.h>
#include <sys/zpl.h>
@@ -2341,7 +2331,7 @@ zfs_fini(void)
zfsctl_fini();
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(zfs_suspend_fs);
EXPORT_SYMBOL(zfs_resume_fs);
EXPORT_SYMBOL(zfs_userspace_one);
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
index d7d73201d..832e4bfc9 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -33,11 +33,8 @@
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
-#include <sys/systm.h>
#include <sys/sysmacros.h>
-#include <sys/resource.h>
#include <sys/vfs.h>
-#include <sys/vfs_opreg.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/kmem.h>
@@ -45,11 +42,9 @@
#include <sys/uio.h>
#include <sys/vmsystm.h>
#include <sys/atomic.h>
-#include <vm/pvn.h>
#include <sys/pathname.h>
#include <sys/cmn_err.h>
#include <sys/errno.h>
-#include <sys/unistd.h>
#include <sys/zfs_dir.h>
#include <sys/zfs_acl.h>
#include <sys/zfs_ioctl.h>
@@ -61,22 +56,16 @@
#include <sys/dbuf.h>
#include <sys/zap.h>
#include <sys/sa.h>
-#include <sys/dirent.h>
#include <sys/policy.h>
#include <sys/sunddi.h>
#include <sys/sid.h>
#include <sys/mode.h>
-#include "fs/fs_subr.h"
#include <sys/zfs_ctldir.h>
#include <sys/zfs_fuid.h>
#include <sys/zfs_sa.h>
#include <sys/zfs_vnops.h>
-#include <sys/dnlc.h>
#include <sys/zfs_rlock.h>
-#include <sys/extdirent.h>
-#include <sys/kidmap.h>
#include <sys/cred.h>
-#include <sys/attr.h>
#include <sys/zpl.h>
#include <sys/zil.h>
#include <sys/sa_impl.h>
@@ -5234,7 +5223,7 @@ zfs_retzcbuf(struct inode *ip, xuio_t *xuio, cred_t *cr)
}
#endif /* HAVE_UIO_ZEROCOPY */
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(zfs_open);
EXPORT_SYMBOL(zfs_close);
EXPORT_SYMBOL(zfs_read);
diff --git a/module/zfs/zfs_znode.c b/module/zfs/zfs_znode.c
index c8a613f14..bb18c1b9a 100644
--- a/module/zfs/zfs_znode.c
+++ b/module/zfs/zfs_znode.c
@@ -29,24 +29,17 @@
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
-#include <sys/systm.h>
#include <sys/sysmacros.h>
-#include <sys/resource.h>
#include <sys/mntent.h>
-#include <sys/mkdev.h>
#include <sys/u8_textprep.h>
#include <sys/dsl_dataset.h>
#include <sys/vfs.h>
-#include <sys/vfs_opreg.h>
#include <sys/vnode.h>
#include <sys/file.h>
#include <sys/kmem.h>
#include <sys/errno.h>
-#include <sys/unistd.h>
#include <sys/mode.h>
#include <sys/atomic.h>
-#include <vm/pvn.h>
-#include "fs/fs_subr.h"
#include <sys/zfs_dir.h>
#include <sys/zfs_acl.h>
#include <sys/zfs_ioctl.h>
@@ -56,7 +49,6 @@
#include <sys/zfs_ctldir.h>
#include <sys/dnode.h>
#include <sys/fs/zfs.h>
-#include <sys/kidmap.h>
#include <sys/zpl.h>
#endif /* _KERNEL */
@@ -2243,7 +2235,7 @@ zfs_obj_to_stats(objset_t *osp, uint64_t obj, zfs_stat_t *sb,
return (error);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(zfs_create_fs);
EXPORT_SYMBOL(zfs_obj_to_path);
diff --git a/module/zfs/zil.c b/module/zfs/zil.c
index d0a100252..da3ee4500 100644
--- a/module/zfs/zil.c
+++ b/module/zfs/zil.c
@@ -32,7 +32,6 @@
#include <sys/zap.h>
#include <sys/arc.h>
#include <sys/stat.h>
-#include <sys/resource.h>
#include <sys/zil.h>
#include <sys/zil_impl.h>
#include <sys/dsl_dataset.h>
@@ -3406,7 +3405,7 @@ zil_reset(const char *osname, void *arg)
return (0);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(zil_alloc);
EXPORT_SYMBOL(zil_free);
EXPORT_SYMBOL(zil_open);
diff --git a/module/zfs/zio.c b/module/zfs/zio.c
index 81ae65c31..8a495988b 100644
--- a/module/zfs/zio.c
+++ b/module/zfs/zio.c
@@ -4712,7 +4712,7 @@ zbookmark_subtree_completed(const dnode_phys_t *dnp,
last_block) <= 0);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(zio_type_name);
EXPORT_SYMBOL(zio_buf_alloc);
EXPORT_SYMBOL(zio_data_buf_alloc);
diff --git a/module/zfs/zio_compress.c b/module/zfs/zio_compress.c
index 974af03d1..971e8de8b 100644
--- a/module/zfs/zio_compress.c
+++ b/module/zfs/zio_compress.c
@@ -32,7 +32,6 @@
*/
#include <sys/zfs_context.h>
-#include <sys/compress.h>
#include <sys/spa.h>
#include <sys/zfeature.h>
#include <sys/zio.h>
diff --git a/module/zfs/zio_crypt.c b/module/zfs/zio_crypt.c
index 2e6176782..2533aee13 100644
--- a/module/zfs/zio_crypt.c
+++ b/module/zfs/zio_crypt.c
@@ -2026,7 +2026,7 @@ error:
return (ret);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
/* BEGIN CSTYLED */
module_param(zfs_key_max_salt_uses, ulong, 0644);
MODULE_PARM_DESC(zfs_key_max_salt_uses, "Max number of times a salt value "
diff --git a/module/zfs/zio_inject.c b/module/zfs/zio_inject.c
index 26f255c7b..87d32a115 100644
--- a/module/zfs/zio_inject.c
+++ b/module/zfs/zio_inject.c
@@ -855,7 +855,7 @@ zio_inject_fini(void)
rw_destroy(&inject_lock);
}
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(zio_injection_enabled);
EXPORT_SYMBOL(zio_inject_fault);
EXPORT_SYMBOL(zio_inject_list_next);
diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c
index e03a0481c..5b6839dd4 100644
--- a/module/zfs/zpl_file.c
+++ b/module/zfs/zpl_file.c
@@ -27,6 +27,7 @@
#ifdef CONFIG_COMPAT
#include <linux/compat.h>
#endif
+#include <sys/file.h>
#include <sys/dmu_objset.h>
#include <sys/zfs_vfsops.h>
#include <sys/zfs_vnops.h>
diff --git a/module/zfs/zpl_xattr.c b/module/zfs/zpl_xattr.c
index ebb6e7be2..09e38ee8b 100644
--- a/module/zfs/zpl_xattr.c
+++ b/module/zfs/zpl_xattr.c
@@ -1498,7 +1498,7 @@ zpl_posix_acl_free(void *arg)
* a is not last node, make sure next pointer is set
* by the adder and advance the head.
*/
- while (ACCESS_ONCE(a->next) == NULL)
+ while (READ_ONCE(a->next) == NULL)
cpu_relax();
acl_rel_head = a->next;
a->next = freelist;
diff --git a/module/zfs/zrlock.c b/module/zfs/zrlock.c
index 4f4854436..014a5cc6c 100644
--- a/module/zfs/zrlock.c
+++ b/module/zfs/zrlock.c
@@ -189,7 +189,7 @@ zrl_owner(zrlock_t *zrl)
}
#endif
-#if defined(_KERNEL) && defined(HAVE_SPL)
+#if defined(_KERNEL)
EXPORT_SYMBOL(zrl_add_impl);
EXPORT_SYMBOL(zrl_remove);