linux: module: weld all but spl.ko into zfs.ko

Originally it was thought it would be useful to split up the kmods
by functionality.  This would allow external consumers to only load
what was needed.  However, in practice we've never had a case where
this functionality would be needed, and conversely managing multiple
kmods can be awkward.  Therefore, this change merges all but the
spl.ko kmod in to a single zfs.ko kmod.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13274
This commit is contained in:
наб 2022-03-31 17:20:50 +02:00 committed by Brian Behlendorf
parent 310ab9d261
commit ad9e767657
40 changed files with 518 additions and 749 deletions

View File

@ -167,7 +167,7 @@ vcscheck:
PHONY += zstdcheck
zstdcheck:
@$(MAKE) -C module/zstd checksymbols
@$(MAKE) -C module check-zstd-symbols
PHONY += lint
lint: cppcheck paxcheck

View File

@ -171,17 +171,6 @@ AC_CONFIG_FILES([
man/Makefile
module/Kbuild
module/Makefile
module/avl/Makefile
module/icp/Makefile
module/lua/Makefile
module/nvpair/Makefile
module/os/linux/spl/Makefile
module/os/linux/zfs/Makefile
module/spl/Makefile
module/unicode/Makefile
module/zcommon/Makefile
module/zfs/Makefile
module/zstd/Makefile
rpm/Makefile
rpm/generic/Makefile
rpm/generic/zfs-dkms.spec

View File

@ -69,8 +69,7 @@ do_stop()
then
# No pools imported, it is/should be safe/possible to
# unload modules.
zfs_action "Unloading modules" rmmod zfs zunicode \
zavl zcommon znvpair zlua spl
zfs_action "Unloading modules" rmmod zfs spl
return "$?"
fi
}

View File

@ -42,9 +42,6 @@ extern "C" {
#endif
#define EXPORT_SYMBOL(x)
#define MODULE_AUTHOR(s)
#define MODULE_DESCRIPTION(s)
#define MODULE_LICENSE(s)
#define module_param(a, b, c)
#define module_param_call(a, b, c, d, e)
#define module_param_named(a, b, c, d)

View File

@ -31,11 +31,6 @@
#include <sys/sysctl.h>
#define ZFS_MODULE_DESCRIPTION(s)
#define ZFS_MODULE_AUTHOR(s)
#define ZFS_MODULE_LICENSE(s)
#define ZFS_MODULE_VERSION(s)
#define EXPORT_SYMBOL(x)
#define module_param(a, b, c)
#define MODULE_PARM_DESC(a, b)

View File

@ -160,11 +160,4 @@ enum scope_prefix_types {
#define ZFS_MODULE_PARAM_ARGS const char *buf, zfs_kernel_param_t *kp
#define ZFS_MODULE_DESCRIPTION(s) MODULE_DESCRIPTION(s)
#define ZFS_MODULE_AUTHOR(s) MODULE_AUTHOR(s)
#define ZFS_MODULE_LICENSE(s) MODULE_LICENSE(s)
#define ZFS_MODULE_VERSION(s) MODULE_VERSION(s)
#define module_init_early(fn) module_init(fn)
#endif /* _MOD_COMPAT_H */

View File

@ -30,11 +30,6 @@
* Exported symbols
*/
#define EXPORT_SYMBOL(x)
#define ZFS_MODULE_DESCRIPTION(s)
#define ZFS_MODULE_AUTHOR(s)
#define ZFS_MODULE_LICENSE(s)
#define ZFS_MODULE_VERSION(s)
#endif
#endif /* SYS_MOD_H */

View File

@ -1,20 +1,6 @@
# When integrated in to a monolithic kernel the spl module must appear
# first. This ensures its module initialization function is run before
# any of the other module initialization functions which depend on it.
ZFS_MODULES += spl/
ZFS_MODULES += avl/
ZFS_MODULES += icp/
ZFS_MODULES += lua/
ZFS_MODULES += nvpair/
ZFS_MODULES += unicode/
ZFS_MODULES += zcommon/
ZFS_MODULES += zfs/
ZFS_MODULES += zstd/
# The rest is only relevant when run by kbuild
ifneq ($(KERNELRELEASE),)
obj-$(CONFIG_ZFS) := $(ZFS_MODULES)
ZFS_MODULE_CFLAGS += -std=gnu99 -Wno-declaration-after-statement
ZFS_MODULE_CFLAGS += -Wmissing-prototypes
@ -22,10 +8,16 @@ ZFS_MODULE_CFLAGS += @KERNEL_DEBUG_CFLAGS@ @NO_FORMAT_ZERO_LENGTH@
ifneq ($(KBUILD_EXTMOD),)
zfs_include = @abs_top_srcdir@/include
icp_include = @abs_srcdir@/icp/include
zstd_include = @abs_srcdir@/zstd/include
ZFS_MODULE_CFLAGS += -include @abs_top_builddir@/zfs_config.h
ZFS_MODULE_CFLAGS += -I@abs_top_builddir@/include
src = @abs_srcdir@
obj = @abs_builddir@
else
zfs_include = $(srctree)/include/zfs
icp_include = $(srctree)/$(src)/icp/include
zstd_include = $(srctree)/$(src)/zstd/include
ZFS_MODULE_CFLAGS += -include $(zfs_include)/zfs_config.h
endif
@ -41,7 +33,404 @@ ifneq ($(KBUILD_EXTMOD),)
@CONFIG_QAT_TRUE@KBUILD_EXTRA_SYMBOLS += @QAT_SYMBOLS@
endif
subdir-asflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)
subdir-ccflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)
asflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)
ccflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)
# Suppress unused-value warnings in sparc64 architecture headers
ccflags-$(CONFIG_SPARC64) += -Wno-unused-value
obj-$(CONFIG_ZFS) := spl.o zfs.o
SPL_OBJS := \
spl-atomic.o \
spl-condvar.o \
spl-cred.o \
spl-err.o \
spl-generic.o \
spl-kmem-cache.o \
spl-kmem.o \
spl-kstat.o \
spl-proc.o \
spl-procfs-list.o \
spl-taskq.o \
spl-thread.o \
spl-trace.o \
spl-tsd.o \
spl-vmem.o \
spl-xdr.o \
spl-zlib.o
spl-objs += $(addprefix os/linux/spl/,$(SPL_OBJS))
zfs-objs += avl/avl.o
ICP_OBJS := \
algs/aes/aes_impl.o \
algs/aes/aes_impl_generic.o \
algs/aes/aes_modes.o \
algs/edonr/edonr.o \
algs/modes/cbc.o \
algs/modes/ccm.o \
algs/modes/ctr.o \
algs/modes/ecb.o \
algs/modes/gcm.o \
algs/modes/gcm_generic.o \
algs/modes/modes.o \
algs/sha2/sha2.o \
algs/skein/skein.o \
algs/skein/skein_block.o \
algs/skein/skein_iv.o \
api/kcf_cipher.o \
api/kcf_ctxops.o \
api/kcf_mac.o \
core/kcf_callprov.o \
core/kcf_mech_tabs.o \
core/kcf_prov_lib.o \
core/kcf_prov_tabs.o \
core/kcf_sched.o \
illumos-crypto.o \
io/aes.o \
io/sha2_mod.o \
io/skein_mod.o \
spi/kcf_spi.o
ICP_OBJS_X86_64 := \
asm-x86_64/aes/aes_aesni.o \
asm-x86_64/aes/aes_amd64.o \
asm-x86_64/aes/aeskey.o \
asm-x86_64/modes/aesni-gcm-x86_64.o \
asm-x86_64/modes/gcm_pclmulqdq.o \
asm-x86_64/modes/ghash-x86_64.o \
asm-x86_64/sha2/sha256_impl.o \
asm-x86_64/sha2/sha512_impl.o
ICP_OBJS_X86 := \
algs/aes/aes_impl_aesni.o \
algs/aes/aes_impl_x86-64.o \
algs/modes/gcm_pclmulqdq.o
zfs-objs += $(addprefix icp/,$(ICP_OBJS))
zfs-$(CONFIG_X86) += $(addprefix icp/,$(ICP_OBJS_X86))
zfs-$(CONFIG_X86_64) += $(addprefix icp/,$(ICP_OBJS_X86_64))
$(addprefix $(obj)/icp/,$(ICP_OBJS) $(ICP_OBJS_X86) $(ICP_OBJS_X86_64)) : asflags-y += -I$(icp_include)
$(addprefix $(obj)/icp/,$(ICP_OBJS) $(ICP_OBJS_X86) $(ICP_OBJS_X86_64)) : ccflags-y += -I$(icp_include)
# Suppress objtool "can't find jump dest instruction at" warnings. They
# are caused by the constants which are defined in the text section of the
# assembly file using .byte instructions (e.g. bswap_mask). The objtool
# utility tries to interpret them as opcodes and obviously fails doing so.
OBJECT_FILES_NON_STANDARD_aesni-gcm-x86_64.o := y
OBJECT_FILES_NON_STANDARD_ghash-x86_64.o := y
# Suppress objtool "unsupported stack pointer realignment" warnings. We are
# not using a DRAP register while aligning the stack to a 64 byte boundary.
# See #6950 for the reasoning.
OBJECT_FILES_NON_STANDARD_sha256_impl.o := y
OBJECT_FILES_NON_STANDARD_sha512_impl.o := y
LUA_OBJS := \
lapi.o \
lauxlib.o \
lbaselib.o \
lcode.o \
lcompat.o \
lcorolib.o \
lctype.o \
ldebug.o \
ldo.o \
lfunc.o \
lgc.o \
llex.o \
lmem.o \
lobject.o \
lopcodes.o \
lparser.o \
lstate.o \
lstring.o \
lstrlib.o \
ltable.o \
ltablib.o \
ltm.o \
lvm.o \
lzio.o \
setjmp/setjmp.o
zfs-objs += $(addprefix lua/,$(LUA_OBJS))
NVPAIR_OBJS := \
fnvpair.o \
nvpair.o \
nvpair_alloc_fixed.o \
nvpair_alloc_spl.o
zfs-objs += $(addprefix nvpair/,$(NVPAIR_OBJS))
UNICODE_OBJS := \
u8_textprep.o \
uconv.o
zfs-objs += $(addprefix unicode/,$(UNICODE_OBJS))
ZCOMMON_OBJS := \
cityhash.o \
zfeature_common.o \
zfs_comutil.o \
zfs_deleg.o \
zfs_fletcher.o \
zfs_fletcher_superscalar.o \
zfs_fletcher_superscalar4.o \
zfs_namecheck.o \
zfs_prop.o \
zpool_prop.o \
zprop_common.o
ZCOMMON_OBJS_X86 := \
zfs_fletcher_avx512.o \
zfs_fletcher_intel.o \
zfs_fletcher_sse.o
ZCOMMON_OBJS_ARM64 := \
zfs_fletcher_aarch64_neon.o
zfs-objs += $(addprefix zcommon/,$(ZCOMMON_OBJS))
zfs-$(CONFIG_X86) += $(addprefix zcommon/,$(ZCOMMON_OBJS_X86))
zfs-$(CONFIG_ARM64) += $(addprefix zcommon/,$(ZCOMMON_OBJS_ARM64))
# Zstd uses -O3 by default, so we should follow
ZFS_ZSTD_FLAGS := -O3
# -fno-tree-vectorize gets set for gcc in zstd/common/compiler.h
# Set it for other compilers, too.
ZFS_ZSTD_FLAGS += -fno-tree-vectorize
# SSE register return with SSE disabled if -march=znverX is passed
ZFS_ZSTD_FLAGS += -U__BMI__
# Quiet warnings about frame size due to unused code in unmodified zstd lib
ZFS_ZSTD_FLAGS += -Wframe-larger-than=20480
ZSTD_OBJS := \
zfs_zstd.o \
zstd_sparc.o
ZSTD_UPSTREAM_OBJS := \
lib/common/entropy_common.o \
lib/common/error_private.o \
lib/common/fse_decompress.o \
lib/common/pool.o \
lib/common/zstd_common.o \
lib/compress/fse_compress.o \
lib/compress/hist.o \
lib/compress/huf_compress.o \
lib/compress/zstd_compress.o \
lib/compress/zstd_compress_literals.o \
lib/compress/zstd_compress_sequences.o \
lib/compress/zstd_compress_superblock.o \
lib/compress/zstd_double_fast.o \
lib/compress/zstd_fast.o \
lib/compress/zstd_lazy.o \
lib/compress/zstd_ldm.o \
lib/compress/zstd_opt.o \
lib/decompress/huf_decompress.o \
lib/decompress/zstd_ddict.o \
lib/decompress/zstd_decompress.o \
lib/decompress/zstd_decompress_block.o
zfs-objs += $(addprefix zstd/,$(ZSTD_OBJS) $(ZSTD_UPSTREAM_OBJS))
# Disable aarch64 neon SIMD instructions for kernel mode
$(addprefix $(obj)/zstd/,$(ZSTD_OBJS) $(ZSTD_UPSTREAM_OBJS)) : ccflags-y += -I$(zstd_include) $(ZFS_ZSTD_FLAGS)
$(addprefix $(obj)/zstd/,$(ZSTD_OBJS) $(ZSTD_UPSTREAM_OBJS)) : asflags-y += -I$(zstd_include)
$(addprefix $(obj)/zstd/,$(ZSTD_UPSTREAM_OBJS)) : ccflags-y += -include $(zstd_include)/aarch64_compat.h -include $(zstd_include)/zstd_compat_wrapper.h -Wp,-w
$(obj)/zstd/zfs_zstd.o : ccflags-y += -include $(zstd_include)/zstd_compat_wrapper.h
ZFS_OBJS := \
abd.o \
aggsum.o \
arc.o \
blkptr.o \
bplist.o \
bpobj.o \
bptree.o \
bqueue.o \
btree.o \
dataset_kstats.o \
dbuf.o \
dbuf_stats.o \
ddt.o \
ddt_zap.o \
dmu.o \
dmu_diff.o \
dmu_object.o \
dmu_objset.o \
dmu_recv.o \
dmu_redact.o \
dmu_send.o \
dmu_traverse.o \
dmu_tx.o \
dmu_zfetch.o \
dnode.o \
dnode_sync.o \
dsl_bookmark.o \
dsl_crypt.o \
dsl_dataset.o \
dsl_deadlist.o \
dsl_deleg.o \
dsl_destroy.o \
dsl_dir.o \
dsl_pool.o \
dsl_prop.o \
dsl_scan.o \
dsl_synctask.o \
dsl_userhold.o \
edonr_zfs.o \
fm.o \
gzip.o \
hkdf.o \
lz4.o \
lz4_zfs.o \
lzjb.o \
metaslab.o \
mmp.o \
multilist.o \
objlist.o \
pathname.o \
range_tree.o \
refcount.o \
rrwlock.o \
sa.o \
sha256.o \
skein_zfs.o \
spa.o \
spa_boot.o \
spa_checkpoint.o \
spa_config.o \
spa_errlog.o \
spa_history.o \
spa_log_spacemap.o \
spa_misc.o \
spa_stats.o \
space_map.o \
space_reftree.o \
txg.o \
uberblock.o \
unique.o \
vdev.o \
vdev_cache.o \
vdev_draid.o \
vdev_draid_rand.o \
vdev_indirect.o \
vdev_indirect_births.o \
vdev_indirect_mapping.o \
vdev_initialize.o \
vdev_label.o \
vdev_mirror.o \
vdev_missing.o \
vdev_queue.o \
vdev_raidz.o \
vdev_raidz_math.o \
vdev_raidz_math_scalar.o \
vdev_rebuild.o \
vdev_removal.o \
vdev_root.o \
vdev_trim.o \
zap.o \
zap_leaf.o \
zap_micro.o \
zcp.o \
zcp_get.o \
zcp_global.o \
zcp_iter.o \
zcp_set.o \
zcp_synctask.o \
zfeature.o \
zfs_byteswap.o \
zfs_fm.o \
zfs_fuid.o \
zfs_ioctl.o \
zfs_log.o \
zfs_onexit.o \
zfs_quota.o \
zfs_ratelimit.o \
zfs_replay.o \
zfs_rlock.o \
zfs_sa.o \
zfs_vnops.o \
zil.o \
zio.o \
zio_checksum.o \
zio_compress.o \
zio_inject.o \
zle.o \
zrlock.o \
zthr.o \
zvol.o
ZFS_OBJS_OS := \
abd_os.o \
arc_os.o \
mmp_os.o \
policy.o \
qat.o \
qat_compress.o \
qat_crypt.o \
spa_misc_os.o \
trace.o \
vdev_disk.o \
vdev_file.o \
zfs_acl.o \
zfs_ctldir.o \
zfs_debug.o \
zfs_dir.o \
zfs_file_os.o \
zfs_ioctl_os.o \
zfs_racct.o \
zfs_sysfs.o \
zfs_uio.o \
zfs_vfsops.o \
zfs_vnops_os.o \
zfs_znode.o \
zio_crypt.o \
zpl_ctldir.o \
zpl_export.o \
zpl_file.o \
zpl_inode.o \
zpl_super.o \
zpl_xattr.o \
zvol_os.o
ZFS_OBJS_X86 := \
vdev_raidz_math_avx2.o \
vdev_raidz_math_avx512bw.o \
vdev_raidz_math_avx512f.o \
vdev_raidz_math_sse2.o \
vdev_raidz_math_ssse3.o
ZFS_OBJS_ARM64 := \
vdev_raidz_math_aarch64_neon.o \
vdev_raidz_math_aarch64_neonx2.o
ZFS_OBJS_PPC_PPC64 := \
vdev_raidz_math_powerpc_altivec.o
zfs-objs += $(addprefix zfs/,$(ZFS_OBJS)) $(addprefix os/linux/zfs/,$(ZFS_OBJS_OS))
zfs-$(CONFIG_X86) += $(addprefix zfs/,$(ZFS_OBJS_X86))
zfs-$(CONFIG_ARM64) += $(addprefix zfs/,$(ZFS_OBJS_ARM64))
zfs-$(CONFIG_PPC) += $(addprefix zfs/,$(ZFS_OBJS_PPC_PPC64))
zfs-$(CONFIG_PPC64) += $(addprefix zfs/,$(ZFS_OBJS_PPC_PPC64))
# Suppress incorrect warnings from versions of objtool which are not
# aware of x86 EVEX prefix instructions used for AVX512.
OBJECT_FILES_NON_STANDARD_vdev_raidz_math_avx512bw.o := y
OBJECT_FILES_NON_STANDARD_vdev_raidz_math_avx512f.o := y
ifeq ($(CONFIG_ALTIVEC),y)
$(obj)/zfs/vdev_raidz_math_powerpc_altivec.o : c_flags += -maltivec
endif

View File

@ -3,8 +3,6 @@ include Kbuild
INSTALL_MOD_DIR ?= extra
INSTALL_MOD_PATH ?= $(DESTDIR)
SUBDIR_TARGETS = icp lua zstd
all: modules
distclean maintainer-clean: clean
install: modules_install
@ -51,7 +49,8 @@ endif
FMAKE = env -u MAKEFLAGS make $(FMAKEFLAGS)
modules-Linux:
list='$(SUBDIR_TARGETS)'; for td in $$list; do $(MAKE) -C $$td; done
mkdir -p $(sort $(dir $(spl-objs) $(spl-)))
mkdir -p $(sort $(dir $(zfs-objs) $(zfs-)))
$(MAKE) -C @LINUX_OBJ@ $(if @KERNEL_CC@,CC=@KERNEL_CC@) \
$(if @KERNEL_LD@,LD=@KERNEL_LD@) $(if @KERNEL_LLVM@,LLVM=@KERNEL_LLVM@) \
M="$$PWD" @KERNEL_MAKE@ CONFIG_ZFS=m modules
@ -77,6 +76,7 @@ clean-FreeBSD:
clean: clean-@ac_system@
KMODDIR := $(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@
modules_install-Linux:
@# Install the kernel modules
$(MAKE) -C @LINUX_OBJ@ M="$$PWD" modules_install \
@ -84,9 +84,8 @@ modules_install-Linux:
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
KERNELRELEASE=@LINUX_VERSION@
@# Remove extraneous build products when packaging
kmoddir=$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \
if [ -n "$(DESTDIR)" ]; then \
find $$kmoddir -name 'modules.*' -delete; \
find $(KMODDIR) -name 'modules.*' -delete; \
fi
@# Debian ships tiny fake System.map files that are
@# syntactically valid but just say
@ -109,10 +108,7 @@ modules_install: modules_install-@ac_system@
modules_uninstall-Linux:
@# Uninstall the kernel modules
kmoddir=$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \
for objdir in $(ZFS_MODULES); do \
$(RM) -R $$kmoddir/$(INSTALL_MOD_DIR)/$$objdir; \
done
$(RM) $(addprefix $(KMODDIR)/$(INSTALL_MOD_DIR)/,zfs.ko spl.ko)
modules_uninstall-FreeBSD:
@false
@ -134,7 +130,7 @@ cppcheck-Linux:
-I @top_srcdir@/include/os/linux/spl \
-I @top_srcdir@/include/os/linux/zfs \
-I @top_srcdir@/include \
avl icp lua nvpair spl unicode zcommon zfs zstd os/linux
avl icp lua nvpair unicode zcommon zfs zstd os/linux
cppcheck-FreeBSD:
@true
@ -142,9 +138,11 @@ cppcheck-FreeBSD:
cppcheck: cppcheck-@ac_system@
distdir:
(cd @srcdir@ && find $(ZFS_MODULES) os -name '*.[chS]') | \
while read path; do \
mkdir -p $$distdir/$${path%/*}; \
cp @srcdir@/$$path $$distdir/$$path; \
done; \
cd @srcdir@ && find . -name '*.[chS]' -exec sh -c 'for f; do mkdir -p $$distdir/$${f%/*}; cp @srcdir@/$$f $$distdir/$$f; done' _ {} +
cp @srcdir@/Makefile.bsd $$distdir/Makefile.bsd
gen-zstd-symbols:
for obj in $(addprefix zstd/,$(ZSTD_UPSTREAM_OBJS)); do echo; echo "/* $${obj#zstd/}: */"; @OBJDUMP@ -t $$obj | awk '$$2 == "g" && !/ zfs_/ {print "#define\t" $$6 " zfs_" $$6}' | sort; done >> zstd/include/zstd_compat_wrapper.h
check-zstd-symbols:
@OBJDUMP@ -t $(addprefix zstd/,$(ZSTD_UPSTREAM_OBJS)) | awk '/file format/ {print} $$2 == "g" && !/ zfs_/ {++ret; print} END {exit ret}'

View File

@ -1,10 +0,0 @@
ifneq ($(KBUILD_EXTMOD),)
src = @abs_srcdir@
obj = @abs_builddir@
endif
MODULE := zavl
obj-$(CONFIG_ZFS) := $(MODULE).o
$(MODULE)-objs += avl.o

View File

@ -1044,28 +1044,6 @@ done:
return (AVL_NODE2DATA(node, off));
}
#if defined(_KERNEL)
static int __init
avl_init(void)
{
return (0);
}
static void __exit
avl_fini(void)
{
}
module_init(avl_init);
module_exit(avl_fini);
#endif
ZFS_MODULE_DESCRIPTION("Generic AVL tree implementation");
ZFS_MODULE_AUTHOR(ZFS_META_AUTHOR);
ZFS_MODULE_LICENSE(ZFS_META_LICENSE);
ZFS_MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
EXPORT_SYMBOL(avl_create);
EXPORT_SYMBOL(avl_find);
EXPORT_SYMBOL(avl_insert);

View File

@ -1,90 +0,0 @@
ifneq ($(KBUILD_EXTMOD),)
src = @abs_srcdir@
obj = @abs_builddir@
icp_include = $(src)/include
else
icp_include = $(srctree)/$(src)/include
endif
MODULE := icp
obj-$(CONFIG_ZFS) := $(MODULE).o
asflags-y := -I$(icp_include)
ccflags-y := -I$(icp_include)
$(MODULE)-objs += illumos-crypto.o
$(MODULE)-objs += api/kcf_cipher.o
$(MODULE)-objs += api/kcf_mac.o
$(MODULE)-objs += api/kcf_ctxops.o
$(MODULE)-objs += core/kcf_callprov.o
$(MODULE)-objs += core/kcf_prov_tabs.o
$(MODULE)-objs += core/kcf_sched.o
$(MODULE)-objs += core/kcf_mech_tabs.o
$(MODULE)-objs += core/kcf_prov_lib.o
$(MODULE)-objs += spi/kcf_spi.o
$(MODULE)-objs += io/aes.o
$(MODULE)-objs += io/sha2_mod.o
$(MODULE)-objs += io/skein_mod.o
$(MODULE)-objs += algs/modes/cbc.o
$(MODULE)-objs += algs/modes/ccm.o
$(MODULE)-objs += algs/modes/ctr.o
$(MODULE)-objs += algs/modes/ecb.o
$(MODULE)-objs += algs/modes/gcm_generic.o
$(MODULE)-objs += algs/modes/gcm.o
$(MODULE)-objs += algs/modes/modes.o
$(MODULE)-objs += algs/aes/aes_impl_generic.o
$(MODULE)-objs += algs/aes/aes_impl.o
$(MODULE)-objs += algs/aes/aes_modes.o
$(MODULE)-objs += algs/edonr/edonr.o
$(MODULE)-objs += algs/sha2/sha2.o
$(MODULE)-objs += algs/skein/skein.o
$(MODULE)-objs += algs/skein/skein_block.o
$(MODULE)-objs += algs/skein/skein_iv.o
$(MODULE)-$(CONFIG_X86_64) += asm-x86_64/aes/aeskey.o
$(MODULE)-$(CONFIG_X86_64) += asm-x86_64/aes/aes_amd64.o
$(MODULE)-$(CONFIG_X86_64) += asm-x86_64/aes/aes_aesni.o
$(MODULE)-$(CONFIG_X86_64) += asm-x86_64/modes/gcm_pclmulqdq.o
$(MODULE)-$(CONFIG_X86_64) += asm-x86_64/modes/aesni-gcm-x86_64.o
$(MODULE)-$(CONFIG_X86_64) += asm-x86_64/modes/ghash-x86_64.o
$(MODULE)-$(CONFIG_X86_64) += asm-x86_64/sha2/sha256_impl.o
$(MODULE)-$(CONFIG_X86_64) += asm-x86_64/sha2/sha512_impl.o
$(MODULE)-$(CONFIG_X86) += algs/modes/gcm_pclmulqdq.o
$(MODULE)-$(CONFIG_X86) += algs/aes/aes_impl_aesni.o
$(MODULE)-$(CONFIG_X86) += algs/aes/aes_impl_x86-64.o
# Suppress objtool "can't find jump dest instruction at" warnings. They
# are caused by the constants which are defined in the text section of the
# assembly file using .byte instructions (e.g. bswap_mask). The objtool
# utility tries to interpret them as opcodes and obviously fails doing so.
OBJECT_FILES_NON_STANDARD_aesni-gcm-x86_64.o := y
OBJECT_FILES_NON_STANDARD_ghash-x86_64.o := y
# Suppress objtool "unsupported stack pointer realignment" warnings. We are
# not using a DRAP register while aligning the stack to a 64 byte boundary.
# See #6950 for the reasoning.
OBJECT_FILES_NON_STANDARD_sha256_impl.o := y
OBJECT_FILES_NON_STANDARD_sha512_impl.o := y
ICP_DIRS = \
api \
core \
spi \
io \
os \
algs \
algs/aes \
algs/edonr \
algs/modes \
algs/sha2 \
algs/skein \
asm-x86_64 \
asm-x86_64/aes \
asm-x86_64/modes \
asm-x86_64/sha2 \
asm-i386 \
asm-generic
all:
mkdir -p $(ICP_DIRS)

View File

@ -104,7 +104,7 @@
* ZFS Makefiles.
*/
void __exit
void
icp_fini(void)
{
skein_mod_fini();
@ -139,10 +139,7 @@ icp_init(void)
return (0);
}
#if defined(_KERNEL)
#if defined(_KERNEL) && defined(__FreeBSD__)
module_exit(icp_fini);
module_init(icp_init);
MODULE_AUTHOR(ZFS_META_AUTHOR);
MODULE_LICENSE(ZFS_META_LICENSE);
MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
#endif

View File

@ -1,39 +0,0 @@
ifneq ($(KBUILD_EXTMOD),)
src = @abs_srcdir@
obj = @abs_builddir@
endif
MODULE := zlua
obj-$(CONFIG_ZFS) := $(MODULE).o
ccflags-y := -DLUA_USE_LONGLONG
$(MODULE)-objs += lapi.o
$(MODULE)-objs += lauxlib.o
$(MODULE)-objs += lbaselib.o
$(MODULE)-objs += lcode.o
$(MODULE)-objs += lcompat.o
$(MODULE)-objs += lcorolib.o
$(MODULE)-objs += lctype.o
$(MODULE)-objs += ldebug.o
$(MODULE)-objs += ldo.o
$(MODULE)-objs += lfunc.o
$(MODULE)-objs += lgc.o
$(MODULE)-objs += llex.o
$(MODULE)-objs += lmem.o
$(MODULE)-objs += lobject.o
$(MODULE)-objs += lopcodes.o
$(MODULE)-objs += lparser.o
$(MODULE)-objs += lstate.o
$(MODULE)-objs += lstring.o
$(MODULE)-objs += lstrlib.o
$(MODULE)-objs += ltable.o
$(MODULE)-objs += ltablib.o
$(MODULE)-objs += ltm.o
$(MODULE)-objs += lvm.o
$(MODULE)-objs += lzio.o
$(MODULE)-objs += setjmp/setjmp.o
all:
mkdir -p setjmp

View File

@ -1278,29 +1278,6 @@ LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1,
luaC_objbarrier(L, f1, *up2);
}
#if defined(_KERNEL)
static int __init
lua_init(void)
{
return (0);
}
static void __exit
lua_fini(void)
{
}
module_init(lua_init);
module_exit(lua_fini);
#endif
ZFS_MODULE_DESCRIPTION("Lua Interpreter for ZFS");
ZFS_MODULE_AUTHOR("Lua.org");
ZFS_MODULE_LICENSE("Dual MIT/GPL");
ZFS_MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
EXPORT_SYMBOL(lua_absindex);
EXPORT_SYMBOL(lua_atpanic);
EXPORT_SYMBOL(lua_checkstack);

View File

@ -1,13 +0,0 @@
ifneq ($(KBUILD_EXTMOD),)
src = @abs_srcdir@
obj = @abs_builddir@
endif
MODULE := znvpair
obj-$(CONFIG_ZFS) := $(MODULE).o
$(MODULE)-objs += nvpair.o
$(MODULE)-objs += fnvpair.o
$(MODULE)-objs += nvpair_alloc_spl.o
$(MODULE)-objs += nvpair_alloc_fixed.o

View File

@ -3678,27 +3678,6 @@ nvs_xdr(nvstream_t *nvs, nvlist_t *nvl, char *buf, size_t *buflen)
return (err);
}
#if defined(_KERNEL)
static int __init
nvpair_init(void)
{
return (0);
}
static void __exit
nvpair_fini(void)
{
}
module_init(nvpair_init);
module_exit(nvpair_fini);
#endif
ZFS_MODULE_DESCRIPTION("Generic name/value pair implementation");
ZFS_MODULE_AUTHOR(ZFS_META_AUTHOR);
ZFS_MODULE_LICENSE(ZFS_META_LICENSE);
ZFS_MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
EXPORT_SYMBOL(nv_alloc_init);
EXPORT_SYMBOL(nv_alloc_reset);
EXPORT_SYMBOL(nv_alloc_fini);

View File

@ -1,17 +0,0 @@
$(MODULE)-objs += ../os/linux/spl/spl-atomic.o
$(MODULE)-objs += ../os/linux/spl/spl-condvar.o
$(MODULE)-objs += ../os/linux/spl/spl-cred.o
$(MODULE)-objs += ../os/linux/spl/spl-err.o
$(MODULE)-objs += ../os/linux/spl/spl-generic.o
$(MODULE)-objs += ../os/linux/spl/spl-kmem.o
$(MODULE)-objs += ../os/linux/spl/spl-kmem-cache.o
$(MODULE)-objs += ../os/linux/spl/spl-kstat.o
$(MODULE)-objs += ../os/linux/spl/spl-proc.o
$(MODULE)-objs += ../os/linux/spl/spl-procfs-list.o
$(MODULE)-objs += ../os/linux/spl/spl-taskq.o
$(MODULE)-objs += ../os/linux/spl/spl-thread.o
$(MODULE)-objs += ../os/linux/spl/spl-trace.o
$(MODULE)-objs += ../os/linux/spl/spl-tsd.o
$(MODULE)-objs += ../os/linux/spl/spl-vmem.o
$(MODULE)-objs += ../os/linux/spl/spl-xdr.o
$(MODULE)-objs += ../os/linux/spl/spl-zlib.o

View File

@ -828,7 +828,7 @@ spl_fini(void)
module_init(spl_init);
module_exit(spl_fini);
ZFS_MODULE_DESCRIPTION("Solaris Porting Layer");
ZFS_MODULE_AUTHOR(ZFS_META_AUTHOR);
ZFS_MODULE_LICENSE("GPL");
ZFS_MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
MODULE_DESCRIPTION("Solaris Porting Layer");
MODULE_AUTHOR(ZFS_META_AUTHOR);
MODULE_LICENSE("GPL");
MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);

View File

@ -1,38 +0,0 @@
#
# Linux specific sources included from module/zfs/Makefile.in
#
# Suppress unused-value warnings in sparc64 architecture headers
ccflags-$(CONFIG_SPARC64) += -Wno-unused-value
$(MODULE)-objs += ../os/linux/zfs/abd_os.o
$(MODULE)-objs += ../os/linux/zfs/arc_os.o
$(MODULE)-objs += ../os/linux/zfs/mmp_os.o
$(MODULE)-objs += ../os/linux/zfs/policy.o
$(MODULE)-objs += ../os/linux/zfs/trace.o
$(MODULE)-objs += ../os/linux/zfs/qat.o
$(MODULE)-objs += ../os/linux/zfs/qat_compress.o
$(MODULE)-objs += ../os/linux/zfs/qat_crypt.o
$(MODULE)-objs += ../os/linux/zfs/spa_misc_os.o
$(MODULE)-objs += ../os/linux/zfs/vdev_disk.o
$(MODULE)-objs += ../os/linux/zfs/vdev_file.o
$(MODULE)-objs += ../os/linux/zfs/zfs_acl.o
$(MODULE)-objs += ../os/linux/zfs/zfs_ctldir.o
$(MODULE)-objs += ../os/linux/zfs/zfs_debug.o
$(MODULE)-objs += ../os/linux/zfs/zfs_dir.o
$(MODULE)-objs += ../os/linux/zfs/zfs_file_os.o
$(MODULE)-objs += ../os/linux/zfs/zfs_ioctl_os.o
$(MODULE)-objs += ../os/linux/zfs/zfs_racct.o
$(MODULE)-objs += ../os/linux/zfs/zfs_sysfs.o
$(MODULE)-objs += ../os/linux/zfs/zfs_uio.o
$(MODULE)-objs += ../os/linux/zfs/zfs_vfsops.o
$(MODULE)-objs += ../os/linux/zfs/zfs_vnops_os.o
$(MODULE)-objs += ../os/linux/zfs/zfs_znode.o
$(MODULE)-objs += ../os/linux/zfs/zio_crypt.o
$(MODULE)-objs += ../os/linux/zfs/zpl_ctldir.o
$(MODULE)-objs += ../os/linux/zfs/zpl_export.o
$(MODULE)-objs += ../os/linux/zfs/zpl_file.o
$(MODULE)-objs += ../os/linux/zfs/zpl_inode.o
$(MODULE)-objs += ../os/linux/zfs/zpl_super.o
$(MODULE)-objs += ../os/linux/zfs/zpl_xattr.o
$(MODULE)-objs += ../os/linux/zfs/zvol_os.o

View File

@ -58,6 +58,8 @@
#include <sys/zvol.h>
#include <sys/fm/util.h>
#include <sys/dsl_crypt.h>
#include <sys/crypto/icp.h>
#include <sys/zstd/zstd.h>
#include <sys/zfs_ioctl_impl.h>
@ -233,8 +235,8 @@ zfsdev_detach(void)
#define ZFS_DEBUG_STR ""
#endif
static int __init
openzfs_init(void)
static int
openzfs_init_os(void)
{
int error;
@ -259,8 +261,8 @@ openzfs_init(void)
return (0);
}
static void __exit
openzfs_fini(void)
static void
openzfs_fini_os(void)
{
zfs_sysfs_fini();
zfs_kmod_fini();
@ -269,12 +271,59 @@ openzfs_fini(void)
ZFS_META_VERSION, ZFS_META_RELEASE, ZFS_DEBUG_STR);
}
extern int __init zcommon_init(void);
extern void zcommon_fini(void);
static int __init
openzfs_init(void)
{
int err;
if ((err = zcommon_init()) != 0)
goto zcommon_failed;
if ((err = icp_init()) != 0)
goto icp_failed;
if ((err = zstd_init()) != 0)
goto zstd_failed;
if ((err = openzfs_init_os()) != 0)
goto openzfs_os_failed;
return (0);
openzfs_os_failed:
zstd_fini();
zstd_failed:
icp_fini();
icp_failed:
zcommon_fini();
zcommon_failed:
return (err);
}
static void __exit
openzfs_fini(void)
{
openzfs_fini_os();
zstd_fini();
icp_fini();
zcommon_fini();
}
#if defined(_KERNEL)
module_init(openzfs_init);
module_exit(openzfs_fini);
#endif
ZFS_MODULE_DESCRIPTION("ZFS");
ZFS_MODULE_AUTHOR(ZFS_META_AUTHOR);
ZFS_MODULE_LICENSE(ZFS_META_LICENSE);
ZFS_MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
MODULE_ALIAS("zavl");
MODULE_ALIAS("icp");
MODULE_ALIAS("zlua");
MODULE_ALIAS("znvpair");
MODULE_ALIAS("zunicode");
MODULE_ALIAS("zcommon");
MODULE_ALIAS("zzstd");
MODULE_DESCRIPTION("ZFS");
MODULE_AUTHOR(ZFS_META_AUTHOR);
MODULE_LICENSE("Lua: MIT");
MODULE_LICENSE("zstd: Dual BSD/GPL");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_LICENSE(ZFS_META_LICENSE);
MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);

View File

@ -1,13 +0,0 @@
ifneq ($(KBUILD_EXTMOD),)
src = @abs_srcdir@
obj = @abs_builddir@
mfdir = $(obj)
else
mfdir = $(srctree)/$(src)
endif
MODULE := spl
obj-$(CONFIG_ZFS) := $(MODULE).o
include $(mfdir)/../os/linux/spl/Makefile

View File

@ -1,11 +0,0 @@
ifneq ($(KBUILD_EXTMOD),)
src = @abs_srcdir@
obj = @abs_builddir@
endif
MODULE := zunicode
obj-$(CONFIG_ZFS) := $(MODULE).o
$(MODULE)-objs += u8_textprep.o
$(MODULE)-objs += uconv.o

View File

@ -2129,27 +2129,6 @@ u8_textprep_str(char *inarray, size_t *inlen, char *outarray, size_t *outlen,
return (ret_val);
}
#if defined(_KERNEL)
static int __init
unicode_init(void)
{
return (0);
}
static void __exit
unicode_fini(void)
{
}
module_init(unicode_init);
module_exit(unicode_fini);
#endif
ZFS_MODULE_DESCRIPTION("Unicode implementation");
ZFS_MODULE_AUTHOR(ZFS_META_AUTHOR);
ZFS_MODULE_LICENSE(ZFS_META_LICENSE);
ZFS_MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
EXPORT_SYMBOL(u8_validate);
EXPORT_SYMBOL(u8_strcmp);
EXPORT_SYMBOL(u8_textprep_str);

View File

@ -1,28 +0,0 @@
ifneq ($(KBUILD_EXTMOD),)
src = @abs_srcdir@
obj = @abs_builddir@
endif
MODULE := zcommon
obj-$(CONFIG_ZFS) := $(MODULE).o
# Suppress unused-value warnings in sparc64 architecture headers
ccflags-$(CONFIG_SPARC64) += -Wno-unused-value
$(MODULE)-objs += cityhash.o
$(MODULE)-objs += zfeature_common.o
$(MODULE)-objs += zfs_comutil.o
$(MODULE)-objs += zfs_deleg.o
$(MODULE)-objs += zfs_fletcher.o
$(MODULE)-objs += zfs_fletcher_superscalar.o
$(MODULE)-objs += zfs_fletcher_superscalar4.o
$(MODULE)-objs += zfs_namecheck.o
$(MODULE)-objs += zfs_prop.o
$(MODULE)-objs += zpool_prop.o
$(MODULE)-objs += zprop_common.o
$(MODULE)-$(CONFIG_X86) += zfs_fletcher_intel.o
$(MODULE)-$(CONFIG_X86) += zfs_fletcher_sse.o
$(MODULE)-$(CONFIG_X86) += zfs_fletcher_avx512.o
$(MODULE)-$(CONFIG_ARM64) += zfs_fletcher_aarch64_neon.o

View File

@ -1006,7 +1006,10 @@ uint8_t **zfs_kfpu_fpregs;
EXPORT_SYMBOL(zfs_kfpu_fpregs);
#endif /* defined(HAVE_KERNEL_FPU_INTERNAL) */
static int __init
extern int __init zcommon_init(void);
extern void zcommon_fini(void);
int __init
zcommon_init(void)
{
int error = kfpu_init();
@ -1018,22 +1021,19 @@ zcommon_init(void)
return (0);
}
static void __exit
void
zcommon_fini(void)
{
fletcher_4_fini();
kfpu_fini();
}
#ifdef __FreeBSD__
module_init_early(zcommon_init);
module_exit(zcommon_fini);
#endif
ZFS_MODULE_DESCRIPTION("Generic ZFS support");
ZFS_MODULE_AUTHOR(ZFS_META_AUTHOR);
ZFS_MODULE_LICENSE(ZFS_META_LICENSE);
ZFS_MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
#endif
/* zfs dataset property functions */
EXPORT_SYMBOL(zfs_userquota_prop_prefixes);

View File

@ -1,158 +0,0 @@
ifneq ($(KBUILD_EXTMOD),)
src = @abs_srcdir@
obj = @abs_builddir@
mfdir = $(obj)
else
mfdir = $(srctree)/$(src)
endif
MODULE := zfs
obj-$(CONFIG_ZFS) := $(MODULE).o
# Suppress unused-value warnings in sparc64 architecture headers
ccflags-$(CONFIG_SPARC64) += -Wno-unused-value
$(MODULE)-objs += abd.o
$(MODULE)-objs += aggsum.o
$(MODULE)-objs += arc.o
$(MODULE)-objs += blkptr.o
$(MODULE)-objs += bplist.o
$(MODULE)-objs += bpobj.o
$(MODULE)-objs += bptree.o
$(MODULE)-objs += btree.o
$(MODULE)-objs += bqueue.o
$(MODULE)-objs += dataset_kstats.o
$(MODULE)-objs += dbuf.o
$(MODULE)-objs += dbuf_stats.o
$(MODULE)-objs += ddt.o
$(MODULE)-objs += ddt_zap.o
$(MODULE)-objs += dmu.o
$(MODULE)-objs += dmu_diff.o
$(MODULE)-objs += dmu_object.o
$(MODULE)-objs += dmu_objset.o
$(MODULE)-objs += dmu_recv.o
$(MODULE)-objs += dmu_redact.o
$(MODULE)-objs += dmu_send.o
$(MODULE)-objs += dmu_traverse.o
$(MODULE)-objs += dmu_tx.o
$(MODULE)-objs += dmu_zfetch.o
$(MODULE)-objs += dnode.o
$(MODULE)-objs += dnode_sync.o
$(MODULE)-objs += dsl_bookmark.o
$(MODULE)-objs += dsl_crypt.o
$(MODULE)-objs += dsl_dataset.o
$(MODULE)-objs += dsl_deadlist.o
$(MODULE)-objs += dsl_deleg.o
$(MODULE)-objs += dsl_destroy.o
$(MODULE)-objs += dsl_dir.o
$(MODULE)-objs += dsl_pool.o
$(MODULE)-objs += dsl_prop.o
$(MODULE)-objs += dsl_scan.o
$(MODULE)-objs += dsl_synctask.o
$(MODULE)-objs += dsl_userhold.o
$(MODULE)-objs += edonr_zfs.o
$(MODULE)-objs += fm.o
$(MODULE)-objs += gzip.o
$(MODULE)-objs += hkdf.o
$(MODULE)-objs += lz4.o
$(MODULE)-objs += lz4_zfs.o
$(MODULE)-objs += lzjb.o
$(MODULE)-objs += metaslab.o
$(MODULE)-objs += mmp.o
$(MODULE)-objs += multilist.o
$(MODULE)-objs += objlist.o
$(MODULE)-objs += pathname.o
$(MODULE)-objs += range_tree.o
$(MODULE)-objs += refcount.o
$(MODULE)-objs += rrwlock.o
$(MODULE)-objs += sa.o
$(MODULE)-objs += sha256.o
$(MODULE)-objs += skein_zfs.o
$(MODULE)-objs += spa.o
$(MODULE)-objs += spa_boot.o
$(MODULE)-objs += spa_checkpoint.o
$(MODULE)-objs += spa_config.o
$(MODULE)-objs += spa_errlog.o
$(MODULE)-objs += spa_history.o
$(MODULE)-objs += spa_log_spacemap.o
$(MODULE)-objs += spa_misc.o
$(MODULE)-objs += spa_stats.o
$(MODULE)-objs += space_map.o
$(MODULE)-objs += space_reftree.o
$(MODULE)-objs += txg.o
$(MODULE)-objs += uberblock.o
$(MODULE)-objs += unique.o
$(MODULE)-objs += vdev.o
$(MODULE)-objs += vdev_cache.o
$(MODULE)-objs += vdev_draid.o
$(MODULE)-objs += vdev_draid_rand.o
$(MODULE)-objs += vdev_indirect.o
$(MODULE)-objs += vdev_indirect_births.o
$(MODULE)-objs += vdev_indirect_mapping.o
$(MODULE)-objs += vdev_initialize.o
$(MODULE)-objs += vdev_label.o
$(MODULE)-objs += vdev_mirror.o
$(MODULE)-objs += vdev_missing.o
$(MODULE)-objs += vdev_queue.o
$(MODULE)-objs += vdev_raidz.o
$(MODULE)-objs += vdev_raidz_math.o
$(MODULE)-objs += vdev_raidz_math_scalar.o
$(MODULE)-objs += vdev_rebuild.o
$(MODULE)-objs += vdev_removal.o
$(MODULE)-objs += vdev_root.o
$(MODULE)-objs += vdev_trim.o
$(MODULE)-objs += zap.o
$(MODULE)-objs += zap_leaf.o
$(MODULE)-objs += zap_micro.o
$(MODULE)-objs += zcp.o
$(MODULE)-objs += zcp_get.o
$(MODULE)-objs += zcp_global.o
$(MODULE)-objs += zcp_iter.o
$(MODULE)-objs += zcp_set.o
$(MODULE)-objs += zcp_synctask.o
$(MODULE)-objs += zfeature.o
$(MODULE)-objs += zfs_byteswap.o
$(MODULE)-objs += zfs_fm.o
$(MODULE)-objs += zfs_fuid.o
$(MODULE)-objs += zfs_ioctl.o
$(MODULE)-objs += zfs_log.o
$(MODULE)-objs += zfs_onexit.o
$(MODULE)-objs += zfs_quota.o
$(MODULE)-objs += zfs_ratelimit.o
$(MODULE)-objs += zfs_replay.o
$(MODULE)-objs += zfs_rlock.o
$(MODULE)-objs += zfs_sa.o
$(MODULE)-objs += zfs_vnops.o
$(MODULE)-objs += zil.o
$(MODULE)-objs += zio.o
$(MODULE)-objs += zio_checksum.o
$(MODULE)-objs += zio_compress.o
$(MODULE)-objs += zio_inject.o
$(MODULE)-objs += zle.o
$(MODULE)-objs += zrlock.o
$(MODULE)-objs += zthr.o
$(MODULE)-objs += zvol.o
# Suppress incorrect warnings from versions of objtool which are not
# aware of x86 EVEX prefix instructions used for AVX512.
OBJECT_FILES_NON_STANDARD_vdev_raidz_math_avx512bw.o := y
OBJECT_FILES_NON_STANDARD_vdev_raidz_math_avx512f.o := y
$(MODULE)-$(CONFIG_X86) += vdev_raidz_math_sse2.o
$(MODULE)-$(CONFIG_X86) += vdev_raidz_math_ssse3.o
$(MODULE)-$(CONFIG_X86) += vdev_raidz_math_avx2.o
$(MODULE)-$(CONFIG_X86) += vdev_raidz_math_avx512f.o
$(MODULE)-$(CONFIG_X86) += vdev_raidz_math_avx512bw.o
$(MODULE)-$(CONFIG_ARM64) += vdev_raidz_math_aarch64_neon.o
$(MODULE)-$(CONFIG_ARM64) += vdev_raidz_math_aarch64_neonx2.o
$(MODULE)-$(CONFIG_PPC) += vdev_raidz_math_powerpc_altivec.o
$(MODULE)-$(CONFIG_PPC64) += vdev_raidz_math_powerpc_altivec.o
ifeq ($(CONFIG_ALTIVEC),y)
$(obj)/vdev_raidz_math_powerpc_altivec.o: c_flags += -maltivec
endif
include $(mfdir)/../os/linux/zfs/Makefile

View File

@ -1,69 +0,0 @@
ifneq ($(KBUILD_EXTMOD),)
src = @abs_srcdir@
obj = @abs_builddir@
zstd_include = $(src)/include
else
zstd_include = $(srctree)/$(src)/include
endif
MODULE := zzstd
obj-$(CONFIG_ZFS) := $(MODULE).o
asflags-y := -I$(zstd_include)
ccflags-y := -I$(zstd_include)
# Zstd uses -O3 by default, so we should follow
ccflags-y += -O3
# -fno-tree-vectorize gets set for gcc in zstd/common/compiler.h
# Set it for other compilers, too.
common_flags := -fno-tree-vectorize
# SSE register return with SSE disabled if -march=znverX is passed
common_flags += -U__BMI__
# Quiet warnings about frame size due to unused code in unmodified zstd lib
common_flags += -Wframe-larger-than=20480
ccflags-y += $(common_flags)
vanilla-objs := lib/common/entropy_common.o \
lib/common/error_private.o \
lib/common/fse_decompress.o \
lib/common/pool.o \
lib/common/zstd_common.o \
lib/compress/fse_compress.o \
lib/compress/hist.o \
lib/compress/huf_compress.o \
lib/compress/zstd_compress_literals.o \
lib/compress/zstd_compress_sequences.o \
lib/compress/zstd_compress_superblock.o \
lib/compress/zstd_compress.o \
lib/compress/zstd_double_fast.o \
lib/compress/zstd_fast.o \
lib/compress/zstd_lazy.o \
lib/compress/zstd_ldm.o \
lib/compress/zstd_opt.o \
lib/decompress/huf_decompress.o \
lib/decompress/zstd_ddict.o \
lib/decompress/zstd_decompress.o \
lib/decompress/zstd_decompress_block.o
# Disable aarch64 neon SIMD instructions for kernel mode
$(addprefix $(obj)/,$(vanilla-objs)) : ccflags-y += -include $(zstd_include)/aarch64_compat.h -include $(zstd_include)/zstd_compat_wrapper.h -Wp,-w $(common_flags)
$(obj)/zfs_zstd.o: ccflags-y += -include $(zstd_include)/zstd_compat_wrapper.h $(common_flags)
$(MODULE)-objs += zfs_zstd.o
$(MODULE)-objs += zstd_sparc.o
$(MODULE)-objs += $(vanilla-objs)
all:
mkdir -p lib/common lib/compress lib/decompress
gensymbols:
for obj in $(vanilla-objs); do echo; echo "/* $$obj: */"; @OBJDUMP@ -t $$obj | awk '$$2 == "g" && !/ zfs_/ {print "#define\t" $$6 " zfs_" $$6}' | sort; done >> include/zstd_compat_wrapper.h
checksymbols:
@OBJDUMP@ -t $(vanilla-objs) | awk '/file format/ {print} $$2 == "g" && !/ zfs_/ {++ret; print} END {exit ret}'

View File

@ -9,7 +9,7 @@ library, besides upgrading to a newer ZSTD release.
Tree structure:
* `zfs_zstd.c` is the actual `zzstd` kernel module.
* `zfs_zstd.c` are the actual `zfs` kernel module hooks.
* `lib/` contains the unmodified version of the `Zstandard` library
* `zstd-in.c` is our template file for generating the single-file library
* `include/`: This directory contains supplemental includes for platform
@ -25,16 +25,7 @@ To update ZSTD the following steps need to be taken:
`grep include [path to zstd]/contrib/single_file_libs/zstd-in.c | awk '{ print $2 }'`
3. Remove debug.c, threading.c, and zstdmt_compress.c.
4. Update Makefiles with resulting file lists.
~~~
Note: if the zstd library for zfs is updated to a newer version,
the macro list in include/zstd_compat_wrapper.h usually needs to be updated.
this can be done with some hand crafting of the output of the following
script (on the object file generated from the "single-file library" script in zstd's
contrib/single_file_libs):
`nm zstd.o | awk '{print "#define "$3 " zfs_" $3}' > macrotable`
5. Follow symbol renaming notes in `include/zstd_compat_wrapper.h`
## Altering ZSTD and breaking changes

View File

@ -38,7 +38,7 @@
* This will cause a symbol collision with the older in-kernel zstd library.
*
* On update, truncate this file at the scissor line, rebuild the module,
* and make gensymbols.
* and make gen-zstd-symbols.
*/
#define MEM_MODULE

View File

@ -702,7 +702,7 @@ zstd_meminit(void)
}
/* Release object from pool and free memory */
static void __exit
static void
release_pool(struct zstd_pool *pool)
{
mutex_destroy(&pool->barrier);
@ -712,7 +712,7 @@ release_pool(struct zstd_pool *pool)
}
/* Release memory pool objects */
static void __exit
static void
zstd_mempool_deinit(void)
{
for (int i = 0; i < ZSTD_POOL_MAX; i++) {
@ -758,7 +758,7 @@ zstd_init(void)
return (0);
}
extern void __exit
extern void
zstd_fini(void)
{
/* Deinitialize kstat */
@ -776,12 +776,10 @@ zstd_fini(void)
}
#if defined(_KERNEL)
#ifdef __FreeBSD__
module_init(zstd_init);
module_exit(zstd_fini);
ZFS_MODULE_DESCRIPTION("ZSTD Compression for ZFS");
ZFS_MODULE_LICENSE("Dual BSD/GPL");
ZFS_MODULE_VERSION(ZSTD_VERSION_STRING "a");
#endif
EXPORT_SYMBOL(zfs_zstd_compress);
EXPORT_SYMBOL(zfs_zstd_decompress_level);

View File

@ -162,7 +162,7 @@ for kernel_version in %{?kernel_versions}; do
cd ..
done
# find-debuginfo.sh only considers executables
chmod u+x ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/*/extra/*/*/*
chmod u+x ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/*/extra/*/*
%{?akmod_install}

View File

@ -82,7 +82,7 @@ make install \
%{__rm} -f %{buildroot}/lib/modules/%{kverrel}/modules.*
# find-debuginfo.sh only considers executables
%{__chmod} u+x %{buildroot}/lib/modules/%{kverrel}/extra/*/*/*
%{__chmod} u+x %{buildroot}/lib/modules/%{kverrel}/extra/*/*
%clean
rm -rf $RPM_BUILD_ROOT

View File

@ -54,16 +54,9 @@ export INSTALL_MOUNT_HELPER_DIR=@mounthelperdir@
export INSTALL_SYSCONF_DIR=@sysconfdir@
export INSTALL_PYTHON_DIR=@pythonsitedir@
export KMOD_SPL=@abs_top_builddir@/module/spl/spl.ko
export KMOD_ZAVL=@abs_top_builddir@/module/avl/zavl.ko
export KMOD_ZNVPAIR=@abs_top_builddir@/module/nvpair/znvpair.ko
export KMOD_ZUNICODE=@abs_top_builddir@/module/unicode/zunicode.ko
export KMOD_ZCOMMON=@abs_top_builddir@/module/zcommon/zcommon.ko
export KMOD_ZLUA=@abs_top_builddir@/module/lua/zlua.ko
export KMOD_ICP=@abs_top_builddir@/module/icp/icp.ko
export KMOD_ZFS=@abs_top_builddir@/module/zfs/zfs.ko
export KMOD_SPL=@abs_top_builddir@/module/spl.ko
export KMOD_ZFS=@abs_top_builddir@/module/zfs.ko
export KMOD_FREEBSD=@abs_top_builddir@/module/openzfs.ko
export KMOD_ZZSTD=@abs_top_builddir@/module/zstd/zzstd.ko
endef
export EXTRA_ENVIRONMENT

View File

@ -77,38 +77,10 @@ STRIP[0]="\$(
&& echo -n no
)"
STRIP[1]="\${STRIP[0]}"
STRIP[2]="\${STRIP[0]}"
STRIP[3]="\${STRIP[0]}"
STRIP[4]="\${STRIP[0]}"
STRIP[5]="\${STRIP[0]}"
STRIP[6]="\${STRIP[0]}"
STRIP[7]="\${STRIP[0]}"
STRIP[8]="\${STRIP[0]}"
BUILT_MODULE_NAME[0]="zavl"
BUILT_MODULE_LOCATION[0]="module/avl/"
DEST_MODULE_LOCATION[0]="/extra/avl/avl"
BUILT_MODULE_NAME[1]="znvpair"
BUILT_MODULE_LOCATION[1]="module/nvpair/"
DEST_MODULE_LOCATION[1]="/extra/nvpair/znvpair"
BUILT_MODULE_NAME[2]="zunicode"
BUILT_MODULE_LOCATION[2]="module/unicode/"
DEST_MODULE_LOCATION[2]="/extra/unicode/zunicode"
BUILT_MODULE_NAME[3]="zcommon"
BUILT_MODULE_LOCATION[3]="module/zcommon/"
DEST_MODULE_LOCATION[3]="/extra/zcommon/zcommon"
BUILT_MODULE_NAME[4]="zfs"
BUILT_MODULE_LOCATION[4]="module/zfs/"
DEST_MODULE_LOCATION[4]="/extra/zfs/zfs"
BUILT_MODULE_NAME[5]="icp"
BUILT_MODULE_LOCATION[5]="module/icp/"
DEST_MODULE_LOCATION[5]="/extra/icp/icp"
BUILT_MODULE_NAME[6]="zlua"
BUILT_MODULE_LOCATION[6]="module/lua/"
DEST_MODULE_LOCATION[6]="/extra/lua/zlua"
BUILT_MODULE_NAME[7]="spl"
BUILT_MODULE_LOCATION[7]="module/spl/"
DEST_MODULE_LOCATION[7]="/extra/spl/spl"
BUILT_MODULE_NAME[8]="zzstd"
BUILT_MODULE_LOCATION[8]="module/zstd/"
DEST_MODULE_LOCATION[8]="/extra/zstd/zzstd"
BUILT_MODULE_NAME[0]="zfs"
BUILT_MODULE_LOCATION[0]="module/"
DEST_MODULE_LOCATION[0]="/extra"
BUILT_MODULE_NAME[1]="spl"
BUILT_MODULE_LOCATION[1]="module/"
DEST_MODULE_LOCATION[1]="/extra"
EOF

View File

@ -23,15 +23,8 @@ LDMOD=${LDMOD:-/sbin/modprobe}
KMOD_ZLIB_DEFLATE=${KMOD_ZLIB_DEFLATE:-zlib_deflate}
KMOD_ZLIB_INFLATE=${KMOD_ZLIB_INFLATE:-zlib_inflate}
KMOD_SPL=${KMOD_SPL:-spl}
KMOD_ZAVL=${KMOD_ZAVL:-zavl}
KMOD_ZNVPAIR=${KMOD_ZNVPAIR:-znvpair}
KMOD_ZUNICODE=${KMOD_ZUNICODE:-zunicode}
KMOD_ZCOMMON=${KMOD_ZCOMMON:-zcommon}
KMOD_ZLUA=${KMOD_ZLUA:-zlua}
KMOD_ICP=${KMOD_ICP:-icp}
KMOD_ZFS=${KMOD_ZFS:-zfs}
KMOD_FREEBSD=${KMOD_FREEBSD:-openzfs}
KMOD_ZZSTD=${KMOD_ZZSTD:-zzstd}
usage() {
@ -91,8 +84,7 @@ check_modules_linux() {
LOADED_MODULES=""
MISSING_MODULES=""
for KMOD in $KMOD_SPL $KMOD_ZAVL $KMOD_ZNVPAIR $KMOD_ZUNICODE $KMOD_ZCOMMON \
$KMOD_ZLUA $KMOD_ZZSTD $KMOD_ICP $KMOD_ZFS; do
for KMOD in $KMOD_SPL $KMOD_ZFS; do
NAME="${KMOD##*/}"
NAME="${NAME%.ko}"
@ -159,9 +151,7 @@ load_modules_linux() {
modprobe "$KMOD_ZLIB_INFLATE" >/dev/null 2>&1
fi
for KMOD in $KMOD_SPL $KMOD_ZAVL $KMOD_ZNVPAIR \
$KMOD_ZUNICODE $KMOD_ZCOMMON $KMOD_ZLUA $KMOD_ZZSTD \
$KMOD_ICP $KMOD_ZFS; do
for KMOD in $KMOD_SPL $KMOD_ZFS; do
load_module_linux "$KMOD" || return 1
done
@ -200,8 +190,7 @@ unload_modules_freebsd() {
}
unload_modules_linux() {
for KMOD in $KMOD_ZFS $KMOD_ICP $KMOD_ZZSTD $KMOD_ZLUA $KMOD_ZCOMMON \
$KMOD_ZUNICODE $KMOD_ZNVPAIR $KMOD_ZAVL $KMOD_SPL; do
for KMOD in $KMOD_ZFS $KMOD_SPL; do
NAME="${KMOD##*/}"
NAME="${NAME%.ko}"
USE_COUNT=$(lsmod | awk '/^'"${NAME}"'/ {print $3}')

View File

@ -19,7 +19,7 @@ s:usr/src/test/zfs-tests/runfiles:tests/runfiles:g
s:usr/src/test/zfs-tests/tests/functional:tests/zfs-tests/tests/functional:g
s:usr/src/test/zfs-tests/tests/perf:tests/zfs-tests/tests/perf:g
s:usr/src/test/test-runner/cmd/run.py:tests/test-runner/cmd/test-runner.py:g
s/usr\/src\/common\/zfs\/\(.*\)\.c/module\/zcommon\/\1.c/g
s:usr/src/common/zfs/\(.*\)\.c:module/zcommon/\1.c:g
# crypto framework
s:usr/src/common/crypto:module/icp/algs:g

View File

@ -3264,7 +3264,6 @@ function set_tunable_impl
typeset name="$1"
typeset value="$2"
typeset mdb_cmd="$3"
typeset module="${4:-zfs}"
eval "typeset tunable=\$$name"
case "$tunable" in
@ -3283,14 +3282,13 @@ function set_tunable_impl
case "$UNAME" in
Linux)
typeset zfs_tunables="/sys/module/$module/parameters"
typeset zfs_tunables="/sys/module/zfs/parameters"
echo "$value" >"$zfs_tunables/$tunable"
;;
FreeBSD)
sysctl vfs.zfs.$tunable=$value
;;
SunOS)
[[ "$module" -eq "zfs" ]] || return 1
echo "${tunable}/${mdb_cmd}0t${value}" | mdb -kw
;;
esac

View File

@ -81,7 +81,7 @@ function nesting_cleanup
# before resetting it, it will be left at the modified
# value for the remaining tests. That's the reason
# we reset it again here just in case.
log_must set_tunable_impl MAX_DATASET_NESTING 50 Z zcommon
log_must set_tunable64 MAX_DATASET_NESTING 50 Z
}
log_onexit nesting_cleanup
@ -93,13 +93,13 @@ log_must zfs create -p $TESTPOOL/$dsC16
log_mustnot zfs rename $TESTPOOL/$dsA02 $TESTPOOL/$dsB15A
# extend limit
log_must set_tunable_impl MAX_DATASET_NESTING 64 Z zcommon
log_must set_tunable64 MAX_DATASET_NESTING 64 Z
log_mustnot zfs rename $TESTPOOL/$dsA02 $TESTPOOL/$dsB16A
log_must zfs rename $TESTPOOL/$dsA02 $TESTPOOL/$dsB15A
# bring back old limit
log_must set_tunable_impl MAX_DATASET_NESTING 50 Z zcommon
log_must set_tunable64 MAX_DATASET_NESTING 50 Z
log_mustnot zfs rename $TESTPOOL/$dsC01 $TESTPOOL/$dsB15A47C
log_must zfs rename $TESTPOOL/$dsB15A47A $TESTPOOL/$dsB15A47B

View File

@ -32,7 +32,7 @@
#
# STRATEGY:
# 1. Test if we are running on a Linux x86 system with SSE support
# 2. If so, check if the zfs_fletcher_4_impl module parameter contains
# 2. If so, check if the zfs_fletcher_4_impl module parameter contains
# a sse implementation
# 3. If not fail the test, otherwise pass it
@ -44,7 +44,7 @@ fi
case "$(uname -m)" in
i?86|x86_64)
typeset -R modparam="/sys/module/zcommon/parameters/zfs_fletcher_4_impl"
typeset -R modparam="/sys/module/zfs/parameters/zfs_fletcher_4_impl"
if awk '/^flags/ {exit !/sse/}' /proc/cpuinfo; then
log_must grep -q sse "$modparam"
log_pass "SIMD instructions supported"