Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Mar 2022 11:08:11 GMT
From:      Martin Matuska <mm@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c088e4d539e4 - stable/13 - zfs: merge openzfs/zfs@52bad4f23 (zfs-2.1-release) into stable/13
Message-ID:  <202203291108.22TB8BKX079382@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mm:

URL: https://cgit.FreeBSD.org/src/commit/?id=c088e4d539e4cc947896a3b156646b831d932539

commit c088e4d539e4cc947896a3b156646b831d932539
Merge: c5890784f6d3 52bad4f23daa
Author:     Martin Matuska <mm@FreeBSD.org>
AuthorDate: 2022-03-29 10:41:53 +0000
Commit:     Martin Matuska <mm@FreeBSD.org>
CommitDate: 2022-03-29 10:49:44 +0000

    zfs: merge openzfs/zfs@52bad4f23 (zfs-2.1-release) into stable/13
    
    OpenZFS release 2.1.4
    
    Notable upstream pull request merges:
      #13219 FreeBSD: add missing replay check to an assert in zfs_xvattr_set
      #13220 module: freebsd: avoid a taking a destroyed lock in zfs_zevent bits
      #13221 Fix ACL checks for NFS kernel server
    
    Obtained from:  OpenZFS
    OpenZFS tag:    zfs-2.1.4
    OpenZFS commit: 52bad4f23daaa5f827f802c8d05785a27b80275d
    Relnotes:       yes

 sys/conf/kern.pre.mk                               |   2 +-
 sys/contrib/openzfs/META                           |   4 +-
 sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c       | 179 +++++++++++++++++++--
 sys/contrib/openzfs/cmd/zed/zed_disk_event.c       |  10 ++
 .../openzfs/include/os/freebsd/spl/sys/Makefile.am |   1 -
 .../openzfs/include/os/freebsd/spl/sys/cred.h      | 136 ++--------------
 .../openzfs/include/os/freebsd/spl/sys/kidmap.h    |  41 -----
 .../openzfs/include/os/freebsd/spl/sys/sid.h       |  25 ---
 .../include/os/linux/kernel/linux/simd_x86.h       |   4 +-
 .../openzfs/include/os/linux/spl/sys/cred.h        |   5 -
 sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c     |   1 -
 .../lib/libzutil/os/linux/zutil_device_path_os.c   |  28 ++--
 sys/contrib/openzfs/module/Makefile.bsd            |   2 +-
 .../openzfs/module/os/freebsd/spl/spl_sysevent.c   |  12 +-
 .../openzfs/module/os/freebsd/zfs/zfs_acl.c        |   6 +-
 .../openzfs/module/os/freebsd/zfs/zfs_vnops_os.c   |  19 +--
 .../openzfs/module/os/freebsd/zfs/zfs_znode.c      |   4 +-
 sys/contrib/openzfs/module/os/linux/spl/spl-cred.c |  42 +----
 sys/contrib/openzfs/module/os/linux/zfs/policy.c   |  10 +-
 .../openzfs/module/os/linux/zfs/zpl_inode.c        |   4 +-
 .../openzfs/module/os/linux/zfs/zpl_xattr.c        |   4 +-
 sys/contrib/openzfs/module/zfs/arc.c               |   2 +-
 sys/modules/zfs/Makefile                           |   2 +-
 sys/modules/zfs/zfs_config.h                       |   8 +-
 sys/modules/zfs/zfs_gitrev.h                       |   3 +-
 25 files changed, 242 insertions(+), 312 deletions(-)

diff --cc sys/conf/kern.pre.mk
index d6ab5e17a82a,000000000000..6be49642b04e
mode 100644,000000..100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@@ -1,387 -1,0 +1,387 @@@
 +# $FreeBSD$
 +
 +# Part of a unified Makefile for building kernels.  This part contains all
 +# of the definitions that need to be before %BEFORE_DEPEND.
 +
 +# Allow user to configure things that only effect src tree builds.
 +# Note: This is duplicated from src.sys.mk to ensure that we include
 +# /etc/src.conf when building the kernel. Kernels can be built without
 +# the rest of /usr/src, but they still always process SRCCONF even though
 +# the normal mechanisms to prevent that (compiling out of tree) won't
 +# work. To ensure they do work, we have to duplicate thee few lines here.
 +SRCCONF?=	/etc/src.conf
 +.if (exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf") && !target(_srcconf_included_)
 +.include "${SRCCONF}"
 +_srcconf_included_:
 +.endif
 +
 +.include <bsd.own.mk>
 +.include <bsd.compiler.mk>
 +.include "kern.opts.mk"
 +
 +# The kernel build always occurs in the object directory which is .CURDIR.
 +.if ${.MAKE.MODE:Unormal:Mmeta}
 +.MAKE.MODE+=	curdirOk=yes
 +.endif
 +
 +# The kernel build always expects .OBJDIR=.CURDIR.
 +.OBJDIR: ${.CURDIR}
 +
 +.if defined(NO_OBJWALK) || ${MK_AUTO_OBJ} == "yes"
 +NO_OBJWALK=		t
 +NO_MODULES_OBJ=	t
 +.endif
 +.if !defined(NO_OBJWALK)
 +_obj=		obj
 +.endif
 +
 +# Can be overridden by makeoptions or /etc/make.conf
 +KERNEL_KO?=	kernel
 +KERNEL?=	kernel
 +KODIR?=		/boot/${KERNEL}
 +LDSCRIPT_NAME?=	ldscript.$M
 +LDSCRIPT?=	$S/conf/${LDSCRIPT_NAME}
 +
 +M=		${MACHINE}
 +
 +AWK?=		awk
 +CP?=		cp
 +ELFDUMP?=	elfdump
 +NM?=		nm
 +OBJCOPY?=	objcopy
 +SIZE?=		size
 +
 +.if defined(DEBUG)
 +CTFFLAGS+=	-g
 +.endif
 +.if ${MACHINE_CPUARCH} == "amd64" && ${COMPILER_TYPE} != "clang"
 +_COPTFLAGS_EXTRA=-frename-registers
 +.else
 +_COPTFLAGS_EXTRA=
 +.endif
 +COPTFLAGS?=-O2 -pipe ${_COPTFLAGS_EXTRA}
 +.if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing)
 +COPTFLAGS+= -fno-strict-aliasing
 +.endif
 +.if !defined(NO_CPU_COPTFLAGS)
 +COPTFLAGS+= ${_CPUCFLAGS}
 +.endif
 +NOSTDINC= -nostdinc
 +
 +INCLUDES= ${NOSTDINC} ${INCLMAGIC} -I. -I$S -I$S/contrib/ck/include
 +
 +CFLAGS=	${COPTFLAGS} ${DEBUG}
 +CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h
 +CFLAGS_PARAM_INLINE_UNIT_GROWTH?=100
 +CFLAGS_PARAM_LARGE_FUNCTION_GROWTH?=1000
 +.if ${MACHINE_CPUARCH} == "mips"
 +CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000 -DMACHINE_ARCH='"${MACHINE_ARCH}"'
 +.endif
 +CFLAGS.gcc+= -fms-extensions -finline-limit=${INLINE_LIMIT}
 +CFLAGS.gcc+= --param inline-unit-growth=${CFLAGS_PARAM_INLINE_UNIT_GROWTH}
 +CFLAGS.gcc+= --param large-function-growth=${CFLAGS_PARAM_LARGE_FUNCTION_GROWTH}
 +CFLAGS.gcc+= -fms-extensions
 +.if defined(CFLAGS_ARCH_PARAMS)
 +CFLAGS.gcc+=${CFLAGS_ARCH_PARAMS}
 +.endif
 +WERROR?=	-Werror
 +# The following should be removed no earlier than LLVM11 being imported into the
 +# tree, to ensure we don't regress the build.  LLVM11 and GCC10 will switch the
 +# default over to -fno-common, making this redundant.
 +CFLAGS+=	-fno-common
 +
 +# XXX LOCORE means "don't declare C stuff" not "for locore.s".
 +ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} ${ASM_CFLAGS.${.IMPSRC:T}}
 +
 +.if defined(PROFLEVEL) && ${PROFLEVEL} >= 1
 +CFLAGS+=	-DGPROF
 +CFLAGS.gcc+=	-falign-functions=16
 +.if ${PROFLEVEL} >= 2
 +CFLAGS+=	-DGPROF4 -DGUPROF
 +PROF=		-pg
 +.if ${COMPILER_TYPE} == "gcc"
 +PROF+=		-mprofiler-epilogue
 +.endif
 +.else
 +PROF=		-pg
 +.endif
 +.endif
 +DEFINED_PROF=	${PROF}
 +
 +COMPAT_FREEBSD32_ENABLED!= grep COMPAT_FREEBSD32 opt_global.h || true ; echo
 +
 +KASAN_ENABLED!=	grep KASAN opt_global.h || true ; echo
 +.if !empty(KASAN_ENABLED)
 +SAN_CFLAGS+=	-fsanitize=kernel-address \
 +		-mllvm -asan-stack=true \
 +		-mllvm -asan-instrument-dynamic-allocas=true \
 +		-mllvm -asan-globals=true \
 +		-mllvm -asan-use-after-scope=true \
 +		-mllvm -asan-instrumentation-with-call-threshold=0 \
 +		-mllvm -asan-instrument-byval=false
 +.endif
 +
 +KCSAN_ENABLED!=	grep KCSAN opt_global.h || true ; echo
 +.if !empty(KCSAN_ENABLED)
 +SAN_CFLAGS+=	-fsanitize=thread
 +.endif
 +
 +KMSAN_ENABLED!= grep KMSAN opt_global.h || true ; echo
 +.if !empty(KMSAN_ENABLED)
 +SAN_CFLAGS+=	-DSAN_NEEDS_INTERCEPTORS -DSAN_INTERCEPTOR_PREFIX=kmsan \
 +		-fsanitize=kernel-memory
 +.endif
 +
 +KUBSAN_ENABLED!=	grep KUBSAN opt_global.h || true ; echo
 +.if !empty(KUBSAN_ENABLED)
 +SAN_CFLAGS+=	-fsanitize=undefined
 +.endif
 +
 +COVERAGE_ENABLED!=	grep COVERAGE opt_global.h || true ; echo
 +.if !empty(COVERAGE_ENABLED)
 +.if ${COMPILER_TYPE} == "clang" || \
 +    (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 80100)
 +SAN_CFLAGS+=	-fsanitize-coverage=trace-pc,trace-cmp
 +.else
 +SAN_CFLAGS+=	-fsanitize-coverage=trace-pc
 +.endif
 +.endif
 +
 +CFLAGS+=	${SAN_CFLAGS}
 +
 +GCOV_ENABLED!=	grep GCOV opt_global.h || true ; echo
 +.if !empty(GCOV_ENABLED)
 +.if ${COMPILER_TYPE} == "gcc"
 +GCOV_CFLAGS+=	 -fprofile-arcs -ftest-coverage
 +.endif
 +.endif
 +
 +CFLAGS+=	${GCOV_CFLAGS}
 +
 +# Put configuration-specific C flags last (except for ${PROF}) so that they
 +# can override the others.
 +CFLAGS+=	${CONF_CFLAGS}
 +
 +.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mbuild-id}
 +LDFLAGS+=	--build-id=sha1
 +.endif
 +
 +.if (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
 +    ${MACHINE_CPUARCH} == "i386" || ${MACHINE} == "powerpc") && \
 +    defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == "" && \
 +    !make(install)
 +.error amd64/arm64/i386/ppc* kernel requires linker ifunc support
 +.endif
 +.if ${MACHINE_CPUARCH} == "amd64"
 +LDFLAGS+=	-z max-page-size=2097152
 +.if ${LINKER_TYPE} != "lld"
 +LDFLAGS+=	-z common-page-size=4096
 +.else
 +.if defined(LINKER_FEATURES) && !${LINKER_FEATURES:Mifunc-noplt}
 +.warning "Linker ${LD} does not support -z ifunc-noplt -> ifunc calls are unoptimized."
 +.else
 +LDFLAGS+=	-z notext -z ifunc-noplt
 +.endif
 +.endif
 +.endif  # ${MACHINE_CPUARCH} == "amd64"
 +
 +.if ${MACHINE_CPUARCH} == "riscv"
 +# Hack: Work around undefined weak symbols being out of range when linking with
 +# LLD (address is a PC-relative calculation, and BFD works around this by
 +# rewriting the instructions to generate an absolute address of 0); -fPIE
 +# avoids this since it uses the GOT for all extern symbols, which is overly
 +# inefficient for us. Drop once undefined weak symbols work with medany.
 +.if ${LINKER_TYPE} == "lld"
 +CFLAGS+=	-fPIE
 +.endif
 +.endif
 +
 +NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
 +NORMAL_S= ${CC:N${CCACHE_BIN}} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}
 +PROFILE_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC}
 +NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
 +
 +NORMAL_M= ${AWK} -f $S/tools/makeobjops.awk ${.IMPSRC} -c ; \
 +	  ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.PREFIX}.c
 +
 +NORMAL_FW= uudecode -o ${.TARGET} ${.ALLSRC}
 +NORMAL_FWO= ${CC:N${CCACHE_BIN}} -c ${ASM_CFLAGS} ${WERROR} -o ${.TARGET} \
 +	$S/kern/firmw.S -DFIRMW_FILE="${.ALLSRC:M*.fw}" \
 +	-DFIRMW_SYMBOL="${.ALLSRC:M*.fw:C/[-.\/]/_/g}"
 +
 +# for ZSTD in the kernel (include zstd/lib/freebsd before other CFLAGS)
 +ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd ${CFLAGS} \
 +	-I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} \
 +	-Wno-missing-prototypes ${PROF} -U__BMI__ \
 +	-DZSTD_NO_INTRINSICS \
 +	${.IMPSRC}
 +# https://github.com/facebook/zstd/commit/812e8f2a [zstd 1.4.1]
 +# "Note that [GCC] autovectorization still does not do a good job on the
 +# optimized version, so it's turned off via attribute and flag.  I found
 +# that neither attribute nor command-line flag were entirely successful in
 +# turning off vectorization, which is why there were both."
 +.if ${COMPILER_TYPE} == "gcc"
 +ZSTD_DECOMPRESS_BLOCK_FLAGS= -fno-tree-vectorize
 +.endif
 +
 +ZINCDIR=$S/contrib/openzfs/include
 +# Common for dtrace / zfs
 +CDDL_CFLAGS=	\
 +	-DFREEBSD_NAMECACHE \
 +	-D_SYS_VMEM_H_ \
 +	-D__KERNEL \
 +	-D__KERNEL__ \
 +	-nostdinc \
 +	-include $S/modules/zfs/static_ccompile.h \
 +	-I${ZINCDIR} \
 +	-I${ZINCDIR}/os/freebsd \
 +	-I${ZINCDIR}/os/freebsd/spl \
 +	-I${ZINCDIR}/os/freebsd/zfs  \
 +	-I$S/modules/zfs \
 +	-I$S/contrib/openzfs/module/zstd/include \
 +	${CFLAGS} \
 +	-Wno-cast-qual \
 +	-Wno-duplicate-decl-specifier \
 +	-Wno-missing-braces \
 +	-Wno-missing-prototypes \
 +	-Wno-nested-externs \
 +	-Wno-parentheses \
 +	-Wno-pointer-arith \
 +	-Wno-redundant-decls \
 +	-Wno-strict-prototypes \
 +	-Wno-switch \
 +	-Wno-undef \
 +	-Wno-uninitialized \
 +	-Wno-unknown-pragmas \
 +	-Wno-unused \
 +	-include ${ZINCDIR}/os/freebsd/spl/sys/ccompile.h \
 +	-I$S/cddl/contrib/opensolaris/uts/common \
 +	-I$S -I$S/cddl/compat/opensolaris
 +CDDL_C=		${CC} -c ${CDDL_CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
 +
 +# Special flags for managing the compat compiles for ZFS
 +ZFS_CFLAGS+=	${CDDL_CFLAGS} -DBUILDING_ZFS -DHAVE_UIO_ZEROCOPY \
 +	-DWITH_NETDUMP -D__KERNEL__ -D_SYS_CONDVAR_H_ -DSMP \
- 	-DIN_FREEBSD_BASE -DHAVE_KSID
++	-DIN_FREEBSD_BASE
 +
 +.if ${MACHINE_ARCH} == "amd64"
 +ZFS_CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_SSE2 -DHAVE_AVX512F \
 +	-DHAVE_SSSE3 -DHAVE_AVX512BW
 +.endif
 +
 +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
 +	${MACHINE_ARCH} == "powerpcspe" || ${MACHINE_ARCH} == "arm"
 +ZFS_CFLAGS+= -DBITS_PER_LONG=32
 +.else
 +ZFS_CFLAGS+= -DBITS_PER_LONG=64
 +.endif
 +
 +
 +ZFS_ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${ZFS_CFLAGS}
 +ZFS_C=		${CC} -c ${ZFS_CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
 +ZFS_RPC_C=	${CC} -c ${ZFS_CFLAGS} -DHAVE_RPC_TYPES ${WERROR} ${PROF} ${.IMPSRC}
 +ZFS_S=		${CC} -c ${ZFS_ASM_CFLAGS} ${WERROR} ${.IMPSRC}
 +
 +
 +
 +# Special flags for managing the compat compiles for DTrace
 +DTRACE_CFLAGS=	-DBUILDING_DTRACE ${CDDL_CFLAGS} -I$S/cddl/dev/dtrace -I$S/cddl/dev/dtrace/${MACHINE_CPUARCH}
 +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
 +DTRACE_CFLAGS+=	-I$S/cddl/contrib/opensolaris/uts/intel -I$S/cddl/dev/dtrace/x86
 +.endif
 +DTRACE_CFLAGS+=	-I$S/cddl/contrib/opensolaris/common/util -I$S -DDIS_MEM -DSMP -I$S/cddl/compat/opensolaris
 +DTRACE_CFLAGS+=	-I$S/cddl/contrib/opensolaris/uts/common
 +DTRACE_ASM_CFLAGS=	-x assembler-with-cpp -DLOCORE ${DTRACE_CFLAGS}
 +DTRACE_C=	${CC} -c ${DTRACE_CFLAGS}	${WERROR} ${PROF} ${.IMPSRC}
 +DTRACE_S=	${CC} -c ${DTRACE_ASM_CFLAGS}	${WERROR} ${.IMPSRC}
 +
 +# Special flags for managing the compat compiles for DTrace/FBT
 +FBT_CFLAGS=	-DBUILDING_DTRACE -nostdinc -I$S/cddl/dev/fbt/${MACHINE_CPUARCH} -I$S/cddl/dev/fbt ${CDDL_CFLAGS} -I$S/cddl/compat/opensolaris -I$S/cddl/contrib/opensolaris/uts/common  
 +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
 +FBT_CFLAGS+=	-I$S/cddl/dev/fbt/x86
 +.endif
 +FBT_C=		${CC} -c ${FBT_CFLAGS}		${WERROR} ${PROF} ${.IMPSRC}
 +
 +.if ${MK_CTF} != "no"
 +NORMAL_CTFCONVERT=	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 +.elif ${MAKE_VERSION} >= 5201111300
 +NORMAL_CTFCONVERT=
 +.else
 +NORMAL_CTFCONVERT=	@:
 +.endif
 +
 +# Linux Kernel Programming Interface C-flags
 +LINUXKPI_INCLUDES=	-I$S/compat/linuxkpi/common/include
 +LINUXKPI_C=		${NORMAL_C} ${LINUXKPI_INCLUDES}
 +
 +# Infiniband C flags.  Correct include paths and omit errors that linux
 +# does not honor.
 +OFEDINCLUDES=	-I$S/ofed/include -I$S/ofed/include/uapi ${LINUXKPI_INCLUDES}
 +OFEDNOERR=	-Wno-cast-qual -Wno-pointer-arith
 +OFEDCFLAGS=	${CFLAGS:N-I*} -DCONFIG_INFINIBAND_USER_MEM \
 +		${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR}
 +OFED_C_NOIMP=	${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} ${PROF}
 +OFED_C=		${OFED_C_NOIMP} ${.IMPSRC}
 +
 +# mlxfw C flags.
 +MLXFW_C=	${OFED_C_NOIMP} \
 +		-I${SRCTOP}/sys/contrib/xz-embedded/freebsd \
 +		-I${SRCTOP}/sys/contrib/xz-embedded/linux/lib/xz \
 +		${.IMPSRC}
 +
 +GEN_CFILES= $S/$M/$M/genassym.c ${MFILES:T:S/.m$/.c/}
 +SYSTEM_CFILES= config.c env.c hints.c vnode_if.c
 +SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
 +SYSTEM_OBJS= locore.o ${MDOBJS} ${OBJS}
 +SYSTEM_OBJS+= ${SYSTEM_CFILES:.c=.o}
 +SYSTEM_OBJS+= hack.pico
 +
 +KEYMAP=kbdcontrol -P ${SRCTOP}/share/vt/keymaps -P ${SRCTOP}/share/syscons/keymaps
 +KEYMAP_FIX=sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /'
 +
 +MD_ROOT_SIZE_CONFIGURED!=	grep MD_ROOT_SIZE opt_md.h || true ; echo
 +.if ${MFS_IMAGE:Uno} != "no"
 +.if empty(MD_ROOT_SIZE_CONFIGURED)
 +SYSTEM_OBJS+= embedfs_${MFS_IMAGE:T:R}.o
 +.endif
 +.endif
 +SYSTEM_LD_BASECMD= \
 +	${LD} -m ${LD_EMULATION} -Bdynamic -T ${LDSCRIPT} ${_LDFLAGS} \
 +	--no-warn-mismatch --warn-common --export-dynamic \
 +	--dynamic-linker /red/herring -X
 +SYSTEM_LD= @${SYSTEM_LD_BASECMD} -o ${.TARGET} ${SYSTEM_OBJS} vers.o
 +SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
 +	${SIZE} ${.TARGET} ; chmod 755 ${.TARGET}
 +SYSTEM_DEP+= ${LDSCRIPT}
 +
 +# Calculate path for .m files early, if needed.
 +.if !defined(NO_MODULES) && !defined(__MPATH) && !make(install) && \
 +    (empty(.MAKEFLAGS:M-V) || defined(NO_SKIP_MPATH))
 +__MPATH!=find ${S:tA}/ -name \*_if.m
 +.endif
 +
 +# MKMODULESENV is set here so that port makefiles can augment
 +# them.
 +
 +MKMODULESENV+=	MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR}
 +MKMODULESENV+=	MACHINE_CPUARCH=${MACHINE_CPUARCH}
 +MKMODULESENV+=	MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH}
 +MKMODULESENV+=	MODULES_EXTRA="${MODULES_EXTRA}" WITHOUT_MODULES="${WITHOUT_MODULES}"
 +MKMODULESENV+=	ARCH_FLAGS="${ARCH_FLAGS}"
 +.if (${KERN_IDENT} == LINT)
 +MKMODULESENV+=	ALL_MODULES=LINT
 +.endif
 +.if defined(MODULES_OVERRIDE)
 +MKMODULESENV+=	MODULES_OVERRIDE="${MODULES_OVERRIDE}"
 +.endif
 +.if defined(DEBUG)
 +MKMODULESENV+=	DEBUG_FLAGS="${DEBUG}"
 +.endif
 +.if !defined(NO_MODULES)
 +MKMODULESENV+=	__MPATH="${__MPATH}"
 +.endif
 +
 +# Detect kernel config options that force stack frames to be turned on.
 +DDB_ENABLED!=	grep DDB opt_ddb.h || true ; echo
 +DTR_ENABLED!=	grep KDTRACE_FRAME opt_kdtrace.h || true ; echo
 +HWPMC_ENABLED!=	grep HWPMC opt_hwpmc_hooks.h || true ; echo
diff --cc sys/modules/zfs/Makefile
index 4217af1c2b03,000000000000..f46f08b2d5d5
mode 100644,000000..100644
--- a/sys/modules/zfs/Makefile
+++ b/sys/modules/zfs/Makefile
@@@ -1,343 -1,0 +1,343 @@@
 +# $FreeBSD$
 +
 +SRCDIR=${SRCTOP}/sys/contrib/openzfs/module
 +INCDIR=${SRCTOP}/sys/contrib/openzfs/include
 +
 +KMOD=	zfs
 +
 +.PATH:	${SRCDIR}/avl \
 +	${SRCDIR}/lua \
 +	${SRCDIR}/nvpair \
 +	${SRCDIR}/os/freebsd/spl \
 +	${SRCDIR}/os/freebsd/zfs \
 +	${SRCDIR}/unicode \
 +	${SRCDIR}/zcommon \
 +	${SRCDIR}/zfs	\
 +	${SRCDIR}/zstd	\
 +	${SRCDIR}/zstd/lib
 +
 +
 +CFLAGS+= -I${INCDIR}
 +CFLAGS+= -I${INCDIR}/os/freebsd
 +CFLAGS+= -I${INCDIR}/os/freebsd/spl
 +CFLAGS+= -I${INCDIR}/os/freebsd/zfs
 +CFLAGS+= -I${SRCDIR}/zstd/include
 +CFLAGS+= -I${.CURDIR}
 +
 +CFLAGS+= -D__KERNEL__ -DFREEBSD_NAMECACHE -DBUILDING_ZFS \
 +	-DHAVE_UIO_ZEROCOPY -DWITHOUT_NETDUMP -D__KERNEL -D_SYS_CONDVAR_H_ \
- 	-D_SYS_VMEM_H_ -DIN_FREEBSD_BASE -DHAVE_KSID
++	-D_SYS_VMEM_H_ -DIN_FREEBSD_BASE
 +
 +.if ${MACHINE_ARCH} == "amd64"
 +CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_SSE2 -DHAVE_AVX512F -DHAVE_AVX512BW -DHAVE_SSSE3
 +.endif
 +
 +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
 +	${MACHINE_ARCH} == "powerpcspe" || ${MACHINE_ARCH} == "arm"
 +CFLAGS+= -DBITS_PER_LONG=32
 +.else
 +CFLAGS+= -DBITS_PER_LONG=64
 +.endif
 +
 +SRCS=	vnode_if.h device_if.h bus_if.h
 +
 +# avl
 +SRCS+=	avl.c
 +
 +#lua
 +SRCS+=	lapi.c \
 +	lauxlib.c \
 +	lbaselib.c \
 +	lcode.c \
 +	lcompat.c \
 +	lcorolib.c \
 +	lctype.c \
 +	ldebug.c \
 +	ldo.c \
 +	lfunc.c \
 +	lgc.c \
 +	llex.c \
 +	lmem.c \
 +	lobject.c \
 +	lopcodes.c \
 +	lparser.c \
 +	lstate.c \
 +	lstring.c \
 +	lstrlib.c \
 +	ltable.c \
 +	ltablib.c \
 +	ltm.c \
 +	lvm.c \
 +	lzio.c
 +
 +#nvpair
 +SRCS+=	nvpair.c \
 +	fnvpair.c \
 +	nvpair_alloc_spl.c \
 +	nvpair_alloc_fixed.c
 +
 +#os/freebsd/spl
 +SRCS+=	acl_common.c \
 +	btree.c \
 +	callb.c \
 +	list.c \
 +	spl_acl.c \
 +	spl_cmn_err.c \
 +	spl_dtrace.c \
 +	spl_kmem.c \
 +	spl_kstat.c \
 +	spl_misc.c \
 +	spl_policy.c \
 +	spl_string.c \
 +	spl_sunddi.c \
 +	spl_sysevent.c \
 +	spl_taskq.c \
 +	spl_uio.c \
 +	spl_vfs.c \
 +	spl_vm.c \
 +	spl_zone.c \
 +	sha256c.c \
 +	sha512c.c \
 +	spl_procfs_list.c \
 +	spl_zlib.c
 +
 +
 +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
 +	${MACHINE_ARCH} == "powerpcspe" || ${MACHINE_ARCH} == "arm"
 +SRCS+= spl_atomic.c
 +.endif
 +
 +#os/freebsd/zfs
 +SRCS+=	abd_os.c \
 +	crypto_os.c \
 +	dmu_os.c \
 +	hkdf.c \
 +	kmod_core.c \
 +	spa_os.c \
 +	sysctl_os.c \
 +	vdev_file.c \
 +	vdev_label_os.c \
 +	vdev_geom.c \
 +	zfs_acl.c \
 +	zfs_ctldir.c \
 +	zfs_dir.c \
 +	zfs_ioctl_compat.c \
 +	zfs_ioctl_os.c \
 +	zfs_log.c \
 +	zfs_racct.c \
 +	zfs_replay.c \
 +	zfs_vfsops.c \
 +	zfs_vnops_os.c \
 +	zfs_znode.c \
 +	zio_crypt.c \
 +	zvol_os.c
 +
 +#unicode
 +SRCS+=	uconv.c \
 +	u8_textprep.c
 +
 +#zcommon
 +SRCS+=	zfeature_common.c \
 +	zfs_comutil.c \
 +	zfs_deleg.c \
 +	zfs_fletcher.c \
 +	zfs_fletcher_avx512.c \
 +	zfs_fletcher_intel.c \
 +	zfs_fletcher_sse.c \
 +	zfs_fletcher_superscalar.c \
 +	zfs_fletcher_superscalar4.c \
 +	zfs_namecheck.c \
 +	zfs_prop.c \
 +	zpool_prop.c \
 +	zprop_common.c
 +
 +#zfs
 +SRCS+=	abd.c \
 +	aggsum.c \
 +	arc.c \
 +	arc_os.c \
 +	blkptr.c \
 +	bplist.c \
 +	bpobj.c \
 +	cityhash.c \
 +	dbuf.c \
 +	dbuf_stats.c \
 +	bptree.c \
 +	bqueue.c \
 +	dataset_kstats.c \
 +	ddt.c \
 +	ddt_zap.c \
 +	dmu.c \
 +	dmu_diff.c \
 +	dmu_object.c \
 +	dmu_objset.c \
 +	dmu_recv.c \
 +	dmu_redact.c \
 +	dmu_send.c \
 +	dmu_traverse.c \
 +	dmu_tx.c \
 +	dmu_zfetch.c \
 +	dnode.c \
 +	dnode_sync.c \
 +	dsl_dataset.c \
 +	dsl_deadlist.c \
 +	dsl_deleg.c \
 +	dsl_bookmark.c \
 +	dsl_dir.c \
 +	dsl_crypt.c \
 +	dsl_destroy.c \
 +	dsl_pool.c \
 +	dsl_prop.c \
 +	dsl_scan.c \
 +	dsl_synctask.c \
 +	dsl_userhold.c \
 +	fm.c \
 +	gzip.c \
 +	lzjb.c \
 +	lz4.c \
 +	metaslab.c \
 +	mmp.c \
 +	multilist.c \
 +	objlist.c \
 +	pathname.c \
 +	range_tree.c \
 +	refcount.c \
 +	rrwlock.c \
 +	sa.c \
 +	sha256.c \
 +	skein_zfs.c \
 +	spa.c \
 +	spa_boot.c \
 +	spa_checkpoint.c \
 +	spa_config.c \
 +	spa_errlog.c \
 +	spa_history.c \
 +	spa_log_spacemap.c \
 +	spa_misc.c \
 +	spa_stats.c \
 +	space_map.c \
 +	space_reftree.c \
 +	txg.c \
 +	uberblock.c \
 +	unique.c \
 +	vdev.c \
 +	vdev_cache.c \
 +	vdev_draid.c \
 +	vdev_draid_rand.c \
 +	vdev_indirect.c \
 +	vdev_indirect_births.c \
 +	vdev_indirect_mapping.c \
 +	vdev_initialize.c \
 +	vdev_label.c \
 +	vdev_mirror.c \
 +	vdev_missing.c \
 +	vdev_queue.c \
 +	vdev_raidz.c \
 +	vdev_raidz_math.c \
 +	vdev_raidz_math_scalar.c \
 +	vdev_raidz_math_avx2.c \
 +	vdev_raidz_math_avx512bw.c \
 +	vdev_raidz_math_avx512f.c \
 +	vdev_raidz_math_sse2.c \
 +	vdev_raidz_math_ssse3.c \
 +	vdev_rebuild.c \
 +	vdev_removal.c \
 +	vdev_root.c \
 +	vdev_trim.c \
 +	zap.c \
 +	zap_leaf.c \
 +	zap_micro.c \
 +	zcp.c \
 +	zcp_get.c \
 +	zcp_global.c \
 +	zcp_iter.c \
 +	zcp_set.c \
 +	zcp_synctask.c \
 +	zfeature.c \
 +	zfs_byteswap.c \
 +	zfs_debug.c \
 +	zfs_file_os.c \
 +	zfs_fm.c \
 +	zfs_fuid.c \
 +	zfs_ioctl.c \
 +	zfs_onexit.c \
 +	zfs_quota.c \
 +	zfs_ratelimit.c \
 +	zfs_rlock.c \
 +	zfs_sa.c \
 +	zfs_vnops.c \
 +	zil.c \
 +	zio.c \
 +	zio_checksum.c \
 +	zio_compress.c \
 +	zio_inject.c \
 +	zle.c \
 +	zrlock.c \
 +	zthr.c \
 +	zvol.c
 +
 +SRCS+=	zfs_zstd.c \
 +	zstd.c \
 +	zstd_sparc.c
 +
 +.include <bsd.kmod.mk>
 +
 +CFLAGS+= -include ${SRCTOP}/sys/cddl/compat/opensolaris/sys/debug_compat.h
 +CFLAGS+= -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h
 +CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/static_ccompile.h
 +
 +CWARNFLAGS+=	${OPENZFS_CWARNFLAGS}
 +
 +CFLAGS.gcc+= -Wno-pointer-to-int-cast
 +
 +CFLAGS.lapi.c= -Wno-cast-qual
 +CFLAGS.lcompat.c= -Wno-cast-qual
 +CFLAGS.lobject.c= -Wno-cast-qual
 +CFLAGS.ltable.c= -Wno-cast-qual
 +CFLAGS.lvm.c= -Wno-cast-qual
 +CFLAGS.nvpair.c= -Wno-cast-qual -DHAVE_RPC_TYPES
 +CFLAGS.spl_string.c= -Wno-cast-qual
 +CFLAGS.spl_vm.c= -Wno-cast-qual
 +CFLAGS.spl_zlib.c= -Wno-cast-qual
 +CFLAGS.abd.c= -Wno-cast-qual
 +CFLAGS.arc.c= -Wno-unused-variable
 +CFLAGS.zfs_log.c= -Wno-cast-qual
 +CFLAGS.zfs_vnops_os.c= -Wno-pointer-arith
 +CFLAGS.u8_textprep.c= -Wno-cast-qual
 +CFLAGS.zfs_fletcher.c= -Wno-cast-qual -Wno-pointer-arith
 +CFLAGS.zfs_fletcher_intel.c= -Wno-cast-qual -Wno-pointer-arith
 +CFLAGS.zfs_fletcher_sse.c= -Wno-cast-qual -Wno-pointer-arith
 +CFLAGS.zfs_fletcher_avx512.c= -Wno-cast-qual -Wno-pointer-arith
 +CFLAGS.zprop_common.c= -Wno-cast-qual
 +CFLAGS.ddt.c= -Wno-cast-qual
 +CFLAGS.dmu.c= -Wno-cast-qual
 +CFLAGS.dmu_traverse.c= -Wno-cast-qual
 +CFLAGS.dsl_dir.c= -Wno-cast-qual
 +CFLAGS.dsl_deadlist.c= -Wno-cast-qual
 +CFLAGS.dsl_prop.c= -Wno-cast-qual
 +CFLAGS.fm.c= -Wno-cast-qual
 +CFLAGS.lz4.c= -Wno-cast-qual
 +CFLAGS.spa.c= -Wno-cast-qual
 +CFLAGS.spa_misc.c= -Wno-cast-qual
 +CFLAGS.sysctl_os.c= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
 +CFLAGS.vdev_draid.c= -Wno-cast-qual
 +CFLAGS.vdev_raidz.c= -Wno-cast-qual
 +CFLAGS.vdev_raidz_math.c= -Wno-cast-qual
 +CFLAGS.vdev_raidz_math_scalar.c= -Wno-cast-qual
 +CFLAGS.vdev_raidz_math_avx2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
 +CFLAGS.vdev_raidz_math_avx512f.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
 +CFLAGS.vdev_raidz_math_sse2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
 +CFLAGS.zap_leaf.c= -Wno-cast-qual
 +CFLAGS.zap_micro.c= -Wno-cast-qual
 +CFLAGS.zcp.c= -Wno-cast-qual
 +CFLAGS.zfs_fm.c= -Wno-cast-qual
 +CFLAGS.zfs_ioctl.c= -Wno-cast-qual
 +CFLAGS.zil.c= -Wno-cast-qual
 +CFLAGS.zio.c= -Wno-cast-qual
 +CFLAGS.zrlock.c= -Wno-cast-qual
 +CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith
 +CFLAGS.zstd.c= -U__BMI__ -fno-tree-vectorize
 +.if ${MACHINE_CPUARCH} == "aarch64"
 +CFLAGS.zstd.c+= -include ${SRCDIR}/zstd/include/aarch64_compat.h
 +.endif
 +CFLAGS.zstd.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL}
diff --cc sys/modules/zfs/zfs_config.h
index 054aaeb3eb19,000000000000..a4604f0cfd86
mode 100644,000000..100644
--- a/sys/modules/zfs/zfs_config.h
+++ b/sys/modules/zfs/zfs_config.h
@@@ -1,915 -1,0 +1,915 @@@
 +/*
 + * $FreeBSD$
 + */
 +
 +/* zfs_config.h.  Generated from zfs_config.h.in by configure.  */
 +/* zfs_config.h.in.  Generated from configure.ac by autoheader.  */
 +
 +/* Define to 1 if translation of program messages to the user's native
 +   language is requested. */
 +/* #undef ENABLE_NLS */
 +
 +/* bio_end_io_t wants 1 arg */
 +/* #undef HAVE_1ARG_BIO_END_IO_T */
 +
 +/* lookup_bdev() wants 1 arg */
 +/* #undef HAVE_1ARG_LOOKUP_BDEV */
 +
 +/* submit_bio() wants 1 arg */
 +/* #undef HAVE_1ARG_SUBMIT_BIO */
 +
 +/* bdi_setup_and_register() wants 2 args */
 +/* #undef HAVE_2ARGS_BDI_SETUP_AND_REGISTER */
 +
 +/* vfs_getattr wants 2 args */
 +/* #undef HAVE_2ARGS_VFS_GETATTR */
 +
 +/* zlib_deflate_workspacesize() wants 2 args */
 +/* #undef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */
 +
 +/* bdi_setup_and_register() wants 3 args */
 +/* #undef HAVE_3ARGS_BDI_SETUP_AND_REGISTER */
 +
 +/* vfs_getattr wants 3 args */
 +/* #undef HAVE_3ARGS_VFS_GETATTR */
 +
 +/* vfs_getattr wants 4 args */
 +/* #undef HAVE_4ARGS_VFS_GETATTR */
 +
 +/* kernel has access_ok with 'type' parameter */
 +/* #undef HAVE_ACCESS_OK_TYPE */
 +
 +/* posix_acl has refcount_t */
 +/* #undef HAVE_ACL_REFCOUNT */
 +
 +/* add_disk() returns int */
 +/* #undef HAVE_ADD_DISK_RET */
 +
 +/* Define if host toolchain supports AES */
 +#define HAVE_AES 1
 +
 +#ifdef __amd64__
 +#ifndef RESCUE
 +/* Define if host toolchain supports AVX */
 +#define HAVE_AVX 1
 +#endif
 +
 +/* Define if host toolchain supports AVX2 */
 +#define HAVE_AVX2 1
 +
 +/* Define if host toolchain supports AVX512BW */
 +#define HAVE_AVX512BW 1
 +
 +/* Define if host toolchain supports AVX512CD */
 +#define HAVE_AVX512CD 1
 +
 +/* Define if host toolchain supports AVX512DQ */
 +#define HAVE_AVX512DQ 1
 +
 +/* Define if host toolchain supports AVX512ER */
 +#define HAVE_AVX512ER 1
 +
 +/* Define if host toolchain supports AVX512F */
 +#define HAVE_AVX512F 1
 +
 +/* Define if host toolchain supports AVX512IFMA */
 +#define HAVE_AVX512IFMA 1
 +
 +/* Define if host toolchain supports AVX512PF */
 +#define HAVE_AVX512PF 1
 +
 +/* Define if host toolchain supports AVX512VBMI */
 +#define HAVE_AVX512VBMI 1
 +
 +/* Define if host toolchain supports AVX512VL */
 +#define HAVE_AVX512VL 1
 +#endif
 +
 +/* bdev_check_media_change() exists */
 +/* #undef HAVE_BDEV_CHECK_MEDIA_CHANGE */
 +
 +/* block_device_operations->submit_bio() returns void */
 +/* #undef HAVE_BDEV_SUBMIT_BIO_RETURNS_VOID */
 +
 +/* bdev_whole() is available */
 +/* #undef HAVE_BDEV_WHOLE */
 +
 +/* bio->bi_bdev->bd_disk exists */
 +/* #undef HAVE_BIO_BDEV_DISK */
 +
 +/* bio->bi_opf is defined */
 +/* #undef HAVE_BIO_BI_OPF */
 +
 +/* bio->bi_status exists */
 +/* #undef HAVE_BIO_BI_STATUS */
 +
 +/* bio has bi_iter */
 +/* #undef HAVE_BIO_BVEC_ITER */
 +
 +/* bio_*_io_acct() available */
 +/* #undef HAVE_BIO_IO_ACCT */
 +
 +/* bio_max_segs() is implemented */
 +/* #undef HAVE_BIO_MAX_SEGS */
 +
 +/* bio_set_dev() is available */
 +/* #undef HAVE_BIO_SET_DEV */
 +
 +/* bio_set_dev() GPL-only */
 +/* #undef HAVE_BIO_SET_DEV_GPL_ONLY */
 +
 +/* bio_set_dev() is a macro */
 +/* #undef HAVE_BIO_SET_DEV_MACRO */
 +
 +/* bio_set_op_attrs is available */
 +/* #undef HAVE_BIO_SET_OP_ATTRS */
 +
 +/* blkdev_get_by_path() handles ERESTARTSYS */
 +/* #undef HAVE_BLKDEV_GET_ERESTARTSYS */
 +
 +/* blkdev_reread_part() exists */
 +/* #undef HAVE_BLKDEV_REREAD_PART */
 +
 +/* blkg_tryget() is available */
 +/* #undef HAVE_BLKG_TRYGET */
 +
 +/* blkg_tryget() GPL-only */
 +/* #undef HAVE_BLKG_TRYGET_GPL_ONLY */
 +
 +/* blk_alloc_disk() exists */
 +/* #undef HAVE_BLK_ALLOC_DISK */
 +
 +/* blk_alloc_queue() expects request function */
 +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN */
 +
 +/* blk_alloc_queue_rh() expects request function */
 +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN_RH */
 +
 +/* blk queue backing_dev_info is dynamic */
 +/* #undef HAVE_BLK_QUEUE_BDI_DYNAMIC */
 +
 +/* blk_queue_flag_clear() exists */
 +/* #undef HAVE_BLK_QUEUE_FLAG_CLEAR */
 +
 +/* blk_queue_flag_set() exists */
 +/* #undef HAVE_BLK_QUEUE_FLAG_SET */
 +
 +/* blk_queue_flush() is available */
 +/* #undef HAVE_BLK_QUEUE_FLUSH */
 +
 +/* blk_queue_flush() is GPL-only */
 +/* #undef HAVE_BLK_QUEUE_FLUSH_GPL_ONLY */
 +
 +/* blk_queue_secdiscard() is available */
 +/* #undef HAVE_BLK_QUEUE_SECDISCARD */
 +
 +/* blk_queue_secure_erase() is available */
 +/* #undef HAVE_BLK_QUEUE_SECURE_ERASE */
 +
 +/* blk_queue_update_readahead() exists */
 +/* #undef HAVE_BLK_QUEUE_UPDATE_READAHEAD */
 +
 +/* blk_queue_write_cache() exists */
 +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE */
 +
 +/* blk_queue_write_cache() is GPL-only */
 +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY */
 +
 +/* Define if revalidate_disk() in block_device_operations */
 +/* #undef HAVE_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK */
 +
 +/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the
 +   CoreFoundation framework. */
 +/* #undef HAVE_CFLOCALECOPYCURRENT */
 +
 +/* Define to 1 if you have the Mac OS X function
*** 746 LINES SKIPPED ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202203291108.22TB8BKX079382>