git: bd2e56ef47d5 - stable/13 - zfs: merge openzfs/zfs@ef83e07db (zfs-2.1-release) into stable/13

From: Martin Matuska <mm_at_FreeBSD.org>
Date: Fri, 11 Mar 2022 09:55:35 UTC
The branch stable/13 has been updated by mm:

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

commit bd2e56ef47d5a2c69f6f8e092abfd27a4d469d1e
Merge: dd6c1475a63a ef83e07db53e
Author:     Martin Matuska <mm@FreeBSD.org>
AuthorDate: 2022-03-11 07:11:42 +0000
Commit:     Martin Matuska <mm@FreeBSD.org>
CommitDate: 2022-03-11 09:54:49 +0000

    zfs: merge openzfs/zfs@ef83e07db (zfs-2.1-release) into stable/13
    
    OpenZFS release 2.1.3
    
    Notable upstream pull request merges:
      #12569 FreeBSD: Really zero the zero page
      #12828 FreeBSD: Add vop_standard_writecount_nomsyn
      #12828 zfs: Fix a deadlock between page busy and the teardown lock
      #12828 FreeBSD: Catch up with more VFS changes
      #12851 FreeBSD: Provide correct file generation number
      #12857 Verify dRAID empty sectors
      #12874 FreeBSD: Update argument types for VOP_READDIR
      #12896 Reduce number of arc_prune threads
      #12934 FreeBSD: Fix zvol_*_open() locking
      #12961 FreeBSD: Fix leaked strings in libspl mnttab
      #12964 Fix handling of errors from dmu_write_uio_dbuf() on FreeBSD
      #12981 Introduce a flag to skip comparing the local mac when
             raw sending
      #12985 Avoid memory allocations in the ARC eviction thread
      #13014 Report dnodes with faulty bonuslen
      #13016 FreeBSD: Fix zvol_cdev_open locking
      #13027 Fix clearing set-uid and set-gid bits on a file when
             replying a write
      #13031 Add enumerated vdev names to 'zpool iostat -v' and
             'zpool list -v'
      #13074 Enable encrypted raw sending to pools with greater ashift
      #13076 Receive checks should allow unencrypted child datasets
      #13098 Avoid dirtying the final TXGs when exporting a pool
      #13172 Fix ENOSPC when unlinking multiple files from full pool
    
    Obtained from:  OpenZFS
    OpenZFS commit: ef83e07db53e5d1017d3afbf376f4dbb2f6feada
    OpenZFS tag:    zfs-2.1.3
    Relnotes:       yes

 .../.github/workflows/zfs-tests-functional.yml     |   4 +-
 .../openzfs/.github/workflows/zfs-tests-sanity.yml |   4 +-
 sys/contrib/openzfs/META                           |   4 +-
 sys/contrib/openzfs/README.md                      |   2 +-
 sys/contrib/openzfs/cmd/mount_zfs/mount_zfs.c      |  47 +++--
 sys/contrib/openzfs/cmd/vdev_id/vdev_id            |  11 +-
 sys/contrib/openzfs/cmd/zed/agents/zfs_retire.c    |   1 +
 sys/contrib/openzfs/cmd/zed/zed.c                  |   2 +-
 sys/contrib/openzfs/cmd/zed/zed.d/all-syslog.sh    |   2 +-
 .../openzfs/cmd/zed/zed.d/generic-notify.sh        |   2 +-
 .../openzfs/cmd/zed/zed.d/statechange-notify.sh    |   5 +-
 sys/contrib/openzfs/cmd/zed/zed.d/zed-functions.sh |  90 +++++++++-
 sys/contrib/openzfs/cmd/zed/zed.d/zed.rc           |  21 ++-
 sys/contrib/openzfs/cmd/zed/zed_conf.c             |   1 +
 sys/contrib/openzfs/cmd/zed/zed_exec.c             |   2 +
 sys/contrib/openzfs/cmd/zpool/zpool.d/dm-deps      |  10 +-
 sys/contrib/openzfs/cmd/zpool/zpool.d/iostat       |   6 +-
 sys/contrib/openzfs/cmd/zpool/zpool.d/lsblk        |   2 +-
 sys/contrib/openzfs/cmd/zpool/zpool.d/media        |  15 +-
 sys/contrib/openzfs/cmd/zpool/zpool.d/ses          |   2 +-
 sys/contrib/openzfs/cmd/zpool/zpool_main.c         |   8 +-
 sys/contrib/openzfs/cmd/zstream/zstream_dump.c     |  13 ++
 sys/contrib/openzfs/config/Substfiles.am           |   4 +-
 sys/contrib/openzfs/config/always-python.m4        |   2 +-
 sys/contrib/openzfs/config/always-pyzfs.m4         |   2 +-
 sys/contrib/openzfs/config/kernel-add-disk.m4      |  26 +++
 sys/contrib/openzfs/config/kernel-fallocate.m4     |  17 ++
 sys/contrib/openzfs/config/kernel-fpu.m4           |  49 +++++-
 sys/contrib/openzfs/config/kernel-kmem.m4          |   1 +
 sys/contrib/openzfs/config/kernel-kthread.m4       |  68 ++++++++
 sys/contrib/openzfs/config/kernel-pde-data.m4      |  16 +-
 sys/contrib/openzfs/config/kernel-vfs-iov_iter.m4  |  22 ++-
 sys/contrib/openzfs/config/kernel.m4               | 117 +++++++++----
 sys/contrib/openzfs/config/toolchain-simd.m4       |  66 +++++++
 sys/contrib/openzfs/config/user-libfetch.m4        |  71 ++++++++
 sys/contrib/openzfs/config/user.m4                 |   1 +
 sys/contrib/openzfs/config/zfs-build.m4            |   3 +
 sys/contrib/openzfs/config/zfs-meta.m4             |   4 +-
 sys/contrib/openzfs/configure.ac                   |   1 +
 sys/contrib/openzfs/contrib/bpftrace/zfs-trace.sh  |   3 +-
 .../dracut/02zfsexpandknowledge/module-setup.sh.in |  16 +-
 .../contrib/dracut/90zfs/module-setup.sh.in        |   8 +-
 .../openzfs/contrib/dracut/90zfs/parse-zfs.sh.in   |   2 +-
 .../contrib/dracut/90zfs/zfs-env-bootfs.service.in |   2 +-
 .../contrib/dracut/90zfs/zfs-generator.sh.in       |   2 +-
 .../contrib/dracut/90zfs/zfs-load-key.sh.in        |  37 ++--
 .../dracut/90zfs/zfs-rollback-bootfs.service.in    |   2 +-
 .../dracut/90zfs/zfs-snapshot-bootfs.service.in    |   2 +-
 sys/contrib/openzfs/contrib/initramfs/hooks/zfs.in |   7 +
 sys/contrib/openzfs/contrib/initramfs/scripts/zfs  |  18 +-
 sys/contrib/openzfs/etc/default/zfs.in             |   8 +-
 sys/contrib/openzfs/etc/init.d/.gitignore          |   1 +
 sys/contrib/openzfs/etc/init.d/Makefile.am         |   2 +-
 sys/contrib/openzfs/etc/init.d/README.md           |  11 +-
 sys/contrib/openzfs/etc/init.d/zfs-import.in       |   3 +-
 sys/contrib/openzfs/etc/init.d/zfs-load-key.in     | 131 ++++++++++++++
 sys/contrib/openzfs/etc/systemd/system/.gitignore  |   1 +
 sys/contrib/openzfs/etc/systemd/system/Makefile.am |   5 +-
 .../etc/systemd/system/zfs-scrub-monthly@.timer.in |  12 ++
 .../etc/systemd/system/zfs-scrub-weekly@.timer.in  |  12 ++
 .../etc/systemd/system/zfs-scrub@.service.in       |  14 ++
 sys/contrib/openzfs/etc/zfs/zfs-functions.in       |  23 +--
 sys/contrib/openzfs/include/libzfs_impl.h          |   2 +
 .../openzfs/include/os/freebsd/spl/sys/vnode.h     |   1 -
 .../include/os/linux/kernel/linux/simd_x86.h       | 124 ++++++++++++-
 sys/contrib/openzfs/include/os/linux/spl/sys/uio.h |   4 +
 sys/contrib/openzfs/include/sys/dsl_pool.h         |   1 +
 sys/contrib/openzfs/include/sys/fm/fs/zfs.h        |   9 +
 sys/contrib/openzfs/include/sys/spa.h              |   2 +
 sys/contrib/openzfs/include/sys/vdev_draid.h       |   1 +
 sys/contrib/openzfs/include/sys/vdev_raidz.h       |   2 +
 sys/contrib/openzfs/include/sys/zio.h              |   2 +
 sys/contrib/openzfs/lib/libshare/os/freebsd/nfs.c  |   8 +-
 sys/contrib/openzfs/lib/libspl/os/freebsd/mnttab.c |  25 ++-
 sys/contrib/openzfs/lib/libzfs/Makefile.am         |   2 +-
 sys/contrib/openzfs/lib/libzfs/libzfs.abi          |  73 +++++---
 sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c     | 186 ++++++++++++++++++++
 sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c   |  14 +-
 sys/contrib/openzfs/lib/libzfs/libzfs_util.c       |   8 +
 .../openzfs/lib/libzfs/os/linux/libzfs_mount_os.c  |   2 +-
 sys/contrib/openzfs/man/man4/zfs.4                 |   7 +
 sys/contrib/openzfs/man/man7/zfsprops.7            |  33 +++-
 sys/contrib/openzfs/man/man7/zpoolprops.7          |   7 +-
 sys/contrib/openzfs/man/man8/zfs-load-key.8        |   2 +-
 sys/contrib/openzfs/man/man8/zfs-receive.8         |   4 +-
 sys/contrib/openzfs/man/man8/zfs-share.8           |  12 +-
 sys/contrib/openzfs/man/man8/zgenhostid.8          |   2 +-
 sys/contrib/openzfs/man/man8/zpool-attach.8        |   2 +-
 sys/contrib/openzfs/man/man8/zpool-clear.8         |   7 +-
 sys/contrib/openzfs/man/man8/zpool-events.8        |   4 +-
 sys/contrib/openzfs/man/man8/zpool-import.8        |   7 +-
 sys/contrib/openzfs/man/man8/zpool-replace.8       |   2 +-
 sys/contrib/openzfs/man/man8/zpool-scrub.8         |  21 +++
 sys/contrib/openzfs/module/Makefile.in             |  37 ++--
 sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c |   1 +
 .../openzfs/module/os/freebsd/zfs/vdev_file.c      |   3 +-
 .../openzfs/module/os/freebsd/zfs/zfs_ctldir.c     |   2 +-
 .../openzfs/module/os/freebsd/zfs/zfs_racct.c      |   4 +
 .../openzfs/module/os/freebsd/zfs/zfs_vfsops.c     |   8 +-
 .../openzfs/module/os/freebsd/zfs/zfs_vnops_os.c   |  22 ++-
 .../openzfs/module/os/freebsd/zfs/zio_crypt.c      |  22 ++-
 .../openzfs/module/os/freebsd/zfs/zvol_os.c        |  90 ++++++----
 .../openzfs/module/os/linux/spl/spl-kstat.c        |   2 +-
 .../openzfs/module/os/linux/spl/spl-procfs-list.c  |   2 +-
 .../openzfs/module/os/linux/spl/spl-taskq.c        |  11 +-
 .../openzfs/module/os/linux/spl/spl-thread.c       |   7 +-
 .../openzfs/module/os/linux/zfs/vdev_disk.c        |   2 +-
 .../openzfs/module/os/linux/zfs/vdev_file.c        |   2 +-
 .../openzfs/module/os/linux/zfs/zfs_racct.c        |   2 +
 .../openzfs/module/os/linux/zfs/zfs_vfsops.c       |   5 +
 .../openzfs/module/os/linux/zfs/zfs_vnops_os.c     |   4 +
 .../openzfs/module/os/linux/zfs/zio_crypt.c        |  18 +-
 sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c |   9 +-
 sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c  | 125 +++++++------
 sys/contrib/openzfs/module/zcommon/zfs_prop.c      |  10 +-
 sys/contrib/openzfs/module/zfs/abd.c               |   6 +-
 sys/contrib/openzfs/module/zfs/arc.c               |  66 ++++---
 sys/contrib/openzfs/module/zfs/bpobj.c             |   4 +-
 sys/contrib/openzfs/module/zfs/bptree.c            |   2 +-
 sys/contrib/openzfs/module/zfs/dbuf.c              |  28 ++-
 sys/contrib/openzfs/module/zfs/dmu.c               |   9 +-
 sys/contrib/openzfs/module/zfs/dmu_diff.c          |   2 +-
 sys/contrib/openzfs/module/zfs/dmu_objset.c        |  10 +-
 sys/contrib/openzfs/module/zfs/dmu_recv.c          |  10 +-
 sys/contrib/openzfs/module/zfs/dmu_redact.c        |   2 +-
 sys/contrib/openzfs/module/zfs/dmu_send.c          |   5 +-
 sys/contrib/openzfs/module/zfs/dmu_traverse.c      |   2 +-
 sys/contrib/openzfs/module/zfs/dmu_zfetch.c        |   1 +
 sys/contrib/openzfs/module/zfs/dnode.c             |  11 +-
 sys/contrib/openzfs/module/zfs/dnode_sync.c        |  11 +-
 sys/contrib/openzfs/module/zfs/dsl_bookmark.c      |   4 +-
 sys/contrib/openzfs/module/zfs/dsl_crypt.c         |   9 +-
 sys/contrib/openzfs/module/zfs/dsl_dataset.c       |   6 +-
 sys/contrib/openzfs/module/zfs/dsl_destroy.c       |   4 +-
 sys/contrib/openzfs/module/zfs/dsl_dir.c           |  28 +--
 sys/contrib/openzfs/module/zfs/dsl_pool.c          |  10 +-
 sys/contrib/openzfs/module/zfs/dsl_prop.c          |   2 +-
 sys/contrib/openzfs/module/zfs/dsl_scan.c          |  34 ++--
 sys/contrib/openzfs/module/zfs/dsl_synctask.c      |   2 +-
 sys/contrib/openzfs/module/zfs/fm.c                |   4 +-
 sys/contrib/openzfs/module/zfs/gzip.c              |   2 +-
 sys/contrib/openzfs/module/zfs/lz4.c               |   6 +-
 sys/contrib/openzfs/module/zfs/lzjb.c              |   4 +-
 sys/contrib/openzfs/module/zfs/metaslab.c          |  16 +-
 sys/contrib/openzfs/module/zfs/range_tree.c        |   8 +-
 sys/contrib/openzfs/module/zfs/sa.c                |   8 +-
 sys/contrib/openzfs/module/zfs/sha256.c            |   5 +-
 sys/contrib/openzfs/module/zfs/spa.c               |  77 +++++---
 sys/contrib/openzfs/module/zfs/spa_checkpoint.c    |  10 +-
 sys/contrib/openzfs/module/zfs/spa_errlog.c        |   2 +
 sys/contrib/openzfs/module/zfs/spa_misc.c          |   2 +
 sys/contrib/openzfs/module/zfs/vdev.c              |   9 +-
 sys/contrib/openzfs/module/zfs/vdev_draid.c        |  51 +++++-
 sys/contrib/openzfs/module/zfs/vdev_indirect.c     |   6 +-
 sys/contrib/openzfs/module/zfs/vdev_initialize.c   |   4 +-
 sys/contrib/openzfs/module/zfs/vdev_mirror.c       |   2 +
 sys/contrib/openzfs/module/zfs/vdev_missing.c      |   7 +-
 sys/contrib/openzfs/module/zfs/vdev_raidz.c        |  24 ++-
 sys/contrib/openzfs/module/zfs/vdev_removal.c      |   4 +-
 sys/contrib/openzfs/module/zfs/vdev_trim.c         |   1 +
 sys/contrib/openzfs/module/zfs/zap.c               |   2 -
 sys/contrib/openzfs/module/zfs/zap_leaf.c          |   2 -
 sys/contrib/openzfs/module/zfs/zap_micro.c         |   2 -
 sys/contrib/openzfs/module/zfs/zcp.c               |   4 +-
 sys/contrib/openzfs/module/zfs/zcp_synctask.c      |   8 +-
 sys/contrib/openzfs/module/zfs/zfs_fm.c            |  77 +++++++-
 sys/contrib/openzfs/module/zfs/zfs_vnops.c         | 105 ++++++++---
 sys/contrib/openzfs/module/zfs/zil.c               |  21 +--
 sys/contrib/openzfs/module/zfs/zio.c               |  18 +-
 sys/contrib/openzfs/module/zfs/zio_checksum.c      |  10 +-
 sys/contrib/openzfs/module/zfs/zio_compress.c      |   4 +-
 sys/contrib/openzfs/rpm/generic/zfs-dkms.spec.in   |   2 +-
 sys/contrib/openzfs/rpm/generic/zfs-kmod.spec.in   |   5 +-
 sys/contrib/openzfs/rpm/generic/zfs.spec.in        |   7 +
 sys/contrib/openzfs/rpm/redhat/zfs-kmod.spec.in    |   5 +-
 sys/contrib/openzfs/scripts/dkms.mkconf            |  22 +--
 sys/contrib/openzfs/scripts/kmodtool               |   2 +-
 sys/contrib/openzfs/scripts/zfs-tests.sh           |  26 +--
 sys/contrib/openzfs/scripts/zfs.sh                 |  11 +-
 sys/contrib/openzfs/scripts/zimport.sh             |   2 +-
 sys/contrib/openzfs/tests/runfiles/common.run      |  26 +--
 sys/contrib/openzfs/tests/runfiles/linux.run       |  14 +-
 sys/contrib/openzfs/tests/runfiles/sanity.run      |   3 +-
 .../openzfs/tests/test-runner/bin/zts-report.py.in |  52 +++---
 .../tests/zfs-tests/cmd/mmap_seek/mmap_seek.c      |   4 +
 .../openzfs/tests/zfs-tests/include/blkdev.shlib   |   2 +-
 .../openzfs/tests/zfs-tests/include/libtest.shlib  |  30 +++-
 .../tests/zfs-tests/tests/functional/Makefile.am   |   1 +
 .../functional/alloc_class/alloc_class.kshlib      |   1 +
 .../tests/functional/cli_root/zfs_load-key/HEXKEY  |   1 +
 .../functional/cli_root/zfs_load-key/Makefile.am   |   6 +-
 .../functional/cli_root/zfs_load-key/PASSPHRASE    |   1 +
 .../tests/functional/cli_root/zfs_load-key/RAWKEY  |   1 +
 .../functional/cli_root/zfs_load-key/cleanup.ksh   |   2 +
 .../functional/cli_root/zfs_load-key/setup.ksh     |   5 +-
 .../cli_root/zfs_load-key/zfs_load-key.cfg         |  31 ++++
 .../cli_root/zfs_load-key/zfs_load-key_all.ksh     |   9 +
 .../zfs_load-key/zfs_load-key_common.kshlib        |  63 +++++++
 .../cli_root/zfs_load-key/zfs_load-key_https.ksh   |  78 +++++++++
 .../zfs_load-key/zfs_load-key_location.ksh         |   5 +
 .../zfs_load-key/zfs_load-key_recursive.ksh        |   6 +
 .../functional/cli_root/zfs_receive/Makefile.am    |   3 +-
 .../zfs_receive/zfs_receive_-wR-encrypted-mix.ksh  |  75 ++++++++
 .../zfs_receive/zfs_receive_to_encrypted.ksh       |  18 +-
 .../cli_root/zfs_set/zfs_set_keylocation.ksh       |  22 +--
 .../cli_root/zpool_events/zpool_events_errors.ksh  |  11 +-
 .../cli_root/zpool_expand/zpool_expand_001_pos.ksh |   4 +-
 .../zpool_import/import_devices_missing.ksh        |   4 +-
 .../zpool_import/import_rewind_config_changed.ksh  |  58 ++++++-
 .../cli_root/zpool_reopen/zpool_reopen.shlib       |   4 +-
 .../tests/functional/deadman/deadman_sync.ksh      |   4 +-
 .../functional/fallocate/fallocate_punch-hole.ksh  |  27 ++-
 .../tests/functional/history/history_006_neg.ksh   |   4 +-
 .../tests/functional/no_space/Makefile.am          |   3 +-
 .../tests/functional/no_space/enospc_002_pos.ksh   |   5 +-
 .../tests/functional/no_space/enospc_rm.ksh        |  60 +++++++
 .../pool_checkpoint/checkpoint_ro_rewind.ksh       |   4 +-
 .../tests/functional/redundancy/redundancy.kshlib  |   2 +-
 .../tests/functional/refreserv/refreserv_raidz.ksh |   2 +-
 .../functional/reservation/reservation_021_neg.ksh |   2 +-
 .../zfs-tests/tests/functional/rsend/Makefile.am   |   2 +
 .../zfs-tests/tests/functional/rsend/rsend.kshlib  |   8 +
 .../tests/functional/rsend/send-c_verify_ratio.ksh |   2 +-
 .../tests/functional/rsend/send_raw_ashift.ksh     | 193 +++++++++++++++++++++
 .../functional/rsend/send_raw_spill_block.ksh      | 161 +++++++++++++++++
 .../rsend/send_realloc_encrypted_files.ksh         |   6 +-
 .../tests/functional/rsend/send_realloc_files.ksh  |   6 +-
 .../zfs-tests/tests/functional/simd/Makefile.am    |   2 +
 .../tests/functional/simd/simd_supported.ksh       |  58 +++++++
 .../tests/functional/snapshot/rollback_003_pos.ksh |  17 +-
 .../zfs-tests/tests/functional/suid/Makefile.am    |   1 +
 .../tests/functional/suid/suid_write_to_file.c     | 150 ++++++++--------
 .../tests/functional/suid/suid_write_to_none.ksh   |   2 +-
 .../tests/functional/suid/suid_write_to_sgid.ksh   |   2 +-
 .../tests/functional/suid/suid_write_to_suid.ksh   |   2 +-
 .../functional/suid/suid_write_to_suid_sgid.ksh    |   2 +-
 .../functional/suid/suid_write_zil_replay.ksh      |  99 +++++++++++
 .../tests/functional/userquota/Makefile.am         |   3 +-
 .../userquota/userspace_send_encrypted.ksh         | 119 +++++++++++++
 .../zvol/zvol_misc/zvol_misc_common.kshlib         |  11 +-
 .../zvol/zvol_misc/zvol_misc_rename_inuse.ksh      |   4 +-
 .../zvol/zvol_misc/zvol_misc_snapdev.ksh           |   2 +-
 .../zvol/zvol_misc/zvol_misc_volmode.ksh           |  93 +++++-----
 .../functional/zvol/zvol_misc/zvol_misc_zil.ksh    |   4 +-
 sys/modules/zfs/Makefile                           |   1 +
 sys/modules/zfs/zfs_config.h                       |  53 +++++-
 sys/modules/zfs/zfs_gitrev.h                       |   2 +-
 247 files changed, 3613 insertions(+), 910 deletions(-)

diff --cc sys/contrib/openzfs/README.md
index d666df7af309,000000000000..331889560950
mode 100644,000000..100644
--- a/sys/contrib/openzfs/README.md
+++ b/sys/contrib/openzfs/README.md
@@@ -1,35 -1,0 +1,35 @@@
 +![img](https://openzfs.github.io/openzfs-docs/_static/img/logo/480px-Open-ZFS-Secondary-Logo-Colour-halfsize.png)
 +
 +OpenZFS is an advanced file system and volume manager which was originally
 +developed for Solaris and is now maintained by the OpenZFS community.
 +This repository contains the code for running OpenZFS on Linux and FreeBSD.
 +
 +[![codecov](https://codecov.io/gh/openzfs/zfs/branch/master/graph/badge.svg)](https://codecov.io/gh/openzfs/zfs)
 +[![coverity](https://scan.coverity.com/projects/1973/badge.svg)](https://scan.coverity.com/projects/openzfs-zfs)
 +
 +# Official Resources
 +
 +  * [Documentation](https://openzfs.github.io/openzfs-docs/) - for using and developing this repo
 +  * [ZoL Site](https://zfsonlinux.org) - Linux release info & links
 +  * [Mailing lists](https://openzfs.github.io/openzfs-docs/Project%20and%20Community/Mailing%20Lists.html)
-   * [OpenZFS site](http://open-zfs.org/) - for conference videos and info on other platforms (illumos, OSX, Windows, etc)
++  * [OpenZFS site](https://openzfs.org/) - for conference videos and info on other platforms (illumos, OSX, Windows, etc)
 +
 +# Installation
 +
 +Full documentation for installing OpenZFS on your favorite operating system can
 +be found at the [Getting Started Page](https://openzfs.github.io/openzfs-docs/Getting%20Started/index.html).
 +
 +# Contribute & Develop
 +
 +We have a separate document with [contribution guidelines](./.github/CONTRIBUTING.md).
 +
 +We have a [Code of Conduct](./CODE_OF_CONDUCT.md).
 +
 +# Release
 +
 +OpenZFS is released under a CDDL license.
 +For more details see the NOTICE, LICENSE and COPYRIGHT files; `UCRL-CODE-235197`
 +
 +# Supported Kernels
 +  * The `META` file contains the officially recognized supported Linux kernel versions.
 +  * Supported FreeBSD versions are any supported branches and releases starting from 12.2-RELEASE.
diff --cc sys/contrib/openzfs/config/kernel-add-disk.m4
index 000000000000,5d1779eb4328..5d1779eb4328
mode 000000,100644..100644
--- a/sys/contrib/openzfs/config/kernel-add-disk.m4
+++ b/sys/contrib/openzfs/config/kernel-add-disk.m4
diff --cc sys/contrib/openzfs/config/kernel-kthread.m4
index 000000000000,f5b824d7947a..f5b824d7947a
mode 000000,100644..100644
--- a/sys/contrib/openzfs/config/kernel-kthread.m4
+++ b/sys/contrib/openzfs/config/kernel-kthread.m4
diff --cc sys/contrib/openzfs/config/user-libfetch.m4
index 000000000000,d961c6ca77a1..d961c6ca77a1
mode 000000,100644..100644
--- a/sys/contrib/openzfs/config/user-libfetch.m4
+++ b/sys/contrib/openzfs/config/user-libfetch.m4
diff --cc sys/contrib/openzfs/etc/init.d/zfs-load-key.in
index 000000000000,2f8deffdc809..2f8deffdc809
mode 000000,100755..100755
--- a/sys/contrib/openzfs/etc/init.d/zfs-load-key.in
+++ b/sys/contrib/openzfs/etc/init.d/zfs-load-key.in
diff --cc sys/contrib/openzfs/etc/systemd/system/zfs-scrub-monthly@.timer.in
index 000000000000,903068468278..903068468278
mode 000000,100644..100644
--- a/sys/contrib/openzfs/etc/systemd/system/zfs-scrub-monthly@.timer.in
+++ b/sys/contrib/openzfs/etc/systemd/system/zfs-scrub-monthly@.timer.in
diff --cc sys/contrib/openzfs/etc/systemd/system/zfs-scrub-weekly@.timer.in
index 000000000000,ede699500599..ede699500599
mode 000000,100644..100644
--- a/sys/contrib/openzfs/etc/systemd/system/zfs-scrub-weekly@.timer.in
+++ b/sys/contrib/openzfs/etc/systemd/system/zfs-scrub-weekly@.timer.in
diff --cc sys/contrib/openzfs/etc/systemd/system/zfs-scrub@.service.in
index 000000000000,bebe91d746ae..bebe91d746ae
mode 000000,100644..100644
--- a/sys/contrib/openzfs/etc/systemd/system/zfs-scrub@.service.in
+++ b/sys/contrib/openzfs/etc/systemd/system/zfs-scrub@.service.in
diff --cc sys/contrib/openzfs/include/os/freebsd/spl/sys/vnode.h
index 1ac595aa15dd,000000000000..d2c900854acb
mode 100644,000000..100644
--- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/vnode.h
+++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/vnode.h
@@@ -1,228 -1,0 +1,227 @@@
 +/*
 + * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
 + * All rights reserved.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *    notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *    notice, this list of conditions and the following disclaimer in the
 + *    documentation and/or other materials provided with the distribution.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 + * SUCH DAMAGE.
 + *
 + * $FreeBSD$
 + */
 +
 +#ifndef _OPENSOLARIS_SYS_VNODE_H_
 +#define	_OPENSOLARIS_SYS_VNODE_H_
 +
 +struct vnode;
 +struct vattr;
 +struct xucred;
 +
 +typedef struct flock	flock64_t;
 +typedef	struct vnode	vnode_t;
 +typedef	struct vattr	vattr_t;
 +typedef enum vtype vtype_t;
 +
 +#include <sys/types.h>
 +#include <sys/queue.h>
 +#include_next <sys/sdt.h>
 +#include <sys/namei.h>
 +enum symfollow { NO_FOLLOW = NOFOLLOW };
 +
 +#define	NOCRED	((struct ucred *)0)	/* no credential available */
 +#define	F_FREESP	11 	/* Free file space */
 +
 +#include <sys/proc.h>
 +#include <sys/vnode_impl.h>
 +#ifndef IN_BASE
 +#include_next <sys/vnode.h>
 +#endif
 +#include <sys/mount.h>
 +#include <sys/cred.h>
 +#include <sys/fcntl.h>
 +#include <sys/refcount.h>
 +#include <sys/file.h>
 +#include <sys/filedesc.h>
 +#include <sys/syscallsubr.h>
 +#include <sys/vm.h>
 +#include <vm/vm_object.h>
 +
 +typedef	struct vop_vector	vnodeops_t;
 +#define	VOP_FID		VOP_VPTOFH
 +#define	vop_fid		vop_vptofh
 +#define	vop_fid_args	vop_vptofh_args
 +#define	a_fid		a_fhp
 +
 +#define	rootvfs		(rootvnode == NULL ? NULL : rootvnode->v_mount)
 +
 +#ifndef IN_BASE
 +static __inline int
 +vn_is_readonly(vnode_t *vp)
 +{
 +	return (vp->v_mount->mnt_flag & MNT_RDONLY);
 +}
 +#endif
 +#define	vn_vfswlock(vp)		(0)
 +#define	vn_vfsunlock(vp)	do { } while (0)
 +#define	vn_ismntpt(vp)	   \
 +	((vp)->v_type == VDIR && (vp)->v_mountedhere != NULL)
 +#define	vn_mountedvfs(vp)	((vp)->v_mountedhere)
 +#define	vn_has_cached_data(vp)	\
 +	((vp)->v_object != NULL && \
 +	(vp)->v_object->resident_page_count > 0)
 +
 +#ifndef IN_BASE
 +static __inline void
 +vn_flush_cached_data(vnode_t *vp, boolean_t sync)
 +{
 +#if __FreeBSD_version > 1300054
 +	if (vm_object_mightbedirty(vp->v_object)) {
 +#else
 +	if (vp->v_object->flags & OBJ_MIGHTBEDIRTY) {
 +#endif
 +		int flags = sync ? OBJPC_SYNC : 0;
 +		zfs_vmobject_wlock(vp->v_object);
 +		vm_object_page_clean(vp->v_object, 0, 0, flags);
 +		zfs_vmobject_wunlock(vp->v_object);
 +	}
 +}
 +#endif
 +
 +#define	vn_exists(vp)		do { } while (0)
 +#define	vn_invalid(vp)		do { } while (0)
 +#define	vn_renamepath(tdvp, svp, tnm, lentnm)	do { } while (0)
 +#define	vn_free(vp)		do { } while (0)
 +#define	vn_matchops(vp, vops)	((vp)->v_op == &(vops))
 +
 +#define	VN_HOLD(v)	vref(v)
 +#define	VN_RELE(v)	vrele(v)
 +#define	VN_URELE(v)	vput(v)
 +
 +#define	vnevent_create(vp, ct)			do { } while (0)
 +#define	vnevent_link(vp, ct)			do { } while (0)
 +#define	vnevent_remove(vp, dvp, name, ct)	do { } while (0)
 +#define	vnevent_rmdir(vp, dvp, name, ct)	do { } while (0)
 +#define	vnevent_rename_src(vp, dvp, name, ct)	do { } while (0)
 +#define	vnevent_rename_dest(vp, dvp, name, ct)	do { } while (0)
 +#define	vnevent_rename_dest_dir(vp, ct)		do { } while (0)
 +
 +#define	specvp(vp, rdev, type, cr)	(VN_HOLD(vp), (vp))
 +#define	MANDLOCK(vp, mode)	(0)
 +
 +/*
 + * We will use va_spare is place of Solaris' va_mask.
 + * This field is initialized in zfs_setattr().
 + */
 +#define	va_mask		va_spare
 +/* TODO: va_fileid is shorter than va_nodeid !!! */
 +#define	va_nodeid	va_fileid
 +/* TODO: This field needs conversion! */
 +#define	va_nblocks	va_bytes
 +#define	va_blksize	va_blocksize
- #define	va_seq		va_gen
 +
 +#define	MAXOFFSET_T	OFF_MAX
 +#define	EXCL		0
 +
 +#define	FCREAT		O_CREAT
 +#define	FTRUNC		O_TRUNC
 +#define	FEXCL		O_EXCL
 +#ifndef FDSYNC
 +#define	FDSYNC		FFSYNC
 +#endif
 +#define	FRSYNC		FFSYNC
 +#define	FSYNC		FFSYNC
 +#define	FOFFMAX		0x00
 +#define	FIGNORECASE	0x00
 +
 +/*
 + * Attributes of interest to the caller of setattr or getattr.
 + */
 +#define	AT_MODE		0x00002
 +#define	AT_UID		0x00004
 +#define	AT_GID		0x00008
 +#define	AT_FSID		0x00010
 +#define	AT_NODEID	0x00020
 +#define	AT_NLINK	0x00040
 +#define	AT_SIZE		0x00080
 +#define	AT_ATIME	0x00100
 +#define	AT_MTIME	0x00200
 +#define	AT_CTIME	0x00400
 +#define	AT_RDEV		0x00800
 +#define	AT_BLKSIZE	0x01000
 +#define	AT_NBLOCKS	0x02000
 +/*			0x04000 */	/* unused */
 +#define	AT_SEQ		0x08000
 +/*
 + * If AT_XVATTR is set then there are additional bits to process in
 + * the xvattr_t's attribute bitmap.  If this is not set then the bitmap
 + * MUST be ignored.  Note that this bit must be set/cleared explicitly.
 + * That is, setting AT_ALL will NOT set AT_XVATTR.
 + */
 +#define	AT_XVATTR	0x10000
 +
 +#define	AT_ALL		(AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|\
 +			AT_NLINK|AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|\
 +			AT_RDEV|AT_BLKSIZE|AT_NBLOCKS|AT_SEQ)
 +
 +#define	AT_STAT		(AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|AT_NLINK|\
 +			AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV)
 +
 +#define	AT_TIMES	(AT_ATIME|AT_MTIME|AT_CTIME)
 +
 +#define	AT_NOSET	(AT_NLINK|AT_RDEV|AT_FSID|AT_NODEID|\
 +			AT_BLKSIZE|AT_NBLOCKS|AT_SEQ)
 +
 +#ifndef IN_BASE
 +static __inline void
 +vattr_init_mask(vattr_t *vap)
 +{
 +
 +	vap->va_mask = 0;
 +
 +	if (vap->va_uid != (uid_t)VNOVAL)
 +		vap->va_mask |= AT_UID;
 +	if (vap->va_gid != (gid_t)VNOVAL)
 +		vap->va_mask |= AT_GID;
 +	if (vap->va_size != (u_quad_t)VNOVAL)
 +		vap->va_mask |= AT_SIZE;
 +	if (vap->va_atime.tv_sec != VNOVAL)
 +		vap->va_mask |= AT_ATIME;
 +	if (vap->va_mtime.tv_sec != VNOVAL)
 +		vap->va_mask |= AT_MTIME;
 +	if (vap->va_mode != (uint16_t)VNOVAL)
 +		vap->va_mask |= AT_MODE;
 +	if (vap->va_flags != VNOVAL)
 +		vap->va_mask |= AT_XVATTR;
 +}
 +#endif
 +
 +#define		RLIM64_INFINITY 0
 +
 +static __inline int
 +vn_rename(char *from, char *to, enum uio_seg seg)
 +{
 +
 +	ASSERT(seg == UIO_SYSSPACE);
 +
 +	return (kern_renameat(curthread, AT_FDCWD, from, AT_FDCWD, to, seg));
 +}
 +
 +#include <sys/vfs.h>
 +
 +#endif	/* _OPENSOLARIS_SYS_VNODE_H_ */
diff --cc sys/contrib/openzfs/module/zfs/lz4.c
index 9da9d9e00635,000000000000..827ba2b662f5
mode 100644,000000..100644
--- a/sys/contrib/openzfs/module/zfs/lz4.c
+++ b/sys/contrib/openzfs/module/zfs/lz4.c
@@@ -1,1084 -1,0 +1,1082 @@@
 +/*
 + * LZ4 - Fast LZ compression algorithm
 + * Header File
 + * Copyright (C) 2011-2013, Yann Collet.
 + * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions are
 + * met:
 + *
 + *     * Redistributions of source code must retain the above copyright
 + * notice, this list of conditions and the following disclaimer.
 + *     * Redistributions in binary form must reproduce the above
 + * copyright notice, this list of conditions and the following disclaimer
 + * in the documentation and/or other materials provided with the
 + * distribution.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 + *
 + * You can contact the author at :
 + * - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
 + * - LZ4 source repository : http://code.google.com/p/lz4/
 + */
 +
 +#include <sys/zfs_context.h>
 +#include <sys/zio_compress.h>
 +
 +static int real_LZ4_compress(const char *source, char *dest, int isize,
 +    int osize);
 +static int LZ4_uncompress_unknownOutputSize(const char *source, char *dest,
 +    int isize, int maxOutputSize);
 +static int LZ4_compressCtx(void *ctx, const char *source, char *dest,
 +    int isize, int osize);
 +static int LZ4_compress64kCtx(void *ctx, const char *source, char *dest,
 +    int isize, int osize);
 +
 +static void *lz4_alloc(int flags);
 +static void lz4_free(void *ctx);
 +
- /*ARGSUSED*/
 +size_t
 +lz4_compress_zfs(void *s_start, void *d_start, size_t s_len,
 +    size_t d_len, int n)
 +{
++	(void) n;
 +	uint32_t bufsiz;
 +	char *dest = d_start;
 +
 +	ASSERT(d_len >= sizeof (bufsiz));
 +
 +	bufsiz = real_LZ4_compress(s_start, &dest[sizeof (bufsiz)], s_len,
 +	    d_len - sizeof (bufsiz));
 +
 +	/* Signal an error if the compression routine returned zero. */
 +	if (bufsiz == 0)
 +		return (s_len);
 +
 +	/*
 +	 * The exact compressed size is needed by the decompression routine,
 +	 * so it is stored at the start of the buffer. Note that this may be
 +	 * less than the compressed block size, which is rounded up to a
 +	 * multiple of 1<<ashift.
 +	 */
 +	*(uint32_t *)dest = BE_32(bufsiz);
 +
 +	return (bufsiz + sizeof (bufsiz));
 +}
 +
- /*ARGSUSED*/
 +int
 +lz4_decompress_zfs(void *s_start, void *d_start, size_t s_len,
 +    size_t d_len, int n)
 +{
++	(void) n;
 +	const char *src = s_start;
 +	uint32_t bufsiz = BE_IN32(src);
 +
 +	/* invalid compressed buffer size encoded at start */
 +	if (bufsiz + sizeof (bufsiz) > s_len)
 +		return (1);
 +
 +	/*
 +	 * Returns 0 on success (decompression function returned non-negative)
 +	 * and non-zero on failure (decompression function returned negative).
 +	 */
 +	return (LZ4_uncompress_unknownOutputSize(&src[sizeof (bufsiz)],
 +	    d_start, bufsiz, d_len) < 0);
 +}
 +
 +/*
 + * LZ4 API Description:
 + *
 + * Simple Functions:
 + * real_LZ4_compress() :
 + * 	isize  : is the input size. Max supported value is ~1.9GB
 + * 	return : the number of bytes written in buffer dest
 + *		 or 0 if the compression fails (if LZ4_COMPRESSMIN is set).
 + * 	note : destination buffer must be already allocated.
 + * 		destination buffer must be sized to handle worst cases
 + * 		situations (input data not compressible) worst case size
 + * 		evaluation is provided by function LZ4_compressBound().
 + *
 + * real_LZ4_uncompress() :
 + * 	osize  : is the output size, therefore the original size
 + * 	return : the number of bytes read in the source buffer.
 + * 		If the source stream is malformed, the function will stop
 + * 		decoding and return a negative result, indicating the byte
 + * 		position of the faulty instruction. This function never
 + * 		writes beyond dest + osize, and is therefore protected
 + * 		against malicious data packets.
 + * 	note : destination buffer must be already allocated
 + *	note : real_LZ4_uncompress() is not used in ZFS so its code
 + *	       is not present here.
 + *
 + * Advanced Functions
 + *
 + * LZ4_compressBound() :
 + * 	Provides the maximum size that LZ4 may output in a "worst case"
 + * 	scenario (input data not compressible) primarily useful for memory
 + * 	allocation of output buffer.
 + *
 + * 	isize  : is the input size. Max supported value is ~1.9GB
 + * 	return : maximum output size in a "worst case" scenario
 + * 	note : this function is limited by "int" range (2^31-1)
 + *
 + * LZ4_uncompress_unknownOutputSize() :
 + * 	isize  : is the input size, therefore the compressed size
 + * 	maxOutputSize : is the size of the destination buffer (which must be
 + * 		already allocated)
 + * 	return : the number of bytes decoded in the destination buffer
 + * 		(necessarily <= maxOutputSize). If the source stream is
 + * 		malformed, the function will stop decoding and return a
 + * 		negative result, indicating the byte position of the faulty
 + * 		instruction. This function never writes beyond dest +
 + * 		maxOutputSize, and is therefore protected against malicious
 + * 		data packets.
 + * 	note   : Destination buffer must be already allocated.
 + *		This version is slightly slower than real_LZ4_uncompress()
 + *
 + * LZ4_compressCtx() :
 + * 	This function explicitly handles the CTX memory structure.
 + *
 + * 	ILLUMOS CHANGES: the CTX memory structure must be explicitly allocated
 + * 	by the caller (either on the stack or using kmem_cache_alloc). Passing
 + * 	NULL isn't valid.
 + *
 + * LZ4_compress64kCtx() :
 + * 	Same as LZ4_compressCtx(), but specific to small inputs (<64KB).
 + * 	isize *Must* be <64KB, otherwise the output will be corrupted.
 + *
 + * 	ILLUMOS CHANGES: the CTX memory structure must be explicitly allocated
 + * 	by the caller (either on the stack or using kmem_cache_alloc). Passing
 + * 	NULL isn't valid.
 + */
 +
 +/*
 + * Tuning parameters
 + */
 +
 +/*
 + * COMPRESSIONLEVEL: Increasing this value improves compression ratio
 + *	 Lowering this value reduces memory usage. Reduced memory usage
 + *	typically improves speed, due to cache effect (ex: L1 32KB for Intel,
 + *	L1 64KB for AMD). Memory usage formula : N->2^(N+2) Bytes
 + *	(examples : 12 -> 16KB ; 17 -> 512KB)
 + */
 +#define	COMPRESSIONLEVEL 12
 +
 +/*
 + * NOTCOMPRESSIBLE_CONFIRMATION: Decreasing this value will make the
 + *	algorithm skip faster data segments considered "incompressible".
 + *	This may decrease compression ratio dramatically, but will be
 + *	faster on incompressible data. Increasing this value will make
 + *	the algorithm search more before declaring a segment "incompressible".
 + *	This could improve compression a bit, but will be slower on
 + *	incompressible data. The default value (6) is recommended.
 + */
 +#define	NOTCOMPRESSIBLE_CONFIRMATION 6
 +
 +/*
 + * BIG_ENDIAN_NATIVE_BUT_INCOMPATIBLE: This will provide a boost to
 + * performance for big endian cpu, but the resulting compressed stream
 + * will be incompatible with little-endian CPU. You can set this option
 + * to 1 in situations where data will stay within closed environment.
 + * This option is useless on Little_Endian CPU (such as x86).
 + */
 +/* #define	BIG_ENDIAN_NATIVE_BUT_INCOMPATIBLE 1 */
 +
 +/*
 + * CPU Feature Detection
 + */
 +
 +/* 32 or 64 bits ? */
 +#if defined(_LP64)
 +#define	LZ4_ARCH64 1
 +#else
 +#define	LZ4_ARCH64 0
 +#endif
 +
 +/*
 + * Little Endian or Big Endian?
 + * Note: overwrite the below #define if you know your architecture endianness.
 + */
 +#if defined(_ZFS_BIG_ENDIAN)
 +#define	LZ4_BIG_ENDIAN 1
 +#else
 +/*
 + * Little Endian assumed. PDP Endian and other very rare endian format
 + * are unsupported.
 + */
 +#undef LZ4_BIG_ENDIAN
 +#endif
 +
 +/*
 + * Unaligned memory access is automatically enabled for "common" CPU,
 + * such as x86. For others CPU, the compiler will be more cautious, and
 + * insert extra code to ensure aligned access is respected. If you know
 + * your target CPU supports unaligned memory access, you may want to
 + * force this option manually to improve performance
 + */
 +#if defined(__ARM_FEATURE_UNALIGNED)
 +#define	LZ4_FORCE_UNALIGNED_ACCESS 1
 +#endif
 +
 +/*
 + * Illumos : we can't use GCC's __builtin_ctz family of builtins in the
 + * kernel
 + * Linux : we can use GCC's __builtin_ctz family of builtins in the
 + * kernel
 + */
 +#undef	LZ4_FORCE_SW_BITCOUNT
 +#if defined(__sparc)
 +#define	LZ4_FORCE_SW_BITCOUNT
 +#endif
 +
 +/*
 + * Compiler Options
 + */
 +/* Disable restrict */
 +#define	restrict
 +
 +/*
 + * Linux : GCC_VERSION is defined as of 3.9-rc1, so undefine it.
 + * torvalds/linux@3f3f8d2f48acfd8ed3b8e6b7377935da57b27b16
 + */
 +#ifdef GCC_VERSION
 +#undef GCC_VERSION
 +#endif
 +
 +#define	GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
 +
 +#if (GCC_VERSION >= 302) || (__INTEL_COMPILER >= 800) || defined(__clang__)
 +#define	expect(expr, value)    (__builtin_expect((expr), (value)))
 +#else
 +#define	expect(expr, value)    (expr)
 +#endif
 +
 +#ifndef likely
 +#define	likely(expr)	expect((expr) != 0, 1)
 +#endif
 +
 +#ifndef unlikely
 +#define	unlikely(expr)	expect((expr) != 0, 0)
 +#endif
 +
 +#define	lz4_bswap16(x) ((unsigned short int) ((((x) >> 8) & 0xffu) | \
 +	(((x) & 0xffu) << 8)))
 +
 +/* Basic types */
 +#define	BYTE	uint8_t
 +#define	U16	uint16_t
 +#define	U32	uint32_t
 +#define	S32	int32_t
 +#define	U64	uint64_t
 +
 +#ifndef LZ4_FORCE_UNALIGNED_ACCESS
 +#pragma pack(1)
 +#endif
 +
 +typedef struct _U16_S {
 +	U16 v;
 +} U16_S;
 +typedef struct _U32_S {
 +	U32 v;
 +} U32_S;
 +typedef struct _U64_S {
 +	U64 v;
 +} U64_S;
 +
 +#ifndef LZ4_FORCE_UNALIGNED_ACCESS
 +#pragma pack()
 +#endif
 +
 +#define	A64(x) (((U64_S *)(x))->v)
 +#define	A32(x) (((U32_S *)(x))->v)
 +#define	A16(x) (((U16_S *)(x))->v)
 +
 +/*
 + * Constants
 + */
 +#define	MINMATCH 4
 +
 +#define	HASH_LOG COMPRESSIONLEVEL
 +#define	HASHTABLESIZE (1 << HASH_LOG)
 +#define	HASH_MASK (HASHTABLESIZE - 1)
 +
 +#define	SKIPSTRENGTH (NOTCOMPRESSIBLE_CONFIRMATION > 2 ? \
 +	NOTCOMPRESSIBLE_CONFIRMATION : 2)
 +
 +#define	COPYLENGTH 8
 +#define	LASTLITERALS 5
 +#define	MFLIMIT (COPYLENGTH + MINMATCH)
 +#define	MINLENGTH (MFLIMIT + 1)
 +
 +#define	MAXD_LOG 16
 +#define	MAX_DISTANCE ((1 << MAXD_LOG) - 1)
 +
 +#define	ML_BITS 4
 +#define	ML_MASK ((1U<<ML_BITS)-1)
 +#define	RUN_BITS (8-ML_BITS)
 +#define	RUN_MASK ((1U<<RUN_BITS)-1)
 +
 +
 +/*
 + * Architecture-specific macros
 + */
 +#if LZ4_ARCH64
 +#define	STEPSIZE 8
 +#define	UARCH U64
 +#define	AARCH A64
 +#define	LZ4_COPYSTEP(s, d)	A64(d) = A64(s); d += 8; s += 8;
 +#define	LZ4_COPYPACKET(s, d)	LZ4_COPYSTEP(s, d)
 +#define	LZ4_SECURECOPY(s, d, e)	if (d < e) LZ4_WILDCOPY(s, d, e)
 +#define	HTYPE U32
 +#define	INITBASE(base)		const BYTE* const base = ip
 +#else /* !LZ4_ARCH64 */
 +#define	STEPSIZE 4
 +#define	UARCH U32
 +#define	AARCH A32
 +#define	LZ4_COPYSTEP(s, d)	A32(d) = A32(s); d += 4; s += 4;
 +#define	LZ4_COPYPACKET(s, d)	LZ4_COPYSTEP(s, d); LZ4_COPYSTEP(s, d);
 +#define	LZ4_SECURECOPY		LZ4_WILDCOPY
 +#define	HTYPE const BYTE *
 +#define	INITBASE(base)		const int base = 0
 +#endif /* !LZ4_ARCH64 */
 +
 +#if (defined(LZ4_BIG_ENDIAN) && !defined(BIG_ENDIAN_NATIVE_BUT_INCOMPATIBLE))
 +#define	LZ4_READ_LITTLEENDIAN_16(d, s, p) \
 +	{ U16 v = A16(p); v = lz4_bswap16(v); d = (s) - v; }
 +#define	LZ4_WRITE_LITTLEENDIAN_16(p, i) \
 +	{ U16 v = (U16)(i); v = lz4_bswap16(v); A16(p) = v; p += 2; }
 +#else
 +#define	LZ4_READ_LITTLEENDIAN_16(d, s, p) { d = (s) - A16(p); }
 +#define	LZ4_WRITE_LITTLEENDIAN_16(p, v)  { A16(p) = v; p += 2; }
 +#endif
 +
 +
 +/* Local structures */
 +struct refTables {
 +	HTYPE hashTable[HASHTABLESIZE];
 +};
 +
 +
 +/* Macros */
 +#define	LZ4_HASH_FUNCTION(i) (((i) * 2654435761U) >> ((MINMATCH * 8) - \
*** 2057 LINES SKIPPED ***