git: 2ec8b6948070 - stable/14 - zfs: merge openzfs/zfs@e269af1b3 (zfs-2.2-release) into stable/14

From: Martin Matuska <mm_at_FreeBSD.org>
Date: Thu, 12 Dec 2024 14:57:27 UTC
The branch stable/14 has been updated by mm:

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

commit 2ec8b69480708185a273254e4e254140eb2ce633
Merge: a0e2fa50e737 e269af1b3c7b
Author:     Martin Matuska <mm@FreeBSD.org>
AuthorDate: 2024-12-12 12:22:56 +0000
Commit:     Martin Matuska <mm@FreeBSD.org>
CommitDate: 2024-12-12 12:22:56 +0000

    zfs: merge openzfs/zfs@e269af1b3 (zfs-2.2-release) into stable/14
    
    OpenZFS release 2.2.7
    
    Notable upstream pull request merges:
     #15457 022bf8637 Increase L2ARC write rate and headroom
     #15527 1ba5b2ef8 freebsd: remove __FBSDID macro use
     #15792 9e7af55e8 Add custom debug printing for your asserts
     #15793 a1ea40af8 libzfs: use zfs_strerror() in place of strerror()
     #16181 -multiple zdb/ztest: improve and harmonise crash output
     #16208 e5e4957a5 Allow block cloning to be interrupted by a signal
     #16210 ba4e582a6 FreeBSD: Add const qualifier to members of struct
                      opensolaris_utsname
     #16225 a6198f34b Simplify issig()
     #16335 25ec9a903 zdb: fix BRT dump
     #16364 cf80a803d zvol: ensure device minors are properly cleaned up
     #16404 384b53be8 FreeBSD: Add missing memory reclamation accounting
     #16492 -multiple Split "shared" userspace & kernel code into separate files
     #16496 f1694496a zfs_file: rename zfs_file_fallocate to zfs_file_deallocate
     #16511 bc0d89bfc Fix an uninitialized data access
     #16529 2dc8529d9 Fix handling of DNS names with '-' in them for sharenfs
     #16539 30ea44296 zfs_log: add flex array fields to log record structs
     #16546 098789216 Evicting too many bytes from MFU metadata
     #16551 54278533a Reduce and handle EAGAIN errors on AIO label reads
     #16554 84ad1d536 FreeBSD: restore zfs_znode_update_vfs()
     #16565 21c40e6d9 FreeBSD: Sync taskq_cancel_id() returns with Linux
     #16567 48482bb2f Properly release key in spa_keystore_dsl_key_hold_dd()
     #16584 e8f4592a1 Avoid computing strlen() inside loops
     #16605 acc8a3186 ARC: Cache arc_c value during arc_evict()
     #16650 fc60e0c6e freebsd: Use compiler.h from FreeBSD's base's linuxkpi
     #16667 b32b35cea zdb: show bp in uberblock dump
     #16684 1f5e1b919 Pack dmu_buf_impl_t by 16 bytes
     #16688 73b3e8ace Fix gcc uninitialized warning in FreeBSD zio_crypt.c
     #16690 727506c94 On the first vdev open ignore impossible ashift hints
     #16692 d83cd5307 zdb: add extra -T flag to show histograms of BRT refcounts
     #16693 82ab837a0 Fix gcc unused value warning in FreeBSD simd.h
     #16740 2bba6e3c5 BRT: Don't call brt_pending_remove() on holes/embedded
     #16801 299da6ace Fix race in libzfs_run_process_impl
    
    Obtained from:  OpenZFS
    OpenZFS commit: e269af1b3c7b1b1c000d05f147a2f75e5e72e0ca
    OpenZFS tag:    zfs-2.2.7

 cddl/lib/libicp/Makefile                           |   1 +
 cddl/lib/libicp_rescue/Makefile                    |   1 +
 cddl/lib/libzfs/Makefile                           |   4 +-
 cddl/lib/libzpool/Makefile                         |  19 +-
 cddl/sbin/zpool/Makefile                           |   1 +
 cddl/share/zfs/compatibility.d/Makefile            |   4 +-
 cddl/usr.bin/zinject/Makefile                      |   1 +
 cddl/usr.bin/zstream/Makefile                      |   2 +
 cddl/usr.bin/ztest/Makefile                        |   1 +
 cddl/usr.sbin/zdb/Makefile                         |   1 +
 cddl/usr.sbin/zfsd/Makefile.common                 |   1 +
 cddl/usr.sbin/zhack/Makefile                       |   1 +
 lib/libbe/Makefile                                 |   3 +-
 sys/conf/files                                     |   4 +-
 sys/contrib/openzfs/.github/CONTRIBUTING.md        |  18 +-
 .../.github/workflows/build-dependencies.txt       |  57 ---
 .../.github/workflows/checkstyle-dependencies.txt  |   5 -
 .../openzfs/.github/workflows/checkstyle.yaml      |  23 +-
 sys/contrib/openzfs/.github/workflows/codeql.yml   |  12 +-
 .../openzfs/.github/workflows/scripts/README.md    |  14 +
 .../.github/workflows/scripts/generate-ci-type.py  | 107 +++++
 .../.github/workflows/scripts/generate-summary.sh  | 119 -----
 .../.github/workflows/scripts/merge_summary.awk    | 109 +++++
 .../.github/workflows/scripts/qemu-1-setup.sh      |  93 ++++
 .../.github/workflows/scripts/qemu-2-start.sh      | 225 ++++++++++
 .../.github/workflows/scripts/qemu-3-deps.sh       | 229 ++++++++++
 .../.github/workflows/scripts/qemu-4-build.sh      | 153 +++++++
 .../.github/workflows/scripts/qemu-5-setup.sh      | 126 ++++++
 .../.github/workflows/scripts/qemu-6-tests.sh      | 105 +++++
 .../.github/workflows/scripts/qemu-7-prepare.sh    | 123 ++++++
 .../.github/workflows/scripts/qemu-8-summary.sh    |  71 +++
 .../workflows/scripts/qemu-9-summary-page.sh       |  57 +++
 .../workflows/scripts/setup-dependencies.sh        |  88 ----
 .../.github/workflows/scripts/setup-functional.sh  |  24 -
 .../openzfs/.github/workflows/zfs-linux-tests.yml  | 124 ------
 .../openzfs/.github/workflows/zfs-linux.yml        |  64 ---
 sys/contrib/openzfs/.github/workflows/zfs-qemu.yml | 177 ++++++++
 sys/contrib/openzfs/.github/workflows/zloop.yml    |  77 ++++
 sys/contrib/openzfs/META                           |   6 +-
 sys/contrib/openzfs/README.md                      |   2 +-
 sys/contrib/openzfs/cmd/zdb/zdb.c                  |  58 ++-
 sys/contrib/openzfs/cmd/zdb/zdb_il.c               |   6 +-
 sys/contrib/openzfs/cmd/zed/zed.d/Makefile.am      |   2 +
 .../openzfs/cmd/zed/zed.d/deadman-slot_off.sh      |  71 +++
 sys/contrib/openzfs/cmd/zed/zed.d/zed.rc           |   7 +
 sys/contrib/openzfs/cmd/zed/zed_disk_event.c       |   3 +-
 sys/contrib/openzfs/cmd/zpool/Makefile.am          |   4 +-
 .../openzfs/cmd/zpool/compatibility.d/grub2-2.06   |  23 +
 .../zpool/compatibility.d/{grub2 => grub2-2.12}    |   2 +-
 sys/contrib/openzfs/cmd/ztest.c                    |  36 +-
 sys/contrib/openzfs/config/Rules.am                |   3 +-
 sys/contrib/openzfs/config/deb.am                  |  10 +-
 sys/contrib/openzfs/config/intlmacosx.m4           |  72 ---
 sys/contrib/openzfs/config/kernel-acl.m4           | 215 +--------
 sys/contrib/openzfs/config/kernel-aio-fsync.m4     |  23 -
 sys/contrib/openzfs/config/kernel-assign_str.m4    |  62 +++
 sys/contrib/openzfs/config/kernel-bdi.m4           |  81 ----
 sys/contrib/openzfs/config/kernel-bio.m4           | 313 +------------
 sys/contrib/openzfs/config/kernel-blk-queue.m4     | 183 +-------
 sys/contrib/openzfs/config/kernel-blkdev.m4        |  22 +-
 sys/contrib/openzfs/config/kernel-clear-inode.m4   |  39 --
 .../openzfs/config/kernel-config-defined.m4        |  15 -
 sys/contrib/openzfs/config/kernel-current-time.m4  |  26 --
 sys/contrib/openzfs/config/kernel-dentry-alias.m4  |  30 --
 .../openzfs/config/kernel-dentry-operations.m4     | 135 ------
 sys/contrib/openzfs/config/kernel-dirty-inode.m4   |  29 --
 .../openzfs/config/kernel-encode-fh-inode.m4       |  27 --
 sys/contrib/openzfs/config/kernel-evict-inode.m4   |  24 -
 sys/contrib/openzfs/config/kernel-fadvise.m4       |  23 -
 sys/contrib/openzfs/config/kernel-fallocate.m4     |  44 --
 sys/contrib/openzfs/config/kernel-file-dentry.m4   |  24 -
 sys/contrib/openzfs/config/kernel-file-inode.m4    |  23 -
 sys/contrib/openzfs/config/kernel-file.m4          |  31 ++
 sys/contrib/openzfs/config/kernel-filemap.m4       |  27 --
 sys/contrib/openzfs/config/kernel-fsync.m4         |  53 ---
 .../openzfs/config/kernel-generic_fillattr.m4      |   4 +
 .../openzfs/config/kernel-generic_io_acct.m4       |  29 --
 .../openzfs/config/kernel-generic_readlink.m4      |  25 --
 sys/contrib/openzfs/config/kernel-genhd-flags.m4   |  21 +-
 sys/contrib/openzfs/config/kernel-get-link.m4      | 104 -----
 .../openzfs/config/kernel-global_page_state.m4     | 128 ------
 sys/contrib/openzfs/config/kernel-group-info.m4    |  22 -
 sys/contrib/openzfs/config/kernel-hotplug.m4       |  26 --
 .../openzfs/config/kernel-in-compat-syscall.m4     |  24 -
 sys/contrib/openzfs/config/kernel-inode-getattr.m4 |  26 --
 sys/contrib/openzfs/config/kernel-inode-lock.m4    |  24 -
 .../openzfs/config/kernel-inode-permission.m4      |   2 +
 .../openzfs/config/kernel-inode-set-flags.m4       |  22 -
 .../openzfs/config/kernel-inode-set-iversion.m4    |  23 -
 sys/contrib/openzfs/config/kernel-inode-setattr.m4 |  22 -
 sys/contrib/openzfs/config/kernel-inode-times.m4   |  23 -
 .../openzfs/config/kernel-kmap-local-page.m4       |  23 +
 sys/contrib/openzfs/config/kernel-kmem-cache.m4    |  41 --
 sys/contrib/openzfs/config/kernel-kmem.m4          |  27 +-
 sys/contrib/openzfs/config/kernel-kstrtoul.m4      |  21 -
 sys/contrib/openzfs/config/kernel-kthread.m4       |  37 +-
 sys/contrib/openzfs/config/kernel-ktime.m4         |  55 ---
 sys/contrib/openzfs/config/kernel-lseek-execute.m4 |  27 --
 .../openzfs/config/kernel-make-request-fn.m4       |  42 +-
 sys/contrib/openzfs/config/kernel-mkdir.m4         |  11 +-
 sys/contrib/openzfs/config/kernel-mm-page-flags.m4 |  24 +
 sys/contrib/openzfs/config/kernel-mm-pagemap.m4    |   4 +-
 sys/contrib/openzfs/config/kernel-percpu.m4        |  56 ---
 sys/contrib/openzfs/config/kernel-put-link.m4      |  61 ---
 .../openzfs/config/kernel-register_sysctl_table.m4 |   2 +-
 sys/contrib/openzfs/config/kernel-rename.m4        |  64 +--
 sys/contrib/openzfs/config/kernel-rw.m4            |  69 ---
 sys/contrib/openzfs/config/kernel-rwsem.m4         |  60 ---
 sys/contrib/openzfs/config/kernel-sched.m4         |  53 ---
 .../openzfs/config/kernel-setattr-prepare.m4       |   2 +
 sys/contrib/openzfs/config/kernel-shrink.m4        | 163 +------
 sys/contrib/openzfs/config/kernel-signal-stop.m4   |  21 -
 sys/contrib/openzfs/config/kernel-special-state.m4 |  21 -
 sys/contrib/openzfs/config/kernel-strlcpy.m4       |  25 +-
 sys/contrib/openzfs/config/kernel-super-userns.m4  |  25 --
 sys/contrib/openzfs/config/kernel-symlink.m4       |   2 +
 sys/contrib/openzfs/config/kernel-timer.m4         |  75 ----
 sys/contrib/openzfs/config/kernel-tmpfile.m4       |   4 -
 sys/contrib/openzfs/config/kernel-user-ns-inum.m4  |  23 -
 .../openzfs/config/kernel-userns-capabilities.m4   |  27 --
 sys/contrib/openzfs/config/kernel-vfs-direct_IO.m4 |  54 +--
 .../config/kernel-vfs-extended-file_range.m4       |  50 ---
 .../openzfs/config/kernel-vfs-file_range.m4        |  30 --
 sys/contrib/openzfs/config/kernel-vfs-getattr.m4   |  86 ----
 sys/contrib/openzfs/config/kernel-vfs-iov_iter.m4  | 163 ++-----
 sys/contrib/openzfs/config/kernel-vfs-iterate.m4   |  83 ----
 .../openzfs/config/kernel-vfs-rw-iterate.m4        |  80 ----
 sys/contrib/openzfs/config/kernel-wait.m4          |  99 -----
 sys/contrib/openzfs/config/kernel-xattr-handler.m4 | 322 +-------------
 sys/contrib/openzfs/config/kernel-zlib.m4          |  26 --
 sys/contrib/openzfs/config/kernel.m4               | 102 +----
 sys/contrib/openzfs/config/user.m4                 |   2 +-
 sys/contrib/openzfs/contrib/Makefile.am            |   1 +
 .../openzfs/contrib/bash_completion.d/Makefile.am  |   5 +-
 .../openzfs/contrib/bash_completion.d/zfs.in       |   2 +-
 sys/contrib/openzfs/contrib/debian/Makefile.am     |  48 ++
 sys/contrib/openzfs/contrib/debian/not-installed   |   1 -
 sys/contrib/openzfs/contrib/debian/rules.in        |   8 +-
 sys/contrib/openzfs/contrib/initramfs/scripts/zfs  |   5 +-
 sys/contrib/openzfs/include/Makefile.am            |   1 +
 sys/contrib/openzfs/include/libzutil.h             |  14 +
 sys/contrib/openzfs/include/os/freebsd/Makefile.am |   2 +
 .../openzfs/include/os/freebsd/linux/compiler.h    |  83 +---
 .../openzfs/include/os/freebsd/spl/sys/ccompat.h   |  51 ---
 .../openzfs/include/os/freebsd/spl/sys/debug.h     | 149 ++++++-
 .../openzfs/include/os/freebsd/spl/sys/kmem.h      |   1 +
 .../openzfs/include/os/freebsd/spl/sys/policy.h    |   6 -
 .../openzfs/include/os/freebsd/spl/sys/proc.h      |   3 -
 .../openzfs/include/os/freebsd/spl/sys/random.h    |   4 +-
 .../openzfs/include/os/freebsd/spl/sys/sig.h       |   8 +-
 .../openzfs/include/os/freebsd/spl/sys/simd.h      |   3 +
 .../openzfs/include/os/freebsd/spl/sys/vm.h        |  16 -
 .../openzfs/include/os/freebsd/spl/sys/vnode.h     |   6 +-
 .../zfs/sys/abd_impl_os.h}                         |  31 +-
 .../openzfs/include/os/freebsd/zfs/sys/abd_os.h    |  46 ++
 .../include/os/freebsd/zfs/sys/zfs_vfsops_os.h     |  77 ----
 sys/contrib/openzfs/include/os/linux/Makefile.am   |   3 +-
 .../include/os/linux/kernel/linux/blkdev_compat.h  | 229 +---------
 .../include/os/linux/kernel/linux/dcache_compat.h  |   6 -
 .../include/os/linux/kernel/linux/kmap_compat.h    |  10 +-
 .../include/os/linux/kernel/linux/mm_compat.h      |  14 +
 .../include/os/linux/kernel/linux/page_compat.h    |  56 ---
 .../openzfs/include/os/linux/kernel/linux/simd.h   |   4 +
 .../include/os/linux/kernel/linux/vfs_compat.h     | 235 +---------
 .../include/os/linux/kernel/linux/xattr_compat.h   | 106 +----
 .../openzfs/include/os/linux/spl/sys/condvar.h     |   4 +-
 .../openzfs/include/os/linux/spl/sys/cred.h        |   4 -
 .../openzfs/include/os/linux/spl/sys/debug.h       | 152 ++++++-
 .../openzfs/include/os/linux/spl/sys/file.h        |  11 -
 .../openzfs/include/os/linux/spl/sys/kmem_cache.h  |   8 +-
 .../openzfs/include/os/linux/spl/sys/signal.h      |   8 +-
 .../openzfs/include/os/linux/spl/sys/string.h      |   7 -
 .../openzfs/include/os/linux/spl/sys/taskq.h       |   6 +-
 .../openzfs/include/os/linux/spl/sys/thread.h      |   7 -
 .../openzfs/include/os/linux/spl/sys/time.h        |  28 --
 .../openzfs/include/os/linux/spl/sys/timer.h       |  20 -
 .../openzfs/include/os/linux/spl/sys/types.h       |   6 +
 .../openzfs/include/os/linux/spl/sys/wait.h        |  24 -
 .../openzfs/include/os/linux/spl/sys/wmsum.h       |   9 -
 .../openzfs/include/os/linux/zfs/sys/abd_impl_os.h |  41 ++
 .../openzfs/include/os/linux/zfs/sys/abd_os.h      |  62 +++
 .../include/os/linux/zfs/sys/trace_dbgmsg.h        |   3 +-
 .../openzfs/include/os/linux/zfs/sys/trace_dbuf.h  |  29 +-
 .../include/os/linux/zfs/sys/zfs_vfsops_os.h       |   1 +
 .../include/os/linux/zfs/sys/zfs_vnops_os.h        |   3 +-
 .../include/os/linux/zfs/sys/zfs_znode_impl.h      |  25 --
 sys/contrib/openzfs/include/os/linux/zfs/sys/zpl.h |  85 +---
 sys/contrib/openzfs/include/sys/abd.h              |  33 +-
 sys/contrib/openzfs/include/sys/abd_impl.h         |  14 +-
 sys/contrib/openzfs/include/sys/dbuf.h             |  53 +--
 sys/contrib/openzfs/include/sys/sa_impl.h          |   4 +-
 sys/contrib/openzfs/include/sys/vdev.h             |   1 +
 sys/contrib/openzfs/include/sys/zfs_context.h      |   4 +-
 sys/contrib/openzfs/include/sys/zfs_debug.h        |   2 +-
 sys/contrib/openzfs/include/sys/zfs_file.h         |   2 +-
 sys/contrib/openzfs/include/sys/zfs_znode.h        |   2 +
 sys/contrib/openzfs/include/sys/zil.h              |  30 +-
 sys/contrib/openzfs/include/sys/zio.h              |   3 +
 sys/contrib/openzfs/include/sys/zio_impl.h         |   3 +
 sys/contrib/openzfs/include/sys/zio_priority.h     |   4 +
 sys/contrib/openzfs/include/sys/zvol_impl.h        |  18 +-
 sys/contrib/openzfs/include/zfs_valstr.h           |  84 ++++
 sys/contrib/openzfs/lib/libshare/nfs.c             |  21 +-
 sys/contrib/openzfs/lib/libshare/os/freebsd/nfs.c  |   7 +-
 sys/contrib/openzfs/lib/libspl/include/assert.h    |  97 ++++
 sys/contrib/openzfs/lib/libspl/include/sys/simd.h  |   3 +
 .../openzfs/lib/libspl/os/freebsd/getmntany.c      |   5 +-
 sys/contrib/openzfs/lib/libspl/os/freebsd/mnttab.c |   3 -
 .../openzfs/lib/libspl/os/linux/getmntany.c        |   3 +-
 sys/contrib/openzfs/lib/libzfs/Makefile.am         |   1 +
 sys/contrib/openzfs/lib/libzfs/libzfs.abi          |  51 +++
 sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c     |   9 +-
 sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c    |   2 +-
 sys/contrib/openzfs/lib/libzfs/libzfs_diff.c       |  17 +-
 sys/contrib/openzfs/lib/libzfs/libzfs_mount.c      |   5 +-
 sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c   |  20 +-
 sys/contrib/openzfs/lib/libzfs/libzfs_util.c       |  15 +-
 .../openzfs/lib/libzfs/os/freebsd/libzfs_compat.c  |   2 +-
 .../openzfs/lib/libzfs/os/freebsd/libzfs_zmount.c  |   3 -
 sys/contrib/openzfs/lib/libzpool/Makefile.am       |  18 +-
 sys/contrib/openzfs/lib/libzpool/abd_os.c          | 492 +++++++++++++++++++++
 sys/contrib/openzfs/lib/libzpool/arc_os.c          |  87 ++++
 .../openzfs/lib/libzpool/include/Makefile.am       |   4 +
 .../openzfs/lib/libzpool/include/sys/abd_impl_os.h |  41 ++
 .../openzfs/lib/libzpool/include/sys/abd_os.h      |  47 ++
 sys/contrib/openzfs/lib/libzpool/kernel.c          |  24 +-
 sys/contrib/openzfs/lib/libzpool/vdev_label_os.c   |  51 +++
 sys/contrib/openzfs/lib/libzpool/zfs_debug.c       | 106 +++++
 sys/contrib/openzfs/lib/libzpool/zfs_racct.c       |  38 ++
 sys/contrib/openzfs/lib/libzutil/zutil_import.c    |  29 +-
 sys/contrib/openzfs/man/man4/zfs.4                 |  32 +-
 sys/contrib/openzfs/man/man7/zfsprops.7            |  13 +-
 sys/contrib/openzfs/man/man7/zpool-features.7      |  29 +-
 sys/contrib/openzfs/man/man8/zdb.8                 |   4 +-
 sys/contrib/openzfs/module/Kbuild.in               |   5 +-
 sys/contrib/openzfs/module/Makefile.bsd            |   4 +-
 sys/contrib/openzfs/module/lua/lobject.h           |  21 +-
 sys/contrib/openzfs/module/lua/lstate.h            |   2 +-
 sys/contrib/openzfs/module/lua/lstring.c           |   2 +-
 sys/contrib/openzfs/module/lua/lstring.h           |   2 +-
 .../openzfs/module/os/freebsd/spl/spl_acl.c        |   3 -
 .../openzfs/module/os/freebsd/spl/spl_atomic.c     |   3 -
 .../openzfs/module/os/freebsd/spl/spl_dtrace.c     |   3 -
 .../openzfs/module/os/freebsd/spl/spl_kmem.c       |  11 -
 .../openzfs/module/os/freebsd/spl/spl_kstat.c      |   3 -
 .../openzfs/module/os/freebsd/spl/spl_misc.c       |   3 -
 .../openzfs/module/os/freebsd/spl/spl_policy.c     |  55 ++-
 .../module/os/freebsd/spl/spl_procfs_list.c        |   3 -
 .../openzfs/module/os/freebsd/spl/spl_sunddi.c     |   3 -
 .../openzfs/module/os/freebsd/spl/spl_sysevent.c   |   3 -
 .../openzfs/module/os/freebsd/spl/spl_taskq.c      |  12 +-
 .../openzfs/module/os/freebsd/spl/spl_vfs.c        |  15 +-
 sys/contrib/openzfs/module/os/freebsd/spl/spl_vm.c |   3 -
 .../openzfs/module/os/freebsd/spl/spl_zlib.c       |   3 -
 .../openzfs/module/os/freebsd/spl/spl_zone.c       |   7 +-
 sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c |   4 +-
 sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c |   6 +-
 .../openzfs/module/os/freebsd/zfs/crypto_os.c      | 252 -----------
 sys/contrib/openzfs/module/os/freebsd/zfs/dmu_os.c |  30 +-
 .../openzfs/module/os/freebsd/zfs/event_os.c       |  19 -
 .../openzfs/module/os/freebsd/zfs/kmod_core.c      |   7 -
 .../openzfs/module/os/freebsd/zfs/sysctl_os.c      |   3 -
 .../openzfs/module/os/freebsd/zfs/vdev_file.c      |  11 +-
 .../openzfs/module/os/freebsd/zfs/vdev_geom.c      |   4 -
 .../openzfs/module/os/freebsd/zfs/zfs_acl.c        |   2 +-
 .../openzfs/module/os/freebsd/zfs/zfs_ctldir.c     |  28 +-
 .../openzfs/module/os/freebsd/zfs/zfs_debug.c      |  23 +-
 .../openzfs/module/os/freebsd/zfs/zfs_dir.c        |   4 +-
 .../openzfs/module/os/freebsd/zfs/zfs_file_os.c    |  27 +-
 .../module/os/freebsd/zfs/zfs_ioctl_compat.c       |   3 -
 .../openzfs/module/os/freebsd/zfs/zfs_ioctl_os.c   |   7 -
 .../openzfs/module/os/freebsd/zfs/zfs_vfsops.c     |  36 +-
 .../openzfs/module/os/freebsd/zfs/zfs_vnops_os.c   | 292 ++----------
 .../os/freebsd/zfs/{zfs_znode.c => zfs_znode_os.c} | 388 +---------------
 .../openzfs/module/os/freebsd/zfs/zvol_os.c        |  18 +-
 .../openzfs/module/os/linux/spl/spl-condvar.c      |  47 +-
 sys/contrib/openzfs/module/os/linux/spl/spl-cred.c |  21 +-
 .../openzfs/module/os/linux/spl/spl-generic.c      |  30 +-
 .../openzfs/module/os/linux/spl/spl-kmem-cache.c   |  29 +-
 sys/contrib/openzfs/module/os/linux/spl/spl-kmem.c |   2 -
 sys/contrib/openzfs/module/os/linux/spl/spl-proc.c |  13 +-
 .../openzfs/module/os/linux/spl/spl-shrinker.c     |  46 +-
 .../openzfs/module/os/linux/spl/spl-taskq.c        |  24 +-
 .../openzfs/module/os/linux/spl/spl-thread.c       |  47 +-
 sys/contrib/openzfs/module/os/linux/spl/spl-vmem.c |   1 -
 sys/contrib/openzfs/module/os/linux/spl/spl-zlib.c |   3 +-
 sys/contrib/openzfs/module/os/linux/spl/spl-zone.c |  20 +-
 sys/contrib/openzfs/module/os/linux/zfs/abd_os.c   | 190 ++------
 sys/contrib/openzfs/module/os/linux/zfs/arc_os.c   |  45 --
 sys/contrib/openzfs/module/os/linux/zfs/policy.c   |   9 -
 .../openzfs/module/os/linux/zfs/vdev_disk.c        | 227 +++++-----
 .../openzfs/module/os/linux/zfs/vdev_file.c        |   9 +-
 sys/contrib/openzfs/module/os/linux/zfs/zfs_acl.c  |   2 +-
 .../openzfs/module/os/linux/zfs/zfs_ctldir.c       | 112 ++++-
 .../openzfs/module/os/linux/zfs/zfs_debug.c        |  40 --
 .../openzfs/module/os/linux/zfs/zfs_file_os.c      |  74 +---
 sys/contrib/openzfs/module/os/linux/zfs/zfs_uio.c  |  14 +-
 .../openzfs/module/os/linux/zfs/zfs_vfsops.c       | 103 +----
 .../openzfs/module/os/linux/zfs/zfs_vnops_os.c     |  53 ++-
 .../os/linux/zfs/{zfs_znode.c => zfs_znode_os.c}   | 406 +----------------
 .../openzfs/module/os/linux/zfs/zpl_ctldir.c       |  86 +---
 .../openzfs/module/os/linux/zfs/zpl_export.c       |  39 +-
 sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c | 290 +-----------
 .../openzfs/module/os/linux/zfs/zpl_file_range.c   |   8 +-
 .../openzfs/module/os/linux/zfs/zpl_inode.c        | 117 +----
 .../openzfs/module/os/linux/zfs/zpl_super.c        |  26 +-
 .../openzfs/module/os/linux/zfs/zpl_xattr.c        | 100 +----
 sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c  |  84 ++--
 sys/contrib/openzfs/module/zcommon/simd_stat.c     | 203 +++++++++
 sys/contrib/openzfs/module/zcommon/zfs_prop.c      |   8 +-
 sys/contrib/openzfs/module/zcommon/zfs_valstr.c    | 277 ++++++++++++
 sys/contrib/openzfs/module/zcommon/zpool_prop.c    |   5 +-
 sys/contrib/openzfs/module/zfs/arc.c               |  26 +-
 sys/contrib/openzfs/module/zfs/dbuf.c              |  18 +-
 sys/contrib/openzfs/module/zfs/dmu.c               |  61 ++-
 sys/contrib/openzfs/module/zfs/dmu_diff.c          |   2 +-
 sys/contrib/openzfs/module/zfs/dmu_objset.c        |   2 +-
 sys/contrib/openzfs/module/zfs/dmu_recv.c          |   2 +-
 sys/contrib/openzfs/module/zfs/dmu_redact.c        |   2 +-
 sys/contrib/openzfs/module/zfs/dmu_send.c          |   2 +-
 sys/contrib/openzfs/module/zfs/dmu_tx.c            |   5 +-
 sys/contrib/openzfs/module/zfs/dnode.c             |   4 +-
 sys/contrib/openzfs/module/zfs/dsl_crypt.c         |   2 +-
 sys/contrib/openzfs/module/zfs/dsl_dataset.c       |  11 +-
 sys/contrib/openzfs/module/zfs/lz4_zfs.c           |   3 +-
 sys/contrib/openzfs/module/zfs/sa.c                |   6 +-
 sys/contrib/openzfs/module/zfs/vdev.c              |  15 +-
 sys/contrib/openzfs/module/zfs/zcp.c               |   3 +-
 sys/contrib/openzfs/module/zfs/zfs_ioctl.c         |   2 +-
 sys/contrib/openzfs/module/zfs/zfs_log.c           |  92 ++--
 sys/contrib/openzfs/module/zfs/zfs_replay.c        | 147 +++---
 sys/contrib/openzfs/module/zfs/zfs_vnops.c         |   5 +
 sys/contrib/openzfs/module/zfs/zfs_znode.c         | 397 +++++++++++++++++
 sys/contrib/openzfs/module/zfs/zio.c               |   4 +
 sys/contrib/openzfs/module/zfs/zvol.c              | 116 ++++-
 sys/contrib/openzfs/scripts/Makefile.am            |   1 -
 sys/contrib/openzfs/scripts/enum-extract.pl        |  58 ---
 sys/contrib/openzfs/scripts/zfs-tests.sh           |  73 ++-
 sys/contrib/openzfs/tests/runfiles/linux.run       |   6 +
 .../tests/test-runner/bin/test-runner.py.in        |  12 +
 .../openzfs/tests/test-runner/bin/zts-report.py.in |  69 +--
 .../openzfs/tests/zfs-tests/cmd/mmap_seek.c        |  10 +
 .../openzfs/tests/zfs-tests/cmd/mmap_sync.c        |   2 +-
 .../openzfs/tests/zfs-tests/include/commands.cfg   |   8 +-
 .../openzfs/tests/zfs-tests/include/libtest.shlib  |  39 +-
 .../openzfs/tests/zfs-tests/include/tunables.cfg   |   1 +
 .../openzfs/tests/zfs-tests/tests/Makefile.am      |   3 +-
 .../tests/functional/bclone/bclone_common.kshlib   |   4 +-
 .../functional/bclone/bclone_corner_cases.kshlib   |   6 +-
 .../tests/functional/bclone/bclone_prop_sync.ksh   |   8 +-
 .../functional/block_cloning/block_cloning.kshlib  |   4 +-
 .../block_cloning_cross_enc_dataset.ksh            |   8 +-
 .../tests/functional/cli_root/zdb/zdb_backup.ksh   |   4 +-
 .../zfs_receive_compressed_corrective.ksh          |   4 +-
 .../zfs_receive/zfs_receive_corrective.ksh         |   6 +-
 .../zfs_receive/zfs_receive_from_encrypted.ksh     |   6 +-
 .../cli_root/zfs_receive/zfs_receive_from_zstd.ksh |   4 +-
 .../zfs_receive_large_block_corrective.ksh         |   4 +-
 .../cli_root/zfs_receive/zfs_receive_raw.ksh       |   6 +-
 .../zfs_receive/zfs_receive_raw_incremental.ksh    |   4 +-
 .../cli_root/zpool_add/zpool_add_dryrun_output.ksh |   6 +-
 .../cli_root/zpool_create/zpool_create.shlib       |   5 +-
 .../zpool_create/zpool_create_dryrun_output.ksh    |   4 +-
 .../import_cachefile_shared_device.ksh             |   2 +-
 .../zpool_import/import_devices_missing.ksh        |   8 +-
 .../zpool_import/import_rewind_config_changed.ksh  |   4 +-
 .../zpool_import/import_rewind_device_replaced.ksh |   6 +-
 .../cli_root/zpool_import/zpool_import.cfg         |   4 +-
 .../cli_root/zpool_import/zpool_import.kshlib      |  34 +-
 ...ort_hostid_changed_cachefile_unclean_export.ksh |  10 +-
 .../zpool_import_hostid_changed_unclean_export.ksh |   9 +-
 .../cli_root/zpool_reopen/zpool_reopen_003_pos.ksh |   4 +-
 .../cli_root/zpool_set/user_property_001_pos.ksh   |   4 +-
 .../cli_root/zpool_set/user_property_002_neg.ksh   |  22 +-
 .../zpool_split/zpool_split_dryrun_output.ksh      |   6 +-
 .../cli_root/zpool_status/zpool_status_008_pos.ksh |   6 +-
 .../tests/functional/cp_files/cp_files_002_pos.ksh |   4 +-
 .../tests/functional/cp_files/seekflood.c          |   7 +
 .../tests/functional/deadman/deadman_ratelimit.ksh |   8 +-
 .../tests/functional/deadman/deadman_sync.ksh      |   8 +-
 .../functional/fault/suspend_resume_single.ksh     |   4 +-
 .../tests/functional/history/history_003_pos.ksh   |   6 +-
 .../tests/functional/luks/luks_sanity.ksh          |  90 ++++
 .../tests/functional/no_space/enospc_ganging.ksh   |   6 +-
 .../zfs-tests/tests/functional/rsend/rsend.kshlib  |  14 +-
 .../tests/functional/rsend/send-c_volume.ksh       |  12 +-
 .../functional/rsend/send-wR_encrypted_zvol.ksh    |   6 +-
 .../functional/rsend/send_encrypted_props.ksh      |  14 +-
 .../rsend/send_encrypted_truncated_files.ksh       |  12 +-
 .../tests/functional/rsend/send_hole_birth.ksh     |   2 +-
 .../tests/functional/slog/slog_replay_fs_001.ksh   |   4 +-
 .../tests/functional/slog/slog_replay_volume.ksh   |   4 +-
 .../functional/zvol/zvol_misc/zvol_misc_fua.ksh    |   9 -
 .../zvol/zvol_misc/zvol_misc_snapdev.ksh           |  13 +
 .../functional/zvol/zvol_misc/zvol_misc_trim.ksh   |   9 -
 sys/contrib/openzfs/udev/zvol_id.c                 |   7 +-
 sys/modules/zfs/Makefile                           |   4 +-
 sys/modules/zfs/zfs_config.h                       | 488 ++------------------
 sys/modules/zfs/zfs_gitrev.h                       |   2 +-
 usr.sbin/fstyp/Makefile                            |   1 +
 400 files changed, 6453 insertions(+), 9830 deletions(-)

diff --cc cddl/lib/libicp/Makefile
index 1dbe4ace88ed,000000000000..1e90f3c85168
mode 100644,000000..100644
--- a/cddl/lib/libicp/Makefile
+++ b/cddl/lib/libicp/Makefile
@@@ -1,142 -1,0 +1,143 @@@
 +
 +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp
 +
 +PACKAGE=	zfs
 +LIB=	icp
 +LIBADD=
 +
 +.if ${MACHINE_ARCH} == "amd64"
 +ASM_SOURCES_C = asm-x86_64/aes/aeskey.c
 +ASM_SOURCES_AS = \
 +        asm-x86_64/aes/aes_amd64.S \
 +        asm-x86_64/aes/aes_aesni.S \
 +        asm-x86_64/modes/gcm_pclmulqdq.S \
 +        asm-x86_64/modes/aesni-gcm-x86_64.S \
 +        asm-x86_64/modes/ghash-x86_64.S \
 +        asm-x86_64/sha2/sha256-x86_64.S \
 +        asm-x86_64/sha2/sha512-x86_64.S \
 +        asm-x86_64/blake3/blake3_avx2.S \
 +        asm-x86_64/blake3/blake3_avx512.S \
 +        asm-x86_64/blake3/blake3_sse2.S \
 +        asm-x86_64/blake3/blake3_sse41.S
 +
 +CFLAGS+= -D__amd64 -D_SYS_STACK_H -UHAVE_AES
 +.elif ${MACHINE_CPUARCH} == "arm"
 +ASM_SOURCES_C =
 +ASM_SOURCES_AS = \
 +        asm-arm/sha2/sha256-armv7.S \
 +        asm-arm/sha2/sha512-armv7.S
 +.elif ${MACHINE_ARCH} == "aarch64"
 +ASM_SOURCES_C =
 +ASM_SOURCES_AS = \
 +        asm-aarch64/blake3/b3_aarch64_sse2.S \
 +        asm-aarch64/blake3/b3_aarch64_sse41.S \
 +        asm-aarch64/sha2/sha256-armv8.S \
 +        asm-aarch64/sha2/sha512-armv8.S
 +.elif ${MACHINE_ARCH} == "powerpc64"
 +ASM_SOURCES_C =
 +ASM_SOURCES_AS = \
 +        asm-ppc64/sha2/sha256-ppc.S \
 +        asm-ppc64/sha2/sha512-ppc.S \
 +        asm-ppc64/sha2/sha256-p8.S \
 +        asm-ppc64/sha2/sha512-p8.S
 +.elif ${MACHINE_ARCH} == "powerpc64le"
 +ASM_SOURCES_C =
 +ASM_SOURCES_AS = \
 +        asm-ppc64/blake3/b3_ppc64le_sse2.S \
 +        asm-ppc64/blake3/b3_ppc64le_sse41.S \
 +        asm-ppc64/sha2/sha256-ppc.S \
 +        asm-ppc64/sha2/sha512-ppc.S \
 +        asm-ppc64/sha2/sha256-p8.S \
 +        asm-ppc64/sha2/sha512-p8.S
 +.else
 +ASM_SOURCES_C =
 +ASM_SOURCES_AS =
 +.endif
 +
 +KERNEL_C = \
 +        spi/kcf_spi.c \
 +        api/kcf_ctxops.c \
 +        api/kcf_cipher.c \
 +        api/kcf_mac.c \
 +        algs/aes/aes_impl_aesni.c \
 +        algs/aes/aes_impl_generic.c \
 +        algs/aes/aes_impl_x86-64.c \
 +        algs/aes/aes_impl.c \
 +        algs/aes/aes_modes.c \
 +        algs/blake3/blake3.c \
 +        algs/blake3/blake3_generic.c \
 +        algs/blake3/blake3_impl.c \
 +        algs/edonr/edonr.c \
 +        algs/modes/modes.c \
 +        algs/modes/cbc.c \
 +        algs/modes/gcm_generic.c \
 +        algs/modes/gcm_pclmulqdq.c \
 +        algs/modes/gcm.c \
 +        algs/modes/ctr.c \
 +        algs/modes/ccm.c \
 +        algs/modes/ecb.c \
 +        algs/sha2/sha2_generic.c \
 +        algs/sha2/sha256_impl.c \
 +        algs/sha2/sha512_impl.c \
 +        algs/skein/skein.c \
 +        algs/skein/skein_block.c \
 +        algs/skein/skein_iv.c \
 +        illumos-crypto.c \
 +        io/aes.c \
 +        io/sha2_mod.c \
 +        io/skein_mod.c \
 +        core/kcf_sched.c \
 +        core/kcf_prov_lib.c \
 +        core/kcf_callprov.c \
 +        core/kcf_mech_tabs.c \
 +        core/kcf_prov_tabs.c \
 +        $(ASM_SOURCES_C)
 +
 +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zfs
 +KERNEL_C+=	zfs_impl.c
 +
 +SRCS= $(ASM_SOURCES_AS) $(KERNEL_C)
 +
 +WARNS?=	2
 +SHLIB_MAJOR= 3
 +CSTD=	c99
 +CFLAGS+= -DIN_BASE
 +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
 +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
 +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
 +CFLAGS+= -I${SRCTOP}/sys
 +CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
 +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
++CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libzpool/include
 +CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
 +CFLAGS+= -DHAVE_ISSETUGID
 +CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
 +
 +CFLAGS.aes_amd64.S+= -DLOCORE
 +CFLAGS.aes_aesni.S+= -DLOCORE
 +CFLAGS.gcm_pclmulqdq.S+= -DLOCORE
 +CFLAGS.aesni-gcm-x86_64.S+= -DLOCORE
 +CFLAGS.ghash-x86_64.S+= -DLOCORE
 +CFLAGS.sha256-x86_64.S+= -DLOCORE
 +CFLAGS.sha512-x86_64.S+= -DLOCORE
 +CFLAGS.blake3_avx2.S = -DLOCORE
 +CFLAGS.blake3_avx512.S = -DLOCORE
 +CFLAGS.blake3_sse2.S = -DLOCORE
 +CFLAGS.blake3_sse41.S = -DLOCORE
 +CFLAGS.b3_aarch64_sse2.S = -DLOCORE
 +CFLAGS.b3_aarch64_sse41.S = -DLOCORE
 +CFLAGS.sha256-armv7.S = -DLOCORE
 +CFLAGS.sha256-armv8.S = -DLOCORE
 +CFLAGS.sha512-armv7.S = -DLOCORE
 +CFLAGS.sha512-armv8.S = -DLOCORE
 +CFLAGS.b3_ppc64le_sse2.S = -DLOCORE
 +CFLAGS.b3_ppc64le_sse41.S = -DLOCORE
 +CFLAGS.sha256-p8.S = -DLOCORE
 +CFLAGS.sha256-ppc.S = -DLOCORE
 +CFLAGS.sha512-p8.S = -DLOCORE
 +CFLAGS.sha512-ppc.S = -DLOCORE
 +
 +
 +LDFLAGS.bfd+= -Wl,-znoexecstack
 +
 +.include <bsd.lib.mk>
diff --cc cddl/lib/libicp_rescue/Makefile
index 196f96b1fcf8,000000000000..7a77e17bdfc0
mode 100644,000000..100644
--- a/cddl/lib/libicp_rescue/Makefile
+++ b/cddl/lib/libicp_rescue/Makefile
@@@ -1,139 -1,0 +1,140 @@@
 +
 +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp
 +
 +PACKAGE=	utilities
 +LIB=	icp_rescue
 +LIBADD=
 +
 +.if ${MACHINE_ARCH} == "amd64"
 +ASM_SOURCES_C = asm-x86_64/aes/aeskey.c
 +ASM_SOURCES_AS = \
 +        asm-x86_64/aes/aes_amd64.S \
 +        asm-x86_64/aes/aes_aesni.S \
 +        asm-x86_64/modes/gcm_pclmulqdq.S \
 +        asm-x86_64/modes/aesni-gcm-x86_64.S \
 +        asm-x86_64/sha2/sha256-x86_64.S \
 +        asm-x86_64/sha2/sha512-x86_64.S \
 +        asm-x86_64/blake3/blake3_avx2.S \
 +        asm-x86_64/blake3/blake3_avx512.S \
 +        asm-x86_64/blake3/blake3_sse2.S \
 +        asm-x86_64/blake3/blake3_sse41.S
 +
 +CFLAGS+= -D__amd64 -D_SYS_STACK_H
 +.elif ${MACHINE_CPUARCH} == "arm"
 +ASM_SOURCES_C =
 +ASM_SOURCES_AS = \
 +        asm-arm/sha2/sha256-armv7.S \
 +        asm-arm/sha2/sha512-armv7.S
 +.elif ${MACHINE_ARCH} == "aarch64"
 +ASM_SOURCES_C =
 +ASM_SOURCES_AS = \
 +        asm-aarch64/blake3/b3_aarch64_sse2.S \
 +        asm-aarch64/blake3/b3_aarch64_sse41.S \
 +        asm-aarch64/sha2/sha256-armv8.S \
 +        asm-aarch64/sha2/sha512-armv8.S
 +.elif ${MACHINE_ARCH} == "powerpc64"
 +ASM_SOURCES_C =
 +ASM_SOURCES_AS = \
 +        asm-ppc64/sha2/sha256-ppc.S \
 +        asm-ppc64/sha2/sha512-ppc.S \
 +        asm-ppc64/sha2/sha256-p8.S \
 +        asm-ppc64/sha2/sha512-p8.S
 +.elif ${MACHINE_ARCH} == "powerpc64le"
 +ASM_SOURCES_C =
 +ASM_SOURCES_AS = \
 +        asm-ppc64/blake3/b3_ppc64le_sse2.S \
 +        asm-ppc64/blake3/b3_ppc64le_sse41.S \
 +        asm-ppc64/sha2/sha256-ppc.S \
 +        asm-ppc64/sha2/sha512-ppc.S \
 +        asm-ppc64/sha2/sha256-p8.S \
 +        asm-ppc64/sha2/sha512-p8.S
 +.else
 +ASM_SOURCES_C =
 +ASM_SOURCES_AS =
 +.endif
 +
 +KERNEL_C = \
 +        spi/kcf_spi.c \
 +        api/kcf_ctxops.c \
 +        api/kcf_cipher.c \
 +        api/kcf_mac.c \
 +        algs/aes/aes_impl_aesni.c \
 +        algs/aes/aes_impl_generic.c \
 +        algs/aes/aes_impl_x86-64.c \
 +        algs/aes/aes_impl.c \
 +        algs/aes/aes_modes.c \
 +        algs/blake3/blake3.c \
 +        algs/blake3/blake3_generic.c \
 +        algs/blake3/blake3_impl.c \
 +        algs/edonr/edonr.c \
 +        algs/modes/modes.c \
 +        algs/modes/cbc.c \
 +        algs/modes/gcm_generic.c \
 +        algs/modes/gcm_pclmulqdq.c \
 +        algs/modes/gcm.c \
 +        algs/modes/ctr.c \
 +        algs/modes/ccm.c \
 +        algs/modes/ecb.c \
 +        algs/sha2/sha2_generic.c \
 +        algs/sha2/sha256_impl.c \
 +        algs/sha2/sha512_impl.c \
 +        algs/skein/skein_block.c \
 +        illumos-crypto.c \
 +        io/aes.c \
 +        io/sha2_mod.c \
 +        io/skein_mod.c \
 +        core/kcf_sched.c \
 +        core/kcf_prov_lib.c \
 +        core/kcf_callprov.c \
 +        core/kcf_mech_tabs.c \
 +        core/kcf_prov_tabs.c \
 +        $(ASM_SOURCES_C)
 +
 +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zfs
 +KERNEL_C+=	zfs_impl.c
 +
 +SRCS= $(ASM_SOURCES_AS) $(KERNEL_C)
 +
 +WARNS?=	2
 +SHLIB_MAJOR= 3
 +CSTD=	c99
 +CFLAGS+= -DIN_BASE
 +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
 +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
 +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
 +CFLAGS+= -I${SRCTOP}/sys
 +CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
 +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
++CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libzpool/include
 +CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
 +CFLAGS+= -DHAVE_ISSETUGID -UHAVE_AVX -DRESCUE
 +CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
 +
 +CFLAGS.aes_amd64.S+= -DLOCORE
 +CFLAGS.aes_aesni.S+= -DLOCORE
 +CFLAGS.gcm_pclmulqdq.S+= -DLOCORE
 +CFLAGS.aesni-gcm-x86_64.S+= -DLOCORE
 +CFLAGS.ghash-x86_64.S+= -DLOCORE
 +CFLAGS.sha256-x86_64.S+= -DLOCORE
 +CFLAGS.sha512-x86_64.S+= -DLOCORE
 +CFLAGS.gcm.c+= -UCAN_USE_GCM_ASM
 +CFLAGS.blake3_avx2.S = -DLOCORE
 +CFLAGS.blake3_avx512.S = -DLOCORE
 +CFLAGS.blake3_sse2.S = -DLOCORE
 +CFLAGS.blake3_sse41.S = -DLOCORE
 +CFLAGS.b3_aarch64_sse2.S = -DLOCORE
 +CFLAGS.b3_aarch64_sse41.S = -DLOCORE
 +CFLAGS.sha256-armv7.S = -DLOCORE
 +CFLAGS.sha512-armv7.S = -DLOCORE
 +CFLAGS.sha256-armv8.S = -DLOCORE
 +CFLAGS.sha512-armv8.S = -DLOCORE
 +CFLAGS.b3_ppc64le_sse2.S = -DLOCORE
 +CFLAGS.b3_ppc64le_sse41.S = -DLOCORE
 +CFLAGS.sha256-ppc.S = -DLOCORE
 +CFLAGS.sha256-p8.S = -DLOCORE
 +CFLAGS.sha512-ppc.S = -DLOCORE
 +CFLAGS.sha512-p8.S = -DLOCORE
 +
 +LDFLAGS.bfd+= -Wl,-znoexecstack
 +
 +.include <bsd.lib.mk>
diff --cc cddl/lib/libzfs/Makefile
index c05fe0c1c12b,000000000000..bb0127a9108a
mode 100644,000000..100644
--- a/cddl/lib/libzfs/Makefile
+++ b/cddl/lib/libzfs/Makefile
@@@ -1,108 -1,0 +1,108 @@@
- 
 +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp
 +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zcommon
 +.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzfs
 +.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzfs/os/freebsd
 +.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libshare
 +.PATH: ${SRCTOP}/sys/contrib/openzfs/include
 +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zstd
 +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zstd/lib
 +
 +PACKAGE=	zfs
 +LIB=	zfs
 +LIBADD= \
 +	avl \
 +	bsdxml \
 +	crypto \
 +	geom \
 +	m \
 +	md \
 +	nvpair \
 +	pthread \
 +	rt \
 +	umem \
 +	util \
 +	uutil \
 +	z \
 +	zfs_core \
 +	zutil
 +
 +INCS=	libzfs.h
 +USER_C = \
 +        libzfs_changelist.c \
 +        libzfs_config.c \
 +        libzfs_crypto.c \
 +        libzfs_dataset.c \
 +        libzfs_diff.c \
 +        libzfs_import.c \
 +        libzfs_iter.c \
 +        libzfs_mount.c \
 +        libzfs_pool.c \
 +        libzfs_sendrecv.c \
 +        libzfs_status.c \
 +        libzfs_util.c
 +
 +# FreeBSD
 +USER_C += \
 +        libzfs_compat.c \
 +        libzfs_zmount.c
 +
 +# libshare
 +USER_C += \
 +	libshare.c \
 +	nfs.c \
 +	os/freebsd/nfs.c \
 +	os/freebsd/smb.c
 +
 +KERNEL_C = \
 +        cityhash.c \
 +        zfeature_common.c \
 +        zfs_comutil.c \
 +        zfs_deleg.c \
 +        zfs_fletcher.c \
 +        zfs_fletcher_superscalar.c \
 +        zfs_fletcher_superscalar4.c \
 +        zfs_namecheck.c \
 +        zfs_prop.c \
++        zfs_valstr.c \
 +        zpool_prop.c \
 +        zprop_common.c
 +
- 
 +ARCH_C =
 +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
 +ARCH_C += 	zfs_fletcher_intel.c \
 +		zfs_fletcher_sse.c 
 +CFLAGS +=  -DHAVE_SSE2
 +.endif
 +.if ${MACHINE_ARCH} == "amd64"
 +ARCH_C +=	zfs_fletcher_avx512.c
 +CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_AVX512F
 +.endif
 +.if ${MACHINE_CPUARCH} == "aarch64"
 +ARCH_C +=	zfs_fletcher_aarch64_neon.c
 +.endif
 +
 +SRCS= $(USER_C) $(KERNEL_C) $(ARCH_C)
 +
 +WARNS?=	2
 +SHLIB_MAJOR= 4
 +CSTD=	c99
 +CFLAGS+= -DIN_BASE
 +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
 +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd
 +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include
 +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
 +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libshare
++CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libzpool/include
 +CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include
 +CFLAGS+= -I${SRCTOP}/sys
 +CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
 +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
 +CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
 +CFLAGS+= -DHAVE_ISSETUGID
 +CFLAGS+= -DHAVE_EXECVPE
 +CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
 +CFLAGS+= -DSYSCONFDIR=\"/etc\"
 +CFLAGS+= -DPKGDATADIR=\"/usr/share/zfs\"
 +CFLAGS+= -DZFSEXECDIR=\"${LIBEXECDIR}/zfs\"
 +
 +.include <bsd.lib.mk>
diff --cc cddl/lib/libzpool/Makefile
index d05babdc26e0,000000000000..c9f8dc39cbdb
mode 100644,000000..100644
--- a/cddl/lib/libzpool/Makefile
+++ b/cddl/lib/libzpool/Makefile
@@@ -1,336 -1,0 +1,339 @@@
- 
 +ZFSTOP=	${SRCTOP}/sys/contrib/openzfs
 +
++.PATH: ${ZFSTOP}/lib/libzpool
++
 +# ZFS_COMMON_SRCS
 +.PATH: ${ZFSTOP}/module/zfs
 +.PATH: ${ZFSTOP}/module/zcommon
 +.PATH: ${ZFSTOP}/module/unicode
 +# LUA_SRCS
 +.PATH: ${ZFSTOP}/module/lua
 +# ZSTD_SRCS
 +.PATH: ${ZFSTOP}/module/zstd
 +.PATH: ${ZFSTOP}/module/zstd/lib/common
 +.PATH: ${ZFSTOP}/module/zstd/lib/compress
 +.PATH: ${ZFSTOP}/module/zstd/lib/decompress
 +
- .PATH: ${ZFSTOP}/module/os/linux/zfs
- 
- .PATH: ${ZFSTOP}/lib/libzpool
- 
 +.if exists(${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}/opensolaris_atomic.S)
 +.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}
 +ATOMIC_SRCS=	opensolaris_atomic.S
 +ACFLAGS+=	-Wa,--noexecstack
 +.else
 +.PATH: ${SRCTOP}/sys/cddl/compat/opensolaris/kern
 +ATOMIC_SRCS=	opensolaris_atomic.c
 +.endif
 +
 +.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe"
 +# Don't waste GOT entries on small data.
 +PICFLAG=	-fPIC
 +.endif
 +
 +PACKAGE=	zfs
 +LIB=		zpool
 +
 +USER_C = \
++	arc_os.c \
 +	kernel.c \
 +	taskq.c \
- 	util.c
++	util.c \
++	zfs_debug.c
++
++.PATH: ${ZFSTOP}/module/os/linux/zfs
 +
 +KERNEL_C = \
++	simd_stat.c \
 +	zfeature_common.c \
 +	zfs_comutil.c \
 +	zfs_deleg.c \
 +	zfs_fletcher.c \
 +	zfs_fletcher_superscalar.c \
 +	zfs_fletcher_superscalar4.c \
 +	zfs_namecheck.c \
 +	zfs_prop.c \
 +	zfs_zstd.c \
 +	zpool_prop.c \
 +	zprop_common.c \
 +	abd.c \
 +	abd_os.c \
 +	aggsum.c \
 +	arc.c \
- 	arc_os.c \
 +        blake3_zfs.c \
 +	blkptr.c \
 +	bplist.c \
 +	bpobj.c \
 +	bptree.c \
 +	bqueue.c \
 +	btree.c \
 +	brt.c \
 +	cityhash.c \
 +	dbuf.c \
 +	dbuf_stats.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_bookmark.c \
 +	dsl_dataset.c \
 +	dsl_deadlist.c \
 +	dsl_deleg.c \
 +	dsl_dir.c \
 +	dsl_crypt.c \
 +	dsl_pool.c \
 +	dsl_prop.c \
 +	dsl_scan.c \
 +	dsl_synctask.c \
 +	dsl_destroy.c \
 +	dsl_userhold.c \
 +	edonr_zfs.c \
 +	entropy_common.c \
 +	error_private.c \
 +	fm.c \
 +	fse_compress.c \
 +	fse_decompress.c \
 +	gzip.c \
 +	hist.c \
 +	hkdf.c \
 +	huf_compress.c \
*** 8127 LINES SKIPPED ***