aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2021-06-13 02:47:27 +0000
committerMartin Matuska <mm@FreeBSD.org>2021-06-13 03:43:03 +0000
commitb0c251b0dea8ab1476e42aa49a888b0d969020d2 (patch)
treec9f813235816a7855d5840938c1d5760f7b2a33d
parentcfd6c9b99f49dd24860456742eecccabfc100326 (diff)
parentc3b60ededa6e6ce36a457a54451ca153c4c630dc (diff)
zfs: merge openzfs/zfs@c3b60eded (zfs-2.1-release) into stable/13
Notable upstream pull request merges: #12015 Replace zstreamdump with zstream link #12046 Improve scrub maxinflight_bytes math. #12052 FreeBSD: incorporate changes to the VFS_QUOTACTL(9) KPI #12072 Let zfs diff be more permissive #12091 libzfs: On FreeBSD, use MNT_NOWAIT with getfsstat #12104 Reminder to update boot code after zpool upgrade #12114 Introduce write-mostly sums #12125 Modernise all (most) remaining .TH manpages #12145 More aggsum optimizations #12149 Multiple man-pages: Move to appropriate section #12158 Re-embed multilist_t storage #12177 Livelist logic should handle dedup blkptrs #12196 Unify manpage makefiles, move pages to better sexions, revisit some #12212 Remove pool io kstats Obtained from: OpenZFS OpenZFS commit: c3b60ededa6e6ce36a457a54451ca153c4c630dc OpenZFS tag: zfs-2.1.0-rc7
-rw-r--r--ObsoleteFiles.inc10
-rw-r--r--cddl/sbin/zfs/Makefile5
-rw-r--r--cddl/sbin/zpool/Makefile13
-rw-r--r--cddl/usr.bin/Makefile2
-rw-r--r--cddl/usr.bin/zstream/Makefile3
-rw-r--r--cddl/usr.bin/zstreamdump/Makefile11
-rw-r--r--cddl/usr.bin/zstreamdump/Makefile.depend25
-rw-r--r--sys/contrib/openzfs/.github/ISSUE_TEMPLATE/config.yml2
-rw-r--r--sys/contrib/openzfs/META2
-rw-r--r--sys/contrib/openzfs/Makefile.am48
-rw-r--r--sys/contrib/openzfs/cmd/Makefile.am8
-rwxr-xr-xsys/contrib/openzfs/cmd/arc_summary/arc_summary36
-rw-r--r--sys/contrib/openzfs/cmd/fsck_zfs/Makefile.am1
-rwxr-xr-xsys/contrib/openzfs/cmd/fsck_zfs/fsck.zfs.in6
-rw-r--r--sys/contrib/openzfs/cmd/vdev_id/Makefile.am2
-rw-r--r--sys/contrib/openzfs/cmd/zdb/zdb.c117
-rw-r--r--sys/contrib/openzfs/cmd/zed/Makefile.am2
-rw-r--r--sys/contrib/openzfs/cmd/zed/zed.d/Makefile.am4
-rwxr-xr-xsys/contrib/openzfs/cmd/zed/zed.d/all-debug.sh16
-rwxr-xr-xsys/contrib/openzfs/cmd/zed/zed.d/all-syslog.sh1
-rwxr-xr-xsys/contrib/openzfs/cmd/zed/zed.d/history_event-zfs-list-cacher.sh.in19
-rw-r--r--sys/contrib/openzfs/cmd/zed/zed.d/zed-functions.sh12
-rw-r--r--sys/contrib/openzfs/cmd/zfs/zfs_main.c38
-rw-r--r--sys/contrib/openzfs/cmd/zgenhostid/zgenhostid.c16
-rw-r--r--sys/contrib/openzfs/cmd/zpool/Makefile.am1
-rw-r--r--sys/contrib/openzfs/cmd/zpool/os/freebsd/zpool_vdev_os.c15
-rw-r--r--sys/contrib/openzfs/cmd/zpool/os/linux/zpool_vdev_os.c5
-rwxr-xr-xsys/contrib/openzfs/cmd/zpool/zpool.d/smart15
-rw-r--r--sys/contrib/openzfs/cmd/zpool/zpool_main.c28
-rw-r--r--sys/contrib/openzfs/cmd/zpool/zpool_util.h1
-rw-r--r--sys/contrib/openzfs/cmd/zpool_influxdb/dashboards/grafana/ZFS-pool-latency-heatmaps-influxdb.json4
-rw-r--r--sys/contrib/openzfs/cmd/zstream/Makefile.am3
-rw-r--r--sys/contrib/openzfs/cmd/zstream/zstream.c5
-rw-r--r--sys/contrib/openzfs/cmd/zstreamdump/Makefile.am1
-rwxr-xr-xsys/contrib/openzfs/cmd/zstreamdump/zstreamdump3
-rw-r--r--sys/contrib/openzfs/cmd/ztest/ztest.c273
-rw-r--r--sys/contrib/openzfs/cmd/zvol_wait/Makefile.am2
-rwxr-xr-xsys/contrib/openzfs/cmd/zvol_wait/zvol_wait1
-rw-r--r--sys/contrib/openzfs/config/Shellcheck.am22
-rw-r--r--sys/contrib/openzfs/config/always-shellcheck.m410
-rw-r--r--sys/contrib/openzfs/config/ax_python_devel.m43
-rw-r--r--sys/contrib/openzfs/config/kernel-percpu.m427
-rw-r--r--sys/contrib/openzfs/config/zfs-build.m418
-rw-r--r--sys/contrib/openzfs/configure.ac5
-rw-r--r--sys/contrib/openzfs/contrib/Makefile.am4
-rw-r--r--sys/contrib/openzfs/contrib/bash_completion.d/Makefile.am5
-rw-r--r--sys/contrib/openzfs/contrib/bash_completion.d/zfs.in76
-rw-r--r--sys/contrib/openzfs/contrib/bpftrace/Makefile.am4
-rw-r--r--sys/contrib/openzfs/contrib/dracut/02zfsexpandknowledge/Makefile.am1
-rwxr-xr-xsys/contrib/openzfs/contrib/dracut/02zfsexpandknowledge/module-setup.sh.in50
-rw-r--r--sys/contrib/openzfs/contrib/dracut/90zfs/.gitignore13
-rw-r--r--sys/contrib/openzfs/contrib/dracut/90zfs/Makefile.am7
-rwxr-xr-xsys/contrib/openzfs/contrib/dracut/90zfs/import-opts-generator.sh.in5
-rwxr-xr-xsys/contrib/openzfs/contrib/dracut/90zfs/module-setup.sh.in44
-rwxr-xr-xsys/contrib/openzfs/contrib/dracut/90zfs/mount-zfs.sh.in10
-rwxr-xr-xsys/contrib/openzfs/contrib/dracut/90zfs/parse-zfs.sh.in3
-rwxr-xr-xsys/contrib/openzfs/contrib/dracut/90zfs/zfs-generator.sh.in1
-rwxr-xr-xsys/contrib/openzfs/contrib/dracut/90zfs/zfs-lib.sh.in10
-rwxr-xr-xsys/contrib/openzfs/contrib/dracut/90zfs/zfs-load-key.sh.in8
-rw-r--r--sys/contrib/openzfs/contrib/dracut/Makefile.am3
-rw-r--r--sys/contrib/openzfs/contrib/initramfs/Makefile.am3
-rw-r--r--sys/contrib/openzfs/contrib/initramfs/hooks/Makefile.am1
-rwxr-xr-xsys/contrib/openzfs/contrib/initramfs/hooks/zfs.in125
-rw-r--r--sys/contrib/openzfs/contrib/initramfs/hooks/zfsunlock.in16
-rw-r--r--sys/contrib/openzfs/contrib/initramfs/scripts/Makefile.am7
-rw-r--r--sys/contrib/openzfs/contrib/initramfs/scripts/local-top/Makefile.am2
-rwxr-xr-xsys/contrib/openzfs/contrib/initramfs/scripts/local-top/zfs21
-rw-r--r--sys/contrib/openzfs/contrib/initramfs/scripts/zfs65
-rw-r--r--sys/contrib/openzfs/etc/Makefile.am4
-rw-r--r--sys/contrib/openzfs/etc/default/Makefile.am4
-rw-r--r--sys/contrib/openzfs/etc/init.d/Makefile.am3
-rwxr-xr-xsys/contrib/openzfs/etc/init.d/zfs-import.in26
-rwxr-xr-xsys/contrib/openzfs/etc/init.d/zfs-mount.in49
-rwxr-xr-xsys/contrib/openzfs/etc/init.d/zfs-share.in6
-rwxr-xr-xsys/contrib/openzfs/etc/init.d/zfs-zed.in31
-rw-r--r--sys/contrib/openzfs/etc/systemd/Makefile.am3
-rw-r--r--sys/contrib/openzfs/etc/systemd/system-generators/Makefile.am14
-rw-r--r--sys/contrib/openzfs/etc/systemd/system-generators/zfs-mount-generator.c1083
-rwxr-xr-xsys/contrib/openzfs/etc/systemd/system-generators/zfs-mount-generator.in474
-rw-r--r--sys/contrib/openzfs/etc/systemd/system/zfs-import-cache.service.in2
-rw-r--r--sys/contrib/openzfs/etc/systemd/system/zfs-import-scan.service.in2
-rw-r--r--sys/contrib/openzfs/etc/zfs/Makefile.am3
-rw-r--r--sys/contrib/openzfs/etc/zfs/zfs-functions.in97
-rw-r--r--sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am1
-rw-r--r--sys/contrib/openzfs/include/os/freebsd/spl/sys/kstat.h4
-rw-r--r--sys/contrib/openzfs/include/os/freebsd/spl/sys/wmsum.h72
-rw-r--r--sys/contrib/openzfs/include/os/linux/spl/sys/Makefile.am1
-rw-r--r--sys/contrib/openzfs/include/os/linux/spl/sys/atomic.h4
-rw-r--r--sys/contrib/openzfs/include/os/linux/spl/sys/kstat.h4
-rw-r--r--sys/contrib/openzfs/include/os/linux/spl/sys/wmsum.h76
-rw-r--r--sys/contrib/openzfs/include/sys/aggsum.h7
-rw-r--r--sys/contrib/openzfs/include/sys/arc_impl.h12
-rw-r--r--sys/contrib/openzfs/include/sys/dataset_kstats.h20
-rw-r--r--sys/contrib/openzfs/include/sys/dmu_objset.h4
-rw-r--r--sys/contrib/openzfs/include/sys/metaslab_impl.h2
-rw-r--r--sys/contrib/openzfs/include/sys/multilist.h3
-rw-r--r--sys/contrib/openzfs/include/sys/spa.h1
-rw-r--r--sys/contrib/openzfs/include/sys/zfs_context.h6
-rw-r--r--sys/contrib/openzfs/include/sys/zfs_ioctl_impl.h1
-rw-r--r--sys/contrib/openzfs/lib/libnvpair/libnvpair_json.c15
-rw-r--r--sys/contrib/openzfs/lib/libspl/asm-generic/atomic.c13
-rw-r--r--sys/contrib/openzfs/lib/libspl/include/atomic.h43
-rw-r--r--sys/contrib/openzfs/lib/libspl/include/sys/Makefile.am1
-rw-r--r--sys/contrib/openzfs/lib/libspl/include/sys/kstat.h6
-rw-r--r--sys/contrib/openzfs/lib/libspl/include/sys/wmsum.h68
-rw-r--r--sys/contrib/openzfs/lib/libspl/os/freebsd/mnttab.c4
-rw-r--r--sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c26
-rw-r--r--sys/contrib/openzfs/lib/libzfs/libzfs_diff.c46
-rw-r--r--sys/contrib/openzfs/lib/libzfs/libzfs_mount.c8
-rw-r--r--sys/contrib/openzfs/lib/libzfs/libzfs_pool.c72
-rw-r--r--sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c34
-rw-r--r--sys/contrib/openzfs/lib/libzfs/libzfs_util.c4
-rw-r--r--sys/contrib/openzfs/lib/libzpool/kernel.c30
-rw-r--r--sys/contrib/openzfs/man/Makefile.am118
-rw-r--r--sys/contrib/openzfs/man/man1/Makefile.am12
-rw-r--r--sys/contrib/openzfs/man/man1/arcstat.1652
-rw-r--r--sys/contrib/openzfs/man/man1/cstyle.1259
-rw-r--r--sys/contrib/openzfs/man/man1/raidz_test.1153
-rw-r--r--sys/contrib/openzfs/man/man1/zhack.1168
-rw-r--r--sys/contrib/openzfs/man/man1/ztest.1327
-rw-r--r--sys/contrib/openzfs/man/man1/zvol_wait.137
-rw-r--r--sys/contrib/openzfs/man/man4/spl.4195
-rw-r--r--sys/contrib/openzfs/man/man4/zfs.42380
-rw-r--r--sys/contrib/openzfs/man/man5/Makefile.am16
-rw-r--r--sys/contrib/openzfs/man/man5/spl-module-parameters.5326
-rw-r--r--sys/contrib/openzfs/man/man5/vdev_id.conf.5429
-rw-r--r--sys/contrib/openzfs/man/man5/zfs-events.5965
-rw-r--r--sys/contrib/openzfs/man/man5/zfs-module-parameters.54354
-rw-r--r--sys/contrib/openzfs/man/man5/zpool-features.51077
-rw-r--r--sys/contrib/openzfs/man/man7/zfsconcepts.7 (renamed from sys/contrib/openzfs/man/man8/zfsconcepts.8)66
-rw-r--r--sys/contrib/openzfs/man/man7/zfsprops.7 (renamed from sys/contrib/openzfs/man/man8/zfsprops.8)730
-rw-r--r--sys/contrib/openzfs/man/man7/zpool-features.7842
-rw-r--r--sys/contrib/openzfs/man/man7/zpoolconcepts.7 (renamed from sys/contrib/openzfs/man/man8/zpoolconcepts.8)277
-rw-r--r--sys/contrib/openzfs/man/man7/zpoolprops.7 (renamed from sys/contrib/openzfs/man/man8/zpoolprops.8)136
-rw-r--r--sys/contrib/openzfs/man/man8/Makefile.am102
-rw-r--r--sys/contrib/openzfs/man/man8/fsck.zfs.8100
-rw-r--r--sys/contrib/openzfs/man/man8/mount.zfs.86
-rw-r--r--sys/contrib/openzfs/man/man8/vdev_id.8154
-rw-r--r--sys/contrib/openzfs/man/man8/zdb.8126
-rw-r--r--sys/contrib/openzfs/man/man8/zed.8.in380
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-allow.8202
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-bookmark.826
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-clone.829
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-create.827
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-destroy.820
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-diff.863
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-hold.824
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-jail.8112
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-list.856
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-load-key.8180
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-mount-generator.8.in387
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-mount.832
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-program.8416
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-project.898
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-promote.829
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-receive.8125
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-rename.85
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-rollback.818
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-send.8290
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-set.898
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-share.816
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-snapshot.829
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-upgrade.829
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-userspace.884
-rw-r--r--sys/contrib/openzfs/man/man8/zfs-wait.827
-rw-r--r--sys/contrib/openzfs/man/man8/zfs.8486
-rw-r--r--sys/contrib/openzfs/man/man8/zfs_ids_to_path.823
-rw-r--r--sys/contrib/openzfs/man/man8/zgenhostid.875
-rw-r--r--sys/contrib/openzfs/man/man8/zinject.8378
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-add.849
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-attach.827
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-checkpoint.840
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-clear.824
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-create.8144
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-destroy.817
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-detach.821
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-events.8452
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-export.823
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-get.852
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-history.816
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-import.8119
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-initialize.828
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-iostat.8236
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-labelclear.816
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-list.843
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-offline.829
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-reguid.815
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-remove.820
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-reopen.827
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-replace.844
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-resilver.827
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-scrub.831
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-split.852
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-status.854
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-sync.828
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-trim.851
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-upgrade.835
-rw-r--r--sys/contrib/openzfs/man/man8/zpool-wait.854
-rw-r--r--sys/contrib/openzfs/man/man8/zpool.8385
-rw-r--r--sys/contrib/openzfs/man/man8/zpool_influxdb.8141
-rw-r--r--sys/contrib/openzfs/man/man8/zstream.826
l---------[-rw-r--r--]sys/contrib/openzfs/man/man8/zstreamdump.859
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c62
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ioctl_os.c17
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c15
-rw-r--r--sys/contrib/openzfs/module/os/linux/spl/spl-kmem-cache.c11
-rw-r--r--sys/contrib/openzfs/module/os/linux/spl/spl-kstat.c66
-rw-r--r--sys/contrib/openzfs/module/os/linux/zfs/zfs_ioctl_os.c6
-rw-r--r--sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c3
-rw-r--r--sys/contrib/openzfs/module/zfs/aggsum.c125
-rw-r--r--sys/contrib/openzfs/module/zfs/arc.c163
-rw-r--r--sys/contrib/openzfs/module/zfs/dataset_kstats.c48
-rw-r--r--sys/contrib/openzfs/module/zfs/dbuf.c20
-rw-r--r--sys/contrib/openzfs/module/zfs/dmu_objset.c30
-rw-r--r--sys/contrib/openzfs/module/zfs/dnode.c2
-rw-r--r--sys/contrib/openzfs/module/zfs/dsl_dataset.c3
-rw-r--r--sys/contrib/openzfs/module/zfs/dsl_deadlist.c65
-rw-r--r--sys/contrib/openzfs/module/zfs/dsl_pool.c3
-rw-r--r--sys/contrib/openzfs/module/zfs/dsl_scan.c40
-rw-r--r--sys/contrib/openzfs/module/zfs/metaslab.c24
-rw-r--r--sys/contrib/openzfs/module/zfs/multilist.c14
-rw-r--r--sys/contrib/openzfs/module/zfs/spa_stats.c50
-rw-r--r--sys/contrib/openzfs/module/zfs/vdev_queue.c47
-rw-r--r--sys/contrib/openzfs/module/zfs/zfs_ioctl.c27
-rw-r--r--sys/contrib/openzfs/rpm/generic/zfs.spec.in2
-rw-r--r--sys/contrib/openzfs/scripts/Makefile.am17
-rwxr-xr-xsys/contrib/openzfs/scripts/commitcheck.sh4
-rwxr-xr-xsys/contrib/openzfs/scripts/dkms.mkconf12
-rwxr-xr-xsys/contrib/openzfs/scripts/dkms.postbuild7
-rwxr-xr-xsys/contrib/openzfs/scripts/kmodtool14
-rwxr-xr-xsys/contrib/openzfs/scripts/make_gitrev.sh6
-rwxr-xr-xsys/contrib/openzfs/scripts/man-dates.sh2
-rwxr-xr-xsys/contrib/openzfs/scripts/mancheck.sh43
-rwxr-xr-xsys/contrib/openzfs/scripts/paxcheck.sh3
-rwxr-xr-xsys/contrib/openzfs/scripts/zfs-tests.sh1
-rwxr-xr-xsys/contrib/openzfs/scripts/zfs.sh4
-rwxr-xr-xsys/contrib/openzfs/scripts/zimport.sh17
-rwxr-xr-xsys/contrib/openzfs/scripts/zloop.sh17
-rwxr-xr-xsys/contrib/openzfs/scripts/zol2zfs-patch.sed2
-rw-r--r--sys/contrib/openzfs/tests/Makefile.am5
-rw-r--r--sys/contrib/openzfs/tests/runfiles/common.run4
-rw-r--r--sys/contrib/openzfs/tests/test-runner/man/test-runner.1598
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh1
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_objset_id.ksh1
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_clone_livelist_dedup.ksh88
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/perf/scripts/prefetch_io.sh42
-rw-r--r--sys/contrib/openzfs/udev/rules.d/.gitignore5
-rw-r--r--sys/modules/zfs/zfs_config.h4
250 files changed, 11645 insertions, 13940 deletions
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 761d5f61dadd..6c7031842714 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -36,6 +36,16 @@
# xargs -n1 | sort | uniq -d;
# done
+# 20210613: Rename OpenZFS manual pages
+OLD_FILES+=usr/share/man/man5/spl-module-parameters.5.gz
+OLD_FILES+=usr/share/man/man5/zfs-events.5.gz
+OLD_FILES+=usr/share/man/man5/zfs-module-parameters.5.gz
+OLD_FILES+=usr/share/man/man8/zfsconcepts.8.gz
+OLD_FILES+=usr/share/man/man8/zfsprops.8.gz
+OLD_FILES+=usr/share/man/man5/zpool-features.5.gz
+OLD_FILES+=usr/share/man/man8/zpoolconcepts.8.gz
+OLD_FILES+=usr/share/man/man8/zpoolprops.8.gz
+
# 20210413: Remove pfctlinput2
OLD_FILES+=usr/share/man/man9/pfctlinput2.9.gz
diff --git a/cddl/sbin/zfs/Makefile b/cddl/sbin/zfs/Makefile
index 5ea237eecaa4..6a6ef62e4fce 100644
--- a/cddl/sbin/zfs/Makefile
+++ b/cddl/sbin/zfs/Makefile
@@ -3,6 +3,7 @@
ZFSTOP= ${SRCTOP}/sys/contrib/openzfs
.PATH: ${ZFSTOP}/cmd/zfs
+.PATH: ${ZFSTOP}/man/man7
.PATH: ${ZFSTOP}/man/man8
.PATH: ${ZFSTOP}/module/os/freebsd/spl
@@ -34,8 +35,8 @@ MAN= \
zfs-upgrade.8 \
zfs-userspace.8 \
zfs-wait.8 \
- zfsconcepts.8 \
- zfsprops.8
+ zfsconcepts.7 \
+ zfsprops.7
MLINKS= \
zfs-allow.8 zfs-unallow.8 \
zfs-hold.8 zfs-release.8 \
diff --git a/cddl/sbin/zpool/Makefile b/cddl/sbin/zpool/Makefile
index 43cc8f2997b7..4c2a8b94de19 100644
--- a/cddl/sbin/zpool/Makefile
+++ b/cddl/sbin/zpool/Makefile
@@ -2,7 +2,9 @@
ZFSTOP= ${SRCTOP}/sys/contrib/openzfs
+.PATH: ${ZFSTOP}/man/man4
.PATH: ${ZFSTOP}/man/man5
+.PATH: ${ZFSTOP}/man/man7
.PATH: ${ZFSTOP}/man/man8
.PATH: ${ZFSTOP}/cmd/zpool
.PATH: ${ZFSTOP}/cmd/zpool/os/freebsd
@@ -11,9 +13,8 @@ ZFSTOP= ${SRCTOP}/sys/contrib/openzfs
PACKAGE= runtime
PROG= zpool
MAN= \
- spl-module-parameters.5 \
- zfs-events.5 \
- zfs-module-parameters.5 \
+ spl.4 \
+ zfs.4 \
zpool.8 \
zpool-add.8 \
zpool-attach.8 \
@@ -24,7 +25,7 @@ MAN= \
zpool-detach.8 \
zpool-events.8 \
zpool-export.8 \
- zpool-features.5 \
+ zpool-features.7 \
zpool-get.8 \
zpool-history.8 \
zpool-import.8 \
@@ -45,8 +46,8 @@ MAN= \
zpool-trim.8 \
zpool-upgrade.8 \
zpool-wait.8 \
- zpoolconcepts.8 \
- zpoolprops.8
+ zpoolconcepts.7 \
+ zpoolprops.7
MLINKS= \
zpool-offline.8 zpool-online.8 \
zpool-get.8 zpool-set.8
diff --git a/cddl/usr.bin/Makefile b/cddl/usr.bin/Makefile
index 5c2595df1c9f..10d55215c0b3 100644
--- a/cddl/usr.bin/Makefile
+++ b/cddl/usr.bin/Makefile
@@ -8,7 +8,6 @@ SUBDIR= \
ctfmerge \
${_zinject} \
${_zstream} \
- ${_zstreamdump} \
${_ztest}
SUBDIR.${MK_TESTS}+= tests
@@ -17,7 +16,6 @@ SUBDIR.${MK_TESTS}+= tests
_zinject= zinject
_ztest= ztest
_zstream = zstream
-_zstreamdump = zstreamdump
.endif
SUBDIR_PARALLEL=
diff --git a/cddl/usr.bin/zstream/Makefile b/cddl/usr.bin/zstream/Makefile
index d6ac8c5f3b16..cfcff71a813f 100644
--- a/cddl/usr.bin/zstream/Makefile
+++ b/cddl/usr.bin/zstream/Makefile
@@ -7,6 +7,7 @@ ZFSTOP= ${SRCTOP}/sys/contrib/openzfs
PROG= zstream
MAN= zstream.8
+MLINKS= zstream.8 zstreamdump.8
INCS= zstream.h
SRCS= \
zstream.c \
@@ -14,6 +15,8 @@ SRCS= \
zstream_redup.c \
zstream_token.c
+SYMLINKS= ${BINDIR}/zstream ${BINDIR}/zstreamdump
+
WARNS?= 2
CFLAGS+= \
-DIN_BASE \
diff --git a/cddl/usr.bin/zstreamdump/Makefile b/cddl/usr.bin/zstreamdump/Makefile
deleted file mode 100644
index 63f365d0445a..000000000000
--- a/cddl/usr.bin/zstreamdump/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# $FreeBSD$
-
-ZFSTOP= ${SRCTOP}/sys/contrib/openzfs
-
-.PATH: ${ZFSTOP}/cmd/zstreamdump
-.PATH: ${ZFSTOP}/man/man8
-
-SCRIPTS= zstreamdump
-MAN= zstreamdump.8
-
-.include <bsd.prog.mk>
diff --git a/cddl/usr.bin/zstreamdump/Makefile.depend b/cddl/usr.bin/zstreamdump/Makefile.depend
deleted file mode 100644
index 3089536f9717..000000000000
--- a/cddl/usr.bin/zstreamdump/Makefile.depend
+++ /dev/null
@@ -1,25 +0,0 @@
-# $FreeBSD$
-# Autogenerated - do NOT edit!
-
-DIRDEPS = \
- cddl/lib/libavl \
- cddl/lib/libnvpair \
- cddl/lib/libumem \
- cddl/lib/libzpool \
- gnu/lib/csu \
- include \
- include/xlocale \
- lib/${CSU_DIR} \
- lib/libc \
- lib/libcompiler_rt \
- lib/libmd \
- lib/libthr \
- lib/libz \
- lib/msun \
-
-
-.include <dirdeps.mk>
-
-.if ${DEP_RELDIR} == ${_DEP_RELDIR}
-# local dependencies - needed for -jN in clean tree
-.endif
diff --git a/sys/contrib/openzfs/.github/ISSUE_TEMPLATE/config.yml b/sys/contrib/openzfs/.github/ISSUE_TEMPLATE/config.yml
index dd8f0557a30c..952414f66ace 100644
--- a/sys/contrib/openzfs/.github/ISSUE_TEMPLATE/config.yml
+++ b/sys/contrib/openzfs/.github/ISSUE_TEMPLATE/config.yml
@@ -10,5 +10,5 @@ contact_links:
url: https://lists.freebsd.org/mailman/listinfo/freebsd-fs
about: Get community support for OpenZFS on FreeBSD
- name: OpenZFS on IRC
- url: https://webchat.freenode.net/#openzfs
+ url: https://kiwiirc.com/nextclient/irc.libera.chat/openzfs
about: Use IRC to get community support for OpenZFS
diff --git a/sys/contrib/openzfs/META b/sys/contrib/openzfs/META
index 9181ce7bd4a2..5698d641ca6b 100644
--- a/sys/contrib/openzfs/META
+++ b/sys/contrib/openzfs/META
@@ -2,7 +2,7 @@ Meta: 1
Name: zfs
Branch: 1.0
Version: 2.1.0
-Release: rc6
+Release: rc7
Release-Tags: relext
License: CDDL
Author: OpenZFS
diff --git a/sys/contrib/openzfs/Makefile.am b/sys/contrib/openzfs/Makefile.am
index c44d64df0187..4e7e29589fc0 100644
--- a/sys/contrib/openzfs/Makefile.am
+++ b/sys/contrib/openzfs/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/config/Shellcheck.am
+
ACLOCAL_AMFLAGS = -I config
SUBDIRS = include
@@ -6,7 +8,7 @@ SUBDIRS += rpm
endif
if CONFIG_USER
-SUBDIRS += etc man scripts lib tests cmd contrib
+SUBDIRS += man scripts lib tests cmd etc contrib
if BUILD_LINUX
SUBDIRS += udev
endif
@@ -123,17 +125,8 @@ cstyle:
filter_executable = -exec test -x '{}' \; -print
-PHONY += shellcheck
-shellcheck:
- @if type shellcheck > /dev/null 2>&1; then \
- shellcheck --exclude=SC1090 --exclude=SC1117 --format=gcc \
- $$(find ${top_srcdir}/scripts/*.sh -type f) \
- $$(find ${top_srcdir}/cmd/zed/zed.d/*.sh -type f) \
- $$(find ${top_srcdir}/cmd/zpool/zpool.d/* \
- -type f ${filter_executable}); \
- else \
- echo "skipping shellcheck because shellcheck is not installed"; \
- fi
+SHELLCHECKDIRS = cmd contrib etc scripts tests
+SHELLCHECKSCRIPTS = autogen.sh
PHONY += checkabi storeabi
checkabi: lib
@@ -142,38 +135,9 @@ checkabi: lib
storeabi: lib
$(MAKE) -C lib storeabi
-PHONY += checkbashisms
-checkbashisms:
- @if type checkbashisms > /dev/null 2>&1; then \
- checkbashisms -n -p -x \
- $$(find ${top_srcdir} \
- -name '.git' -prune \
- -o -name 'build' -prune \
- -o -name 'tests' -prune \
- -o -name 'config' -prune \
- -o -name 'zed-functions.sh*' -prune \
- -o -name 'zfs-import*' -prune \
- -o -name 'zfs-mount*' -prune \
- -o -name 'zfs-zed*' -prune \
- -o -name 'smart' -prune \
- -o -name 'paxcheck.sh' -prune \
- -o -name 'make_gitrev.sh' -prune \
- -o -name '90zfs' -prune \
- -o -type f ! -name 'config*' \
- ! -name 'libtool' \
- -exec sh -c 'awk "NR==1 && /#!.*bin\/sh.*/ {print FILENAME;}" "{}"' \;); \
- else \
- echo "skipping checkbashisms because checkbashisms is not installed"; \
- fi
-
PHONY += mancheck
mancheck:
- @if type mandoc > /dev/null 2>&1; then \
- find ${top_srcdir}/man/man8 -type f -name '*[1-9]*' \
- -exec mandoc -Tlint -Werror {} \+; \
- else \
- echo "skipping mancheck because mandoc is not installed"; \
- fi
+ ${top_srcdir}/scripts/mancheck.sh ${top_srcdir}/man ${top_srcdir}/tests/test-runner/man
if BUILD_LINUX
stat_fmt = -c '%A %n'
diff --git a/sys/contrib/openzfs/cmd/Makefile.am b/sys/contrib/openzfs/cmd/Makefile.am
index 473fcb0e07a1..5fc9e83971d8 100644
--- a/sys/contrib/openzfs/cmd/Makefile.am
+++ b/sys/contrib/openzfs/cmd/Makefile.am
@@ -1,10 +1,15 @@
-SUBDIRS = zfs zpool zdb zhack zinject zstream zstreamdump ztest
+include $(top_srcdir)/config/Shellcheck.am
+
+SUBDIRS = zfs zpool zdb zhack zinject zstream ztest
SUBDIRS += fsck_zfs vdev_id raidz_test zfs_ids_to_path
SUBDIRS += zpool_influxdb
CPPCHECKDIRS = zfs zpool zdb zhack zinject zstream ztest
CPPCHECKDIRS += raidz_test zfs_ids_to_path zpool_influxdb
+# TODO: #12084: SHELLCHECKDIRS = fsck_zfs vdev_id zpool
+SHELLCHECKDIRS = fsck_zfs zpool
+
if USING_PYTHON
SUBDIRS += arcstat arc_summary dbufstat
endif
@@ -12,6 +17,7 @@ endif
if BUILD_LINUX
SUBDIRS += mount_zfs zed zgenhostid zvol_id zvol_wait
CPPCHECKDIRS += mount_zfs zed zgenhostid zvol_id
+SHELLCHECKDIRS += zed
endif
PHONY = cppcheck
diff --git a/sys/contrib/openzfs/cmd/arc_summary/arc_summary3 b/sys/contrib/openzfs/cmd/arc_summary/arc_summary3
index d5b5489992e7..7b28012ede4d 100755
--- a/sys/contrib/openzfs/cmd/arc_summary/arc_summary3
+++ b/sys/contrib/openzfs/cmd/arc_summary/arc_summary3
@@ -42,6 +42,7 @@ import os
import subprocess
import sys
import time
+import errno
# We can't use env -S portably, and we need python3 -u to handle pipes in
# the shell abruptly closing the way we want to, so...
@@ -239,6 +240,11 @@ def handle_Exception(ex_cls, ex, tb):
# It turns out that while sys.exit() triggers an exception
# not handled message on Python 3.8+, os._exit() does not.
os._exit(0)
+
+ if ex_cls is OSError:
+ if ex.errno == errno.ENOTCONN:
+ sys.exit()
+
raise ex
if hasattr(sys,'unraisablehook'): # Python 3.8+
diff --git a/sys/contrib/openzfs/cmd/fsck_zfs/Makefile.am b/sys/contrib/openzfs/cmd/fsck_zfs/Makefile.am
index 67583ac75924..f8139f117ff2 100644
--- a/sys/contrib/openzfs/cmd/fsck_zfs/Makefile.am
+++ b/sys/contrib/openzfs/cmd/fsck_zfs/Makefile.am
@@ -1,4 +1,5 @@
include $(top_srcdir)/config/Substfiles.am
+include $(top_srcdir)/config/Shellcheck.am
dist_sbin_SCRIPTS = fsck.zfs
diff --git a/sys/contrib/openzfs/cmd/fsck_zfs/fsck.zfs.in b/sys/contrib/openzfs/cmd/fsck_zfs/fsck.zfs.in
index 32c8043e68fb..37096902cb94 100755
--- a/sys/contrib/openzfs/cmd/fsck_zfs/fsck.zfs.in
+++ b/sys/contrib/openzfs/cmd/fsck_zfs/fsck.zfs.in
@@ -26,15 +26,15 @@ for dataset in "$@"; do
case "$(@sbindir@/zpool list -Ho health "$pool")" in
DEGRADED)
- ret=$(( $ret | 4 ))
+ ret=$(( ret | 4 ))
;;
FAULTED)
awk '!/^([[:space:]]*#.*)?$/ && $1 == "'"$dataset"'" && $3 == "zfs" {exit 1}' /etc/fstab || \
- ret=$(( $ret | 8 ))
+ ret=$(( ret | 8 ))
;;
"")
# Pool not found, error printed by zpool(8)
- ret=$(( $ret | 8 ))
+ ret=$(( ret | 8 ))
;;
*)
;;
diff --git a/sys/contrib/openzfs/cmd/vdev_id/Makefile.am b/sys/contrib/openzfs/cmd/vdev_id/Makefile.am
index fb815faad084..4071c6d5ed6b 100644
--- a/sys/contrib/openzfs/cmd/vdev_id/Makefile.am
+++ b/sys/contrib/openzfs/cmd/vdev_id/Makefile.am
@@ -1 +1,3 @@
+include $(top_srcdir)/config/Shellcheck.am
+
dist_udev_SCRIPTS = vdev_id
diff --git a/sys/contrib/openzfs/cmd/zdb/zdb.c b/sys/contrib/openzfs/cmd/zdb/zdb.c
index 84ae606b999f..c548936bcce5 100644
--- a/sys/contrib/openzfs/cmd/zdb/zdb.c
+++ b/sys/contrib/openzfs/cmd/zdb/zdb.c
@@ -162,12 +162,6 @@ static int dump_bpobj_cb(void *arg, const blkptr_t *bp, boolean_t free,
dmu_tx_t *tx);
typedef struct sublivelist_verify {
- /* all ALLOC'd blkptr_t in one sub-livelist */
- zfs_btree_t sv_all_allocs;
-
- /* all FREE'd blkptr_t in one sub-livelist */
- zfs_btree_t sv_all_frees;
-
/* FREE's that haven't yet matched to an ALLOC, in one sub-livelist */
zfs_btree_t sv_pair;
@@ -226,29 +220,68 @@ typedef struct sublivelist_verify_block {
static void zdb_print_blkptr(const blkptr_t *bp, int flags);
+typedef struct sublivelist_verify_block_refcnt {
+ /* block pointer entry in livelist being verified */
+ blkptr_t svbr_blk;
+
+ /*
+ * Refcount gets incremented to 1 when we encounter the first
+ * FREE entry for the svfbr block pointer and a node for it
+ * is created in our ZDB verification/tracking metadata.
+ *
+ * As we encounter more FREE entries we increment this counter
+ * and similarly decrement it whenever we find the respective
+ * ALLOC entries for this block.
+ *
+ * When the refcount gets to 0 it means that all the FREE and
+ * ALLOC entries of this block have paired up and we no longer
+ * need to track it in our verification logic (e.g. the node
+ * containing this struct in our verification data structure
+ * should be freed).
+ *
+ * [refer to sublivelist_verify_blkptr() for the actual code]
+ */
+ uint32_t svbr_refcnt;
+} sublivelist_verify_block_refcnt_t;
+
+static int
+sublivelist_block_refcnt_compare(const void *larg, const void *rarg)
+{
+ const sublivelist_verify_block_refcnt_t *l = larg;
+ const sublivelist_verify_block_refcnt_t *r = rarg;
+ return (livelist_compare(&l->svbr_blk, &r->svbr_blk));
+}
+
static int
sublivelist_verify_blkptr(void *arg, const blkptr_t *bp, boolean_t free,
dmu_tx_t *tx)
{
ASSERT3P(tx, ==, NULL);
struct sublivelist_verify *sv = arg;
- char blkbuf[BP_SPRINTF_LEN];
+ sublivelist_verify_block_refcnt_t current = {
+ .svbr_blk = *bp,
+
+ /*
+ * Start with 1 in case this is the first free entry.
+ * This field is not used for our B-Tree comparisons
+ * anyway.
+ */
+ .svbr_refcnt = 1,
+ };
+
zfs_btree_index_t where;
+ sublivelist_verify_block_refcnt_t *pair =
+ zfs_btree_find(&sv->sv_pair, &current, &where);
if (free) {
- zfs_btree_add(&sv->sv_pair, bp);
- /* Check if the FREE is a duplicate */
- if (zfs_btree_find(&sv->sv_all_frees, bp, &where) != NULL) {
- snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), bp,
- free);
- (void) printf("\tERROR: Duplicate FREE: %s\n", blkbuf);
+ if (pair == NULL) {
+ /* first free entry for this block pointer */
+ zfs_btree_add(&sv->sv_pair, &current);
} else {
- zfs_btree_add_idx(&sv->sv_all_frees, bp, &where);
+ pair->svbr_refcnt++;
}
} else {
- /* Check if the ALLOC has been freed */
- if (zfs_btree_find(&sv->sv_pair, bp, &where) != NULL) {
- zfs_btree_remove_idx(&sv->sv_pair, &where);
- } else {
+ if (pair == NULL) {
+ /* block that is currently marked as allocated */
for (int i = 0; i < SPA_DVAS_PER_BP; i++) {
if (DVA_IS_EMPTY(&bp->blk_dva[i]))
break;
@@ -263,16 +296,16 @@ sublivelist_verify_blkptr(void *arg, const blkptr_t *bp, boolean_t free,
&svb, &where);
}
}
- }
- /* Check if the ALLOC is a duplicate */
- if (zfs_btree_find(&sv->sv_all_allocs, bp, &where) != NULL) {
- snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), bp,
- free);
- (void) printf("\tERROR: Duplicate ALLOC: %s\n", blkbuf);
} else {
- zfs_btree_add_idx(&sv->sv_all_allocs, bp, &where);
+ /* alloc matches a free entry */
+ pair->svbr_refcnt--;
+ if (pair->svbr_refcnt == 0) {
+ /* all allocs and frees have been matched */
+ zfs_btree_remove_idx(&sv->sv_pair, &where);
+ }
}
}
+
return (0);
}
@@ -280,32 +313,22 @@ static int
sublivelist_verify_func(void *args, dsl_deadlist_entry_t *dle)
{
int err;
- char blkbuf[BP_SPRINTF_LEN];
struct sublivelist_verify *sv = args;
- zfs_btree_create(&sv->sv_all_allocs, livelist_compare,
- sizeof (blkptr_t));
-
- zfs_btree_create(&sv->sv_all_frees, livelist_compare,
- sizeof (blkptr_t));
-
- zfs_btree_create(&sv->sv_pair, livelist_compare,
- sizeof (blkptr_t));
+ zfs_btree_create(&sv->sv_pair, sublivelist_block_refcnt_compare,
+ sizeof (sublivelist_verify_block_refcnt_t));
err = bpobj_iterate_nofree(&dle->dle_bpobj, sublivelist_verify_blkptr,
sv, NULL);
- zfs_btree_clear(&sv->sv_all_allocs);
- zfs_btree_destroy(&sv->sv_all_allocs);
-
- zfs_btree_clear(&sv->sv_all_frees);
- zfs_btree_destroy(&sv->sv_all_frees);
-
- blkptr_t *e;
+ sublivelist_verify_block_refcnt_t *e;
zfs_btree_index_t *cookie = NULL;
while ((e = zfs_btree_destroy_nodes(&sv->sv_pair, &cookie)) != NULL) {
- snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), e, B_TRUE);
- (void) printf("\tERROR: Unmatched FREE: %s\n", blkbuf);
+ char blkbuf[BP_SPRINTF_LEN];
+ snprintf_blkptr_compact(blkbuf, sizeof (blkbuf),
+ &e->svbr_blk, B_TRUE);
+ (void) printf("\tERROR: %d unmatched FREE(s): %s\n",
+ e->svbr_refcnt, blkbuf);
}
zfs_btree_destroy(&sv->sv_pair);
@@ -614,10 +637,14 @@ mv_populate_livelist_allocs(metaslab_verify_t *mv, sublivelist_verify_t *sv)
/*
* [Livelist Check]
* Iterate through all the sublivelists and:
- * - report leftover frees
- * - report double ALLOCs/FREEs
+ * - report leftover frees (**)
* - record leftover ALLOCs together with their TXG [see Cross Check]
*
+ * (**) Note: Double ALLOCs are valid in datasets that have dedup
+ * enabled. Similarly double FREEs are allowed as well but
+ * only if they pair up with a corresponding ALLOC entry once
+ * we our done with our sublivelist iteration.
+ *
* [Spacemap Check]
* for each metaslab:
* - iterate over spacemap and then the metaslab's entries in the
diff --git a/sys/contrib/openzfs/cmd/zed/Makefile.am b/sys/contrib/openzfs/cmd/zed/Makefile.am
index 7d2fe124fb67..5f754c8aef8b 100644
--- a/sys/contrib/openzfs/cmd/zed/Makefile.am
+++ b/sys/contrib/openzfs/cmd/zed/Makefile.am
@@ -1,8 +1,10 @@
include $(top_srcdir)/config/Rules.am
+include $(top_srcdir)/config/Shellcheck.am
AM_CFLAGS += $(LIBUDEV_CFLAGS) $(LIBUUID_CFLAGS)
SUBDIRS = zed.d
+SHELLCHECKDIRS = $(SUBDIRS)
sbin_PROGRAMS = zed
diff --git a/sys/contrib/openzfs/cmd/zed/zed.d/Makefile.am b/sys/contrib/openzfs/cmd/zed/zed.d/Makefile.am
index 8b2d0c200286..2c8173b3e769 100644
--- a/sys/contrib/openzfs/cmd/zed/zed.d/Makefile.am
+++ b/sys/contrib/openzfs/cmd/zed/zed.d/Makefile.am
@@ -1,5 +1,6 @@
include $(top_srcdir)/config/Rules.am
include $(top_srcdir)/config/Substfiles.am
+include $(top_srcdir)/config/Shellcheck.am
EXTRA_DIST += README
@@ -51,3 +52,6 @@ install-data-hook:
ln -s "$(zedexecdir)/$${f}" "$(DESTDIR)$(zedconfdir)"; \
done
chmod 0600 "$(DESTDIR)$(zedconfdir)/zed.rc"
+
+# False positive: 1>&"${ZED_FLOCK_FD}" looks suspiciously similar to a >&filename bash extension
+CHECKBASHISMS_IGNORE = -e 'should be >word 2>&1' -e '&"$${ZED_FLOCK_FD}"'
diff --git a/sys/contrib/openzfs/cmd/zed/zed.d/all-debug.sh b/sys/contrib/openzfs/cmd/zed/zed.d/all-debug.sh
index 14b39caacd9d..824c9fe423d7 100755
--- a/sys/contrib/openzfs/cmd/zed/zed.d/all-debug.sh
+++ b/sys/contrib/openzfs/cmd/zed/zed.d/all-debug.sh
@@ -12,15 +12,11 @@
zed_exit_if_ignoring_this_event
-lockfile="$(basename -- "${ZED_DEBUG_LOG}").lock"
+zed_lock "${ZED_DEBUG_LOG}"
+{
+ printenv | sort
+ echo
+} 1>&"${ZED_FLOCK_FD}"
+zed_unlock "${ZED_DEBUG_LOG}"
-umask 077
-zed_lock "${lockfile}"
-exec >> "${ZED_DEBUG_LOG}"
-
-printenv | sort
-echo
-
-exec >&-
-zed_unlock "${lockfile}"
exit 0
diff --git a/sys/contrib/openzfs/cmd/zed/zed.d/all-syslog.sh b/sys/contrib/openzfs/cmd/zed/zed.d/all-syslog.sh
index 270b1bc67e5c..b07cf0f295ad 100755
--- a/sys/contrib/openzfs/cmd/zed/zed.d/all-syslog.sh
+++ b/sys/contrib/openzfs/cmd/zed/zed.d/all-syslog.sh
@@ -42,6 +42,7 @@ fi
msg="${msg} delay=$((ZEVENT_ZIO_DELAY / 1000000))ms"
# list the bookmark data together
+# shellcheck disable=SC2153
[ -n "${ZEVENT_ZIO_OBJSET}" ] && \
msg="${msg} bookmark=${ZEVENT_ZIO_OBJSET}:${ZEVENT_ZIO_OBJECT}:${ZEVENT_ZIO_LEVEL}:${ZEVENT_ZIO_BLKID}"
diff --git a/sys/contrib/openzfs/cmd/zed/zed.d/history_event-zfs-list-cacher.sh.in b/sys/contrib/openzfs/cmd/zed/zed.d/history_event-zfs-list-cacher.sh.in
index 15f0a8ed6189..db40fa36d668 100755
--- a/sys/contrib/openzfs/cmd/zed/zed.d/history_event-zfs-list-cacher.sh.in
+++ b/sys/contrib/openzfs/cmd/zed/zed.d/history_event-zfs-list-cacher.sh.in
@@ -3,9 +3,8 @@
# Track changes to enumerated pools for use in early-boot
set -ef
-FSLIST_DIR="@sysconfdir@/zfs/zfs-list.cache"
-FSLIST_TMP="@runstatedir@/zfs-list.cache.new"
-FSLIST="${FSLIST_DIR}/${ZEVENT_POOL}"
+FSLIST="@sysconfdir@/zfs/zfs-list.cache/${ZEVENT_POOL}"
+FSLIST_TMP="@runstatedir@/zfs-list.cache@${ZEVENT_POOL}"
# If the pool specific cache file is not writeable, abort
[ -w "${FSLIST}" ] || exit 0
@@ -19,15 +18,15 @@ zed_check_cmd "${ZFS}" sort diff
# If we are acting on a snapshot, we have nothing to do
[ "${ZEVENT_HISTORY_DSNAME%@*}" = "${ZEVENT_HISTORY_DSNAME}" ] || exit 0
-# We obtain a lock on zfs-list to avoid any simultaneous writes.
+# We lock the output file to avoid simultaneous writes.
# If we run into trouble, log and drop the lock
abort_alter() {
- zed_log_msg "Error updating zfs-list.cache!"
- zed_unlock zfs-list
+ zed_log_msg "Error updating zfs-list.cache for ${ZEVENT_POOL}!"
+ zed_unlock "${FSLIST}"
}
finished() {
- zed_unlock zfs-list
+ zed_unlock "${FSLIST}"
trap - EXIT
exit 0
}
@@ -37,7 +36,7 @@ case "${ZEVENT_HISTORY_INTERNAL_NAME}" in
;;
export)
- zed_lock zfs-list
+ zed_lock "${FSLIST}"
trap abort_alter EXIT
echo > "${FSLIST}"
finished
@@ -63,7 +62,7 @@ case "${ZEVENT_HISTORY_INTERNAL_NAME}" in
;;
esac
-zed_lock zfs-list
+zed_lock "${FSLIST}"
trap abort_alter EXIT
PROPS="name,mountpoint,canmount,atime,relatime,devices,exec\
@@ -79,7 +78,7 @@ PROPS="name,mountpoint,canmount,atime,relatime,devices,exec\
sort "${FSLIST_TMP}" -o "${FSLIST_TMP}"
# Don't modify the file if it hasn't changed
-diff -q "${FSLIST_TMP}" "${FSLIST}" || mv "${FSLIST_TMP}" "${FSLIST}"
+diff -q "${FSLIST_TMP}" "${FSLIST}" || cat "${FSLIST_TMP}" > "${FSLIST}"
rm -f "${FSLIST_TMP}"
finished
diff --git a/sys/contrib/openzfs/cmd/zed/zed.d/zed-functions.sh b/sys/contrib/openzfs/cmd/zed/zed.d/zed-functions.sh
index 1fd3888625b2..7dcd6b2d20b9 100644
--- a/sys/contrib/openzfs/cmd/zed/zed.d/zed-functions.sh
+++ b/sys/contrib/openzfs/cmd/zed/zed.d/zed-functions.sh
@@ -126,10 +126,8 @@ zed_lock()
# Obtain a lock on the file bound to the given file descriptor.
#
- eval "exec ${fd}> '${lockfile}'"
- err="$(flock --exclusive "${fd}" 2>&1)"
- # shellcheck disable=SC2181
- if [ $? -ne 0 ]; then
+ eval "exec ${fd}>> '${lockfile}'"
+ if ! err="$(flock --exclusive "${fd}" 2>&1)"; then
zed_log_err "failed to lock \"${lockfile}\": ${err}"
fi
@@ -165,9 +163,7 @@ zed_unlock()
fi
# Release the lock and close the file descriptor.
- err="$(flock --unlock "${fd}" 2>&1)"
- # shellcheck disable=SC2181
- if [ $? -ne 0 ]; then
+ if ! err="$(flock --unlock "${fd}" 2>&1)"; then
zed_log_err "failed to unlock \"${lockfile}\": ${err}"
fi
eval "exec ${fd}>&-"
@@ -267,7 +263,7 @@ zed_notify_email()
-e "s/@SUBJECT@/${subject}/g")"
# shellcheck disable=SC2086
- eval "${ZED_EMAIL_PROG}" ${ZED_EMAIL_OPTS} < "${pathname}" >/dev/null 2>&1
+ ${ZED_EMAIL_PROG} ${ZED_EMAIL_OPTS} < "${pathname}" >/dev/null 2>&1
rv=$?
if [ "${rv}" -ne 0 ]; then
zed_log_err "$(basename "${ZED_EMAIL_PROG}") exit=${rv}"
diff --git a/sys/contrib/openzfs/cmd/zfs/zfs_main.c b/sys/contrib/openzfs/cmd/zfs/zfs_main.c
index 395fc353fe1b..cabf7189223b 100644
--- a/sys/contrib/openzfs/cmd/zfs/zfs_main.c
+++ b/sys/contrib/openzfs/cmd/zfs/zfs_main.c
@@ -728,6 +728,32 @@ finish_progress(char *done)
pt_header = NULL;
}
+/* This function checks if the passed fd refers to /dev/null or /dev/zero */
+#ifdef __linux__
+static boolean_t
+is_dev_nullzero(int fd)
+{
+ struct stat st;
+ fstat(fd, &st);
+ return (major(st.st_rdev) == 1 && (minor(st.st_rdev) == 3 /* null */ ||
+ minor(st.st_rdev) == 5 /* zero */));
+}
+#endif
+
+static void
+note_dev_error(int err, int fd)
+{
+#ifdef __linux__
+ if (err == EINVAL && is_dev_nullzero(fd)) {
+ (void) fprintf(stderr,
+ gettext("Error: Writing directly to /dev/{null,zero} files"
+ " on certain kernels is not currently implemented.\n"
+ "(As a workaround, "
+ "try \"zfs send [...] | cat > /dev/null\")\n"));
+ }
+#endif
+}
+
static int
zfs_mount_and_share(libzfs_handle_t *hdl, const char *dataset, zfs_type_t type)
{
@@ -4572,11 +4598,16 @@ zfs_do_send(int argc, char **argv)
err = zfs_send_saved(zhp, &flags, STDOUT_FILENO,
resume_token);
+ if (err != 0)
+ note_dev_error(errno, STDOUT_FILENO);
zfs_close(zhp);
return (err != 0);
} else if (resume_token != NULL) {
- return (zfs_send_resume(g_zfs, &flags, STDOUT_FILENO,
- resume_token));
+ err = zfs_send_resume(g_zfs, &flags, STDOUT_FILENO,
+ resume_token);
+ if (err != 0)
+ note_dev_error(errno, STDOUT_FILENO);
+ return (err);
}
if (flags.skipmissing && !flags.replicate) {
@@ -4627,6 +4658,8 @@ zfs_do_send(int argc, char **argv)
err = zfs_send_one(zhp, fromname, STDOUT_FILENO, &flags,
redactbook);
zfs_close(zhp);
+ if (err != 0)
+ note_dev_error(errno, STDOUT_FILENO);
return (err != 0);
}
@@ -4703,6 +4736,7 @@ zfs_do_send(int argc, char **argv)
nvlist_free(dbgnv);
}
zfs_close(zhp);
+ note_dev_error(errno, STDOUT_FILENO);
return (err != 0);
}
diff --git a/sys/contrib/openzfs/cmd/zgenhostid/zgenhostid.c b/sys/contrib/openzfs/cmd/zgenhostid/zgenhostid.c
index 5a9bdad7c38d..4a4ca80e00e0 100644
--- a/sys/contrib/openzfs/cmd/zgenhostid/zgenhostid.c
+++ b/sys/contrib/openzfs/cmd/zgenhostid/zgenhostid.c
@@ -36,8 +36,6 @@
#include <time.h>
#include <unistd.h>
-static void usage(void);
-
static void
usage(void)
{
@@ -60,12 +58,11 @@ int
main(int argc, char **argv)
{
/* default file path, can be optionally set by user */
- char path[PATH_MAX] = "/etc/hostid";
+ const char *path = "/etc/hostid";
/* holds converted user input or lrand48() generated value */
unsigned long input_i = 0;
int opt;
- int pathlen;
int force_fwrite = 0;
while ((opt = getopt_long(argc, argv, "fo:h?", 0, 0)) != -1) {
switch (opt) {
@@ -73,14 +70,7 @@ main(int argc, char **argv)
force_fwrite = 1;
break;
case 'o':
- pathlen = snprintf(path, sizeof (path), "%s", optarg);
- if (pathlen >= sizeof (path)) {
- fprintf(stderr, "%s\n", strerror(EOVERFLOW));
- exit(EXIT_FAILURE);
- } else if (pathlen < 1) {
- fprintf(stderr, "%s\n", strerror(EINVAL));
- exit(EXIT_FAILURE);
- }
+ path = optarg;
break;
case 'h':
case '?':
@@ -118,7 +108,7 @@ main(int argc, char **argv)
if (force_fwrite == 0 && stat(path, &fstat) == 0 &&
S_ISREG(fstat.st_mode)) {
fprintf(stderr, "%s: %s\n", path, strerror(EEXIST));
- exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
/*
diff --git a/sys/contrib/openzfs/cmd/zpool/Makefile.am b/sys/contrib/openzfs/cmd/zpool/Makefile.am
index 4446cf04a085..aad45d4f7497 100644
--- a/sys/contrib/openzfs/cmd/zpool/Makefile.am
+++ b/sys/contrib/openzfs/cmd/zpool/Makefile.am
@@ -1,4 +1,5 @@
include $(top_srcdir)/config/Rules.am
+include $(top_srcdir)/config/Shellcheck.am
AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUUID_CFLAGS)
diff --git a/sys/contrib/openzfs/cmd/zpool/os/freebsd/zpool_vdev_os.c b/sys/contrib/openzfs/cmd/zpool/os/freebsd/zpool_vdev_os.c
index 7d48f61a0ee7..aa66d29fa604 100644
--- a/sys/contrib/openzfs/cmd/zpool/os/freebsd/zpool_vdev_os.c
+++ b/sys/contrib/openzfs/cmd/zpool/os/freebsd/zpool_vdev_os.c
@@ -101,3 +101,18 @@ check_sector_size_database(char *path, int *sector_size)
{
return (0);
}
+
+void
+after_zpool_upgrade(zpool_handle_t *zhp)
+{
+ char bootfs[ZPOOL_MAXPROPLEN];
+
+ if (zpool_get_prop(zhp, ZPOOL_PROP_BOOTFS, bootfs,
+ sizeof (bootfs), NULL, B_FALSE) == 0 &&
+ strcmp(bootfs, "-") != 0) {
+ (void) printf(gettext("Pool '%s' has the bootfs "
+ "property set, you might need to update\nthe boot "
+ "code. See gptzfsboot(8) and loader.efi(8) for "
+ "details.\n"), zpool_get_name(zhp));
+ }
+}
diff --git a/sys/contrib/openzfs/cmd/zpool/os/linux/zpool_vdev_os.c b/sys/contrib/openzfs/cmd/zpool/os/linux/zpool_vdev_os.c
index 55a9367ec180..da87aa79f365 100644
--- a/sys/contrib/openzfs/cmd/zpool/os/linux/zpool_vdev_os.c
+++ b/sys/contrib/openzfs/cmd/zpool/os/linux/zpool_vdev_os.c
@@ -405,3 +405,8 @@ check_device(const char *path, boolean_t force,
return (error);
}
+
+void
+after_zpool_upgrade(zpool_handle_t *zhp)
+{
+}
diff --git a/sys/contrib/openzfs/cmd/zpool/zpool.d/smart b/sys/contrib/openzfs/cmd/zpool/zpool.d/smart
index f8854b75227c..b95256d75648 100755
--- a/sys/contrib/openzfs/cmd/zpool/zpool.d/smart
+++ b/sys/contrib/openzfs/cmd/zpool/zpool.d/smart
@@ -53,7 +53,7 @@ get_filename_from_dir()
num_files=$(find "$dir" -maxdepth 1 -type f | wc -l)
mod=$((pid % num_files))
i=0
- find "$dir" -type f -printf "%f\n" | while read -r file ; do
+ find "$dir" -type f -printf '%f\n' | while read -r file ; do
if [ "$mod" = "$i" ] ; then
echo "$file"
break
@@ -62,17 +62,14 @@ get_filename_from_dir()
done
}
-script=$(basename "$0")
+script="${0##*/}"
if [ "$1" = "-h" ] ; then
echo "$helpstr" | grep "$script:" | tr -s '\t' | cut -f 2-
exit
fi
-smartctl_path=$(command -v smartctl)
-
-# shellcheck disable=SC2015
-if [ -b "$VDEV_UPATH" ] && [ -x "$smartctl_path" ] || [ -n "$samples" ] ; then
+if [ -b "$VDEV_UPATH" ] && PATH="/usr/sbin:$PATH" command -v smartctl > /dev/null || [ -n "$samples" ] ; then
if [ -n "$samples" ] ; then
# cat a smartctl output text file instead of running smartctl
# on a vdev (only used for developer testing).
@@ -80,7 +77,7 @@ if [ -b "$VDEV_UPATH" ] && [ -x "$smartctl_path" ] || [ -n "$samples" ] ; then
echo "file=$file"
raw_out=$(cat "$samples/$file")
else
- raw_out=$(eval "sudo $smartctl_path -a $VDEV_UPATH")
+ raw_out=$(sudo smartctl -a "$VDEV_UPATH")
fi
# What kind of drive are we? Look for the right line in smartctl:
@@ -231,11 +228,11 @@ esac
with_vals=$(echo "$out" | grep -E "$scripts")
if [ -n "$with_vals" ]; then
echo "$with_vals"
- without_vals=$(echo "$scripts" | tr "|" "\n" |
+ without_vals=$(echo "$scripts" | tr '|' '\n' |
grep -v -E "$(echo "$with_vals" |
awk -F "=" '{print $1}')" | awk '{print $0"="}')
else
- without_vals=$(echo "$scripts" | tr "|" "\n" | awk '{print $0"="}')
+ without_vals=$(echo "$scripts" | tr '|' '\n' | awk '{print $0"="}')
fi
if [ -n "$without_vals" ]; then
diff --git a/sys/contrib/openzfs/cmd/zpool/zpool_main.c b/sys/contrib/openzfs/cmd/zpool/zpool_main.c
index d7d93c4da343..a8c3aedc03b0 100644
--- a/sys/contrib/openzfs/cmd/zpool/zpool_main.c
+++ b/sys/contrib/openzfs/cmd/zpool/zpool_main.c
@@ -533,7 +533,7 @@ usage(boolean_t requested)
(void) fprintf(fp, "YES disabled | enabled | active\n");
(void) fprintf(fp, gettext("\nThe feature@ properties must be "
- "appended with a feature name.\nSee zpool-features(5).\n"));
+ "appended with a feature name.\nSee zpool-features(7).\n"));
}
/*
@@ -8269,7 +8269,7 @@ status_callback(zpool_handle_t *zhp, void *data)
printf_color(ANSI_YELLOW, gettext("Enable all features using "
"'zpool upgrade'. Once this is done,\n\tthe pool may no "
"longer be accessible by software that does not support\n\t"
- "the features. See zpool-features(5) for details.\n"));
+ "the features. See zpool-features(7) for details.\n"));
break;
case ZPOOL_STATUS_COMPATIBILITY_ERR:
@@ -8858,7 +8858,7 @@ upgrade_cb(zpool_handle_t *zhp, void *arg)
upgrade_cbdata_t *cbp = arg;
nvlist_t *config;
uint64_t version;
- boolean_t printnl = B_FALSE;
+ boolean_t modified_pool = B_FALSE;
int ret;
config = zpool_get_config(zhp, NULL);
@@ -8872,7 +8872,7 @@ upgrade_cb(zpool_handle_t *zhp, void *arg)
ret = upgrade_version(zhp, cbp->cb_version);
if (ret != 0)
return (ret);
- printnl = B_TRUE;
+ modified_pool = B_TRUE;
/*
* If they did "zpool upgrade -a", then we could
@@ -8892,12 +8892,13 @@ upgrade_cb(zpool_handle_t *zhp, void *arg)
if (count > 0) {
cbp->cb_first = B_FALSE;
- printnl = B_TRUE;
+ modified_pool = B_TRUE;
}
}
- if (printnl) {
- (void) printf(gettext("\n"));
+ if (modified_pool) {
+ (void) printf("\n");
+ (void) after_zpool_upgrade(zhp);
}
return (0);
@@ -8971,7 +8972,7 @@ upgrade_list_disabled_cb(zpool_handle_t *zhp, void *arg)
"pool may become incompatible with "
"software\nthat does not support "
"the feature. See "
- "zpool-features(5) for "
+ "zpool-features(7) for "
"details.\n\n"
"Note that the pool "
"'compatibility' feature can be "
@@ -9010,7 +9011,7 @@ upgrade_list_disabled_cb(zpool_handle_t *zhp, void *arg)
static int
upgrade_one(zpool_handle_t *zhp, void *data)
{
- boolean_t printnl = B_FALSE;
+ boolean_t modified_pool = B_FALSE;
upgrade_cbdata_t *cbp = data;
uint64_t cur_version;
int ret;
@@ -9038,7 +9039,7 @@ upgrade_one(zpool_handle_t *zhp, void *data)
}
if (cur_version != cbp->cb_version) {
- printnl = B_TRUE;
+ modified_pool = B_TRUE;
ret = upgrade_version(zhp, cbp->cb_version);
if (ret != 0)
return (ret);
@@ -9051,7 +9052,7 @@ upgrade_one(zpool_handle_t *zhp, void *data)
return (ret);
if (count != 0) {
- printnl = B_TRUE;
+ modified_pool = B_TRUE;
} else if (cur_version == SPA_VERSION) {
(void) printf(gettext("Pool '%s' already has all "
"supported and requested features enabled.\n"),
@@ -9059,8 +9060,9 @@ upgrade_one(zpool_handle_t *zhp, void *data)
}
}
- if (printnl) {
- (void) printf(gettext("\n"));
+ if (modified_pool) {
+ (void) printf("\n");
+ (void) after_zpool_upgrade(zhp);
}
return (0);
diff --git a/sys/contrib/openzfs/cmd/zpool/zpool_util.h b/sys/contrib/openzfs/cmd/zpool/zpool_util.h
index abaa22d78c20..493f8cb98043 100644
--- a/sys/contrib/openzfs/cmd/zpool/zpool_util.h
+++ b/sys/contrib/openzfs/cmd/zpool/zpool_util.h
@@ -129,6 +129,7 @@ int check_device(const char *path, boolean_t force,
boolean_t check_sector_size_database(char *path, int *sector_size);
void vdev_error(const char *fmt, ...);
int check_file(const char *file, boolean_t force, boolean_t isspare);
+void after_zpool_upgrade(zpool_handle_t *zhp);
#ifdef __cplusplus
}
diff --git a/sys/contrib/openzfs/cmd/zpool_influxdb/dashboards/grafana/ZFS-pool-latency-heatmaps-influxdb.json b/sys/contrib/openzfs/cmd/zpool_influxdb/dashboards/grafana/ZFS-pool-latency-heatmaps-influxdb.json
index a99f92783bc4..70260ae40814 100644
--- a/sys/contrib/openzfs/cmd/zpool_influxdb/dashboards/grafana/ZFS-pool-latency-heatmaps-influxdb.json
+++ b/sys/contrib/openzfs/cmd/zpool_influxdb/dashboards/grafana/ZFS-pool-latency-heatmaps-influxdb.json
@@ -1360,7 +1360,7 @@
"type": "row"
},
{
- "content": "I/O requests that are satisfied by accessing pool devices are managed by the ZIO scheduler.\nThe total latency is measured from the start of the I/O to completion by the disk.\nLatency through each queue is shown prior to its submission to the disk queue.\n\nThis view is useful for observing the effects of tuning the ZIO scheduler min and max values\n(see zfs-module-parameters(5) and [ZFS on Linux Module Parameters](https://openzfs.github.io/openzfs-docs/Performance%20and%20tuning/ZFS%20on%20Linux%20Module%20Parameters.html)):\n+ *zfs_vdev_max_active* controls the ZIO scheduler's disk queue depth (do not confuse with the block device's nr_requests)\n+ *zfs_vdev_sync_read_min_active* and *zfs_vdev_sync_read_max_active* control the synchronous queue for reads: most reads are sync\n+ *zfs_vdev_sync_write_min_active* and *zfs_vdev_sync_write_max_active* control the synchronous queue for writes: \nusually metadata or user data depending on the \"sync\" property setting or I/Os that are requested to be flushed\n+ *zfs_vdev_async_read_min_active* and *zfs_vdev_async_read_max_active* control the asynchronous queue for reads: usually prefetches\n+ *zfs_vdev_async_write_min_active* and *zfs_vdev_async_write_max_active* control the asynchronous queue for writes: \nusually the bulk of all writes at transaction group (txg) commit\n+ *zfs_vdev_scrub_min_active* and *zfs_vdev_scrub_max_active* controls the scan reads: usually scrub or resilver\n\n",
+ "content": "I/O requests that are satisfied by accessing pool devices are managed by the ZIO scheduler.\nThe total latency is measured from the start of the I/O to completion by the disk.\nLatency through each queue is shown prior to its submission to the disk queue.\n\nThis view is useful for observing the effects of tuning the ZIO scheduler min and max values\n(see zfs(4) and [ZFS on Linux Module Parameters](https://openzfs.github.io/openzfs-docs/Performance%20and%20tuning/ZFS%20on%20Linux%20Module%20Parameters.html)):\n+ *zfs_vdev_max_active* controls the ZIO scheduler's disk queue depth (do not confuse with the block device's nr_requests)\n+ *zfs_vdev_sync_read_min_active* and *zfs_vdev_sync_read_max_active* control the synchronous queue for reads: most reads are sync\n+ *zfs_vdev_sync_write_min_active* and *zfs_vdev_sync_write_max_active* control the synchronous queue for writes: \nusually metadata or user data depending on the \"sync\" property setting or I/Os that are requested to be flushed\n+ *zfs_vdev_async_read_min_active* and *zfs_vdev_async_read_max_active* control the asynchronous queue for reads: usually prefetches\n+ *zfs_vdev_async_write_min_active* and *zfs_vdev_async_write_max_active* control the asynchronous queue for writes: \nusually the bulk of all writes at transaction group (txg) commit\n+ *zfs_vdev_scrub_min_active* and *zfs_vdev_scrub_max_active* controls the scan reads: usually scrub or resilver\n\n",
"datasource": "${DS_MACBOOK-INFLUX}",
"fieldConfig": {
"defaults": {
@@ -1664,4 +1664,4 @@
"list": []
},
"version": 2
-} \ No newline at end of file
+}
diff --git a/sys/contrib/openzfs/cmd/zstream/Makefile.am b/sys/contrib/openzfs/cmd/zstream/Makefile.am
index 69e1adbcbd64..8e813027fa3d 100644
--- a/sys/contrib/openzfs/cmd/zstream/Makefile.am
+++ b/sys/contrib/openzfs/cmd/zstream/Makefile.am
@@ -15,3 +15,6 @@ zstream_LDADD = \
$(abs_top_builddir)/lib/libnvpair/libnvpair.la
include $(top_srcdir)/config/CppCheck.am
+
+install-exec-hook:
+ cd $(DESTDIR)$(sbindir) && $(LN_S) -f zstream zstreamdump
diff --git a/sys/contrib/openzfs/cmd/zstream/zstream.c b/sys/contrib/openzfs/cmd/zstream/zstream.c
index cbcb560a8638..523ae0689710 100644
--- a/sys/contrib/openzfs/cmd/zstream/zstream.c
+++ b/sys/contrib/openzfs/cmd/zstream/zstream.c
@@ -49,6 +49,11 @@ zstream_usage(void)
int
main(int argc, char *argv[])
{
+ char *basename = strrchr(argv[0], '/');
+ basename = basename ? (basename + 1) : argv[0];
+ if (argc >= 1 && strcmp(basename, "zstreamdump") == 0)
+ return (zstream_do_dump(argc, argv));
+
if (argc < 2)
zstream_usage();
diff --git a/sys/contrib/openzfs/cmd/zstreamdump/Makefile.am b/sys/contrib/openzfs/cmd/zstreamdump/Makefile.am
deleted file mode 100644
index 2c04d8513150..000000000000
--- a/sys/contrib/openzfs/cmd/zstreamdump/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-dist_sbin_SCRIPTS = zstreamdump
diff --git a/sys/contrib/openzfs/cmd/zstreamdump/zstreamdump b/sys/contrib/openzfs/cmd/zstreamdump/zstreamdump
deleted file mode 100755
index 17f1aa4b2206..000000000000
--- a/sys/contrib/openzfs/cmd/zstreamdump/zstreamdump
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-exec zstream dump "$@"
diff --git a/sys/contrib/openzfs/cmd/ztest/ztest.c b/sys/contrib/openzfs/cmd/ztest/ztest.c
index 24197d27b065..73694b0b352b 100644
--- a/sys/contrib/openzfs/cmd/ztest/ztest.c
+++ b/sys/contrib/openzfs/cmd/ztest/ztest.c
@@ -124,6 +124,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <getopt.h>
#include <signal.h>
#include <umem.h>
#include <ctype.h>
@@ -192,30 +193,58 @@ typedef struct ztest_shared_opts {
char zo_gvars[ZO_GVARS_MAX_COUNT][ZO_GVARS_MAX_ARGLEN];
} ztest_shared_opts_t;
+/* Default values for command line options. */
+#define DEFAULT_POOL "ztest"
+#define DEFAULT_VDEV_DIR "/tmp"
+#define DEFAULT_VDEV_COUNT 5
+#define DEFAULT_VDEV_SIZE (SPA_MINDEVSIZE * 4) /* 256m default size */
+#define DEFAULT_VDEV_SIZE_STR "256M"
+#define DEFAULT_ASHIFT SPA_MINBLOCKSHIFT
+#define DEFAULT_MIRRORS 2
+#define DEFAULT_RAID_CHILDREN 4
+#define DEFAULT_RAID_PARITY 1
+#define DEFAULT_DRAID_DATA 4
+#define DEFAULT_DRAID_SPARES 1
+#define DEFAULT_DATASETS_COUNT 7
+#define DEFAULT_THREADS 23
+#define DEFAULT_RUN_TIME 300 /* 300 seconds */
+#define DEFAULT_RUN_TIME_STR "300 sec"
+#define DEFAULT_PASS_TIME 60 /* 60 seconds */
+#define DEFAULT_PASS_TIME_STR "60 sec"
+#define DEFAULT_KILL_RATE 70 /* 70% kill rate */
+#define DEFAULT_KILLRATE_STR "70%"
+#define DEFAULT_INITS 1
+#define DEFAULT_MAX_LOOPS 50 /* 5 minutes */
+#define DEFAULT_FORCE_GANGING (64 << 10)
+#define DEFAULT_FORCE_GANGING_STR "64K"
+
+/* Simplifying assumption: -1 is not a valid default. */
+#define NO_DEFAULT -1
+
static const ztest_shared_opts_t ztest_opts_defaults = {
- .zo_pool = "ztest",
- .zo_dir = "/tmp",
+ .zo_pool = DEFAULT_POOL,
+ .zo_dir = DEFAULT_VDEV_DIR,
.zo_alt_ztest = { '\0' },
.zo_alt_libpath = { '\0' },
- .zo_vdevs = 5,
- .zo_ashift = SPA_MINBLOCKSHIFT,
- .zo_mirrors = 2,
- .zo_raid_children = 4,
- .zo_raid_parity = 1,
+ .zo_vdevs = DEFAULT_VDEV_COUNT,
+ .zo_ashift = DEFAULT_ASHIFT,
+ .zo_mirrors = DEFAULT_MIRRORS,
+ .zo_raid_children = DEFAULT_RAID_CHILDREN,
+ .zo_raid_parity = DEFAULT_RAID_PARITY,
.zo_raid_type = VDEV_TYPE_RAIDZ,
- .zo_vdev_size = SPA_MINDEVSIZE * 4, /* 256m default size */
- .zo_draid_data = 4, /* data drives */
- .zo_draid_spares = 1, /* distributed spares */
- .zo_datasets = 7,
- .zo_threads = 23,
- .zo_passtime = 60, /* 60 seconds */
- .zo_killrate = 70, /* 70% kill rate */
+ .zo_vdev_size = DEFAULT_VDEV_SIZE,
+ .zo_draid_data = DEFAULT_DRAID_DATA, /* data drives */
+ .zo_draid_spares = DEFAULT_DRAID_SPARES, /* distributed spares */
+ .zo_datasets = DEFAULT_DATASETS_COUNT,
+ .zo_threads = DEFAULT_THREADS,
+ .zo_passtime = DEFAULT_PASS_TIME,
+ .zo_killrate = DEFAULT_KILL_RATE,
.zo_verbose = 0,
.zo_mmp_test = 0,
- .zo_init = 1,
- .zo_time = 300, /* 5 minutes */
- .zo_maxloops = 50, /* max loops during spa_freeze() */
- .zo_metaslab_force_ganging = 64 << 10,
+ .zo_init = DEFAULT_INITS,
+ .zo_time = DEFAULT_RUN_TIME,
+ .zo_maxloops = DEFAULT_MAX_LOOPS, /* max loops during spa_freeze() */
+ .zo_metaslab_force_ganging = DEFAULT_FORCE_GANGING,
.zo_special_vdevs = ZTEST_VDEV_CLASS_RND,
.zo_gvars_count = 0,
};
@@ -684,68 +713,154 @@ nicenumtoull(const char *buf)
return (val);
}
+typedef struct ztest_option {
+ const char short_opt;
+ const char *long_opt;
+ const char *long_opt_param;
+ const char *comment;
+ unsigned int default_int;
+ char *default_str;
+} ztest_option_t;
+
+/*
+ * The following option_table is used for generating the usage info as well as
+ * the long and short option information for calling getopt_long().
+ */
+static ztest_option_t option_table[] = {
+ { 'v', "vdevs", "INTEGER", "Number of vdevs", DEFAULT_VDEV_COUNT,
+ NULL},
+ { 's', "vdev-size", "INTEGER", "Size of each vdev",
+ NO_DEFAULT, DEFAULT_VDEV_SIZE_STR},
+ { 'a', "alignment-shift", "INTEGER",
+ "Alignment shift; use 0 for random", DEFAULT_ASHIFT, NULL},
+ { 'm', "mirror-copies", "INTEGER", "Number of mirror copies",
+ DEFAULT_MIRRORS, NULL},
+ { 'r', "raid-disks", "INTEGER", "Number of raidz/draid disks",
+ DEFAULT_RAID_CHILDREN, NULL},
+ { 'R', "raid-parity", "INTEGER", "Raid parity",
+ DEFAULT_RAID_PARITY, NULL},
+ { 'K', "raid-kind", "raidz|draid|random", "Raid kind",
+ NO_DEFAULT, "random"},
+ { 'D', "draid-data", "INTEGER", "Number of draid data drives",
+ DEFAULT_DRAID_DATA, NULL},
+ { 'S', "draid-spares", "INTEGER", "Number of draid spares",
+ DEFAULT_DRAID_SPARES, NULL},
+ { 'd', "datasets", "INTEGER", "Number of datasets",
+ DEFAULT_DATASETS_COUNT, NULL},
+ { 't', "threads", "INTEGER", "Number of ztest threads",
+ DEFAULT_THREADS, NULL},
+ { 'g', "gang-block-threshold", "INTEGER",
+ "Metaslab gang block threshold",
+ NO_DEFAULT, DEFAULT_FORCE_GANGING_STR},
+ { 'i', "init-count", "INTEGER", "Number of times to initialize pool",
+ DEFAULT_INITS, NULL},
+ { 'k', "kill-percentage", "INTEGER", "Kill percentage",
+ NO_DEFAULT, DEFAULT_KILLRATE_STR},
+ { 'p', "pool-name", "STRING", "Pool name",
+ NO_DEFAULT, DEFAULT_POOL},
+ { 'f', "vdev-file-directory", "PATH", "File directory for vdev files",
+ NO_DEFAULT, DEFAULT_VDEV_DIR},
+ { 'M', "multi-host", NULL,
+ "Multi-host; simulate pool imported on remote host",
+ NO_DEFAULT, NULL},
+ { 'E', "use-existing-pool", NULL,
+ "Use existing pool instead of creating new one", NO_DEFAULT, NULL},
+ { 'T', "run-time", "INTEGER", "Total run time",
+ NO_DEFAULT, DEFAULT_RUN_TIME_STR},
+ { 'P', "pass-time", "INTEGER", "Time per pass",
+ NO_DEFAULT, DEFAULT_PASS_TIME_STR},
+ { 'F', "freeze-loops", "INTEGER", "Max loops in spa_freeze()",
+ DEFAULT_MAX_LOOPS, NULL},
+ { 'B', "alt-ztest", "PATH", "Alternate ztest path",
+ NO_DEFAULT, NULL},
+ { 'C', "vdev-class-state", "on|off|random", "vdev class state",
+ NO_DEFAULT, "random"},
+ { 'o', "option", "\"OPTION=INTEGER\"",
+ "Set global variable to an unsigned 32-bit integer value",
+ NO_DEFAULT, NULL},
+ { 'G', "dump-debug-msg", NULL,
+ "Dump zfs_dbgmsg buffer before exiting due to an error",
+ NO_DEFAULT, NULL},
+ { 'V', "verbose", NULL,
+ "Verbose (use multiple times for ever more verbosity)",
+ NO_DEFAULT, NULL},
+ { 'h', "help", NULL, "Show this help",
+ NO_DEFAULT, NULL},
+ {0, 0, 0, 0, 0, 0}
+};
+
+static struct option *long_opts = NULL;
+static char *short_opts = NULL;
+
static void
-usage(boolean_t requested)
+init_options(void)
+{
+ ASSERT3P(long_opts, ==, NULL);
+ ASSERT3P(short_opts, ==, NULL);
+
+ int count = sizeof (option_table) / sizeof (option_table[0]);
+ long_opts = umem_alloc(sizeof (struct option) * count, UMEM_NOFAIL);
+
+ short_opts = umem_alloc(sizeof (char) * 2 * count, UMEM_NOFAIL);
+ int short_opt_index = 0;
+
+ for (int i = 0; i < count; i++) {
+ long_opts[i].val = option_table[i].short_opt;
+ long_opts[i].name = option_table[i].long_opt;
+ long_opts[i].has_arg = option_table[i].long_opt_param != NULL
+ ? required_argument : no_argument;
+ long_opts[i].flag = NULL;
+ short_opts[short_opt_index++] = option_table[i].short_opt;
+ if (option_table[i].long_opt_param != NULL) {
+ short_opts[short_opt_index++] = ':';
+ }
+ }
+}
+
+static void
+fini_options(void)
{
- const ztest_shared_opts_t *zo = &ztest_opts_defaults;
+ int count = sizeof (option_table) / sizeof (option_table[0]);
- char nice_vdev_size[NN_NUMBUF_SZ];
- char nice_force_ganging[NN_NUMBUF_SZ];
+ umem_free(long_opts, sizeof (struct option) * count);
+ umem_free(short_opts, sizeof (char) * 2 * count);
+
+ long_opts = NULL;
+ short_opts = NULL;
+}
+
+static void
+usage(boolean_t requested)
+{
+ char option[80];
FILE *fp = requested ? stdout : stderr;
- nicenum(zo->zo_vdev_size, nice_vdev_size, sizeof (nice_vdev_size));
- nicenum(zo->zo_metaslab_force_ganging, nice_force_ganging,
- sizeof (nice_force_ganging));
-
- (void) fprintf(fp, "Usage: %s\n"
- "\t[-v vdevs (default: %llu)]\n"
- "\t[-s size_of_each_vdev (default: %s)]\n"
- "\t[-a alignment_shift (default: %d)] use 0 for random\n"
- "\t[-m mirror_copies (default: %d)]\n"
- "\t[-r raidz_disks / draid_disks (default: %d)]\n"
- "\t[-R raid_parity (default: %d)]\n"
- "\t[-K raid_kind (default: random)] raidz|draid|random\n"
- "\t[-D draid_data (default: %d)] in config\n"
- "\t[-S draid_spares (default: %d)]\n"
- "\t[-d datasets (default: %d)]\n"
- "\t[-t threads (default: %d)]\n"
- "\t[-g gang_block_threshold (default: %s)]\n"
- "\t[-i init_count (default: %d)] initialize pool i times\n"
- "\t[-k kill_percentage (default: %llu%%)]\n"
- "\t[-p pool_name (default: %s)]\n"
- "\t[-f dir (default: %s)] file directory for vdev files\n"
- "\t[-M] Multi-host simulate pool imported on remote host\n"
- "\t[-V] verbose (use multiple times for ever more blather)\n"
- "\t[-E] use existing pool instead of creating new one\n"
- "\t[-T time (default: %llu sec)] total run time\n"
- "\t[-F freezeloops (default: %llu)] max loops in spa_freeze()\n"
- "\t[-P passtime (default: %llu sec)] time per pass\n"
- "\t[-B alt_ztest (default: <none>)] alternate ztest path\n"
- "\t[-C vdev class state (default: random)] special=on|off|random\n"
- "\t[-o variable=value] ... set global variable to an unsigned\n"
- "\t 32-bit integer value\n"
- "\t[-G dump zfs_dbgmsg buffer before exiting due to an error\n"
- "\t[-h] (print help)\n"
- "",
- zo->zo_pool,
- (u_longlong_t)zo->zo_vdevs, /* -v */
- nice_vdev_size, /* -s */
- zo->zo_ashift, /* -a */
- zo->zo_mirrors, /* -m */
- zo->zo_raid_children, /* -r */
- zo->zo_raid_parity, /* -R */
- zo->zo_draid_data, /* -D */
- zo->zo_draid_spares, /* -S */
- zo->zo_datasets, /* -d */
- zo->zo_threads, /* -t */
- nice_force_ganging, /* -g */
- zo->zo_init, /* -i */
- (u_longlong_t)zo->zo_killrate, /* -k */
- zo->zo_pool, /* -p */
- zo->zo_dir, /* -f */
- (u_longlong_t)zo->zo_time, /* -T */
- (u_longlong_t)zo->zo_maxloops, /* -F */
- (u_longlong_t)zo->zo_passtime);
+ (void) fprintf(fp, "Usage: %s [OPTIONS...]\n", DEFAULT_POOL);
+ for (int i = 0; option_table[i].short_opt != 0; i++) {
+ if (option_table[i].long_opt_param != NULL) {
+ (void) sprintf(option, " -%c --%s=%s",
+ option_table[i].short_opt,
+ option_table[i].long_opt,
+ option_table[i].long_opt_param);
+ } else {
+ (void) sprintf(option, " -%c --%s",
+ option_table[i].short_opt,
+ option_table[i].long_opt);
+ }
+ (void) fprintf(fp, " %-40s%s", option,
+ option_table[i].comment);
+
+ if (option_table[i].long_opt_param != NULL) {
+ if (option_table[i].default_str != NULL) {
+ (void) fprintf(fp, " (default: %s)",
+ option_table[i].default_str);
+ } else if (option_table[i].default_int != NO_DEFAULT) {
+ (void) fprintf(fp, " (default: %u)",
+ option_table[i].default_int);
+ }
+ }
+ (void) fprintf(fp, "\n");
+ }
exit(requested ? 0 : 1);
}
@@ -817,8 +932,10 @@ process_options(int argc, char **argv)
bcopy(&ztest_opts_defaults, zo, sizeof (*zo));
- while ((opt = getopt(argc, argv,
- "v:s:a:m:r:R:K:D:S:d:t:g:i:k:p:f:MVET:P:hF:B:C:o:G")) != EOF) {
+ init_options();
+
+ while ((opt = getopt_long(argc, argv, short_opts, long_opts,
+ NULL)) != EOF) {
value = 0;
switch (opt) {
case 'v':
@@ -953,6 +1070,8 @@ process_options(int argc, char **argv)
}
}
+ fini_options();
+
/* When raid choice is 'random' add a draid pool 50% of the time */
if (strcmp(raid_kind, "random") == 0) {
(void) strlcpy(raid_kind, (ztest_random(2) == 0) ?
diff --git a/sys/contrib/openzfs/cmd/zvol_wait/Makefile.am b/sys/contrib/openzfs/cmd/zvol_wait/Makefile.am
index 564031c9799d..2e5bf3323389 100644
--- a/sys/contrib/openzfs/cmd/zvol_wait/Makefile.am
+++ b/sys/contrib/openzfs/cmd/zvol_wait/Makefile.am
@@ -1 +1,3 @@
+include $(top_srcdir)/config/Shellcheck.am
+
dist_bin_SCRIPTS = zvol_wait
diff --git a/sys/contrib/openzfs/cmd/zvol_wait/zvol_wait b/sys/contrib/openzfs/cmd/zvol_wait/zvol_wait
index cc6ba5e62572..2aa929b0ca2b 100755
--- a/sys/contrib/openzfs/cmd/zvol_wait/zvol_wait
+++ b/sys/contrib/openzfs/cmd/zvol_wait/zvol_wait
@@ -20,6 +20,7 @@ filter_out_deleted_zvols() {
OIFS="$IFS"
IFS="
"
+ # shellcheck disable=SC2086
zfs list -H -o name $zvols 2>/dev/null
IFS="$OIFS"
}
diff --git a/sys/contrib/openzfs/config/Shellcheck.am b/sys/contrib/openzfs/config/Shellcheck.am
new file mode 100644
index 000000000000..6b805b797d12
--- /dev/null
+++ b/sys/contrib/openzfs/config/Shellcheck.am
@@ -0,0 +1,22 @@
+.PHONY: shellcheck
+shellcheck: $(SCRIPTS) $(SHELLCHECKSCRIPTS)
+if HAVE_SHELLCHECK
+ [ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; shellcheck $$([ -n "$(SHELLCHECK_SHELL)" ] && echo "--shell=$(SHELLCHECK_SHELL)") --exclude=SC1090,SC1091$(SHELLCHECK_IGNORE) --format=gcc $(SCRIPTS) $(SHELLCHECKSCRIPTS)
+else
+ @[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; echo "skipping shellcheck of" $(SCRIPTS) $(SHELLCHECKSCRIPTS) "because shellcheck is not installed"
+endif
+ @set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir shellcheck; done
+
+
+# command -v *is* specified by POSIX and every shell in existence supports it
+.PHONY: checkbashisms
+checkbashisms: $(SCRIPTS) $(SHELLCHECKSCRIPTS)
+if HAVE_CHECKBASHISMS
+ [ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; ! if [ -z "$(SHELLCHECK_SHELL)" ]; then \
+ checkbashisms -npx $(SCRIPTS) $(SHELLCHECKSCRIPTS); else \
+ for f in $(SCRIPTS) $(SHELLCHECKSCRIPTS); do echo $$f >&3; { echo '#!/bin/$(SHELLCHECK_SHELL)'; cat $$f; } | checkbashisms -npx; done; \
+ fi 3>&2 2>&1 | grep -vFe "'command' with option other than -p" -e 'command -v' $(CHECKBASHISMS_IGNORE) >&2
+else
+ @[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; echo "skipping checkbashisms of" $(SCRIPTS) $(SHELLCHECKSCRIPTS) "because checkbashisms is not installed"
+endif
+ @set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir checkbashisms; done
diff --git a/sys/contrib/openzfs/config/always-shellcheck.m4 b/sys/contrib/openzfs/config/always-shellcheck.m4
new file mode 100644
index 000000000000..2a9a099746f4
--- /dev/null
+++ b/sys/contrib/openzfs/config/always-shellcheck.m4
@@ -0,0 +1,10 @@
+dnl #
+dnl # Check if shellcheck and/or checkbashisms are available.
+dnl #
+AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_SHELLCHECK], [
+ AC_CHECK_PROG([SHELLCHECK], [shellcheck], [yes])
+ AC_CHECK_PROG([CHECKBASHISMS], [checkbashisms], [yes])
+
+ AM_CONDITIONAL([HAVE_SHELLCHECK], [test "x$SHELLCHECK" = "xyes"])
+ AM_CONDITIONAL([HAVE_CHECKBASHISMS], [test "x$CHECKBASHISMS" = "xyes"])
+])
diff --git a/sys/contrib/openzfs/config/ax_python_devel.m4 b/sys/contrib/openzfs/config/ax_python_devel.m4
index c51b45b7d54d..faf6c2b0d7ef 100644
--- a/sys/contrib/openzfs/config/ax_python_devel.m4
+++ b/sys/contrib/openzfs/config/ax_python_devel.m4
@@ -148,8 +148,7 @@ variable to configure. See ``configure --help'' for reference.
# Check if you have distutils, else fail
#
AC_MSG_CHECKING([for the distutils Python package])
- ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
- if test $? -eq 0; then
+ if ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
diff --git a/sys/contrib/openzfs/config/kernel-percpu.m4 b/sys/contrib/openzfs/config/kernel-percpu.m4
index 700d97a25853..5125dd5c5bb8 100644
--- a/sys/contrib/openzfs/config/kernel-percpu.m4
+++ b/sys/contrib/openzfs/config/kernel-percpu.m4
@@ -26,6 +26,31 @@ AC_DEFUN([ZFS_AC_KERNEL_PERCPU_COUNTER_INIT], [
])
dnl #
+dnl # 4.13 API change,
+dnl # __percpu_counter_add() was renamed to percpu_counter_add_batch().
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_SRC_PERCPU_COUNTER_ADD_BATCH], [
+ ZFS_LINUX_TEST_SRC([percpu_counter_add_batch], [
+ #include <linux/percpu_counter.h>
+ ],[
+ struct percpu_counter counter;
+
+ percpu_counter_add_batch(&counter, 1, 1);
+ ])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_PERCPU_COUNTER_ADD_BATCH], [
+ AC_MSG_CHECKING([whether percpu_counter_add_batch() is defined])
+ ZFS_LINUX_TEST_RESULT([percpu_counter_add_batch], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_PERCPU_COUNTER_ADD_BATCH, 1,
+ [percpu_counter_add_batch() is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
+
+dnl #
dnl # 5.10 API change,
dnl # The "count" was moved into ref->data, from ref
dnl #
@@ -51,10 +76,12 @@ AC_DEFUN([ZFS_AC_KERNEL_PERCPU_REF_COUNT_IN_DATA], [
])
AC_DEFUN([ZFS_AC_KERNEL_SRC_PERCPU], [
ZFS_AC_KERNEL_SRC_PERCPU_COUNTER_INIT
+ ZFS_AC_KERNEL_SRC_PERCPU_COUNTER_ADD_BATCH
ZFS_AC_KERNEL_SRC_PERCPU_REF_COUNT_IN_DATA
])
AC_DEFUN([ZFS_AC_KERNEL_PERCPU], [
ZFS_AC_KERNEL_PERCPU_COUNTER_INIT
+ ZFS_AC_KERNEL_PERCPU_COUNTER_ADD_BATCH
ZFS_AC_KERNEL_PERCPU_REF_COUNT_IN_DATA
])
diff --git a/sys/contrib/openzfs/config/zfs-build.m4 b/sys/contrib/openzfs/config/zfs-build.m4
index cee5c87e770c..1af4356cde19 100644
--- a/sys/contrib/openzfs/config/zfs-build.m4
+++ b/sys/contrib/openzfs/config/zfs-build.m4
@@ -34,6 +34,9 @@ dnl # When debugging is enabled:
dnl # - Enable all ASSERTs (-DDEBUG)
dnl # - Promote all compiler warnings to errors (-Werror)
dnl #
+dnl # (If INVARIANTS is detected, we need to force DEBUG, or strange panics
+dnl # can ensue.)
+dnl #
AC_DEFUN([ZFS_AC_DEBUG], [
AC_MSG_CHECKING([whether assertion support will be enabled])
AC_ARG_ENABLE([debug],
@@ -49,6 +52,20 @@ AC_DEFUN([ZFS_AC_DEBUG], [
[ZFS_AC_DEBUG_DISABLE],
[AC_MSG_ERROR([Unknown option $enable_debug])])
+ AS_CASE(["x$enable_invariants"],
+ ["xyes"],
+ [],
+ ["xno"],
+ [],
+ [ZFS_AC_DEBUG_INVARIANTS_DETECT])
+
+ AS_CASE(["x$enable_invariants"],
+ ["xyes"],
+ [ZFS_AC_DEBUG_ENABLE],
+ ["xno"],
+ [],
+ [AC_MSG_ERROR([Unknown option $enable_invariants])])
+
AC_SUBST(DEBUG_CFLAGS)
AC_SUBST(DEBUG_CPPFLAGS)
AC_SUBST(DEBUG_LDFLAGS)
@@ -207,6 +224,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
ZFS_AC_CONFIG_ALWAYS_PYZFS
ZFS_AC_CONFIG_ALWAYS_SED
ZFS_AC_CONFIG_ALWAYS_CPPCHECK
+ ZFS_AC_CONFIG_ALWAYS_SHELLCHECK
])
AC_DEFUN([ZFS_AC_CONFIG], [
diff --git a/sys/contrib/openzfs/configure.ac b/sys/contrib/openzfs/configure.ac
index e31d12271394..27409c82f396 100644
--- a/sys/contrib/openzfs/configure.ac
+++ b/sys/contrib/openzfs/configure.ac
@@ -48,6 +48,7 @@ AC_CONFIG_HEADERS([zfs_config.h], [
LT_INIT
AC_PROG_INSTALL
AC_PROG_CC
+AC_PROG_LN_S
PKG_PROG_PKG_CONFIG
AM_PROG_AS
AM_PROG_CC_C_O
@@ -83,7 +84,6 @@ AC_CONFIG_FILES([
cmd/zinject/Makefile
cmd/zpool/Makefile
cmd/zstream/Makefile
- cmd/zstreamdump/Makefile
cmd/ztest/Makefile
cmd/zvol_id/Makefile
cmd/zvol_wait/Makefile
@@ -171,9 +171,6 @@ AC_CONFIG_FILES([
lib/libzstd/Makefile
lib/libzutil/Makefile
man/Makefile
- man/man1/Makefile
- man/man5/Makefile
- man/man8/Makefile
module/Kbuild
module/Makefile
module/avl/Makefile
diff --git a/sys/contrib/openzfs/contrib/Makefile.am b/sys/contrib/openzfs/contrib/Makefile.am
index 9547878d07d0..5ec13ece5327 100644
--- a/sys/contrib/openzfs/contrib/Makefile.am
+++ b/sys/contrib/openzfs/contrib/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/config/Shellcheck.am
+
SUBDIRS = bash_completion.d pyzfs zcp
if BUILD_LINUX
SUBDIRS += bpftrace dracut initramfs
@@ -6,3 +8,5 @@ if PAM_ZFS_ENABLED
SUBDIRS += pam_zfs_key
endif
DIST_SUBDIRS = bash_completion.d bpftrace dracut initramfs pam_zfs_key pyzfs zcp
+
+SHELLCHECKDIRS = bash_completion.d bpftrace dracut initramfs
diff --git a/sys/contrib/openzfs/contrib/bash_completion.d/Makefile.am b/sys/contrib/openzfs/contrib/bash_completion.d/Makefile.am
index 8fbe03688b48..8c8d1acebe15 100644
--- a/sys/contrib/openzfs/contrib/bash_completion.d/Makefile.am
+++ b/sys/contrib/openzfs/contrib/bash_completion.d/Makefile.am
@@ -1,4 +1,5 @@
include $(top_srcdir)/config/Substfiles.am
+include $(top_srcdir)/config/Shellcheck.am
bashcompletiondir = $(sysconfdir)/bash_completion.d
@@ -6,3 +7,7 @@ noinst_DATA = zfs
EXTRA_DIST += $(noinst_DATA)
SUBSTFILES += $(noinst_DATA)
+
+SHELLCHECKSCRIPTS = $(noinst_DATA)
+SHELLCHECK_SHELL = bash
+SHELLCHECK_IGNORE = ,SC2207
diff --git a/sys/contrib/openzfs/contrib/bash_completion.d/zfs.in b/sys/contrib/openzfs/contrib/bash_completion.d/zfs.in
index 8898fc735cd1..41ce2f871e34 100644
--- a/sys/contrib/openzfs/contrib/bash_completion.d/zfs.in
+++ b/sys/contrib/openzfs/contrib/bash_completion.d/zfs.in
@@ -62,24 +62,25 @@ __zfs_list_filesystems()
__zfs_match_snapshot()
{
- local base_dataset=${cur%@*}
- if [[ $base_dataset != $cur ]]
+ local base_dataset="${cur%@*}"
+ if [ "$base_dataset" != "$cur" ]
then
- $__ZFS_CMD list -H -o name -s name -t snapshot -d 1 $base_dataset
+ $__ZFS_CMD list -H -o name -s name -t snapshot -d 1 "$base_dataset"
else
- if [[ $cur != "" ]] && __zfs_list_datasets $cur &> /dev/null
+ if [ "$cur" != "" ] && __zfs_list_datasets "$cur" &> /dev/null
then
- $__ZFS_CMD list -H -o name -s name -t filesystem -r $cur | tail -n +2
+ $__ZFS_CMD list -H -o name -s name -t filesystem -r "$cur" | tail -n +2
# We output the base dataset name even though we might be
# completing a command that can only take a snapshot, because it
# prevents bash from considering the completion finished when it
# ends in the bare @.
- echo $cur
- echo $cur@
+ echo "$cur"
+ echo "$cur@"
else
- local datasets=$(__zfs_list_datasets)
+ local datasets
+ datasets="$(__zfs_list_datasets)"
# As above
- echo $datasets
+ echo "$datasets"
if [[ "$cur" == */ ]]
then
# If the current command ends with a slash, then the only way
@@ -89,54 +90,57 @@ __zfs_match_snapshot()
local num_children
# This is actually off by one as zfs list includes the named
# dataset in addition to its children
- num_children=$(__zfs_list_datasets -d 1 ${cur%/} 2> /dev/null | wc -l)
+ num_children=$(__zfs_list_datasets -d 1 "${cur%/}" 2> /dev/null | wc -l)
if [[ $num_children != 2 ]]
then
return 0
fi
fi
- echo "$datasets" | awk '{print $1"@"}'
+ echo "$datasets" | awk '{print $1 "@"}'
fi
fi
}
__zfs_match_snapshot_or_bookmark()
{
- local base_dataset=${cur%[#@]*}
- if [[ $base_dataset != $cur ]]
+ local base_dataset="${cur%[#@]*}"
+ if [ "$base_dataset" != "$cur" ]
then
if [[ $cur == *@* ]]
then
- $__ZFS_CMD list -H -o name -s name -t snapshot -d 1 $base_dataset
+ $__ZFS_CMD list -H -o name -s name -t snapshot -d 1 "$base_dataset"
else
- $__ZFS_CMD list -H -o name -s name -t bookmark -d 1 $base_dataset
+ $__ZFS_CMD list -H -o name -s name -t bookmark -d 1 "$base_dataset"
fi
else
$__ZFS_CMD list -H -o name -s name -t filesystem,volume
- if [[ $cur != "" ]] && $__ZFS_CMD list -H -o name -s name -t filesystem,volume $cur &> /dev/null
+ if [ -e "$cur" ] && $__ZFS_CMD list -H -o name -s name -t filesystem,volume "$cur" &> /dev/null
then
- echo $cur@
- echo $cur#
+ echo "$cur@"
+ echo "$cur#"
fi
fi
}
__zfs_match_multiple_snapshots()
{
- local existing_opts=$(expr "$cur" : '\(.*\)[%,]')
- if [[ $existing_opts ]]
+ local existing_opts
+ existing_opts="$(expr "$cur" : '\(.*\)[%,]')"
+ if [ -e "$existing_opts" ]
then
- local base_dataset=${cur%@*}
- if [[ $base_dataset != $cur ]]
+ local base_dataset="${cur%@*}"
+ if [ "$base_dataset" != "$cur" ]
then
- local cur=${cur##*,}
+ local cur="${cur##*,}"
if [[ $cur =~ ^%|%.*% ]]
then
# correct range syntax is start%end
return 1
fi
- local range_start=$(expr "$cur" : '\(.*%\)')
- $__ZFS_CMD list -H -o name -s name -t snapshot -d 1 $base_dataset | sed 's$.*@$'$range_start'$g'
+ local range_start
+ range_start="$(expr "$cur" : '\(.*%\)')"
+ # shellcheck disable=SC2016
+ $__ZFS_CMD list -H -o name -s name -t snapshot -d 1 "$base_dataset" | sed 's$.*@$'"$range_start"'$g'
fi
else
__zfs_match_snapshot_or_bookmark
@@ -160,7 +164,7 @@ __zfs_argument_chosen()
then
return 0
fi
- for property in $@
+ for property in "$@"
do
if [[ $prev == "$property"* ]]
then
@@ -178,6 +182,7 @@ __zfs_complete_ordered_arguments()
local list2=$2
local cur=$3
local extra=$4
+ # shellcheck disable=SC2086
if __zfs_argument_chosen $list1
then
COMPREPLY=($(compgen -W "$list2 $extra" -- "$cur"))
@@ -190,9 +195,10 @@ __zfs_complete_multiple_options()
{
local options=$1
local cur=$2
+ local existing_opts
COMPREPLY=($(compgen -W "$options" -- "${cur##*,}"))
- local existing_opts=$(expr "$cur" : '\(.*,\)')
+ existing_opts=$(expr "$cur" : '\(.*,\)')
if [[ $existing_opts ]]
then
COMPREPLY=( "${COMPREPLY[@]/#/${existing_opts}}" )
@@ -287,6 +293,7 @@ __zfs_complete()
*)
if ! __zfs_complete_switch "H,r,p,d,o,t,s"
then
+ # shellcheck disable=SC2046
if __zfs_argument_chosen $(__zfs_get_properties)
then
COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
@@ -300,7 +307,7 @@ __zfs_complete()
inherit)
if ! __zfs_complete_switch "r"
then
- __zfs_complete_ordered_arguments "$(__zfs_get_inheritable_properties)" "$(__zfs_match_snapshot)" $cur
+ __zfs_complete_ordered_arguments "$(__zfs_get_inheritable_properties)" "$(__zfs_match_snapshot)" "$cur"
fi
;;
list)
@@ -366,7 +373,7 @@ __zfs_complete()
esac
;;
set)
- __zfs_complete_ordered_arguments "$(__zfs_get_editable_properties)" "$(__zfs_match_snapshot)" $cur
+ __zfs_complete_ordered_arguments "$(__zfs_get_editable_properties)" "$(__zfs_match_snapshot)" "$cur"
__zfs_complete_nospace
;;
upgrade)
@@ -385,7 +392,7 @@ __zfs_complete()
destroy)
if ! __zfs_complete_switch "d,f,n,p,R,r,v"
then
- __zfs_complete_multiple_options "$(__zfs_match_multiple_snapshots)" $cur
+ __zfs_complete_multiple_options "$(__zfs_match_multiple_snapshots)" "$cur"
__zfs_complete_nospace
fi
;;
@@ -422,7 +429,7 @@ __zpool_list_pools()
__zpool_complete()
{
- local cur prev cmd cmds
+ local cur prev cmd cmds pools
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
@@ -437,7 +444,7 @@ __zpool_complete()
case "${cmd}" in
get)
- __zfs_complete_ordered_arguments "$(__zpool_get_properties)" "$(__zpool_list_pools)" $cur
+ __zfs_complete_ordered_arguments "$(__zpool_get_properties)" "$(__zpool_list_pools)" "$cur"
return 0
;;
import)
@@ -450,12 +457,13 @@ __zpool_complete()
return 0
;;
set)
- __zfs_complete_ordered_arguments "$(__zpool_get_editable_properties)" "$(__zpool_list_pools)" $cur
+ __zfs_complete_ordered_arguments "$(__zpool_get_editable_properties)" "$(__zpool_list_pools)" "$cur"
__zfs_complete_nospace
return 0
;;
add|attach|clear|create|detach|offline|online|remove|replace)
- local pools="$(__zpool_list_pools)"
+ pools="$(__zpool_list_pools)"
+ # shellcheck disable=SC2086
if __zfs_argument_chosen $pools
then
_filedir
diff --git a/sys/contrib/openzfs/contrib/bpftrace/Makefile.am b/sys/contrib/openzfs/contrib/bpftrace/Makefile.am
index 327bc64425d8..05e4f1c507ce 100644
--- a/sys/contrib/openzfs/contrib/bpftrace/Makefile.am
+++ b/sys/contrib/openzfs/contrib/bpftrace/Makefile.am
@@ -1,3 +1,7 @@
+include $(top_srcdir)/config/Shellcheck.am
+
EXTRA_DIST = \
taskqlatency.bt \
zfs-trace.sh
+
+SHELLCHECKSCRIPTS = zfs-trace.sh
diff --git a/sys/contrib/openzfs/contrib/dracut/02zfsexpandknowledge/Makefile.am b/sys/contrib/openzfs/contrib/dracut/02zfsexpandknowledge/Makefile.am
index d31d389a0e5e..b1bbb6bd3aac 100644
--- a/sys/contrib/openzfs/contrib/dracut/02zfsexpandknowledge/Makefile.am
+++ b/sys/contrib/openzfs/contrib/dracut/02zfsexpandknowledge/Makefile.am
@@ -1,4 +1,5 @@
include $(top_srcdir)/config/Substfiles.am
+include $(top_srcdir)/config/Shellcheck.am
pkgdracutdir = $(dracutdir)/modules.d/02zfsexpandknowledge
pkgdracut_SCRIPTS = \
diff --git a/sys/contrib/openzfs/contrib/dracut/02zfsexpandknowledge/module-setup.sh.in b/sys/contrib/openzfs/contrib/dracut/02zfsexpandknowledge/module-setup.sh.in
index f4b7b8cdcce3..d21ab74cc0d0 100755
--- a/sys/contrib/openzfs/contrib/dracut/02zfsexpandknowledge/module-setup.sh.in
+++ b/sys/contrib/openzfs/contrib/dracut/02zfsexpandknowledge/module-setup.sh.in
@@ -14,22 +14,16 @@ get_pool_devices() {
local poolconfigtemp
local poolconfigoutput
local pooldev
- local prefix
local resolved
- poolconfigtemp=`mktemp`
- @sbindir@/zpool list -v -H -P "$1" > "$poolconfigtemp" 2>&1
- if [ "$?" != "0" ] ; then
- poolconfigoutput=$(cat "$poolconfigtemp")
+ poolconfigtemp="$(mktemp)"
+ if ! @sbindir@/zpool list -v -H -P "$1" > "$poolconfigtemp" 2>&1 ; then
+ poolconfigoutput="$(cat "$poolconfigtemp")"
dinfo "zfsexpandknowledge: pool $1 cannot be listed: $poolconfigoutput"
else
- cat "$poolconfigtemp" | awk -F '\t' '/\t\/dev/ { print $2 }' | \
- while read pooldev ; do
- if [ -n "$pooldev" -a -e "$pooldev" ] ; then
- if [ -h "$pooldev" ] ; then
- resolved=`readlink -f "$pooldev"`
- else
- resolved="$pooldev"
- fi
+ awk -F '\t' '/\t\/dev/ { print $2 }' "$poolconfigtemp" | \
+ while read -r pooldev ; do
+ if [ -e "$pooldev" ] ; then
+ resolved="$(readlink -f "$pooldev")"
dinfo "zfsexpandknowledge: pool $1 has device $pooldev (which resolves to $resolved)"
echo "$resolved"
fi
@@ -40,22 +34,20 @@ get_pool_devices() {
find_zfs_block_devices() {
local dev
- local blockdev
local mp
local fstype
local pool
- local key
- local n
- local poolconfigoutput
- numfields=`head -1 /proc/self/mountinfo | awk '{print NF}'`
- if [ "$numfields" == "10" ] ; then
- fields="n n n n mp n n fstype dev n"
+ local _
+ numfields="$(awk '{print NF; exit}' /proc/self/mountinfo)"
+ if [ "$numfields" = "10" ] ; then
+ fields="_ _ _ _ mp _ _ fstype dev _"
else
- fields="n n n n mp n n n fstype dev n"
+ fields="_ _ _ _ mp _ _ _ fstype dev _"
fi
- while read $fields ; do
- if [ "$fstype" != "zfs" ]; then continue ; fi
- if [ "$mp" == "$1" ]; then
+ # shellcheck disable=SC2086
+ while read -r ${fields?} ; do
+ [ "$fstype" = "zfs" ] || continue
+ if [ "$mp" = "$1" ]; then
pool=$(echo "$dev" | cut -d / -f 1)
get_pool_devices "$pool"
fi
@@ -77,10 +69,9 @@ check() {
local _depdev
local _depdevname
local _depdevtype
- local _depmajmin
- local _dev
-if [[ $hostonly ]]; then
+# shellcheck disable=SC2154
+if [ -n "$hostonly" ]; then
for mp in \
"/" \
@@ -107,13 +98,12 @@ if [[ $hostonly ]]; then
fstype=$(get_devtype "$dev")
host_fs_types["$dev"]="$fstype"
majmin=$(get_maj_min "$dev")
- if [[ -d /sys/dev/block/$majmin/slaves ]] ; then
- for _depdev in /sys/dev/block/$majmin/slaves/*; do
+ if [ -d "/sys/dev/block/$majmin/slaves" ] ; then
+ for _depdev in "/sys/dev/block/$majmin/slaves"/*; do
[[ -f $_depdev/dev ]] || continue
_depdev=/dev/$(basename "$_depdev")
_depdevname=$(udevadm info --query=property --name="$_depdev" | grep "^DEVNAME=" | sed 's|^DEVNAME=||')
_depdevtype=$(get_devtype "$_depdevname")
- _depmajmin=$(get_maj_min "$_depdevname")
dinfo "zfsexpandknowledge: underlying block device backing ZFS dataset $mp: ${_depdevname//$'\n'/ }"
array_contains "$_depdevname" "${host_devs[@]}" || host_devs+=("$_depdevname")
host_fs_types["$_depdevname"]="$_depdevtype"
diff --git a/sys/contrib/openzfs/contrib/dracut/90zfs/.gitignore b/sys/contrib/openzfs/contrib/dracut/90zfs/.gitignore
index dce24393479b..cb84212f3a2a 100644
--- a/sys/contrib/openzfs/contrib/dracut/90zfs/.gitignore
+++ b/sys/contrib/openzfs/contrib/dracut/90zfs/.gitignore
@@ -1,11 +1,2 @@
-export-zfs.sh
-module-setup.sh
-mount-zfs.sh
-parse-zfs.sh
-zfs-generator.sh
-zfs-lib.sh
-zfs-load-key.sh
-zfs-needshutdown.sh
-zfs-env-bootfs.service
-zfs-snapshot-bootfs.service
-zfs-rollback-bootfs.service
+*.sh
+*.service
diff --git a/sys/contrib/openzfs/contrib/dracut/90zfs/Makefile.am b/sys/contrib/openzfs/contrib/dracut/90zfs/Makefile.am
index a4843827ede3..3f7050300994 100644
--- a/sys/contrib/openzfs/contrib/dracut/90zfs/Makefile.am
+++ b/sys/contrib/openzfs/contrib/dracut/90zfs/Makefile.am
@@ -1,4 +1,5 @@
include $(top_srcdir)/config/Substfiles.am
+include $(top_srcdir)/config/Shellcheck.am
pkgdracutdir = $(dracutdir)/modules.d/90zfs
pkgdracut_SCRIPTS = \
@@ -9,7 +10,8 @@ pkgdracut_SCRIPTS = \
zfs-generator.sh \
zfs-load-key.sh \
zfs-needshutdown.sh \
- zfs-lib.sh
+ zfs-lib.sh \
+ import-opts-generator.sh
pkgdracut_DATA = \
zfs-env-bootfs.service \
@@ -17,3 +19,6 @@ pkgdracut_DATA = \
zfs-rollback-bootfs.service
SUBSTFILES += $(pkgdracut_SCRIPTS) $(pkgdracut_DATA)
+
+# Provided by /bin/sleep, and, again, every implementation of that supports this
+CHECKBASHISMS_IGNORE = -e 'sleep only takes one integer' -e 'sleep 0.'
diff --git a/sys/contrib/openzfs/contrib/dracut/90zfs/import-opts-generator.sh.in b/sys/contrib/openzfs/contrib/dracut/90zfs/import-opts-generator.sh.in
new file mode 100755
index 000000000000..8bc8c9b35b73
--- /dev/null
+++ b/sys/contrib/openzfs/contrib/dracut/90zfs/import-opts-generator.sh.in
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+. /lib/dracut-zfs-lib.sh
+
+echo ZPOOL_IMPORT_OPTS="$ZPOOL_IMPORT_OPTS"
diff --git a/sys/contrib/openzfs/contrib/dracut/90zfs/module-setup.sh.in b/sys/contrib/openzfs/contrib/dracut/90zfs/module-setup.sh.in
index b6b86e2eafb4..213b48a25f5a 100755
--- a/sys/contrib/openzfs/contrib/dracut/90zfs/module-setup.sh.in
+++ b/sys/contrib/openzfs/contrib/dracut/90zfs/module-setup.sh.in
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
+# shellcheck disable=SC2154
check() {
# We depend on udev-rules being loaded
@@ -8,8 +9,6 @@ check() {
for tool in "@sbindir@/zgenhostid" "@sbindir@/zpool" "@sbindir@/zfs" "@mounthelperdir@/mount.zfs" ; do
test -x "$tool" || return 1
done
- # Verify grep exists
- which grep >/dev/null 2>&1 || return 1
return 0
}
@@ -43,19 +42,23 @@ install() {
dracut_install @sbindir@/zpool
# Workaround for https://github.com/openzfs/zfs/issues/4749 by
# ensuring libgcc_s.so(.1) is included
- if [[ -n "$(ldd @sbindir@/zpool | grep -F 'libgcc_s.so')" ]]; then
+ if ldd @sbindir@/zpool | grep -qF 'libgcc_s.so'; then
# Dracut will have already tracked and included it
:;
- elif command -v gcc-config 2>&1 1>/dev/null; then
+ elif command -v gcc-config >/dev/null 2>&1; then
# On systems with gcc-config (Gentoo, Funtoo, etc.):
# Use the current profile to resolve the appropriate path
- dracut_install "/usr/lib/gcc/$(s=$(gcc-config -c); echo ${s%-*}/${s##*-})/libgcc_s.so.1"
- elif [[ -n "$(ls /usr/lib/libgcc_s.so* 2>/dev/null)" ]]; then
+ s="$(gcc-config -c)"
+ dracut_install "/usr/lib/gcc/${s%-*}/${s##*-}/libgcc_s.so"*
+ elif [ "$(echo /usr/lib/libgcc_s.so*)" != "/usr/lib/libgcc_s.so*" ]; then
# Try a simple path first
dracut_install /usr/lib/libgcc_s.so*
+ elif [ "$(echo /lib*/libgcc_s.so*)" != "/lib*/libgcc_s.so*" ]; then
+ # SUSE
+ dracut_install /lib*/libgcc_s.so*
else
# Fallback: Guess the path and include all matches
- dracut_install /usr/lib/gcc/*/*/libgcc_s.so*
+ dracut_install /usr/lib*/gcc/**/libgcc_s.so*
fi
dracut_install @mounthelperdir@/mount.zfs
dracut_install @udevdir@/vdev_id
@@ -95,29 +98,40 @@ install() {
if dracut_module_included "systemd"; then
mkdir -p "${initdir}/$systemdsystemunitdir/zfs-import.target.wants"
- for _item in scan cache ; do
- dracut_install @systemdunitdir@/zfs-import-$_item.service
- if ! [ -L "${initdir}/$systemdsystemunitdir/zfs-import.target.wants"/zfs-import-$_item.service ]; then
- ln -s ../zfs-import-$_item.service "${initdir}/$systemdsystemunitdir/zfs-import.target.wants"/zfs-import-$_item.service
- type mark_hostonly >/dev/null 2>&1 && mark_hostonly @systemdunitdir@/zfs-import-$_item.service
+ for _service in "zfs-import-scan.service" "zfs-import-cache.service" ; do
+ dracut_install "@systemdunitdir@/$_service"
+ if ! [ -L "${initdir}/$systemdsystemunitdir/zfs-import.target.wants/$_service" ]; then
+ ln -sf ../$_service "${initdir}/$systemdsystemunitdir/zfs-import.target.wants/$_service"
+ type mark_hostonly >/dev/null 2>&1 && mark_hostonly "@systemdunitdir@/$_service"
fi
done
+
inst "${moddir}"/zfs-env-bootfs.service "${systemdsystemunitdir}"/zfs-env-bootfs.service
ln -s ../zfs-env-bootfs.service "${initdir}/${systemdsystemunitdir}/zfs-import.target.wants"/zfs-env-bootfs.service
type mark_hostonly >/dev/null 2>&1 && mark_hostonly @systemdunitdir@/zfs-env-bootfs.service
+
dracut_install systemd-ask-password
dracut_install systemd-tty-ask-password-agent
+
mkdir -p "${initdir}/$systemdsystemunitdir/initrd.target.wants"
dracut_install @systemdunitdir@/zfs-import.target
if ! [ -L "${initdir}/$systemdsystemunitdir/initrd.target.wants"/zfs-import.target ]; then
ln -s ../zfs-import.target "${initdir}/$systemdsystemunitdir/initrd.target.wants"/zfs-import.target
type mark_hostonly >/dev/null 2>&1 && mark_hostonly @systemdunitdir@/zfs-import.target
fi
+
for _service in zfs-snapshot-bootfs.service zfs-rollback-bootfs.service ; do
- inst "${moddir}"/$_service "${systemdsystemunitdir}"/$_service
- if ! [ -L "${initdir}/$systemdsystemunitdir/initrd.target.wants"/$_service ]; then
- ln -s ../$_service "${initdir}/$systemdsystemunitdir/initrd.target.wants"/$_service
+ inst "${moddir}/$_service" "${systemdsystemunitdir}/$_service"
+ if ! [ -L "${initdir}/$systemdsystemunitdir/initrd.target.wants/$_service" ]; then
+ ln -s "../$_service" "${initdir}/$systemdsystemunitdir/initrd.target.wants/$_service"
fi
done
+
+ # There isn't a pkg-config variable for this,
+ # and dracut doesn't automatically resolve anything this'd be next to
+ local systemdsystemenvironmentgeneratordir
+ systemdsystemenvironmentgeneratordir="$(pkg-config --variable=prefix systemd || echo "/usr")/lib/systemd/system-environment-generators"
+ mkdir -p "${initdir}/${systemdsystemenvironmentgeneratordir}"
+ inst "${moddir}"/import-opts-generator.sh "${systemdsystemenvironmentgeneratordir}"/zfs-import-opts.sh
fi
}
diff --git a/sys/contrib/openzfs/contrib/dracut/90zfs/mount-zfs.sh.in b/sys/contrib/openzfs/contrib/dracut/90zfs/mount-zfs.sh.in
index 4a892e9382cf..68e3f0e0d60b 100755
--- a/sys/contrib/openzfs/contrib/dracut/90zfs/mount-zfs.sh.in
+++ b/sys/contrib/openzfs/contrib/dracut/90zfs/mount-zfs.sh.in
@@ -1,4 +1,5 @@
#!/bin/sh
+# shellcheck disable=SC2034,SC2154
. /lib/dracut-zfs-lib.sh
@@ -38,11 +39,10 @@ modprobe zfs 2>/dev/null
udevadm settle
if [ "${root}" = "zfs:AUTO" ] ; then
- ZFS_DATASET="$(find_bootfs)"
- if [ $? -ne 0 ] ; then
+ if ! ZFS_DATASET="$(find_bootfs)" ; then
+ # shellcheck disable=SC2086
zpool import -N -a ${ZPOOL_IMPORT_OPTS}
- ZFS_DATASET="$(find_bootfs)"
- if [ $? -ne 0 ] ; then
+ if ! ZFS_DATASET="$(find_bootfs)" ; then
warn "ZFS: No bootfs attribute found in importable pools."
export_all -F
@@ -58,7 +58,7 @@ ZFS_POOL="${ZFS_DATASET%%/*}"
if import_pool "${ZFS_POOL}" ; then
# Load keys if we can or if we need to
- if [ "$(zpool list -H -o feature@encryption "$(echo "${ZFS_POOL}" | awk -F/ '{print $1}')")" = 'active' ]; then
+ if [ "$(zpool list -H -o feature@encryption "${ZFS_POOL}")" = 'active' ]; then
# if the root dataset has encryption enabled
ENCRYPTIONROOT="$(zfs get -H -o value encryptionroot "${ZFS_DATASET}")"
if ! [ "${ENCRYPTIONROOT}" = "-" ]; then
diff --git a/sys/contrib/openzfs/contrib/dracut/90zfs/parse-zfs.sh.in b/sys/contrib/openzfs/contrib/dracut/90zfs/parse-zfs.sh.in
index 768de9dd2512..fe786a880699 100755
--- a/sys/contrib/openzfs/contrib/dracut/90zfs/parse-zfs.sh.in
+++ b/sys/contrib/openzfs/contrib/dracut/90zfs/parse-zfs.sh.in
@@ -1,4 +1,5 @@
#!/bin/sh
+# shellcheck disable=SC2034,SC2154
. /lib/dracut-lib.sh
@@ -28,7 +29,7 @@ case "${root}" in
info "ZFS: Enabling autodetection of bootfs after udev settles."
;;
- ZFS\=*|zfs:*|zfs:FILESYSTEM\=*|FILESYSTEM\=*)
+ ZFS=*|zfs:*|FILESYSTEM=*)
# root is explicit ZFS root. Parse it now. We can handle
# a root=... param in any of the following formats:
# root=ZFS=rpool/ROOT
diff --git a/sys/contrib/openzfs/contrib/dracut/90zfs/zfs-generator.sh.in b/sys/contrib/openzfs/contrib/dracut/90zfs/zfs-generator.sh.in
index e3fbf334f7d0..b57c64c688b1 100755
--- a/sys/contrib/openzfs/contrib/dracut/90zfs/zfs-generator.sh.in
+++ b/sys/contrib/openzfs/contrib/dracut/90zfs/zfs-generator.sh.in
@@ -1,4 +1,5 @@
#!/bin/sh
+# shellcheck disable=SC2016,SC1004
grep -wq debug /proc/cmdline && debug=1
[ -n "$debug" ] && echo "zfs-generator: starting" >> /dev/kmsg
diff --git a/sys/contrib/openzfs/contrib/dracut/90zfs/zfs-lib.sh.in b/sys/contrib/openzfs/contrib/dracut/90zfs/zfs-lib.sh.in
index f3cdd1503d34..10b0b701a233 100755
--- a/sys/contrib/openzfs/contrib/dracut/90zfs/zfs-lib.sh.in
+++ b/sys/contrib/openzfs/contrib/dracut/90zfs/zfs-lib.sh.in
@@ -5,12 +5,8 @@ command -v getargbool >/dev/null || {
# Compatibility with older Dracut versions.
# With apologies to the Dracut developers.
getargbool() {
- if ! [ -z "$_b" ]; then
- unset _b
- fi
_default="$1"; shift
- _b=$(getarg "$@")
- [ $? -ne 0 ] && [ -z "$_b" ] && _b="$_default"
+ ! _b=$(getarg "$@") && [ -z "$_b" ] && _b="$_default"
if [ -n "$_b" ]; then
[ "$_b" = "0" ] && return 1
[ "$_b" = "no" ] && return 1
@@ -63,6 +59,7 @@ import_pool() {
if ! zpool list -H "${pool}" > /dev/null 2>&1; then
info "ZFS: Importing pool ${pool}..."
+ # shellcheck disable=SC2086
if ! zpool import -N ${ZPOOL_IMPORT_OPTS} "${pool}" ; then
warn "ZFS: Unable to import pool ${pool}"
return 1
@@ -127,13 +124,12 @@ for_relevant_root_children() {
# export_all OPTS
# exports all imported zfs pools.
export_all() {
- opts="${@}"
ret=0
IFS="${NEWLINE}"
for pool in $(zpool list -H -o name) ; do
if zpool list -H "${pool}" > /dev/null 2>&1; then
- zpool export "${pool}" ${opts} || ret=$?
+ zpool export "${pool}" "$@" || ret=$?
fi
done
IFS="${OLDIFS}"
diff --git a/sys/contrib/openzfs/contrib/dracut/90zfs/zfs-load-key.sh.in b/sys/contrib/openzfs/contrib/dracut/90zfs/zfs-load-key.sh.in
index 9b7716ae9e25..5eb28fee3fe3 100755
--- a/sys/contrib/openzfs/contrib/dracut/90zfs/zfs-load-key.sh.in
+++ b/sys/contrib/openzfs/contrib/dracut/90zfs/zfs-load-key.sh.in
@@ -1,4 +1,5 @@
#!/bin/sh
+# shellcheck disable=SC2154
# only run this on systemd systems, we handle the decrypt in mount-zfs.sh in the mount hook otherwise
[ -e /bin/systemctl ] || [ -e /usr/bin/systemctl ] || return 0
@@ -32,16 +33,15 @@ else
fi
# if pool encryption is active and the zfs command understands '-o encryption'
-if [ "$(zpool list -H -o feature@encryption "$(echo "${BOOTFS}" | awk -F/ '{print $1}')")" = 'active' ]; then
+if [ "$(zpool list -H -o feature@encryption "${BOOTFS%%/*}")" = 'active' ]; then
# if the root dataset has encryption enabled
ENCRYPTIONROOT="$(zfs get -H -o value encryptionroot "${BOOTFS}")"
- # where the key is stored (in a file or loaded via prompt)
- KEYLOCATION="$(zfs get -H -o value keylocation "${ENCRYPTIONROOT}")"
if ! [ "${ENCRYPTIONROOT}" = "-" ]; then
KEYSTATUS="$(zfs get -H -o value keystatus "${ENCRYPTIONROOT}")"
# continue only if the key needs to be loaded
[ "$KEYSTATUS" = "unavailable" ] || exit 0
- # if key is stored in a file, do not prompt
+
+ KEYLOCATION="$(zfs get -H -o value keylocation "${ENCRYPTIONROOT}")"
if ! [ "${KEYLOCATION}" = "prompt" ]; then
zfs load-key "${ENCRYPTIONROOT}"
else
diff --git a/sys/contrib/openzfs/contrib/dracut/Makefile.am b/sys/contrib/openzfs/contrib/dracut/Makefile.am
index 1065e5e94f0e..8c9a6be0899a 100644
--- a/sys/contrib/openzfs/contrib/dracut/Makefile.am
+++ b/sys/contrib/openzfs/contrib/dracut/Makefile.am
@@ -1,3 +1,6 @@
+include $(top_srcdir)/config/Shellcheck.am
+
SUBDIRS = 02zfsexpandknowledge 90zfs
+SHELLCHECKDIRS = $(SUBDIRS)
EXTRA_DIST = README.dracut.markdown
diff --git a/sys/contrib/openzfs/contrib/initramfs/Makefile.am b/sys/contrib/openzfs/contrib/initramfs/Makefile.am
index 5eac6e2155db..931ceb1316a5 100644
--- a/sys/contrib/openzfs/contrib/initramfs/Makefile.am
+++ b/sys/contrib/openzfs/contrib/initramfs/Makefile.am
@@ -1,9 +1,12 @@
+include $(top_srcdir)/config/Shellcheck.am
+
initrddir = /usr/share/initramfs-tools
dist_initrd_SCRIPTS = \
zfsunlock
SUBDIRS = conf.d conf-hooks.d hooks scripts
+SHELLCHECKDIRS = hooks scripts
EXTRA_DIST = \
README.initramfs.markdown
diff --git a/sys/contrib/openzfs/contrib/initramfs/hooks/Makefile.am b/sys/contrib/openzfs/contrib/initramfs/hooks/Makefile.am
index f303e995b9c7..0cd1aafcd359 100644
--- a/sys/contrib/openzfs/contrib/initramfs/hooks/Makefile.am
+++ b/sys/contrib/openzfs/contrib/initramfs/hooks/Makefile.am
@@ -1,4 +1,5 @@
include $(top_srcdir)/config/Substfiles.am
+include $(top_srcdir)/config/Shellcheck.am
hooksdir = /usr/share/initramfs-tools/hooks
diff --git a/sys/contrib/openzfs/contrib/initramfs/hooks/zfs.in b/sys/contrib/openzfs/contrib/initramfs/hooks/zfs.in
index 0a9cc87720ad..32331b264da8 100755
--- a/sys/contrib/openzfs/contrib/initramfs/hooks/zfs.in
+++ b/sys/contrib/openzfs/contrib/initramfs/hooks/zfs.in
@@ -3,107 +3,48 @@
# Add OpenZFS filesystem capabilities to an initrd, usually for a native ZFS root.
#
-# This hook installs udev rules for OpenZFS.
-PREREQ="udev"
-
-# These prerequisites are provided by the zfsutils package. The zdb utility is
-# not strictly required, but it can be useful at the initramfs recovery prompt.
-COPY_EXEC_LIST="@sbindir@/zdb @sbindir@/zpool @sbindir@/zfs"
-COPY_EXEC_LIST="$COPY_EXEC_LIST @mounthelperdir@/mount.zfs @udevdir@/vdev_id"
-COPY_EXEC_LIST="$COPY_EXEC_LIST @udevdir@/zvol_id"
-COPY_FILE_LIST="/etc/hostid @sysconfdir@/zfs/zpool.cache"
-COPY_FILE_LIST="$COPY_FILE_LIST @initconfdir@/zfs"
-COPY_FILE_LIST="$COPY_FILE_LIST @sysconfdir@/zfs/zfs-functions"
-COPY_FILE_LIST="$COPY_FILE_LIST @sysconfdir@/zfs/vdev_id.conf"
-COPY_FILE_LIST="$COPY_FILE_LIST @udevruledir@/60-zvol.rules"
-COPY_FILE_LIST="$COPY_FILE_LIST @udevruledir@/69-vdev.rules"
-
-# These prerequisites are provided by the base system.
-COPY_EXEC_LIST="$COPY_EXEC_LIST /usr/bin/dirname /bin/hostname /sbin/blkid"
-COPY_EXEC_LIST="$COPY_EXEC_LIST /usr/bin/env"
-COPY_EXEC_LIST="$COPY_EXEC_LIST $(which systemd-ask-password)"
-
-# Explicitly specify all kernel modules because automatic dependency resolution
-# is unreliable on many systems.
-BASE_MODULES="zlib_deflate spl zavl zcommon znvpair zunicode zlua zfs icp"
-CRPT_MODULES="sun-ccm sun-gcm sun-ctr"
-MANUAL_ADD_MODULES_LIST="$BASE_MODULES"
-
-# Generic result code.
-RC=0
-
-case $1 in
-prereqs)
- echo "$PREREQ"
- exit 0
- ;;
-esac
-
-for ii in $COPY_EXEC_LIST
-do
- if [ ! -x "$ii" ]
- then
- echo "Error: $ii is not executable."
- RC=2
- fi
-done
-
-if [ "$RC" -ne 0 ]
-then
- exit "$RC"
+if [ "$1" = "prereqs" ]; then
+ echo "udev"
+ exit
fi
. /usr/share/initramfs-tools/hook-functions
-mkdir -p "$DESTDIR/etc/"
-
-# ZDB uses pthreads for some functions, but the library dependency is not
-# automatically detected. The `find` utility and extended `cp` options are
-# used here because libgcc_s.so could be in a subdirectory of /lib for
-# multi-arch installations.
-cp --target-directory="$DESTDIR" --parents $(find /lib/ -type f -name libgcc_s.so.1)
-
-for ii in $COPY_EXEC_LIST
-do
- copy_exec "$ii"
+for req in "@sbindir@/zpool" "@sbindir@/zfs" "@mounthelperdir@/mount.zfs"; do
+ copy_exec "$req" || {
+ echo "$req not available!" >&2
+ exit 2
+ }
done
-for ii in $COPY_FILE_LIST
-do
- dir=$(dirname "$ii")
- [ -d "$dir" ] && mkdir -p "$DESTDIR/$dir"
- [ -f "$ii" ] && cp -p "$ii" "$DESTDIR/$ii"
-done
+copy_exec "@sbindir@/zdb"
+copy_exec "@udevdir@/vdev_id"
+copy_exec "@udevdir@/zvol_id"
+if command -v systemd-ask-password > /dev/null; then
+ copy_exec "$(command -v systemd-ask-password)"
+fi
-for ii in $MANUAL_ADD_MODULES_LIST
-do
- manual_add_modules "$ii"
+# We use pthreads, but i-t from buster doesn't automatically
+# copy this indirect dependency: this can be removed when buster finally dies.
+find /lib/ -type f -name "libgcc_s.so.[1-9]" | while read -r libgcc; do
+ copy_exec "$libgcc"
done
-if [ -f "/etc/hostname" ]
-then
- cp -p "/etc/hostname" "$DESTDIR/etc/"
-else
- hostname >"$DESTDIR/etc/hostname"
-fi
+copy_file config "/etc/hostid"
+copy_file cache "@sysconfdir@/zfs/zpool.cache"
+copy_file config "@initconfdir@/zfs"
+copy_file config "@sysconfdir@/zfs/zfs-functions"
+copy_file config "@sysconfdir@/zfs/vdev_id.conf"
+copy_file rule "@udevruledir@/60-zvol.rules"
+copy_file rule "@udevruledir@/69-vdev.rules"
-for ii in zfs zfs.conf spl spl.conf
-do
- if [ -f "/etc/modprobe.d/$ii" ]; then
- if [ ! -d "$DESTDIR/etc/modprobe.d" ]; then
- mkdir -p $DESTDIR/etc/modprobe.d
- fi
- cp -p "/etc/modprobe.d/$ii" $DESTDIR/etc/modprobe.d/
- fi
-done
+manual_add_modules zfs
-# With pull request #1476 (not yet merged) comes a verbose warning
-# if /usr/bin/net doesn't exist or isn't executable. Just create
-# a dummy...
-[ ! -d "$DESTDIR/usr/bin" ] && mkdir -p "$DESTDIR/usr/bin"
-if [ ! -x "$DESTDIR/usr/bin/net" ]; then
- touch "$DESTDIR/usr/bin/net"
- chmod +x "$DESTDIR/usr/bin/net"
+if [ -f "/etc/hostname" ]; then
+ copy_file config "/etc/hostname"
+else
+ hostname="$(mktemp -t hostname.XXXXXXXXXX)"
+ hostname > "$hostname"
+ copy_file config "$hostname" "/etc/hostname"
+ rm -f "$hostname"
fi
-
-exit 0
diff --git a/sys/contrib/openzfs/contrib/initramfs/hooks/zfsunlock.in b/sys/contrib/openzfs/contrib/initramfs/hooks/zfsunlock.in
index d451726545db..4776087d9a76 100644
--- a/sys/contrib/openzfs/contrib/initramfs/hooks/zfsunlock.in
+++ b/sys/contrib/openzfs/contrib/initramfs/hooks/zfsunlock.in
@@ -1,17 +1,9 @@
#!/bin/sh
-PREREQ="dropbear"
-
-prereqs() {
- echo "$PREREQ"
-}
-
-case "$1" in
- prereqs)
- prereqs
- exit 0
- ;;
-esac
+if [ "$1" = "prereqs" ]; then
+ echo "dropbear"
+ exit
+fi
. /usr/share/initramfs-tools/hook-functions
diff --git a/sys/contrib/openzfs/contrib/initramfs/scripts/Makefile.am b/sys/contrib/openzfs/contrib/initramfs/scripts/Makefile.am
index 2a142096e449..444a5f374bfe 100644
--- a/sys/contrib/openzfs/contrib/initramfs/scripts/Makefile.am
+++ b/sys/contrib/openzfs/contrib/initramfs/scripts/Makefile.am
@@ -1,6 +1,11 @@
+include $(top_srcdir)/config/Shellcheck.am
+
scriptsdir = /usr/share/initramfs-tools/scripts
-dist_scripts_DATA = \
+dist_scripts_SCRIPTS = \
zfs
SUBDIRS = local-top
+
+SHELLCHECKDIRS = $(SUBDIRS)
+SHELLCHECK_SHELL = sh
diff --git a/sys/contrib/openzfs/contrib/initramfs/scripts/local-top/Makefile.am b/sys/contrib/openzfs/contrib/initramfs/scripts/local-top/Makefile.am
index 1523a907c860..897f9b2e2124 100644
--- a/sys/contrib/openzfs/contrib/initramfs/scripts/local-top/Makefile.am
+++ b/sys/contrib/openzfs/contrib/initramfs/scripts/local-top/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/config/Shellcheck.am
+
localtopdir = /usr/share/initramfs-tools/scripts/local-top
dist_localtop_SCRIPTS = \
diff --git a/sys/contrib/openzfs/contrib/initramfs/scripts/local-top/zfs b/sys/contrib/openzfs/contrib/initramfs/scripts/local-top/zfs
index e8e5cd26451c..6b80e9f43607 100755
--- a/sys/contrib/openzfs/contrib/initramfs/scripts/local-top/zfs
+++ b/sys/contrib/openzfs/contrib/initramfs/scripts/local-top/zfs
@@ -1,18 +1,11 @@
#!/bin/sh
-PREREQ="mdadm mdrun multipath"
+# shellcheck disable=SC2154
-prereqs()
-{
- echo "$PREREQ"
-}
-case $1 in
-# get pre-requisites
-prereqs)
- prereqs
+if [ "$1" = "prereqs" ]; then
+ echo mdadm mdrun multipath
exit 0
- ;;
-esac
+fi
#
@@ -20,10 +13,10 @@ esac
#
message()
{
- if [ -x /bin/plymouth ] && plymouth --ping; then
- plymouth message --text="$@"
+ if plymouth --ping 2>/dev/null; then
+ plymouth message --text="$*"
else
- echo "$@" >&2
+ echo "$*" >&2
fi
return 0
}
diff --git a/sys/contrib/openzfs/contrib/initramfs/scripts/zfs b/sys/contrib/openzfs/contrib/initramfs/scripts/zfs
index b7e9e57035f3..82eceaedb56e 100644
--- a/sys/contrib/openzfs/contrib/initramfs/scripts/zfs
+++ b/sys/contrib/openzfs/contrib/initramfs/scripts/zfs
@@ -5,6 +5,8 @@
#
# Enable this by passing boot=zfs on the kernel command line.
#
+# $quiet, $root, $rpool, $bootfs come from the cmdline:
+# shellcheck disable=SC2154
# Source the common functions
. /etc/zfs/zfs-functions
@@ -102,14 +104,10 @@ find_rootfs()
# Support function to get a list of all pools, separated with ';'
find_pools()
{
- CMD="$*"
-
- pools=$($CMD 2> /dev/null | \
+ pools=$("$@" 2> /dev/null | \
grep -E "pool:|^[a-zA-Z0-9]" | \
sed 's@.*: @@' | \
- while read -r pool; do \
- printf "%s" "$pool;"
- done)
+ tr '\n' ';')
echo "${pools%%;}" # Return without the last ';'.
}
@@ -203,7 +201,7 @@ import_pool()
# exists).
if [ -n "$USE_DISK_BY_ID" ] && [ -z "$ZPOOL_IMPORT_PATH" ]
then
- dirs="$(for dir in $(echo /dev/disk/by-*)
+ dirs="$(for dir in /dev/disk/by-*
do
# Ignore by-vdev here - we want it first!
echo "$dir" | grep -q /by-vdev && continue
@@ -273,6 +271,8 @@ import_pool()
# with more logging etc.
load_module_initrd()
{
+ [ -n "$ROOTDELAY" ] && ZFS_INITRD_PRE_MOUNTROOT_SLEEP="$ROOTDELAY"
+
if [ "$ZFS_INITRD_PRE_MOUNTROOT_SLEEP" -gt 0 ] 2>/dev/null
then
if [ "$quiet" != "y" ]; then
@@ -327,6 +327,7 @@ mount_fs()
# Need the _original_ datasets mountpoint!
mountpoint=$(get_fs_value "$fs" mountpoint)
+ ZFS_CMD="mount -o zfsutil -t zfs"
if [ "$mountpoint" = "legacy" ] || [ "$mountpoint" = "none" ]; then
# Can't use the mountpoint property. Might be one of our
# clones. Check the 'org.zol:mountpoint' property set in
@@ -346,15 +347,11 @@ mount_fs()
fi
fi
+ # If it's not a legacy filesystem, it can only be a
+ # native one...
if [ "$mountpoint" = "legacy" ]; then
ZFS_CMD="mount -t zfs"
- else
- # If it's not a legacy filesystem, it can only be a
- # native one...
- ZFS_CMD="mount -o zfsutil -t zfs"
fi
- else
- ZFS_CMD="mount -o zfsutil -t zfs"
fi
# Possibly decrypt a filesystem using native encryption.
@@ -393,7 +390,7 @@ decrypt_fs()
fs="$1"
# If pool encryption is active and the zfs command understands '-o encryption'
- if [ "$(zpool list -H -o feature@encryption "$(echo "${fs}" | awk -F/ '{print $1}')")" = 'active' ]; then
+ if [ "$(zpool list -H -o feature@encryption "${fs%%/*}")" = 'active' ]; then
# Determine dataset that holds key for root dataset
ENCRYPTIONROOT="$(get_fs_value "${fs}" encryptionroot)"
@@ -554,7 +551,6 @@ rollback_snap()
ask_user_snap()
{
fs="$1"
- i=1
# We need to temporarily disable debugging. Set 'debug' so we
# remember to enabled it again.
@@ -567,16 +563,25 @@ ask_user_snap()
# Because we need the resulting snapshot, which is sent on
# stdout to the caller, we use stderr for our questions.
echo "What snapshot do you want to boot from?" > /dev/stderr
- while read -r snap; do
- echo " $i: ${snap}" > /dev/stderr
- eval "$(echo SNAP_$i=$snap)"
- i=$((i + 1))
- done <<EOT
-$("${ZFS}" list -H -oname -tsnapshot -r "${fs}")
-EOT
+ # shellcheck disable=SC2046
+ IFS="
+" set -- $("${ZFS}" list -H -oname -tsnapshot -r "${fs}")
- echo "%s" " Snap nr [1-$((i-1))]? " > /dev/stderr
- read -r snapnr
+ i=1
+ for snap in "$@"; do
+ echo " $i: $snap"
+ i=$((i + 1))
+ done > /dev/stderr
+
+ # expr instead of test here because [ a -lt 0 ] errors out,
+ # but expr falls back to lexicographical, which works out right
+ snapnr=0
+ while expr "$snapnr" "<" 1 > /dev/null ||
+ expr "$snapnr" ">" "$#" > /dev/null
+ do
+ printf "%s" "Snap nr [1-$#]? " > /dev/stderr
+ read -r snapnr
+ done
# Re-enable debugging.
if [ -n "${debug}" ]; then
@@ -584,7 +589,7 @@ EOT
set -x
fi
- echo "$(eval echo '$SNAP_'$snapnr)"
+ eval echo '$'"$snapnr"
}
setup_snapshot_booting()
@@ -704,7 +709,8 @@ mountroot()
# ------------
# Look for the cache file (if any).
- [ ! -f ${ZPOOL_CACHE} ] && unset ZPOOL_CACHE
+ [ -f "${ZPOOL_CACHE}" ] || unset ZPOOL_CACHE
+ [ -s "${ZPOOL_CACHE}" ] || unset ZPOOL_CACHE
# ------------
# Compatibility: 'ROOT' is for Debian GNU/Linux (etc),
@@ -794,7 +800,8 @@ mountroot()
#
# Reassign the variable by dumping the environment and
# stripping the zfs-bootfs= prefix. Let the shell handle
- # quoting through the eval command.
+ # quoting through the eval command:
+ # shellcheck disable=SC2046
eval ZFS_RPOOL=$(set | sed -n -e 's,^zfs-bootfs=,,p')
fi
@@ -876,7 +883,7 @@ mountroot()
echo ""
echo "No pool imported. Manually import the root pool"
echo "at the command prompt and then exit."
- echo "Hint: Try: zpool import -R ${rootmnt} -N ${ZFS_RPOOL}"
+ echo "Hint: Try: zpool import -N ${ZFS_RPOOL}"
shell
fi
@@ -948,7 +955,7 @@ mountroot()
touch /run/zfs_unlock_complete
if [ -e /run/zfs_unlock_complete_notify ]; then
- read -r zfs_unlock_complete_notify < /run/zfs_unlock_complete_notify
+ read -r < /run/zfs_unlock_complete_notify
fi
# ------------
diff --git a/sys/contrib/openzfs/etc/Makefile.am b/sys/contrib/openzfs/etc/Makefile.am
index ac71da9445d8..aa9ff182c863 100644
--- a/sys/contrib/openzfs/etc/Makefile.am
+++ b/sys/contrib/openzfs/etc/Makefile.am
@@ -1,5 +1,9 @@
+include $(top_srcdir)/config/Shellcheck.am
+
SUBDIRS = zfs sudoers.d
+SHELLCHECKDIRS = zfs
if BUILD_LINUX
+SHELLCHECKDIRS += default $(ZFS_INIT_SYSV)
SUBDIRS += default $(ZFS_INIT_SYSTEMD) $(ZFS_INIT_SYSV) $(ZFS_MODULE_LOAD)
endif
DIST_SUBDIRS = default init.d zfs systemd modules-load.d sudoers.d
diff --git a/sys/contrib/openzfs/etc/default/Makefile.am b/sys/contrib/openzfs/etc/default/Makefile.am
index 0ec868e13484..b88eb549493b 100644
--- a/sys/contrib/openzfs/etc/default/Makefile.am
+++ b/sys/contrib/openzfs/etc/default/Makefile.am
@@ -1,5 +1,9 @@
include $(top_srcdir)/config/Substfiles.am
+include $(top_srcdir)/config/Shellcheck.am
initconf_SCRIPTS = zfs
SUBSTFILES += $(initconf_SCRIPTS)
+
+SHELLCHECK_SHELL = sh
+SHELLCHECK_IGNORE = ,SC2034
diff --git a/sys/contrib/openzfs/etc/init.d/Makefile.am b/sys/contrib/openzfs/etc/init.d/Makefile.am
index 9285a995a1cf..f93af1fd77e0 100644
--- a/sys/contrib/openzfs/etc/init.d/Makefile.am
+++ b/sys/contrib/openzfs/etc/init.d/Makefile.am
@@ -1,7 +1,10 @@
include $(top_srcdir)/config/Substfiles.am
+include $(top_srcdir)/config/Shellcheck.am
EXTRA_DIST += README.md
init_SCRIPTS = zfs-import zfs-mount zfs-share zfs-zed
SUBSTFILES += $(init_SCRIPTS)
+
+SHELLCHECK_SHELL = dash # local variables
diff --git a/sys/contrib/openzfs/etc/init.d/zfs-import.in b/sys/contrib/openzfs/etc/init.d/zfs-import.in
index 714cc6c089d7..e4bc7b8339fc 100755
--- a/sys/contrib/openzfs/etc/init.d/zfs-import.in
+++ b/sys/contrib/openzfs/etc/init.d/zfs-import.in
@@ -26,10 +26,8 @@
#
# Released under the 2-clause BSD license.
#
-# The original script that acted as a template for this script came from
-# the Debian GNU/Linux kFreeBSD ZFS packages (which did not include a
-# licensing stansa) in the commit dated Mar 24, 2011:
-# https://github.com/zfsonlinux/pkg-zfs/commit/80a3ae582b59c0250d7912ba794dca9e669e605a
+# This script is based on debian/zfsutils.zfs.init from the
+# Debian GNU/kFreeBSD zfsutils 8.1-3 package, written by Aurelien Jarno.
# Source the common init script
. @sysconfdir@/zfs/zfs-functions
@@ -56,16 +54,13 @@ do_verbatim_import()
# Support function to get a list of all pools, separated with ';'
find_pools()
{
- local CMD="$*"
local pools
- pools=$($CMD 2> /dev/null | \
+ pools=$("$@" 2> /dev/null | \
grep -E "pool:|^[a-zA-Z0-9]" | \
sed 's@.*: @@' | \
sort | \
- while read pool; do \
- echo -n "$pool;"
- done)
+ tr '\n' ';')
echo "${pools%%;}" # Return without the last ';'.
}
@@ -77,10 +72,11 @@ do_import_all_visible()
local exception dir ZPOOL_IMPORT_PATH RET=0 r=1
# In case not shutdown cleanly.
+ # shellcheck disable=SC2154
[ -n "$init" ] && rm -f /etc/dfs/sharetab
# Just simplify code later on.
- if [ -n "$USE_DISK_BY_ID" -a "$USE_DISK_BY_ID" != 'yes' ]
+ if [ -n "$USE_DISK_BY_ID" ] && [ "$USE_DISK_BY_ID" != 'yes' ]
then
# It's something, but not 'yes' so it's no good to us.
unset USE_DISK_BY_ID
@@ -153,7 +149,7 @@ do_import_all_visible()
# to something we can use later with the real import(s). We want to
# make sure we find all by* dirs, BUT by-vdev should be first (if it
# exists).
- if [ -n "$USE_DISK_BY_ID" -a -z "$ZPOOL_IMPORT_PATH" ]
+ if [ -n "$USE_DISK_BY_ID" ] && [ -z "$ZPOOL_IMPORT_PATH" ]
then
local dirs
dirs="$(for dir in $(echo /dev/disk/by-*)
@@ -162,7 +158,7 @@ do_import_all_visible()
echo "$dir" | grep -q /by-vdev && continue
[ ! -d "$dir" ] && continue
- echo -n "$dir:"
+ printf "%s" "$dir:"
done | sed 's,:$,,g')"
if [ -d "/dev/disk/by-vdev" ]
@@ -219,6 +215,7 @@ do_import_all_visible()
# Import by using ZPOOL_IMPORT_PATH (either set above or in
# the config file) _or_ with the 'built in' default search
# paths. This is the preferred way.
+ # shellcheck disable=SC2086
"$ZPOOL" import -N ${ZPOOL_IMPORT_OPTS} "$pool" 2> /dev/null
r="$?" ; RET=$((RET + r))
if [ "$r" -eq 0 ]
@@ -231,7 +228,7 @@ do_import_all_visible()
# using the cache file soon and that might succeed.
[ ! -f "$ZPOOL_CACHE" ] && zfs_log_end_msg "$RET"
- if [ "$r" -gt 0 -a -f "$ZPOOL_CACHE" ]
+ if [ "$r" -gt 0 ] && [ -f "$ZPOOL_CACHE" ]
then
# Failed to import without a cache file. Try WITH...
if [ -z "$init" ] && check_boolean "$VERBOSE_MOUNT"
@@ -240,6 +237,7 @@ do_import_all_visible()
zfs_log_progress_msg " using cache file"
fi
+ # shellcheck disable=SC2086
"$ZPOOL" import -c "$ZPOOL_CACHE" -N ${ZPOOL_IMPORT_OPTS} \
"$pool" 2> /dev/null
r="$?" ; RET=$((RET + r))
@@ -254,7 +252,7 @@ do_import_all_visible()
[ -n "$init" ] && zfs_log_end_msg "$RET"
IFS="$OLD_IFS"
- [ -n "$already_imported" -a -z "$available_pools" ] && return 0
+ [ -n "$already_imported" ] && [ -z "$available_pools" ] && return 0
return "$RET"
}
diff --git a/sys/contrib/openzfs/etc/init.d/zfs-mount.in b/sys/contrib/openzfs/etc/init.d/zfs-mount.in
index 9b400916f42e..000619b6717c 100755
--- a/sys/contrib/openzfs/etc/init.d/zfs-mount.in
+++ b/sys/contrib/openzfs/etc/init.d/zfs-mount.in
@@ -23,10 +23,8 @@
#
# Released under the 2-clause BSD license.
#
-# The original script that acted as a template for this script came from
-# the Debian GNU/Linux kFreeBSD ZFS packages (which did not include a
-# licensing stansa) in the commit dated Mar 24, 2011:
-# https://github.com/zfsonlinux/pkg-zfs/commit/80a3ae582b59c0250d7912ba794dca9e669e605a
+# This script is based on debian/zfsutils.zfs.init from the
+# Debian GNU/kFreeBSD zfsutils 8.1-3 package, written by Aurelien Jarno.
# Source the common init script
. @sysconfdir@/zfs/zfs-functions
@@ -34,9 +32,8 @@
# ----------------------------------------------------
chkroot() {
- while read line; do
- set -- $line
- if [ "$2" = "/" ]; then
+ while read -r _ mp _; do
+ if [ "$mp" = "/" ]; then
return 0
fi
done < /proc/self/mounts
@@ -65,7 +62,7 @@ do_depend()
# Mount all datasets/filesystems
do_mount()
{
- local verbose overlay i mntpt val
+ local verbose overlay i mntpt
check_boolean "$VERBOSE_MOUNT" && verbose=v
check_boolean "$DO_OVERLAY_MOUNTS" && overlay=O
@@ -83,11 +80,11 @@ do_mount()
read_mtab "^/dev/(zd|zvol)"
read_fstab "^/dev/(zd|zvol)"
- i=0; var=$(eval echo FSTAB_$i)
- while [ -n "$(eval echo "$""$var")" ]
+ i=0; var="FSTAB_0"
+ while [ -n "$(eval echo "\$$var")" ]
do
- mntpt=$(eval echo "$""$var")
- dev=$(eval echo "$"FSTAB_dev_$i)
+ mntpt=$(eval echo "\$$var")
+ dev=$(eval echo "\$FSTAB_dev_$i")
if ! in_mtab "$mntpt" && ! is_mounted "$mntpt" && [ -e "$dev" ]
then
check_boolean "$VERBOSE_MOUNT" && \
@@ -96,15 +93,15 @@ do_mount()
fi
i=$((i + 1))
- var=$(eval echo FSTAB_$i)
+ var=$(eval echo "FSTAB_$i")
done
read_mtab "[[:space:]]zfs[[:space:]]"
read_fstab "[[:space:]]zfs[[:space:]]"
- i=0; var=$(eval echo FSTAB_$i)
- while [ -n "$(eval echo "$""$var")" ]
+ i=0; var=$(eval echo "FSTAB_$i")
+ while [ -n "$(eval echo "\$$var")" ]
do
- mntpt=$(eval echo "$""$var")
+ mntpt=$(eval echo "\$$var")
if ! in_mtab "$mntpt" && ! is_mounted "$mntpt"
then
check_boolean "$VERBOSE_MOUNT" && \
@@ -113,7 +110,7 @@ do_mount()
fi
i=$((i + 1))
- var=$(eval echo FSTAB_$i)
+ var=$(eval echo "FSTAB_$i")
done
check_boolean "$VERBOSE_MOUNT" && zfs_log_end_msg 0
@@ -136,11 +133,11 @@ do_unmount()
read_mtab "^/dev/(zd|zvol)"
read_fstab "^/dev/(zd|zvol)"
- i=0; var=$(eval echo FSTAB_$i)
- while [ -n "$(eval echo "$""$var")" ]
+ i=0; var="FSTAB_0"
+ while [ -n "$(eval echo "\$$var")" ]
do
- mntpt=$(eval echo "$""$var")
- dev=$(eval echo "$"FSTAB_dev_$i)
+ mntpt=$(eval echo "\$$var")
+ dev=$(eval echo "\$FSTAB_dev_$i")
if in_mtab "$mntpt"
then
check_boolean "$VERBOSE_MOUNT" && \
@@ -149,15 +146,15 @@ do_unmount()
fi
i=$((i + 1))
- var=$(eval echo FSTAB_$i)
+ var=$(eval echo "FSTAB_$i")
done
read_mtab "[[:space:]]zfs[[:space:]]"
read_fstab "[[:space:]]zfs[[:space:]]"
- i=0; var=$(eval echo FSTAB_$i)
- while [ -n "$(eval echo "$""$var")" ]
+ i=0; var="FSTAB_0"
+ while [ -n "$(eval echo "\$$var")" ]
do
- mntpt=$(eval echo "$""$var")
+ mntpt=$(eval echo "\$$var")
if in_mtab "$mntpt"; then
check_boolean "$VERBOSE_MOUNT" && \
zfs_log_progress_msg "$mntpt "
@@ -165,7 +162,7 @@ do_unmount()
fi
i=$((i + 1))
- var=$(eval echo FSTAB_$i)
+ var=$(eval echo "FSTAB_$i")
done
check_boolean "$VERBOSE_MOUNT" && zfs_log_end_msg 0
diff --git a/sys/contrib/openzfs/etc/init.d/zfs-share.in b/sys/contrib/openzfs/etc/init.d/zfs-share.in
index 3256d1d067f1..ef628fe46363 100755
--- a/sys/contrib/openzfs/etc/init.d/zfs-share.in
+++ b/sys/contrib/openzfs/etc/init.d/zfs-share.in
@@ -22,10 +22,8 @@
#
# Released under the 2-clause BSD license.
#
-# The original script that acted as a template for this script came from
-# the Debian GNU/Linux kFreeBSD ZFS packages (which did not include a
-# licensing stansa) in the commit dated Mar 24, 2011:
-# https://github.com/zfsonlinux/pkg-zfs/commit/80a3ae582b59c0250d7912ba794dca9e669e605a
+# This script is based on debian/zfsutils.zfs.init from the
+# Debian GNU/kFreeBSD zfsutils 8.1-3 package, written by Aurelien Jarno.
# Source the common init script
. @sysconfdir@/zfs/zfs-functions
diff --git a/sys/contrib/openzfs/etc/init.d/zfs-zed.in b/sys/contrib/openzfs/etc/init.d/zfs-zed.in
index 6af9ee60c8c1..e5256cbc6280 100755
--- a/sys/contrib/openzfs/etc/init.d/zfs-zed.in
+++ b/sys/contrib/openzfs/etc/init.d/zfs-zed.in
@@ -21,10 +21,8 @@
#
# Released under the 2-clause BSD license.
#
-# The original script that acted as a template for this script came from
-# the Debian GNU/Linux kFreeBSD ZFS packages (which did not include a
-# licensing stansa) in the commit dated Mar 24, 2011:
-# https://github.com/zfsonlinux/pkg-zfs/commit/80a3ae582b59c0250d7912ba794dca9e669e605a
+# This script is based on debian/zfsutils.zfs.init from the
+# Debian GNU/kFreeBSD zfsutils 8.1-3 package, written by Aurelien Jarno.
# Source the common init script
. @sysconfdir@/zfs/zfs-functions
@@ -32,6 +30,7 @@
ZED_NAME="zed"
ZED_PIDFILE="@runstatedir@/$ZED_NAME.pid"
+# shellcheck disable=SC2034
extra_started_commands="reload"
# Exit if the package is not installed
@@ -57,24 +56,20 @@ do_start()
do_stop()
{
- local pools RET
+ local pools
check_module_loaded "zfs" || exit 0
zfs_action "Stopping ZFS Event Daemon" zfs_daemon_stop \
- "$ZED_PIDFILE" "$ZED" "$ZED_NAME"
- if [ "$?" -eq "0" ]
+ "$ZED_PIDFILE" "$ZED" "$ZED_NAME" || return "$?"
+
+ # Let's see if we have any pools imported
+ pools=$("$ZPOOL" list -H -oname)
+ if [ -z "$pools" ]
then
- # Let's see if we have any pools imported
- pools=$("$ZPOOL" list -H -oname)
- if [ -z "$pools" ]
- then
- # No pools imported, it is/should be safe/possible to
- # unload modules.
- zfs_action "Unloading modules" rmmod zfs zunicode \
- zavl zcommon znvpair zlua spl
- return "$?"
- fi
- else
+ # No pools imported, it is/should be safe/possible to
+ # unload modules.
+ zfs_action "Unloading modules" rmmod zfs zunicode \
+ zavl zcommon znvpair zlua spl
return "$?"
fi
}
diff --git a/sys/contrib/openzfs/etc/systemd/Makefile.am b/sys/contrib/openzfs/etc/systemd/Makefile.am
index 7b47b93fc105..66232a5ff197 100644
--- a/sys/contrib/openzfs/etc/systemd/Makefile.am
+++ b/sys/contrib/openzfs/etc/systemd/Makefile.am
@@ -1 +1,4 @@
+include $(top_srcdir)/config/Shellcheck.am
+
SUBDIRS = system system-generators
+SHELLCHECKDIRS = system-generators
diff --git a/sys/contrib/openzfs/etc/systemd/system-generators/Makefile.am b/sys/contrib/openzfs/etc/systemd/system-generators/Makefile.am
index fee88dad8ca1..e5920bf39203 100644
--- a/sys/contrib/openzfs/etc/systemd/system-generators/Makefile.am
+++ b/sys/contrib/openzfs/etc/systemd/system-generators/Makefile.am
@@ -1,6 +1,14 @@
-include $(top_srcdir)/config/Substfiles.am
+include $(top_srcdir)/config/Rules.am
-systemdgenerator_SCRIPTS = \
+systemdgenerator_PROGRAMS = \
zfs-mount-generator
-SUBSTFILES += $(systemdgenerator_SCRIPTS)
+zfs_mount_generator_SOURCES = \
+ zfs-mount-generator.c
+
+zfs_mount_generator_LDADD = \
+ $(abs_top_builddir)/lib/libzfs/libzfs.la
+
+zfs_mount_generator_LDFLAGS = -pthread
+
+include $(top_srcdir)/config/CppCheck.am
diff --git a/sys/contrib/openzfs/etc/systemd/system-generators/zfs-mount-generator.c b/sys/contrib/openzfs/etc/systemd/system-generators/zfs-mount-generator.c
new file mode 100644
index 000000000000..b806339deb2f
--- /dev/null
+++ b/sys/contrib/openzfs/etc/systemd/system-generators/zfs-mount-generator.c
@@ -0,0 +1,1083 @@
+/*
+ * Copyright (c) 2017 Antonio Russo <antonio.e.russo@gmail.com>
+ * Copyright (c) 2020 InsanePrawn <insane.prawny@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include <sys/resource.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <sys/mman.h>
+#include <semaphore.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <time.h>
+#include <regex.h>
+#include <search.h>
+#include <dirent.h>
+#include <string.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <errno.h>
+#include <libzfs.h>
+
+#define STRCMP ((int(*)(const void *, const void *))&strcmp)
+#define PID_T_CMP ((int(*)(const void *, const void *))&pid_t_cmp)
+
+static int
+pid_t_cmp(const pid_t *lhs, const pid_t *rhs)
+{
+ /*
+ * This is always valid, quoth sys_types.h(7posix):
+ * > blksize_t, pid_t, and ssize_t shall be signed integer types.
+ */
+ return (*lhs - *rhs);
+}
+
+#define EXIT_ENOMEM() \
+ do { \
+ fprintf(stderr, PROGNAME "[%d]: " \
+ "not enough memory (L%d)!\n", getpid(), __LINE__); \
+ _exit(1); \
+ } while (0)
+
+
+#define PROGNAME "zfs-mount-generator"
+#define FSLIST SYSCONFDIR "/zfs/zfs-list.cache"
+#define ZFS SBINDIR "/zfs"
+
+#define OUTPUT_HEADER \
+ "# Automatically generated by " PROGNAME "\n" \
+ "\n"
+
+/*
+ * Starts like the one in libzfs_util.c but also matches "//"
+ * and captures until the end, since we actually use it for path extraxion
+ */
+#define URI_REGEX_S "^\\([A-Za-z][A-Za-z0-9+.\\-]*\\):\\/\\/\\(.*\\)$"
+static regex_t uri_regex;
+
+static char *argv0;
+
+static const char *destdir = "/tmp";
+static int destdir_fd = -1;
+
+static void *known_pools = NULL; /* tsearch() of C strings */
+static struct {
+ sem_t noauto_not_on_sem;
+
+ sem_t noauto_names_sem;
+ size_t noauto_names_len;
+ size_t noauto_names_max;
+ char noauto_names[][NAME_MAX];
+} *noauto_files;
+
+
+static char *
+systemd_escape(const char *input, const char *prepend, const char *append)
+{
+ size_t len = strlen(input);
+ size_t applen = strlen(append);
+ size_t prelen = strlen(prepend);
+ char *ret = malloc(4 * len + prelen + applen + 1);
+ if (!ret)
+ EXIT_ENOMEM();
+
+ memcpy(ret, prepend, prelen);
+ char *out = ret + prelen;
+
+ const char *cur = input;
+ if (*cur == '.') {
+ memcpy(out, "\\x2e", 4);
+ out += 4;
+ ++cur;
+ }
+ for (; *cur; ++cur) {
+ if (*cur == '/')
+ *(out++) = '-';
+ else if (strchr(
+ "0123456789"
+ "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ ":_.", *cur))
+ *(out++) = *cur;
+ else {
+ sprintf(out, "\\x%02x", (int)*cur);
+ out += 4;
+ }
+ }
+
+ memcpy(out, append, applen + 1);
+ return (ret);
+}
+
+static void
+simplify_path(char *path)
+{
+ char *out = path;
+ for (char *cur = path; *cur; ++cur) {
+ if (*cur == '/') {
+ while (*(cur + 1) == '/')
+ ++cur;
+ *(out++) = '/';
+ } else
+ *(out++) = *cur;
+ }
+
+ *(out++) = '\0';
+}
+
+static bool
+strendswith(const char *what, const char *suff)
+{
+ size_t what_l = strlen(what);
+ size_t suff_l = strlen(suff);
+
+ return ((what_l >= suff_l) &&
+ (strcmp(what + what_l - suff_l, suff) == 0));
+}
+
+/* Assumes already-simplified path, doesn't modify input */
+static char *
+systemd_escape_path(char *input, const char *prepend, const char *append)
+{
+ if (strcmp(input, "/") == 0) {
+ char *ret;
+ if (asprintf(&ret, "%s-%s", prepend, append) == -1)
+ EXIT_ENOMEM();
+ return (ret);
+ } else {
+ /*
+ * path_is_normalized() (flattened for absolute paths here),
+ * required for proper escaping
+ */
+ if (strstr(input, "/./") || strstr(input, "/../") ||
+ strendswith(input, "/.") || strendswith(input, "/.."))
+ return (NULL);
+
+
+ if (input[0] == '/')
+ ++input;
+
+ char *back = &input[strlen(input) - 1];
+ bool deslash = *back == '/';
+ if (deslash)
+ *back = '\0';
+
+ char *ret = systemd_escape(input, prepend, append);
+
+ if (deslash)
+ *back = '/';
+ return (ret);
+ }
+}
+
+static FILE *
+fopenat(int dirfd, const char *pathname, int flags,
+ const char *stream_mode, mode_t mode)
+{
+ int fd = openat(dirfd, pathname, flags, mode);
+ if (fd < 0)
+ return (NULL);
+
+ return (fdopen(fd, stream_mode));
+}
+
+static int
+line_worker(char *line, const char *cachefile)
+{
+ char *toktmp;
+ /* BEGIN CSTYLED */
+ const char *dataset = strtok_r(line, "\t", &toktmp);
+ char *p_mountpoint = strtok_r(NULL, "\t", &toktmp);
+ const char *p_canmount = strtok_r(NULL, "\t", &toktmp);
+ const char *p_atime = strtok_r(NULL, "\t", &toktmp);
+ const char *p_relatime = strtok_r(NULL, "\t", &toktmp);
+ const char *p_devices = strtok_r(NULL, "\t", &toktmp);
+ const char *p_exec = strtok_r(NULL, "\t", &toktmp);
+ const char *p_readonly = strtok_r(NULL, "\t", &toktmp);
+ const char *p_setuid = strtok_r(NULL, "\t", &toktmp);
+ const char *p_nbmand = strtok_r(NULL, "\t", &toktmp);
+ const char *p_encroot = strtok_r(NULL, "\t", &toktmp) ?: "-";
+ char *p_keyloc = strtok_r(NULL, "\t", &toktmp) ?: strdupa("none");
+ const char *p_systemd_requires = strtok_r(NULL, "\t", &toktmp) ?: "-";
+ const char *p_systemd_requiresmountsfor = strtok_r(NULL, "\t", &toktmp) ?: "-";
+ const char *p_systemd_before = strtok_r(NULL, "\t", &toktmp) ?: "-";
+ const char *p_systemd_after = strtok_r(NULL, "\t", &toktmp) ?: "-";
+ char *p_systemd_wantedby = strtok_r(NULL, "\t", &toktmp) ?: strdupa("-");
+ char *p_systemd_requiredby = strtok_r(NULL, "\t", &toktmp) ?: strdupa("-");
+ const char *p_systemd_nofail = strtok_r(NULL, "\t", &toktmp) ?: "-";
+ const char *p_systemd_ignore = strtok_r(NULL, "\t", &toktmp) ?: "-";
+ /* END CSTYLED */
+
+ const char *pool = dataset;
+ if ((toktmp = strchr(pool, '/')) != NULL)
+ pool = strndupa(pool, toktmp - pool);
+
+ if (p_nbmand == NULL) {
+ fprintf(stderr, PROGNAME "[%d]: %s: not enough tokens!\n",
+ getpid(), dataset);
+ return (1);
+ }
+
+ strncpy(argv0, dataset, strlen(argv0));
+
+ /* Minimal pre-requisites to mount a ZFS dataset */
+ const char *after = "zfs-import.target";
+ const char *wants = "zfs-import.target";
+ const char *bindsto = NULL;
+ char *wantedby = NULL;
+ char *requiredby = NULL;
+ bool noauto = false;
+ bool wantedby_append = true;
+
+ /*
+ * zfs-import.target is not needed if the pool is already imported.
+ * This avoids a dependency loop on root-on-ZFS systems:
+ * systemd-random-seed.service After (via RequiresMountsFor)
+ * var-lib.mount After
+ * zfs-import.target After
+ * zfs-import-{cache,scan}.service After
+ * cryptsetup.service After
+ * systemd-random-seed.service
+ */
+ if (tfind(pool, &known_pools, STRCMP)) {
+ after = "";
+ wants = "";
+ }
+
+ if (strcmp(p_systemd_after, "-") == 0)
+ p_systemd_after = NULL;
+ if (strcmp(p_systemd_before, "-") == 0)
+ p_systemd_before = NULL;
+ if (strcmp(p_systemd_requires, "-") == 0)
+ p_systemd_requires = NULL;
+ if (strcmp(p_systemd_requiresmountsfor, "-") == 0)
+ p_systemd_requiresmountsfor = NULL;
+
+
+ if (strcmp(p_encroot, "-") != 0) {
+ char *keyloadunit =
+ systemd_escape(p_encroot, "zfs-load-key@", ".service");
+
+ if (strcmp(dataset, p_encroot) == 0) {
+ const char *keymountdep = NULL;
+ bool is_prompt = false;
+
+ regmatch_t uri_matches[3];
+ if (regexec(&uri_regex, p_keyloc,
+ sizeof (uri_matches) / sizeof (*uri_matches),
+ uri_matches, 0) == 0) {
+ p_keyloc[uri_matches[2].rm_eo] = '\0';
+ const char *path =
+ &p_keyloc[uri_matches[2].rm_so];
+
+ /*
+ * Assumes all URI keylocations need
+ * the mount for their path;
+ * http://, for example, wouldn't
+ * (but it'd need network-online.target et al.)
+ */
+ keymountdep = path;
+ } else {
+ if (strcmp(p_keyloc, "prompt") != 0)
+ fprintf(stderr, PROGNAME "[%d]: %s: "
+ "unknown non-URI keylocation=%s\n",
+ getpid(), dataset, p_keyloc);
+
+ is_prompt = true;
+ }
+
+
+ /* Generate the key-load .service unit */
+ FILE *keyloadunit_f = fopenat(destdir_fd, keyloadunit,
+ O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, "w",
+ 0644);
+ if (!keyloadunit_f) {
+ fprintf(stderr, PROGNAME "[%d]: %s: "
+ "couldn't open %s under %s: %s\n",
+ getpid(), dataset, keyloadunit, destdir,
+ strerror(errno));
+ return (1);
+ }
+
+ fprintf(keyloadunit_f,
+ OUTPUT_HEADER
+ "[Unit]\n"
+ "Description=Load ZFS key for %s\n"
+ "SourcePath=" FSLIST "/%s\n"
+ "Documentation=man:zfs-mount-generator(8)\n"
+ "DefaultDependencies=no\n"
+ "Wants=%s\n"
+ "After=%s\n",
+ dataset, cachefile, wants, after);
+
+ if (p_systemd_requires)
+ fprintf(keyloadunit_f,
+ "Requires=%s\n", p_systemd_requires);
+
+ if (p_systemd_requiresmountsfor || keymountdep) {
+ fprintf(keyloadunit_f, "RequiresMountsFor=");
+ if (p_systemd_requiresmountsfor)
+ fprintf(keyloadunit_f,
+ "%s ", p_systemd_requiresmountsfor);
+ if (keymountdep)
+ fprintf(keyloadunit_f,
+ "'%s'", keymountdep);
+ fprintf(keyloadunit_f, "\n");
+ }
+
+ /* BEGIN CSTYLED */
+ fprintf(keyloadunit_f,
+ "\n"
+ "[Service]\n"
+ "Type=oneshot\n"
+ "RemainAfterExit=yes\n"
+ "# This avoids a dependency loop involving systemd-journald.socket if this\n"
+ "# dataset is a parent of the root filesystem.\n"
+ "StandardOutput=null\n"
+ "StandardError=null\n"
+ "ExecStart=/bin/sh -euc '"
+ "[ \"$$(" ZFS " get -H -o value keystatus \"%s\")\" = \"unavailable\" ] || exit 0;",
+ dataset);
+ if (is_prompt)
+ fprintf(keyloadunit_f,
+ "for i in 1 2 3; do "
+ "systemd-ask-password --id=\"zfs:%s\" \"Enter passphrase for %s:\" |"
+ "" ZFS " load-key \"%s\" && exit 0;"
+ "done;"
+ "exit 1",
+ dataset, dataset, dataset);
+ else
+ fprintf(keyloadunit_f,
+ "exec " ZFS " load-key \"%s\"",
+ dataset);
+
+ fprintf(keyloadunit_f,
+ "'\n"
+ "ExecStop=/bin/sh -euc '"
+ "[ \"$$(" ZFS " get -H -o value keystatus \"%s\")\" = \"available\" ] || exit 0;"
+ "exec " ZFS " unload-key \"%s\""
+ "'\n",
+ dataset, dataset);
+ /* END CSTYLED */
+
+ (void) fclose(keyloadunit_f);
+ }
+
+ /* Update dependencies for the mount file to want this */
+ bindsto = keyloadunit;
+ if (after[0] == '\0')
+ after = keyloadunit;
+ else if (asprintf(&toktmp, "%s %s", after, keyloadunit) != -1)
+ after = toktmp;
+ else
+ EXIT_ENOMEM();
+ }
+
+
+ /* Skip generation of the mount unit if org.openzfs.systemd:ignore=on */
+ if (strcmp(p_systemd_ignore, "-") == 0 ||
+ strcmp(p_systemd_ignore, "off") == 0) {
+ /* ok */
+ } else if (strcmp(p_systemd_ignore, "on") == 0)
+ return (0);
+ else {
+ fprintf(stderr, PROGNAME "[%d]: %s: "
+ "invalid org.openzfs.systemd:ignore=%s\n",
+ getpid(), dataset, p_systemd_ignore);
+ return (1);
+ }
+
+ /* Check for canmount */
+ if (strcmp(p_canmount, "on") == 0) {
+ /* ok */
+ } else if (strcmp(p_canmount, "noauto") == 0)
+ noauto = true;
+ else if (strcmp(p_canmount, "off") == 0)
+ return (0);
+ else {
+ fprintf(stderr, PROGNAME "[%d]: %s: invalid canmount=%s\n",
+ getpid(), dataset, p_canmount);
+ return (1);
+ }
+
+ /* Check for legacy and blank mountpoints */
+ if (strcmp(p_mountpoint, "legacy") == 0 ||
+ strcmp(p_mountpoint, "none") == 0)
+ return (0);
+ else if (p_mountpoint[0] != '/') {
+ fprintf(stderr, PROGNAME "[%d]: %s: invalid mountpoint=%s\n",
+ getpid(), dataset, p_mountpoint);
+ return (1);
+ }
+
+ /* Escape the mountpoint per systemd policy */
+ simplify_path(p_mountpoint);
+ const char *mountfile = systemd_escape_path(p_mountpoint, "", ".mount");
+ if (mountfile == NULL) {
+ fprintf(stderr,
+ PROGNAME "[%d]: %s: abnormal simplified mountpoint: %s\n",
+ getpid(), dataset, p_mountpoint);
+ return (1);
+ }
+
+
+ /*
+ * Parse options, cf. lib/libzfs/libzfs_mount.c:zfs_add_options
+ *
+ * The longest string achievable here is
+ * ",atime,strictatime,nodev,noexec,rw,nosuid,nomand".
+ */
+ char opts[64] = "";
+
+ /* atime */
+ if (strcmp(p_atime, "on") == 0) {
+ /* relatime */
+ if (strcmp(p_relatime, "on") == 0)
+ strcat(opts, ",atime,relatime");
+ else if (strcmp(p_relatime, "off") == 0)
+ strcat(opts, ",atime,strictatime");
+ else
+ fprintf(stderr,
+ PROGNAME "[%d]: %s: invalid relatime=%s\n",
+ getpid(), dataset, p_relatime);
+ } else if (strcmp(p_atime, "off") == 0) {
+ strcat(opts, ",noatime");
+ } else
+ fprintf(stderr, PROGNAME "[%d]: %s: invalid atime=%s\n",
+ getpid(), dataset, p_atime);
+
+ /* devices */
+ if (strcmp(p_devices, "on") == 0)
+ strcat(opts, ",dev");
+ else if (strcmp(p_devices, "off") == 0)
+ strcat(opts, ",nodev");
+ else
+ fprintf(stderr, PROGNAME "[%d]: %s: invalid devices=%s\n",
+ getpid(), dataset, p_devices);
+
+ /* exec */
+ if (strcmp(p_exec, "on") == 0)
+ strcat(opts, ",exec");
+ else if (strcmp(p_exec, "off") == 0)
+ strcat(opts, ",noexec");
+ else
+ fprintf(stderr, PROGNAME "[%d]: %s: invalid exec=%s\n",
+ getpid(), dataset, p_exec);
+
+ /* readonly */
+ if (strcmp(p_readonly, "on") == 0)
+ strcat(opts, ",ro");
+ else if (strcmp(p_readonly, "off") == 0)
+ strcat(opts, ",rw");
+ else
+ fprintf(stderr, PROGNAME "[%d]: %s: invalid readonly=%s\n",
+ getpid(), dataset, p_readonly);
+
+ /* setuid */
+ if (strcmp(p_setuid, "on") == 0)
+ strcat(opts, ",suid");
+ else if (strcmp(p_setuid, "off") == 0)
+ strcat(opts, ",nosuid");
+ else
+ fprintf(stderr, PROGNAME "[%d]: %s: invalid setuid=%s\n",
+ getpid(), dataset, p_setuid);
+
+ /* nbmand */
+ if (strcmp(p_nbmand, "on") == 0)
+ strcat(opts, ",mand");
+ else if (strcmp(p_nbmand, "off") == 0)
+ strcat(opts, ",nomand");
+ else
+ fprintf(stderr, PROGNAME "[%d]: %s: invalid nbmand=%s\n",
+ getpid(), dataset, p_setuid);
+
+ if (strcmp(p_systemd_wantedby, "-") != 0) {
+ noauto = true;
+
+ if (strcmp(p_systemd_wantedby, "none") != 0)
+ wantedby = p_systemd_wantedby;
+ }
+
+ if (strcmp(p_systemd_requiredby, "-") != 0) {
+ noauto = true;
+
+ if (strcmp(p_systemd_requiredby, "none") != 0)
+ requiredby = p_systemd_requiredby;
+ }
+
+ /*
+ * For datasets with canmount=on, a dependency is created for
+ * local-fs.target by default. To avoid regressions, this dependency
+ * is reduced to "wants" rather than "requires" when nofail!=off.
+ * **THIS MAY CHANGE**
+ * noauto=on disables this behavior completely.
+ */
+ if (!noauto) {
+ if (strcmp(p_systemd_nofail, "off") == 0)
+ requiredby = strdupa("local-fs.target");
+ else {
+ wantedby = strdupa("local-fs.target");
+ wantedby_append = strcmp(p_systemd_nofail, "on") != 0;
+ }
+ }
+
+ /*
+ * Handle existing files:
+ * 1. We never overwrite existing files, although we may delete
+ * files if we're sure they were created by us. (see 5.)
+ * 2. We handle files differently based on canmount.
+ * Units with canmount=on always have precedence over noauto.
+ * This is enforced by the noauto_not_on_sem semaphore,
+ * which is only unlocked when the last canmount=on process exits.
+ * It is important to use p_canmount and not noauto here,
+ * since we categorise by canmount while other properties,
+ * e.g. org.openzfs.systemd:wanted-by, also modify noauto.
+ * 3. If no unit file exists for a noauto dataset, we create one.
+ * Additionally, we use noauto_files to track the unit file names
+ * (which are the systemd-escaped mountpoints) of all (exclusively)
+ * noauto datasets that had a file created.
+ * 4. If the file to be created is found in the tracking array,
+ * we do NOT create it.
+ * 5. If a file exists for a noauto dataset,
+ * we check whether the file name is in the array.
+ * If it is, we have multiple noauto datasets for the same
+ * mountpoint. In such cases, we remove the file for safety.
+ * We leave the file name in the tracking array to avoid
+ * further noauto datasets creating a file for this path again.
+ */
+
+ {
+ sem_t *our_sem = (strcmp(p_canmount, "on") == 0) ?
+ &noauto_files->noauto_names_sem :
+ &noauto_files->noauto_not_on_sem;
+ while (sem_wait(our_sem) == -1 && errno == EINTR)
+ ;
+ }
+
+ struct stat stbuf;
+ bool already_exists = fstatat(destdir_fd, mountfile, &stbuf, 0) == 0;
+
+ bool is_known = false;
+ for (size_t i = 0; i < noauto_files->noauto_names_len; ++i) {
+ if (strncmp(
+ noauto_files->noauto_names[i], mountfile, NAME_MAX) == 0) {
+ is_known = true;
+ break;
+ }
+ }
+
+ if (already_exists) {
+ if (is_known) {
+ /* If it's in $noauto_files, we must be noauto too */
+
+ /* See 5 */
+ errno = 0;
+ (void) unlinkat(destdir_fd, mountfile, 0);
+
+ /* See 2 */
+ fprintf(stderr, PROGNAME "[%d]: %s: "
+ "removing duplicate noauto unit %s%s%s\n",
+ getpid(), dataset, mountfile,
+ errno ? "" : " failed: ",
+ errno ? "" : strerror(errno));
+ } else {
+ /* Don't log for canmount=noauto */
+ if (strcmp(p_canmount, "on") == 0)
+ fprintf(stderr, PROGNAME "[%d]: %s: "
+ "%s already exists. Skipping.\n",
+ getpid(), dataset, mountfile);
+ }
+
+ /* File exists: skip current dataset */
+ if (strcmp(p_canmount, "on") == 0)
+ sem_post(&noauto_files->noauto_names_sem);
+ return (0);
+ } else {
+ if (is_known) {
+ /* See 4 */
+ if (strcmp(p_canmount, "on") == 0)
+ sem_post(&noauto_files->noauto_names_sem);
+ return (0);
+ } else if (strcmp(p_canmount, "noauto") == 0) {
+ if (noauto_files->noauto_names_len ==
+ noauto_files->noauto_names_max)
+ fprintf(stderr, PROGNAME "[%d]: %s: "
+ "noauto dataset limit (%zu) reached! "
+ "Not tracking %s. Please report this to "
+ "https://github.com/openzfs/zfs\n",
+ getpid(), dataset,
+ noauto_files->noauto_names_max, mountfile);
+ else {
+ strncpy(noauto_files->noauto_names[
+ noauto_files->noauto_names_len],
+ mountfile, NAME_MAX);
+ ++noauto_files->noauto_names_len;
+ }
+ }
+ }
+
+
+ FILE *mountfile_f = fopenat(destdir_fd, mountfile,
+ O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, "w", 0644);
+ if (strcmp(p_canmount, "on") == 0)
+ sem_post(&noauto_files->noauto_names_sem);
+ if (!mountfile_f) {
+ fprintf(stderr,
+ PROGNAME "[%d]: %s: couldn't open %s under %s: %s\n",
+ getpid(), dataset, mountfile, destdir, strerror(errno));
+ return (1);
+ }
+
+ fprintf(mountfile_f,
+ OUTPUT_HEADER
+ "[Unit]\n"
+ "SourcePath=" FSLIST "/%s\n"
+ "Documentation=man:zfs-mount-generator(8)\n"
+ "\n"
+ "Before=",
+ cachefile);
+
+ if (p_systemd_before)
+ fprintf(mountfile_f, "%s ", p_systemd_before);
+ fprintf(mountfile_f, "zfs-mount.service"); /* Ensures we don't race */
+ if (requiredby)
+ fprintf(mountfile_f, " %s", requiredby);
+ if (wantedby && wantedby_append)
+ fprintf(mountfile_f, " %s", wantedby);
+
+ fprintf(mountfile_f,
+ "\n"
+ "After=");
+ if (p_systemd_after)
+ fprintf(mountfile_f, "%s ", p_systemd_after);
+ fprintf(mountfile_f, "%s\n", after);
+
+ fprintf(mountfile_f, "Wants=%s\n", wants);
+
+ if (bindsto)
+ fprintf(mountfile_f, "BindsTo=%s\n", bindsto);
+ if (p_systemd_requires)
+ fprintf(mountfile_f, "Requires=%s\n", p_systemd_requires);
+ if (p_systemd_requiresmountsfor)
+ fprintf(mountfile_f,
+ "RequiresMountsFor=%s\n", p_systemd_requiresmountsfor);
+
+ fprintf(mountfile_f,
+ "\n"
+ "[Mount]\n"
+ "Where=%s\n"
+ "What=%s\n"
+ "Type=zfs\n"
+ "Options=defaults%s,zfsutil\n",
+ p_mountpoint, dataset, opts);
+
+ (void) fclose(mountfile_f);
+
+ if (!requiredby && !wantedby)
+ return (0);
+
+ /* Finally, create the appropriate dependencies */
+ char *linktgt;
+ if (asprintf(&linktgt, "../%s", mountfile) == -1)
+ EXIT_ENOMEM();
+
+ char *dependencies[][2] = {
+ {"wants", wantedby},
+ {"requires", requiredby},
+ {}
+ };
+ for (__typeof__(&*dependencies) dep = &*dependencies; **dep; ++dep) {
+ if (!(*dep)[1])
+ continue;
+
+ for (char *reqby = strtok_r((*dep)[1], " ", &toktmp);
+ reqby;
+ reqby = strtok_r(NULL, " ", &toktmp)) {
+ char *depdir;
+ if (asprintf(&depdir, "%s.%s", reqby, (*dep)[0]) == -1)
+ EXIT_ENOMEM();
+
+ (void) mkdirat(destdir_fd, depdir, 0755);
+ int depdir_fd = openat(destdir_fd, depdir,
+ O_PATH | O_DIRECTORY | O_CLOEXEC);
+ if (depdir_fd < 0) {
+ fprintf(stderr, PROGNAME "[%d]: %s: "
+ "couldn't open %s under %s: %s\n",
+ getpid(), dataset, depdir, destdir,
+ strerror(errno));
+ free(depdir);
+ continue;
+ }
+
+ if (symlinkat(linktgt, depdir_fd, mountfile) == -1)
+ fprintf(stderr, PROGNAME "[%d]: %s: "
+ "couldn't symlink at "
+ "%s under %s under %s: %s\n",
+ getpid(), dataset, mountfile,
+ depdir, destdir, strerror(errno));
+
+ (void) close(depdir_fd);
+ free(depdir);
+ }
+ }
+
+ return (0);
+}
+
+
+static int
+pool_enumerator(zpool_handle_t *pool, void *data __attribute__((unused)))
+{
+ int ret = 0;
+
+ /*
+ * Pools are guaranteed-unique by the kernel,
+ * no risk of leaking dupes here
+ */
+ char *name = strdup(zpool_get_name(pool));
+ if (!name || !tsearch(name, &known_pools, STRCMP)) {
+ free(name);
+ ret = ENOMEM;
+ }
+
+ zpool_close(pool);
+ return (ret);
+}
+
+int
+main(int argc, char **argv)
+{
+ struct timespec time_init = {};
+ clock_gettime(CLOCK_MONOTONIC_RAW, &time_init);
+
+ {
+ int kmfd = open("/dev/kmsg", O_WRONLY | O_CLOEXEC);
+ if (kmfd >= 0) {
+ (void) dup2(kmfd, STDERR_FILENO);
+ (void) close(kmfd);
+ }
+ }
+
+ uint8_t debug = 0;
+
+ argv0 = argv[0];
+ switch (argc) {
+ case 1:
+ /* Use default */
+ break;
+ case 2:
+ case 4:
+ destdir = argv[1];
+ break;
+ default:
+ fprintf(stderr,
+ PROGNAME "[%d]: wrong argument count: %d\n",
+ getpid(), argc - 1);
+ _exit(1);
+ }
+
+ {
+ destdir_fd = open(destdir, O_PATH | O_DIRECTORY | O_CLOEXEC);
+ if (destdir_fd < 0) {
+ fprintf(stderr, PROGNAME "[%d]: "
+ "can't open destination directory %s: %s\n",
+ getpid(), destdir, strerror(errno));
+ _exit(1);
+ }
+ }
+
+ DIR *fslist_dir = opendir(FSLIST);
+ if (!fslist_dir) {
+ if (errno != ENOENT)
+ fprintf(stderr,
+ PROGNAME "[%d]: couldn't open " FSLIST ": %s\n",
+ getpid(), strerror(errno));
+ _exit(0);
+ }
+
+ {
+ libzfs_handle_t *libzfs = libzfs_init();
+ if (libzfs) {
+ if (zpool_iter(libzfs, pool_enumerator, NULL) != 0)
+ fprintf(stderr, PROGNAME "[%d]: "
+ "error listing pools, ignoring\n",
+ getpid());
+ libzfs_fini(libzfs);
+ } else
+ fprintf(stderr, PROGNAME "[%d]: "
+ "couldn't start libzfs, ignoring\n",
+ getpid());
+ }
+
+ {
+ int regerr = regcomp(&uri_regex, URI_REGEX_S, 0);
+ if (regerr != 0) {
+ fprintf(stderr,
+ PROGNAME "[%d]: invalid regex: %d\n",
+ getpid(), regerr);
+ _exit(1);
+ }
+ }
+
+ {
+ /*
+ * We could just get a gigabyte here and Not Care,
+ * but if vm.overcommit_memory=2, then MAP_NORESERVE is ignored
+ * and we'd try (and likely fail) to rip it out of swap
+ */
+ noauto_files = mmap(NULL, 4 * 1024 * 1024,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
+ if (noauto_files == MAP_FAILED) {
+ fprintf(stderr,
+ PROGNAME "[%d]: couldn't allocate IPC region: %s\n",
+ getpid(), strerror(errno));
+ _exit(1);
+ }
+
+ sem_init(&noauto_files->noauto_not_on_sem, true, 0);
+ sem_init(&noauto_files->noauto_names_sem, true, 1);
+ noauto_files->noauto_names_len = 0;
+ /* Works out to 16447ish, *well* enough */
+ noauto_files->noauto_names_max =
+ (4 * 1024 * 1024 - sizeof (*noauto_files)) / NAME_MAX;
+ }
+
+ char *line = NULL;
+ size_t linelen = 0;
+ struct timespec time_start = {};
+ {
+ const char *dbgenv = getenv("ZFS_DEBUG");
+ if (dbgenv)
+ debug = atoi(dbgenv);
+ else {
+ FILE *cmdline = fopen("/proc/cmdline", "re");
+ if (cmdline != NULL) {
+ if (getline(&line, &linelen, cmdline) >= 0)
+ debug = strstr(line, "debug") ? 2 : 0;
+ (void) fclose(cmdline);
+ }
+ }
+
+ if (debug && !isatty(STDOUT_FILENO))
+ dup2(STDERR_FILENO, STDOUT_FILENO);
+ }
+
+ size_t forked_canmount_on = 0;
+ size_t forked_canmount_not_on = 0;
+ size_t canmount_on_pids_len = 128;
+ pid_t *canmount_on_pids =
+ malloc(canmount_on_pids_len * sizeof (*canmount_on_pids));
+ if (canmount_on_pids == NULL)
+ canmount_on_pids_len = 0;
+
+ if (debug)
+ clock_gettime(CLOCK_MONOTONIC_RAW, &time_start);
+
+ ssize_t read;
+ pid_t pid;
+ struct dirent *cachent;
+ while ((cachent = readdir(fslist_dir)) != NULL) {
+ if (strcmp(cachent->d_name, ".") == 0 ||
+ strcmp(cachent->d_name, "..") == 0)
+ continue;
+
+ FILE *cachefile = fopenat(dirfd(fslist_dir), cachent->d_name,
+ O_RDONLY | O_CLOEXEC, "r", 0);
+ if (!cachefile) {
+ fprintf(stderr, PROGNAME "[%d]: "
+ "couldn't open %s under " FSLIST ": %s\n",
+ getpid(), cachent->d_name, strerror(errno));
+ continue;
+ }
+
+ while ((read = getline(&line, &linelen, cachefile)) >= 0) {
+ line[read - 1] = '\0'; /* newline */
+
+ switch (pid = fork()) {
+ case -1:
+ fprintf(stderr,
+ PROGNAME "[%d]: couldn't fork for %s: %s\n",
+ getpid(), line, strerror(errno));
+ break;
+ case 0: /* child */
+ _exit(line_worker(line, cachent->d_name));
+ default: { /* parent */
+ char *tmp;
+ char *dset = strtok_r(line, "\t", &tmp);
+ strtok_r(NULL, "\t", &tmp);
+ char *canmount = strtok_r(NULL, "\t", &tmp);
+ bool canmount_on =
+ canmount && strncmp(canmount, "on", 2) == 0;
+
+ if (debug >= 2)
+ printf(PROGNAME ": forked %d, "
+ "canmount_on=%d, dataset=%s\n",
+ (int)pid, canmount_on, dset);
+
+ if (canmount_on &&
+ forked_canmount_on ==
+ canmount_on_pids_len) {
+ size_t new_len =
+ (canmount_on_pids_len ?: 16) * 2;
+ void *new_pidlist =
+ realloc(canmount_on_pids,
+ new_len *
+ sizeof (*canmount_on_pids));
+ if (!new_pidlist) {
+ fprintf(stderr,
+ PROGNAME "[%d]: "
+ "out of memory! "
+ "Mount ordering may be "
+ "affected.\n", getpid());
+ continue;
+ }
+
+ canmount_on_pids = new_pidlist;
+ canmount_on_pids_len = new_len;
+ }
+
+ if (canmount_on) {
+ canmount_on_pids[forked_canmount_on] =
+ pid;
+ ++forked_canmount_on;
+ } else
+ ++forked_canmount_not_on;
+ break;
+ }
+ }
+ }
+
+ (void) fclose(cachefile);
+ }
+ free(line);
+
+ if (forked_canmount_on == 0) {
+ /* No canmount=on processes to finish, so don't deadlock here */
+ for (size_t i = 0; i < forked_canmount_not_on; ++i)
+ sem_post(&noauto_files->noauto_not_on_sem);
+ } else {
+ /* Likely a no-op, since we got these from a narrow fork loop */
+ qsort(canmount_on_pids, forked_canmount_on,
+ sizeof (*canmount_on_pids), PID_T_CMP);
+ }
+
+ int status, ret = 0;
+ struct rusage usage;
+ size_t forked_canmount_on_max = forked_canmount_on;
+ while ((pid = wait4(-1, &status, 0, &usage)) != -1) {
+ ret |= WEXITSTATUS(status) | WTERMSIG(status);
+
+ if (forked_canmount_on != 0) {
+ if (bsearch(&pid, canmount_on_pids,
+ forked_canmount_on_max, sizeof (*canmount_on_pids),
+ PID_T_CMP))
+ --forked_canmount_on;
+
+ if (forked_canmount_on == 0) {
+ /*
+ * All canmount=on processes have finished,
+ * let all the lower-priority ones finish now
+ */
+ for (size_t i = 0;
+ i < forked_canmount_not_on; ++i)
+ sem_post(
+ &noauto_files->noauto_not_on_sem);
+ }
+ }
+
+ if (debug >= 2)
+ printf(PROGNAME ": %d done, user=%llu.%06us, "
+ "system=%llu.%06us, maxrss=%ldB, ex=0x%x\n",
+ (int)pid,
+ (unsigned long long) usage.ru_utime.tv_sec,
+ (unsigned int) usage.ru_utime.tv_usec,
+ (unsigned long long) usage.ru_stime.tv_sec,
+ (unsigned int) usage.ru_stime.tv_usec,
+ usage.ru_maxrss * 1024, status);
+ }
+
+ if (debug) {
+ struct timespec time_end = {};
+ clock_gettime(CLOCK_MONOTONIC_RAW, &time_end);
+
+ getrusage(RUSAGE_SELF, &usage);
+ printf(
+ "\n"
+ PROGNAME ": self : "
+ "user=%llu.%06us, system=%llu.%06us, maxrss=%ldB\n",
+ (unsigned long long) usage.ru_utime.tv_sec,
+ (unsigned int) usage.ru_utime.tv_usec,
+ (unsigned long long) usage.ru_stime.tv_sec,
+ (unsigned int) usage.ru_stime.tv_usec,
+ usage.ru_maxrss * 1024);
+
+ getrusage(RUSAGE_CHILDREN, &usage);
+ printf(PROGNAME ": children: "
+ "user=%llu.%06us, system=%llu.%06us, maxrss=%ldB\n",
+ (unsigned long long) usage.ru_utime.tv_sec,
+ (unsigned int) usage.ru_utime.tv_usec,
+ (unsigned long long) usage.ru_stime.tv_sec,
+ (unsigned int) usage.ru_stime.tv_usec,
+ usage.ru_maxrss * 1024);
+
+ if (time_start.tv_nsec > time_end.tv_nsec) {
+ time_end.tv_nsec =
+ 1000000000 + time_end.tv_nsec - time_start.tv_nsec;
+ time_end.tv_sec -= 1;
+ } else
+ time_end.tv_nsec -= time_start.tv_nsec;
+ time_end.tv_sec -= time_start.tv_sec;
+
+ if (time_init.tv_nsec > time_start.tv_nsec) {
+ time_start.tv_nsec =
+ 1000000000 + time_start.tv_nsec - time_init.tv_nsec;
+ time_start.tv_sec -= 1;
+ } else
+ time_start.tv_nsec -= time_init.tv_nsec;
+ time_start.tv_sec -= time_init.tv_sec;
+
+ time_init.tv_nsec = time_start.tv_nsec + time_end.tv_nsec;
+ time_init.tv_sec =
+ time_start.tv_sec + time_end.tv_sec +
+ time_init.tv_nsec / 1000000000;
+ time_init.tv_nsec %= 1000000000;
+
+ printf(PROGNAME ": wall : "
+ "total=%llu.%09llus = "
+ "init=%llu.%09llus + real=%llu.%09llus\n",
+ (unsigned long long) time_init.tv_sec,
+ (unsigned long long) time_init.tv_nsec,
+ (unsigned long long) time_start.tv_sec,
+ (unsigned long long) time_start.tv_nsec,
+ (unsigned long long) time_end.tv_sec,
+ (unsigned long long) time_end.tv_nsec);
+ }
+
+ _exit(ret);
+}
diff --git a/sys/contrib/openzfs/etc/systemd/system-generators/zfs-mount-generator.in b/sys/contrib/openzfs/etc/systemd/system-generators/zfs-mount-generator.in
deleted file mode 100755
index c276fbbce59d..000000000000
--- a/sys/contrib/openzfs/etc/systemd/system-generators/zfs-mount-generator.in
+++ /dev/null
@@ -1,474 +0,0 @@
-#!/bin/sh
-
-# zfs-mount-generator - generates systemd mount units for zfs
-# Copyright (c) 2017 Antonio Russo <antonio.e.russo@gmail.com>
-# Copyright (c) 2020 InsanePrawn <insane.prawny@gmail.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-set -e
-
-FSLIST="@sysconfdir@/zfs/zfs-list.cache"
-
-[ -d "${FSLIST}" ] || exit 0
-[ "$(echo "${FSLIST}"/*)" = "${FSLIST}/*" ] && exit 0
-
-do_fail() {
- printf 'zfs-mount-generator: %s\n' "$*" > /dev/kmsg
- exit 1
-}
-
-# test if $1 is in space-separated list $2
-is_known() {
- query="$1"
- IFS=' '
- for element in $2 ; do
- if [ "$query" = "$element" ] ; then
- return 0
- fi
- done
- return 1
-}
-
-# create dependency on unit file $1
-# of type $2, i.e. "wants" or "requires"
-# in the target units from space-separated list $3
-create_dependencies() {
- unitfile="$1"
- suffix="$2"
- IFS=' '
- for target in $3 ; do
- target_dir="${dest_norm}/${target}.${suffix}/"
- mkdir -p "${target_dir}"
- ln -s "../${unitfile}" "${target_dir}"
- done
-}
-
-# see systemd.generator
-if [ $# -eq 0 ] ; then
- dest_norm="/tmp"
-elif [ $# -eq 3 ] ; then
- dest_norm="${1}"
-else
- do_fail "zero or three arguments required"
-fi
-
-pools=$(zpool list -H -o name || true)
-
-# All needed information about each ZFS is available from
-# zfs list -H -t filesystem -o <properties>
-# cached in $FSLIST, and each line is processed by the following function:
-# See the list below for the properties and their order
-
-process_line() {
-
- # zfs list -H -o name,...
- # fields are tab separated
- IFS="$(printf '\t')"
- # shellcheck disable=SC2086
- set -- $1
-
- dataset="${1}"
- pool="${dataset%%/*}"
- p_mountpoint="${2}"
- p_canmount="${3}"
- p_atime="${4}"
- p_relatime="${5}"
- p_devices="${6}"
- p_exec="${7}"
- p_readonly="${8}"
- p_setuid="${9}"
- p_nbmand="${10}"
- p_encroot="${11}"
- p_keyloc="${12}"
- p_systemd_requires="${13}"
- p_systemd_requiresmountsfor="${14}"
- p_systemd_before="${15}"
- p_systemd_after="${16}"
- p_systemd_wantedby="${17}"
- p_systemd_requiredby="${18}"
- p_systemd_nofail="${19}"
- p_systemd_ignore="${20}"
-
- # Minimal pre-requisites to mount a ZFS dataset
- # By ordering before zfs-mount.service, we avoid race conditions.
- after="zfs-import.target"
- before="zfs-mount.service"
- wants="zfs-import.target"
- requires=""
- requiredmounts=""
- bindsto=""
- wantedby=""
- requiredby=""
- noauto="off"
-
- # If the pool is already imported, zfs-import.target is not needed. This
- # avoids a dependency loop on root-on-ZFS systems:
- # systemd-random-seed.service After (via RequiresMountsFor) var-lib.mount
- # After zfs-import.target After zfs-import-{cache,scan}.service After
- # cryptsetup.service After systemd-random-seed.service.
- #
- # Pools are newline-separated and may contain spaces in their names.
- # There is no better portable way to set IFS to just a newline. Using
- # $(printf '\n') doesn't work because $(...) strips trailing newlines.
- IFS="
-"
- for p in $pools ; do
- if [ "$p" = "$pool" ] ; then
- after=""
- wants=""
- break
- fi
- done
-
- if [ -n "${p_systemd_after}" ] && \
- [ "${p_systemd_after}" != "-" ] ; then
- after="${p_systemd_after} ${after}"
- fi
-
- if [ -n "${p_systemd_before}" ] && \
- [ "${p_systemd_before}" != "-" ] ; then
- before="${p_systemd_before} ${before}"
- fi
-
- if [ -n "${p_systemd_requires}" ] && \
- [ "${p_systemd_requires}" != "-" ] ; then
- requires="Requires=${p_systemd_requires}"
- fi
-
- if [ -n "${p_systemd_requiresmountsfor}" ] && \
- [ "${p_systemd_requiresmountsfor}" != "-" ] ; then
- requiredmounts="RequiresMountsFor=${p_systemd_requiresmountsfor}"
- fi
-
- # Handle encryption
- if [ -n "${p_encroot}" ] &&
- [ "${p_encroot}" != "-" ] ; then
- keyloadunit="zfs-load-key-$(systemd-escape "${p_encroot}").service"
- if [ "${p_encroot}" = "${dataset}" ] ; then
- keymountdep=""
- if [ "${p_keyloc%%://*}" = "file" ] ; then
- if [ -n "${requiredmounts}" ] ; then
- keymountdep="${requiredmounts} '${p_keyloc#file://}'"
- else
- keymountdep="RequiresMountsFor='${p_keyloc#file://}'"
- fi
- keyloadscript="@sbindir@/zfs load-key \"${dataset}\""
- elif [ "${p_keyloc}" = "prompt" ] ; then
- keyloadscript="\
-count=0;\
-while [ \$\$count -lt 3 ];do\
- systemd-ask-password --id=\"zfs:${dataset}\"\
- \"Enter passphrase for ${dataset}:\"|\
- @sbindir@/zfs load-key \"${dataset}\" && exit 0;\
- count=\$\$((count + 1));\
-done;\
-exit 1"
- else
- printf 'zfs-mount-generator: (%s) invalid keylocation\n' \
- "${dataset}" >/dev/kmsg
- fi
- keyloadcmd="\
-/bin/sh -c '\
-set -eu;\
-keystatus=\"\$\$(@sbindir@/zfs get -H -o value keystatus \"${dataset}\")\";\
-[ \"\$\$keystatus\" = \"unavailable\" ] || exit 0;\
-${keyloadscript}'"
- keyunloadcmd="\
-/bin/sh -c '\
-set -eu;\
-keystatus=\"\$\$(@sbindir@/zfs get -H -o value keystatus \"${dataset}\")\";\
-[ \"\$\$keystatus\" = \"available\" ] || exit 0;\
-@sbindir@/zfs unload-key \"${dataset}\"'"
-
-
-
- # Generate the key-load .service unit
- #
- # Note: It is tempting to use a `<<EOF` style here-document for this, but
- # bash requires a writable /tmp or $TMPDIR for that. This is not always
- # available early during boot.
- #
- echo \
-"# Automatically generated by zfs-mount-generator
-
-[Unit]
-Description=Load ZFS key for ${dataset}
-SourcePath=${cachefile}
-Documentation=man:zfs-mount-generator(8)
-DefaultDependencies=no
-Wants=${wants}
-After=${after}
-${requires}
-${keymountdep}
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-# This avoids a dependency loop involving systemd-journald.socket if this
-# dataset is a parent of the root filesystem.
-StandardOutput=null
-StandardError=null
-ExecStart=${keyloadcmd}
-ExecStop=${keyunloadcmd}" > "${dest_norm}/${keyloadunit}"
- fi
- # Update the dependencies for the mount file to want the
- # key-loading unit.
- wants="${wants}"
- bindsto="BindsTo=${keyloadunit}"
- after="${after} ${keyloadunit}"
- fi
-
- # Prepare the .mount unit
-
- # skip generation of the mount unit if org.openzfs.systemd:ignore is "on"
- if [ -n "${p_systemd_ignore}" ] ; then
- if [ "${p_systemd_ignore}" = "on" ] ; then
- return
- elif [ "${p_systemd_ignore}" = "-" ] \
- || [ "${p_systemd_ignore}" = "off" ] ; then
- : # This is OK
- else
- do_fail "invalid org.openzfs.systemd:ignore for ${dataset}"
- fi
- fi
-
- # Check for canmount=off .
- if [ "${p_canmount}" = "off" ] ; then
- return
- elif [ "${p_canmount}" = "noauto" ] ; then
- noauto="on"
- elif [ "${p_canmount}" = "on" ] ; then
- : # This is OK
- else
- do_fail "invalid canmount for ${dataset}"
- fi
-
- # Check for legacy and blank mountpoints.
- if [ "${p_mountpoint}" = "legacy" ] ; then
- return
- elif [ "${p_mountpoint}" = "none" ] ; then
- return
- elif [ "${p_mountpoint%"${p_mountpoint#?}"}" != "/" ] ; then
- do_fail "invalid mountpoint for ${dataset}"
- fi
-
- # Escape the mountpoint per systemd policy.
- mountfile="$(systemd-escape --path --suffix=mount "${p_mountpoint}")"
-
- # Parse options
- # see lib/libzfs/libzfs_mount.c:zfs_add_options
- opts=""
-
- # atime
- if [ "${p_atime}" = on ] ; then
- # relatime
- if [ "${p_relatime}" = on ] ; then
- opts="${opts},atime,relatime"
- elif [ "${p_relatime}" = off ] ; then
- opts="${opts},atime,strictatime"
- else
- printf 'zfs-mount-generator: (%s) invalid relatime\n' \
- "${dataset}" >/dev/kmsg
- fi
- elif [ "${p_atime}" = off ] ; then
- opts="${opts},noatime"
- else
- printf 'zfs-mount-generator: (%s) invalid atime\n' \
- "${dataset}" >/dev/kmsg
- fi
-
- # devices
- if [ "${p_devices}" = on ] ; then
- opts="${opts},dev"
- elif [ "${p_devices}" = off ] ; then
- opts="${opts},nodev"
- else
- printf 'zfs-mount-generator: (%s) invalid devices\n' \
- "${dataset}" >/dev/kmsg
- fi
-
- # exec
- if [ "${p_exec}" = on ] ; then
- opts="${opts},exec"
- elif [ "${p_exec}" = off ] ; then
- opts="${opts},noexec"
- else
- printf 'zfs-mount-generator: (%s) invalid exec\n' \
- "${dataset}" >/dev/kmsg
- fi
-
- # readonly
- if [ "${p_readonly}" = on ] ; then
- opts="${opts},ro"
- elif [ "${p_readonly}" = off ] ; then
- opts="${opts},rw"
- else
- printf 'zfs-mount-generator: (%s) invalid readonly\n' \
- "${dataset}" >/dev/kmsg
- fi
-
- # setuid
- if [ "${p_setuid}" = on ] ; then
- opts="${opts},suid"
- elif [ "${p_setuid}" = off ] ; then
- opts="${opts},nosuid"
- else
- printf 'zfs-mount-generator: (%s) invalid setuid\n' \
- "${dataset}" >/dev/kmsg
- fi
-
- # nbmand
- if [ "${p_nbmand}" = on ] ; then
- opts="${opts},mand"
- elif [ "${p_nbmand}" = off ] ; then
- opts="${opts},nomand"
- else
- printf 'zfs-mount-generator: (%s) invalid nbmand\n' \
- "${dataset}" >/dev/kmsg
- fi
-
- if [ -n "${p_systemd_wantedby}" ] && \
- [ "${p_systemd_wantedby}" != "-" ] ; then
- noauto="on"
- if [ "${p_systemd_wantedby}" = "none" ] ; then
- wantedby=""
- else
- wantedby="${p_systemd_wantedby}"
- before="${before} ${wantedby}"
- fi
- fi
-
- if [ -n "${p_systemd_requiredby}" ] && \
- [ "${p_systemd_requiredby}" != "-" ] ; then
- noauto="on"
- if [ "${p_systemd_requiredby}" = "none" ] ; then
- requiredby=""
- else
- requiredby="${p_systemd_requiredby}"
- before="${before} ${requiredby}"
- fi
- fi
-
- # For datasets with canmount=on, a dependency is created for
- # local-fs.target by default. To avoid regressions, this dependency
- # is reduced to "wants" rather than "requires" when nofail is not "off".
- # **THIS MAY CHANGE**
- # noauto=on disables this behavior completely.
- if [ "${noauto}" != "on" ] ; then
- if [ "${p_systemd_nofail}" = "off" ] ; then
- requiredby="local-fs.target"
- before="${before} local-fs.target"
- else
- wantedby="local-fs.target"
- if [ "${p_systemd_nofail}" != "on" ] ; then
- before="${before} local-fs.target"
- fi
- fi
- fi
-
- # Handle existing files:
- # 1. We never overwrite existing files, although we may delete
- # files if we're sure they were created by us. (see 5.)
- # 2. We handle files differently based on canmount. Units with canmount=on
- # always have precedence over noauto. This is enforced by the sort pipe
- # in the loop around this function.
- # It is important to use $p_canmount and not $noauto here, since we
- # sort by canmount while other properties also modify $noauto, e.g.
- # org.openzfs.systemd:wanted-by.
- # 3. If no unit file exists for a noauto dataset, we create one.
- # Additionally, we use $noauto_files to track the unit file names
- # (which are the systemd-escaped mountpoints) of all (exclusively)
- # noauto datasets that had a file created.
- # 4. If the file to be created is found in the tracking variable,
- # we do NOT create it.
- # 5. If a file exists for a noauto dataset, we check whether the file
- # name is in the variable. If it is, we have multiple noauto datasets
- # for the same mountpoint. In such cases, we remove the file for safety.
- # To avoid further noauto datasets creating a file for this path again,
- # we leave the file name in the tracking variable.
- if [ -e "${dest_norm}/${mountfile}" ] ; then
- if is_known "$mountfile" "$noauto_files" ; then
- # if it's in $noauto_files, we must be noauto too. See 2.
- printf 'zfs-mount-generator: removing duplicate noauto %s\n' \
- "${mountfile}" >/dev/kmsg
- # See 5.
- rm "${dest_norm}/${mountfile}"
- else
- # don't log for canmount=noauto
- if [ "${p_canmount}" = "on" ] ; then
- printf 'zfs-mount-generator: %s already exists. Skipping.\n' \
- "${mountfile}" >/dev/kmsg
- fi
- fi
- # file exists; Skip current dataset.
- return
- else
- if is_known "${mountfile}" "${noauto_files}" ; then
- # See 4.
- return
- elif [ "${p_canmount}" = "noauto" ] ; then
- noauto_files="${mountfile} ${noauto_files}"
- fi
- fi
-
- # Create the .mount unit file.
- #
- # (Do not use `<<EOF`-style here-documents for this, see warning above)
- #
- echo \
-"# Automatically generated by zfs-mount-generator
-
-[Unit]
-SourcePath=${cachefile}
-Documentation=man:zfs-mount-generator(8)
-
-Before=${before}
-After=${after}
-Wants=${wants}
-${bindsto}
-${requires}
-${requiredmounts}
-
-[Mount]
-Where=${p_mountpoint}
-What=${dataset}
-Type=zfs
-Options=defaults${opts},zfsutil" > "${dest_norm}/${mountfile}"
-
- # Finally, create the appropriate dependencies
- create_dependencies "${mountfile}" "wants" "$wantedby"
- create_dependencies "${mountfile}" "requires" "$requiredby"
-
-}
-
-for cachefile in "${FSLIST}/"* ; do
- # Disable glob expansion to protect against special characters when parsing.
- set -f
- # Sort cachefile's lines by canmount, "on" before "noauto"
- # and feed each line into process_line
- sort -t "$(printf '\t')" -k 3 -r "${cachefile}" | \
- ( # subshell is necessary for `sort|while read` and $noauto_files
- noauto_files=""
- while read -r fs ; do
- process_line "${fs}"
- done
- )
-done
diff --git a/sys/contrib/openzfs/etc/systemd/system/zfs-import-cache.service.in b/sys/contrib/openzfs/etc/systemd/system/zfs-import-cache.service.in
index 0d236fe9e468..b09961a8bb84 100644
--- a/sys/contrib/openzfs/etc/systemd/system/zfs-import-cache.service.in
+++ b/sys/contrib/openzfs/etc/systemd/system/zfs-import-cache.service.in
@@ -14,7 +14,7 @@ ConditionPathIsDirectory=/sys/module/zfs
[Service]
Type=oneshot
RemainAfterExit=yes
-ExecStart=@sbindir@/zpool import -c @sysconfdir@/zfs/zpool.cache -aN
+ExecStart=@sbindir@/zpool import -c @sysconfdir@/zfs/zpool.cache -aN ${ZPOOL_IMPORT_OPTS}
[Install]
WantedBy=zfs-import.target
diff --git a/sys/contrib/openzfs/etc/systemd/system/zfs-import-scan.service.in b/sys/contrib/openzfs/etc/systemd/system/zfs-import-scan.service.in
index f0317e23e508..c1111c73a607 100644
--- a/sys/contrib/openzfs/etc/systemd/system/zfs-import-scan.service.in
+++ b/sys/contrib/openzfs/etc/systemd/system/zfs-import-scan.service.in
@@ -13,7 +13,7 @@ ConditionPathIsDirectory=/sys/module/zfs
[Service]
Type=oneshot
RemainAfterExit=yes
-ExecStart=@sbindir@/zpool import -aN -o cachefile=none
+ExecStart=@sbindir@/zpool import -aN -o cachefile=none ${ZPOOL_IMPORT_OPTS}
[Install]
WantedBy=zfs-import.target
diff --git a/sys/contrib/openzfs/etc/zfs/Makefile.am b/sys/contrib/openzfs/etc/zfs/Makefile.am
index b9123c176b93..3dee81c75860 100644
--- a/sys/contrib/openzfs/etc/zfs/Makefile.am
+++ b/sys/contrib/openzfs/etc/zfs/Makefile.am
@@ -1,4 +1,5 @@
include $(top_srcdir)/config/Substfiles.am
+include $(top_srcdir)/config/Shellcheck.am
pkgsysconfdir = $(sysconfdir)/zfs
@@ -13,3 +14,5 @@ pkgsysconf_SCRIPTS = \
zfs-functions
SUBSTFILES += $(pkgsysconf_SCRIPTS)
+
+SHELLCHECK_SHELL = dash # local variables
diff --git a/sys/contrib/openzfs/etc/zfs/zfs-functions.in b/sys/contrib/openzfs/etc/zfs/zfs-functions.in
index 54f2ebc0e7ea..2fb065afdb9a 100644
--- a/sys/contrib/openzfs/etc/zfs/zfs-functions.in
+++ b/sys/contrib/openzfs/etc/zfs/zfs-functions.in
@@ -5,10 +5,8 @@
#
# Released under the 2-clause BSD license.
#
-# The original script that acted as a template for this script came from
-# the Debian GNU/Linux kFreeBSD ZFS packages (which did not include a
-# licensing stansa) in the commit dated Mar 24, 2011:
-# https://github.com/zfsonlinux/pkg-zfs/commit/80a3ae582b59c0250d7912ba794dca9e669e605a
+# This script is based on debian/zfsutils.zfs.init from the
+# Debian GNU/kFreeBSD zfsutils 8.1-3 package, written by Aurelien Jarno.
PATH=/sbin:/bin:/usr/bin:/usr/sbin
@@ -20,7 +18,7 @@ elif [ -L /etc/init.d/functions.sh ]; then
# Gentoo
. /etc/init.d/functions.sh
elif [ -f /lib/lsb/init-functions ]; then
- # LSB, Debian GNU/Linux and derivatives
+ # LSB, Debian, and derivatives
. /lib/lsb/init-functions
fi
@@ -46,7 +44,7 @@ elif type success > /dev/null 2>&1 ; then
fi
}
- zfs_log_begin_msg() { echo -n "$1 "; }
+ zfs_log_begin_msg() { printf "%s" "$1 "; }
zfs_log_end_msg() {
zfs_set_ifs "$OLD_IFS"
if [ "$1" -eq 0 ]; then
@@ -63,17 +61,17 @@ elif type success > /dev/null 2>&1 ; then
echo
zfs_set_ifs "$TMP_IFS"
}
- zfs_log_progress_msg() { echo -n $"$1"; }
+ zfs_log_progress_msg() { printf "%s" "$""$1"; }
elif type einfo > /dev/null 2>&1 ; then
# Gentoo functions
zfs_log_begin_msg() { ebegin "$1"; }
zfs_log_end_msg() { eend "$1"; }
zfs_log_failure_msg() { eend "$1"; }
-# zfs_log_progress_msg() { echo -n "$1"; }
- zfs_log_progress_msg() { echo -n; }
+# zfs_log_progress_msg() { printf "%s" "$1"; }
+ zfs_log_progress_msg() { :; }
else
# Unknown - simple substitutes.
- zfs_log_begin_msg() { echo -n "$1"; }
+ zfs_log_begin_msg() { printf "%s" "$1"; }
zfs_log_end_msg() {
ret=$1
if [ "$ret" -ge 1 ]; then
@@ -84,7 +82,7 @@ else
return "$ret"
}
zfs_log_failure_msg() { echo "$1"; }
- zfs_log_progress_msg() { echo -n "$1"; }
+ zfs_log_progress_msg() { printf "%s" "$1"; }
fi
# Paths to what we need
@@ -136,27 +134,28 @@ zfs_daemon_start()
{
local PIDFILE="$1"; shift
local DAEMON_BIN="$1"; shift
- local DAEMON_ARGS="$*"
if type start-stop-daemon > /dev/null 2>&1 ; then
# LSB functions
start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
--exec "$DAEMON_BIN" --test > /dev/null || return 1
- start-stop-daemon --start --quiet --exec "$DAEMON_BIN" -- \
- $DAEMON_ARGS || return 2
+ # shellcheck disable=SC2086
+ start-stop-daemon --start --quiet --exec "$DAEMON_BIN" -- \
+ "$@" || return 2
- # On Debian GNU/Linux, there's a 'sendsigs' script that will
+ # On Debian, there's a 'sendsigs' script that will
# kill basically everything quite early and zed is stopped
# much later than that. We don't want zed to be among them,
# so add the zed pid to list of pids to ignore.
- if [ -f "$PIDFILE" -a -d /run/sendsigs.omit.d ]
+ if [ -f "$PIDFILE" ] && [ -d /run/sendsigs.omit.d ]
then
ln -sf "$PIDFILE" /run/sendsigs.omit.d/zed
fi
elif type daemon > /dev/null 2>&1 ; then
- # Fedora/RedHat functions
- daemon --pidfile "$PIDFILE" "$DAEMON_BIN" $DAEMON_ARGS
+ # Fedora/RedHat functions
+ # shellcheck disable=SC2086
+ daemon --pidfile "$PIDFILE" "$DAEMON_BIN" "$@"
return $?
else
# Unsupported
@@ -182,15 +181,17 @@ zfs_daemon_stop()
# LSB functions
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
--pidfile "$PIDFILE" --name "$DAEMON_NAME"
- [ "$?" = 0 ] && rm -f "$PIDFILE"
+ ret="$?"
+ [ "$ret" = 0 ] && rm -f "$PIDFILE"
- return $?
+ return "$ret"
elif type killproc > /dev/null 2>&1 ; then
# Fedora/RedHat functions
killproc -p "$PIDFILE" "$DAEMON_NAME"
- [ "$?" = 0 ] && rm -f "$PIDFILE"
+ ret="$?"
+ [ "$ret" = 0 ] && rm -f "$PIDFILE"
- return $?
+ return "$ret"
else
# Unsupported
return 3
@@ -234,7 +235,7 @@ zfs_daemon_reload()
return $?
elif type killproc > /dev/null 2>&1 ; then
# Fedora/RedHat functions
- killproc -p "$PIDFILE" "$DAEMON_NAME" -HUP
+ killproc -p "$PIDFILE" "$DAEMON_NAME" -HUP
return $?
else
# Unsupported
@@ -287,6 +288,7 @@ checksystem()
# HOWEVER, only do this if we're called at the boot up
# (from init), not if we're running interactively (as in
# from the shell - we know what we're doing).
+ # shellcheck disable=SC2154
[ -n "$init" ] && exit 3
fi
@@ -301,6 +303,7 @@ checksystem()
get_root_pool()
{
+ # shellcheck disable=SC2046
set -- $(mount | grep ' on / ')
[ "$5" = "zfs" ] && echo "${1%%/*}"
}
@@ -338,9 +341,10 @@ load_module()
read_mtab()
{
local match="$1"
- local fs mntpnt fstype opts rest TMPFILE
+ local fs mntpnt fstype opts rest
# Unset all MTAB_* variables
+ # shellcheck disable=SC2046
unset $(env | grep ^MTAB_ | sed 's,=.*,,')
while read -r fs mntpnt fstype opts rest; do
@@ -352,8 +356,8 @@ read_mtab()
# * We need to use the external echo, because the
# internal one would interpret the backslash code
# (incorrectly), giving us a  instead.
- mntpnt=$(/bin/echo "$mntpnt" | sed "s,\\\0,\\\00,g")
- fs=$(/bin/echo "$fs" | sed "s,\\\0,\\\00,")
+ mntpnt=$(/bin/echo "$mntpnt" | sed 's,\\0,\\00,g')
+ fs=$(/bin/echo "$fs" | sed 's,\\0,\\00,')
# Remove 'unwanted' characters.
mntpnt=$(printf '%b\n' "$mntpnt" | sed -e 's,/,,g' \
@@ -361,7 +365,7 @@ read_mtab()
fs=$(printf '%b\n' "$fs")
# Set the variable.
- eval export MTAB_$mntpnt=\"$fs\"
+ eval export "MTAB_$mntpnt=\"$fs\""
fi
done < /proc/self/mounts
}
@@ -371,10 +375,10 @@ in_mtab()
local mntpnt="$1"
# Remove 'unwanted' characters.
mntpnt=$(printf '%b\n' "$mntpnt" | sed -e 's,/,,g' \
- -e 's,-,,g' -e 's,\.,,g' -e 's, ,,g')
+ -e 's,-,,g' -e 's,\.,,g' -e 's, ,,g')
local var
- var="$(eval echo MTAB_$mntpnt)"
+ var="$(eval echo "MTAB_$mntpnt")"
[ "$(eval echo "$""$var")" != "" ]
return "$?"
}
@@ -383,21 +387,22 @@ in_mtab()
read_fstab()
{
local match="$1"
- local i var TMPFILE
+ local i var
# Unset all FSTAB_* variables
+ # shellcheck disable=SC2046
unset $(env | grep ^FSTAB_ | sed 's,=.*,,')
i=0
while read -r fs mntpnt fstype opts; do
- echo "$fs" | egrep -qE '^#|^$' && continue
- echo "$mntpnt" | egrep -qE '^none|^swap' && continue
- echo "$fstype" | egrep -qE '^swap' && continue
+ echo "$fs" | grep -qE '^#|^$' && continue
+ echo "$mntpnt" | grep -qE '^none|^swap' && continue
+ echo "$fstype" | grep -qE '^swap' && continue
if echo "$fs $mntpnt $fstype $opts" | grep -qE "$match"; then
- eval export FSTAB_dev_$i="$fs"
+ eval export "FSTAB_dev_$i=$fs"
fs=$(printf '%b\n' "$fs" | sed 's,/,_,g')
- eval export FSTAB_$i="$mntpnt"
+ eval export "FSTAB_$i=$mntpnt"
i=$((i + 1))
fi
@@ -408,7 +413,7 @@ in_fstab()
{
local var
- var="$(eval echo FSTAB_$1)"
+ var="$(eval echo "FSTAB_$1")"
[ "${var}" != "" ]
return $?
}
@@ -416,19 +421,11 @@ in_fstab()
is_mounted()
{
local mntpt="$1"
- local line
-
- mount | \
- while read line; do
- if echo "$line" | grep -q " on $mntpt "; then
- # returns:
- # 0 on unsuccessful match
- # 1 on a successful match
- return 1
- fi
- done
+ local mp
+
+ while read -r _ mp _; do
+ [ "$mp" = "$mntpt" ] && return 0
+ done < /proc/self/mounts
- # The negation will flip the subshell return result where the default
- # return value is 0 when a match is not found.
- return $(( !$? ))
+ return 1
}
diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am b/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am
index 4bb9beffc723..232aaf569fa2 100644
--- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am
+++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am
@@ -68,6 +68,7 @@ KERNEL_H = \
vmsystm.h \
vnode_impl.h \
vnode.h \
+ wmsum.h \
zmod.h \
zone.h
diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/kstat.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/kstat.h
index f5157c7f4fe3..947dfee62393 100644
--- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/kstat.h
+++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/kstat.h
@@ -210,10 +210,6 @@ extern kstat_t *__kstat_create(const char *ks_module, int ks_instance,
extern void __kstat_install(kstat_t *ksp);
extern void __kstat_delete(kstat_t *ksp);
-extern void kstat_waitq_enter(kstat_io_t *);
-extern void kstat_waitq_exit(kstat_io_t *);
-extern void kstat_runq_enter(kstat_io_t *);
-extern void kstat_runq_exit(kstat_io_t *);
#define kstat_set_seq_raw_ops(k, h, d, a) \
__kstat_set_seq_raw_ops(k, h, d, a)
diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/wmsum.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/wmsum.h
new file mode 100644
index 000000000000..9fdd1901b7ee
--- /dev/null
+++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/wmsum.h
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * wmsum counters are a reduced version of aggsum counters, optimized for
+ * write-mostly scenarios. They do not provide optimized read functions,
+ * but instead allow much cheaper add function. The primary usage is
+ * infrequently read statistic counters, not requiring exact precision.
+ *
+ * The FreeBSD implementation is directly mapped into counter(9) KPI.
+ */
+
+#ifndef _SYS_WMSUM_H
+#define _SYS_WMSUM_H
+
+#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/counter.h>
+#include <sys/malloc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define wmsum_t counter_u64_t
+
+static inline void
+wmsum_init(wmsum_t *ws, uint64_t value)
+{
+
+ *ws = counter_u64_alloc(M_WAITOK);
+ counter_u64_add(*ws, value);
+}
+
+static inline void
+wmsum_fini(wmsum_t *ws)
+{
+
+ counter_u64_free(*ws);
+}
+
+static inline uint64_t
+wmsum_value(wmsum_t *ws)
+{
+
+ return (counter_u64_fetch(*ws));
+}
+
+static inline void
+wmsum_add(wmsum_t *ws, int64_t delta)
+{
+
+ counter_u64_add(*ws, delta);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_WMSUM_H */
diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/Makefile.am b/sys/contrib/openzfs/include/os/linux/spl/sys/Makefile.am
index a5b0d78e8bd7..48c27f970fc9 100644
--- a/sys/contrib/openzfs/include/os/linux/spl/sys/Makefile.am
+++ b/sys/contrib/openzfs/include/os/linux/spl/sys/Makefile.am
@@ -54,6 +54,7 @@ KERNEL_H = \
vmsystm.h \
vnode.h \
wait.h \
+ wmsum.h \
zmod.h \
zone.h
diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/atomic.h b/sys/contrib/openzfs/include/os/linux/spl/sys/atomic.h
index 2d21cbb3e140..8f7fa5aeda11 100644
--- a/sys/contrib/openzfs/include/os/linux/spl/sys/atomic.h
+++ b/sys/contrib/openzfs/include/os/linux/spl/sys/atomic.h
@@ -48,6 +48,8 @@
#define atomic_sub_32_nv(v, i) atomic_sub_return((i), (atomic_t *)(v))
#define atomic_cas_32(v, x, y) atomic_cmpxchg((atomic_t *)(v), x, y)
#define atomic_swap_32(v, x) atomic_xchg((atomic_t *)(v), x)
+#define atomic_load_32(v) atomic_read((atomic_t *)(v))
+#define atomic_store_32(v, x) atomic_set((atomic_t *)(v), x)
#define atomic_inc_64(v) atomic64_inc((atomic64_t *)(v))
#define atomic_dec_64(v) atomic64_dec((atomic64_t *)(v))
#define atomic_add_64(v, i) atomic64_add((i), (atomic64_t *)(v))
@@ -58,6 +60,8 @@
#define atomic_sub_64_nv(v, i) atomic64_sub_return((i), (atomic64_t *)(v))
#define atomic_cas_64(v, x, y) atomic64_cmpxchg((atomic64_t *)(v), x, y)
#define atomic_swap_64(v, x) atomic64_xchg((atomic64_t *)(v), x)
+#define atomic_load_64(v) atomic64_read((atomic64_t *)(v))
+#define atomic_store_64(v, x) atomic64_set((atomic64_t *)(v), x)
#ifdef _LP64
static __inline__ void *
diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/kstat.h b/sys/contrib/openzfs/include/os/linux/spl/sys/kstat.h
index 905d8257c8d3..928f70757545 100644
--- a/sys/contrib/openzfs/include/os/linux/spl/sys/kstat.h
+++ b/sys/contrib/openzfs/include/os/linux/spl/sys/kstat.h
@@ -206,10 +206,6 @@ extern void kstat_proc_entry_install(kstat_proc_entry_t *kpep, mode_t mode,
extern void __kstat_install(kstat_t *ksp);
extern void __kstat_delete(kstat_t *ksp);
-extern void kstat_waitq_enter(kstat_io_t *);
-extern void kstat_waitq_exit(kstat_io_t *);
-extern void kstat_runq_enter(kstat_io_t *);
-extern void kstat_runq_exit(kstat_io_t *);
#define kstat_set_raw_ops(k, h, d, a) \
__kstat_set_raw_ops(k, h, d, a)
diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/wmsum.h b/sys/contrib/openzfs/include/os/linux/spl/sys/wmsum.h
new file mode 100644
index 000000000000..0871bd69504c
--- /dev/null
+++ b/sys/contrib/openzfs/include/os/linux/spl/sys/wmsum.h
@@ -0,0 +1,76 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * wmsum counters are a reduced version of aggsum counters, optimized for
+ * write-mostly scenarios. They do not provide optimized read functions,
+ * but instead allow much cheaper add function. The primary usage is
+ * infrequently read statistic counters, not requiring exact precision.
+ *
+ * The Linux implementation is directly mapped into percpu_counter KPI.
+ */
+
+#ifndef _SYS_WMSUM_H
+#define _SYS_WMSUM_H
+
+#include <linux/percpu_counter.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct percpu_counter wmsum_t;
+
+static inline void
+wmsum_init(wmsum_t *ws, uint64_t value)
+{
+
+#ifdef HAVE_PERCPU_COUNTER_INIT_WITH_GFP
+ percpu_counter_init(ws, value, GFP_KERNEL);
+#else
+ percpu_counter_init(ws, value);
+#endif
+}
+
+static inline void
+wmsum_fini(wmsum_t *ws)
+{
+
+ percpu_counter_destroy(ws);
+}
+
+static inline uint64_t
+wmsum_value(wmsum_t *ws)
+{
+
+ return (percpu_counter_sum(ws));
+}
+
+static inline void
+wmsum_add(wmsum_t *ws, int64_t delta)
+{
+
+#ifdef HAVE_PERCPU_COUNTER_ADD_BATCH
+ percpu_counter_add_batch(ws, delta, INT_MAX / 2);
+#else
+ __percpu_counter_add(ws, delta, INT_MAX / 2);
+#endif
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_WMSUM_H */
diff --git a/sys/contrib/openzfs/include/sys/aggsum.h b/sys/contrib/openzfs/include/sys/aggsum.h
index cb43727f1df4..65800058cbf6 100644
--- a/sys/contrib/openzfs/include/sys/aggsum.h
+++ b/sys/contrib/openzfs/include/sys/aggsum.h
@@ -39,15 +39,16 @@ struct aggsum_bucket {
typedef struct aggsum {
kmutex_t as_lock;
int64_t as_lower_bound;
- int64_t as_upper_bound;
+ uint64_t as_upper_bound;
+ aggsum_bucket_t *as_buckets ____cacheline_aligned;
uint_t as_numbuckets;
- aggsum_bucket_t *as_buckets;
+ uint_t as_bucketshift;
} aggsum_t;
void aggsum_init(aggsum_t *, uint64_t);
void aggsum_fini(aggsum_t *);
int64_t aggsum_lower_bound(aggsum_t *);
-int64_t aggsum_upper_bound(aggsum_t *);
+uint64_t aggsum_upper_bound(aggsum_t *);
int aggsum_compare(aggsum_t *, uint64_t);
uint64_t aggsum_value(aggsum_t *);
void aggsum_add(aggsum_t *, int64_t);
diff --git a/sys/contrib/openzfs/include/sys/arc_impl.h b/sys/contrib/openzfs/include/sys/arc_impl.h
index 94123fc10e67..c01da46e01e3 100644
--- a/sys/contrib/openzfs/include/sys/arc_impl.h
+++ b/sys/contrib/openzfs/include/sys/arc_impl.h
@@ -74,20 +74,20 @@ typedef struct arc_state {
/*
* list of evictable buffers
*/
- multilist_t *arcs_list[ARC_BUFC_NUMTYPES];
+ multilist_t arcs_list[ARC_BUFC_NUMTYPES];
+ /*
+ * supports the "dbufs" kstat
+ */
+ arc_state_type_t arcs_state;
/*
* total amount of evictable data in this state
*/
- zfs_refcount_t arcs_esize[ARC_BUFC_NUMTYPES];
+ zfs_refcount_t arcs_esize[ARC_BUFC_NUMTYPES] ____cacheline_aligned;
/*
* total amount of data in this state; this includes: evictable,
* non-evictable, ARC_BUFC_DATA, and ARC_BUFC_METADATA.
*/
zfs_refcount_t arcs_size;
- /*
- * supports the "dbufs" kstat
- */
- arc_state_type_t arcs_state;
} arc_state_t;
typedef struct arc_callback arc_callback_t;
diff --git a/sys/contrib/openzfs/include/sys/dataset_kstats.h b/sys/contrib/openzfs/include/sys/dataset_kstats.h
index 667d1b85fa2c..b165b98576dd 100644
--- a/sys/contrib/openzfs/include/sys/dataset_kstats.h
+++ b/sys/contrib/openzfs/include/sys/dataset_kstats.h
@@ -27,18 +27,18 @@
#ifndef _SYS_DATASET_KSTATS_H
#define _SYS_DATASET_KSTATS_H
-#include <sys/aggsum.h>
+#include <sys/wmsum.h>
#include <sys/dmu.h>
#include <sys/kstat.h>
-typedef struct dataset_aggsum_stats_t {
- aggsum_t das_writes;
- aggsum_t das_nwritten;
- aggsum_t das_reads;
- aggsum_t das_nread;
- aggsum_t das_nunlinks;
- aggsum_t das_nunlinked;
-} dataset_aggsum_stats_t;
+typedef struct dataset_sum_stats_t {
+ wmsum_t dss_writes;
+ wmsum_t dss_nwritten;
+ wmsum_t dss_reads;
+ wmsum_t dss_nread;
+ wmsum_t dss_nunlinks;
+ wmsum_t dss_nunlinked;
+} dataset_sum_stats_t;
typedef struct dataset_kstat_values {
kstat_named_t dkv_ds_name;
@@ -59,7 +59,7 @@ typedef struct dataset_kstat_values {
} dataset_kstat_values_t;
typedef struct dataset_kstats {
- dataset_aggsum_stats_t dk_aggsums;
+ dataset_sum_stats_t dk_sums;
kstat_t *dk_kstats;
} dataset_kstats_t;
diff --git a/sys/contrib/openzfs/include/sys/dmu_objset.h b/sys/contrib/openzfs/include/sys/dmu_objset.h
index a8cb812714ec..e89ee64ea686 100644
--- a/sys/contrib/openzfs/include/sys/dmu_objset.h
+++ b/sys/contrib/openzfs/include/sys/dmu_objset.h
@@ -153,7 +153,7 @@ struct objset {
/* no lock needed: */
struct dmu_tx *os_synctx; /* XXX sketchy */
zil_header_t os_zil_header;
- multilist_t *os_synced_dnodes;
+ multilist_t os_synced_dnodes;
uint64_t os_flags;
uint64_t os_freed_dnodes;
boolean_t os_rescan_dnodes;
@@ -172,7 +172,7 @@ struct objset {
/* Protected by os_lock */
kmutex_t os_lock;
- multilist_t *os_dirty_dnodes[TXG_SIZE];
+ multilist_t os_dirty_dnodes[TXG_SIZE];
list_t os_dnodes;
list_t os_downgraded_dbufs;
diff --git a/sys/contrib/openzfs/include/sys/metaslab_impl.h b/sys/contrib/openzfs/include/sys/metaslab_impl.h
index 3be0c466c403..9924c3ba0eaa 100644
--- a/sys/contrib/openzfs/include/sys/metaslab_impl.h
+++ b/sys/contrib/openzfs/include/sys/metaslab_impl.h
@@ -206,7 +206,7 @@ struct metaslab_class {
* List of all loaded metaslabs in the class, sorted in order of most
* recent use.
*/
- multilist_t *mc_metaslab_txg_list;
+ multilist_t mc_metaslab_txg_list;
metaslab_class_allocator_t mc_allocator[];
};
diff --git a/sys/contrib/openzfs/include/sys/multilist.h b/sys/contrib/openzfs/include/sys/multilist.h
index 0c7b4075d9a3..26f37c37ab38 100644
--- a/sys/contrib/openzfs/include/sys/multilist.h
+++ b/sys/contrib/openzfs/include/sys/multilist.h
@@ -71,8 +71,9 @@ struct multilist {
multilist_sublist_index_func_t *ml_index_func;
};
+void multilist_create(multilist_t *, size_t, size_t,
+ multilist_sublist_index_func_t *);
void multilist_destroy(multilist_t *);
-multilist_t *multilist_create(size_t, size_t, multilist_sublist_index_func_t *);
void multilist_insert(multilist_t *, void *);
void multilist_remove(multilist_t *, void *);
diff --git a/sys/contrib/openzfs/include/sys/spa.h b/sys/contrib/openzfs/include/sys/spa.h
index c960478efe50..9dd47a1ebece 100644
--- a/sys/contrib/openzfs/include/sys/spa.h
+++ b/sys/contrib/openzfs/include/sys/spa.h
@@ -916,7 +916,6 @@ typedef struct spa_stats {
spa_history_list_t read_history;
spa_history_list_t txg_history;
spa_history_kstat_t tx_assign_histogram;
- spa_history_kstat_t io_history;
spa_history_list_t mmp_history;
spa_history_kstat_t state; /* pool state */
spa_history_kstat_t iostats;
diff --git a/sys/contrib/openzfs/include/sys/zfs_context.h b/sys/contrib/openzfs/include/sys/zfs_context.h
index 3fb390c3f6e3..ffb20e1fefad 100644
--- a/sys/contrib/openzfs/include/sys/zfs_context.h
+++ b/sys/contrib/openzfs/include/sys/zfs_context.h
@@ -362,12 +362,6 @@ extern kstat_t *kstat_create(const char *, int,
const char *, const char *, uchar_t, ulong_t, uchar_t);
extern void kstat_install(kstat_t *);
extern void kstat_delete(kstat_t *);
-extern void kstat_waitq_enter(kstat_io_t *);
-extern void kstat_waitq_exit(kstat_io_t *);
-extern void kstat_runq_enter(kstat_io_t *);
-extern void kstat_runq_exit(kstat_io_t *);
-extern void kstat_waitq_to_runq(kstat_io_t *);
-extern void kstat_runq_back_to_waitq(kstat_io_t *);
extern void kstat_set_raw_ops(kstat_t *ksp,
int (*headers)(char *buf, size_t size),
int (*data)(char *buf, size_t size, void *data),
diff --git a/sys/contrib/openzfs/include/sys/zfs_ioctl_impl.h b/sys/contrib/openzfs/include/sys/zfs_ioctl_impl.h
index 787475cf396c..5774e9e0e30c 100644
--- a/sys/contrib/openzfs/include/sys/zfs_ioctl_impl.h
+++ b/sys/contrib/openzfs/include/sys/zfs_ioctl_impl.h
@@ -82,6 +82,7 @@ void zfs_ioctl_register(const char *, zfs_ioc_t, zfs_ioc_func_t *,
boolean_t, boolean_t, const zfs_ioc_key_t *, size_t);
uint64_t zfs_max_nvlist_src_size_os(void);
+void zfs_ioctl_update_mount_cache(const char *dsname);
void zfs_ioctl_init_os(void);
boolean_t zfs_vfs_held(zfsvfs_t *);
diff --git a/sys/contrib/openzfs/lib/libnvpair/libnvpair_json.c b/sys/contrib/openzfs/lib/libnvpair/libnvpair_json.c
index 37a392391fb0..15b6f4afaf73 100644
--- a/sys/contrib/openzfs/lib/libnvpair/libnvpair_json.c
+++ b/sys/contrib/openzfs/lib/libnvpair/libnvpair_json.c
@@ -54,6 +54,13 @@ nvlist_print_json_string(FILE *fp, const char *input)
FPRINTF(fp, "\"");
while ((sz = mbrtowc(&c, input, MB_CUR_MAX, &mbr)) > 0) {
+ if (sz == (size_t)-1 || sz == (size_t)-2) {
+ /*
+ * We last read an invalid multibyte character sequence,
+ * so return an error.
+ */
+ return (-1);
+ }
switch (c) {
case '"':
FPRINTF(fp, "\\\"");
@@ -97,14 +104,6 @@ nvlist_print_json_string(FILE *fp, const char *input)
input += sz;
}
- if (sz == (size_t)-1 || sz == (size_t)-2) {
- /*
- * We last read an invalid multibyte character sequence,
- * so return an error.
- */
- return (-1);
- }
-
FPRINTF(fp, "\"");
return (0);
}
diff --git a/sys/contrib/openzfs/lib/libspl/asm-generic/atomic.c b/sys/contrib/openzfs/lib/libspl/asm-generic/atomic.c
index 35535ea49c79..504422b8e226 100644
--- a/sys/contrib/openzfs/lib/libspl/asm-generic/atomic.c
+++ b/sys/contrib/openzfs/lib/libspl/asm-generic/atomic.c
@@ -390,6 +390,19 @@ atomic_swap_ptr(volatile void *target, void *bits)
return (old);
}
+#ifndef _LP64
+uint64_t
+atomic_load_64(volatile uint64_t *target)
+{
+ return (__atomic_load_n(target, __ATOMIC_RELAXED));
+}
+
+void
+atomic_store_64(volatile uint64_t *target, uint64_t bits)
+{
+ return (__atomic_store_n(target, bits, __ATOMIC_RELAXED));
+}
+#endif
int
atomic_set_long_excl(volatile ulong_t *target, uint_t value)
diff --git a/sys/contrib/openzfs/lib/libspl/include/atomic.h b/sys/contrib/openzfs/lib/libspl/include/atomic.h
index f8c257f9696b..8dd1d654a486 100644
--- a/sys/contrib/openzfs/lib/libspl/include/atomic.h
+++ b/sys/contrib/openzfs/lib/libspl/include/atomic.h
@@ -246,6 +246,49 @@ extern uint64_t atomic_swap_64(volatile uint64_t *, uint64_t);
#endif
/*
+ * Atomically read variable.
+ */
+#define atomic_load_char(p) (*(volatile uchar_t *)(p))
+#define atomic_load_short(p) (*(volatile ushort_t *)(p))
+#define atomic_load_int(p) (*(volatile uint_t *)(p))
+#define atomic_load_long(p) (*(volatile ulong_t *)(p))
+#define atomic_load_ptr(p) (*(volatile __typeof(*p) *)(p))
+#define atomic_load_8(p) (*(volatile uint8_t *)(p))
+#define atomic_load_16(p) (*(volatile uint16_t *)(p))
+#define atomic_load_32(p) (*(volatile uint32_t *)(p))
+#ifdef _LP64
+#define atomic_load_64(p) (*(volatile uint64_t *)(p))
+#elif defined(_INT64_TYPE)
+extern uint64_t atomic_load_64(volatile uint64_t *);
+#endif
+
+/*
+ * Atomically write variable.
+ */
+#define atomic_store_char(p, v) \
+ (*(volatile uchar_t *)(p) = (uchar_t)(v))
+#define atomic_store_short(p, v) \
+ (*(volatile ushort_t *)(p) = (ushort_t)(v))
+#define atomic_store_int(p, v) \
+ (*(volatile uint_t *)(p) = (uint_t)(v))
+#define atomic_store_long(p, v) \
+ (*(volatile ulong_t *)(p) = (ulong_t)(v))
+#define atomic_store_ptr(p, v) \
+ (*(volatile __typeof(*p) *)(p) = (v))
+#define atomic_store_8(p, v) \
+ (*(volatile uint8_t *)(p) = (uint8_t)(v))
+#define atomic_store_16(p, v) \
+ (*(volatile uint16_t *)(p) = (uint16_t)(v))
+#define atomic_store_32(p, v) \
+ (*(volatile uint32_t *)(p) = (uint32_t)(v))
+#ifdef _LP64
+#define atomic_store_64(p, v) \
+ (*(volatile uint64_t *)(p) = (uint64_t)(v))
+#elif defined(_INT64_TYPE)
+extern void atomic_store_64(volatile uint64_t *, uint64_t);
+#endif
+
+/*
* Perform an exclusive atomic bit set/clear on a target.
* Returns 0 if bit was successfully set/cleared, or -1
* if the bit was already set/cleared.
diff --git a/sys/contrib/openzfs/lib/libspl/include/sys/Makefile.am b/sys/contrib/openzfs/lib/libspl/include/sys/Makefile.am
index 53a36f6bfbca..6816a012533f 100644
--- a/sys/contrib/openzfs/lib/libspl/include/sys/Makefile.am
+++ b/sys/contrib/openzfs/lib/libspl/include/sys/Makefile.am
@@ -44,4 +44,5 @@ libspl_HEADERS = \
varargs.h \
vnode.h \
vtoc.h \
+ wmsum.h \
zone.h
diff --git a/sys/contrib/openzfs/lib/libspl/include/sys/kstat.h b/sys/contrib/openzfs/lib/libspl/include/sys/kstat.h
index 69fb6d401fc7..f73fb92eb797 100644
--- a/sys/contrib/openzfs/lib/libspl/include/sys/kstat.h
+++ b/sys/contrib/openzfs/lib/libspl/include/sys/kstat.h
@@ -796,12 +796,6 @@ extern void kstat_delete_byname(const char *, int, const char *);
extern void kstat_delete_byname_zone(const char *, int, const char *, zoneid_t);
extern void kstat_named_init(kstat_named_t *, const char *, uchar_t);
extern void kstat_timer_init(kstat_timer_t *, const char *);
-extern void kstat_waitq_enter(kstat_io_t *);
-extern void kstat_waitq_exit(kstat_io_t *);
-extern void kstat_runq_enter(kstat_io_t *);
-extern void kstat_runq_exit(kstat_io_t *);
-extern void kstat_waitq_to_runq(kstat_io_t *);
-extern void kstat_runq_back_to_waitq(kstat_io_t *);
extern void kstat_timer_start(kstat_timer_t *);
extern void kstat_timer_stop(kstat_timer_t *);
diff --git a/sys/contrib/openzfs/lib/libspl/include/sys/wmsum.h b/sys/contrib/openzfs/lib/libspl/include/sys/wmsum.h
new file mode 100644
index 000000000000..0679af73ce91
--- /dev/null
+++ b/sys/contrib/openzfs/lib/libspl/include/sys/wmsum.h
@@ -0,0 +1,68 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * wmsum counters are a reduced version of aggsum counters, optimized for
+ * write-mostly scenarios. They do not provide optimized read functions,
+ * but instead allow much cheaper add function. The primary usage is
+ * infrequently read statistic counters, not requiring exact precision.
+ *
+ * In user-space due to lack of better implementation mapped to aggsum.
+ */
+
+#ifndef _SYS_WMSUM_H
+#define _SYS_WMSUM_H
+
+#include <sys/aggsum.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define wmsum_t aggsum_t
+
+static inline void
+wmsum_init(wmsum_t *ws, uint64_t value)
+{
+
+ aggsum_init(ws, value);
+}
+
+static inline void
+wmsum_fini(wmsum_t *ws)
+{
+
+ aggsum_fini(ws);
+}
+
+static inline uint64_t
+wmsum_value(wmsum_t *ws)
+{
+
+ return (aggsum_value(ws));
+}
+
+static inline void
+wmsum_add(wmsum_t *ws, int64_t delta)
+{
+
+ aggsum_add(ws, delta);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_WMSUM_H */
diff --git a/sys/contrib/openzfs/lib/libspl/os/freebsd/mnttab.c b/sys/contrib/openzfs/lib/libspl/os/freebsd/mnttab.c
index 5b9e6429d9e3..bd3e3e4e3eef 100644
--- a/sys/contrib/openzfs/lib/libspl/os/freebsd/mnttab.c
+++ b/sys/contrib/openzfs/lib/libspl/os/freebsd/mnttab.c
@@ -140,14 +140,14 @@ statfs_init(void)
free(gsfs);
gsfs = NULL;
}
- allfs = getfsstat(NULL, 0, MNT_WAIT);
+ allfs = getfsstat(NULL, 0, MNT_NOWAIT);
if (allfs == -1)
goto fail;
gsfs = malloc(sizeof (gsfs[0]) * allfs * 2);
if (gsfs == NULL)
goto fail;
allfs = getfsstat(gsfs, (long)(sizeof (gsfs[0]) * allfs * 2),
- MNT_WAIT);
+ MNT_NOWAIT);
if (allfs == -1)
goto fail;
sfs = realloc(gsfs, allfs * sizeof (gsfs[0]));
diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c b/sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c
index e734189478b3..2accfff28a6e 100644
--- a/sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c
+++ b/sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c
@@ -1261,9 +1261,9 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
intval > maxbs || !ISP2(intval))) {
zfs_nicebytes(maxbs, buf, sizeof (buf));
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
- "invalid '%s=%d' property: must be zero or "
- "a power of 2 from 512B to %s"), propname,
- intval, buf);
+ "invalid '%s=%llu' property: must be zero "
+ "or a power of 2 from 512B to %s"),
+ propname, (unsigned long long)intval, buf);
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
goto error;
}
@@ -4835,8 +4835,6 @@ zfs_userspace(zfs_handle_t *zhp, zfs_userquota_prop_t type,
zc.zc_nvlist_dst_size = sizeof (buf);
if (zfs_ioctl(hdl, ZFS_IOC_USERSPACE_MANY, &zc) != 0) {
- char errbuf[1024];
-
if ((errno == ENOTSUP &&
(type == ZFS_PROP_USEROBJUSED ||
type == ZFS_PROP_GROUPOBJUSED ||
@@ -4848,10 +4846,9 @@ zfs_userspace(zfs_handle_t *zhp, zfs_userquota_prop_t type,
type == ZFS_PROP_PROJECTQUOTA)))
break;
- (void) snprintf(errbuf, sizeof (errbuf),
+ return (zfs_standard_error_fmt(hdl, errno,
dgettext(TEXT_DOMAIN,
- "cannot get used/quota for %s"), zc.zc_name);
- return (zfs_standard_error_fmt(hdl, errno, errbuf));
+ "cannot get used/quota for %s"), zc.zc_name));
}
if (zc.zc_nvlist_dst_size == 0)
break;
@@ -5080,7 +5077,7 @@ zfs_release(zfs_handle_t *zhp, const char *snapname, const char *tag,
(void) zfs_error(hdl, EZFS_BADVERSION, errbuf);
break;
default:
- (void) zfs_standard_error_fmt(hdl, errno, errbuf);
+ (void) zfs_standard_error(hdl, errno, errbuf);
}
}
@@ -5099,7 +5096,7 @@ zfs_release(zfs_handle_t *zhp, const char *snapname, const char *tag,
(void) zfs_error(hdl, EZFS_BADTYPE, errbuf);
break;
default:
- (void) zfs_standard_error_fmt(hdl,
+ (void) zfs_standard_error(hdl,
fnvpair_value_int32(elem), errbuf);
}
}
@@ -5156,17 +5153,16 @@ tryagain:
err = zfs_error(hdl, EZFS_NOENT, errbuf);
break;
default:
- err = zfs_standard_error_fmt(hdl, errno, errbuf);
+ err = zfs_standard_error(hdl, errno, errbuf);
break;
}
} else {
/* success */
int rc = nvlist_unpack(nvbuf, zc.zc_nvlist_dst_size, nvl, 0);
if (rc) {
- (void) snprintf(errbuf, sizeof (errbuf), dgettext(
+ err = zfs_standard_error_fmt(hdl, rc, dgettext(
TEXT_DOMAIN, "cannot get permissions on '%s'"),
zc.zc_name);
- err = zfs_standard_error_fmt(hdl, rc, errbuf);
}
}
@@ -5219,7 +5215,7 @@ zfs_set_fsacl(zfs_handle_t *zhp, boolean_t un, nvlist_t *nvl)
err = zfs_error(hdl, EZFS_NOENT, errbuf);
break;
default:
- err = zfs_standard_error_fmt(hdl, errno, errbuf);
+ err = zfs_standard_error(hdl, errno, errbuf);
break;
}
}
@@ -5256,7 +5252,7 @@ zfs_get_holds(zfs_handle_t *zhp, nvlist_t **nvl)
err = zfs_error(hdl, EZFS_NOENT, errbuf);
break;
default:
- err = zfs_standard_error_fmt(hdl, errno, errbuf);
+ err = zfs_standard_error(hdl, errno, errbuf);
break;
}
}
diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_diff.c b/sys/contrib/openzfs/lib/libzfs/libzfs_diff.c
index 12e079b0eeb7..d46e23a2fc0e 100644
--- a/sys/contrib/openzfs/lib/libzfs/libzfs_diff.c
+++ b/sys/contrib/openzfs/lib/libzfs/libzfs_diff.c
@@ -243,6 +243,7 @@ write_inuse_diffs_one(FILE *fp, differ_info_t *di, uint64_t dobj)
struct zfs_stat fsb, tsb;
mode_t fmode, tmode;
char fobjname[MAXPATHLEN], tobjname[MAXPATHLEN];
+ boolean_t already_logged = B_FALSE;
int fobjerr, tobjerr;
int change;
@@ -254,22 +255,36 @@ write_inuse_diffs_one(FILE *fp, differ_info_t *di, uint64_t dobj)
* we get ENOENT, then the object just didn't exist in that
* snapshot. If we get ENOTSUP, then we tried to get
* info on a non-ZPL object, which we don't care about anyway.
+ * For any other error we print a warning which includes the
+ * errno and continue.
*/
+
fobjerr = get_stats_for_obj(di, di->fromsnap, dobj, fobjname,
MAXPATHLEN, &fsb);
- if (fobjerr && di->zerr != ENOENT && di->zerr != ENOTSUP)
- return (-1);
+ if (fobjerr && di->zerr != ENOTSUP && di->zerr != ENOENT) {
+ zfs_error_aux(di->zhp->zfs_hdl, "%s", strerror(di->zerr));
+ zfs_error(di->zhp->zfs_hdl, di->zerr, di->errbuf);
+ /*
+ * Let's not print an error for the same object more than
+ * once if it happens in both snapshots
+ */
+ already_logged = B_TRUE;
+ }
tobjerr = get_stats_for_obj(di, di->tosnap, dobj, tobjname,
MAXPATHLEN, &tsb);
- if (tobjerr && di->zerr != ENOENT && di->zerr != ENOTSUP)
- return (-1);
+ if (tobjerr && di->zerr != ENOTSUP && di->zerr != ENOENT) {
+ if (!already_logged) {
+ zfs_error_aux(di->zhp->zfs_hdl,
+ "%s", strerror(di->zerr));
+ zfs_error(di->zhp->zfs_hdl, di->zerr, di->errbuf);
+ }
+ }
/*
* Unallocated object sharing the same meta dnode block
*/
if (fobjerr && tobjerr) {
- ASSERT(di->zerr == ENOENT || di->zerr == ENOTSUP);
di->zerr = 0;
return (0);
}
@@ -344,12 +359,11 @@ describe_free(FILE *fp, differ_info_t *di, uint64_t object, char *namebuf,
{
struct zfs_stat sb;
- if (get_stats_for_obj(di, di->fromsnap, object, namebuf,
- maxlen, &sb) != 0) {
- return (-1);
- }
+ (void) get_stats_for_obj(di, di->fromsnap, object, namebuf,
+ maxlen, &sb);
+
/* Don't print if in the delete queue on from side */
- if (di->zerr == ESTALE) {
+ if (di->zerr == ESTALE || di->zerr == ENOENT) {
di->zerr = 0;
return (0);
}
@@ -384,8 +398,6 @@ write_free_diffs(FILE *fp, differ_info_t *di, dmu_diff_record_t *dr)
}
err = describe_free(fp, di, zc.zc_obj, fobjname,
MAXPATHLEN);
- if (err)
- break;
} else if (errno == ESRCH) {
break;
} else {
@@ -732,7 +744,7 @@ zfs_show_diffs(zfs_handle_t *zhp, int outfd, const char *fromsnap,
}
if (pipe2(pipefd, O_CLOEXEC)) {
- zfs_error_aux(zhp->zfs_hdl, strerror(errno));
+ zfs_error_aux(zhp->zfs_hdl, "%s", strerror(errno));
teardown_differ_info(&di);
return (zfs_error(zhp->zfs_hdl, EZFS_PIPEFAILED, errbuf));
}
@@ -745,7 +757,7 @@ zfs_show_diffs(zfs_handle_t *zhp, int outfd, const char *fromsnap,
di.datafd = pipefd[0];
if (pthread_create(&tid, NULL, differ, &di)) {
- zfs_error_aux(zhp->zfs_hdl, strerror(errno));
+ zfs_error_aux(zhp->zfs_hdl, "%s", strerror(errno));
(void) close(pipefd[0]);
(void) close(pipefd[1]);
teardown_differ_info(&di);
@@ -771,14 +783,14 @@ zfs_show_diffs(zfs_handle_t *zhp, int outfd, const char *fromsnap,
zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
"\n Not an earlier snapshot from the same fs"));
} else if (errno != EPIPE || di.zerr == 0) {
- zfs_error_aux(zhp->zfs_hdl, strerror(errno));
+ zfs_error_aux(zhp->zfs_hdl, "%s", strerror(errno));
}
(void) close(pipefd[1]);
(void) pthread_cancel(tid);
(void) pthread_join(tid, NULL);
teardown_differ_info(&di);
if (di.zerr != 0 && di.zerr != EPIPE) {
- zfs_error_aux(zhp->zfs_hdl, strerror(di.zerr));
+ zfs_error_aux(zhp->zfs_hdl, "%s", strerror(di.zerr));
return (zfs_error(zhp->zfs_hdl, EZFS_DIFF, di.errbuf));
} else {
return (zfs_error(zhp->zfs_hdl, EZFS_DIFFDATA, errbuf));
@@ -789,7 +801,7 @@ zfs_show_diffs(zfs_handle_t *zhp, int outfd, const char *fromsnap,
(void) pthread_join(tid, NULL);
if (di.zerr != 0) {
- zfs_error_aux(zhp->zfs_hdl, strerror(di.zerr));
+ zfs_error_aux(zhp->zfs_hdl, "%s", strerror(di.zerr));
return (zfs_error(zhp->zfs_hdl, EZFS_DIFF, di.errbuf));
}
teardown_differ_info(&di);
diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_mount.c b/sys/contrib/openzfs/lib/libzfs/libzfs_mount.c
index d3f7e6106c6b..d7c728f3fcb0 100644
--- a/sys/contrib/openzfs/lib/libzfs/libzfs_mount.c
+++ b/sys/contrib/openzfs/lib/libzfs/libzfs_mount.c
@@ -538,19 +538,17 @@ zfs_mount_at(zfs_handle_t *zhp, const char *options, int flags,
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"Insufficient privileges"));
} else if (rc == ENOTSUP) {
- char buf[256];
int spa_version;
VERIFY(zfs_spa_version(zhp, &spa_version) == 0);
- (void) snprintf(buf, sizeof (buf),
- dgettext(TEXT_DOMAIN, "Can't mount a version %lld "
+ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+ "Can't mount a version %llu "
"file system on a version %d pool. Pool must be"
" upgraded to mount this file system."),
(u_longlong_t)zfs_prop_get_int(zhp,
ZFS_PROP_VERSION), spa_version);
- zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, buf));
} else {
- zfs_error_aux(hdl, strerror(rc));
+ zfs_error_aux(hdl, "%s", strerror(rc));
}
return (zfs_error_fmt(hdl, EZFS_MOUNTFAILED,
dgettext(TEXT_DOMAIN, "cannot mount '%s'"),
diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_pool.c b/sys/contrib/openzfs/lib/libzfs/libzfs_pool.c
index d4849ee5bd9b..adc36c47f290 100644
--- a/sys/contrib/openzfs/lib/libzfs/libzfs_pool.c
+++ b/sys/contrib/openzfs/lib/libzfs/libzfs_pool.c
@@ -563,8 +563,8 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
if (intval < version ||
!SPA_VERSION_IS_SUPPORTED(intval)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
- "property '%s' number %d is invalid."),
- propname, intval);
+ "property '%s' number %llu is invalid."),
+ propname, (unsigned long long)intval);
(void) zfs_error(hdl, EZFS_BADVERSION, errbuf);
goto error;
}
@@ -574,10 +574,11 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
if (intval != 0 &&
(intval < ASHIFT_MIN || intval > ASHIFT_MAX)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
- "property '%s' number %d is invalid, only "
- "values between %" PRId32 " and "
- "%" PRId32 " are allowed."),
- propname, intval, ASHIFT_MIN, ASHIFT_MAX);
+ "property '%s' number %llu is invalid, "
+ "only values between %" PRId32 " and %"
+ PRId32 " are allowed."),
+ propname, (unsigned long long)intval,
+ ASHIFT_MIN, ASHIFT_MAX);
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
goto error;
}
@@ -685,7 +686,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
case ZPOOL_COMPATIBILITY_BADFILE:
case ZPOOL_COMPATIBILITY_BADTOKEN:
case ZPOOL_COMPATIBILITY_NOFILES:
- zfs_error_aux(hdl, report);
+ zfs_error_aux(hdl, "%s", report);
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
goto error;
}
@@ -1648,10 +1649,6 @@ zpool_export_common(zpool_handle_t *zhp, boolean_t force, boolean_t hardforce,
const char *log_str)
{
zfs_cmd_t zc = {"\0"};
- char msg[1024];
-
- (void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN,
- "cannot export '%s'"), zhp->zpool_name);
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
zc.zc_cookie = force;
@@ -1666,11 +1663,13 @@ zpool_export_common(zpool_handle_t *zhp, boolean_t force, boolean_t hardforce,
"'%s' has an active shared spare which could be"
" used by other pools once '%s' is exported."),
zhp->zpool_name, zhp->zpool_name);
- return (zfs_error(zhp->zpool_hdl, EZFS_ACTIVE_SPARE,
- msg));
+ return (zfs_error_fmt(zhp->zpool_hdl, EZFS_ACTIVE_SPARE,
+ dgettext(TEXT_DOMAIN, "cannot export '%s'"),
+ zhp->zpool_name));
default:
return (zpool_standard_error_fmt(zhp->zpool_hdl, errno,
- msg));
+ dgettext(TEXT_DOMAIN, "cannot export '%s'"),
+ zhp->zpool_name));
}
}
@@ -2080,7 +2079,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
"the zgenhostid(8) command.\n"));
}
- (void) zfs_error_aux(hdl, aux);
+ (void) zfs_error_aux(hdl, "%s", aux);
}
(void) zfs_error(hdl, EZFS_ACTIVE_POOL, desc);
break;
@@ -4520,13 +4519,10 @@ int
zpool_events_clear(libzfs_handle_t *hdl, int *count)
{
zfs_cmd_t zc = {"\0"};
- char msg[1024];
-
- (void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN,
- "cannot clear events"));
if (zfs_ioctl(hdl, ZFS_IOC_EVENTS_CLEAR, &zc) != 0)
- return (zpool_standard_error_fmt(hdl, errno, msg));
+ return (zpool_standard_error(hdl, errno,
+ dgettext(TEXT_DOMAIN, "cannot clear events")));
if (count != NULL)
*count = (int)zc.zc_cookie; /* # of events cleared */
@@ -4800,11 +4796,16 @@ zpool_load_compat(const char *compat, boolean_t *features, char *report,
* as they're only needed if the filename is relative
* which will be checked during the openat().
*/
-#ifndef O_PATH
-#define O_PATH O_RDONLY
+
+/* O_PATH safer than O_RDONLY if system allows it */
+#if defined(O_PATH)
+#define ZC_DIR_FLAGS (O_DIRECTORY | O_CLOEXEC | O_PATH)
+#else
+#define ZC_DIR_FLAGS (O_DIRECTORY | O_CLOEXEC | O_RDONLY)
#endif
- sdirfd = open(ZPOOL_SYSCONF_COMPAT_D, O_DIRECTORY | O_PATH | O_CLOEXEC);
- ddirfd = open(ZPOOL_DATA_COMPAT_D, O_DIRECTORY | O_PATH | O_CLOEXEC);
+
+ sdirfd = open(ZPOOL_SYSCONF_COMPAT_D, ZC_DIR_FLAGS);
+ ddirfd = open(ZPOOL_DATA_COMPAT_D, ZC_DIR_FLAGS);
(void) strlcpy(l_compat, compat, ZFS_MAXPROPLEN);
@@ -4812,7 +4813,7 @@ zpool_load_compat(const char *compat, boolean_t *features, char *report,
file != NULL;
file = strtok_r(NULL, ",", &ps)) {
- boolean_t l_features[SPA_FEATURES] = {B_FALSE};
+ boolean_t l_features[SPA_FEATURES];
enum { Z_SYSCONF, Z_DATA } source;
@@ -4835,14 +4836,18 @@ zpool_load_compat(const char *compat, boolean_t *features, char *report,
continue;
}
-#if !defined(MAP_POPULATE) && defined(MAP_PREFAULT_READ)
-#define MAP_POPULATE MAP_PREFAULT_READ
-#elif !defined(MAP_POPULATE)
-#define MAP_POPULATE 0
+/* Prefault the file if system allows */
+#if defined(MAP_POPULATE)
+#define ZC_MMAP_FLAGS (MAP_PRIVATE | MAP_POPULATE)
+#elif defined(MAP_PREFAULT_READ)
+#define ZC_MMAP_FLAGS (MAP_PRIVATE | MAP_PREFAULT_READ)
+#else
+#define ZC_MMAP_FLAGS (MAP_PRIVATE)
#endif
+
/* private mmap() so we can strtok safely */
- fc = (char *)mmap(NULL, fs.st_size,
- PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_POPULATE, featfd, 0);
+ fc = (char *)mmap(NULL, fs.st_size, PROT_READ | PROT_WRITE,
+ ZC_MMAP_FLAGS, featfd, 0);
(void) close(featfd);
/* map ok, and last character == newline? */
@@ -4856,7 +4861,10 @@ zpool_load_compat(const char *compat, boolean_t *features, char *report,
ret_nofiles = B_FALSE;
- /* replace last char with NUL to ensure we have a delimiter */
+ for (uint_t i = 0; i < SPA_FEATURES; i++)
+ l_features[i] = B_FALSE;
+
+ /* replace final newline with NULL to ensure string ends */
fc[fs.st_size - 1] = '\0';
for (line = strtok_r(fc, "\n", &ls);
diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c b/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c
index 511895d18658..410c34888ab1 100644
--- a/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c
+++ b/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c
@@ -768,7 +768,7 @@ zfs_send_space(zfs_handle_t *zhp, const char *snapname, const char *from,
case EFAULT:
case EROFS:
case EINVAL:
- zfs_error_aux(hdl, strerror(error));
+ zfs_error_aux(hdl, "%s", strerror(error));
return (zfs_error(hdl, EZFS_BADBACKUP, errbuf));
default:
@@ -849,7 +849,8 @@ dump_ioctl(zfs_handle_t *zhp, const char *fromsnap, uint64_t fromsnap_obj,
case ERANGE:
case EFAULT:
case EROFS:
- zfs_error_aux(hdl, strerror(errno));
+ case EINVAL:
+ zfs_error_aux(hdl, "%s", strerror(errno));
return (zfs_error(hdl, EZFS_BADBACKUP, errbuf));
default:
@@ -1479,7 +1480,7 @@ estimate_size(zfs_handle_t *zhp, const char *from, int fd, sendflags_t *flags,
err = pthread_create(&ptid, NULL,
send_progress_thread, &pa);
if (err != 0) {
- zfs_error_aux(zhp->zfs_hdl, strerror(errno));
+ zfs_error_aux(zhp->zfs_hdl, "%s", strerror(errno));
return (zfs_error(zhp->zfs_hdl,
EZFS_THREADCREATEFAILED, errbuf));
}
@@ -1505,7 +1506,7 @@ estimate_size(zfs_handle_t *zhp, const char *from, int fd, sendflags_t *flags,
}
if (err != 0) {
- zfs_error_aux(zhp->zfs_hdl, strerror(err));
+ zfs_error_aux(zhp->zfs_hdl, "%s", strerror(err));
return (zfs_error(zhp->zfs_hdl, EZFS_BADBACKUP,
errbuf));
}
@@ -1822,7 +1823,7 @@ zfs_send_resume_impl(libzfs_handle_t *hdl, sendflags_t *flags, int outfd,
case ERANGE:
case EFAULT:
case EROFS:
- zfs_error_aux(hdl, strerror(errno));
+ zfs_error_aux(hdl, "%s", strerror(errno));
return (zfs_error(hdl, EZFS_BADBACKUP, errbuf));
default:
@@ -2082,13 +2083,13 @@ send_prelim_records(zfs_handle_t *zhp, const char *from, int fd,
err = dump_record(&drr, packbuf, buflen, &zc, fd);
free(packbuf);
if (err != 0) {
- zfs_error_aux(zhp->zfs_hdl, strerror(err));
+ zfs_error_aux(zhp->zfs_hdl, "%s", strerror(err));
return (zfs_error(zhp->zfs_hdl, EZFS_BADBACKUP,
errbuf));
}
err = send_conclusion_record(fd, &zc);
if (err != 0) {
- zfs_error_aux(zhp->zfs_hdl, strerror(err));
+ zfs_error_aux(zhp->zfs_hdl, "%s", strerror(err));
return (zfs_error(zhp->zfs_hdl, EZFS_BADBACKUP,
errbuf));
}
@@ -2507,7 +2508,7 @@ zfs_send_one(zfs_handle_t *zhp, const char *from, int fd, sendflags_t *flags,
err = pthread_create(&ptid, NULL,
send_progress_thread, &pa);
if (err != 0) {
- zfs_error_aux(zhp->zfs_hdl, strerror(errno));
+ zfs_error_aux(zhp->zfs_hdl, "%s", strerror(errno));
return (zfs_error(zhp->zfs_hdl,
EZFS_THREADCREATEFAILED, errbuf));
}
@@ -2522,13 +2523,10 @@ zfs_send_one(zfs_handle_t *zhp, const char *from, int fd, sendflags_t *flags,
(void) pthread_cancel(ptid);
(void) pthread_join(ptid, &status);
int error = (int)(uintptr_t)status;
- if (error != 0 && status != PTHREAD_CANCELED) {
- char errbuf[1024];
- (void) snprintf(errbuf, sizeof (errbuf),
- dgettext(TEXT_DOMAIN, "progress thread exited "
- "nonzero"));
- return (zfs_standard_error(hdl, error, errbuf));
- }
+ if (error != 0 && status != PTHREAD_CANCELED)
+ return (zfs_standard_error_fmt(hdl, error,
+ dgettext(TEXT_DOMAIN,
+ "progress thread exited nonzero")));
}
if (flags->props || flags->holds || flags->backup) {
@@ -2576,7 +2574,7 @@ zfs_send_one(zfs_handle_t *zhp, const char *from, int fd, sendflags_t *flags,
case EPIPE:
case ERANGE:
case EROFS:
- zfs_error_aux(hdl, strerror(errno));
+ zfs_error_aux(hdl, "%s", strerror(errno));
return (zfs_error(hdl, EZFS_BADBACKUP, errbuf));
default:
@@ -5078,8 +5076,8 @@ zfs_receive_impl(libzfs_handle_t *hdl, const char *tosnap,
if (!DMU_STREAM_SUPPORTED(featureflags) ||
(hdrtype != DMU_SUBSTREAM && hdrtype != DMU_COMPOUNDSTREAM)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
- "stream has unsupported feature, feature flags = %lx"),
- featureflags);
+ "stream has unsupported feature, feature flags = %llx"),
+ (unsigned long long)featureflags);
return (zfs_error(hdl, EZFS_BADSTREAM, errbuf));
}
diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_util.c b/sys/contrib/openzfs/lib/libzfs/libzfs_util.c
index 7a6e9269280b..4170cf019f7e 100644
--- a/sys/contrib/openzfs/lib/libzfs/libzfs_util.c
+++ b/sys/contrib/openzfs/lib/libzfs/libzfs_util.c
@@ -483,7 +483,7 @@ zfs_standard_error_fmt(libzfs_handle_t *hdl, int error, const char *fmt, ...)
zfs_verror(hdl, EZFS_BADPROP, fmt, ap);
break;
default:
- zfs_error_aux(hdl, strerror(error));
+ zfs_error_aux(hdl, "%s", strerror(error));
zfs_verror(hdl, EZFS_UNKNOWN, fmt, ap);
break;
}
@@ -734,7 +734,7 @@ zpool_standard_error_fmt(libzfs_handle_t *hdl, int error, const char *fmt, ...)
zfs_verror(hdl, EZFS_IOC_NOTSUPPORTED, fmt, ap);
break;
default:
- zfs_error_aux(hdl, strerror(error));
+ zfs_error_aux(hdl, "%s", strerror(error));
zfs_verror(hdl, EZFS_UNKNOWN, fmt, ap);
}
diff --git a/sys/contrib/openzfs/lib/libzpool/kernel.c b/sys/contrib/openzfs/lib/libzpool/kernel.c
index e96a1d7521d9..cc8e534e7eb5 100644
--- a/sys/contrib/openzfs/lib/libzpool/kernel.c
+++ b/sys/contrib/openzfs/lib/libzpool/kernel.c
@@ -146,36 +146,6 @@ void
kstat_delete(kstat_t *ksp)
{}
-/*ARGSUSED*/
-void
-kstat_waitq_enter(kstat_io_t *kiop)
-{}
-
-/*ARGSUSED*/
-void
-kstat_waitq_exit(kstat_io_t *kiop)
-{}
-
-/*ARGSUSED*/
-void
-kstat_runq_enter(kstat_io_t *kiop)
-{}
-
-/*ARGSUSED*/
-void
-kstat_runq_exit(kstat_io_t *kiop)
-{}
-
-/*ARGSUSED*/
-void
-kstat_waitq_to_runq(kstat_io_t *kiop)
-{}
-
-/*ARGSUSED*/
-void
-kstat_runq_back_to_waitq(kstat_io_t *kiop)
-{}
-
void
kstat_set_raw_ops(kstat_t *ksp,
int (*headers)(char *buf, size_t size),
diff --git a/sys/contrib/openzfs/man/Makefile.am b/sys/contrib/openzfs/man/Makefile.am
index 841cb9c4e6a0..8ab1b757242c 100644
--- a/sys/contrib/openzfs/man/Makefile.am
+++ b/sys/contrib/openzfs/man/Makefile.am
@@ -1 +1,117 @@
-SUBDIRS = man1 man5 man8
+include $(top_srcdir)/config/Substfiles.am
+
+EXTRA_DIST += \
+ man1/cstyle.1
+
+dist_man_MANS = \
+ man1/zhack.1 \
+ man1/ztest.1 \
+ man1/raidz_test.1 \
+ man1/zvol_wait.1 \
+ man1/arcstat.1 \
+ \
+ man5/vdev_id.conf.5 \
+ \
+ man4/spl.4 \
+ man4/zfs.4 \
+ \
+ man7/zpool-features.7 \
+ man7/zfsconcepts.7 \
+ man7/zfsprops.7 \
+ man7/zpoolconcepts.7 \
+ man7/zpoolprops.7 \
+ \
+ man8/fsck.zfs.8 \
+ man8/mount.zfs.8 \
+ man8/vdev_id.8 \
+ man8/zdb.8 \
+ man8/zfs.8 \
+ man8/zfs-allow.8 \
+ man8/zfs-bookmark.8 \
+ man8/zfs-change-key.8 \
+ man8/zfs-clone.8 \
+ man8/zfs-create.8 \
+ man8/zfs-destroy.8 \
+ man8/zfs-diff.8 \
+ man8/zfs-get.8 \
+ man8/zfs-groupspace.8 \
+ man8/zfs-hold.8 \
+ man8/zfs-inherit.8 \
+ man8/zfs-jail.8 \
+ man8/zfs-list.8 \
+ man8/zfs-load-key.8 \
+ man8/zfs-mount.8 \
+ man8/zfs-program.8 \
+ man8/zfs-project.8 \
+ man8/zfs-projectspace.8 \
+ man8/zfs-promote.8 \
+ man8/zfs-receive.8 \
+ man8/zfs-recv.8 \
+ man8/zfs-redact.8 \
+ man8/zfs-release.8 \
+ man8/zfs-rename.8 \
+ man8/zfs-rollback.8 \
+ man8/zfs-send.8 \
+ man8/zfs-set.8 \
+ man8/zfs-share.8 \
+ man8/zfs-snapshot.8 \
+ man8/zfs-unallow.8 \
+ man8/zfs-unjail.8 \
+ man8/zfs-unload-key.8 \
+ man8/zfs-unmount.8 \
+ man8/zfs-upgrade.8 \
+ man8/zfs-userspace.8 \
+ man8/zfs-wait.8 \
+ man8/zfs_ids_to_path.8 \
+ man8/zgenhostid.8 \
+ man8/zinject.8 \
+ man8/zpool.8 \
+ man8/zpool-add.8 \
+ man8/zpool-attach.8 \
+ man8/zpool-checkpoint.8 \
+ man8/zpool-clear.8 \
+ man8/zpool-create.8 \
+ man8/zpool-destroy.8 \
+ man8/zpool-detach.8 \
+ man8/zpool-events.8 \
+ man8/zpool-export.8 \
+ man8/zpool-get.8 \
+ man8/zpool-history.8 \
+ man8/zpool-import.8 \
+ man8/zpool-initialize.8 \
+ man8/zpool-iostat.8 \
+ man8/zpool-labelclear.8 \
+ man8/zpool-list.8 \
+ man8/zpool-offline.8 \
+ man8/zpool-online.8 \
+ man8/zpool-reguid.8 \
+ man8/zpool-remove.8 \
+ man8/zpool-reopen.8 \
+ man8/zpool-replace.8 \
+ man8/zpool-resilver.8 \
+ man8/zpool-scrub.8 \
+ man8/zpool-set.8 \
+ man8/zpool-split.8 \
+ man8/zpool-status.8 \
+ man8/zpool-sync.8 \
+ man8/zpool-trim.8 \
+ man8/zpool-upgrade.8 \
+ man8/zpool-wait.8 \
+ man8/zstream.8 \
+ man8/zstreamdump.8 \
+ man8/zpool_influxdb.8
+
+nodist_man_MANS = \
+ man8/zed.8 \
+ man8/zfs-mount-generator.8
+
+SUBSTFILES += $(nodist_man_MANS)
+
+
+if BUILD_LINUX
+# The manual pager in most Linux distros defaults to "BSD" when .Os is blank,
+# but leaving it blank makes things a lot easier on
+# FreeBSD when OpenZFS is vendored in the base system.
+install-data-hook:
+ cd $(DESTDIR)$(mandir) && $(SED) ${ac_inplace} -e 's/^\.Os$$/.Os OpenZFS/' $(dist_man_MANS) $(nodist_man_MANS)
+endif
diff --git a/sys/contrib/openzfs/man/man1/Makefile.am b/sys/contrib/openzfs/man/man1/Makefile.am
deleted file mode 100644
index 8d7457a3e258..000000000000
--- a/sys/contrib/openzfs/man/man1/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-dist_man_MANS = zhack.1 ztest.1 raidz_test.1 zvol_wait.1 arcstat.1
-EXTRA_DIST = cstyle.1
-
-if BUILD_LINUX
-# The man pager in most Linux distros defaults to BSD instead of Linux
-# when .Os is blank, but leaving it blank makes things a lot easier on
-# FreeBSD when OpenZFS is vendored in the base system.
-install-data-hook:
- cd $(DESTDIR)$(mandir)/man1; \
- $(SED) ${ac_inplace} -e 's/^\.Os$$/.Os Linux/' \
- $(dist_man_MANS)
-endif
diff --git a/sys/contrib/openzfs/man/man1/arcstat.1 b/sys/contrib/openzfs/man/man1/arcstat.1
index de63206e279f..a69cd8937bdf 100644
--- a/sys/contrib/openzfs/man/man1/arcstat.1
+++ b/sys/contrib/openzfs/man/man1/arcstat.1
@@ -8,603 +8,177 @@
.\" source. A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
.\"
-.\"
.\" Copyright 2014 Adam Stevko. All rights reserved.
.\" Copyright (c) 2015 by Delphix. All rights reserved.
.\" Copyright (c) 2020 by AJ Jordan. All rights reserved.
.\"
-.TH ARCSTAT 1 "Oct 20, 2020" OpenZFS
-.SH NAME
-arcstat \- report ZFS ARC and L2ARC statistics
-.SH SYNOPSIS
-.LP
-.nf
-\fBarcstat\fR [\fB-havxp\fR] [\fB-f field[,field]...\fR] [\fB-o file\fR] [\fB-s string\fR] [\fBinterval\fR [\fBcount\fR]]
-.fi
-
-.SH DESCRIPTION
-.LP
-The \fBarcstat\fR utility print various ZFS ARC and L2ARC statistics in
-vmstat-like fashion.
-.sp
-
-.sp
-.LP
-The \fBarcstat\fR command reports the following information:
-.sp
-.ne 2
-
-.\"
-.sp
-.ne 1
-.na
-\fBc \fR
-.ad
-.RS 14n
+.Dd May 26, 2021
+.Dt ARCSTAT 1
+.Os
+.
+.Sh NAME
+.Nm arcstat
+.Nd report ZFS ARC and L2ARC statistics
+.Sh SYNOPSIS
+.Nm
+.Op Fl havxp
+.Op Fl f Ar field Ns Op , Ns Ar field Ns …
+.Op Fl o Ar file
+.Op Fl s Ar string
+.Op Ar interval
+.Op Ar count
+.
+.Sh DESCRIPTION
+.Nm
+prints various ZFS ARC and L2ARC statistics in vmstat-like fashion:
+.Bl -tag -compact -offset Ds -width "l2asize"
+.It Sy c
ARC target size
-.RE
-
-.sp
-.ne 2
-.na
-\fBdh% \fR
-.ad
-.RS 14n
+.It Sy dh%
Demand data hit percentage
-.RE
-
-.sp
-.ne 2
-.na
-\fBdm% \fR
-.ad
-.RS 14n
+.It Sy dm%
Demand data miss percentage
-.RE
-
-.sp
-.ne 2
-.na
-\fBmfu \fR
-.ad
-.RS 14n
+.It Sy mfu
MFU list hits per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBmh% \fR
-.ad
-.RS 14n
+.It Sy mh%
Metadata hit percentage
-.RE
-
-.sp
-.ne 2
-.na
-\fBmm% \fR
-.ad
-.RS 14n
+.It Sy mm%
Metadata miss percentage
-.RE
-
-.sp
-.ne 2
-.na
-\fBmru \fR
-.ad
-.RS 14n
+.It Sy mru
MRU list hits per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBph% \fR
-.ad
-.RS 14n
+.It Sy ph%
Prefetch hits percentage
-.RE
-
-.sp
-.ne 2
-.na
-\fBpm% \fR
-.ad
-.RS 14n
+.It Sy pm%
Prefetch miss percentage
-.RE
-
-.sp
-.ne 2
-.na
-\fBdhit \fR
-.ad
-.RS 14n
+.It Sy dhit
Demand data hits per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBdmis \fR
-.ad
-.RS 14n
+.It Sy dmis
Demand data misses per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBhit% \fR
-.ad
-.RS 14n
+.It Sy hit%
ARC hit percentage
-.RE
-
-.sp
-.ne 2
-.na
-\fBhits \fR
-.ad
-.RS 14n
+.It Sy hits
ARC reads per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBmfug \fR
-.ad
-.RS 14n
+.It Sy mfug
MFU ghost list hits per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBmhit \fR
-.ad
-.RS 14n
+.It Sy mhit
Metadata hits per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBmiss \fR
-.ad
-.RS 14n
+.It Sy miss
ARC misses per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBmmis \fR
-.ad
-.RS 14n
+.It Sy mmis
Metadata misses per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBmrug \fR
-.ad
-.RS 14n
+.It Sy mrug
MRU ghost list hits per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBphit \fR
-.ad
-.RS 14n
+.It Sy phit
Prefetch hits per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBpmis \fR
-.ad
-.RS 14n
+.It Sy pmis
Prefetch misses per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBread \fR
-.ad
-.RS 14n
+.It Sy read
Total ARC accesses per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBtime \fR
-.ad
-.RS 14n
-Time
-.RE
-
-.sp
-.ne 2
-.na
-\fBsize \fR
-.ad
-.RS 14n
+.It Sy time
+Current time
+.It Sy size
ARC size
-.RE
-
-.sp
-.ne 2
-.na
-\fBarcsz \fR
-.ad
-.RS 14n
-Alias for \fBsize\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBdread \fR
-.ad
-.RS 14n
+.It Sy arcsz
+Alias for
+.Sy size
+.It Sy dread
Demand data accesses per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBeskip \fR
-.ad
-.RS 14n
+.It Sy eskip
evict_skip per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBmiss% \fR
-.ad
-.RS 14n
+.It Sy miss%
ARC miss percentage
-.RE
-
-.sp
-.ne 2
-.na
-\fBmread \fR
-.ad
-.RS 14n
+.It Sy mread
Metadata accesses per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBpread \fR
-.ad
-.RS 14n
+.It Sy pread
Prefetch accesses per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2hit% \fR
-.ad
-.RS 14n
+.It Sy l2hit%
L2ARC access hit percentage
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2hits \fR
-.ad
-.RS 14n
+.It Sy l2hits
L2ARC hits per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2miss \fR
-.ad
-.RS 14n
+.It Sy l2miss
L2ARC misses per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2read \fR
-.ad
-.RS 14n
+.It Sy l2read
Total L2ARC accesses per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2pref \fR
-.ad
-.RS 14n
+.It Sy l2pref
L2ARC prefetch allocated size per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2pref% \fR
-.ad
-.RS 14n
+.It Sy l2pref%
L2ARC prefetch allocated size percentage
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2mfu \fR
-.ad
-.RS 14n
+.It Sy l2mfu
L2ARC MFU allocated size per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2mfu% \fR
-.ad
-.RS 14n
+.It Sy l2mfu%
L2ARC MFU allocated size percentage
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2mru \fR
-.ad
-.RS 14n
+.It Sy l2mru
L2ARC MRU allocated size per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2mru% \fR
-.ad
-.RS 14n
+.It Sy l2mru%
L2ARC MRU allocated size percentage
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2data \fR
-.ad
-.RS 14n
+.It Sy l2data
L2ARC data (buf content) allocated size per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2data% \fR
-.ad
-.RS 14n
+.It Sy l2data%
L2ARC data (buf content) allocated size percentage
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2meta \fR
-.ad
-.RS 14n
+.It Sy l2meta
L2ARC metadata (buf content) allocated size per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2meta% \fR
-.ad
-.RS 14n
+.It Sy l2meta%
L2ARC metadata (buf content) allocated size percentage
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2size \fR
-.ad
-.RS 14n
+.It Sy l2size
Size of the L2ARC
-.RE
-
-.sp
-.ne 2
-.na
-\fBmtxmis \fR
-.ad
-.RS 14n
+.It Sy mtxmis
mutex_miss per second
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2bytes \fR
-.ad
-.RS 14n
+.It Sy l2bytes
Bytes read per second from the L2ARC
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2miss% \fR
-.ad
-.RS 14n
+.It Sy l2miss%
L2ARC access miss percentage
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2asize \fR
-.ad
-.RS 14n
+.It Sy l2asize
Actual (compressed) size of the L2ARC
-.RE
-
-.sp
-.ne 2
-.na
-\fBgrow \fR
-.ad
-.RS 14n
+.It Sy grow
ARC grow disabled
-.RE
-
-.sp
-.ne 2
-.na
-\fBneed \fR
-.ad
-.RS 14n
+.It Sy need
ARC reclaim needed
-.RE
-
-.sp
-.ne 2
-.na
-\fBfree \fR
-.ad
-.RS 14n
+.It Sy free
The ARC's idea of how much free memory there is, which includes evictable memory in the page cache.
-Since the ARC tries to keep \fBavail\fR above zero, \fBavail\fR is usually more instructive to observe than \fBfree\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBavail \fR
-.ad
-.RS 14n
-The ARC's idea of how much free memory is available to it, which is a bit less than \fBfree\fR.
-May temporarily be negative, in which case the ARC will reduce the target size \fBc\fR.
-.RE
-.\"
-
-.SH OPTIONS
-.LP
-The following options are supported:
-
-.sp
-.ne 2
-.na
-\fB\fB-a\fR\fR
-.ad
-.RS 12n
+Since the ARC tries to keep
+.Sy avail
+above zero,
+.Sy avail
+is usually more instructive to observe than
+.Sy free .
+.It Sy avail
+The ARC's idea of how much free memory is available to it, which is a bit less than
+.Sy free .
+May temporarily be negative, in which case the ARC will reduce the target size
+.Sy c .
+.El
+.
+.Sh OPTIONS
+.Bl -tag -width "-v"
+.It Fl a
Print all possible stats.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-f\fR\fR
-.ad
-.RS 12n
-Display only specific fields. See \fBDESCRIPTION\fR for supported statistics.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-h\fR\fR
-.ad
-.RS 12n
+.It Fl f
+Display only specific fields.
+See
+.Sx DESCRIPTION
+for supported statistics.
+.It Fl h
Display help message.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-o\fR\fR
-.ad
-.RS 12n
+.It Fl o
Report statistics to a file instead of the standard output.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-p\fR\fR
-.ad
-.RS 12n
+.It Fl p
Disable auto-scaling of numerical fields (for raw, machine-parsable values).
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-s\fR\fR
-.ad
-.RS 12n
+.It Fl s
Display data with a specified separator (default: 2 spaces).
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-x\fR\fR
-.ad
-.RS 12n
-Print extended stats (same as -f time,mfu,mru,mfug,mrug,eskip,mtxmis,dread,pread,read).
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-v\fR\fR
-.ad
-.RS 12n
+.It Fl x
+Print extended stats
+.Pq same as Fl f Sy time , Ns Sy mfu , Ns Sy mru , Ns Sy mfug , Ns Sy mrug , Ns Sy eskip , Ns Sy mtxmis , Ns Sy dread , Ns Sy pread , Ns Sy read .
+.It Fl v
Show field headers and definitions
-.RE
-
-.SH OPERANDS
-.LP
+.El
+.
+.Sh OPERANDS
The following operands are supported:
-.sp
-.ne 2
-.na
-\fB\fIcount\fR\fR
-.ad
-.RS 12n
-Display only \fIcount\fR reports.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIinterval\fR\fR
-.ad
-.RS 12n
+.Bl -tag -compact -offset Ds -width "interval"
+.It Ar interval
Specify the sampling interval in seconds.
-.RE
-
-.SH AUTHORS
-.LP
-arcstat was originally written in Perl by Neelakanth Nadgir and supported only ZFS ARC statistics.
-Mike Harsch updated it to support L2ARC statistics.
-John Hixson ported it to Python for FreeNAS over some beer, after which many individuals from the OpenZFS community continued to maintain and improve it.
+.It Ar count
+Display only
+.Ar count
+reports.
+.El
diff --git a/sys/contrib/openzfs/man/man1/cstyle.1 b/sys/contrib/openzfs/man/man1/cstyle.1
index 14175838a4fd..f5f9ec78f827 100644
--- a/sys/contrib/openzfs/man/man1/cstyle.1
+++ b/sys/contrib/openzfs/man/man1/cstyle.1
@@ -20,148 +20,141 @@
.\"
.\" CDDL HEADER END
.\"
-.TH CSTYLE 1 "Aug 24, 2020" OpenZFS
-.SH NAME
-.I cstyle
-\- check for some common stylistic errors in C source files
-.SH SYNOPSIS
-\fBcstyle [-chpvCP] [-o constructs] [file...]\fP
-.LP
-.SH DESCRIPTION
-.IX "OS-Net build tools" "cstyle" "" "\fBcstyle\fP"
-.LP
-.I cstyle
-inspects C source files (*.c and *.h) for common stylistic errors. It
-attempts to check for the cstyle documented in
-\fIhttp://www.cis.upenn.edu/~lee/06cse480/data/cstyle.ms.pdf\fP.
+.Dd May 26, 2021
+.Dt CSTYLE 1
+.Os
+.
+.Sh NAME
+.Nm cstyle
+.Nd check for some common stylistic errors in C source files
+.Sh SYNOPSIS
+.Nm
+.Op Fl chpvCP
+.Op Fl o Ar construct Ns Op , Ns Ar construct Ns …
+.Oo Ar file Oc Ns …
+.Sh DESCRIPTION
+.Nm
+inspects C source files (*.c and *.h) for common stylistic errors.
+It attempts to check for the cstyle documented in
+.Lk http://www.cis.upenn.edu/~lee/06cse480/data/cstyle.ms.pdf .
Note that there is much in that document that
-.I cannot
-be checked for; just because your code is \fBcstyle(1)\fP clean does not
-mean that you've followed Sun's C style. \fICaveat emptor\fP.
-.LP
-.SH OPTIONS
-.LP
+.Em cannot
+be checked for; just because your code is
+.Nm Ns -clean
+does not mean that you've followed Sun's C style.
+.Em Caveat emptor .
+.
+.Sh OPTIONS
The following options are supported:
-.TP 4
-.B \-c
-Check continuation line indentation inside of functions. Sun's C style
+.Bl -tag -width "-c"
+.It Fl c
+Check continuation line indentation inside of functions.
+Sun's C style
states that all statements must be indented to an appropriate tab stop,
-and any continuation lines after them must be indented \fIexactly\fP four
-spaces from the start line. This option enables a series of checks
-designed to find continuation line problems within functions only. The
-checks have some limitations; see CONTINUATION CHECKING, below.
-.LP
-.TP 4
-.B \-h
-Performs heuristic checks that are sometimes wrong. Not generally used.
-.LP
-.TP 4
-.B \-p
-Performs some of the more picky checks. Includes ANSI #else and #endif
-rules, and tries to detect spaces after casts. Used as part of the
-putback checks.
-.LP
-.TP 4
-.B \-v
-Verbose output; includes the text of the line of error, and, for
-\fB-c\fP, the first statement in the current continuation block.
-.LP
-.TP 4
-.B \-C
+and any continuation lines after them must be indented
+.Em exactly
+four spaces from the start line.
+This option enables a series of checks designed to find
+continuation line problems within functions only.
+The checks have some limitations; see
+.Sy CONTINUATION CHECKING ,
+below.
+.It Fl h
+Performs heuristic checks that are sometimes wrong.
+Not generally used.
+.It Fl p
+Performs some of the more picky checks.
+Includes ANSI
+.Sy #else
+and
+.Sy #endif
+rules, and tries to detect spaces after casts.
+Used as part of the putback checks.
+.It Fl v
+Verbose output; includes the text of the line of error, and, for
+.Fl c ,
+the first statement in the current continuation block.
+.It Fl C
Ignore errors in header comments (i.e. block comments starting in the
-first column). Not generally used.
-.LP
-.TP 4
-.B \-P
-Check for use of non-POSIX types. Historically, types like "u_int" and
-"u_long" were used, but they are now deprecated in favor of the POSIX
-types uint_t, ulong_t, etc. This detects any use of the deprecated
-types. Used as part of the putback checks.
-.LP
-.TP 4
-.B \-o \fIconstructs\fP
-Allow a comma-separated list of additional constructs. Available
-constructs include:
-.LP
-.TP 10
-.B doxygen
-Allow doxygen-style block comments (\fB/**\fP and \fB/*!\fP)
-.LP
-.TP 10
-.B splint
-Allow splint-style lint comments (\fB/*@...@*/\fP)
-.LP
-.SH NOTES
-.LP
-The cstyle rule for the OS/Net consolidation is that all new files must
-be \fB-pP\fP clean. For existing files, the following invocations are
-run against both the old and new files:
-.LP
-.TP 4
-\fBcstyle file\fB
-.LP
-.TP 4
-\fBcstyle -p file\fB
-.LP
-.TP 4
-\fBcstyle -pP file\fB
-.LP
-If the old file gave no errors for one of the invocations, the new file
-must also give no errors. This way, files can only become more clean.
-.LP
-.SH CONTINUATION CHECKING
-.LP
+first column).
+Not generally used.
+.It Fl P
+Check for use of non-POSIX types.
+Historically, types like
+.Sy u_int
+and
+.Sy u_long
+were used, but they are now deprecated in favor of the POSIX
+types
+.Sy uint_t ,
+.Sy ulong_t ,
+etc.
+This detects any use of the deprecated types.
+Used as part of the putback checks.
+.It Fl o Ar construct Ns Op , Ns Ar construct Ns …
+Available constructs include:
+.Bl -tag -compact -width "doxygen"
+.It Sy doxygen
+Allow doxygen-style block comments
+.Pq Sy /** No and Sy /*!\& .
+.It Sy splint
+Allow splint-style lint comments
+.Pq Sy /*@ Ns ... Ns Sy @*/ .
+.El
+.El
+.
+.Sh CONTINUATION CHECKING
The continuation checker is a reasonably simple state machine that knows
something about how C is laid out, and can match parenthesis, etc. over
-multiple lines. It does have some limitations:
-.LP
-.TP 4
-.B 1.
+multiple lines.
+It does have some limitations:
+.Bl -enum
+.It
Preprocessor macros which cause unmatched parenthesis will confuse the
-checker for that line. To fix this, you'll need to make sure that each
-branch of the #if statement has balanced parenthesis.
-.LP
-.TP 4
-.B 2.
-Some \fBcpp\fP macros do not require ;s after them. Any such macros
-*must* be ALL_CAPS; any lower case letters will cause bad output.
-.LP
-The bad output will generally be corrected after the next \fB;\fP,
-\fB{\fP, or \fB}\fP.
-.LP
-Some continuation error messages deserve some additional explanation
-.LP
-.TP 4
-.B
-multiple statements continued over multiple lines
-A multi-line statement which is not broken at statement
-boundaries. For example:
-.RS 4
-.HP 4
+checker for that line.
+To fix this, you'll need to make sure that each branch of the
+.Sy #if
+statement has balanced parenthesis.
+.It
+Some
+.Xr cpp 1
+macros do not require
+.Sy ;\& Ns s after them.
+Any such macros
+.Em must
+be ALL_CAPS; any lower case letters will cause bad output.
+.Pp
+The bad output will generally be corrected after the next
+.Sy ;\& , { , No or Sy } .
+.El
+Some continuation error messages deserve some additional explanation:
+.Bl -tag -width Ds
+.It Sy multiple statements continued over multiple lines
+A multi-line statement which is not broken at statement boundaries.
+For example:
+.Bd -literal -compact -offset Ds
if (this_is_a_long_variable == another_variable) a =
-.br
-b + c;
-.LP
-Will trigger this error. Instead, do:
-.HP 8
+ b + c;
+.Ed
+.Pp
+Will trigger this error.
+Instead, do:
+.Bd -literal -compact -offset Ds
if (this_is_a_long_variable == another_variable)
-.br
-a = b + c;
-.RE
-.LP
-.TP 4
-.B
-empty if/for/while body not on its own line
+ a = b + c;
+.Ed
+.It Sy empty if/for/while body not on its own line
For visibility, empty bodies for if, for, and while statements should be
-on their own line. For example:
-.RS 4
-.HP 4
+on their own line.
+For example:
+.Bd -literal -compact -offset Ds
while (do_something(&x) == 0);
-.LP
-Will trigger this error. Instead, do:
-.HP 8
+.Ed
+.Pp
+Will trigger this error.
+Instead, do:
+.Bd -literal -compact -offset Ds
while (do_something(&x) == 0)
-.br
-;
-.RE
-
+ ;
+.Ed
+.El
diff --git a/sys/contrib/openzfs/man/man1/raidz_test.1 b/sys/contrib/openzfs/man/man1/raidz_test.1
index 26e6b24ad815..4283a4b527f3 100644
--- a/sys/contrib/openzfs/man/man1/raidz_test.1
+++ b/sys/contrib/openzfs/man/man1/raidz_test.1
@@ -1,4 +1,3 @@
-'\" t
.\"
.\" CDDL HEADER START
.\"
@@ -19,88 +18,84 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2016 Gvozden Nešković. All rights reserved.
.\"
-.TH RAIDZ_TEST 1 "Aug 24, 2020" OpenZFS
-
-.SH NAME
-\fBraidz_test\fR \- raidz implementation verification and benchmarking tool
-.SH SYNOPSIS
-.LP
-.BI "raidz_test <options>"
-.SH DESCRIPTION
-.LP
-This manual page documents briefly the \fBraidz_test\fR command.
-.LP
-Purpose of this tool is to run all supported raidz implementation and verify
-results of all methods. Tool also contains a parameter sweep option where all
-parameters affecting RAIDZ block are verified (like ashift size, data offset,
-data size, etc...).
-The tool also supports a benchmarking mode using -B option.
-.SH OPTION
-.HP
-.BI "\-h" ""
-.IP
+.Dd May 26, 2021
+.Dt RAIDZ_TEST 1
+.Os
+.
+.Sh NAME
+.Nm raidz_test
+.Nd raidz implementation verification and benchmarking tool
+.Sh SYNOPSIS
+.Nm
+.Op Fl StBevTD
+.Op Fl a Ar ashift
+.Op Fl o Ar zio_off_shift
+.Op Fl d Ar raidz_data_disks
+.Op Fl s Ar zio_size_shift
+.Op Fl r Ar reflow_offset
+.
+.Sh DESCRIPTION
+The purpose of this tool is to run all supported raidz implementation and verify
+the results of all methods.
+It also contains a parameter sweep option where all
+parameters affecting a RAIDZ block are verified (like ashift size, data offset,
+data size, etc.).
+The tool also supports a benchmarking mode using the
+.Fl B
+option.
+.
+.Sh OPTION
+.Bl -tag -width "-B(enchmark)"
+.It Fl h
Print a help summary.
-.HP
-.BI "\-a" " ashift (default: 9)"
-.IP
+.It Fl a Ar ashift Pq default: Sy 9
Ashift value.
-.HP
-.BI "\-o" " zio_off_shift" " (default: 0)"
-.IP
-Zio offset for raidz block. Offset value is 1 << (zio_off_shift)
-.HP
-.BI "\-d" " raidz_data_disks" " (default: 8)"
-.IP
-Number of raidz data disks to use. Additional disks for parity will be used
-during testing.
-.HP
-.BI "\-s" " zio_size_shift" " (default: 19)"
-.IP
-Size of data for raidz block. Size is 1 << (zio_size_shift).
-.HP
-.BI "\-r" " reflow_offset" " (default: uint max)"
-.IP
-Set raidz expansion offset. The expanded raidz map allocation function will
+.It Fl o Ar zio_off_shift Pq default: Sy 0
+ZIO offset for each raidz block.
+The offset's value is
+.Em 2^zio_off_shift .
+.It Fl d Ar raidz_data_disks Pq default: Sy 8
+Number of raidz data disks to use.
+Additional disks will be used for parity.
+.It Fl s Ar zio_size_shift Pq default: Sy 19
+Size of data for raidz block.
+The real size is
+.Em 2^zio_size_shift .
+.It Fl r Ar reflow_offset Pq default: Sy uint max
+Set raidz expansion offset.
+The expanded raidz map allocation function will
produce different map configurations depending on this value.
-.HP
-.BI "\-S(weep)"
-.IP
-Sweep parameter space while verifying the raidz implementations. This option
-will exhaust all most of valid values for -a -o -d -s options. Runtime using
-this option will be long.
-.HP
-.BI "\-t(imeout)"
-.IP
-Wall time for sweep test in seconds. The actual runtime could be longer.
-.HP
-.BI "\-B(enchmark)"
-.IP
-This options starts the benchmark mode. All implementations are benchmarked
-using increasing per disk data size. Results are given as throughput per disk,
-measured in MiB/s.
-.HP
-.BI "\-e(xpansion)"
-.IP
+.It Fl S Ns Pq weep
+Sweep parameter space while verifying the raidz implementations.
+This option
+will exhaust all most of valid values for the
+.Fl aods
+options.
+Runtime using this option will be long.
+.It Fl t Ns Pq imeout
+Wall time for sweep test in seconds.
+The actual runtime could be longer.
+.It Fl B Ns Pq enchmark
+All implementations are benchmarked using increasing per disk data size.
+Results are given as throughput per disk, measured in MiB/s.
+.It Fl e Ns Pq xpansion
Use expanded raidz map allocation function.
-.HP
-.BI "\-v(erbose)"
-.IP
+.It Fl v Ns Pq erbose
Increase verbosity.
-.HP
-.BI "\-T(est the test)"
-.IP
-Debugging option. When this option is specified tool is supposed to fail
-all tests. This is to check if tests would properly verify bit-exactness.
-.HP
-.BI "\-D(ebug)"
-.IP
-Debugging option. Specify to attach gdb when SIGSEGV or SIGABRT are received.
-.HP
-
-.SH "SEE ALSO"
-.BR "ztest (1)"
-.SH "AUTHORS"
-vdev_raidz, created for OpenZFS by Gvozden Nešković <neskovic@gmail.com>
+.It Fl T Ns Pq est the test
+Debugging option: fail all tests.
+This is to check if tests would properly verify bit-exactness.
+.It Fl D Ns Pq ebug
+Debugging option: attach
+.Xr gdb 1
+when
+.Sy SIGSEGV
+or
+.Sy SIGABRT
+are received.
+.El
+.
+.Sh "SEE ALSO"
+.Xr ztest 1
diff --git a/sys/contrib/openzfs/man/man1/zhack.1 b/sys/contrib/openzfs/man/man1/zhack.1
index 3126007a5e0d..83046ee8f515 100644
--- a/sys/contrib/openzfs/man/man1/zhack.1
+++ b/sys/contrib/openzfs/man/man1/zhack.1
@@ -1,4 +1,3 @@
-'\" t
.\"
.\" CDDL HEADER START
.\"
@@ -19,63 +18,108 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright 2013 Darik Horn <dajhorn@vanadac.com>. All rights reserved.
.\"
-.TH ZHACK 1 "Aug 24, 2020" OpenZFS
-
-.SH NAME
-zhack \- libzpool debugging tool
-.SH DESCRIPTION
+.\" lint-ok: WARNING: sections out of conventional order: Sh SYNOPSIS
+.\"
+.Dd May 26, 2021
+.Dt ZHACK 1
+.Os
+.
+.Sh NAME
+.Nm zhack
+.Nd libzpool debugging tool
+.Sh DESCRIPTION
This utility pokes configuration changes directly into a ZFS pool,
which is dangerous and can cause data corruption.
-.SH SYNOPSIS
-.LP
-.BI "zhack [\-c " "cachefile" "] [\-d " "dir" "] <" "subcommand" "> [" "arguments" "]"
-.SH OPTIONS
-.HP
-.BI "\-c" " cachefile"
-.IP
-Read the \fIpool\fR configuration from the \fIcachefile\fR, which is
-/etc/zfs/zpool.cache by default.
-.HP
-.BI "\-d" " dir"
-.IP
-Search for \fIpool\fR members in the \fIdir\fR path. Can be specified
-more than once.
-.SH SUBCOMMANDS
-.LP
-.BI "feature stat " "pool"
-.IP
+.Sh SYNOPSIS
+.Bl -tag -width Ds
+.It Xo
+.Nm zhack
+.Cm feature stat
+.Ar pool
+.Xc
List feature flags.
-.LP
-.BI "feature enable [\-d " "description" "] [\-r] " "pool guid"
-.IP
-Add a new feature to \fIpool\fR that is uniquely identified by
-\fIguid\fR, which is specified in the same form as a zfs(8) user
-property.
-.IP
-The \fIdescription\fR is a short human readable explanation of the new
+.
+.It Xo
+.Nm zhack
+.Cm feature enable
+.Op Fl d Ar description
+.Op Fl r
+.Ar pool
+.Ar guid
+.Xc
+Add a new feature to
+.Ar pool
+that is uniquely identified by
+.Ar guid ,
+which is specified in the same form as a
+.Xr zfs 8
+user property.
+.Pp
+The
+.Ar description
+is a short human readable explanation of the new feature.
+.Pp
+The
+.Fl r
+flag indicates that
+.Ar pool
+can be safely opened in read-only mode by a system that does not understand the
+.Ar guid
feature.
-.IP
-The \fB\-r\fR switch indicates that \fIpool\fR can be safely opened
-in read-only mode by a system that does not have the \fIguid\fR
-feature.
-.LP
-.BI "feature ref [\-d|\-m] " "pool guid"
-.IP
-Increment the reference count of the \fIguid\fR feature in \fIpool\fR.
-.IP
-The \fB\-d\fR switch decrements the reference count of the \fIguid\fR
-feature in \fIpool\fR.
-.IP
-The \fB\-m\fR switch indicates that the \fIguid\fR feature is now
-required to read the pool MOS.
-.SH EXAMPLES
-.LP
-.nf
-# zhack feature stat tank
-
+.
+.It Xo
+.Nm zhack
+.Cm feature ref
+.Op Fl d Ns | Ns Fl m
+.Ar pool
+.Ar guid
+.Xc
+Increment the reference count of the
+.Ar guid
+feature in
+.Ar pool .
+.Pp
+The
+.Fl d
+flag decrements the reference count of the
+.Ar guid
+feature in
+.Ar pool
+instead.
+.Pp
+The
+.Fl m
+flag indicates that the
+.Ar guid
+feature is now required to read the pool MOS.
+.El
+.
+.Sh GLOBAL OPTIONS
+The following can be passed to all
+.Nm
+invocations before any subcommand:
+.Bl -tag -width "-d dir"
+.It Fl c Ar cachefile
+Read
+.Ar pool
+configuration from the
+.Ar cachefile ,
+which is
+.Pa /etc/zfs/zpool.cache
+by default.
+.It Fl d Ar dir
+Search for
+.Ar pool
+members in
+.Ar dir .
+Can be specified more than once.
+.El
+.
+.Sh EXAMPLES
+.Bd -literal
+.No # Nm zhack Cm feature stat Ar tank
for_read_obj:
org.illumos:lz4_compress = 0
for_write_obj:
@@ -85,14 +129,12 @@ descriptions_obj:
com.delphix:async_destroy = Destroy filesystems asynchronously.
com.delphix:empty_bpobj = Snapshots use less space.
org.illumos:lz4_compress = LZ4 compression algorithm support.
-.LP
-# zhack feature enable -d 'Predict future disk failures.' \\
- tank com.example:clairvoyance
-.LP
-# zhack feature ref tank com.example:clairvoyance
-.SH AUTHORS
-This man page was written by Darik Horn <dajhorn@vanadac.com>.
-.SH SEE ALSO
-.BR zfs (8),
-.BR zpool-features (5),
-.BR ztest (1)
+
+.No # Nm zhack Cm feature enable Fl d No 'Predict future disk failures.' Ar tank com.example:clairvoyance
+.No # Nm zhack Cm feature ref Ar tank com.example:clairvoyance
+.Ed
+.
+.Sh SEE ALSO
+.Xr ztest 1 ,
+.Xr zpool-features 7 ,
+.Xr zfs 8
diff --git a/sys/contrib/openzfs/man/man1/ztest.1 b/sys/contrib/openzfs/man/man1/ztest.1
index 3f30b3ed743d..fd1374a2f106 100644
--- a/sys/contrib/openzfs/man/man1/ztest.1
+++ b/sys/contrib/openzfs/man/man1/ztest.1
@@ -1,4 +1,3 @@
-'\" t
.\"
.\" CDDL HEADER START
.\"
@@ -19,178 +18,216 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
.\" Copyright (c) 2009 Michael Gebetsroither <michael.geb@gmx.at>. All rights
.\" reserved.
.\" Copyright (c) 2017, Intel Corporation.
.\"
-.TH ZTEST 1 "Aug 24, 2020" OpenZFS
-
-.SH NAME
-\fBztest\fR \- was written by the ZFS Developers as a ZFS unit test.
-.SH SYNOPSIS
-.LP
-.BI "ztest <options>"
-.SH DESCRIPTION
-.LP
-This manual page documents briefly the \fBztest\fR command.
-.LP
-\fBztest\fR was written by the ZFS Developers as a ZFS unit test. The
-tool was developed in tandem with the ZFS functionality and was
-executed nightly as one of the many regression test against the daily
-build. As features were added to ZFS, unit tests were also added to
-\fBztest\fR. In addition, a separate test development team wrote and
+.Dd May 26, 2021
+.Dt ZTEST 1
+.Os
+.
+.Sh NAME
+.Nm ztest
+.Nd was written by the ZFS Developers as a ZFS unit test
+.Sh SYNOPSIS
+.Nm
+.Op Fl VEG
+.Op Fl v Ar vdevs
+.Op Fl s Ar size_of_each_vdev
+.Op Fl a Ar alignment_shift
+.Op Fl m Ar mirror_copies
+.Op Fl r Ar raidz_disks/draid_disks
+.Op Fl R Ar raid_parity
+.Op Fl K Ar raid_kind
+.Op Fl D Ar draid_data
+.Op Fl S Ar draid_spares
+.Op Fl C Ar vdev_class_state
+.Op Fl d Ar datasets
+.Op Fl t Ar threads
+.Op Fl g Ar gang_block_threshold
+.Op Fl i Ar initialize_pool_i_times
+.Op Fl k Ar kill_percentage
+.Op Fl p Ar pool_name
+.Op Fl T Ar time
+.Op Fl z Ar zil_failure_rate
+.
+.Sh DESCRIPTION
+.Nm
+was written by the ZFS Developers as a ZFS unit test.
+The tool was developed in tandem with the ZFS functionality and was
+executed nightly as one of the many regression test against the daily build.
+As features were added to ZFS, unit tests were also added to
+.Nm .
+In addition, a separate test development team wrote and
executed more functional and stress tests.
-.LP
-By default \fBztest\fR runs for ten minutes and uses block files
-(stored in /tmp) to create pools rather than using physical disks.
-Block files afford \fBztest\fR its flexibility to play around with
+.
+.Pp
+By default
+.Nm
+runs for ten minutes and uses block files
+(stored in
+.Pa /tmp )
+to create pools rather than using physical disks.
+Block files afford
+.Nm
+its flexibility to play around with
zpool components without requiring large hardware configurations.
-However, storing the block files in /tmp may not work for you if you
+However, storing the block files in
+.Pa /tmp
+may not work for you if you
have a small tmp directory.
-.LP
-By default is non-verbose. This is why entering the command above will
-result in \fBztest\fR quietly executing for 5 minutes. The -V option
-can be used to increase the verbosity of the tool. Adding multiple -V
-option is allowed and the more you add the more chatty \fBztest\fR
+.
+.Pp
+By default is non-verbose.
+This is why entering the command above will result in
+.Nm
+quietly executing for 5 minutes.
+The
+.Fl V
+option can be used to increase the verbosity of the tool.
+Adding multiple
+.Fl V
+options is allowed and the more you add the more chatty
+.Nm
becomes.
-.LP
-After the \fBztest\fR run completes, you should notice many ztest.*
-files lying around. Once the run completes you can safely remove these
-files. Note that you shouldn't remove these files during a run. You
-can re-use these files in your next \fBztest\fR run by using the -E
+.
+.Pp
+After the
+.Nm
+run completes, you should notice many
+.Pa ztest.*
+files lying around.
+Once the run completes you can safely remove these files.
+Note that you shouldn't remove these files during a run.
+You can re-use these files in your next
+.Nm
+run by using the
+.Fl E
option.
-.SH OPTIONS
-.HP
-.BI "\-?" ""
-.IP
+.
+.Sh OPTIONS
+.Bl -tag -width "-v v"
+.It Fl h , \&? , -help
Print a help summary.
-.HP
-.BI "\-v" " vdevs" " (default: 5)
-.IP
+.It Fl v , -vdevs Ns = (default: Sy 5 )
Number of vdevs.
-.HP
-.BI "\-s" " size_of_each_vdev" " (default: 64M)"
-.IP
+.It Fl s , -vdev-size Ns = (default: Sy 64M )
Size of each vdev.
-.HP
-.BI "\-a" " alignment_shift" " (default: 9) (use 0 for random)"
-.IP
-Used alignment in test.
-.HP
-.BI "\-m" " mirror_copies" " (default: 2)"
-.IP
+.It Fl a , -alignment-shift Ns = (default: Sy 9 ) No (use Sy 0 No for random)
+Alignment shift used in test.
+.It Fl m , -mirror-copies Ns = (default: Sy 2 )
Number of mirror copies.
-.HP
-.BI "\-r" " raidz_disks / draid_disks" " (default: 4 / 16)"
-.IP
-Number of raidz disks.
-.HP
-.BI "\-R" " raid_parity" " (default: 1)"
-.IP
+.It Fl r , -raid-disks Ns = (default: Sy 4 No for raidz/ Ns Sy 16 No for draid)
+Number of raidz/draid disks.
+.It Fl R , -raid-parity Ns = (default: Sy 1 )
Raid parity (raidz & draid).
-.HP
-.BI "\-K" " raid_kind" " (default: 'random') raidz|draid|random"
-.IP
-The kind of RAID config to use. With 'random' the kind alternates between raidz and draid.
-.HP
-.BI "\-D" " draid_data" " (default: 4)"
-.IP
+.It Fl K , -raid-kind Ns = Ns Sy raidz Ns | Ns Sy draid Ns | Ns Sy random No (default: Sy random )
+The kind of RAID config to use.
+With
+.Sy random
+the kind alternates between raidz and draid.
+.It Fl D , -draid-data Ns = (default: Sy 4 )
Number of data disks in a dRAID redundancy group.
-.HP
-.BI "\-S" " draid_spares" " (default: 1)"
-.IP
+.It Fl S , -draid-spares Ns = (default: Sy 1 )
Number of dRAID distributed spare disks.
-.HP
-.BI "\-C" " vdev_class_state" " (default: random)"
-.IP
-The vdev allocation class state: special=on|off|random.
-.HP
-.BI "\-d" " datasets" " (default: 7)"
-.IP
+.It Fl d , -datasets Ns = (default: Sy 7 )
Number of datasets.
-.HP
-.BI "\-t" " threads" " (default: 23)"
-.IP
+.It Fl t , -threads Ns = (default: Sy 23 )
Number of threads.
-.HP
-.BI "\-g" " gang_block_threshold" " (default: 32K)"
-.IP
+.It Fl g , -gang-block-threshold Ns = (default: Sy 32K )
Gang block threshold.
-.HP
-.BI "\-i" " initialize_pool_i_times" " (default: 1)"
-.IP
-Number of pool initialisations.
-.HP
-.BI "\-k" " kill_percentage" " (default: 70%)"
-.IP
+.It Fl i , -init-count Ns = (default: Sy 1 )
+Number of pool initializations.
+.It Fl k , -kill-percentage Ns = (default: Sy 70% )
Kill percentage.
-.HP
-.BI "\-p" " pool_name" " (default: ztest)"
-.IP
+.It Fl p , -pool-name Ns = (default: Sy ztest )
Pool name.
-.HP
-.BI "\-V(erbose)"
-.IP
-Verbose (use multiple times for ever more blather).
-.HP
-.BI "\-E(xisting)"
-.IP
+.It Fl f , -vdev-file-directory Ns = (default: Pa /tmp )
+File directory for vdev files.
+.It Fl M , -multi-host
+Multi-host; simulate pool imported on remote host.
+.It Fl E , -use-existing-pool
Use existing pool (use existing pool instead of creating new one).
-.HP
-.BI "\-T" " time" " (default: 300 sec)"
-.IP
+.It Fl T , -run-time Ns = (default: Sy 300 Ns s)
Total test run time.
-.HP
-.BI "\-z" " zil_failure_rate" " (default: fail every 2^5 allocs)
-.IP
-Injected failure rate.
-.HP
-.BI "\-G"
-.IP
-Dump zfs_dbgmsg buffer before exiting.
-.SH "EXAMPLES"
-.LP
-To override /tmp as your location for block files, you can use the -f
+.It Fl P , -pass-time Ns = (default: Sy 60 Ns s)
+Time per pass.
+.It Fl F , -freeze-loops Ns = (default: Sy 50 )
+Max loops in
+.Fn spa_freeze .
+.It Fl B , -alt-ztest Ns =
+Alternate ztest path.
+.It Fl C , -vdev-class-state Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Sy random No (default: Sy random )
+The vdev allocation class state.
+.It Fl o , -option Ns = Ns Ar variable Ns = Ns Ar value
+Set global
+.Ar variable
+to an unsigned 32-bit integer
+.Ar value
+(little-endian only).
+.It Fl G , -dump-debug
+Dump zfs_dbgmsg buffer before exiting due to an error.
+.It Fl V , -verbose
+Verbose (use multiple times for ever more verbosity).
+.El
+.
+.Sh EXAMPLES
+To override
+.Pa /tmp
+as your location for block files, you can use the
+.Fl f
option:
-.IP
-ztest -f /
-.LP
-To get an idea of what ztest is actually testing try this:
-.IP
-ztest -f / -VVV
-.LP
-Maybe you'd like to run ztest for longer? To do so simply use the -T
+.Dl # ztest -f /
+.Pp
+To get an idea of what
+.Nm
+is actually testing try this:
+.Dl # ztest -f / -VVV
+.Pp
+Maybe you'd like to run
+.Nm ztest
+for longer? To do so simply use the
+.Fl T
option and specify the runlength in seconds like so:
-.IP
-ztest -f / -V -T 120
-
-.SH "ENVIRONMENT VARIABLES"
-.TP
-.B "ZFS_HOSTID=id"
-Use \fBid\fR instead of the SPL hostid to identify this host. Intended for use
-with ztest, but this environment variable will affect any utility which uses
-libzpool, including \fBzpool(8)\fR. Since the kernel is unaware of this setting
+.Dl # ztest -f / -V -T 120
+.
+.Sh ENVIRONMENT VARIABLES
+.Bl -tag -width "ZF"
+.It Ev ZFS_HOSTID Ns = Ns Em id
+Use
+.Em id
+instead of the SPL hostid to identify this host.
+Intended for use with
+.Nm , but this environment variable will affect any utility which uses
+libzpool, including
+.Xr zpool 8 .
+Since the kernel is unaware of this setting,
results with utilities other than ztest are undefined.
-.TP
-.B "ZFS_STACK_SIZE=stacksize"
-Limit the default stack size to \fBstacksize\fR bytes for the purpose of
-detecting and debugging kernel stack overflows. This value defaults to
-\fB32K\fR which is double the default \fB16K\fR Linux kernel stack size.
-
+.It Ev ZFS_STACK_SIZE Ns = Ns Em stacksize
+Limit the default stack size to
+.Em stacksize
+bytes for the purpose of
+detecting and debugging kernel stack overflows.
+This value defaults to
+.Em 32K
+which is double the default
+.Em 16K
+Linux kernel stack size.
+.Pp
In practice, setting the stack size slightly higher is needed because
differences in stack usage between kernel and user space can lead to spurious
-stack overflows (especially when debugging is enabled). The specified value
+stack overflows (especially when debugging is enabled).
+The specified value
will be rounded up to a floor of PTHREAD_STACK_MIN which is the minimum stack
required for a NULL procedure in user space.
-
-By default the stack size is limited to 256K.
-.SH "SEE ALSO"
-.BR "spl-module-parameters (5)" ","
-.BR "zpool (1)" ","
-.BR "zfs (1)" ","
-.BR "zdb (1)" ","
-.SH "AUTHOR"
-This manual page was transferred to asciidoc by Michael Gebetsroither
-<gebi@grml.org> from http://opensolaris.org/os/community/zfs/ztest/
+.Pp
+By default the stack size is limited to
+.Em 256K .
+.El
+.
+.Sh SEE ALSO
+.Xr zdb 1 ,
+.Xr zfs 1 ,
+.Xr zpool 1 ,
+.Xr spl 4
diff --git a/sys/contrib/openzfs/man/man1/zvol_wait.1 b/sys/contrib/openzfs/man/man1/zvol_wait.1
index 839e1f144752..0fb47ce73481 100644
--- a/sys/contrib/openzfs/man/man1/zvol_wait.1
+++ b/sys/contrib/openzfs/man/man1/zvol_wait.1
@@ -1,21 +1,32 @@
-.Dd July 5, 2019
-.Dt ZVOL_WAIT 1 SMM
+.\"
+.\" This file and its contents are supplied under the terms of the
+.\" Common Development and Distribution License ("CDDL"), version 1.0.
+.\" You may only use this file in accordance with the terms of version
+.\" 1.0 of the CDDL.
+.\"
+.\" A full copy of the text of the CDDL should have accompanied this
+.\" source. A copy of the CDDL is also available via the Internet at
+.\" http://www.illumos.org/license/CDDL.
+.\"
+.Dd May 27, 2021
+.Dt ZVOL_WAIT 1
.Os
+.
.Sh NAME
.Nm zvol_wait
-.Nd Wait for ZFS volume links in
-.Em /dev
-to be created.
+.Nd wait for ZFS volume links to appear in /dev
.Sh SYNOPSIS
.Nm
+.
.Sh DESCRIPTION
-When a ZFS pool is imported, ZFS will register each ZFS volume
-(zvol) as a disk device with the system. As the disks are registered,
-.Xr \fBudev 7\fR
-will asynchronously create symlinks under
-.Em /dev/zvol
-using the zvol's name.
+When a ZFS pool is imported, the volumes within it will appear as block devices.
+As they're registered,
+.Xr udev 7
+asynchronously creates symlinks under
+.Pa /dev/zvol
+using the volumes' names.
.Nm
-will wait for all those symlinks to be created before returning.
+will wait for all those symlinks to be created before exiting.
+.
.Sh SEE ALSO
-.Xr \fBudev 7\fR
+.Xr udev 7
diff --git a/sys/contrib/openzfs/man/man4/spl.4 b/sys/contrib/openzfs/man/man4/spl.4
new file mode 100644
index 000000000000..11cde14ae5ca
--- /dev/null
+++ b/sys/contrib/openzfs/man/man4/spl.4
@@ -0,0 +1,195 @@
+.\"
+.\" The contents of this file are subject to the terms of the Common Development
+.\" and Distribution License (the "License"). You may not use this file except
+.\" in compliance with the License. You can obtain a copy of the license at
+.\" usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
+.\"
+.\" See the License for the specific language governing permissions and
+.\" limitations under the License. When distributing Covered Code, include this
+.\" CDDL HEADER in each file and include the License file at
+.\" usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this
+.\" CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your
+.\" own identifying information:
+.\" Portions Copyright [yyyy] [name of copyright owner]
+.\"
+.\" Copyright 2013 Turbo Fredriksson <turbo@bayour.com>. All rights reserved.
+.\"
+.Dd August 24, 2020
+.Dt SPL 4
+.Os
+.
+.Sh NAME
+.Nm spl
+.Nd parameters of the SPL kernel module
+.
+.Sh DESCRIPTION
+.Bl -tag -width Ds
+.It Sy spl_kmem_cache_kmem_threads Ns = Ns Sy 4 Pq uint
+The number of threads created for the spl_kmem_cache task queue.
+This task queue is responsible for allocating new slabs
+for use by the kmem caches.
+For the majority of systems and workloads only a small number of threads are
+required.
+.
+.It Sy spl_kmem_cache_reclaim Ns = Ns Sy 0 Pq uint
+When this is set it prevents Linux from being able to rapidly reclaim all the
+memory held by the kmem caches.
+This may be useful in circumstances where it's preferable that Linux
+reclaim memory from some other subsystem first.
+Setting this will increase the likelihood out of memory events on a memory
+constrained system.
+.
+.It Sy spl_kmem_cache_obj_per_slab Ns = Ns Sy 8 Pq uint
+The preferred number of objects per slab in the cache.
+In general, a larger value will increase the caches memory footprint
+while decreasing the time required to perform an allocation.
+Conversely, a smaller value will minimize the footprint
+and improve cache reclaim time but individual allocations may take longer.
+.
+.It Sy spl_kmem_cache_max_size Ns = Ns Sy 32 Po 64-bit Pc or Sy 4 Po 32-bit Pc Pq uint
+The maximum size of a kmem cache slab in MiB.
+This effectively limits the maximum cache object size to
+.Sy spl_kmem_cache_max_size Ns / Ns Sy spl_kmem_cache_obj_per_slab .
+.Pp
+Caches may not be created with
+object sized larger than this limit.
+.
+.It Sy spl_kmem_cache_slab_limit Ns = Ns Sy 16384 Pq uint
+For small objects the Linux slab allocator should be used to make the most
+efficient use of the memory.
+However, large objects are not supported by
+the Linux slab and therefore the SPL implementation is preferred.
+This value is used to determine the cutoff between a small and large object.
+.Pp
+Objects of size
+.Sy spl_kmem_cache_slab_limit
+or smaller will be allocated using the Linux slab allocator,
+large objects use the SPL allocator.
+A cutoff of 16K was determined to be optimal for architectures using 4K pages.
+.
+.It Sy spl_kmem_alloc_warn Ns = Ns Sy 32768 Pq uint
+As a general rule
+.Fn kmem_alloc
+allocations should be small,
+preferably just a few pages, since they must by physically contiguous.
+Therefore, a rate limited warning will be printed to the console for any
+.Fn kmem_alloc
+which exceeds a reasonable threshold.
+.Pp
+The default warning threshold is set to eight pages but capped at 32K to
+accommodate systems using large pages.
+This value was selected to be small enough to ensure
+the largest allocations are quickly noticed and fixed.
+But large enough to avoid logging any warnings when a allocation size is
+larger than optimal but not a serious concern.
+Since this value is tunable, developers are encouraged to set it lower
+when testing so any new largish allocations are quickly caught.
+These warnings may be disabled by setting the threshold to zero.
+.
+.It Sy spl_kmem_alloc_max Ns = Ns Sy KMALLOC_MAX_SIZE Ns / Ns Sy 4 Pq uint
+Large
+.Fn kmem_alloc
+allocations will fail if they exceed
+.Sy KMALLOC_MAX_SIZE .
+Allocations which are marginally smaller than this limit may succeed but
+should still be avoided due to the expense of locating a contiguous range
+of free pages.
+Therefore, a maximum kmem size with reasonable safely margin of 4x is set.
+.Fn kmem_alloc
+allocations larger than this maximum will quickly fail.
+.Fn vmem_alloc
+allocations less than or equal to this value will use
+.Fn kmalloc ,
+but shift to
+.Fn vmalloc
+when exceeding this value.
+.
+.It Sy spl_kmem_cache_magazine_size Ns = Ns Sy 0 Pq uint
+Cache magazines are an optimization designed to minimize the cost of
+allocating memory.
+They do this by keeping a per-cpu cache of recently
+freed objects, which can then be reallocated without taking a lock.
+This can improve performance on highly contended caches.
+However, because objects in magazines will prevent otherwise empty slabs
+from being immediately released this may not be ideal for low memory machines.
+.Pp
+For this reason,
+.Sy spl_kmem_cache_magazine_size
+can be used to set a maximum magazine size.
+When this value is set to 0 the magazine size will
+be automatically determined based on the object size.
+Otherwise magazines will be limited to 2-256 objects per magazine (i.e per cpu).
+Magazines may never be entirely disabled in this implementation.
+.
+.It Sy spl_hostid Ns = Ns Sy 0 Pq ulong
+The system hostid, when set this can be used to uniquely identify a system.
+By default this value is set to zero which indicates the hostid is disabled.
+It can be explicitly enabled by placing a unique non-zero value in
+.Pa /etc/hostid .
+.
+.It Sy spl_hostid_path Ns = Ns Pa /etc/hostid Pq charp
+The expected path to locate the system hostid when specified.
+This value may be overridden for non-standard configurations.
+.
+.It Sy spl_panic_halt Ns = Ns Sy 0 Pq uint
+Cause a kernel panic on assertion failures.
+When not enabled, the thread is halted to facilitate further debugging.
+.Pp
+Set to a non-zero value to enable.
+.
+.It Sy spl_taskq_kick Ns = Ns Sy 0 Pq uint
+Kick stuck taskq to spawn threads.
+When writing a non-zero value to it, it will scan all the taskqs.
+If any of them have a pending task more than 5 seconds old,
+it will kick it to spawn more threads.
+This can be used if you find a rare
+deadlock occurs because one or more taskqs didn't spawn a thread when it should.
+.
+.It Sy spl_taskq_thread_bind Ns = Ns Sy 0 Pq int
+Bind taskq threads to specific CPUs.
+When enabled all taskq threads will be distributed evenly
+across the available CPUs.
+By default, this behavior is disabled to allow the Linux scheduler
+the maximum flexibility to determine where a thread should run.
+.
+.It Sy spl_taskq_thread_dynamic Ns = Ns Sy 1 Pq int
+Allow dynamic taskqs.
+When enabled taskqs which set the
+.Sy TASKQ_DYNAMIC
+flag will by default create only a single thread.
+New threads will be created on demand up to a maximum allowed number
+to facilitate the completion of outstanding tasks.
+Threads which are no longer needed will be promptly destroyed.
+By default this behavior is enabled but it can be disabled to
+aid performance analysis or troubleshooting.
+.
+.It Sy spl_taskq_thread_priority Ns = Ns Sy 1 Pq int
+Allow newly created taskq threads to set a non-default scheduler priority.
+When enabled, the priority specified when a taskq is created will be applied
+to all threads created by that taskq.
+When disabled all threads will use the default Linux kernel thread priority.
+By default, this behavior is enabled.
+.
+.It Sy spl_taskq_thread_sequential Ns = Ns Sy 4 Pq int
+The number of items a taskq worker thread must handle without interruption
+before requesting a new worker thread be spawned.
+This is used to control
+how quickly taskqs ramp up the number of threads processing the queue.
+Because Linux thread creation and destruction are relatively inexpensive a
+small default value has been selected.
+This means that normally threads will be created aggressively which is desirable.
+Increasing this value will
+result in a slower thread creation rate which may be preferable for some
+configurations.
+.
+.It Sy spl_max_show_tasks Ns = Ns Sy 512 Pq uint
+The maximum number of tasks per pending list in each taskq shown in
+.Pa /proc/spl/taskq{,-all} .
+Write
+.Sy 0
+to turn off the limit.
+The proc file will walk the lists with lock held,
+reading it could cause a lock-up if the list grow too large
+without limiting the output.
+"(truncated)" will be shown if the list is larger than the limit.
+.El
diff --git a/sys/contrib/openzfs/man/man4/zfs.4 b/sys/contrib/openzfs/man/man4/zfs.4
new file mode 100644
index 000000000000..6da8d42b42bd
--- /dev/null
+++ b/sys/contrib/openzfs/man/man4/zfs.4
@@ -0,0 +1,2380 @@
+.\"
+.\" Copyright (c) 2013 by Turbo Fredriksson <turbo@bayour.com>. All rights reserved.
+.\" Copyright (c) 2019, 2021 by Delphix. All rights reserved.
+.\" Copyright (c) 2019 Datto Inc.
+.\" The contents of this file are subject to the terms of the Common Development
+.\" and Distribution License (the "License"). You may not use this file except
+.\" in compliance with the License. You can obtain a copy of the license at
+.\" usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
+.\"
+.\" See the License for the specific language governing permissions and
+.\" limitations under the License. When distributing Covered Code, include this
+.\" CDDL HEADER in each file and include the License file at
+.\" usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this
+.\" CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your
+.\" own identifying information:
+.\" Portions Copyright [yyyy] [name of copyright owner]
+.\"
+.Dd June 1, 2021
+.Dt ZFS 4
+.Os
+.
+.Sh NAME
+.Nm zfs
+.Nd tuning of the ZFS kernel module
+.
+.Sh DESCRIPTION
+The ZFS module supports these parameters:
+.Bl -tag -width Ds
+.It Sy dbuf_cache_max_bytes Ns = Ns Sy ULONG_MAX Ns B Pq ulong
+Maximum size in bytes of the dbuf cache.
+The target size is determined by the MIN versus
+.No 1/2^ Ns Sy dbuf_cache_shift Pq 1/32nd
+of the target ARC size.
+The behavior of the dbuf cache and its associated settings
+can be observed via the
+.Pa /proc/spl/kstat/zfs/dbufstats
+kstat.
+.
+.It Sy dbuf_metadata_cache_max_bytes Ns = Ns Sy ULONG_MAX Ns B Pq ulong
+Maximum size in bytes of the metadata dbuf cache.
+The target size is determined by the MIN versus
+.No 1/2^ Ns Sy dbuf_metadata_cache_shift Pq 1/64th
+of the target ARC size.
+The behavior of the metadata dbuf cache and its associated settings
+can be observed via the
+.Pa /proc/spl/kstat/zfs/dbufstats
+kstat.
+.
+.It Sy dbuf_cache_hiwater_pct Ns = Ns Sy 10 Ns % Pq uint
+The percentage over
+.Sy dbuf_cache_max_bytes
+when dbufs must be evicted directly.
+.
+.It Sy dbuf_cache_lowater_pct Ns = Ns Sy 10 Ns % Pq uint
+The percentage below
+.Sy dbuf_cache_max_bytes
+when the evict thread stops evicting dbufs.
+.
+.It Sy dbuf_cache_shift Ns = Ns Sy 5 Pq int
+Set the size of the dbuf cache
+.Pq Sy dbuf_cache_max_bytes
+to a log2 fraction of the target ARC size.
+.
+.It Sy dbuf_metadata_cache_shift Ns = Ns Sy 6 Pq int
+Set the size of the dbuf metadata cache
+.Pq Sy dbuf_metadata_cache_max_bytes
+to a log2 fraction of the target ARC size.
+.
+.It Sy dmu_object_alloc_chunk_shift Ns = Ns Sy 7 Po 128 Pc Pq int
+dnode slots allocated in a single operation as a power of 2.
+The default value minimizes lock contention for the bulk operation performed.
+.
+.It Sy dmu_prefetch_max Ns = Ns Sy 134217728 Ns B Po 128MB Pc Pq int
+Limit the amount we can prefetch with one call to this amount in bytes.
+This helps to limit the amount of memory that can be used by prefetching.
+.
+.It Sy ignore_hole_birth Pq int
+Alias for
+.Sy send_holes_without_birth_time .
+.
+.It Sy l2arc_feed_again Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Turbo L2ARC warm-up.
+When the L2ARC is cold the fill interval will be set as fast as possible.
+.
+.It Sy l2arc_feed_min_ms Ns = Ns Sy 200 Pq ulong
+Min feed interval in milliseconds.
+Requires
+.Sy l2arc_feed_again Ns = Ns Ar 1
+and only applicable in related situations.
+.
+.It Sy l2arc_feed_secs Ns = Ns Sy 1 Pq ulong
+Seconds between L2ARC writing.
+.
+.It Sy l2arc_headroom Ns = Ns Sy 2 Pq ulong
+How far through the ARC lists to search for L2ARC cacheable content,
+expressed as a multiplier of
+.Sy l2arc_write_max .
+ARC persistence across reboots can be achieved with persistent L2ARC
+by setting this parameter to
+.Sy 0 ,
+allowing the full length of ARC lists to be searched for cacheable content.
+.
+.It Sy l2arc_headroom_boost Ns = Ns Sy 200 Ns % Pq ulong
+Scales
+.Sy l2arc_headroom
+by this percentage when L2ARC contents are being successfully compressed
+before writing.
+A value of
+.Sy 100
+disables this feature.
+.
+.It Sy l2arc_mfuonly Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Controls whether only MFU metadata and data are cached from ARC into L2ARC.
+This may be desired to avoid wasting space on L2ARC when reading/writing large
+amounts of data that are not expected to be accessed more than once.
+.Pp
+The default is off,
+meaning both MRU and MFU data and metadata are cached.
+When turning off this feature, some MRU buffers will still be present
+in ARC and eventually cached on L2ARC.
+.No If Sy l2arc_noprefetch Ns = Ns Sy 0 ,
+some prefetched buffers will be cached to L2ARC, and those might later
+transition to MRU, in which case the
+.Sy l2arc_mru_asize No arcstat will not be Sy 0 .
+.Pp
+Regardless of
+.Sy l2arc_noprefetch ,
+some MFU buffers might be evicted from ARC,
+accessed later on as prefetches and transition to MRU as prefetches.
+If accessed again they are counted as MRU and the
+.Sy l2arc_mru_asize No arcstat will not be Sy 0 .
+.Pp
+The ARC status of L2ARC buffers when they were first cached in
+L2ARC can be seen in the
+.Sy l2arc_mru_asize , Sy l2arc_mfu_asize , No and Sy l2arc_prefetch_asize
+arcstats when importing the pool or onlining a cache
+device if persistent L2ARC is enabled.
+.Pp
+The
+.Sy evict_l2_eligible_mru
+arcstat does not take into account if this option is enabled as the information
+provided by the
+.Sy evict_l2_eligible_m[rf]u
+arcstats can be used to decide if toggling this option is appropriate
+for the current workload.
+.
+.It Sy l2arc_meta_percent Ns = Ns Sy 33 Ns % Pq int
+Percent of ARC size allowed for L2ARC-only headers.
+Since L2ARC buffers are not evicted on memory pressure,
+too many headers on a system with an irrationally large L2ARC
+can render it slow or unusable.
+This parameter limits L2ARC writes and rebuilds to achieve the target.
+.
+.It Sy l2arc_trim_ahead Ns = Ns Sy 0 Ns % Pq ulong
+Trims ahead of the current write size
+.Pq Sy l2arc_write_max
+on L2ARC devices by this percentage of write size if we have filled the device.
+If set to
+.Sy 100
+we TRIM twice the space required to accommodate upcoming writes.
+A minimum of
+.Sy 64MB
+will be trimmed.
+It also enables TRIM of the whole L2ARC device upon creation
+or addition to an existing pool or if the header of the device is
+invalid upon importing a pool or onlining a cache device.
+A value of
+.Sy 0
+disables TRIM on L2ARC altogether and is the default as it can put significant
+stress on the underlying storage devices.
+This will vary depending of how well the specific device handles these commands.
+.
+.It Sy l2arc_noprefetch Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Do not write buffers to L2ARC if they were prefetched but not used by
+applications.
+In case there are prefetched buffers in L2ARC and this option
+is later set, we do not read the prefetched buffers from L2ARC.
+Unsetting this option is useful for caching sequential reads from the
+disks to L2ARC and serve those reads from L2ARC later on.
+This may be beneficial in case the L2ARC device is significantly faster
+in sequential reads than the disks of the pool.
+.Pp
+Use
+.Sy 1
+to disable and
+.Sy 0
+to enable caching/reading prefetches to/from L2ARC.
+.
+.It Sy l2arc_norw Ns = Ns Sy 0 Ns | Ns 1 Pq int
+No reads during writes.
+.
+.It Sy l2arc_write_boost Ns = Ns Sy 8388608 Ns B Po 8MB Pc Pq ulong
+Cold L2ARC devices will have
+.Sy l2arc_write_max
+increased by this amount while they remain cold.
+.
+.It Sy l2arc_write_max Ns = Ns Sy 8388608 Ns B Po 8MB Pc Pq ulong
+Max write bytes per interval.
+.
+.It Sy l2arc_rebuild_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Rebuild the L2ARC when importing a pool (persistent L2ARC).
+This can be disabled if there are problems importing a pool
+or attaching an L2ARC device (e.g. the L2ARC device is slow
+in reading stored log metadata, or the metadata
+has become somehow fragmented/unusable).
+.
+.It Sy l2arc_rebuild_blocks_min_l2size Ns = Ns Sy 1073741824 Ns B Po 1GB Pc Pq ulong
+Mininum size of an L2ARC device required in order to write log blocks in it.
+The log blocks are used upon importing the pool to rebuild the persistent L2ARC.
+.Pp
+For L2ARC devices less than 1GB, the amount of data
+.Fn l2arc_evict
+evicts is significant compared to the amount of restored L2ARC data.
+In this case, do not write log blocks in L2ARC in order not to waste space.
+.
+.It Sy metaslab_aliquot Ns = Ns Sy 524288 Ns B Po 512kB Pc Pq ulong
+Metaslab granularity, in bytes.
+This is roughly similar to what would be referred to as the "stripe size"
+in traditional RAID arrays.
+In normal operation, ZFS will try to write this amount of data
+to a top-level vdev before moving on to the next one.
+.
+.It Sy metaslab_bias_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Enable metaslab group biasing based on their vdevs' over- or under-utilization
+relative to the pool.
+.
+.It Sy metaslab_force_ganging Ns = Ns Sy 16777217 Ns B Ns B Po 16MB + 1B Pc Pq ulong
+Make some blocks above a certain size be gang blocks.
+This option is used by the test suite to facilitate testing.
+.
+.It Sy zfs_history_output_max Ns = Ns Sy 1048576 Ns B Ns B Po 1MB Pc Pq int
+When attempting to log an output nvlist of an ioctl in the on-disk history,
+the output will not be stored if it is larger than this size (in bytes).
+This must be less than
+.Sy DMU_MAX_ACCESS Pq 64MB .
+This applies primarily to
+.Fn zfs_ioc_channel_program Pq cf. Xr zfs-program 8 .
+.
+.It Sy zfs_keep_log_spacemaps_at_export Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Prevent log spacemaps from being destroyed during pool exports and destroys.
+.
+.It Sy zfs_metaslab_segment_weight_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Enable/disable segment-based metaslab selection.
+.
+.It Sy zfs_metaslab_switch_threshold Ns = Ns Sy 2 Pq int
+When using segment-based metaslab selection, continue allocating
+from the active metaslab until this option's
+worth of buckets have been exhausted.
+.
+.It Sy metaslab_debug_load Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Load all metaslabs during pool import.
+.
+.It Sy metaslab_debug_unload Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Prevent metaslabs from being unloaded.
+.
+.It Sy metaslab_fragmentation_factor_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Enable use of the fragmentation metric in computing metaslab weights.
+.
+.It Sy metaslab_df_max_search Ns = Ns Sy 16777216 Ns B Po 16MB Pc Pq int
+Maximum distance to search forward from the last offset.
+Without this limit, fragmented pools can see
+.Em >100`000
+iterations and
+.Fn metaslab_block_picker
+becomes the performance limiting factor on high-performance storage.
+.Pp
+With the default setting of
+.Sy 16MB ,
+we typically see less than
+.Em 500
+iterations, even with very fragmented
+.Sy ashift Ns = Ns Sy 9
+pools.
+The maximum number of iterations possible is
+.Sy metaslab_df_max_search / 2^(ashift+1) .
+With the default setting of
+.Sy 16MB
+this is
+.Em 16*1024 Pq with Sy ashift Ns = Ns Sy 9
+or
+.Em 2*1024 Pq with Sy ashift Ns = Ns Sy 12 .
+.
+.It Sy metaslab_df_use_largest_segment Ns = Ns Sy 0 Ns | Ns 1 Pq int
+If not searching forward (due to
+.Sy metaslab_df_max_search , metaslab_df_free_pct ,
+.No or Sy metaslab_df_alloc_threshold ) ,
+this tunable controls which segment is used.
+If set, we will use the largest free segment.
+If unset, we will use a segment of at least the requested size.
+.
+.It Sy zfs_metaslab_max_size_cache_sec Ns = Ns Sy 3600 Ns s Po 1h Pc Pq ulong
+When we unload a metaslab, we cache the size of the largest free chunk.
+We use that cached size to determine whether or not to load a metaslab
+for a given allocation.
+As more frees accumulate in that metaslab while it's unloaded,
+the cached max size becomes less and less accurate.
+After a number of seconds controlled by this tunable,
+we stop considering the cached max size and start
+considering only the histogram instead.
+.
+.It Sy zfs_metaslab_mem_limit Ns = Ns Sy 25 Ns % Pq int
+When we are loading a new metaslab, we check the amount of memory being used
+to store metaslab range trees.
+If it is over a threshold, we attempt to unload the least recently used metaslab
+to prevent the system from clogging all of its memory with range trees.
+This tunable sets the percentage of total system memory that is the threshold.
+.
+.It Sy zfs_metaslab_try_hard_before_gang Ns = Ns Sy 0 Ns | Ns 1 Pq int
+.Bl -item -compact
+.It
+If unset, we will first try normal allocation.
+.It
+If that fails then we will do a gang allocation.
+.It
+If that fails then we will do a "try hard" gang allocation.
+.It
+If that fails then we will have a multi-layer gang block.
+.El
+.Pp
+.Bl -item -compact
+.It
+If set, we will first try normal allocation.
+.It
+If that fails then we will do a "try hard" allocation.
+.It
+If that fails we will do a gang allocation.
+.It
+If that fails we will do a "try hard" gang allocation.
+.It
+If that fails then we will have a multi-layer gang block.
+.El
+.
+.It Sy zfs_metaslab_find_max_tries Ns = Ns Sy 100 Pq int
+When not trying hard, we only consider this number of the best metaslabs.
+This improves performance, especially when there are many metaslabs per vdev
+and the allocation can't actually be satisfied
+(so we would otherwise iterate all metaslabs).
+.
+.It Sy zfs_vdev_default_ms_count Ns = Ns Sy 200 Pq int
+When a vdev is added, target this number of metaslabs per top-level vdev.
+.
+.It Sy zfs_vdev_default_ms_shift Ns = Ns Sy 29 Po 512MB Pc Pq int
+Default limit for metaslab size.
+.
+.It Sy zfs_vdev_max_auto_ashift Ns = Ns Sy ASHIFT_MAX Po 16 Pc Pq ulong
+Maximum ashift used when optimizing for logical -> physical sector size on new
+top-level vdevs.
+.
+.It Sy zfs_vdev_min_auto_ashift Ns = Ns Sy ASHIFT_MIN Po 9 Pc Pq ulong
+Minimum ashift used when creating new top-level vdevs.
+.
+.It Sy zfs_vdev_min_ms_count Ns = Ns Sy 16 Pq int
+Minimum number of metaslabs to create in a top-level vdev.
+.
+.It Sy vdev_validate_skip Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Skip label validation steps during pool import.
+Changing is not recommended unless you know what you're doing
+and are recovering a damaged label.
+.
+.It Sy zfs_vdev_ms_count_limit Ns = Ns Sy 131072 Po 128k Pc Pq int
+Practical upper limit of total metaslabs per top-level vdev.
+.
+.It Sy metaslab_preload_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Enable metaslab group preloading.
+.
+.It Sy metaslab_lba_weighting_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Give more weight to metaslabs with lower LBAs,
+assuming they have greater bandwidth,
+as is typically the case on a modern constant angular velocity disk drive.
+.
+.It Sy metaslab_unload_delay Ns = Ns Sy 32 Pq int
+After a metaslab is used, we keep it loaded for this many TXGs, to attempt to
+reduce unnecessary reloading.
+Note that both this many TXGs and
+.Sy metaslab_unload_delay_ms
+milliseconds must pass before unloading will occur.
+.
+.It Sy metaslab_unload_delay_ms Ns = Ns Sy 600000 Ns ms Po 10min Pc Pq int
+After a metaslab is used, we keep it loaded for this many milliseconds,
+to attempt to reduce unnecessary reloading.
+Note, that both this many milliseconds and
+.Sy metaslab_unload_delay
+TXGs must pass before unloading will occur.
+.
+.It Sy reference_history Ns = Ns Sy 3 Pq int
+Maximum reference holders being tracked when reference_tracking_enable is active.
+.
+.It Sy reference_tracking_enable Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Track reference holders to
+.Sy refcount_t
+objects (debug builds only).
+.
+.It Sy send_holes_without_birth_time Ns = Ns Sy 1 Ns | Ns 0 Pq int
+When set, the
+.Sy hole_birth
+optimization will not be used, and all holes will always be sent during a
+.Nm zfs Cm send .
+This is useful if you suspect your datasets are affected by a bug in
+.Sy hole_birth .
+.
+.It Sy spa_config_path Ns = Ns Pa /etc/zfs/zpool.cache Pq charp
+SPA config file.
+.
+.It Sy spa_asize_inflation Ns = Ns Sy 24 Pq int
+Multiplication factor used to estimate actual disk consumption from the
+size of data being written.
+The default value is a worst case estimate,
+but lower values may be valid for a given pool depending on its configuration.
+Pool administrators who understand the factors involved
+may wish to specify a more realistic inflation factor,
+particularly if they operate close to quota or capacity limits.
+.
+.It Sy spa_load_print_vdev_tree Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Whether to print the vdev tree in the debugging message buffer during pool import.
+.
+.It Sy spa_load_verify_data Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Whether to traverse data blocks during an "extreme rewind"
+.Pq Fl X
+import.
+.Pp
+An extreme rewind import normally performs a full traversal of all
+blocks in the pool for verification.
+If this parameter is unset, the traversal skips non-metadata blocks.
+It can be toggled once the
+import has started to stop or start the traversal of non-metadata blocks.
+.
+.It Sy spa_load_verify_metadata Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Whether to traverse blocks during an "extreme rewind"
+.Pq Fl X
+pool import.
+.Pp
+An extreme rewind import normally performs a full traversal of all
+blocks in the pool for verification.
+If this parameter is unset, the traversal is not performed.
+It can be toggled once the import has started to stop or start the traversal.
+.
+.It Sy spa_load_verify_shift Ns = Ns Sy 4 Po 1/16th Pc Pq int
+Sets the maximum number of bytes to consume during pool import to the log2
+fraction of the target ARC size.
+.
+.It Sy spa_slop_shift Ns = Ns Sy 5 Po 1/32nd Pc Pq int
+Normally, we don't allow the last
+.Sy 3.2% Pq Sy 1/2^spa_slop_shift
+of space in the pool to be consumed.
+This ensures that we don't run the pool completely out of space,
+due to unaccounted changes (e.g. to the MOS).
+It also limits the worst-case time to allocate space.
+If we have less than this amount of free space,
+most ZPL operations (e.g. write, create) will return
+.Sy ENOSPC .
+.
+.It Sy vdev_removal_max_span Ns = Ns Sy 32768 Ns B Po 32kB Pc Pq int
+During top-level vdev removal, chunks of data are copied from the vdev
+which may include free space in order to trade bandwidth for IOPS.
+This parameter determines the maximum span of free space, in bytes,
+which will be included as "unnecessary" data in a chunk of copied data.
+.Pp
+The default value here was chosen to align with
+.Sy zfs_vdev_read_gap_limit ,
+which is a similar concept when doing
+regular reads (but there's no reason it has to be the same).
+.
+.It Sy vdev_file_logical_ashift Ns = Ns Sy 9 Po 512B Pc Pq ulong
+Logical ashift for file-based devices.
+.
+.It Sy vdev_file_physical_ashift Ns = Ns Sy 9 Po 512B Pc Pq ulong
+Physical ashift for file-based devices.
+.
+.It Sy zap_iterate_prefetch Ns = Ns Sy 1 Ns | Ns 0 Pq int
+If set, when we start iterating over a ZAP object,
+prefetch the entire object (all leaf blocks).
+However, this is limited by
+.Sy dmu_prefetch_max .
+.
+.It Sy zfetch_array_rd_sz Ns = Ns Sy 1048576 Ns B Po 1MB Pc Pq ulong
+If prefetching is enabled, disable prefetching for reads larger than this size.
+.
+.It Sy zfetch_max_distance Ns = Ns Sy 8388608 Ns B Po 8MB Pc Pq uint
+Max bytes to prefetch per stream.
+.
+.It Sy zfetch_max_idistance Ns = Ns Sy 67108864 Ns B Po 64MB Pc Pq uint
+Max bytes to prefetch indirects for per stream.
+.
+.It Sy zfetch_max_streams Ns = Ns Sy 8 Pq uint
+Max number of streams per zfetch (prefetch streams per file).
+.
+.It Sy zfetch_min_sec_reap Ns = Ns Sy 2 Pq uint
+Min time before an active prefetch stream can be reclaimed
+.
+.It Sy zfs_abd_scatter_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Enables ARC from using scatter/gather lists and forces all allocations to be
+linear in kernel memory.
+Disabling can improve performance in some code paths
+at the expense of fragmented kernel memory.
+.
+.It Sy zfs_abd_scatter_max_order Ns = Ns Sy MAX_ORDER-1 Pq uint
+Maximum number of consecutive memory pages allocated in a single block for
+scatter/gather lists.
+.Pp
+The value of
+.Sy MAX_ORDER
+depends on kernel configuration.
+.
+.It Sy zfs_abd_scatter_min_size Ns = Ns Sy 1536 Ns B Po 1.5kB Pc Pq uint
+This is the minimum allocation size that will use scatter (page-based) ABDs.
+Smaller allocations will use linear ABDs.
+.
+.It Sy zfs_arc_dnode_limit Ns = Ns Sy 0 Ns B Pq ulong
+When the number of bytes consumed by dnodes in the ARC exceeds this number of
+bytes, try to unpin some of it in response to demand for non-metadata.
+This value acts as a ceiling to the amount of dnode metadata, and defaults to
+.Sy 0 ,
+which indicates that a percent which is based on
+.Sy zfs_arc_dnode_limit_percent
+of the ARC meta buffers that may be used for dnodes.
+.Pp
+Also see
+.Sy zfs_arc_meta_prune
+which serves a similar purpose but is used
+when the amount of metadata in the ARC exceeds
+.Sy zfs_arc_meta_limit
+rather than in response to overall demand for non-metadata.
+.
+.It Sy zfs_arc_dnode_limit_percent Ns = Ns Sy 10 Ns % Pq ulong
+Percentage that can be consumed by dnodes of ARC meta buffers.
+.Pp
+See also
+.Sy zfs_arc_dnode_limit ,
+which serves a similar purpose but has a higher priority if nonzero.
+.
+.It Sy zfs_arc_dnode_reduce_percent Ns = Ns Sy 10 Ns % Pq ulong
+Percentage of ARC dnodes to try to scan in response to demand for non-metadata
+when the number of bytes consumed by dnodes exceeds
+.Sy zfs_arc_dnode_limit .
+.
+.It Sy zfs_arc_average_blocksize Ns = Ns Sy 8192 Ns B Po 8kB Pc Pq int
+The ARC's buffer hash table is sized based on the assumption of an average
+block size of this value.
+This works out to roughly 1MB of hash table per 1GB of physical memory
+with 8-byte pointers.
+For configurations with a known larger average block size,
+this value can be increased to reduce the memory footprint.
+.
+.It Sy zfs_arc_eviction_pct Ns = Ns Sy 200 Ns % Pq int
+When
+.Fn arc_is_overflowing ,
+.Fn arc_get_data_impl
+waits for this percent of the requested amount of data to be evicted.
+For example, by default, for every
+.Em 2kB
+that's evicted,
+.Em 1kB
+of it may be "reused" by a new allocation.
+Since this is above
+.Sy 100 Ns % ,
+it ensures that progress is made towards getting
+.Sy arc_size No under Sy arc_c .
+Since this is finite, it ensures that allocations can still happen,
+even during the potentially long time that
+.Sy arc_size No is more than Sy arc_c .
+.
+.It Sy zfs_arc_evict_batch_limit Ns = Ns Sy 10 Pq int
+Number ARC headers to evict per sub-list before proceeding to another sub-list.
+This batch-style operation prevents entire sub-lists from being evicted at once
+but comes at a cost of additional unlocking and locking.
+.
+.It Sy zfs_arc_grow_retry Ns = Ns Sy 0 Ns s Pq int
+If set to a non zero value, it will replace the
+.Sy arc_grow_retry
+value with this value.
+The
+.Sy arc_grow_retry
+.No value Pq default Sy 5 Ns s
+is the number of seconds the ARC will wait before
+trying to resume growth after a memory pressure event.
+.
+.It Sy zfs_arc_lotsfree_percent Ns = Ns Sy 10 Ns % Pq int
+Throttle I/O when free system memory drops below this percentage of total
+system memory.
+Setting this value to
+.Sy 0
+will disable the throttle.
+.
+.It Sy zfs_arc_max Ns = Ns Sy 0 Ns B Pq ulong
+Max size of ARC in bytes.
+If
+.Sy 0 ,
+then the max size of ARC is determined by the amount of system memory installed.
+Under Linux, half of system memory will be used as the limit.
+Under
+.Fx ,
+the larger of
+.Sy all_system_memory - 1GB No and Sy 5/8 * all_system_memory
+will be used as the limit.
+This value must be at least
+.Sy 67108864 Ns B Pq 64MB .
+.Pp
+This value can be changed dynamically, with some caveats.
+It cannot be set back to
+.Sy 0
+while running, and reducing it below the current ARC size will not cause
+the ARC to shrink without memory pressure to induce shrinking.
+.
+.It Sy zfs_arc_meta_adjust_restarts Ns = Ns Sy 4096 Pq ulong
+The number of restart passes to make while scanning the ARC attempting
+the free buffers in order to stay below the
+.Sy fs_arc_meta_limit .
+This value should not need to be tuned but is available to facilitate
+performance analysis.
+.
+.It Sy zfs_arc_meta_limit Ns = Ns Sy 0 Ns B Pq ulong
+The maximum allowed size in bytes that metadata buffers are allowed to
+consume in the ARC.
+When this limit is reached, metadata buffers will be reclaimed,
+even if the overall
+.Sy arc_c_max
+has not been reached.
+It defaults to
+.Sy 0 ,
+which indicates that a percentage based on
+.Sy zfs_arc_meta_limit_percent
+of the ARC may be used for metadata.
+.Pp
+This value my be changed dynamically, except that must be set to an explicit value
+.Pq cannot be set back to Sy 0 .
+.
+.It Sy zfs_arc_meta_limit_percent Ns = Ns Sy 75 Ns % Pq ulong
+Percentage of ARC buffers that can be used for metadata.
+.Pp
+See also
+.Sy zfs_arc_meta_limit ,
+which serves a similar purpose but has a higher priority if nonzero.
+.
+.It Sy zfs_arc_meta_min Ns = Ns Sy 0 Ns B Pq ulong
+The minimum allowed size in bytes that metadata buffers may consume in
+the ARC.
+.
+.It Sy zfs_arc_meta_prune Ns = Ns Sy 10000 Pq int
+The number of dentries and inodes to be scanned looking for entries
+which can be dropped.
+This may be required when the ARC reaches the
+.Sy zfs_arc_meta_limit
+because dentries and inodes can pin buffers in the ARC.
+Increasing this value will cause to dentry and inode caches
+to be pruned more aggressively.
+Setting this value to
+.Sy 0
+will disable pruning the inode and dentry caches.
+.
+.It Sy zfs_arc_meta_strategy Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Define the strategy for ARC metadata buffer eviction (meta reclaim strategy):
+.Bl -tag -compact -offset 4n -width "0 (META_ONLY)"
+.It Sy 0 Pq META_ONLY
+evict only the ARC metadata buffers
+.It Sy 1 Pq BALANCED
+additional data buffers may be evicted if required
+to evict the required number of metadata buffers.
+.El
+.
+.It Sy zfs_arc_min Ns = Ns Sy 0 Ns B Pq ulong
+Min size of ARC in bytes.
+.No If set to Sy 0 , arc_c_min
+will default to consuming the larger of
+.Sy 32MB No or Sy all_system_memory/32 .
+.
+.It Sy zfs_arc_min_prefetch_ms Ns = Ns Sy 0 Ns ms Ns Po Ns ≡ Ns 1s Pc Pq int
+Minimum time prefetched blocks are locked in the ARC.
+.
+.It Sy zfs_arc_min_prescient_prefetch_ms Ns = Ns Sy 0 Ns ms Ns Po Ns ≡ Ns 6s Pc Pq int
+Minimum time "prescient prefetched" blocks are locked in the ARC.
+These blocks are meant to be prefetched fairly aggressively ahead of
+the code that may use them.
+.
+.It Sy zfs_max_missing_tvds Ns = Ns Sy 0 Pq int
+Number of missing top-level vdevs which will be allowed during
+pool import (only in read-only mode).
+.
+.It Sy zfs_max_nvlist_src_size Ns = Sy 0 Pq ulong
+Maximum size in bytes allowed to be passed as
+.Sy zc_nvlist_src_size
+for ioctls on
+.Pa /dev/zfs .
+This prevents a user from causing the kernel to allocate
+an excessive amount of memory.
+When the limit is exceeded, the ioctl fails with
+.Sy EINVAL
+and a description of the error is sent to the
+.Pa zfs-dbgmsg
+log.
+This parameter should not need to be touched under normal circumstances.
+If
+.Sy 0 ,
+equivalent to a quarter of the user-wired memory limit under
+.Fx
+and to
+.Sy 134217728 Ns B Pq 128MB
+under Linux.
+.
+.It Sy zfs_multilist_num_sublists Ns = Ns Sy 0 Pq int
+To allow more fine-grained locking, each ARC state contains a series
+of lists for both data and metadata objects.
+Locking is performed at the level of these "sub-lists".
+This parameters controls the number of sub-lists per ARC state,
+and also applies to other uses of the multilist data structure.
+.Pp
+If
+.Sy 0 ,
+equivalent to the greater of the number of online CPUs and
+.Sy 4 .
+.
+.It Sy zfs_arc_overflow_shift Ns = Ns Sy 8 Pq int
+The ARC size is considered to be overflowing if it exceeds the current
+ARC target size
+.Pq Sy arc_c
+by a threshold determined by this parameter.
+The threshold is calculated as a fraction of
+.Sy arc_c
+using the formula
+.Sy arc_c >> zfs_arc_overflow_shift .
+.Pp
+The default value of
+.Sy 8
+causes the ARC to be considered overflowing if it exceeds the target size by
+.Em 1/256th Pq Em 0.3%
+of the target size.
+.Pp
+When the ARC is overflowing, new buffer allocations are stalled until
+the reclaim thread catches up and the overflow condition no longer exists.
+.
+.It Sy zfs_arc_p_min_shift Ns = Ns Sy 0 Pq int
+If nonzero, this will update
+.Sy arc_p_min_shift Pq default Sy 4
+with the new value.
+.Sy arc_p_min_shift No is used as a shift of Sy arc_c
+when calculating the minumum
+.Sy arc_p No size.
+.
+.It Sy zfs_arc_p_dampener_disable Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Disable
+.Sy arc_p
+adapt dampener, which reduces the maximum single adjustment to
+.Sy arc_p .
+.
+.It Sy zfs_arc_shrink_shift Ns = Ns Sy 0 Pq int
+If nonzero, this will update
+.Sy arc_shrink_shift Pq default Sy 7
+with the new value.
+.
+.It Sy zfs_arc_pc_percent Ns = Ns Sy 0 Ns % Po off Pc Pq uint
+Percent of pagecache to reclaim ARC to.
+.Pp
+This tunable allows the ZFS ARC to play more nicely
+with the kernel's LRU pagecache.
+It can guarantee that the ARC size won't collapse under scanning
+pressure on the pagecache, yet still allows the ARC to be reclaimed down to
+.Sy zfs_arc_min
+if necessary.
+This value is specified as percent of pagecache size (as measured by
+.Sy NR_FILE_PAGES ) ,
+where that percent may exceed
+.Sy 100 .
+This
+only operates during memory pressure/reclaim.
+.
+.It Sy zfs_arc_shrinker_limit Ns = Ns Sy 10000 Pq int
+This is a limit on how many pages the ARC shrinker makes available for
+eviction in response to one page allocation attempt.
+Note that in practice, the kernel's shrinker can ask us to evict
+up to about four times this for one allocation attempt.
+.Pp
+The default limit of
+.Sy 10000 Pq in practice, Em 160MB No per allocation attempt with 4kB pages
+limits the amount of time spent attempting to reclaim ARC memory to
+less than 100ms per allocation attempt,
+even with a small average compressed block size of ~8kB.
+.Pp
+The parameter can be set to 0 (zero) to disable the limit,
+and only applies on Linux.
+.
+.It Sy zfs_arc_sys_free Ns = Ns Sy 0 Ns B Pq ulong
+The target number of bytes the ARC should leave as free memory on the system.
+If zero, equivalent to the bigger of
+.Sy 512kB No and Sy all_system_memory/64 .
+.
+.It Sy zfs_autoimport_disable Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Disable pool import at module load by ignoring the cache file
+.Pq Sy spa_config_path .
+.
+.It Sy zfs_checksum_events_per_second Ns = Ns Sy 20 Ns /s Pq uint
+Rate limit checksum events to this many per second.
+Note that this should not be set below the ZED thresholds
+(currently 10 checksums over 10 seconds)
+or else the daemon may not trigger any action.
+.
+.It Sy zfs_commit_timeout_pct Ns = Ns Sy 5 Ns % Pq int
+This controls the amount of time that a ZIL block (lwb) will remain "open"
+when it isn't "full", and it has a thread waiting for it to be committed to
+stable storage.
+The timeout is scaled based on a percentage of the last lwb
+latency to avoid significantly impacting the latency of each individual
+transaction record (itx).
+.
+.It Sy zfs_condense_indirect_commit_entry_delay_ms Ns = Ns Sy 0 Ns ms Pq int
+Vdev indirection layer (used for device removal) sleeps for this many
+milliseconds during mapping generation.
+Intended for use with the test suite to throttle vdev removal speed.
+.
+.It Sy zfs_condense_indirect_obsolete_pct Ns = Ns Sy 25 Ns % Pq int
+Minimum percent of obsolete bytes in vdev mapping required to attempt to condense
+.Pq see Sy zfs_condense_indirect_vdevs_enable .
+Intended for use with the test suite
+to facilitate triggering condensing as needed.
+.
+.It Sy zfs_condense_indirect_vdevs_enable Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Enable condensing indirect vdev mappings.
+When set, attempt to condense indirect vdev mappings
+if the mapping uses more than
+.Sy zfs_condense_min_mapping_bytes
+bytes of memory and if the obsolete space map object uses more than
+.Sy zfs_condense_max_obsolete_bytes
+bytes on-disk.
+The condensing process is an attempt to save memory by removing obsolete mappings.
+.
+.It Sy zfs_condense_max_obsolete_bytes Ns = Ns Sy 1073741824 Ns B Po 1GB Pc Pq ulong
+Only attempt to condense indirect vdev mappings if the on-disk size
+of the obsolete space map object is greater than this number of bytes
+.Pq see Sy zfs_condense_indirect_vdevs_enable .
+.
+.It Sy zfs_condense_min_mapping_bytes Ns = Ns Sy 131072 Ns B Po 128kB Pc Pq ulong
+Minimum size vdev mapping to attempt to condense
+.Pq see Sy zfs_condense_indirect_vdevs_enable .
+.
+.It Sy zfs_dbgmsg_enable Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Internally ZFS keeps a small log to facilitate debugging.
+The log is enabled by default, and can be disabled by unsetting this option.
+The contents of the log can be accessed by reading
+.Pa /proc/spl/kstat/zfs/dbgmsg .
+Writing
+.Sy 0
+to the file clears the log.
+.Pp
+This setting does not influence debug prints due to
+.Sy zfs_flags .
+.
+.It Sy zfs_dbgmsg_maxsize Ns = Ns Sy 4194304 Ns B Po 4MB Pc Pq int
+Maximum size of the internal ZFS debug log.
+.
+.It Sy zfs_dbuf_state_index Ns = Ns Sy 0 Pq int
+Historically used for controlling what reporting was available under
+.Pa /proc/spl/kstat/zfs .
+No effect.
+.
+.It Sy zfs_deadman_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
+When a pool sync operation takes longer than
+.Sy zfs_deadman_synctime_ms ,
+or when an individual I/O operation takes longer than
+.Sy zfs_deadman_ziotime_ms ,
+then the operation is considered to be "hung".
+If
+.Sy zfs_deadman_enabled
+is set, then the deadman behavior is invoked as described by
+.Sy zfs_deadman_failmode .
+By default, the deadman is enabled and set to
+.Sy wait
+which results in "hung" I/Os only being logged.
+The deadman is automatically disabled when a pool gets suspended.
+.
+.It Sy zfs_deadman_failmode Ns = Ns Sy wait Pq charp
+Controls the failure behavior when the deadman detects a "hung" I/O operation.
+Valid values are:
+.Bl -tag -compact -offset 4n -width "continue"
+.It Sy wait
+Wait for a "hung" operation to complete.
+For each "hung" operation a "deadman" event will be posted
+describing that operation.
+.It Sy continue
+Attempt to recover from a "hung" operation by re-dispatching it
+to the I/O pipeline if possible.
+.It Sy panic
+Panic the system.
+This can be used to facilitate automatic fail-over
+to a properly configured fail-over partner.
+.El
+.
+.It Sy zfs_deadman_checktime_ms Ns = Ns Sy 60000 Ns ms Po 1min Pc Pq int
+Check time in milliseconds.
+This defines the frequency at which we check for hung I/O requests
+and potentially invoke the
+.Sy zfs_deadman_failmode
+behavior.
+.
+.It Sy zfs_deadman_synctime_ms Ns = Ns Sy 600000 Ns ms Po 10min Pc Pq ulong
+Interval in milliseconds after which the deadman is triggered and also
+the interval after which a pool sync operation is considered to be "hung".
+Once this limit is exceeded the deadman will be invoked every
+.Sy zfs_deadman_checktime_ms
+milliseconds until the pool sync completes.
+.
+.It Sy zfs_deadman_ziotime_ms Ns = Ns Sy 300000 Ns ms Po 5min Pc Pq ulong
+Interval in milliseconds after which the deadman is triggered and an
+individual I/O operation is considered to be "hung".
+As long as the operation remains "hung",
+the deadman will be invoked every
+.Sy zfs_deadman_checktime_ms
+milliseconds until the operation completes.
+.
+.It Sy zfs_dedup_prefetch Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Enable prefetching dedup-ed blocks which are going to be freed.
+.
+.It Sy zfs_delay_min_dirty_percent Ns = Ns Sy 60 Ns % Pq int
+Start to delay each transaction once there is this amount of dirty data,
+expressed as a percentage of
+.Sy zfs_dirty_data_max .
+This value should be at least
+.Sy zfs_vdev_async_write_active_max_dirty_percent .
+.No See Sx ZFS TRANSACTION DELAY .
+.
+.It Sy zfs_delay_scale Ns = Ns Sy 500000 Pq int
+This controls how quickly the transaction delay approaches infinity.
+Larger values cause longer delays for a given amount of dirty data.
+.Pp
+For the smoothest delay, this value should be about 1 billion divided
+by the maximum number of operations per second.
+This will smoothly handle between ten times and a tenth of this number.
+.No See Sx ZFS TRANSACTION DELAY .
+.Pp
+.Sy zfs_delay_scale * zfs_dirty_data_max Em must be smaller than Sy 2^64 .
+.
+.It Sy zfs_disable_ivset_guid_check Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Disables requirement for IVset GUIDs to be present and match when doing a raw
+receive of encrypted datasets.
+Intended for users whose pools were created with
+OpenZFS pre-release versions and now have compatibility issues.
+.
+.It Sy zfs_key_max_salt_uses Ns = Ns Sy 400000000 Po 4*10^8 Pc Pq ulong
+Maximum number of uses of a single salt value before generating a new one for
+encrypted datasets.
+The default value is also the maximum.
+.
+.It Sy zfs_object_mutex_size Ns = Ns Sy 64 Pq uint
+Size of the znode hashtable used for holds.
+.Pp
+Due to the need to hold locks on objects that may not exist yet, kernel mutexes
+are not created per-object and instead a hashtable is used where collisions
+will result in objects waiting when there is not actually contention on the
+same object.
+.
+.It Sy zfs_slow_io_events_per_second Ns = Ns Sy 20 Ns /s Pq int
+Rate limit delay and deadman zevents (which report slow I/Os) to this many per
+second.
+.
+.It Sy zfs_unflushed_max_mem_amt Ns = Ns Sy 1073741824 Ns B Po 1GB Pc Pq ulong
+Upper-bound limit for unflushed metadata changes to be held by the
+log spacemap in memory, in bytes.
+.
+.It Sy zfs_unflushed_max_mem_ppm Ns = Ns Sy 1000 Ns ppm Po 0.1% Pc Pq ulong
+Part of overall system memory that ZFS allows to be used
+for unflushed metadata changes by the log spacemap, in millionths.
+.
+.It Sy zfs_unflushed_log_block_max Ns = Ns Sy 262144 Po 256k Pc Pq ulong
+Describes the maximum number of log spacemap blocks allowed for each pool.
+The default value means that the space in all the log spacemaps
+can add up to no more than
+.Sy 262144
+blocks (which means
+.Em 32GB
+of logical space before compression and ditto blocks,
+assuming that blocksize is
+.Em 128kB ) .
+.Pp
+This tunable is important because it involves a trade-off between import
+time after an unclean export and the frequency of flushing metaslabs.
+The higher this number is, the more log blocks we allow when the pool is
+active which means that we flush metaslabs less often and thus decrease
+the number of I/Os for spacemap updates per TXG.
+At the same time though, that means that in the event of an unclean export,
+there will be more log spacemap blocks for us to read, inducing overhead
+in the import time of the pool.
+The lower the number, the amount of flushing increases, destroying log
+blocks quicker as they become obsolete faster, which leaves less blocks
+to be read during import time after a crash.
+.Pp
+Each log spacemap block existing during pool import leads to approximately
+one extra logical I/O issued.
+This is the reason why this tunable is exposed in terms of blocks rather
+than space used.
+.
+.It Sy zfs_unflushed_log_block_min Ns = Ns Sy 1000 Pq ulong
+If the number of metaslabs is small and our incoming rate is high,
+we could get into a situation that we are flushing all our metaslabs every TXG.
+Thus we always allow at least this many log blocks.
+.
+.It Sy zfs_unflushed_log_block_pct Ns = Ns Sy 400 Ns % Pq ulong
+Tunable used to determine the number of blocks that can be used for
+the spacemap log, expressed as a percentage of the total number of
+metaslabs in the pool.
+.
+.It Sy zfs_unlink_suspend_progress Ns = Ns Sy 0 Ns | Ns 1 Pq uint
+When enabled, files will not be asynchronously removed from the list of pending
+unlinks and the space they consume will be leaked.
+Once this option has been disabled and the dataset is remounted,
+the pending unlinks will be processed and the freed space returned to the pool.
+This option is used by the test suite.
+.
+.It Sy zfs_delete_blocks Ns = Ns Sy 20480 Pq ulong
+This is the used to define a large file for the purposes of deletion.
+Files containing more than
+.Sy zfs_delete_blocks
+will be deleted asynchronously, while smaller files are deleted synchronously.
+Decreasing this value will reduce the time spent in an
+.Xr unlink 2
+system call, at the expense of a longer delay before the freed space is available.
+.
+.It Sy zfs_dirty_data_max Ns = Pq int
+Determines the dirty space limit in bytes.
+Once this limit is exceeded, new writes are halted until space frees up.
+This parameter takes precedence over
+.Sy zfs_dirty_data_max_percent .
+.No See Sx ZFS TRANSACTION DELAY .
+.Pp
+Defaults to
+.Sy physical_ram/10 ,
+capped at
+.Sy zfs_dirty_data_max_max .
+.
+.It Sy zfs_dirty_data_max_max Ns = Pq int
+Maximum allowable value of
+.Sy zfs_dirty_data_max ,
+expressed in bytes.
+This limit is only enforced at module load time, and will be ignored if
+.Sy zfs_dirty_data_max
+is later changed.
+This parameter takes precedence over
+.Sy zfs_dirty_data_max_max_percent .
+.No See Sx ZFS TRANSACTION DELAY .
+.Pp
+Defaults to
+.Sy physical_ram/4 ,
+.
+.It Sy zfs_dirty_data_max_max_percent Ns = Ns Sy 25 Ns % Pq int
+Maximum allowable value of
+.Sy zfs_dirty_data_max ,
+expressed as a percentage of physical RAM.
+This limit is only enforced at module load time, and will be ignored if
+.Sy zfs_dirty_data_max
+is later changed.
+The parameter
+.Sy zfs_dirty_data_max_max
+takes precedence over this one.
+.No See Sx ZFS TRANSACTION DELAY .
+.
+.It Sy zfs_dirty_data_max_percent Ns = Ns Sy 10 Ns % Pq int
+Determines the dirty space limit, expressed as a percentage of all memory.
+Once this limit is exceeded, new writes are halted until space frees up.
+The parameter
+.Sy zfs_dirty_data_max
+takes precedence over this one.
+.No See Sx ZFS TRANSACTION DELAY .
+.Pp
+Subject to
+.Sy zfs_dirty_data_max_max .
+.
+.It Sy zfs_dirty_data_sync_percent Ns = Ns Sy 20 Ns % Pq int
+Start syncing out a transaction group if there's at least this much dirty data
+.Pq as a percentage of Sy zfs_dirty_data_max .
+This should be less than
+.Sy zfs_vdev_async_write_active_min_dirty_percent .
+.
+.It Sy zfs_fallocate_reserve_percent Ns = Ns Sy 110 Ns % Pq uint
+Since ZFS is a copy-on-write filesystem with snapshots, blocks cannot be
+preallocated for a file in order to guarantee that later writes will not
+run out of space.
+Instead,
+.Xr fallocate 2
+space preallocation only checks that sufficient space is currently available
+in the pool or the user's project quota allocation,
+and then creates a sparse file of the requested size.
+The requested space is multiplied by
+.Sy zfs_fallocate_reserve_percent
+to allow additional space for indirect blocks and other internal metadata.
+Setting this to
+.Sy 0
+disables support for
+.Xr fallocate 2
+and causes it to return
+.Sy EOPNOTSUPP .
+.
+.It Sy zfs_fletcher_4_impl Ns = Ns Sy fastest Pq string
+Select a fletcher 4 implementation.
+.Pp
+Supported selectors are:
+.Sy fastest , scalar , sse2 , ssse3 , avx2 , avx512f , avx512bw ,
+.No and Sy aarch64_neon .
+All except
+.Sy fastest No and Sy scalar
+require instruction set extensions to be available,
+and will only appear if ZFS detects that they are present at runtime.
+If multiple implementations of fletcher 4 are available, the
+.Sy fastest
+will be chosen using a micro benchmark.
+Selecting
+.Sy scalar
+results in the original CPU-based calculation being used.
+Selecting any option other than
+.Sy fastest No or Sy scalar
+results in vector instructions
+from the respective CPU instruction set being used.
+.
+.It Sy zfs_free_bpobj_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Enable/disable the processing of the free_bpobj object.
+.
+.It Sy zfs_async_block_max_blocks Ns = Ns Sy ULONG_MAX Po unlimited Pc Pq ulong
+Maximum number of blocks freed in a single TXG.
+.
+.It Sy zfs_max_async_dedup_frees Ns = Ns Sy 100000 Po 10^5 Pc Pq ulong
+Maximum number of dedup blocks freed in a single TXG.
+.
+.It Sy zfs_override_estimate_recordsize Ns = Ns Sy 0 Pq ulong
+If nonzer, override record size calculation for
+.Nm zfs Cm send
+estimates.
+.
+.It Sy zfs_vdev_async_read_max_active Ns = Ns Sy 3 Pq int
+Maximum asynchronous read I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_async_read_min_active Ns = Ns Sy 1 Pq int
+Minimum asynchronous read I/O operation active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_async_write_active_max_dirty_percent Ns = Ns Sy 60 Ns % Pq int
+When the pool has more than this much dirty data, use
+.Sy zfs_vdev_async_write_max_active
+to limit active async writes.
+If the dirty data is between the minimum and maximum,
+the active I/O limit is linearly interpolated.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_async_write_active_min_dirty_percent Ns = Ns Sy 30 Ns % Pq int
+When the pool has less than this much dirty data, use
+.Sy zfs_vdev_async_write_min_active
+to limit active async writes.
+If the dirty data is between the minimum and maximum,
+the active I/O limit is linearly
+interpolated.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_async_write_max_active Ns = Ns Sy 30 Pq int
+Maximum asynchronous write I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_async_write_min_active Ns = Ns Sy 2 Pq int
+Minimum asynchronous write I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.Pp
+Lower values are associated with better latency on rotational media but poorer
+resilver performance.
+The default value of
+.Sy 2
+was chosen as a compromise.
+A value of
+.Sy 3
+has been shown to improve resilver performance further at a cost of
+further increasing latency.
+.
+.It Sy zfs_vdev_initializing_max_active Ns = Ns Sy 1 Pq int
+Maximum initializing I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_initializing_min_active Ns = Ns Sy 1 Pq int
+Minimum initializing I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_max_active Ns = Ns Sy 1000 Pq int
+The maximum number of I/O operations active to each device.
+Ideally, this will be at least the sum of each queue's
+.Sy max_active .
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_rebuild_max_active Ns = Ns Sy 3 Pq int
+Maximum sequential resilver I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_rebuild_min_active Ns = Ns Sy 1 Pq int
+Minimum sequential resilver I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_removal_max_active Ns = Ns Sy 2 Pq int
+Maximum removal I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_removal_min_active Ns = Ns Sy 1 Pq int
+Minimum removal I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_scrub_max_active Ns = Ns Sy 2 Pq int
+Maximum scrub I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_scrub_min_active Ns = Ns Sy 1 Pq int
+Minimum scrub I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_sync_read_max_active Ns = Ns Sy 10 Pq int
+Maximum synchronous read I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_sync_read_min_active Ns = Ns Sy 10 Pq int
+Minimum synchronous read I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_sync_write_max_active Ns = Ns Sy 10 Pq int
+Maximum synchronous write I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_sync_write_min_active Ns = Ns Sy 10 Pq int
+Minimum synchronous write I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_trim_max_active Ns = Ns Sy 2 Pq int
+Maximum trim/discard I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_trim_min_active Ns = Ns Sy 1 Pq int
+Minimum trim/discard I/O operations active to each device.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_nia_delay Ns = Ns Sy 5 Pq int
+For non-interactive I/O (scrub, resilver, removal, initialize and rebuild),
+the number of concurrently-active I/O operations is limited to
+.Sy zfs_*_min_active ,
+unless the vdev is "idle".
+When there are no interactive I/O operatinons active (synchronous or otherwise),
+and
+.Sy zfs_vdev_nia_delay
+operations have completed since the last interactive operation,
+then the vdev is considered to be "idle",
+and the number of concurrently-active non-interactive operations is increased to
+.Sy zfs_*_max_active .
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_nia_credit Ns = Ns Sy 5 Pq int
+Some HDDs tend to prioritize sequential I/O so strongly, that concurrent
+random I/O latency reaches several seconds.
+On some HDDs this happens even if sequential I/O operations
+are submitted one at a time, and so setting
+.Sy zfs_*_max_active Ns = Sy 1
+does not help.
+To prevent non-interactive I/O, like scrub,
+from monopolizing the device, no more than
+.Sy zfs_vdev_nia_credit operations can be sent
+while there are outstanding incomplete interactive operations.
+This enforced wait ensures the HDD services the interactive I/O
+within a reasonable amount of time.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_queue_depth_pct Ns = Ns Sy 1000 Ns % Pq int
+Maximum number of queued allocations per top-level vdev expressed as
+a percentage of
+.Sy zfs_vdev_async_write_max_active ,
+which allows the system to detect devices that are more capable
+of handling allocations and to allocate more blocks to those devices.
+This allows for dynamic allocation distribution when devices are imbalanced,
+as fuller devices will tend to be slower than empty devices.
+.Pp
+Also see
+.Sy zio_dva_throttle_enabled .
+.
+.It Sy zfs_expire_snapshot Ns = Ns Sy 300 Ns s Pq int
+Time before expiring
+.Pa .zfs/snapshot .
+.
+.It Sy zfs_admin_snapshot Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Allow the creation, removal, or renaming of entries in the
+.Sy .zfs/snapshot
+directory to cause the creation, destruction, or renaming of snapshots.
+When enabled, this functionality works both locally and over NFS exports
+which have the
+.Em no_root_squash
+option set.
+.
+.It Sy zfs_flags Ns = Ns Sy 0 Pq int
+Set additional debugging flags.
+The following flags may be bitwise-ored together:
+.TS
+box;
+lbz r l l .
+ Value Symbolic Name Description
+_
+ 1 ZFS_DEBUG_DPRINTF Enable dprintf entries in the debug log.
+* 2 ZFS_DEBUG_DBUF_VERIFY Enable extra dbuf verifications.
+* 4 ZFS_DEBUG_DNODE_VERIFY Enable extra dnode verifications.
+ 8 ZFS_DEBUG_SNAPNAMES Enable snapshot name verification.
+ 16 ZFS_DEBUG_MODIFY Check for illegally modified ARC buffers.
+ 64 ZFS_DEBUG_ZIO_FREE Enable verification of block frees.
+ 128 ZFS_DEBUG_HISTOGRAM_VERIFY Enable extra spacemap histogram verifications.
+ 256 ZFS_DEBUG_METASLAB_VERIFY Verify space accounting on disk matches in-memory \fBrange_trees\fP.
+ 512 ZFS_DEBUG_SET_ERROR Enable \fBSET_ERROR\fP and dprintf entries in the debug log.
+ 1024 ZFS_DEBUG_INDIRECT_REMAP Verify split blocks created by device removal.
+ 2048 ZFS_DEBUG_TRIM Verify TRIM ranges are always within the allocatable range tree.
+ 4096 ZFS_DEBUG_LOG_SPACEMAP Verify that the log summary is consistent with the spacemap log
+ and enable \fBzfs_dbgmsgs\fP for metaslab loading and flushing.
+.TE
+.Sy \& * No Requires debug build.
+.
+.It Sy zfs_free_leak_on_eio Ns = Ns Sy 0 Ns | Ns 1 Pq int
+If destroy encounters an
+.Sy EIO
+while reading metadata (e.g. indirect blocks),
+space referenced by the missing metadata can not be freed.
+Normally this causes the background destroy to become "stalled",
+as it is unable to make forward progress.
+While in this stalled state, all remaining space to free
+from the error-encountering filesystem is "temporarily leaked".
+Set this flag to cause it to ignore the
+.Sy EIO ,
+permanently leak the space from indirect blocks that can not be read,
+and continue to free everything else that it can.
+.Pp
+The default "stalling" behavior is useful if the storage partially
+fails (i.e. some but not all I/O operations fail), and then later recovers.
+In this case, we will be able to continue pool operations while it is
+partially failed, and when it recovers, we can continue to free the
+space, with no leaks.
+Note, however, that this case is actually fairly rare.
+.Pp
+Typically pools either
+.Bl -enum -compact -offset 4n -width "1."
+.It
+fail completely (but perhaps temporarily,
+e.g. due to a top-level vdev going offline), or
+.It
+have localized, permanent errors (e.g. disk returns the wrong data
+due to bit flip or firmware bug).
+.El
+In the former case, this setting does not matter because the
+pool will be suspended and the sync thread will not be able to make
+forward progress regardless.
+In the latter, because the error is permanent, the best we can do
+is leak the minimum amount of space,
+which is what setting this flag will do.
+It is therefore reasonable for this flag to normally be set,
+but we chose the more conservative approach of not setting it,
+so that there is no possibility of
+leaking space in the "partial temporary" failure case.
+.
+.It Sy zfs_free_min_time_ms Ns = Ns Sy 1000 Ns ms Po 1s Pc Pq int
+During a
+.Nm zfs Cm destroy
+operation using the
+.Sy async_destroy
+feature,
+a minimum of this much time will be spent working on freeing blocks per TXG.
+.
+.It Sy zfs_obsolete_min_time_ms Ns = Ns Sy 500 Ns ms Pq int
+Similar to
+.Sy zfs_free_min_time_ms ,
+but for cleanup of old indirection records for removed vdevs.
+.
+.It Sy zfs_immediate_write_sz Ns = Ns Sy 32768 Ns B Po 32kB Pc Pq long
+Largest data block to write to the ZIL.
+Larger blocks will be treated as if the dataset being written to had the
+.Sy logbias Ns = Ns Sy throughput
+property set.
+.
+.It Sy zfs_initialize_value Ns = Ns Sy 16045690984833335022 Po 0xDEADBEEFDEADBEEE Pc Pq ulong
+Pattern written to vdev free space by
+.Xr zpool-initialize 8 .
+.
+.It Sy zfs_initialize_chunk_size Ns = Ns Sy 1048576 Ns B Po 1MB Pc Pq ulong
+Size of writes used by
+.Xr zpool-initialize 8 .
+This option is used by the test suite.
+.
+.It Sy zfs_livelist_max_entries Ns = Ns Sy 500000 Po 5*10^5 Pc Pq ulong
+The threshold size (in block pointers) at which we create a new sub-livelist.
+Larger sublists are more costly from a memory perspective but the fewer
+sublists there are, the lower the cost of insertion.
+.
+.It Sy zfs_livelist_min_percent_shared Ns = Ns Sy 75 Ns % Pq int
+If the amount of shared space between a snapshot and its clone drops below
+this threshold, the clone turns off the livelist and reverts to the old
+deletion method.
+This is in place because livelists no long give us a benefit
+once a clone has been overwritten enough.
+.
+.It Sy zfs_livelist_condense_new_alloc Ns = Ns Sy 0 Pq int
+Incremented each time an extra ALLOC blkptr is added to a livelist entry while
+it is being condensed.
+This option is used by the test suite to track race conditions.
+.
+.It Sy zfs_livelist_condense_sync_cancel Ns = Ns Sy 0 Pq int
+Incremented each time livelist condensing is canceled while in
+.Fn spa_livelist_condense_sync .
+This option is used by the test suite to track race conditions.
+.
+.It Sy zfs_livelist_condense_sync_pause Ns = Ns Sy 0 Ns | Ns 1 Pq int
+When set, the livelist condense process pauses indefinitely before
+executing the synctask -
+.Fn spa_livelist_condense_sync .
+This option is used by the test suite to trigger race conditions.
+.
+.It Sy zfs_livelist_condense_zthr_cancel Ns = Ns Sy 0 Pq int
+Incremented each time livelist condensing is canceled while in
+.Fn spa_livelist_condense_cb .
+This option is used by the test suite to track race conditions.
+.
+.It Sy zfs_livelist_condense_zthr_pause Ns = Ns Sy 0 Ns | Ns 1 Pq int
+When set, the livelist condense process pauses indefinitely before
+executing the open context condensing work in
+.Fn spa_livelist_condense_cb .
+This option is used by the test suite to trigger race conditions.
+.
+.It Sy zfs_lua_max_instrlimit Ns = Ns Sy 100000000 Po 10^8 Pc Pq ulong
+The maximum execution time limit that can be set for a ZFS channel program,
+specified as a number of Lua instructions.
+.
+.It Sy zfs_lua_max_memlimit Ns = Ns Sy 104857600 Po 100MB Pc Pq ulong
+The maximum memory limit that can be set for a ZFS channel program, specified
+in bytes.
+.
+.It Sy zfs_max_dataset_nesting Ns = Ns Sy 50 Pq int
+The maximum depth of nested datasets.
+This value can be tuned temporarily to
+fix existing datasets that exceed the predefined limit.
+.
+.It Sy zfs_max_log_walking Ns = Ns Sy 5 Pq ulong
+The number of past TXGs that the flushing algorithm of the log spacemap
+feature uses to estimate incoming log blocks.
+.
+.It Sy zfs_max_logsm_summary_length Ns = Ns Sy 10 Pq ulong
+Maximum number of rows allowed in the summary of the spacemap log.
+.
+.It Sy zfs_max_recordsize Ns = Ns Sy 1048576 Po 1MB Pc Pq int
+We currently support block sizes from
+.Em 512B No to Em 16MB .
+The benefits of larger blocks, and thus larger I/O,
+need to be weighed against the cost of COWing a giant block to modify one byte.
+Additionally, very large blocks can have an impact on I/O latency,
+and also potentially on the memory allocator.
+Therefore, we do not allow the recordsize to be set larger than this tunable.
+Larger blocks can be created by changing it,
+and pools with larger blocks can always be imported and used,
+regardless of this setting.
+.
+.It Sy zfs_allow_redacted_dataset_mount Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Allow datasets received with redacted send/receive to be mounted.
+Normally disabled because these datasets may be missing key data.
+.
+.It Sy zfs_min_metaslabs_to_flush Ns = Ns Sy 1 Pq ulong
+Minimum number of metaslabs to flush per dirty TXG.
+.
+.It Sy zfs_metaslab_fragmentation_threshold Ns = Ns Sy 70 Ns % Pq int
+Allow metaslabs to keep their active state as long as their fragmentation
+percentage is no more than this value.
+An active metaslab that exceeds this threshold
+will no longer keep its active status allowing better metaslabs to be selected.
+.
+.It Sy zfs_mg_fragmentation_threshold Ns = Ns Sy 95 Ns % Pq int
+Metaslab groups are considered eligible for allocations if their
+fragmentation metric (measured as a percentage) is less than or equal to
+this value.
+If a metaslab group exceeds this threshold then it will be
+skipped unless all metaslab groups within the metaslab class have also
+crossed this threshold.
+.
+.It Sy zfs_mg_noalloc_threshold Ns = Ns Sy 0 Ns % Pq int
+Defines a threshold at which metaslab groups should be eligible for allocations.
+The value is expressed as a percentage of free space
+beyond which a metaslab group is always eligible for allocations.
+If a metaslab group's free space is less than or equal to the
+threshold, the allocator will avoid allocating to that group
+unless all groups in the pool have reached the threshold.
+Once all groups have reached the threshold, all groups are allowed to accept
+allocations.
+The default value of
+.Sy 0
+disables the feature and causes all metaslab groups to be eligible for allocations.
+.Pp
+This parameter allows one to deal with pools having heavily imbalanced
+vdevs such as would be the case when a new vdev has been added.
+Setting the threshold to a non-zero percentage will stop allocations
+from being made to vdevs that aren't filled to the specified percentage
+and allow lesser filled vdevs to acquire more allocations than they
+otherwise would under the old
+.Sy zfs_mg_alloc_failures
+facility.
+.
+.It Sy zfs_ddt_data_is_special Ns = Ns Sy 1 Ns | Ns 0 Pq int
+If enabled, ZFS will place DDT data into the special allocation class.
+.
+.It Sy zfs_user_indirect_is_special Ns = Ns Sy 1 Ns | Ns 0 Pq int
+If enabled, ZFS will place user data indirect blocks
+into the special allocation class.
+.
+.It Sy zfs_multihost_history Ns = Ns Sy 0 Pq int
+Historical statistics for this many latest multihost updates will be available in
+.Pa /proc/spl/kstat/zfs/ Ns Ao Ar pool Ac Ns Pa /multihost .
+.
+.It Sy zfs_multihost_interval Ns = Ns Sy 1000 Ns ms Po 1s Pc Pq ulong
+Used to control the frequency of multihost writes which are performed when the
+.Sy multihost
+pool property is on.
+This is one of the factors used to determine the
+length of the activity check during import.
+.Pp
+The multihost write period is
+.Sy zfs_multihost_interval / leaf-vdevs .
+On average a multihost write will be issued for each leaf vdev
+every
+.Sy zfs_multihost_interval
+milliseconds.
+In practice, the observed period can vary with the I/O load
+and this observed value is the delay which is stored in the uberblock.
+.
+.It Sy zfs_multihost_import_intervals Ns = Ns Sy 20 Pq uint
+Used to control the duration of the activity test on import.
+Smaller values of
+.Sy zfs_multihost_import_intervals
+will reduce the import time but increase
+the risk of failing to detect an active pool.
+The total activity check time is never allowed to drop below one second.
+.Pp
+On import the activity check waits a minimum amount of time determined by
+.Sy zfs_multihost_interval * zfs_multihost_import_intervals ,
+or the same product computed on the host which last had the pool imported,
+whichever is greater.
+The activity check time may be further extended if the value of MMP
+delay found in the best uberblock indicates actual multihost updates happened
+at longer intervals than
+.Sy zfs_multihost_interval .
+A minimum of
+.Em 100ms
+is enforced.
+.Pp
+.Sy 0 No is equivalent to Sy 1 .
+.
+.It Sy zfs_multihost_fail_intervals Ns = Ns Sy 10 Pq uint
+Controls the behavior of the pool when multihost write failures or delays are
+detected.
+.Pp
+When
+.Sy 0 ,
+multihost write failures or delays are ignored.
+The failures will still be reported to the ZED which depending on
+its configuration may take action such as suspending the pool or offlining a
+device.
+.Pp
+Otherwise, the pool will be suspended if
+.Sy zfs_multihost_fail_intervals * zfs_multihost_interval
+milliseconds pass without a successful MMP write.
+This guarantees the activity test will see MMP writes if the pool is imported.
+.Sy 1 No is equivalent to Sy 2 ;
+this is necessary to prevent the pool from being suspended
+due to normal, small I/O latency variations.
+.
+.It Sy zfs_no_scrub_io Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Set to disable scrub I/O.
+This results in scrubs not actually scrubbing data and
+simply doing a metadata crawl of the pool instead.
+.
+.It Sy zfs_no_scrub_prefetch Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Set to disable block prefetching for scrubs.
+.
+.It Sy zfs_nocacheflush Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Disable cache flush operations on disks when writing.
+Setting this will cause pool corruption on power loss
+if a volatile out-of-order write cache is enabled.
+.
+.It Sy zfs_nopwrite_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Allow no-operation writes.
+The occurrence of nopwrites will further depend on other pool properties
+.Pq i.a. the checksumming and compression algorithms .
+.
+.It Sy zfs_dmu_offset_next_sync Ns = Ns Sy 0 Ns | ns 1 Pq int
+Enable forcing TXG sync to find holes.
+When enabled forces ZFS to act like prior versions when
+.Sy SEEK_HOLE No or Sy SEEK_DATA
+flags are used, which, when a dnode is dirty,
+causes TXGs to be synced so that this data can be found.
+.
+.It Sy zfs_pd_bytes_max Ns = Ns Sy 52428800 Ns B Po 50MB Pc Pq int
+The number of bytes which should be prefetched during a pool traversal, like
+.Nm zfs Cm send
+or other data crawling operations.
+.
+.It Sy zfs_traverse_indirect_prefetch_limit Ns = Ns Sy 32 Pq int
+The number of blocks pointed by indirect (non-L0) block which should be
+prefetched during a pool traversal, like
+.Nm zfs Cm send
+or other data crawling operations.
+.
+.It Sy zfs_per_txg_dirty_frees_percent Ns = Ns Sy 5 Ns % Pq ulong
+Control percentage of dirtied indirect blocks from frees allowed into one TXG.
+After this threshold is crossed, additional frees will wait until the next TXG.
+.Sy 0 No disables this throttle.
+.
+.It Sy zfs_prefetch_disable Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Disable predictive prefetch.
+Note that it leaves "prescient" prefetch (for. e.g.\&
+.Nm zfs Cm send )
+intact.
+Unlike predictive prefetch, prescient prefetch never issues I/O
+that ends up not being needed, so it can't hurt performance.
+.
+.It Sy zfs_qat_checksum_disable Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Disable QAT hardware acceleration for SHA256 checksums.
+May be unset after the ZFS modules have been loaded to initialize the QAT
+hardware as long as support is compiled in and the QAT driver is present.
+.
+.It Sy zfs_qat_compress_disable Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Disable QAT hardware acceleration for gzip compression.
+May be unset after the ZFS modules have been loaded to initialize the QAT
+hardware as long as support is compiled in and the QAT driver is present.
+.
+.It Sy zfs_qat_encrypt_disable Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Disable QAT hardware acceleration for AES-GCM encryption.
+May be unset after the ZFS modules have been loaded to initialize the QAT
+hardware as long as support is compiled in and the QAT driver is present.
+.
+.It Sy zfs_vnops_read_chunk_size Ns = Ns Sy 1048576 Ns B Po 1MB Pc Pq long
+Bytes to read per chunk.
+.
+.It Sy zfs_read_history Ns = Ns Sy 0 Pq int
+Historical statistics for this many latest reads will be available in
+.Pa /proc/spl/kstat/zfs/ Ns Ao Ar pool Ac Ns Pa /reads .
+.
+.It Sy zfs_read_history_hits Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Include cache hits in read history
+.
+.It Sy zfs_rebuild_max_segment Ns = Ns Sy 1048576 Ns B Po 1MB Pc Pq ulong
+Maximum read segment size to issue when sequentially resilvering a
+top-level vdev.
+.
+.It Sy zfs_rebuild_scrub_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Automatically start a pool scrub when the last active sequential resilver
+completes in order to verify the checksums of all blocks which have been
+resilvered.
+This is enabled by default and strongly recommended.
+.
+.It Sy zfs_rebuild_vdev_limit Ns = Ns Sy 33554432 Ns B Po 32MB Pc Pq ulong
+Maximum amount of I/O that can be concurrently issued for a sequential
+resilver per leaf device, given in bytes.
+.
+.It Sy zfs_reconstruct_indirect_combinations_max Ns = Ns Sy 4096 Pq int
+If an indirect split block contains more than this many possible unique
+combinations when being reconstructed, consider it too computationally
+expensive to check them all.
+Instead, try at most this many randomly selected
+combinations each time the block is accessed.
+This allows all segment copies to participate fairly
+in the reconstruction when all combinations
+cannot be checked and prevents repeated use of one bad copy.
+.
+.It Sy zfs_recover Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Set to attempt to recover from fatal errors.
+This should only be used as a last resort,
+as it typically results in leaked space, or worse.
+.
+.It Sy zfs_removal_ignore_errors Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Ignore hard IO errors during device removal.
+When set, if a device encounters a hard IO error during the removal process
+the removal will not be cancelled.
+This can result in a normally recoverable block becoming permanently damaged
+and is hence not recommended.
+This should only be used as a last resort when the
+pool cannot be returned to a healthy state prior to removing the device.
+.
+.It Sy zfs_removal_suspend_progress Ns = Ns Sy 0 Ns | Ns 1 Pq int
+This is used by the test suite so that it can ensure that certain actions
+happen while in the middle of a removal.
+.
+.It Sy zfs_remove_max_segment Ns = Ns Sy 16777216 Ns B Po 16MB Pc Pq int
+The largest contiguous segment that we will attempt to allocate when removing
+a device.
+If there is a performance problem with attempting to allocate large blocks,
+consider decreasing this.
+The default value is also the maximum.
+.
+.It Sy zfs_resilver_disable_defer Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Ignore the
+.Sy resilver_defer
+feature, causing an operation that would start a resilver to
+immediately restart the one in progress.
+.
+.It Sy zfs_resilver_min_time_ms Ns = Ns Sy 3000 Ns ms Po 3s Pc Pq int
+Resilvers are processed by the sync thread.
+While resilvering, it will spend at least this much time
+working on a resilver between TXG flushes.
+.
+.It Sy zfs_scan_ignore_errors Ns = Ns Sy 0 Ns | Ns 1 Pq int
+If set, remove the DTL (dirty time list) upon completion of a pool scan (scrub),
+even if there were unrepairable errors.
+Intended to be used during pool repair or recovery to
+stop resilvering when the pool is next imported.
+.
+.It Sy zfs_scrub_min_time_ms Ns = Ns Sy 1000 Ns ms Po 1s Pc Pq int
+Scrubs are processed by the sync thread.
+While scrubbing, it will spend at least this much time
+working on a scrub between TXG flushes.
+.
+.It Sy zfs_scan_checkpoint_intval Ns = Ns Sy 7200 Ns s Po 2h Pc Pq int
+To preserve progress across reboots, the sequential scan algorithm periodically
+needs to stop metadata scanning and issue all the verification I/O to disk.
+The frequency of this flushing is determined by this tunable.
+.
+.It Sy zfs_scan_fill_weight Ns = Ns Sy 3 Pq int
+This tunable affects how scrub and resilver I/O segments are ordered.
+A higher number indicates that we care more about how filled in a segment is,
+while a lower number indicates we care more about the size of the extent without
+considering the gaps within a segment.
+This value is only tunable upon module insertion.
+Changing the value afterwards will have no affect on scrub or resilver performance.
+.
+.It Sy zfs_scan_issue_strategy Ns = Ns Sy 0 Pq int
+Determines the order that data will be verified while scrubbing or resilvering:
+.Bl -tag -compact -offset 4n -width "a"
+.It Sy 1
+Data will be verified as sequentially as possible, given the
+amount of memory reserved for scrubbing
+.Pq see Sy zfs_scan_mem_lim_fact .
+This may improve scrub performance if the pool's data is very fragmented.
+.It Sy 2
+The largest mostly-contiguous chunk of found data will be verified first.
+By deferring scrubbing of small segments, we may later find adjacent data
+to coalesce and increase the segment size.
+.It Sy 0
+.No Use strategy Sy 1 No during normal verification
+.No and strategy Sy 2 No while taking a checkpoint.
+.El
+.
+.It Sy zfs_scan_legacy Ns = Ns Sy 0 Ns | Ns 1 Pq int
+If unset, indicates that scrubs and resilvers will gather metadata in
+memory before issuing sequential I/O.
+Otherwise indicates that the legacy algorithm will be used,
+where I/O is initiated as soon as it is discovered.
+Unsetting will not affect scrubs or resilvers that are already in progress.
+.
+.It Sy zfs_scan_max_ext_gap Ns = Ns Sy 2097152 Ns B Po 2MB Pc Pq int
+Sets the largest gap in bytes between scrub/resilver I/O operations
+that will still be considered sequential for sorting purposes.
+Changing this value will not
+affect scrubs or resilvers that are already in progress.
+.
+.It Sy zfs_scan_mem_lim_fact Ns = Ns Sy 20 Ns ^-1 Pq int
+Maximum fraction of RAM used for I/O sorting by sequential scan algorithm.
+This tunable determines the hard limit for I/O sorting memory usage.
+When the hard limit is reached we stop scanning metadata and start issuing
+data verification I/O.
+This is done until we get below the soft limit.
+.
+.It Sy zfs_scan_mem_lim_soft_fact Ns = Ns Sy 20 Ns ^-1 Pq int
+The fraction of the hard limit used to determined the soft limit for I/O sorting
+by the sequential scan algorithm.
+When we cross this limit from below no action is taken.
+When we cross this limit from above it is because we are issuing verification I/O.
+In this case (unless the metadata scan is done) we stop issuing verification I/O
+and start scanning metadata again until we get to the hard limit.
+.
+.It Sy zfs_scan_strict_mem_lim Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Enforce tight memory limits on pool scans when a sequential scan is in progress.
+When disabled, the memory limit may be exceeded by fast disks.
+.
+.It Sy zfs_scan_suspend_progress Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Freezes a scrub/resilver in progress without actually pausing it.
+Intended for testing/debugging.
+.
+.It Sy zfs_scan_vdev_limit Ns = Ns Sy 4194304 Ns B Po 4MB Pc Pq int
+Maximum amount of data that can be concurrently issued at once for scrubs and
+resilvers per leaf device, given in bytes.
+.
+.It Sy zfs_send_corrupt_data Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Allow sending of corrupt data (ignore read/checksum errors when sending).
+.
+.It Sy zfs_send_unmodified_spill_blocks Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Include unmodified spill blocks in the send stream.
+Under certain circumstances, previous versions of ZFS could incorrectly
+remove the spill block from an existing object.
+Including unmodified copies of the spill blocks creates a backwards-compatible
+stream which will recreate a spill block if it was incorrectly removed.
+.
+.It Sy zfs_send_no_prefetch_queue_ff Ns = Ns Sy 20 Ns ^-1 Pq int
+The fill fraction of the
+.Nm zfs Cm send
+internal queues.
+The fill fraction controls the timing with which internal threads are woken up.
+.
+.It Sy zfs_send_no_prefetch_queue_length Ns = Ns Sy 1048576 Ns B Po 1MB Pc Pq int
+The maximum number of bytes allowed in
+.Nm zfs Cm send Ns 's
+internal queues.
+.
+.It Sy zfs_send_queue_ff Ns = Ns Sy 20 Ns ^-1 Pq int
+The fill fraction of the
+.Nm zfs Cm send
+prefetch queue.
+The fill fraction controls the timing with which internal threads are woken up.
+.
+.It Sy zfs_send_queue_length Ns = Ns Sy 16777216 Ns B Po 16MB Pc Pq int
+The maximum number of bytes allowed that will be prefetched by
+.Nm zfs Cm send .
+This value must be at least twice the maximum block size in use.
+.
+.It Sy zfs_recv_queue_ff Ns = Ns Sy 20 Ns ^-1 Pq int
+The fill fraction of the
+.Nm zfs Cm receive
+queue.
+The fill fraction controls the timing with which internal threads are woken up.
+.
+.It Sy zfs_recv_queue_length Ns = Ns Sy 16777216 Ns B Po 16MB Pc Pq int
+The maximum number of bytes allowed in the
+.Nm zfs Cm receive
+queue.
+This value must be at least twice the maximum block size in use.
+.
+.It Sy zfs_recv_write_batch_size Ns = Ns Sy 1048576 Ns B Po 1MB Pc Pq int
+The maximum amount of data, in bytes, that
+.Nm zfs Cm receive
+will write in one DMU transaction.
+This is the uncompressed size, even when receiving a compressed send stream.
+This setting will not reduce the write size below a single block.
+Capped at a maximum of
+.Sy 32MB .
+.
+.It Sy zfs_override_estimate_recordsize Ns = Ns Sy 0 Ns | Ns 1 Pq ulong
+Setting this variable overrides the default logic for estimating block
+sizes when doing a
+.Nm zfs Cm send .
+The default heuristic is that the average block size
+will be the current recordsize.
+Override this value if most data in your dataset is not of that size
+and you require accurate zfs send size estimates.
+.
+.It Sy zfs_sync_pass_deferred_free Ns = Ns Sy 2 Pq int
+Flushing of data to disk is done in passes.
+Defer frees starting in this pass.
+.
+.It Sy zfs_spa_discard_memory_limit Ns = Ns Sy 16777216 Ns B Po 16MB Pc Pq int
+Maximum memory used for prefetching a checkpoint's space map on each
+vdev while discarding the checkpoint.
+.
+.It Sy zfs_special_class_metadata_reserve_pct Ns = Ns Sy 25 Ns % Pq int
+Only allow small data blocks to be allocated on the special and dedup vdev
+types when the available free space percentage on these vdevs exceeds this value.
+This ensures reserved space is available for pool metadata as the
+special vdevs approach capacity.
+.
+.It Sy zfs_sync_pass_dont_compress Ns = Ns Sy 8 Pq int
+Starting in this sync pass, disable compression (including of metadata).
+With the default setting, in practice, we don't have this many sync passes,
+so this has no effect.
+.Pp
+The original intent was that disabling compression would help the sync passes
+to converge.
+However, in practice, disabling compression increases
+the average number of sync passes; because when we turn compression off,
+many blocks' size will change, and thus we have to re-allocate
+(not overwrite) them.
+It also increases the number of
+.Em 128kB
+allocations (e.g. for indirect blocks and spacemaps)
+because these will not be compressed.
+The
+.Em 128kB
+allocations are especially detrimental to performance
+on highly fragmented systems, which may have very few free segments of this size,
+and may need to load new metaslabs to satisfy these allocations.
+.
+.It Sy zfs_sync_pass_rewrite Ns = Ns Sy 2 Pq int
+Rewrite new block pointers starting in this pass.
+.
+.It Sy zfs_sync_taskq_batch_pct Ns = Ns Sy 75 Ns % Pq int
+This controls the number of threads used by
+.Sy dp_sync_taskq .
+The default value of
+.Sy 75%
+will create a maximum of one thread per CPU.
+.
+.It Sy zfs_trim_extent_bytes_max Ns = Ns Sy 134217728 Ns B Po 128MB Pc Pq uint
+Maximum size of TRIM command.
+Larger ranges will be split into chunks no larger than this value before issuing.
+.
+.It Sy zfs_trim_extent_bytes_min Ns = Ns Sy 32768 Ns B Po 32kB Pc Pq uint
+Minimum size of TRIM commands.
+TRIM ranges smaller than this will be skipped,
+unless they're part of a larger range which was chunked.
+This is done because it's common for these small TRIMs
+to negatively impact overall performance.
+.
+.It Sy zfs_trim_metaslab_skip Ns = Ns Sy 0 Ns | Ns 1 Pq uint
+Skip uninitialized metaslabs during the TRIM process.
+This option is useful for pools constructed from large thinly-provisioned devices
+where TRIM operations are slow.
+As a pool ages, an increasing fraction of the pool's metaslabs
+will be initialized, progressively degrading the usefulness of this option.
+This setting is stored when starting a manual TRIM and will
+persist for the duration of the requested TRIM.
+.
+.It Sy zfs_trim_queue_limit Ns = Ns Sy 10 Pq uint
+Maximum number of queued TRIMs outstanding per leaf vdev.
+The number of concurrent TRIM commands issued to the device is controlled by
+.Sy zfs_vdev_trim_min_active No and Sy zfs_vdev_trim_max_active .
+.
+.It Sy zfs_trim_txg_batch Ns = Ns Sy 32 Pq uint
+The number of transaction groups' worth of frees which should be aggregated
+before TRIM operations are issued to the device.
+This setting represents a trade-off between issuing larger,
+more efficient TRIM operations and the delay
+before the recently trimmed space is available for use by the device.
+.Pp
+Increasing this value will allow frees to be aggregated for a longer time.
+This will result is larger TRIM operations and potentially increased memory usage.
+Decreasing this value will have the opposite effect.
+The default of
+.Sy 32
+was determined to be a reasonable compromise.
+.
+.It Sy zfs_txg_history Ns = Ns Sy 0 Pq int
+Historical statistics for this many latest TXGs will be available in
+.Pa /proc/spl/kstat/zfs/ Ns Ao Ar pool Ac Ns Pa /TXGs .
+.
+.It Sy zfs_txg_timeout Ns = Ns Sy 5 Ns s Pq int
+Flush dirty data to disk at least every this many seconds (maximum TXG duration).
+.
+.It Sy zfs_vdev_aggregate_trim Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Allow TRIM I/Os to be aggregated.
+This is normally not helpful because the extents to be trimmed
+will have been already been aggregated by the metaslab.
+This option is provided for debugging and performance analysis.
+.
+.It Sy zfs_vdev_aggregation_limit Ns = Ns Sy 1048576 Ns B Po 1MB Pc Pq int
+Max vdev I/O aggregation size.
+.
+.It Sy zfs_vdev_aggregation_limit_non_rotating Ns = Ns Sy 131072 Ns B Po 128kB Pc Pq int
+Max vdev I/O aggregation size for non-rotating media.
+.
+.It Sy zfs_vdev_cache_bshift Ns = Ns Sy 16 Po 64kB Pc Pq int
+Shift size to inflate reads to.
+.
+.It Sy zfs_vdev_cache_max Ns = Ns Sy 16384 Ns B Po 16kB Pc Pq int
+Inflate reads smaller than this value to meet the
+.Sy zfs_vdev_cache_bshift
+size
+.Pq default Sy 64kB .
+.
+.It Sy zfs_vdev_cache_size Ns = Ns Sy 0 Pq int
+Total size of the per-disk cache in bytes.
+.Pp
+Currently this feature is disabled, as it has been found to not be helpful
+for performance and in some cases harmful.
+.
+.It Sy zfs_vdev_mirror_rotating_inc Ns = Ns Sy 0 Pq int
+A number by which the balancing algorithm increments the load calculation for
+the purpose of selecting the least busy mirror member when an I/O operation
+immediately follows its predecessor on rotational vdevs
+for the purpose of making decisions based on load.
+.
+.It Sy zfs_vdev_mirror_rotating_seek_inc Ns = Ns Sy 5 Pq int
+A number by which the balancing algorithm increments the load calculation for
+the purpose of selecting the least busy mirror member when an I/O operation
+lacks locality as defined by
+.Sy zfs_vdev_mirror_rotating_seek_offset .
+Operations within this that are not immediately following the previous operation
+are incremented by half.
+.
+.It Sy zfs_vdev_mirror_rotating_seek_offset Ns = Ns Sy 1048576 Ns B Po 1MB Pc Pq int
+The maximum distance for the last queued I/O operation in which
+the balancing algorithm considers an operation to have locality.
+.No See Sx ZFS I/O SCHEDULER .
+.
+.It Sy zfs_vdev_mirror_non_rotating_inc Ns = Ns Sy 0 Pq int
+A number by which the balancing algorithm increments the load calculation for
+the purpose of selecting the least busy mirror member on non-rotational vdevs
+when I/O operations do not immediately follow one another.
+.
+.It Sy zfs_vdev_mirror_non_rotating_seek_inc Ns = Ns Sy 1 Pq int
+A number by which the balancing algorithm increments the load calculation for
+the purpose of selecting the least busy mirror member when an I/O operation lacks
+locality as defined by the
+.Sy zfs_vdev_mirror_rotating_seek_offset .
+Operations within this that are not immediately following the previous operation
+are incremented by half.
+.
+.It Sy zfs_vdev_read_gap_limit Ns = Ns Sy 32768 Ns B Po 32kB Pc Pq int
+Aggregate read I/O operations if the on-disk gap between them is within this
+threshold.
+.
+.It Sy zfs_vdev_write_gap_limit Ns = Ns Sy 4096 Ns B Po 4kB Pc Pq int
+Aggregate write I/O operations if the on-disk gap between them is within this
+threshold.
+.
+.It Sy zfs_vdev_raidz_impl Ns = Ns Sy fastest Pq string
+Select the raidz parity implementation to use.
+.Pp
+Variants that don't depend on CPU-specific features
+may be selected on module load, as they are supported on all systems.
+The remaining options may only be set after the module is loaded,
+as they are available only if the implementations are compiled in
+and supported on the running system.
+.Pp
+Once the module is loaded,
+.Pa /sys/module/zfs/parameters/zfs_vdev_raidz_impl
+will show the available options,
+with the currently selected one enclosed in square brackets.
+.Pp
+.TS
+lb l l .
+fastest selected by built-in benchmark
+original original implementation
+scalar scalar implementation
+sse2 SSE2 instruction set 64-bit x86
+ssse3 SSSE3 instruction set 64-bit x86
+avx2 AVX2 instruction set 64-bit x86
+avx512f AVX512F instruction set 64-bit x86
+avx512bw AVX512F & AVX512BW instruction sets 64-bit x86
+aarch64_neon NEON Aarch64/64-bit ARMv8
+aarch64_neonx2 NEON with more unrolling Aarch64/64-bit ARMv8
+powerpc_altivec Altivec PowerPC
+.TE
+.
+.It Sy zfs_vdev_scheduler Pq charp
+.Sy DEPRECATED .
+Prints warning to kernel log for compatiblity.
+.
+.It Sy zfs_zevent_len_max Ns = Ns Sy 512 Pq int
+Max event queue length.
+Events in the queue can be viewed with
+.Xr zpool-events 8 .
+.
+.It Sy zfs_zevent_retain_max Ns = Ns Sy 2000 Pq int
+Maximum recent zevent records to retain for duplicate checking.
+Setting this to
+.Sy 0
+disables duplicate detection.
+.
+.It Sy zfs_zevent_retain_expire_secs Ns = Ns Sy 900 Ns s Po 15min Pc Pq int
+Lifespan for a recent ereport that was retained for duplicate checking.
+.
+.It Sy zfs_zil_clean_taskq_maxalloc Ns = Ns Sy 1048576 Pq int
+The maximum number of taskq entries that are allowed to be cached.
+When this limit is exceeded transaction records (itxs)
+will be cleaned synchronously.
+.
+.It Sy zfs_zil_clean_taskq_minalloc Ns = Ns Sy 1024 Pq int
+The number of taskq entries that are pre-populated when the taskq is first
+created and are immediately available for use.
+.
+.It Sy zfs_zil_clean_taskq_nthr_pct Ns = Ns Sy 100 Ns % Pq int
+This controls the number of threads used by
+.Sy dp_zil_clean_taskq .
+The default value of
+.Sy 100%
+will create a maximum of one thread per cpu.
+.
+.It Sy zil_maxblocksize Ns = Ns Sy 131072 Ns B Po 128kB Pc Pq int
+This sets the maximum block size used by the ZIL.
+On very fragmented pools, lowering this
+.Pq typically to Sy 36kB
+can improve performance.
+.
+.It Sy zil_nocacheflush Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Disable the cache flush commands that are normally sent to disk by
+the ZIL after an LWB write has completed.
+Setting this will cause ZIL corruption on power loss
+if a volatile out-of-order write cache is enabled.
+.
+.It Sy zil_replay_disable Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Disable intent logging replay.
+Can be disabled for recovery from corrupted ZIL.
+.
+.It Sy zil_slog_bulk Ns = Ns Sy 786432 Ns B Po 768kB Pc Pq ulong
+Limit SLOG write size per commit executed with synchronous priority.
+Any writes above that will be executed with lower (asynchronous) priority
+to limit potential SLOG device abuse by single active ZIL writer.
+.
+.It Sy zfs_embedded_slog_min_ms Ns = Ns Sy 64 Pq int
+Usually, one metaslab from each normal-class vdev is dedicated for use by
+the ZIL to log synchronous writes.
+However, if there are fewer than
+.Sy zfs_embedded_slog_min_ms
+metaslabs in the vdev, this functionality is disabled.
+This ensures that we don't set aside an unreasonable amount of space for the ZIL.
+.
+.It Sy zio_deadman_log_all Ns = Ns Sy 0 Ns | Ns 1 Pq int
+If non-zero, the zio deadman will produce debugging messages
+.Pq see Sy zfs_dbgmsg_enable
+for all zios, rather than only for leaf zios possessing a vdev.
+This is meant to be used by developers to gain
+diagnostic information for hang conditions which don't involve a mutex
+or other locking primitive: typically conditions in which a thread in
+the zio pipeline is looping indefinitely.
+.
+.It Sy zio_slow_io_ms Ns = Ns Sy 30000 Ns ms Po 30s Pc Pq int
+When an I/O operation takes more than this much time to complete,
+it's marked as slow.
+Each slow operation causes a delay zevent.
+Slow I/O counters can be seen with
+.Nm zpool Cm status Fl s .
+.
+.It Sy zio_dva_throttle_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
+Throttle block allocations in the I/O pipeline.
+This allows for dynamic allocation distribution when devices are imbalanced.
+When enabled, the maximum number of pending allocations per top-level vdev
+is limited by
+.Sy zfs_vdev_queue_depth_pct .
+.
+.It Sy zio_requeue_io_start_cut_in_line Ns = Ns Sy 0 Ns | Ns 1 Pq int
+Prioritize requeued I/O.
+.
+.It Sy zio_taskq_batch_pct Ns = Ns Sy 80 Ns % Pq uint
+Percentage of online CPUs which will run a worker thread for I/O.
+These workers are responsible for I/O work such as compression and
+checksum calculations.
+Fractional number of CPUs will be rounded down.
+.Pp
+The default value of
+.Sy 80%
+was chosen to avoid using all CPUs which can result in
+latency issues and inconsistent application performance,
+especially when slower compression and/or checksumming is enabled.
+.
+.It Sy zio_taskq_batch_tpq Ns = Ns Sy 0 Pq uint
+Number of worker threads per taskq.
+Lower values improve I/O ordering and CPU utilization,
+while higher reduces lock contention.
+.Pp
+If
+.Sy 0 ,
+generate a system-dependent value close to 6 threads per taskq.
+.
+.It Sy zvol_inhibit_dev Ns = Ns Sy 0 Ns | Ns 1 Pq uint
+Do not create zvol device nodes.
+This may slightly improve startup time on
+systems with a very large number of zvols.
+.
+.It Sy zvol_major Ns = Ns Sy 230 Pq uint
+Major number for zvol block devices.
+.
+.It Sy zvol_max_discard_blocks Ns = Ns Sy 16384 Pq ulong
+Discard (TRIM) operations done on zvols will be done in batches of this
+many blocks, where block size is determined by the
+.Sy volblocksize
+property of a zvol.
+.
+.It Sy zvol_prefetch_bytes Ns = Ns Sy 131072 Ns B Po 128kB Pc Pq uint
+When adding a zvol to the system, prefetch this many bytes
+from the start and end of the volume.
+Prefetching these regions of the volume is desirable,
+because they are likely to be accessed immediately by
+.Xr blkid 8
+or the kernel partitioner.
+.
+.It Sy zvol_request_sync Ns = Ns Sy 0 Ns | Ns 1 Pq uint
+When processing I/O requests for a zvol, submit them synchronously.
+This effectively limits the queue depth to
+.Em 1
+for each I/O submitter.
+When unset, requests are handled asynchronously by a thread pool.
+The number of requests which can be handled concurrently is controlled by
+.Sy zvol_threads .
+.
+.It Sy zvol_threads Ns = Ns Sy 32 Pq uint
+Max number of threads which can handle zvol I/O requests concurrently.
+.
+.It Sy zvol_volmode Ns = Ns Sy 1 Pq uint
+Defines zvol block devices behaviour when
+.Sy volmode Ns = Ns Sy default :
+.Bl -tag -compact -offset 4n -width "a"
+.It Sy 1
+.No equivalent to Sy full
+.It Sy 2
+.No equivalent to Sy dev
+.It Sy 3
+.No equivalent to Sy none
+.El
+.El
+.
+.Sh ZFS I/O SCHEDULER
+ZFS issues I/O operations to leaf vdevs to satisfy and complete I/O operations.
+The scheduler determines when and in what order those operations are issued.
+The scheduler divides operations into five I/O classes,
+prioritized in the following order: sync read, sync write, async read,
+async write, and scrub/resilver.
+Each queue defines the minimum and maximum number of concurrent operations
+that may be issued to the device.
+In addition, the device has an aggregate maximum,
+.Sy zfs_vdev_max_active .
+Note that the sum of the per-queue minima must not exceed the aggregate maximum.
+If the sum of the per-queue maxima exceeds the aggregate maximum,
+then the number of active operations may reach
+.Sy zfs_vdev_max_active ,
+in which case no further operations will be issued,
+regardless of whether all per-queue minima have been met.
+.Pp
+For many physical devices, throughput increases with the number of
+concurrent operations, but latency typically suffers.
+Furthermore, physical devices typically have a limit
+at which more concurrent operations have no
+effect on throughput or can actually cause it to decrease.
+.Pp
+The scheduler selects the next operation to issue by first looking for an
+I/O class whose minimum has not been satisfied.
+Once all are satisfied and the aggregate maximum has not been hit,
+the scheduler looks for classes whose maximum has not been satisfied.
+Iteration through the I/O classes is done in the order specified above.
+No further operations are issued
+if the aggregate maximum number of concurrent operations has been hit,
+or if there are no operations queued for an I/O class that has not hit its maximum.
+Every time an I/O operation is queued or an operation completes,
+the scheduler looks for new operations to issue.
+.Pp
+In general, smaller
+.Sy max_active Ns s
+will lead to lower latency of synchronous operations.
+Larger
+.Sy max_active Ns s
+may lead to higher overall throughput, depending on underlying storage.
+.Pp
+The ratio of the queues'
+.Sy max_active Ns s
+determines the balance of performance between reads, writes, and scrubs.
+For example, increasing
+.Sy zfs_vdev_scrub_max_active
+will cause the scrub or resilver to complete more quickly,
+but reads and writes to have higher latency and lower throughput.
+.Pp
+All I/O classes have a fixed maximum number of outstanding operations,
+except for the async write class.
+Asynchronous writes represent the data that is committed to stable storage
+during the syncing stage for transaction groups.
+Transaction groups enter the syncing state periodically,
+so the number of queued async writes will quickly burst up
+and then bleed down to zero.
+Rather than servicing them as quickly as possible,
+the I/O scheduler changes the maximum number of active async write operations
+according to the amount of dirty data in the pool.
+Since both throughput and latency typically increase with the number of
+concurrent operations issued to physical devices, reducing the
+burstiness in the number of concurrent operations also stabilizes the
+response time of operations from other – and in particular synchronous – queues.
+In broad strokes, the I/O scheduler will issue more concurrent operations
+from the async write queue as there's more dirty data in the pool.
+.
+.Ss Async Writes
+The number of concurrent operations issued for the async write I/O class
+follows a piece-wise linear function defined by a few adjustable points:
+.Bd -literal
+ | o---------| <-- \fBzfs_vdev_async_write_max_active\fP
+ ^ | /^ |
+ | | / | |
+active | / | |
+ I/O | / | |
+count | / | |
+ | / | |
+ |-------o | | <-- \fBzfs_vdev_async_write_min_active\fP
+ 0|_______^______|_________|
+ 0% | | 100% of \fBzfs_dirty_data_max\fP
+ | |
+ | `-- \fBzfs_vdev_async_write_active_max_dirty_percent\fP
+ `--------- \fBzfs_vdev_async_write_active_min_dirty_percent\fP
+.Ed
+.Pp
+Until the amount of dirty data exceeds a minimum percentage of the dirty
+data allowed in the pool, the I/O scheduler will limit the number of
+concurrent operations to the minimum.
+As that threshold is crossed, the number of concurrent operations issued
+increases linearly to the maximum at the specified maximum percentage
+of the dirty data allowed in the pool.
+.Pp
+Ideally, the amount of dirty data on a busy pool will stay in the sloped
+part of the function between
+.Sy zfs_vdev_async_write_active_min_dirty_percent
+and
+.Sy zfs_vdev_async_write_active_max_dirty_percent .
+If it exceeds the maximum percentage,
+this indicates that the rate of incoming data is
+greater than the rate that the backend storage can handle.
+In this case, we must further throttle incoming writes,
+as described in the next section.
+.
+.Sh ZFS TRANSACTION DELAY
+We delay transactions when we've determined that the backend storage
+isn't able to accommodate the rate of incoming writes.
+.Pp
+If there is already a transaction waiting, we delay relative to when
+that transaction will finish waiting.
+This way the calculated delay time
+is independent of the number of threads concurrently executing transactions.
+.Pp
+If we are the only waiter, wait relative to when the transaction started,
+rather than the current time.
+This credits the transaction for "time already served",
+e.g. reading indirect blocks.
+.Pp
+The minimum time for a transaction to take is calculated as
+.Dl min_time = min( Ns Sy zfs_delay_scale No * (dirty - min) / (max - dirty), 100ms)
+.Pp
+The delay has two degrees of freedom that can be adjusted via tunables.
+The percentage of dirty data at which we start to delay is defined by
+.Sy zfs_delay_min_dirty_percent .
+This should typically be at or above
+.Sy zfs_vdev_async_write_active_max_dirty_percent ,
+so that we only start to delay after writing at full speed
+has failed to keep up with the incoming write rate.
+The scale of the curve is defined by
+.Sy zfs_delay_scale .
+Roughly speaking, this variable determines the amount of delay at the midpoint of the curve.
+.Bd -literal
+delay
+ 10ms +-------------------------------------------------------------*+
+ | *|
+ 9ms + *+
+ | *|
+ 8ms + *+
+ | * |
+ 7ms + * +
+ | * |
+ 6ms + * +
+ | * |
+ 5ms + * +
+ | * |
+ 4ms + * +
+ | * |
+ 3ms + * +
+ | * |
+ 2ms + (midpoint) * +
+ | | ** |
+ 1ms + v *** +
+ | \fBzfs_delay_scale\fP ----------> ******** |
+ 0 +-------------------------------------*********----------------+
+ 0% <- \fBzfs_dirty_data_max\fP -> 100%
+.Ed
+.Pp
+Note, that since the delay is added to the outstanding time remaining on the
+most recent transaction it's effectively the inverse of IOPS.
+Here, the midpoint of
+.Em 500us
+translates to
+.Em 2000 IOPS .
+The shape of the curve
+was chosen such that small changes in the amount of accumulated dirty data
+in the first three quarters of the curve yield relatively small differences
+in the amount of delay.
+.Pp
+The effects can be easier to understand when the amount of delay is
+represented on a logarithmic scale:
+.Bd -literal
+delay
+100ms +-------------------------------------------------------------++
+ + +
+ | |
+ + *+
+ 10ms + *+
+ + ** +
+ | (midpoint) ** |
+ + | ** +
+ 1ms + v **** +
+ + \fBzfs_delay_scale\fP ----------> ***** +
+ | **** |
+ + **** +
+100us + ** +
+ + * +
+ | * |
+ + * +
+ 10us + * +
+ + +
+ | |
+ + +
+ +--------------------------------------------------------------+
+ 0% <- \fBzfs_dirty_data_max\fP -> 100%
+.Ed
+.Pp
+Note here that only as the amount of dirty data approaches its limit does
+the delay start to increase rapidly.
+The goal of a properly tuned system should be to keep the amount of dirty data
+out of that range by first ensuring that the appropriate limits are set
+for the I/O scheduler to reach optimal throughput on the back-end storage,
+and then by changing the value of
+.Sy zfs_delay_scale
+to increase the steepness of the curve.
diff --git a/sys/contrib/openzfs/man/man5/Makefile.am b/sys/contrib/openzfs/man/man5/Makefile.am
deleted file mode 100644
index 9cbb2c08f378..000000000000
--- a/sys/contrib/openzfs/man/man5/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-dist_man_MANS = \
- vdev_id.conf.5 \
- zpool-features.5 \
- spl-module-parameters.5 \
- zfs-module-parameters.5 \
- zfs-events.5
-
-if BUILD_LINUX
-# The man pager in most Linux distros defaults to BSD instead of Linux
-# when .Os is blank, but leaving it blank makes things a lot easier on
-# FreeBSD when OpenZFS is vendored in the base system.
-install-data-hook:
- cd $(DESTDIR)$(mandir)/man5; \
- $(SED) ${ac_inplace} -e 's/^\.Os$$/.Os Linux/' \
- $(dist_man_MANS)
-endif
diff --git a/sys/contrib/openzfs/man/man5/spl-module-parameters.5 b/sys/contrib/openzfs/man/man5/spl-module-parameters.5
deleted file mode 100644
index 5e28e694e04c..000000000000
--- a/sys/contrib/openzfs/man/man5/spl-module-parameters.5
+++ /dev/null
@@ -1,326 +0,0 @@
-'\" te
-.\"
-.\" Copyright 2013 Turbo Fredriksson <turbo@bayour.com>. All rights reserved.
-.\"
-.TH SPL-MODULE-PARAMETERS 5 "Aug 24, 2020" OpenZFS
-.SH NAME
-spl\-module\-parameters \- SPL module parameters
-.SH DESCRIPTION
-.sp
-.LP
-Description of the different parameters to the SPL module.
-
-.SS "Module parameters"
-.sp
-.LP
-
-.sp
-.ne 2
-.na
-\fBspl_kmem_cache_expire\fR (uint)
-.ad
-.RS 12n
-Cache expiration is part of default Illumos cache behavior. The idea is
-that objects in magazines which have not been recently accessed should be
-returned to the slabs periodically. This is known as cache aging and
-when enabled objects will be typically returned after 15 seconds.
-.sp
-On the other hand Linux slabs are designed to never move objects back to
-the slabs unless there is memory pressure. This is possible because under
-Linux the cache will be notified when memory is low and objects can be
-released.
-.sp
-By default only the Linux method is enabled. It has been shown to improve
-responsiveness on low memory systems and not negatively impact the performance
-of systems with more memory. This policy may be changed by setting the
-\fBspl_kmem_cache_expire\fR bit mask as follows, both policies may be enabled
-concurrently.
-.sp
-0x01 - Aging (Illumos), 0x02 - Low memory (Linux)
-.sp
-Default value: \fB0x02\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_kmem_cache_kmem_threads\fR (uint)
-.ad
-.RS 12n
-The number of threads created for the spl_kmem_cache task queue. This task
-queue is responsible for allocating new slabs for use by the kmem caches.
-For the majority of systems and workloads only a small number of threads are
-required.
-.sp
-Default value: \fB4\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_kmem_cache_reclaim\fR (uint)
-.ad
-.RS 12n
-When this is set it prevents Linux from being able to rapidly reclaim all the
-memory held by the kmem caches. This may be useful in circumstances where
-it's preferable that Linux reclaim memory from some other subsystem first.
-Setting this will increase the likelihood out of memory events on a memory
-constrained system.
-.sp
-Default value: \fB0\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_kmem_cache_obj_per_slab\fR (uint)
-.ad
-.RS 12n
-The preferred number of objects per slab in the cache. In general, a larger
-value will increase the caches memory footprint while decreasing the time
-required to perform an allocation. Conversely, a smaller value will minimize
-the footprint and improve cache reclaim time but individual allocations may
-take longer.
-.sp
-Default value: \fB8\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_kmem_cache_obj_per_slab_min\fR (uint)
-.ad
-.RS 12n
-The minimum number of objects allowed per slab. Normally slabs will contain
-\fBspl_kmem_cache_obj_per_slab\fR objects but for caches that contain very
-large objects it's desirable to only have a few, or even just one, object per
-slab.
-.sp
-Default value: \fB1\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_kmem_cache_max_size\fR (uint)
-.ad
-.RS 12n
-The maximum size of a kmem cache slab in MiB. This effectively limits
-the maximum cache object size to \fBspl_kmem_cache_max_size\fR /
-\fBspl_kmem_cache_obj_per_slab\fR. Caches may not be created with
-object sized larger than this limit.
-.sp
-Default value: \fB32 (64-bit) or 4 (32-bit)\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_kmem_cache_slab_limit\fR (uint)
-.ad
-.RS 12n
-For small objects the Linux slab allocator should be used to make the most
-efficient use of the memory. However, large objects are not supported by
-the Linux slab and therefore the SPL implementation is preferred. This
-value is used to determine the cutoff between a small and large object.
-.sp
-Objects of \fBspl_kmem_cache_slab_limit\fR or smaller will be allocated
-using the Linux slab allocator, large objects use the SPL allocator. A
-cutoff of 16K was determined to be optimal for architectures using 4K pages.
-.sp
-Default value: \fB16,384\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_kmem_alloc_warn\fR (uint)
-.ad
-.RS 12n
-As a general rule kmem_alloc() allocations should be small, preferably
-just a few pages since they must by physically contiguous. Therefore, a
-rate limited warning will be printed to the console for any kmem_alloc()
-which exceeds a reasonable threshold.
-.sp
-The default warning threshold is set to eight pages but capped at 32K to
-accommodate systems using large pages. This value was selected to be small
-enough to ensure the largest allocations are quickly noticed and fixed.
-But large enough to avoid logging any warnings when a allocation size is
-larger than optimal but not a serious concern. Since this value is tunable,
-developers are encouraged to set it lower when testing so any new largish
-allocations are quickly caught. These warnings may be disabled by setting
-the threshold to zero.
-.sp
-Default value: \fB32,768\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_kmem_alloc_max\fR (uint)
-.ad
-.RS 12n
-Large kmem_alloc() allocations will fail if they exceed KMALLOC_MAX_SIZE.
-Allocations which are marginally smaller than this limit may succeed but
-should still be avoided due to the expense of locating a contiguous range
-of free pages. Therefore, a maximum kmem size with reasonable safely
-margin of 4x is set. Kmem_alloc() allocations larger than this maximum
-will quickly fail. Vmem_alloc() allocations less than or equal to this
-value will use kmalloc(), but shift to vmalloc() when exceeding this value.
-.sp
-Default value: \fBKMALLOC_MAX_SIZE/4\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_kmem_cache_magazine_size\fR (uint)
-.ad
-.RS 12n
-Cache magazines are an optimization designed to minimize the cost of
-allocating memory. They do this by keeping a per-cpu cache of recently
-freed objects, which can then be reallocated without taking a lock. This
-can improve performance on highly contended caches. However, because
-objects in magazines will prevent otherwise empty slabs from being
-immediately released this may not be ideal for low memory machines.
-.sp
-For this reason \fBspl_kmem_cache_magazine_size\fR can be used to set a
-maximum magazine size. When this value is set to 0 the magazine size will
-be automatically determined based on the object size. Otherwise magazines
-will be limited to 2-256 objects per magazine (i.e per cpu). Magazines
-may never be entirely disabled in this implementation.
-.sp
-Default value: \fB0\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_hostid\fR (ulong)
-.ad
-.RS 12n
-The system hostid, when set this can be used to uniquely identify a system.
-By default this value is set to zero which indicates the hostid is disabled.
-It can be explicitly enabled by placing a unique non-zero value in
-\fB/etc/hostid/\fR.
-.sp
-Default value: \fB0\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_hostid_path\fR (charp)
-.ad
-.RS 12n
-The expected path to locate the system hostid when specified. This value
-may be overridden for non-standard configurations.
-.sp
-Default value: \fB/etc/hostid\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_panic_halt\fR (uint)
-.ad
-.RS 12n
-Cause a kernel panic on assertion failures. When not enabled, the thread is
-halted to facilitate further debugging.
-.sp
-Set to a non-zero value to enable.
-.sp
-Default value: \fB0\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_taskq_kick\fR (uint)
-.ad
-.RS 12n
-Kick stuck taskq to spawn threads. When writing a non-zero value to it, it will
-scan all the taskqs. If any of them have a pending task more than 5 seconds old,
-it will kick it to spawn more threads. This can be used if you find a rare
-deadlock occurs because one or more taskqs didn't spawn a thread when it should.
-.sp
-Default value: \fB0\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_taskq_thread_bind\fR (int)
-.ad
-.RS 12n
-Bind taskq threads to specific CPUs. When enabled all taskq threads will
-be distributed evenly over the available CPUs. By default, this behavior
-is disabled to allow the Linux scheduler the maximum flexibility to determine
-where a thread should run.
-.sp
-Default value: \fB0\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_taskq_thread_dynamic\fR (int)
-.ad
-.RS 12n
-Allow dynamic taskqs. When enabled taskqs which set the TASKQ_DYNAMIC flag
-will by default create only a single thread. New threads will be created on
-demand up to a maximum allowed number to facilitate the completion of
-outstanding tasks. Threads which are no longer needed will be promptly
-destroyed. By default this behavior is enabled but it can be disabled to
-aid performance analysis or troubleshooting.
-.sp
-Default value: \fB1\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_taskq_thread_priority\fR (int)
-.ad
-.RS 12n
-Allow newly created taskq threads to set a non-default scheduler priority.
-When enabled the priority specified when a taskq is created will be applied
-to all threads created by that taskq. When disabled all threads will use
-the default Linux kernel thread priority. By default, this behavior is
-enabled.
-.sp
-Default value: \fB1\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_taskq_thread_sequential\fR (int)
-.ad
-.RS 12n
-The number of items a taskq worker thread must handle without interruption
-before requesting a new worker thread be spawned. This is used to control
-how quickly taskqs ramp up the number of threads processing the queue.
-Because Linux thread creation and destruction are relatively inexpensive a
-small default value has been selected. This means that normally threads will
-be created aggressively which is desirable. Increasing this value will
-result in a slower thread creation rate which may be preferable for some
-configurations.
-.sp
-Default value: \fB4\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBspl_max_show_tasks\fR (uint)
-.ad
-.RS 12n
-The maximum number of tasks per pending list in each taskq shown in
-/proc/spl/{taskq,taskq-all}. Write 0 to turn off the limit. The proc file will
-walk the lists with lock held, reading it could cause a lock up if the list
-grow too large without limiting the output. "(truncated)" will be shown if the
-list is larger than the limit.
-.sp
-Default value: \fB512\fR
-.RE
diff --git a/sys/contrib/openzfs/man/man5/vdev_id.conf.5 b/sys/contrib/openzfs/man/man5/vdev_id.conf.5
index 9ae3865f7d3d..a2d38add4ee0 100644
--- a/sys/contrib/openzfs/man/man5/vdev_id.conf.5
+++ b/sys/contrib/openzfs/man/man5/vdev_id.conf.5
@@ -1,222 +1,249 @@
-.TH VDEV_ID.CONF 5 "Aug 24, 2020" OpenZFS
-.SH NAME
-vdev_id.conf \- Configuration file for vdev_id
-.SH DESCRIPTION
-.I vdev_id.conf
+.\"
+.\" This file and its contents are supplied under the terms of the
+.\" Common Development and Distribution License ("CDDL"), version 1.0.
+.\" You may only use this file in accordance with the terms of version
+.\" 1.0 of the CDDL.
+.\"
+.\" A full copy of the text of the CDDL should have accompanied this
+.\" source. A copy of the CDDL is also available via the Internet at
+.\" http://www.illumos.org/license/CDDL.
+.\"
+.Dd May 26, 2021
+.Dt VDEV_ID.CONF 5
+.Os
+.
+.Sh NAME
+.Nm vdev_id.conf
+.Nd configuration file for vdev_id(8)
+.Sh DESCRIPTION
+.Nm
is the configuration file for
-.BR vdev_id (8).
+.Xr vdev_id 8 .
It controls the default behavior of
-.BR vdev_id (8)
+.Xr vdev_id 8
while it is mapping a disk device name to an alias.
-.PP
+.Pp
The
-.I vdev_id.conf
+.Nm
file uses a simple format consisting of a keyword followed by one or
-more values on a single line. Any line not beginning with a recognized
-keyword is ignored. Comments may optionally begin with a hash
-character.
-
+more values on a single line.
+Any line not beginning with a recognized keyword is ignored.
+Comments may optionally begin with a hash character.
+.Pp
The following keywords and values are used.
-.TP
-\fIalias\fR <name> <devlink>
-Maps a device link in the /dev directory hierarchy to a new device
-name. The udev rule defining the device link must have run prior to
-.BR vdev_id (8).
+.Bl -tag -width "-h"
+.It Sy alias Ar name Ar devlink
+Maps a device link in the
+.Pa /dev
+directory hierarchy to a new device name.
+The udev rule defining the device link must have run prior to
+.Xr vdev_id 8 .
A defined alias takes precedence over a topology-derived name, but the
-two naming methods can otherwise coexist. For example, one might name
-drives in a JBOD with the sas_direct topology while naming an internal
-L2ARC device with an alias.
-
-\fIname\fR - the name of the link to the device that will by created in
-/dev/disk/by-vdev.
-
-\fIdevlink\fR - the name of the device link that has already been
-defined by udev. This may be an absolute path or the base filename.
-
-.TP
-\fIchannel\fR [pci_slot] <port> <name>
+two naming methods can otherwise coexist.
+For example, one might name drives in a JBOD with the
+.Sy sas_direct
+topology while naming an internal L2ARC device with an alias.
+.Pp
+.Ar name
+is the name of the link to the device that will by created under
+.Pa /dev/disk/by-vdev .
+.Pp
+.Ar devlink
+is the name of the device link that has already been
+defined by udev.
+This may be an absolute path or the base filename.
+.
+.It Sy channel [ Ns Ar pci_slot ] Ar port Ar name
Maps a physical path to a channel name (typically representing a single
disk enclosure).
-
-.TP
-\fIenclosure_symlinks\fR <yes|no>
-Additionally create /dev/by-enclosure symlinks to the disk enclosure
-sg devices using the naming scheme from vdev_id.conf.
-\fIenclosure_symlinks\fR is only allowed for sas_direct mode.
-.TP
-\fIenclosure_symlinks_prefix\fR <prefix>
-Specify the prefix for the enclosure symlinks in the form of:
-
-/dev/by-enclosure/<prefix>-<channel><num>
-
-Defaults to "enc" if not specified.
-.TP
-\fIpci_slot\fR - specifies the PCI SLOT of the HBA
-hosting the disk enclosure being mapped, as found in the output of
-.BR lspci (8).
-This argument is not used in sas_switch mode.
-
-\fIport\fR - specifies the numeric identifier of the HBA or SAS switch port
-connected to the disk enclosure being mapped.
-
-\fIname\fR - specifies the name of the channel.
-
-.TP
-\fIslot\fR <old> <new> [channel]
+.
+.It Sy enclosure_symlinks Sy yes Ns | Ns Sy no
+Additionally create
+.Pa /dev/by-enclosure
+symlinks to the disk enclosure
+.Em sg
+devices using the naming scheme from
+.Pa vdev_id.conf .
+.Sy enclosure_symlinks
+is only allowed for
+.Sy sas_direct
+mode.
+.
+.It Sy enclosure_symlinks_prefix Ar prefix
+Specify the prefix for the enclosure symlinks in the form
+.Pa /dev/by-enclosure/ Ns Ao Ar prefix Ac Ns - Ns Ao Ar channel Ac Ns Aq Ar num
+.Pp
+Defaults to
+.Dq Em enc .
+.
+.It Sy slot Ar prefix Ar new Op Ar channel
Maps a disk slot number as reported by the operating system to an
-alternative slot number. If the \fIchannel\fR parameter is specified
+alternative slot number.
+If the
+.Ar channel
+parameter is specified
then the mapping is only applied to slots in the named channel,
-otherwise the mapping is applied to all channels. The first-specified
-\fIslot\fR rule that can match a slot takes precedence. Therefore a
-channel-specific mapping for a given slot should generally appear before
-a generic mapping for the same slot. In this way a custom mapping may
-be applied to a particular channel and a default mapping applied to the
-others.
-
-.TP
-\fImultipath\fR <yes|no>
+otherwise the mapping is applied to all channels.
+The first-specified
+.Ar slot
+rule that can match a slot takes precedence.
+Therefore a channel-specific mapping for a given slot should generally appear
+before a generic mapping for the same slot.
+In this way a custom mapping may be applied to a particular channel
+and a default mapping applied to the others.
+.
+.It Sy multipath Sy yes Ns | Ns Sy no
Specifies whether
-.BR vdev_id (8)
-will handle only dm-multipath devices. If set to "yes" then
-.BR vdev_id (8)
+.Xr vdev_id 8
+will handle only dm-multipath devices.
+If set to
+.Sy yes
+then
+.Xr vdev_id 8
will examine the first running component disk of a dm-multipath
-device as listed by the
-.BR multipath (8)
-command to determine the physical path.
-.TP
-\fItopology\fR <sas_direct|sas_switch>
+device as provided by the driver command to determine the physical path.
+.
+.It Sy topology Sy sas_direct Ns | Ns Sy sas_switch Ns | Ns Sy scsi
Identifies a physical topology that governs how physical paths are
-mapped to channels.
-
-\fIsas_direct\fR - in this mode a channel is uniquely identified by
-a PCI slot and a HBA port number
-
-\fIsas_switch\fR - in this mode a channel is uniquely identified by
-a SAS switch port number
-
-.TP
-\fIphys_per_port\fR <num>
+mapped to channels:
+.Bl -tag -compact -width "sas_direct and scsi"
+.It Sy sas_direct No and Sy scsi
+channels are uniquely identified by a PCI slot and HBA port number
+.It Sy sas_switch
+channels are uniquely identified by a SAS switch port number
+.El
+.
+.It Sy phys_per_port Ar num
Specifies the number of PHY devices associated with a SAS HBA port or SAS
switch port.
-.BR vdev_id (8)
+.Xr vdev_id 8
internally uses this value to determine which HBA or switch port a
-device is connected to. The default is 4.
-
-.TP
-\fIslot\fR <bay|phy|port|id|lun|ses>
+device is connected to.
+The default is
+.Sy 4 .
+.
+.It Sy slot Sy bay Ns | Ns Sy phy Ns | Ns Sy port Ns | Ns Sy id Ns | Ns Sy lun Ns | Ns Sy ses
Specifies from which element of a SAS identifier the slot number is
-taken. The default is bay.
-
-\fIbay\fR - read the slot number from the bay identifier.
-
-\fIphy\fR - read the slot number from the phy identifier.
-
-\fIport\fR - use the SAS port as the slot number.
-
-\fIid\fR - use the scsi id as the slot number.
-
-\fIlun\fR - use the scsi lun as the slot number.
-
-\fIses\fR - use the SCSI Enclosure Services (SES) enclosure device slot number,
+taken.
+The default is
+.Sy bay :
+.Bl -tag -compact -width "port"
+.It Sy bay
+read the slot number from the bay identifier.
+.It Sy phy
+read the slot number from the phy identifier.
+.It Sy port
+use the SAS port as the slot number.
+.It Sy id
+use the scsi id as the slot number.
+.It Sy lun
+use the scsi lun as the slot number.
+.It Sy ses
+use the SCSI Enclosure Services (SES) enclosure device slot number,
as reported by
-.BR sg_ses (8).
-This is intended for use only on systems where \fIbay\fR is unsupported,
-noting that \fIport\fR and \fIid\fR may be unstable across disk replacement.
-.SH EXAMPLES
+.Xr sg_ses 8 .
+Intended for use only on systems where
+.Sy bay
+is unsupported,
+noting that
+.Sy port
+and
+.Sy id
+may be unstable across disk replacement.
+.El
+.El
+.
+.Sh FILES
+.Bl -tag -width "-v v"
+.It Pa /etc/zfs/vdev_id.conf
+The configuration file for
+.Xr vdev_id 8 .
+.El
+.
+.Sh EXAMPLES
A non-multipath configuration with direct-attached SAS enclosures and an
-arbitrary slot re-mapping.
-.P
-.nf
- multipath no
- topology sas_direct
- phys_per_port 4
- slot bay
-
- # PCI_SLOT HBA PORT CHANNEL NAME
- channel 85:00.0 1 A
- channel 85:00.0 0 B
- channel 86:00.0 1 C
- channel 86:00.0 0 D
-
- # Custom mapping for Channel A
-
- # Linux Mapped
- # Slot Slot Channel
- slot 1 7 A
- slot 2 10 A
- slot 3 3 A
- slot 4 6 A
-
- # Default mapping for B, C, and D
-
- slot 1 4
- slot 2 2
- slot 3 1
- slot 4 3
-.fi
-.P
-A SAS-switch topology. Note that the
-.I channel
-keyword takes only two arguments in this example.
-.P
-.nf
- topology sas_switch
-
- # SWITCH PORT CHANNEL NAME
- channel 1 A
- channel 2 B
- channel 3 C
- channel 4 D
-.fi
-.P
-A multipath configuration. Note that channel names have multiple
-definitions - one per physical path.
-.P
-.nf
- multipath yes
-
- # PCI_SLOT HBA PORT CHANNEL NAME
- channel 85:00.0 1 A
- channel 85:00.0 0 B
- channel 86:00.0 1 A
- channel 86:00.0 0 B
-.fi
-.P
-A configuration with enclosure_symlinks enabled.
-.P
-.nf
- multipath yes
- enclosure_symlinks yes
-
- # PCI_ID HBA PORT CHANNEL NAME
- channel 05:00.0 1 U
- channel 05:00.0 0 L
- channel 06:00.0 1 U
- channel 06:00.0 0 L
-.fi
+arbitrary slot re-mapping:
+.Bd -literal -compact -offset Ds
+multipath no
+topology sas_direct
+phys_per_port 4
+slot bay
+
+# PCI_SLOT HBA PORT CHANNEL NAME
+channel 85:00.0 1 A
+channel 85:00.0 0 B
+channel 86:00.0 1 C
+channel 86:00.0 0 D
+
+# Custom mapping for Channel A
+
+# Linux Mapped
+# Slot Slot Channel
+slot 1 7 A
+slot 2 10 A
+slot 3 3 A
+slot 4 6 A
+
+# Default mapping for B, C, and D
+
+slot 1 4
+slot 2 2
+slot 3 1
+slot 4 3
+.Ed
+.Pp
+A SAS-switch topology.
+Note, that the
+.Ar channel
+keyword takes only two arguments in this example:
+.Bd -literal -compact -offset Ds
+topology sas_switch
+
+# SWITCH PORT CHANNEL NAME
+channel 1 A
+channel 2 B
+channel 3 C
+channel 4 D
+.Ed
+.Pp
+A multipath configuration.
+Note that channel names have multiple definitions - one per physical path:
+.Bd -literal -compact -offset Ds
+multipath yes
+
+# PCI_SLOT HBA PORT CHANNEL NAME
+channel 85:00.0 1 A
+channel 85:00.0 0 B
+channel 86:00.0 1 A
+channel 86:00.0 0 B
+.Ed
+.Pp
+A configuration with enclosure_symlinks enabled:
+.Bd -literal -compact -offset Ds
+multipath yes
+enclosure_symlinks yes
+
+# PCI_ID HBA PORT CHANNEL NAME
+channel 05:00.0 1 U
+channel 05:00.0 0 L
+channel 06:00.0 1 U
+channel 06:00.0 0 L
+.Ed
In addition to the disks symlinks, this configuration will create:
-.P
-.nf
- /dev/by-enclosure/enc-L0
- /dev/by-enclosure/enc-L1
- /dev/by-enclosure/enc-U0
- /dev/by-enclosure/enc-U1
-.fi
-.P
-A configuration using device link aliases.
-.P
-.nf
- # by-vdev
- # name fully qualified or base name of device link
- alias d1 /dev/disk/by-id/wwn-0x5000c5002de3b9ca
- alias d2 wwn-0x5000c5002def789e
-.fi
-.P
-
-.SH FILES
-.TP
-.I /etc/zfs/vdev_id.conf
-The configuration file for
-.BR vdev_id (8).
-.SH SEE ALSO
-.BR vdev_id (8)
+.Bd -literal -compact -offset Ds
+/dev/by-enclosure/enc-L0
+/dev/by-enclosure/enc-L1
+/dev/by-enclosure/enc-U0
+/dev/by-enclosure/enc-U1
+.Ed
+.Pp
+A configuration using device link aliases:
+.Bd -literal -compact -offset Ds
+# by-vdev
+# name fully qualified or base name of device link
+alias d1 /dev/disk/by-id/wwn-0x5000c5002de3b9ca
+alias d2 wwn-0x5000c5002def789e
+.Ed
+.
+.Sh SEE ALSO
+.Xr vdev_id 8
diff --git a/sys/contrib/openzfs/man/man5/zfs-events.5 b/sys/contrib/openzfs/man/man5/zfs-events.5
deleted file mode 100644
index 0d0e1a9593d5..000000000000
--- a/sys/contrib/openzfs/man/man5/zfs-events.5
+++ /dev/null
@@ -1,965 +0,0 @@
-'\" te
-.\" Copyright (c) 2013 by Turbo Fredriksson <turbo@bayour.com>. All rights reserved.
-.\" Portions Copyright 2018 by Richard Elling
-.\" The contents of this file are subject to the terms of the Common Development
-.\" and Distribution License (the "License"). You may not use this file except
-.\" in compliance with the License. You can obtain a copy of the license at
-.\" usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
-.\"
-.\" See the License for the specific language governing permissions and
-.\" limitations under the License. When distributing Covered Code, include this
-.\" CDDL HEADER in each file and include the License file at
-.\" usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this
-.\" CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your
-.\" own identifying information:
-.\" Portions Copyright [yyyy] [name of copyright owner]
-.TH ZFS-EVENTS 5 "Aug 24, 2020" OpenZFS
-.SH NAME
-zfs\-events \- Events created by the ZFS filesystem.
-.SH DESCRIPTION
-.sp
-.LP
-Description of the different events generated by the ZFS stack.
-.sp
-Most of these don't have any description. The events generated by ZFS
-have never been publicly documented. What is here is intended as a
-starting point to provide documentation for all possible events.
-.sp
-To view all events created since the loading of the ZFS infrastructure
-(i.e, "the module"), run
-.P
-.nf
-\fBzpool events\fR
-.fi
-.P
-to get a short list, and
-.P
-.nf
-\fBzpool events -v\fR
-.fi
-.P
-to get a full detail of the events and what information
-is available about it.
-.sp
-This man page lists the different subclasses that are issued
-in the case of an event. The full event name would be
-\fIereport.fs.zfs.SUBCLASS\fR, but we only list the last
-part here.
-
-.SS "EVENTS (SUBCLASS)"
-.sp
-.LP
-
-.sp
-.ne 2
-.na
-\fBchecksum\fR
-.ad
-.RS 12n
-Issued when a checksum error has been detected.
-.RE
-
-.sp
-.ne 2
-.na
-\fBio\fR
-.ad
-.RS 12n
-Issued when there is an I/O error in a vdev in the pool.
-.RE
-
-.sp
-.ne 2
-.na
-\fBdata\fR
-.ad
-.RS 12n
-Issued when there have been data errors in the pool.
-.RE
-
-.sp
-.ne 2
-.na
-\fBdeadman\fR
-.ad
-.RS 12n
-Issued when an I/O is determined to be "hung", this can be caused by lost
-completion events due to flaky hardware or drivers. See the
-\fBzfs_deadman_failmode\fR module option description for additional
-information regarding "hung" I/O detection and configuration.
-.RE
-
-.sp
-.ne 2
-.na
-\fBdelay\fR
-.ad
-.RS 12n
-Issued when a completed I/O exceeds the maximum allowed time specified
-by the \fBzio_slow_io_ms\fR module option. This can be an indicator of
-problems with the underlying storage device. The number of delay events is
-ratelimited by the \fBzfs_slow_io_events_per_second\fR module parameter.
-.RE
-
-.sp
-.ne 2
-.na
-\fBconfig.sync\fR
-.ad
-.RS 12n
-Issued every time a vdev change have been done to the pool.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzpool\fR
-.ad
-.RS 12n
-Issued when a pool cannot be imported.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzpool.destroy\fR
-.ad
-.RS 12n
-Issued when a pool is destroyed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzpool.export\fR
-.ad
-.RS 12n
-Issued when a pool is exported.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzpool.import\fR
-.ad
-.RS 12n
-Issued when a pool is imported.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzpool.reguid\fR
-.ad
-.RS 12n
-Issued when a REGUID (new unique identifier for the pool have been regenerated) have been detected.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev.unknown\fR
-.ad
-.RS 12n
-Issued when the vdev is unknown. Such as trying to clear device
-errors on a vdev that have failed/been kicked from the system/pool
-and is no longer available.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev.open_failed\fR
-.ad
-.RS 12n
-Issued when a vdev could not be opened (because it didn't exist for example).
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev.corrupt_data\fR
-.ad
-.RS 12n
-Issued when corrupt data have been detected on a vdev.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev.no_replicas\fR
-.ad
-.RS 12n
-Issued when there are no more replicas to sustain the pool.
-This would lead to the pool being \fIDEGRADED\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev.bad_guid_sum\fR
-.ad
-.RS 12n
-Issued when a missing device in the pool have been detected.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev.too_small\fR
-.ad
-.RS 12n
-Issued when the system (kernel) have removed a device, and ZFS
-notices that the device isn't there any more. This is usually
-followed by a \fBprobe_failure\fR event.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev.bad_label\fR
-.ad
-.RS 12n
-Issued when the label is OK but invalid.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev.bad_ashift\fR
-.ad
-.RS 12n
-Issued when the ashift alignment requirement has increased.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev.remove\fR
-.ad
-.RS 12n
-Issued when a vdev is detached from a mirror (or a spare detached from a
-vdev where it have been used to replace a failed drive - only works if
-the original drive have been readded).
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev.clear\fR
-.ad
-.RS 12n
-Issued when clearing device errors in a pool. Such as running \fBzpool clear\fR
-on a device in the pool.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev.check\fR
-.ad
-.RS 12n
-Issued when a check to see if a given vdev could be opened is started.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev.spare\fR
-.ad
-.RS 12n
-Issued when a spare have kicked in to replace a failed device.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev.autoexpand\fR
-.ad
-.RS 12n
-Issued when a vdev can be automatically expanded.
-.RE
-
-.sp
-.ne 2
-.na
-\fBio_failure\fR
-.ad
-.RS 12n
-Issued when there is an I/O failure in a vdev in the pool.
-.RE
-
-.sp
-.ne 2
-.na
-\fBprobe_failure\fR
-.ad
-.RS 12n
-Issued when a probe fails on a vdev. This would occur if a vdev
-have been kicked from the system outside of ZFS (such as the kernel
-have removed the device).
-.RE
-
-.sp
-.ne 2
-.na
-\fBlog_replay\fR
-.ad
-.RS 12n
-Issued when the intent log cannot be replayed. The can occur in the case
-of a missing or damaged log device.
-.RE
-
-.sp
-.ne 2
-.na
-\fBresilver.start\fR
-.ad
-.RS 12n
-Issued when a resilver is started.
-.RE
-
-.sp
-.ne 2
-.na
-\fBresilver.finish\fR
-.ad
-.RS 12n
-Issued when the running resilver have finished.
-.RE
-
-.sp
-.ne 2
-.na
-\fBscrub.start\fR
-.ad
-.RS 12n
-Issued when a scrub is started on a pool.
-.RE
-
-.sp
-.ne 2
-.na
-\fBscrub.finish\fR
-.ad
-.RS 12n
-Issued when a pool has finished scrubbing.
-.RE
-
-.sp
-.ne 2
-.na
-\fBscrub.abort\fR
-.ad
-.RS 12n
-Issued when a scrub is aborted on a pool.
-.RE
-
-.sp
-.ne 2
-.na
-\fBscrub.resume\fR
-.ad
-.RS 12n
-Issued when a scrub is resumed on a pool.
-.RE
-
-.sp
-.ne 2
-.na
-\fBscrub.paused\fR
-.ad
-.RS 12n
-Issued when a scrub is paused on a pool.
-.RE
-
-.sp
-.ne 2
-.na
-\fBbootfs.vdev.attach\fR
-.ad
-.RS 12n
-.RE
-
-.SS "PAYLOADS"
-.sp
-.LP
-This is the payload (data, information) that accompanies an
-event.
-.sp
-For
-.BR zed (8),
-these are set to uppercase and prefixed with \fBZEVENT_\fR.
-
-.sp
-.ne 2
-.na
-\fBpool\fR
-.ad
-.RS 12n
-Pool name.
-.RE
-
-.sp
-.ne 2
-.na
-\fBpool_failmode\fR
-.ad
-.RS 12n
-Failmode - \fBwait\fR, \fBcontinue\fR or \fBpanic\fR.
-See
-.BR zpool (8)
-(\fIfailmode\fR property) for more information.
-.RE
-
-.sp
-.ne 2
-.na
-\fBpool_guid\fR
-.ad
-.RS 12n
-The GUID of the pool.
-.RE
-
-.sp
-.ne 2
-.na
-\fBpool_context\fR
-.ad
-.RS 12n
-The load state for the pool (0=none, 1=open, 2=import, 3=tryimport, 4=recover
-5=error).
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_guid\fR
-.ad
-.RS 12n
-The GUID of the vdev in question (the vdev failing or operated upon with
-\fBzpool clear\fR etc).
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_type\fR
-.ad
-.RS 12n
-Type of vdev - \fBdisk\fR, \fBfile\fR, \fBmirror\fR etc. See
-.BR zpool (8)
-under \fBVirtual Devices\fR for more information on possible values.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_path\fR
-.ad
-.RS 12n
-Full path of the vdev, including any \fI-partX\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_devid\fR
-.ad
-.RS 12n
-ID of vdev (if any).
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_fru\fR
-.ad
-.RS 12n
-Physical FRU location.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_state\fR
-.ad
-.RS 12n
-State of vdev (0=uninitialized, 1=closed, 2=offline, 3=removed, 4=failed to open, 5=faulted, 6=degraded, 7=healthy).
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_ashift\fR
-.ad
-.RS 12n
-The ashift value of the vdev.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_complete_ts\fR
-.ad
-.RS 12n
-The time the last I/O completed for the specified vdev.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_delta_ts\fR
-.ad
-.RS 12n
-The time since the last I/O completed for the specified vdev.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_spare_paths\fR
-.ad
-.RS 12n
-List of spares, including full path and any \fI-partX\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_spare_guids\fR
-.ad
-.RS 12n
-GUID(s) of spares.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_read_errors\fR
-.ad
-.RS 12n
-How many read errors that have been detected on the vdev.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_write_errors\fR
-.ad
-.RS 12n
-How many write errors that have been detected on the vdev.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_cksum_errors\fR
-.ad
-.RS 12n
-How many checksum errors that have been detected on the vdev.
-.RE
-
-.sp
-.ne 2
-.na
-\fBparent_guid\fR
-.ad
-.RS 12n
-GUID of the vdev parent.
-.RE
-
-.sp
-.ne 2
-.na
-\fBparent_type\fR
-.ad
-.RS 12n
-Type of parent. See \fBvdev_type\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBparent_path\fR
-.ad
-.RS 12n
-Path of the vdev parent (if any).
-.RE
-
-.sp
-.ne 2
-.na
-\fBparent_devid\fR
-.ad
-.RS 12n
-ID of the vdev parent (if any).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_objset\fR
-.ad
-.RS 12n
-The object set number for a given I/O.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_object\fR
-.ad
-.RS 12n
-The object number for a given I/O.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_level\fR
-.ad
-.RS 12n
-The indirect level for the block. Level 0 is the lowest level and includes
-data blocks. Values > 0 indicate metadata blocks at the appropriate level.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_blkid\fR
-.ad
-.RS 12n
-The block ID for a given I/O.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_err\fR
-.ad
-.RS 12n
-The errno for a failure when handling a given I/O. The errno is compatible
-with \fBerrno\fR(3) with the value for EBADE (0x34) used to indicate ZFS
-checksum error.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_offset\fR
-.ad
-.RS 12n
-The offset in bytes of where to write the I/O for the specified vdev.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_size\fR
-.ad
-.RS 12n
-The size in bytes of the I/O.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_flags\fR
-.ad
-.RS 12n
-The current flags describing how the I/O should be handled. See the
-\fBI/O FLAGS\fR section for the full list of I/O flags.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_stage\fR
-.ad
-.RS 12n
-The current stage of the I/O in the pipeline. See the \fBI/O STAGES\fR
-section for a full list of all the I/O stages.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_pipeline\fR
-.ad
-.RS 12n
-The valid pipeline stages for the I/O. See the \fBI/O STAGES\fR section for a
-full list of all the I/O stages.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_delay\fR
-.ad
-.RS 12n
-The time elapsed (in nanoseconds) waiting for the block layer to complete the
-I/O. Unlike \fBzio_delta\fR this does not include any vdev queuing time and is
-therefore solely a measure of the block layer performance.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_timestamp\fR
-.ad
-.RS 12n
-The time when a given I/O was submitted.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_delta\fR
-.ad
-.RS 12n
-The time required to service a given I/O.
-.RE
-
-.sp
-.ne 2
-.na
-\fBprev_state\fR
-.ad
-.RS 12n
-The previous state of the vdev.
-.RE
-
-.sp
-.ne 2
-.na
-\fBcksum_expected\fR
-.ad
-.RS 12n
-The expected checksum value for the block.
-.RE
-
-.sp
-.ne 2
-.na
-\fBcksum_actual\fR
-.ad
-.RS 12n
-The actual checksum value for an errant block.
-.RE
-
-.sp
-.ne 2
-.na
-\fBcksum_algorithm\fR
-.ad
-.RS 12n
-Checksum algorithm used. See \fBzfs\fR(8) for more information on checksum
-algorithms available.
-.RE
-
-.sp
-.ne 2
-.na
-\fBcksum_byteswap\fR
-.ad
-.RS 12n
-Whether or not the data is byteswapped.
-.RE
-
-.sp
-.ne 2
-.na
-\fBbad_ranges\fR
-.ad
-.RS 12n
-[start, end) pairs of corruption offsets. Offsets are always aligned on a
-64-bit boundary, and can include some gaps of non-corruption.
-(See \fBbad_ranges_min_gap\fR)
-.RE
-
-.sp
-.ne 2
-.na
-\fBbad_ranges_min_gap\fR
-.ad
-.RS 12n
-In order to bound the size of the \fBbad_ranges\fR array, gaps of non-corruption
-less than or equal to \fBbad_ranges_min_gap\fR bytes have been merged with
-adjacent corruption. Always at least 8 bytes, since corruption is detected
-on a 64-bit word basis.
-.RE
-
-.sp
-.ne 2
-.na
-\fBbad_range_sets\fR
-.ad
-.RS 12n
-This array has one element per range in \fBbad_ranges\fR. Each element contains
-the count of bits in that range which were clear in the good data and set
-in the bad data.
-.RE
-
-.sp
-.ne 2
-.na
-\fBbad_range_clears\fR
-.ad
-.RS 12n
-This array has one element per range in \fBbad_ranges\fR. Each element contains
-the count of bits for that range which were set in the good data and clear in
-the bad data.
-.RE
-
-.sp
-.ne 2
-.na
-\fBbad_set_bits\fR
-.ad
-.RS 12n
-If this field exists, it is an array of: (bad data & ~(good data)); that is,
-the bits set in the bad data which are cleared in the good data. Each element
-corresponds a byte whose offset is in a range in \fBbad_ranges\fR, and the
-array is ordered by offset. Thus, the first element is the first byte in the
-first \fBbad_ranges\fR range, and the last element is the last byte in the last
-\fBbad_ranges\fR range.
-.RE
-
-.sp
-.ne 2
-.na
-\fBbad_cleared_bits\fR
-.ad
-.RS 12n
-Like \fBbad_set_bits\fR, but contains: (good data & ~(bad data)); that is,
-the bits set in the good data which are cleared in the bad data.
-.RE
-
-.sp
-.ne 2
-.na
-\fBbad_set_histogram\fR
-.ad
-.RS 12n
-If this field exists, it is an array of counters. Each entry counts bits set
-in a particular bit of a big-endian uint64 type. The first entry counts bits
-set in the high-order bit of the first byte, the 9th byte, etc, and the last
-entry counts bits set of the low-order bit of the 8th byte, the 16th byte, etc.
-This information is useful for observing a stuck bit in a parallel data path,
-such as IDE or parallel SCSI.
-.RE
-
-.sp
-.ne 2
-.na
-\fBbad_cleared_histogram\fR
-.ad
-.RS 12n
-If this field exists, it is an array of counters. Each entry counts bit clears
-in a particular bit of a big-endian uint64 type. The first entry counts bits
-clears of the high-order bit of the first byte, the 9th byte, etc, and the
-last entry counts clears of the low-order bit of the 8th byte, the 16th byte,
-etc. This information is useful for observing a stuck bit in a parallel data
-path, such as IDE or parallel SCSI.
-.RE
-
-.SS "I/O STAGES"
-.sp
-.LP
-The ZFS I/O pipeline is comprised of various stages which are defined
-below. The individual stages are used to construct these basic I/O
-operations: Read, Write, Free, Claim, and Ioctl. These stages may be
-set on an event to describe the life cycle of a given I/O.
-
-.TS
-tab(:);
-l l l .
-Stage:Bit Mask:Operations
-_:_:_
-ZIO_STAGE_OPEN:0x00000001:RWFCI
-
-ZIO_STAGE_READ_BP_INIT:0x00000002:R----
-ZIO_STAGE_WRITE_BP_INIT:0x00000004:-W---
-ZIO_STAGE_FREE_BP_INIT:0x00000008:--F--
-ZIO_STAGE_ISSUE_ASYNC:0x00000010:RWF--
-ZIO_STAGE_WRITE_COMPRESS:0x00000020:-W---
-
-ZIO_STAGE_ENCRYPT:0x00000040:-W---
-ZIO_STAGE_CHECKSUM_GENERATE:0x00000080:-W---
-
-ZIO_STAGE_NOP_WRITE:0x00000100:-W---
-
-ZIO_STAGE_DDT_READ_START:0x00000200:R----
-ZIO_STAGE_DDT_READ_DONE:0x00000400:R----
-ZIO_STAGE_DDT_WRITE:0x00000800:-W---
-ZIO_STAGE_DDT_FREE:0x00001000:--F--
-
-ZIO_STAGE_GANG_ASSEMBLE:0x00002000:RWFC-
-ZIO_STAGE_GANG_ISSUE:0x00004000:RWFC-
-
-ZIO_STAGE_DVA_THROTTLE:0x00008000:-W---
-ZIO_STAGE_DVA_ALLOCATE:0x00010000:-W---
-ZIO_STAGE_DVA_FREE:0x00020000:--F--
-ZIO_STAGE_DVA_CLAIM:0x00040000:---C-
-
-ZIO_STAGE_READY:0x00080000:RWFCI
-
-ZIO_STAGE_VDEV_IO_START:0x00100000:RW--I
-ZIO_STAGE_VDEV_IO_DONE:0x00200000:RW--I
-ZIO_STAGE_VDEV_IO_ASSESS:0x00400000:RW--I
-
-ZIO_STAGE_CHECKSUM_VERIFY:0x00800000:R----
-
-ZIO_STAGE_DONE:0x01000000:RWFCI
-.TE
-
-.SS "I/O FLAGS"
-.sp
-.LP
-Every I/O in the pipeline contains a set of flags which describe its
-function and are used to govern its behavior. These flags will be set
-in an event as an \fBzio_flags\fR payload entry.
-
-.TS
-tab(:);
-l l .
-Flag:Bit Mask
-_:_
-ZIO_FLAG_DONT_AGGREGATE:0x00000001
-ZIO_FLAG_IO_REPAIR:0x00000002
-ZIO_FLAG_SELF_HEAL:0x00000004
-ZIO_FLAG_RESILVER:0x00000008
-ZIO_FLAG_SCRUB:0x00000010
-ZIO_FLAG_SCAN_THREAD:0x00000020
-ZIO_FLAG_PHYSICAL:0x00000040
-
-ZIO_FLAG_CANFAIL:0x00000080
-ZIO_FLAG_SPECULATIVE:0x00000100
-ZIO_FLAG_CONFIG_WRITER:0x00000200
-ZIO_FLAG_DONT_RETRY:0x00000400
-ZIO_FLAG_DONT_CACHE:0x00000800
-ZIO_FLAG_NODATA:0x00001000
-ZIO_FLAG_INDUCE_DAMAGE:0x00002000
-
-ZIO_FLAG_IO_ALLOCATING:0x00004000
-ZIO_FLAG_IO_RETRY:0x00008000
-ZIO_FLAG_PROBE:0x00010000
-ZIO_FLAG_TRYHARD:0x00020000
-ZIO_FLAG_OPTIONAL:0x00040000
-
-ZIO_FLAG_DONT_QUEUE:0x00080000
-ZIO_FLAG_DONT_PROPAGATE:0x00100000
-ZIO_FLAG_IO_BYPASS:0x00200000
-ZIO_FLAG_IO_REWRITE:0x00400000
-ZIO_FLAG_RAW_COMPRESS:0x00800000
-ZIO_FLAG_RAW_ENCRYPT:0x01000000
-
-ZIO_FLAG_GANG_CHILD:0x02000000
-ZIO_FLAG_DDT_CHILD:0x04000000
-ZIO_FLAG_GODFATHER:0x08000000
-ZIO_FLAG_NOPWRITE:0x10000000
-ZIO_FLAG_REEXECUTED:0x20000000
-ZIO_FLAG_DELEGATED:0x40000000
-ZIO_FLAG_FASTWRITE:0x80000000
-.TE
diff --git a/sys/contrib/openzfs/man/man5/zfs-module-parameters.5 b/sys/contrib/openzfs/man/man5/zfs-module-parameters.5
deleted file mode 100644
index f4afe2525c89..000000000000
--- a/sys/contrib/openzfs/man/man5/zfs-module-parameters.5
+++ /dev/null
@@ -1,4354 +0,0 @@
-'\" te
-.\" Copyright (c) 2013 by Turbo Fredriksson <turbo@bayour.com>. All rights reserved.
-.\" Copyright (c) 2019, 2021 by Delphix. All rights reserved.
-.\" Copyright (c) 2019 Datto Inc.
-.\" The contents of this file are subject to the terms of the Common Development
-.\" and Distribution License (the "License"). You may not use this file except
-.\" in compliance with the License. You can obtain a copy of the license at
-.\" usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
-.\"
-.\" See the License for the specific language governing permissions and
-.\" limitations under the License. When distributing Covered Code, include this
-.\" CDDL HEADER in each file and include the License file at
-.\" usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this
-.\" CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your
-.\" own identifying information:
-.\" Portions Copyright [yyyy] [name of copyright owner]
-.TH ZFS-MODULE-PARAMETERS 5 "May 5, 2021" OpenZFS
-.SH NAME
-zfs\-module\-parameters \- ZFS module parameters
-.SH DESCRIPTION
-.sp
-.LP
-Description of the different parameters to the ZFS module.
-
-.SS "Module parameters"
-.sp
-.LP
-
-.sp
-.ne 2
-.na
-\fBdbuf_cache_max_bytes\fR (ulong)
-.ad
-.RS 12n
-Maximum size in bytes of the dbuf cache. The target size is determined by the
-MIN versus \fB1/2^dbuf_cache_shift\fR (1/32) of the target ARC size. The
-behavior of the dbuf cache and its associated settings can be observed via the
-\fB/proc/spl/kstat/zfs/dbufstats\fR kstat.
-.sp
-Default value: \fBULONG_MAX\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBdbuf_metadata_cache_max_bytes\fR (ulong)
-.ad
-.RS 12n
-Maximum size in bytes of the metadata dbuf cache. The target size is
-determined by the MIN versus \fB1/2^dbuf_metadata_cache_shift\fR (1/64) of the
-target ARC size. The behavior of the metadata dbuf cache and its associated
-settings can be observed via the \fB/proc/spl/kstat/zfs/dbufstats\fR kstat.
-.sp
-Default value: \fBULONG_MAX\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBdbuf_cache_hiwater_pct\fR (uint)
-.ad
-.RS 12n
-The percentage over \fBdbuf_cache_max_bytes\fR when dbufs must be evicted
-directly.
-.sp
-Default value: \fB10\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBdbuf_cache_lowater_pct\fR (uint)
-.ad
-.RS 12n
-The percentage below \fBdbuf_cache_max_bytes\fR when the evict thread stops
-evicting dbufs.
-.sp
-Default value: \fB10\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBdbuf_cache_shift\fR (int)
-.ad
-.RS 12n
-Set the size of the dbuf cache, \fBdbuf_cache_max_bytes\fR, to a log2 fraction
-of the target ARC size.
-.sp
-Default value: \fB5\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBdbuf_metadata_cache_shift\fR (int)
-.ad
-.RS 12n
-Set the size of the dbuf metadata cache, \fBdbuf_metadata_cache_max_bytes\fR,
-to a log2 fraction of the target ARC size.
-.sp
-Default value: \fB6\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBdmu_object_alloc_chunk_shift\fR (int)
-.ad
-.RS 12n
-dnode slots allocated in a single operation as a power of 2. The default value
-minimizes lock contention for the bulk operation performed.
-.sp
-Default value: \fB7\fR (128).
-.RE
-
-.sp
-.ne 2
-.na
-\fBdmu_prefetch_max\fR (int)
-.ad
-.RS 12n
-Limit the amount we can prefetch with one call to this amount (in bytes).
-This helps to limit the amount of memory that can be used by prefetching.
-.sp
-Default value: \fB134,217,728\fR (128MB).
-.RE
-
-.sp
-.ne 2
-.na
-\fBignore_hole_birth\fR (int)
-.ad
-.RS 12n
-This is an alias for \fBsend_holes_without_birth_time\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2arc_feed_again\fR (int)
-.ad
-.RS 12n
-Turbo L2ARC warm-up. When the L2ARC is cold the fill interval will be set as
-fast as possible.
-.sp
-Use \fB1\fR for yes (default) and \fB0\fR to disable.
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2arc_feed_min_ms\fR (ulong)
-.ad
-.RS 12n
-Min feed interval in milliseconds. Requires \fBl2arc_feed_again=1\fR and only
-applicable in related situations.
-.sp
-Default value: \fB200\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2arc_feed_secs\fR (ulong)
-.ad
-.RS 12n
-Seconds between L2ARC writing
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2arc_headroom\fR (ulong)
-.ad
-.RS 12n
-How far through the ARC lists to search for L2ARC cacheable content, expressed
-as a multiplier of \fBl2arc_write_max\fR.
-ARC persistence across reboots can be achieved with persistent L2ARC by setting
-this parameter to \fB0\fR allowing the full length of ARC lists to be searched
-for cacheable content.
-.sp
-Default value: \fB2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2arc_headroom_boost\fR (ulong)
-.ad
-.RS 12n
-Scales \fBl2arc_headroom\fR by this percentage when L2ARC contents are being
-successfully compressed before writing. A value of \fB100\fR disables this
-feature.
-.sp
-Default value: \fB200\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2arc_mfuonly\fR (int)
-.ad
-.RS 12n
-Controls whether only MFU metadata and data are cached from ARC into L2ARC.
-This may be desired to avoid wasting space on L2ARC when reading/writing large
-amounts of data that are not expected to be accessed more than once. The
-default is \fB0\fR, meaning both MRU and MFU data and metadata are cached.
-When turning off (\fB0\fR) this feature some MRU buffers will still be present
-in ARC and eventually cached on L2ARC. If \fBl2arc_noprefetch\fR is set to 0,
-some prefetched buffers will be cached to L2ARC, and those might later
-transition to MRU, in which case the \fBl2arc_mru_asize\fR arcstat will not
-be 0. Regardless of \fBl2arc_noprefetch\fR, some MFU buffers might be evicted
-from ARC, accessed later on as prefetches and transition to MRU as prefetches.
-If accessed again they are counted as MRU and the \fBl2arc_mru_asize\fR arcstat
-will not be 0. The ARC status of L2ARC buffers when they were first cached in
-L2ARC can be seen in the \fBl2arc_mru_asize\fR, \fBl2arc_mfu_asize\fR and
-\fBl2arc_prefetch_asize\fR arcstats when importing the pool or onlining a cache
-device if persistent L2ARC is enabled. The \fBevicted_l2_eligible_mru\fR
-arcstat does not take into account if this option is enabled as the information
-provided by the evicted_l2_eligible_* arcstats can be used to decide if
-toggling this option is appropriate for the current workload.
-.sp
-Use \fB0\fR for no (default) and \fB1\fR for yes.
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2arc_meta_percent\fR (int)
-.ad
-.RS 12n
-Percent of ARC size allowed for L2ARC-only headers.
-Since L2ARC buffers are not evicted on memory pressure, too large amount of
-headers on system with irrationally large L2ARC can render it slow or unusable.
-This parameter limits L2ARC writes and rebuild to achieve it.
-.sp
-Default value: \fB33\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2arc_trim_ahead\fR (ulong)
-.ad
-.RS 12n
-Trims ahead of the current write size (\fBl2arc_write_max\fR) on L2ARC devices
-by this percentage of write size if we have filled the device. If set to
-\fB100\fR we TRIM twice the space required to accommodate upcoming writes. A
-minimum of 64MB will be trimmed. It also enables TRIM of the whole L2ARC device
-upon creation or addition to an existing pool or if the header of the device is
-invalid upon importing a pool or onlining a cache device. A value of \fB0\fR
-disables TRIM on L2ARC altogether and is the default as it can put significant
-stress on the underlying storage devices. This will vary depending of how well
-the specific device handles these commands.
-.sp
-Default value: \fB0\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2arc_noprefetch\fR (int)
-.ad
-.RS 12n
-Do not write buffers to L2ARC if they were prefetched but not used by
-applications. In case there are prefetched buffers in L2ARC and this option
-is later set to \fB1\fR, we do not read the prefetched buffers from L2ARC.
-Setting this option to \fB0\fR is useful for caching sequential reads from the
-disks to L2ARC and serve those reads from L2ARC later on. This may be beneficial
-in case the L2ARC device is significantly faster in sequential reads than the
-disks of the pool.
-.sp
-Use \fB1\fR to disable (default) and \fB0\fR to enable caching/reading
-prefetches to/from L2ARC..
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2arc_norw\fR (int)
-.ad
-.RS 12n
-No reads during writes.
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2arc_write_boost\fR (ulong)
-.ad
-.RS 12n
-Cold L2ARC devices will have \fBl2arc_write_max\fR increased by this amount
-while they remain cold.
-.sp
-Default value: \fB8,388,608\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2arc_write_max\fR (ulong)
-.ad
-.RS 12n
-Max write bytes per interval.
-.sp
-Default value: \fB8,388,608\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2arc_rebuild_enabled\fR (int)
-.ad
-.RS 12n
-Rebuild the L2ARC when importing a pool (persistent L2ARC). This can be
-disabled if there are problems importing a pool or attaching an L2ARC device
-(e.g. the L2ARC device is slow in reading stored log metadata, or the metadata
-has become somehow fragmented/unusable).
-.sp
-Use \fB1\fR for yes (default) and \fB0\fR for no.
-.RE
-
-.sp
-.ne 2
-.na
-\fBl2arc_rebuild_blocks_min_l2size\fR (ulong)
-.ad
-.RS 12n
-Min size (in bytes) of an L2ARC device required in order to write log blocks
-in it. The log blocks are used upon importing the pool to rebuild
-the L2ARC (persistent L2ARC). Rationale: for L2ARC devices less than 1GB, the
-amount of data l2arc_evict() evicts is significant compared to the amount of
-restored L2ARC data. In this case do not write log blocks in L2ARC in order not
-to waste space.
-.sp
-Default value: \fB1,073,741,824\fR (1GB).
-.RE
-
-.sp
-.ne 2
-.na
-\fBmetaslab_aliquot\fR (ulong)
-.ad
-.RS 12n
-Metaslab granularity, in bytes. This is roughly similar to what would be
-referred to as the "stripe size" in traditional RAID arrays. In normal
-operation, ZFS will try to write this amount of data to a top-level vdev
-before moving on to the next one.
-.sp
-Default value: \fB524,288\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBmetaslab_bias_enabled\fR (int)
-.ad
-.RS 12n
-Enable metaslab group biasing based on its vdev's over- or under-utilization
-relative to the pool.
-.sp
-Use \fB1\fR for yes (default) and \fB0\fR for no.
-.RE
-
-.sp
-.ne 2
-.na
-\fBmetaslab_force_ganging\fR (ulong)
-.ad
-.RS 12n
-Make some blocks above a certain size be gang blocks. This option is used
-by the test suite to facilitate testing.
-.sp
-Default value: \fB16,777,217\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_history_output_max\fR (int)
-.ad
-.RS 12n
-When attempting to log the output nvlist of an ioctl in the on-disk history, the
-output will not be stored if it is larger than size (in bytes). This must be
-less than DMU_MAX_ACCESS (64MB). This applies primarily to
-zfs_ioc_channel_program().
-.sp
-Default value: \fB1MB\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_keep_log_spacemaps_at_export\fR (int)
-.ad
-.RS 12n
-Prevent log spacemaps from being destroyed during pool exports and destroys.
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_metaslab_segment_weight_enabled\fR (int)
-.ad
-.RS 12n
-Enable/disable segment-based metaslab selection.
-.sp
-Use \fB1\fR for yes (default) and \fB0\fR for no.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_metaslab_switch_threshold\fR (int)
-.ad
-.RS 12n
-When using segment-based metaslab selection, continue allocating
-from the active metaslab until \fBzfs_metaslab_switch_threshold\fR
-worth of buckets have been exhausted.
-.sp
-Default value: \fB2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBmetaslab_debug_load\fR (int)
-.ad
-.RS 12n
-Load all metaslabs during pool import.
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBmetaslab_debug_unload\fR (int)
-.ad
-.RS 12n
-Prevent metaslabs from being unloaded.
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBmetaslab_fragmentation_factor_enabled\fR (int)
-.ad
-.RS 12n
-Enable use of the fragmentation metric in computing metaslab weights.
-.sp
-Use \fB1\fR for yes (default) and \fB0\fR for no.
-.RE
-
-.sp
-.ne 2
-.na
-\fBmetaslab_df_max_search\fR (int)
-.ad
-.RS 12n
-Maximum distance to search forward from the last offset. Without this limit,
-fragmented pools can see >100,000 iterations and metaslab_block_picker()
-becomes the performance limiting factor on high-performance storage.
-
-With the default setting of 16MB, we typically see less than 500 iterations,
-even with very fragmented, ashift=9 pools. The maximum number of iterations
-possible is: \fBmetaslab_df_max_search / (2 * (1<<ashift))\fR.
-With the default setting of 16MB this is 16*1024 (with ashift=9) or 2048
-(with ashift=12).
-.sp
-Default value: \fB16,777,216\fR (16MB)
-.RE
-
-.sp
-.ne 2
-.na
-\fBmetaslab_df_use_largest_segment\fR (int)
-.ad
-.RS 12n
-If we are not searching forward (due to metaslab_df_max_search,
-metaslab_df_free_pct, or metaslab_df_alloc_threshold), this tunable controls
-what segment is used. If it is set, we will use the largest free segment.
-If it is not set, we will use a segment of exactly the requested size (or
-larger).
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_metaslab_max_size_cache_sec\fR (ulong)
-.ad
-.RS 12n
-When we unload a metaslab, we cache the size of the largest free chunk. We use
-that cached size to determine whether or not to load a metaslab for a given
-allocation. As more frees accumulate in that metaslab while it's unloaded, the
-cached max size becomes less and less accurate. After a number of seconds
-controlled by this tunable, we stop considering the cached max size and start
-considering only the histogram instead.
-.sp
-Default value: \fB3600 seconds\fR (one hour)
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_metaslab_mem_limit\fR (int)
-.ad
-.RS 12n
-When we are loading a new metaslab, we check the amount of memory being used
-to store metaslab range trees. If it is over a threshold, we attempt to unload
-the least recently used metaslab to prevent the system from clogging all of
-its memory with range trees. This tunable sets the percentage of total system
-memory that is the threshold.
-.sp
-Default value: \fB25 percent\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_metaslab_try_hard_before_gang\fR (int)
-.ad
-.RS 12n
-If not set (the default), we will first try normal allocation.
-If that fails then we will do a gang allocation.
-If that fails then we will do a "try hard" gang allocation.
-If that fails then we will have a multi-layer gang block.
-.sp
-If set, we will first try normal allocation.
-If that fails then we will do a "try hard" allocation.
-If that fails we will do a gang allocation.
-If that fails we will do a "try hard" gang allocation.
-If that fails then we will have a multi-layer gang block.
-.sp
-Default value: \fB0 (false)\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_metaslab_find_max_tries\fR (int)
-.ad
-.RS 12n
-When not trying hard, we only consider this number of the best metaslabs.
-This improves performance, especially when there are many metaslabs per vdev
-and the allocation can't actually be satisfied (so we would otherwise iterate
-all the metaslabs).
-.sp
-Default value: \fB100\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_default_ms_count\fR (int)
-.ad
-.RS 12n
-When a vdev is added target this number of metaslabs per top-level vdev.
-.sp
-Default value: \fB200\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_default_ms_shift\fR (int)
-.ad
-.RS 12n
-Default limit for metaslab size.
-.sp
-Default value: \fB29\fR [meaning (1 << 29) = 512MB].
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_max_auto_ashift\fR (ulong)
-.ad
-.RS 12n
-Maximum ashift used when optimizing for logical -> physical sector size on new
-top-level vdevs.
-.sp
-Default value: \fBASHIFT_MAX\fR (16).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_min_auto_ashift\fR (ulong)
-.ad
-.RS 12n
-Minimum ashift used when creating new top-level vdevs.
-.sp
-Default value: \fBASHIFT_MIN\fR (9).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_min_ms_count\fR (int)
-.ad
-.RS 12n
-Minimum number of metaslabs to create in a top-level vdev.
-.sp
-Default value: \fB16\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_validate_skip\fR (int)
-.ad
-.RS 12n
-Skip label validation steps during pool import. Changing is not recommended
-unless you know what you are doing and are recovering a damaged label.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_ms_count_limit\fR (int)
-.ad
-.RS 12n
-Practical upper limit of total metaslabs per top-level vdev.
-.sp
-Default value: \fB131,072\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBmetaslab_preload_enabled\fR (int)
-.ad
-.RS 12n
-Enable metaslab group preloading.
-.sp
-Use \fB1\fR for yes (default) and \fB0\fR for no.
-.RE
-
-.sp
-.ne 2
-.na
-\fBmetaslab_lba_weighting_enabled\fR (int)
-.ad
-.RS 12n
-Give more weight to metaslabs with lower LBAs, assuming they have
-greater bandwidth as is typically the case on a modern constant
-angular velocity disk drive.
-.sp
-Use \fB1\fR for yes (default) and \fB0\fR for no.
-.RE
-
-.sp
-.ne 2
-.na
-\fBmetaslab_unload_delay\fR (int)
-.ad
-.RS 12n
-After a metaslab is used, we keep it loaded for this many txgs, to attempt to
-reduce unnecessary reloading. Note that both this many txgs and
-\fBmetaslab_unload_delay_ms\fR milliseconds must pass before unloading will
-occur.
-.sp
-Default value: \fB32\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBmetaslab_unload_delay_ms\fR (int)
-.ad
-.RS 12n
-After a metaslab is used, we keep it loaded for this many milliseconds, to
-attempt to reduce unnecessary reloading. Note that both this many
-milliseconds and \fBmetaslab_unload_delay\fR txgs must pass before unloading
-will occur.
-.sp
-Default value: \fB600000\fR (ten minutes).
-.RE
-
-.sp
-.ne 2
-.na
-\fBreference_history\fR (int)
-.ad
-.RS 12n
-Maximum reference holders being tracked when reference_tracking_enable is
-active.
-.sp
-Default value: \fB3\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBreference_tracking_enable\fR (int)
-.ad
-.RS 12n
-Track reference holders to refcount_t objects (debug builds only).
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBsend_holes_without_birth_time\fR (int)
-.ad
-.RS 12n
-When set, the hole_birth optimization will not be used, and all holes will
-always be sent on zfs send. This is useful if you suspect your datasets are
-affected by a bug in hole_birth.
-.sp
-Use \fB1\fR for on (default) and \fB0\fR for off.
-.RE
-
-.sp
-.ne 2
-.na
-\fBspa_config_path\fR (charp)
-.ad
-.RS 12n
-SPA config file
-.sp
-Default value: \fB/etc/zfs/zpool.cache\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBspa_asize_inflation\fR (int)
-.ad
-.RS 12n
-Multiplication factor used to estimate actual disk consumption from the
-size of data being written. The default value is a worst case estimate,
-but lower values may be valid for a given pool depending on its
-configuration. Pool administrators who understand the factors involved
-may wish to specify a more realistic inflation factor, particularly if
-they operate close to quota or capacity limits.
-.sp
-Default value: \fB24\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBspa_load_print_vdev_tree\fR (int)
-.ad
-.RS 12n
-Whether to print the vdev tree in the debugging message buffer during pool import.
-Use 0 to disable and 1 to enable.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBspa_load_verify_data\fR (int)
-.ad
-.RS 12n
-Whether to traverse data blocks during an "extreme rewind" (\fB-X\fR)
-import. Use 0 to disable and 1 to enable.
-
-An extreme rewind import normally performs a full traversal of all
-blocks in the pool for verification. If this parameter is set to 0,
-the traversal skips non-metadata blocks. It can be toggled once the
-import has started to stop or start the traversal of non-metadata blocks.
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBspa_load_verify_metadata\fR (int)
-.ad
-.RS 12n
-Whether to traverse blocks during an "extreme rewind" (\fB-X\fR)
-pool import. Use 0 to disable and 1 to enable.
-
-An extreme rewind import normally performs a full traversal of all
-blocks in the pool for verification. If this parameter is set to 0,
-the traversal is not performed. It can be toggled once the import has
-started to stop or start the traversal.
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBspa_load_verify_shift\fR (int)
-.ad
-.RS 12n
-Sets the maximum number of bytes to consume during pool import to the log2
-fraction of the target ARC size.
-.sp
-Default value: \fB4\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBspa_slop_shift\fR (int)
-.ad
-.RS 12n
-Normally, we don't allow the last 3.2% (1/(2^spa_slop_shift)) of space
-in the pool to be consumed. This ensures that we don't run the pool
-completely out of space, due to unaccounted changes (e.g. to the MOS).
-It also limits the worst-case time to allocate space. If we have
-less than this amount of free space, most ZPL operations (e.g. write,
-create) will return ENOSPC.
-.sp
-Default value: \fB5\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_removal_max_span\fR (int)
-.ad
-.RS 12n
-During top-level vdev removal, chunks of data are copied from the vdev
-which may include free space in order to trade bandwidth for IOPS.
-This parameter determines the maximum span of free space (in bytes)
-which will be included as "unnecessary" data in a chunk of copied data.
-
-The default value here was chosen to align with
-\fBzfs_vdev_read_gap_limit\fR, which is a similar concept when doing
-regular reads (but there's no reason it has to be the same).
-.sp
-Default value: \fB32,768\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_file_logical_ashift\fR (ulong)
-.ad
-.RS 12n
-Logical ashift for file-based devices.
-.sp
-Default value: \fB9\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBvdev_file_physical_ashift\fR (ulong)
-.ad
-.RS 12n
-Physical ashift for file-based devices.
-.sp
-Default value: \fB9\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzap_iterate_prefetch\fR (int)
-.ad
-.RS 12n
-If this is set, when we start iterating over a ZAP object, zfs will prefetch
-the entire object (all leaf blocks). However, this is limited by
-\fBdmu_prefetch_max\fR.
-.sp
-Use \fB1\fR for on (default) and \fB0\fR for off.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfetch_array_rd_sz\fR (ulong)
-.ad
-.RS 12n
-If prefetching is enabled, disable prefetching for reads larger than this size.
-.sp
-Default value: \fB1,048,576\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfetch_max_distance\fR (uint)
-.ad
-.RS 12n
-Max bytes to prefetch per stream.
-.sp
-Default value: \fB8,388,608\fR (8MB).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfetch_max_idistance\fR (uint)
-.ad
-.RS 12n
-Max bytes to prefetch indirects for per stream.
-.sp
-Default value: \fB67,108,864\fR (64MB).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfetch_max_streams\fR (uint)
-.ad
-.RS 12n
-Max number of streams per zfetch (prefetch streams per file).
-.sp
-Default value: \fB8\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfetch_min_sec_reap\fR (uint)
-.ad
-.RS 12n
-Min time before an active prefetch stream can be reclaimed
-.sp
-Default value: \fB2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_abd_scatter_enabled\fR (int)
-.ad
-.RS 12n
-Enables ARC from using scatter/gather lists and forces all allocations to be
-linear in kernel memory. Disabling can improve performance in some code paths
-at the expense of fragmented kernel memory.
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_abd_scatter_max_order\fR (iunt)
-.ad
-.RS 12n
-Maximum number of consecutive memory pages allocated in a single block for
-scatter/gather lists. Default value is specified by the kernel itself.
-.sp
-Default value: \fB10\fR at the time of this writing.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_abd_scatter_min_size\fR (uint)
-.ad
-.RS 12n
-This is the minimum allocation size that will use scatter (page-based)
-ABD's. Smaller allocations will use linear ABD's.
-.sp
-Default value: \fB1536\fR (512B and 1KB allocations will be linear).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_dnode_limit\fR (ulong)
-.ad
-.RS 12n
-When the number of bytes consumed by dnodes in the ARC exceeds this number of
-bytes, try to unpin some of it in response to demand for non-metadata. This
-value acts as a ceiling to the amount of dnode metadata, and defaults to 0 which
-indicates that a percent which is based on \fBzfs_arc_dnode_limit_percent\fR of
-the ARC meta buffers that may be used for dnodes.
-
-See also \fBzfs_arc_meta_prune\fR which serves a similar purpose but is used
-when the amount of metadata in the ARC exceeds \fBzfs_arc_meta_limit\fR rather
-than in response to overall demand for non-metadata.
-
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_dnode_limit_percent\fR (ulong)
-.ad
-.RS 12n
-Percentage that can be consumed by dnodes of ARC meta buffers.
-.sp
-See also \fBzfs_arc_dnode_limit\fR which serves a similar purpose but has a
-higher priority if set to nonzero value.
-.sp
-Default value: \fB10\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_dnode_reduce_percent\fR (ulong)
-.ad
-.RS 12n
-Percentage of ARC dnodes to try to scan in response to demand for non-metadata
-when the number of bytes consumed by dnodes exceeds \fBzfs_arc_dnode_limit\fR.
-
-.sp
-Default value: \fB10\fR% of the number of dnodes in the ARC.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_average_blocksize\fR (int)
-.ad
-.RS 12n
-The ARC's buffer hash table is sized based on the assumption of an average
-block size of \fBzfs_arc_average_blocksize\fR (default 8K). This works out
-to roughly 1MB of hash table per 1GB of physical memory with 8-byte pointers.
-For configurations with a known larger average block size this value can be
-increased to reduce the memory footprint.
-
-.sp
-Default value: \fB8192\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_eviction_pct\fR (int)
-.ad
-.RS 12n
-When \fBarc_is_overflowing()\fR, \fBarc_get_data_impl()\fR waits for this
-percent of the requested amount of data to be evicted. For example, by
-default for every 2KB that's evicted, 1KB of it may be "reused" by a new
-allocation. Since this is above 100%, it ensures that progress is made
-towards getting \fBarc_size\fR under \fBarc_c\fR. Since this is finite, it
-ensures that allocations can still happen, even during the potentially long
-time that \fBarc_size\fR is more than \fBarc_c\fR.
-.sp
-Default value: \fB200\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_evict_batch_limit\fR (int)
-.ad
-.RS 12n
-Number ARC headers to evict per sub-list before proceeding to another sub-list.
-This batch-style operation prevents entire sub-lists from being evicted at once
-but comes at a cost of additional unlocking and locking.
-.sp
-Default value: \fB10\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_grow_retry\fR (int)
-.ad
-.RS 12n
-If set to a non zero value, it will replace the arc_grow_retry value with this value.
-The arc_grow_retry value (default 5) is the number of seconds the ARC will wait before
-trying to resume growth after a memory pressure event.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_lotsfree_percent\fR (int)
-.ad
-.RS 12n
-Throttle I/O when free system memory drops below this percentage of total
-system memory. Setting this value to 0 will disable the throttle.
-.sp
-Default value: \fB10\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_max\fR (ulong)
-.ad
-.RS 12n
-Max size of ARC in bytes. If set to 0 then the max size of ARC is determined
-by the amount of system memory installed. For Linux, 1/2 of system memory will
-be used as the limit. For FreeBSD, the larger of all system memory - 1GB or
-5/8 of system memory will be used as the limit. This value must be at least
-67108864 (64 megabytes).
-.sp
-This value can be changed dynamically with some caveats. It cannot be set back
-to 0 while running and reducing it below the current ARC size will not cause
-the ARC to shrink without memory pressure to induce shrinking.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_meta_adjust_restarts\fR (ulong)
-.ad
-.RS 12n
-The number of restart passes to make while scanning the ARC attempting
-the free buffers in order to stay below the \fBzfs_arc_meta_limit\fR.
-This value should not need to be tuned but is available to facilitate
-performance analysis.
-.sp
-Default value: \fB4096\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_meta_limit\fR (ulong)
-.ad
-.RS 12n
-The maximum allowed size in bytes that meta data buffers are allowed to
-consume in the ARC. When this limit is reached meta data buffers will
-be reclaimed even if the overall arc_c_max has not been reached. This
-value defaults to 0 which indicates that a percent which is based on
-\fBzfs_arc_meta_limit_percent\fR of the ARC may be used for meta data.
-.sp
-This value my be changed dynamically except that it cannot be set back to 0
-for a specific percent of the ARC; it must be set to an explicit value.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_meta_limit_percent\fR (ulong)
-.ad
-.RS 12n
-Percentage of ARC buffers that can be used for meta data.
-
-See also \fBzfs_arc_meta_limit\fR which serves a similar purpose but has a
-higher priority if set to nonzero value.
-
-.sp
-Default value: \fB75\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_meta_min\fR (ulong)
-.ad
-.RS 12n
-The minimum allowed size in bytes that meta data buffers may consume in
-the ARC. This value defaults to 0 which disables a floor on the amount
-of the ARC devoted meta data.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_meta_prune\fR (int)
-.ad
-.RS 12n
-The number of dentries and inodes to be scanned looking for entries
-which can be dropped. This may be required when the ARC reaches the
-\fBzfs_arc_meta_limit\fR because dentries and inodes can pin buffers
-in the ARC. Increasing this value will cause to dentry and inode caches
-to be pruned more aggressively. Setting this value to 0 will disable
-pruning the inode and dentry caches.
-.sp
-Default value: \fB10,000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_meta_strategy\fR (int)
-.ad
-.RS 12n
-Define the strategy for ARC meta data buffer eviction (meta reclaim strategy).
-A value of 0 (META_ONLY) will evict only the ARC meta data buffers.
-A value of 1 (BALANCED) indicates that additional data buffers may be evicted if
-that is required to in order to evict the required number of meta data buffers.
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_min\fR (ulong)
-.ad
-.RS 12n
-Min size of ARC in bytes. If set to 0 then arc_c_min will default to
-consuming the larger of 32M or 1/32 of total system memory.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_min_prefetch_ms\fR (int)
-.ad
-.RS 12n
-Minimum time prefetched blocks are locked in the ARC, specified in ms.
-A value of \fB0\fR will default to 1000 ms.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_min_prescient_prefetch_ms\fR (int)
-.ad
-.RS 12n
-Minimum time "prescient prefetched" blocks are locked in the ARC, specified
-in ms. These blocks are meant to be prefetched fairly aggressively ahead of
-the code that may use them. A value of \fB0\fR will default to 6000 ms.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_max_missing_tvds\fR (int)
-.ad
-.RS 12n
-Number of missing top-level vdevs which will be allowed during
-pool import (only in read-only mode).
-.sp
-Default value: \fB0\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_max_nvlist_src_size\fR (ulong)
-.ad
-.RS 12n
-Maximum size in bytes allowed to be passed as zc_nvlist_src_size for ioctls on
-/dev/zfs. This prevents a user from causing the kernel to allocate an excessive
-amount of memory. When the limit is exceeded, the ioctl fails with EINVAL and a
-description of the error is sent to the zfs-dbgmsg log. This parameter should
-not need to be touched under normal circumstances. On FreeBSD, the default is
-based on the system limit on user wired memory. On Linux, the default is
-\fB128MB\fR.
-.sp
-Default value: \fB0\fR (kernel decides)
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_multilist_num_sublists\fR (int)
-.ad
-.RS 12n
-To allow more fine-grained locking, each ARC state contains a series
-of lists for both data and meta data objects. Locking is performed at
-the level of these "sub-lists". This parameters controls the number of
-sub-lists per ARC state, and also applies to other uses of the
-multilist data structure.
-.sp
-Default value: \fB4\fR or the number of online CPUs, whichever is greater
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_overflow_shift\fR (int)
-.ad
-.RS 12n
-The ARC size is considered to be overflowing if it exceeds the current
-ARC target size (arc_c) by a threshold determined by this parameter.
-The threshold is calculated as a fraction of arc_c using the formula
-"arc_c >> \fBzfs_arc_overflow_shift\fR".
-
-The default value of 8 causes the ARC to be considered to be overflowing
-if it exceeds the target size by 1/256th (0.3%) of the target size.
-
-When the ARC is overflowing, new buffer allocations are stalled until
-the reclaim thread catches up and the overflow condition no longer exists.
-.sp
-Default value: \fB8\fR.
-.RE
-
-.sp
-.ne 2
-.na
-
-\fBzfs_arc_p_min_shift\fR (int)
-.ad
-.RS 12n
-If set to a non zero value, this will update arc_p_min_shift (default 4)
-with the new value.
-arc_p_min_shift is used to shift of arc_c for calculating both min and max
-max arc_p
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_p_dampener_disable\fR (int)
-.ad
-.RS 12n
-Disable arc_p adapt dampener
-.sp
-Use \fB1\fR for yes (default) and \fB0\fR to disable.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_shrink_shift\fR (int)
-.ad
-.RS 12n
-If set to a non zero value, this will update arc_shrink_shift (default 7)
-with the new value.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_pc_percent\fR (uint)
-.ad
-.RS 12n
-Percent of pagecache to reclaim arc to
-
-This tunable allows ZFS arc to play more nicely with the kernel's LRU
-pagecache. It can guarantee that the ARC size won't collapse under scanning
-pressure on the pagecache, yet still allows arc to be reclaimed down to
-zfs_arc_min if necessary. This value is specified as percent of pagecache
-size (as measured by NR_FILE_PAGES) where that percent may exceed 100. This
-only operates during memory pressure/reclaim.
-.sp
-Default value: \fB0\fR% (disabled).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_shrinker_limit\fR (int)
-.ad
-.RS 12n
-This is a limit on how many pages the ARC shrinker makes available for
-eviction in response to one page allocation attempt. Note that in
-practice, the kernel's shrinker can ask us to evict up to about 4x this
-for one allocation attempt.
-.sp
-The default limit of 10,000 (in practice, 160MB per allocation attempt with
-4K pages) limits the amount of time spent attempting to reclaim ARC memory to
-less than 100ms per allocation attempt, even with a small average compressed
-block size of ~8KB.
-.sp
-The parameter can be set to 0 (zero) to disable the limit.
-.sp
-This parameter only applies on Linux.
-.sp
-Default value: \fB10,000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_arc_sys_free\fR (ulong)
-.ad
-.RS 12n
-The target number of bytes the ARC should leave as free memory on the system.
-Defaults to the larger of 1/64 of physical memory or 512K. Setting this
-option to a non-zero value will override the default.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_autoimport_disable\fR (int)
-.ad
-.RS 12n
-Disable pool import at module load by ignoring the cache file (typically \fB/etc/zfs/zpool.cache\fR).
-.sp
-Use \fB1\fR for yes (default) and \fB0\fR for no.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_checksum_events_per_second\fR (uint)
-.ad
-.RS 12n
-Rate limit checksum events to this many per second. Note that this should
-not be set below the zed thresholds (currently 10 checksums over 10 sec)
-or else zed may not trigger any action.
-.sp
-Default value: 20
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_commit_timeout_pct\fR (int)
-.ad
-.RS 12n
-This controls the amount of time that a ZIL block (lwb) will remain "open"
-when it isn't "full", and it has a thread waiting for it to be committed to
-stable storage. The timeout is scaled based on a percentage of the last lwb
-latency to avoid significantly impacting the latency of each individual
-transaction record (itx).
-.sp
-Default value: \fB5\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_condense_indirect_commit_entry_delay_ms\fR (int)
-.ad
-.RS 12n
-Vdev indirection layer (used for device removal) sleeps for this many
-milliseconds during mapping generation. Intended for use with the test suite
-to throttle vdev removal speed.
-.sp
-Default value: \fB0\fR (no throttle).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_condense_indirect_obsolete_pct\fR (int)
-.ad
-.RS 12n
-Minimum percent of obsolete bytes in vdev mapping required to attempt to
-condense (see \fBzfs_condense_indirect_vdevs_enable\fR). Intended for use
-with the test suite to facilitate triggering condensing as needed.
-.sp
-Default value: \fB25\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_condense_indirect_vdevs_enable\fR (int)
-.ad
-.RS 12n
-Enable condensing indirect vdev mappings. When set to a non-zero value,
-attempt to condense indirect vdev mappings if the mapping uses more than
-\fBzfs_condense_min_mapping_bytes\fR bytes of memory and if the obsolete
-space map object uses more than \fBzfs_condense_max_obsolete_bytes\fR
-bytes on-disk. The condensing process is an attempt to save memory by
-removing obsolete mappings.
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_condense_max_obsolete_bytes\fR (ulong)
-.ad
-.RS 12n
-Only attempt to condense indirect vdev mappings if the on-disk size
-of the obsolete space map object is greater than this number of bytes
-(see \fBfBzfs_condense_indirect_vdevs_enable\fR).
-.sp
-Default value: \fB1,073,741,824\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_condense_min_mapping_bytes\fR (ulong)
-.ad
-.RS 12n
-Minimum size vdev mapping to attempt to condense (see
-\fBzfs_condense_indirect_vdevs_enable\fR).
-.sp
-Default value: \fB131,072\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_dbgmsg_enable\fR (int)
-.ad
-.RS 12n
-Internally ZFS keeps a small log to facilitate debugging. By default the log
-is enabled, to disable it set this option to 0. The contents of the log can
-be accessed by reading the /proc/spl/kstat/zfs/dbgmsg file. Writing 0 to
-this proc file clears the log.
-.sp
-This setting does not influence debug prints due to \fBzfs_flags\fR
-settings.
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_dbgmsg_maxsize\fR (int)
-.ad
-.RS 12n
-The maximum size in bytes of the internal ZFS debug log.
-.sp
-Default value: \fB4M\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_dbuf_state_index\fR (int)
-.ad
-.RS 12n
-This feature is currently unused. It is normally used for controlling what
-reporting is available under /proc/spl/kstat/zfs.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_deadman_enabled\fR (int)
-.ad
-.RS 12n
-When a pool sync operation takes longer than \fBzfs_deadman_synctime_ms\fR
-milliseconds, or when an individual I/O takes longer than
-\fBzfs_deadman_ziotime_ms\fR milliseconds, then the operation is considered to
-be "hung". If \fBzfs_deadman_enabled\fR is set then the deadman behavior is
-invoked as described by the \fBzfs_deadman_failmode\fR module option.
-By default the deadman is enabled and configured to \fBwait\fR which results
-in "hung" I/Os only being logged. The deadman is automatically disabled
-when a pool gets suspended.
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_deadman_failmode\fR (charp)
-.ad
-.RS 12n
-Controls the failure behavior when the deadman detects a "hung" I/O. Valid
-values are \fBwait\fR, \fBcontinue\fR, and \fBpanic\fR.
-.sp
-\fBwait\fR - Wait for a "hung" I/O to complete. For each "hung" I/O a
-"deadman" event will be posted describing that I/O.
-.sp
-\fBcontinue\fR - Attempt to recover from a "hung" I/O by re-dispatching it
-to the I/O pipeline if possible.
-.sp
-\fBpanic\fR - Panic the system. This can be used to facilitate an automatic
-fail-over to a properly configured fail-over partner.
-.sp
-Default value: \fBwait\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_deadman_checktime_ms\fR (int)
-.ad
-.RS 12n
-Check time in milliseconds. This defines the frequency at which we check
-for hung I/O and potentially invoke the \fBzfs_deadman_failmode\fR behavior.
-.sp
-Default value: \fB60,000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_deadman_synctime_ms\fR (ulong)
-.ad
-.RS 12n
-Interval in milliseconds after which the deadman is triggered and also
-the interval after which a pool sync operation is considered to be "hung".
-Once this limit is exceeded the deadman will be invoked every
-\fBzfs_deadman_checktime_ms\fR milliseconds until the pool sync completes.
-.sp
-Default value: \fB600,000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_deadman_ziotime_ms\fR (ulong)
-.ad
-.RS 12n
-Interval in milliseconds after which the deadman is triggered and an
-individual I/O operation is considered to be "hung". As long as the I/O
-remains "hung" the deadman will be invoked every \fBzfs_deadman_checktime_ms\fR
-milliseconds until the I/O completes.
-.sp
-Default value: \fB300,000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_dedup_prefetch\fR (int)
-.ad
-.RS 12n
-Enable prefetching dedup-ed blks
-.sp
-Use \fB1\fR for yes and \fB0\fR to disable (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_delay_min_dirty_percent\fR (int)
-.ad
-.RS 12n
-Start to delay each transaction once there is this amount of dirty data,
-expressed as a percentage of \fBzfs_dirty_data_max\fR.
-This value should be >= zfs_vdev_async_write_active_max_dirty_percent.
-See the section "ZFS TRANSACTION DELAY".
-.sp
-Default value: \fB60\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_delay_scale\fR (int)
-.ad
-.RS 12n
-This controls how quickly the transaction delay approaches infinity.
-Larger values cause longer delays for a given amount of dirty data.
-.sp
-For the smoothest delay, this value should be about 1 billion divided
-by the maximum number of operations per second. This will smoothly
-handle between 10x and 1/10th this number.
-.sp
-See the section "ZFS TRANSACTION DELAY".
-.sp
-Note: \fBzfs_delay_scale\fR * \fBzfs_dirty_data_max\fR must be < 2^64.
-.sp
-Default value: \fB500,000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_disable_ivset_guid_check\fR (int)
-.ad
-.RS 12n
-Disables requirement for IVset guids to be present and match when doing a raw
-receive of encrypted datasets. Intended for users whose pools were created with
-OpenZFS pre-release versions and now have compatibility issues.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_key_max_salt_uses\fR (ulong)
-.ad
-.RS 12n
-Maximum number of uses of a single salt value before generating a new one for
-encrypted datasets. The default value is also the maximum that will be
-accepted.
-.sp
-Default value: \fB400,000,000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_object_mutex_size\fR (uint)
-.ad
-.RS 12n
-Size of the znode hashtable used for holds.
-
-Due to the need to hold locks on objects that may not exist yet, kernel mutexes
-are not created per-object and instead a hashtable is used where collisions
-will result in objects waiting when there is not actually contention on the
-same object.
-.sp
-Default value: \fB64\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_slow_io_events_per_second\fR (int)
-.ad
-.RS 12n
-Rate limit delay and deadman zevents (which report slow I/Os) to this many per
-second.
-.sp
-Default value: 20
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_unflushed_max_mem_amt\fR (ulong)
-.ad
-.RS 12n
-Upper-bound limit for unflushed metadata changes to be held by the
-log spacemap in memory (in bytes).
-.sp
-Default value: \fB1,073,741,824\fR (1GB).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_unflushed_max_mem_ppm\fR (ulong)
-.ad
-.RS 12n
-Percentage of the overall system memory that ZFS allows to be used
-for unflushed metadata changes by the log spacemap.
-(value is calculated over 1000000 for finer granularity).
-.sp
-Default value: \fB1000\fR (which is divided by 1000000, resulting in
-the limit to be \fB0.1\fR% of memory)
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_unflushed_log_block_max\fR (ulong)
-.ad
-.RS 12n
-Describes the maximum number of log spacemap blocks allowed for each pool.
-The default value of 262144 means that the space in all the log spacemaps
-can add up to no more than 262144 blocks (which means 32GB of logical
-space before compression and ditto blocks, assuming that blocksize is
-128k).
-.sp
-This tunable is important because it involves a trade-off between import
-time after an unclean export and the frequency of flushing metaslabs.
-The higher this number is, the more log blocks we allow when the pool is
-active which means that we flush metaslabs less often and thus decrease
-the number of I/Os for spacemap updates per TXG.
-At the same time though, that means that in the event of an unclean export,
-there will be more log spacemap blocks for us to read, inducing overhead
-in the import time of the pool.
-The lower the number, the amount of flushing increases destroying log
-blocks quicker as they become obsolete faster, which leaves less blocks
-to be read during import time after a crash.
-.sp
-Each log spacemap block existing during pool import leads to approximately
-one extra logical I/O issued.
-This is the reason why this tunable is exposed in terms of blocks rather
-than space used.
-.sp
-Default value: \fB262144\fR (256K).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_unflushed_log_block_min\fR (ulong)
-.ad
-.RS 12n
-If the number of metaslabs is small and our incoming rate is high, we
-could get into a situation that we are flushing all our metaslabs every
-TXG.
-Thus we always allow at least this many log blocks.
-.sp
-Default value: \fB1000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_unflushed_log_block_pct\fR (ulong)
-.ad
-.RS 12n
-Tunable used to determine the number of blocks that can be used for
-the spacemap log, expressed as a percentage of the total number of
-metaslabs in the pool.
-.sp
-Default value: \fB400\fR (read as \fB400\fR% - meaning that the number
-of log spacemap blocks are capped at 4 times the number of
-metaslabs in the pool).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_unlink_suspend_progress\fR (uint)
-.ad
-.RS 12n
-When enabled, files will not be asynchronously removed from the list of pending
-unlinks and the space they consume will be leaked. Once this option has been
-disabled and the dataset is remounted, the pending unlinks will be processed
-and the freed space returned to the pool.
-This option is used by the test suite to facilitate testing.
-.sp
-Uses \fB0\fR (default) to allow progress and \fB1\fR to pause progress.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_delete_blocks\fR (ulong)
-.ad
-.RS 12n
-This is the used to define a large file for the purposes of delete. Files
-containing more than \fBzfs_delete_blocks\fR will be deleted asynchronously
-while smaller files are deleted synchronously. Decreasing this value will
-reduce the time spent in an unlink(2) system call at the expense of a longer
-delay before the freed space is available.
-.sp
-Default value: \fB20,480\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_dirty_data_max\fR (int)
-.ad
-.RS 12n
-Determines the dirty space limit in bytes. Once this limit is exceeded, new
-writes are halted until space frees up. This parameter takes precedence
-over \fBzfs_dirty_data_max_percent\fR.
-See the section "ZFS TRANSACTION DELAY".
-.sp
-Default value: \fB10\fR% of physical RAM, capped at \fBzfs_dirty_data_max_max\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_dirty_data_max_max\fR (int)
-.ad
-.RS 12n
-Maximum allowable value of \fBzfs_dirty_data_max\fR, expressed in bytes.
-This limit is only enforced at module load time, and will be ignored if
-\fBzfs_dirty_data_max\fR is later changed. This parameter takes
-precedence over \fBzfs_dirty_data_max_max_percent\fR. See the section
-"ZFS TRANSACTION DELAY".
-.sp
-Default value: \fB25\fR% of physical RAM.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_dirty_data_max_max_percent\fR (int)
-.ad
-.RS 12n
-Maximum allowable value of \fBzfs_dirty_data_max\fR, expressed as a
-percentage of physical RAM. This limit is only enforced at module load
-time, and will be ignored if \fBzfs_dirty_data_max\fR is later changed.
-The parameter \fBzfs_dirty_data_max_max\fR takes precedence over this
-one. See the section "ZFS TRANSACTION DELAY".
-.sp
-Default value: \fB25\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_dirty_data_max_percent\fR (int)
-.ad
-.RS 12n
-Determines the dirty space limit, expressed as a percentage of all
-memory. Once this limit is exceeded, new writes are halted until space frees
-up. The parameter \fBzfs_dirty_data_max\fR takes precedence over this
-one. See the section "ZFS TRANSACTION DELAY".
-.sp
-Default value: \fB10\fR%, subject to \fBzfs_dirty_data_max_max\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_dirty_data_sync_percent\fR (int)
-.ad
-.RS 12n
-Start syncing out a transaction group if there's at least this much dirty data
-as a percentage of \fBzfs_dirty_data_max\fR. This should be less than
-\fBzfs_vdev_async_write_active_min_dirty_percent\fR.
-.sp
-Default value: \fB20\fR% of \fBzfs_dirty_data_max\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_fallocate_reserve_percent\fR (uint)
-.ad
-.RS 12n
-Since ZFS is a copy-on-write filesystem with snapshots, blocks cannot be
-preallocated for a file in order to guarantee that later writes will not
-run out of space. Instead, fallocate() space preallocation only checks
-that sufficient space is currently available in the pool or the user's
-project quota allocation, and then creates a sparse file of the requested
-size. The requested space is multiplied by \fBzfs_fallocate_reserve_percent\fR
-to allow additional space for indirect blocks and other internal metadata.
-Setting this value to 0 disables support for fallocate(2) and returns
-EOPNOTSUPP for fallocate() space preallocation again.
-.sp
-Default value: \fB110\fR%
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_fletcher_4_impl\fR (string)
-.ad
-.RS 12n
-Select a fletcher 4 implementation.
-.sp
-Supported selectors are: \fBfastest\fR, \fBscalar\fR, \fBsse2\fR, \fBssse3\fR,
-\fBavx2\fR, \fBavx512f\fR, \fBavx512bw\fR, and \fBaarch64_neon\fR.
-All of the selectors except \fBfastest\fR and \fBscalar\fR require instruction
-set extensions to be available and will only appear if ZFS detects that they are
-present at runtime. If multiple implementations of fletcher 4 are available,
-the \fBfastest\fR will be chosen using a micro benchmark. Selecting \fBscalar\fR
-results in the original, CPU based calculation, being used. Selecting any option
-other than \fBfastest\fR and \fBscalar\fR results in vector instructions from
-the respective CPU instruction set being used.
-.sp
-Default value: \fBfastest\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_free_bpobj_enabled\fR (int)
-.ad
-.RS 12n
-Enable/disable the processing of the free_bpobj object.
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_async_block_max_blocks\fR (ulong)
-.ad
-.RS 12n
-Maximum number of blocks freed in a single txg.
-.sp
-Default value: \fBULONG_MAX\fR (unlimited).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_max_async_dedup_frees\fR (ulong)
-.ad
-.RS 12n
-Maximum number of dedup blocks freed in a single txg.
-.sp
-Default value: \fB100,000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_override_estimate_recordsize\fR (ulong)
-.ad
-.RS 12n
-Record size calculation override for zfs send estimates.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_async_read_max_active\fR (int)
-.ad
-.RS 12n
-Maximum asynchronous read I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB3\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_async_read_min_active\fR (int)
-.ad
-.RS 12n
-Minimum asynchronous read I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_async_write_active_max_dirty_percent\fR (int)
-.ad
-.RS 12n
-When the pool has more than
-\fBzfs_vdev_async_write_active_max_dirty_percent\fR dirty data, use
-\fBzfs_vdev_async_write_max_active\fR to limit active async writes. If
-the dirty data is between min and max, the active I/O limit is linearly
-interpolated. See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB60\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_async_write_active_min_dirty_percent\fR (int)
-.ad
-.RS 12n
-When the pool has less than
-\fBzfs_vdev_async_write_active_min_dirty_percent\fR dirty data, use
-\fBzfs_vdev_async_write_min_active\fR to limit active async writes. If
-the dirty data is between min and max, the active I/O limit is linearly
-interpolated. See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB30\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_async_write_max_active\fR (int)
-.ad
-.RS 12n
-Maximum asynchronous write I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB10\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_async_write_min_active\fR (int)
-.ad
-.RS 12n
-Minimum asynchronous write I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Lower values are associated with better latency on rotational media but poorer
-resilver performance. The default value of 2 was chosen as a compromise. A
-value of 3 has been shown to improve resilver performance further at a cost of
-further increasing latency.
-.sp
-Default value: \fB2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_initializing_max_active\fR (int)
-.ad
-.RS 12n
-Maximum initializing I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_initializing_min_active\fR (int)
-.ad
-.RS 12n
-Minimum initializing I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_max_active\fR (int)
-.ad
-.RS 12n
-The maximum number of I/Os active to each device. Ideally, this will be >=
-the sum of each queue's max_active. See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB1,000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_rebuild_max_active\fR (int)
-.ad
-.RS 12n
-Maximum sequential resilver I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB3\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_rebuild_min_active\fR (int)
-.ad
-.RS 12n
-Minimum sequential resilver I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_removal_max_active\fR (int)
-.ad
-.RS 12n
-Maximum removal I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_removal_min_active\fR (int)
-.ad
-.RS 12n
-Minimum removal I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_scrub_max_active\fR (int)
-.ad
-.RS 12n
-Maximum scrub I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_scrub_min_active\fR (int)
-.ad
-.RS 12n
-Minimum scrub I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_sync_read_max_active\fR (int)
-.ad
-.RS 12n
-Maximum synchronous read I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB10\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_sync_read_min_active\fR (int)
-.ad
-.RS 12n
-Minimum synchronous read I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB10\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_sync_write_max_active\fR (int)
-.ad
-.RS 12n
-Maximum synchronous write I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB10\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_sync_write_min_active\fR (int)
-.ad
-.RS 12n
-Minimum synchronous write I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB10\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_trim_max_active\fR (int)
-.ad
-.RS 12n
-Maximum trim/discard I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_trim_min_active\fR (int)
-.ad
-.RS 12n
-Minimum trim/discard I/Os active to each device.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_nia_delay\fR (int)
-.ad
-.RS 12n
-For non-interactive I/O (scrub, resilver, removal, initialize and rebuild),
-the number of concurrently-active I/O's is limited to *_min_active, unless
-the vdev is "idle". When there are no interactive I/Os active (sync or
-async), and zfs_vdev_nia_delay I/Os have completed since the last
-interactive I/O, then the vdev is considered to be "idle", and the number
-of concurrently-active non-interactive I/O's is increased to *_max_active.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB5\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_nia_credit\fR (int)
-.ad
-.RS 12n
-Some HDDs tend to prioritize sequential I/O so high, that concurrent
-random I/O latency reaches several seconds. On some HDDs it happens
-even if sequential I/Os are submitted one at a time, and so setting
-*_max_active to 1 does not help. To prevent non-interactive I/Os, like
-scrub, from monopolizing the device no more than zfs_vdev_nia_credit
-I/Os can be sent while there are outstanding incomplete interactive
-I/Os. This enforced wait ensures the HDD services the interactive I/O
-within a reasonable amount of time.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB5\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_queue_depth_pct\fR (int)
-.ad
-.RS 12n
-Maximum number of queued allocations per top-level vdev expressed as
-a percentage of \fBzfs_vdev_async_write_max_active\fR which allows the
-system to detect devices that are more capable of handling allocations
-and to allocate more blocks to those devices. It allows for dynamic
-allocation distribution when devices are imbalanced as fuller devices
-will tend to be slower than empty devices.
-
-See also \fBzio_dva_throttle_enabled\fR.
-.sp
-Default value: \fB1000\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_expire_snapshot\fR (int)
-.ad
-.RS 12n
-Seconds to expire .zfs/snapshot
-.sp
-Default value: \fB300\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_admin_snapshot\fR (int)
-.ad
-.RS 12n
-Allow the creation, removal, or renaming of entries in the .zfs/snapshot
-directory to cause the creation, destruction, or renaming of snapshots.
-When enabled this functionality works both locally and over NFS exports
-which have the 'no_root_squash' option set. This functionality is disabled
-by default.
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_flags\fR (int)
-.ad
-.RS 12n
-Set additional debugging flags. The following flags may be bitwise-or'd
-together.
-.sp
-.TS
-box;
-rB lB
-lB lB
-r l.
-Value Symbolic Name
- Description
-_
-1 ZFS_DEBUG_DPRINTF
- Enable dprintf entries in the debug log.
-_
-2 ZFS_DEBUG_DBUF_VERIFY *
- Enable extra dbuf verifications.
-_
-4 ZFS_DEBUG_DNODE_VERIFY *
- Enable extra dnode verifications.
-_
-8 ZFS_DEBUG_SNAPNAMES
- Enable snapshot name verification.
-_
-16 ZFS_DEBUG_MODIFY
- Check for illegally modified ARC buffers.
-_
-64 ZFS_DEBUG_ZIO_FREE
- Enable verification of block frees.
-_
-128 ZFS_DEBUG_HISTOGRAM_VERIFY
- Enable extra spacemap histogram verifications.
-_
-256 ZFS_DEBUG_METASLAB_VERIFY
- Verify space accounting on disk matches in-core range_trees.
-_
-512 ZFS_DEBUG_SET_ERROR
- Enable SET_ERROR and dprintf entries in the debug log.
-_
-1024 ZFS_DEBUG_INDIRECT_REMAP
- Verify split blocks created by device removal.
-_
-2048 ZFS_DEBUG_TRIM
- Verify TRIM ranges are always within the allocatable range tree.
-_
-4096 ZFS_DEBUG_LOG_SPACEMAP
- Verify that the log summary is consistent with the spacemap log
- and enable zfs_dbgmsgs for metaslab loading and flushing.
-.TE
-.sp
-* Requires debug build.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_free_leak_on_eio\fR (int)
-.ad
-.RS 12n
-If destroy encounters an EIO while reading metadata (e.g. indirect
-blocks), space referenced by the missing metadata can not be freed.
-Normally this causes the background destroy to become "stalled", as
-it is unable to make forward progress. While in this stalled state,
-all remaining space to free from the error-encountering filesystem is
-"temporarily leaked". Set this flag to cause it to ignore the EIO,
-permanently leak the space from indirect blocks that can not be read,
-and continue to free everything else that it can.
-
-The default, "stalling" behavior is useful if the storage partially
-fails (i.e. some but not all i/os fail), and then later recovers. In
-this case, we will be able to continue pool operations while it is
-partially failed, and when it recovers, we can continue to free the
-space, with no leaks. However, note that this case is actually
-fairly rare.
-
-Typically pools either (a) fail completely (but perhaps temporarily,
-e.g. a top-level vdev going offline), or (b) have localized,
-permanent errors (e.g. disk returns the wrong data due to bit flip or
-firmware bug). In case (a), this setting does not matter because the
-pool will be suspended and the sync thread will not be able to make
-forward progress regardless. In case (b), because the error is
-permanent, the best we can do is leak the minimum amount of space,
-which is what setting this flag will do. Therefore, it is reasonable
-for this flag to normally be set, but we chose the more conservative
-approach of not setting it, so that there is no possibility of
-leaking space in the "partial temporary" failure case.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_free_min_time_ms\fR (int)
-.ad
-.RS 12n
-During a \fBzfs destroy\fR operation using \fBfeature@async_destroy\fR a minimum
-of this much time will be spent working on freeing blocks per txg.
-.sp
-Default value: \fB1,000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_obsolete_min_time_ms\fR (int)
-.ad
-.RS 12n
-Similar to \fBzfs_free_min_time_ms\fR but for cleanup of old indirection records
-for removed vdevs.
-.sp
-Default value: \fB500\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_immediate_write_sz\fR (long)
-.ad
-.RS 12n
-Largest data block to write to zil. Larger blocks will be treated as if the
-dataset being written to had the property setting \fBlogbias=throughput\fR.
-.sp
-Default value: \fB32,768\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_initialize_value\fR (ulong)
-.ad
-.RS 12n
-Pattern written to vdev free space by \fBzpool initialize\fR.
-.sp
-Default value: \fB16,045,690,984,833,335,022\fR (0xdeadbeefdeadbeee).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_initialize_chunk_size\fR (ulong)
-.ad
-.RS 12n
-Size of writes used by \fBzpool initialize\fR.
-This option is used by the test suite to facilitate testing.
-.sp
-Default value: \fB1,048,576\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_livelist_max_entries\fR (ulong)
-.ad
-.RS 12n
-The threshold size (in block pointers) at which we create a new sub-livelist.
-Larger sublists are more costly from a memory perspective but the fewer
-sublists there are, the lower the cost of insertion.
-.sp
-Default value: \fB500,000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_livelist_min_percent_shared\fR (int)
-.ad
-.RS 12n
-If the amount of shared space between a snapshot and its clone drops below
-this threshold, the clone turns off the livelist and reverts to the old deletion
-method. This is in place because once a clone has been overwritten enough
-livelists no long give us a benefit.
-.sp
-Default value: \fB75\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_livelist_condense_new_alloc\fR (int)
-.ad
-.RS 12n
-Incremented each time an extra ALLOC blkptr is added to a livelist entry while
-it is being condensed.
-This option is used by the test suite to track race conditions.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_livelist_condense_sync_cancel\fR (int)
-.ad
-.RS 12n
-Incremented each time livelist condensing is canceled while in
-spa_livelist_condense_sync.
-This option is used by the test suite to track race conditions.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_livelist_condense_sync_pause\fR (int)
-.ad
-.RS 12n
-When set, the livelist condense process pauses indefinitely before
-executing the synctask - spa_livelist_condense_sync.
-This option is used by the test suite to trigger race conditions.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_livelist_condense_zthr_cancel\fR (int)
-.ad
-.RS 12n
-Incremented each time livelist condensing is canceled while in
-spa_livelist_condense_cb.
-This option is used by the test suite to track race conditions.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_livelist_condense_zthr_pause\fR (int)
-.ad
-.RS 12n
-When set, the livelist condense process pauses indefinitely before
-executing the open context condensing work in spa_livelist_condense_cb.
-This option is used by the test suite to trigger race conditions.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_lua_max_instrlimit\fR (ulong)
-.ad
-.RS 12n
-The maximum execution time limit that can be set for a ZFS channel program,
-specified as a number of Lua instructions.
-.sp
-Default value: \fB100,000,000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_lua_max_memlimit\fR (ulong)
-.ad
-.RS 12n
-The maximum memory limit that can be set for a ZFS channel program, specified
-in bytes.
-.sp
-Default value: \fB104,857,600\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_max_dataset_nesting\fR (int)
-.ad
-.RS 12n
-The maximum depth of nested datasets. This value can be tuned temporarily to
-fix existing datasets that exceed the predefined limit.
-.sp
-Default value: \fB50\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_max_log_walking\fR (ulong)
-.ad
-.RS 12n
-The number of past TXGs that the flushing algorithm of the log spacemap
-feature uses to estimate incoming log blocks.
-.sp
-Default value: \fB5\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_max_logsm_summary_length\fR (ulong)
-.ad
-.RS 12n
-Maximum number of rows allowed in the summary of the spacemap log.
-.sp
-Default value: \fB10\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_max_recordsize\fR (int)
-.ad
-.RS 12n
-We currently support block sizes from 512 bytes to 16MB. The benefits of
-larger blocks, and thus larger I/O, need to be weighed against the cost of
-COWing a giant block to modify one byte. Additionally, very large blocks
-can have an impact on i/o latency, and also potentially on the memory
-allocator. Therefore, we do not allow the recordsize to be set larger than
-zfs_max_recordsize (default 1MB). Larger blocks can be created by changing
-this tunable, and pools with larger blocks can always be imported and used,
-regardless of this setting.
-.sp
-Default value: \fB1,048,576\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_allow_redacted_dataset_mount\fR (int)
-.ad
-.RS 12n
-Allow datasets received with redacted send/receive to be mounted. Normally
-disabled because these datasets may be missing key data.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_min_metaslabs_to_flush\fR (ulong)
-.ad
-.RS 12n
-Minimum number of metaslabs to flush per dirty TXG
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_metaslab_fragmentation_threshold\fR (int)
-.ad
-.RS 12n
-Allow metaslabs to keep their active state as long as their fragmentation
-percentage is less than or equal to this value. An active metaslab that
-exceeds this threshold will no longer keep its active status allowing
-better metaslabs to be selected.
-.sp
-Default value: \fB70\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_mg_fragmentation_threshold\fR (int)
-.ad
-.RS 12n
-Metaslab groups are considered eligible for allocations if their
-fragmentation metric (measured as a percentage) is less than or equal to
-this value. If a metaslab group exceeds this threshold then it will be
-skipped unless all metaslab groups within the metaslab class have also
-crossed this threshold.
-.sp
-Default value: \fB95\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_mg_noalloc_threshold\fR (int)
-.ad
-.RS 12n
-Defines a threshold at which metaslab groups should be eligible for
-allocations. The value is expressed as a percentage of free space
-beyond which a metaslab group is always eligible for allocations.
-If a metaslab group's free space is less than or equal to the
-threshold, the allocator will avoid allocating to that group
-unless all groups in the pool have reached the threshold. Once all
-groups have reached the threshold, all groups are allowed to accept
-allocations. The default value of 0 disables the feature and causes
-all metaslab groups to be eligible for allocations.
-
-This parameter allows one to deal with pools having heavily imbalanced
-vdevs such as would be the case when a new vdev has been added.
-Setting the threshold to a non-zero percentage will stop allocations
-from being made to vdevs that aren't filled to the specified percentage
-and allow lesser filled vdevs to acquire more allocations than they
-otherwise would under the old \fBzfs_mg_alloc_failures\fR facility.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_ddt_data_is_special\fR (int)
-.ad
-.RS 12n
-If enabled, ZFS will place DDT data into the special allocation class.
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_user_indirect_is_special\fR (int)
-.ad
-.RS 12n
-If enabled, ZFS will place user data (both file and zvol) indirect blocks
-into the special allocation class.
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_multihost_history\fR (int)
-.ad
-.RS 12n
-Historical statistics for the last N multihost updates will be available in
-\fB/proc/spl/kstat/zfs/<pool>/multihost\fR
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_multihost_interval\fR (ulong)
-.ad
-.RS 12n
-Used to control the frequency of multihost writes which are performed when the
-\fBmultihost\fR pool property is on. This is one factor used to determine the
-length of the activity check during import.
-.sp
-The multihost write period is \fBzfs_multihost_interval / leaf-vdevs\fR
-milliseconds. On average a multihost write will be issued for each leaf vdev
-every \fBzfs_multihost_interval\fR milliseconds. In practice, the observed
-period can vary with the I/O load and this observed value is the delay which is
-stored in the uberblock.
-.sp
-Default value: \fB1000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_multihost_import_intervals\fR (uint)
-.ad
-.RS 12n
-Used to control the duration of the activity test on import. Smaller values of
-\fBzfs_multihost_import_intervals\fR will reduce the import time but increase
-the risk of failing to detect an active pool. The total activity check time is
-never allowed to drop below one second.
-.sp
-On import the activity check waits a minimum amount of time determined by
-\fBzfs_multihost_interval * zfs_multihost_import_intervals\fR, or the same
-product computed on the host which last had the pool imported (whichever is
-greater). The activity check time may be further extended if the value of mmp
-delay found in the best uberblock indicates actual multihost updates happened
-at longer intervals than \fBzfs_multihost_interval\fR. A minimum value of
-\fB100ms\fR is enforced.
-.sp
-A value of 0 is ignored and treated as if it was set to 1.
-.sp
-Default value: \fB20\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_multihost_fail_intervals\fR (uint)
-.ad
-.RS 12n
-Controls the behavior of the pool when multihost write failures or delays are
-detected.
-.sp
-When \fBzfs_multihost_fail_intervals = 0\fR, multihost write failures or delays
-are ignored. The failures will still be reported to the ZED which depending on
-its configuration may take action such as suspending the pool or offlining a
-device.
-
-.sp
-When \fBzfs_multihost_fail_intervals > 0\fR, the pool will be suspended if
-\fBzfs_multihost_fail_intervals * zfs_multihost_interval\fR milliseconds pass
-without a successful mmp write. This guarantees the activity test will see
-mmp writes if the pool is imported. A value of 1 is ignored and treated as
-if it was set to 2. This is necessary to prevent the pool from being suspended
-due to normal, small I/O latency variations.
-
-.sp
-Default value: \fB10\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_no_scrub_io\fR (int)
-.ad
-.RS 12n
-Set for no scrub I/O. This results in scrubs not actually scrubbing data and
-simply doing a metadata crawl of the pool instead.
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_no_scrub_prefetch\fR (int)
-.ad
-.RS 12n
-Set to disable block prefetching for scrubs.
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_nocacheflush\fR (int)
-.ad
-.RS 12n
-Disable cache flush operations on disks when writing. Setting this will
-cause pool corruption on power loss if a volatile out-of-order write cache
-is enabled.
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_nopwrite_enabled\fR (int)
-.ad
-.RS 12n
-Enable NOP writes
-.sp
-Use \fB1\fR for yes (default) and \fB0\fR to disable.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_dmu_offset_next_sync\fR (int)
-.ad
-.RS 12n
-Enable forcing txg sync to find holes. When enabled forces ZFS to act
-like prior versions when SEEK_HOLE or SEEK_DATA flags are used, which
-when a dnode is dirty causes txg's to be synced so that this data can be
-found.
-.sp
-Use \fB1\fR for yes and \fB0\fR to disable (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_pd_bytes_max\fR (int)
-.ad
-.RS 12n
-The number of bytes which should be prefetched during a pool traversal
-(eg: \fBzfs send\fR or other data crawling operations)
-.sp
-Default value: \fB52,428,800\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_traverse_indirect_prefetch_limit\fR (int)
-.ad
-.RS 12n
-The number of blocks pointed by indirect (non-L0) block, which should be
-prefetched during a pool traversal (eg: \fBzfs send\fR or other data
-crawling operations)
-.sp
-Default value: \fB32\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_per_txg_dirty_frees_percent \fR (ulong)
-.ad
-.RS 12n
-Tunable to control percentage of dirtied indirect blocks from frees allowed
-into one TXG. After this threshold is crossed, additional frees will wait until
-the next TXG.
-A value of zero will disable this throttle.
-.sp
-Default value: \fB5\fR, set to \fB0\fR to disable.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_prefetch_disable\fR (int)
-.ad
-.RS 12n
-This tunable disables predictive prefetch. Note that it leaves "prescient"
-prefetch (e.g. prefetch for zfs send) intact. Unlike predictive prefetch,
-prescient prefetch never issues i/os that end up not being needed, so it
-can't hurt performance.
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_qat_checksum_disable\fR (int)
-.ad
-.RS 12n
-This tunable disables qat hardware acceleration for sha256 checksums. It
-may be set after the zfs modules have been loaded to initialize the qat
-hardware as long as support is compiled in and the qat driver is present.
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_qat_compress_disable\fR (int)
-.ad
-.RS 12n
-This tunable disables qat hardware acceleration for gzip compression. It
-may be set after the zfs modules have been loaded to initialize the qat
-hardware as long as support is compiled in and the qat driver is present.
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_qat_encrypt_disable\fR (int)
-.ad
-.RS 12n
-This tunable disables qat hardware acceleration for AES-GCM encryption. It
-may be set after the zfs modules have been loaded to initialize the qat
-hardware as long as support is compiled in and the qat driver is present.
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_read_chunk_size\fR (long)
-.ad
-.RS 12n
-Bytes to read per chunk
-.sp
-Default value: \fB1,048,576\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_read_history\fR (int)
-.ad
-.RS 12n
-Historical statistics for the last N reads will be available in
-\fB/proc/spl/kstat/zfs/<pool>/reads\fR
-.sp
-Default value: \fB0\fR (no data is kept).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_read_history_hits\fR (int)
-.ad
-.RS 12n
-Include cache hits in read history
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_rebuild_max_segment\fR (ulong)
-.ad
-.RS 12n
-Maximum read segment size to issue when sequentially resilvering a
-top-level vdev.
-.sp
-Default value: \fB1,048,576\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_rebuild_scrub_enabled\fR (int)
-.ad
-.RS 12n
-Automatically start a pool scrub when the last active sequential resilver
-completes in order to verify the checksums of all blocks which have been
-resilvered. This option is enabled by default and is strongly recommended.
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_rebuild_vdev_limit\fR (ulong)
-.ad
-.RS 12n
-Maximum amount of i/o that can be concurrently issued for a sequential
-resilver per leaf device, given in bytes.
-.sp
-Default value: \fB33,554,432\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_reconstruct_indirect_combinations_max\fR (int)
-.ad
-.RS 12na
-If an indirect split block contains more than this many possible unique
-combinations when being reconstructed, consider it too computationally
-expensive to check them all. Instead, try at most
-\fBzfs_reconstruct_indirect_combinations_max\fR randomly-selected
-combinations each time the block is accessed. This allows all segment
-copies to participate fairly in the reconstruction when all combinations
-cannot be checked and prevents repeated use of one bad copy.
-.sp
-Default value: \fB4096\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_recover\fR (int)
-.ad
-.RS 12n
-Set to attempt to recover from fatal errors. This should only be used as a
-last resort, as it typically results in leaked space, or worse.
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_removal_ignore_errors\fR (int)
-.ad
-.RS 12n
-.sp
-Ignore hard IO errors during device removal. When set, if a device encounters
-a hard IO error during the removal process the removal will not be cancelled.
-This can result in a normally recoverable block becoming permanently damaged
-and is not recommended. This should only be used as a last resort when the
-pool cannot be returned to a healthy state prior to removing the device.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_removal_suspend_progress\fR (int)
-.ad
-.RS 12n
-.sp
-This is used by the test suite so that it can ensure that certain actions
-happen while in the middle of a removal.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_remove_max_segment\fR (int)
-.ad
-.RS 12n
-.sp
-The largest contiguous segment that we will attempt to allocate when removing
-a device. This can be no larger than 16MB. If there is a performance
-problem with attempting to allocate large blocks, consider decreasing this.
-.sp
-Default value: \fB16,777,216\fR (16MB).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_resilver_disable_defer\fR (int)
-.ad
-.RS 12n
-Disables the \fBresilver_defer\fR feature, causing an operation that would
-start a resilver to restart one in progress immediately.
-.sp
-Default value: \fB0\fR (feature enabled).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_resilver_min_time_ms\fR (int)
-.ad
-.RS 12n
-Resilvers are processed by the sync thread. While resilvering it will spend
-at least this much time working on a resilver between txg flushes.
-.sp
-Default value: \fB3,000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_scan_ignore_errors\fR (int)
-.ad
-.RS 12n
-If set to a nonzero value, remove the DTL (dirty time list) upon
-completion of a pool scan (scrub) even if there were unrepairable
-errors. It is intended to be used during pool repair or recovery to
-stop resilvering when the pool is next imported.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_scrub_min_time_ms\fR (int)
-.ad
-.RS 12n
-Scrubs are processed by the sync thread. While scrubbing it will spend
-at least this much time working on a scrub between txg flushes.
-.sp
-Default value: \fB1,000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_scan_checkpoint_intval\fR (int)
-.ad
-.RS 12n
-To preserve progress across reboots the sequential scan algorithm periodically
-needs to stop metadata scanning and issue all the verifications I/Os to disk.
-The frequency of this flushing is determined by the
-\fBzfs_scan_checkpoint_intval\fR tunable.
-.sp
-Default value: \fB7200\fR seconds (every 2 hours).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_scan_fill_weight\fR (int)
-.ad
-.RS 12n
-This tunable affects how scrub and resilver I/O segments are ordered. A higher
-number indicates that we care more about how filled in a segment is, while a
-lower number indicates we care more about the size of the extent without
-considering the gaps within a segment. This value is only tunable upon module
-insertion. Changing the value afterwards will have no affect on scrub or
-resilver performance.
-.sp
-Default value: \fB3\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_scan_issue_strategy\fR (int)
-.ad
-.RS 12n
-Determines the order that data will be verified while scrubbing or resilvering.
-If set to \fB1\fR, data will be verified as sequentially as possible, given the
-amount of memory reserved for scrubbing (see \fBzfs_scan_mem_lim_fact\fR). This
-may improve scrub performance if the pool's data is very fragmented. If set to
-\fB2\fR, the largest mostly-contiguous chunk of found data will be verified
-first. By deferring scrubbing of small segments, we may later find adjacent data
-to coalesce and increase the segment size. If set to \fB0\fR, zfs will use
-strategy \fB1\fR during normal verification and strategy \fB2\fR while taking a
-checkpoint.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_scan_legacy\fR (int)
-.ad
-.RS 12n
-A value of 0 indicates that scrubs and resilvers will gather metadata in
-memory before issuing sequential I/O. A value of 1 indicates that the legacy
-algorithm will be used where I/O is initiated as soon as it is discovered.
-Changing this value to 0 will not affect scrubs or resilvers that are already
-in progress.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_scan_max_ext_gap\fR (int)
-.ad
-.RS 12n
-Indicates the largest gap in bytes between scrub / resilver I/Os that will still
-be considered sequential for sorting purposes. Changing this value will not
-affect scrubs or resilvers that are already in progress.
-.sp
-Default value: \fB2097152 (2 MB)\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_scan_mem_lim_fact\fR (int)
-.ad
-.RS 12n
-Maximum fraction of RAM used for I/O sorting by sequential scan algorithm.
-This tunable determines the hard limit for I/O sorting memory usage.
-When the hard limit is reached we stop scanning metadata and start issuing
-data verification I/O. This is done until we get below the soft limit.
-.sp
-Default value: \fB20\fR which is 5% of RAM (1/20).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_scan_mem_lim_soft_fact\fR (int)
-.ad
-.RS 12n
-The fraction of the hard limit used to determined the soft limit for I/O sorting
-by the sequential scan algorithm. When we cross this limit from below no action
-is taken. When we cross this limit from above it is because we are issuing
-verification I/O. In this case (unless the metadata scan is done) we stop
-issuing verification I/O and start scanning metadata again until we get to the
-hard limit.
-.sp
-Default value: \fB20\fR which is 5% of the hard limit (1/20).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_scan_strict_mem_lim\fR (int)
-.ad
-.RS 12n
-Enforces tight memory limits on pool scans when a sequential scan is in
-progress. When disabled the memory limit may be exceeded by fast disks.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_scan_suspend_progress\fR (int)
-.ad
-.RS 12n
-Freezes a scrub/resilver in progress without actually pausing it. Intended for
-testing/debugging.
-.sp
-Default value: \fB0\fR.
-.RE
-
-
-.sp
-.ne 2
-.na
-\fBzfs_scan_vdev_limit\fR (int)
-.ad
-.RS 12n
-Maximum amount of data that can be concurrently issued at once for scrubs and
-resilvers per leaf device, given in bytes.
-.sp
-Default value: \fB41943040\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_send_corrupt_data\fR (int)
-.ad
-.RS 12n
-Allow sending of corrupt data (ignore read/checksum errors when sending data)
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_send_unmodified_spill_blocks\fR (int)
-.ad
-.RS 12n
-Include unmodified spill blocks in the send stream. Under certain circumstances
-previous versions of ZFS could incorrectly remove the spill block from an
-existing object. Including unmodified copies of the spill blocks creates a
-backwards compatible stream which will recreate a spill block if it was
-incorrectly removed.
-.sp
-Use \fB1\fR for yes (default) and \fB0\fR for no.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_send_no_prefetch_queue_ff\fR (int)
-.ad
-.RS 12n
-The fill fraction of the \fBzfs send\fR internal queues. The fill fraction
-controls the timing with which internal threads are woken up.
-.sp
-Default value: \fB20\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_send_no_prefetch_queue_length\fR (int)
-.ad
-.RS 12n
-The maximum number of bytes allowed in \fBzfs send\fR's internal queues.
-.sp
-Default value: \fB1,048,576\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_send_queue_ff\fR (int)
-.ad
-.RS 12n
-The fill fraction of the \fBzfs send\fR prefetch queue. The fill fraction
-controls the timing with which internal threads are woken up.
-.sp
-Default value: \fB20\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_send_queue_length\fR (int)
-.ad
-.RS 12n
-The maximum number of bytes allowed that will be prefetched by \fBzfs send\fR.
-This value must be at least twice the maximum block size in use.
-.sp
-Default value: \fB16,777,216\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_recv_queue_ff\fR (int)
-.ad
-.RS 12n
-The fill fraction of the \fBzfs receive\fR queue. The fill fraction
-controls the timing with which internal threads are woken up.
-.sp
-Default value: \fB20\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_recv_queue_length\fR (int)
-.ad
-.RS 12n
-The maximum number of bytes allowed in the \fBzfs receive\fR queue. This value
-must be at least twice the maximum block size in use.
-.sp
-Default value: \fB16,777,216\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_recv_write_batch_size\fR (int)
-.ad
-.RS 12n
-The maximum amount of data (in bytes) that \fBzfs receive\fR will write in
-one DMU transaction. This is the uncompressed size, even when receiving a
-compressed send stream. This setting will not reduce the write size below
-a single block. Capped at a maximum of 32MB
-.sp
-Default value: \fB1MB\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_override_estimate_recordsize\fR (ulong)
-.ad
-.RS 12n
-Setting this variable overrides the default logic for estimating block
-sizes when doing a zfs send. The default heuristic is that the average
-block size will be the current recordsize. Override this value if most data
-in your dataset is not of that size and you require accurate zfs send size
-estimates.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_sync_pass_deferred_free\fR (int)
-.ad
-.RS 12n
-Flushing of data to disk is done in passes. Defer frees starting in this pass
-.sp
-Default value: \fB2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_spa_discard_memory_limit\fR (int)
-.ad
-.RS 12n
-Maximum memory used for prefetching a checkpoint's space map on each
-vdev while discarding the checkpoint.
-.sp
-Default value: \fB16,777,216\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_special_class_metadata_reserve_pct\fR (int)
-.ad
-.RS 12n
-Only allow small data blocks to be allocated on the special and dedup vdev
-types when the available free space percentage on these vdevs exceeds this
-value. This ensures reserved space is available for pool meta data as the
-special vdevs approach capacity.
-.sp
-Default value: \fB25\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_sync_pass_dont_compress\fR (int)
-.ad
-.RS 12n
-Starting in this sync pass, we disable compression (including of metadata).
-With the default setting, in practice, we don't have this many sync passes,
-so this has no effect.
-.sp
-The original intent was that disabling compression would help the sync passes
-to converge. However, in practice disabling compression increases the average
-number of sync passes, because when we turn compression off, a lot of block's
-size will change and thus we have to re-allocate (not overwrite) them. It
-also increases the number of 128KB allocations (e.g. for indirect blocks and
-spacemaps) because these will not be compressed. The 128K allocations are
-especially detrimental to performance on highly fragmented systems, which may
-have very few free segments of this size, and may need to load new metaslabs
-to satisfy 128K allocations.
-.sp
-Default value: \fB8\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_sync_pass_rewrite\fR (int)
-.ad
-.RS 12n
-Rewrite new block pointers starting in this pass
-.sp
-Default value: \fB2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_sync_taskq_batch_pct\fR (int)
-.ad
-.RS 12n
-This controls the number of threads used by the dp_sync_taskq. The default
-value of 75% will create a maximum of one thread per cpu.
-.sp
-Default value: \fB75\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_trim_extent_bytes_max\fR (uint)
-.ad
-.RS 12n
-Maximum size of TRIM command. Ranges larger than this will be split in to
-chunks no larger than \fBzfs_trim_extent_bytes_max\fR bytes before being
-issued to the device.
-.sp
-Default value: \fB134,217,728\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_trim_extent_bytes_min\fR (uint)
-.ad
-.RS 12n
-Minimum size of TRIM commands. TRIM ranges smaller than this will be skipped
-unless they're part of a larger range which was broken in to chunks. This is
-done because it's common for these small TRIMs to negatively impact overall
-performance. This value can be set to 0 to TRIM all unallocated space.
-.sp
-Default value: \fB32,768\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_trim_metaslab_skip\fR (uint)
-.ad
-.RS 12n
-Skip uninitialized metaslabs during the TRIM process. This option is useful
-for pools constructed from large thinly-provisioned devices where TRIM
-operations are slow. As a pool ages an increasing fraction of the pools
-metaslabs will be initialized progressively degrading the usefulness of
-this option. This setting is stored when starting a manual TRIM and will
-persist for the duration of the requested TRIM.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_trim_queue_limit\fR (uint)
-.ad
-.RS 12n
-Maximum number of queued TRIMs outstanding per leaf vdev. The number of
-concurrent TRIM commands issued to the device is controlled by the
-\fBzfs_vdev_trim_min_active\fR and \fBzfs_vdev_trim_max_active\fR module
-options.
-.sp
-Default value: \fB10\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_trim_txg_batch\fR (uint)
-.ad
-.RS 12n
-The number of transaction groups worth of frees which should be aggregated
-before TRIM operations are issued to the device. This setting represents a
-trade-off between issuing larger, more efficient TRIM operations and the
-delay before the recently trimmed space is available for use by the device.
-.sp
-Increasing this value will allow frees to be aggregated for a longer time.
-This will result is larger TRIM operations and potentially increased memory
-usage. Decreasing this value will have the opposite effect. The default
-value of 32 was determined to be a reasonable compromise.
-.sp
-Default value: \fB32\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_txg_history\fR (int)
-.ad
-.RS 12n
-Historical statistics for the last N txgs will be available in
-\fB/proc/spl/kstat/zfs/<pool>/txgs\fR
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_txg_timeout\fR (int)
-.ad
-.RS 12n
-Flush dirty data to disk at least every N seconds (maximum txg duration)
-.sp
-Default value: \fB5\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_aggregate_trim\fR (int)
-.ad
-.RS 12n
-Allow TRIM I/Os to be aggregated. This is normally not helpful because
-the extents to be trimmed will have been already been aggregated by the
-metaslab. This option is provided for debugging and performance analysis.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_aggregation_limit\fR (int)
-.ad
-.RS 12n
-Max vdev I/O aggregation size
-.sp
-Default value: \fB1,048,576\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_aggregation_limit_non_rotating\fR (int)
-.ad
-.RS 12n
-Max vdev I/O aggregation size for non-rotating media
-.sp
-Default value: \fB131,072\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_cache_bshift\fR (int)
-.ad
-.RS 12n
-Shift size to inflate reads too
-.sp
-Default value: \fB16\fR (effectively 65536).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_cache_max\fR (int)
-.ad
-.RS 12n
-Inflate reads smaller than this value to meet the \fBzfs_vdev_cache_bshift\fR
-size (default 64k).
-.sp
-Default value: \fB16384\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_cache_size\fR (int)
-.ad
-.RS 12n
-Total size of the per-disk cache in bytes.
-.sp
-Currently this feature is disabled as it has been found to not be helpful
-for performance and in some cases harmful.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_mirror_rotating_inc\fR (int)
-.ad
-.RS 12n
-A number by which the balancing algorithm increments the load calculation for
-the purpose of selecting the least busy mirror member when an I/O immediately
-follows its predecessor on rotational vdevs for the purpose of making decisions
-based on load.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_mirror_rotating_seek_inc\fR (int)
-.ad
-.RS 12n
-A number by which the balancing algorithm increments the load calculation for
-the purpose of selecting the least busy mirror member when an I/O lacks
-locality as defined by the zfs_vdev_mirror_rotating_seek_offset. I/Os within
-this that are not immediately following the previous I/O are incremented by
-half.
-.sp
-Default value: \fB5\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_mirror_rotating_seek_offset\fR (int)
-.ad
-.RS 12n
-The maximum distance for the last queued I/O in which the balancing algorithm
-considers an I/O to have locality.
-See the section "ZFS I/O SCHEDULER".
-.sp
-Default value: \fB1048576\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_mirror_non_rotating_inc\fR (int)
-.ad
-.RS 12n
-A number by which the balancing algorithm increments the load calculation for
-the purpose of selecting the least busy mirror member on non-rotational vdevs
-when I/Os do not immediately follow one another.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_mirror_non_rotating_seek_inc\fR (int)
-.ad
-.RS 12n
-A number by which the balancing algorithm increments the load calculation for
-the purpose of selecting the least busy mirror member when an I/O lacks
-locality as defined by the zfs_vdev_mirror_rotating_seek_offset. I/Os within
-this that are not immediately following the previous I/O are incremented by
-half.
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_read_gap_limit\fR (int)
-.ad
-.RS 12n
-Aggregate read I/O operations if the gap on-disk between them is within this
-threshold.
-.sp
-Default value: \fB32,768\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_write_gap_limit\fR (int)
-.ad
-.RS 12n
-Aggregate write I/O over gap
-.sp
-Default value: \fB4,096\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_raidz_impl\fR (string)
-.ad
-.RS 12n
-Parameter for selecting raidz parity implementation to use.
-
-Options marked (always) below may be selected on module load as they are
-supported on all systems.
-The remaining options may only be set after the module is loaded, as they
-are available only if the implementations are compiled in and supported
-on the running system.
-
-Once the module is loaded, the content of
-/sys/module/zfs/parameters/zfs_vdev_raidz_impl will show available options
-with the currently selected one enclosed in [].
-Possible options are:
- fastest - (always) implementation selected using built-in benchmark
- original - (always) original raidz implementation
- scalar - (always) scalar raidz implementation
- sse2 - implementation using SSE2 instruction set (64bit x86 only)
- ssse3 - implementation using SSSE3 instruction set (64bit x86 only)
- avx2 - implementation using AVX2 instruction set (64bit x86 only)
- avx512f - implementation using AVX512F instruction set (64bit x86 only)
- avx512bw - implementation using AVX512F & AVX512BW instruction sets (64bit x86 only)
- aarch64_neon - implementation using NEON (Aarch64/64 bit ARMv8 only)
- aarch64_neonx2 - implementation using NEON with more unrolling (Aarch64/64 bit ARMv8 only)
- powerpc_altivec - implementation using Altivec (PowerPC only)
-.sp
-Default value: \fBfastest\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_vdev_scheduler\fR (charp)
-.ad
-.RS 12n
-\fBDEPRECATED\fR: This option exists for compatibility with older user
-configurations. It does nothing except print a warning to the kernel log if
-set.
-.sp
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_zevent_len_max\fR (int)
-.ad
-.RS 12n
-Max event queue length.
-Events in the queue can be viewed with the \fBzpool events\fR command.
-.sp
-Default value: \fB512\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_zevent_retain_max\fR (int)
-.ad
-.RS 12n
-Maximum recent zevent records to retain for duplicate checking. Setting
-this value to zero disables duplicate detection.
-.sp
-Default value: \fB2000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_zevent_retain_expire_secs\fR (int)
-.ad
-.RS 12n
-Lifespan for a recent ereport that was retained for duplicate checking.
-.sp
-Default value: \fB900\fR.
-.RE
-
-.na
-\fBzfs_zil_clean_taskq_maxalloc\fR (int)
-.ad
-.RS 12n
-The maximum number of taskq entries that are allowed to be cached. When this
-limit is exceeded transaction records (itxs) will be cleaned synchronously.
-.sp
-Default value: \fB1048576\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_zil_clean_taskq_minalloc\fR (int)
-.ad
-.RS 12n
-The number of taskq entries that are pre-populated when the taskq is first
-created and are immediately available for use.
-.sp
-Default value: \fB1024\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_zil_clean_taskq_nthr_pct\fR (int)
-.ad
-.RS 12n
-This controls the number of threads used by the dp_zil_clean_taskq. The default
-value of 100% will create a maximum of one thread per cpu.
-.sp
-Default value: \fB100\fR%.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzil_maxblocksize\fR (int)
-.ad
-.RS 12n
-This sets the maximum block size used by the ZIL. On very fragmented pools,
-lowering this (typically to 36KB) can improve performance.
-.sp
-Default value: \fB131072\fR (128KB).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzil_nocacheflush\fR (int)
-.ad
-.RS 12n
-Disable the cache flush commands that are normally sent to the disk(s) by
-the ZIL after an LWB write has completed. Setting this will cause ZIL
-corruption on power loss if a volatile out-of-order write cache is enabled.
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzil_replay_disable\fR (int)
-.ad
-.RS 12n
-Disable intent logging replay. Can be disabled for recovery from corrupted
-ZIL
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzil_slog_bulk\fR (ulong)
-.ad
-.RS 12n
-Limit SLOG write size per commit executed with synchronous priority.
-Any writes above that will be executed with lower (asynchronous) priority
-to limit potential SLOG device abuse by single active ZIL writer.
-.sp
-Default value: \fB786,432\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzfs_embedded_slog_min_ms\fR (int)
-.ad
-.RS 12n
-Usually, one metaslab from each (normal-class) vdev is dedicated for use by
-the ZIL (to log synchronous writes).
-However, if there are fewer than zfs_embedded_slog_min_ms metaslabs in the
-vdev, this functionality is disabled.
-This ensures that we don't set aside an unreasonable amount of space for the
-ZIL.
-.sp
-Default value: \fB64\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_deadman_log_all\fR (int)
-.ad
-.RS 12n
-If non-zero, the zio deadman will produce debugging messages (see
-\fBzfs_dbgmsg_enable\fR) for all zios, rather than only for leaf
-zios possessing a vdev. This is meant to be used by developers to gain
-diagnostic information for hang conditions which don't involve a mutex
-or other locking primitive; typically conditions in which a thread in
-the zio pipeline is looping indefinitely.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_decompress_fail_fraction\fR (int)
-.ad
-.RS 12n
-If non-zero, this value represents the denominator of the probability that zfs
-should induce a decompression failure. For instance, for a 5% decompression
-failure rate, this value should be set to 20.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_slow_io_ms\fR (int)
-.ad
-.RS 12n
-When an I/O operation takes more than \fBzio_slow_io_ms\fR milliseconds to
-complete is marked as a slow I/O. Each slow I/O causes a delay zevent. Slow
-I/O counters can be seen with "zpool status -s".
-
-.sp
-Default value: \fB30,000\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_dva_throttle_enabled\fR (int)
-.ad
-.RS 12n
-Throttle block allocations in the I/O pipeline. This allows for
-dynamic allocation distribution when devices are imbalanced.
-When enabled, the maximum number of pending allocations per top-level vdev
-is limited by \fBzfs_vdev_queue_depth_pct\fR.
-.sp
-Default value: \fB1\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_requeue_io_start_cut_in_line\fR (int)
-.ad
-.RS 12n
-Prioritize requeued I/O
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_taskq_batch_pct\fR (uint)
-.ad
-.RS 12n
-Percentage of online CPUs (or CPU cores, etc) which will run a worker thread
-for I/O. These workers are responsible for I/O work such as compression and
-checksum calculations. Fractional number of CPUs will be rounded down.
-.sp
-The default value of 80 was chosen to avoid using all CPUs which can result in
-latency issues and inconsistent application performance, especially when slower
-compression and/or checksumming is enabled.
-.sp
-Default value: \fB80\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzio_taskq_batch_tpq\fR (uint)
-.ad
-.RS 12n
-Number of worker threads per taskq. Lower value improves I/O ordering and
-CPU utilization, while higher reduces lock contention.
-.sp
-By default about 6 worker threads per taskq, depending on system size.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzvol_inhibit_dev\fR (uint)
-.ad
-.RS 12n
-Do not create zvol device nodes. This may slightly improve startup time on
-systems with a very large number of zvols.
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
-.sp
-.ne 2
-.na
-\fBzvol_major\fR (uint)
-.ad
-.RS 12n
-Major number for zvol block devices
-.sp
-Default value: \fB230\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzvol_max_discard_blocks\fR (ulong)
-.ad
-.RS 12n
-Discard (aka TRIM) operations done on zvols will be done in batches of this
-many blocks, where block size is determined by the \fBvolblocksize\fR property
-of a zvol.
-.sp
-Default value: \fB16,384\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzvol_prefetch_bytes\fR (uint)
-.ad
-.RS 12n
-When adding a zvol to the system prefetch \fBzvol_prefetch_bytes\fR
-from the start and end of the volume. Prefetching these regions
-of the volume is desirable because they are likely to be accessed
-immediately by \fBblkid(8)\fR or by the kernel scanning for a partition
-table.
-.sp
-Default value: \fB131,072\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzvol_request_sync\fR (uint)
-.ad
-.RS 12n
-When processing I/O requests for a zvol submit them synchronously. This
-effectively limits the queue depth to 1 for each I/O submitter. When set
-to 0 requests are handled asynchronously by a thread pool. The number of
-requests which can be handled concurrently is controller by \fBzvol_threads\fR.
-.sp
-Default value: \fB0\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzvol_threads\fR (uint)
-.ad
-.RS 12n
-Max number of threads which can handle zvol I/O requests concurrently.
-.sp
-Default value: \fB32\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzvol_volmode\fR (uint)
-.ad
-.RS 12n
-Defines zvol block devices behaviour when \fBvolmode\fR is set to \fBdefault\fR.
-Valid values are \fB1\fR (full), \fB2\fR (dev) and \fB3\fR (none).
-.sp
-Default value: \fB1\fR.
-.RE
-
-.SH ZFS I/O SCHEDULER
-ZFS issues I/O operations to leaf vdevs to satisfy and complete I/Os.
-The I/O scheduler determines when and in what order those operations are
-issued. The I/O scheduler divides operations into five I/O classes
-prioritized in the following order: sync read, sync write, async read,
-async write, and scrub/resilver. Each queue defines the minimum and
-maximum number of concurrent operations that may be issued to the
-device. In addition, the device has an aggregate maximum,
-\fBzfs_vdev_max_active\fR. Note that the sum of the per-queue minimums
-must not exceed the aggregate maximum. If the sum of the per-queue
-maximums exceeds the aggregate maximum, then the number of active I/Os
-may reach \fBzfs_vdev_max_active\fR, in which case no further I/Os will
-be issued regardless of whether all per-queue minimums have been met.
-.sp
-For many physical devices, throughput increases with the number of
-concurrent operations, but latency typically suffers. Further, physical
-devices typically have a limit at which more concurrent operations have no
-effect on throughput or can actually cause it to decrease.
-.sp
-The scheduler selects the next operation to issue by first looking for an
-I/O class whose minimum has not been satisfied. Once all are satisfied and
-the aggregate maximum has not been hit, the scheduler looks for classes
-whose maximum has not been satisfied. Iteration through the I/O classes is
-done in the order specified above. No further operations are issued if the
-aggregate maximum number of concurrent operations has been hit or if there
-are no operations queued for an I/O class that has not hit its maximum.
-Every time an I/O is queued or an operation completes, the I/O scheduler
-looks for new operations to issue.
-.sp
-In general, smaller max_active's will lead to lower latency of synchronous
-operations. Larger max_active's may lead to higher overall throughput,
-depending on underlying storage.
-.sp
-The ratio of the queues' max_actives determines the balance of performance
-between reads, writes, and scrubs. E.g., increasing
-\fBzfs_vdev_scrub_max_active\fR will cause the scrub or resilver to complete
-more quickly, but reads and writes to have higher latency and lower throughput.
-.sp
-All I/O classes have a fixed maximum number of outstanding operations
-except for the async write class. Asynchronous writes represent the data
-that is committed to stable storage during the syncing stage for
-transaction groups. Transaction groups enter the syncing state
-periodically so the number of queued async writes will quickly burst up
-and then bleed down to zero. Rather than servicing them as quickly as
-possible, the I/O scheduler changes the maximum number of active async
-write I/Os according to the amount of dirty data in the pool. Since
-both throughput and latency typically increase with the number of
-concurrent operations issued to physical devices, reducing the
-burstiness in the number of concurrent operations also stabilizes the
-response time of operations from other -- and in particular synchronous
--- queues. In broad strokes, the I/O scheduler will issue more
-concurrent operations from the async write queue as there's more dirty
-data in the pool.
-.sp
-Async Writes
-.sp
-The number of concurrent operations issued for the async write I/O class
-follows a piece-wise linear function defined by a few adjustable points.
-.nf
-
- | o---------| <-- zfs_vdev_async_write_max_active
- ^ | /^ |
- | | / | |
-active | / | |
- I/O | / | |
-count | / | |
- | / | |
- |-------o | | <-- zfs_vdev_async_write_min_active
- 0|_______^______|_________|
- 0% | | 100% of zfs_dirty_data_max
- | |
- | `-- zfs_vdev_async_write_active_max_dirty_percent
- `--------- zfs_vdev_async_write_active_min_dirty_percent
-
-.fi
-Until the amount of dirty data exceeds a minimum percentage of the dirty
-data allowed in the pool, the I/O scheduler will limit the number of
-concurrent operations to the minimum. As that threshold is crossed, the
-number of concurrent operations issued increases linearly to the maximum at
-the specified maximum percentage of the dirty data allowed in the pool.
-.sp
-Ideally, the amount of dirty data on a busy pool will stay in the sloped
-part of the function between \fBzfs_vdev_async_write_active_min_dirty_percent\fR
-and \fBzfs_vdev_async_write_active_max_dirty_percent\fR. If it exceeds the
-maximum percentage, this indicates that the rate of incoming data is
-greater than the rate that the backend storage can handle. In this case, we
-must further throttle incoming writes, as described in the next section.
-
-.SH ZFS TRANSACTION DELAY
-We delay transactions when we've determined that the backend storage
-isn't able to accommodate the rate of incoming writes.
-.sp
-If there is already a transaction waiting, we delay relative to when
-that transaction will finish waiting. This way the calculated delay time
-is independent of the number of threads concurrently executing
-transactions.
-.sp
-If we are the only waiter, wait relative to when the transaction
-started, rather than the current time. This credits the transaction for
-"time already served", e.g. reading indirect blocks.
-.sp
-The minimum time for a transaction to take is calculated as:
-.nf
- min_time = zfs_delay_scale * (dirty - min) / (max - dirty)
- min_time is then capped at 100 milliseconds.
-.fi
-.sp
-The delay has two degrees of freedom that can be adjusted via tunables. The
-percentage of dirty data at which we start to delay is defined by
-\fBzfs_delay_min_dirty_percent\fR. This should typically be at or above
-\fBzfs_vdev_async_write_active_max_dirty_percent\fR so that we only start to
-delay after writing at full speed has failed to keep up with the incoming write
-rate. The scale of the curve is defined by \fBzfs_delay_scale\fR. Roughly speaking,
-this variable determines the amount of delay at the midpoint of the curve.
-.sp
-.nf
-delay
- 10ms +-------------------------------------------------------------*+
- | *|
- 9ms + *+
- | *|
- 8ms + *+
- | * |
- 7ms + * +
- | * |
- 6ms + * +
- | * |
- 5ms + * +
- | * |
- 4ms + * +
- | * |
- 3ms + * +
- | * |
- 2ms + (midpoint) * +
- | | ** |
- 1ms + v *** +
- | zfs_delay_scale ----------> ******** |
- 0 +-------------------------------------*********----------------+
- 0% <- zfs_dirty_data_max -> 100%
-.fi
-.sp
-Note that since the delay is added to the outstanding time remaining on the
-most recent transaction, the delay is effectively the inverse of IOPS.
-Here the midpoint of 500us translates to 2000 IOPS. The shape of the curve
-was chosen such that small changes in the amount of accumulated dirty data
-in the first 3/4 of the curve yield relatively small differences in the
-amount of delay.
-.sp
-The effects can be easier to understand when the amount of delay is
-represented on a log scale:
-.sp
-.nf
-delay
-100ms +-------------------------------------------------------------++
- + +
- | |
- + *+
- 10ms + *+
- + ** +
- | (midpoint) ** |
- + | ** +
- 1ms + v **** +
- + zfs_delay_scale ----------> ***** +
- | **** |
- + **** +
-100us + ** +
- + * +
- | * |
- + * +
- 10us + * +
- + +
- | |
- + +
- +--------------------------------------------------------------+
- 0% <- zfs_dirty_data_max -> 100%
-.fi
-.sp
-Note here that only as the amount of dirty data approaches its limit does
-the delay start to increase rapidly. The goal of a properly tuned system
-should be to keep the amount of dirty data out of that range by first
-ensuring that the appropriate limits are set for the I/O scheduler to reach
-optimal throughput on the backend storage, and then by changing the value
-of \fBzfs_delay_scale\fR to increase the steepness of the curve.
diff --git a/sys/contrib/openzfs/man/man5/zpool-features.5 b/sys/contrib/openzfs/man/man5/zpool-features.5
deleted file mode 100644
index c97870dbbe82..000000000000
--- a/sys/contrib/openzfs/man/man5/zpool-features.5
+++ /dev/null
@@ -1,1077 +0,0 @@
-'\" te
-.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
-.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
-.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
-.\" The contents of this file are subject to the terms of the Common Development
-.\" and Distribution License (the "License"). You may not use this file except
-.\" in compliance with the License. You can obtain a copy of the license at
-.\" usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
-.\"
-.\" See the License for the specific language governing permissions and
-.\" limitations under the License. When distributing Covered Code, include this
-.\" CDDL HEADER in each file and include the License file at
-.\" usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this
-.\" CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your
-.\" own identifying information:
-.\" Portions Copyright [yyyy] [name of copyright owner]
-.\" Copyright (c) 2019, Klara Inc.
-.\" Copyright (c) 2019, Allan Jude
-.\" Copyright (c) 2021, Colm Buckley <colm@tuatha.org>
-.TH ZPOOL-FEATURES 5 "Aug 24, 2020" OpenZFS
-.SH NAME
-zpool\-features \- ZFS pool feature descriptions
-.SH DESCRIPTION
-.sp
-.LP
-ZFS pool on\-disk format versions are specified via "features" which replace
-the old on\-disk format numbers (the last supported on\-disk format number is
-28). To enable a feature on a pool use the \fBupgrade\fR subcommand of the
-zpool(8) command, or set the \fBfeature@\fR\fIfeature_name\fR property
-to \fBenabled\fR. Please also see the \fB"Compatibility feature sets"\fR
-section for information on how sets of features may be enabled together.
-.sp
-.LP
-The pool format does not affect file system version compatibility or the ability
-to send file systems between pools.
-.sp
-.LP
-Since most features can be enabled independently of each other the on\-disk
-format of the pool is specified by the set of all features marked as
-\fBactive\fR on the pool. If the pool was created by another software version
-this set may include unsupported features.
-.SS "Identifying features"
-.sp
-.LP
-Every feature has a GUID of the form \fIcom.example:feature_name\fR. The
-reversed DNS name ensures that the feature's GUID is unique across all ZFS
-implementations. When unsupported features are encountered on a pool they will
-be identified by their GUIDs. Refer to the documentation for the ZFS
-implementation that created the pool for information about those features.
-.sp
-.LP
-Each supported feature also has a short name. By convention a feature's short
-name is the portion of its GUID which follows the ':' (e.g.
-\fIcom.example:feature_name\fR would have the short name \fIfeature_name\fR),
-however a feature's short name may differ across ZFS implementations if
-following the convention would result in name conflicts.
-.SS "Feature states"
-.sp
-.LP
-Features can be in one of three states:
-.sp
-.ne 2
-.na
-\fBactive\fR
-.ad
-.RS 12n
-This feature's on\-disk format changes are in effect on the pool. Support for
-this feature is required to import the pool in read\-write mode. If this
-feature is not read-only compatible, support is also required to import the pool
-in read\-only mode (see "Read\-only compatibility").
-.RE
-
-.sp
-.ne 2
-.na
-\fBenabled\fR
-.ad
-.RS 12n
-An administrator has marked this feature as enabled on the pool, but the
-feature's on\-disk format changes have not been made yet. The pool can still be
-imported by software that does not support this feature, but changes may be made
-to the on\-disk format at any time which will move the feature to the
-\fBactive\fR state. Some features may support returning to the \fBenabled\fR
-state after becoming \fBactive\fR. See feature\-specific documentation for
-details.
-.RE
-
-.sp
-.ne 2
-.na
-\fBdisabled\fR
-.ad
-.RS 12n
-This feature's on\-disk format changes have not been made and will not be made
-unless an administrator moves the feature to the \fBenabled\fR state. Features
-cannot be disabled once they have been enabled.
-.RE
-
-.sp
-.LP
-The state of supported features is exposed through pool properties of the form
-\fIfeature@short_name\fR.
-.SS "Read\-only compatibility"
-.sp
-.LP
-Some features may make on\-disk format changes that do not interfere with other
-software's ability to read from the pool. These features are referred to as
-"read\-only compatible". If all unsupported features on a pool are read\-only
-compatible, the pool can be imported in read\-only mode by setting the
-\fBreadonly\fR property during import (see zpool(8) for details on
-importing pools).
-.SS "Unsupported features"
-.sp
-.LP
-For each unsupported feature enabled on an imported pool a pool property
-named \fIunsupported@feature_name\fR will indicate why the import was allowed
-despite the unsupported feature. Possible values for this property are:
-
-.sp
-.ne 2
-.na
-\fBinactive\fR
-.ad
-.RS 12n
-The feature is in the \fBenabled\fR state and therefore the pool's on\-disk
-format is still compatible with software that does not support this feature.
-.RE
-
-.sp
-.ne 2
-.na
-\fBreadonly\fR
-.ad
-.RS 12n
-The feature is read\-only compatible and the pool has been imported in
-read\-only mode.
-.RE
-
-.SS "Feature dependencies"
-.sp
-.LP
-Some features depend on other features being enabled in order to function
-properly. Enabling a feature will automatically enable any features it
-depends on.
-
-.SS "Compatibility feature sets"
-.sp
-.LP
-It is sometimes necessary for a pool to maintain compatibility with a
-specific on\-disk format, by enabling and disabling particular features. The
-\fBcompatibility\fR feature facilitates this by allowing feature sets to
-be read from text files. When set to \fBoff\fR (the default); compatibility
-feature sets are disabled (ie: all features are enabled); when set to
-\fBlegacy\fR; no features are enabled. When set to a comma\-separated list
-of filenames (each filename may either be an absolute path, or relative to
-\fB/etc/zfs/compatibility.d\fR or \fB/usr/share/zfs/compatibility.d\fR)
-the lists of requested features are read from those files, separated by
-whitespace and/or commas. Only features present in all files are enabled.
-.LP
-Simple sanity checks are applied to the files; they must be between 1 and
-16,384 bytes in size, and must end with a newline character.
-.LP
-The requested features are applied when a pool is created using
-\fBzpool create \-o compatibility=...\fR and controls which features are
-enabled when using \fBzpool upgrade\fR. \fBzpool status\fR
-will not show a warning about disabled features which are not part
-of the requested feature set.
-.LP
-The special value \fBlegacy\fR prevents any features from being enabled,
-either via \fBzpool upgrade\fR or via \fBzpool set feature@XX=enabled\fR.
-This setting also prevents pools from being upgraded to newer on-disk
-versions. This is a safety measure to prevent new features from being
-accidentally enabled, breaking compatibility.
-.LP
-By convention, compatibility files in \fB/usr/share/zfs/compatibility.d\fR
-are provided by the distribution package, and include feature sets
-supported by important versions of popular distributions, and feature
-sets commonly supported at the start of each year. Compatibility files
-in \fB/etc/zfs/compatibility.d\fR, if present, will take precedence over
-files with the same name in \fB/usr/share/zfs/compatibility.d\fR.
-.LP
-If an unrecognized feature is found in these files, an error message will
-be shown. If the unrecognized feature is in a file in
-\fB/etc/zfs/compatibility.d\fR, this is treated as an error and processing
-will stop. If the unrecognized feature is under
-\fB/usr/share/zfs/compatibility.d\fR, this is treated as a warning and
-processing will continue. This difference is to allow distributions to
-include features which might not be recognized by the currently-installed
-binaries.
-.LP
-Compatibility files may include comments; any text from \fB#\fR to the end
-of the line is ignored.
-.LP
-\fBExample:\fR
-.EX
-# \fBcat /usr/share/zfs/compatibility.d/grub2\fR
-# Features which are supported by GRUB2
-async_destroy
-bookmarks
-embedded_data
-empty_bpobj
-enabled_txg
-extensible_dataset
-filesystem_limits
-hole_birth
-large_blocks
-lz4_compress
-spacemap_histogram
-
-# \fBzpool create \-o compatibility=grub2 bootpool vdev\fR
-.EE
-.LP
-See \fBzpool\-create(8)\fR and \fBzpool\-upgrade(8)\fR for more information
-on how these commands are affected by feature sets.
-.SH FEATURES
-.sp
-.LP
-The following features are supported on this system:
-
-.sp
-.ne 2
-.na
-\fBallocation_classes\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID org.zfsonlinux:allocation_classes
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES none
-.TE
-
-This feature enables support for separate allocation classes.
-
-This feature becomes \fBactive\fR when a dedicated allocation class vdev
-(dedup or special) is created with the \fBzpool create\fR or \fBzpool add\fR
-subcommands. With device removal, it can be returned to the \fBenabled\fR
-state if all the dedicated allocation class vdevs are removed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBasync_destroy\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:async_destroy
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES none
-.TE
-
-Destroying a file system requires traversing all of its data in order to
-return its used space to the pool. Without \fBasync_destroy\fR the file system
-is not fully removed until all space has been reclaimed. If the destroy
-operation is interrupted by a reboot or power outage the next attempt to open
-the pool will need to complete the destroy operation synchronously.
-
-When \fBasync_destroy\fR is enabled the file system's data will be reclaimed
-by a background process, allowing the destroy operation to complete without
-traversing the entire file system. The background process is able to resume
-interrupted destroys after the pool has been opened, eliminating the need
-to finish interrupted destroys as part of the open operation. The amount
-of space remaining to be reclaimed by the background process is available
-through the \fBfreeing\fR property.
-
-This feature is only \fBactive\fR while \fBfreeing\fR is non\-zero.
-.RE
-
-.sp
-.ne 2
-.na
-\fBbookmarks\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:bookmarks
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES extensible_dataset
-.TE
-
-This feature enables use of the \fBzfs bookmark\fR subcommand.
-
-This feature is \fBactive\fR while any bookmarks exist in the pool.
-All bookmarks in the pool can be listed by running
-\fBzfs list -t bookmark -r \fIpoolname\fR\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBbookmark_v2\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.datto:bookmark_v2
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES bookmark, extensible_dataset
-.TE
-
-This feature enables the creation and management of larger bookmarks which are
-needed for other features in ZFS.
-
-This feature becomes \fBactive\fR when a v2 bookmark is created and will be
-returned to the \fBenabled\fR state when all v2 bookmarks are destroyed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBbookmark_written\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:bookmark_written
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES bookmark, extensible_dataset, bookmark_v2
-.TE
-
-This feature enables additional bookmark accounting fields, enabling the
-written#<bookmark> property (space written since a bookmark) and estimates of
-send stream sizes for incrementals from bookmarks.
-
-This feature becomes \fBactive\fR when a bookmark is created and will be
-returned to the \fBenabled\fR state when all bookmarks with these fields are destroyed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBdevice_rebuild\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID org.openzfs:device_rebuild
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES none
-.TE
-
-This feature enables the ability for the \fBzpool attach\fR and \fBzpool
-replace\fR subcommands to perform sequential reconstruction (instead of
-healing reconstruction) when resilvering.
-
-Sequential reconstruction resilvers a device in LBA order without immediately
-verifying the checksums. Once complete a scrub is started which then verifies
-the checksums. This approach allows full redundancy to be restored to the pool
-in the minimum amount of time. This two phase approach will take longer than a
-healing resilver when the time to verify the checksums is included. However,
-unless there is additional pool damage no checksum errors should be reported
-by the scrub. This feature is incompatible with raidz configurations.
-
-This feature becomes \fBactive\fR while a sequential resilver is in progress,
-and returns to \fBenabled\fR when the resilver completes.
-.RE
-
-.sp
-.ne 2
-.na
-\fBdevice_removal\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:device_removal
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES none
-.TE
-
-This feature enables the \fBzpool remove\fR subcommand to remove top-level
-vdevs, evacuating them to reduce the total size of the pool.
-
-This feature becomes \fBactive\fR when the \fBzpool remove\fR subcommand is used
-on a top-level vdev, and will never return to being \fBenabled\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBdraid\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID org.openzfs:draid
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES none
-.TE
-
-This feature enables use of the \fBdraid\fR vdev type. dRAID is a variant
-of raidz which provides integrated distributed hot spares that allow faster
-resilvering while retaining the benefits of raidz. Data, parity, and spare
-space are organized in redundancy groups and distributed evenly over all of
-the devices.
-
-This feature becomes \fBactive\fR when creating a pool which uses the
-\fBdraid\fR vdev type, or when adding a new \fBdraid\fR vdev to an
-existing pool.
-.RE
-
-.sp
-.ne 2
-.na
-\fBedonr\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID org.illumos:edonr
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES extensible_dataset
-.TE
-
-This feature enables the use of the Edon-R hash algorithm for checksum,
-including for nopwrite (if compression is also enabled, an overwrite of
-a block whose checksum matches the data being written will be ignored).
-In an abundance of caution, Edon-R requires verification when used with
-dedup: \fBzfs set dedup=edonr,verify\fR. See \fBzfs\fR(8).
-
-Edon-R is a very high-performance hash algorithm that was part
-of the NIST SHA-3 competition. It provides extremely high hash
-performance (over 350% faster than SHA-256), but was not selected
-because of its unsuitability as a general purpose secure hash algorithm.
-This implementation utilizes the new salted checksumming functionality
-in ZFS, which means that the checksum is pre-seeded with a secret
-256-bit random key (stored on the pool) before being fed the data block
-to be checksummed. Thus the produced checksums are unique to a given
-pool.
-
-When the \fBedonr\fR feature is set to \fBenabled\fR, the administrator
-can turn on the \fBedonr\fR checksum on any dataset using the
-\fBzfs set checksum=edonr\fR. See zfs(8). This feature becomes
-\fBactive\fR once a \fBchecksum\fR property has been set to \fBedonr\fR,
-and will return to being \fBenabled\fR once all filesystems that have
-ever had their checksum set to \fBedonr\fR are destroyed.
-
-FreeBSD does not support the \fBedonr\fR feature.
-.RE
-
-.sp
-.ne 2
-.na
-\fBembedded_data\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:embedded_data
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES none
-.TE
-
-This feature improves the performance and compression ratio of
-highly-compressible blocks. Blocks whose contents can compress to 112 bytes
-or smaller can take advantage of this feature.
-
-When this feature is enabled, the contents of highly-compressible blocks are
-stored in the block "pointer" itself (a misnomer in this case, as it contains
-the compressed data, rather than a pointer to its location on disk). Thus
-the space of the block (one sector, typically 512 bytes or 4KB) is saved,
-and no additional i/o is needed to read and write the data block.
-
-This feature becomes \fBactive\fR as soon as it is enabled and will
-never return to being \fBenabled\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBempty_bpobj\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:empty_bpobj
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES none
-.TE
-
-This feature increases the performance of creating and using a large
-number of snapshots of a single filesystem or volume, and also reduces
-the disk space required.
-
-When there are many snapshots, each snapshot uses many Block Pointer
-Objects (bpobj's) to track blocks associated with that snapshot.
-However, in common use cases, most of these bpobj's are empty. This
-feature allows us to create each bpobj on-demand, thus eliminating the
-empty bpobjs.
-
-This feature is \fBactive\fR while there are any filesystems, volumes,
-or snapshots which were created after enabling this feature.
-.RE
-
-.sp
-.ne 2
-.na
-\fBenabled_txg\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:enabled_txg
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES none
-.TE
-
-Once this feature is enabled ZFS records the transaction group number
-in which new features are enabled. This has no user-visible impact,
-but other features may depend on this feature.
-
-This feature becomes \fBactive\fR as soon as it is enabled and will
-never return to being \fBenabled\fB.
-.RE
-
-.sp
-.ne 2
-.na
-\fBencryption\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.datto:encryption
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES bookmark_v2, extensible_dataset
-.TE
-
-This feature enables the creation and management of natively encrypted datasets.
-
-This feature becomes \fBactive\fR when an encrypted dataset is created and will
-be returned to the \fBenabled\fR state when all datasets that use this feature
-are destroyed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBextensible_dataset\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:extensible_dataset
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES none
-.TE
-
-This feature allows more flexible use of internal ZFS data structures,
-and exists for other features to depend on.
-
-This feature will be \fBactive\fR when the first dependent feature uses it,
-and will be returned to the \fBenabled\fR state when all datasets that use
-this feature are destroyed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBfilesystem_limits\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.joyent:filesystem_limits
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES extensible_dataset
-.TE
-
-This feature enables filesystem and snapshot limits. These limits can be used
-to control how many filesystems and/or snapshots can be created at the point in
-the tree on which the limits are set.
-
-This feature is \fBactive\fR once either of the limit properties has been
-set on a dataset. Once activated the feature is never deactivated.
-.RE
-
-.sp
-.ne 2
-.na
-\fBhole_birth\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:hole_birth
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES enabled_txg
-.TE
-
-This feature has/had bugs, the result of which is that, if you do a
-\fBzfs send -i\fR (or \fB-R\fR, since it uses \fB-i\fR) from an affected
-dataset, the receiver will not see any checksum or other errors, but the
-resulting destination snapshot will not match the source. Its use by
-\fBzfs send -i\fR has been disabled by default. See the
-\fBsend_holes_without_birth_time\fR module parameter in
-zfs-module-parameters(5).
-
-This feature improves performance of incremental sends (\fBzfs send -i\fR)
-and receives for objects with many holes. The most common case of
-hole-filled objects is zvols.
-
-An incremental send stream from snapshot \fBA\fR to snapshot \fBB\fR
-contains information about every block that changed between \fBA\fR and
-\fBB\fR. Blocks which did not change between those snapshots can be
-identified and omitted from the stream using a piece of metadata called
-the 'block birth time', but birth times are not recorded for holes (blocks
-filled only with zeroes). Since holes created after \fBA\fR cannot be
-distinguished from holes created before \fBA\fR, information about every
-hole in the entire filesystem or zvol is included in the send stream.
-
-For workloads where holes are rare this is not a problem. However, when
-incrementally replicating filesystems or zvols with many holes (for
-example a zvol formatted with another filesystem) a lot of time will
-be spent sending and receiving unnecessary information about holes that
-already exist on the receiving side.
-
-Once the \fBhole_birth\fR feature has been enabled the block birth times
-of all new holes will be recorded. Incremental sends between snapshots
-created after this feature is enabled will use this new metadata to avoid
-sending information about holes that already exist on the receiving side.
-
-This feature becomes \fBactive\fR as soon as it is enabled and will
-never return to being \fBenabled\fB.
-.RE
-
-.sp
-.ne 2
-.na
-\fBlarge_blocks\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID org.open-zfs:large_blocks
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES extensible_dataset
-.TE
-
-The \fBlarge_block\fR feature allows the record size on a dataset to be
-set larger than 128KB.
-
-This feature becomes \fBactive\fR once a dataset contains a file with
-a block size larger than 128KB, and will return to being \fBenabled\fR once all
-filesystems that have ever had their recordsize larger than 128KB are destroyed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBlarge_dnode\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID org.zfsonlinux:large_dnode
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES extensible_dataset
-.TE
-
-The \fBlarge_dnode\fR feature allows the size of dnodes in a dataset to be
-set larger than 512B.
-
-This feature becomes \fBactive\fR once a dataset contains an object with
-a dnode larger than 512B, which occurs as a result of setting the
-\fBdnodesize\fR dataset property to a value other than \fBlegacy\fR. The
-feature will return to being \fBenabled\fR once all filesystems that
-have ever contained a dnode larger than 512B are destroyed. Large dnodes
-allow more data to be stored in the bonus buffer, thus potentially
-improving performance by avoiding the use of spill blocks.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBlivelist\fR\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:livelist
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES none
-.TE
-This feature allows clones to be deleted faster than the traditional method
-when a large number of random/sparse writes have been made to the clone.
-All blocks allocated and freed after a clone is created are tracked by the
-the clone's livelist which is referenced during the deletion of the clone.
-The feature is activated when a clone is created and remains active until all
-clones have been destroyed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBlog_spacemap\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:log_spacemap
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES com.delphix:spacemap_v2
-.TE
-
-This feature improves performance for heavily-fragmented pools,
-especially when workloads are heavy in random-writes. It does so by
-logging all the metaslab changes on a single spacemap every TXG
-instead of scattering multiple writes to all the metaslab spacemaps.
-
-This feature becomes \fBactive\fR as soon as it is enabled and will never
-return to being \fBenabled\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBlz4_compress\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID org.illumos:lz4_compress
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES none
-.TE
-
-\fBlz4\fR is a high-performance real-time compression algorithm that
-features significantly faster compression and decompression as well as a
-higher compression ratio than the older \fBlzjb\fR compression.
-Typically, \fBlz4\fR compression is approximately 50% faster on
-compressible data and 200% faster on incompressible data than
-\fBlzjb\fR. It is also approximately 80% faster on decompression, while
-giving approximately 10% better compression ratio.
-
-When the \fBlz4_compress\fR feature is set to \fBenabled\fR, the
-administrator can turn on \fBlz4\fR compression on any dataset on the
-pool using the zfs(8) command. Please note that doing so will
-immediately activate the \fBlz4_compress\fR feature on the underlying
-pool using the zfs(8) command. Also, all newly written metadata
-will be compressed with \fBlz4\fR algorithm. Since this feature is not
-read-only compatible, this operation will render the pool unimportable
-on systems without support for the \fBlz4_compress\fR feature.
-
-This feature becomes \fBactive\fR as soon as it is enabled and will
-never return to being \fBenabled\fB.
-.RE
-
-.sp
-.ne 2
-.na
-\fBmulti_vdev_crash_dump\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.joyent:multi_vdev_crash_dump
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES none
-.TE
-
-This feature allows a dump device to be configured with a pool comprised
-of multiple vdevs. Those vdevs may be arranged in any mirrored or raidz
-configuration.
-
-When the \fBmulti_vdev_crash_dump\fR feature is set to \fBenabled\fR,
-the administrator can use the \fBdumpadm\fR(1M) command to configure a
-dump device on a pool comprised of multiple vdevs.
-
-Under FreeBSD and Linux this feature is registered for compatibility but not
-used. New pools created under FreeBSD and Linux will have the feature
-\fBenabled\fR but will never transition to \fB\fBactive\fR. This functionality
-is not required in order to support crash dumps under FreeBSD and Linux.
-Existing pools where this feature is \fB\fBactive\fR can be imported.
-.RE
-
-.sp
-.ne 2
-.na
-\fBobsolete_counts\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:obsolete_counts
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES device_removal
-.TE
-
-This feature is an enhancement of device_removal, which will over time
-reduce the memory used to track removed devices. When indirect blocks
-are freed or remapped, we note that their part of the indirect mapping
-is "obsolete", i.e. no longer needed.
-
-This feature becomes \fBactive\fR when the \fBzpool remove\fR subcommand is
-used on a top-level vdev, and will never return to being \fBenabled\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBproject_quota\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID org.zfsonlinux:project_quota
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES extensible_dataset
-.TE
-
-This feature allows administrators to account the spaces and objects usage
-information against the project identifier (ID).
-
-The project ID is new object-based attribute. When upgrading an existing
-filesystem, object without project ID attribute will be assigned a zero
-project ID. After this feature is enabled, newly created object will inherit
-its parent directory's project ID if the parent inherit flag is set (via
-\fBchattr +/-P\fR or \fBzfs project [-s|-C]\fR). Otherwise, the new object's
-project ID will be set as zero. An object's project ID can be changed at
-anytime by the owner (or privileged user) via \fBchattr -p $prjid\fR or
-\fBzfs project -p $prjid\fR.
-
-This feature will become \fBactive\fR as soon as it is enabled and will never
-return to being \fBdisabled\fR. Each filesystem will be upgraded automatically
-when remounted or when new file is created under that filesystem. The upgrade
-can also be triggered on filesystems via `zfs set version=current <pool/fs>`.
-The upgrade process runs in the background and may take a while to complete
-for the filesystems containing a large number of files.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBredaction_bookmarks\fR\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:redaction_bookmarks
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES bookmarks, extensible_dataset
-.TE
-
-This feature enables the use of the redacted zfs send. Redacted \fBzfs send\fR
-creates redaction bookmarks, which store the list of blocks redacted by the
-send that created them. For more information about redacted send,
-see \fBzfs\fR(8).
-
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBredacted_datasets\fR\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:redacted_datasets
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES extensible_dataset
-.TE
-
-This feature enables the receiving of redacted zfs send streams. Redacted zfs
-send streams create redacted datasets when received. These datasets are
-missing some of their blocks, and so cannot be safely mounted, and their
-contents cannot be safely read. For more information about redacted receive,
-see \fBzfs\fR(8).
-.RE
-
-.sp
-.ne 2
-.na
-\fBresilver_defer\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.datto:resilver_defer
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES none
-.TE
-
-This feature allows zfs to postpone new resilvers if an existing one is already
-in progress. Without this feature, any new resilvers will cause the currently
-running one to be immediately restarted from the beginning.
-
-This feature becomes \fBactive\fR once a resilver has been deferred, and
-returns to being \fBenabled\fR when the deferred resilver begins.
-.RE
-
-.sp
-.ne 2
-.na
-\fBsha512\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID org.illumos:sha512
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES extensible_dataset
-.TE
-
-This feature enables the use of the SHA-512/256 truncated hash algorithm
-(FIPS 180-4) for checksum and dedup. The native 64-bit arithmetic of
-SHA-512 provides an approximate 50% performance boost over SHA-256 on
-64-bit hardware and is thus a good minimum-change replacement candidate
-for systems where hash performance is important, but these systems
-cannot for whatever reason utilize the faster \fBskein\fR and
-\fBedonr\fR algorithms.
-
-When the \fBsha512\fR feature is set to \fBenabled\fR, the administrator
-can turn on the \fBsha512\fR checksum on any dataset using
-\fBzfs set checksum=sha512\fR. See zfs(8). This feature becomes
-\fBactive\fR once a \fBchecksum\fR property has been set to \fBsha512\fR,
-and will return to being \fBenabled\fR once all filesystems that have
-ever had their checksum set to \fBsha512\fR are destroyed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBskein\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID org.illumos:skein
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES extensible_dataset
-.TE
-
-This feature enables the use of the Skein hash algorithm for checksum
-and dedup. Skein is a high-performance secure hash algorithm that was a
-finalist in the NIST SHA-3 competition. It provides a very high security
-margin and high performance on 64-bit hardware (80% faster than
-SHA-256). This implementation also utilizes the new salted checksumming
-functionality in ZFS, which means that the checksum is pre-seeded with a
-secret 256-bit random key (stored on the pool) before being fed the data
-block to be checksummed. Thus the produced checksums are unique to a
-given pool, preventing hash collision attacks on systems with dedup.
-
-When the \fBskein\fR feature is set to \fBenabled\fR, the administrator
-can turn on the \fBskein\fR checksum on any dataset using
-\fBzfs set checksum=skein\fR. See zfs(8). This feature becomes
-\fBactive\fR once a \fBchecksum\fR property has been set to \fBskein\fR,
-and will return to being \fBenabled\fR once all filesystems that have
-ever had their checksum set to \fBskein\fR are destroyed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBspacemap_histogram\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:spacemap_histogram
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES none
-.TE
-
-This features allows ZFS to maintain more information about how free space
-is organized within the pool. If this feature is \fBenabled\fR, ZFS will
-set this feature to \fBactive\fR when a new space map object is created or
-an existing space map is upgraded to the new format. Once the feature is
-\fBactive\fR, it will remain in that state until the pool is destroyed.
-.RE
-
-.sp
-.ne 2
-.na
-\fBspacemap_v2\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:spacemap_v2
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES none
-.TE
-
-This feature enables the use of the new space map encoding which
-consists of two words (instead of one) whenever it is advantageous.
-The new encoding allows space maps to represent large regions of
-space more efficiently on-disk while also increasing their maximum
-addressable offset.
-
-This feature becomes \fBactive\fR once it is \fBenabled\fR, and never
-returns back to being \fBenabled\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fBuserobj_accounting\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID org.zfsonlinux:userobj_accounting
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES extensible_dataset
-.TE
-
-This feature allows administrators to account the object usage information
-by user and group.
-
-This feature becomes \fBactive\fR as soon as it is enabled and will never
-return to being \fBenabled\fR. Each filesystem will be upgraded automatically
-when remounted, or when new files are created under that filesystem.
-The upgrade can also be started manually on filesystems by running
-`zfs set version=current <pool/fs>`. The upgrade process runs in the background
-and may take a while to complete for filesystems containing a large number of
-files.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzpool_checkpoint\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID com.delphix:zpool_checkpoint
-READ\-ONLY COMPATIBLE yes
-DEPENDENCIES none
-.TE
-
-This feature enables the \fBzpool checkpoint\fR subcommand that can
-checkpoint the state of the pool at the time it was issued and later
-rewind back to it or discard it.
-
-This feature becomes \fBactive\fR when the \fBzpool checkpoint\fR subcommand
-is used to checkpoint the pool.
-The feature will only return back to being \fBenabled\fR when the pool
-is rewound or the checkpoint has been discarded.
-.RE
-
-.sp
-.ne 2
-.na
-\fBzstd_compress\fR
-.ad
-.RS 4n
-.TS
-l l .
-GUID org.freebsd:zstd_compress
-READ\-ONLY COMPATIBLE no
-DEPENDENCIES extensible_dataset
-.TE
-
-\fBzstd\fR is a high-performance compression algorithm that features a
-combination of high compression ratios and high speed. Compared to \fBgzip\fR,
-\fBzstd\fR offers slightly better compression at much higher speeds. Compared
-to \fBlz4\fR, \fBzstd\fR offers much better compression while being only
-modestly slower. Typically, \fBzstd\fR compression speed ranges from 250 to 500
-MB/s per thread and decompression speed is over 1 GB/s per thread.
-
-When the \fBzstd\fR feature is set to \fBenabled\fR, the administrator can turn
-on \fBzstd\fR compression of any dataset by running
-`zfs set compress=zstd <pool/fs>`.
-
-This feature becomes \fBactive\fR once a \fBcompress\fR property has been set to
-\fBzstd\fR, and will return to being \fBenabled\fR once all filesystems that
-have ever had their compress property set to \fBzstd\fR are destroyed.
-.RE
-
-.SH "SEE ALSO"
-zpool(8)
diff --git a/sys/contrib/openzfs/man/man8/zfsconcepts.8 b/sys/contrib/openzfs/man/man7/zfsconcepts.7
index 8e0e68678789..f958035f72df 100644
--- a/sys/contrib/openzfs/man/man8/zfsconcepts.8
+++ b/sys/contrib/openzfs/man/man7/zfsconcepts.7
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -31,11 +30,13 @@
.\" Copyright 2019 Joyent, Inc.
.\"
.Dd June 30, 2019
-.Dt ZFSCONCEPTS 8
+.Dt ZFSCONCEPTS 7
.Os
+.
.Sh NAME
.Nm zfsconcepts
-.Nd An overview of ZFS concepts.
+.Nd overview of ZFS concepts
+.
.Sh DESCRIPTION
.Ss ZFS File System Hierarchy
A ZFS storage pool is a logical collection of devices that provide space for
@@ -77,15 +78,15 @@ property.
.Ss Bookmarks
A bookmark is like a snapshot, a read-only copy of a file system or volume.
Bookmarks can be created extremely quickly, compared to snapshots, and they
-consume no additional space within the pool. Bookmarks can also have arbitrary
-names, much like snapshots.
-.Pp
-Unlike snapshots, bookmarks can not be accessed through the filesystem in any
-way. From a storage standpoint a bookmark just provides a way to reference
-when a snapshot was created as a distinct object. Bookmarks are initially
-tied to a snapshot, not the filesystem or volume, and they will survive if the
-snapshot itself is destroyed. Since they are very light weight there's little
-incentive to destroy them.
+consume no additional space within the pool.
+Bookmarks can also have arbitrary names, much like snapshots.
+.Pp
+Unlike snapshots, bookmarks can not be accessed through the filesystem in any way.
+From a storage standpoint a bookmark just provides a way to reference
+when a snapshot was created as a distinct object.
+Bookmarks are initially tied to a snapshot, not the filesystem or volume,
+and they will survive if the snapshot itself is destroyed.
+Since they are very light weight there's little incentive to destroy them.
.Ss Clones
A clone is a writable volume or file system whose initial contents are the same
as another dataset.
@@ -162,37 +163,44 @@ If needed, ZFS file systems can also be managed with traditional tools
If a file system's mount point is set to
.Sy legacy ,
ZFS makes no attempt to manage the file system, and the administrator is
-responsible for mounting and unmounting the file system. Because pools must
+responsible for mounting and unmounting the file system.
+Because pools must
be imported before a legacy mount can succeed, administrators should ensure
that legacy mounts are only attempted after the zpool import process
-finishes at boot time. For example, on machines using systemd, the mount
-option
+finishes at boot time.
+For example, on machines using systemd, the mount option
.Pp
.Nm x-systemd.requires=zfs-import.target
.Pp
will ensure that the zfs-import completes before systemd attempts mounting
-the filesystem. See systemd.mount(5) for details.
+the filesystem.
+See
+.Xr systemd.mount 5
+for details.
.Ss Deduplication
Deduplication is the process for removing redundant data at the block level,
-reducing the total amount of data stored. If a file system has the
+reducing the total amount of data stored.
+If a file system has the
.Sy dedup
-property enabled, duplicate data blocks are removed synchronously. The result
+property enabled, duplicate data blocks are removed synchronously.
+The result
is that only unique data is stored and common components are shared among files.
.Pp
-Deduplicating data is a very resource-intensive operation. It is generally
-recommended that you have at least 1.25 GiB of RAM per 1 TiB of storage when
-you enable deduplication. Calculating the exact requirement depends heavily
+Deduplicating data is a very resource-intensive operation.
+It is generally recommended that you have at least 1.25 GiB of RAM
+per 1 TiB of storage when you enable deduplication.
+Calculating the exact requirement depends heavily
on the type of data stored in the pool.
.Pp
Enabling deduplication on an improperly-designed system can result in
-performance issues (slow IO and administrative operations). It can potentially
-lead to problems importing a pool due to memory exhaustion. Deduplication
-can consume significant processing power (CPU) and memory as well as generate
-additional disk IO.
+performance issues (slow IO and administrative operations).
+It can potentially lead to problems importing a pool due to memory exhaustion.
+Deduplication can consume significant processing power (CPU) and memory as well
+as generate additional disk IO.
.Pp
Before creating a pool with deduplication enabled, ensure that you have planned
your hardware requirements appropriately and implemented appropriate recovery
-practices, such as regular backups. As an alternative to deduplication
-consider using
-.Sy compression=on ,
-as a less resource-intensive alternative.
+practices, such as regular backups.
+Consider using the
+.Sy compression
+property as a less resource-intensive alternative.
diff --git a/sys/contrib/openzfs/man/man8/zfsprops.8 b/sys/contrib/openzfs/man/man7/zfsprops.7
index 29a3cd41d585..387e51b0b5ee 100644
--- a/sys/contrib/openzfs/man/man8/zfsprops.8
+++ b/sys/contrib/openzfs/man/man7/zfsprops.7
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -39,11 +38,13 @@
.\" Copyright (c) 2019, Kjeld Schouten-Lebbing
.\"
.Dd May 24, 2021
-.Dt ZFSPROPS 8
+.Dt ZFSPROPS 7
.Os
+.
.Sh NAME
.Nm zfsprops
-.Nd Native properties and user-defined of ZFS datasets.
+.Nd native and user-defined properties of ZFS datasets
+.
.Sh DESCRIPTION
Properties are divided into two types, native properties and user-defined
.Po or
@@ -57,6 +58,7 @@ datasets in a way that is meaningful in your environment.
For more information about user properties, see the
.Sx User Properties
section, below.
+.
.Ss Native Properties
Every dataset has a set of properties that export statistics about the dataset
as well as control various behaviors.
@@ -118,11 +120,12 @@ Compression can be turned on by running:
The default value is
.Sy off .
.It Sy createtxg
-The transaction group (txg) in which the dataset was created. Bookmarks have
-the same
+The transaction group (txg) in which the dataset was created.
+Bookmarks have the same
.Sy createtxg
-as the snapshot they are initially tied to. This property is suitable for
-ordering a list of snapshots, e.g. for incremental send and receive.
+as the snapshot they are initially tied to.
+This property is suitable for ordering a list of snapshots,
+e.g. for incremental send and receive.
.It Sy creation
The time this dataset was created.
.It Sy clones
@@ -153,7 +156,8 @@ Otherwise, the property is
.Sy off .
.It Sy encryptionroot
For encrypted datasets, indicates where the dataset is currently inheriting its
-encryption key from. Loading or unloading a key for the
+encryption key from.
+Loading or unloading a key for the
.Sy encryptionroot
will implicitly load / unload the key for any inheriting datasets (see
.Nm zfs Cm load-key
@@ -161,8 +165,9 @@ and
.Nm zfs Cm unload-key
for details).
Clones will always share an
-encryption key with their origin. See the
-.Em Encryption
+encryption key with their origin.
+See the
+.Sx Encryption
section of
.Xr zfs-load-key 8
for details.
@@ -173,8 +178,8 @@ This value is only available when a
.Sy filesystem_limit
has been set somewhere in the tree under which the dataset resides.
.It Sy keystatus
-Indicates if an encryption key is currently loaded into ZFS. The possible
-values are
+Indicates if an encryption key is currently loaded into ZFS.
+The possible values are
.Sy none ,
.Sy available ,
and
@@ -185,8 +190,9 @@ and
.Nm zfs Cm unload-key .
.It Sy guid
The 64 bit GUID of this dataset or bookmark which does not change over its
-entire lifetime. When a snapshot is sent to another pool, the received
-snapshot has the same GUID. Thus, the
+entire lifetime.
+When a snapshot is sent to another pool, the received snapshot has the same GUID.
+Thus, the
.Sy guid
is suitable to identify a snapshot across pools.
.It Sy logicalreferenced
@@ -230,10 +236,9 @@ This property can be either
or
.Sy no .
.It Sy objsetid
-A unique identifier for this dataset within the pool. Unlike the dataset's
-.Sy guid
-, the
-.Sy objsetid
+A unique identifier for this dataset within the pool.
+Unlike the dataset's
+.Sy guid , No the Sy objsetid
of a dataset is not transferred to other pools when the snapshot is copied
with a send/receive operation.
The
@@ -247,11 +252,11 @@ See also the
property.
.It Sy receive_resume_token
For filesystems or volumes which have saved partially-completed state from
-.Sy zfs receive -s ,
+.Nm zfs Cm receive Fl s ,
this opaque token can be provided to
-.Sy zfs send -t
+.Nm zfs Cm send Fl t
to resume and complete the
-.Sy zfs receive .
+.Nm zfs Cm receive .
.It Sy redact_snaps
For bookmarks, this is the list of snapshot guids the bookmark contains a redaction
list for.
@@ -297,9 +302,9 @@ greater of its space used and its reservation.
.Pp
The used space of a snapshot
.Po see the
-.Em Snapshots
+.Sx Snapshots
section of
-.Xr zfsconcepts 8
+.Xr zfsconcepts 7
.Pc
is space that is referenced exclusively by this snapshot.
If this snapshot is destroyed, the amount of
@@ -323,7 +328,7 @@ Pending changes are generally accounted for within a few seconds.
Committing a change to a disk using
.Xr fsync 2
or
-.Dv O_SYNC
+.Sy O_SYNC
does not necessarily guarantee that the space usage information is updated
immediately.
.It Sy usedby*
@@ -365,17 +370,15 @@ dataset's snapshots were destroyed.
Note that this is not simply the sum of the snapshots'
.Sy used
properties because space can be shared by multiple snapshots.
-.It Sy userused Ns @ Ns Em user
+.It Sy userused Ns @ Ns Ar user
The amount of space consumed by the specified user in this dataset.
Space is charged to the owner of each file, as displayed by
.Nm ls Fl l .
The amount of space charged is displayed by
-.Nm du
-and
-.Nm ls Fl s .
+.Nm du No and Nm ls Fl s .
See the
.Nm zfs Cm userspace
-subcommand for more information.
+command for more information.
.Pp
Unprivileged users can access only their own space usage.
The root user, or a user who has been granted the
@@ -385,66 +388,60 @@ privilege with
can access everyone's usage.
.Pp
The
-.Sy userused Ns @ Ns Em ...
+.Sy userused Ns @ Ns Ar ...
properties are not displayed by
.Nm zfs Cm get Sy all .
-The user's name must be appended after the @ symbol, using one of the following
-forms:
-.Bl -bullet -width ""
+The user's name must be appended after the
+.Sy @
+symbol, using one of the following forms:
+.Bl -bullet -compact -offset 4n
.It
-.Em POSIX name
-.Po for example,
-.Sy joe
-.Pc
+POSIX name
+.Pq Qq joe
.It
-.Em POSIX numeric ID
-.Po for example,
-.Sy 789
-.Pc
+POSIX numeric ID
+.Pq Qq 789
.It
-.Em SID name
-.Po for example,
-.Sy joe.smith@mydomain
-.Pc
+SID name
+.Pq Qq joe.smith@mydomain
.It
-.Em SID numeric ID
-.Po for example,
-.Sy S-1-123-456-789
-.Pc
+SID numeric ID
+.Pq Qq S-1-123-456-789
.El
.Pp
Files created on Linux always have POSIX owners.
-.It Sy userobjused Ns @ Ns Em user
+.It Sy userobjused Ns @ Ns Ar user
The
.Sy userobjused
property is similar to
.Sy userused
-but instead it counts the number of objects consumed by a user. This property
-counts all objects allocated on behalf of the user, it may differ from the
-results of system tools such as
+but instead it counts the number of objects consumed by a user.
+This property counts all objects allocated on behalf of the user,
+it may differ from the results of system tools such as
.Nm df Fl i .
.Pp
When the property
-.Sy xattr=on
+.Sy xattr Ns = Ns Sy on
is set on a file system additional objects will be created per-file to store
-extended attributes. These additional objects are reflected in the
+extended attributes.
+These additional objects are reflected in the
.Sy userobjused
value and are counted against the user's
.Sy userobjquota .
When a file system is configured to use
-.Sy xattr=sa
+.Sy xattr Ns = Ns Sy sa
no additional internal objects are normally required.
.It Sy userrefs
This property is set to the number of user holds on this snapshot.
User holds are set by using the
.Nm zfs Cm hold
command.
-.It Sy groupused Ns @ Ns Em group
+.It Sy groupused Ns @ Ns Ar group
The amount of space consumed by the specified group in this dataset.
Space is charged to the group of each file, as displayed by
.Nm ls Fl l .
See the
-.Sy userused Ns @ Ns Em user
+.Sy userused Ns @ Ns Ar user
property for more information.
.Pp
Unprivileged users can only access their own groups' space usage.
@@ -453,11 +450,12 @@ The root user, or a user who has been granted the
privilege with
.Nm zfs Cm allow ,
can access all groups' usage.
-.It Sy groupobjused Ns @ Ns Em group
+.It Sy groupobjused Ns @ Ns Ar group
The number of objects consumed by the specified group in this dataset.
Multiple objects may be charged to the group for each file when extended
-attributes are in use. See the
-.Sy userobjused Ns @ Ns Em user
+attributes are in use.
+See the
+.Sy userobjused Ns @ Ns Ar user
property for more information.
.Pp
Unprivileged users can only access their own groups' space usage.
@@ -466,25 +464,28 @@ The root user, or a user who has been granted the
privilege with
.Nm zfs Cm allow ,
can access all groups' usage.
-.It Sy projectused Ns @ Ns Em project
-The amount of space consumed by the specified project in this dataset. Project
-is identified via the project identifier (ID) that is object-based numeral
-attribute. An object can inherit the project ID from its parent object (if the
+.It Sy projectused Ns @ Ns Ar project
+The amount of space consumed by the specified project in this dataset.
+Project is identified via the project identifier (ID) that is object-based
+numeral attribute.
+An object can inherit the project ID from its parent object (if the
parent has the flag of inherit project ID that can be set and changed via
.Nm chattr Fl /+P
or
.Nm zfs project Fl s )
-when being created. The privileged user can set and change object's project
+when being created.
+The privileged user can set and change object's project
ID via
.Nm chattr Fl p
or
.Nm zfs project Fl s
-anytime. Space is charged to the project of each file, as displayed by
+anytime.
+Space is charged to the project of each file, as displayed by
.Nm lsattr Fl p
or
.Nm zfs project .
See the
-.Sy userused Ns @ Ns Em user
+.Sy userused Ns @ Ns Ar user
property for more information.
.Pp
The root user, or a user who has been granted the
@@ -492,23 +493,25 @@ The root user, or a user who has been granted the
privilege with
.Nm zfs allow ,
can access all projects' usage.
-.It Sy projectobjused Ns @ Ns Em project
+.It Sy projectobjused Ns @ Ns Ar project
The
.Sy projectobjused
is similar to
.Sy projectused
-but instead it counts the number of objects consumed by project. When the
-property
-.Sy xattr=on
+but instead it counts the number of objects consumed by project.
+When the property
+.Sy xattr Ns = Ns Sy on
is set on a fileset, ZFS will create additional objects per-file to store
-extended attributes. These additional objects are reflected in the
+extended attributes.
+These additional objects are reflected in the
.Sy projectobjused
value and are counted against the project's
.Sy projectobjquota .
When a filesystem is configured to use
-.Sy xattr=sa
-no additional internal objects are required. See the
-.Sy userobjused Ns @ Ns Em user
+.Sy xattr Ns = Ns Sy sa
+no additional internal objects are required.
+See the
+.Sy userobjused Ns @ Ns Ar user
property for more information.
.Pp
The root user, or a user who has been granted the
@@ -534,7 +537,7 @@ The amount of space
.Sy referenced
by this dataset, that was written since the previous snapshot
.Pq i.e. that is not referenced by the previous snapshot .
-.It Sy written Ns @ Ns Em snapshot
+.It Sy written Ns @ Ns Ar snapshot
The amount of
.Sy referenced
space written to this dataset since the specified snapshot.
@@ -542,17 +545,15 @@ This is the space that is referenced by this dataset but was not referenced by
the specified snapshot.
.Pp
The
-.Em snapshot
+.Ar snapshot
may be specified as a short snapshot name
-.Po just the part after the
-.Sy @
-.Pc ,
+.Pq just the part after the Sy @ ,
in which case it will be interpreted as a snapshot in the same filesystem as
this dataset.
The
-.Em snapshot
+.Ar snapshot
may be a full snapshot name
-.Po Em filesystem Ns @ Ns Em snapshot Pc ,
+.Pq Ar filesystem Ns @ Ns Ar snapshot ,
which for clones may be a snapshot in the origin's filesystem
.Pq or the origin of the origin's filesystem, etc.
.El
@@ -565,7 +566,7 @@ dataset.
.Sy restricted Ns | Ns Sy passthrough Ns | Ns Sy passthrough-x
.Xc
Controls how ACEs are inherited when files and directories are created.
-.Bl -tag -width "passthrough-x"
+.Bl -tag -compact -offset 4n -width "passthrough-x"
.It Sy discard
does not inherit any ACEs.
.It Sy noallow
@@ -584,10 +585,7 @@ inherits all inheritable ACEs without any modifications.
same meaning as
.Sy passthrough ,
except that the
-.Sy owner@ ,
-.Sy group@ ,
-and
-.Sy everyone@
+.Sy owner@ , group@ , No and Sy everyone@
ACEs inherit the execute permission only if the file creation mode also requests
the execute bit.
.El
@@ -606,8 +604,8 @@ property does not apply to POSIX ACLs.
.Sy passthrough Ns | Ns Sy restricted Ns
.Xc
Controls how an ACL is modified during chmod(2) and how inherited ACEs
-are modified by the file creation mode.
-.Bl -tag -width "passthrough"
+are modified by the file creation mode:
+.Bl -tag -compact -offset 4n -width "passthrough"
.It Sy discard
default, deletes all
.Sy ACEs
@@ -622,41 +620,30 @@ entries found in the
such that they are no greater than the group permissions specified by
.Xr chmod 2 .
.It Sy passthrough
-indicates that no changes are made to the
-.Tn ACL
-other than creating or updating the necessary
-.Tn ACL
-entries to represent the new mode of the file or directory.
+indicates that no changes are made to the ACL other than creating or updating
+the necessary ACL entries to represent the new mode of the file or directory.
.It Sy restricted
will cause the
.Xr chmod 2
operation to return an error when used on any file or directory which has
-a non-trivial
-.Tn ACL
-whose entries can not be represented by a mode.
+a non-trivial ACL whose entries can not be represented by a mode.
.Xr chmod 2
is required to change the set user ID, set group ID, or sticky bits on a file
-or directory, as they do not have equivalent
-.Tn ACL
-entries.
+or directory, as they do not have equivalent ACL entries.
In order to use
.Xr chmod 2
-on a file or directory with a non-trivial
-.Tn ACL
-when
+on a file or directory with a non-trivial ACL when
.Sy aclmode
is set to
.Sy restricted ,
-you must first remove all
-.Tn ACL
-entries which do not represent the current mode.
+you must first remove all ACL entries which do not represent the current mode.
.El
.It Sy acltype Ns = Ns Sy off Ns | Ns Sy nfsv4 Ns | Ns Sy posix
Controls whether ACLs are enabled and if so what type of ACL to use.
When this property is set to a type of ACL not supported by the current
platform, the behavior is the same as if it were set to
.Sy off .
-.Bl -tag -width "posixacl"
+.Bl -tag -compact -offset 4n -width "posixacl"
.It Sy off
default on Linux, when a file system has the
.Sy acltype
@@ -665,17 +652,20 @@ property set to off then ACLs are disabled.
an alias for
.Sy off
.It Sy nfsv4
-default on FreeBSD, indicates that NFSv4-style ZFS ACLs should be used.
+default on
+.Fx ,
+indicates that NFSv4-style ZFS ACLs should be used.
These ACLs can be managed with the
.Xr getfacl 1
and
-.Xr setfacl 1
-commands on FreeBSD. The
+.Xr setfacl 1 .
+The
.Sy nfsv4
ZFS ACL type is not yet supported on Linux.
.It Sy posix
-indicates POSIX ACLs should be used. POSIX ACLs are specific to Linux and are
-not functional on other platforms. POSIX ACLs are stored as an extended
+indicates POSIX ACLs should be used.
+POSIX ACLs are specific to Linux and are not functional on other platforms.
+POSIX ACLs are stored as an extended
attribute and therefore will not overwrite any existing NFSv4 ACLs which
may be set.
.It Sy posixacl
@@ -686,19 +676,22 @@ an alias for
To obtain the best performance when setting
.Sy posix
users are strongly encouraged to set the
-.Sy xattr=sa
-property. This will result in the POSIX ACL being stored more efficiently on
-disk. But as a consequence, all new extended attributes will only be
+.Sy xattr Ns = Ns Sy sa
+property.
+This will result in the POSIX ACL being stored more efficiently on disk.
+But as a consequence, all new extended attributes will only be
accessible from OpenZFS implementations which support the
-.Sy xattr=sa
-property. See the
+.Sy xattr Ns = Ns Sy sa
+property.
+See the
.Sy xattr
property for more details.
.It Sy atime Ns = Ns Sy on Ns | Ns Sy off
Controls whether the access time for files is updated when they are read.
Turning this property off avoids producing write traffic when reading files and
can result in significant performance gains, though it might confuse mailers
-and other similar utilities. The values
+and other similar utilities.
+The values
.Sy on
and
.Sy off
@@ -706,7 +699,8 @@ are equivalent to the
.Sy atime
and
.Sy noatime
-mount options. The default value is
+mount options.
+The default value is
.Sy on .
See also
.Sy relatime
@@ -768,7 +762,7 @@ not only disables integrity but also disables maintaining parity for user data.
This setting is used internally by a dump device residing on a RAID-Z pool and
should not be used by any other dataset.
Disabling checksums is
-.Sy NOT
+.Em NOT
a recommended practice.
.Pp
The
@@ -777,19 +771,20 @@ The
and
.Sy edonr
checksum algorithms require enabling the appropriate features on the pool.
-FreeBSD does not support the
+.Fx
+does not support the
.Sy edonr
algorithm.
.Pp
Please see
-.Xr zpool-features 5
+.Xr zpool-features 7
for more information on these algorithms.
.Pp
Changing this property affects only newly-written data.
.It Xo
.Sy compression Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Sy gzip Ns | Ns
-.Sy gzip- Ns Em N Ns | Ns Sy lz4 Ns | Ns Sy lzjb Ns | Ns Sy zle Ns | Ns Sy zstd Ns | Ns
-.Sy zstd- Ns Em N Ns | Ns Sy zstd-fast Ns | Ns Sy zstd-fast- Ns Em N
+.Sy gzip- Ns Ar N Ns | Ns Sy lz4 Ns | Ns Sy lzjb Ns | Ns Sy zle Ns | Ns Sy zstd Ns | Ns
+.Sy zstd- Ns Ar N Ns | Ns Sy zstd-fast Ns | Ns Sy zstd-fast- Ns Ar N
.Xc
Controls the compression algorithm used for this dataset.
.Pp
@@ -823,7 +818,7 @@ but can only be used on pools with the
feature set to
.Sy enabled .
See
-.Xr zpool-features 5
+.Xr zpool-features 7
for details on ZFS feature flags and the
.Sy lz4_compress
feature.
@@ -841,9 +836,9 @@ command.
You can specify the
.Sy gzip
level by using the value
-.Sy gzip- Ns Em N ,
+.Sy gzip- Ns Ar N ,
where
-.Em N
+.Ar N
is an integer from 1
.Pq fastest
to 9
@@ -858,13 +853,13 @@ is equivalent to
.Pp
The
.Sy zstd
-compression algorithm provides both high compression ratios and good
-performance. You can specify the
+compression algorithm provides both high compression ratios and good performance.
+You can specify the
.Sy zstd
level by using the value
-.Sy zstd- Ns Em N ,
+.Sy zstd- Ns Ar N ,
where
-.Em N
+.Ar N
is an integer from 1
.Pq fastest
to 19
@@ -876,14 +871,16 @@ is equivalent to
Faster speeds at the cost of the compression ratio can be requested by
setting a negative
.Sy zstd
-level. This is done using
-.Sy zstd-fast- Ns Em N ,
+level.
+This is done using
+.Sy zstd-fast- Ns Ar N ,
where
-.Em N
+.Ar N
is an integer in [1-9,10,20,30,...,100,500,1000] which maps to a negative
.Sy zstd
-level. The lower the level the faster the compression - 1000 provides
-the fastest compression and lowest compression ratio.
+level.
+The lower the level the faster the compression -
+.Ar 1000 No provides the fastest compression and lowest compression ratio.
.Sy zstd-fast
is equivalent to
.Sy zstd-fast-1 .
@@ -899,43 +896,49 @@ Changing this property affects only newly-written data.
When any setting except
.Sy off
is selected, compression will explicitly check for blocks consisting of only
-zeroes (the NUL byte). When a zero-filled block is detected, it is stored as
+zeroes (the NUL byte).
+When a zero-filled block is detected, it is stored as
a hole and not compressed using the indicated compression algorithm.
.Pp
Any block being compressed must be no larger than 7/8 of its original size
after compression, otherwise the compression will not be considered worthwhile
-and the block saved uncompressed. Note that when the logical block is less than
+and the block saved uncompressed.
+Note that when the logical block is less than
8 times the disk sector size this effectively reduces the necessary compression
-ratio; for example 8k blocks on disks with 4k disk sectors must compress to 1/2
+ratio; for example, 8kB blocks on disks with 4kB disk sectors must compress to 1/2
or less of their original size.
.It Xo
.Sy context Ns = Ns Sy none Ns | Ns
-.Em SELinux_User:SElinux_Role:Selinux_Type:Sensitivity_Level
+.Ar SELinux-User : Ns Ar SElinux-Role : Ns Ar Selinux-Type : Ns Ar Sensitivity-Level
.Xc
This flag sets the SELinux context for all files in the file system under
-a mount point for that file system. See
+a mount point for that file system.
+See
.Xr selinux 8
for more information.
.It Xo
.Sy fscontext Ns = Ns Sy none Ns | Ns
-.Em SELinux_User:SElinux_Role:Selinux_Type:Sensitivity_Level
+.Ar SELinux-User : Ns Ar SElinux-Role : Ns Ar Selinux-Type : Ns Ar Sensitivity-Level
.Xc
This flag sets the SELinux context for the file system file system being
-mounted. See
+mounted.
+See
.Xr selinux 8
for more information.
.It Xo
.Sy defcontext Ns = Ns Sy none Ns | Ns
-.Em SELinux_User:SElinux_Role:Selinux_Type:Sensitivity_Level
+.Ar SELinux-User : Ns Ar SElinux-Role : Ns Ar Selinux-Type : Ns Ar Sensitivity-Level
.Xc
-This flag sets the SELinux default context for unlabeled files. See
+This flag sets the SELinux default context for unlabeled files.
+See
.Xr selinux 8
for more information.
.It Xo
.Sy rootcontext Ns = Ns Sy none Ns | Ns
-.Em SELinux_User:SElinux_Role:Selinux_Type:Sensitivity_Level
+.Ar SELinux-User : Ns Ar SElinux-Role : Ns Ar Selinux-Type : Ns Ar Sensitivity-Level
.Xc
-This flag sets the SELinux context for the root inode of the file system. See
+This flag sets the SELinux context for the root inode of the file system.
+See
.Xr selinux 8
for more information.
.It Sy copies Ns = Ns Sy 1 Ns | Ns Sy 2 Ns | Ns Sy 3
@@ -953,16 +956,17 @@ Therefore, set this property at file system creation time by using the
.Fl o Sy copies Ns = Ns Ar N
option.
.Pp
-Remember that ZFS will not import a pool with a missing top-level vdev. Do
-.Sy NOT
+Remember that ZFS will not import a pool with a missing top-level vdev.
+Do
+.Em NOT
create, for example a two-disk striped pool and set
-.Sy copies=2
-on some datasets thinking you have setup redundancy for them. When a disk
-fails you will not be able to import the pool and will have lost all of your
-data.
+.Sy copies Ns = Ns Ar 2
+on some datasets thinking you have setup redundancy for them.
+When a disk fails you will not be able to import the pool
+and will have lost all of your data.
.Pp
Encrypted datasets may not have
-.Sy copies Ns = Ns Em 3
+.Sy copies Ns = Ns Ar 3
since the implementation stores some encryption metadata where the third copy
would normally be.
.It Sy devices Ns = Ns Sy on Ns | Ns Sy off
@@ -980,55 +984,64 @@ and
mount options.
.It Xo
.Sy dedup Ns = Ns Sy off Ns | Ns Sy on Ns | Ns Sy verify Ns | Ns
-.Sy sha256[,verify] Ns | Ns Sy sha512[,verify] Ns | Ns Sy skein[,verify] Ns | Ns
-.Sy edonr,verify
+.Sy sha256 Ns Oo , Ns Sy verify Oc Ns | Ns Sy sha512 Ns Oo , Ns Sy verify Oc Ns | Ns Sy skein Ns Oo , Ns Sy verify Oc Ns | Ns
+.Sy edonr , Ns Sy verify
.Xc
-Configures deduplication for a dataset. The default value is
+Configures deduplication for a dataset.
+The default value is
.Sy off .
The default deduplication checksum is
.Sy sha256
-(this may change in the future). When
+(this may change in the future).
+When
.Sy dedup
is enabled, the checksum defined here overrides the
.Sy checksum
-property. Setting the value to
+property.
+Setting the value to
.Sy verify
has the same effect as the setting
-.Sy sha256,verify.
+.Sy sha256 , Ns Sy verify .
.Pp
If set to
.Sy verify ,
ZFS will do a byte-to-byte comparison in case of two blocks having the same
-signature to make sure the block contents are identical. Specifying
+signature to make sure the block contents are identical.
+Specifying
.Sy verify
is mandatory for the
.Sy edonr
algorithm.
.Pp
-Unless necessary, deduplication should NOT be enabled on a system. See the
-.Em Deduplication
+Unless necessary, deduplication should
+.Em not
+be enabled on a system.
+See the
+.Sx Deduplication
section of
-.Xr zfsconcepts 8 .
+.Xr zfsconcepts 7 .
.It Xo
.Sy dnodesize Ns = Ns Sy legacy Ns | Ns Sy auto Ns | Ns Sy 1k Ns | Ns
.Sy 2k Ns | Ns Sy 4k Ns | Ns Sy 8k Ns | Ns Sy 16k
.Xc
Specifies a compatibility mode or literal value for the size of dnodes in the
-file system. The default value is
+file system.
+The default value is
.Sy legacy .
Setting this property to a value other than
-.Sy legacy
-requires the large_dnode pool feature to be enabled.
+.Sy legacy No requires the Sy large_dnode No pool feature to be enabled.
.Pp
Consider setting
.Sy dnodesize
to
.Sy auto
if the dataset uses the
-.Sy xattr=sa
-property setting and the workload makes heavy use of extended attributes. This
+.Sy xattr Ns = Ns Sy sa
+property setting and the workload makes heavy use of extended attributes.
+This
may be applicable to SELinux-enabled systems, Lustre servers, and Samba
-servers, for example. Literal values are supported for cases where the optimal
+servers, for example.
+Literal values are supported for cases where the optimal
size is known in advance and for performance testing.
.Pp
Leave
@@ -1036,8 +1049,10 @@ Leave
set to
.Sy legacy
if you need to receive a send stream of this dataset on a pool that doesn't
-enable the large_dnode feature, or if you need to import this pool on a system
-that doesn't support the large_dnode feature.
+enable the
+.Sy large_dnode
+feature, or if you need to import this pool on a system that doesn't support the
+.Sy large_dnode No feature.
.Pp
This property can also be referred to by its shortened column name,
.Sy dnsize .
@@ -1047,7 +1062,8 @@ This property can also be referred to by its shortened column name,
.Sy aes-192-gcm Ns | Ns Sy aes-256-gcm
.Xc
Controls the encryption cipher suite (block cipher, key length, and mode) used
-for this dataset. Requires the
+for this dataset.
+Requires the
.Sy encryption
feature to be enabled on the pool.
Requires a
@@ -1063,26 +1079,24 @@ In order to provide consistent data protection, encryption must be specified at
dataset creation time and it cannot be changed afterwards.
.Pp
For more details and caveats about encryption see the
-.Em Encryption
+.Sx Encryption
section of
.Xr zfs-load-key 8 .
.It Sy keyformat Ns = Ns Sy raw Ns | Ns Sy hex Ns | Ns Sy passphrase
-Controls what format the user's encryption key will be provided as. This
-property is only set when the dataset is encrypted.
+Controls what format the user's encryption key will be provided as.
+This property is only set when the dataset is encrypted.
.Pp
Raw keys and hex keys must be 32 bytes long (regardless of the chosen
-encryption suite) and must be randomly generated. A raw key can be generated
-with the following command:
-.Bd -literal
-# dd if=/dev/urandom of=/path/to/output/key bs=32 count=1
-.Ed
+encryption suite) and must be randomly generated.
+A raw key can be generated with the following command:
+.Dl # Nm dd Sy if=/dev/urandom bs=32 count=1 Sy of= Ns Pa /path/to/output/key
.Pp
Passphrases must be between 8 and 512 bytes long and will be processed through
PBKDF2 before being used (see the
.Sy pbkdf2iters
-property). Even though the
-encryption suite cannot be changed after dataset creation, the keyformat can be
-with
+property).
+Even though the encryption suite cannot be changed after dataset creation,
+the keyformat can be with
.Nm zfs Cm change-key .
.It Xo
.Sy keylocation Ns = Ns Sy prompt Ns | Ns Sy file:// Ns Em </absolute/file/path>
@@ -1091,10 +1105,10 @@ Controls where the user's encryption key will be loaded from by default for
commands such as
.Nm zfs Cm load-key
and
-.Nm zfs Cm mount Cm -l .
-This property is only set for encrypted datasets which are encryption roots. If
-unspecified, the default is
-.Sy prompt.
+.Nm zfs Cm mount Fl l .
+This property is only set for encrypted datasets which are encryption roots.
+If unspecified, the default is
+.Sy prompt .
.Pp
Even though the encryption suite cannot be changed after dataset creation, the
keylocation can be with either
@@ -1106,9 +1120,11 @@ If
is selected ZFS will ask for the key at the command prompt when it is required
to access the encrypted data (see
.Nm zfs Cm load-key
-for details). This setting will also allow the key to be passed in via STDIN,
+for details).
+This setting will also allow the key to be passed in via the standard input stream,
but users should be careful not to place keys which should be kept secret on
-the command line. If a file URI is selected, the key will be loaded from the
+the command line.
+If a file URI is selected, the key will be loaded from the
specified absolute file path.
.It Sy pbkdf2iters Ns = Ns Ar iterations
Controls the number of PBKDF2 iterations that a
@@ -1116,14 +1132,16 @@ Controls the number of PBKDF2 iterations that a
encryption key should be run through when processing it into an encryption key.
This property is only defined when encryption is enabled and a keyformat of
.Sy passphrase
-is selected. The goal of PBKDF2 is to significantly increase the
-computational difficulty needed to brute force a user's passphrase. This is
-accomplished by forcing the attacker to run each passphrase through a
+is selected.
+The goal of PBKDF2 is to significantly increase the
+computational difficulty needed to brute force a user's passphrase.
+This is accomplished by forcing the attacker to run each passphrase through a
computationally expensive hashing function many times before they arrive at the
-resulting key. A user who actually knows the passphrase will only have to pay
-this cost once. As CPUs become better at processing, this number should be
-raised to ensure that a brute force attack is still not possible. The current
-default is
+resulting key.
+A user who actually knows the passphrase will only have to pay this cost once.
+As CPUs become better at processing, this number should be
+raised to ensure that a brute force attack is still not possible.
+The current default is
.Sy 350000
and the minimum is
.Sy 100000 .
@@ -1142,7 +1160,7 @@ are equivalent to the
and
.Sy noexec
mount options.
-.It Sy filesystem_limit Ns = Ns Em count Ns | Ns Sy none
+.It Sy filesystem_limit Ns = Ns Ar count Ns | Ns Sy none
Limits the number of filesystems and volumes that can exist under this point in
the dataset tree.
The limit is not enforced if the user is allowed to change the limit.
@@ -1157,26 +1175,29 @@ does not override the ancestor's
but rather imposes an additional limit.
This feature must be enabled to be used
.Po see
-.Xr zpool-features 5
+.Xr zpool-features 7
.Pc .
-.It Sy special_small_blocks Ns = Ns Em size
+.It Sy special_small_blocks Ns = Ns Ar size
This value represents the threshold block size for including small file
-blocks into the special allocation class. Blocks smaller than or equal to this
+blocks into the special allocation class.
+Blocks smaller than or equal to this
value will be assigned to the special allocation class while greater blocks
-will be assigned to the regular class. Valid values are zero or a power of two
-from 512B up to 1M. The default size is 0 which means no small file blocks
+will be assigned to the regular class.
+Valid values are zero or a power of two from 512B up to 1M.
+The default size is 0 which means no small file blocks
will be allocated in the special class.
.Pp
Before setting this property, a special class vdev must be added to the
-pool. See
-.Xr zpoolconcepts 8
+pool.
+See
+.Xr zpoolconcepts 7
for more details on the special allocation class.
.It Sy mountpoint Ns = Ns Pa path Ns | Ns Sy none Ns | Ns Sy legacy
Controls the mount point used for this file system.
See the
-.Em Mount Points
+.Sx Mount Points
section of
-.Xr zfsconcepts 8
+.Xr zfsconcepts 7
for more information on how this property is used.
.Pp
When the
@@ -1200,11 +1221,14 @@ Controls whether the file system should be mounted with
.Pq Non-blocking mandatory locks .
This is used for SMB clients.
Changes to this property only take effect when the file system is umounted and
-remounted. Support for these locks is scarce and not described by POSIX.
+remounted.
+Support for these locks is scarce and not described by POSIX.
.It Sy overlay Ns = Ns Sy on Ns | Ns Sy off
Allow mounting on a busy directory or a directory which already contains
files or directories.
-This is the default mount behavior for Linux and FreeBSD file systems.
+This is the default mount behavior for Linux and
+.Fx
+file systems.
On these platforms the property is
.Sy on
by default.
@@ -1225,7 +1249,7 @@ If this property is set to
then only metadata is cached.
The default value is
.Sy all .
-.It Sy quota Ns = Ns Em size Ns | Ns Sy none
+.It Sy quota Ns = Ns Ar size Ns | Ns Sy none
Limits the amount of space a dataset and its descendents can consume.
This property enforces a hard limit on the amount of space used.
This includes all space consumed by descendents, including file systems and
@@ -1236,7 +1260,7 @@ override the ancestor's quota, but rather imposes an additional limit.
Quotas cannot be set on volumes, as the
.Sy volsize
property acts as an implicit quota.
-.It Sy snapshot_limit Ns = Ns Em count Ns | Ns Sy none
+.It Sy snapshot_limit Ns = Ns Ar count Ns | Ns Sy none
Limits the number of snapshots that can be created on a dataset and its
descendents.
Setting a
@@ -1251,12 +1275,12 @@ For example, this means that recursive snapshots taken from the global zone are
counted against each delegated dataset within a zone.
This feature must be enabled to be used
.Po see
-.Xr zpool-features 5
+.Xr zpool-features 7
.Pc .
-.It Sy userquota@ Ns Em user Ns = Ns Em size Ns | Ns Sy none
+.It Sy userquota@ Ns Ar user Ns = Ns Ar size Ns | Ns Sy none
Limits the amount of space consumed by the specified user.
User space consumption is identified by the
-.Sy userspace@ Ns Em user
+.Sy userspace@ Ns Ar user
property.
.Pp
Enforcement of user quotas may be delayed by several seconds.
@@ -1266,7 +1290,7 @@ that they are over quota and begins to refuse additional writes with the
error message.
See the
.Nm zfs Cm userspace
-subcommand for more information.
+command for more information.
.Pp
Unprivileged users can only access their own groups' space usage.
The root user, or a user who has been granted the
@@ -1278,48 +1302,41 @@ can get and set everyone's quota.
This property is not available on volumes, on file systems before version 4, or
on pools before version 15.
The
-.Sy userquota@ Ns Em ...
+.Sy userquota@ Ns Ar ...
properties are not displayed by
.Nm zfs Cm get Sy all .
The user's name must be appended after the
.Sy @
symbol, using one of the following forms:
-.Bl -bullet
+.Bl -bullet -compact -offset 4n
.It
-.Em POSIX name
-.Po for example,
-.Sy joe
-.Pc
+POSIX name
+.Pq Qq joe
.It
-.Em POSIX numeric ID
-.Po for example,
-.Sy 789
-.Pc
+POSIX numeric ID
+.Pq Qq 789
.It
-.Em SID name
-.Po for example,
-.Sy joe.smith@mydomain
-.Pc
+SID name
+.Pq Qq joe.smith@mydomain
.It
-.Em SID numeric ID
-.Po for example,
-.Sy S-1-123-456-789
-.Pc
+SID numeric ID
+.Pq Qq S-1-123-456-789
.El
.Pp
Files created on Linux always have POSIX owners.
-.It Sy userobjquota@ Ns Em user Ns = Ns Em size Ns | Ns Sy none
+.It Sy userobjquota@ Ns Ar user Ns = Ns Ar size Ns | Ns Sy none
The
.Sy userobjquota
is similar to
.Sy userquota
-but it limits the number of objects a user can create. Please refer to
+but it limits the number of objects a user can create.
+Please refer to
.Sy userobjused
for more information about how objects are counted.
-.It Sy groupquota@ Ns Em group Ns = Ns Em size Ns | Ns Sy none
+.It Sy groupquota@ Ns Ar group Ns = Ns Ar size Ns | Ns Sy none
Limits the amount of space consumed by the specified group.
Group space consumption is identified by the
-.Sy groupused@ Ns Em group
+.Sy groupused@ Ns Ar group
property.
.Pp
Unprivileged users can access only their own groups' space usage.
@@ -1328,19 +1345,21 @@ The root user, or a user who has been granted the
privilege with
.Nm zfs Cm allow ,
can get and set all groups' quotas.
-.It Sy groupobjquota@ Ns Em group Ns = Ns Em size Ns | Ns Sy none
+.It Sy groupobjquota@ Ns Ar group Ns = Ns Ar size Ns | Ns Sy none
The
.Sy groupobjquota
is similar to
.Sy groupquota
-but it limits number of objects a group can consume. Please refer to
+but it limits number of objects a group can consume.
+Please refer to
.Sy userobjused
for more information about how objects are counted.
-.It Sy projectquota@ Ns Em project Ns = Ns Em size Ns | Ns Sy none
-Limits the amount of space consumed by the specified project. Project
-space consumption is identified by the
-.Sy projectused@ Ns Em project
-property. Please refer to
+.It Sy projectquota@ Ns Ar project Ns = Ns Ar size Ns | Ns Sy none
+Limits the amount of space consumed by the specified project.
+Project space consumption is identified by the
+.Sy projectused@ Ns Ar project
+property.
+Please refer to
.Sy projectused
for more information about how project is identified and set/changed.
.Pp
@@ -1349,12 +1368,13 @@ The root user, or a user who has been granted the
privilege with
.Nm zfs allow ,
can access all projects' quota.
-.It Sy projectobjquota@ Ns Em project Ns = Ns Em size Ns | Ns Sy none
+.It Sy projectobjquota@ Ns Ar project Ns = Ns Ar size Ns | Ns Sy none
The
.Sy projectobjquota
is similar to
.Sy projectquota
-but it limits number of objects a project can consume. Please refer to
+but it limits number of objects a project can consume.
+Please refer to
.Sy userobjused
for more information about how objects are counted.
.It Sy readonly Ns = Ns Sy on Ns | Ns Sy off
@@ -1373,7 +1393,7 @@ mount options.
.Pp
This property can also be referred to by its shortened column name,
.Sy rdonly .
-.It Sy recordsize Ns = Ns Em size
+.It Sy recordsize Ns = Ns Ar size
Specifies a suggested block size for files in the file system.
This property is designed solely for use with database workloads that access
files in fixed-size records.
@@ -1389,13 +1409,16 @@ significant performance gains.
Use of this property for general purpose file systems is strongly discouraged,
and may adversely affect performance.
.Pp
-The size specified must be a power of two greater than or equal to 512 and less
-than or equal to 128 Kbytes.
+The size specified must be a power of two greater than or equal to
+.Ar 512B
+and less than or equal to
+.Ar 128kB .
If the
.Sy large_blocks
-feature is enabled on the pool, the size may be up to 1 Mbyte.
+feature is enabled on the pool, the size may be up to
+.Ar 1MB .
See
-.Xr zpool-features 5
+.Xr zpool-features 7
for details on ZFS feature flags.
.Pp
Changing the file system's
@@ -1447,12 +1470,12 @@ future releases.
.Pp
The default value is
.Sy all .
-.It Sy refquota Ns = Ns Em size Ns | Ns Sy none
+.It Sy refquota Ns = Ns Ar size Ns | Ns Sy none
Limits the amount of space a dataset can consume.
This property enforces a hard limit on the amount of space used.
This hard limit does not include space used by descendents, including file
systems and snapshots.
-.It Sy refreservation Ns = Ns Em size Ns | Ns Sy none Ns | Ns Sy auto
+.It Sy refreservation Ns = Ns Ar size Ns | Ns Sy none Ns | Ns Sy auto
The minimum amount of space guaranteed to a dataset, not including its
descendents.
When the amount of space used is below this value, the dataset is treated as if
@@ -1490,12 +1513,14 @@ This property can also be referred to by its shortened column name,
.Sy refreserv .
.It Sy relatime Ns = Ns Sy on Ns | Ns Sy off
Controls the manner in which the access time is updated when
-.Sy atime=on
-is set. Turning this property on causes the access time to be updated relative
-to the modify or change time. Access time is only updated if the previous
+.Sy atime Ns = Ns Sy on
+is set.
+Turning this property on causes the access time to be updated relative
+to the modify or change time.
+Access time is only updated if the previous
access time was earlier than the current modify or change time or if the
-existing access time hasn't been updated within the past 24 hours. The default
-value is
+existing access time hasn't been updated within the past 24 hours.
+The default value is
.Sy off .
The values
.Sy on
@@ -1506,7 +1531,7 @@ are equivalent to the
and
.Sy norelatime
mount options.
-.It Sy reservation Ns = Ns Em size Ns | Ns Sy none
+.It Sy reservation Ns = Ns Ar size Ns | Ns Sy none
The minimum amount of space guaranteed to a dataset and its descendants.
When the amount of space used is below this value, the dataset is treated as if
it were taking up the amount of space specified by its reservation.
@@ -1542,21 +1567,23 @@ are equivalent to the
and
.Sy nosuid
mount options.
-.It Sy sharesmb Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Em opts
+.It Sy sharesmb Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Ar opts
Controls whether the file system is shared by using
.Sy Samba USERSHARES
-and what options are to be used. Otherwise, the file system is automatically
-shared and unshared with the
+and what options are to be used.
+Otherwise, the file system is automatically shared and unshared with the
.Nm zfs Cm share
and
.Nm zfs Cm unshare
-commands. If the property is set to on, the
+commands.
+If the property is set to on, the
.Xr net 8
command is invoked to create a
.Sy USERSHARE .
.Pp
Because SMB shares requires a resource name, a unique resource name is
-constructed from the dataset name. The constructed name is a copy of the
+constructed from the dataset name.
+The constructed name is a copy of the
dataset name except that the characters in the dataset name, which would be
invalid in the resource name, are replaced with underscore (_) characters.
Linux does not currently support additional options which might be available
@@ -1569,12 +1596,12 @@ property is set to
the file systems are unshared.
.Pp
The share is created with the ACL (Access Control List) "Everyone:F" ("F"
-stands for "full permissions", ie. read and write permissions) and no guest
+stands for "full permissions", i.e. read and write permissions) and no guest
access (which means Samba must be able to authenticate a real user, system
-passwd/shadow, LDAP or smbpasswd based) by default. This means that any
-additional access control (disallow specific user specific access etc) must
-be done on the underlying file system.
-.It Sy sharenfs Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Em opts
+passwd/shadow, LDAP or smbpasswd based) by default.
+This means that any additional access control
+(disallow specific user specific access etc) must be done on the underlying file system.
+.It Sy sharenfs Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Ar opts
Controls whether the file system is shared via NFS, and what options are to be
used.
A file system with a
@@ -1584,7 +1611,7 @@ property of
is managed with the
.Xr exportfs 8
command and entries in the
-.Em /etc/exports
+.Pa /etc/exports
file.
Otherwise, the file system is automatically shared and unshared with the
.Nm zfs Cm share
@@ -1594,12 +1621,12 @@ commands.
If the property is set to
.Sy on ,
the dataset is shared using the default options:
-.Pp
-.Em sec=sys,rw,crossmnt,no_subtree_check
+.Dl sec=sys,rw,crossmnt,no_subtree_check
.Pp
See
.Xr exports 5
-for the meaning of the default options. Otherwise, the
+for the meaning of the default options.
+Otherwise, the
.Xr exportfs 8
command is invoked with options equivalent to the contents of this property.
.Pp
@@ -1631,28 +1658,27 @@ ZFS will instead optimize synchronous operations for global pool throughput and
efficient use of resources.
.It Sy snapdev Ns = Ns Sy hidden Ns | Ns Sy visible
Controls whether the volume snapshot devices under
-.Em /dev/zvol/<pool>
-are hidden or visible. The default value is
+.Pa /dev/zvol/ Ns Aq Ar pool
+are hidden or visible.
+The default value is
.Sy hidden .
.It Sy snapdir Ns = Ns Sy hidden Ns | Ns Sy visible
Controls whether the
.Pa .zfs
directory is hidden or visible in the root of the file system as discussed in
the
-.Em Snapshots
+.Sx Snapshots
section of
-.Xr zfsconcepts 8 .
+.Xr zfsconcepts 7 .
The default value is
.Sy hidden .
.It Sy sync Ns = Ns Sy standard Ns | Ns Sy always Ns | Ns Sy disabled
Controls the behavior of synchronous requests
.Pq e.g. fsync, O_DSYNC .
.Sy standard
-is the
-.Tn POSIX
-specified behavior of ensuring all synchronous requests are written to stable
-storage and all devices are flushed to ensure data is not cached by device
-controllers
+is the POSIX-specified behavior of ensuring all synchronous requests
+are written to stable storage and all devices are flushed to ensure
+data is not cached by device controllers
.Pq this is the default .
.Sy always
causes every file system transaction to be written and flushed before its
@@ -1665,14 +1691,14 @@ This option will give the highest performance.
However, it is very dangerous as ZFS would be ignoring the synchronous
transaction demands of applications such as databases or NFS.
Administrators should only use this option when the risks are understood.
-.It Sy version Ns = Ns Em N Ns | Ns Sy current
+.It Sy version Ns = Ns Ar N Ns | Ns Sy current
The on-disk version of this file system, which is independent of the pool
version.
This property can only be set to later supported versions.
See the
.Nm zfs Cm upgrade
command.
-.It Sy volsize Ns = Ns Em size
+.It Sy volsize Ns = Ns Ar size
For volumes, specifies the logical size of the volume.
By default, creating a volume establishes a reservation of equal size.
For storage pools with a version number of 9 or higher, a
@@ -1681,9 +1707,7 @@ is set instead.
Any changes to
.Sy volsize
are reflected in an equivalent change to the reservation
-.Po or
-.Sy refreservation
-.Pc .
+.Pq or Sy refreservation .
The
.Sy volsize
can only be set to a multiple of
@@ -1727,19 +1751,20 @@ when the pool is low on space.
For a sparse volume, changes to
.Sy volsize
are not reflected in the
-.Sy refreservation.
+.Sy refreservation .
A volume that is not sparse is said to be
.Qq thick provisioned .
A sparse volume can become thick provisioned by setting
.Sy refreservation
to
.Sy auto .
-.It Sy volmode Ns = Ns Cm default | full | geom | dev | none
+.It Sy volmode Ns = Ns Sy default Ns | Ns Sy full Ns | Ns Sy geom Ns | Ns Sy dev Ns | Ns Sy none
This property specifies how volumes should be exposed to the OS.
Setting it to
.Sy full
exposes volumes as fully fledged block devices, providing maximal
-functionality. The value
+functionality.
+The value
.Sy geom
is just an alias for
.Sy full
@@ -1754,7 +1779,7 @@ that can be suitable for backup purposes.
Value
.Sy default
means that volumes exposition is controlled by system-wide tunable
-.Va zvol_volmode ,
+.Sy zvol_volmode ,
where
.Sy full ,
.Sy dev
@@ -1772,35 +1797,39 @@ The default value is
.Sy off .
This property is not used on Linux.
.It Sy xattr Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Sy sa
-Controls whether extended attributes are enabled for this file system. Two
-styles of extended attributes are supported either directory based or system
-attribute based.
+Controls whether extended attributes are enabled for this file system.
+Two styles of extended attributes are supported: either directory based
+or system attribute based.
.Pp
The default value of
.Sy on
-enables directory based extended attributes. This style of extended attribute
-imposes no practical limit on either the size or number of attributes which
-can be set on a file. Although under Linux the
+enables directory based extended attributes.
+This style of extended attribute imposes no practical limit
+on either the size or number of attributes which can be set on a file.
+Although under Linux the
.Xr getxattr 2
and
.Xr setxattr 2
-system calls limit the maximum size to 64K. This is the most compatible
-style of extended attribute and is supported by all OpenZFS implementations.
+system calls limit the maximum size to 64K.
+This is the most compatible
+style of extended attribute and is supported by all ZFS implementations.
.Pp
System attribute based xattrs can be enabled by setting the value to
.Sy sa .
-The key advantage of this type of xattr is improved performance. Storing
-extended attributes as system attributes significantly decreases the amount of
-disk IO required. Up to 64K of data may be stored per-file in the space
-reserved for system attributes. If there is not enough space available for
-an extended attribute then it will be automatically written as a directory
-based xattr. System attribute based extended attributes are not accessible
+The key advantage of this type of xattr is improved performance.
+Storing extended attributes as system attributes
+significantly decreases the amount of disk IO required.
+Up to 64K of data may be stored per-file in the space reserved for system attributes.
+If there is not enough space available for an extended attribute
+then it will be automatically written as a directory based xattr.
+System attribute based extended attributes are not accessible
on platforms which do not support the
-.Sy xattr=sa
+.Sy xattr Ns = Ns Sy sa
feature.
.Pp
The use of system attribute based xattrs is strongly encouraged for users of
-SELinux or POSIX ACLs. Both of these features heavily rely on extended
+SELinux or POSIX ACLs.
+Both of these features heavily rely on extended
attributes and benefit significantly from the reduced access time.
.Pp
The values
@@ -1813,16 +1842,19 @@ and
.Sy noxattr
mount options.
.It Sy jailed Ns = Ns Sy off Ns | Ns Sy on
-Controls whether the dataset is managed from a jail. See the
-.Qq Sx Jails
-section in
-.Xr zfs 8
-for more information. Jails are a FreeBSD feature and are not relevant on
-other platforms. The default value is
-.Cm off .
+Controls whether the dataset is managed from a jail.
+See
+.Xr zfs-jail 8
+for more information.
+Jails are a
+.Fx
+feature and are not relevant on other platforms.
+The default value is
+.Sy off .
.It Sy zoned Ns = Ns Sy on Ns | Ns Sy off
-Controls whether the dataset is managed from a non-global zone. Zones are a
-Solaris feature and are not relevant on other platforms. The default value is
+Controls whether the dataset is managed from a non-global zone.
+Zones are a Solaris feature and are not relevant on other platforms.
+The default value is
.Sy off .
.El
.Pp
@@ -1850,9 +1882,7 @@ property is
.Sy sensitive .
Traditionally,
.Ux
-and
-.Tn POSIX
-file systems have case-sensitive file names.
+and POSIX file systems have case-sensitive file names.
.Pp
The
.Sy mixed
@@ -1911,7 +1941,8 @@ and
.Sy utf8only
properties are also new permissions that can be assigned to non-privileged users
by using the ZFS delegated administration feature.
-.Ss "Temporary Mount Point Properties"
+.
+.Ss Temporary Mount Point Properties
When a file system is mounted, either through
.Xr mount 8
for legacy mounts or the
@@ -1919,22 +1950,34 @@ for legacy mounts or the
command for normal file systems, its mount options are set according to its
properties.
The correlation between properties and mount options is as follows:
-.Bd -literal
- PROPERTY MOUNT OPTION
- atime atime/noatime
- canmount auto/noauto
- devices dev/nodev
- exec exec/noexec
- readonly ro/rw
- relatime relatime/norelatime
- setuid suid/nosuid
- xattr xattr/noxattr
- nbmand mand/nomand
- context context=
- fscontext fscontext=
- defcontext defcontext=
- rootcontext rootcontext=
-.Ed
+.Bl -tag -compact -offset Ds -width "rootcontext="
+.It Sy atime
+atime/noatime
+.It Sy canmount
+auto/noauto
+.It Sy devices
+dev/nodev
+.It Sy exec
+exec/noexec
+.It Sy readonly
+ro/rw
+.It Sy relatime
+relatime/norelatime
+.It Sy setuid
+suid/nosuid
+.It Sy xattr
+xattr/noxattr
+.It Sy nbmand
+mand/nomand
+.It Sy context Ns =
+context=
+.It Sy fscontext Ns =
+fscontext=
+.It Sy defcontext Ns =
+defcontext=
+.It Sy rootcontext Ns =
+rootcontext=
+.El
.Pp
In addition, these options can be set on a per-mount basis using the
.Fl o
@@ -1944,7 +1987,7 @@ dataset.
The
.Sy nosuid
option is an alias for
-.Sy nodevices Ns \&, Ns Sy nosetuid .
+.Sy nodevices , Ns Sy nosetuid .
These properties are reported as
.Qq temporary
by the
@@ -1952,7 +1995,8 @@ by the
command.
If the properties are changed while the dataset is mounted, the new setting
overrides any temporary settings.
-.Ss "User Properties"
+.
+.Ss User Properties
In addition to the standard native properties, ZFS supports arbitrary user
properties.
User properties have no effect on ZFS behavior, but applications or
@@ -1973,16 +2017,14 @@ and underscore
.Pq Qq Sy _ .
The expected convention is that the property name is divided into two portions
such as
-.Em module Ns \&: Ns Em property ,
+.Ar module : Ns Ar property ,
but this namespace is not enforced by ZFS.
User property names can be at most 256 characters, and cannot begin with a dash
.Pq Qq Sy - .
.Pp
When making programmatic use of user properties, it is strongly suggested to use
-a reversed
-.Sy DNS
-domain name for the
-.Em module
+a reversed DNS domain name for the
+.Ar module
component of property names to reduce the chance that two
independently-developed packages use the same property name for different
purposes.
diff --git a/sys/contrib/openzfs/man/man7/zpool-features.7 b/sys/contrib/openzfs/man/man7/zpool-features.7
new file mode 100644
index 000000000000..83ca91175370
--- /dev/null
+++ b/sys/contrib/openzfs/man/man7/zpool-features.7
@@ -0,0 +1,842 @@
+.\"
+.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
+.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
+.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
+.\" The contents of this file are subject to the terms of the Common Development
+.\" and Distribution License (the "License"). You may not use this file except
+.\" in compliance with the License. You can obtain a copy of the license at
+.\" usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
+.\"
+.\" See the License for the specific language governing permissions and
+.\" limitations under the License. When distributing Covered Code, include this
+.\" CDDL HEADER in each file and include the License file at
+.\" usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this
+.\" CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your
+.\" own identifying information:
+.\" Portions Copyright [yyyy] [name of copyright owner]
+.\" Copyright (c) 2019, Klara Inc.
+.\" Copyright (c) 2019, Allan Jude
+.\" Copyright (c) 2021, Colm Buckley <colm@tuatha.org>
+.\"
+.Dd May 31, 2021
+.Dt ZPOOL-FEATURES 7
+.Os
+.
+.Sh NAME
+.Nm zpool-features
+.Nd description of ZFS pool features
+.
+.Sh DESCRIPTION
+ZFS pool on-disk format versions are specified via "features" which replace
+the old on-disk format numbers (the last supported on-disk format number is 28).
+To enable a feature on a pool use the
+.Nm zpool Cm upgrade ,
+or set the
+.Sy feature Ns @ Ns Ar feature-name
+property to
+.Sy enabled .
+Please also see the
+.Sx Compatibility feature sets
+section for information on how sets of features may be enabled together.
+.Pp
+The pool format does not affect file system version compatibility or the ability
+to send file systems between pools.
+.Pp
+Since most features can be enabled independently of each other, the on-disk
+format of the pool is specified by the set of all features marked as
+.Sy active
+on the pool.
+If the pool was created by another software version
+this set may include unsupported features.
+.
+.Ss Identifying features
+Every feature has a GUID of the form
+.Ar com.example : Ns Ar feature-name .
+The reversed DNS name ensures that the feature's GUID is unique across all ZFS
+implementations.
+When unsupported features are encountered on a pool they will
+be identified by their GUIDs.
+Refer to the documentation for the ZFS
+implementation that created the pool for information about those features.
+.Pp
+Each supported feature also has a short name.
+By convention a feature's short name is the portion of its GUID which follows the
+.Sq \&:
+(i.e.
+.Ar com.example : Ns Ar feature-name
+would have the short name
+.Ar feature-name ) ,
+however a feature's short name may differ across ZFS implementations if
+following the convention would result in name conflicts.
+.
+.Ss Feature states
+Features can be in one of three states:
+.Bl -tag -width "disabled"
+.It Sy active
+This feature's on-disk format changes are in effect on the pool.
+Support for this feature is required to import the pool in read-write mode.
+If this feature is not read-only compatible,
+support is also required to import the pool in read-only mode
+.Pq see Sx Read-only compatibility .
+.It Sy enabled
+An administrator has marked this feature as enabled on the pool, but the
+feature's on-disk format changes have not been made yet.
+The pool can still be imported by software that does not support this feature,
+but changes may be made to the on-disk format at any time
+which will move the feature to the
+.Sy active
+state.
+Some features may support returning to the
+.Sy enabled
+state after becoming
+.Sy active .
+See feature-specific documentation for details.
+.It Sy disabled
+This feature's on-disk format changes have not been made and will not be made
+unless an administrator moves the feature to the
+.Sy enabled
+state.
+Features cannot be disabled once they have been enabled.
+.El
+.Pp
+The state of supported features is exposed through pool properties of the form
+.Sy feature Ns @ Ns Ar short-name .
+.
+.Ss Read-only compatibility
+Some features may make on-disk format changes that do not interfere with other
+software's ability to read from the pool.
+These features are referred to as
+.Dq read-only compatible .
+If all unsupported features on a pool are read-only compatible,
+the pool can be imported in read-only mode by setting the
+.Sy readonly
+property during import (see
+.Xr zpool-import 8
+for details on importing pools).
+.
+.Ss Unsupported features
+For each unsupported feature enabled on an imported pool, a pool property
+named
+.Sy unsupported Ns @ Ns Ar feature-name
+will indicate why the import was allowed despite the unsupported feature.
+Possible values for this property are:
+.Bl -tag -width "readonly"
+.It Sy inactive
+The feature is in the
+.Sy enabled
+state and therefore the pool's on-disk
+format is still compatible with software that does not support this feature.
+.It Sy readonly
+The feature is read-only compatible and the pool has been imported in
+read-only mode.
+.El
+.
+.Ss Feature dependencies
+Some features depend on other features being enabled in order to function.
+Enabling a feature will automatically enable any features it depends on.
+.
+.Ss Compatibility feature sets
+It is sometimes necessary for a pool to maintain compatibility with a
+specific on-disk format, by enabling and disabling particular features.
+The
+.Sy compatibility
+feature facilitates this by allowing feature sets to be read from text files.
+When set to
+.Sy off
+(the default), compatibility feature sets are disabled
+(i.e. all features are enabled); when set to
+.Sy legacy ,
+no features are enabled.
+When set to a comma-separated list of filenames
+(each filename may either be an absolute path, or relative to
+.Pa /etc/zfs/compatibility.d
+or
+.Pa /usr/share/zfs/compatibility.d ) ,
+the lists of requested features are read from those files,
+separated by whitespace and/or commas.
+Only features present in all files are enabled.
+.Pp
+Simple sanity checks are applied to the files:
+they must be between 1B and 16kB in size, and must end with a newline character.
+.Pp
+The requested features are applied when a pool is created using
+.Nm zpool Cm create Fl o Sy compatibility Ns = Ns Ar …
+and controls which features are enabled when using
+.Nm zpool Cm upgrade .
+.Nm zpool Cm status
+will not show a warning about disabled features which are not part
+of the requested feature set.
+.Pp
+The special value
+.Sy legacy
+prevents any features from being enabled, either via
+.Nm zpool Cm upgrade
+or
+.Nm zpool Cm set Sy feature Ns @ Ns Ar feature-name Ns = Ns Sy enabled .
+This setting also prevents pools from being upgraded to newer on-disk versions.
+This is a safety measure to prevent new features from being
+accidentally enabled, breaking compatibility.
+.Pp
+By convention, compatibility files in
+.Pa /usr/share/zfs/compatibility.d
+are provided by the distribution, and include feature sets
+supported by important versions of popular distributions, and feature
+sets commonly supported at the start of each year.
+Compatibility files in
+.Pa /etc/zfs/compatibility.d ,
+if present, will take precedence over files with the same name in
+.Pa /usr/share/zfs/compatibility.d .
+.Pp
+If an unrecognized feature is found in these files, an error message will
+be shown.
+If the unrecognized feature is in a file in
+.Pa /etc/zfs/compatibility.d ,
+this is treated as an error and processing will stop.
+If the unrecognized feature is under
+.Pa /usr/share/zfs/compatibility.d ,
+this is treated as a warning and processing will continue.
+This difference is to allow distributions to include features
+which might not be recognized by the currently-installed binaries.
+.Pp
+Compatibility files may include comments:
+any text from
+.Sq #
+to the end of the line is ignored.
+.Pp
+.Sy Example :
+.Bd -literal -compact -offset 4n
+.No example# Nm cat Pa /usr/share/zfs/compatibility.d/grub2
+# Features which are supported by GRUB2
+async_destroy
+bookmarks
+embedded_data
+empty_bpobj
+enabled_txg
+extensible_dataset
+filesystem_limits
+hole_birth
+large_blocks
+lz4_compress
+spacemap_histogram
+
+.No example# Nm zpool Cm create Fl o Sy compatibility Ns = Ns Ar grub2 Ar bootpool Ar vdev
+.Ed
+.Pp
+See
+.Xr zpool-create 8
+and
+.Xr zpool-upgrade 8
+for more information on how these commands are affected by feature sets.
+.
+.de feature
+.It Sy \\$2
+.Bl -tag -compact -width "READ-ONLY COMPATIBLE"
+.It GUID
+.Sy \\$1:\\$2
+.if !"\\$4"" \{\
+.It DEPENDENCIES
+\fB\\$4\fP\c
+.if !"\\$5"" , \fB\\$5\fP\c
+.if !"\\$6"" , \fB\\$6\fP\c
+.if !"\\$7"" , \fB\\$7\fP\c
+.if !"\\$8"" , \fB\\$8\fP\c
+.if !"\\$9"" , \fB\\$9\fP\c
+.\}
+.It READ-ONLY COMPATIBLE
+\\$3
+.El
+.Pp
+..
+.
+.ds instant-never \
+.No This feature becomes Sy active No as soon as it is enabled \
+and will never return to being Sy enabled .
+.
+.ds remount-upgrade \
+.No Each filesystem will be upgraded automatically when remounted, \
+or when a new file is created under that filesystem. \
+The upgrade can also be triggered on filesystems via \
+Nm zfs Cm set Sy version Ns = Ns Sy current Ar fs . \
+No The upgrade process runs in the background and may take a while to complete \
+for filesystems containing large amounts of files.
+.
+.de checksum-spiel
+When the
+.Sy \\$1
+feature is set to
+.Sy enabled ,
+the administrator can turn on the
+.Sy \\$1
+checksum on any dataset using
+.Nm zfs Cm set Sy checksum Ns = Ns Sy \\$1 Ar dset
+.Po see Xr zfs-set 8 Pc .
+This feature becomes
+.Sy active
+once a
+.Sy checksum
+property has been set to
+.Sy \\$1 ,
+and will return to being
+.Sy enabled
+once all filesystems that have ever had their checksum set to
+.Sy \\$1
+are destroyed.
+..
+.
+.Sh FEATURES
+The following features are supported on this system:
+.Bl -tag -width Ds
+.feature org.zfsonlinux allocation_classes yes
+This feature enables support for separate allocation classes.
+.Pp
+This feature becomes
+.Sy active
+when a dedicated allocation class vdev (dedup or special) is created with the
+.Nm zpool Cm create No or Nm zpool Cm add No commands .
+With device removal, it can be returned to the
+.Sy enabled
+state if all the dedicated allocation class vdevs are removed.
+.
+.feature com.delphix async_destroy yes
+Destroying a file system requires traversing all of its data in order to
+return its used space to the pool.
+Without
+.Sy async_destroy ,
+the file system is not fully removed until all space has been reclaimed.
+If the destroy operation is interrupted by a reboot or power outage,
+the next attempt to open the pool will need to complete the destroy
+operation synchronously.
+.Pp
+When
+.Sy async_destroy
+is enabled, the file system's data will be reclaimed by a background process,
+allowing the destroy operation to complete
+without traversing the entire file system.
+The background process is able to resume
+interrupted destroys after the pool has been opened, eliminating the need
+to finish interrupted destroys as part of the open operation.
+The amount of space remaining to be reclaimed by the background process
+is available through the
+.Sy freeing
+property.
+.Pp
+This feature is only
+.Sy active
+while
+.Sy freeing
+is non-zero.
+.
+.feature com.delphix bookmarks yes extensible_dataset
+This feature enables use of the
+.Nm zfs Cm bookmark
+command.
+.Pp
+This feature is
+.Sy active
+while any bookmarks exist in the pool.
+All bookmarks in the pool can be listed by running
+.Nm zfs Cm list Fl t Sy bookmark Fl r Ar poolname .
+.
+.feature com.datto bookmark_v2 no bookmark extensible_dataset
+This feature enables the creation and management of larger bookmarks which are
+needed for other features in ZFS.
+.Pp
+This feature becomes
+.Sy active
+when a v2 bookmark is created and will be returned to the
+.Sy enabled
+state when all v2 bookmarks are destroyed.
+.
+.feature com.delphix bookmark_written no bookmark extensible_dataset bookmark_v2
+This feature enables additional bookmark accounting fields, enabling the
+.Sy written Ns # Ns Ar bookmark
+property (space written since a bookmark) and estimates of
+send stream sizes for incrementals from bookmarks.
+.Pp
+This feature becomes
+.Sy active
+when a bookmark is created and will be
+returned to the
+.Sy enabled
+state when all bookmarks with these fields are destroyed.
+.
+.feature org.openzfs device_rebuild yes
+This feature enables the ability for the
+.Nm zpool Cm attach
+and
+.Nm zpool Cm replace
+commands to perform sequential reconstruction
+(instead of healing reconstruction) when resilvering.
+.Pp
+Sequential reconstruction resilvers a device in LBA order without immediately
+verifying the checksums.
+Once complete, a scrub is started, which then verifies the checksums.
+This approach allows full redundancy to be restored to the pool
+in the minimum amount of time.
+This two-phase approach will take longer than a healing resilver
+when the time to verify the checksums is included.
+However, unless there is additional pool damage,
+no checksum errors should be reported by the scrub.
+This feature is incompatible with raidz configurations.
+.
+This feature becomes
+.Sy active
+while a sequential resilver is in progress, and returns to
+.Sy enabled
+when the resilver completes.
+.
+.feature com.delphix device_removal no
+This feature enables the
+.Nm zpool Cm remove
+command to remove top-level vdevs,
+evacuating them to reduce the total size of the pool.
+.Pp
+This feature becomes
+.Sy active
+when the
+.Nm zpool Cm remove
+command is used
+on a top-level vdev, and will never return to being
+.Sy enabled .
+.
+.feature org.openzfs draid no
+This feature enables use of the
+.Sy draid
+vdev type.
+dRAID is a variant of raidz which provides integrated distributed
+hot spares that allow faster resilvering while retaining the benefits of raidz.
+Data, parity, and spare space are organized in redundancy groups
+and distributed evenly over all of the devices.
+.Pp
+This feature becomes
+.Sy active
+when creating a pool which uses the
+.Sy draid
+vdev type, or when adding a new
+.Sy draid
+vdev to an existing pool.
+.
+.feature org.illumos edonr no extensible_dataset
+This feature enables the use of the Edon-R hash algorithm for checksum,
+including for nopwrite (if compression is also enabled, an overwrite of
+a block whose checksum matches the data being written will be ignored).
+In an abundance of caution, Edon-R requires verification when used with
+dedup:
+.Nm zfs Cm set Sy dedup Ns = Ns Sy edonr , Ns Sy verify
+.Po see Xr zfs-set 8 Pc .
+.Pp
+Edon-R is a very high-performance hash algorithm that was part
+of the NIST SHA-3 competition.
+It provides extremely high hash performance (over 350% faster than SHA-256),
+but was not selected because of its unsuitability
+as a general purpose secure hash algorithm.
+This implementation utilizes the new salted checksumming functionality
+in ZFS, which means that the checksum is pre-seeded with a secret
+256-bit random key (stored on the pool) before being fed the data block
+to be checksummed.
+Thus the produced checksums are unique to a given pool,
+preventing hash collision attacks on systems with dedup.
+.Pp
+.checksum-spiel edonr
+.Pp
+.Fx does not support the Sy edonr No feature.
+.
+.feature com.delphix embedded_data no
+This feature improves the performance and compression ratio of
+highly-compressible blocks.
+Blocks whose contents can compress to 112 bytes
+or smaller can take advantage of this feature.
+.Pp
+When this feature is enabled, the contents of highly-compressible blocks are
+stored in the block "pointer" itself (a misnomer in this case, as it contains
+the compressed data, rather than a pointer to its location on disk).
+Thus the space of the block (one sector, typically 512B or 4kB) is saved,
+and no additional I/O is needed to read and write the data block.
+.
+\*[instant-never]
+.
+.feature com.delphix empty_bpobj yes
+This feature increases the performance of creating and using a large
+number of snapshots of a single filesystem or volume, and also reduces
+the disk space required.
+.Pp
+When there are many snapshots, each snapshot uses many Block Pointer
+Objects (bpobjs) to track blocks associated with that snapshot.
+However, in common use cases, most of these bpobjs are empty.
+This feature allows us to create each bpobj on-demand,
+thus eliminating the empty bpobjs.
+.Pp
+This feature is
+.Sy active
+while there are any filesystems, volumes,
+or snapshots which were created after enabling this feature.
+.
+.feature com.delphix enabled_txg yes
+Once this feature is enabled, ZFS records the transaction group number
+in which new features are enabled.
+This has no user-visible impact, but other features may depend on this feature.
+.Pp
+This feature becomes
+.Sy active
+ as soon as it is enabled and will
+never return to being
+.Sy enabled .
+.
+.feature com.datto encryption no bookmark_v2 extensible_dataset
+This feature enables the creation and management of natively encrypted datasets.
+.Pp
+This feature becomes
+.Sy active
+when an encrypted dataset is created and will be returned to the
+.Sy enabled
+state when all datasets that use this feature are destroyed.
+.
+.feature com.delphix extensible_dataset no
+This feature allows more flexible use of internal ZFS data structures,
+and exists for other features to depend on.
+.Pp
+This feature will be
+.Sy active
+when the first dependent feature uses it, and will be returned to the
+.Sy enabled
+state when all datasets that use this feature are destroyed.
+.
+.feature com.joyent filesystem_limits yes extensible_dataset
+This feature enables filesystem and snapshot limits.
+These limits can be used to control how many filesystems and/or snapshots
+can be created at the point in the tree on which the limits are set.
+.Pp
+This feature is
+.Sy active
+once either of the limit properties has been set on a dataset.
+Once activated the feature is never deactivated.
+.
+.feature com.delphix hole_birth no enabled_txg
+This feature has/had bugs, the result of which is that, if you do a
+.Nm zfs Cm send Fl i
+.Pq or Fl R , No since it uses Fl i
+from an affected dataset, the receiving party will not see any checksum
+or other errors, but the resulting destination snapshot
+will not match the source.
+Its use by
+.Nm zfs Cm send Fl i
+has been disabled by default
+.Pq see Sy send_holes_without_birth_time No in Xr zfs 4 .
+.Pp
+This feature improves performance of incremental sends
+.Pq Nm zfs Cm send Fl i
+and receives for objects with many holes.
+The most common case of hole-filled objects is zvols.
+.Pp
+An incremental send stream from snapshot
+.Sy A No to snapshot Sy B
+contains information about every block that changed between
+.Sy A No and Sy B .
+Blocks which did not change between those snapshots can be
+identified and omitted from the stream using a piece of metadata called
+the "block birth time", but birth times are not recorded for holes
+(blocks filled only with zeroes).
+Since holes created after
+.Sy A No cannot be distinguished from holes created before Sy A ,
+information about every hole in the entire filesystem or zvol
+is included in the send stream.
+.Pp
+For workloads where holes are rare this is not a problem.
+However, when incrementally replicating filesystems or zvols with many holes
+(for example a zvol formatted with another filesystem) a lot of time will
+be spent sending and receiving unnecessary information about holes that
+already exist on the receiving side.
+.Pp
+Once the
+.Sy hole_birth
+feature has been enabled the block birth times
+of all new holes will be recorded.
+Incremental sends between snapshots created after this feature is enabled
+will use this new metadata to avoid sending information about holes that
+already exist on the receiving side.
+.Pp
+\*[instant-never]
+.
+.feature org.open-zfs large_blocks no extensible_dataset
+This feature allows the record size on a dataset to be set larger than 128kB.
+.Pp
+This feature becomes
+.Sy active
+once a dataset contains a file with a block size larger than 128kB,
+and will return to being
+.Sy enabled
+once all filesystems that have ever had their recordsize larger than 128kB
+are destroyed.
+.
+.feature org.zfsonlinux large_dnode no extensible_dataset
+This feature allows the size of dnodes in a dataset to be set larger than 512B.
+.
+This feature becomes
+.Sy active
+once a dataset contains an object with a dnode larger than 512B,
+which occurs as a result of setting the
+.Sy dnodesize
+dataset property to a value other than
+.Sy legacy .
+The feature will return to being
+.Sy enabled
+once all filesystems that have ever contained a dnode larger than 512B
+are destroyed.
+Large dnodes allow more data to be stored in the bonus buffer,
+thus potentially improving performance by avoiding the use of spill blocks.
+.
+.feature com.delphix livelist yes
+This feature allows clones to be deleted faster than the traditional method
+when a large number of random/sparse writes have been made to the clone.
+All blocks allocated and freed after a clone is created are tracked by the
+the clone's livelist which is referenced during the deletion of the clone.
+The feature is activated when a clone is created and remains
+.Sy active
+until all clones have been destroyed.
+.
+.feature com.delphix log_spacemap yes com.delphix:spacemap_v2
+This feature improves performance for heavily-fragmented pools,
+especially when workloads are heavy in random-writes.
+It does so by logging all the metaslab changes on a single spacemap every TXG
+instead of scattering multiple writes to all the metaslab spacemaps.
+.Pp
+\*[instant-never]
+.
+.feature org.illumos lz4_compress no
+.Sy lz4
+is a high-performance real-time compression algorithm that
+features significantly faster compression and decompression as well as a
+higher compression ratio than the older
+.Sy lzjb
+compression.
+Typically,
+.Sy lz4
+compression is approximately 50% faster on compressible data and 200% faster
+on incompressible data than
+.Sy lzjb .
+It is also approximately 80% faster on decompression,
+while giving approximately a 10% better compression ratio.
+.Pp
+When the
+.Sy lz4_compress
+feature is set to
+.Sy enabled ,
+the administrator can turn on
+.Sy lz4
+compression on any dataset on the pool using the
+.Xr zfs-set 8
+command.
+All newly written metadata will be compressed with the
+.Sy lz4
+algorithm.
+.Pp
+\*[instant-never]
+.
+.feature com.joyent multi_vdev_crash_dump no
+This feature allows a dump device to be configured with a pool comprised
+of multiple vdevs.
+Those vdevs may be arranged in any mirrored or raidz configuration.
+.Pp
+When the
+.Sy multi_vdev_crash_dump
+feature is set to
+.Sy enabled ,
+the administrator can use
+.Xr dumpadm 1M
+to configure a dump device on a pool comprised of multiple vdevs.
+.Pp
+Under
+.Fx
+and Linux this feature is unused, but registered for compatibility.
+New pools created on these systems will have the feature
+.Sy enabled
+but will never transition to
+.Sy active ,
+as this functionality is not required for crash dump support.
+Existing pools where this feature is
+.Sy active
+can be imported.
+.
+.feature com.delphix obsolete_counts yes device_removal
+This feature is an enhancement of
+.Sy device_removal ,
+which will over time reduce the memory used to track removed devices.
+When indirect blocks are freed or remapped,
+we note that their part of the indirect mapping is "obsolete" – no longer needed.
+.Pp
+This feature becomes
+.Sy active
+when the
+.Nm zpool Cm remove
+command is used on a top-level vdev, and will never return to being
+.Sy enabled .
+.
+.feature org.zfsonlinux project_quota yes extensible_dataset
+This feature allows administrators to account the spaces and objects usage
+information against the project identifier (ID).
+.Pp
+The project ID is an object-based attribute.
+When upgrading an existing filesystem,
+objects without a project ID will be assigned a zero project ID.
+When this feature is enabled, newly created objects inherit
+their parent directories' project ID if the parent's inherit flag is set
+.Pq via Nm chattr Sy [+-]P No or Nm zfs Cm project Fl s Ns | Ns Fl C .
+Otherwise, the new object's project ID will be zero.
+An object's project ID can be changed at any time by the owner
+(or privileged user) via
+.Nm chattr Fl p Ar prjid
+or
+.Nm zfs Cm project Fl p Ar prjid .
+.Pp
+This feature will become
+.Sy active
+as soon as it is enabled and will never return to being
+.Sy disabled .
+\*[remount-upgrade]
+.
+.feature com.delphix redaction_bookmarks no bookmarks extensible_dataset
+This feature enables the use of redacted
+.Nm zfs Cm send Ns s ,
+which create redaction bookmarks storing the list of blocks
+redacted by the send that created them.
+For more information about redacted sends, see
+.Xr zfs-send 8 .
+.
+.feature com.delphix redacted_datasets no extensible_dataset
+This feature enables the receiving of redacted
+.Nm zfs Cm send Ns
+streams. which create redacted datasets when received.
+These datasets are missing some of their blocks,
+and so cannot be safely mounted, and their contents cannot be safely read.
+For more information about redacted receives, see
+.Xr zfs-send 8 .
+.
+.feature com.datto resilver_defer yes
+This feature allows ZFS to postpone new resilvers if an existing one is already
+in progress.
+Without this feature, any new resilvers will cause the currently
+running one to be immediately restarted from the beginning.
+.Pp
+This feature becomes
+.Sy active
+once a resilver has been deferred, and returns to being
+.Sy enabled
+when the deferred resilver begins.
+.
+.feature org.illumos sha512 no extensible_dataset
+This feature enables the use of the SHA-512/256 truncated hash algorithm
+(FIPS 180-4) for checksum and dedup.
+The native 64-bit arithmetic of SHA-512 provides an approximate 50%
+performance boost over SHA-256 on 64-bit hardware
+and is thus a good minimum-change replacement candidate
+for systems where hash performance is important,
+but these systems cannot for whatever reason utilize the faster
+.Sy skein No and Sy edonr
+algorithms.
+.Pp
+.checksum-spiel sha512
+.
+.feature org.illumos skein no extensible_dataset
+This feature enables the use of the Skein hash algorithm for checksum and dedup.
+Skein is a high-performance secure hash algorithm that was a
+finalist in the NIST SHA-3 competition.
+It provides a very high security margin and high performance on 64-bit hardware
+(80% faster than SHA-256).
+This implementation also utilizes the new salted checksumming
+functionality in ZFS, which means that the checksum is pre-seeded with a
+secret 256-bit random key (stored on the pool) before being fed the data
+block to be checksummed.
+Thus the produced checksums are unique to a given pool,
+preventing hash collision attacks on systems with dedup.
+.Pp
+.checksum-spiel skein
+.
+.feature com.delphix spacemap_histogram yes
+This features allows ZFS to maintain more information about how free space
+is organized within the pool.
+If this feature is
+.Sy enabled ,
+it will be activated when a new space map object is created, or
+an existing space map is upgraded to the new format,
+and never returns back to being
+.Sy enabled .
+.
+.feature com.delphix spacemap_v2 yes
+This feature enables the use of the new space map encoding which
+consists of two words (instead of one) whenever it is advantageous.
+The new encoding allows space maps to represent large regions of
+space more efficiently on-disk while also increasing their maximum
+addressable offset.
+.Pp
+This feature becomes
+.Sy active
+once it is
+.Sy enabled ,
+and never returns back to being
+.Sy enabled .
+.
+.feature org.zfsonlinux userobj_accounting yes extensible_dataset
+This feature allows administrators to account the object usage information
+by user and group.
+.Pp
+\*[instant-never]
+\*[remount-upgrade]
+.
+.feature com.delphix zpool_checkpoint yes
+This feature enables the
+.Nm zpool Cm checkpoint
+command that can checkpoint the state of the pool
+at the time it was issued and later rewind back to it or discard it.
+.Pp
+This feature becomes
+.Sy active
+when the
+.Nm zpool Cm checkpoint
+command is used to checkpoint the pool.
+The feature will only return back to being
+.Sy enabled
+when the pool is rewound or the checkpoint has been discarded.
+.
+.feature org.freebsd zstd_compress no extensible_dataset
+.Sy zstd
+is a high-performance compression algorithm that features a
+combination of high compression ratios and high speed.
+Compared to
+.Sy gzip ,
+.Sy zstd
+offers slightly better compression at much higher speeds.
+Compared to
+.Sy lz4 ,
+.Sy zstd
+offers much better compression while being only modestly slower.
+Typically,
+.Sy zstd
+compression speed ranges from 250 to 500 MB/s per thread
+and decompression speed is over 1 GB/s per thread.
+.Pp
+When the
+.Sy zstd
+feature is set to
+.Sy enabled ,
+the administrator can turn on
+.Sy zstd
+compression of any dataset using
+.Nm zfs Cm set Sy compress Ns = Ns Sy zstd Ar dset
+.Po see Xr zfs-set 8 Pc .
+This feature becomes
+.Sy active
+once a
+.Sy compress
+property has been set to
+.Sy zstd ,
+and will return to being
+.Sy enabled
+once all filesystems that have ever had their
+.Sy compress
+property set to
+.Sy zstd
+are destroyed.
+.El
+.
+.Sh SEE ALSO
+.Xr zpool 8
diff --git a/sys/contrib/openzfs/man/man8/zpoolconcepts.8 b/sys/contrib/openzfs/man/man7/zpoolconcepts.7
index b1081714eacb..58132baf5025 100644
--- a/sys/contrib/openzfs/man/man8/zpoolconcepts.8
+++ b/sys/contrib/openzfs/man/man7/zpoolconcepts.7
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,18 +26,20 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
-.Dt ZPOOLCONCEPTS 8
+.Dd June 2, 2021
+.Dt ZPOOLCONCEPTS 7
.Os
+.
.Sh NAME
.Nm zpoolconcepts
.Nd overview of ZFS storage pools
+.
.Sh DESCRIPTION
.Ss Virtual Devices (vdevs)
A "virtual device" describes a single device or a collection of devices
organized according to certain performance and fault characteristics.
The following virtual devices are supported:
-.Bl -tag -width Ds
+.Bl -tag -width "special"
.It Sy disk
A block device, typically located under
.Pa /dev .
@@ -58,13 +59,14 @@ When given a whole disk, ZFS automatically labels the disk, if necessary.
A regular file.
The use of files as a backing store is strongly discouraged.
It is designed primarily for experimental purposes, as the fault tolerance of a
-file is only as good as the file system of which it is a part.
+file is only as good as the file system on which it resides.
A file must be specified by a full path.
.It Sy mirror
A mirror of two or more devices.
Data is replicated in an identical fashion across all components of a mirror.
-A mirror with N disks of size X can hold X bytes and can withstand (N-1) devices
-failing without losing data.
+A mirror with
+.Em N No disks of size Em X No can hold Em X No bytes and can withstand Em N-1
+devices failing without losing data.
.It Sy raidz , raidz1 , raidz2 , raidz3
A variation on RAID-5 that allows for better distribution of parity and
eliminates the RAID-5
@@ -72,7 +74,7 @@ eliminates the RAID-5
.Pq in which data and parity become inconsistent after a power loss .
Data and parity is striped across all disks within a raidz group.
.Pp
-A raidz group can have single-, double-, or triple-parity, meaning that the
+A raidz group can have single, double, or triple parity, meaning that the
raidz group can sustain one, two, or three failures, respectively, without
losing any data.
The
@@ -87,39 +89,42 @@ The
vdev type is an alias for
.Sy raidz1 .
.Pp
-A raidz group with N disks of size X with P parity disks can hold approximately
-(N-P)*X bytes and can withstand P device(s) failing without losing data.
+A raidz group with
+.Em N No disks of size Em X No with Em P No parity disks can hold approximately
+.Em (N-P)*X No bytes and can withstand Em P No devices failing without losing data.
The minimum number of devices in a raidz group is one more than the number of
parity disks.
The recommended number is between 3 and 9 to help increase performance.
.It Sy draid , draid1 , draid2 , draid3
A variant of raidz that provides integrated distributed hot spares which
allows for faster resilvering while retaining the benefits of raidz.
-A dRAID vdev is constructed from multiple internal raidz groups, each with D
-data devices and P parity devices.
+A dRAID vdev is constructed from multiple internal raidz groups, each with
+.Em D No data devices and Em P No parity devices.
These groups are distributed over all of the children in order to fully
utilize the available disk performance.
.Pp
Unlike raidz, dRAID uses a fixed stripe width (padding as necessary with
zeros) to allow fully sequential resilvering.
This fixed stripe width significantly effects both usable capacity and IOPS.
-For example, with the default D=8 and 4k disk sectors the minimum allocation
-size is 32k.
+For example, with the default
+.Em D=8 No and Em 4kB No disk sectors the minimum allocation size is Em 32kB .
If using compression, this relatively large allocation size can reduce the
effective compression ratio.
-When using ZFS volumes and dRAID the default volblocksize property is increased
-to account for the allocation size.
+When using ZFS volumes and dRAID, the default of the
+.Sy volblocksize
+property is increased to account for the allocation size.
If a dRAID pool will hold a significant amount of small blocks, it is
recommended to also add a mirrored
.Sy special
vdev to store those blocks.
.Pp
-In regards to IO/s, performance is similar to raidz since for any read all D
-data disks must be accessed.
+In regards to I/O, performance is similar to raidz since for any read all
+.Em D No data disks must be accessed.
Delivered random IOPS can be reasonably approximated as
-floor((N-S)/(D+P))*<single-drive-IOPS>.
+.Sy floor((N-S)/(D+P))*single_drive_IOPS .
.Pp
-Like raidz a dRAID can have single-, double-, or triple-parity. The
+Like raidzm a dRAID can have single-, double-, or triple-parity.
+The
.Sy draid1 ,
.Sy draid2 ,
and
@@ -130,33 +135,34 @@ The
vdev type is an alias for
.Sy draid1 .
.Pp
-A dRAID with N disks of size X, D data disks per redundancy group, P parity
-level, and S distributed hot spares can hold approximately (N-S)*(D/(D+P))*X
-bytes and can withstand P device(s) failing without losing data.
-.It Sy draid[<parity>][:<data>d][:<children>c][:<spares>s]
+A dRAID with
+.Em N No disks of size Em X , D No data disks per redundancy group, Em P
+.No parity level, and Em S No distributed hot spares can hold approximately
+.Em (N-S)*(D/(D+P))*X No bytes and can withstand Em P
+devices failing without losing data.
+.It Sy draid Ns Oo Ar parity Oc Ns Oo Sy \&: Ns Ar data Ns Sy d Oc Ns Oo Sy \&: Ns Ar children Ns Sy c Oc Ns Oo Sy \&: Ns Ar spares Ns Sy s Oc
A non-default dRAID configuration can be specified by appending one or more
of the following optional arguments to the
.Sy draid
-keyword.
-.Pp
-.Em parity
-- The parity level (1-3).
-.Pp
-.Em data
-- The number of data devices per redundancy group.
-In general a smaller value of D will increase IOPS, improve the compression ratio, and speed up resilvering at the expense of total usable capacity.
-Defaults to 8, unless N-P-S is less than 8.
-.Pp
-.Em children
-- The expected number of children.
+keyword:
+.Bl -tag -compact -width "children"
+.It Ar parity
+The parity level (1-3).
+.It Ar data
+The number of data devices per redundancy group.
+In general, a smaller value of
+.Em D No will increase IOPS, improve the compression ratio,
+and speed up resilvering at the expense of total usable capacity.
+Defaults to
+.Em 8 , No unless Em N-P-S No is less than Em 8 .
+.It Ar children
+The expected number of children.
Useful as a cross-check when listing a large number of devices.
An error is returned when the provided number of children differs.
-.Pp
-.Em spares
-- The number of distributed hot spares.
+.It Ar spares
+The number of distributed hot spares.
Defaults to zero.
-.Pp
-.Pp
+.El
.It Sy spare
A pseudo-vdev which keeps track of available hot spares for a pool.
For more information, see the
@@ -174,13 +180,15 @@ section.
.It Sy dedup
A device dedicated solely for deduplication tables.
The redundancy of this device should match the redundancy of the other normal
-devices in the pool. If more than one dedup device is specified, then
+devices in the pool.
+If more than one dedup device is specified, then
allocations are load-balanced between those devices.
.It Sy special
A device dedicated solely for allocating various kinds of internal metadata,
and optionally small file blocks.
The redundancy of this device should match the redundancy of the other normal
-devices in the pool. If more than one special device is specified, then
+devices in the pool.
+If more than one special device is specified, then
allocations are load-balanced between those devices.
.Pp
For more information on special allocations, see the
@@ -209,17 +217,15 @@ among devices.
As new virtual devices are added, ZFS automatically places data on the newly
available devices.
.Pp
-Virtual devices are specified one at a time on the command line, separated by
-whitespace.
-The keywords
-.Sy mirror
-and
-.Sy raidz
+Virtual devices are specified one at a time on the command line,
+separated by whitespace.
+Keywords like
+.Sy mirror No and Sy raidz
are used to distinguish where a group ends and another begins.
-For example, the following creates two root vdevs, each a mirror of two disks:
-.Bd -literal
-# zpool create mypool mirror sda sdb mirror sdc sdd
-.Ed
+For example, the following creates a pool with two root vdevs,
+each a mirror of two disks:
+.Dl # Nm zpool Cm create Ar mypool Sy mirror Ar sda sdb Sy mirror Ar sdc sdd
+.
.Ss Device Failure and Recovery
ZFS supports a rich set of mechanisms for handling device failure and data
corruption.
@@ -232,17 +238,17 @@ While ZFS supports running in a non-redundant configuration, where each root
vdev is simply a disk or file, this is strongly discouraged.
A single case of bit corruption can render some or all of your data unavailable.
.Pp
-A pool's health status is described by one of three states: online, degraded,
-or faulted.
+A pool's health status is described by one of three states:
+.Sy online , degraded , No or Sy faulted .
An online pool has all devices operating normally.
A degraded pool is one in which one or more devices have failed, but the data is
still available due to a redundant configuration.
A faulted pool has corrupted metadata, or one or more faulted devices, and
insufficient replicas to continue functioning.
.Pp
-The health of the top-level vdev, such as mirror or raidz device, is
-potentially impacted by the state of its associated vdevs, or component
-devices.
+The health of the top-level vdev, such as a mirror or raidz device,
+is potentially impacted by the state of its associated vdevs,
+or component devices.
A top-level vdev or component device is in one of the following states:
.Bl -tag -width "DEGRADED"
.It Sy DEGRADED
@@ -253,7 +259,7 @@ Sufficient replicas exist to continue functioning.
One or more component devices is in the degraded or faulted state, but
sufficient replicas exist to continue functioning.
The underlying conditions are as follows:
-.Bl -bullet
+.Bl -bullet -compact
.It
The number of checksum errors exceeds acceptable levels and the device is
degraded as an indication that something may be wrong.
@@ -271,7 +277,7 @@ Insufficient replicas exist to continue functioning.
One or more component devices is in the faulted state, and insufficient
replicas exist to continue functioning.
The underlying conditions are as follows:
-.Bl -bullet
+.Bl -bullet -compact
.It
The device could be opened, but the contents did not match expected values.
.It
@@ -303,19 +309,20 @@ The checksum errors are reported in
and
.Nm zpool Cm events .
When a block is stored redundantly, a damaged block may be reconstructed
-(e.g. from RAIDZ parity or a mirrored copy).
+(e.g. from raidz parity or a mirrored copy).
In this case, ZFS reports the checksum error against the disks that contained
damaged data.
If a block is unable to be reconstructed (e.g. due to 3 disks being damaged
-in a RAIDZ2 group), it is not possible to determine which disks were silently
+in a raidz2 group), it is not possible to determine which disks were silently
corrupted.
In this case, checksum errors are reported for all disks on which the block
is stored.
.Pp
-If a device is removed and later re-attached to the system, ZFS attempts
-to put the device online automatically.
-Device attach detection is hardware-dependent and might not be supported on all
-platforms.
+If a device is removed and later re-attached to the system,
+ZFS attempts online the device automatically.
+Device attachment detection is hardware-dependent
+and might not be supported on all platforms.
+.
.Ss Hot Spares
ZFS allows devices to be associated with pools as
.Qq hot spares .
@@ -325,9 +332,7 @@ To create a pool with hot spares, specify a
.Sy spare
vdev with any number of devices.
For example,
-.Bd -literal
-# zpool create pool mirror sda sdb spare sdc sdd
-.Ed
+.Dl # Nm zpool Cm create Ar pool Sy mirror Ar sda sdb Sy spare Ar sdc sdd
.Pp
Spares can be shared across multiple pools, and can be added with the
.Nm zpool Cm add
@@ -344,10 +349,11 @@ If a pool has a shared spare that is currently being used, the pool can not be
exported since other pools may use this shared spare, which may lead to
potential data corruption.
.Pp
-Shared spares add some risk. If the pools are imported on different hosts, and
-both pools suffer a device failure at the same time, both could attempt to use
-the spare at the same time. This may not be detected, resulting in data
-corruption.
+Shared spares add some risk.
+If the pools are imported on different hosts,
+and both pools suffer a device failure at the same time,
+both could attempt to use the spare at the same time.
+This may not be detected, resulting in data corruption.
.Pp
An in-progress spare replacement can be cancelled by detaching the hot spare.
If the original faulted device is detached, then the hot spare assumes its
@@ -357,12 +363,14 @@ pools.
The
.Sy draid
vdev type provides distributed hot spares.
-These hot spares are named after the dRAID vdev they're a part of (
-.Qq draid1-2-3 specifies spare 3 of vdev 2, which is a single parity dRAID
-) and may only be used by that dRAID vdev.
+These hot spares are named after the dRAID vdev they're a part of
+.Po Sy draid1 Ns - Ns Ar 2 Ns - Ns Ar 3 No specifies spare Ar 3 No of vdev Ar 2 ,
+.No which is a single parity dRAID Pc
+and may only be used by that dRAID vdev.
Otherwise, they behave the same as normal hot spares.
.Pp
Spares cannot replace log devices.
+.
.Ss Intent Log
The ZFS Intent Log (ZIL) satisfies POSIX requirements for synchronous
transactions.
@@ -375,26 +383,25 @@ By default, the intent log is allocated from blocks within the main pool.
However, it might be possible to get better performance using separate intent
log devices such as NVRAM or a dedicated disk.
For example:
-.Bd -literal
-# zpool create pool sda sdb log sdc
-.Ed
+.Dl # Nm zpool Cm create Ar pool sda sdb Sy log Ar sdc
.Pp
Multiple log devices can also be specified, and they can be mirrored.
See the
.Sx EXAMPLES
section for an example of mirroring multiple log devices.
.Pp
-Log devices can be added, replaced, attached, detached and removed. In
-addition, log devices are imported and exported as part of the pool
+Log devices can be added, replaced, attached, detached and removed.
+In addition, log devices are imported and exported as part of the pool
that contains them.
Mirrored devices can be removed by specifying the top-level mirror vdev.
+.
.Ss Cache Devices
Devices can be added to a storage pool as
.Qq cache devices .
These devices provide an additional layer of caching between main memory and
disk.
For read-heavy workloads, where the working set size is much larger than what
-can be cached in main memory, using cache devices allow much more of this
+can be cached in main memory, using cache devices allows much more of this
working set to be served from low latency media.
Using cache devices provides the greatest performance improvement for random
read-workloads of mostly static content.
@@ -403,9 +410,7 @@ To create a pool with cache devices, specify a
.Sy cache
vdev with any number of devices.
For example:
-.Bd -literal
-# zpool create pool sda sdb cache sdc sdd
-.Ed
+.Dl # Nm zpool Cm create Ar pool sda sdb Sy cache Ar sdc sdd
.Pp
Cache devices cannot be mirrored or part of a raidz configuration.
If a read error is encountered on a cache device, that read I/O is reissued to
@@ -415,29 +420,36 @@ configuration.
The content of the cache devices is persistent across reboots and restored
asynchronously when importing the pool in L2ARC (persistent L2ARC).
This can be disabled by setting
-.Sy l2arc_rebuild_enabled = 0 .
-For cache devices smaller than 1GB we do not write the metadata structures
-required for rebuilding the L2ARC in order not to waste space. This can be
-changed with
+.Sy l2arc_rebuild_enabled Ns = Ns Sy 0 .
+For cache devices smaller than
+.Em 1GB ,
+we do not write the metadata structures
+required for rebuilding the L2ARC in order not to waste space.
+This can be changed with
.Sy l2arc_rebuild_blocks_min_l2size .
-The cache device header (512 bytes) is updated even if no metadata structures
-are written. Setting
-.Sy l2arc_headroom = 0
+The cache device header
+.Pq Em 512B
+is updated even if no metadata structures are written.
+Setting
+.Sy l2arc_headroom Ns = Ns Sy 0
will result in scanning the full-length ARC lists for cacheable content to be
-written in L2ARC (persistent ARC). If a cache device is added with
+written in L2ARC (persistent ARC).
+If a cache device is added with
.Nm zpool Cm add
its label and header will be overwritten and its contents are not going to be
-restored in L2ARC, even if the device was previously part of the pool. If a
-cache device is onlined with
+restored in L2ARC, even if the device was previously part of the pool.
+If a cache device is onlined with
.Nm zpool Cm online
-its contents will be restored in L2ARC. This is useful in case of memory pressure
+its contents will be restored in L2ARC.
+This is useful in case of memory pressure
where the contents of the cache device are not fully restored in L2ARC.
-The user can off/online the cache device when there is less memory pressure
+The user can off- and online the cache device when there is less memory pressure
in order to fully restore its contents to L2ARC.
+.
.Ss Pool checkpoint
-Before starting critical procedures that include destructive actions (e.g
-.Nm zfs Cm destroy
-), an administrator can checkpoint the pool's state and in the case of a
+Before starting critical procedures that include destructive actions
+.Pq like Nm zfs Cm destroy ,
+an administrator can checkpoint the pool's state and in the case of a
mistake or failure, rewind the entire pool back to the checkpoint.
Otherwise, the checkpoint can be discarded when the procedure has completed
successfully.
@@ -445,59 +457,56 @@ successfully.
A pool checkpoint can be thought of as a pool-wide snapshot and should be used
with care as it contains every part of the pool's state, from properties to vdev
configuration.
-Thus, while a pool has a checkpoint certain operations are not allowed.
+Thus, certain operations are not allowed while a pool has a checkpoint.
Specifically, vdev removal/attach/detach, mirror splitting, and
-changing the pool's guid.
-Adding a new vdev is supported but in the case of a rewind it will have to be
+changing the pool's GUID.
+Adding a new vdev is supported, but in the case of a rewind it will have to be
added again.
Finally, users of this feature should keep in mind that scrubs in a pool that
has a checkpoint do not repair checkpointed data.
.Pp
To create a checkpoint for a pool:
-.Bd -literal
-# zpool checkpoint pool
-.Ed
+.Dl # Nm zpool Cm checkpoint Ar pool
.Pp
To later rewind to its checkpointed state, you need to first export it and
then rewind it during import:
-.Bd -literal
-# zpool export pool
-# zpool import --rewind-to-checkpoint pool
-.Ed
+.Dl # Nm zpool Cm export Ar pool
+.Dl # Nm zpool Cm import Fl -rewind-to-checkpoint Ar pool
.Pp
To discard the checkpoint from a pool:
-.Bd -literal
-# zpool checkpoint -d pool
-.Ed
+.Dl # Nm zpool Cm checkpoint Fl d Ar pool
.Pp
Dataset reservations (controlled by the
-.Nm reservation
-or
-.Nm refreservation
-zfs properties) may be unenforceable while a checkpoint exists, because the
+.Sy reservation No and Sy refreservation
+properties) may be unenforceable while a checkpoint exists, because the
checkpoint is allowed to consume the dataset's reservation.
Finally, data that is part of the checkpoint but has been freed in the
current state of the pool won't be scanned during a scrub.
+.
.Ss Special Allocation Class
-The allocations in the special class are dedicated to specific block types.
+Allocations in the special class are dedicated to specific block types.
By default this includes all metadata, the indirect blocks of user data, and
-any deduplication tables. The class can also be provisioned to accept
-small file blocks.
-.Pp
-A pool must always have at least one normal (non-dedup/special) vdev before
-other devices can be assigned to the special class. If the special class
-becomes full, then allocations intended for it will spill back into the
-normal class.
+any deduplication tables.
+The class can also be provisioned to accept small file blocks.
+.Pp
+A pool must always have at least one normal
+.Pq non- Ns Sy dedup Ns /- Ns Sy special
+vdev before
+other devices can be assigned to the special class.
+If the
+.Sy special
+class becomes full, then allocations intended for it
+will spill back into the normal class.
.Pp
-Deduplication tables can be excluded from the special class by setting the
+Deduplication tables can be excluded from the special class by unsetting the
.Sy zfs_ddt_data_is_special
-zfs module parameter to false (0).
+ZFS module parameter.
.Pp
-Inclusion of small file blocks in the special class is opt-in. Each dataset
-can control the size of small file blocks allowed in the special class by
-setting the
+Inclusion of small file blocks in the special class is opt-in.
+Each dataset can control the size of small file blocks allowed
+in the special class by setting the
.Sy special_small_blocks
-dataset property. It defaults to zero, so you must opt-in by setting it to a
-non-zero value. See
-.Xr zfs 8
-for more info on setting this property.
+property to nonzero.
+See
+.Xr zfsprops 7
+for more info on this property.
diff --git a/sys/contrib/openzfs/man/man8/zpoolprops.8 b/sys/contrib/openzfs/man/man7/zpoolprops.7
index 20e0d74421ae..513f02e0314f 100644
--- a/sys/contrib/openzfs/man/man8/zpoolprops.8
+++ b/sys/contrib/openzfs/man/man7/zpoolprops.7
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -28,19 +27,21 @@
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\" Copyright (c) 2021, Colm Buckley <colm@tuatha.org>
.\"
-.Dd August 9, 2019
-.Dt ZPOOLPROPS 8
+.Dd May 27, 2021
+.Dt ZPOOLPROPS 7
.Os
+.
.Sh NAME
.Nm zpoolprops
-.Nd available properties for ZFS storage pools
+.Nd properties of ZFS storage pools
+.
.Sh DESCRIPTION
Each pool has several properties associated with it.
Some properties are read-only statistics while others are configurable and
change the behavior of the pool.
.Pp
The following are read-only properties:
-.Bl -tag -width Ds
+.Bl -tag -width "unsupported@guid"
.It Cm allocated
Amount of storage used within the pool.
See
@@ -65,11 +66,13 @@ The space can be claimed for the pool by bringing it online with
or using
.Nm zpool Cm online Fl e .
.It Sy fragmentation
-The amount of fragmentation in the pool. As the amount of space
+The amount of fragmentation in the pool.
+As the amount of space
.Sy allocated
increases, it becomes more difficult to locate
.Sy free
-space. This may result in lower write performance compared to pools with more
+space.
+This may result in lower write performance compared to pools with more
unfragmented free space.
.It Sy free
The amount of free space available in the pool.
@@ -81,11 +84,12 @@ The zpool
.Sy free
property is not generally useful for this purpose, and can be substantially more than the zfs
.Sy available
-space. This discrepancy is due to several factors, including raidz parity; zfs
-reservation, quota, refreservation, and refquota properties; and space set aside by
+space.
+This discrepancy is due to several factors, including raidz parity;
+zfs reservation, quota, refreservation, and refquota properties; and space set aside by
.Sy spa_slop_shift
(see
-.Xr zfs-module-parameters 5
+.Xr zfs 4
for more information).
.It Sy freeing
After a file system or snapshot is destroyed, the space it was using is
@@ -107,17 +111,17 @@ A unique identifier for the pool.
A unique identifier for the pool.
Unlike the
.Sy guid
-property, this identifier is generated every time we load the pool (e.g. does
+property, this identifier is generated every time we load the pool (i.e. does
not persist across imports/exports) and never changes while the pool is loaded
(even if a
.Sy reguid
operation takes place).
.It Sy size
Total size of the storage pool.
-.It Sy unsupported@ Ns Em feature_guid
+.It Sy unsupported@ Ns Em guid
Information about unsupported features that are enabled on the pool.
See
-.Xr zpool-features 5
+.Xr zpool-features 7
for details.
.El
.Pp
@@ -173,22 +177,27 @@ command:
Pool sector size exponent, to the power of
.Sy 2
(internally referred to as
-.Sy ashift
-). Values from 9 to 16, inclusive, are valid; also, the
+.Sy ashift ) .
+Values from 9 to 16, inclusive, are valid; also, the
value 0 (the default) means to auto-detect using the kernel's block
-layer and a ZFS internal exception list. I/O operations will be aligned
-to the specified size boundaries. Additionally, the minimum (disk)
+layer and a ZFS internal exception list.
+I/O operations will be aligned to the specified size boundaries.
+Additionally, the minimum (disk)
write size will be set to the specified size, so this represents a
-space vs. performance trade-off. For optimal performance, the pool
-sector size should be greater than or equal to the sector size of the
-underlying disks. The typical case for setting this property is when
+space vs. performance trade-off.
+For optimal performance, the pool sector size should be greater than
+or equal to the sector size of the underlying disks.
+The typical case for setting this property is when
performance is important and the underlying disks use 4KiB sectors but
report 512B sectors to the OS (for compatibility reasons); in that
case, set
-.Sy ashift=12
-(which is 1<<12 = 4096). When set, this property is
+.Sy ashift Ns = Ns Sy 12
+(which is
+.Sy 1<<12 No = Sy 4096 ) .
+When set, this property is
used as the default hint value in subsequent vdev operations (add,
-attach and replace). Changing this value will not modify any existing
+attach and replace).
+Changing this value will not modify any existing
vdev, not even on disk replacement; however it can be used, for
instance, to replace a dying 512B sectors disk with a newer 4KiB
sectors device: this will probably result in bad performance but at the
@@ -222,40 +231,44 @@ This property can also be referred to by its shortened column name,
.Sy replace .
Autoreplace can also be used with virtual disks (like device
mapper) provided that you use the /dev/disk/by-vdev paths setup by
-vdev_id.conf. See the
+vdev_id.conf.
+See the
.Xr vdev_id 8
-man page for more details.
+manual page for more details.
Autoreplace and autoonline require the ZFS Event Daemon be configured and
-running. See the
+running.
+See the
.Xr zed 8
-man page for more details.
+manual page for more details.
.It Sy autotrim Ns = Ns Sy on Ns | Ns Sy off
When set to
.Sy on
space which has been recently freed, and is no longer allocated by the pool,
-will be periodically trimmed. This allows block device vdevs which support
+will be periodically trimmed.
+This allows block device vdevs which support
BLKDISCARD, such as SSDs, or file vdevs on which the underlying file system
-supports hole-punching, to reclaim unused blocks. The default setting for
-this property is
+supports hole-punching, to reclaim unused blocks.
+The default value for this property is
.Sy off .
.Pp
-Automatic TRIM does not immediately reclaim blocks after a free. Instead,
-it will optimistically delay allowing smaller ranges to be aggregated in to
-a few larger ones. These can then be issued more efficiently to the storage.
+Automatic TRIM does not immediately reclaim blocks after a free.
+Instead, it will optimistically delay allowing smaller ranges to be aggregated
+into a few larger ones.
+These can then be issued more efficiently to the storage.
TRIM on L2ARC devices is enabled by setting
.Sy l2arc_trim_ahead > 0 .
.Pp
Be aware that automatic trimming of recently freed data blocks can put
-significant stress on the underlying storage devices. This will vary
-depending of how well the specific device handles these commands. For
-lower end devices it is often possible to achieve most of the benefits
+significant stress on the underlying storage devices.
+This will vary depending of how well the specific device handles these commands.
+For lower-end devices it is often possible to achieve most of the benefits
of automatic trimming by running an on-demand (manual) TRIM periodically
using the
.Nm zpool Cm trim
command.
-.It Sy bootfs Ns = Ns Sy (unset) Ns | Ns Ar pool Ns / Ns Ar dataset
-Identifies the default bootable dataset for the root pool. This property is
-expected to be set mainly by the installation and upgrade programs.
+.It Sy bootfs Ns = Ns Sy (unset) Ns | Ns Ar pool Ns Op / Ns Ar dataset
+Identifies the default bootable dataset for the root pool.
+This property is expected to be set mainly by the installation and upgrade programs.
Not all Linux distribution boot processes use the bootfs property.
.It Sy cachefile Ns = Ns Ar path Ns | Ns Sy none
Controls the location of where the pool configuration is cached.
@@ -286,20 +299,24 @@ A text string consisting of printable ASCII characters that will be stored
such that it is available even if the pool becomes faulted.
An administrator can provide additional information about a pool using this
property.
-.It Sy compatibility Ns = Ns Ar off | legacy | file Bq , Ns Ar file Ns ...
+.It Sy compatibility Ns = Ns Sy off Ns | Ns Sy legacy Ns | Ns Ar file Ns Oo , Ns Ar file Oc Ns …
Specifies that the pool maintain compatibility with specific feature sets.
When set to
.Sy off
-(or unset); compatibility is disabled (all features are enabled); when set to
-.Sy legacy Ns ;
-no features are enabled. When set to a comma-separated list of
-filenames (each filename may either be an absolute path, or relative to
-.Pa /etc/zfs/compatibility.d or Pa /usr/share/zfs/compatibility.d Ns )
+(or unset) compatibility is disabled (all features may be enabled); when set to
+.Sy legacy Ns
+no features may be enabled.
+When set to a comma-separated list of filenames
+(each filename may either be an absolute path, or relative to
+.Pa /etc/zfs/compatibility.d
+or
+.Pa /usr/share/zfs/compatibility.d )
the lists of requested features are read from those files, separated by
-whitespace and/or commas. Only features present in all files are enabled.
-
+whitespace and/or commas.
+Only features present in all files may be enabled.
+.Pp
See
-.Xr zpool-features 5 Ns ,
+.Xr zpool-features 7 ,
.Xr zpool-create 8
and
.Xr zpool-upgrade 8
@@ -340,7 +357,7 @@ which moves
.Ar feature_name
to the enabled state.
See
-.Xr zpool-features 5
+.Xr zpool-features 7
for details on feature states.
.It Sy listsnapshots Ns = Ns Sy on Ns | Ns Sy off
Controls whether information about snapshots associated with this pool is
@@ -358,25 +375,30 @@ Controls whether a pool activity check should be performed during
.Nm zpool Cm import .
When a pool is determined to be active it cannot be imported, even with the
.Fl f
-option. This property is intended to be used in failover configurations
+option.
+This property is intended to be used in failover configurations
where multiple hosts have access to a pool on shared storage.
.Pp
-Multihost provides protection on import only. It does not protect against an
+Multihost provides protection on import only.
+It does not protect against an
individual device being used in multiple pools, regardless of the type of vdev.
See the discussion under
-.Sy zpool create.
+.Nm zpool Cm create .
.Pp
When this property is on, periodic writes to storage occur to show the pool is
-in use. See
+in use.
+See
.Sy zfs_multihost_interval
in the
-.Xr zfs-module-parameters 5
-man page. In order to enable this property each host must set a unique hostid.
+.Xr zfs 4
+manual page.
+In order to enable this property each host must set a unique hostid.
See
.Xr genhostid 1
.Xr zgenhostid 8
-.Xr spl-module-parameters 5
-for additional details. The default value is
+.Xr spl 4
+for additional details.
+The default value is
.Sy off .
.It Sy version Ns = Ns Ar version
The current on-disk version of the pool.
diff --git a/sys/contrib/openzfs/man/man8/Makefile.am b/sys/contrib/openzfs/man/man8/Makefile.am
deleted file mode 100644
index 602645180beb..000000000000
--- a/sys/contrib/openzfs/man/man8/Makefile.am
+++ /dev/null
@@ -1,102 +0,0 @@
-include $(top_srcdir)/config/Substfiles.am
-
-dist_man_MANS = \
- fsck.zfs.8 \
- mount.zfs.8 \
- vdev_id.8 \
- zdb.8 \
- zfs.8 \
- zfsconcepts.8 \
- zfsprops.8 \
- zfs-allow.8 \
- zfs-bookmark.8 \
- zfs-change-key.8 \
- zfs-clone.8 \
- zfs-create.8 \
- zfs-destroy.8 \
- zfs-diff.8 \
- zfs-get.8 \
- zfs-groupspace.8 \
- zfs-hold.8 \
- zfs-inherit.8 \
- zfs-jail.8 \
- zfs-list.8 \
- zfs-load-key.8 \
- zfs-mount.8 \
- zfs-program.8 \
- zfs-project.8 \
- zfs-projectspace.8 \
- zfs-promote.8 \
- zfs-receive.8 \
- zfs-recv.8 \
- zfs-redact.8 \
- zfs-release.8 \
- zfs-rename.8 \
- zfs-rollback.8 \
- zfs-send.8 \
- zfs-set.8 \
- zfs-share.8 \
- zfs-snapshot.8 \
- zfs-unallow.8 \
- zfs-unjail.8 \
- zfs-unload-key.8 \
- zfs-unmount.8 \
- zfs-upgrade.8 \
- zfs-userspace.8 \
- zfs-wait.8 \
- zfs_ids_to_path.8 \
- zgenhostid.8 \
- zinject.8 \
- zpool.8 \
- zpoolconcepts.8 \
- zpoolprops.8 \
- zpool-add.8 \
- zpool-attach.8 \
- zpool-checkpoint.8 \
- zpool-clear.8 \
- zpool-create.8 \
- zpool-destroy.8 \
- zpool-detach.8 \
- zpool-events.8 \
- zpool-export.8 \
- zpool-get.8 \
- zpool-history.8 \
- zpool-import.8 \
- zpool-initialize.8 \
- zpool-iostat.8 \
- zpool-labelclear.8 \
- zpool-list.8 \
- zpool-offline.8 \
- zpool-online.8 \
- zpool-reguid.8 \
- zpool-remove.8 \
- zpool-reopen.8 \
- zpool-replace.8 \
- zpool-resilver.8 \
- zpool-scrub.8 \
- zpool-set.8 \
- zpool-split.8 \
- zpool-status.8 \
- zpool-sync.8 \
- zpool-trim.8 \
- zpool-upgrade.8 \
- zpool-wait.8 \
- zstream.8 \
- zstreamdump.8 \
- zpool_influxdb.8
-
-nodist_man_MANS = \
- zed.8 \
- zfs-mount-generator.8
-
-SUBSTFILES += $(nodist_man_MANS)
-
-if BUILD_LINUX
-# The man pager in most Linux distros defaults to BSD instead of Linux
-# when .Os is blank, but leaving it blank makes things a lot easier on
-# FreeBSD when OpenZFS is vendored in the base system.
-install-data-hook:
- cd $(DESTDIR)$(mandir)/man8; \
- $(SED) ${ac_inplace} -e 's/^\.Os$$/.Os Linux/' \
- $(dist_man_MANS) $(nodist_man_MANS)
-endif
diff --git a/sys/contrib/openzfs/man/man8/fsck.zfs.8 b/sys/contrib/openzfs/man/man8/fsck.zfs.8
index 934abc6772e8..0ce7576ebe63 100644
--- a/sys/contrib/openzfs/man/man8/fsck.zfs.8
+++ b/sys/contrib/openzfs/man/man8/fsck.zfs.8
@@ -1,4 +1,3 @@
-'\" t
.\"
.\" CDDL HEADER START
.\"
@@ -19,53 +18,60 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright 2013 Darik Horn <dajhorn@vanadac.com>. All rights reserved.
.\"
-.TH FSCK.ZFS 8 "Mar 27, 2021" OpenZFS
-
-.SH NAME
-fsck.zfs \- Dummy ZFS filesystem checker.
-
-.SH SYNOPSIS
-.LP
-.BI "fsck.zfs [" "options" "] <" "dataset" ">…"
-
-.SH DESCRIPTION
-.LP
-\fBfsck.zfs\fR is a thin shell wrapper that at most checks the status of a
-dataset's container pool. It is installed by OpenZFS because some Linux
+.Dd May 26, 2021
+.Dt FSCK.ZFS 8
+.Os
+.
+.Sh NAME
+.Nm fsck.zfs
+.Nd dummy ZFS filesystem checker
+.Sh SYNOPSIS
+.Nm
+.Op Ar options
+.Ar dataset Ns No …
+.
+.Sh DESCRIPTION
+.Nm
+is a thin shell wrapper that at most checks the status of a dataset's container pool.
+It is installed by OpenZFS because some Linux
distributions expect a fsck helper for all filesystems.
-.LP
-If more than one \fIdataset\fR is specified, each is checked in turn
-and results binary ored.
-
-.SH OPTIONS
-.HP
-All \fIoptions\fR are ignored.
-
-.SH "NOTES"
-.LP
-ZFS datasets are checked by running \fBzpool scrub\fR on the
-containing pool. An individual ZFS dataset is never checked
-independently of its pool, which is unlike a regular filesystem.
-
-.LP
+.Pp
+If more than one
+.Ar dataset
+is specified, each is checked in turn and the results binary-ored.
+.
+.Sh OPTIONS
+Ignored.
+.
+.Sh NOTES
+ZFS datasets are checked by running
+.Nm zpool Cm scrub
+on the containing pool.
+An individual ZFS dataset is never checked independently of its pool,
+which is unlike a regular filesystem.
+.Pp
However, the
-.BR fsck (8)
-interface still allows it to communicate some errors:
-if the \fIdataset\fR is in a degraded pool, then \fBfsck.zfs\fR will
-return exit code 4 to indicate an uncorrected filesystem error.
-.LP
-Similarly, if the \fIdataset\fR is in a faulted pool and has a legacy
-/etc/fstab record, then \fBfsck.zfs\fR will return exit code 8 to
-indicate a fatal operational error.
-
-.SH "AUTHORS"
-.LP
-Darik Horn <dajhorn@vanadac.com>.
-
-.SH "SEE ALSO"
-.BR fsck (8),
-.BR fstab (5),
-.BR zpool-scrub (8)
+.Xr fsck 8
+interface still allows it to communicate some errors: if the
+.Ar dataset
+is in a degraded pool, then
+.Nm
+will return exit code
+.Sy 4
+to indicate an uncorrected filesystem error.
+.Pp
+Similarly, if the
+.Ar dataset
+is in a faulted pool and has a legacy
+.Pa /etc/fstab
+record, then
+.Nm
+will return exit code
+.Sy 8
+to indicate a fatal operational error.
+.Sh SEE ALSO
+.Xr fstab 5 ,
+.Xr fsck 8 ,
+.Xr zpool-scrub 8
diff --git a/sys/contrib/openzfs/man/man8/mount.zfs.8 b/sys/contrib/openzfs/man/man8/mount.zfs.8
index dd04b3109bfc..2101f70cd595 100644
--- a/sys/contrib/openzfs/man/man8/mount.zfs.8
+++ b/sys/contrib/openzfs/man/man8/mount.zfs.8
@@ -26,7 +26,7 @@
.
.Sh NAME
.Nm mount.zfs
-.Nd mount a ZFS filesystem
+.Nd mount ZFS filesystem
.Sh SYNOPSIS
.Nm
.Op Fl sfnvh
@@ -44,7 +44,7 @@ to mount filesystem snapshots and
ZFS filesystems, as well as by
.Xr zfs 8
when the
-.Ev Em $ZFS_MOUNT_HELPER
+.Sy ZFS_MOUNT_HELPER
environment variable is not set.
Users should should invoke either
.Xr mount 8
@@ -56,7 +56,7 @@ in most cases.
are handled according to the
.Em Temporary Mount Point Properties
section in
-.Xr zfsprops 8 ,
+.Xr zfsprops 7 ,
except for those described below.
.Pp
If
diff --git a/sys/contrib/openzfs/man/man8/vdev_id.8 b/sys/contrib/openzfs/man/man8/vdev_id.8
index 6de3d18fe575..2b327b3192a6 100644
--- a/sys/contrib/openzfs/man/man8/vdev_id.8
+++ b/sys/contrib/openzfs/man/man8/vdev_id.8
@@ -1,77 +1,93 @@
-.TH VDEV_ID 8 "Aug 24, 2020" OpenZFS
-.SH NAME
-vdev_id \- generate user-friendly names for JBOD disks
-.SH SYNOPSIS
-.LP
-.nf
-\fBvdev_id\fR <-d dev> [-c config_file] [-g sas_direct|sas_switch]
- [-m] [-p phys_per_port]
-\fBvdev_id\fR -h
-.fi
-.SH DESCRIPTION
-The \fBvdev_id\fR command is a udev helper which parses the file
-.BR /etc/zfs/vdev_id.conf (5)
-to map a physical path in a storage topology to a channel name. The
-channel name is combined with a disk enclosure slot number to create an
-alias that reflects the physical location of the drive. This is
-particularly helpful when it comes to tasks like replacing failed
-drives. Slot numbers may also be re-mapped in case the default
-numbering is unsatisfactory. The drive aliases will be created as
-symbolic links in /dev/disk/by-vdev.
-
-The currently supported topologies are sas_direct and sas_switch. A
-multipath mode is supported in which dm-mpath devices are handled by
-examining the first-listed running component disk as reported by the
-.BR multipath (8)
-command. In multipath mode the configuration file should contain a
+.\"
+.\" This file and its contents are supplied under the terms of the
+.\" Common Development and Distribution License ("CDDL"), version 1.0.
+.\" You may only use this file in accordance with the terms of version
+.\" 1.0 of the CDDL.
+.\"
+.\" A full copy of the text of the CDDL should have accompanied this
+.\" source. A copy of the CDDL is also available via the Internet at
+.\" http://www.illumos.org/license/CDDL.
+.\"
+.Dd May 26, 2021
+.Dt VDEV_ID 8
+.Os
+.
+.Sh NAME
+.Nm vdev_id
+.Nd generate user-friendly names for JBOD disks
+.Sh SYNOPSIS
+.Nm
+.Fl d Ar dev
+.Fl c Ar config_file
+.Fl g Sy sas_direct Ns | Ns Sy sas_switch Ns | Ns Sy scsi
+.Fl m
+.Fl p Ar phys_per_port
+.
+.Sh DESCRIPTION
+.Nm
+is an udev helper which parses
+.Xr vdev_id.conf 5
+to map a physical path in a storage topology to a channel name.
+The channel name is combined with a disk enclosure slot number to create
+an alias that reflects the physical location of the drive.
+This is particularly helpful when it comes to tasks like replacing failed drives.
+Slot numbers may also be remapped in case the default numbering is unsatisfactory.
+The drive aliases will be created as symbolic links in
+.Pa /dev/disk/by-vdev .
+.Pp
+The currently supported topologies are
+.Sy sas_direct ,
+.Sy sas_switch ,
+and
+.Sy scsi .
+A multipath mode is supported in which dm-mpath devices are handled by
+examining the first running component disk as reported by the driver.
+In multipath mode the configuration file should contain a
channel definition with the same name for each path to a given
enclosure.
-
-.BR vdev_id
+.Pp
+.Nm
also supports creating aliases based on existing udev links in the /dev
-hierarchy using the \fIalias\fR configuration file keyword. See the
-.BR vdev_id.conf (5)
-man page for details.
-
-.SH OPTIONS
-.TP
-\fB\-c\fR <config_file>
-Specifies the path to an alternate configuration file. The default is
-/etc/zfs/vdev_id.conf.
-.TP
-\fB\-d\fR <device>
-This is the only mandatory argument. Specifies the name of a device
-in /dev, i.e. "sda".
-.TP
-\fB\-g\fR <sas_direct|sas_switch>
+hierarchy using the
+.Sy alias
+configuration file keyword.
+See
+.Xr vdev_id.conf 5
+for details.
+.
+.Sh OPTIONS
+.Bl -tag -width "-m"
+.It Fl d Ar device
+The device node to classify, like
+.Pa /dev/sda .
+.It Fl c Ar config_file
+Specifies the path to an alternate configuration file.
+The default is
+.Pa /etc/zfs/vdev_id.conf .
+.It Fl g Sy sas_direct Ns | Ns Sy sas_switch Ns | Ns Sy scsi
Identifies a physical topology that governs how physical paths are
-mapped to channels.
-
-\fIsas_direct\fR - in this mode a channel is uniquely identified by
-a PCI slot and a HBA port number
-
-\fIsas_switch\fR - in this mode a channel is uniquely identified by
-a SAS switch port number
-.TP
-\fB\-m\fR
-Specifies that
-.BR vdev_id (8)
-will handle only dm-multipath devices. If set to "yes" then
-.BR vdev_id (8)
-will examine the first running component disk of a dm-multipath
-device as listed by the
-.BR multipath (8)
-command to determine the physical path.
-.TP
-\fB\-p\fR <phys_per_port>
+mapped to channels:
+.Bl -tag -compact -width "sas_direct and scsi"
+.It Sy sas_direct No and Sy scsi
+channels are uniquely identified by a PCI slot and HBA port number
+.It Sy sas_switch
+channels are uniquely identified by a SAS switch port number
+.El
+.It Fl m
+Only handle dm-multipath devices.
+If specified, examine the first running component disk of a dm-multipath
+device as provided by the driver to determine the physical path.
+.It Fl p Ar phys_per_port
Specifies the number of PHY devices associated with a SAS HBA port or SAS
switch port.
-.BR vdev_id (8)
+.Nm
internally uses this value to determine which HBA or switch port a
-device is connected to. The default is 4.
-.TP
-\fB\-h\fR
+device is connected to.
+The default is
+.Sy 4 .
+.It Fl h
Print a usage summary.
-.SH SEE ALSO
-.LP
-\fBvdev_id.conf\fR(5)
+.El
+.
+.Sh SEE ALSO
+.Xr vdev_id.conf 5
diff --git a/sys/contrib/openzfs/man/man8/zdb.8 b/sys/contrib/openzfs/man/man8/zdb.8
index 36fe6de547b3..a8a944219071 100644
--- a/sys/contrib/openzfs/man/man8/zdb.8
+++ b/sys/contrib/openzfs/man/man8/zdb.8
@@ -8,7 +8,6 @@
.\" source. A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
.\"
-.\"
.\" Copyright 2012, Richard Lowe.
.\" Copyright (c) 2012, 2019 by Delphix. All rights reserved.
.\" Copyright 2017 Nexenta Systems, Inc.
@@ -16,27 +15,29 @@
.\" Copyright (c) 2017 Intel Corporation.
.\"
.Dd October 7, 2020
-.Dt ZDB 8 SMM
+.Dt ZDB 8
.Os
+.
.Sh NAME
.Nm zdb
-.Nd display zpool debugging and consistency information
+.Nd display ZFS storage pool debugging and consistency information
.Sh SYNOPSIS
.Nm
.Op Fl AbcdDFGhikLMPsvXYy
-.Op Fl e Oo Fl V Oc Op Fl p Ar path ...
+.Op Fl e Oo Fl V Oc Oo Fl p Ar path Oc Ns …
.Op Fl I Ar inflight I/Os
-.Oo Fl o Ar var Ns = Ns Ar value Oc Ns ...
+.Oo Fl o Ar var Ns = Ns Ar value Oc Ns …
.Op Fl t Ar txg
.Op Fl U Ar cache
.Op Fl x Ar dumpdir
-.Op Ar poolname[/dataset | objset ID]
-.Op Ar object | range ...
+.Op Ar poolname Ns Op / Ns Ar dataset | objset ID
+.Op Ar object Ns | Ns Ar range Ns …
.Nm
.Op Fl AdiPv
-.Op Fl e Oo Fl V Oc Op Fl p Ar path ...
+.Op Fl e Oo Fl V Oc Oo Fl p Ar path Oc Ns …
.Op Fl U Ar cache
-.Ar poolname[/dataset | objset ID] Op Ar object | range ...
+.Ar poolname Ns Op Ar / Ns Ar dataset | objset ID
+.Op Ar object Ns | Ns Ar range Ns …
.Nm
.Fl C
.Op Fl A
@@ -44,7 +45,7 @@
.Nm
.Fl E
.Op Fl A
-.Ar word0 Ns \&: Ns Ar word1 Ns :...: Ns Ar word15
+.Ar word0 : Ns Ar word1 Ns :…: Ns Ar word15
.Nm
.Fl l
.Op Fl Aqu
@@ -52,10 +53,10 @@
.Nm
.Fl m
.Op Fl AFLPXY
-.Op Fl e Oo Fl V Oc Op Fl p Ar path ...
+.Op Fl e Oo Fl V Oc Oo Fl p Ar path Oc Ns …
.Op Fl t Ar txg
.Op Fl U Ar cache
-.Ar poolname Op Ar vdev Op Ar metaslab ...
+.Ar poolname Op Ar vdev Oo Ar metaslab Oc Ns …
.Nm
.Fl O
.Ar dataset path
@@ -65,15 +66,16 @@
.Nm
.Fl R
.Op Fl A
-.Op Fl e Oo Fl V Oc Op Fl p Ar path ...
+.Op Fl e Oo Fl V Oc Oo Fl p Ar path Oc Ns …
.Op Fl U Ar cache
-.Ar poolname vdev Ns \&: Ns Ar offset Ns \&: Ns Ar [<lsize>/]<psize> Ns Op : Ns Ar flags
+.Ar poolname vdev : Ns Ar offset : Ns Oo Ar lsize Ns / Oc Ns Ar psize Ns Op : Ns Ar flags
.Nm
.Fl S
.Op Fl AP
-.Op Fl e Oo Fl V Oc Op Fl p Ar path ...
+.Op Fl e Oo Fl V Oc Oo Fl p Ar path Oc Ns …
.Op Fl U Ar cache
.Ar poolname
+.
.Sh DESCRIPTION
The
.Nm
@@ -99,11 +101,11 @@ or
.Qq Sy @
characters, it is interpreted as a pool name.
The root dataset can be specified as
-.Ar pool Ns /
-.Pq pool name followed by a slash .
+.Qq Ar pool Ns / .
.Pp
When operating on an imported and active pool it is possible, though unlikely,
that zdb may interpret inconsistent pool data and behave erratically.
+.
.Sh OPTIONS
Display options:
.Bl -tag -width Ds
@@ -143,27 +145,30 @@ those specific objects or ranges only.
.Pp
An object ID range is specified in terms of a colon-separated tuple of
the form
-.Ao start Ac Ns : Ns Ao end Ac Ns Op Ns : Ns Ao flags Ac Ns .
+.Ao start Ac : Ns Ao end Ac Ns Op : Ns Ao flags Ac .
The fields
.Ar start
and
.Ar end
are integer object identifiers that denote the upper and lower bounds
-of the range. An
+of the range.
+An
.Ar end
-value of -1 specifies a range with no upper bound. The
+value of -1 specifies a range with no upper bound.
+The
.Ar flags
field optionally specifies a set of flags, described below, that control
-which object types are dumped. By default, all object types are dumped. A minus
-sign
+which object types are dumped.
+By default, all object types are dumped.
+A minus sign
.Pq -
negates the effect of the flag that follows it and has no effect unless
preceded by the
.Ar A
-flag. For example, the range 0:-1:A-d will dump all object types except
-for directories.
+flag.
+For example, the range 0:-1:A-d will dump all object types except for directories.
.Pp
-.Bl -tag -compact
+.Bl -tag -compact -width Ds
.It Sy A
Dump all objects (this is the default)
.It Sy d
@@ -198,7 +203,7 @@ Display the statistics independently for each deduplication table.
Dump the contents of the deduplication tables describing duplicate blocks.
.It Fl DDDDD
Also dump the contents of the deduplication tables describing unique blocks.
-.It Fl E Ar word0 Ns \&: Ns Ar word1 Ns :...: Ns Ar word15
+.It Fl E Ar word0 : Ns Ar word1 Ns :…: Ns Ar word15
Decode and display block from an embedded block pointer specified by the
.Ar word
arguments.
@@ -218,18 +223,21 @@ Note, the on disk format of the pool is not reverted to the checkpointed state.
Read the vdev labels and L2ARC header from the specified device.
.Nm Fl l
will return 0 if valid label was found, 1 if error occurred, and 2 if no valid
-labels were found. The presence of L2ARC header is indicated by a specific
-sequence (L2ARC_DEV_HDR_MAGIC). If there is an accounting error in the size
-or the number of L2ARC log blocks
+labels were found.
+The presence of L2ARC header is indicated by a specific
+sequence (L2ARC_DEV_HDR_MAGIC).
+If there is an accounting error in the size or the number of L2ARC log blocks
.Nm Fl l
-will return 1. Each unique configuration is displayed only
-once.
+will return 1.
+Each unique configuration is displayed only once.
.It Fl ll Ar device
-In addition display label space usage stats. If a valid L2ARC header was found
+In addition display label space usage stats.
+If a valid L2ARC header was found
also display the properties of log blocks used for restoring L2ARC contents
(persistent L2ARC).
.It Fl lll Ar device
-Display every configuration, unique or not. If a valid L2ARC header was found
+Display every configuration, unique or not.
+If a valid L2ARC header was found
also display the properties of log entries in log blocks used for restoring
L2ARC contents (persistent L2ARC).
.Pp
@@ -239,8 +247,8 @@ option is also specified, don't print the labels or the L2ARC header.
.Pp
If the
.Fl u
-option is also specified, also display the uberblocks on this device. Specify
-multiple times to increase verbosity.
+option is also specified, also display the uberblocks on this device.
+Specify multiple times to increase verbosity.
.It Fl L
Disable leak detection and the loading of space maps.
By default,
@@ -291,7 +299,7 @@ This option can be combined with
.Fl v
for increasing verbosity.
.It Xo
-.Fl R Ar poolname vdev Ns \&: Ns Ar offset Ns \&: Ns Ar [<lsize>/]<psize> Ns Op : Ns Ar flags
+.Fl R Ar poolname vdev : Ns Ar offset : Ns Oo Ar lsize Ns / Oc Ns Ar psize Ns Op : Ns Ar flags
.Xc
Read and display a block from the specified device.
By default the block is displayed as a hex dump, but see the description of the
@@ -315,7 +323,8 @@ Print block pointer at hex offset
.It Sy c
Calculate and display checksums
.It Sy d
-Decompress the block. Set environment variable
+Decompress the block.
+Set environment variable
.Nm ZDB_NO_ZLE
to skip zle when guessing.
.It Sy e
@@ -352,7 +361,7 @@ Enable panic recovery, certain errors which would otherwise be fatal are
demoted to warnings.
.It Fl AAA
Do not abort if asserts fail and also enable panic recovery.
-.It Fl e Op Fl p Ar path ...
+.It Fl e Oo Fl p Ar path Oc Ns …
Operate on an exported pool, not present in
.Pa /etc/zfs/zpool.cache .
The
@@ -382,14 +391,16 @@ The default value is 200.
This option affects the performance of the
.Fl c
option.
-.It Fl o Ar var Ns = Ns Ar value ...
+.It Fl o Ar var Ns = Ns Ar value …
Set the given global libzpool variable to the provided value.
The value must be an unsigned 32-bit integer.
Currently only little-endian systems are supported to avoid accidentally setting
the high 32 bits of 64-bit variables.
.It Fl P
-Print numbers in an unscaled form more amenable to parsing, eg. 1000000 rather
-than 1M.
+Print numbers in an unscaled form more amenable to parsing, e.g.\&
+.Sy 1000000
+rather than
+.Sy 1M .
.It Fl t Ar transaction
Specify the highest transaction to use when searching for uberblocks.
See also the
@@ -432,51 +443,51 @@ option, with more occurrences enabling more verbosity.
.Pp
If no options are specified, all information about the named pool will be
displayed at default verbosity.
+.
.Sh EXAMPLES
.Bl -tag -width Ds
.It Xo
-.Sy Example 1
+.Sy Example 1 :
Display the configuration of imported pool
-.Pa rpool
+.Ar rpool
.Xc
.Bd -literal
-# zdb -C rpool
-
+.No # Nm zdb Fl C Ar rpool
MOS Configuration:
version: 28
name: 'rpool'
- ...
+ …
.Ed
.It Xo
-.Sy Example 2
+.Sy Example 2 :
Display basic dataset information about
-.Pa rpool
+.Ar rpool
.Xc
.Bd -literal
-# zdb -d rpool
+.No # Nm zdb Fl d Ar rpool
Dataset mos [META], ID 0, cr_txg 4, 26.9M, 1051 objects
Dataset rpool/swap [ZVOL], ID 59, cr_txg 356, 486M, 2 objects
- ...
+ …
.Ed
.It Xo
-.Sy Example 3
+.Sy Example 3 :
Display basic information about object 0 in
-.Pa rpool/export/home
+.Ar rpool/export/home
.Xc
.Bd -literal
-# zdb -d rpool/export/home 0
+.No # Nm zdb Fl d Ar rpool/export/home 0
Dataset rpool/export/home [ZPL], ID 137, cr_txg 1546, 32K, 8 objects
Object lvl iblk dblk dsize lsize %full type
0 7 16K 16K 15.0K 16K 25.00 DMU dnode
.Ed
.It Xo
-.Sy Example 4
+.Sy Example 4 :
Display the predicted effect of enabling deduplication on
-.Pa rpool
+.Ar rpool
.Xc
.Bd -literal
-# zdb -S rpool
+.No # Nm zdb Fl S Ar rpool
Simulated DDT histogram:
bucket allocated referenced
@@ -485,10 +496,11 @@ refcnt blocks LSIZE PSIZE DSIZE blocks LSIZE PSIZE DSIZE
------ ------ ----- ----- ----- ------ ----- ----- -----
1 694K 27.1G 15.0G 15.0G 694K 27.1G 15.0G 15.0G
2 35.0K 1.33G 699M 699M 74.7K 2.79G 1.45G 1.45G
- ...
+ …
dedup = 1.11, compress = 1.80, copies = 1.00, dedup * compress / copies = 2.00
.Ed
.El
+.
.Sh SEE ALSO
.Xr zfs 8 ,
.Xr zpool 8
diff --git a/sys/contrib/openzfs/man/man8/zed.8.in b/sys/contrib/openzfs/man/man8/zed.8.in
index 38f8b663d38e..d3297605206e 100644
--- a/sys/contrib/openzfs/man/man8/zed.8.in
+++ b/sys/contrib/openzfs/man/man8/zed.8.in
@@ -10,240 +10,246 @@
.\" "OPENSOLARIS.LICENSE" or at <http://opensource.org/licenses/CDDL-1.0>.
.\" You may not use this file except in compliance with the license.
.\"
-.TH ZED 8 "Aug 24, 2020" OpenZFS
-
-.SH NAME
-ZED \- ZFS Event Daemon
-
-.SH SYNOPSIS
-.HP
-.B zed
-.\" [\fB\-c\fR \fIconfigfile\fR]
-[\fB\-d\fR \fIzedletdir\fR]
-[\fB\-f\fR]
-[\fB\-F\fR]
-[\fB\-h\fR]
-[\fB\-I\fR]
-[\fB\-L\fR]
-[\fB\-M\fR]
-[\fB\-p\fR \fIpidfile\fR]
-[\fB\-P\fR \fIpath\fR]
-[\fB\-s\fR \fIstatefile\fR]
-[\fB\-j\fR \fIjobs\fR]
-[\fB\-v\fR]
-[\fB\-V\fR]
-[\fB\-Z\fR]
-
-.SH DESCRIPTION
-.PP
-\fBZED\fR (ZFS Event Daemon) monitors events generated by the ZFS kernel
-module. When a zevent (ZFS Event) is posted, \fBZED\fR will run any ZEDLETs
-(ZFS Event Daemon Linkage for Executable Tasks) that have been enabled for the
-corresponding zevent class.
-
-.SH OPTIONS
-.TP
-.BI \-h
+.\" Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049)
+.\"
+.Dd May 26, 2021
+.Dt ZED 8
+.Os
+.
+.Sh NAME
+.Nm ZED
+.Nd ZFS Event Daemon
+.Sh SYNOPSIS
+.Nm
+.Op Fl fFhILMvVZ
+.Op Fl d Ar zedletdir
+.Op Fl p Ar pidfile
+.Op Fl P Ar path
+.Op Fl s Ar statefile
+.Op Fl j Ar jobs
+.
+.Sh DESCRIPTION
+The
+.Nm
+(ZFS Event Daemon) monitors events generated by the ZFS kernel
+module.
+When a zevent (ZFS Event) is posted, the
+.Nm
+will run any ZEDLETs (ZFS Event Daemon Linkage for Executable Tasks)
+that have been enabled for the corresponding zevent class.
+.
+.Sh OPTIONS
+.Bl -tag -width "-h"
+.It Fl h
Display a summary of the command-line options.
-.TP
-.BI \-L
+.It Fl L
Display license information.
-.TP
-.BI \-V
+.It Fl V
Display version information.
-.TP
-.BI \-v
+.It Fl v
Be verbose.
-.TP
-.BI \-f
+.It Fl f
Force the daemon to run if at all possible, disabling security checks and
-throwing caution to the wind. Not recommended for use in production.
-.TP
-.BI \-F
-Run the daemon in the foreground.
-.TP
-.BI \-M
+throwing caution to the wind.
+Not recommended for use in production.
+.It Fl F
+Don't daemonise: remain attached to the controlling terminal,
+log to the standard I/O streams.
+.It Fl M
Lock all current and future pages in the virtual memory address space.
This may help the daemon remain responsive when the system is under heavy
memory pressure.
-.TP
-.BI \-I
-Request that the daemon idle rather than exit when the kernel modules are
-not loaded. Processing of events will start, or resume, when the kernel
-modules are (re)loaded. Under Linux the kernel modules cannot be unloaded
-while the daemon is running.
-.TP
-.BI \-Z
+.It Fl I
+Request that the daemon idle rather than exit when the kernel modules are not loaded.
+Processing of events will start, or resume, when the kernel modules are (re)loaded.
+Under Linux the kernel modules cannot be unloaded while the daemon is running.
+.It Fl Z
Zero the daemon's state, thereby allowing zevents still within the kernel
to be reprocessed.
-.TP
-.BI \-d\ zedletdir
+.It Fl d Ar zedletdir
Read the enabled ZEDLETs from the specified directory.
-.TP
-.BI \-p\ pidfile
+.It Fl p Ar pidfile
Write the daemon's process ID to the specified file.
-.TP
-.BI \-P\ path
-Custom $PATH for zedlets to use. Normally zedlets run in a locked-down
-environment, with hardcoded paths to the ZFS commands ($ZFS, $ZPOOL, $ZED, ...),
-and a hardcoded $PATH. This is done for security reasons. However, the
-ZFS test suite uses a custom PATH for its ZFS commands, and passes it to zed
-with -P. In short, -P is only to be used by the ZFS test suite; never use
+.It Fl P Ar path
+Custom
+.Ev $PATH
+for zedlets to use.
+Normally zedlets run in a locked-down environment, with hardcoded paths to the ZFS commands
+.Pq Ev $ZFS , $ZPOOL , $ZED , ... ,
+and a hard-coded
+.Ev $PATH .
+This is done for security reasons.
+However, the ZFS test suite uses a custom PATH for its ZFS commands, and passes it to
+.Nm
+with
+.Fl P .
+In short,
+.Fl P
+is only to be used by the ZFS test suite; never use
it in production!
-.TP
-.BI \-s\ statefile
+.It Fl s Ar statefile
Write the daemon's state to the specified file.
-.TP
-.BI \-j\ jobs
-Allow at most \fIjobs\fR ZEDLETs to run concurrently,
+.It Fl j Ar jobs
+Allow at most
+.Ar jobs
+ZEDLETs to run concurrently,
delaying execution of new ones until they finish.
-Defaults to 16.
-.SH ZEVENTS
-.PP
-A zevent is comprised of a list of nvpairs (name/value pairs). Each zevent
-contains an EID (Event IDentifier) that uniquely identifies it throughout
+Defaults to
+.Sy 16 .
+.El
+.Sh ZEVENTS
+A zevent is comprised of a list of nvpairs (name/value pairs).
+Each zevent contains an EID (Event IDentifier) that uniquely identifies it throughout
the lifetime of the loaded ZFS kernel module; this EID is a monotonically
increasing integer that resets to 1 each time the kernel module is loaded.
Each zevent also contains a class string that identifies the type of event.
For brevity, a subclass string is defined that omits the leading components
-of the class string. Additional nvpairs exist to provide event details.
-.PP
+of the class string.
+Additional nvpairs exist to provide event details.
+.Pp
The kernel maintains a list of recent zevents that can be viewed (along with
-their associated lists of nvpairs) using the "\fBzpool events \-v\fR" command.
-
-.SH CONFIGURATION
-.PP
+their associated lists of nvpairs) using the
+.Nm zpool Cm events Fl v
+command.
+.
+.Sh CONFIGURATION
ZEDLETs to be invoked in response to zevents are located in the
-\fIenabled-zedlets\fR directory. These can be symlinked or copied from the
-\fIinstalled-zedlets\fR directory; symlinks allow for automatic updates
+.Em enabled-zedlets
+directory
+.Pq Ar zedletdir .
+These can be symlinked or copied from the
+.Em installed-zedlets
+directory; symlinks allow for automatic updates
from the installed ZEDLETs, whereas copies preserve local modifications.
As a security measure, since ownership change is a privileged operation,
-ZEDLETs must be owned by root. They must have execute permissions for the user,
+ZEDLETs must be owned by root.
+They must have execute permissions for the user,
but they must not have write permissions for group or other.
Dotfiles are ignored.
-.PP
+.Pp
ZEDLETs are named after the zevent class for which they should be invoked.
In particular, a ZEDLET will be invoked for a given zevent if either its
class or subclass string is a prefix of its filename (and is followed by
-a non-alphabetic character). As a special case, the prefix "all" matches
-all zevents. Multiple ZEDLETs may be invoked for a given zevent.
-
-.SH ZEDLETS
-.PP
+a non-alphabetic character).
+As a special case, the prefix
+.Sy all
+matches all zevents.
+Multiple ZEDLETs may be invoked for a given zevent.
+.
+.Sh ZEDLETS
ZEDLETs are executables invoked by the ZED in response to a given zevent.
They should be written under the presumption they can be invoked concurrently,
and they should use appropriate locking to access any shared resources.
Common variables used by ZEDLETs can be stored in the default rc file which
-is sourced by scripts; these variables should be prefixed with "ZED_".
-.PP
+is sourced by scripts; these variables should be prefixed with
+.Sy ZED_ .
+.Pp
The zevent nvpairs are passed to ZEDLETs as environment variables.
Each nvpair name is converted to an environment variable in the following
-manner: 1) it is prefixed with "ZEVENT_", 2) it is converted to uppercase,
-and 3) each non-alphanumeric character is converted to an underscore.
+manner:
+.Bl -enum -compact
+.It
+it is prefixed with
+.Sy ZEVENT_ ,
+.It
+it is converted to uppercase, and
+.It
+each non-alphanumeric character is converted to an underscore.
+.El
+.Pp
Some additional environment variables have been defined to present certain
-nvpair values in a more convenient form. An incomplete list of zevent
-environment variables is as follows:
-.TP
-.B
-ZEVENT_EID
+nvpair values in a more convenient form.
+An incomplete list of zevent environment variables is as follows:
+.Bl -tag -compact -width "ZEVENT_TIME_STRING"
+.It Sy ZEVENT_EID
The Event IDentifier.
-.TP
-.B
-ZEVENT_CLASS
+.It Sy ZEVENT_CLASS
The zevent class string.
-.TP
-.B
-ZEVENT_SUBCLASS
+.It Sy ZEVENT_SUBCLASS
The zevent subclass string.
-.TP
-.B
-ZEVENT_TIME
+.It Sy ZEVENT_TIME
The time at which the zevent was posted as
-"\fIseconds\fR\ \fInanoseconds\fR" since the Epoch.
-.TP
-.B
-ZEVENT_TIME_SECS
-The \fIseconds\fR component of ZEVENT_TIME.
-.TP
-.B
-ZEVENT_TIME_NSECS
-The \fInanoseconds\fR component of ZEVENT_TIME.
-.TP
-.B
-ZEVENT_TIME_STRING
-An almost-RFC3339-compliant string for ZEVENT_TIME.
-.PP
+.Dq Em seconds nanoseconds
+since the Epoch.
+.It Sy ZEVENT_TIME_SECS
+The
+.Em seconds
+component of
+.Sy ZEVENT_TIME .
+.It Sy ZEVENT_TIME_NSECS
+The
+.Em nanoseconds
+component of
+.Sy ZEVENT_TIME .
+.It Sy ZEVENT_TIME_STRING
+An almost-RFC3339-compliant string for
+.Sy ZEVENT_TIME .
+.El
+.Pp
Additionally, the following ZED & ZFS variables are defined:
-.TP
-.B
-ZED_PID
+.Bl -tag -compact -width "ZEVENT_TIME_STRING"
+.It Sy ZED_PID
The daemon's process ID.
-.TP
-.B
-ZED_ZEDLET_DIR
-The daemon's current \fIenabled-zedlets\fR directory.
-.TP
-.B
-ZFS_ALIAS
-The ZFS alias (\fIname-version-release\fR) string used to build the daemon.
-.TP
-.B
-ZFS_VERSION
-The ZFS version used to build the daemon.
-.TP
-.B
-ZFS_RELEASE
-The ZFS release used to build the daemon.
-.PP
-ZEDLETs may need to call other ZFS commands. The installation paths of
-the following executables are defined: \fBZDB\fR, \fBZED\fR, \fBZFS\fR,
-\fBZINJECT\fR, and \fBZPOOL\fR. These variables can be overridden in the
-rc file if needed.
-
-.SH FILES
-.TP
-.I @sysconfdir@/zfs/zed.d
+.It Sy ZED_ZEDLET_DIR
+The daemon's current
+.Em enabled-zedlets
+directory.
+.It Sy ZFS_ALIAS
+The alias
+.Pq Dq Em name Ns - Ns Em version Ns - Ns Em release
+string of the ZFS distribution the daemon is part of.
+.It Sy ZFS_VERSION
+The ZFS version the daemon is part of.
+.It Sy ZFS_RELEASE
+The ZFS release the daemon is part of.
+.El
+.Pp
+ZEDLETs may need to call other ZFS commands.
+The installation paths of the following executables are defined as environment variables:
+.Sy ZDB ,
+.Sy ZED ,
+.Sy ZFS ,
+.Sy ZINJECT ,
+and
+.Sy ZPOOL .
+These variables may be overridden in the rc file.
+.
+.Sh FILES
+.Bl -tag -width "-c"
+.It Pa @sysconfdir@/zfs/zed.d
The default directory for enabled ZEDLETs.
-.TP
-.I @sysconfdir@/zfs/zed.d/zed.rc
+.It Pa @sysconfdir@/zfs/zed.d/zed.rc
The default rc file for common variables used by ZEDLETs.
-.TP
-.I @zfsexecdir@/zed.d
+.It Pa @zfsexecdir@/zed.d
The default directory for installed ZEDLETs.
-.TP
-.I @runstatedir@/zed.pid
+.It Pa @runstatedir@/zed.pid
The default file containing the daemon's process ID.
-.TP
-.I @runstatedir@/zed.state
+.It Pa @runstatedir@/zed.state
The default file containing the daemon's state.
-
-.SH SIGNALS
-.TP
-.B HUP
+.El
+.
+.Sh SIGNALS
+.Bl -tag -width "-c"
+.It Sy SIGHUP
Reconfigure the daemon and rescan the directory for enabled ZEDLETs.
-.TP
-.B TERM
+.It Sy SIGTERM , SIGINT
Terminate the daemon.
-
-.SH NOTES
-.PP
-\fBZED\fR requires root privileges.
-.\" Do not taunt zed.
-
-.SH BUGS
-.PP
+.El
+.
+.Sh SEE ALSO
+.Xr zfs 8 ,
+.Xr zpool 8 ,
+.Xr zpool-events 8
+.
+.Sh NOTES
+The
+.Nm
+requires root privileges.
+.Pp
+Do not taunt the
+.Nm .
+.
+.Sh BUGS
ZEDLETs are unable to return state/status information to the kernel.
-.PP
+.Pp
Internationalization support via gettext has not been added.
-
-.SH LICENSE
-.PP
-\fBZED\fR (ZFS Event Daemon) is distributed under the terms of the
-Common Development and Distribution License Version 1.0 (CDDL\-1.0).
-.PP
-Developed at Lawrence Livermore National Laboratory (LLNL\-CODE\-403049).
-
-.SH SEE ALSO
-.BR zfs (8),
-.BR zpool (8)
-.BR zpool-events (8)
diff --git a/sys/contrib/openzfs/man/man8/zfs-allow.8 b/sys/contrib/openzfs/man/man8/zfs-allow.8
index 2c0a2ca36d54..070161be5413 100644
--- a/sys/contrib/openzfs/man/man8/zfs-allow.8
+++ b/sys/contrib/openzfs/man/man8/zfs-allow.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -30,67 +29,69 @@
.\" Copyright 2018 Nexenta Systems, Inc.
.\" Copyright 2019 Joyent, Inc.
.\"
-.Dd June 30, 2019
+.Dd May 27, 2021
.Dt ZFS-ALLOW 8
.Os
+.
.Sh NAME
.Nm zfs-allow
-.Nd Delegates ZFS administration permission for the file systems to non-privileged users.
+.Nd delegate ZFS administration permissions to unprivileged users
.Sh SYNOPSIS
.Nm zfs
.Cm allow
.Op Fl dglu
-.Ar user Ns | Ns Ar group Ns Oo , Ns Ar user Ns | Ns Ar group Oc Ns ...
+.Ar user Ns | Ns Ar group Ns Oo , Ns Ar user Ns | Ns Ar group Oc Ns …
.Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ...
+.Ar setname Oc Ns …
.Ar filesystem Ns | Ns Ar volume
.Nm zfs
.Cm allow
.Op Fl dl
.Fl e Ns | Ns Sy everyone
.Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ...
+.Ar setname Oc Ns …
.Ar filesystem Ns | Ns Ar volume
.Nm zfs
.Cm allow
.Fl c
.Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ...
+.Ar setname Oc Ns …
.Ar filesystem Ns | Ns Ar volume
.Nm zfs
.Cm allow
.Fl s No @ Ns Ar setname
.Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ...
+.Ar setname Oc Ns …
.Ar filesystem Ns | Ns Ar volume
.Nm zfs
.Cm unallow
.Op Fl dglru
-.Ar user Ns | Ns Ar group Ns Oo , Ns Ar user Ns | Ns Ar group Oc Ns ...
+.Ar user Ns | Ns Ar group Ns Oo , Ns Ar user Ns | Ns Ar group Oc Ns …
.Oo Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ... Oc
+.Ar setname Oc Ns … Oc
.Ar filesystem Ns | Ns Ar volume
.Nm zfs
.Cm unallow
.Op Fl dlr
.Fl e Ns | Ns Sy everyone
.Oo Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ... Oc
+.Ar setname Oc Ns … Oc
.Ar filesystem Ns | Ns Ar volume
.Nm zfs
.Cm unallow
.Op Fl r
.Fl c
.Oo Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ... Oc
+.Ar setname Oc Ns … Oc
.Ar filesystem Ns | Ns Ar volume
.Nm zfs
.Cm unallow
.Op Fl r
.Fl s No @ Ns Ar setname
.Oo Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ... Oc
+.Ar setname Oc Ns … Oc
.Ar filesystem Ns | Ns Ar volume
+.
.Sh DESCRIPTION
.Bl -tag -width ""
.It Xo
@@ -119,9 +120,9 @@ command restricts modifications of the global namespace to the root user.
.Nm zfs
.Cm allow
.Op Fl dglu
-.Ar user Ns | Ns Ar group Ns Oo , Ns Ar user Ns | Ns Ar group Oc Ns ...
+.Ar user Ns | Ns Ar group Ns Oo , Ns Ar user Ns | Ns Ar group Oc Ns …
.Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ...
+.Ar setname Oc Ns …
.Ar filesystem Ns | Ns Ar volume
.Xc
.It Xo
@@ -130,7 +131,7 @@ command restricts modifications of the global namespace to the root user.
.Op Fl dl
.Fl e Ns | Ns Sy everyone
.Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ...
+.Ar setname Oc Ns …
.Ar filesystem Ns | Ns Ar volume
.Xc
Delegates ZFS administration permission for the file systems to non-privileged
@@ -140,15 +141,15 @@ users.
Allow only for the descendent file systems.
.It Fl e Ns | Ns Sy everyone
Specifies that the permissions be delegated to everyone.
-.It Fl g Ar group Ns Oo , Ns Ar group Oc Ns ...
+.It Fl g Ar group Ns Oo , Ns Ar group Oc Ns …
Explicitly specify that permissions are delegated to the group.
.It Fl l
Allow
.Qq locally
only for the specified file system.
-.It Fl u Ar user Ns Oo , Ns Ar user Oc Ns ...
+.It Fl u Ar user Ns Oo , Ns Ar user Oc Ns …
Explicitly specify that permissions are delegated to the user.
-.It Ar user Ns | Ns Ar group Ns Oo , Ns Ar user Ns | Ns Ar group Oc Ns ...
+.It Ar user Ns | Ns Ar group Ns Oo , Ns Ar user Ns | Ns Ar group Oc Ns …
Specifies to whom the permissions are delegated.
Multiple entities can be specified as a comma-separated list.
If neither of the
@@ -169,7 +170,7 @@ To specify a group with the same name as a user, use the
options.
.It Xo
.Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ...
+.Ar setname Oc Ns …
.Xc
The permissions to delegate.
Multiple permissions may be specified as a comma-separated list.
@@ -191,95 +192,80 @@ file system or volume, and all of its descendents.
Permissions are generally the ability to use a ZFS subcommand or change a ZFS
property.
The following permissions are available:
-.Bd -literal
-NAME TYPE NOTES
-allow subcommand Must also have the permission that is
- being allowed
-bookmark subcommand
-clone subcommand Must also have the 'create' ability and
- 'mount' ability in the origin file system
-create subcommand Must also have the 'mount' ability.
- Must also have the 'refreservation' ability to
- create a non-sparse volume.
-destroy subcommand Must also have the 'mount' ability
-diff subcommand Allows lookup of paths within a dataset
- given an object number, and the ability
- to create snapshots necessary to
- 'zfs diff'.
-hold subcommand Allows adding a user hold to a snapshot
-load-key subcommand Allows loading and unloading of encryption key
- (see 'zfs load-key' and 'zfs unload-key').
-change-key subcommand Allows changing an encryption key via
- 'zfs change-key'.
-mount subcommand Allows mount/umount of ZFS datasets
-promote subcommand Must also have the 'mount' and 'promote'
- ability in the origin file system
-receive subcommand Must also have the 'mount' and 'create'
- ability
-release subcommand Allows releasing a user hold which might
- destroy the snapshot
-rename subcommand Must also have the 'mount' and 'create'
- ability in the new parent
-rollback subcommand Must also have the 'mount' ability
-send subcommand
-share subcommand Allows sharing file systems over NFS
- or SMB protocols
-snapshot subcommand Must also have the 'mount' ability
+.TS
+l l l .
+NAME TYPE NOTES
+_ _ _
+allow subcommand Must also have the permission that is being allowed
+bookmark subcommand
+clone subcommand Must also have the \fBcreate\fR ability and \fBmount\fR ability in the origin file system
+create subcommand Must also have the \fBmount\fR ability. Must also have the \fBrefreservation\fR ability to create a non-sparse volume.
+destroy subcommand Must also have the \fBmount\fR ability
+diff subcommand Allows lookup of paths within a dataset given an object number, and the ability to create snapshots necessary to \fBzfs diff\fR.
+hold subcommand Allows adding a user hold to a snapshot
+load subcommand Allows loading and unloading of encryption key (see \fBzfs load-key\fR and \fBzfs unload-key\fR).
+change subcommand Allows changing an encryption key via \fBzfs change-key\fR.
+mount subcommand Allows mounting/umounting ZFS datasets
+promote subcommand Must also have the \fBmount\fR and \fBpromote\fR ability in the origin file system
+receive subcommand Must also have the \fBmount\fR and \fBcreate\fR ability
+release subcommand Allows releasing a user hold which might destroy the snapshot
+rename subcommand Must also have the \fBmount\fR and \fBcreate\fR ability in the new parent
+rollback subcommand Must also have the \fBmount\fR ability
+send subcommand
+share subcommand Allows sharing file systems over NFS or SMB protocols
+snapshot subcommand Must also have the \fBmount\fR ability
-groupquota other Allows accessing any groupquota@...
- property
-groupused other Allows reading any groupused@... property
-userprop other Allows changing any user property
-userquota other Allows accessing any userquota@...
- property
-userused other Allows reading any userused@... property
-projectobjquota other Allows accessing any projectobjquota@...
- property
-projectquota other Allows accessing any projectquota@... property
-projectobjused other Allows reading any projectobjused@... property
-projectused other Allows reading any projectused@... property
+groupquota other Allows accessing any \fBgroupquota@\fI...\fR property
+groupused other Allows reading any \fBgroupused@\fI...\fR property
+userprop other Allows changing any user property
+userquota other Allows accessing any \fBuserquota@\fI...\fR property
+userused other Allows reading any \fBuserused@\fI...\fR property
+projectobjquota other Allows accessing any \fBprojectobjquota@\fI...\fR property
+projectquota other Allows accessing any \fBprojectquota@\fI...\fR property
+projectobjused other Allows reading any \fBprojectobjused@\fI...\fR property
+projectused other Allows reading any \fBprojectused@\fI...\fR property
-aclinherit property
-acltype property
-atime property
-canmount property
-casesensitivity property
-checksum property
-compression property
-copies property
-devices property
-exec property
-filesystem_limit property
-mountpoint property
-nbmand property
-normalization property
-primarycache property
-quota property
-readonly property
-recordsize property
-refquota property
-refreservation property
-reservation property
-secondarycache property
-setuid property
-sharenfs property
-sharesmb property
-snapdir property
-snapshot_limit property
-utf8only property
-version property
-volblocksize property
-volsize property
-vscan property
-xattr property
-zoned property
-.Ed
+aclinherit property
+acltype property
+atime property
+canmount property
+casesensitivity property
+checksum property
+compression property
+copies property
+devices property
+exec property
+filesystem_limit property
+mountpoint property
+nbmand property
+normalization property
+primarycache property
+quota property
+readonly property
+recordsize property
+refquota property
+refreservation property
+reservation property
+secondarycache property
+setuid property
+sharenfs property
+sharesmb property
+snapdir property
+snapshot_limit property
+utf8only property
+version property
+volblocksize property
+volsize property
+vscan property
+xattr property
+zoned property
+.TE
.It Xo
.Nm zfs
.Cm allow
.Fl c
.Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ...
+.Ar setname Oc Ns …
.Ar filesystem Ns | Ns Ar volume
.Xc
Sets
@@ -293,7 +279,7 @@ to the creator of any newly-created descendent file system.
.Cm allow
.Fl s No @ Ns Ar setname
.Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ...
+.Ar setname Oc Ns …
.Ar filesystem Ns | Ns Ar volume
.Xc
Defines or adds permissions to a permission set.
@@ -309,9 +295,9 @@ and can be no more than 64 characters long.
.Nm zfs
.Cm unallow
.Op Fl dglru
-.Ar user Ns | Ns Ar group Ns Oo , Ns Ar user Ns | Ns Ar group Oc Ns ...
+.Ar user Ns | Ns Ar group Ns Oo , Ns Ar user Ns | Ns Ar group Oc Ns …
.Oo Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ... Oc
+.Ar setname Oc Ns … Oc
.Ar filesystem Ns | Ns Ar volume
.Xc
.It Xo
@@ -320,7 +306,7 @@ and can be no more than 64 characters long.
.Op Fl dlr
.Fl e Ns | Ns Sy everyone
.Oo Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ... Oc
+.Ar setname Oc Ns … Oc
.Ar filesystem Ns | Ns Ar volume
.Xc
.It Xo
@@ -329,7 +315,7 @@ and can be no more than 64 characters long.
.Op Fl r
.Fl c
.Oo Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ... Oc
+.Ar setname Oc Ns … Oc
.Ar filesystem Ns | Ns Ar volume
.Xc
Removes permissions that were granted with the
@@ -367,7 +353,7 @@ Recursively remove the permissions from this file system and all descendents.
.Op Fl r
.Fl s No @ Ns Ar setname
.Oo Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns
-.Ar setname Oc Ns ... Oc
+.Ar setname Oc Ns … Oc
.Ar filesystem Ns | Ns Ar volume
.Xc
Removes permissions from a permission set.
diff --git a/sys/contrib/openzfs/man/man8/zfs-bookmark.8 b/sys/contrib/openzfs/man/man8/zfs-bookmark.8
index 042ddf504435..094a7b30902f 100644
--- a/sys/contrib/openzfs/man/man8/zfs-bookmark.8
+++ b/sys/contrib/openzfs/man/man8/zfs-bookmark.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -31,38 +30,37 @@
.\" Copyright 2019 Joyent, Inc.
.\" Copyright (c) 2019, 2020 by Christian Schwarz. All Rights Reserved.
.\"
-.Dd June 30, 2019
-.Dt ZFS-BOOKMARK 8 SMM
+.Dd May 27, 2021
+.Dt ZFS-BOOKMARK 8
.Os
+.
.Sh NAME
.Nm zfs-bookmark
-.Nd Creates a bookmark of the given snapshot.
+.Nd create bookmark of ZFS snapshot
.Sh SYNOPSIS
-.Sh DESCRIPTION
-.Bl -tag -width ""
-.It Xo
.Nm zfs
.Cm bookmark
-.Ar snapshot Ns | Ns Ar bookmark newbookmark
-.Xc
+.Ar snapshot Ns | Ns Ar bookmark
+.Ar newbookmark
+.
+.Sh DESCRIPTION
Creates a new bookmark of the given snapshot or bookmark.
Bookmarks mark the point in time when the snapshot was created, and can be used
as the incremental source for a
-.Xr zfs-send 8
-command.
+.Nm zfs Cm send .
.Pp
When creating a bookmark from an existing redaction bookmark, the resulting
bookmark is
-.Sy not
+.Em not
a redaction bookmark.
.Pp
This feature must be enabled to be used.
See
-.Xr zpool-features 5
+.Xr zpool-features 7
for details on ZFS feature flags and the
.Sy bookmarks
feature.
-.El
+.
.Sh SEE ALSO
.Xr zfs-destroy 8 ,
.Xr zfs-send 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zfs-clone.8 b/sys/contrib/openzfs/man/man8/zfs-clone.8
index 9cb84d3c56d6..0640244f2009 100644
--- a/sys/contrib/openzfs/man/man8/zfs-clone.8
+++ b/sys/contrib/openzfs/man/man8/zfs-clone.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -30,35 +29,29 @@
.\" Copyright 2018 Nexenta Systems, Inc.
.\" Copyright 2019 Joyent, Inc.
.\"
-.Dd June 30, 2019
+.Dd May 27, 2021
.Dt ZFS-CLONE 8
.Os
+.
.Sh NAME
.Nm zfs-clone
-.Nd Creates a clone of the given snapshot.
+.Nd clone snapshot of ZFS dataset
.Sh SYNOPSIS
.Nm zfs
.Cm clone
.Op Fl p
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
+.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
.Ar snapshot Ar filesystem Ns | Ns Ar volume
+.
.Sh DESCRIPTION
-.Bl -tag -width ""
-.It Xo
-.Nm zfs
-.Cm clone
-.Op Fl p
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
-.Ar snapshot Ar filesystem Ns | Ns Ar volume
-.Xc
See the
-.Em Clones
+.Sx Clones
section of
-.Xr zfsconcepts 8
+.Xr zfsconcepts 7
for details.
-The target dataset can be located anywhere in the ZFS hierarchy, and is created
-as the same type as the original.
-.Bl -tag -width "-o"
+The target dataset can be located anywhere in the ZFS hierarchy,
+and is created as the same type as the original.
+.Bl -tag -width Ds
.It Fl o Ar property Ns = Ns Ar value
Sets the specified property; see
.Nm zfs Cm create
@@ -71,7 +64,7 @@ property inherited from their parent.
If the target filesystem or volume already exists, the operation completes
successfully.
.El
-.El
+.
.Sh SEE ALSO
.Xr zfs-promote 8 ,
.Xr zfs-snapshot 8
diff --git a/sys/contrib/openzfs/man/man8/zfs-create.8 b/sys/contrib/openzfs/man/man8/zfs-create.8
index 5a4f9a32afa5..55397fa661d5 100644
--- a/sys/contrib/openzfs/man/man8/zfs-create.8
+++ b/sys/contrib/openzfs/man/man8/zfs-create.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -33,28 +32,30 @@
.Dd December 1, 2020
.Dt ZFS-CREATE 8
.Os
+.
.Sh NAME
.Nm zfs-create
-.Nd Creates a new ZFS file system.
+.Nd create ZFS dataset
.Sh SYNOPSIS
.Nm zfs
.Cm create
.Op Fl Pnpuv
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
+.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
.Ar filesystem
.Nm zfs
.Cm create
.Op Fl ps
.Op Fl b Ar blocksize
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
+.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
.Fl V Ar size Ar volume
+.
.Sh DESCRIPTION
.Bl -tag -width ""
.It Xo
.Nm zfs
.Cm create
.Op Fl Pnpuv
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
+.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
.Ar filesystem
.Xc
Creates a new ZFS file system.
@@ -134,7 +135,7 @@ Print verbose information about the created dataset.
.Cm create
.Op Fl ps
.Op Fl b Ar blocksize
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
+.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
.Fl V Ar size Ar volume
.Xc
Creates a volume of the given size.
@@ -183,7 +184,7 @@ See
in the
.Em Native Properties
section of
-.Xr zfsprops 8
+.Xr zfsprops 7
for more information about sparse volumes.
.It Fl n
Do a dry-run
@@ -234,14 +235,14 @@ Print verbose information about the created dataset.
.El
.El
.Ss ZFS Volumes as Swap
-ZFS volumes may be used as swap devices. After creating the volume with the
+ZFS volumes may be used as swap devices.
+After creating the volume with the
.Nm zfs Cm create Fl V
-command set up and enable the swap area using the
-.Xr mkswap 8
-and
+enable the swap area using the
.Xr swapon 8
-commands. Do not swap to a file on a ZFS file system. A ZFS swap file
-configuration is not supported.
+command.
+Swapping to files on ZFS filesystems is not supported.
+.
.Sh SEE ALSO
.Xr zfs-destroy 8 ,
.Xr zfs-list 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zfs-destroy.8 b/sys/contrib/openzfs/man/man8/zfs-destroy.8
index b0365cc82a91..51d9b7ab8e7d 100644
--- a/sys/contrib/openzfs/man/man8/zfs-destroy.8
+++ b/sys/contrib/openzfs/man/man8/zfs-destroy.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -33,9 +32,10 @@
.Dd June 30, 2019
.Dt ZFS-DESTROY 8
.Os
+.
.Sh NAME
.Nm zfs-destroy
-.Nd Destroys the given dataset(s), snapshot(s), or bookmark.
+.Nd destroy ZFS dataset, snapshots, or bookmark
.Sh SYNOPSIS
.Nm zfs
.Cm destroy
@@ -45,10 +45,11 @@
.Cm destroy
.Op Fl Rdnprv
.Ar filesystem Ns | Ns Ar volume Ns @ Ns Ar snap Ns
-.Oo % Ns Ar snap Ns Oo , Ns Ar snap Ns Oo % Ns Ar snap Oc Oc Oc Ns ...
+.Oo % Ns Ar snap Ns Oo , Ns Ar snap Ns Oo % Ns Ar snap Oc Oc Oc Ns …
.Nm zfs
.Cm destroy
.Ar filesystem Ns | Ns Ar volume Ns # Ns Ar bookmark
+.
.Sh DESCRIPTION
.Bl -tag -width ""
.It Xo
@@ -67,9 +68,7 @@ dataset that has active dependents
Recursively destroy all dependents, including cloned file systems outside the
target hierarchy.
.It Fl f
-Force an unmount of any file systems using the
-.Nm unmount Fl f
-command.
+Forcibly unmount file systems.
This option has no effect on non-file systems or unmounted file systems.
.It Fl n
Do a dry-run
@@ -100,10 +99,10 @@ behavior for mounted file systems in use.
.Cm destroy
.Op Fl Rdnprv
.Ar filesystem Ns | Ns Ar volume Ns @ Ns Ar snap Ns
-.Oo % Ns Ar snap Ns Oo , Ns Ar snap Ns Oo % Ns Ar snap Oc Oc Oc Ns ...
+.Oo % Ns Ar snap Ns Oo , Ns Ar snap Ns Oo % Ns Ar snap Oc Oc Oc Ns …
.Xc
The given snapshots are destroyed immediately if and only if the
-.Ql zfs destroy
+.Nm zfs Cm destroy
command without the
.Fl d
option would have destroyed it.
@@ -138,8 +137,8 @@ If this flag is specified, the
.Fl d
flag will have no effect.
.It Fl d
-Destroy immediately. If a snapshot cannot be destroyed now, mark it for
-deferred destruction.
+Destroy immediately.
+If a snapshot cannot be destroyed now, mark it for deferred destruction.
.It Fl n
Do a dry-run
.Pq Qq No-op
@@ -173,6 +172,7 @@ behavior for mounted file systems in use.
.Xc
The given bookmark is destroyed.
.El
+.
.Sh SEE ALSO
.Xr zfs-create 8 ,
.Xr zfs-hold 8
diff --git a/sys/contrib/openzfs/man/man8/zfs-diff.8 b/sys/contrib/openzfs/man/man8/zfs-diff.8
index c7b9e138d849..49443bf47d17 100644
--- a/sys/contrib/openzfs/man/man8/zfs-diff.8
+++ b/sys/contrib/openzfs/man/man8/zfs-diff.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -30,25 +29,20 @@
.\" Copyright 2018 Nexenta Systems, Inc.
.\" Copyright 2019 Joyent, Inc.
.\"
-.Dd June 30, 2019
+.Dd May 29, 2021
.Dt ZFS-DIFF 8
.Os
+.
.Sh NAME
.Nm zfs-diff
-.Nd Display the difference between two snapshots of a given filesystem.
+.Nd show difference between ZFS snapshots
.Sh SYNOPSIS
.Nm zfs
.Cm diff
.Op Fl FHt
.Ar snapshot Ar snapshot Ns | Ns Ar filesystem
+.
.Sh DESCRIPTION
-.Bl -tag -width ""
-.It Xo
-.Nm zfs
-.Cm diff
-.Op Fl FHt
-.Ar snapshot Ar snapshot Ns | Ns Ar filesystem
-.Xc
Display the difference between a snapshot of a given filesystem and another
snapshot of that filesystem from a later time or the current contents of the
filesystem.
@@ -57,35 +51,48 @@ indicate pathname, new pathname
.Pq in case of rename ,
change in link count, and optionally file type and/or change time.
The types of change are:
-.Bd -literal
-- The path has been removed
-+ The path has been created
-M The path has been modified
-R The path has been renamed
-.Ed
+.Bl -tag -compact -offset Ds -width "M"
+.It Sy -
+The path has been removed
+.It Sy +
+The path has been created
+.It Sy M
+The path has been modified
+.It Sy R
+The path has been renamed
+.El
.Bl -tag -width "-F"
.It Fl F
Display an indication of the type of file, in a manner similar to the
.Fl F
option of
.Xr ls 1 .
-.Bd -literal
-B Block device
-C Character device
-/ Directory
-> Door
-| Named pipe
-@ Symbolic link
-P Event port
-= Socket
-F Regular file
-.Ed
+.Bl -tag -compact -offset 2n -width "B"
+.It Sy B
+Block device
+.It Sy C
+Character device
+.It Sy /
+Directory
+.It Sy >
+Door
+.It Sy |\&
+Named pipe
+.It Sy @
+Symbolic link
+.It Sy P
+Event port
+.It Sy =
+Socket
+.It Sy F
+Regular file
+.El
.It Fl H
Give more parsable tab-separated output, without header lines and without
arrows.
.It Fl t
Display the path's inode change time as the first column of output.
.El
-.El
+.
.Sh SEE ALSO
.Xr zfs-snapshot 8
diff --git a/sys/contrib/openzfs/man/man8/zfs-hold.8 b/sys/contrib/openzfs/man/man8/zfs-hold.8
index ac56fc4a434a..5e4652092e80 100644
--- a/sys/contrib/openzfs/man/man8/zfs-hold.8
+++ b/sys/contrib/openzfs/man/man8/zfs-hold.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -33,40 +32,42 @@
.Dd June 30, 2019
.Dt ZFS-HOLD 8
.Os
+.
.Sh NAME
.Nm zfs-hold
-.Nd Hold a snapshot to prevent it being removed with the zfs destroy command.
+.Nd hold ZFS snapshots to prevent their removal
.Sh SYNOPSIS
.Nm zfs
.Cm hold
.Op Fl r
-.Ar tag Ar snapshot Ns ...
+.Ar tag Ar snapshot Ns …
.Nm zfs
.Cm holds
.Op Fl rH
-.Ar snapshot Ns ...
+.Ar snapshot Ns …
.Nm zfs
.Cm release
.Op Fl r
-.Ar tag Ar snapshot Ns ...
+.Ar tag Ar snapshot Ns …
+.
.Sh DESCRIPTION
.Bl -tag -width ""
.It Xo
.Nm zfs
.Cm hold
.Op Fl r
-.Ar tag Ar snapshot Ns ...
+.Ar tag Ar snapshot Ns …
.Xc
Adds a single reference, named with the
.Ar tag
-argument, to the specified snapshot or snapshots.
+argument, to the specified snapshots.
Each snapshot has its own tag namespace, and tags must be unique within that
space.
.Pp
If a hold exists on a snapshot, attempts to destroy that snapshot by using the
.Nm zfs Cm destroy
command return
-.Er EBUSY .
+.Sy EBUSY .
.Bl -tag -width "-r"
.It Fl r
Specifies that a hold with the given tag is applied recursively to the snapshots
@@ -76,7 +77,7 @@ of all descendent file systems.
.Nm zfs
.Cm holds
.Op Fl rH
-.Ar snapshot Ns ...
+.Ar snapshot Ns …
.Xc
Lists all existing user references for the given snapshot or snapshots.
.Bl -tag -width "-r"
@@ -90,7 +91,7 @@ Do not print headers, use tab-delimited output.
.Nm zfs
.Cm release
.Op Fl r
-.Ar tag Ar snapshot Ns ...
+.Ar tag Ar snapshot Ns …
.Xc
Removes a single reference, named with the
.Ar tag
@@ -99,12 +100,13 @@ The tag must already exist for each snapshot.
If a hold exists on a snapshot, attempts to destroy that snapshot by using the
.Nm zfs Cm destroy
command return
-.Er EBUSY .
+.Sy EBUSY .
.Bl -tag -width "-r"
.It Fl r
Recursively releases a hold with the given tag on the snapshots of all
descendent file systems.
.El
.El
+.
.Sh SEE ALSO
.Xr zfs-destroy 8
diff --git a/sys/contrib/openzfs/man/man8/zfs-jail.8 b/sys/contrib/openzfs/man/man8/zfs-jail.8
index ef621185e6a8..4f9faaea9bf5 100644
--- a/sys/contrib/openzfs/man/man8/zfs-jail.8
+++ b/sys/contrib/openzfs/man/man8/zfs-jail.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -37,83 +36,88 @@
.\" Copyright 2018 Nexenta Systems, Inc.
.\" Copyright 2019 Joyent, Inc.
.\"
-.Dd December 9, 2019
+.Dd May 27, 2021
.Dt ZFS-JAIL 8
-.Os FreeBSD
+.Os
+.
.Sh NAME
.Nm zfs-jail
-.Nd Attaches and detaches ZFS filesystems from FreeBSD jails.
-.No A Tn ZFS
-dataset can be attached to a jail by using the
-.Qq Nm zfs jail
-subcommand. You cannot attach a dataset to one jail and the children of the
-same dataset to another jail. You can also not attach the root file system
-of the jail or any dataset which needs to be mounted before the zfs rc script
-is run inside the jail, as it would be attached unmounted until it is
-mounted from the rc script inside the jail. To allow management of the
-dataset from within a jail, the
-.Sy jailed
-property has to be set and the jail needs access to the
-.Pa /dev/zfs
-device. The
-.Sy quota
-property cannot be changed from within a jail. See
-.Xr jail 8
-for information on how to allow mounting
-.Tn ZFS
-datasets from within a jail.
-.Pp
-.No A Tn ZFS
-dataset can be detached from a jail using the
-.Qq Nm zfs unjail
-subcommand.
-.Pp
-After a dataset is attached to a jail and the jailed property is set, a jailed
-file system cannot be mounted outside the jail, since the jail administrator
-might have set the mount point to an unacceptable value.
+.Nd attach or detach ZFS filesystem from FreeBSD jail
.Sh SYNOPSIS
-.Nm zfs
-.Cm jail
-.Ar jailid Ns | Ns Ar jailname filesystem
-.Nm zfs
-.Cm unjail
-.Ar jailid Ns | Ns Ar jailname filesystem
+.Nm zfs Cm jail
+.Ar jailid Ns | Ns Ar jailname
+.Ar filesystem
+.Nm zfs Cm unjail
+.Ar jailid Ns | Ns Ar jailname
+.Ar filesystem
+.
.Sh DESCRIPTION
.Bl -tag -width ""
.It Xo
.Nm zfs
.Cm jail
-.Ar jailid filesystem
+.Ar jailid Ns | Ns Ar jailname
+.Ar filesystem
.Xc
-.Pp
-Attaches the specified
+Attach the specified
.Ar filesystem
to the jail identified by JID
-.Ar jailid .
+.Ar jailid
+or name
+.Ar jailname .
From now on this file system tree can be managed from within a jail if the
.Sy jailed
-property has been set. To use this functuinality, the jail needs the
-.Va allow.mount
+property has been set.
+To use this functionality, the jail needs the
+.Sy allow.mount
and
-.Va allow.mount.zfs
-parameters set to 1 and the
-.Va enforce_statfs
-parameter set to a value lower than 2.
+.Sy allow.mount.zfs
+parameters set to
+.Sy 1
+and the
+.Sy enforce_statfs
+parameter set to a value lower than
+.Sy 2 .
+.Pp
+You cannot attach a jailed dataset's children to another jail.
+You can also not attach the root file system
+of the jail or any dataset which needs to be mounted before the zfs rc script
+is run inside the jail, as it would be attached unmounted until it is
+mounted from the rc script inside the jail.
+.Pp
+To allow management of the dataset from within a jail, the
+.Sy jailed
+property has to be set and the jail needs access to the
+.Pa /dev/zfs
+device.
+The
+.Sy quota
+property cannot be changed from within a jail.
+.Pp
+After a dataset is attached to a jail and the
+.Sy jailed
+property is set, a jailed file system cannot be mounted outside the jail,
+since the jail administrator might have set the mount point to an unacceptable value.
.Pp
See
.Xr jail 8
-for more information on managing jails and configuring the parameters above.
+for more information on managing jails.
+Jails are a
+.Fx
+feature and are not relevant on other platforms.
.It Xo
.Nm zfs
.Cm unjail
-.Ar jailid filesystem
+.Ar jailid Ns | Ns Ar jailname
+.Ar filesystem
.Xc
-.Pp
Detaches the specified
.Ar filesystem
from the jail identified by JID
-.Ar jailid .
+.Ar jailid
+or name
+.Ar jailname .
.El
.Sh SEE ALSO
-.Xr jail 8 ,
-.Xr zfsprops 8
+.Xr zfsprops 7 ,
+.Xr jail 8
diff --git a/sys/contrib/openzfs/man/man8/zfs-list.8 b/sys/contrib/openzfs/man/man8/zfs-list.8
index 3ed74955e942..5200483868ff 100644
--- a/sys/contrib/openzfs/man/man8/zfs-list.8
+++ b/sys/contrib/openzfs/man/man8/zfs-list.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -30,35 +29,25 @@
.\" Copyright 2018 Nexenta Systems, Inc.
.\" Copyright 2019 Joyent, Inc.
.\"
-.Dd June 30, 2019
+.Dd May 27, 2021
.Dt ZFS-LIST 8
.Os
+.
.Sh NAME
.Nm zfs-list
-.Nd Lists the property information for the given datasets in tabular form.
+.Nd list properties of ZFS datasets
.Sh SYNOPSIS
.Nm zfs
.Cm list
.Op Fl r Ns | Ns Fl d Ar depth
.Op Fl Hp
-.Oo Fl o Ar property Ns Oo , Ns Ar property Oc Ns ... Oc
-.Oo Fl s Ar property Oc Ns ...
-.Oo Fl S Ar property Oc Ns ...
-.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... Oc
-.Oo Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Oc Ns ...
+.Oo Fl o Ar property Ns Oo , Ns Ar property Oc Ns … Oc
+.Oo Fl s Ar property Oc Ns …
+.Oo Fl S Ar property Oc Ns …
+.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns … Oc
+.Oo Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Oc Ns …
+.
.Sh DESCRIPTION
-.Bl -tag -width ""
-.It Xo
-.Nm zfs
-.Cm list
-.Op Fl r Ns | Ns Fl d Ar depth
-.Op Fl Hp
-.Oo Fl o Ar property Ns Oo , Ns Ar property Oc Ns ... Oc
-.Oo Fl s Ar property Oc Ns ...
-.Oo Fl S Ar property Oc Ns ...
-.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... Oc
-.Oo Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Oc Ns ...
-.Xc
If specified, you can list property information by the absolute pathname or the
relative pathname.
By default, all file systems and volumes are displayed.
@@ -75,7 +64,7 @@ or
.Fl t Sy all
options are specified.
The following fields are displayed:
-.Sy name Ns \&, Sy used Ns \&, Sy available Ns \&, Sy referenced Ns \&, Sy mountpoint Ns .
+.Sy name , Sy used , Sy available , Sy referenced , Sy mountpoint .
.Bl -tag -width "-H"
.It Fl H
Used for scripting mode.
@@ -96,12 +85,12 @@ will display only the dataset and its direct children.
.It Fl o Ar property
A comma-separated list of properties to display.
The property must be:
-.Bl -bullet
+.Bl -bullet -compact
.It
One of the properties described in the
-.Em Native Properties
+.Sx Native Properties
section of
-.Xr zfsprops 8
+.Xr zfsprops 7
.It
A user property
.It
@@ -113,10 +102,9 @@ The value
.Sy space
to display space usage properties on file systems and volumes.
This is a shortcut for specifying
-.Fl o Sy name Ns \&, Ns Sy avail Ns \&, Ns Sy used Ns \&, Ns Sy usedsnap Ns \&, Ns
-.Sy usedds Ns \&, Ns Sy usedrefreserv Ns \&, Ns Sy usedchild Fl t
-.Sy filesystem Ns \&, Ns Sy volume
-syntax.
+.Fl o Ns \ \& Ns Sy name , Ns Sy avail , Ns Sy used , Ns Sy usedsnap , Ns
+.Sy usedds , Ns Sy usedrefreserv , Ns Sy usedchild
+.Fl t Sy filesystem , Ns Sy volume .
.El
.It Fl p
Display numbers in parsable
@@ -128,9 +116,9 @@ Recursively display any children of the dataset on the command line.
A property for sorting the output by column in ascending order based on the
value of the property.
The property must be one of the properties described in the
-.Em Properties
+.Sx Properties
section of
-.Xr zfsprops 8
+.Xr zfsprops 7
or the value
.Sy name
to sort by the dataset name.
@@ -141,7 +129,7 @@ Multiple
.Fl s
options are evaluated from left to right in decreasing order of importance.
The following is a list of sorting criteria:
-.Bl -bullet
+.Bl -bullet -compact
.It
Numeric types sort in numeric order.
.It
@@ -168,7 +156,7 @@ For example, specifying
.Fl t Sy snapshot
displays only snapshots.
.El
-.El
+.
.Sh SEE ALSO
-.Xr zfs-get 8 ,
-.Xr zfsprops 8
+.Xr zfsprops 7 ,
+.Xr zfs-get 8
diff --git a/sys/contrib/openzfs/man/man8/zfs-load-key.8 b/sys/contrib/openzfs/man/man8/zfs-load-key.8
index 7d273ddd53b0..ed89b65d7159 100644
--- a/sys/contrib/openzfs/man/man8/zfs-load-key.8
+++ b/sys/contrib/openzfs/man/man8/zfs-load-key.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -33,19 +32,20 @@
.Dd January 13, 2020
.Dt ZFS-LOAD-KEY 8
.Os
+.
.Sh NAME
.Nm zfs-load-key
-.Nd Load, unload, or change the encryption key used to access a dataset.
+.Nd load, unload, or change encryption key of ZFS dataset
.Sh SYNOPSIS
.Nm zfs
.Cm load-key
.Op Fl nr
.Op Fl L Ar keylocation
-.Fl a | Ar filesystem
+.Fl a Ns | Ns Ar filesystem
.Nm zfs
.Cm unload-key
.Op Fl r
-.Fl a | Ar filesystem
+.Fl a Ns | Ns Ar filesystem
.Nm zfs
.Cm change-key
.Op Fl l
@@ -58,6 +58,7 @@
.Fl i
.Op Fl l
.Ar filesystem
+.
.Sh DESCRIPTION
.Bl -tag -width ""
.It Xo
@@ -65,23 +66,26 @@
.Cm load-key
.Op Fl nr
.Op Fl L Ar keylocation
-.Fl a | Ar filesystem
+.Fl a Ns | Ns Ar filesystem
.Xc
Load the key for
.Ar filesystem ,
allowing it and all children that inherit the
.Sy keylocation
-property to be accessed. The key will be expected in the format specified by the
+property to be accessed.
+The key will be expected in the format specified by the
.Sy keyformat
and location specified by the
.Sy keylocation
-property. Note that if the
+property.
+Note that if the
.Sy keylocation
is set to
.Sy prompt
-the terminal will interactively wait for the key to be entered. Loading a key
-will not automatically mount the dataset. If that functionality is desired,
-.Nm zfs Cm mount Sy -l
+the terminal will interactively wait for the key to be entered.
+Loading a key will not automatically mount the dataset.
+If that functionality is desired,
+.Nm zfs Cm mount Fl l
will ask for the key and mount the dataset
.Po
see
@@ -100,16 +104,19 @@ Loads the keys for all encryption roots in all imported pools.
.It Fl n
Do a dry-run
.Pq Qq No-op
-load-key. This will cause zfs to simply check that the
-provided key is correct. This command may be run even if the key is already
-loaded.
+.Cm load-key .
+This will cause
+.Nm zfs
+to simply check that the provided key is correct.
+This command may be run even if the key is already loaded.
.It Fl L Ar keylocation
Use
.Ar keylocation
instead of the
.Sy keylocation
-property. This will not change the value of the property on the dataset. Note
-that if used with either
+property.
+This will not change the value of the property on the dataset.
+Note that if used with either
.Fl r
or
.Fl a ,
@@ -121,13 +128,14 @@ may only be given as
.Nm zfs
.Cm unload-key
.Op Fl r
-.Fl a | Ar filesystem
+.Fl a Ns | Ns Ar filesystem
.Xc
Unloads a key from ZFS, removing the ability to access the dataset and all of
its children that inherit the
.Sy keylocation
-property. This requires that the dataset is not currently open or mounted. Once
-the key is unloaded the
+property.
+This requires that the dataset is not currently open or mounted.
+Once the key is unloaded the
.Sy keystatus
property will become
.Sy unavailable .
@@ -154,15 +162,16 @@ Unloads the keys for all encryption roots in all imported pools.
.Op Fl l
.Ar filesystem
.Xc
-Changes the user's key (e.g. a passphrase) used to access a dataset. This
-command requires that the existing key for the dataset is already loaded into
-ZFS. This command may also be used to change the
+Changes the user's key (e.g. a passphrase) used to access a dataset.
+This command requires that the existing key for the dataset is already loaded.
+This command may also be used to change the
.Sy keylocation ,
.Sy keyformat ,
and
.Sy pbkdf2iters
-properties as needed. If the dataset was not previously an encryption root it
-will become one. Alternatively, the
+properties as needed.
+If the dataset was not previously an encryption root it will become one.
+Alternatively, the
.Fl i
flag may be provided to cause an encryption root to inherit the parent's key
instead.
@@ -171,36 +180,33 @@ If the user's key is compromised,
.Nm zfs Cm change-key
does not necessarily protect existing or newly-written data from attack.
Newly-written data will continue to be encrypted with the same master key as
-the existing data. The master key is compromised if an attacker obtains a
-user key and the corresponding wrapped master key. Currently,
+the existing data.
+The master key is compromised if an attacker obtains a
+user key and the corresponding wrapped master key.
+Currently,
.Nm zfs Cm change-key
does not overwrite the previous wrapped master key on disk, so it is
accessible via forensic analysis for an indeterminate length of time.
.Pp
In the event of a master key compromise, ideally the drives should be securely
erased to remove all the old data (which is readable using the compromised
-master key), a new pool created, and the data copied back. This can be
-approximated in place by creating new datasets, copying the data
-(e.g. using
-.Nm zfs Cm send
-|
-.Nm zfs Cm recv Ns
-), and then clearing the free space with
-.Nm zpool Cm trim --secure
+master key), a new pool created, and the data copied back.
+This can be approximated in place by creating new datasets, copying the data
+.Pq e.g. using Nm zfs Cm send | Nm zfs Cm recv ,
+and then clearing the free space with
+.Nm zpool Cm trim Fl -secure
if supported by your hardware, otherwise
-.Nm zpool Cm initialize Ns .
+.Nm zpool Cm initialize .
.Bl -tag -width "-r"
.It Fl l
-Ensures the key is loaded before attempting to change the key. This is
-effectively equivalent to
-.Qq Nm zfs Cm load-key Ar filesystem ; Nm zfs Cm change-key Ar filesystem
+Ensures the key is loaded before attempting to change the key.
+This is effectively equivalent to runnin
+.Nm zfs Cm load-key Ar filesystem ; Nm zfs Cm change-key Ar filesystem
.It Fl o Ar property Ns = Ns Ar value
-Allows the user to set encryption key properties (
-.Sy keyformat ,
-.Sy keylocation ,
-and
-.Sy pbkdf2iters
-) while changing the key. This is the only way to alter
+Allows the user to set encryption key properties
+.Pq Sy keyformat , keylocation , No and Sy pbkdf2iters
+while changing the key.
+This is the only way to alter
.Sy keyformat
and
.Sy pbkdf2iters
@@ -208,44 +214,43 @@ after the dataset has been created.
.It Fl i
Indicates that zfs should make
.Ar filesystem
-inherit the key of its parent. Note that this command can only be run on an
-encryption root that has an encrypted parent.
+inherit the key of its parent.
+Note that this command can only be run on an encryption root
+that has an encrypted parent.
.El
.El
.Ss Encryption
Enabling the
.Sy encryption
-feature allows for the creation of encrypted filesystems and volumes. ZFS
-will encrypt file and zvol data, file attributes, ACLs, permission bits,
+feature allows for the creation of encrypted filesystems and volumes.
+ZFS will encrypt file and volume data, file attributes, ACLs, permission bits,
directory listings, FUID mappings, and
-.Sy userused
-/
-.Sy groupused
-data. ZFS will not encrypt metadata related to the pool structure, including
+.Sy userused Ns / Ns Sy groupused
+data.
+ZFS will not encrypt metadata related to the pool structure, including
dataset and snapshot names, dataset hierarchy, properties, file size, file
holes, and deduplication tables (though the deduplicated data itself is
encrypted).
.Pp
-Key rotation is managed by ZFS. Changing the user's key (e.g. a passphrase)
-does not require re-encrypting the entire dataset. Datasets can be scrubbed,
+Key rotation is managed by ZFS.
+Changing the user's key (e.g. a passphrase)
+does not require re-encrypting the entire dataset.
+Datasets can be scrubbed,
resilvered, renamed, and deleted without the encryption keys being loaded (see the
-.Nm zfs Cm load-key
+.Cm load-key
subcommand for more info on key loading).
.Pp
Creating an encrypted dataset requires specifying the
-.Sy encryption
-and
-.Sy keyformat
+.Sy encryption No and Sy keyformat
properties at creation time, along with an optional
-.Sy keylocation
-and
-.Sy pbkdf2iters .
+.Sy keylocation No and Sy pbkdf2iters .
After entering an encryption key, the
-created dataset will become an encryption root. Any descendant datasets will
+created dataset will become an encryption root.
+Any descendant datasets will
inherit their encryption key from the encryption root by default, meaning that
loading, unloading, or changing the key for the encryption root will implicitly
-do the same for all inheriting datasets. If this inheritance is not desired,
-simply supply a
+do the same for all inheriting datasets.
+If this inheritance is not desired, simply supply a
.Sy keyformat
when creating the child dataset or use
.Nm zfs Cm change-key
@@ -256,40 +261,41 @@ may match that of the parent while still creating a new encryption root, and
that changing the
.Sy encryption
property alone does not create a new encryption root; this would simply use a
-different cipher suite with the same key as its encryption root. The one
-exception is that clones will always use their origin's encryption key.
-As a result of this exception, some encryption-related properties (namely
-.Sy keystatus ,
-.Sy keyformat ,
-.Sy keylocation ,
-and
-.Sy pbkdf2iters )
+different cipher suite with the same key as its encryption root.
+The one exception is that clones will always use their origin's encryption key.
+As a result of this exception, some encryption-related properties
+.Pq namely Sy keystatus , keyformat , keylocation , No and Sy pbkdf2iters
do not inherit like other ZFS properties and instead use the value determined
-by their encryption root. Encryption root inheritance can be tracked via the
-read-only
+by their encryption root.
+Encryption root inheritance can be tracked via the read-only
.Sy encryptionroot
property.
.Pp
Encryption changes the behavior of a few ZFS
-operations. Encryption is applied after compression so compression ratios are
-preserved. Normally checksums in ZFS are 256 bits long, but for encrypted data
+operations.
+Encryption is applied after compression so compression ratios are preserved.
+Normally checksums in ZFS are 256 bits long, but for encrypted data
the checksum is 128 bits of the user-chosen checksum and 128 bits of MAC from
the encryption suite, which provides additional protection against maliciously
-altered data. Deduplication is still possible with encryption enabled but for
-security, datasets will only dedup against themselves, their snapshots, and
-their clones.
+altered data.
+Deduplication is still possible with encryption enabled but for security,
+datasets will only deduplicate against themselves, their snapshots,
+and their clones.
.Pp
-There are a few limitations on encrypted datasets. Encrypted data cannot be
-embedded via the
+There are a few limitations on encrypted datasets.
+Encrypted data cannot be embedded via the
.Sy embedded_data
-feature. Encrypted datasets may not have
+feature.
+Encrypted datasets may not have
.Sy copies Ns = Ns Em 3
since the implementation stores some encryption metadata where the third copy
-would normally be. Since compression is applied before encryption datasets may
-be vulnerable to a CRIME-like attack if applications accessing the data allow
-for it. Deduplication with encryption will leak information about which blocks
-are equivalent in a dataset and will incur an extra CPU cost per block written.
+would normally be.
+Since compression is applied before encryption, datasets may
+be vulnerable to a CRIME-like attack if applications accessing the data allow for it.
+Deduplication with encryption will leak information about which blocks
+are equivalent in a dataset and will incur an extra CPU cost for each block written.
+.
.Sh SEE ALSO
+.Xr zfsprops 7 ,
.Xr zfs-create 8 ,
-.Xr zfs-set 8 ,
-.Xr zfsprops 8
+.Xr zfs-set 8
diff --git a/sys/contrib/openzfs/man/man8/zfs-mount-generator.8.in b/sys/contrib/openzfs/man/man8/zfs-mount-generator.8.in
index 96fee4291071..7aa332ba8174 100644
--- a/sys/contrib/openzfs/man/man8/zfs-mount-generator.8.in
+++ b/sys/contrib/openzfs/man/man8/zfs-mount-generator.8.in
@@ -21,227 +21,172 @@
.\" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
.\" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
.\" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-.TH ZFS-MOUNT-GENERATOR 8 "Aug 24, 2020" OpenZFS
-
-.SH "NAME"
-zfs\-mount\-generator \- generates systemd mount units for ZFS
-.SH SYNOPSIS
-.B @systemdgeneratordir@/zfs\-mount\-generator
-.sp
-.SH DESCRIPTION
-zfs\-mount\-generator implements the \fBGenerators Specification\fP
-of
-.BR systemd (1),
-and is called during early boot to generate
-.BR systemd.mount (5)
-units for automatically mounted datasets. Mount ordering and dependencies
-are created for all tracked pools (see below).
-
-.SS ENCRYPTION KEYS
-If the dataset is an encryption root, a service that loads the associated key (either from file or through a
-.BR systemd\-ask\-password (1)
-prompt) will be created. This service
-. BR RequiresMountsFor
-the path of the key (if file-based) and also copies the mount unit's
-.BR After ,
-.BR Before
-and
-.BR Requires .
-All mount units of encrypted datasets add the key\-load service for their encryption root to their
-.BR Wants
+.\"
+.Dd May 31, 2021
+.Dt ZFS-MOUNT-GENERATOR 8
+.Os
+.
+.Sh NAME
+.Nm zfs-mount-generator
+.Nd generate systemd mount units for ZFS filesystems
+.Sh SYNOPSIS
+.Pa @systemdgeneratordir@/zfs-mount-generator
+.
+.Sh DESCRIPTION
+.Nm
+is a
+.Xr systemd.generator 7
+that generates native
+.Xr systemd.mount 5
+units for configured ZFS datasets.
+.
+.Ss Properties
+.Bl -tag -compact -width "org.openzfs.systemd:required-by=unit[ unit]…"
+.It Sy mountpoint Ns =
+.No Skipped if Sy legacy No or Sy none .
+.
+.It Sy canmount Ns =
+.No Skipped if Sy off .
+.No Skipped if only Sy noauto
+datasets exist for a given mountpoint and there's more than one.
+.No Datasets with Sy yes No take precedence over ones with Sy noauto No for the same mountpoint.
+.No Sets logical Em noauto No flag if Sy noauto .
+Encryption roots always generate
+.Sy zfs-load-key@ Ns Ar root Ns Sy .service ,
+even if
+.Sy off .
+.
+.It Sy atime Ns = , Sy relatime Ns = , Sy devices Ns = , Sy exec Ns = , Sy readonly Ns = , Sy setuid Ns = , Sy nbmand Ns =
+Used to generate mount options equivalent to
+.Nm zfs Cm mount .
+.
+.It Sy encroot Ns = , Sy keylocation Ns =
+If the dataset is an encryption root, its mount unit will bind to
+.Sy zfs-load-key@ Ns Ar root Ns Sy .service ,
+with additional dependencies as follows:
+.Bl -tag -compact -offset Ds -width "keylocation=https://URL (et al.)"
+.It Sy keylocation Ns = Ns Sy prompt
+None, uses
+.Xr systemd-ask-password 1
+.It Sy keylocation Ns = Ns Sy https:// Ns Ar URL Pq et al.\&
+.Sy Wants Ns = , Sy After Ns = : Pa network-online.target
+.It Sy keylocation Ns = Ns Sy file:// Ns < Ns Ar path Ns >
+.Sy RequiresMountsFor Ns = Ns Ar path
+.El
+.
+The service also uses the same
+.Sy Wants Ns = ,
+.Sy After Ns = ,
+.Sy Requires Ns = , No and
+.Sy RequiresMountsFor Ns = ,
+as the mount unit.
+.
+.It Sy org.openzfs.systemd:requires Ns = Ns Pa path Ns Oo " " Ns Pa path Oc Ns …
+.No Sets Sy Requires Ns = for the mount- and key-loading unit.
+.
+.It Sy org.openzfs.systemd:requires-mounts-for Ns = Ns Pa path Ns Oo " " Ns Pa path Oc Ns …
+.No Sets Sy RequiresMountsFor Ns = for the mount- and key-loading unit.
+.
+.It Sy org.openzfs.systemd:before Ns = Ns Pa unit Ns Oo " " Ns Pa unit Oc Ns …
+.No Sets Sy Before Ns = for the mount unit.
+.
+.It Sy org.openzfs.systemd:after Ns = Ns Pa unit Ns Oo " " Ns Pa unit Oc Ns …
+.No Sets Sy After Ns = for the mount unit.
+.
+.It Sy org.openzfs.systemd:wanted-by Ns = Ns Pa unit Ns Oo " " Ns Pa unit Oc Ns …
+.No Sets logical Em noauto No flag (see below).
+.No If not Sy none , No sets Sy WantedBy Ns = for the mount unit.
+.It Sy org.openzfs.systemd:required-by Ns = Ns Pa unit Ns Oo " " Ns Pa unit Oc Ns …
+.No Sets logical Em noauto No flag (see below).
+.No If not Sy none , No sets Sy RequiredBy Ns = for the mount unit.
+.
+.It Sy org.openzfs.systemd:nofail Ns = Ns (unset) Ns | Ns Sy on Ns | Ns Sy off
+Waxes or wanes strength of default reverse dependencies of the mount unit, see below.
+.
+.It Sy org.openzfs.systemd:ignore Ns = Ns Sy on Ns | Ns Sy off
+.No Skip if Sy on .
+.No Defaults to Sy off .
+.El
+.
+.Ss Unit Ordering And Dependencies
+Additionally, unless the pool the dataset resides on
+is imported at generation time, both units gain
+.Sy Wants Ns = Ns Pa zfs-import.target
and
-.BR After .
-The service will not be
-.BR Want ed
-or
-.BR Require d
-by
-.BR local-fs.target
-directly, and so will only be started manually or as a dependency of a started mount unit.
-
-.SS UNIT ORDERING AND DEPENDENCIES
-mount unit's
-.BR Before
-\->
-key\-load service (if any)
-\->
-mount unit
-\->
-mount unit's
-.BR After
-
-It is worth nothing that when a mount unit is activated, it activates all available mount units for parent paths to its mountpoint, i.e. activating the mount unit for /tmp/foo/1/2/3 automatically activates all available mount units for /tmp, /tmp/foo, /tmp/foo/1, and /tmp/foo/1/2. This is true for any combination of mount units from any sources, not just ZFS.
-
-.SS CACHE FILE
+.Sy After Ns = Ns Pa zfs-import.target .
+.Pp
+Additionally, unless the logical
+.Em noauto
+flag is set, the mount unit gains a reverse-dependency for
+.Pa local-fs.target
+of strength
+.Bl -tag -compact -offset Ds -width "(unset)"
+.It (unset)
+.Sy WantedBy Ns = No + Sy Before Ns =
+.It Sy on
+.Sy WantedBy Ns =
+.It Sy off
+.Sy RequiredBy Ns = No + Sy Before Ns =
+.El
+.
+.Ss Cache File
Because ZFS pools may not be available very early in the boot process,
-information on ZFS mountpoints must be stored separately. The output of the command
-.PP
-.RS 4
-zfs list -H -o name,mountpoint,canmount,atime,relatime,devices,exec,readonly,setuid,nbmand,encroot,keylocation,org.openzfs.systemd:requires,org.openzfs.systemd:requires-mounts-for,org.openzfs.systemd:before,org.openzfs.systemd:after,org.openzfs.systemd:wanted-by,org.openzfs.systemd:required-by,org.openzfs.systemd:nofail,org.openzfs.systemd:ignore
-
-.RE
-.PP
-for datasets that should be mounted by systemd, should be kept
-separate from the pool, at
-.PP
-.RS 4
-.RI @sysconfdir@/zfs/zfs-list.cache/ POOLNAME
-.
-.RE
-.PP
-The cache file, if writeable, will be kept synchronized with the pool
-state by the ZEDLET
-.PP
-.RS 4
-history_event-zfs-list-cacher.sh .
-.RE
-.PP
-.sp
-.SS PROPERTIES
-The behavior of the generator script can be influenced by the following dataset properties:
-.sp
-.TP 4
-.BR canmount = on | off | noauto
-If a dataset has
-.BR mountpoint
-set and
-.BR canmount
-is not
-.BR off ,
-a mount unit will be generated.
-Additionally, if
-.BR canmount
-is
-.BR on ,
-.BR local-fs.target
-will gain a dependency on the mount unit.
-
-This behavior is equal to the
-.BR auto
-and
-.BR noauto
-legacy mount options, see
-.BR systemd.mount (5).
-
-Encryption roots always generate a key-load service, even for
-.BR canmount=off .
-.TP 4
-.BR org.openzfs.systemd:requires\-mounts\-for = \fIpath\fR...
-Space\-separated list of mountpoints to require to be mounted for this mount unit
-.TP 4
-.BR org.openzfs.systemd:before = \fIunit\fR...
-The mount unit and associated key\-load service will be ordered before this space\-separated list of units.
-.TP 4
-.BR org.openzfs.systemd:after = \fIunit\fR...
-The mount unit and associated key\-load service will be ordered after this space\-separated list of units.
-.TP 4
-.BR org.openzfs.systemd:wanted\-by = \fIunit\fR...
-Space-separated list of units that will gain a
-.BR Wants
-dependency on this mount unit.
-Setting this property implies
-.BR noauto .
-.TP 4
-.BR org.openzfs.systemd:required\-by = \fIunit\fR...
-Space-separated list of units that will gain a
-.BR Requires
-dependency on this mount unit.
-Setting this property implies
-.BR noauto .
-.TP 4
-.BR org.openzfs.systemd:nofail = unset | on | off
-Toggles between a
-.BR Wants
-and
-.BR Requires
-type of dependency between the mount unit and
-.BR local-fs.target ,
-if
-.BR noauto
-isn't set or implied.
-
-.BR on :
-Mount will be
-.BR WantedBy
-local-fs.target
-
-.BR off :
-Mount will be
-.BR Before
-and
-.BR RequiredBy
-local-fs.target
-
-.BR unset :
-Mount will be
-.BR Before
-and
-.BR WantedBy
-local-fs.target
-.TP 4
-.BR org.openzfs.systemd:ignore = on | off
-If set to
-.BR on ,
-do not generate a mount unit for this dataset.
-
-See also
-.BR systemd.mount (5)
-
-.PP
-.SH EXAMPLE
+information on ZFS mountpoints must be stored separately.
+The output of
+.Dl Nm zfs Cm list Fl Ho Ar name , Ns Aq every property above in order
+for datasets that should be mounted by systemd should be kept at
+.Pa @sysconfdir@/zfs/zfs-list.cache/ Ns Ar poolname ,
+and, if writeable, will be kept synchronized for the entire pool by the
+.Pa history_event-zfs-list-cacher.sh
+ZEDLET, if enabled
+.Pq see Xr zed 8 .
+.
+.Sh ENVIRONMENT
+The
+.Sy ZFS_DEBUG
+environment variable can either be
+.Sy 0
+(default),
+.Sy 1
+(print summary accounting information at the end), or at least
+.Sy 2
+(print accounting information for each subprocess as it finishes).
+.
+If not present,
+.Pa /proc/cmdline
+is additionally checked for
+.Qq debug ,
+in which case the debug level is set to
+.Sy 2 .
+.
+.Sh EXAMPLES
To begin, enable tracking for the pool:
-.PP
-.RS 4
-touch
-.RI @sysconfdir@/zfs/zfs-list.cache/ POOLNAME
-.RE
-.PP
-Then, enable the tracking ZEDLET:
-.PP
-.RS 4
-ln -s "@zfsexecdir@/zed.d/history_event-zfs-list-cacher.sh" "@sysconfdir@/zfs/zed.d"
-
-systemctl enable zfs-zed.service
-
-systemctl restart zfs-zed.service
-.RE
-.PP
-Force the running of the ZEDLET by setting a monitored property, e.g.
-.BR canmount ,
-for at least one dataset in the pool:
-.PP
-.RS 4
-zfs set canmount=on
-.I DATASET
-.RE
-.PP
-This forces an update to the stale cache file.
-
-To test the generator output, run
-.PP
-.RS 4
-@systemdgeneratordir@/zfs-mount-generator /tmp/zfs-mount-generator . .
-.RE
-.PP
-This will generate units and dependencies in
-.I /tmp/zfs-mount-generator
-for you to inspect them. The second and third argument are ignored.
-
-If you're satisfied with the generated units, instruct systemd to re-run all generators:
-.PP
-.RS 4
-systemctl daemon-reload
-.RE
-.PP
-
-.sp
-.SH SEE ALSO
-.BR zfs (5)
-.BR zfs-events (5)
-.BR zed (8)
-.BR zpool (5)
-.BR systemd (1)
-.BR systemd.target (5)
-.BR systemd.special (7)
-.BR systemd.mount (7)
+.Dl # Nm touch Pa @sysconfdir@/zfs/zfs-list.cache/ Ns Ar poolname
+Then enable the tracking ZEDLET:
+.Dl # Nm ln Fl s Pa @zfsexecdir@/zed.d/history_event-zfs-list-cacher.sh @sysconfdir@/zfs/zed.d
+.Dl # Nm systemctl Cm enable Pa zfs-zed.service
+.Dl # Nm systemctl Cm restart Pa zfs-zed.service
+.Pp
+If no history event is in the queue,
+inject one to ensure the ZEDLET runs to refresh the cache file
+by setting a monitored property somewhere on the pool:
+.Dl # Nm zfs Cm set Sy relatime Ns = Ns Sy off Ar poolname/dset
+.Dl # Nm zfs Cm inherit Sy relatime Ar poolname/dset
+.Pp
+To test the generator output:
+.Dl $ Nm mkdir Pa /tmp/zfs-mount-generator
+.Dl $ Nm @systemdgeneratordir@/zfs-mount-generator Pa /tmp/zfs-mount-generator
+.
+If the generated units are satisfactory, instruct
+.Nm systemd
+to re-run all generators:
+.Dl # Nm systemctl daemon-reload
+.
+.Sh SEE ALSO
+.Xr systemd.mount 5 ,
+.Xr systemd.target 5 ,
+.Xr zfs 5 ,
+.Xr systemd.generator 7 ,
+.Xr systemd.special 7 ,
+.Xr zed 8 ,
+.Xr zpool-events 8
diff --git a/sys/contrib/openzfs/man/man8/zfs-mount.8 b/sys/contrib/openzfs/man/man8/zfs-mount.8
index 00fb37c786e1..42ce6b5ca155 100644
--- a/sys/contrib/openzfs/man/man8/zfs-mount.8
+++ b/sys/contrib/openzfs/man/man8/zfs-mount.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -33,9 +32,10 @@
.Dd February 16, 2019
.Dt ZFS-MOUNT 8
.Os
+.
.Sh NAME
.Nm zfs-mount
-.Nd Manage mount state of ZFS file systems.
+.Nd manage mount state of ZFS filesystems
.Sh SYNOPSIS
.Nm zfs
.Cm mount
@@ -43,11 +43,12 @@
.Cm mount
.Op Fl Oflv
.Op Fl o Ar options
-.Fl a | Ar filesystem
+.Fl a Ns | Ns Ar filesystem
.Nm zfs
.Cm unmount
.Op Fl fu
-.Fl a | Ar filesystem Ns | Ns Ar mountpoint
+.Fl a Ns | Ns Ar filesystem Ns | Ns Ar mountpoint
+.
.Sh DESCRIPTION
.Bl -tag -width ""
.It Xo
@@ -60,11 +61,12 @@ Displays all ZFS file systems currently mounted.
.Cm mount
.Op Fl Oflv
.Op Fl o Ar options
-.Fl a | Ar filesystem
+.Fl a Ns | Ns Ar filesystem
.Xc
Mount ZFS filesystem on a path described by its
.Sy mountpoint
-property, if the path exists and is empty. If
+property, if the path exists and is empty.
+If
.Sy mountpoint
is set to
.Em legacy ,
@@ -72,7 +74,8 @@ the filesystem should be instead mounted using
.Xr mount 8 .
.Bl -tag -width "-O"
.It Fl O
-Perform an overlay mount. Allows mounting in non-empty
+Perform an overlay mount.
+Allows mounting in non-empty
.Sy mountpoint .
See
.Xr mount 8
@@ -88,16 +91,15 @@ duration of the mount.
See the
.Em Temporary Mount Point Properties
section of
-.Xr zfsprops 8
+.Xr zfsprops 7
for details.
.It Fl l
-Load keys for encrypted filesystems as they are being mounted. This is
-equivalent to executing
+Load keys for encrypted filesystems as they are being mounted.
+This is equivalent to executing
.Nm zfs Cm load-key
-on each encryption root before mounting it. Note that if a filesystem has a
-.Sy keylocation
-of
-.Sy prompt
+on each encryption root before mounting it.
+Note that if a filesystem has
+.Sy keylocation Ns = Ns Sy prompt ,
this will cause the terminal to interactively block after asking for the key.
.It Fl v
Report mount progress.
@@ -108,7 +110,7 @@ Attempt to force mounting of all filesystems, even those that couldn't normally
.Nm zfs
.Cm unmount
.Op Fl fu
-.Fl a | Ar filesystem Ns | Ns Ar mountpoint
+.Fl a Ns | Ns Ar filesystem Ns | Ns Ar mountpoint
.Xc
Unmounts currently mounted ZFS file systems.
.Bl -tag -width "-a"
diff --git a/sys/contrib/openzfs/man/man8/zfs-program.8 b/sys/contrib/openzfs/man/man8/zfs-program.8
index 02251ae7cbad..4a9718cdcfcb 100644
--- a/sys/contrib/openzfs/man/man8/zfs-program.8
+++ b/sys/contrib/openzfs/man/man8/zfs-program.8
@@ -1,3 +1,4 @@
+.\"
.\" This file and its contents are supplied under the terms of the
.\" Common Development and Distribution License ("CDDL"), version 1.0.
.\" You may only use this file in accordance with the terms of version
@@ -7,17 +8,17 @@
.\" source. A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
.\"
-.\"
.\" Copyright (c) 2016, 2019 by Delphix. All Rights Reserved.
.\" Copyright (c) 2019, 2020 by Christian Schwarz. All Rights Reserved.
.\" Copyright 2020 Joyent, Inc.
.\"
-.Dd January 26, 2021
+.Dd May 27, 2021
.Dt ZFS-PROGRAM 8
.Os
+.
.Sh NAME
.Nm zfs-program
-.Nd executes ZFS channel programs
+.Nd execute ZFS channel programs
.Sh SYNOPSIS
.Nm zfs
.Cm program
@@ -26,7 +27,8 @@
.Op Fl m Ar memory-limit
.Ar pool
.Ar script
-.\".Op Ar optional arguments to channel program
+.Op Ar script arguments
+.
.Sh DESCRIPTION
The ZFS channel program interface allows ZFS administrative operations to be
run programmatically as a Lua script.
@@ -37,22 +39,22 @@ Channel programs may only be run with root privileges.
.Pp
A modified version of the Lua 5.2 interpreter is used to run channel program
scripts.
-The Lua 5.2 manual can be found at:
-.Bd -centered -offset indent
+The Lua 5.2 manual can be found at
.Lk http://www.lua.org/manual/5.2/
-.Ed
.Pp
The channel program given by
.Ar script
will be run on
.Ar pool ,
and any attempts to access or modify other pools will cause an error.
+.
.Sh OPTIONS
.Bl -tag -width "-t"
.It Fl j
-Display channel program output in JSON format. When this flag is specified and
-standard output is empty - channel program encountered an error. The details of
-such an error will be printed to standard error in plain text.
+Display channel program output in JSON format.
+When this flag is specified and standard output is empty -
+channel program encountered an error.
+The details of such an error will be printed to standard error in plain text.
.It Fl n
Executes a read-only channel program, which runs faster.
The program cannot change on-disk state by calling functions from the
@@ -78,15 +80,17 @@ All remaining argument strings will be passed directly to the Lua script as
described in the
.Sx LUA INTERFACE
section below.
+.
.Sh LUA INTERFACE
A channel program can be invoked either from the command line, or via a library
call to
.Fn lzc_channel_program .
+.
.Ss Arguments
Arguments passed to the channel program are converted to a Lua table.
If invoked from the command line, extra arguments to the Lua script will be
accessible as an array stored in the argument table with the key 'argv':
-.Bd -literal -offset indent
+.Bd -literal -compact -offset indent
args = ...
argv = args["argv"]
-- argv == {1="arg1", 2="arg2", ...}
@@ -95,7 +99,7 @@ argv = args["argv"]
If invoked from the libZFS interface, an arbitrary argument list can be
passed to the channel program, which is accessible via the same
"..." syntax in Lua:
-.Bd -literal -offset indent
+.Bd -literal -compact -offset indent
args = ...
-- args == {"foo"="bar", "baz"={...}, ...}
.Ed
@@ -108,37 +112,35 @@ in
in a C array passed to a channel program will be stored in
.Va arr[1]
when accessed from Lua.
+.
.Ss Return Values
Lua return statements take the form:
-.Bd -literal -offset indent
-return ret0, ret1, ret2, ...
-.Ed
+.Dl return ret0, ret1, ret2, ...
.Pp
Return statements returning multiple values are permitted internally in a
channel program script, but attempting to return more than one value from the
top level of the channel program is not permitted and will throw an error.
However, tables containing multiple values can still be returned.
If invoked from the command line, a return statement:
-.Bd -literal -offset indent
+.Bd -literal -compact -offset indent
a = {foo="bar", baz=2}
return a
.Ed
.Pp
Will be output formatted as:
-.Bd -literal -offset indent
+.Bd -literal -compact -offset indent
Channel program fully executed with return value:
return:
baz: 2
foo: 'bar'
.Ed
+.
.Ss Fatal Errors
If the channel program encounters a fatal error while running, a non-zero exit
status will be returned.
If more information about the error is available, a singleton list will be
returned detailing the error:
-.Bd -literal -offset indent
-error: "error string, including Lua stack trace"
-.Ed
+.Dl error: \&"error string, including Lua stack trace"
.Pp
If a fatal error is returned, the channel program may have not executed at all,
may have partially executed, or may have fully executed but failed to pass a
@@ -162,6 +164,7 @@ return an error code and the channel program continues executing.
See the
.Sx ZFS API
section below for function-specific details on error return codes.
+.
.Ss Lua to C Value Conversion
When invoking a channel program via the libZFS interface, it is necessary to
translate arguments and return values from Lua values to their C equivalents,
@@ -171,37 +174,37 @@ There is a correspondence between nvlist values in C and Lua tables.
A Lua table which is returned from the channel program will be recursively
converted to an nvlist, with table values converted to their natural
equivalents:
-.Bd -literal -offset indent
-string -> string
-number -> int64
-boolean -> boolean_value
-nil -> boolean (no value)
-table -> nvlist
-.Ed
+.TS
+cw3 l c l .
+ string -> string
+ number -> int64
+ boolean -> boolean_value
+ nil -> boolean (no value)
+ table -> nvlist
+.TE
.Pp
Likewise, table keys are replaced by string equivalents as follows:
-.Bd -literal -offset indent
-string -> no change
-number -> signed decimal string ("%lld")
-boolean -> "true" | "false"
-.Ed
+.TS
+cw3 l c l .
+ string -> no change
+ number -> signed decimal string ("%lld")
+ boolean -> "true" | "false"
+.TE
.Pp
Any collision of table key strings (for example, the string "true" and a
true boolean value) will cause a fatal error.
.Pp
Lua numbers are represented internally as signed 64-bit integers.
+.
.Sh LUA STANDARD LIBRARY
The following Lua built-in base library functions are available:
-.Bd -literal -offset indent
-assert rawlen
-collectgarbage rawget
-error rawset
-getmetatable select
-ipairs setmetatable
-next tonumber
-pairs tostring
-rawequal type
-.Ed
+.TS
+cw3 l l l l .
+ assert rawlen collectgarbage rawget
+ error rawset getmetatable select
+ ipairs setmetatable next tonumber
+ pairs tostring rawequal type
+.TE
.Pp
All functions in the
.Em coroutine ,
@@ -214,15 +217,13 @@ manual.
.Pp
The following functions base library functions have been disabled and are
not available for use in channel programs:
-.Bd -literal -offset indent
-dofile
-loadfile
-load
-pcall
-print
-xpcall
-.Ed
+.TS
+cw3 l l l l l l .
+ dofile loadfile load pcall print xpcall
+.TE
+.
.Sh ZFS API
+.
.Ss Function Arguments
Each API function takes a fixed set of required positional arguments and
optional keyword arguments.
@@ -231,22 +232,17 @@ For example, the destroy function takes a single positional string argument
argument.
When using parentheses to specify the arguments to a Lua function, only
positional arguments can be used:
-.Bd -literal -offset indent
-zfs.sync.destroy("rpool@snap")
-.Ed
+.Dl Sy zfs.sync.destroy Ns Pq \&"rpool@snap"
.Pp
To use keyword arguments, functions must be called with a single argument that
is a Lua table containing entries mapping integers to positional arguments and
strings to keyword arguments:
-.Bd -literal -offset indent
-zfs.sync.destroy({1="rpool@snap", defer=true})
-.Ed
+.Dl Sy zfs.sync.destroy Ns Pq {1="rpool@snap", defer=true}
.Pp
The Lua language allows curly braces to be used in place of parenthesis as
syntactic sugar for this calling convention:
-.Bd -literal -offset indent
-zfs.sync.snapshot{"rpool@snap", defer=true}
-.Ed
+.Dl Sy zfs.sync.snapshot Ns {"rpool@snap", defer=true}
+.
.Ss Function Return Values
If an API function succeeds, it returns 0.
If it fails, it returns an error code and the channel program continues
@@ -261,13 +257,11 @@ Lua table, or Nil if no error details were returned.
Different keys will exist in the error details table depending on the function
and error case.
Any such function may be called expecting a single return value:
-.Bd -literal -offset indent
-errno = zfs.sync.promote(dataset)
-.Ed
+.Dl errno = Sy zfs.sync.promote Ns Pq dataset
.Pp
Or, the error details can be retrieved:
-.Bd -literal -offset indent
-errno, details = zfs.sync.promote(dataset)
+.Bd -literal -compact -offset indent
+.No errno, details = Sy zfs.sync.promote Ns Pq dataset
if (errno == EEXIST) then
assert(details ~= Nil)
list_of_conflicting_snapshots = details
@@ -276,48 +270,46 @@ end
.Pp
The following global aliases for API function error return codes are defined
for use in channel programs:
-.Bd -literal -offset indent
-EPERM ECHILD ENODEV ENOSPC
-ENOENT EAGAIN ENOTDIR ESPIPE
-ESRCH ENOMEM EISDIR EROFS
-EINTR EACCES EINVAL EMLINK
-EIO EFAULT ENFILE EPIPE
-ENXIO ENOTBLK EMFILE EDOM
-E2BIG EBUSY ENOTTY ERANGE
-ENOEXEC EEXIST ETXTBSY EDQUOT
-EBADF EXDEV EFBIG
-.Ed
+.TS
+cw3 l l l l l l l .
+ EPERM ECHILD ENODEV ENOSPC ENOENT EAGAIN ENOTDIR
+ ESPIPE ESRCH ENOMEM EISDIR EROFS EINTR EACCES
+ EINVAL EMLINK EIO EFAULT ENFILE EPIPE ENXIO
+ ENOTBLK EMFILE EDOM E2BIG EBUSY ENOTTY ERANGE
+ ENOEXEC EEXIST ETXTBSY EDQUOT EBADF EXDEV EFBIG
+.TE
+.
.Ss API Functions
-For detailed descriptions of the exact behavior of any zfs administrative
+For detailed descriptions of the exact behavior of any ZFS administrative
operations, see the main
.Xr zfs 8
manual page.
.Bl -tag -width "xx"
-.It Em zfs.debug(msg)
+.It Fn zfs.debug msg
Record a debug message in the zfs_dbgmsg log.
A log of these messages can be printed via mdb's "::zfs_dbgmsg" command, or
-can be monitored live by running:
-.Bd -literal -offset indent
- dtrace -n 'zfs-dbgmsg{trace(stringof(arg0))}'
-.Ed
+can be monitored live by running
+.Dl dtrace -n 'zfs-dbgmsg{trace(stringof(arg0))}'
.Pp
-msg (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "property (string)"
+.It Ar msg Pq string
Debug message to be printed.
-.Ed
-.It Em zfs.exists(dataset)
+.El
+.It Fn zfs.exists dataset
Returns true if the given dataset exists, or false if it doesn't.
A fatal error will be thrown if the dataset is not in the target pool.
That is, in a channel program running on rpool,
-zfs.exists("rpool/nonexistent_fs") returns false, but
-zfs.exists("somepool/fs_that_may_exist") will error.
+.Sy zfs.exists Ns Pq \&"rpool/nonexistent_fs"
+returns false, but
+.Sy zfs.exists Ns Pq \&"somepool/fs_that_may_exist"
+will error.
.Pp
-dataset (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "property (string)"
+.It Ar dataset Pq string
Dataset to check for existence.
Must be in the target pool.
-.Ed
-.It Em zfs.get_prop(dataset, property)
+.El
+.It Fn zfs.get_prop dataset property
Returns two values.
First, a string, number or table containing the property value for the given
dataset.
@@ -326,22 +318,25 @@ dataset in which it was set or nil if it is readonly).
Throws a Lua error if the dataset is invalid or the property doesn't exist.
Note that Lua only supports int64 number types whereas ZFS number properties
are uint64.
-This means very large values (like guid) may wrap around and appear negative.
+This means very large values (like GUIDs) may wrap around and appear negative.
.Pp
-dataset (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "property (string)"
+.It Ar dataset Pq string
Filesystem or snapshot path to retrieve properties from.
-.Ed
-.Pp
-property (string)
-.Bd -ragged -compact -offset "xxxx"
+.It Ar property Pq string
Name of property to retrieve.
-All filesystem, snapshot and volume properties are supported except
-for 'mounted' and 'iscsioptions.'
-Also supports the 'written@snap' and 'written#bookmark' properties and
-the '<user|group><quota|used>@id' properties, though the id must be in numeric
-form.
-.Ed
+All filesystem, snapshot and volume properties are supported except for
+.Sy mounted
+and
+.Sy iscsioptions .
+Also supports the
+.Sy written@ Ns Ar snap
+and
+.Sy written# Ns Ar bookmark
+properties and the
+.Ao Sy user Ns | Ns Sy group Ac Ns Ao Sy quota Ns | Ns Sy used Ac Ns Sy @ Ns Ar id
+properties, though the id must be in numeric form.
+.El
.El
.Bl -tag -width "xx"
.It Sy zfs.sync submodule
@@ -350,86 +345,73 @@ They are executed in "syncing context".
.Pp
The available sync submodule functions are as follows:
.Bl -tag -width "xx"
-.It Em zfs.sync.destroy(dataset, [defer=true|false])
+.It Sy zfs.sync.destroy Ns Pq Ar dataset , Op Ar defer Ns = Ns Sy true Ns | Ns Sy false
Destroy the given dataset.
Returns 0 on successful destroy, or a nonzero error code if the dataset could
not be destroyed (for example, if the dataset has any active children or
clones).
.Pp
-dataset (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "newbookmark (string)"
+.It Ar dataset Pq string
Filesystem or snapshot to be destroyed.
-.Ed
-.Pp
-[optional] defer (boolean)
-.Bd -ragged -compact -offset "xxxx"
+.It Op Ar defer Pq boolean
Valid only for destroying snapshots.
If set to true, and the snapshot has holds or clones, allows the snapshot to be
marked for deferred deletion rather than failing.
-.Ed
-.It Em zfs.sync.inherit(dataset, property)
+.El
+.It Fn zfs.sync.inherit dataset property
Clears the specified property in the given dataset, causing it to be inherited
from an ancestor, or restored to the default if no ancestor property is set.
The
-.Ql zfs inherit -S
+.Nm zfs Cm inherit Fl S
option has not been implemented.
Returns 0 on success, or a nonzero error code if the property could not be
cleared.
.Pp
-dataset (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "newbookmark (string)"
+.It Ar dataset Pq string
Filesystem or snapshot containing the property to clear.
-.Ed
-.Pp
-property (string)
-.Bd -ragged -compact -offset "xxxx"
+.It Ar property Pq string
The property to clear.
Allowed properties are the same as those for the
.Nm zfs Cm inherit
command.
-.Ed
-.It Em zfs.sync.promote(dataset)
+.El
+.It Fn zfs.sync.promote dataset
Promote the given clone to a filesystem.
Returns 0 on successful promotion, or a nonzero error code otherwise.
If EEXIST is returned, the second return value will be an array of the clone's
snapshots whose names collide with snapshots of the parent filesystem.
.Pp
-dataset (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "newbookmark (string)"
+.It Ar dataset Pq string
Clone to be promoted.
-.Ed
-.It Em zfs.sync.rollback(filesystem)
+.El
+.It Fn zfs.sync.rollback filesystem
Rollback to the previous snapshot for a dataset.
Returns 0 on successful rollback, or a nonzero error code otherwise.
Rollbacks can be performed on filesystems or zvols, but not on snapshots
or mounted datasets.
EBUSY is returned in the case where the filesystem is mounted.
.Pp
-filesystem (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "newbookmark (string)"
+.It Ar filesystem Pq string
Filesystem to rollback.
-.Ed
-.It Em zfs.sync.set_prop(dataset, property, value)
+.El
+.It Fn zfs.sync.set_prop dataset property value
Sets the given property on a dataset.
Currently only user properties are supported.
Returns 0 if the property was set, or a nonzero error code otherwise.
.Pp
-dataset (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "newbookmark (string)"
+.It Ar dataset Pq string
The dataset where the property will be set.
-.Ed
-.Pp
-property (string)
-.Bd -ragged -compact -offset "xxxx"
+.It Ar property Pq string
The property to set.
-Only user properties are supported.
-.Ed
-.Pp
-value (string)
-.Bd -ragged -compact -offset "xxxx"
+.It Ar value Pq string
The value of the property to be set.
-.Ed
-.It Em zfs.sync.snapshot(dataset)
+.El
+.It Fn zfs.sync.snapshot dataset
Create a snapshot of a filesystem.
Returns 0 if the snapshot was successfully created,
and a nonzero error code otherwise.
@@ -437,132 +419,142 @@ and a nonzero error code otherwise.
Note: Taking a snapshot will fail on any pool older than legacy version 27.
To enable taking snapshots from ZCP scripts, the pool must be upgraded.
.Pp
-dataset (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "newbookmark (string)"
+.It Ar dataset Pq string
Name of snapshot to create.
-.Ed
-.It Em zfs.sync.bookmark(source, newbookmark)
+.El
+.It Fn zfs.sync.bookmark source newbookmark
Create a bookmark of an existing source snapshot or bookmark.
Returns 0 if the new bookmark was successfully created,
and a nonzero error code otherwise.
.Pp
Note: Bookmarking requires the corresponding pool feature to be enabled.
.Pp
-source (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "newbookmark (string)"
+.It Ar source Pq string
Full name of the existing snapshot or bookmark.
-.Ed
-.Pp
-newbookmark (string)
-.Bd -ragged -compact -offset "xxxx"
+.It Ar newbookmark Pq string
Full name of the new bookmark.
.El
-.Ed
+.El
.It Sy zfs.check submodule
-For each function in the zfs.sync submodule, there is a corresponding zfs.check
+For each function in the
+.Sy zfs.sync
+submodule, there is a corresponding
+.Sy zfs.check
function which performs a "dry run" of the same operation.
-Each takes the same arguments as its zfs.sync counterpart and returns 0 if the
-operation would succeed, or a non-zero error code if it would fail, along with
-any other error details.
+Each takes the same arguments as its
+.Sy zfs.sync
+counterpart and returns 0 if the operation would succeed,
+or a non-zero error code if it would fail, along with any other error details.
That is, each has the same behavior as the corresponding sync function except
for actually executing the requested change.
For example,
-.Em zfs.check.destroy("fs")
+.Fn zfs.check.destroy \&"fs"
returns 0 if
-.Em zfs.sync.destroy("fs")
+.Fn zfs.sync.destroy \&"fs"
would successfully destroy the dataset.
.Pp
-The available zfs.check functions are:
-.Bl -tag -width "xx"
-.It Em zfs.check.destroy(dataset, [defer=true|false])
-.It Em zfs.check.promote(dataset)
-.It Em zfs.check.rollback(filesystem)
-.It Em zfs.check.set_property(dataset, property, value)
-.It Em zfs.check.snapshot(dataset)
+The available
+.Sy zfs.check
+functions are:
+.Bl -tag -compact -width "xx"
+.It Sy zfs.check.destroy Ns Pq Ar dataset , Op Ar defer Ns = Ns Sy true Ns | Ns Sy false
+.It Fn zfs.check.promote dataset
+.It Fn zfs.check.rollback filesystem
+.It Fn zfs.check.set_property dataset property value
+.It Fn zfs.check.snapshot dataset
.El
.It Sy zfs.list submodule
The zfs.list submodule provides functions for iterating over datasets and
properties.
Rather than returning tables, these functions act as Lua iterators, and are
generally used as follows:
-.Bd -literal -offset indent
-for child in zfs.list.children("rpool") do
+.Bd -literal -compact -offset indent
+.No for child in Fn zfs.list.children \&"rpool" No do
...
end
.Ed
.Pp
-The available zfs.list functions are:
+The available
+.Sy zfs.list
+functions are:
.Bl -tag -width "xx"
-.It Em zfs.list.clones(snapshot)
+.It Fn zfs.list.clones snapshot
Iterate through all clones of the given snapshot.
.Pp
-snapshot (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "snapshot (string)"
+.It Ar snapshot Pq string
Must be a valid snapshot path in the current pool.
-.Ed
-.It Em zfs.list.snapshots(dataset)
+.El
+.It Fn zfs.list.snapshots dataset
Iterate through all snapshots of the given dataset.
-Each snapshot is returned as a string containing the full dataset name, e.g.
-"pool/fs@snap".
+Each snapshot is returned as a string containing the full dataset name,
+e.g. "pool/fs@snap".
.Pp
-dataset (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "snapshot (string)"
+.It Ar dataset Pq string
Must be a valid filesystem or volume.
-.Ed
-.It Em zfs.list.children(dataset)
+.El
+.It Fn zfs.list.children dataset
Iterate through all direct children of the given dataset.
-Each child is returned as a string containing the full dataset name, e.g.
-"pool/fs/child".
+Each child is returned as a string containing the full dataset name,
+e.g. "pool/fs/child".
.Pp
-dataset (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "snapshot (string)"
+.It Ar dataset Pq string
Must be a valid filesystem or volume.
-.Ed
-.It Em zfs.list.bookmarks(dataset)
-Iterate through all bookmarks of the given dataset. Each bookmark is returned
-as a string containing the full dataset name, e.g. "pool/fs#bookmark".
+.El
+.It Fn zfs.list.bookmarks dataset
+Iterate through all bookmarks of the given dataset.
+Each bookmark is returned as a string containing the full dataset name,
+e.g. "pool/fs#bookmark".
.Pp
-dataset (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "snapshot (string)"
+.It Ar dataset Pq string
Must be a valid filesystem or volume.
-.Ed
-.It Em zfs.list.holds(snapshot)
-Iterate through all user holds on the given snapshot. Each hold is returned
+.El
+.It Fn zfs.list.holds snapshot
+Iterate through all user holds on the given snapshot.
+Each hold is returned
as a pair of the hold's tag and the timestamp (in seconds since the epoch) at
which it was created.
.Pp
-snapshot (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "snapshot (string)"
+.It Ar snapshot Pq string
Must be a valid snapshot.
-.Ed
-.It Em zfs.list.properties(dataset)
+.El
+.It Fn zfs.list.properties dataset
An alias for zfs.list.user_properties (see relevant entry).
.Pp
-dataset (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "snapshot (string)"
+.It Ar dataset Pq string
Must be a valid filesystem, snapshot, or volume.
-.Ed
-.It Em zfs.list.user_properties(dataset)
-Iterate through all user properties for the given dataset. For each
-step of the iteration, output the property name, its value, and its source.
+.El
+.It Fn zfs.list.user_properties dataset
+Iterate through all user properties for the given dataset.
+For each step of the iteration, output the property name, its value,
+and its source.
Throws a Lua error if the dataset is invalid.
.Pp
-dataset (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "snapshot (string)"
+.It Ar dataset Pq string
Must be a valid filesystem, snapshot, or volume.
-.Ed
-.It Em zfs.list.system_properties(dataset)
+.El
+.It Fn zfs.list.system_properties dataset
Returns an array of strings, the names of the valid system (non-user defined)
properties for the given dataset.
Throws a Lua error if the dataset is invalid.
.Pp
-dataset (string)
-.Bd -ragged -compact -offset "xxxx"
+.Bl -tag -compact -width "snapshot (string)"
+.It Ar dataset Pq string
Must be a valid filesystem, snapshot or volume.
-.Ed
.El
.El
+.El
+.
.Sh EXAMPLES
+.
.Ss Example 1
The following channel program recursively destroys a filesystem and all its
snapshots and children in a naive manner.
@@ -579,6 +571,7 @@ function destroy_recursive(root)
end
destroy_recursive("pool/somefs")
.Ed
+.
.Ss Example 2
A more verbose and robust version of the same channel program, which
properly detects and reports errors, and also takes the dataset to destroy
@@ -617,6 +610,7 @@ results["succeeded"] = succeeded
results["failed"] = failed
return results
.Ed
+.
.Ss Example 3
The following function performs a forced promote operation by attempting to
promote the given clone and destroying any conflicting snapshots.
diff --git a/sys/contrib/openzfs/man/man8/zfs-project.8 b/sys/contrib/openzfs/man/man8/zfs-project.8
index 21c300f83df1..f264a110fc00 100644
--- a/sys/contrib/openzfs/man/man8/zfs-project.8
+++ b/sys/contrib/openzfs/man/man8/zfs-project.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -30,68 +29,65 @@
.\" Copyright 2018 Nexenta Systems, Inc.
.\" Copyright 2019 Joyent, Inc.
.\"
-.Dd June 30, 2019
+.Dd May 27, 2021
.Dt ZFS-PROJECT 8
.Os
+.
.Sh NAME
.Nm zfs-project
-.Nd List, set, or clear project ID and/or inherit flag on the file(s) or directories.
+.Nd manage projects in ZFS filesystem
.Sh SYNOPSIS
.Nm zfs
.Cm project
.Oo Fl d Ns | Ns Fl r Ns Oc
-.Ar file Ns | Ns Ar directory Ns ...
+.Ar file Ns | Ns Ar directory Ns …
.Nm zfs
.Cm project
.Fl C
.Oo Fl kr Ns Oc
-.Ar file Ns | Ns Ar directory Ns ...
+.Ar file Ns | Ns Ar directory Ns …
.Nm zfs
.Cm project
.Fl c
.Oo Fl 0 Ns Oc
.Oo Fl d Ns | Ns Fl r Ns Oc
.Op Fl p Ar id
-.Ar file Ns | Ns Ar directory Ns ...
+.Ar file Ns | Ns Ar directory Ns …
.Nm zfs
.Cm project
.Op Fl p Ar id
.Oo Fl rs Ns Oc
-.Ar file Ns | Ns Ar directory Ns ...
+.Ar file Ns | Ns Ar directory Ns …
+.
.Sh DESCRIPTION
.Bl -tag -width ""
.It Xo
.Nm zfs
.Cm project
.Oo Fl d Ns | Ns Fl r Ns Oc
-.Ar file Ns | Ns Ar directory Ns ...
+.Ar file Ns | Ns Ar directory Ns …
.Xc
-List project identifier (ID) and inherit flag of file(s) or directories.
+List project identifier (ID) and inherit flag of files and directories.
.Bl -tag -width "-d"
.It Fl d
-Show the directory project ID and inherit flag, not its children. It will
-overwrite the former specified
-.Fl r
-option.
+Show the directory project ID and inherit flag, not its children.
.It Fl r
-Show on subdirectories recursively. It will overwrite the former specified
-.Fl d
-option.
+List subdirectories recursively.
.El
.It Xo
.Nm zfs
.Cm project
.Fl C
.Oo Fl kr Ns Oc
-.Ar file Ns | Ns Ar directory Ns ...
+.Ar file Ns | Ns Ar directory Ns …
.Xc
-Clear project inherit flag and/or ID on the file(s) or directories.
+Clear project inherit flag and/or ID on the files and directories.
.Bl -tag -width "-k"
.It Fl k
-Keep the project ID unchanged. If not specified, the project ID will be reset
-as zero.
+Keep the project ID unchanged.
+If not specified, the project ID will be reset to zero.
.It Fl r
-Clear on subdirectories recursively.
+Clear subdirectories' flags recursively.
.El
.It Xo
.Nm zfs
@@ -100,54 +96,46 @@ Clear on subdirectories recursively.
.Oo Fl 0 Ns Oc
.Oo Fl d Ns | Ns Fl r Ns Oc
.Op Fl p Ar id
-.Ar file Ns | Ns Ar directory Ns ...
+.Ar file Ns | Ns Ar directory Ns …
.Xc
-Check project ID and inherit flag on the file(s) or directories, report the
-entries without project inherit flag or with different project IDs from the
-specified (via
-.Fl p
-option) value or the target directory's project ID.
-.Bl -tag -width "-0"
+Check project ID and inherit flag on the files and directories:
+report entries without the project inherit flag, or with project IDs different from the
+target directory's project ID or the one specified with
+.Fl p .
+.Bl -tag -width "-p id"
.It Fl 0
-Print file name with a trailing NUL instead of newline (by default), like
-"find -print0".
+Delimit filenames with a NUL byte instead of newline.
.It Fl d
-Check the directory project ID and inherit flag, not its children. It will
-overwrite the former specified
-.Fl r
-option.
-.It Fl p
-Specify the referenced ID for comparing with the target file(s) or directories'
-project IDs. If not specified, the target (top) directory's project ID will be
-used as the referenced one.
+Check the directory project ID and inherit flag, not its children.
+.It Fl p Ar id
+Compare to
+.Ar id
+instead of the target files and directories' project IDs.
.It Fl r
-Check on subdirectories recursively. It will overwrite the former specified
-.Fl d
-option.
+Check subdirectories recursively.
.El
.It Xo
.Nm zfs
.Cm project
-.Op Fl p Ar id
+.Fl p Ar id
.Oo Fl rs Ns Oc
-.Ar file Ns | Ns Ar directory Ns ...
+.Ar file Ns | Ns Ar directory Ns …
.Xc
-Set project ID and/or inherit flag on the file(s) or directories.
-.Bl -tag -width "-p"
-.It Fl p
-Set the file(s)' or directories' project ID with the given value.
+Set project ID and/or inherit flag on the files and directories.
+.Bl -tag -width "-p id"
+.It Fl p Ar id
+Set the project ID to the given value.
.It Fl r
Set on subdirectories recursively.
.It Fl s
-Set project inherit flag on the given file(s) or directories. It is usually used
-for setup tree quota on the directory target with
-.Fl r
-option specified together. When setup tree quota, by default the directory's
-project ID will be set to all its descendants unless you specify the project
-ID via
-.Fl p
-option explicitly.
+Set project inherit flag on the given files and directories.
+This is usually used for setting up tree quotas with
+.Fl r .
+In that case, the directory's project ID
+will be set for all its descendants, unless specified explicitly with
+.Fl p .
.El
.El
+.
.Sh SEE ALSO
.Xr zfs-projectspace 8
diff --git a/sys/contrib/openzfs/man/man8/zfs-promote.8 b/sys/contrib/openzfs/man/man8/zfs-promote.8
index 64c124c11b61..ba8cd5f6da80 100644
--- a/sys/contrib/openzfs/man/man8/zfs-promote.8
+++ b/sys/contrib/openzfs/man/man8/zfs-promote.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -33,37 +32,33 @@
.Dd June 30, 2019
.Dt ZFS-PROMOTE 8
.Os
+.
.Sh NAME
.Nm zfs-promote
-.Nd Promotes a clone file system to no longer be dependent on its origin snapshot.
+.Nd promote clone dataset to no longer depend on origin snapshot
.Sh SYNOPSIS
.Nm zfs
.Cm promote
-.Ar clone-filesystem
+.Ar clone
+.
.Sh DESCRIPTION
-.Bl -tag -width ""
-.It Xo
-.Nm zfs
-.Cm promote
-.Ar clone-filesystem
-.Xc
The
-.Cm promote
-command makes it possible to destroy the file system that the clone was created
-from.
+.Nm zfs Cm promote
+command makes it possible to destroy the dataset that the clone was created from.
The clone parent-child dependency relationship is reversed, so that the origin
-file system becomes a clone of the specified file system.
+dataset becomes a clone of the specified dataset.
.Pp
The snapshot that was cloned, and any snapshots previous to this snapshot, are
now owned by the promoted clone.
-The space they use moves from the origin file system to the promoted clone, so
+The space they use moves from the origin dataset to the promoted clone, so
enough space must be available to accommodate these snapshots.
No new space is consumed by this operation, but the space accounting is
adjusted.
The promoted clone must not have any conflicting snapshot names of its own.
The
-.Xr zfs-rename 8
+.Nm zfs Cm rename
subcommand can be used to rename any conflicting snapshots.
-.El
+.
.Sh SEE ALSO
-.Xr zfs-clone 8
+.Xr zfs-clone 8 ,
+.Xr zfs-rename 8
diff --git a/sys/contrib/openzfs/man/man8/zfs-receive.8 b/sys/contrib/openzfs/man/man8/zfs-receive.8
index 36ed2050683a..d2cec42a8e71 100644
--- a/sys/contrib/openzfs/man/man8/zfs-receive.8
+++ b/sys/contrib/openzfs/man/man8/zfs-receive.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -33,9 +32,10 @@
.Dd February 16, 2020
.Dt ZFS-RECEIVE 8
.Os
+.
.Sh NAME
.Nm zfs-receive
-.Nd Creates a snapshot whose contents are as specified in the stream provided on standard input.
+.Nd create snapshot from backup stream
.Sh SYNOPSIS
.Nm zfs
.Cm receive
@@ -56,6 +56,7 @@
.Cm receive
.Fl A
.Ar filesystem Ns | Ns Ar volume
+.
.Sh DESCRIPTION
.Bl -tag -width ""
.It Xo
@@ -85,7 +86,7 @@ Streams are created using the
subcommand, which by default creates a full stream.
.Nm zfs Cm recv
can be used as an alias for
-.Nm zfs Cm receive.
+.Nm zfs Cm receive .
.Pp
If an incremental stream is received, then the destination file system must
already exist, and its most recent snapshot must match the incremental stream's
@@ -116,15 +117,17 @@ If
or
.Fl x Em property
is specified, it applies to the effective value of the property throughout
-the entire subtree of replicated datasets. Effective property values will be
-set (
-.Fl o
-) or inherited (
-.Fl x
-) on the topmost in the replicated subtree. In descendant datasets, if the
+the entire subtree of replicated datasets.
+Effective property values will be set
+.Pq Fl o
+or inherited
+.Pq Fl x
+on the topmost in the replicated subtree.
+In descendant datasets, if the
property is set by the send stream, it will be overridden by forcing the
-property to be inherited from the top‐most file system. Received properties
-are retained in spite of being overridden and may be restored with
+property to be inherited from the top‐most file system.
+Received properties are retained in spite of being overridden
+and may be restored with
.Nm zfs Cm inherit Fl S .
Specifying
.Fl o Sy origin Ns = Ns Em snapshot
@@ -134,41 +137,51 @@ is a read-only property and cannot be set, it's allowed to receive the send
stream as a clone of the given snapshot.
.Pp
Raw encrypted send streams (created with
-.Nm zfs Cm send Fl w
-) may only be received as is, and cannot be re-encrypted, decrypted, or
-recompressed by the receive process. Unencrypted streams can be received as
+.Nm zfs Cm send Fl w )
+may only be received as is, and cannot be re-encrypted, decrypted, or
+recompressed by the receive process.
+Unencrypted streams can be received as
encrypted datasets, either through inheritance or by specifying encryption
parameters with the
.Fl o
-options. Note that the
+options.
+Note that the
.Sy keylocation
property cannot be overridden to
.Sy prompt
-during a receive. This is because the receive process itself is already using
-stdin for the send stream. Instead, the property can be overridden after the
-receive completes.
+during a receive.
+This is because the receive process itself is already using
+the standard input for the send stream.
+Instead, the property can be overridden after the receive completes.
.Pp
The added security provided by raw sends adds some restrictions to the send
-and receive process. ZFS will not allow a mix of raw receives and non-raw
-receives. Specifically, any raw incremental receives that are attempted after
-a non-raw receive will fail. Non-raw receives do not have this restriction and,
-therefore, are always possible. Because of this, it is best practice to always
+and receive process.
+ZFS will not allow a mix of raw receives and non-raw receives.
+Specifically, any raw incremental receives that are attempted after
+a non-raw receive will fail.
+Non-raw receives do not have this restriction and,
+therefore, are always possible.
+Because of this, it is best practice to always
use either raw sends for their security benefits or non-raw sends for their
flexibility when working with encrypted datasets, but not a combination.
.Pp
The reason for this restriction stems from the inherent restrictions of the
-AEAD ciphers that ZFS uses to encrypt data. When using ZFS native encryption,
+AEAD ciphers that ZFS uses to encrypt data.
+When using ZFS native encryption,
each block of data is encrypted against a randomly generated number known as
the "initialization vector" (IV), which is stored in the filesystem metadata.
This number is required by the encryption algorithms whenever the data is to
-be decrypted. Together, all of the IVs provided for all of the blocks in a
-given snapshot are collectively called an "IV set". When ZFS performs a raw
-send, the IV set is transferred from the source to the destination in the send
-stream. When ZFS performs a non-raw send, the data is decrypted by the source
+be decrypted.
+Together, all of the IVs provided for all of the blocks in a
+given snapshot are collectively called an "IV set".
+When ZFS performs a raw send, the IV set is transferred from the source
+to the destination in the send stream.
+When ZFS performs a non-raw send, the data is decrypted by the source
system and re-encrypted by the destination system, creating a snapshot with
-effectively the same data, but a different IV set. In order for decryption to
-work after a raw send, ZFS must ensure that the IV set used on both the source
-and destination side match. When an incremental raw receive is performed on
+effectively the same data, but a different IV set.
+In order for decryption to work after a raw send, ZFS must ensure that
+the IV set used on both the source and destination side match.
+When an incremental raw receive is performed on
top of an existing snapshot, ZFS will check to confirm that the "from"
snapshot on both the source and destination were using the same IV set,
ensuring the new IV set is consistent.
@@ -234,7 +247,8 @@ Discard all but the last element of the sent snapshot's file system name, using
that element to determine the name of the target file system for the new
snapshot as described in the paragraph above.
.It Fl h
-Skip the receive of holds. There is no effect if holds are not sent.
+Skip the receive of holds.
+There is no effect if holds are not sent.
.It Fl M
Force an unmount of the file system while receiving a snapshot.
This option is not supported on Linux.
@@ -254,7 +268,8 @@ performed.
.It Fl o Em property Ns = Ns Ar value
Sets the specified property as if the command
.Nm zfs Cm set Em property Ns = Ns Ar value
-was invoked immediately before the receive. When receiving a stream from
+was invoked immediately before the receive.
+When receiving a stream from
.Nm zfs Cm send Fl R ,
causes the property to be inherited by all descendant datasets, as through
.Nm zfs Cm inherit Em property
@@ -267,11 +282,13 @@ then overriding the
.Sy compression
property will have no affect on received data but the
.Sy compression
-property will be set. To have the data recompressed on receive remove the
+property will be set.
+To have the data recompressed on receive remove the
.Fl c
flag from the send stream.
.Pp
-Any editable property can be set at receive time. Set-once properties bound
+Any editable property can be set at receive time.
+Set-once properties bound
to the received data, such as
.Sy normalization
and
@@ -286,8 +303,8 @@ cannot be set at receive time.
.Pp
The
.Fl o
-option may be specified multiple times, for different properties. An error
-results if the same property is specified in multiple
+option may be specified multiple times, for different properties.
+An error results if the same property is specified in multiple
.Fl o
or
.Fl x
@@ -295,30 +312,27 @@ options.
.Pp
The
.Fl o
-option may also be used to override encryption properties upon initial
-receive. This allows unencrypted streams to be received as encrypted datasets.
+option may also be used to override encryption properties upon initial receive.
+This allows unencrypted streams to be received as encrypted datasets.
To cause the received dataset (or root dataset of a recursive stream) to be
received as an encryption root, specify encryption properties in the same
manner as is required for
-.Nm zfs
-.Cm create .
+.Nm zfs Cm create .
For instance:
-.Bd -literal
-# zfs send tank/test@snap1 | zfs recv -o encryption=on -o keyformat=passphrase -o keylocation=file:///path/to/keyfile
-.Ed
+.Dl # Nm zfs Cm send Pa tank/test@snap1 | Nm zfs Cm recv Fl o Sy encryption Ns = Ns Sy on Fl o keyformat=passphrase Fl o Sy keylocation Ns = Ns Pa file:///path/to/keyfile
.Pp
Note that
-.Op Fl o Ar keylocation Ns = Ns Ar prompt
-may not be specified here, since stdin is already being utilized for the send
-stream. Once the receive has completed, you can use
-.Nm zfs
-.Cm set
-to change this setting after the fact. Similarly, you can receive a dataset as
-an encrypted child by specifying
+.Fl o Sy keylocation Ns = Ns Sy prompt
+may not be specified here, since the standard input
+is already being utilized for the send stream.
+Once the receive has completed, you can use
+.Nm zfs Cm set
+to change this setting after the fact.
+Similarly, you can receive a dataset as an encrypted child by specifying
.Op Fl x Ar encryption
-to force the property to be inherited. Overriding encryption properties (except
-for
-.Sy keylocation Ns )
+to force the property to be inherited.
+Overriding encryption properties (except for
+.Sy keylocation )
is not possible with raw send streams.
.It Fl s
If the receive is interrupted, save the partially received state, rather
@@ -343,7 +357,7 @@ To use this flag, the storage pool must have the
.Sy extensible_dataset
feature enabled.
See
-.Xr zpool-features 5
+.Xr zpool-features 7
for details on ZFS feature flags.
.It Fl u
File system that is associated with the received stream is not mounted.
@@ -380,6 +394,7 @@ Abort an interrupted
.Nm zfs Cm receive Fl s ,
deleting its saved partially received state.
.El
+.
.Sh SEE ALSO
-.Xr zfs-send 8
+.Xr zfs-send 8 ,
.Xr zstream 8
diff --git a/sys/contrib/openzfs/man/man8/zfs-rename.8 b/sys/contrib/openzfs/man/man8/zfs-rename.8
index f57bcd8441f4..6caee50657ee 100644
--- a/sys/contrib/openzfs/man/man8/zfs-rename.8
+++ b/sys/contrib/openzfs/man/man8/zfs-rename.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -33,9 +32,10 @@
.Dd September 1, 2020
.Dt ZFS-RENAME 8
.Os
+.
.Sh NAME
.Nm zfs-rename
-.Nd Renames the given dataset (filesystem or snapshot).
+.Nd rename ZFS dataset
.Sh SYNOPSIS
.Nm zfs
.Cm rename
@@ -57,6 +57,7 @@
.Cm rename
.Fl r
.Ar snapshot Ar snapshot
+.
.Sh DESCRIPTION
.Bl -tag -width ""
.It Xo
diff --git a/sys/contrib/openzfs/man/man8/zfs-rollback.8 b/sys/contrib/openzfs/man/man8/zfs-rollback.8
index 8a7cb6621fae..08e914b47659 100644
--- a/sys/contrib/openzfs/man/man8/zfs-rollback.8
+++ b/sys/contrib/openzfs/man/man8/zfs-rollback.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -30,25 +29,20 @@
.\" Copyright 2018 Nexenta Systems, Inc.
.\" Copyright 2019 Joyent, Inc.
.\"
-.Dd June 30, 2019
+.Dd May 27, 2021
.Dt ZFS-ROLLBACK 8
.Os
+.
.Sh NAME
.Nm zfs-rollback
-.Nd Roll back the given dataset to a previous snapshot.
+.Nd roll ZFS dataset back to snapshot
.Sh SYNOPSIS
.Nm zfs
.Cm rollback
.Op Fl Rfr
.Ar snapshot
+.
.Sh DESCRIPTION
-.Bl -tag -width ""
-.It Xo
-.Nm zfs
-.Cm rollback
-.Op Fl Rfr
-.Ar snapshot
-.Xc
When a dataset is rolled back, all data that has changed since the snapshot is
discarded, and the dataset reverts to the state at the time of the snapshot.
By default, the command refuses to roll back to a snapshot other than the most
@@ -63,7 +57,7 @@ The
options do not recursively destroy the child snapshots of a recursive snapshot.
Only direct snapshots of the specified filesystem are destroyed by either of
these options.
-To completely roll back a recursive snapshot, you must rollback the individual
+To completely roll back a recursive snapshot, you must roll back the individual
child snapshots.
.Bl -tag -width "-R"
.It Fl R
@@ -76,6 +70,6 @@ option to force an unmount of any clone file systems that are to be destroyed.
.It Fl r
Destroy any snapshots and bookmarks more recent than the one specified.
.El
-.El
+.
.Sh SEE ALSO
.Xr zfs-snapshot 8
diff --git a/sys/contrib/openzfs/man/man8/zfs-send.8 b/sys/contrib/openzfs/man/man8/zfs-send.8
index 5a072c18527a..a3d08fbf6e2c 100644
--- a/sys/contrib/openzfs/man/man8/zfs-send.8
+++ b/sys/contrib/openzfs/man/man8/zfs-send.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -33,9 +32,10 @@
.Dd April 15, 2021
.Dt ZFS-SEND 8
.Os
+.
.Sh NAME
.Nm zfs-send
-.Nd Generate a send stream, which may be of a filesystem, and may be incremental from a bookmark.
+.Nd generate backup stream of ZFS dataset
.Sh SYNOPSIS
.Nm zfs
.Cm send
@@ -51,7 +51,6 @@
.Cm send
.Fl -redact Ar redaction_bookmark
.Op Fl DLPcenpv
-.br
.Op Fl i Ar snapshot Ns | Ns Ar bookmark
.Ar snapshot
.Nm zfs
@@ -66,7 +65,8 @@
.Nm zfs
.Cm redact
.Ar snapshot redaction_bookmark
-.Ar redaction_snapshot Ns ...
+.Ar redaction_snapshot Ns …
+.
.Sh DESCRIPTION
.Bl -tag -width ""
.It Xo
@@ -85,7 +85,7 @@ The output can be redirected to a file or to a different system
.Pc .
By default, a full stream is generated.
.Bl -tag -width "-D"
-.It Fl D, -dedup
+.It Fl D , -dedup
Deduplicated send is no longer supported.
This flag is accepted for backwards compatibility, but a regular,
non-deduplicated stream will be generated.
@@ -99,7 +99,7 @@ is similar to
The incremental source may be specified as with the
.Fl i
option.
-.It Fl L, -large-block
+.It Fl L , -large-block
Generate a stream which may contain blocks larger than 128KB.
This flag has no effect if the
.Sy large_blocks
@@ -110,13 +110,13 @@ The receiving system must have the
.Sy large_blocks
pool feature enabled as well.
See
-.Xr zpool-features 5
+.Xr zpool-features 7
for details on ZFS feature flags and the
.Sy large_blocks
feature.
-.It Fl P, -parsable
+.It Fl P , -parsable
Print machine-parsable verbose information about the stream package generated.
-.It Fl R, -replicate
+.It Fl R , -replicate
Generate a replication stream package, which will replicate the specified
file system, and all descendent file systems, up to the named snapshot.
When received, all properties, snapshots, descendent file systems, and clones
@@ -134,12 +134,13 @@ set when the stream is received.
If the
.Fl F
flag is specified when this stream is received, snapshots and file systems that
-do not exist on the sending side are destroyed. If the
+do not exist on the sending side are destroyed.
+If the
.Fl R
flag is used to send encrypted datasets, then
.Fl w
must also be specified.
-.It Fl e, -embed
+.It Fl e , -embed
Generate a more compact stream by using
.Sy WRITE_EMBEDDED
records for blocks which are stored more compactly on disk by the
@@ -154,24 +155,25 @@ feature enabled.
If the
.Sy lz4_compress
feature is active on the sending system, then the receiving system must have
-that feature enabled as well. Datasets that are sent with this flag may not be
+that feature enabled as well.
+Datasets that are sent with this flag may not be
received as an encrypted dataset, since encrypted datasets cannot use the
.Sy embedded_data
feature.
See
-.Xr zpool-features 5
+.Xr zpool-features 7
for details on ZFS feature flags and the
.Sy embedded_data
feature.
-.It Fl b, -backup
+.It Fl b , -backup
Sends only received property values whether or not they are overridden by local
-settings, but only if the dataset has ever been received. Use this option when
-you want
+settings, but only if the dataset has ever been received.
+Use this option when you want
.Nm zfs Cm receive
to restore received properties backed up on the sent dataset and to avoid
sending local settings that may have nothing to do with the source dataset,
but only with how the data is backed up.
-.It Fl c, -compressed
+.It Fl c , -compressed
Generate a more compact stream by using compressed WRITE records for blocks
which are compressed on disk and in memory
.Po see the
@@ -189,34 +191,36 @@ feature is enabled on the sending system but the
option is not supplied in conjunction with
.Fl c ,
then the data will be decompressed before sending so it can be split into
-smaller block sizes. Streams sent with
+smaller block sizes.
+Streams sent with
.Fl c
will not have their data recompressed on the receiver side using
-.Fl o compress=value.
-The data will stay compressed as it was from the sender. The new compression
-property will be set for future data.
-.It Fl w, -raw
-For encrypted datasets, send data exactly as it exists on disk. This allows
-backups to be taken even if encryption keys are not currently loaded. The
-backup may then be received on an untrusted machine since that machine will
+.Fl o Sy compress Ns = Ar value .
+The data will stay compressed as it was from the sender.
+The new compression property will be set for future data.
+.It Fl w , -raw
+For encrypted datasets, send data exactly as it exists on disk.
+This allows backups to be taken even if encryption keys are not currently loaded.
+The backup may then be received on an untrusted machine since that machine will
not have the encryption keys to read the protected data or alter it without
-being detected. Upon being received, the dataset will have the same encryption
+being detected.
+Upon being received, the dataset will have the same encryption
keys as it did on the send side, although the
.Sy keylocation
property will be defaulted to
.Sy prompt
-if not otherwise provided. For unencrypted datasets, this flag will be
-equivalent to
+if not otherwise provided.
+For unencrypted datasets, this flag will be equivalent to
.Fl Lec .
Note that if you do not use this flag for sending encrypted datasets, data will
be sent unencrypted and may be re-encrypted with a different encryption key on
the receiving system, which will disable the ability to do a raw send to that
system for incrementals.
-.It Fl h, -holds
+.It Fl h , -holds
Generate a stream package that includes any snapshot holds (created with the
-.Sy zfs hold
+.Nm zfs Cm hold
command), and indicating to
-.Sy zfs receive
+.Nm zfs Cm receive
that the holds be applied to the dataset on the receiving system.
.It Fl i Ar snapshot
Generate an incremental stream from the first
@@ -240,7 +244,7 @@ be fully specified
not just
.Em @origin
.Pc .
-.It Fl n, -dryrun
+.It Fl n , -dryrun
Do a dry-run
.Pq Qq No-op
send.
@@ -254,22 +258,24 @@ In this case, the verbose output will be written to standard output
.Po contrast with a non-dry-run, where the stream is written to standard output
and the verbose output goes to standard error
.Pc .
-.It Fl p, -props
+.It Fl p , -props
Include the dataset's properties in the stream.
This flag is implicit when
.Fl R
is specified.
-The receiving system must also support this feature. Sends of encrypted datasets
-must use
+The receiving system must also support this feature.
+Sends of encrypted datasets must use
.Fl w
when using this flag.
-.It Fl s, -skip-missing
+.It Fl s , -skip-missing
Allows sending a replication stream even when there are snapshots missing in the
-hierarchy. When a snapshot is missing, instead of throwing an error and aborting
-the send, a warning is printed to STDERR and the dataset to which it belongs
-and its descendents are skipped. This flag can only be used in conjunction with
+hierarchy.
+When a snapshot is missing, instead of throwing an error and aborting the send,
+a warning is printed to the standard error stream and the dataset to which it belongs
+and its descendents are skipped.
+This flag can only be used in conjunction with
.Fl R .
-.It Fl v, -verbose
+.It Fl v , -verbose
Print verbose information about the stream package generated.
This information includes a per-second report of how much data has been sent.
.Pp
@@ -291,7 +297,7 @@ When the stream generated from a filesystem or volume is received, the default
snapshot name will be
.Qq --head-- .
.Bl -tag -width "-L"
-.It Fl L, -large-block
+.It Fl L , -large-block
Generate a stream which may contain blocks larger than 128KB.
This flag has no effect if the
.Sy large_blocks
@@ -302,13 +308,13 @@ The receiving system must have the
.Sy large_blocks
pool feature enabled as well.
See
-.Xr zpool-features 5
+.Xr zpool-features 7
for details on ZFS feature flags and the
.Sy large_blocks
feature.
-.It Fl P, -parsable
+.It Fl P , -parsable
Print machine-parsable verbose information about the stream package generated.
-.It Fl c, -compressed
+.It Fl c , -compressed
Generate a more compact stream by using compressed WRITE records for blocks
which are compressed on disk and in memory
.Po see the
@@ -327,24 +333,25 @@ option is not supplied in conjunction with
.Fl c ,
then the data will be decompressed before sending so it can be split into
smaller block sizes.
-.It Fl w, -raw
-For encrypted datasets, send data exactly as it exists on disk. This allows
-backups to be taken even if encryption keys are not currently loaded. The
-backup may then be received on an untrusted machine since that machine will
+.It Fl w , -raw
+For encrypted datasets, send data exactly as it exists on disk.
+This allows backups to be taken even if encryption keys are not currently loaded.
+The backup may then be received on an untrusted machine since that machine will
not have the encryption keys to read the protected data or alter it without
-being detected. Upon being received, the dataset will have the same encryption
+being detected.
+Upon being received, the dataset will have the same encryption
keys as it did on the send side, although the
.Sy keylocation
property will be defaulted to
.Sy prompt
-if not otherwise provided. For unencrypted datasets, this flag will be
-equivalent to
+if not otherwise provided.
+For unencrypted datasets, this flag will be equivalent to
.Fl Lec .
Note that if you do not use this flag for sending encrypted datasets, data will
be sent unencrypted and may be re-encrypted with a different encryption key on
the receiving system, which will disable the ability to do a raw send to that
system for incrementals.
-.It Fl e, -embed
+.It Fl e , -embed
Generate a more compact stream by using
.Sy WRITE_EMBEDDED
records for blocks which are stored more compactly on disk by the
@@ -359,12 +366,13 @@ feature enabled.
If the
.Sy lz4_compress
feature is active on the sending system, then the receiving system must have
-that feature enabled as well. Datasets that are sent with this flag may not be
-received as an encrypted dataset, since encrypted datasets cannot use the
+that feature enabled as well.
+Datasets that are sent with this flag may not be received as an encrypted dataset,
+since encrypted datasets cannot use the
.Sy embedded_data
feature.
See
-.Xr zpool-features 5
+.Xr zpool-features 7
for details on ZFS feature flags and the
.Sy embedded_data
feature.
@@ -383,7 +391,7 @@ character and following
If the incremental target is a clone, the incremental source can be the origin
snapshot, or an earlier snapshot in the origin's filesystem, or the origin's
origin, etc.
-.It Fl n, -dryrun
+.It Fl n , -dryrun
Do a dry-run
.Pq Qq No-op
send.
@@ -397,7 +405,7 @@ In this case, the verbose output will be written to standard output
.Po contrast with a non-dry-run, where the stream is written to standard output
and the verbose output goes to standard error
.Pc .
-.It Fl v, -verbose
+.It Fl v , -verbose
Print verbose information about the stream package generated.
This information includes a per-second report of how much data has been sent.
.El
@@ -406,7 +414,6 @@ This information includes a per-second report of how much data has been sent.
.Cm send
.Fl -redact Ar redaction_bookmark
.Op Fl DLPcenpv
-.br
.Op Fl i Ar snapshot Ns | Ns Ar bookmark
.Ar snapshot
.Xc
@@ -415,15 +422,15 @@ This send stream contains all blocks from the snapshot being sent that aren't
included in the redaction list contained in the bookmark specified by the
.Fl -redact
(or
-.Fl -d
-) flag.
+.Fl d )
+flag.
The resulting send stream is said to be redacted with respect to the snapshots
the bookmark specified by the
.Fl -redact No flag was created with.
The bookmark must have been created by running
-.Sy zfs redact
+.Nm zfs Cm redact
on the snapshot being sent.
-.sp
+.Pp
This feature can be used to allow clones of a filesystem to be made available on
a remote system, in the case where their parent need not (or needs to not) be
usable.
@@ -439,21 +446,23 @@ parent, that block will not be sent; but if one or more snapshots have not
modified a block in the parent, they will still reference the parent's block, so
that block will be sent.
Note that only user data will be redacted.
-.sp
+.Pp
When the redacted send stream is received, we will generate a redacted
snapshot.
Due to the nature of redaction, a redacted dataset can only be used in the
following ways:
-.sp
-1. To receive, as a clone, an incremental send from the original snapshot to one
+.Bl -enum -width "a."
+.It
+To receive, as a clone, an incremental send from the original snapshot to one
of the snapshots it was redacted with respect to.
In this case, the stream will produce a valid dataset when received because all
blocks that were redacted in the parent are guaranteed to be present in the
child's send stream.
This use case will produce a normal snapshot, which can be used just like other
snapshots.
-.sp
-2. To receive an incremental send from the original snapshot to something
+.
+.It
+To receive an incremental send from the original snapshot to something
redacted with respect to a subset of the set of snapshots the initial snapshot
was redacted with respect to.
In this case, each block that was redacted in the original is still redacted
@@ -461,8 +470,8 @@ In this case, each block that was redacted in the original is still redacted
(because the snapshots define what is permitted, and everything else is
redacted)).
This use case will produce a new redacted snapshot.
-.sp
-3. To receive an incremental send from a redaction bookmark of the original
+.It
+To receive an incremental send from a redaction bookmark of the original
snapshot that was created when redacting with respect to a subset of the set of
snapshots the initial snapshot was created with respect to
anything else.
@@ -471,27 +480,30 @@ necessary to fill in any redacted data, should it be needed, because the sending
system is aware of what blocks were originally redacted.
This will either produce a normal snapshot or a redacted one, depending on
whether the new send stream is redacted.
-.sp
-4. To receive an incremental send from a redacted version of the initial
+.It
+To receive an incremental send from a redacted version of the initial
snapshot that is redacted with respect to a subject of the set of snapshots the
initial snapshot was created with respect to.
A send stream from a compatible redacted dataset will contain all of the blocks
necessary to fill in any redacted data.
This will either produce a normal snapshot or a redacted one, depending on
whether the new send stream is redacted.
-.sp
-5. To receive a full send as a clone of the redacted snapshot.
+.It
+To receive a full send as a clone of the redacted snapshot.
Since the stream is a full send, it definitionally contains all the data needed
to create a new dataset.
This use case will either produce a normal snapshot or a redacted one, depending
on whether the full send stream was redacted.
-.sp
-These restrictions are detected and enforced by \fBzfs receive\fR; a
-redacted send stream will contain the list of snapshots that the stream is
+.El
+.Pp
+These restrictions are detected and enforced by
+.Nm zfs Cm receive ;
+a redacted send stream will contain the list of snapshots that the stream is
redacted with respect to.
These are stored with the redacted snapshot, and are used to detect and
-correctly handle the cases above. Note that for technical reasons, raw sends
-and redacted sends cannot be combined at this time.
+correctly handle the cases above.
+Note that for technical reasons,
+raw sends and redacted sends cannot be combined at this time.
.It Xo
.Nm zfs
.Cm send
@@ -505,7 +517,7 @@ The
is the value of this property on the filesystem or volume that was being
received into.
See the documentation for
-.Sy zfs receive -s
+.Nm zfs Cm receive Fl s
for more details.
.It Xo
.Nm zfs
@@ -517,18 +529,19 @@ for more details.
.Xc
Generate a send stream from a dataset that has been partially received.
.Bl -tag -width "-L"
-.It Fl S, -saved
+.It Fl S , -saved
This flag requires that the specified filesystem previously received a resumable
-send that did not finish and was interrupted. In such scenarios this flag
-enables the user to send this partially received state. Using this flag will
-always use the last fully received snapshot as the incremental source if it
-exists.
+send that did not finish and was interrupted.
+In such scenarios this flag
+enables the user to send this partially received state.
+Using this flag will always use the last fully received snapshot
+as the incremental source if it exists.
.El
.It Xo
.Nm zfs
.Cm redact
.Ar snapshot redaction_bookmark
-.Ar redaction_snapshot Ns ...
+.Ar redaction_snapshot Ns …
.Xc
Generate a new redaction bookmark.
In addition to the typical bookmark information, a redaction bookmark contains
@@ -538,81 +551,96 @@ of the redaction snapshots.
These blocks are found by iterating over the metadata in each redaction snapshot
to determine what has been changed since the target snapshot.
Redaction is designed to support redacted zfs sends; see the entry for
-.Sy zfs send
+.Nm zfs Cm send
for more information on the purpose of this operation.
If a redact operation fails partway through (due to an error or a system
failure), the redaction can be resumed by rerunning the same command.
.El
.Ss Redaction
ZFS has support for a limited version of data subsetting, in the form of
-redaction. Using the
-.Sy zfs redact
+redaction.
+Using the
+.Nm zfs Cm redact
command, a
.Sy redaction bookmark
-can be created that stores a list of blocks containing sensitive information. When
-provided to
-.Sy zfs
-.Sy send ,
+can be created that stores a list of blocks containing sensitive information.
+When provided to
+.Nm zfs Cm send ,
this causes a
.Sy redacted send
-to occur. Redacted sends omit the blocks containing sensitive information,
-replacing them with REDACT records. When these send streams are received, a
+to occur.
+Redacted sends omit the blocks containing sensitive information,
+replacing them with REDACT records.
+When these send streams are received, a
.Sy redacted dataset
-is created. A redacted dataset cannot be mounted by default, since it is
-incomplete. It can be used to receive other send streams. In this way datasets
-can be used for data backup and replication, with all the benefits that zfs send
-and receive have to offer, while protecting sensitive information from being
+is created.
+A redacted dataset cannot be mounted by default, since it is incomplete.
+It can be used to receive other send streams.
+In this way datasets can be used for data backup and replication,
+with all the benefits that zfs send and receive have to offer,
+while protecting sensitive information from being
stored on less-trusted machines or services.
.Pp
-For the purposes of redaction, there are two steps to the process. A redact
-step, and a send/receive step. First, a redaction bookmark is created. This is
-done by providing the
-.Sy zfs redact
+For the purposes of redaction, there are two steps to the process.
+A redact step, and a send/receive step.
+First, a redaction bookmark is created.
+This is done by providing the
+.Nm zfs Cm redact
command with a parent snapshot, a bookmark to be created, and a number of
-redaction snapshots. These redaction snapshots must be descendants of the
-parent snapshot, and they should modify data that is considered sensitive in
-some way. Any blocks of data modified by all of the redaction snapshots will
+redaction snapshots.
+These redaction snapshots must be descendants of the parent snapshot,
+and they should modify data that is considered sensitive in some way.
+Any blocks of data modified by all of the redaction snapshots will
be listed in the redaction bookmark, because it represents the truly sensitive
-information. When it comes to the send step, the send process will not send
+information.
+When it comes to the send step, the send process will not send
the blocks listed in the redaction bookmark, instead replacing them with
-REDACT records. When received on the target system, this will create a
+REDACT records.
+When received on the target system, this will create a
redacted dataset, missing the data that corresponds to the blocks in the
-redaction bookmark on the sending system. The incremental send streams from
+redaction bookmark on the sending system.
+The incremental send streams from
the original parent to the redaction snapshots can then also be received on
the target system, and this will produce a complete snapshot that can be used
-normally. Incrementals from one snapshot on the parent filesystem and another
+normally.
+Incrementals from one snapshot on the parent filesystem and another
can also be done by sending from the redaction bookmark, rather than the
snapshots themselves.
.Pp
-In order to make the purpose of the feature more clear, an example is
-provided. Consider a zfs filesystem containing four files. These files
-represent information for an online shopping service. One file contains a list
-of usernames and passwords, another contains purchase histories, a third
-contains click tracking data, and a fourth contains user preferences. The
-owner of this data wants to make it available for their development teams to
-test against, and their market research teams to do analysis on. The
-development teams need information about user preferences and the click
+In order to make the purpose of the feature more clear, an example is provided.
+Consider a zfs filesystem containing four files.
+These files represent information for an online shopping service.
+One file contains a list of usernames and passwords, another contains purchase histories,
+a third contains click tracking data, and a fourth contains user preferences.
+The owner of this data wants to make it available for their development teams to
+test against, and their market research teams to do analysis on.
+The development teams need information about user preferences and the click
tracking data, while the market research teams need information about purchase
-histories and user preferences. Neither needs access to the usernames and
-passwords. However, because all of this data is stored in one ZFS filesystem,
-it must all be sent and received together. In addition, the owner of the data
+histories and user preferences.
+Neither needs access to the usernames and passwords.
+However, because all of this data is stored in one ZFS filesystem,
+it must all be sent and received together.
+In addition, the owner of the data
wants to take advantage of features like compression, checksumming, and
-snapshots, so they do want to continue to use ZFS to store and transmit their
-data. Redaction can help them do so. First, they would make two clones of a
-snapshot of the data on the source. In one clone, they create the setup they
-want their market research team to see; they delete the usernames and
-passwords file, and overwrite the click tracking data with dummy
-information. In another, they create the setup they want the development teams
+snapshots, so they do want to continue to use ZFS to store and transmit their data.
+Redaction can help them do so.
+First, they would make two clones of a snapshot of the data on the source.
+In one clone, they create the setup they want their market research team to see;
+they delete the usernames and passwords file,
+and overwrite the click tracking data with dummy information.
+In another, they create the setup they want the development teams
to see, by replacing the passwords with fake information and replacing the
-purchase histories with randomly generated ones. They would then create a
-redaction bookmark on the parent snapshot, using snapshots on the two clones
-as redaction snapshots. The parent can then be sent, redacted, to the target
-server where the research and development teams have access. Finally,
-incremental sends from the parent snapshot to each of the clones can be send
+purchase histories with randomly generated ones.
+They would then create a redaction bookmark on the parent snapshot,
+using snapshots on the two clones as redaction snapshots.
+The parent can then be sent, redacted, to the target
+server where the research and development teams have access.
+Finally, incremental sends from the parent snapshot to each of the clones can be sent
to and received on the target server; these snapshots are identical to the
ones on the source, and are ready to be used, while the parent snapshot on the
target contains none of the username and password data present on the source,
because it was removed by the redacted send operation.
+.
.Sh SEE ALSO
.Xr zfs-bookmark 8 ,
.Xr zfs-receive 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zfs-set.8 b/sys/contrib/openzfs/man/man8/zfs-set.8
index 74a7a61d0e29..a3588cc26638 100644
--- a/sys/contrib/openzfs/man/man8/zfs-set.8
+++ b/sys/contrib/openzfs/man/man8/zfs-set.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -30,41 +29,43 @@
.\" Copyright 2018 Nexenta Systems, Inc.
.\" Copyright 2019 Joyent, Inc.
.\"
-.Dd June 30, 2019
+.Dd June 2, 2021
.Dt ZFS-SET 8
.Os
+.
.Sh NAME
.Nm zfs-set
-.Nd Sets the property or list of properties to the given value(s) for each dataset.
+.Nd set properties on ZFS datasets
.Sh SYNOPSIS
.Nm zfs
.Cm set
-.Ar property Ns = Ns Ar value Oo Ar property Ns = Ns Ar value Oc Ns ...
-.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns ...
+.Ar property Ns = Ns Ar value Oo Ar property Ns = Ns Ar value Oc Ns …
+.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns …
.Nm zfs
.Cm get
.Op Fl r Ns | Ns Fl d Ar depth
.Op Fl Hp
-.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns ... Oc
-.Oo Fl s Ar source Ns Oo , Ns Ar source Oc Ns ... Oc
-.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... Oc
-.Cm all | Ar property Ns Oo , Ns Ar property Oc Ns ...
-.Oo Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns | Ns Ar bookmark Oc Ns ...
+.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns … Oc
+.Oo Fl s Ar source Ns Oo , Ns Ar source Oc Ns … Oc
+.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns … Oc
+.Cm all Ns | Ns Ar property Ns Oo , Ns Ar property Oc Ns …
+.Oo Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns | Ns Ar bookmark Oc Ns …
.Nm zfs
.Cm inherit
.Op Fl rS
-.Ar property Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns ...
+.Ar property Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns …
+.
.Sh DESCRIPTION
.Bl -tag -width ""
.It Xo
.Nm zfs
.Cm set
-.Ar property Ns = Ns Ar value Oo Ar property Ns = Ns Ar value Oc Ns ...
-.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns ...
+.Ar property Ns = Ns Ar value Oo Ar property Ns = Ns Ar value Oc Ns …
+.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns …
.Xc
Only some properties can be edited.
See
-.Xr zfsprops 8
+.Xr zfsprops 7
for more information on what properties can be set and acceptable
values.
Numeric values can be specified as exact values, or in a human-readable form
@@ -77,45 +78,49 @@ User properties can be set on snapshots.
For more information, see the
.Em User Properties
section of
-.Xr zfsprops 8 .
+.Xr zfsprops 7 .
.It Xo
.Nm zfs
.Cm get
.Op Fl r Ns | Ns Fl d Ar depth
.Op Fl Hp
-.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns ... Oc
-.Oo Fl s Ar source Ns Oo , Ns Ar source Oc Ns ... Oc
-.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... Oc
-.Cm all | Ar property Ns Oo , Ns Ar property Oc Ns ...
-.Oo Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns | Ns Ar bookmark Oc Ns ...
+.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns … Oc
+.Oo Fl s Ar source Ns Oo , Ns Ar source Oc Ns … Oc
+.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns … Oc
+.Cm all Ns | Ns Ar property Ns Oo , Ns Ar property Oc Ns …
+.Oo Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns | Ns Ar bookmark Oc Ns …
.Xc
Displays properties for the given datasets.
If no datasets are specified, then the command displays properties for all
datasets on the system.
For each property, the following columns are displayed:
-.Bd -literal
- name Dataset name
- property Property name
- value Property value
- source Property source \fBlocal\fP, \fBdefault\fP, \fBinherited\fP,
- \fBtemporary\fP, \fBreceived\fP or none (\fB-\fP).
-.Ed
+.Bl -tag -compact -offset 4n -width "property"
+.It Sy name
+Dataset name
+.It Sy property
+Property name
+.It Sy value
+Property value
+.It Sy source
+Property source
+.Sy local , default , inherited , temporary , received , No or Sy - Pq none .
+.El
.Pp
All columns are displayed by default, though this can be controlled by using the
.Fl o
option.
This command takes a comma-separated list of properties as described in the
-.Em Native Properties
+.Sx Native Properties
and
-.Em User Properties
+.Sx User Properties
sections of
-.Xr zfsprops 8 .
+.Xr zfsprops 7 .
.Pp
The value
.Sy all
can be used to display all properties that apply to the given dataset's type
-.Pq filesystem, volume, snapshot, or bookmark .
-.Bl -tag -width "-H"
+.Pq Sy filesystem , volume , snapshot , No or Sy bookmark .
+.Bl -tag -width "-s source"
.It Fl H
Display output in a form more easily parsed by scripts.
Any headers are omitted, and fields are explicitly separated by a single tab
@@ -127,9 +132,8 @@ A depth of
.Sy 1
will display only the dataset and its direct children.
.It Fl o Ar field
-A comma-separated list of columns to display.
-.Sy name Ns \&, Ns Sy property Ns \&, Ns Sy value Ns \&, Ns Sy source
-is the default value.
+A comma-separated list of columns to display, defaults to
+.Sy name , Ns Sy property , Ns Sy value , Ns Sy source .
.It Fl p
Display numbers in parsable
.Pq exact
@@ -140,37 +144,26 @@ Recursively display properties for any children.
A comma-separated list of sources to display.
Those properties coming from a source other than those in this list are ignored.
Each source must be one of the following:
-.Sy local ,
-.Sy default ,
-.Sy inherited ,
-.Sy temporary ,
-.Sy received ,
-and
-.Sy none .
+.Sy local , default , inherited , temporary , received , No or Sy none .
The default value is all sources.
.It Fl t Ar type
A comma-separated list of types to display, where
.Ar type
is one of
-.Sy filesystem ,
-.Sy snapshot ,
-.Sy volume ,
-.Sy bookmark ,
-or
-.Sy all .
+.Sy filesystem , snapshot , volume , bookmark , No or Sy all .
.El
.It Xo
.Nm zfs
.Cm inherit
.Op Fl rS
-.Ar property Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns ...
+.Ar property Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns …
.Xc
Clears the specified property, causing it to be inherited from an ancestor,
restored to default if no ancestor has the property set, or with the
.Fl S
option reverted to the received value if one exists.
See
-.Xr zfsprops 8
+.Xr zfsprops 7
for a listing of default values, and details on which properties can be
inherited.
.Bl -tag -width "-r"
@@ -183,6 +176,7 @@ if the
option was not specified.
.El
.El
+.
.Sh SEE ALSO
-.Xr zfs-list 8 ,
-.Xr zfsprops 8
+.Xr zfsprops 7 ,
+.Xr zfs-list 8
diff --git a/sys/contrib/openzfs/man/man8/zfs-share.8 b/sys/contrib/openzfs/man/man8/zfs-share.8
index ce35accdbf7e..e30d538814ca 100644
--- a/sys/contrib/openzfs/man/man8/zfs-share.8
+++ b/sys/contrib/openzfs/man/man8/zfs-share.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -33,22 +32,24 @@
.Dd June 30, 2019
.Dt ZFS-SHARE 8
.Os
+.
.Sh NAME
.Nm zfs-share
-.Nd Shares and unshares available ZFS filesystems.
+.Nd share and unshare ZFS filesystems
.Sh SYNOPSIS
.Nm zfs
.Cm share
-.Fl a | Ar filesystem
+.Fl a Ns | Ns Ar filesystem
.Nm zfs
.Cm unshare
-.Fl a | Ar filesystem Ns | Ns Ar mountpoint
+.Fl a Ns | Ns Ar filesystem Ns | Ns Ar mountpoint
+.
.Sh DESCRIPTION
.Bl -tag -width ""
.It Xo
.Nm zfs
.Cm share
-.Fl a | Ar filesystem
+.Fl a Ns | Ns Ar filesystem
.Xc
Shares available ZFS file systems.
.Bl -tag -width "-a"
@@ -70,7 +71,7 @@ property is set.
.It Xo
.Nm zfs
.Cm unshare
-.Fl a | Ar filesystem Ns | Ns Ar mountpoint
+.Fl a Ns | Ns Ar filesystem Ns | Ns Ar mountpoint
.Xc
Unshares currently shared ZFS file systems.
.Bl -tag -width "-a"
@@ -82,7 +83,8 @@ Unshare the specified filesystem.
The command can also be given a path to a ZFS file system shared on the system.
.El
.El
+.
.Sh SEE ALSO
.Xr exports 5 ,
.Xr smb.conf 5 ,
-.Xr zfsprops 8
+.Xr zfsprops 7
diff --git a/sys/contrib/openzfs/man/man8/zfs-snapshot.8 b/sys/contrib/openzfs/man/man8/zfs-snapshot.8
index b677bc73d2bd..225123f44b2b 100644
--- a/sys/contrib/openzfs/man/man8/zfs-snapshot.8
+++ b/sys/contrib/openzfs/man/man8/zfs-snapshot.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -30,48 +29,42 @@
.\" Copyright 2018 Nexenta Systems, Inc.
.\" Copyright 2019 Joyent, Inc.
.\"
-.Dd June 30, 2019
+.Dd May 27, 2021
.Dt ZFS-SNAPSHOT 8
.Os
+.
.Sh NAME
.Nm zfs-snapshot
-.Nd Creates snapshots with the given names.
+.Nd create snapshots of ZFS datasets
.Sh SYNOPSIS
.Nm zfs
.Cm snapshot
.Op Fl r
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
-.Ar filesystem Ns @ Ns Ar snapname Ns | Ns Ar volume Ns @ Ns Ar snapname Ns ...
+.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
+.Ar dataset Ns @ Ns Ar snapname Ns …
+.
.Sh DESCRIPTION
-.Bl -tag -width ""
-.It Xo
-.Nm zfs
-.Cm snapshot
-.Op Fl r
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
-.Ar filesystem Ns @ Ns Ar snapname Ns | Ns Ar volume Ns @ Ns Ar snapname Ns ...
-.Xc
All previous modifications by successful system calls to the file system are
part of the snapshots.
Snapshots are taken atomically, so that all snapshots correspond to the same
moment in time.
.Nm zfs Cm snap
can be used as an alias for
-.Nm zfs Cm snapshot.
+.Nm zfs Cm snapshot .
See the
-.Em Snapshots
+.Sx Snapshots
section of
-.Xr zfsconcepts 8
+.Xr zfsconcepts 7
for details.
.Bl -tag -width "-o"
.It Fl o Ar property Ns = Ns Ar value
-Sets the specified property; see
+Set the specified property; see
.Nm zfs Cm create
for details.
.It Fl r
Recursively create snapshots of all descendent datasets
.El
-.El
+.
.Sh SEE ALSO
.Xr zfs-bookmark 8 ,
.Xr zfs-clone 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zfs-upgrade.8 b/sys/contrib/openzfs/man/man8/zfs-upgrade.8
index 6a79f3ea77fd..f3620faa6135 100644
--- a/sys/contrib/openzfs/man/man8/zfs-upgrade.8
+++ b/sys/contrib/openzfs/man/man8/zfs-upgrade.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -33,9 +32,10 @@
.Dd June 30, 2019
.Dt ZFS-UPGRADE 8
.Os
+.
.Sh NAME
.Nm zfs-upgrade
-.Nd Manage upgrading the on-disk version of filesystems.
+.Nd manage on-disk version of ZFS filesystems
.Sh SYNOPSIS
.Nm zfs
.Cm upgrade
@@ -46,7 +46,8 @@
.Cm upgrade
.Op Fl r
.Op Fl V Ar version
-.Fl a | Ar filesystem
+.Fl a Ns | Ns Ar filesystem
+.
.Sh DESCRIPTION
.Bl -tag -width ""
.It Xo
@@ -65,35 +66,31 @@ Displays a list of currently supported file system versions.
.Cm upgrade
.Op Fl r
.Op Fl V Ar version
-.Fl a | Ar filesystem
+.Fl a Ns | Ns Ar filesystem
.Xc
Upgrades file systems to a new on-disk version.
Once this is done, the file systems will no longer be accessible on systems
-running older versions of the software.
+running older versions of ZFS.
.Nm zfs Cm send
streams generated from new snapshots of these file systems cannot be accessed on
-systems running older versions of the software.
+systems running older versions of ZFS.
.Pp
In general, the file system version is independent of the pool version.
See
-.Xr zpool 8
-for information on the
-.Nm zpool Cm upgrade
-command.
+.Xr zpool-features 7
+for information on features of ZFS storage pools.
.Pp
In some cases, the file system version and the pool version are interrelated and
the pool version must be upgraded before the file system version can be
upgraded.
-.Bl -tag -width "-V"
+.Bl -tag -width "filesystem"
.It Fl V Ar version
-Upgrade to the specified
+Upgrade to
.Ar version .
-If the
-.Fl V
-flag is not specified, this command upgrades to the most recent version.
+If not specified, upgrade to the most recent version.
This
option can only be used to increase the version number, and only up to the most
-recent version supported by this software.
+recent version supported by this version of ZFS.
.It Fl a
Upgrade all file systems on all imported pools.
.It Ar filesystem
diff --git a/sys/contrib/openzfs/man/man8/zfs-userspace.8 b/sys/contrib/openzfs/man/man8/zfs-userspace.8
index 0a9977a61c6a..b7bd61b5709a 100644
--- a/sys/contrib/openzfs/man/man8/zfs-userspace.8
+++ b/sys/contrib/openzfs/man/man8/zfs-userspace.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -33,43 +32,45 @@
.Dd June 30, 2019
.Dt ZFS-USERSPACE 8
.Os
+.
.Sh NAME
.Nm zfs-userspace
-.Nd Displays space consumed by, and quotas on, each user or group in the specified filesystem or snapshot.
+.Nd display space and quotas of ZFS dataset
.Sh SYNOPSIS
.Nm zfs
.Cm userspace
.Op Fl Hinp
-.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns ... Oc
-.Oo Fl s Ar field Oc Ns ...
-.Oo Fl S Ar field Oc Ns ...
-.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... Oc
+.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns … Oc
+.Oo Fl s Ar field Oc Ns …
+.Oo Fl S Ar field Oc Ns …
+.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns … Oc
.Ar filesystem Ns | Ns Ar snapshot Ns | Ns Ar path
.Nm zfs
.Cm groupspace
.Op Fl Hinp
-.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns ... Oc
-.Oo Fl s Ar field Oc Ns ...
-.Oo Fl S Ar field Oc Ns ...
-.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... Oc
+.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns … Oc
+.Oo Fl s Ar field Oc Ns …
+.Oo Fl S Ar field Oc Ns …
+.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns … Oc
.Ar filesystem Ns | Ns Ar snapshot Ns | Ns Ar path
.Nm zfs
.Cm projectspace
.Op Fl Hp
-.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns ... Oc
-.Oo Fl s Ar field Oc Ns ...
-.Oo Fl S Ar field Oc Ns ...
+.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns … Oc
+.Oo Fl s Ar field Oc Ns …
+.Oo Fl S Ar field Oc Ns …
.Ar filesystem Ns | Ns Ar snapshot Ns | Ns Ar path
+.
.Sh DESCRIPTION
.Bl -tag -width ""
.It Xo
.Nm zfs
.Cm userspace
.Op Fl Hinp
-.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns ... Oc
-.Oo Fl s Ar field Oc Ns ...
-.Oo Fl S Ar field Oc Ns ...
-.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... Oc
+.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns … Oc
+.Oo Fl s Ar field Oc Ns …
+.Oo Fl S Ar field Oc Ns …
+.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns … Oc
.Ar filesystem Ns | Ns Ar snapshot Ns | Ns Ar path
.Xc
Displays space consumed by, and quotas on, each user in the specified filesystem,
@@ -78,11 +79,11 @@ If a path is given, the filesystem that contains that path will be used.
This corresponds to the
.Sy userused@ Ns Em user ,
.Sy userobjused@ Ns Em user ,
-.Sy userquota@ Ns Em user,
+.Sy userquota@ Ns Em user ,
and
.Sy userobjquota@ Ns Em user
properties.
-.Bl -tag -width "-H"
+.Bl -tag -width "-S field"
.It Fl H
Do not print headers, use tab-delimited output.
.It Fl S Ar field
@@ -93,10 +94,7 @@ See
Translate SID to POSIX ID.
The POSIX ID may be ephemeral if no mapping exists.
Normal POSIX interfaces
-.Po for example,
-.Xr stat 2 ,
-.Nm ls Fl l
-.Pc
+.Pq like Xr stat 2 , Nm ls Fl l
perform this translation, so the
.Fl i
option allows the output from
@@ -113,7 +111,7 @@ However, the
option will report that the POSIX entity has the total usage and quota for both.
.It Fl n
Print numeric ID instead of user/group name.
-.It Fl o Ar field Ns Oo , Ns Ar field Oc Ns ...
+.It Fl o Ar field Ns Oo , Ns Ar field Oc Ns …
Display only the specified fields from the following set:
.Sy type ,
.Sy name ,
@@ -134,7 +132,7 @@ flags may be specified multiple times to sort first by one field, then by
another.
The default is
.Fl s Sy type Fl s Sy name .
-.It Fl t Ar type Ns Oo , Ns Ar type Oc Ns ...
+.It Fl t Ar type Ns Oo , Ns Ar type Oc Ns …
Print only the specified types from the following set:
.Sy all ,
.Sy posixuser ,
@@ -142,17 +140,17 @@ Print only the specified types from the following set:
.Sy posixgroup ,
.Sy smbgroup .
The default is
-.Fl t Sy posixuser Ns \&, Ns Sy smbuser .
+.Fl t Sy posixuser , Ns Sy smbuser .
The default can be changed to include group types.
.El
.It Xo
.Nm zfs
.Cm groupspace
.Op Fl Hinp
-.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns ... Oc
-.Oo Fl s Ar field Oc Ns ...
-.Oo Fl S Ar field Oc Ns ...
-.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... Oc
+.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns … Oc
+.Oo Fl s Ar field Oc Ns …
+.Oo Fl S Ar field Oc Ns …
+.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns … Oc
.Ar filesystem Ns | Ns Ar snapshot
.Xc
Displays space consumed by, and quotas on, each group in the specified
@@ -160,28 +158,30 @@ filesystem or snapshot.
This subcommand is identical to
.Cm userspace ,
except that the default types to display are
-.Fl t Sy posixgroup Ns \&, Ns Sy smbgroup .
+.Fl t Sy posixgroup , Ns Sy smbgroup .
.It Xo
.Nm zfs
.Cm projectspace
.Op Fl Hp
-.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns ... Oc
-.Oo Fl s Ar field Oc Ns ...
-.Oo Fl S Ar field Oc Ns ...
+.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns … Oc
+.Oo Fl s Ar field Oc Ns …
+.Oo Fl S Ar field Oc Ns …
.Ar filesystem Ns | Ns Ar snapshot Ns | Ns Ar path
.Xc
Displays space consumed by, and quotas on, each project in the specified
-filesystem or snapshot. This subcommand is identical to
+filesystem or snapshot.
+This subcommand is identical to
.Cm userspace ,
-except that the project identifier is numeral, not name. So need neither
-the option
-.Sy -i
+except that the project identifier is a numeral, not a name.
+So need neither the option
+.Fl i
for SID to POSIX ID nor
-.Sy -n
+.Fl n
for numeric ID, nor
-.Sy -t
+.Fl t
for types.
.El
+.
.Sh SEE ALSO
-.Xr zfs-set 8 ,
-.Xr zfsprops 8
+.Xr zfsprops 7 ,
+.Xr zfs-set 8
diff --git a/sys/contrib/openzfs/man/man8/zfs-wait.8 b/sys/contrib/openzfs/man/man8/zfs-wait.8
index 9213fa20f1ff..81bc15636541 100644
--- a/sys/contrib/openzfs/man/man8/zfs-wait.8
+++ b/sys/contrib/openzfs/man/man8/zfs-wait.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,25 +26,20 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
+.Dd May 31, 2021
.Dt ZFS-WAIT 8
.Os
+.
.Sh NAME
.Nm zfs-wait
-.Nd Wait for background activity to stop in a ZFS filesystem
+.Nd wait for activity in ZFS filesystem to stop
.Sh SYNOPSIS
.Nm zfs
.Cm wait
-.Op Fl t Ar activity Ns Oo , Ns Ar activity Ns Oc Ns ...
-.Ar fs
+.Op Fl t Ar activity Ns Oo , Ns Ar activity Ns Oc Ns …
+.Ar filesystem
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zfs
-.Cm wait
-.Op Fl t Ar activity Ns Oo , Ns Ar activity Ns Oc Ns ...
-.Ar fs
-.Xc
Waits until all background activity of the given types has ceased in the given
filesystem.
The activity could cease because it has completed or because the filesystem has
@@ -58,13 +52,14 @@ immediately.
These are the possible values for
.Ar activity ,
along with what each one waits for:
-.Bd -literal
- deleteq The filesystem's internal delete queue to empty
-.Ed
+.Bl -tag -compact -offset Ds -width "deleteq"
+.It Sy deleteq
+The filesystem's internal delete queue to empty
+.El
.Pp
Note that the internal delete queue does not finish draining until
all large files have had time to be fully destroyed and all open file
handles to unlinked files are closed.
-.El
+.
.Sh SEE ALSO
.Xr lsof 8
diff --git a/sys/contrib/openzfs/man/man8/zfs.8 b/sys/contrib/openzfs/man/man8/zfs.8
index 52000f29b463..fca1ba00da7d 100644
--- a/sys/contrib/openzfs/man/man8/zfs.8
+++ b/sys/contrib/openzfs/man/man8/zfs.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
@@ -40,17 +39,19 @@
.Dd June 30, 2019
.Dt ZFS 8
.Os
+.
.Sh NAME
.Nm zfs
-.Nd configures ZFS file systems
+.Nd configure ZFS datasets
.Sh SYNOPSIS
.Nm
.Fl ?V
.Nm
.Cm version
.Nm
-.Cm <subcommand>
-.Op Ar <args>
+.Cm subcommand
+.Op Ar arguments
+.
.Sh DESCRIPTION
The
.Nm
@@ -58,23 +59,18 @@ command configures ZFS datasets within a ZFS storage pool, as described in
.Xr zpool 8 .
A dataset is identified by a unique path within the ZFS namespace.
For example:
-.Bd -literal
-pool/{filesystem,volume,snapshot}
-.Ed
+.Dl pool/{filesystem,volume,snapshot}
.Pp
where the maximum length of a dataset name is
-.Dv MAXNAMELEN
-.Pq 256 bytes
+.Sy MAXNAMELEN Pq 256B
and the maximum amount of nesting allowed in a path is 50 levels deep.
.Pp
A dataset can be one of the following:
-.Bl -tag -width "file system"
+.Bl -tag -offset Ds -width "file system"
.It Sy file system
-A ZFS dataset of type
-.Sy filesystem
-can be mounted within the standard system namespace and behaves like other file
+Can be mounted within the standard system namespace and behaves like other file
systems.
-While ZFS file systems are designed to be POSIX compliant, known issues exist
+While ZFS file systems are designed to be POSIX-compliant, known issues exist
that prevent compliance in some cases.
Applications that depend on standards conformance might fail due to non-standard
behavior when checking file system free space.
@@ -92,38 +88,39 @@ or
Much like a
.Sy snapshot ,
but without the hold on on-disk data.
-It can be used as the source of a send (but not for a receive). It is specified as
+It can be used as the source of a send (but not for a receive).
+It is specified as
.Ar filesystem Ns # Ns Ar name
or
.Ar volume Ns # Ns Ar name .
.El
.Pp
-For details see
-.Xr zfsconcepts 8 .
+See
+.Xr zfsconcepts 7
+for details.
+.
.Ss Properties
-Properties are divided into two types, native properties and user-defined
-.Po or
-.Qq user
-.Pc
+Properties are divided into two types: native properties and user-defined
+.Pq or Qq user
properties.
Native properties either export internal statistics or control ZFS behavior.
In addition, native properties are either editable or read-only.
User properties have no effect on ZFS behavior, but you can use them to annotate
datasets in a way that is meaningful in your environment.
-For more information about properties, see the
-.Xr zfsprops 8 man page.
+For more information about properties, see
+.Xr zfsprops 7 .
+.
.Ss Encryption
Enabling the
.Sy encryption
feature allows for the creation of encrypted filesystems and volumes.
ZFS will encrypt file and zvol data, file attributes, ACLs, permission bits,
directory listings, FUID mappings, and
-.Sy userused
-/
-.Sy groupused
+.Sy userused Ns / Ns Sy groupused Ns / Ns Sy projectused
data.
-For an overview of encryption see the
-.Xr zfs-load-key 8 command manual.
+For an overview of encryption, see
+.Xr zfs-load-key 8 .
+.
.Sh SUBCOMMANDS
All subcommands that modify state are logged persistently to the pool in their
original form.
@@ -134,9 +131,6 @@ Displays a help message.
.Nm
.Fl V , -version
.Xc
-An alias for the
-.Nm zfs Cm version
-subcommand.
.It Xo
.Nm
.Cm version
@@ -145,6 +139,7 @@ Displays the software version of the
.Nm
userland utility and the zfs kernel module.
.El
+.
.Ss Dataset Management
.Bl -tag -width ""
.It Xr zfs-list 8
@@ -158,26 +153,25 @@ Renames the given dataset (filesystem or snapshot).
.It Xr zfs-upgrade 8
Manage upgrading the on-disk version of filesystems.
.El
+.
.Ss Snapshots
.Bl -tag -width ""
.It Xr zfs-snapshot 8
Creates snapshots with the given names.
.It Xr zfs-rollback 8
Roll back the given dataset to a previous snapshot.
-.It Xo
-.Xr zfs-hold 8 /
-.Xr zfs-release 8
-.Xc
+.It Xr zfs-hold 8 Ns / Ns Xr zfs-release 8
Add or remove a hold reference to the specified snapshot or snapshots.
If a hold exists on a snapshot, attempts to destroy that snapshot by using the
.Nm zfs Cm destroy
command return
-.Er EBUSY .
+.Sy EBUSY .
.It Xr zfs-diff 8
Display the difference between a snapshot of a given filesystem and another
snapshot of that filesystem from a later time or the current contents of the
filesystem.
.El
+.
.Ss Clones
.Bl -tag -width ""
.It Xr zfs-clone 8
@@ -187,6 +181,7 @@ Promotes a clone file system to no longer be dependent on its
.Qq origin
snapshot.
.El
+.
.Ss Send & Receive
.Bl -tag -width ""
.It Xr zfs-send 8
@@ -211,6 +206,7 @@ This feature can be used to allow clones of a filesystem to be made available on
a remote system, in the case where their parent need not (or needs to not) be
usable.
.El
+.
.Ss Properties
.Bl -tag -width ""
.It Xr zfs-get 8
@@ -223,18 +219,16 @@ restored to default if no ancestor has the property set, or with the
.Fl S
option reverted to the received value if one exists.
.El
+.
.Ss Quotas
.Bl -tag -width ""
-.It Xo
-.Xr zfs-userspace 8 /
-.Xr zfs-groupspace 8 /
-.Xr zfs-projectspace 8
-.Xc
+.It Xr zfs-userspace 8 Ns / Ns Xr zfs-groupspace 8 Ns / Ns Xr zfs-projectspace 8
Displays space consumed by, and quotas on, each user, group, or project
in the specified filesystem or snapshot.
.It Xr zfs-project 8
List, set, or clear project ID and/or inherit flag on the file(s) or directories.
.El
+.
.Ss Mountpoints
.Bl -tag -width ""
.It Xr zfs-mount 8
@@ -245,6 +239,7 @@ property.
.It Xr zfs-unmount 8
Unmounts currently mounted ZFS file systems.
.El
+.
.Ss Shares
.Bl -tag -width ""
.It Xr zfs-share 8
@@ -252,6 +247,7 @@ Shares available ZFS file systems.
.It Xr zfs-unshare 8
Unshares currently shared ZFS file systems.
.El
+.
.Ss Delegated Administration
.Bl -tag -width ""
.It Xr zfs-allow 8
@@ -259,6 +255,7 @@ Delegate permissions on the specified filesystem or volume.
.It Xr zfs-unallow 8
Remove delegated permissions on the specified filesystem or volume.
.El
+.
.Ss Encryption
.Bl -tag -width ""
.It Xr zfs-change-key 8
@@ -268,12 +265,14 @@ Load the key for the specified encrypted dataset, enabling access.
.It Xr zfs-unload-key 8
Unload a key for the specified dataset, removing the ability to access the dataset.
.El
+.
.Ss Channel Programs
.Bl -tag -width ""
.It Xr zfs-program 8
Execute ZFS administrative operations
programmatically via a Lua script-language channel program.
.El
+.
.Ss Jails
.Bl -tag -width ""
.It Xr zfs-jail 8
@@ -281,100 +280,101 @@ Attaches a filesystem to a jail.
.It Xr zfs-unjail 8
Detaches a filesystem from a jail.
.El
+.
.Ss Waiting
.Bl -tag -width ""
.It Xr zfs-wait 8
Wait for background activity in a filesystem to complete.
.El
+.
.Sh EXIT STATUS
The
.Nm
-utility exits 0 on success, 1 if an error occurs, and 2 if invalid command line
-options were specified.
+utility exits
+.Sy 0
+on success,
+.Sy 1
+if an error occurs, and
+.Sy 2
+if invalid command line options were specified.
+.
.Sh EXAMPLES
.Bl -tag -width ""
-.It Sy Example 1 No Creating a ZFS File System Hierarchy
+.
+.It Sy Example 1 : No Creating a ZFS File System Hierarchy
The following commands create a file system named
-.Em pool/home
+.Ar pool/home
and a file system named
-.Em pool/home/bob .
+.Ar pool/home/bob .
The mount point
.Pa /export/home
is set for the parent file system, and is automatically inherited by the child
file system.
-.Bd -literal
-# zfs create pool/home
-# zfs set mountpoint=/export/home pool/home
-# zfs create pool/home/bob
-.Ed
-.It Sy Example 2 No Creating a ZFS Snapshot
+.Dl # Nm zfs Cm create Ar pool/home
+.Dl # Nm zfs Cm set Sy mountpoint Ns = Ns Ar /export/home pool/home
+.Dl # Nm zfs Cm create Ar pool/home/bob
+.
+.It Sy Example 2 : No Creating a ZFS Snapshot
The following command creates a snapshot named
-.Sy yesterday .
+.Ar yesterday .
This snapshot is mounted on demand in the
.Pa .zfs/snapshot
directory at the root of the
-.Em pool/home/bob
+.Ar pool/home/bob
file system.
-.Bd -literal
-# zfs snapshot pool/home/bob@yesterday
-.Ed
-.It Sy Example 3 No Creating and Destroying Multiple Snapshots
+.Dl # Nm zfs Cm snapshot Ar pool/home/bob Ns @ Ns Ar yesterday
+.
+.It Sy Example 3 : No Creating and Destroying Multiple Snapshots
The following command creates snapshots named
-.Sy yesterday
-of
-.Em pool/home
+.Ar yesterday No of Ar pool/home
and all of its descendent file systems.
Each snapshot is mounted on demand in the
.Pa .zfs/snapshot
directory at the root of its file system.
The second command destroys the newly created snapshots.
-.Bd -literal
-# zfs snapshot -r pool/home@yesterday
-# zfs destroy -r pool/home@yesterday
-.Ed
-.It Sy Example 4 No Disabling and Enabling File System Compression
+.Dl # Nm zfs Cm snapshot Fl r Ar pool/home Ns @ Ns Ar yesterday
+.Dl # Nm zfs Cm destroy Fl r Ar pool/home Ns @ Ns Ar yesterday
+.
+.It Sy Example 4 : No Disabling and Enabling File System Compression
The following command disables the
.Sy compression
property for all file systems under
-.Em pool/home .
+.Ar pool/home .
The next command explicitly enables
.Sy compression
for
-.Em pool/home/anne .
-.Bd -literal
-# zfs set compression=off pool/home
-# zfs set compression=on pool/home/anne
-.Ed
-.It Sy Example 5 No Listing ZFS Datasets
+.Ar pool/home/anne .
+.Dl # Nm zfs Cm set Sy compression Ns = Ns Sy off Ar pool/home
+.Dl # Nm zfs Cm set Sy compression Ns = Ns Sy on Ar pool/home/anne
+.
+.It Sy Example 5 : No Listing ZFS Datasets
The following command lists all active file systems and volumes in the system.
-Snapshots are displayed if the
-.Sy listsnaps
-property is
-.Sy on .
+Snapshots are displayed if
+.Sy listsnaps Ns = Ns Sy on .
The default is
.Sy off .
See
-.Xr zpool 8
+.Xr zpoolprops 7
for more information on pool properties.
-.Bd -literal
-# zfs list
+.Bd -literal -compact -offset Ds
+.No # Nm zfs Cm list
NAME USED AVAIL REFER MOUNTPOINT
pool 450K 457G 18K /pool
pool/home 315K 457G 21K /export/home
pool/home/anne 18K 457G 18K /export/home/anne
pool/home/bob 276K 457G 276K /export/home/bob
.Ed
-.It Sy Example 6 No Setting a Quota on a ZFS File System
+.
+.It Sy Example 6 : No Setting a Quota on a ZFS File System
The following command sets a quota of 50 Gbytes for
-.Em pool/home/bob .
-.Bd -literal
-# zfs set quota=50G pool/home/bob
-.Ed
-.It Sy Example 7 No Listing ZFS Properties
+.Ar pool/home/bob :
+.Dl # Nm zfs Cm set Sy quota Ns = Ns Ar 50G pool/home/bob
+.
+.It Sy Example 7 : No Listing ZFS Properties
The following command lists all properties for
-.Em pool/home/bob .
-.Bd -literal
-# zfs get all pool/home/bob
+.Ar pool/home/bob :
+.Bd -literal -compact -offset Ds
+.No # Nm zfs Cm get Sy all Ar pool/home/bob
NAME PROPERTY VALUE SOURCE
pool/home/bob type filesystem -
pool/home/bob creation Tue Jul 21 15:53 2009 -
@@ -420,63 +420,61 @@ pool/home/bob usedbychildren 0 -
pool/home/bob usedbyrefreservation 0 -
.Ed
.Pp
-The following command gets a single property value.
-.Bd -literal
-# zfs get -H -o value compression pool/home/bob
+The following command gets a single property value:
+.Bd -literal -compact -offset Ds
+.No # Nm zfs Cm get Fl H o Sy value compression Ar pool/home/bob
on
.Ed
+.Pp
The following command lists all properties with local settings for
-.Em pool/home/bob .
-.Bd -literal
-# zfs get -r -s local -o name,property,value all pool/home/bob
+.Ar pool/home/bob :
+.Bd -literal -compact -offset Ds
+.No # Nm zfs Cm get Fl r s Sy local Fl o Sy name , Ns Sy property , Ns Sy value all Ar pool/home/bob
NAME PROPERTY VALUE
pool/home/bob quota 20G
pool/home/bob compression on
.Ed
-.It Sy Example 8 No Rolling Back a ZFS File System
+.
+.It Sy Example 8 : No Rolling Back a ZFS File System
The following command reverts the contents of
-.Em pool/home/anne
+.Ar pool/home/anne
to the snapshot named
-.Sy yesterday ,
-deleting all intermediate snapshots.
-.Bd -literal
-# zfs rollback -r pool/home/anne@yesterday
-.Ed
-.It Sy Example 9 No Creating a ZFS Clone
+.Ar yesterday ,
+deleting all intermediate snapshots:
+.Dl # Nm zfs Cm rollback Fl r Ar pool/home/anne Ns @ Ns Ar yesterday
+.
+.It Sy Example 9 : No Creating a ZFS Clone
The following command creates a writable file system whose initial contents are
the same as
-.Em pool/home/bob@yesterday .
-.Bd -literal
-# zfs clone pool/home/bob@yesterday pool/clone
-.Ed
-.It Sy Example 10 No Promoting a ZFS Clone
+.Ar pool/home/bob@yesterday .
+.Dl # Nm zfs Cm clone Ar pool/home/bob@yesterday pool/clone
+.
+.It Sy Example 10 : No Promoting a ZFS Clone
The following commands illustrate how to test out changes to a file system, and
then replace the original file system with the changed one, using clones, clone
promotion, and renaming:
-.Bd -literal
-# zfs create pool/project/production
+.Bd -literal -compact -offset Ds
+.No # Nm zfs Cm create Ar pool/project/production
populate /pool/project/production with data
-# zfs snapshot pool/project/production@today
-# zfs clone pool/project/production@today pool/project/beta
+.No # Nm zfs Cm snapshot Ar pool/project/production Ns @ Ns Ar today
+.No # Nm zfs Cm clone Ar pool/project/production@today pool/project/beta
make changes to /pool/project/beta and test them
-# zfs promote pool/project/beta
-# zfs rename pool/project/production pool/project/legacy
-# zfs rename pool/project/beta pool/project/production
+.No # Nm zfs Cm promote Ar pool/project/beta
+.No # Nm zfs Cm rename Ar pool/project/production pool/project/legacy
+.No # Nm zfs Cm rename Ar pool/project/beta pool/project/production
once the legacy version is no longer needed, it can be destroyed
-# zfs destroy pool/project/legacy
+.No # Nm zfs Cm destroy Ar pool/project/legacy
.Ed
-.It Sy Example 11 No Inheriting ZFS Properties
+.
+.It Sy Example 11 : No Inheriting ZFS Properties
The following command causes
-.Em pool/home/bob
-and
-.Em pool/home/anne
+.Ar pool/home/bob No and Ar pool/home/anne
to inherit the
.Sy checksum
property from their parent.
-.Bd -literal
-# zfs inherit checksum pool/home/bob pool/home/anne
-.Ed
-.It Sy Example 12 No Remotely Replicating ZFS Data
+.Dl # Nm zfs Cm inherit Sy checksum Ar pool/home/bob pool/home/anne
+.
+.It Sy Example 12 : No Remotely Replicating ZFS Data
The following commands send a full stream and then an incremental stream to a
remote machine, restoring them into
.Em poolB/received/fs@a
@@ -488,147 +486,145 @@ must contain the file system
.Em poolB/received ,
and must not initially contain
.Em poolB/received/fs .
-.Bd -literal
-# zfs send pool/fs@a | \e
- ssh host zfs receive poolB/received/fs@a
-# zfs send -i a pool/fs@b | \e
- ssh host zfs receive poolB/received/fs
+.Bd -literal -compact -offset Ds
+.No # Nm zfs Cm send Ar pool/fs@a |
+.No " " Nm ssh Ar host Nm zfs Cm receive Ar poolB/received/fs Ns @ Ns Ar a
+.No # Nm zfs Cm send Fl i Ar a pool/fs@b |
+.No " " Nm ssh Ar host Nm zfs Cm receive Ar poolB/received/fs
.Ed
-.It Sy Example 13 No Using the zfs receive -d Option
+.
+.It Sy Example 13 : No Using the Nm zfs Cm receive Fl d No Option
The following command sends a full stream of
-.Em poolA/fsA/fsB@snap
+.Ar poolA/fsA/fsB@snap
to a remote machine, receiving it into
-.Em poolB/received/fsA/fsB@snap .
+.Ar poolB/received/fsA/fsB@snap .
The
-.Em fsA/fsB@snap
+.Ar fsA/fsB@snap
portion of the received snapshot's name is determined from the name of the sent
snapshot.
-.Em poolB
+.Ar poolB
must contain the file system
-.Em poolB/received .
+.Ar poolB/received .
If
-.Em poolB/received/fsA
+.Ar poolB/received/fsA
does not exist, it is created as an empty file system.
-.Bd -literal
-# zfs send poolA/fsA/fsB@snap | \e
- ssh host zfs receive -d poolB/received
+.Bd -literal -compact -offset Ds
+.No # Nm zfs Cm send Ar poolA/fsA/fsB@snap |
+.No " " Nm ssh Ar host Nm zfs Cm receive Fl d Ar poolB/received
.Ed
-.It Sy Example 14 No Setting User Properties
+.
+.It Sy Example 14 : No Setting User Properties
The following example sets the user-defined
-.Sy com.example:department
-property for a dataset.
-.Bd -literal
-# zfs set com.example:department=12345 tank/accounting
-.Ed
-.It Sy Example 15 No Performing a Rolling Snapshot
+.Ar com.example : Ns Ar department
+property for a dataset:
+.Dl # Nm zfs Cm set Ar com.example : Ns Ar department Ns = Ns Ar 12345 tank/accounting
+.
+.It Sy Example 15 : No Performing a Rolling Snapshot
The following example shows how to maintain a history of snapshots with a
consistent naming scheme.
To keep a week's worth of snapshots, the user destroys the oldest snapshot,
renames the remaining snapshots, and then creates a new snapshot, as follows:
-.Bd -literal
-# zfs destroy -r pool/users@7daysago
-# zfs rename -r pool/users@6daysago @7daysago
-# zfs rename -r pool/users@5daysago @6daysago
-# zfs rename -r pool/users@4daysago @5daysago
-# zfs rename -r pool/users@3daysago @4daysago
-# zfs rename -r pool/users@2daysago @3daysago
-# zfs rename -r pool/users@yesterday @2daysago
-# zfs rename -r pool/users@today @yesterday
-# zfs snapshot -r pool/users@today
+.Bd -literal -compact -offset Ds
+.No # Nm zfs Cm destroy Fl r Ar pool/users@7daysago
+.No # Nm zfs Cm rename Fl r Ar pool/users@6daysago No @ Ns Ar 7daysago
+.No # Nm zfs Cm rename Fl r Ar pool/users@5daysago No @ Ns Ar 6daysago
+.No # Nm zfs Cm rename Fl r Ar pool/users@4daysago No @ Ns Ar 5daysago
+.No # Nm zfs Cm rename Fl r Ar pool/users@3daysago No @ Ns Ar 4daysago
+.No # Nm zfs Cm rename Fl r Ar pool/users@2daysago No @ Ns Ar 3daysago
+.No # Nm zfs Cm rename Fl r Ar pool/users@yesterday No @ Ns Ar 2daysago
+.No # Nm zfs Cm rename Fl r Ar pool/users@today No @ Ns Ar yesterday
+.No # Nm zfs Cm snapshot Fl r Ar pool/users Ns @ Ns Ar today
.Ed
-.It Sy Example 16 No Setting sharenfs Property Options on a ZFS File System
+.
+.It Sy Example 16 : No Setting sharenfs Property Options on a ZFS File System
The following commands show how to set
.Sy sharenfs
-property options to enable
-.Sy rw
-access for a set of
-.Sy IP
-addresses and to enable root access for system
-.Sy neo
+property options to enable read-write
+access for a set of IP addresses and to enable root access for system
+.Qq neo
on the
-.Em tank/home
-file system.
-.Bd -literal
-# zfs set sharenfs='rw=@123.123.0.0/16,root=neo' tank/home
-.Ed
+.Ar tank/home
+file system:
+.Dl # Nm zfs Cm set Sy sharenfs Ns = Ns ' Ns Ar rw Ns =@123.123.0.0/16,root= Ns Ar neo Ns ' tank/home
.Pp
-If you are using
-.Sy DNS
-for host name resolution, specify the fully qualified hostname.
-.It Sy Example 17 No Delegating ZFS Administration Permissions on a ZFS Dataset
+If you are using DNS for host name resolution,
+specify the fully-qualified hostname.
+.
+.It Sy Example 17 : No Delegating ZFS Administration Permissions on a ZFS Dataset
The following example shows how to set permissions so that user
-.Sy cindys
+.Ar cindys
can create, destroy, mount, and take snapshots on
-.Em tank/cindys .
+.Ar tank/cindys .
The permissions on
-.Em tank/cindys
+.Ar tank/cindys
are also displayed.
-.Bd -literal
-# zfs allow cindys create,destroy,mount,snapshot tank/cindys
-# zfs allow tank/cindys
+.Bd -literal -compact -offset Ds
+.No # Nm zfs Cm allow Sy cindys create , Ns Sy destroy , Ns Sy mount , Ns Sy snapshot Ar tank/cindys
+.No # Nm zfs Cm allow Ar tank/cindys
---- Permissions on tank/cindys --------------------------------------
Local+Descendent permissions:
user cindys create,destroy,mount,snapshot
.Ed
.Pp
Because the
-.Em tank/cindys
+.Ar tank/cindys
mount point permission is set to 755 by default, user
-.Sy cindys
+.Ar cindys
will be unable to mount file systems under
-.Em tank/cindys .
+.Ar tank/cindys .
Add an ACE similar to the following syntax to provide mount point access:
-.Bd -literal
-# chmod A+user:cindys:add_subdirectory:allow /tank/cindys
-.Ed
-.It Sy Example 18 No Delegating Create Time Permissions on a ZFS Dataset
+.Dl # Cm chmod No A+user: Ns Ar cindys Ns :add_subdirectory:allow Ar /tank/cindys
+.
+.It Sy Example 18 : No Delegating Create Time Permissions on a ZFS Dataset
The following example shows how to grant anyone in the group
-.Sy staff
+.Ar staff
to create file systems in
-.Em tank/users .
+.Ar tank/users .
This syntax also allows staff members to destroy their own file systems, but not
destroy anyone else's file system.
The permissions on
-.Em tank/users
+.Ar tank/users
are also displayed.
-.Bd -literal
-# zfs allow staff create,mount tank/users
-# zfs allow -c destroy tank/users
-# zfs allow tank/users
+.Bd -literal -compact -offset Ds
+.No # Nm zfs Cm allow Ar staff Sy create , Ns Sy mount Ar tank/users
+.No # Nm zfs Cm allow Fl c Sy destroy Ar tank/users
+.No # Nm zfs Cm allow Ar tank/users
---- Permissions on tank/users ---------------------------------------
Permission sets:
destroy
Local+Descendent permissions:
group staff create,mount
.Ed
-.It Sy Example 19 No Defining and Granting a Permission Set on a ZFS Dataset
+.
+.It Sy Example 19 : No Defining and Granting a Permission Set on a ZFS Dataset
The following example shows how to define and grant a permission set on the
-.Em tank/users
+.Ar tank/users
file system.
The permissions on
-.Em tank/users
+.Ar tank/users
are also displayed.
-.Bd -literal
-# zfs allow -s @pset create,destroy,snapshot,mount tank/users
-# zfs allow staff @pset tank/users
-# zfs allow tank/users
+.Bd -literal -compact -offset Ds
+.No # Nm zfs Cm allow Fl s No @ Ns Ar pset Sy create , Ns Sy destroy , Ns Sy snapshot , Ns Sy mount Ar tank/users
+.No # Nm zfs Cm allow staff No @ Ns Ar pset tank/users
+.No # Nm zfs Cm allow Ar tank/users
---- Permissions on tank/users ---------------------------------------
Permission sets:
@pset create,destroy,mount,snapshot
Local+Descendent permissions:
group staff @pset
.Ed
-.It Sy Example 20 No Delegating Property Permissions on a ZFS Dataset
+.
+.It Sy Example 20 : No Delegating Property Permissions on a ZFS Dataset
The following example shows to grant the ability to set quotas and reservations
on the
-.Em users/home
+.Ar users/home
file system.
The permissions on
-.Em users/home
+.Ar users/home
are also displayed.
-.Bd -literal
-# zfs allow cindys quota,reservation users/home
-# zfs allow users/home
+.Bd -literal -compact -offset Ds
+.No # Nm zfs Cm allow Ar cindys Sy quota , Ns Sy reservation Ar users/home
+.No # Nm zfs Cm allow Ar users/home
---- Permissions on users/home ---------------------------------------
Local+Descendent permissions:
user cindys quota,reservation
@@ -637,32 +633,34 @@ cindys% zfs get quota users/home/marks
NAME PROPERTY VALUE SOURCE
users/home/marks quota 10G local
.Ed
-.It Sy Example 21 No Removing ZFS Delegated Permissions on a ZFS Dataset
+.
+.It Sy Example 21 : No Removing ZFS Delegated Permissions on a ZFS Dataset
The following example shows how to remove the snapshot permission from the
-.Sy staff
+.Ar staff
group on the
-.Em tank/users
+.Sy tank/users
file system.
The permissions on
-.Em tank/users
+.Sy tank/users
are also displayed.
-.Bd -literal
-# zfs unallow staff snapshot tank/users
-# zfs allow tank/users
+.Bd -literal -compact -offset Ds
+.No # Nm zfs Cm unallow Ar staff Sy snapshot Ar tank/users
+.No # Nm zfs Cm allow Ar tank/users
---- Permissions on tank/users ---------------------------------------
Permission sets:
@pset create,destroy,mount,snapshot
Local+Descendent permissions:
group staff @pset
.Ed
-.It Sy Example 22 No Showing the differences between a snapshot and a ZFS Dataset
+.
+.It Sy Example 22 : No Showing the differences between a snapshot and a ZFS Dataset
The following example shows how to see what has changed between a prior
snapshot of a ZFS dataset and its current state.
The
.Fl F
option is used to indicate type information for the files affected.
-.Bd -literal
-# zfs diff -F tank/test@before tank/test
+.Bd -literal -compact -offset Ds
+.No # Nm zfs Cm diff Fl F Ar tank/test@before tank/test
M / /tank/test/
M F /tank/test/linked (+1)
R F /tank/test/oldname -> /tank/test/newname
@@ -670,57 +668,55 @@ R F /tank/test/oldname -> /tank/test/newname
+ F /tank/test/created
M F /tank/test/modified
.Ed
-.It Sy Example 23 No Creating a bookmark
+.
+.It Sy Example 23 : No Creating a bookmark
The following example create a bookmark to a snapshot.
This bookmark can then be used instead of snapshot in send streams.
-.Bd -literal
-# zfs bookmark rpool@snapshot rpool#bookmark
-.Ed
-.It Sy Example 24 No Setting sharesmb Property Options on a ZFS File System
+.Dl # Nm zfs Cm bookmark Ar rpool Ns @ Ns Ar snapshot rpool Ns # Ns Ar bookmark
+.
+.It Sy Example 24 : No Setting Sy sharesmb No Property Options on a ZFS File System
The following example show how to share SMB filesystem through ZFS.
-Note that a user and his/her password must be given.
-.Bd -literal
-# smbmount //127.0.0.1/share_tmp /mnt/tmp \\
- -o user=workgroup/turbo,password=obrut,uid=1000
-.Ed
+Note that a user and their password must be given.
+.Dl # Nm smbmount Ar //127.0.0.1/share_tmp /mnt/tmp Fl o No user=workgroup/turbo,password=obrut,uid=1000
.Pp
Minimal
-.Em /etc/samba/smb.conf
-configuration required:
+.Pa /etc/samba/smb.conf
+configuration is required, as follows.
.Pp
-Samba will need to listen to 'localhost' (127.0.0.1) for the ZFS utilities to
+Samba will need to bind to the loopback interface for the ZFS utilities to
communicate with Samba.
This is the default behavior for most Linux distributions.
.Pp
Samba must be able to authenticate a user.
-This can be done in a number of ways, depending on if using the system password file, LDAP or the Samba
-specific smbpasswd file.
-How to do this is outside the scope of this manual.
-Please refer to the
+This can be done in a number of ways
+.Pq Xr passwd 5 , LDAP , Xr smbpasswd 5 , &c.\& .
+How to do this is outside the scope of this document – refer to
.Xr smb.conf 5
-man page for more information.
+for more information.
.Pp
See the
-.Sy USERSHARE section
-of the
-.Xr smb.conf 5
-man page for all configuration options in case you need to modify any options
-to the share afterwards.
+.Sx USERSHARES
+section for all configuration options,
+in case you need to modify any options of the share afterwards.
Do note that any changes done with the
.Xr net 8
-command will be undone if the share is ever unshared (such as at a reboot etc).
+command will be undone if the share is ever unshared (like via a reboot).
.El
+.
.Sh ENVIRONMENT VARIABLES
.Bl -tag -width "ZFS_MOUNT_HELPER"
-.It Ev ZFS_MOUNT_HELPER
+.It Sy ZFS_MOUNT_HELPER
Cause
-.Nm zfs mount
+.Nm zfs Cm mount
to use
-.Em /bin/mount
-to mount zfs datasets. This option is provided for backwards compatibility with older zfs versions.
+.Xr mount 8
+to mount ZFS datasets.
+This option is provided for backwards compatibility with older ZFS versions.
.El
+.
.Sh INTERFACE STABILITY
.Sy Committed .
+.
.Sh SEE ALSO
.Xr attr 1 ,
.Xr gzip 1 ,
@@ -732,6 +728,8 @@ to mount zfs datasets. This option is provided for backwards compatibility with
.Xr acl 5 ,
.Xr attributes 5 ,
.Xr exports 5 ,
+.Xr zfsconcepts 7 ,
+.Xr zfsprops 7 ,
.Xr exportfs 8 ,
.Xr mount 8 ,
.Xr net 8 ,
@@ -772,6 +770,4 @@ to mount zfs datasets. This option is provided for backwards compatibility with
.Xr zfs-upgrade 8 ,
.Xr zfs-userspace 8 ,
.Xr zfs-wait 8 ,
-.Xr zfsconcepts 8 ,
-.Xr zfsprops 8 ,
.Xr zpool 8
diff --git a/sys/contrib/openzfs/man/man8/zfs_ids_to_path.8 b/sys/contrib/openzfs/man/man8/zfs_ids_to_path.8
index 4f7b8429e411..d5b74678b29c 100644
--- a/sys/contrib/openzfs/man/man8/zfs_ids_to_path.8
+++ b/sys/contrib/openzfs/man/man8/zfs_ids_to_path.8
@@ -18,11 +18,12 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2020 by Delphix. All rights reserved.
+.\"
.Dd April 17, 2020
.Dt ZFS_IDS_TO_PATH 8
.Os
+.
.Sh NAME
.Nm zfs_ids_to_path
.Nd convert objset and object ids to names and paths
@@ -30,21 +31,21 @@
.Nm
.Op Fl v
.Ar pool
-.Ar objset id
-.Ar object id
-.Nm
+.Ar objset-id
+.Ar object-id
+.
.Sh DESCRIPTION
-.Pp
The
.Sy zfs_ids_to_path
-utility converts a provided objset and object id into a path to the file that
-those ids refer to.
+utility converts a provided objset and object ids
+into a path to the file they refer to.
.Bl -tag -width "-D"
.It Fl v
Verbose.
-Print the dataset name and the file path within the dataset separately. This
-will work correctly even if the dataset is not mounted.
+Print the dataset name and the file path within the dataset separately.
+This will work correctly even if the dataset is not mounted.
.El
+.
.Sh SEE ALSO
-.Xr zfs 8 ,
-.Xr zdb 8
+.Xr zdb 8 ,
+.Xr zfs 8
diff --git a/sys/contrib/openzfs/man/man8/zgenhostid.8 b/sys/contrib/openzfs/man/man8/zgenhostid.8
index eb0fde748eb7..0dcebef73c31 100644
--- a/sys/contrib/openzfs/man/man8/zgenhostid.8
+++ b/sys/contrib/openzfs/man/man8/zgenhostid.8
@@ -18,86 +18,83 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2017 by Lawrence Livermore National Security, LLC.
.\"
-.Dd March 18, 2021
-.Dt ZGENHOSTID 8 SMM
+.Dd May 26, 2021
+.Dt ZGENHOSTID 8
.Os
+.
.Sh NAME
.Nm zgenhostid
-.Nd generate and store a hostid in
-.Em /etc/hostid
+.Nd generate host ID into /etc/hostid
.Sh SYNOPSIS
.Nm
.Op Fl f
.Op Fl o Ar filename
.Op Ar hostid
+.
.Sh DESCRIPTION
Creates
.Pa /etc/hostid
-file and stores hostid in it.
-If the user provides
-.Op Ar hostid
-on the command line, validates and stores that value.
-Otherwise, randomly generates a value to store.
-.Bl -tag -width "hostid"
+file and stores the host ID in it.
+If
+.Ar hostid
+was provided, validate and store that value.
+Otherwise, randomly generate an ID.
+.
+.Sh OPTIONS
+.Bl -tag -width "-o filename"
.It Fl h
Display a summary of the command-line options.
.It Fl f
-Force file overwrite.
+Allow output overwrite.
.It Fl o Ar filename
Write to
.Pa filename
-instead of default
-.Pa /etc/hostid
+instead of the default
+.Pa /etc/hostid .
.It Ar hostid
Specifies the value to be placed in
.Pa /etc/hostid .
It should be a number with a value between 1 and 2^32-1.
-If it is 0, zgenhostid will generate a random hostid.
+If
+.Sy 0 ,
+generate a random ID.
This value
-.Sy must
+.Em must
be unique among your systems.
It
-.Sy must
-be expressed in hexadecimal and be exactly
-.Em 8
-digits long, optionally prefixed by
-.Em 0x .
+.Em must
+be an 8-digit-long hexadecimal number, optionally prefixed by
+.Qq 0x .
.El
+.
.Sh FILES
.Pa /etc/hostid
+.
.Sh EXAMPLES
.Bl -tag -width Bd
.It Generate a random hostid and store it
-.Bd -literal
-# zgenhostid
-.Ed
+.Dl # Nm
.It Record the libc-generated hostid in Pa /etc/hostid
-.Bd -literal
-# zgenhostid "$(hostid)"
-.Ed
-.It Record a custom hostid (0xdeadbeef) in Pa /etc/hostid
-.Bd -literal
-# zgenhostid deadbeef
-.Ed
-.It Record a custom hostid (0x01234567) in Pa /tmp/hostid
-and ovewrite the file if it exists
-.Bd -literal
-# zgenhostid -f -o /tmp/hostid 0x01234567
-.Ed
+.Dl # Nm Qq $ Ns Pq Nm hostid
+.It Record a custom hostid Po Ar 0xdeadbeef Pc in Pa /etc/hostid
+.Dl # Nm Ar deadbeef
+.It Record a custom hostid Po Ar 0x01234567 Pc in Pa /tmp/hostid No and ovewrite the file if it exists
+.Dl # Nm Fl f o Ar /tmp/hostid 0x01234567
.El
+.
.Sh SEE ALSO
.Xr genhostid 1 ,
.Xr hostid 1 ,
.Xr sethostid 3 ,
-.Xr spl-module-parameters 5
+.Xr spl 4
+.
.Sh HISTORY
.Nm
emulates the
.Xr genhostid 1
utility and is provided for use on systems which
-do not include the utility or do not provide
+do not include the utility or do not provide the
.Xr sethostid 3
-call.
+function.
diff --git a/sys/contrib/openzfs/man/man8/zinject.8 b/sys/contrib/openzfs/man/man8/zinject.8
index ee6776fe7641..a29346929988 100644
--- a/sys/contrib/openzfs/man/man8/zinject.8
+++ b/sys/contrib/openzfs/man/man8/zinject.8
@@ -1,4 +1,3 @@
-'\" t
.\"
.\" CDDL HEADER START
.\"
@@ -19,180 +18,279 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright 2013 Darik Horn <dajhorn@vanadac.com>. All rights reserved.
.\"
-.TH ZINJECT 8 "Aug 24, 2020" OpenZFS
-
-.SH NAME
-zinject \- ZFS Fault Injector
-.SH DESCRIPTION
-.BR zinject
-creates artificial problems in a ZFS pool by simulating data corruption or device failures. This program is dangerous.
-.SH SYNOPSIS
-.TP
-.B "zinject"
+.\" lint-ok: WARNING: sections out of conventional order: Sh SYNOPSIS
+.\"
+.Dd May 26, 2021
+.Dt ZINJECT 8
+.Os
+.
+.Sh NAME
+.Nm zinject
+.Nd ZFS Fault Injector
+.Sh DESCRIPTION
+.Nm
+creates artificial problems in a ZFS pool by simulating data corruption
+or device failures.
+This program is dangerous.
+.
+.Sh SYNOPSIS
+.Bl -tag -width Ds
+.It Xo
+.Nm zinject
+.Xc
List injection records.
-.TP
-.B "zinject \-b \fIobjset:object:level:blkd\fB [\-f \fIfrequency\fB] [\-amu] \fIpool\fB"
+.
+.It Xo
+.Nm zinject
+.Fl b Ar objset : Ns Ar object : Ns Ar level : Ns Ar start : Ns Ar end
+.Op Fl f Ar frequency
+.Fl amu
+.Op pool
+.Xc
Force an error into the pool at a bookmark.
-.TP
-.B "zinject \-c <\fIid\fB | all>
+.
+.It Xo
+.Nm zinject
+.Fl c Ar id Ns | Ns Sy all
+.Xc
Cancel injection records.
-.TP
-.B "zinject \-d \fIvdev\fB \-A <degrade|fault> \fIpool\fB
+.
+.It Xo
+.Nm zinject
+.Fl d Ar vdev
+.Fl A Sy degrade Ns | Ns Sy fault
+.Ar pool
+.Xc
Force a vdev into the DEGRADED or FAULTED state.
-.TP
-.B "zinject -d \fIvdev\fB -D latency:lanes \fIpool\fB
-
+.
+.It Xo
+.Nm zinject
+.Fl d Ar vdev
+.Fl D Ar latency : Ns Ar lanes
+.Ar pool
+.Xc
Add an artificial delay to IO requests on a particular
-device, such that the requests take a minimum of 'latency'
-milliseconds to complete. Each delay has an associated
-number of 'lanes' which defines the number of concurrent
+device, such that the requests take a minimum of
+.Ar latency
+milliseconds to complete.
+Each delay has an associated number of
+.Ar lanes
+which defines the number of concurrent
IO requests that can be processed.
-
-For example, with a single lane delay of 10 ms (-D 10:1),
+.Pp
+For example, with a single lane delay of 10 ms
+.No (\& Ns Fl D Ar 10 : Ns Ar 1 ) ,
the device will only be able to service a single IO request
-at a time with each request taking 10 ms to complete. So,
-if only a single request is submitted every 10 ms, the
+at a time with each request taking 10 ms to complete.
+So, if only a single request is submitted every 10 ms, the
average latency will be 10 ms; but if more than one request
is submitted every 10 ms, the average latency will be more
than 10 ms.
-
+.Pp
Similarly, if a delay of 10 ms is specified to have two
-lanes (-D 10:2), then the device will be able to service
-two requests at a time, each with a minimum latency of
-10 ms. So, if two requests are submitted every 10 ms, then
+lanes
+.No (\& Ns Fl D Ar 10 : Ns Ar 2 ) ,
+then the device will be able to service
+two requests at a time, each with a minimum latency of 10 ms.
+So, if two requests are submitted every 10 ms, then
the average latency will be 10 ms; but if more than two
requests are submitted every 10 ms, the average latency
will be more than 10 ms.
-
-Also note, these delays are additive. So two invocations
-of '-D 10:1', is roughly equivalent to a single invocation
-of '-D 10:2'. This also means, one can specify multiple
-lanes with differing target latencies. For example, an
-invocation of '-D 10:1' followed by '-D 25:2' will
-create 3 lanes on the device; one lane with a latency
+.Pp
+Also note, these delays are additive.
+So two invocations of
+.Fl D Ar 10 : Ns Ar 1
+are roughly equivalent to a single invocation of
+.Fl D Ar 10 : Ns Ar 2 .
+This also means, that one can specify multiple
+lanes with differing target latencies.
+For example, an invocation of
+.Fl D Ar 10 : Ns Ar 1
+followed by
+.Fl D Ar 25 : Ns Ar 2
+will create 3 lanes on the device: one lane with a latency
of 10 ms and two lanes with a 25 ms latency.
-
-.TP
-.B "zinject \-d \fIvdev\fB [\-e \fIdevice_error\fB] [\-L \fIlabel_error\fB] [\-T \fIfailure\fB] [\-f \fIfrequency\fB] [\-F] \fIpool\fB"
+.
+.It Xo
+.Nm zinject
+.Fl d Ar vdev
+.Op Fl e Ar device_error
+.Op Fl L Ar label_error
+.Op Fl T Ar failure
+.Op Fl f Ar frequency
+.Op Fl F
+.Ar pool
+.Xc
Force a vdev error.
-.TP
-.B "zinject \-I [\-s \fIseconds\fB | \-g \fItxgs\fB] \fIpool\fB"
+.
+.It Xo
+.Nm zinject
+.Fl I
+.Op Fl s Ar seconds Ns | Ns Fl g Ar txgs
+.Ar pool
+.Xc
Simulate a hardware failure that fails to honor a cache flush.
-.TP
-.B "zinject \-p \fIfunction\fB \fIpool\fB
+.
+.It Xo
+.Nm zinject
+.Fl p Ar function
+.Ar pool
+.Xc
Panic inside the specified function.
-.TP
-.B "zinject \-t data [\-C \fIdvas\fB] [\-e \fIdevice_error\fB] [\-f \fIfrequency\fB] [\-l \fIlevel\fB] [\-r \fIrange\fB] [\-amq] \fIpath\fB"
+.
+.It Xo
+.Nm zinject
+.Fl t Sy data
+.Fl C Ar dvas
+.Op Fl e Ar device_error
+.Op Fl f Ar frequency
+.Op Fl l Ar level
+.Op Fl r Ar range
+.Op Fl amq
+.Ar path
+.Xc
Force an error into the contents of a file.
-.TP
-.B "zinject \-t dnode [\-C \fIdvas\fB] [\-e \fIdevice_error\fB] [\-f \fIfrequency\fB] [\-l \fIlevel\fB] [\-amq] \fIpath\fB"
+.
+.It Xo
+.Nm zinject
+.Fl t Sy dnode
+.Fl C Ar dvas
+.Op Fl e Ar device_error
+.Op Fl f Ar frequency
+.Op Fl l Ar level
+.Op Fl amq
+.Ar path
+.Xc
Force an error into the metadnode for a file or directory.
-.TP
-.B "zinject \-t \fImos_type\fB [\-C \fIdvas\fB] [\-e \fIdevice_error\fB] [\-f \fIfrequency\fB] [\-l \fIlevel\fB] [\-r \fIrange\fB] [\-amqu] \fIpool\fB"
+.
+.It Xo
+.Nm zinject
+.Fl t Ar mos_type
+.Fl C Ar dvas
+.Op Fl e Ar device_error
+.Op Fl f Ar frequency
+.Op Fl l Ar level
+.Op Fl r Ar range
+.Op Fl amqu
+.Ar pool
+.Xc
Force an error into the MOS of a pool.
-.SH OPTIONS
-.TP
-.BI "\-a"
+.El
+.Sh OPTIONS
+.Bl -tag -width "-C dvas"
+.It Fl a
Flush the ARC before injection.
-.TP
-.BI "\-b" " objset:object:level:start:end"
-Force an error into the pool at this bookmark tuple. Each number is
-in hexadecimal, and only one block can be specified.
-.TP
-.BI "\-C" " dvas"
-Inject the given error only into specific DVAs. The mask should be
-specified as a list of 0-indexed DVAs separated by commas (ex. '0,2'). This
-option is not applicable to logical data errors such as
-.BR "decompress"
+.It Fl b Ar objset : Ns Ar object : Ns Ar level : Ns Ar start : Ns Ar end
+Force an error into the pool at this bookmark tuple.
+Each number is in hexadecimal, and only one block can be specified.
+.It Fl C Ar dvas
+Inject the given error only into specific DVAs.
+The mask should be specified as a list of 0-indexed DVAs separated by commas
+.No (ex. Ar 0,2 Ns No ).
+This option is not applicable to logical data errors such as
+.Sy decompress
and
-.BR "decrypt" .
-.TP
-.BI "\-d" " vdev"
+.Sy decrypt .
+.It Fl d Ar vdev
A vdev specified by path or GUID.
-.TP
-.BI "\-e" " device_error"
+.It Fl e Ar device_error
Specify
-.BR "checksum" " for an ECKSUM error,"
-.BR "decompress" " for a data decompression error,"
-.BR "decrypt" " for a data decryption error,"
-.BR "corrupt" " to flip a bit in the data after a read,"
-.BR "dtl" " for an ECHILD error,"
-.BR "io" " for an EIO error where reopening the device will succeed, or"
-.BR "nxio" " for an ENXIO error where reopening the device will fail."
-For EIO and ENXIO, the "failed" reads or writes still occur. The probe simply
-sets the error value reported by the I/O pipeline so it appears the read or
-write failed. Decryption errors only currently work with file data.
-.TP
-.BI "\-f" " frequency"
-Only inject errors a fraction of the time. Expressed as a real number
-percentage between 0.0001 and 100.
-.TP
-.BI "\-F"
-Fail faster. Do fewer checks.
-.TP
-.BI "\-g" " txgs"
+.Bl -tag -compact -width "decompress"
+.It Sy checksum
+for an ECKSUM error,
+.It Sy decompress
+for a data decompression error,
+.It Sy decrypt
+for a data decryption error,
+.It Sy corrupt
+to flip a bit in the data after a read,
+.It Sy dtl
+for an ECHILD error,
+.It Sy io
+for an EIO error where reopening the device will succeed, or
+.It Sy nxio
+for an ENXIO error where reopening the device will fail.
+.El
+.Pp
+For EIO and ENXIO, the "failed" reads or writes still occur.
+The probe simply sets the error value reported by the I/O pipeline
+so it appears the read or write failed.
+Decryption errors only currently work with file data.
+.It Fl f Ar frequency
+Only inject errors a fraction of the time.
+Expressed as a real number percentage between
+.Sy 0.0001
+and
+.Sy 100 .
+.It Fl F
+Fail faster.
+Do fewer checks.
+.It Fl f Ar txgs
Run for this many transaction groups before reporting failure.
-.TP
-.BI "\-h"
+.It Fl h
Print the usage message.
-.TP
-.BI "\-l" " level"
-Inject an error at a particular block level. The default is 0.
-.TP
-.BI "\-L" " label_error"
+.It Fl l Ar level
+Inject an error at a particular block level.
+The default is
+.Sy 0 .
+.It Fl L Ar label_error
Set the label error region to one of
-.BR " nvlist" ","
-.BR " pad1" ","
-.BR " pad2" ", or"
-.BR " uber" "."
-.TP
-.BI "\-m"
+.Sy nvlist ,
+.Sy pad1 ,
+.Sy pad2 ,
+or
+.Sy uber .
+.It Fl m
Automatically remount the underlying filesystem.
-.TP
-.BI "\-q"
-Quiet mode. Only print the handler number added.
-.TP
-.BI "\-r" " range"
+.It Fl q
+Quiet mode.
+Only print the handler number added.
+.It Fl r Ar range
Inject an error over a particular logical range of an object, which
will be translated to the appropriate blkid range according to the
object's properties.
-.TP
-.BI "\-s" " seconds"
+.It Fl s Ar seconds
Run for this many seconds before reporting failure.
-.TP
-.BI "\-T" " failure"
+.It Fl T Ar failure
Set the failure type to one of
-.BR " all" ","
-.BR " claim" ","
-.BR " free" ","
-.BR " read" ", or"
-.BR " write" "."
-.TP
-.BI "\-t" " mos_type"
+.Sy all ,
+.Sy claim ,
+.Sy free ,
+.Sy read ,
+or
+.Sy write .
+.It Fl t Ar mos_type
Set this to
-.BR "mos " "for any data in the MOS,"
-.BR "mosdir " "for an object directory,"
-.BR "config " "for the pool configuration,"
-.BR "bpobj " "for the block pointer list,"
-.BR "spacemap " "for the space map,"
-.BR "metaslab " "for the metaslab, or"
-.BR "errlog " "for the persistent error log."
-.TP
-.BI "\-u"
+.Bl -tag -compact -width "spacemap"
+.It Sy mos
+for any data in the MOS,
+.It Sy mosdir
+for an object directory,
+.It Sy config
+for the pool configuration,
+.It Sy bpobj
+for the block pointer list,
+.It Sy spacemap
+for the space map,
+.It Sy metaslab
+for the metaslab, or
+.It Sy errlog
+for the persistent error log.
+.El
+.It Fl u
Unload the pool after injection.
-
-.SH "ENVIRONMENT VARIABLES"
-.TP
-.B "ZINJECT_DEBUG"
-Run \fBzinject\fR in debug mode.
-
-.SH "AUTHORS"
-This man page was written by Darik Horn <dajhorn@vanadac.com>
-excerpting the \fBzinject\fR usage message and source code.
-
-.SH "SEE ALSO"
-.BR zpool (8),
-.BR zfs (8)
+.El
+.
+.Sh ENVIRONMENT VARIABLES
+.Bl -tag -width "ZF"
+.It Ev ZFS_HOSTID
+Run
+.Nm
+in debug mode.
+.El
+.
+.Sh SEE ALSO
+.Xr zfs 8 ,
+.Xr zpool 8
diff --git a/sys/contrib/openzfs/man/man8/zpool-add.8 b/sys/contrib/openzfs/man/man8/zpool-add.8
index cf1630435eb4..26cf33c5538c 100644
--- a/sys/contrib/openzfs/man/man8/zpool-add.8
+++ b/sys/contrib/openzfs/man/man8/zpool-add.8
@@ -17,7 +17,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -26,34 +25,28 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
+.Dd May 27, 2021
.Dt ZPOOL-ADD 8
.Os
+.
.Sh NAME
.Nm zpool-add
-.Nd Adds specified virtual devices to a ZFS storage pool
+.Nd add vdevs to ZFS storage pool
.Sh SYNOPSIS
.Nm zpool
.Cm add
.Op Fl fgLnP
.Oo Fl o Ar property Ns = Ns Ar value Oc
-.Ar pool vdev Ns ...
+.Ar pool vdev Ns …
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm add
-.Op Fl fgLnP
-.Oo Fl o Ar property Ns = Ns Ar value Oc
-.Ar pool vdev Ns ...
-.Xc
Adds the specified virtual devices to the given pool.
The
.Ar vdev
specification is described in the
.Em Virtual Devices
section of
-.Xr zpoolconcepts 8.
+.Xr zpoolconcepts 7 .
The behavior of the
.Fl f
option, and the device checks performed are described in the
@@ -68,13 +61,17 @@ Not all devices can be overridden in this manner.
.It Fl g
Display
.Ar vdev ,
-GUIDs instead of the normal device names. These GUIDs can be used in place of
+GUIDs instead of the normal device names.
+These GUIDs can be used in place of
device names for the zpool detach/offline/remove/replace commands.
.It Fl L
Display real paths for
.Ar vdev Ns s
-resolving all symbolic links. This can be used to look up the current block
-device name regardless of the /dev/disk/ path used to open it.
+resolving all symbolic links.
+This can be used to look up the current block
+device name regardless of the
+.Pa /dev/disk
+path used to open it.
.It Fl n
Displays the configuration that would be used without actually adding the
.Ar vdev Ns s .
@@ -83,20 +80,22 @@ device sharing.
.It Fl P
Display real paths for
.Ar vdev Ns s
-instead of only the last component of the path. This can be used in
-conjunction with the
+instead of only the last component of the path.
+This can be used in conjunction with the
.Fl L
flag.
.It Fl o Ar property Ns = Ns Ar value
-Sets the given pool properties. See the
-.Xr zpoolprops 8
-manual page for a list of valid properties that can be set. The only property
-supported at the moment is ashift.
-.El
+Sets the given pool properties.
+See the
+.Xr zpoolprops 7
+manual page for a list of valid properties that can be set.
+The only property supported at the moment is
+.Sy ashift .
.El
+.
.Sh SEE ALSO
-.Xr zpool-remove 8 ,
.Xr zpool-attach 8 ,
.Xr zpool-import 8 ,
.Xr zpool-initialize 8 ,
-.Xr zpool-online 8
+.Xr zpool-online 8 ,
+.Xr zpool-remove 8
diff --git a/sys/contrib/openzfs/man/man8/zpool-attach.8 b/sys/contrib/openzfs/man/man8/zpool-attach.8
index 41b6a6b613da..19d8f6ac07ac 100644
--- a/sys/contrib/openzfs/man/man8/zpool-attach.8
+++ b/sys/contrib/openzfs/man/man8/zpool-attach.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -30,24 +29,18 @@
.Dd May 15, 2020
.Dt ZPOOL-ATTACH 8
.Os
+.
.Sh NAME
.Nm zpool-attach
-.Nd Attach a new device to an existing ZFS virtual device (vdev).
+.Nd attach new device to existing ZFS vdev
.Sh SYNOPSIS
.Nm zpool
.Cm attach
.Op Fl fsw
.Oo Fl o Ar property Ns = Ns Ar value Oc
.Ar pool device new_device
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm attach
-.Op Fl fsw
-.Oo Fl o Ar property Ns = Ns Ar value Oc
-.Ar pool device new_device
-.Xc
Attaches
.Ar new_device
to the existing
@@ -76,10 +69,12 @@ Forces use of
even if it appears to be in use.
Not all devices can be overridden in this manner.
.It Fl o Ar property Ns = Ns Ar value
-Sets the given pool properties. See the
-.Xr zpoolprops 8
-manual page for a list of valid properties that can be set. The only property
-supported at the moment is ashift.
+Sets the given pool properties.
+See the
+.Xr zpoolprops 7
+manual page for a list of valid properties that can be set.
+The only property supported at the moment is
+.Sy ashift .
.It Fl s
The
.Ar new_device
@@ -92,10 +87,10 @@ Waits until
.Ar new_device
has finished resilvering before returning.
.El
-.El
+.
.Sh SEE ALSO
-.Xr zpool-detach 8 ,
.Xr zpool-add 8 ,
+.Xr zpool-detach 8 ,
.Xr zpool-import 8 ,
.Xr zpool-initialize 8 ,
.Xr zpool-online 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zpool-checkpoint.8 b/sys/contrib/openzfs/man/man8/zpool-checkpoint.8
index 128970ee66ac..d5add14aed2f 100644
--- a/sys/contrib/openzfs/man/man8/zpool-checkpoint.8
+++ b/sys/contrib/openzfs/man/man8/zpool-checkpoint.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,56 +26,47 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
+.Dd May 27, 2021
.Dt ZPOOL-CHECKPOINT 8
.Os
+.
.Sh NAME
.Nm zpool-checkpoint
-.Nd Checkpoints the current state of a ZFS storage pool
+.Nd check-point current ZFS storage pool state
.Sh SYNOPSIS
.Nm zpool
.Cm checkpoint
-.Op Fl d, -discard Oo Fl w, -wait Oc
+.Op Fl d Op Fl w
.Ar pool
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm checkpoint
-.Op Fl d, -discard Oo Fl w, -wait Oc
-.Ar pool
-.Xc
Checkpoints the current state of
.Ar pool
, which can be later restored by
.Nm zpool Cm import --rewind-to-checkpoint .
The existence of a checkpoint in a pool prohibits the following
.Nm zpool
-commands:
-.Cm remove ,
-.Cm attach ,
-.Cm detach ,
-.Cm split ,
-and
-.Cm reguid .
+subcommands:
+.Cm remove , attach , detach , split , No and Cm reguid .
In addition, it may break reservation boundaries if the pool lacks free
space.
The
.Nm zpool Cm status
command indicates the existence of a checkpoint or the progress of discarding a
checkpoint from a pool.
-The
.Nm zpool Cm list
-command reports how much space the checkpoint takes from the pool.
+can be used to check how much space the checkpoint takes from the pool.
+.
+.Sh OPTIONS
.Bl -tag -width Ds
-.It Fl d, -discard
+.It Fl d , -discard
Discards an existing checkpoint from
.Ar pool .
-.It Fl w, -wait
+.It Fl w , -wait
Waits until the checkpoint has finished being discarded before returning.
.El
-.El
+.
.Sh SEE ALSO
+.Xr zfs-snapshot 8 ,
.Xr zpool-import 8 ,
-.Xr zpool-status 8 ,
-.Xr zfs-snapshot 8
+.Xr zpool-status 8
diff --git a/sys/contrib/openzfs/man/man8/zpool-clear.8 b/sys/contrib/openzfs/man/man8/zpool-clear.8
index e00eb760af61..6e41566ca6da 100644
--- a/sys/contrib/openzfs/man/man8/zpool-clear.8
+++ b/sys/contrib/openzfs/man/man8/zpool-clear.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,33 +26,30 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
+.Dd May 27, 2021
.Dt ZPOOL-CLEAR 8
.Os
+.
.Sh NAME
.Nm zpool-clear
-.Nd Clears device errors in a ZFS storage pool.
+.Nd clear device errors in ZFS storage pool
.Sh SYNOPSIS
.Nm zpool
.Cm clear
.Ar pool
-.Op Ar device
+.Oo Ar device Oc Ns …
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm clear
-.Ar pool
-.Op Ar device
-.Xc
Clears device errors in a pool.
If no arguments are specified, all device errors within the pool are cleared.
If one or more devices is specified, only those errors associated with the
specified device or devices are cleared.
-If multihost is enabled, and the pool has been suspended, this will not
-resume I/O. While the pool was suspended, it may have been imported on
+If
+.Sy multihost
+is enabled and the pool has been suspended, this will not resume I/O.
+While the pool was suspended, it may have been imported on
another host, and resuming I/O could result in pool damage.
-.El
+.
.Sh SEE ALSO
.Xr zdb 8 ,
.Xr zpool-reopen 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zpool-create.8 b/sys/contrib/openzfs/man/man8/zpool-create.8
index d8cb61c45170..e902c770076d 100644
--- a/sys/contrib/openzfs/man/man8/zpool-create.8
+++ b/sys/contrib/openzfs/man/man8/zpool-create.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -28,42 +27,32 @@
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\" Copyright (c) 2021, Colm Buckley <colm@tuatha.org>
.\"
-.Dd August 9, 2019
+.Dd June 2, 2021
.Dt ZPOOL-CREATE 8
.Os
+.
.Sh NAME
.Nm zpool-create
-.Nd Creates a new ZFS storage pool
+.Nd create ZFS storage pool
.Sh SYNOPSIS
.Nm zpool
.Cm create
.Op Fl dfn
.Op Fl m Ar mountpoint
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
-.Oo Fl o Ar feature@feature Ns = Ns Ar value Oc
-.Op Fl o Ar compatibility Ns = Ns Ar off | legacy | file Bq , Ns Ar file Ns ...
-.Oo Fl O Ar file-system-property Ns = Ns Ar value Oc Ns ...
-.Op Fl R Ar root
-.Ar pool vdev Ns ...
-.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm create
-.Op Fl dfn
-.Op Fl m Ar mountpoint
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
-.Oo Fl o Ar feature@feature Ns = Ns Ar value Oc Ns ...
-.Op Fl o Ar compatibility Ns = Ns Ar off | legacy | file Bq , Ns Ar file Ns ...
-.Oo Fl O Ar file-system-property Ns = Ns Ar value Oc Ns ...
+.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
+.Oo Fl o Sy feature@ Ns Ar feature Ns = Ns Ar value Oc
+.Op Fl o Ar compatibility Ns = Ns Sy off Ns | Ns Sy legacy Ns | Ns Ar file Ns Oo , Ns Ar file Oc Ns …
+.Oo Fl O Ar file-system-property Ns = Ns Ar value Oc Ns …
.Op Fl R Ar root
.Op Fl t Ar tname
-.Ar pool vdev Ns ...
-.Xc
+.Ar pool
+.Ar vdev Ns …
+.
+.Sh DESCRIPTION
Creates a new storage pool containing the virtual devices specified on the
command line.
The pool name must begin with a letter, and can only contain
-alphanumeric characters as well as underscore
+alphanumeric characters as well as the underscore
.Pq Qq Sy _ ,
dash
.Pq Qq Sy \&- ,
@@ -84,46 +73,41 @@ are reserved, as are names beginning with
.Sy mirror ,
.Sy raidz ,
.Sy draid ,
-.Sy spare ,
-and the pattern
-.Sy c[0-9] .
+and
+.Sy spare .
The
.Ar vdev
specification is described in the
-.Em Virtual Devices
+.Sx Virtual Devices
section of
-.Xr zpoolconcepts 8 .
+.Xr zpoolconcepts 7 .
.Pp
The command attempts to verify that each device specified is accessible and not
-currently in use by another subsystem. However this check is not robust enough
+currently in use by another subsystem.
+However this check is not robust enough
to detect simultaneous attempts to use a new device in different pools, even if
-.Sy multihost
-is
-.Sy enabled.
-The
-administrator must ensure that simultaneous invocations of any combination of
-.Sy zpool replace ,
-.Sy zpool create ,
-.Sy zpool add ,
+.Sy multihost Ns = Sy enabled .
+The administrator must ensure, that simultaneous invocations of any combination of
+.Nm zpool Cm replace ,
+.Nm zpool Cm create ,
+.Nm zpool Cm add ,
or
-.Sy zpool labelclear ,
-do not refer to the same device. Using the same device in two pools will
-result in pool corruption.
+.Nm zpool Cm labelclear ,
+do not refer to the same device.
+Using the same device in two pools will result in pool corruption.
.Pp
There are some uses, such as being currently mounted, or specified as the
dedicated dump device, that prevents a device from ever being used by ZFS.
Other uses, such as having a preexisting UFS file system, can be overridden with
-the
-.Fl f
-option.
+.Fl f .
.Pp
The command also checks that the replication strategy for the pool is
consistent.
-An attempt to combine redundant and non-redundant storage in a single pool, or
-to mix disks and files, results in an error unless
+An attempt to combine redundant and non-redundant storage in a single pool,
+or to mix disks and files, results in an error unless
.Fl f
is specified.
-The use of differently sized devices within a single raidz or mirror group is
+The use of differently-sized devices within a single raidz or mirror group is
also flagged as an error unless
.Fl f
is specified.
@@ -133,29 +117,29 @@ Unless the
option is specified, the default mount point is
.Pa / Ns Ar pool .
The mount point must not exist or must be empty, or else the root dataset
-cannot be mounted.
+will not be able to be be mounted.
This can be overridden with the
.Fl m
option.
.Pp
-By default all supported features are enabled on the new pool. The
+By default all supported features are enabled on the new pool.
+The
.Fl d
-option or the
+option and the
.Fl o Ar compatibility
-property (eg:
-.Fl o Ar compatibility=2020
-) can be used to restrict the features that are enabled, so that the
-pool can be imported on other releases of the ZFS software.
-.Bl -tag -width Ds
+property
+.Pq e.g Fl o Sy compatibility Ns = Ns Ar 2020
+can be used to restrict the features that are enabled, so that the
+pool can be imported on other releases of ZFS.
+.Bl -tag -width "-t tname"
.It Fl d
Do not enable any features on the new pool.
Individual features can be enabled by setting their corresponding properties to
.Sy enabled
-with the
-.Fl o
-option.
+with
+.Fl o .
See
-.Xr zpool-features 5
+.Xr zpool-features 7
for details about feature properties.
.It Fl f
Forces use of
@@ -169,14 +153,14 @@ The default mount point is
or
.Pa altroot/pool
if
-.Ar altroot
+.Sy altroot
is specified.
The mount point must be an absolute path,
.Sy legacy ,
or
.Sy none .
For more information on dataset mount points, see
-.Xr zfs 8 .
+.Xr zfsprops 7 .
.It Fl n
Displays the configuration that would be used without actually creating the
pool.
@@ -184,37 +168,43 @@ The actual pool creation can still fail due to insufficient privileges or
device sharing.
.It Fl o Ar property Ns = Ns Ar value
Sets the given pool properties.
-See the
-.Xr zpoolprops 8
-manual page for a list of valid properties that can be set.
-.It Fl o Ar compatibility Ns = Ns Ar off | legacy | file Bq , Ns Ar file Ns ...
-Specifies compatibility feature sets. See
-.Xr zpool-features 5
+See
+.Xr zpoolprops 7
+for a list of valid properties that can be set.
+.It Fl o Ar compatibility Ns = Ns Sy off Ns | Ns Sy legacy Ns | Ns Ar file Ns Oo , Ns Ar file Oc Ns …
+Specifies compatibility feature sets.
+See
+.Xr zpool-features 7
for more information about compatibility feature sets.
-.It Fl o Ar feature@feature Ns = Ns Ar value
-Sets the given pool feature. See the
-.Xr zpool-features 5
+.It Fl o Sy feature@ Ns Ar feature Ns = Ns Ar value
+Sets the given pool feature.
+See the
+.Xr zpool-features 7
section for a list of valid features that can be set.
Value can be either disabled or enabled.
.It Fl O Ar file-system-property Ns = Ns Ar value
Sets the given file system properties in the root file system of the pool.
-See the
-.Xr zfsprops 8
-manual page for a list of valid properties that can be set.
+See
+.Xr zfsprops 7
+for a list of valid properties that can be set.
.It Fl R Ar root
Equivalent to
.Fl o Sy cachefile Ns = Ns Sy none Fl o Sy altroot Ns = Ns Ar root
.It Fl t Ar tname
Sets the in-core pool name to
-.Sy tname
-while the on-disk name will be the name specified as the pool name
-.Sy pool .
-This will set the default cachefile property to none. This is intended
+.Ar tname
+while the on-disk name will be the name specified as
+.Ar pool .
+This will set the default of the
+.Sy cachefile
+property to
+.Sy none .
+This is intended
to handle name space collisions when creating pools for other systems,
such as virtual machines or physical machines whose pools live on network
block devices.
.El
-.El
+.
.Sh SEE ALSO
.Xr zpool-destroy 8 ,
.Xr zpool-export 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zpool-destroy.8 b/sys/contrib/openzfs/man/man8/zpool-destroy.8
index d4fc21eaec02..a2f6729c8a76 100644
--- a/sys/contrib/openzfs/man/man8/zpool-destroy.8
+++ b/sys/contrib/openzfs/man/man8/zpool-destroy.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,29 +26,23 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
+.Dd May 31, 2021
.Dt ZPOOL-DESTROY 8
.Os
+.
.Sh NAME
.Nm zpool-destroy
-.Nd Destroys the given ZFS storage pool, freeing up any devices for other use
+.Nd destroy ZFS storage pool
.Sh SYNOPSIS
.Nm zpool
.Cm destroy
.Op Fl f
.Ar pool
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm destroy
-.Op Fl f
-.Ar pool
-.Xc
Destroys the given pool, freeing up any devices for other use.
This command tries to unmount any active datasets before destroying the pool.
.Bl -tag -width Ds
.It Fl f
-Forces any active datasets contained within the pool to be unmounted.
-.El
+Forcefully unmount all active datasets.
.El
diff --git a/sys/contrib/openzfs/man/man8/zpool-detach.8 b/sys/contrib/openzfs/man/man8/zpool-detach.8
index 75a5786d5a3d..952dd7882a90 100644
--- a/sys/contrib/openzfs/man/man8/zpool-detach.8
+++ b/sys/contrib/openzfs/man/man8/zpool-detach.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -30,32 +29,30 @@
.Dd August 9, 2019
.Dt ZPOOL-DETACH 8
.Os
+.
.Sh NAME
.Nm zpool-detach
-.Nd Detaches a device from a ZFS mirror vdev (virtual device)
+.Nd detach device from ZFS mirror
.Sh SYNOPSIS
.Nm zpool
.Cm detach
.Ar pool device
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm detach
-.Ar pool device
-.Xc
Detaches
.Ar device
from a mirror.
The operation is refused if there are no other valid replicas of the data.
-If device may be re-added to the pool later on then consider the
-.Sy zpool offline
+If
+.Ar device
+may be re-added to the pool later on then consider the
+.Nm zpool Cm offline
command instead.
-.El
+.
.Sh SEE ALSO
.Xr zpool-attach 8 ,
-.Xr zpool-offline 8 ,
.Xr zpool-labelclear 8 ,
+.Xr zpool-offline 8 ,
.Xr zpool-remove 8 ,
.Xr zpool-replace 8 ,
.Xr zpool-split 8
diff --git a/sys/contrib/openzfs/man/man8/zpool-events.8 b/sys/contrib/openzfs/man/man8/zpool-events.8
index 3a6ff8840168..ab1d6ea56213 100644
--- a/sys/contrib/openzfs/man/man8/zpool-events.8
+++ b/sys/contrib/openzfs/man/man8/zpool-events.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,45 +26,458 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
+.Dd May 27, 2021
.Dt ZPOOL-EVENTS 8
.Os
+.
.Sh NAME
.Nm zpool-events
-.Nd Lists all recent events generated by the ZFS kernel modules
+.Nd list recent events generated by kernel
.Sh SYNOPSIS
.Nm zpool
.Cm events
-.Op Fl vHf Oo Ar pool Oc | Fl c
-.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
+.Op Fl vHf
+.Op Ar pool
.Nm zpool
.Cm events
-.Op Fl vHf Oo Ar pool Oc | Fl c
-.Xc
-Lists all recent events generated by the ZFS kernel modules. These events
-are consumed by the
+.Fl c
+.
+.Sh DESCRIPTION
+Lists all recent events generated by the ZFS kernel modules.
+These events are consumed by the
.Xr zed 8
and used to automate administrative tasks such as replacing a failed device
-with a hot spare. For more information about the subclasses and event payloads
-that can be generated see the
-.Xr zfs-events 5
-man page.
-.Bl -tag -width Ds
+with a hot spare.
+For more information about the subclasses and event payloads
+that can be generated see
+.Sx EVENTS
+and the following sections.
+.
+.Sh OPTIONS
+.Bl -tag -compact -width Ds
.It Fl c
Clear all previous events.
.It Fl f
Follow mode.
.It Fl H
-Scripted mode. Do not display headers, and separate fields by a
+Scripted mode.
+Do not display headers, and separate fields by a
single tab instead of arbitrary space.
.It Fl v
Print the entire payload for each event.
.El
+.
+.Sh EVENTS
+Theese are the different event subclasses.
+The full event name would be
+.Sy ereport.fs.zfs.\& Ns Em SUBCLASS ,
+but only the last part is listed here.
+.Pp
+.Bl -tag -compact -width "vdev.bad_guid_sum"
+.It Sy checksum
+Issued when a checksum error has been detected.
+.It Sy io
+Issued when there is an I/O error in a vdev in the pool.
+.It Sy data
+Issued when there have been data errors in the pool.
+.It Sy deadman
+Issued when an I/O request is determined to be "hung", this can be caused
+by lost completion events due to flaky hardware or drivers.
+See
+.Sy zfs_deadman_failmode
+in
+.Xr zfs 4
+for additional information regarding "hung" I/O detection and configuration.
+.It Sy delay
+Issued when a completed I/O request exceeds the maximum allowed time
+specified by the
+.Sy zio_slow_io_ms
+module parameter.
+This can be an indicator of problems with the underlying storage device.
+The number of delay events is ratelimited by the
+.Sy zfs_slow_io_events_per_second
+module parameter.
+.It Sy config
+Issued every time a vdev change have been done to the pool.
+.It Sy zpool
+Issued when a pool cannot be imported.
+.It Sy zpool.destroy
+Issued when a pool is destroyed.
+.It Sy zpool.export
+Issued when a pool is exported.
+.It Sy zpool.import
+Issued when a pool is imported.
+.It Sy zpool.reguid
+Issued when a REGUID (new unique identifier for the pool have been regenerated) have been detected.
+.It Sy vdev.unknown
+Issued when the vdev is unknown.
+Such as trying to clear device errors on a vdev that have failed/been kicked
+from the system/pool and is no longer available.
+.It Sy vdev.open_failed
+Issued when a vdev could not be opened (because it didn't exist for example).
+.It Sy vdev.corrupt_data
+Issued when corrupt data have been detected on a vdev.
+.It Sy vdev.no_replicas
+Issued when there are no more replicas to sustain the pool.
+This would lead to the pool being
+.Em DEGRADED .
+.It Sy vdev.bad_guid_sum
+Issued when a missing device in the pool have been detected.
+.It Sy vdev.too_small
+Issued when the system (kernel) have removed a device, and ZFS
+notices that the device isn't there any more.
+This is usually followed by a
+.Sy probe_failure
+event.
+.It Sy vdev.bad_label
+Issued when the label is OK but invalid.
+.It Sy vdev.bad_ashift
+Issued when the ashift alignment requirement has increased.
+.It Sy vdev.remove
+Issued when a vdev is detached from a mirror (or a spare detached from a
+vdev where it have been used to replace a failed drive - only works if
+the original drive have been readded).
+.It Sy vdev.clear
+Issued when clearing device errors in a pool.
+Such as running
+.Nm zpool Cm clear
+on a device in the pool.
+.It Sy vdev.check
+Issued when a check to see if a given vdev could be opened is started.
+.It Sy vdev.spare
+Issued when a spare have kicked in to replace a failed device.
+.It Sy vdev.autoexpand
+Issued when a vdev can be automatically expanded.
+.It Sy io_failure
+Issued when there is an I/O failure in a vdev in the pool.
+.It Sy probe_failure
+Issued when a probe fails on a vdev.
+This would occur if a vdev
+have been kicked from the system outside of ZFS (such as the kernel
+have removed the device).
+.It Sy log_replay
+Issued when the intent log cannot be replayed.
+The can occur in the case of a missing or damaged log device.
+.It Sy resilver.start
+Issued when a resilver is started.
+.It Sy resilver.finish
+Issued when the running resilver have finished.
+.It Sy scrub.start
+Issued when a scrub is started on a pool.
+.It Sy scrub.finish
+Issued when a pool has finished scrubbing.
+.It Sy scrub.abort
+Issued when a scrub is aborted on a pool.
+.It Sy scrub.resume
+Issued when a scrub is resumed on a pool.
+.It Sy scrub.paused
+Issued when a scrub is paused on a pool.
+.It Sy bootfs.vdev.attach
+.El
+.
+.Sh PAYLOADS
+This is the payload (data, information) that accompanies an
+event.
+.Pp
+For
+.Xr zed 8 ,
+these are set to uppercase and prefixed with
+.Sy ZEVENT_ .
+.Pp
+.Bl -tag -compact -width "vdev_cksum_errors"
+.It Sy pool
+Pool name.
+.It Sy pool_failmode
+Failmode -
+.Sy wait ,
+.Sy continue ,
+or
+.Sy panic .
+See the
+.Sy failmode
+property in
+.Xr zpoolprops 7
+for more information.
+.It Sy pool_guid
+The GUID of the pool.
+.It Sy pool_context
+The load state for the pool (0=none, 1=open, 2=import, 3=tryimport, 4=recover
+5=error).
+.It Sy vdev_guid
+The GUID of the vdev in question (the vdev failing or operated upon with
+.Nm zpool Cm clear ,
+etc.).
+.It Sy vdev_type
+Type of vdev -
+.Sy disk ,
+.Sy file ,
+.Sy mirror ,
+etc.
+See the
+.Sy Virtual Devices
+section of
+.Xr zpoolconcepts 7
+for more information on possible values.
+.It Sy vdev_path
+Full path of the vdev, including any
+.Em -partX .
+.It Sy vdev_devid
+ID of vdev (if any).
+.It Sy vdev_fru
+Physical FRU location.
+.It Sy vdev_state
+State of vdev (0=uninitialized, 1=closed, 2=offline, 3=removed, 4=failed to open, 5=faulted, 6=degraded, 7=healthy).
+.It Sy vdev_ashift
+The ashift value of the vdev.
+.It Sy vdev_complete_ts
+The time the last I/O request completed for the specified vdev.
+.It Sy vdev_delta_ts
+The time since the last I/O request completed for the specified vdev.
+.It Sy vdev_spare_paths
+List of spares, including full path and any
+.Em -partX .
+.It Sy vdev_spare_guids
+GUID(s) of spares.
+.It Sy vdev_read_errors
+How many read errors that have been detected on the vdev.
+.It Sy vdev_write_errors
+How many write errors that have been detected on the vdev.
+.It Sy vdev_cksum_errors
+How many checksum errors that have been detected on the vdev.
+.It Sy parent_guid
+GUID of the vdev parent.
+.It Sy parent_type
+Type of parent.
+See
+.Sy vdev_type .
+.It Sy parent_path
+Path of the vdev parent (if any).
+.It Sy parent_devid
+ID of the vdev parent (if any).
+.It Sy zio_objset
+The object set number for a given I/O request.
+.It Sy zio_object
+The object number for a given I/O request.
+.It Sy zio_level
+The indirect level for the block.
+Level 0 is the lowest level and includes data blocks.
+Values > 0 indicate metadata blocks at the appropriate level.
+.It Sy zio_blkid
+The block ID for a given I/O request.
+.It Sy zio_err
+The error number for a failure when handling a given I/O request,
+compatible with
+.Xr errno 3
+with the value of
+.Sy EBADE
+used to indicate a ZFS checksum error.
+.It Sy zio_offset
+The offset in bytes of where to write the I/O request for the specified vdev.
+.It Sy zio_size
+The size in bytes of the I/O request.
+.It Sy zio_flags
+The current flags describing how the I/O request should be handled.
+See the
+.Sy I/O FLAGS
+section for the full list of I/O flags.
+.It Sy zio_stage
+The current stage of the I/O in the pipeline.
+See the
+.Sy I/O STAGES
+section for a full list of all the I/O stages.
+.It Sy zio_pipeline
+The valid pipeline stages for the I/O.
+See the
+.Sy I/O STAGES
+section for a full list of all the I/O stages.
+.It Sy zio_delay
+The time elapsed (in nanoseconds) waiting for the block layer to complete the
+I/O request.
+Unlike
+.Sy zio_delta ,
+this does not include any vdev queuing time and is
+therefore solely a measure of the block layer performance.
+.It Sy zio_timestamp
+The time when a given I/O request was submitted.
+.It Sy zio_delta
+The time required to service a given I/O request.
+.It Sy prev_state
+The previous state of the vdev.
+.It Sy cksum_expected
+The expected checksum value for the block.
+.It Sy cksum_actual
+The actual checksum value for an errant block.
+.It Sy cksum_algorithm
+Checksum algorithm used.
+See
+.Xr zfsprops 7
+for more information on the available checksum algorithms.
+.It Sy cksum_byteswap
+Whether or not the data is byteswapped.
+.It Sy bad_ranges
+.No [\& Ns Ar start , end )
+pairs of corruption offsets.
+Offsets are always aligned on a 64-bit boundary,
+and can include some gaps of non-corruption.
+(See
+.Sy bad_ranges_min_gap )
+.It Sy bad_ranges_min_gap
+In order to bound the size of the
+.Sy bad_ranges
+array, gaps of non-corruption
+less than or equal to
+.Sy bad_ranges_min_gap
+bytes have been merged with
+adjacent corruption.
+Always at least 8 bytes, since corruption is detected on a 64-bit word basis.
+.It Sy bad_range_sets
+This array has one element per range in
+.Sy bad_ranges .
+Each element contains
+the count of bits in that range which were clear in the good data and set
+in the bad data.
+.It Sy bad_range_clears
+This array has one element per range in
+.Sy bad_ranges .
+Each element contains
+the count of bits for that range which were set in the good data and clear in
+the bad data.
+.It Sy bad_set_bits
+If this field exists, it is an array of
+.Pq Ar bad data No & ~( Ns Ar good data ) ;
+that is, the bits set in the bad data which are cleared in the good data.
+Each element corresponds a byte whose offset is in a range in
+.Sy bad_ranges ,
+and the array is ordered by offset.
+Thus, the first element is the first byte in the first
+.Sy bad_ranges
+range, and the last element is the last byte in the last
+.Sy bad_ranges
+range.
+.It Sy bad_cleared_bits
+Like
+.Sy bad_set_bits ,
+but contains
+.Pq Ar good data No & ~( Ns Ar bad data ) ;
+that is, the bits set in the good data which are cleared in the bad data.
+.It Sy bad_set_histogram
+If this field exists, it is an array of counters.
+Each entry counts bits set in a particular bit of a big-endian uint64 type.
+The first entry counts bits
+set in the high-order bit of the first byte, the 9th byte, etc, and the last
+entry counts bits set of the low-order bit of the 8th byte, the 16th byte, etc.
+This information is useful for observing a stuck bit in a parallel data path,
+such as IDE or parallel SCSI.
+.It Sy bad_cleared_histogram
+If this field exists, it is an array of counters.
+Each entry counts bit clears in a particular bit of a big-endian uint64 type.
+The first entry counts bits
+clears of the high-order bit of the first byte, the 9th byte, etc, and the
+last entry counts clears of the low-order bit of the 8th byte, the 16th byte, etc.
+This information is useful for observing a stuck bit in a parallel data
+path, such as IDE or parallel SCSI.
.El
+.
+.Sh I/O STAGES
+The ZFS I/O pipeline is comprised of various stages which are defined below.
+The individual stages are used to construct these basic I/O
+operations: Read, Write, Free, Claim, and Ioctl.
+These stages may be
+set on an event to describe the life cycle of a given I/O request.
+.Pp
+.TS
+tab(:);
+l l l .
+Stage:Bit Mask:Operations
+_:_:_
+ZIO_STAGE_OPEN:0x00000001:RWFCI
+
+ZIO_STAGE_READ_BP_INIT:0x00000002:R----
+ZIO_STAGE_WRITE_BP_INIT:0x00000004:-W---
+ZIO_STAGE_FREE_BP_INIT:0x00000008:--F--
+ZIO_STAGE_ISSUE_ASYNC:0x00000010:RWF--
+ZIO_STAGE_WRITE_COMPRESS:0x00000020:-W---
+
+ZIO_STAGE_ENCRYPT:0x00000040:-W---
+ZIO_STAGE_CHECKSUM_GENERATE:0x00000080:-W---
+
+ZIO_STAGE_NOP_WRITE:0x00000100:-W---
+
+ZIO_STAGE_DDT_READ_START:0x00000200:R----
+ZIO_STAGE_DDT_READ_DONE:0x00000400:R----
+ZIO_STAGE_DDT_WRITE:0x00000800:-W---
+ZIO_STAGE_DDT_FREE:0x00001000:--F--
+
+ZIO_STAGE_GANG_ASSEMBLE:0x00002000:RWFC-
+ZIO_STAGE_GANG_ISSUE:0x00004000:RWFC-
+
+ZIO_STAGE_DVA_THROTTLE:0x00008000:-W---
+ZIO_STAGE_DVA_ALLOCATE:0x00010000:-W---
+ZIO_STAGE_DVA_FREE:0x00020000:--F--
+ZIO_STAGE_DVA_CLAIM:0x00040000:---C-
+
+ZIO_STAGE_READY:0x00080000:RWFCI
+
+ZIO_STAGE_VDEV_IO_START:0x00100000:RW--I
+ZIO_STAGE_VDEV_IO_DONE:0x00200000:RW--I
+ZIO_STAGE_VDEV_IO_ASSESS:0x00400000:RW--I
+
+ZIO_STAGE_CHECKSUM_VERIFY:0x00800000:R----
+
+ZIO_STAGE_DONE:0x01000000:RWFCI
+.TE
+.
+.Sh I/O FLAGS
+Every I/O request in the pipeline contains a set of flags which describe its
+function and are used to govern its behavior.
+These flags will be set in an event as a
+.Sy zio_flags
+payload entry.
+.Pp
+.TS
+tab(:);
+l l .
+Flag:Bit Mask
+_:_
+ZIO_FLAG_DONT_AGGREGATE:0x00000001
+ZIO_FLAG_IO_REPAIR:0x00000002
+ZIO_FLAG_SELF_HEAL:0x00000004
+ZIO_FLAG_RESILVER:0x00000008
+ZIO_FLAG_SCRUB:0x00000010
+ZIO_FLAG_SCAN_THREAD:0x00000020
+ZIO_FLAG_PHYSICAL:0x00000040
+
+ZIO_FLAG_CANFAIL:0x00000080
+ZIO_FLAG_SPECULATIVE:0x00000100
+ZIO_FLAG_CONFIG_WRITER:0x00000200
+ZIO_FLAG_DONT_RETRY:0x00000400
+ZIO_FLAG_DONT_CACHE:0x00000800
+ZIO_FLAG_NODATA:0x00001000
+ZIO_FLAG_INDUCE_DAMAGE:0x00002000
+
+ZIO_FLAG_IO_ALLOCATING:0x00004000
+ZIO_FLAG_IO_RETRY:0x00008000
+ZIO_FLAG_PROBE:0x00010000
+ZIO_FLAG_TRYHARD:0x00020000
+ZIO_FLAG_OPTIONAL:0x00040000
+
+ZIO_FLAG_DONT_QUEUE:0x00080000
+ZIO_FLAG_DONT_PROPAGATE:0x00100000
+ZIO_FLAG_IO_BYPASS:0x00200000
+ZIO_FLAG_IO_REWRITE:0x00400000
+ZIO_FLAG_RAW_COMPRESS:0x00800000
+ZIO_FLAG_RAW_ENCRYPT:0x01000000
+
+ZIO_FLAG_GANG_CHILD:0x02000000
+ZIO_FLAG_DDT_CHILD:0x04000000
+ZIO_FLAG_GODFATHER:0x08000000
+ZIO_FLAG_NOPWRITE:0x10000000
+ZIO_FLAG_REEXECUTED:0x20000000
+ZIO_FLAG_DELEGATED:0x40000000
+ZIO_FLAG_FASTWRITE:0x80000000
+.TE
+.
.Sh SEE ALSO
+.Xr zfs 4 ,
.Xr zed 8 ,
-.Xr zpool-wait 8 ,
-.Xr zfs-events 5 ,
-.Xr zfs-module-parameters 5
+.Xr zpool-wait 8
diff --git a/sys/contrib/openzfs/man/man8/zpool-export.8 b/sys/contrib/openzfs/man/man8/zpool-export.8
index 1b8077ba19fa..a15291a1f598 100644
--- a/sys/contrib/openzfs/man/man8/zpool-export.8
+++ b/sys/contrib/openzfs/man/man8/zpool-export.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -30,24 +29,17 @@
.Dd February 16, 2020
.Dt ZPOOL-EXPORT 8
.Os
+.
.Sh NAME
.Nm zpool-export
-.Nd Exports the given ZFS storage pools from the system
+.Nd export ZFS storage pools
.Sh SYNOPSIS
.Nm zpool
.Cm export
-.Op Fl a
.Op Fl f
-.Ar pool Ns ...
+.Fl a Ns | Ns Ar pool Ns …
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm export
-.Op Fl a
-.Op Fl f
-.Ar pool Ns ...
-.Xc
Exports the given pools from the system.
All devices are marked as exported, but are still considered in use by other
subsystems.
@@ -69,15 +61,12 @@ the disks.
.It Fl a
Exports all pools imported on the system.
.It Fl f
-Forcefully unmount all datasets, using the
-.Nm unmount Fl f
-command.
-This option is not supported on Linux.
+Forcefully unmount all datasets, and allow export of pools with active shared spares.
.Pp
This command will forcefully export the pool even if it has a shared spare that
is currently being used.
This may lead to potential data corruption.
.El
-.El
+.
.Sh SEE ALSO
.Xr zpool-import 8
diff --git a/sys/contrib/openzfs/man/man8/zpool-get.8 b/sys/contrib/openzfs/man/man8/zpool-get.8
index 118743080095..55904f169e24 100644
--- a/sys/contrib/openzfs/man/man8/zpool-get.8
+++ b/sys/contrib/openzfs/man/man8/zpool-get.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -30,29 +29,31 @@
.Dd August 9, 2019
.Dt ZPOOL-GET 8
.Os
+.
.Sh NAME
.Nm zpool-get
-.Nd Retrieves properties for the specified ZFS storage pool(s)
+.Nd retrieve properties of ZFS storage pools
.Sh SYNOPSIS
.Nm zpool
.Cm get
.Op Fl Hp
-.Op Fl o Ar field Ns Oo , Ns Ar field Oc Ns ...
-.Sy all Ns | Ns Ar property Ns Oo , Ns Ar property Oc Ns ...
-.Oo Ar pool Oc Ns ...
+.Op Fl o Ar field Ns Oo , Ns Ar field Oc Ns …
+.Sy all Ns | Ns Ar property Ns Oo , Ns Ar property Oc Ns …
+.Oo Ar pool Oc Ns …
.Nm zpool
.Cm set
.Ar property Ns = Ns Ar value
.Ar pool
+.
.Sh DESCRIPTION
.Bl -tag -width Ds
.It Xo
.Nm zpool
.Cm get
.Op Fl Hp
-.Op Fl o Ar field Ns Oo , Ns Ar field Oc Ns ...
-.Sy all Ns | Ns Ar property Ns Oo , Ns Ar property Oc Ns ...
-.Oo Ar pool Oc Ns ...
+.Op Fl o Ar field Ns Oo , Ns Ar field Oc Ns …
+.Sy all Ns | Ns Ar property Ns Oo , Ns Ar property Oc Ns …
+.Oo Ar pool Oc Ns …
.Xc
Retrieves the given list of properties
.Po
@@ -62,25 +63,29 @@ is used
.Pc
for the specified storage pool(s).
These properties are displayed with the following fields:
-.Bd -literal
- name Name of storage pool
- property Property name
- value Property value
- source Property source, either 'default' or 'local'.
-.Ed
+.Bl -tag -compact -offset Ds -width "property"
+.It Sy name
+Name of storage pool.
+.It Sy property
+Property name.
+.It Sy value
+Property value.
+.It Sy source
+Property source, either
+.Sy default No or Sy local .
+.El
.Pp
See the
-.Xr zpoolprops 8
+.Xr zpoolprops 7
manual page for more information on the available pool properties.
-.Bl -tag -width Ds
+.Bl -tag -compact -offset Ds -width "-o field"
.It Fl H
Scripted mode.
Do not display headers, and separate fields by a single tab instead of arbitrary
space.
.It Fl o Ar field
-A comma-separated list of columns to display.
-.Sy name Ns \&, Ns Sy property Ns \&, Ns Sy value Ns \&, Ns Sy source
-is the default value.
+A comma-separated list of columns to display, defaults to
+.Sy name , Ns Sy property , Ns Sy value , Ns Sy source .
.It Fl p
Display numbers in parsable (exact) values.
.El
@@ -92,11 +97,12 @@ Display numbers in parsable (exact) values.
.Xc
Sets the given property on the specified pool.
See the
-.Xr zpoolprops 8
+.Xr zpoolprops 7
manual page for more information on what properties can be set and acceptable
values.
.El
+.
.Sh SEE ALSO
-.Xr zpoolprops 8 ,
-.Xr zpool-list 8 ,
-.Xr zpool-features 5
+.Xr zpool-features 7 ,
+.Xr zpoolprops 7 ,
+.Xr zpool-list 8
diff --git a/sys/contrib/openzfs/man/man8/zpool-history.8 b/sys/contrib/openzfs/man/man8/zpool-history.8
index 5b0a102f3825..2a2d500b8b8c 100644
--- a/sys/contrib/openzfs/man/man8/zpool-history.8
+++ b/sys/contrib/openzfs/man/man8/zpool-history.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -30,22 +29,17 @@
.Dd August 9, 2019
.Dt ZPOOL-HISTORY 8
.Os
+.
.Sh NAME
.Nm zpool-history
-.Nd Displays the command history of the specified ZFS storage pool(s)
+.Nd inspect command history of ZFS storage pools
.Sh SYNOPSIS
.Nm zpool
.Cm history
.Op Fl il
-.Oo Ar pool Oc Ns ...
+.Oo Ar pool Oc Ns …
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm history
-.Op Fl il
-.Oo Ar pool Oc Ns ...
-.Xc
Displays the command history of the specified pool(s) or all pools if no pool is
specified.
.Bl -tag -width Ds
@@ -56,7 +50,7 @@ Displays log records in long format, which in addition to standard format
includes, the user name, the hostname, and the zone in which the operation was
performed.
.El
-.El
+.
.Sh SEE ALSO
.Xr zpool-checkpoint 8 ,
.Xr zpool-events 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zpool-import.8 b/sys/contrib/openzfs/man/man8/zpool-import.8
index 66a8d94d6de6..518e3cf1d76a 100644
--- a/sys/contrib/openzfs/man/man8/zpool-import.8
+++ b/sys/contrib/openzfs/man/man8/zpool-import.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -30,50 +29,53 @@
.Dd August 9, 2019
.Dt ZPOOL-IMPORT 8
.Os
+.
.Sh NAME
.Nm zpool-import
-.Nd Lists ZFS storage pools available to import or import the specified pools
+.Nd import ZFS storage pools or list available pools
.Sh SYNOPSIS
.Nm zpool
.Cm import
.Op Fl D
-.Op Fl d Ar dir Ns | Ns device
+.Oo Fl d Ar dir Ns | Ns Ar device Oc Ns …
.Nm zpool
.Cm import
.Fl a
.Op Fl DflmN
-.Op Fl F Oo Fl n Oc Oo Fl T Oc Oo Fl X Oc
+.Op Fl F Op Fl nTX
.Op Fl -rewind-to-checkpoint
-.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir Ns | Ns device
+.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir Ns | Ns Ar device
.Op Fl o Ar mntopts
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
+.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
.Op Fl R Ar root
.Nm zpool
.Cm import
-.Op Fl Dflm
-.Op Fl F Oo Fl n Oc Oo Fl T Oc Oo Fl X Oc
+.Op Fl Dflmt
+.Op Fl F Op Fl nTX
.Op Fl -rewind-to-checkpoint
-.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir Ns | Ns device
+.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir Ns | Ns Ar device
.Op Fl o Ar mntopts
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
+.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
.Op Fl R Ar root
.Op Fl s
.Ar pool Ns | Ns Ar id
-.Op Ar newpool Oo Fl t Oc
+.Op Ar newpool
+.
.Sh DESCRIPTION
.Bl -tag -width Ds
.It Xo
.Nm zpool
.Cm import
.Op Fl D
-.Op Fl d Ar dir Ns | Ns device
+.Oo Fl d Ar dir Ns | Ns Ar device Oc Ns …
.Xc
Lists pools available to import.
If the
.Fl d or
.Fl c
options are not specified, this command searches for devices using libblkid
-on Linux and geom on FreeBSD.
+on Linux and geom on
+.Fx .
The
.Fl d
option can be specified multiple times, and all directories are searched.
@@ -114,10 +116,10 @@ Lists destroyed pools only.
.Cm import
.Fl a
.Op Fl DflmN
-.Op Fl F Oo Fl n Oc Oo Fl T Oc Oo Fl X Oc
-.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir Ns | Ns device
+.Op Fl F Op Fl nTX
+.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir Ns | Ns Ar device
.Op Fl o Ar mntopts
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
+.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
.Op Fl R Ar root
.Op Fl s
.Xc
@@ -168,12 +170,13 @@ If successful, the data from the discarded transactions is irretrievably lost.
This option is ignored if the pool is importable or already imported.
.It Fl l
Indicates that this command will request encryption keys for all encrypted
-datasets it attempts to mount as it is bringing the pool online. Note that if
-any datasets have a
+datasets it attempts to mount as it is bringing the pool online.
+Note that if any datasets have a
.Sy keylocation
of
.Sy prompt
-this command will block waiting for the keys to be entered. Without this flag
+this command will block waiting for the keys to be entered.
+Without this flag
encrypted datasets will be left unavailable until the keys are loaded.
.It Fl m
Allows a pool to import when there is a missing log device.
@@ -198,7 +201,7 @@ for a description of dataset properties and mount options.
.It Fl o Ar property Ns = Ns Ar value
Sets the specified property on the imported pool.
See the
-.Xr zpoolprops 8
+.Xr zpoolprops 7
manual page for more information on the available pool properties.
.It Fl R Ar root
Sets the
@@ -221,36 +224,42 @@ administrator can see how the pool would look like if they were
to fully rewind.
.It Fl s
Scan using the default search path, the libblkid cache will not be
-consulted. A custom search path may be specified by setting the
-ZPOOL_IMPORT_PATH environment variable.
+consulted.
+A custom search path may be specified by setting the
+.Sy ZPOOL_IMPORT_PATH
+environment variable.
.It Fl X
Used with the
.Fl F
-recovery option. Determines whether extreme
-measures to find a valid txg should take place. This allows the pool to
+recovery option.
+Determines whether extreme measures to find a valid txg should take place.
+This allows the pool to
be rolled back to a txg which is no longer guaranteed to be consistent.
-Pools imported at an inconsistent txg may contain uncorrectable
-checksum errors. For more details about pool recovery mode, see the
+Pools imported at an inconsistent txg may contain uncorrectable checksum errors.
+For more details about pool recovery mode, see the
.Fl F
-option, above. WARNING: This option can be extremely hazardous to the
+option, above.
+WARNING: This option can be extremely hazardous to the
health of your pool and should only be used as a last resort.
.It Fl T
-Specify the txg to use for rollback. Implies
+Specify the txg to use for rollback.
+Implies
.Fl FX .
For more details
about pool recovery mode, see the
.Fl X
-option, above. WARNING: This option can be extremely hazardous to the
+option, above.
+WARNING: This option can be extremely hazardous to the
health of your pool and should only be used as a last resort.
.El
.It Xo
.Nm zpool
.Cm import
-.Op Fl Dflm
-.Op Fl F Oo Fl n Oc Oo Fl t Oc Oo Fl T Oc Oo Fl X Oc
-.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir Ns | Ns device
+.Op Fl Dflmt
+.Op Fl F Op Fl nTX
+.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir Ns | Ns Ar device
.Op Fl o Ar mntopts
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
+.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
.Op Fl R Ar root
.Op Fl s
.Ar pool Ns | Ns Ar id
@@ -309,12 +318,13 @@ If successful, the data from the discarded transactions is irretrievably lost.
This option is ignored if the pool is importable or already imported.
.It Fl l
Indicates that this command will request encryption keys for all encrypted
-datasets it attempts to mount as it is bringing the pool online. Note that if
-any datasets have a
+datasets it attempts to mount as it is bringing the pool online.
+Note that if any datasets have a
.Sy keylocation
of
.Sy prompt
-this command will block waiting for the keys to be entered. Without this flag
+this command will block waiting for the keys to be entered.
+Without this flag
encrypted datasets will be left unavailable until the keys are loaded.
.It Fl m
Allows a pool to import when there is a missing log device.
@@ -337,7 +347,7 @@ for a description of dataset properties and mount options.
.It Fl o Ar property Ns = Ns Ar value
Sets the specified property on the imported pool.
See the
-.Xr zpoolprops 8
+.Xr zpoolprops 7
manual page for more information on the available pool properties.
.It Fl R Ar root
Sets the
@@ -350,38 +360,49 @@ property to
.Ar root .
.It Fl s
Scan using the default search path, the libblkid cache will not be
-consulted. A custom search path may be specified by setting the
-ZPOOL_IMPORT_PATH environment variable.
+consulted.
+A custom search path may be specified by setting the
+.Sy ZPOOL_IMPORT_PATH
+environment variable.
.It Fl X
Used with the
.Fl F
-recovery option. Determines whether extreme
-measures to find a valid txg should take place. This allows the pool to
+recovery option.
+Determines whether extreme measures to find a valid txg should take place.
+This allows the pool to
be rolled back to a txg which is no longer guaranteed to be consistent.
Pools imported at an inconsistent txg may contain uncorrectable
-checksum errors. For more details about pool recovery mode, see the
+checksum errors.
+For more details about pool recovery mode, see the
.Fl F
-option, above. WARNING: This option can be extremely hazardous to the
+option, above.
+WARNING: This option can be extremely hazardous to the
health of your pool and should only be used as a last resort.
.It Fl T
-Specify the txg to use for rollback. Implies
+Specify the txg to use for rollback.
+Implies
.Fl FX .
For more details
about pool recovery mode, see the
.Fl X
-option, above. WARNING: This option can be extremely hazardous to the
+option, above.
+WARNING: This option can be extremely hazardous to the
health of your pool and should only be used as a last resort.
.It Fl t
Used with
.Sy newpool .
Specifies that
.Sy newpool
-is temporary. Temporary pool names last until export. Ensures that
-the original pool name will be used in all label updates and therefore
-is retained upon export.
-Will also set -o cachefile=none when not explicitly specified.
+is temporary.
+Temporary pool names last until export.
+Ensures that the original pool name will be used
+in all label updates and therefore is retained upon export.
+Will also set
+.Fl o Sy cachefile Ns = Ns Sy none
+when not explicitly specified.
.El
.El
+.
.Sh SEE ALSO
.Xr zpool-export 8 ,
.Xr zpool-list 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zpool-initialize.8 b/sys/contrib/openzfs/man/man8/zpool-initialize.8
index 2734c1b340b8..0a108180dbbe 100644
--- a/sys/contrib/openzfs/man/man8/zpool-initialize.8
+++ b/sys/contrib/openzfs/man/man8/zpool-initialize.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,40 +26,33 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
+.Dd May 27, 2021
.Dt ZPOOL-INITIALIZE 8
.Os
+.
.Sh NAME
.Nm zpool-initialize
-.Nd Write to all unallocated regions of eligible devices in a ZFS storage pool
+.Nd write to unallocated regions of ZFS storage pool
.Sh SYNOPSIS
.Nm zpool
.Cm initialize
-.Op Fl c | Fl s
+.Op Fl c Ns | Ns Fl s
.Op Fl w
.Ar pool
-.Op Ar device Ns ...
+.Oo Ar device Oc Ns …
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm initialize
-.Op Fl c | Fl s
-.Op Fl w
-.Ar pool
-.Op Ar device Ns ...
-.Xc
Begins initializing by writing to all unallocated regions on the specified
devices, or all eligible devices in the pool if no individual devices are
specified.
Only leaf data or log devices may be initialized.
.Bl -tag -width Ds
-.It Fl c, -cancel
+.It Fl c , -cancel
Cancel initializing on the specified devices, or all eligible devices if none
are specified.
If one or more target devices are invalid or are not currently being
initialized, the command will fail and no cancellation will occur on any device.
-.It Fl s -suspend
+.It Fl s , -suspend
Suspend initializing on the specified devices, or all eligible devices if none
are specified.
If one or more target devices are invalid or are not currently being
@@ -68,10 +60,10 @@ initialized, the command will fail and no suspension will occur on any device.
Initializing can then be resumed by running
.Nm zpool Cm initialize
with no flags on the relevant target devices.
-.It Fl w, -wait
+.It Fl w , -wait
Wait until the devices have finished initializing before returning.
.El
-.El
+.
.Sh SEE ALSO
.Xr zpool-add 8 ,
.Xr zpool-attach 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zpool-iostat.8 b/sys/contrib/openzfs/man/man8/zpool-iostat.8
index e457eb142ab8..0e64aa71b1d6 100644
--- a/sys/contrib/openzfs/man/man8/zpool-iostat.8
+++ b/sys/contrib/openzfs/man/man8/zpool-iostat.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,79 +26,85 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
+.Dd May 27, 2021
.Dt ZPOOL-IOSTAT 8
.Os
+.
.Sh NAME
.Nm zpool-iostat
-.Nd Display logical I/O statistics for the given ZFS storage pools/vdevs
+.Nd display logical I/O statistics for ZFS storage pools
.Sh SYNOPSIS
.Nm zpool
.Cm iostat
.Op Oo Oo Fl c Ar SCRIPT Oc Oo Fl lq Oc Oc Ns | Ns Fl rw
.Op Fl T Sy u Ns | Ns Sy d
.Op Fl ghHLnpPvy
-.Oo Oo Ar pool Ns ... Oc Ns | Ns Oo Ar pool vdev Ns ... Oc Ns | Ns Oo Ar vdev Ns ... Oc Oc
+.Oo Ar pool Ns … Ns | Ns Oo Ar pool vdev Ns … Oc Ns | Ns Ar vdev Ns … Oc
.Op Ar interval Op Ar count
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm iostat
-.Op Oo Oo Fl c Ar SCRIPT Oc Oo Fl lq Oc Oc Ns | Ns Fl rw
-.Op Fl T Sy u Ns | Ns Sy d
-.Op Fl ghHLnpPvy
-.Oo Oo Ar pool Ns ... Oc Ns | Ns Oo Ar pool vdev Ns ... Oc Ns | Ns Oo Ar vdev Ns ... Oc Oc
-.Op Ar interval Op Ar count
-.Xc
-Displays logical I/O statistics for the given pools/vdevs. Physical I/Os may
-be observed via
+Displays logical I/O statistics for the given pools/vdevs.
+Physical I/O statistics may be observed via
.Xr iostat 1 .
If writes are located nearby, they may be merged into a single
-larger operation. Additional I/O may be generated depending on the level of
-vdev redundancy.
+larger operation.
+Additional I/O may be generated depending on the level of vdev redundancy.
To filter output, you may pass in a list of pools, a pool and list of vdevs
-in that pool, or a list of any vdevs from any pool. If no items are specified,
-statistics for every pool in the system are shown.
+in that pool, or a list of any vdevs from any pool.
+If no items are specified, statistics for every pool in the system are shown.
When given an
.Ar interval ,
the statistics are printed every
.Ar interval
-seconds until ^C is pressed. If
+seconds until killed.
+If
.Fl n
flag is specified the headers are displayed only once, otherwise they are
-displayed periodically. If count is specified, the command exits
-after count reports are printed. The first report printed is always
-the statistics since boot regardless of whether
+displayed periodically.
+If
+.Ar count
+is specified, the command exits after
+.Ar count
+reports are printed.
+The first report printed is always the statistics since boot regardless of whether
.Ar interval
and
.Ar count
-are passed. However, this behavior can be suppressed with the
+are passed.
+However, this behavior can be suppressed with the
.Fl y
-flag. Also note that the units of
+flag.
+Also note that the units of
.Sy K ,
.Sy M ,
-.Sy G ...
-that are printed in the report are in base 1024. To get the raw
-values, use the
+.Sy G Ns …
+that are printed in the report are in base 1024.
+To get the raw values, use the
.Fl p
flag.
.Bl -tag -width Ds
-.It Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns ...
+.It Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns …
Run a script (or scripts) on each vdev and include the output as a new column
in the
.Nm zpool Cm iostat
-output. Users can run any script found in their
+output.
+Users can run any script found in their
.Pa ~/.zpool.d
directory or from the system
.Pa /etc/zfs/zpool.d
-directory. Script names containing the slash (/) character are not allowed.
+directory.
+Script names containing the slash
+.Pq Sy /
+character are not allowed.
The default search path can be overridden by setting the
-ZPOOL_SCRIPTS_PATH environment variable. A privileged user can run
+.Sy ZPOOL_SCRIPTS_PATH
+environment variable.
+A privileged user can only run
.Fl c
-if they have the ZPOOL_SCRIPTS_AS_ROOT
-environment variable set. If a script requires the use of a privileged
-command, like
+if they have the
+.Sy ZPOOL_SCRIPTS_AS_ROOT
+environment variable set.
+If a script requires the use of a privileged command, like
.Xr smartctl 8 ,
then it's recommended you allow the user access to it in
.Pa /etc/sudoers
@@ -114,25 +119,23 @@ is passed without a script name, it prints a list of all scripts.
also sets verbose mode
.No \&( Ns Fl v Ns No \&).
.Pp
-Script output should be in the form of "name=value". The column name is
-set to "name" and the value is set to "value". Multiple lines can be
-used to output multiple columns. The first line of output not in the
-"name=value" format is displayed without a column title, and no more
-output after that is displayed. This can be useful for printing error
-messages. Blank or NULL values are printed as a '-' to make output
-awk-able.
+Script output should be in the form of "name=value".
+The column name is set to "name" and the value is set to "value".
+Multiple lines can be used to output multiple columns.
+The first line of output not in the
+"name=value" format is displayed without a column title,
+and no more output after that is displayed.
+This can be useful for printing error messages.
+Blank or NULL values are printed as a '-' to make output AWKable.
.Pp
The following environment variables are set before running each script:
-.Bl -tag -width "VDEV_PATH"
+.Bl -tag -compact -width "VDEV_ENC_SYSFS_PATH"
.It Sy VDEV_PATH
Full path to the vdev
-.El
-.Bl -tag -width "VDEV_UPATH"
.It Sy VDEV_UPATH
-Underlying path to the vdev (/dev/sd*). For use with device mapper,
-multipath, or partitioned vdevs.
-.El
-.Bl -tag -width "VDEV_ENC_SYSFS_PATH"
+Underlying path to the vdev
+.Pq Pa /dev/sd* .
+For use with device mapper, multipath, or partitioned vdevs.
.It Sy VDEV_ENC_SYSFS_PATH
The sysfs path to the enclosure for the vdev (if any).
.El
@@ -149,99 +152,106 @@ for standard date format.
See
.Xr date 1 .
.It Fl g
-Display vdev GUIDs instead of the normal device names. These GUIDs
-can be used in place of device names for the zpool
+Display vdev GUIDs instead of the normal device names.
+These GUIDs can be used in place of device names for the zpool
detach/offline/remove/replace commands.
.It Fl H
-Scripted mode. Do not display headers, and separate fields by a
+Scripted mode.
+Do not display headers, and separate fields by a
single tab instead of arbitrary space.
.It Fl L
-Display real paths for vdevs resolving all symbolic links. This can
-be used to look up the current block device name regardless of the
+Display real paths for vdevs resolving all symbolic links.
+This can be used to look up the current block device name regardless of the
.Pa /dev/disk/
path used to open it.
.It Fl n
Print headers only once when passed
.It Fl p
-Display numbers in parsable (exact) values. Time values are in
-nanoseconds.
+Display numbers in parsable (exact) values.
+Time values are in nanoseconds.
.It Fl P
-Display full paths for vdevs instead of only the last component of
-the path. This can be used in conjunction with the
+Display full paths for vdevs instead of only the last component of the path.
+This can be used in conjunction with the
.Fl L
flag.
.It Fl r
-Print request size histograms for the leaf vdev's IO. This includes
-histograms of individual IOs (ind) and aggregate IOs (agg). These stats
-can be useful for observing how well IO aggregation is working. Note
-that TRIM IOs may exceed 16M, but will be counted as 16M.
+Print request size histograms for the leaf vdev's I/O.
+This includes histograms of individual I/O (ind) and aggregate I/O (agg).
+These stats can be useful for observing how well I/O aggregation is working.
+Note that TRIM I/O may exceed 16M, but will be counted as 16M.
.It Fl v
Verbose statistics Reports usage statistics for individual vdevs within the
pool, in addition to the pool-wide statistics.
.It Fl y
-Omit statistics since boot.
-Normally the first line of output reports the statistics since boot.
-This option suppresses that first line of output.
-.Ar interval
+Normally the first line of output reports the statistics since boot:
+suppress it.
.It Fl w
Display latency histograms:
-.Pp
-.Ar total_wait :
-Total IO time (queuing + disk IO time).
-.Ar disk_wait :
-Disk IO time (time reading/writing the disk).
-.Ar syncq_wait :
-Amount of time IO spent in synchronous priority queues. Does not include
-disk time.
-.Ar asyncq_wait :
-Amount of time IO spent in asynchronous priority queues. Does not include
-disk time.
-.Ar scrub :
-Amount of time IO spent in scrub queue. Does not include disk time.
+.Bl -tag -compact -width "asyncq_read/write"
+.It Sy total_wait
+Total I/O time (queuing + disk I/O time).
+.It Sy disk_wait
+Disk I/O time (time reading/writing the disk).
+.It Sy syncq_wait
+Amount of time I/O spent in synchronous priority queues.
+Does not include disk time.
+.It Sy asyncq_wait
+Amount of time I/O spent in asynchronous priority queues.
+Does not include disk time.
+.It Sy scrub
+Amount of time I/O spent in scrub queue.
+Does not include disk time.
+.El
.It Fl l
Include average latency statistics:
-.Pp
-.Ar total_wait :
-Average total IO time (queuing + disk IO time).
-.Ar disk_wait :
-Average disk IO time (time reading/writing the disk).
-.Ar syncq_wait :
-Average amount of time IO spent in synchronous priority queues. Does
-not include disk time.
-.Ar asyncq_wait :
-Average amount of time IO spent in asynchronous priority queues.
+.Bl -tag -compact -width "asyncq_read/write"
+.It Sy total_wait
+Average total I/O time (queuing + disk I/O time).
+.It Sy disk_wait
+Average disk I/O time (time reading/writing the disk).
+.It Sy syncq_wait
+Average amount of time I/O spent in synchronous priority queues.
+Does not include disk time.
+.It Sy asyncq_wait
+Average amount of time I/O spent in asynchronous priority queues.
+Does not include disk time.
+.It Sy scrub
+Average queuing time in scrub queue.
Does not include disk time.
-.Ar scrub :
-Average queuing time in scrub queue. Does not include disk time.
-.Ar trim :
-Average queuing time in trim queue. Does not include disk time.
+.It Sy trim
+Average queuing time in trim queue.
+Does not include disk time.
+.El
.It Fl q
-Include active queue statistics. Each priority queue has both
-pending (
-.Ar pend )
-and active (
-.Ar activ )
-IOs. Pending IOs are waiting to
-be issued to the disk, and active IOs have been issued to disk and are
-waiting for completion. These stats are broken out by priority queue:
-.Pp
-.Ar syncq_read/write :
+Include active queue statistics.
+Each priority queue has both pending
+.Sy ( pend )
+and active
+.Sy ( activ )
+I/O requests.
+Pending requests are waiting to be issued to the disk,
+and active requests have been issued to disk and are waiting for completion.
+These stats are broken out by priority queue:
+.Bl -tag -compact -width "asyncq_read/write"
+.It Sy syncq_read/write
Current number of entries in synchronous priority
queues.
-.Ar asyncq_read/write :
+.It Sy asyncq_read/write
Current number of entries in asynchronous priority queues.
-.Ar scrubq_read :
+.It Sy scrubq_read
Current number of entries in scrub queue.
-.Ar trimq_write :
+.It Sy trimq_write
Current number of entries in trim queue.
+.El
.Pp
All queue statistics are instantaneous measurements of the number of
-entries in the queues. If you specify an interval, the measurements
-will be sampled from the end of the interval.
-.El
+entries in the queues.
+If you specify an interval,
+the measurements will be sampled from the end of the interval.
.El
+.
.Sh SEE ALSO
-.Xr zpool-list 8 ,
-.Xr zpool-status 8 ,
.Xr iostat 1 ,
-.Xr smartctl 8
+.Xr smartctl 8 ,
+.Xr zpool-list 8 ,
+.Xr zpool-status 8
diff --git a/sys/contrib/openzfs/man/man8/zpool-labelclear.8 b/sys/contrib/openzfs/man/man8/zpool-labelclear.8
index 576eee21c508..c7edc911604d 100644
--- a/sys/contrib/openzfs/man/man8/zpool-labelclear.8
+++ b/sys/contrib/openzfs/man/man8/zpool-labelclear.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,25 +26,20 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
+.Dd May 31, 2021
.Dt ZPOOL-LABELCLEAR 8
.Os
+.
.Sh NAME
.Nm zpool-labelclear
-.Nd Removes ZFS label information from the specified physical device
+.Nd remove ZFS label information from device
.Sh SYNOPSIS
.Nm zpool
.Cm labelclear
.Op Fl f
.Ar device
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm labelclear
-.Op Fl f
-.Ar device
-.Xc
Removes ZFS label information from the specified
.Ar device .
If the
@@ -58,7 +52,7 @@ must not be part of an active pool configuration.
.It Fl f
Treat exported or foreign devices as inactive.
.El
-.El
+.
.Sh SEE ALSO
.Xr zpool-destroy 8 ,
.Xr zpool-detach 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zpool-list.8 b/sys/contrib/openzfs/man/man8/zpool-list.8
index 4b3aae74cac1..dd4e13c16042 100644
--- a/sys/contrib/openzfs/man/man8/zpool-list.8
+++ b/sys/contrib/openzfs/man/man8/zpool-list.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -30,28 +29,20 @@
.Dd August 9, 2019
.Dt ZPOOL-LIST 8
.Os
+.
.Sh NAME
.Nm zpool-list
-.Nd Lists ZFS storage pools along with a health status and space usage
+.Nd list information about ZFS storage pools
.Sh SYNOPSIS
.Nm zpool
.Cm list
.Op Fl HgLpPv
-.Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
+.Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns …
.Op Fl T Sy u Ns | Ns Sy d
-.Oo Ar pool Oc Ns ...
+.Oo Ar pool Oc Ns …
.Op Ar interval Op Ar count
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm list
-.Op Fl HgLpPv
-.Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
-.Op Fl T Sy u Ns | Ns Sy d
-.Oo Ar pool Oc Ns ...
-.Op Ar interval Op Ar count
-.Xc
Lists the given pools along with a health status and space usage.
If no
.Ar pool Ns s
@@ -60,7 +51,7 @@ When given an
.Ar interval ,
the information is printed every
.Ar interval
-seconds until ^C is pressed.
+seconds until killed.
If
.Ar count
is specified, the command exits after
@@ -68,8 +59,8 @@ is specified, the command exits after
reports are printed.
.Bl -tag -width Ds
.It Fl g
-Display vdev GUIDs instead of the normal device names. These GUIDs
-can be used in place of device names for the zpool
+Display vdev GUIDs instead of the normal device names.
+These GUIDs can be used in place of device names for the zpool
detach/offline/remove/replace commands.
.It Fl H
Scripted mode.
@@ -78,22 +69,24 @@ space.
.It Fl o Ar property
Comma-separated list of properties to display.
See the
-.Xr zpoolprops 8
+.Xr zpoolprops 7
manual page for a list of valid properties.
The default list is
-.Cm name , size , allocated , free , checkpoint, expandsize , fragmentation ,
-.Cm capacity , dedupratio , health , altroot .
+.Sy name , size , allocated , free , checkpoint, expandsize , fragmentation ,
+.Sy capacity , dedupratio , health , altroot .
.It Fl L
-Display real paths for vdevs resolving all symbolic links. This can
-be used to look up the current block device name regardless of the
-/dev/disk/ path used to open it.
+Display real paths for vdevs resolving all symbolic links.
+This can be used to look up the current block device name regardless of the
+.Pa /dev/disk
+path used to open it.
.It Fl p
Display numbers in parsable
.Pq exact
values.
.It Fl P
Display full paths for vdevs instead of only the last component of
-the path. This can be used in conjunction with the
+the path.
+This can be used in conjunction with the
.Fl L
flag.
.It Fl T Sy u Ns | Ns Sy d
@@ -113,7 +106,7 @@ Verbose statistics.
Reports usage statistics for individual vdevs within the pool, in addition to
the pool-wide statistics.
.El
-.El
+.
.Sh SEE ALSO
.Xr zpool-import 8 ,
.Xr zpool-status 8
diff --git a/sys/contrib/openzfs/man/man8/zpool-offline.8 b/sys/contrib/openzfs/man/man8/zpool-offline.8
index 3bf3bae72541..9b2cf59cf414 100644
--- a/sys/contrib/openzfs/man/man8/zpool-offline.8
+++ b/sys/contrib/openzfs/man/man8/zpool-offline.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -30,27 +29,30 @@
.Dd August 9, 2019
.Dt ZPOOL-OFFLINE 8
.Os
+.
.Sh NAME
.Nm zpool-offline
-.Nd Take a physical device in a ZFS storage pool offline
+.Nd take physical devices offline in ZFS storage pool
.Sh SYNOPSIS
.Nm zpool
.Cm offline
-.Op Fl f
-.Op Fl t
-.Ar pool Ar device Ns ...
+.Op Fl ft
+.Ar pool
+.Ar device Ns …
.Nm zpool
.Cm online
.Op Fl e
-.Ar pool Ar device Ns ...
+.Ar pool
+.Ar device Ns …
+.
.Sh DESCRIPTION
.Bl -tag -width Ds
.It Xo
.Nm zpool
.Cm offline
-.Op Fl f
-.Op Fl t
-.Ar pool Ar device Ns ...
+.Op Fl ft
+.Ar pool
+.Ar device Ns …
.Xc
Takes the specified physical device offline.
While the
@@ -59,8 +61,9 @@ is offline, no attempt is made to read or write to the device.
This command is not applicable to spares.
.Bl -tag -width Ds
.It Fl f
-Force fault. Instead of offlining the disk, put it into a faulted
-state. The fault will persist across imports unless the
+Force fault.
+Instead of offlining the disk, put it into a faulted state.
+The fault will persist across imports unless the
.Fl t
flag was specified.
.It Fl t
@@ -71,7 +74,8 @@ Upon reboot, the specified physical device reverts to its previous state.
.Nm zpool
.Cm online
.Op Fl e
-.Ar pool Ar device Ns ...
+.Ar pool
+.Ar device Ns …
.Xc
Brings the specified physical device online.
This command is not applicable to spares.
@@ -82,6 +86,7 @@ If the device is part of a mirror or raidz then all devices must be expanded
before the new space will become available to the pool.
.El
.El
+.
.Sh SEE ALSO
.Xr zpool-detach 8 ,
.Xr zpool-remove 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zpool-reguid.8 b/sys/contrib/openzfs/man/man8/zpool-reguid.8
index f5c4a33f694a..7bb7c1c726b2 100644
--- a/sys/contrib/openzfs/man/man8/zpool-reguid.8
+++ b/sys/contrib/openzfs/man/man8/zpool-reguid.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,27 +26,23 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
+.Dd May 31, 2021
.Dt ZPOOL-REGUID 8
.Os
+.
.Sh NAME
.Nm zpool-reguid
-.Nd Generate a new unique identifier for a ZFS storage pool
+.Nd generate new unique identifier for ZFS storage pool
.Sh SYNOPSIS
.Nm zpool
.Cm reguid
.Ar pool
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm reguid
-.Ar pool
-.Xc
Generates a new unique identifier for the pool.
You must ensure that all devices in this pool are online and healthy before
performing this action.
-.El
+.
.Sh SEE ALSO
.Xr zpool-export 8 ,
.Xr zpool-import 8
diff --git a/sys/contrib/openzfs/man/man8/zpool-remove.8 b/sys/contrib/openzfs/man/man8/zpool-remove.8
index f491cd40ac5c..1429180385cc 100644
--- a/sys/contrib/openzfs/man/man8/zpool-remove.8
+++ b/sys/contrib/openzfs/man/man8/zpool-remove.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -32,12 +31,12 @@
.Os
.Sh NAME
.Nm zpool-remove
-.Nd Remove a device from a ZFS storage pool
+.Nd remove devices from ZFS storage pool
.Sh SYNOPSIS
.Nm zpool
.Cm remove
.Op Fl npw
-.Ar pool Ar device Ns ...
+.Ar pool Ar device Ns …
.Nm zpool
.Cm remove
.Fl s
@@ -48,7 +47,7 @@
.Nm zpool
.Cm remove
.Op Fl npw
-.Ar pool Ar device Ns ...
+.Ar pool Ar device Ns …
.Xc
Removes the specified device from the pool.
This command supports removing hot spare, cache, log, and both mirrored and
@@ -57,7 +56,7 @@ When the primary pool storage includes a top-level raidz vdev only hot spare,
cache, and log devices can be removed.
Note that keys for all encrypted datasets must be loaded for top-level vdevs
to be removed.
-.sp
+.Pp
Removing a top-level vdev reduces the total amount of space in the storage pool.
The specified device will be evacuated by copying all allocated space from it to
the other devices in the pool.
@@ -67,11 +66,11 @@ command initiates the removal and returns, while the evacuation continues in
the background.
The removal progress can be monitored with
.Nm zpool Cm status .
-If an IO error is encountered during the removal process it will be
-cancelled. The
+If an IO error is encountered during the removal process it will be cancelled.
+The
.Sy device_removal
feature flag must be enabled to remove a top-level vdev, see
-.Xr zpool-features 5 .
+.Xr zpool-features 7 .
.Pp
A mirrored top-level device (log or data) can be removed by specifying the top-level mirror for the
same.
@@ -81,7 +80,8 @@ the
command.
.Bl -tag -width Ds
.It Fl n
-Do not actually perform the removal ("no-op").
+Do not actually perform the removal
+.Pq Qq No-op .
Instead, print the estimated amount of memory that will be used by the
mapping table after the removal completes.
This is nonzero only for top-level vdevs.
@@ -105,7 +105,7 @@ Stops and cancels an in-progress removal of a top-level vdev.
.Sh SEE ALSO
.Xr zpool-add 8 ,
.Xr zpool-detach 8 ,
-.Xr zpool-offline 8 ,
.Xr zpool-labelclear 8 ,
+.Xr zpool-offline 8 ,
.Xr zpool-replace 8 ,
.Xr zpool-split 8
diff --git a/sys/contrib/openzfs/man/man8/zpool-reopen.8 b/sys/contrib/openzfs/man/man8/zpool-reopen.8
index 6f804cc7e5f2..f1f8606f12c7 100644
--- a/sys/contrib/openzfs/man/man8/zpool-reopen.8
+++ b/sys/contrib/openzfs/man/man8/zpool-reopen.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,29 +26,27 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
+.Dd June 2, 2021
.Dt ZPOOL-REOPEN 8
.Os
+.
.Sh NAME
.Nm zpool-reopen
-.Nd Reopen all virtual devices (vdevs) associated with a ZFS storage pool
+.Nd reopen vdevs associated with ZFS storage pools
.Sh SYNOPSIS
.Nm zpool
.Cm reopen
.Op Fl n
-.Ar pool
+.Oo Ar pool Oc Ns …
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm reopen
-.Op Fl n
-.Ar pool
-.Xc
-Reopen all the vdevs associated with the pool.
-.Bl -tag -width Ds
+Reopen all vdevs associated with the specified pools,
+or all pools if none specified.
+.
+.Sh OPTIONS
+.Bl -tag -width "-n"
.It Fl n
-Do not restart an in-progress scrub operation. This is not recommended and can
+Do not restart an in-progress scrub operation.
+This is not recommended and can
result in partially resilvered devices unless a second scrub is performed.
.El
-.El
diff --git a/sys/contrib/openzfs/man/man8/zpool-replace.8 b/sys/contrib/openzfs/man/man8/zpool-replace.8
index ae2e66344870..2b2875ed4292 100644
--- a/sys/contrib/openzfs/man/man8/zpool-replace.8
+++ b/sys/contrib/openzfs/man/man8/zpool-replace.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,48 +26,42 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd May 15, 2020
+.Dd May 29, 2021
.Dt ZPOOL-REPLACE 8
.Os
+.
.Sh NAME
.Nm zpool-replace
-.Nd Replace one device with another in a ZFS storage pool
+.Nd replace one device with another in ZFS storage pool
.Sh SYNOPSIS
.Nm zpool
.Cm replace
.Op Fl fsw
.Oo Fl o Ar property Ns = Ns Ar value Oc
-.Ar pool Ar device Op Ar new_device
+.Ar pool Ar device Op Ar new-device
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm replace
-.Op Fl fsw
-.Op Fl o Ar property Ns = Ns Ar value
-.Ar pool Ar device Op Ar new_device
-.Xc
Replaces
-.Ar old_device
+.Ar device
with
-.Ar new_device .
+.Ar new-device .
This is equivalent to attaching
-.Ar new_device ,
+.Ar new-device ,
waiting for it to resilver, and then detaching
-.Ar old_device .
+.Ar device .
Any in progress scrub will be cancelled.
.Pp
The size of
-.Ar new_device
+.Ar new-device
must be greater than or equal to the minimum size of all the devices in a mirror
or raidz configuration.
.Pp
-.Ar new_device
+.Ar new-device
is required if the pool is not redundant.
If
-.Ar new_device
+.Ar new-device
is not specified, it defaults to
-.Ar old_device .
+.Ar device .
This form of replacement is useful after an existing disk has failed and has
been physically replaced.
In this case, the new disk may have the same
@@ -78,18 +71,19 @@ ZFS recognizes this.
.Bl -tag -width Ds
.It Fl f
Forces use of
-.Ar new_device ,
+.Ar new-device ,
even if it appears to be in use.
Not all devices can be overridden in this manner.
.It Fl o Ar property Ns = Ns Ar value
-Sets the given pool properties. See the
-.Xr zpoolprops 8
+Sets the given pool properties.
+See the
+.Xr zpoolprops 7
manual page for a list of valid properties that can be set.
The only property supported at the moment is
.Sy ashift .
.It Fl s
The
-.Ar new_device
+.Ar new-device
is reconstructed sequentially to restore redundancy as quickly as possible.
Checksums are not verfied during sequential reconstruction so a scrub is
started when the resilver completes.
@@ -97,7 +91,7 @@ Sequential reconstruction is not supported for raidz configurations.
.It Fl w
Waits until the replacement has completed before returning.
.El
-.El
+.
.Sh SEE ALSO
.Xr zpool-detach 8 ,
.Xr zpool-initialize 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zpool-resilver.8 b/sys/contrib/openzfs/man/man8/zpool-resilver.8
index 602e296fea11..1ef316ac1825 100644
--- a/sys/contrib/openzfs/man/man8/zpool-resilver.8
+++ b/sys/contrib/openzfs/man/man8/zpool-resilver.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,29 +26,27 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
+.Dd May 27, 2021
.Dt ZPOOL-RESILVER 8
.Os
+.
.Sh NAME
.Nm zpool-resilver
-.Nd Start a resilver of a device in a ZFS storage pool
+.Nd resilver devices in ZFS storage pools
.Sh SYNOPSIS
.Nm zpool
.Cm resilver
-.Ar pool Ns ...
+.Ar pool Ns …
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm resilver
-.Ar pool Ns ...
-.Xc
-Starts a resilver. If an existing resilver is already running it will be
-restarted from the beginning. Any drives that were scheduled for a deferred
-resilver will be added to the new one. This requires the
+Starts a resilver of the specified pools.
+If an existing resilver is already running it will be restarted from the beginning.
+Any drives that were scheduled for a deferred
+resilver will be added to the new one.
+This requires the
.Sy resilver_defer
-feature.
-.El
+pool feature.
+.
.Sh SEE ALSO
.Xr zpool-iostat 8 ,
.Xr zpool-online 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zpool-scrub.8 b/sys/contrib/openzfs/man/man8/zpool-scrub.8
index 6ff2eb261017..10375b6393ac 100644
--- a/sys/contrib/openzfs/man/man8/zpool-scrub.8
+++ b/sys/contrib/openzfs/man/man8/zpool-scrub.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,27 +26,21 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
+.Dd May 27, 2021
.Dt ZPOOL-SCRUB 8
.Os
+.
.Sh NAME
.Nm zpool-scrub
-.Nd Begin a scrub or resume a paused scrub of a ZFS storage pool
+.Nd begin or resume scrub of ZFS storage pools
.Sh SYNOPSIS
.Nm zpool
.Cm scrub
-.Op Fl s | Fl p
+.Op Fl s Ns | Ns Fl p
.Op Fl w
-.Ar pool Ns ...
+.Ar pool Ns …
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm scrub
-.Op Fl s | Fl p
-.Op Fl w
-.Ar pool Ns ...
-.Xc
Begins a scrub or resumes a paused scrub.
The scrub examines all data in the specified pools to verify that it checksums
correctly.
@@ -78,13 +71,13 @@ If a resilver is in progress, ZFS does not allow a scrub to be started until the
resilver completes.
.Pp
Note that, due to changes in pool data on a live system, it is possible for
-scrubs to progress slightly beyond 100% completion. During this period, no
-completion time estimate will be provided.
-.Bl -tag -width Ds
+scrubs to progress slightly beyond 100% completion.
+During this period, no completion time estimate will be provided.
+.
+.Sh OPTIONS
+.Bl -tag -width "-s"
.It Fl s
Stop scrubbing.
-.El
-.Bl -tag -width Ds
.It Fl p
Pause scrubbing.
Scrub pause state and progress are periodically synced to disk.
@@ -98,7 +91,7 @@ again.
.It Fl w
Wait until scrub has completed before returning.
.El
-.El
+.
.Sh SEE ALSO
.Xr zpool-iostat 8 ,
.Xr zpool-resilver 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zpool-split.8 b/sys/contrib/openzfs/man/man8/zpool-split.8
index 54cb8aa7de1c..c3b05c2366bf 100644
--- a/sys/contrib/openzfs/man/man8/zpool-split.8
+++ b/sys/contrib/openzfs/man/man8/zpool-split.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,31 +26,23 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
+.Dd June 2, 2021
.Dt ZPOOL-SPLIT 8
.Os
+.
.Sh NAME
.Nm zpool-split
-.Nd Split devices off a ZFS storage pool creating a new pool
+.Nd split devices off ZFS storage pool, creating new pool
.Sh SYNOPSIS
.Nm zpool
.Cm split
.Op Fl gLlnP
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
+.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
.Op Fl R Ar root
.Ar pool newpool
-.Oo Ar device Oc Ns ...
+.Oo Ar device Oc Ns …
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm split
-.Op Fl gLlnP
-.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
-.Op Fl R Ar root
-.Ar pool newpool
-.Op Ar device ...
-.Xc
Splits devices off
.Ar pool
creating
@@ -76,37 +67,38 @@ and, should any devices remain unspecified,
the last device in each mirror is used as would be by default.
.Bl -tag -width Ds
.It Fl g
-Display vdev GUIDs instead of the normal device names. These GUIDs
-can be used in place of device names for the zpool
+Display vdev GUIDs instead of the normal device names.
+These GUIDs can be used in place of device names for the zpool
detach/offline/remove/replace commands.
.It Fl L
-Display real paths for vdevs resolving all symbolic links. This can
-be used to look up the current block device name regardless of the
+Display real paths for vdevs resolving all symbolic links.
+This can be used to look up the current block device name regardless of the
.Pa /dev/disk/
path used to open it.
.It Fl l
Indicates that this command will request encryption keys for all encrypted
-datasets it attempts to mount as it is bringing the new pool online. Note that
-if any datasets have a
-.Sy keylocation
-of
-.Sy prompt
-this command will block waiting for the keys to be entered. Without this flag
-encrypted datasets will be left unavailable until the keys are loaded.
+datasets it attempts to mount as it is bringing the new pool online.
+Note that if any datasets have
+.Sy keylocation Ns = Ns Sy prompt ,
+this command will block waiting for the keys to be entered.
+Without this flag, encrypted datasets will be left unavailable until the keys are loaded.
.It Fl n
-Do dry run, do not actually perform the split.
+Do a dry-run
+.Pq Qq No-op
+split: do not actually perform it.
Print out the expected configuration of
.Ar newpool .
.It Fl P
Display full paths for vdevs instead of only the last component of
-the path. This can be used in conjunction with the
+the path.
+This can be used in conjunction with the
.Fl L
flag.
.It Fl o Ar property Ns = Ns Ar value
Sets the specified property for
.Ar newpool .
See the
-.Xr zpoolprops 8
+.Xr zpoolprops 7
manual page for more information on the available pool properties.
.It Fl R Ar root
Set
@@ -117,7 +109,7 @@ to
.Ar root
and automatically import it.
.El
-.El
+.
.Sh SEE ALSO
.Xr zpool-import 8 ,
.Xr zpool-list 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zpool-status.8 b/sys/contrib/openzfs/man/man8/zpool-status.8
index 54f0987b80c6..7c825f69d8e2 100644
--- a/sys/contrib/openzfs/man/man8/zpool-status.8
+++ b/sys/contrib/openzfs/man/man8/zpool-status.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,50 +26,43 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd May 15, 2020
+.Dd June 2, 2021
.Dt ZPOOL-STATUS 8
.Os
+.
.Sh NAME
.Nm zpool-status
-.Nd Display detailed health status for the given ZFS storage pools
+.Nd show detailed health status for ZFS storage pools
.Sh SYNOPSIS
.Nm zpool
.Cm status
-.Oo Fl c Ar SCRIPT Oc
.Op Fl DigLpPstvx
.Op Fl T Sy u Ns | Ns Sy d
-.Oo Ar pool Oc Ns ...
+.Op Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns …
+.Oo Ar pool Oc Ns …
.Op Ar interval Op Ar count
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm status
-.Op Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns ...
-.Op Fl DigLpPstvx
-.Op Fl T Sy u Ns | Ns Sy d
-.Oo Ar pool Oc Ns ...
-.Op Ar interval Op Ar count
-.Xc
Displays the detailed health status for the given pools.
If no
.Ar pool
is specified, then the status of each pool in the system is displayed.
For more information on pool and device health, see the
-.Em Device Failure and Recovery
+.Sx Device Failure and Recovery
section of
-.Xr zpoolconcepts 8 .
+.Xr zpoolconcepts 7 .
.Pp
If a scrub or resilver is in progress, this command reports the percentage done
and the estimated time to completion.
Both of these are only approximate, because the amount of data in the pool and
the other workloads on the system can change.
.Bl -tag -width Ds
-.It Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns ...
+.It Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns …
Run a script (or scripts) on each vdev and include the output as a new column
in the
.Nm zpool Cm status
-output. See the
+output.
+See the
.Fl c
option of
.Nm zpool Cm iostat
@@ -78,19 +70,20 @@ for complete details.
.It Fl i
Display vdev initialization status.
.It Fl g
-Display vdev GUIDs instead of the normal device names. These GUIDs
-can be used in place of device names for the zpool
+Display vdev GUIDs instead of the normal device names
+These GUIDs can be used in place of device names for the zpool
detach/offline/remove/replace commands.
.It Fl L
-Display real paths for vdevs resolving all symbolic links. This can
-be used to look up the current block device name regardless of the
+Display real paths for vdevs resolving all symbolic links.
+This can be used to look up the current block device name regardless of the
.Pa /dev/disk/
path used to open it.
.It Fl p
Display numbers in parsable (exact) values.
.It Fl P
Display full paths for vdevs instead of only the last component of
-the path. This can be used in conjunction with the
+the path.
+This can be used in conjunction with the
.Fl L
flag.
.It Fl D
@@ -100,11 +93,14 @@ and referenced
.Pq logically referenced in the pool
block counts and sizes by reference count.
.It Fl s
-Display the number of leaf VDEV slow IOs. This is the number of IOs that
-didn't complete in \fBzio_slow_io_ms\fR milliseconds (default 30 seconds).
+Display the number of leaf VDEV slow IOs.
+This is the number of IOs that
+didn't complete in
+.Sy zio_slow_io_ms
+milliseconds (default 30 seconds).
This does not necessarily mean the IOs failed to complete, just took an
-unreasonably long amount of time. This may indicate a problem with the
-underlying storage.
+unreasonably long amount of time.
+This may indicate a problem with the underlying storage.
.It Fl t
Display vdev TRIM status.
.It Fl T Sy u Ns | Ns Sy d
@@ -127,7 +123,7 @@ Only display status for pools that are exhibiting errors or are otherwise
unavailable.
Warnings about pools not using the latest on-disk format will not be included.
.El
-.El
+.
.Sh SEE ALSO
.Xr zpool-events 8 ,
.Xr zpool-history 8 ,
diff --git a/sys/contrib/openzfs/man/man8/zpool-sync.8 b/sys/contrib/openzfs/man/man8/zpool-sync.8
index 027d129d181c..aa68a5729e9f 100644
--- a/sys/contrib/openzfs/man/man8/zpool-sync.8
+++ b/sys/contrib/openzfs/man/man8/zpool-sync.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -30,28 +29,25 @@
.Dd August 9, 2019
.Dt ZPOOL-SYNC 8
.Os
+.
.Sh NAME
.Nm zpool-sync
-.Nd Force data to be written to primary storage of a ZFS storage pool and update reporting data
+.Nd flush data to primary storage of ZFS storage pools
.Sh SYNOPSIS
.Nm zpool
.Cm sync
-.Oo Ar pool Oc Ns ...
+.Oo Ar pool Oc Ns …
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm sync
-.Op Ar pool ...
-.Xc
This command forces all in-core dirty data to be written to the primary
-pool storage and not the ZIL. It will also update administrative
-information including quota reporting. Without arguments,
-.Sy zpool sync
-will sync all pools on the system. Otherwise, it will sync only the
-specified pool(s).
-.El
+pool storage and not the ZIL.
+It will also update administrative information including quota reporting.
+Without arguments,
+.Nm zpool Cm sync
+will sync all pools on the system.
+Otherwise, it will sync only the specified pools.
+.
.Sh SEE ALSO
-.Xr zpoolconcepts 8 ,
+.Xr zpoolconcepts 7 ,
.Xr zpool-export 8 ,
.Xr zpool-iostat 8
diff --git a/sys/contrib/openzfs/man/man8/zpool-trim.8 b/sys/contrib/openzfs/man/man8/zpool-trim.8
index 1d8bc6e44a24..d9a7b4400301 100644
--- a/sys/contrib/openzfs/man/man8/zpool-trim.8
+++ b/sys/contrib/openzfs/man/man8/zpool-trim.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,56 +26,54 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd February 25, 2020
+.Dd May 27, 2021
.Dt ZPOOL-TRIM 8
.Os
+.
.Sh NAME
.Nm zpool-trim
-.Nd Initiate immediate TRIM operations for all free space in a ZFS storage pool
+.Nd initiate TRIM of free space in ZFS storage pool
.Sh SYNOPSIS
.Nm zpool
.Cm trim
.Op Fl dw
.Op Fl r Ar rate
-.Op Fl c | Fl s
+.Op Fl c Ns | Ns Fl s
.Ar pool
-.Op Ar device Ns ...
+.Oo Ar device Ns Oc Ns …
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm trim
-.Op Fl dw
-.Op Fl c | Fl s
-.Ar pool
-.Op Ar device Ns ...
-.Xc
Initiates an immediate on-demand TRIM operation for all of the free space in
-a pool. This operation informs the underlying storage devices of all blocks
+a pool.
+This operation informs the underlying storage devices of all blocks
in the pool which are no longer allocated and allows thinly provisioned
devices to reclaim the space.
.Pp
A manual on-demand TRIM operation can be initiated irrespective of the
.Sy autotrim
-pool property setting. See the documentation for the
+pool property setting.
+See the documentation for the
.Sy autotrim
property above for the types of vdev devices which can be trimmed.
.Bl -tag -width Ds
-.It Fl d -secure
-Causes a secure TRIM to be initiated. When performing a secure TRIM, the
+.It Fl d , -secure
+Causes a secure TRIM to be initiated.
+When performing a secure TRIM, the
device guarantees that data stored on the trimmed blocks has been erased.
This requires support from the device and is not supported by all SSDs.
-.It Fl r -rate Ar rate
-Controls the rate at which the TRIM operation progresses. Without this
-option TRIM is executed as quickly as possible. The rate, expressed in bytes
+.It Fl r , -rate Ar rate
+Controls the rate at which the TRIM operation progresses.
+Without this
+option TRIM is executed as quickly as possible.
+The rate, expressed in bytes
per second, is applied on a per-vdev basis and may be set differently for
each leaf vdev.
-.It Fl c, -cancel
+.It Fl c , -cancel
Cancel trimming on the specified devices, or all eligible devices if none
are specified.
If one or more target devices are invalid or are not currently being
trimmed, the command will fail and no cancellation will occur on any device.
-.It Fl s -suspend
+.It Fl s , -suspend
Suspend trimming on the specified devices, or all eligible devices if none
are specified.
If one or more target devices are invalid or are not currently being
@@ -84,11 +81,11 @@ trimmed, the command will fail and no suspension will occur on any device.
Trimming can then be resumed by running
.Nm zpool Cm trim
with no flags on the relevant target devices.
-.It Fl w -wait
+.It Fl w , -wait
Wait until the devices are done being trimmed before returning.
.El
-.El
+.
.Sh SEE ALSO
+.Xr zpoolprops 7 ,
.Xr zpool-initialize 8 ,
-.Xr zpool-wait 8 ,
-.Xr zpoolprops 8
+.Xr zpool-wait 8
diff --git a/sys/contrib/openzfs/man/man8/zpool-upgrade.8 b/sys/contrib/openzfs/man/man8/zpool-upgrade.8
index 15baf8a52fba..1b13bad898bf 100644
--- a/sys/contrib/openzfs/man/man8/zpool-upgrade.8
+++ b/sys/contrib/openzfs/man/man8/zpool-upgrade.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -31,9 +30,10 @@
.Dd August 9, 2019
.Dt ZPOOL-UPGRADE 8
.Os
+.
.Sh NAME
.Nm zpool-upgrade
-.Nd Manage version and feature flags of ZFS storage pools
+.Nd manage version and feature flags of ZFS storage pools
.Sh SYNOPSIS
.Nm zpool
.Cm upgrade
@@ -43,7 +43,8 @@
.Nm zpool
.Cm upgrade
.Op Fl V Ar version
-.Fl a Ns | Ns Ar pool Ns ...
+.Fl a Ns | Ns Ar pool Ns …
+.
.Sh DESCRIPTION
.Bl -tag -width Ds
.It Xo
@@ -56,36 +57,37 @@ These pools can continue to be used, but some features may not be available.
Use
.Nm zpool Cm upgrade Fl a
to enable all features on all pools (subject to the
-.Fl o Ar compatibility
+.Fl o Sy compatibility
property).
.It Xo
.Nm zpool
.Cm upgrade
.Fl v
.Xc
-Displays legacy ZFS versions supported by the current software.
+Displays legacy ZFS versions supported by the this version of ZFS.
See
-.Xr zpool-features 5
-for a description of feature flags features supported by the current software.
+.Xr zpool-features 7
+for a description of feature flags features supported by this version of ZFS.
.It Xo
.Nm zpool
.Cm upgrade
.Op Fl V Ar version
-.Fl a Ns | Ns Ar pool Ns ...
+.Fl a Ns | Ns Ar pool Ns …
.Xc
Enables all supported features on the given pool.
.Pp
If the pool has specified compatibility feature sets using the
-.Fl o Ar compatibility
+.Fl o Sy compatibility
property, only the features present in all requested compatibility sets will be
-enabled. If this property is set to
+enabled.
+If this property is set to
.Ar legacy
then no upgrade will take place.
.Pp
Once this is done, the pool will no longer be accessible on systems that do not
support feature flags.
See
-.Xr zpool-features 5
+.Xr zpool-features 7
for details on compatibility with systems that support feature flags, but do not
support all features enabled on the pool.
.Bl -tag -width Ds
@@ -94,15 +96,14 @@ Enables all supported features (from specified compatibility sets, if any) on al
pools.
.It Fl V Ar version
Upgrade to the specified legacy version.
-If the
-.Fl V
-flag is specified, no features will be enabled on the pool.
+If specified, no features will be enabled on the pool.
This option can only be used to increase the version number up to the last
supported legacy version number.
.El
.El
+.
.Sh SEE ALSO
-.Xr zpool-features 5 ,
-.Xr zpoolconcepts 8 ,
-.Xr zpoolprops 8 ,
+.Xr zpool-features 7 ,
+.Xr zpoolconcepts 7 ,
+.Xr zpoolprops 7 ,
.Xr zpool-history 8
diff --git a/sys/contrib/openzfs/man/man8/zpool-wait.8 b/sys/contrib/openzfs/man/man8/zpool-wait.8
index ff6d992243b8..38f4812ace10 100644
--- a/sys/contrib/openzfs/man/man8/zpool-wait.8
+++ b/sys/contrib/openzfs/man/man8/zpool-wait.8
@@ -27,31 +27,23 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd February 25, 2020
+.Dd May 27, 2021
.Dt ZPOOL-WAIT 8
.Os
+.
.Sh NAME
.Nm zpool-wait
-.Nd Wait for background activity to stop in a ZFS storage pool
+.Nd wait for activity to stop in a ZFS storage pool
.Sh SYNOPSIS
.Nm zpool
.Cm wait
.Op Fl Hp
.Op Fl T Sy u Ns | Ns Sy d
-.Op Fl t Ar activity Ns Oo , Ns Ar activity Ns Oc Ns ...
+.Op Fl t Ar activity Ns Oo , Ns Ar activity Ns Oc Ns …
.Ar pool
.Op Ar interval
+.
.Sh DESCRIPTION
-.Bl -tag -width Ds
-.It Xo
-.Nm zpool
-.Cm wait
-.Op Fl Hp
-.Op Fl T Sy u Ns | Ns Sy d
-.Op Fl t Ar activity Ns Oo , Ns Ar activity Ns Oc Ns ...
-.Ar pool
-.Op Ar interval
-.Xc
Waits until all background activity of the given types has ceased in the given
pool.
The activity could cease because it has completed, or because it has been
@@ -65,16 +57,26 @@ immediately.
These are the possible values for
.Ar activity ,
along with what each one waits for:
-.Bd -literal
- discard Checkpoint to be discarded
- free 'freeing' property to become 0
- initialize All initializations to cease
- replace All device replacements to cease
- remove Device removal to cease
- resilver Resilver to cease
- scrub Scrub to cease
- trim Manual trim to cease
-.Ed
+.Bl -tag -compact -offset Ds -width "initialize"
+.It Sy discard
+Checkpoint to be discarded
+.It Sy free
+.Sy freeing
+property to become
+.Sy 0
+.It Sy initialize
+All initializations to cease
+.It Sy replace
+All device replacements to cease
+.It Sy remove
+Device removal to cease
+.It Sy resilver
+Resilver to cease
+.It Sy scrub
+Scrub to cease
+.It Sy trim
+Manual trim to cease
+.El
.Pp
If an
.Ar interval
@@ -102,13 +104,13 @@ for standard date format.
See
.Xr date 1 .
.El
-.El
+.
.Sh SEE ALSO
-.Xr zpool-status 8 ,
.Xr zpool-checkpoint 8 ,
.Xr zpool-initialize 8 ,
-.Xr zpool-replace 8 ,
.Xr zpool-remove 8 ,
+.Xr zpool-replace 8 ,
.Xr zpool-resilver 8 ,
.Xr zpool-scrub 8 ,
+.Xr zpool-status 8 ,
.Xr zpool-trim 8
diff --git a/sys/contrib/openzfs/man/man8/zpool.8 b/sys/contrib/openzfs/man/man8/zpool.8
index 15e50838fee5..192a8e2eac8d 100644
--- a/sys/contrib/openzfs/man/man8/zpool.8
+++ b/sys/contrib/openzfs/man/man8/zpool.8
@@ -18,7 +18,6 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
@@ -27,9 +26,10 @@
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\"
-.Dd August 9, 2019
+.Dd June 2, 2021
.Dt ZPOOL 8
.Os
+.
.Sh NAME
.Nm zpool
.Nd configure ZFS storage pools
@@ -39,8 +39,9 @@
.Nm
.Cm version
.Nm
-.Cm <subcommand>
-.Op Ar <args>
+.Cm subcommand
+.Op Ar argumentss
+.
.Sh DESCRIPTION
The
.Nm
@@ -53,8 +54,9 @@ See
for information on managing datasets.
.Pp
For an overview of creating and managing ZFS storage pools see the
-.Xr zpoolconcepts 8
+.Xr zpoolconcepts 7
manual page.
+.
.Sh SUBCOMMANDS
All subcommands that modify state are logged persistently to the pool in their
original form.
@@ -67,24 +69,22 @@ The following subcommands are supported:
.Bl -tag -width Ds
.It Xo
.Nm
-.Fl ?
+.Fl ?\&
.Xc
Displays a help message.
.It Xo
.Nm
-.Fl V, -version
+.Fl V , -version
.Xc
-An alias for the
-.Nm zpool Cm version
-subcommand.
.It Xo
.Nm
.Cm version
.Xc
Displays the software version of the
.Nm
-userland utility and the zfs kernel module.
+userland utility and the ZFS kernel module.
.El
+.
.Ss Creation
.Bl -tag -width Ds
.It Xr zpool-create 8
@@ -95,6 +95,7 @@ Begins initializing by writing to all unallocated regions on the specified
devices, or all eligible devices in the pool if no individual devices are
specified.
.El
+.
.Ss Destruction
.Bl -tag -width Ds
.It Xr zpool-destroy 8
@@ -103,18 +104,17 @@ Destroys the given pool, freeing up any devices for other use.
Removes ZFS label information from the specified
.Ar device .
.El
+.
.Ss Virtual Devices
.Bl -tag -width Ds
.It Xo
-.Xr zpool-attach 8 /
-.Xr zpool-detach 8
+.Xr zpool-attach 8 Ns / Ns Xr zpool-detach 8
.Xc
Increases or decreases redundancy by
-.Cm attach Ns -ing or
-.Cm detach Ns -ing a device on an existing vdev (virtual device).
+.Cm attach Ns ing or
+.Cm detach Ns ing a device on an existing vdev (virtual device).
.It Xo
-.Xr zpool-add 8 /
-.Xr zpool-remove 8
+.Xr zpool-add 8 Ns / Ns Xr zpool-remove 8
.Xc
Adds the specified virtual devices to the given pool,
or removes the specified device from the pool.
@@ -123,16 +123,16 @@ Replaces an existing device (which may be faulted) with a new one.
.It Xr zpool-split 8
Creates a new pool by splitting all mirrors in an existing pool (which decreases its redundancy).
.El
+.
.Ss Properties
Available pool properties listed in the
-.Xr zpoolprops 8
+.Xr zpoolprops 7
manual page.
.Bl -tag -width Ds
.It Xr zpool-list 8
Lists the given pools along with a health status and space usage.
.It Xo
-.Xr zpool-get 8 /
-.Xr zpool-set 8
+.Xr zpool-get 8 Ns / Ns Xr zpool-set 8
.Xc
Retrieves the given list of properties
.Po
@@ -142,6 +142,7 @@ is used
.Pc
for the specified storage pool(s).
.El
+.
.Ss Monitoring
.Bl -tag -width Ds
.It Xr zpool-status 8
@@ -151,60 +152,62 @@ Displays logical I/O statistics for the given pools/vdevs. Physical I/Os may
be observed via
.Xr iostat 1 .
.It Xr zpool-events 8
-Lists all recent events generated by the ZFS kernel modules. These events
-are consumed by the
+Lists all recent events generated by the ZFS kernel modules.
+These events are consumed by the
.Xr zed 8
and used to automate administrative tasks such as replacing a failed device
-with a hot spare. For more information about the subclasses and event payloads
-that can be generated see the
-.Xr zfs-events 5
-man page.
+with a hot spare.
+That manual page also describes the subclasses and event payloads
+that can be generated.
.It Xr zpool-history 8
Displays the command history of the specified pool(s) or all pools if no pool is
specified.
.El
+.
.Ss Maintenance
.Bl -tag -width Ds
.It Xr zpool-scrub 8
Begins a scrub or resumes a paused scrub.
.It Xr zpool-checkpoint 8
Checkpoints the current state of
-.Ar pool
-, which can be later restored by
-.Nm zpool Cm import --rewind-to-checkpoint .
+.Ar pool ,
+which can be later restored by
+.Nm zpool Cm import Fl -rewind-to-checkpoint .
.It Xr zpool-trim 8
-Initiates an immediate on-demand TRIM operation for all of the free space in
-a pool. This operation informs the underlying storage devices of all blocks
+Initiates an immediate on-demand TRIM operation for all of the free space in a pool.
+This operation informs the underlying storage devices of all blocks
in the pool which are no longer allocated and allows thinly provisioned
devices to reclaim the space.
.It Xr zpool-sync 8
This command forces all in-core dirty data to be written to the primary
-pool storage and not the ZIL. It will also update administrative
-information including quota reporting. Without arguments,
-.Sy zpool sync
-will sync all pools on the system. Otherwise, it will sync only the
-specified pool(s).
+pool storage and not the ZIL.
+It will also update administrative information including quota reporting.
+Without arguments,
+.Nm zpool Cm sync
+will sync all pools on the system.
+Otherwise, it will sync only the specified pool(s).
.It Xr zpool-upgrade 8
Manage the on-disk format version of storage pools.
.It Xr zpool-wait 8
Waits until all background activity of the given types has ceased in the given
pool.
.El
+.
.Ss Fault Resolution
.Bl -tag -width Ds
.It Xo
-.Xr zpool-offline 8
-.Xr zpool-online 8
+.Xr zpool-offline 8 Ns / Ns Xr zpool-online 8
.Xc
Takes the specified physical device offline or brings it online.
.It Xr zpool-resilver 8
-Starts a resilver. If an existing resilver is already running it will be
-restarted from the beginning.
+Starts a resilver.
+If an existing resilver is already running it will be restarted from the beginning.
.It Xr zpool-reopen 8
Reopen all the vdevs associated with the pool.
.It Xr zpool-clear 8
Clears device errors in a pool.
.El
+.
.Ss Import & Export
.Bl -tag -width Ds
.It Xr zpool-import 8
@@ -214,9 +217,10 @@ Exports the given pools from the system.
.It Xr zpool-reguid 8
Generates a new unique identifier for the pool.
.El
+.
.Sh EXIT STATUS
The following exit values are returned:
-.Bl -tag -width Ds
+.Bl -tag -compact -offset 4n -width "a"
.It Sy 0
Successful completion.
.It Sy 1
@@ -224,74 +228,69 @@ An error occurred.
.It Sy 2
Invalid command line options were specified.
.El
+.
.Sh EXAMPLES
-.Bl -tag -width Ds
-.It Sy Example 1 No Creating a RAID-Z Storage Pool
+.Bl -tag -width "Exam"
+.It Sy Example 1 : No Creating a RAID-Z Storage Pool
The following command creates a pool with a single raidz root vdev that
-consists of six disks.
-.Bd -literal
-# zpool create tank raidz sda sdb sdc sdd sde sdf
-.Ed
-.It Sy Example 2 No Creating a Mirrored Storage Pool
+consists of six disks:
+.Dl # Nm zpool Cm create Ar tank Sy raidz Ar sda sdb sdc sdd sde sdf
+.
+.It Sy Example 2 : No Creating a Mirrored Storage Pool
The following command creates a pool with two mirrors, where each mirror
-contains two disks.
-.Bd -literal
-# zpool create tank mirror sda sdb mirror sdc sdd
-.Ed
-.It Sy Example 3 No Creating a ZFS Storage Pool by Using Partitions
-The following command creates an unmirrored pool using two disk partitions.
-.Bd -literal
-# zpool create tank sda1 sdb2
-.Ed
-.It Sy Example 4 No Creating a ZFS Storage Pool by Using Files
+contains two disks:
+.Dl # Nm zpool Cm create Ar tank Sy mirror Ar sda sdb Sy mirror Ar sdc sdd
+.
+.It Sy Example 3 : No Creating a ZFS Storage Pool by Using Partitions
+The following command creates an unmirrored pool using two disk partitions:
+.Dl # Nm zpool Cm create Ar tank sda1 sdb2
+.
+.It Sy Example 4 : No Creating a ZFS Storage Pool by Using Files
The following command creates an unmirrored pool using files.
While not recommended, a pool based on files can be useful for experimental
purposes.
-.Bd -literal
-# zpool create tank /path/to/file/a /path/to/file/b
-.Ed
-.It Sy Example 5 No Adding a Mirror to a ZFS Storage Pool
+.Dl # Nm zpool Cm create Ar tank /path/to/file/a /path/to/file/b
+.
+.It Sy Example 5 : No Adding a Mirror to a ZFS Storage Pool
The following command adds two mirrored disks to the pool
-.Em tank ,
+.Ar tank ,
assuming the pool is already made up of two-way mirrors.
The additional space is immediately available to any datasets within the pool.
-.Bd -literal
-# zpool add tank mirror sda sdb
-.Ed
-.It Sy Example 6 No Listing Available ZFS Storage Pools
+.Dl # Nm zpool Cm add Ar tank Sy mirror Ar sda sdb
+.
+.It Sy Example 6 : No Listing Available ZFS Storage Pools
The following command lists all available pools on the system.
In this case, the pool
-.Em zion
+.Ar zion
is faulted due to a missing device.
The results from this command are similar to the following:
-.Bd -literal
-# zpool list
+.Bd -literal -compact -offset Ds
+.No # Nm zpool Cm list
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
rpool 19.9G 8.43G 11.4G - 33% 42% 1.00x ONLINE -
tank 61.5G 20.0G 41.5G - 48% 32% 1.00x ONLINE -
zion - - - - - - - FAULTED -
.Ed
-.It Sy Example 7 No Destroying a ZFS Storage Pool
+.
+.It Sy Example 7 : No Destroying a ZFS Storage Pool
The following command destroys the pool
-.Em tank
-and any datasets contained within.
-.Bd -literal
-# zpool destroy -f tank
-.Ed
-.It Sy Example 8 No Exporting a ZFS Storage Pool
+.Ar tank
+and any datasets contained within:
+.Dl # Nm zpool Cm destroy Fl f Ar tank
+.
+.It Sy Example 8 : No Exporting a ZFS Storage Pool
The following command exports the devices in pool
-.Em tank
-so that they can be relocated or later imported.
-.Bd -literal
-# zpool export tank
-.Ed
-.It Sy Example 9 No Importing a ZFS Storage Pool
+.Ar tank
+so that they can be relocated or later imported:
+.Dl # Nm zpool Cm export Ar tank
+.
+.It Sy Example 9 : No Importing a ZFS Storage Pool
The following command displays available pools, and then imports the pool
-.Em tank
+.Ar tank
for use on the system.
The results from this command are similar to the following:
-.Bd -literal
-# zpool import
+.Bd -literal -compact -offset Ds
+.No # Nm zpool Cm import
pool: tank
id: 15451357997522795478
state: ONLINE
@@ -303,66 +302,58 @@ config:
sda ONLINE
sdb ONLINE
-# zpool import tank
+.No # Nm zpool Cm import Ar tank
.Ed
-.It Sy Example 10 No Upgrading All ZFS Storage Pools to the Current Version
+.
+.It Sy Example 10 : No Upgrading All ZFS Storage Pools to the Current Version
The following command upgrades all ZFS Storage pools to the current version of
-the software.
-.Bd -literal
-# zpool upgrade -a
+the software:
+.Bd -literal -compact -offset Ds
+.No # Nm zpool Cm upgrade Fl a
This system is currently running ZFS version 2.
.Ed
-.It Sy Example 11 No Managing Hot Spares
+.
+.It Sy Example 11 : No Managing Hot Spares
The following command creates a new pool with an available hot spare:
-.Bd -literal
-# zpool create tank mirror sda sdb spare sdc
-.Ed
+.Dl # Nm zpool Cm create Ar tank Sy mirror Ar sda sdb Sy spare Ar sdc
.Pp
If one of the disks were to fail, the pool would be reduced to the degraded
state.
The failed device can be replaced using the following command:
-.Bd -literal
-# zpool replace tank sda sdd
-.Ed
+.Dl # Nm zpool Cm replace Ar tank sda sdd
.Pp
Once the data has been resilvered, the spare is automatically removed and is
made available for use should another device fail.
The hot spare can be permanently removed from the pool using the following
command:
-.Bd -literal
-# zpool remove tank sdc
-.Ed
-.It Sy Example 12 No Creating a ZFS Pool with Mirrored Separate Intent Logs
+.Dl # Nm zpool Cm remove Ar tank sdc
+.
+.It Sy Example 12 : No Creating a ZFS Pool with Mirrored Separate Intent Logs
The following command creates a ZFS storage pool consisting of two, two-way
mirrors and mirrored log devices:
-.Bd -literal
-# zpool create pool mirror sda sdb mirror sdc sdd log mirror \\
- sde sdf
-.Ed
-.It Sy Example 13 No Adding Cache Devices to a ZFS Pool
+.Dl # Nm zpool Cm create Ar pool Sy mirror Ar sda sdb Sy mirror Ar sdc sdd Sy log mirror Ar sde sdf
+.
+.It Sy Example 13 : No Adding Cache Devices to a ZFS Pool
The following command adds two disks for use as cache devices to a ZFS storage
pool:
-.Bd -literal
-# zpool add pool cache sdc sdd
-.Ed
+.Dl # Nm zpool Cm add Ar pool Sy cache Ar sdc sdd
.Pp
Once added, the cache devices gradually fill with content from main memory.
Depending on the size of your cache devices, it could take over an hour for
them to fill.
Capacity and reads can be monitored using the
.Cm iostat
-option as follows:
-.Bd -literal
-# zpool iostat -v pool 5
-.Ed
-.It Sy Example 14 No Removing a Mirrored top-level (Log or Data) Device
+subcommand as follows:
+.Dl # Nm zpool Cm iostat Fl v Ar pool 5
+.
+.It Sy Example 14 : No Removing a Mirrored top-level (Log or Data) Device
The following commands remove the mirrored log device
.Sy mirror-2
and mirrored top-level data device
.Sy mirror-1 .
.Pp
Given this configuration:
-.Bd -literal
+.Bd -literal -compact -offset Ds
pool: tank
state: ONLINE
scrub: none requested
@@ -383,27 +374,22 @@ config:
.Ed
.Pp
The command to remove the mirrored log
-.Sy mirror-2
-is:
-.Bd -literal
-# zpool remove tank mirror-2
-.Ed
+.Ar mirror-2 No is:
+.Dl # Nm zpool Cm remove Ar tank mirror-2
.Pp
The command to remove the mirrored data
-.Sy mirror-1
-is:
-.Bd -literal
-# zpool remove tank mirror-1
-.Ed
-.It Sy Example 15 No Displaying expanded space on a device
+.Ar mirror-1 No is:
+.Dl # Nm zpool Cm remove Ar tank mirror-1
+.
+.It Sy Example 15 : No Displaying expanded space on a device
The following command displays the detailed information for the pool
-.Em data .
+.Ar data .
This pool is comprised of a single raidz vdev where one of its devices
increased its capacity by 10GB.
In this example, the pool will not be able to utilize this extra capacity until
all the devices under the raidz vdev have been expanded.
-.Bd -literal
-# zpool list -v data
+.Bd -literal -compact -offset Ds
+.No # Nm zpool Cm list Fl v Ar data
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
data 23.9G 14.6G 9.30G - 48% 61% 1.00x ONLINE -
raidz1 23.9G 14.6G 9.30G - 48%
@@ -411,16 +397,12 @@ data 23.9G 14.6G 9.30G - 48% 61% 1.00x ONLINE -
sdb - - - 10G -
sdc - - - - -
.Ed
-.It Sy Example 16 No Adding output columns
+.
+.It Sy Example 16 : No Adding output columns
Additional columns can be added to the
-.Nm zpool Cm status
-and
-.Nm zpool Cm iostat
-output with
-.Fl c
-option.
-.Bd -literal
-# zpool status -c vendor,model,size
+.Nm zpool Cm status No and Nm zpool Cm iostat No output with Fl c .
+.Bd -literal -compact -offset Ds
+.No # Nm zpool Cm status Fl c Ar vendor , Ns Ar model , Ns Ar size
NAME STATE READ WRITE CKSUM vendor model size
tank ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
@@ -431,7 +413,7 @@ option.
U13 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
U14 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
-# zpool iostat -vc size
+.No # Nm zpool Cm iostat Fl vc Ar size
capacity operations bandwidth
pool alloc free read write read write size
---------- ----- ----- ----- ----- ----- ----- ----
@@ -440,128 +422,109 @@ rpool 14.6G 54.9G 4 55 250K 2.69M
---------- ----- ----- ----- ----- ----- ----- ----
.Ed
.El
+.
.Sh ENVIRONMENT VARIABLES
-.Bl -tag -width "ZFS_ABORT"
-.It Ev ZFS_ABORT
+.Bl -tag -compact -width "ZPOOL_IMPORT_UDEV_TIMEOUT_MS"
+.It Sy ZFS_ABORT
Cause
-.Nm zpool
+.Nm
to dump core on exit for the purposes of running
.Sy ::findleaks .
-.El
-.Bl -tag -width "ZFS_COLOR"
-.It Ev ZFS_COLOR
+.It Sy ZFS_COLOR
Use ANSI color in
.Nm zpool status
output.
-.El
-.Bl -tag -width "ZPOOL_IMPORT_PATH"
-.It Ev ZPOOL_IMPORT_PATH
-The search path for devices or files to use with the pool. This is a colon-separated list of directories in which
-.Nm zpool
+.It Sy ZPOOL_IMPORT_PATH
+The search path for devices or files to use with the pool.
+This is a colon-separated list of directories in which
+.Nm
looks for device nodes and files.
Similar to the
.Fl d
option in
.Nm zpool import .
-.El
-.Bl -tag -width "ZPOOL_IMPORT_UDEV_TIMEOUT_MS"
-.It Ev ZPOOL_IMPORT_UDEV_TIMEOUT_MS
+.It Sy ZPOOL_IMPORT_UDEV_TIMEOUT_MS
The maximum time in milliseconds that
.Nm zpool import
will wait for an expected device to be available.
-.El
-.Bl -tag -width "ZPOOL_STATUS_NON_NATIVE_ASHIFT_IGNORE"
-.It Ev ZPOOL_STATUS_NON_NATIVE_ASHIFT_IGNORE
+.It Sy ZPOOL_STATUS_NON_NATIVE_ASHIFT_IGNORE
If set, suppress warning about non-native vdev ashift in
.Nm zpool status .
The value is not used, only the presence or absence of the variable matters.
-.El
-.Bl -tag -width "ZPOOL_VDEV_NAME_GUID"
-.It Ev ZPOOL_VDEV_NAME_GUID
+.It Sy ZPOOL_VDEV_NAME_GUID
Cause
-.Nm zpool
-subcommands to output vdev guids by default. This behavior is identical to the
-.Nm zpool status -g
+.Nm
+subcommands to output vdev guids by default.
+This behavior is identical to the
+.Nm zpool Cm status Fl g
command line option.
-.El
-.Bl -tag -width "ZPOOL_VDEV_NAME_FOLLOW_LINKS"
-.It Ev ZPOOL_VDEV_NAME_FOLLOW_LINKS
+.It Sy ZPOOL_VDEV_NAME_FOLLOW_LINKS
Cause
-.Nm zpool
-subcommands to follow links for vdev names by default. This behavior is identical to the
-.Nm zpool status -L
+.Nm
+subcommands to follow links for vdev names by default.
+This behavior is identical to the
+.Nm zpool Cm status Fl L
command line option.
-.El
-.Bl -tag -width "ZPOOL_VDEV_NAME_PATH"
-.It Ev ZPOOL_VDEV_NAME_PATH
+.It Sy ZPOOL_VDEV_NAME_PATH
Cause
-.Nm zpool
-subcommands to output full vdev path names by default. This
-behavior is identical to the
-.Nm zpool status -P
+.Nm
+subcommands to output full vdev path names by default.
+This behavior is identical to the
+.Nm zpool Cm status Fl P
command line option.
-.El
-.Bl -tag -width "ZFS_VDEV_DEVID_OPT_OUT"
-.It Ev ZFS_VDEV_DEVID_OPT_OUT
+.It Sy ZFS_VDEV_DEVID_OPT_OUT
Older OpenZFS implementations had issues when attempting to display pool
config VDEV names if a
.Sy devid
NVP value is present in the pool's config.
.Pp
-For example, a pool that originated on illumos platform would have a devid
+For example, a pool that originated on illumos platform would have a
+.Sy devid
value in the config and
.Nm zpool status
would fail when listing the config.
-This would also be true for future Linux based pools.
+This would also be true for future Linux-based pools.
.Pp
A pool can be stripped of any
.Sy devid
values on import or prevented from adding
them on
-.Nm zpool create
+.Nm zpool Cm create
or
-.Nm zpool add
+.Nm zpool Cm add
by setting
.Sy ZFS_VDEV_DEVID_OPT_OUT .
-.El
-.Bl -tag -width "ZPOOL_SCRIPTS_AS_ROOT"
-.It Ev ZPOOL_SCRIPTS_AS_ROOT
-Allow a privileged user to run the
-.Nm zpool status/iostat
-with the
-.Fl c
-option. Normally, only unprivileged users are allowed to run
+.Pp
+.It Sy ZPOOL_SCRIPTS_AS_ROOT
+Allow a privileged user to run
+.Nm zpool status/iostat Fl c .
+Normally, only unprivileged users are allowed to run
.Fl c .
-.El
-.Bl -tag -width "ZPOOL_SCRIPTS_PATH"
-.It Ev ZPOOL_SCRIPTS_PATH
+.It Sy ZPOOL_SCRIPTS_PATH
The search path for scripts when running
-.Nm zpool status/iostat
-with the
-.Fl c
-option. This is a colon-separated list of directories and overrides the default
+.Nm zpool status/iostat Fl c .
+This is a colon-separated list of directories and overrides the default
.Pa ~/.zpool.d
and
.Pa /etc/zfs/zpool.d
search paths.
-.El
-.Bl -tag -width "ZPOOL_SCRIPTS_ENABLED"
-.It Ev ZPOOL_SCRIPTS_ENABLED
+.It Sy ZPOOL_SCRIPTS_ENABLED
Allow a user to run
-.Nm zpool status/iostat
-with the
-.Fl c
-option. If
+.Nm zpool status/iostat Fl c .
+If
.Sy ZPOOL_SCRIPTS_ENABLED
is not set, it is assumed that the user is allowed to run
-.Nm zpool status/iostat -c .
+.Nm zpool Cm status Ns / Ns Cm iostat Fl c .
.El
+.
.Sh INTERFACE STABILITY
.Sy Evolving
+.
.Sh SEE ALSO
-.Xr zfs-events 5 ,
-.Xr zfs-module-parameters 5 ,
-.Xr zpool-features 5 ,
+.Xr zfs 4 ,
+.Xr zpool-features 7 ,
+.Xr zpoolconcepts 7 ,
+.Xr zpoolprops 7 ,
.Xr zed 8 ,
.Xr zfs 8 ,
.Xr zpool-add 8 ,
@@ -594,6 +557,4 @@ is not set, it is assumed that the user is allowed to run
.Xr zpool-sync 8 ,
.Xr zpool-trim 8 ,
.Xr zpool-upgrade 8 ,
-.Xr zpool-wait 8 ,
-.Xr zpoolconcepts 8 ,
-.Xr zpoolprops 8
+.Xr zpool-wait 8
diff --git a/sys/contrib/openzfs/man/man8/zpool_influxdb.8 b/sys/contrib/openzfs/man/man8/zpool_influxdb.8
index bd899dbe90a0..021fbdeaac8a 100644
--- a/sys/contrib/openzfs/man/man8/zpool_influxdb.8
+++ b/sys/contrib/openzfs/man/man8/zpool_influxdb.8
@@ -18,76 +18,81 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright 2020 Richard Elling
-.\" .Dd June 14, 2020
-.TH zpool_influxdb 8
-.SH NAME
-zpool_influxdb \- collect zpool statistics in influxdb line protocol format
-.SH SYNOPSIS
-.LP
-.nf
-\fBzpool_influxdb\fR [--execd] [--no-histogram] [--sum-histogram-buckets]
-[--tags key=value] [pool]
-\fBzpool_influxdb\fR --help
-.fi
-.SH DESCRIPTION
-The \fBzpool_influxdb\fR command produces influxdb line protocol compatible
-metrics from zpools. Like the \fBzpool\fR command, \fBzpool_influxdb\fR
-reads the current pool status and statistics. Unlike the \fBzpool\fR
-command which is intended for humans, \fBzpool_influxdb\fR formats the
-output in influxdb line protocol. The expected use is as a plugin to a
-metrics collector or aggregator, such as telegraf.
-
-By default, \fBzpool_influxdb\fR prints pool metrics and status in the
-influxdb line protocol format. All pools are printed, similar to
-the \fBzpool status\fR command. Providing a pool name restricts the
-output to the named pool.
-
-Like the \fBzpool\fR command, \fBzpool_influxdb\fR uses internal data
-structures that can change over time as new ZFS releases are made.
-Therefore, the \fBzpool_influxdb\fR command must be compiled against the
-ZFS source. It is expected that later releases of ZFS includes compatible
-\fBzpool_influxdb\fR and \fBzpool\fR commands.
-
-.SH OPTIONS
-.TP
-\fB\--execd\fR, \fB-e\fR
-Run in daemon mode compatible with telegraf`s \fBexecd\fR plugin.
-In this mode, the pools are sampled every time there is a [return] on stdin.
-Once a sample printed, \fBzpool_influxdb\fR waits for another [return].
-When run on a terminal, use [ctrl+C] to exit.
-.TP
-\fB\--no-histogram\fR, \fB-n\fR
-Do not print latency and I/O size histograms. This can reduce the total
+.\"
+.Dd May 26, 2021
+.Dt ZPOOL_INFLUXDB 8
+.Os
+.
+.Sh NAME
+.Nm zpool_influxdb
+.Nd collect ZFS pool statistics in InfluxDB line protocol format
+.Sh SYNOPSIS
+.Nm
+.Op Fl e Ns | Ns Fl -execd
+.Op Fl n Ns | Ns Fl -no-histogram
+.Op Fl s Ns | Ns Fl -sum-histogram-buckets
+.Op Fl t Ns | Ns Fl -tags Ar key Ns = Ns Ar value Ns Oo , Ns Ar key Ns = Ns Ar value Oc Ns …
+.Op Ar pool
+.
+.Sh DESCRIPTION
+.Nm
+produces InfluxDB-line-protocol-compatible metrics from zpools.
+Like the
+.Nm zpool
+command,
+.Nm
+reads the current pool status and statistics.
+Unlike the
+.Nm zpool
+command which is intended for humans,
+.Nm
+formats the output in the InfluxDB line protocol.
+The expected use is as a plugin to a
+metrics collector or aggregator, such as Telegraf.
+.Pp
+By default,
+.Nm
+prints pool metrics and status in the InfluxDB line protocol format.
+All pools are printed, similar to the
+.Nm zpool Cm status
+command.
+Providing a pool name restricts the output to the named pool.
+.
+.Sh OPTIONS
+.Bl -tag -width "-e, --execd"
+.It Fl e , -execd
+Run in daemon mode compatible with Telegraf's
+.Nm execd
+plugin.
+In this mode, the pools are sampled every time a
+newline appears on the standard input.
+.It Fl n , -no-histogram
+Do not print latency and I/O size histograms.
+This can reduce the total
amount of data, but one should consider the value brought by the insights
-that latency and I/O size distributions provide. The resulting values
-are suitable for graphing with grafana's heatmap plugin.
-.TP
-\fB--sum-histogram-buckets\fR, \fB-s\fR
-Accumulates bucket values. By default, the values are not accumulated and
-the raw data appears as shown by \fBzpool iostat\fR. This works well for
-grafana's heatmap plugin. Summing the buckets produces output similar to
-prometheus histograms.
-.TP
-\fB--tags\fR, \fB-t\fR
-Adds specified tags to the tag set. Tags are key=value pairs and multiple
-tags are separated by commas. No sanity checking is performed.
+that latency and I/O size distributions provide.
+The resulting values
+are suitable for graphing with Grafana's heatmap plugin.
+.It Fl s , -sum-histogram-buckets
+Accumulates bucket values.
+By default, the values are not accumulated and the raw data appears as shown by
+.Nm zpool Cm iostat .
+This works well for Grafana's heatmap plugin.
+Summing the buckets produces output similar to Prometheus histograms.
+.It Fl t , Fl -tags Ar key Ns = Ns Ar value Ns Oo , Ns Ar key Ns = Ns Ar value Oc Ns …
+Adds specified tags to the tag set.
+No sanity checking is performed.
See the InfluxDB Line Protocol format documentation for details on escaping
special characters used in tags.
-.TP
-\fB\--help\fR, \fB\-h\fR
+.It Fl h , -help
Print a usage summary.
-
-.SH SEE ALSO
-.LP
-\fBzpool-status\fR(8)
-\fBzpool-iostat\fR(8)
-.PP
-Influxdb https://github.com/influxdata/influxdb
-.PP
-Telegraf https://github.com/influxdata/telegraf
-.PP
-Grafana https://grafana.com
-.PP
-Prometheus https://prometheus.io
+.El
+.
+.Sh SEE ALSO
+.Xr zpool-iostat 8 ,
+.Xr zpool-status 8 ,
+.Lk https://github.com/influxdata/influxdb "InfluxDB" ,
+.Lk https://github.com/influxdata/telegraf "Telegraf" ,
+.Lk https://grafana.com "Grafana" ,
+.Lk https://prometheus.io "Prometheus"
diff --git a/sys/contrib/openzfs/man/man8/zstream.8 b/sys/contrib/openzfs/man/man8/zstream.8
index 2912f10c6913..c0322ee3ace0 100644
--- a/sys/contrib/openzfs/man/man8/zstream.8
+++ b/sys/contrib/openzfs/man/man8/zstream.8
@@ -18,14 +18,15 @@
.\"
.\" CDDL HEADER END
.\"
-.\"
.\" Copyright (c) 2020 by Delphix. All rights reserved.
-.Dd March 25, 2020
+.\"
+.Dd May 8, 2021
.Dt ZSTREAM 8
.Os
+.
.Sh NAME
.Nm zstream
-.Nd manipulate zfs send streams
+.Nd manipulate ZFS send streams
.Sh SYNOPSIS
.Nm
.Cm dump
@@ -38,11 +39,11 @@
.Nm
.Cm token
.Ar resume_token
+.
.Sh DESCRIPTION
-.sp
The
.Sy zstream
-utility manipulates zfs send streams, which are the output of the
+utility manipulates ZFS send streams output by the
.Sy zfs send
command.
.Bl -tag -width ""
@@ -67,6 +68,12 @@ Print metadata for each record.
Dump data contained in each record.
Implies verbose.
.El
+.Pp
+The
+.Nm zstreamdump
+alias is provided for compatibility and is equivalent to running
+.Nm
+.Cm dump .
.It Xo
.Nm
.Cm token
@@ -96,16 +103,15 @@ command is provided a
containing a deduplicated send stream, and outputs an equivalent
non-deduplicated send stream on standard output.
Therefore, a deduplicated send stream can be received by running:
-.Bd -literal
-# zstream redup DEDUP_STREAM_FILE | zfs receive ...
-.Ed
+.Dl # Nm zstream Cm redup Pa DEDUP_STREAM_FILE | Nm zfs Cm receive No …
.Bl -tag -width "-D"
.It Fl v
Verbose.
Print summary of converted records.
.El
.El
+.
.Sh SEE ALSO
.Xr zfs 8 ,
-.Xr zfs-send 8 ,
-.Xr zfs-receive 8
+.Xr zfs-receive 8 ,
+.Xr zfs-send 8
diff --git a/sys/contrib/openzfs/man/man8/zstreamdump.8 b/sys/contrib/openzfs/man/man8/zstreamdump.8
index f499be442a47..c6721daf11de 100644..120000
--- a/sys/contrib/openzfs/man/man8/zstreamdump.8
+++ b/sys/contrib/openzfs/man/man8/zstreamdump.8
@@ -1,58 +1 @@
-'\" te
-.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
-.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
-.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
-.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH ZSTREAMDUMP 8 "Aug 24, 2020" OpenZFS
-.SH NAME
-zstreamdump \- filter data in zfs send stream
-.SH SYNOPSIS
-.LP
-.nf
-\fBzstreamdump\fR [\fB-C\fR] [\fB-v\fR] [\fB-d\fR]
-.fi
-
-.SH DESCRIPTION
-.sp
-.LP
-The \fBzstreamdump\fR utility reads from the output of the \fBzfs send\fR
-command, then displays headers and some statistics from that output. See
-\fBzfs\fR(8).
-.SH OPTIONS
-.sp
-.LP
-The following options are supported:
-.sp
-.ne 2
-.na
-\fB-C\fR
-.ad
-.sp .6
-.RS 4n
-Suppress the validation of checksums.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-v\fR
-.ad
-.sp .6
-.RS 4n
-Verbose. Dump all headers, not only begin and end headers.
-.RE
-
-.sp
-.ne 2
-.na
-\fB-d\fR
-.ad
-.sp .6
-.RS 4n
-Dump contents of blocks modified. Implies verbose.
-.RE
-
-.SH SEE ALSO
-.sp
-.LP
-\fBzfs\fR(8)
+zstream.8 \ No newline at end of file
diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c b/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c
index 43ce358298b5..38a7b434712e 100644
--- a/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c
+++ b/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c
@@ -508,65 +508,3 @@ kstat_delete(kstat_t *ksp)
kmem_free(ksp->ks_data, ksp->ks_data_size);
free(ksp, M_KSTAT);
}
-
-void
-kstat_waitq_enter(kstat_io_t *kiop)
-{
- hrtime_t new, delta;
- ulong_t wcnt;
-
- new = gethrtime();
- delta = new - kiop->wlastupdate;
- kiop->wlastupdate = new;
- wcnt = kiop->wcnt++;
- if (wcnt != 0) {
- kiop->wlentime += delta * wcnt;
- kiop->wtime += delta;
- }
-}
-
-void
-kstat_waitq_exit(kstat_io_t *kiop)
-{
- hrtime_t new, delta;
- ulong_t wcnt;
-
- new = gethrtime();
- delta = new - kiop->wlastupdate;
- kiop->wlastupdate = new;
- wcnt = kiop->wcnt--;
- ASSERT((int)wcnt > 0);
- kiop->wlentime += delta * wcnt;
- kiop->wtime += delta;
-}
-
-void
-kstat_runq_enter(kstat_io_t *kiop)
-{
- hrtime_t new, delta;
- ulong_t rcnt;
-
- new = gethrtime();
- delta = new - kiop->rlastupdate;
- kiop->rlastupdate = new;
- rcnt = kiop->rcnt++;
- if (rcnt != 0) {
- kiop->rlentime += delta * rcnt;
- kiop->rtime += delta;
- }
-}
-
-void
-kstat_runq_exit(kstat_io_t *kiop)
-{
- hrtime_t new, delta;
- ulong_t rcnt;
-
- new = gethrtime();
- delta = new - kiop->rlastupdate;
- kiop->rlastupdate = new;
- rcnt = kiop->rcnt--;
- ASSERT((int)rcnt > 0);
- kiop->rlentime += delta * rcnt;
- kiop->rtime += delta;
-}
diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ioctl_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ioctl_os.c
index 0e0c16033b15..7f7e2b72c51a 100644
--- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ioctl_os.c
+++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ioctl_os.c
@@ -138,6 +138,23 @@ zfs_ioc_nextboot(const char *unused, nvlist_t *innvl, nvlist_t *outnvl)
return (error);
}
+/* Update the VFS's cache of mountpoint properties */
+void
+zfs_ioctl_update_mount_cache(const char *dsname)
+{
+ zfsvfs_t *zfsvfs;
+
+ if (getzfsvfs(dsname, &zfsvfs) == 0) {
+ struct mount *mp = zfsvfs->z_vfs;
+ VFS_STATFS(mp, &mp->mnt_stat);
+ zfs_vfs_rele(zfsvfs);
+ }
+ /*
+ * Ignore errors; we can't do anything useful if either getzfsvfs or
+ * VFS_STATFS fails.
+ */
+}
+
uint64_t
zfs_max_nvlist_src_size_os(void)
{
diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c
index 79beddea8193..516d7dd81d18 100644
--- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c
+++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c
@@ -102,7 +102,12 @@ SYSCTL_INT(_vfs_zfs_version, OID_AUTO, zpl, CTLFLAG_RD, &zfs_version_zpl, 0,
"ZPL_VERSION");
/* END CSTYLED */
+#if __FreeBSD_version >= 1400018
+static int zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg,
+ bool *mp_busy);
+#else
static int zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg);
+#endif
static int zfs_mount(vfs_t *vfsp);
static int zfs_umount(vfs_t *vfsp, int fflag);
static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp);
@@ -267,7 +272,11 @@ done:
}
static int
+#if __FreeBSD_version >= 1400018
+zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg, bool *mp_busy)
+#else
zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg)
+#endif
{
zfsvfs_t *zfsvfs = vfsp->vfs_data;
struct thread *td;
@@ -291,8 +300,10 @@ zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg)
break;
default:
error = EINVAL;
+#if __FreeBSD_version < 1400018
if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF)
vfs_unbusy(vfsp);
+#endif
goto done;
}
}
@@ -351,11 +362,15 @@ zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg)
case Q_QUOTAON:
// As far as I can tell, you can't turn quotas on or off on zfs
error = 0;
+#if __FreeBSD_version < 1400018
vfs_unbusy(vfsp);
+#endif
break;
case Q_QUOTAOFF:
error = ENOTSUP;
+#if __FreeBSD_version < 1400018
vfs_unbusy(vfsp);
+#endif
break;
case Q_SETQUOTA:
error = copyin(arg, &dqblk, sizeof (dqblk));
diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-kmem-cache.c b/sys/contrib/openzfs/module/os/linux/spl/spl-kmem-cache.c
index 6b3d559ffc1c..2151ef008fd6 100644
--- a/sys/contrib/openzfs/module/os/linux/spl/spl-kmem-cache.c
+++ b/sys/contrib/openzfs/module/os/linux/spl/spl-kmem-cache.c
@@ -100,13 +100,10 @@ MODULE_PARM_DESC(spl_kmem_cache_max_size, "Maximum size of slab in MB");
* For small objects the Linux slab allocator should be used to make the most
* efficient use of the memory. However, large objects are not supported by
* the Linux slab and therefore the SPL implementation is preferred. A cutoff
- * of 16K was determined to be optimal for architectures using 4K pages.
+ * of 16K was determined to be optimal for architectures using 4K pages and
+ * to also work well on architecutres using larger 64K page sizes.
*/
-#if PAGE_SIZE == 4096
unsigned int spl_kmem_cache_slab_limit = 16384;
-#else
-unsigned int spl_kmem_cache_slab_limit = 0;
-#endif
module_param(spl_kmem_cache_slab_limit, uint, 0644);
MODULE_PARM_DESC(spl_kmem_cache_slab_limit,
"Objects less than N bytes use the Linux slab");
@@ -527,9 +524,7 @@ spl_cache_flush(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flush)
* Size a slab based on the size of each aligned object plus spl_kmem_obj_t.
* When on-slab we want to target spl_kmem_cache_obj_per_slab. However,
* for very small objects we may end up with more than this so as not
- * to waste space in the minimal allocation of a single page. Also for
- * very large objects we may use as few as spl_kmem_cache_obj_per_slab_min,
- * lower than this and we will fail.
+ * to waste space in the minimal allocation of a single page.
*/
static int
spl_slab_size(spl_kmem_cache_t *skc, uint32_t *objs, uint32_t *size)
diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-kstat.c b/sys/contrib/openzfs/module/os/linux/spl/spl-kstat.c
index c7f1aadf784e..0c46708326d8 100644
--- a/sys/contrib/openzfs/module/os/linux/spl/spl-kstat.c
+++ b/sys/contrib/openzfs/module/os/linux/spl/spl-kstat.c
@@ -50,72 +50,6 @@ kstat_resize_raw(kstat_t *ksp)
return (0);
}
-void
-kstat_waitq_enter(kstat_io_t *kiop)
-{
- hrtime_t new, delta;
- ulong_t wcnt;
-
- new = gethrtime();
- delta = new - kiop->wlastupdate;
- kiop->wlastupdate = new;
- wcnt = kiop->wcnt++;
- if (wcnt != 0) {
- kiop->wlentime += delta * wcnt;
- kiop->wtime += delta;
- }
-}
-EXPORT_SYMBOL(kstat_waitq_enter);
-
-void
-kstat_waitq_exit(kstat_io_t *kiop)
-{
- hrtime_t new, delta;
- ulong_t wcnt;
-
- new = gethrtime();
- delta = new - kiop->wlastupdate;
- kiop->wlastupdate = new;
- wcnt = kiop->wcnt--;
- ASSERT((int)wcnt > 0);
- kiop->wlentime += delta * wcnt;
- kiop->wtime += delta;
-}
-EXPORT_SYMBOL(kstat_waitq_exit);
-
-void
-kstat_runq_enter(kstat_io_t *kiop)
-{
- hrtime_t new, delta;
- ulong_t rcnt;
-
- new = gethrtime();
- delta = new - kiop->rlastupdate;
- kiop->rlastupdate = new;
- rcnt = kiop->rcnt++;
- if (rcnt != 0) {
- kiop->rlentime += delta * rcnt;
- kiop->rtime += delta;
- }
-}
-EXPORT_SYMBOL(kstat_runq_enter);
-
-void
-kstat_runq_exit(kstat_io_t *kiop)
-{
- hrtime_t new, delta;
- ulong_t rcnt;
-
- new = gethrtime();
- delta = new - kiop->rlastupdate;
- kiop->rlastupdate = new;
- rcnt = kiop->rcnt--;
- ASSERT((int)rcnt > 0);
- kiop->rlentime += delta * rcnt;
- kiop->rtime += delta;
-}
-EXPORT_SYMBOL(kstat_runq_exit);
-
static int
kstat_seq_show_headers(struct seq_file *f)
{
diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zfs_ioctl_os.c b/sys/contrib/openzfs/module/os/linux/zfs/zfs_ioctl_os.c
index 812f9c0ea105..79b9d777dc88 100644
--- a/sys/contrib/openzfs/module/os/linux/zfs/zfs_ioctl_os.c
+++ b/sys/contrib/openzfs/module/os/linux/zfs/zfs_ioctl_os.c
@@ -212,6 +212,12 @@ zfs_max_nvlist_src_size_os(void)
return (MIN(ptob(zfs_totalram_pages) / 4, 128 * 1024 * 1024));
}
+/* Update the VFS's cache of mountpoint properties */
+void
+zfs_ioctl_update_mount_cache(const char *dsname)
+{
+}
+
void
zfs_ioctl_init_os(void)
{
diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c b/sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c
index 421aebefe465..524c43dcded4 100644
--- a/sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c
+++ b/sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c
@@ -342,9 +342,6 @@ zpl_iter_write(struct kiocb *kiocb, struct iov_iter *from)
ssize_t wrote = count - uio.uio_resid;
kiocb->ki_pos += wrote;
- if (wrote > 0)
- iov_iter_advance(from, wrote);
-
return (wrote);
}
diff --git a/sys/contrib/openzfs/module/zfs/aggsum.c b/sys/contrib/openzfs/module/zfs/aggsum.c
index e46da95f676c..c4ea4f86fc5f 100644
--- a/sys/contrib/openzfs/module/zfs/aggsum.c
+++ b/sys/contrib/openzfs/module/zfs/aggsum.c
@@ -78,11 +78,11 @@
*/
/*
- * We will borrow aggsum_borrow_multiplier times the current request, so we will
- * have to get the as_lock approximately every aggsum_borrow_multiplier calls to
- * aggsum_delta().
+ * We will borrow 2^aggsum_borrow_shift times the current request, so we will
+ * have to get the as_lock approximately every 2^aggsum_borrow_shift calls to
+ * aggsum_add().
*/
-static uint_t aggsum_borrow_multiplier = 10;
+static uint_t aggsum_borrow_shift = 4;
void
aggsum_init(aggsum_t *as, uint64_t value)
@@ -90,9 +90,14 @@ aggsum_init(aggsum_t *as, uint64_t value)
bzero(as, sizeof (*as));
as->as_lower_bound = as->as_upper_bound = value;
mutex_init(&as->as_lock, NULL, MUTEX_DEFAULT, NULL);
- as->as_numbuckets = boot_ncpus;
- as->as_buckets = kmem_zalloc(boot_ncpus * sizeof (aggsum_bucket_t),
- KM_SLEEP);
+ /*
+ * Too many buckets may hurt read performance without improving
+ * write. From 12 CPUs use bucket per 2 CPUs, from 48 per 4, etc.
+ */
+ as->as_bucketshift = highbit64(boot_ncpus / 6) / 2;
+ as->as_numbuckets = ((boot_ncpus - 1) >> as->as_bucketshift) + 1;
+ as->as_buckets = kmem_zalloc(as->as_numbuckets *
+ sizeof (aggsum_bucket_t), KM_SLEEP);
for (int i = 0; i < as->as_numbuckets; i++) {
mutex_init(&as->as_buckets[i].asc_lock,
NULL, MUTEX_DEFAULT, NULL);
@@ -111,59 +116,49 @@ aggsum_fini(aggsum_t *as)
int64_t
aggsum_lower_bound(aggsum_t *as)
{
- return (as->as_lower_bound);
+ return (atomic_load_64((volatile uint64_t *)&as->as_lower_bound));
}
-int64_t
+uint64_t
aggsum_upper_bound(aggsum_t *as)
{
- return (as->as_upper_bound);
-}
-
-static void
-aggsum_flush_bucket(aggsum_t *as, struct aggsum_bucket *asb)
-{
- ASSERT(MUTEX_HELD(&as->as_lock));
- ASSERT(MUTEX_HELD(&asb->asc_lock));
-
- /*
- * We use atomic instructions for this because we read the upper and
- * lower bounds without the lock, so we need stores to be atomic.
- */
- atomic_add_64((volatile uint64_t *)&as->as_lower_bound,
- asb->asc_delta + asb->asc_borrowed);
- atomic_add_64((volatile uint64_t *)&as->as_upper_bound,
- asb->asc_delta - asb->asc_borrowed);
- asb->asc_delta = 0;
- asb->asc_borrowed = 0;
+ return (atomic_load_64(&as->as_upper_bound));
}
uint64_t
aggsum_value(aggsum_t *as)
{
- int64_t rv;
+ int64_t lb;
+ uint64_t ub;
mutex_enter(&as->as_lock);
- if (as->as_lower_bound == as->as_upper_bound) {
- rv = as->as_lower_bound;
+ lb = as->as_lower_bound;
+ ub = as->as_upper_bound;
+ if (lb == ub) {
for (int i = 0; i < as->as_numbuckets; i++) {
ASSERT0(as->as_buckets[i].asc_delta);
ASSERT0(as->as_buckets[i].asc_borrowed);
}
mutex_exit(&as->as_lock);
- return (rv);
+ return (lb);
}
for (int i = 0; i < as->as_numbuckets; i++) {
struct aggsum_bucket *asb = &as->as_buckets[i];
+ if (asb->asc_borrowed == 0)
+ continue;
mutex_enter(&asb->asc_lock);
- aggsum_flush_bucket(as, asb);
+ lb += asb->asc_delta + asb->asc_borrowed;
+ ub += asb->asc_delta - asb->asc_borrowed;
+ asb->asc_delta = 0;
+ asb->asc_borrowed = 0;
mutex_exit(&asb->asc_lock);
}
- VERIFY3U(as->as_lower_bound, ==, as->as_upper_bound);
- rv = as->as_lower_bound;
+ ASSERT3U(lb, ==, ub);
+ atomic_store_64((volatile uint64_t *)&as->as_lower_bound, lb);
+ atomic_store_64(&as->as_upper_bound, lb);
mutex_exit(&as->as_lock);
- return (rv);
+ return (lb);
}
void
@@ -172,7 +167,8 @@ aggsum_add(aggsum_t *as, int64_t delta)
struct aggsum_bucket *asb;
int64_t borrow;
- asb = &as->as_buckets[CPU_SEQID_UNSTABLE % as->as_numbuckets];
+ asb = &as->as_buckets[(CPU_SEQID_UNSTABLE >> as->as_bucketshift) %
+ as->as_numbuckets];
/* Try fast path if we already borrowed enough before. */
mutex_enter(&asb->asc_lock);
@@ -188,21 +184,22 @@ aggsum_add(aggsum_t *as, int64_t delta)
* We haven't borrowed enough. Take the global lock and borrow
* considering what is requested now and what we borrowed before.
*/
- borrow = (delta < 0 ? -delta : delta) * aggsum_borrow_multiplier;
+ borrow = (delta < 0 ? -delta : delta);
+ borrow <<= aggsum_borrow_shift + as->as_bucketshift;
mutex_enter(&as->as_lock);
- mutex_enter(&asb->asc_lock);
- delta += asb->asc_delta;
- asb->asc_delta = 0;
if (borrow >= asb->asc_borrowed)
borrow -= asb->asc_borrowed;
else
borrow = (borrow - (int64_t)asb->asc_borrowed) / 4;
+ mutex_enter(&asb->asc_lock);
+ delta += asb->asc_delta;
+ asb->asc_delta = 0;
asb->asc_borrowed += borrow;
- atomic_add_64((volatile uint64_t *)&as->as_lower_bound,
- delta - borrow);
- atomic_add_64((volatile uint64_t *)&as->as_upper_bound,
- delta + borrow);
mutex_exit(&asb->asc_lock);
+ atomic_store_64((volatile uint64_t *)&as->as_lower_bound,
+ as->as_lower_bound + delta - borrow);
+ atomic_store_64(&as->as_upper_bound,
+ as->as_upper_bound + delta + borrow);
mutex_exit(&as->as_lock);
}
@@ -214,27 +211,35 @@ aggsum_add(aggsum_t *as, int64_t delta)
int
aggsum_compare(aggsum_t *as, uint64_t target)
{
- if (as->as_upper_bound < target)
+ int64_t lb;
+ uint64_t ub;
+ int i;
+
+ if (atomic_load_64(&as->as_upper_bound) < target)
return (-1);
- if (as->as_lower_bound > target)
+ lb = atomic_load_64((volatile uint64_t *)&as->as_lower_bound);
+ if (lb > 0 && (uint64_t)lb > target)
return (1);
mutex_enter(&as->as_lock);
- for (int i = 0; i < as->as_numbuckets; i++) {
+ lb = as->as_lower_bound;
+ ub = as->as_upper_bound;
+ for (i = 0; i < as->as_numbuckets; i++) {
struct aggsum_bucket *asb = &as->as_buckets[i];
+ if (asb->asc_borrowed == 0)
+ continue;
mutex_enter(&asb->asc_lock);
- aggsum_flush_bucket(as, asb);
+ lb += asb->asc_delta + asb->asc_borrowed;
+ ub += asb->asc_delta - asb->asc_borrowed;
+ asb->asc_delta = 0;
+ asb->asc_borrowed = 0;
mutex_exit(&asb->asc_lock);
- if (as->as_upper_bound < target) {
- mutex_exit(&as->as_lock);
- return (-1);
- }
- if (as->as_lower_bound > target) {
- mutex_exit(&as->as_lock);
- return (1);
- }
+ if (ub < target || (lb > 0 && (uint64_t)lb > target))
+ break;
}
- VERIFY3U(as->as_lower_bound, ==, as->as_upper_bound);
- ASSERT3U(as->as_lower_bound, ==, target);
+ if (i >= as->as_numbuckets)
+ ASSERT3U(lb, ==, ub);
+ atomic_store_64((volatile uint64_t *)&as->as_lower_bound, lb);
+ atomic_store_64(&as->as_upper_bound, ub);
mutex_exit(&as->as_lock);
- return (0);
+ return (ub < target ? -1 : (uint64_t)lb > target ? 1 : 0);
}
diff --git a/sys/contrib/openzfs/module/zfs/arc.c b/sys/contrib/openzfs/module/zfs/arc.c
index f0ae3938a333..3878e658a5c8 100644
--- a/sys/contrib/openzfs/module/zfs/arc.c
+++ b/sys/contrib/openzfs/module/zfs/arc.c
@@ -305,6 +305,7 @@
#include <sys/arc_impl.h>
#include <sys/trace_zfs.h>
#include <sys/aggsum.h>
+#include <sys/wmsum.h>
#include <cityhash.h>
#include <sys/vdev_trim.h>
#include <sys/zfs_racct.h>
@@ -692,14 +693,14 @@ arc_state_t *arc_mfu;
*/
aggsum_t arc_size;
aggsum_t arc_meta_used;
-aggsum_t astat_data_size;
-aggsum_t astat_metadata_size;
-aggsum_t astat_dbuf_size;
+wmsum_t astat_data_size;
+wmsum_t astat_metadata_size;
+wmsum_t astat_dbuf_size;
aggsum_t astat_dnode_size;
-aggsum_t astat_bonus_size;
-aggsum_t astat_hdr_size;
+wmsum_t astat_bonus_size;
+wmsum_t astat_hdr_size;
aggsum_t astat_l2_hdr_size;
-aggsum_t astat_abd_chunk_waste_size;
+wmsum_t astat_abd_chunk_waste_size;
hrtime_t arc_growtime;
list_t arc_prune_list;
@@ -2326,7 +2327,7 @@ add_reference(arc_buf_hdr_t *hdr, void *tag)
(state != arc_anon)) {
/* We don't use the L2-only state list. */
if (state != arc_l2c_only) {
- multilist_remove(state->arcs_list[arc_buf_type(hdr)],
+ multilist_remove(&state->arcs_list[arc_buf_type(hdr)],
hdr);
arc_evictable_space_decrement(hdr, state);
}
@@ -2360,7 +2361,7 @@ remove_reference(arc_buf_hdr_t *hdr, kmutex_t *hash_lock, void *tag)
*/
if (((cnt = zfs_refcount_remove(&hdr->b_l1hdr.b_refcnt, tag)) == 0) &&
(state != arc_anon)) {
- multilist_insert(state->arcs_list[arc_buf_type(hdr)], hdr);
+ multilist_insert(&state->arcs_list[arc_buf_type(hdr)], hdr);
ASSERT3U(hdr->b_l1hdr.b_bufcnt, >, 0);
arc_evictable_space_increment(hdr, state);
}
@@ -2463,7 +2464,7 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t *hdr,
if (refcnt == 0) {
if (old_state != arc_anon && old_state != arc_l2c_only) {
ASSERT(HDR_HAS_L1HDR(hdr));
- multilist_remove(old_state->arcs_list[buftype], hdr);
+ multilist_remove(&old_state->arcs_list[buftype], hdr);
if (GHOST_STATE(old_state)) {
ASSERT0(bufcnt);
@@ -2480,7 +2481,7 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t *hdr,
* beforehand.
*/
ASSERT(HDR_HAS_L1HDR(hdr));
- multilist_insert(new_state->arcs_list[buftype], hdr);
+ multilist_insert(&new_state->arcs_list[buftype], hdr);
if (GHOST_STATE(new_state)) {
ASSERT0(bufcnt);
@@ -2632,8 +2633,8 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t *hdr,
* L2 headers should never be on the L2 state list since they don't
* have L1 headers allocated.
*/
- ASSERT(multilist_is_empty(arc_l2c_only->arcs_list[ARC_BUFC_DATA]) &&
- multilist_is_empty(arc_l2c_only->arcs_list[ARC_BUFC_METADATA]));
+ ASSERT(multilist_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_DATA]) &&
+ multilist_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA]));
}
void
@@ -2645,22 +2646,22 @@ arc_space_consume(uint64_t space, arc_space_type_t type)
default:
break;
case ARC_SPACE_DATA:
- aggsum_add(&astat_data_size, space);
+ wmsum_add(&astat_data_size, space);
break;
case ARC_SPACE_META:
- aggsum_add(&astat_metadata_size, space);
+ wmsum_add(&astat_metadata_size, space);
break;
case ARC_SPACE_BONUS:
- aggsum_add(&astat_bonus_size, space);
+ wmsum_add(&astat_bonus_size, space);
break;
case ARC_SPACE_DNODE:
aggsum_add(&astat_dnode_size, space);
break;
case ARC_SPACE_DBUF:
- aggsum_add(&astat_dbuf_size, space);
+ wmsum_add(&astat_dbuf_size, space);
break;
case ARC_SPACE_HDRS:
- aggsum_add(&astat_hdr_size, space);
+ wmsum_add(&astat_hdr_size, space);
break;
case ARC_SPACE_L2HDRS:
aggsum_add(&astat_l2_hdr_size, space);
@@ -2672,7 +2673,7 @@ arc_space_consume(uint64_t space, arc_space_type_t type)
* scatter ABD's come from the ARC, because other users are
* very short-lived.
*/
- aggsum_add(&astat_abd_chunk_waste_size, space);
+ wmsum_add(&astat_abd_chunk_waste_size, space);
break;
}
@@ -2691,28 +2692,28 @@ arc_space_return(uint64_t space, arc_space_type_t type)
default:
break;
case ARC_SPACE_DATA:
- aggsum_add(&astat_data_size, -space);
+ wmsum_add(&astat_data_size, -space);
break;
case ARC_SPACE_META:
- aggsum_add(&astat_metadata_size, -space);
+ wmsum_add(&astat_metadata_size, -space);
break;
case ARC_SPACE_BONUS:
- aggsum_add(&astat_bonus_size, -space);
+ wmsum_add(&astat_bonus_size, -space);
break;
case ARC_SPACE_DNODE:
aggsum_add(&astat_dnode_size, -space);
break;
case ARC_SPACE_DBUF:
- aggsum_add(&astat_dbuf_size, -space);
+ wmsum_add(&astat_dbuf_size, -space);
break;
case ARC_SPACE_HDRS:
- aggsum_add(&astat_hdr_size, -space);
+ wmsum_add(&astat_hdr_size, -space);
break;
case ARC_SPACE_L2HDRS:
aggsum_add(&astat_l2_hdr_size, -space);
break;
case ARC_SPACE_ABD_CHUNK_WASTE:
- aggsum_add(&astat_abd_chunk_waste_size, -space);
+ wmsum_add(&astat_abd_chunk_waste_size, -space);
break;
}
@@ -4204,7 +4205,7 @@ arc_evict_state(arc_state_t *state, uint64_t spa, int64_t bytes,
arc_buf_contents_t type)
{
uint64_t total_evicted = 0;
- multilist_t *ml = state->arcs_list[type];
+ multilist_t *ml = &state->arcs_list[type];
int num_sublists;
arc_buf_hdr_t **markers;
@@ -4538,8 +4539,8 @@ arc_evict_meta(uint64_t meta_used)
static arc_buf_contents_t
arc_evict_type(arc_state_t *state)
{
- multilist_t *data_ml = state->arcs_list[ARC_BUFC_DATA];
- multilist_t *meta_ml = state->arcs_list[ARC_BUFC_METADATA];
+ multilist_t *data_ml = &state->arcs_list[ARC_BUFC_DATA];
+ multilist_t *meta_ml = &state->arcs_list[ARC_BUFC_METADATA];
int data_idx = multilist_get_random_index(data_ml);
int meta_idx = multilist_get_random_index(meta_ml);
multilist_sublist_t *data_mls;
@@ -7275,21 +7276,21 @@ arc_kstat_update(kstat_t *ksp, int rw)
ARCSTAT(arcstat_size) = aggsum_value(&arc_size);
ARCSTAT(arcstat_meta_used) = aggsum_value(&arc_meta_used);
- ARCSTAT(arcstat_data_size) = aggsum_value(&astat_data_size);
+ ARCSTAT(arcstat_data_size) = wmsum_value(&astat_data_size);
ARCSTAT(arcstat_metadata_size) =
- aggsum_value(&astat_metadata_size);
- ARCSTAT(arcstat_hdr_size) = aggsum_value(&astat_hdr_size);
+ wmsum_value(&astat_metadata_size);
+ ARCSTAT(arcstat_hdr_size) = wmsum_value(&astat_hdr_size);
ARCSTAT(arcstat_l2_hdr_size) = aggsum_value(&astat_l2_hdr_size);
- ARCSTAT(arcstat_dbuf_size) = aggsum_value(&astat_dbuf_size);
+ ARCSTAT(arcstat_dbuf_size) = wmsum_value(&astat_dbuf_size);
#if defined(COMPAT_FREEBSD11)
- ARCSTAT(arcstat_other_size) = aggsum_value(&astat_bonus_size) +
+ ARCSTAT(arcstat_other_size) = wmsum_value(&astat_bonus_size) +
aggsum_value(&astat_dnode_size) +
- aggsum_value(&astat_dbuf_size);
+ wmsum_value(&astat_dbuf_size);
#endif
ARCSTAT(arcstat_dnode_size) = aggsum_value(&astat_dnode_size);
- ARCSTAT(arcstat_bonus_size) = aggsum_value(&astat_bonus_size);
+ ARCSTAT(arcstat_bonus_size) = wmsum_value(&astat_bonus_size);
ARCSTAT(arcstat_abd_chunk_waste_size) =
- aggsum_value(&astat_abd_chunk_waste_size);
+ wmsum_value(&astat_abd_chunk_waste_size);
as->arcstat_memory_all_bytes.value.ui64 =
arc_all_memory();
@@ -7459,44 +7460,44 @@ arc_state_init(void)
arc_mfu_ghost = &ARC_mfu_ghost;
arc_l2c_only = &ARC_l2c_only;
- arc_mru->arcs_list[ARC_BUFC_METADATA] =
- multilist_create(sizeof (arc_buf_hdr_t),
+ multilist_create(&arc_mru->arcs_list[ARC_BUFC_METADATA],
+ sizeof (arc_buf_hdr_t),
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
arc_state_multilist_index_func);
- arc_mru->arcs_list[ARC_BUFC_DATA] =
- multilist_create(sizeof (arc_buf_hdr_t),
+ multilist_create(&arc_mru->arcs_list[ARC_BUFC_DATA],
+ sizeof (arc_buf_hdr_t),
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
arc_state_multilist_index_func);
- arc_mru_ghost->arcs_list[ARC_BUFC_METADATA] =
- multilist_create(sizeof (arc_buf_hdr_t),
+ multilist_create(&arc_mru_ghost->arcs_list[ARC_BUFC_METADATA],
+ sizeof (arc_buf_hdr_t),
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
arc_state_multilist_index_func);
- arc_mru_ghost->arcs_list[ARC_BUFC_DATA] =
- multilist_create(sizeof (arc_buf_hdr_t),
+ multilist_create(&arc_mru_ghost->arcs_list[ARC_BUFC_DATA],
+ sizeof (arc_buf_hdr_t),
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
arc_state_multilist_index_func);
- arc_mfu->arcs_list[ARC_BUFC_METADATA] =
- multilist_create(sizeof (arc_buf_hdr_t),
+ multilist_create(&arc_mfu->arcs_list[ARC_BUFC_METADATA],
+ sizeof (arc_buf_hdr_t),
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
arc_state_multilist_index_func);
- arc_mfu->arcs_list[ARC_BUFC_DATA] =
- multilist_create(sizeof (arc_buf_hdr_t),
+ multilist_create(&arc_mfu->arcs_list[ARC_BUFC_DATA],
+ sizeof (arc_buf_hdr_t),
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
arc_state_multilist_index_func);
- arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA] =
- multilist_create(sizeof (arc_buf_hdr_t),
+ multilist_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA],
+ sizeof (arc_buf_hdr_t),
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
arc_state_multilist_index_func);
- arc_mfu_ghost->arcs_list[ARC_BUFC_DATA] =
- multilist_create(sizeof (arc_buf_hdr_t),
+ multilist_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_DATA],
+ sizeof (arc_buf_hdr_t),
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
arc_state_multilist_index_func);
- arc_l2c_only->arcs_list[ARC_BUFC_METADATA] =
- multilist_create(sizeof (arc_buf_hdr_t),
+ multilist_create(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA],
+ sizeof (arc_buf_hdr_t),
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
arc_state_multilist_index_func);
- arc_l2c_only->arcs_list[ARC_BUFC_DATA] =
- multilist_create(sizeof (arc_buf_hdr_t),
+ multilist_create(&arc_l2c_only->arcs_list[ARC_BUFC_DATA],
+ sizeof (arc_buf_hdr_t),
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
arc_state_multilist_index_func);
@@ -7522,14 +7523,14 @@ arc_state_init(void)
aggsum_init(&arc_meta_used, 0);
aggsum_init(&arc_size, 0);
- aggsum_init(&astat_data_size, 0);
- aggsum_init(&astat_metadata_size, 0);
- aggsum_init(&astat_hdr_size, 0);
+ wmsum_init(&astat_data_size, 0);
+ wmsum_init(&astat_metadata_size, 0);
+ wmsum_init(&astat_hdr_size, 0);
aggsum_init(&astat_l2_hdr_size, 0);
- aggsum_init(&astat_bonus_size, 0);
+ wmsum_init(&astat_bonus_size, 0);
aggsum_init(&astat_dnode_size, 0);
- aggsum_init(&astat_dbuf_size, 0);
- aggsum_init(&astat_abd_chunk_waste_size, 0);
+ wmsum_init(&astat_dbuf_size, 0);
+ wmsum_init(&astat_abd_chunk_waste_size, 0);
arc_anon->arcs_state = ARC_STATE_ANON;
arc_mru->arcs_state = ARC_STATE_MRU;
@@ -7562,27 +7563,27 @@ arc_state_fini(void)
zfs_refcount_destroy(&arc_mfu_ghost->arcs_size);
zfs_refcount_destroy(&arc_l2c_only->arcs_size);
- multilist_destroy(arc_mru->arcs_list[ARC_BUFC_METADATA]);
- multilist_destroy(arc_mru_ghost->arcs_list[ARC_BUFC_METADATA]);
- multilist_destroy(arc_mfu->arcs_list[ARC_BUFC_METADATA]);
- multilist_destroy(arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA]);
- multilist_destroy(arc_mru->arcs_list[ARC_BUFC_DATA]);
- multilist_destroy(arc_mru_ghost->arcs_list[ARC_BUFC_DATA]);
- multilist_destroy(arc_mfu->arcs_list[ARC_BUFC_DATA]);
- multilist_destroy(arc_mfu_ghost->arcs_list[ARC_BUFC_DATA]);
- multilist_destroy(arc_l2c_only->arcs_list[ARC_BUFC_METADATA]);
- multilist_destroy(arc_l2c_only->arcs_list[ARC_BUFC_DATA]);
+ multilist_destroy(&arc_mru->arcs_list[ARC_BUFC_METADATA]);
+ multilist_destroy(&arc_mru_ghost->arcs_list[ARC_BUFC_METADATA]);
+ multilist_destroy(&arc_mfu->arcs_list[ARC_BUFC_METADATA]);
+ multilist_destroy(&arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA]);
+ multilist_destroy(&arc_mru->arcs_list[ARC_BUFC_DATA]);
+ multilist_destroy(&arc_mru_ghost->arcs_list[ARC_BUFC_DATA]);
+ multilist_destroy(&arc_mfu->arcs_list[ARC_BUFC_DATA]);
+ multilist_destroy(&arc_mfu_ghost->arcs_list[ARC_BUFC_DATA]);
+ multilist_destroy(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA]);
+ multilist_destroy(&arc_l2c_only->arcs_list[ARC_BUFC_DATA]);
aggsum_fini(&arc_meta_used);
aggsum_fini(&arc_size);
- aggsum_fini(&astat_data_size);
- aggsum_fini(&astat_metadata_size);
- aggsum_fini(&astat_hdr_size);
+ wmsum_fini(&astat_data_size);
+ wmsum_fini(&astat_metadata_size);
+ wmsum_fini(&astat_hdr_size);
aggsum_fini(&astat_l2_hdr_size);
- aggsum_fini(&astat_bonus_size);
+ wmsum_fini(&astat_bonus_size);
aggsum_fini(&astat_dnode_size);
- aggsum_fini(&astat_dbuf_size);
- aggsum_fini(&astat_abd_chunk_waste_size);
+ wmsum_fini(&astat_dbuf_size);
+ wmsum_fini(&astat_abd_chunk_waste_size);
}
uint64_t
@@ -8628,16 +8629,16 @@ l2arc_sublist_lock(int list_num)
switch (list_num) {
case 0:
- ml = arc_mfu->arcs_list[ARC_BUFC_METADATA];
+ ml = &arc_mfu->arcs_list[ARC_BUFC_METADATA];
break;
case 1:
- ml = arc_mru->arcs_list[ARC_BUFC_METADATA];
+ ml = &arc_mru->arcs_list[ARC_BUFC_METADATA];
break;
case 2:
- ml = arc_mfu->arcs_list[ARC_BUFC_DATA];
+ ml = &arc_mfu->arcs_list[ARC_BUFC_DATA];
break;
case 3:
- ml = arc_mru->arcs_list[ARC_BUFC_DATA];
+ ml = &arc_mru->arcs_list[ARC_BUFC_DATA];
break;
default:
return (NULL);
diff --git a/sys/contrib/openzfs/module/zfs/dataset_kstats.c b/sys/contrib/openzfs/module/zfs/dataset_kstats.c
index e46a0926d557..3fbb24ddef5e 100644
--- a/sys/contrib/openzfs/module/zfs/dataset_kstats.c
+++ b/sys/contrib/openzfs/module/zfs/dataset_kstats.c
@@ -50,17 +50,17 @@ dataset_kstats_update(kstat_t *ksp, int rw)
dataset_kstat_values_t *dkv = dk->dk_kstats->ks_data;
dkv->dkv_writes.value.ui64 =
- aggsum_value(&dk->dk_aggsums.das_writes);
+ wmsum_value(&dk->dk_sums.dss_writes);
dkv->dkv_nwritten.value.ui64 =
- aggsum_value(&dk->dk_aggsums.das_nwritten);
+ wmsum_value(&dk->dk_sums.dss_nwritten);
dkv->dkv_reads.value.ui64 =
- aggsum_value(&dk->dk_aggsums.das_reads);
+ wmsum_value(&dk->dk_sums.dss_reads);
dkv->dkv_nread.value.ui64 =
- aggsum_value(&dk->dk_aggsums.das_nread);
+ wmsum_value(&dk->dk_sums.dss_nread);
dkv->dkv_nunlinks.value.ui64 =
- aggsum_value(&dk->dk_aggsums.das_nunlinks);
+ wmsum_value(&dk->dk_sums.dss_nunlinks);
dkv->dkv_nunlinked.value.ui64 =
- aggsum_value(&dk->dk_aggsums.das_nunlinked);
+ wmsum_value(&dk->dk_sums.dss_nunlinked);
return (0);
}
@@ -140,12 +140,12 @@ dataset_kstats_create(dataset_kstats_t *dk, objset_t *objset)
kstat_install(kstat);
dk->dk_kstats = kstat;
- aggsum_init(&dk->dk_aggsums.das_writes, 0);
- aggsum_init(&dk->dk_aggsums.das_nwritten, 0);
- aggsum_init(&dk->dk_aggsums.das_reads, 0);
- aggsum_init(&dk->dk_aggsums.das_nread, 0);
- aggsum_init(&dk->dk_aggsums.das_nunlinks, 0);
- aggsum_init(&dk->dk_aggsums.das_nunlinked, 0);
+ wmsum_init(&dk->dk_sums.dss_writes, 0);
+ wmsum_init(&dk->dk_sums.dss_nwritten, 0);
+ wmsum_init(&dk->dk_sums.dss_reads, 0);
+ wmsum_init(&dk->dk_sums.dss_nread, 0);
+ wmsum_init(&dk->dk_sums.dss_nunlinks, 0);
+ wmsum_init(&dk->dk_sums.dss_nunlinked, 0);
}
void
@@ -162,12 +162,12 @@ dataset_kstats_destroy(dataset_kstats_t *dk)
kstat_delete(dk->dk_kstats);
dk->dk_kstats = NULL;
- aggsum_fini(&dk->dk_aggsums.das_writes);
- aggsum_fini(&dk->dk_aggsums.das_nwritten);
- aggsum_fini(&dk->dk_aggsums.das_reads);
- aggsum_fini(&dk->dk_aggsums.das_nread);
- aggsum_fini(&dk->dk_aggsums.das_nunlinks);
- aggsum_fini(&dk->dk_aggsums.das_nunlinked);
+ wmsum_fini(&dk->dk_sums.dss_writes);
+ wmsum_fini(&dk->dk_sums.dss_nwritten);
+ wmsum_fini(&dk->dk_sums.dss_reads);
+ wmsum_fini(&dk->dk_sums.dss_nread);
+ wmsum_fini(&dk->dk_sums.dss_nunlinks);
+ wmsum_fini(&dk->dk_sums.dss_nunlinked);
}
void
@@ -179,8 +179,8 @@ dataset_kstats_update_write_kstats(dataset_kstats_t *dk,
if (dk->dk_kstats == NULL)
return;
- aggsum_add(&dk->dk_aggsums.das_writes, 1);
- aggsum_add(&dk->dk_aggsums.das_nwritten, nwritten);
+ wmsum_add(&dk->dk_sums.dss_writes, 1);
+ wmsum_add(&dk->dk_sums.dss_nwritten, nwritten);
}
void
@@ -192,8 +192,8 @@ dataset_kstats_update_read_kstats(dataset_kstats_t *dk,
if (dk->dk_kstats == NULL)
return;
- aggsum_add(&dk->dk_aggsums.das_reads, 1);
- aggsum_add(&dk->dk_aggsums.das_nread, nread);
+ wmsum_add(&dk->dk_sums.dss_reads, 1);
+ wmsum_add(&dk->dk_sums.dss_nread, nread);
}
void
@@ -202,7 +202,7 @@ dataset_kstats_update_nunlinks_kstat(dataset_kstats_t *dk, int64_t delta)
if (dk->dk_kstats == NULL)
return;
- aggsum_add(&dk->dk_aggsums.das_nunlinks, delta);
+ wmsum_add(&dk->dk_sums.dss_nunlinks, delta);
}
void
@@ -211,5 +211,5 @@ dataset_kstats_update_nunlinked_kstat(dataset_kstats_t *dk, int64_t delta)
if (dk->dk_kstats == NULL)
return;
- aggsum_add(&dk->dk_aggsums.das_nunlinked, delta);
+ wmsum_add(&dk->dk_sums.dss_nunlinked, delta);
}
diff --git a/sys/contrib/openzfs/module/zfs/dbuf.c b/sys/contrib/openzfs/module/zfs/dbuf.c
index d48dc7943a24..368cdfe397a2 100644
--- a/sys/contrib/openzfs/module/zfs/dbuf.c
+++ b/sys/contrib/openzfs/module/zfs/dbuf.c
@@ -203,8 +203,8 @@ static boolean_t dbuf_evict_thread_exit;
* by those caches' matching enum values (from dbuf_cached_state_t).
*/
typedef struct dbuf_cache {
- multilist_t *cache;
- zfs_refcount_t size;
+ multilist_t cache;
+ zfs_refcount_t size ____cacheline_aligned;
} dbuf_cache_t;
dbuf_cache_t dbuf_caches[DB_CACHE_MAX];
@@ -667,9 +667,9 @@ dbuf_cache_above_lowater(void)
static void
dbuf_evict_one(void)
{
- int idx = multilist_get_random_index(dbuf_caches[DB_DBUF_CACHE].cache);
+ int idx = multilist_get_random_index(&dbuf_caches[DB_DBUF_CACHE].cache);
multilist_sublist_t *mls = multilist_sublist_lock(
- dbuf_caches[DB_DBUF_CACHE].cache, idx);
+ &dbuf_caches[DB_DBUF_CACHE].cache, idx);
ASSERT(!MUTEX_HELD(&dbuf_evict_lock));
@@ -833,8 +833,8 @@ retry:
dbu_evict_taskq = taskq_create("dbu_evict", 1, defclsyspri, 0, 0, 0);
for (dbuf_cached_state_t dcs = 0; dcs < DB_CACHE_MAX; dcs++) {
- dbuf_caches[dcs].cache =
- multilist_create(sizeof (dmu_buf_impl_t),
+ multilist_create(&dbuf_caches[dcs].cache,
+ sizeof (dmu_buf_impl_t),
offsetof(dmu_buf_impl_t, db_cache_link),
dbuf_cache_multilist_index_func);
zfs_refcount_create(&dbuf_caches[dcs].size);
@@ -901,7 +901,7 @@ dbuf_fini(void)
for (dbuf_cached_state_t dcs = 0; dcs < DB_CACHE_MAX; dcs++) {
zfs_refcount_destroy(&dbuf_caches[dcs].size);
- multilist_destroy(dbuf_caches[dcs].cache);
+ multilist_destroy(&dbuf_caches[dcs].cache);
}
if (dbuf_ksp != NULL) {
@@ -2757,7 +2757,7 @@ dbuf_destroy(dmu_buf_impl_t *db)
ASSERT(db->db_caching_status == DB_DBUF_CACHE ||
db->db_caching_status == DB_DBUF_METADATA_CACHE);
- multilist_remove(dbuf_caches[db->db_caching_status].cache, db);
+ multilist_remove(&dbuf_caches[db->db_caching_status].cache, db);
(void) zfs_refcount_remove_many(
&dbuf_caches[db->db_caching_status].size,
db->db.db_size, db);
@@ -3467,7 +3467,7 @@ dbuf_hold_impl(dnode_t *dn, uint8_t level, uint64_t blkid,
ASSERT(db->db_caching_status == DB_DBUF_CACHE ||
db->db_caching_status == DB_DBUF_METADATA_CACHE);
- multilist_remove(dbuf_caches[db->db_caching_status].cache, db);
+ multilist_remove(&dbuf_caches[db->db_caching_status].cache, db);
(void) zfs_refcount_remove_many(
&dbuf_caches[db->db_caching_status].size,
db->db.db_size, db);
@@ -3709,7 +3709,7 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag, boolean_t evicting)
DB_DBUF_METADATA_CACHE : DB_DBUF_CACHE;
db->db_caching_status = dcs;
- multilist_insert(dbuf_caches[dcs].cache, db);
+ multilist_insert(&dbuf_caches[dcs].cache, db);
size = zfs_refcount_add_many(
&dbuf_caches[dcs].size,
db->db.db_size, db);
diff --git a/sys/contrib/openzfs/module/zfs/dmu_objset.c b/sys/contrib/openzfs/module/zfs/dmu_objset.c
index bfb4adf262d5..8c244dc4c317 100644
--- a/sys/contrib/openzfs/module/zfs/dmu_objset.c
+++ b/sys/contrib/openzfs/module/zfs/dmu_objset.c
@@ -601,7 +601,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp,
os->os_zil = zil_alloc(os, &os->os_zil_header);
for (i = 0; i < TXG_SIZE; i++) {
- os->os_dirty_dnodes[i] = multilist_create(sizeof (dnode_t),
+ multilist_create(&os->os_dirty_dnodes[i], sizeof (dnode_t),
offsetof(dnode_t, dn_dirty_link[i]),
dnode_multilist_index_func);
}
@@ -995,9 +995,8 @@ dmu_objset_evict_done(objset_t *os)
mutex_destroy(&os->os_obj_lock);
mutex_destroy(&os->os_user_ptr_lock);
mutex_destroy(&os->os_upgrade_lock);
- for (int i = 0; i < TXG_SIZE; i++) {
- multilist_destroy(os->os_dirty_dnodes[i]);
- }
+ for (int i = 0; i < TXG_SIZE; i++)
+ multilist_destroy(&os->os_dirty_dnodes[i]);
spa_evicting_os_deregister(os->os_spa, os);
kmem_free(os, sizeof (objset_t));
}
@@ -1520,7 +1519,7 @@ dmu_objset_sync_dnodes(multilist_sublist_t *list, dmu_tx_t *tx)
* of why this dnode hold is always needed (even when not
* doing user accounting).
*/
- multilist_t *newlist = dn->dn_objset->os_synced_dnodes;
+ multilist_t *newlist = &dn->dn_objset->os_synced_dnodes;
(void) dnode_add_ref(dn, newlist);
multilist_insert(newlist, dn);
@@ -1689,17 +1688,16 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx)
* dn_dirty_link[] of this txg. But it may already
* exist because we call dsl_dataset_sync() twice per txg.
*/
- if (os->os_synced_dnodes == NULL) {
- os->os_synced_dnodes =
- multilist_create(sizeof (dnode_t),
+ if (os->os_synced_dnodes.ml_sublists == NULL) {
+ multilist_create(&os->os_synced_dnodes, sizeof (dnode_t),
offsetof(dnode_t, dn_dirty_link[txgoff]),
dnode_multilist_index_func);
} else {
- ASSERT3U(os->os_synced_dnodes->ml_offset, ==,
+ ASSERT3U(os->os_synced_dnodes.ml_offset, ==,
offsetof(dnode_t, dn_dirty_link[txgoff]));
}
- ml = os->os_dirty_dnodes[txgoff];
+ ml = &os->os_dirty_dnodes[txgoff];
num_sublists = multilist_get_num_sublists(ml);
for (int i = 0; i < num_sublists; i++) {
if (multilist_sublist_is_empty_idx(ml, i))
@@ -1738,7 +1736,7 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx)
boolean_t
dmu_objset_is_dirty(objset_t *os, uint64_t txg)
{
- return (!multilist_is_empty(os->os_dirty_dnodes[txg & TXG_MASK]));
+ return (!multilist_is_empty(&os->os_dirty_dnodes[txg & TXG_MASK]));
}
static file_info_cb_t *file_cbs[DMU_OST_NUMTYPES];
@@ -1949,7 +1947,7 @@ userquota_updates_task(void *arg)
userquota_cache_t cache = { { 0 } };
multilist_sublist_t *list =
- multilist_sublist_lock(os->os_synced_dnodes, uua->uua_sublist_idx);
+ multilist_sublist_lock(&os->os_synced_dnodes, uua->uua_sublist_idx);
ASSERT(multilist_sublist_head(list) == NULL ||
dmu_objset_userused_enabled(os));
@@ -2006,7 +2004,7 @@ userquota_updates_task(void *arg)
mutex_exit(&dn->dn_mtx);
multilist_sublist_remove(list, dn);
- dnode_rele(dn, os->os_synced_dnodes);
+ dnode_rele(dn, &os->os_synced_dnodes);
}
do_userquota_cacheflush(os, &cache, tx);
multilist_sublist_unlock(list);
@@ -2032,12 +2030,12 @@ dnode_rele_task(void *arg)
objset_t *os = uua->uua_os;
multilist_sublist_t *list =
- multilist_sublist_lock(os->os_synced_dnodes, uua->uua_sublist_idx);
+ multilist_sublist_lock(&os->os_synced_dnodes, uua->uua_sublist_idx);
dnode_t *dn;
while ((dn = multilist_sublist_head(list)) != NULL) {
multilist_sublist_remove(list, dn);
- dnode_rele(dn, os->os_synced_dnodes);
+ dnode_rele(dn, &os->os_synced_dnodes);
}
multilist_sublist_unlock(list);
kmem_free(uua, sizeof (*uua));
@@ -2093,7 +2091,7 @@ dmu_objset_sync_done(objset_t *os, dmu_tx_t *tx)
{
boolean_t need_userquota = dmu_objset_do_userquota_updates_prep(os, tx);
- int num_sublists = multilist_get_num_sublists(os->os_synced_dnodes);
+ int num_sublists = multilist_get_num_sublists(&os->os_synced_dnodes);
for (int i = 0; i < num_sublists; i++) {
userquota_updates_arg_t *uua =
kmem_alloc(sizeof (*uua), KM_SLEEP);
diff --git a/sys/contrib/openzfs/module/zfs/dnode.c b/sys/contrib/openzfs/module/zfs/dnode.c
index 0fc788e28fe4..8434e72aa4f8 100644
--- a/sys/contrib/openzfs/module/zfs/dnode.c
+++ b/sys/contrib/openzfs/module/zfs/dnode.c
@@ -1671,7 +1671,7 @@ dnode_setdirty(dnode_t *dn, dmu_tx_t *tx)
*/
dmu_objset_userquota_get_ids(dn, B_TRUE, tx);
- multilist_t *dirtylist = os->os_dirty_dnodes[txg & TXG_MASK];
+ multilist_t *dirtylist = &os->os_dirty_dnodes[txg & TXG_MASK];
multilist_sublist_t *mls = multilist_sublist_lock_obj(dirtylist, dn);
/*
diff --git a/sys/contrib/openzfs/module/zfs/dsl_dataset.c b/sys/contrib/openzfs/module/zfs/dsl_dataset.c
index 6da5faf01edf..9b9bb42287d5 100644
--- a/sys/contrib/openzfs/module/zfs/dsl_dataset.c
+++ b/sys/contrib/openzfs/module/zfs/dsl_dataset.c
@@ -2267,8 +2267,7 @@ dsl_dataset_sync_done(dsl_dataset_t *ds, dmu_tx_t *tx)
dsl_bookmark_sync_done(ds, tx);
- multilist_destroy(os->os_synced_dnodes);
- os->os_synced_dnodes = NULL;
+ multilist_destroy(&os->os_synced_dnodes);
if (os->os_encrypted)
os->os_next_write_raw[tx->tx_txg & TXG_MASK] = B_FALSE;
diff --git a/sys/contrib/openzfs/module/zfs/dsl_deadlist.c b/sys/contrib/openzfs/module/zfs/dsl_deadlist.c
index bad2d56eefdd..a77e381520db 100644
--- a/sys/contrib/openzfs/module/zfs/dsl_deadlist.c
+++ b/sys/contrib/openzfs/module/zfs/dsl_deadlist.c
@@ -909,15 +909,16 @@ dsl_deadlist_move_bpobj(dsl_deadlist_t *dl, bpobj_t *bpo, uint64_t mintxg,
}
typedef struct livelist_entry {
- const blkptr_t *le_bp;
+ blkptr_t le_bp;
+ uint32_t le_refcnt;
avl_node_t le_node;
} livelist_entry_t;
static int
livelist_compare(const void *larg, const void *rarg)
{
- const blkptr_t *l = ((livelist_entry_t *)larg)->le_bp;
- const blkptr_t *r = ((livelist_entry_t *)rarg)->le_bp;
+ const blkptr_t *l = &((livelist_entry_t *)larg)->le_bp;
+ const blkptr_t *r = &((livelist_entry_t *)rarg)->le_bp;
/* Sort them according to dva[0] */
uint64_t l_dva0_vdev = DVA_GET_VDEV(&l->blk_dva[0]);
@@ -944,6 +945,11 @@ struct livelist_iter_arg {
* Expects an AVL tree which is incrementally filled will FREE blkptrs
* and used to match up ALLOC/FREE pairs. ALLOC'd blkptrs without a
* corresponding FREE are stored in the supplied bplist.
+ *
+ * Note that multiple FREE and ALLOC entries for the same blkptr may
+ * be encountered when dedup is involved. For this reason we keep a
+ * refcount for all the FREE entries of each blkptr and ensure that
+ * each of those FREE entries has a corresponding ALLOC preceding it.
*/
static int
dsl_livelist_iterate(void *arg, const blkptr_t *bp, boolean_t bp_freed,
@@ -957,23 +963,47 @@ dsl_livelist_iterate(void *arg, const blkptr_t *bp, boolean_t bp_freed,
if ((t != NULL) && (zthr_has_waiters(t) || zthr_iscancelled(t)))
return (SET_ERROR(EINTR));
+
+ livelist_entry_t node;
+ node.le_bp = *bp;
+ livelist_entry_t *found = avl_find(avl, &node, NULL);
if (bp_freed) {
- livelist_entry_t *node = kmem_alloc(sizeof (livelist_entry_t),
- KM_SLEEP);
- blkptr_t *temp_bp = kmem_alloc(sizeof (blkptr_t), KM_SLEEP);
- *temp_bp = *bp;
- node->le_bp = temp_bp;
- avl_add(avl, node);
- } else {
- livelist_entry_t node;
- node.le_bp = bp;
- livelist_entry_t *found = avl_find(avl, &node, NULL);
- if (found != NULL) {
- avl_remove(avl, found);
- kmem_free((blkptr_t *)found->le_bp, sizeof (blkptr_t));
- kmem_free(found, sizeof (livelist_entry_t));
+ if (found == NULL) {
+ /* first free entry for this blkptr */
+ livelist_entry_t *e =
+ kmem_alloc(sizeof (livelist_entry_t), KM_SLEEP);
+ e->le_bp = *bp;
+ e->le_refcnt = 1;
+ avl_add(avl, e);
} else {
+ /* dedup block free */
+ ASSERT(BP_GET_DEDUP(bp));
+ ASSERT3U(BP_GET_CHECKSUM(bp), ==,
+ BP_GET_CHECKSUM(&found->le_bp));
+ ASSERT3U(found->le_refcnt + 1, >, found->le_refcnt);
+ found->le_refcnt++;
+ }
+ } else {
+ if (found == NULL) {
+ /* block is currently marked as allocated */
bplist_append(to_free, bp);
+ } else {
+ /* alloc matches a free entry */
+ ASSERT3U(found->le_refcnt, !=, 0);
+ found->le_refcnt--;
+ if (found->le_refcnt == 0) {
+ /* all tracked free pairs have been matched */
+ avl_remove(avl, found);
+ kmem_free(found, sizeof (livelist_entry_t));
+ } else {
+ /*
+ * This is definitely a deduped blkptr so
+ * let's validate it.
+ */
+ ASSERT(BP_GET_DEDUP(bp));
+ ASSERT3U(BP_GET_CHECKSUM(bp), ==,
+ BP_GET_CHECKSUM(&found->le_bp));
+ }
}
}
return (0);
@@ -999,6 +1029,7 @@ dsl_process_sub_livelist(bpobj_t *bpobj, bplist_t *to_free, zthr_t *t,
};
int err = bpobj_iterate_nofree(bpobj, dsl_livelist_iterate, &arg, size);
+ VERIFY0(avl_numnodes(&avl));
avl_destroy(&avl);
return (err);
}
diff --git a/sys/contrib/openzfs/module/zfs/dsl_pool.c b/sys/contrib/openzfs/module/zfs/dsl_pool.c
index c770eafa75d8..e66c136a9e02 100644
--- a/sys/contrib/openzfs/module/zfs/dsl_pool.c
+++ b/sys/contrib/openzfs/module/zfs/dsl_pool.c
@@ -568,8 +568,7 @@ dsl_pool_sync_mos(dsl_pool_t *dp, dmu_tx_t *tx)
VERIFY0(zio_wait(zio));
dmu_objset_sync_done(dp->dp_meta_objset, tx);
taskq_wait(dp->dp_sync_taskq);
- multilist_destroy(dp->dp_meta_objset->os_synced_dnodes);
- dp->dp_meta_objset->os_synced_dnodes = NULL;
+ multilist_destroy(&dp->dp_meta_objset->os_synced_dnodes);
dprintf_bp(&dp->dp_meta_rootbp, "meta objset rootbp is %s", "");
spa_set_rootblkptr(dp->dp_spa, &dp->dp_meta_rootbp);
diff --git a/sys/contrib/openzfs/module/zfs/dsl_scan.c b/sys/contrib/openzfs/module/zfs/dsl_scan.c
index cc1cbcdb9778..62ee9bb9ab6c 100644
--- a/sys/contrib/openzfs/module/zfs/dsl_scan.c
+++ b/sys/contrib/openzfs/module/zfs/dsl_scan.c
@@ -126,7 +126,7 @@ static boolean_t scan_ds_queue_contains(dsl_scan_t *scn, uint64_t dsobj,
static void scan_ds_queue_insert(dsl_scan_t *scn, uint64_t dsobj, uint64_t txg);
static void scan_ds_queue_remove(dsl_scan_t *scn, uint64_t dsobj);
static void scan_ds_queue_sync(dsl_scan_t *scn, dmu_tx_t *tx);
-static uint64_t dsl_scan_count_leaves(vdev_t *vd);
+static uint64_t dsl_scan_count_data_disks(vdev_t *vd);
extern int zfs_vdev_async_write_active_min_dirty_percent;
@@ -451,7 +451,7 @@ dsl_scan_init(dsl_pool_t *dp, uint64_t txg)
* phase are done per top-level vdev and are handled separately.
*/
scn->scn_maxinflight_bytes = MAX(zfs_scan_vdev_limit *
- dsl_scan_count_leaves(spa->spa_root_vdev), 1ULL << 20);
+ dsl_scan_count_data_disks(spa->spa_root_vdev), 1ULL << 20);
avl_create(&scn->scn_queue, scan_ds_queue_compare, sizeof (scan_ds_t),
offsetof(scan_ds_t, sds_node));
@@ -2759,22 +2759,16 @@ dsl_scan_visit(dsl_scan_t *scn, dmu_tx_t *tx)
}
static uint64_t
-dsl_scan_count_leaves(vdev_t *vd)
+dsl_scan_count_data_disks(vdev_t *rvd)
{
uint64_t i, leaves = 0;
- /* we only count leaves that belong to the main pool and are readable */
- if (vd->vdev_islog || vd->vdev_isspare ||
- vd->vdev_isl2cache || !vdev_readable(vd))
- return (0);
-
- if (vd->vdev_ops->vdev_op_leaf)
- return (1);
-
- for (i = 0; i < vd->vdev_children; i++) {
- leaves += dsl_scan_count_leaves(vd->vdev_child[i]);
+ for (i = 0; i < rvd->vdev_children; i++) {
+ vdev_t *vd = rvd->vdev_child[i];
+ if (vd->vdev_islog || vd->vdev_isspare || vd->vdev_isl2cache)
+ continue;
+ leaves += vdev_get_ndisks(vd) - vdev_get_nparity(vd);
}
-
return (leaves);
}
@@ -3017,8 +3011,6 @@ scan_io_queues_run_one(void *arg)
range_seg_t *rs = NULL;
scan_io_t *sio = NULL;
list_t sio_list;
- uint64_t bytes_per_leaf = zfs_scan_vdev_limit;
- uint64_t nr_leaves = dsl_scan_count_leaves(queue->q_vd);
ASSERT(queue->q_scn->scn_is_sorted);
@@ -3026,9 +3018,9 @@ scan_io_queues_run_one(void *arg)
offsetof(scan_io_t, sio_nodes.sio_list_node));
mutex_enter(q_lock);
- /* calculate maximum in-flight bytes for this txg (min 1MB) */
- queue->q_maxinflight_bytes =
- MAX(nr_leaves * bytes_per_leaf, 1ULL << 20);
+ /* Calculate maximum in-flight bytes for this vdev. */
+ queue->q_maxinflight_bytes = MAX(1, zfs_scan_vdev_limit *
+ (vdev_get_ndisks(queue->q_vd) - vdev_get_nparity(queue->q_vd)));
/* reset per-queue scan statistics for this txg */
queue->q_total_seg_size_this_txg = 0;
@@ -3665,16 +3657,14 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx)
/* Need to scan metadata for more blocks to scrub */
dsl_scan_phys_t *scnp = &scn->scn_phys;
taskqid_t prefetch_tqid;
- uint64_t bytes_per_leaf = zfs_scan_vdev_limit;
- uint64_t nr_leaves = dsl_scan_count_leaves(spa->spa_root_vdev);
/*
* Recalculate the max number of in-flight bytes for pool-wide
* scanning operations (minimum 1MB). Limits for the issuing
* phase are done per top-level vdev and are handled separately.
*/
- scn->scn_maxinflight_bytes =
- MAX(nr_leaves * bytes_per_leaf, 1ULL << 20);
+ scn->scn_maxinflight_bytes = MAX(zfs_scan_vdev_limit *
+ dsl_scan_count_data_disks(spa->spa_root_vdev), 1ULL << 20);
if (scnp->scn_ddt_bookmark.ddb_class <=
scnp->scn_ddt_class_max) {
@@ -4050,9 +4040,8 @@ scan_exec_io(dsl_pool_t *dp, const blkptr_t *bp, int zio_flags,
size_t size = BP_GET_PSIZE(bp);
abd_t *data = abd_alloc_for_io(size, B_FALSE);
- ASSERT3U(scn->scn_maxinflight_bytes, >, 0);
-
if (queue == NULL) {
+ ASSERT3U(scn->scn_maxinflight_bytes, >, 0);
mutex_enter(&spa->spa_scrub_lock);
while (spa->spa_scrub_inflight >= scn->scn_maxinflight_bytes)
cv_wait(&spa->spa_scrub_io_cv, &spa->spa_scrub_lock);
@@ -4061,6 +4050,7 @@ scan_exec_io(dsl_pool_t *dp, const blkptr_t *bp, int zio_flags,
} else {
kmutex_t *q_lock = &queue->q_vd->vdev_scan_io_queue_lock;
+ ASSERT3U(queue->q_maxinflight_bytes, >, 0);
mutex_enter(q_lock);
while (queue->q_inflight_bytes >= queue->q_maxinflight_bytes)
cv_wait(&queue->q_zio_cv, q_lock);
diff --git a/sys/contrib/openzfs/module/zfs/metaslab.c b/sys/contrib/openzfs/module/zfs/metaslab.c
index 3b2b79b2f42f..e588765b3382 100644
--- a/sys/contrib/openzfs/module/zfs/metaslab.c
+++ b/sys/contrib/openzfs/module/zfs/metaslab.c
@@ -416,7 +416,7 @@ metaslab_class_create(spa_t *spa, metaslab_ops_t *ops)
mc->mc_spa = spa;
mc->mc_ops = ops;
mutex_init(&mc->mc_lock, NULL, MUTEX_DEFAULT, NULL);
- mc->mc_metaslab_txg_list = multilist_create(sizeof (metaslab_t),
+ multilist_create(&mc->mc_metaslab_txg_list, sizeof (metaslab_t),
offsetof(metaslab_t, ms_class_txg_node), metaslab_idx_func);
for (int i = 0; i < spa->spa_alloc_count; i++) {
metaslab_class_allocator_t *mca = &mc->mc_allocator[i];
@@ -443,7 +443,7 @@ metaslab_class_destroy(metaslab_class_t *mc)
zfs_refcount_destroy(&mca->mca_alloc_slots);
}
mutex_destroy(&mc->mc_lock);
- multilist_destroy(mc->mc_metaslab_txg_list);
+ multilist_destroy(&mc->mc_metaslab_txg_list);
kmem_free(mc, offsetof(metaslab_class_t,
mc_allocator[spa->spa_alloc_count]));
}
@@ -639,7 +639,7 @@ metaslab_class_expandable_space(metaslab_class_t *mc)
void
metaslab_class_evict_old(metaslab_class_t *mc, uint64_t txg)
{
- multilist_t *ml = mc->mc_metaslab_txg_list;
+ multilist_t *ml = &mc->mc_metaslab_txg_list;
for (int i = 0; i < multilist_get_num_sublists(ml); i++) {
multilist_sublist_t *mls = multilist_sublist_lock(ml, i);
metaslab_t *msp = multilist_sublist_head(mls);
@@ -1139,7 +1139,7 @@ metaslab_group_remove(metaslab_group_t *mg, metaslab_t *msp)
metaslab_class_t *mc = msp->ms_group->mg_class;
multilist_sublist_t *mls =
- multilist_sublist_lock_obj(mc->mc_metaslab_txg_list, msp);
+ multilist_sublist_lock_obj(&mc->mc_metaslab_txg_list, msp);
if (multilist_link_active(&msp->ms_class_txg_node))
multilist_sublist_remove(mls, msp);
multilist_sublist_unlock(mls);
@@ -2175,20 +2175,20 @@ metaslab_potentially_evict(metaslab_class_t *mc)
uint64_t size = spl_kmem_cache_entry_size(zfs_btree_leaf_cache);
int tries = 0;
for (; allmem * zfs_metaslab_mem_limit / 100 < inuse * size &&
- tries < multilist_get_num_sublists(mc->mc_metaslab_txg_list) * 2;
+ tries < multilist_get_num_sublists(&mc->mc_metaslab_txg_list) * 2;
tries++) {
unsigned int idx = multilist_get_random_index(
- mc->mc_metaslab_txg_list);
+ &mc->mc_metaslab_txg_list);
multilist_sublist_t *mls =
- multilist_sublist_lock(mc->mc_metaslab_txg_list, idx);
+ multilist_sublist_lock(&mc->mc_metaslab_txg_list, idx);
metaslab_t *msp = multilist_sublist_head(mls);
multilist_sublist_unlock(mls);
while (msp != NULL && allmem * zfs_metaslab_mem_limit / 100 <
inuse * size) {
VERIFY3P(mls, ==, multilist_sublist_lock(
- mc->mc_metaslab_txg_list, idx));
+ &mc->mc_metaslab_txg_list, idx));
ASSERT3U(idx, ==,
- metaslab_idx_func(mc->mc_metaslab_txg_list, msp));
+ metaslab_idx_func(&mc->mc_metaslab_txg_list, msp));
if (!multilist_link_active(&msp->ms_class_txg_node)) {
multilist_sublist_unlock(mls);
@@ -2535,7 +2535,7 @@ metaslab_unload(metaslab_t *msp)
if (msp->ms_group != NULL) {
metaslab_class_t *mc = msp->ms_group->mg_class;
multilist_sublist_t *mls =
- multilist_sublist_lock_obj(mc->mc_metaslab_txg_list, msp);
+ multilist_sublist_lock_obj(&mc->mc_metaslab_txg_list, msp);
if (multilist_link_active(&msp->ms_class_txg_node))
multilist_sublist_remove(mls, msp);
multilist_sublist_unlock(mls);
@@ -2600,7 +2600,7 @@ metaslab_set_selected_txg(metaslab_t *msp, uint64_t txg)
ASSERT(MUTEX_HELD(&msp->ms_lock));
metaslab_class_t *mc = msp->ms_group->mg_class;
multilist_sublist_t *mls =
- multilist_sublist_lock_obj(mc->mc_metaslab_txg_list, msp);
+ multilist_sublist_lock_obj(&mc->mc_metaslab_txg_list, msp);
if (multilist_link_active(&msp->ms_class_txg_node))
multilist_sublist_remove(mls, msp);
msp->ms_selected_txg = txg;
@@ -5682,7 +5682,7 @@ metaslab_claim_concrete(vdev_t *vd, uint64_t offset, uint64_t size,
if (spa_writeable(spa)) { /* don't dirty if we're zdb(8) */
metaslab_class_t *mc = msp->ms_group->mg_class;
multilist_sublist_t *mls =
- multilist_sublist_lock_obj(mc->mc_metaslab_txg_list, msp);
+ multilist_sublist_lock_obj(&mc->mc_metaslab_txg_list, msp);
if (!multilist_link_active(&msp->ms_class_txg_node)) {
msp->ms_selected_txg = txg;
multilist_sublist_insert_head(mls, msp);
diff --git a/sys/contrib/openzfs/module/zfs/multilist.c b/sys/contrib/openzfs/module/zfs/multilist.c
index 36c0d33bf1f6..eeac73bd7adf 100644
--- a/sys/contrib/openzfs/module/zfs/multilist.c
+++ b/sys/contrib/openzfs/module/zfs/multilist.c
@@ -68,8 +68,8 @@ multilist_d2l(multilist_t *ml, void *obj)
* requirement, but a general rule of thumb in order to garner the
* best multi-threaded performance out of the data structure.
*/
-static multilist_t *
-multilist_create_impl(size_t size, size_t offset,
+static void
+multilist_create_impl(multilist_t *ml, size_t size, size_t offset,
unsigned int num, multilist_sublist_index_func_t *index_func)
{
ASSERT3U(size, >, 0);
@@ -77,7 +77,6 @@ multilist_create_impl(size_t size, size_t offset,
ASSERT3U(num, >, 0);
ASSERT3P(index_func, !=, NULL);
- multilist_t *ml = kmem_alloc(sizeof (*ml), KM_SLEEP);
ml->ml_offset = offset;
ml->ml_num_sublists = num;
ml->ml_index_func = index_func;
@@ -92,7 +91,6 @@ multilist_create_impl(size_t size, size_t offset,
mutex_init(&mls->mls_lock, NULL, MUTEX_NOLOCKDEP, NULL);
list_create(&mls->mls_list, size, offset);
}
- return (ml);
}
/*
@@ -103,8 +101,8 @@ multilist_create_impl(size_t size, size_t offset,
* reserve the RAM necessary to create the extra slots for additional CPUs up
* front, and dynamically adding them is a complex task.
*/
-multilist_t *
-multilist_create(size_t size, size_t offset,
+void
+multilist_create(multilist_t *ml, size_t size, size_t offset,
multilist_sublist_index_func_t *index_func)
{
int num_sublists;
@@ -115,7 +113,7 @@ multilist_create(size_t size, size_t offset,
num_sublists = MAX(boot_ncpus, 4);
}
- return (multilist_create_impl(size, offset, num_sublists, index_func));
+ multilist_create_impl(ml, size, offset, num_sublists, index_func);
}
/*
@@ -141,7 +139,7 @@ multilist_destroy(multilist_t *ml)
ml->ml_num_sublists = 0;
ml->ml_offset = 0;
- kmem_free(ml, sizeof (multilist_t));
+ ml->ml_sublists = NULL;
}
/*
diff --git a/sys/contrib/openzfs/module/zfs/spa_stats.c b/sys/contrib/openzfs/module/zfs/spa_stats.c
index c3eacc14239e..534ac72fee7b 100644
--- a/sys/contrib/openzfs/module/zfs/spa_stats.c
+++ b/sys/contrib/openzfs/module/zfs/spa_stats.c
@@ -550,54 +550,6 @@ spa_tx_assign_add_nsecs(spa_t *spa, uint64_t nsecs)
/*
* ==========================================================================
- * SPA IO History Routines
- * ==========================================================================
- */
-static int
-spa_io_history_update(kstat_t *ksp, int rw)
-{
- if (rw == KSTAT_WRITE)
- memset(ksp->ks_data, 0, ksp->ks_data_size);
-
- return (0);
-}
-
-static void
-spa_io_history_init(spa_t *spa)
-{
- spa_history_kstat_t *shk = &spa->spa_stats.io_history;
- char *name;
- kstat_t *ksp;
-
- mutex_init(&shk->lock, NULL, MUTEX_DEFAULT, NULL);
-
- name = kmem_asprintf("zfs/%s", spa_name(spa));
-
- ksp = kstat_create(name, 0, "io", "disk", KSTAT_TYPE_IO, 1, 0);
- shk->kstat = ksp;
-
- if (ksp) {
- ksp->ks_lock = &shk->lock;
- ksp->ks_private = spa;
- ksp->ks_update = spa_io_history_update;
- kstat_install(ksp);
- }
- kmem_strfree(name);
-}
-
-static void
-spa_io_history_destroy(spa_t *spa)
-{
- spa_history_kstat_t *shk = &spa->spa_stats.io_history;
-
- if (shk->kstat)
- kstat_delete(shk->kstat);
-
- mutex_destroy(&shk->lock);
-}
-
-/*
- * ==========================================================================
* SPA MMP History Routines
* ==========================================================================
*/
@@ -996,7 +948,6 @@ spa_stats_init(spa_t *spa)
spa_read_history_init(spa);
spa_txg_history_init(spa);
spa_tx_assign_init(spa);
- spa_io_history_init(spa);
spa_mmp_history_init(spa);
spa_state_init(spa);
spa_iostats_init(spa);
@@ -1010,7 +961,6 @@ spa_stats_destroy(spa_t *spa)
spa_tx_assign_destroy(spa);
spa_txg_history_destroy(spa);
spa_read_history_destroy(spa);
- spa_io_history_destroy(spa);
spa_mmp_history_destroy(spa);
}
diff --git a/sys/contrib/openzfs/module/zfs/vdev_queue.c b/sys/contrib/openzfs/module/zfs/vdev_queue.c
index 25a4bc69cc23..198861edb816 100644
--- a/sys/contrib/openzfs/module/zfs/vdev_queue.c
+++ b/sys/contrib/openzfs/module/zfs/vdev_queue.c
@@ -35,8 +35,6 @@
#include <sys/dsl_pool.h>
#include <sys/metaslab_impl.h>
#include <sys/spa.h>
-#include <sys/spa_impl.h>
-#include <sys/kstat.h>
#include <sys/abd.h>
/*
@@ -516,35 +514,17 @@ vdev_queue_fini(vdev_t *vd)
static void
vdev_queue_io_add(vdev_queue_t *vq, zio_t *zio)
{
- spa_t *spa = zio->io_spa;
- spa_history_kstat_t *shk = &spa->spa_stats.io_history;
-
ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE);
avl_add(vdev_queue_class_tree(vq, zio->io_priority), zio);
avl_add(vdev_queue_type_tree(vq, zio->io_type), zio);
-
- if (shk->kstat != NULL) {
- mutex_enter(&shk->lock);
- kstat_waitq_enter(shk->kstat->ks_data);
- mutex_exit(&shk->lock);
- }
}
static void
vdev_queue_io_remove(vdev_queue_t *vq, zio_t *zio)
{
- spa_t *spa = zio->io_spa;
- spa_history_kstat_t *shk = &spa->spa_stats.io_history;
-
ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE);
avl_remove(vdev_queue_class_tree(vq, zio->io_priority), zio);
avl_remove(vdev_queue_type_tree(vq, zio->io_type), zio);
-
- if (shk->kstat != NULL) {
- mutex_enter(&shk->lock);
- kstat_waitq_exit(shk->kstat->ks_data);
- mutex_exit(&shk->lock);
- }
}
static boolean_t
@@ -564,9 +544,6 @@ vdev_queue_is_interactive(zio_priority_t p)
static void
vdev_queue_pending_add(vdev_queue_t *vq, zio_t *zio)
{
- spa_t *spa = zio->io_spa;
- spa_history_kstat_t *shk = &spa->spa_stats.io_history;
-
ASSERT(MUTEX_HELD(&vq->vq_lock));
ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE);
vq->vq_class[zio->io_priority].vqc_active++;
@@ -577,20 +554,11 @@ vdev_queue_pending_add(vdev_queue_t *vq, zio_t *zio)
vq->vq_nia_credit--;
}
avl_add(&vq->vq_active_tree, zio);
-
- if (shk->kstat != NULL) {
- mutex_enter(&shk->lock);
- kstat_runq_enter(shk->kstat->ks_data);
- mutex_exit(&shk->lock);
- }
}
static void
vdev_queue_pending_remove(vdev_queue_t *vq, zio_t *zio)
{
- spa_t *spa = zio->io_spa;
- spa_history_kstat_t *shk = &spa->spa_stats.io_history;
-
ASSERT(MUTEX_HELD(&vq->vq_lock));
ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE);
vq->vq_class[zio->io_priority].vqc_active--;
@@ -602,21 +570,6 @@ vdev_queue_pending_remove(vdev_queue_t *vq, zio_t *zio)
} else if (vq->vq_ia_active == 0)
vq->vq_nia_credit++;
avl_remove(&vq->vq_active_tree, zio);
-
- if (shk->kstat != NULL) {
- kstat_io_t *ksio = shk->kstat->ks_data;
-
- mutex_enter(&shk->lock);
- kstat_runq_exit(ksio);
- if (zio->io_type == ZIO_TYPE_READ) {
- ksio->reads++;
- ksio->nread += zio->io_size;
- } else if (zio->io_type == ZIO_TYPE_WRITE) {
- ksio->writes++;
- ksio->nwritten += zio->io_size;
- }
- mutex_exit(&shk->lock);
- }
}
static void
diff --git a/sys/contrib/openzfs/module/zfs/zfs_ioctl.c b/sys/contrib/openzfs/module/zfs/zfs_ioctl.c
index 7f929df16757..b0eee81bebe9 100644
--- a/sys/contrib/openzfs/module/zfs/zfs_ioctl.c
+++ b/sys/contrib/openzfs/module/zfs/zfs_ioctl.c
@@ -2521,6 +2521,26 @@ zfs_prop_set_special(const char *dsname, zprop_source_t source,
return (err);
}
+static boolean_t
+zfs_is_namespace_prop(zfs_prop_t prop)
+{
+ switch (prop) {
+
+ case ZFS_PROP_ATIME:
+ case ZFS_PROP_RELATIME:
+ case ZFS_PROP_DEVICES:
+ case ZFS_PROP_EXEC:
+ case ZFS_PROP_SETUID:
+ case ZFS_PROP_READONLY:
+ case ZFS_PROP_XATTR:
+ case ZFS_PROP_NBMAND:
+ return (B_TRUE);
+
+ default:
+ return (B_FALSE);
+ }
+}
+
/*
* This function is best effort. If it fails to set any of the given properties,
* it continues to set as many as it can and returns the last error
@@ -2540,6 +2560,7 @@ zfs_set_prop_nvlist(const char *dsname, zprop_source_t source, nvlist_t *nvl,
int rv = 0;
uint64_t intval;
const char *strval;
+ boolean_t should_update_mount_cache = B_FALSE;
nvlist_t *genericnvl = fnvlist_alloc();
nvlist_t *retrynvl = fnvlist_alloc();
@@ -2637,6 +2658,9 @@ retry:
fnvlist_add_int32(errlist, propname, err);
rv = err;
}
+
+ if (zfs_is_namespace_prop(prop))
+ should_update_mount_cache = B_TRUE;
}
if (nvl != retrynvl && !nvlist_empty(retrynvl)) {
@@ -2685,6 +2709,9 @@ retry:
}
}
}
+ if (should_update_mount_cache)
+ zfs_ioctl_update_mount_cache(dsname);
+
nvlist_free(genericnvl);
nvlist_free(retrynvl);
diff --git a/sys/contrib/openzfs/rpm/generic/zfs.spec.in b/sys/contrib/openzfs/rpm/generic/zfs.spec.in
index b1750942f53f..582ce3f9c41f 100644
--- a/sys/contrib/openzfs/rpm/generic/zfs.spec.in
+++ b/sys/contrib/openzfs/rpm/generic/zfs.spec.in
@@ -472,7 +472,9 @@ systemctl --system daemon-reload >/dev/null || true
%{_bindir}/dbufstat
# Man pages
%{_mandir}/man1/*
+%{_mandir}/man4/*
%{_mandir}/man5/*
+%{_mandir}/man7/*
%{_mandir}/man8/*
# Configuration files and scripts
%{_libexecdir}/%{name}
diff --git a/sys/contrib/openzfs/scripts/Makefile.am b/sys/contrib/openzfs/scripts/Makefile.am
index f59826fe6bc8..6c59fd7d4faf 100644
--- a/sys/contrib/openzfs/scripts/Makefile.am
+++ b/sys/contrib/openzfs/scripts/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/config/Shellcheck.am
+
pkgdatadir = $(datadir)/@PACKAGE@
dist_pkgdata_SCRIPTS = \
@@ -7,19 +9,26 @@ dist_pkgdata_SCRIPTS = \
zloop.sh \
zfs-helpers.sh
-EXTRA_DIST = \
+EXTRA_SCRIPTS = \
commitcheck.sh \
common.sh.in \
- cstyle.pl \
dkms.mkconf \
dkms.postbuild \
- enum-extract.pl \
kmodtool \
make_gitrev.sh \
man-dates.sh \
paxcheck.sh \
+ mancheck.sh
+
+EXTRA_DIST = \
+ cstyle.pl \
+ enum-extract.pl \
zfs2zol-patch.sed \
- zol2zfs-patch.sed
+ zol2zfs-patch.sed \
+ $(EXTRA_SCRIPTS)
+
+SHELLCHECK_IGNORE = ,SC1117
+SHELLCHECKSCRIPTS = $(EXTRA_SCRIPTS)
define EXTRA_ENVIRONMENT
diff --git a/sys/contrib/openzfs/scripts/commitcheck.sh b/sys/contrib/openzfs/scripts/commitcheck.sh
index 71cf521666a6..0077eb6b0406 100755
--- a/sys/contrib/openzfs/scripts/commitcheck.sh
+++ b/sys/contrib/openzfs/scripts/commitcheck.sh
@@ -87,9 +87,7 @@ coverity_fix_commit()
IFS='
'
for line in $(git log -n 1 --pretty=%b "$REF" | grep -E '^CID'); do
- echo "$line" | grep -E '^CID [[:digit:]]+: ([[:graph:]]+|[[:space:]])+ \(([[:upper:]]|\_)+\)' > /dev/null
- # shellcheck disable=SC2181
- if [ $? -ne 0 ]; then
+ if ! echo "$line" | grep -qE '^CID [[:digit:]]+: ([[:graph:]]+|[[:space:]])+ \(([[:upper:]]|\_)+\)'; then
echo "error: commit message has an improperly formatted CID defect line"
error=1
fi
diff --git a/sys/contrib/openzfs/scripts/dkms.mkconf b/sys/contrib/openzfs/scripts/dkms.mkconf
index 8649b93183a2..9d12a8c3b3fd 100755
--- a/sys/contrib/openzfs/scripts/dkms.mkconf
+++ b/sys/contrib/openzfs/scripts/dkms.mkconf
@@ -6,19 +6,21 @@ pkgcfg=/etc/sysconfig/zfs
while getopts "n:v:c:f:" opt; do
case $opt in
- n) pkgname=$OPTARG ;;
- v) pkgver=$OPTARG ;;
- c) pkgcfg=$OPTARG ;;
+ n) pkgname=$OPTARG ;;
+ v) pkgver=$OPTARG ;;
+ c) pkgcfg=$OPTARG ;;
f) filename=$OPTARG ;;
+ *) err=1 ;;
esac
done
-if [ -z "${pkgname}" ] || [ -z "${pkgver}" ] || [ -z "${filename}" ]; then
+if [ -z "${pkgname}" ] || [ -z "${pkgver}" ] || [ -z "${filename}" ] ||
+ [ -n "${err}" ]; then
echo "Usage: $PROG -n <pkgname> -v <pkgver> -c <pkgcfg> -f <filename>"
exit 1
fi
-cat >${filename} <<EOF
+exec cat >"${filename}" <<EOF
PACKAGE_NAME="${pkgname}"
PACKAGE_VERSION="${pkgver}"
PACKAGE_CONFIG="${pkgcfg}"
diff --git a/sys/contrib/openzfs/scripts/dkms.postbuild b/sys/contrib/openzfs/scripts/dkms.postbuild
index 81de475877dd..a2ceff64a40b 100755
--- a/sys/contrib/openzfs/scripts/dkms.postbuild
+++ b/sys/contrib/openzfs/scripts/dkms.postbuild
@@ -9,16 +9,17 @@ while getopts "a:k:n:t:v:" opt; do
n) pkgname=$OPTARG ;;
t) tree=$OPTARG ;;
v) pkgver=$OPTARG ;;
+ *) err=1 ;;
esac
done
if [ -z "${arch}" ] || [ -z "${kver}" ] || [ -z "${pkgname}" ] || \
- [ -z "${tree}" ] || [ -z "${pkgver}" ]; then
+ [ -z "${tree}" ] || [ -z "${pkgver}" ] || [ -n "${err}" ]; then
echo "Usage: $PROG -a <arch> -k <kver> -n <pkgname>" \
- "-t <tree> -v <pkgver>"
+ "-t <tree> -v <pkgver>"
exit 1
fi
-cp "${tree}/${pkgname}/${pkgver}/build/zfs_config.h" \
+exec cp "${tree}/${pkgname}/${pkgver}/build/zfs_config.h" \
"${tree}/${pkgname}/${pkgver}/build/module/Module.symvers" \
"${tree}/${pkgname}/${pkgver}/${kver}/${arch}/"
diff --git a/sys/contrib/openzfs/scripts/kmodtool b/sys/contrib/openzfs/scripts/kmodtool
index 35d54bad2ba5..26bacf5991d2 100755
--- a/sys/contrib/openzfs/scripts/kmodtool
+++ b/sys/contrib/openzfs/scripts/kmodtool
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
+# shellcheck disable=SC2086
# kmodtool - Helper script for building kernel module RPMs
# Copyright (c) 2003-2012 Ville Skyttä <ville.skytta@iki.fi>,
@@ -38,15 +39,16 @@ prefix=
filterfile=
target=
buildroot=
+dashvariant=
error_out()
{
local errorlevel=${1}
shift
- echo "Error: $@" >&2
+ echo "Error: $*" >&2
# the next line is not multi-line safe -- not needed *yet*
- echo "%global kmodtool_check echo \"kmodtool error: $@\"; exit ${errorlevel};"
- exit ${errorlevel}
+ echo "%global kmodtool_check echo \"kmodtool error: $*\"; exit ${errorlevel};"
+ exit "${errorlevel}"
}
print_rpmtemplate_header()
@@ -579,7 +581,7 @@ elif [[ ! "${kmodname}" ]]; then
error_out 2 "please pass kmodname with --kmodname"
elif [[ ! "${kernels_known_variants}" ]] ; then
error_out 2 "could not determine known variants"
-elif ( [[ "${obsolete_name}" ]] && [[ ! "${obsolete_version}" ]] ) || ( [[ ! "${obsolete_name}" ]] && [[ "${obsolete_version}" ]] ) ; then
+elif { [[ "${obsolete_name}" ]] && [[ ! "${obsolete_version}" ]]; } || { [[ ! "${obsolete_name}" ]] && [[ "${obsolete_version}" ]]; } ; then
error_out 2 "you need to provide both --obsolete-name and --obsolete-version"
fi
@@ -597,7 +599,7 @@ else
# we need more sanity checks in this case
if [[ ! "${repo}" ]]; then
error_out 2 "please provide repo name with --repo"
- elif ! $(which buildsys-build-${repo}-kerneldevpkgs &> /dev/null) ; then
+ elif ! command -v "buildsys-build-${repo}-kerneldevpkgs" &> /dev/null ; then
error_out 2 "buildsys-build-${repo}-kerneldevpkgs not found"
fi
@@ -611,7 +613,7 @@ else
kernel_versions_to_build_for="$(buildsys-build-${repo}-kerneldevpkgs --${build_kernels} ${cmdoptions})"
returncode=$?
- if (( ${returncode} != 0 )); then
+ if (( returncode != 0 )); then
error_out 2 "buildsys-build-${repo}-kerneldevpkgs failed: $(buildsys-build-${repo}-kerneldevpkgs --${build_kernels} ${cmdoptions})"
fi
diff --git a/sys/contrib/openzfs/scripts/make_gitrev.sh b/sys/contrib/openzfs/scripts/make_gitrev.sh
index f5c743b13799..e7f4ce8844d5 100755
--- a/sys/contrib/openzfs/scripts/make_gitrev.sh
+++ b/sys/contrib/openzfs/scripts/make_gitrev.sh
@@ -50,15 +50,15 @@ esac
ZFS_GITREV=$({ cd "${top_srcdir}" &&
git describe --always --long --dirty 2>/dev/null; } || :)
-if [ "x${ZFS_GITREV}" = x ]
+if [ -z "${ZFS_GITREV}" ]
then
# If the source directory is not a git repository, check if the file
# already exists (in the source)
if [ -f "${top_srcdir}/${GITREV}" ]
then
- ZFS_GITREV="$(sed -n \
+ ZFS_GITREV=$(sed -n \
'1s/^#define[[:blank:]]ZFS_META_GITREV "\([^"]*\)"$/\1/p' \
- "${top_srcdir}/${GITREV}")"
+ "${top_srcdir}/${GITREV}")
fi
elif [ ${dist} = yes ]
then
diff --git a/sys/contrib/openzfs/scripts/man-dates.sh b/sys/contrib/openzfs/scripts/man-dates.sh
index 186d94639a56..39f1b5fb1324 100755
--- a/sys/contrib/openzfs/scripts/man-dates.sh
+++ b/sys/contrib/openzfs/scripts/man-dates.sh
@@ -7,6 +7,6 @@ set -eu
find man -type f | while read -r i ; do
git_date=$(git log -1 --date=short --format="%ad" -- "$i")
- [ "x$git_date" = "x" ] && continue
+ [ -z "$git_date" ] && continue
sed -i "s|^\.Dd.*|.Dd $(date -d "$git_date" "+%B %-d, %Y")|" "$i"
done
diff --git a/sys/contrib/openzfs/scripts/mancheck.sh b/sys/contrib/openzfs/scripts/mancheck.sh
new file mode 100755
index 000000000000..6ae1fc5becff
--- /dev/null
+++ b/sys/contrib/openzfs/scripts/mancheck.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# Permission to use, copy, modify, and/or distribute this software for
+# any purpose with or without fee is hereby granted.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+# AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# shellcheck disable=SC2086
+
+if [ "$#" -eq 0 ]; then
+ echo "Usage: $0 manpage-directory..."
+ exit 1
+fi
+
+if ! command -v mandoc > /dev/null; then
+ echo "skipping mancheck because mandoc is not installed"
+ exit 0
+fi
+
+IFS="
+"
+
+files="$(find "$@" -type f -name '*[1-9]*')" || exit 1
+
+add_excl="$(awk '
+ /^.\\" lint-ok:/ {
+ print "-e"
+ $1 = "mandoc:"
+ $2 = FILENAME ":[[:digit:]]+:[[:digit:]]+:"
+ print
+ }' $files)"
+
+# Redirect to file instead of 2>&1ing because mandoc flushes inconsistently(?) which tears lines
+# https://github.com/openzfs/zfs/pull/12129/checks?check_run_id=2701608671#step:5:3
+etmp="$(mktemp)"
+! { mandoc -Tlint $files 2>"$etmp"; cat "$etmp"; rm -f "$etmp"; } |
+ grep -vE -e 'mandoc: outdated mandoc.db' -e 'STYLE: referenced manual not found' $add_excl >&2
diff --git a/sys/contrib/openzfs/scripts/paxcheck.sh b/sys/contrib/openzfs/scripts/paxcheck.sh
index 87e817500b1b..27acc95364aa 100755
--- a/sys/contrib/openzfs/scripts/paxcheck.sh
+++ b/sys/contrib/openzfs/scripts/paxcheck.sh
@@ -1,7 +1,6 @@
#!/bin/sh
-# shellcheck disable=SC2039
-if ! type scanelf > /dev/null 2>&1; then
+if ! command -v scanelf > /dev/null; then
echo "scanelf (from pax-utils) is required for these checks." >&2
exit 3
fi
diff --git a/sys/contrib/openzfs/scripts/zfs-tests.sh b/sys/contrib/openzfs/scripts/zfs-tests.sh
index 45e08473d35c..edb9c9f106c2 100755
--- a/sys/contrib/openzfs/scripts/zfs-tests.sh
+++ b/sys/contrib/openzfs/scripts/zfs-tests.sh
@@ -355,7 +355,6 @@ while getopts 'hvqxkfScn:d:s:r:?t:T:u:I:' OPTION; do
exit 1
;;
v)
- # shellcheck disable=SC2034
VERBOSE="yes"
;;
q)
diff --git a/sys/contrib/openzfs/scripts/zfs.sh b/sys/contrib/openzfs/scripts/zfs.sh
index 2f5f3f8fdb54..39c49d71e59f 100755
--- a/sys/contrib/openzfs/scripts/zfs.sh
+++ b/sys/contrib/openzfs/scripts/zfs.sh
@@ -120,9 +120,7 @@ load_module_linux() {
echo "Loading: $FILE ($VERSION)"
fi
- $LDMOD "$KMOD" >/dev/null 2>&1
- # shellcheck disable=SC2181
- if [ $? -ne 0 ]; then
+ if ! $LDMOD "$KMOD" >/dev/null 2>&1; then
echo "Failed to load $KMOD"
return 1
fi
diff --git a/sys/contrib/openzfs/scripts/zimport.sh b/sys/contrib/openzfs/scripts/zimport.sh
index 6c3b415ffcd1..0e9c01182b8b 100755
--- a/sys/contrib/openzfs/scripts/zimport.sh
+++ b/sys/contrib/openzfs/scripts/zimport.sh
@@ -164,15 +164,13 @@ populate() {
local MAX_DIR_SIZE=$2
local MAX_FILE_SIZE=$3
- # shellcheck disable=SC2086
- mkdir -p $ROOT/{a,b,c,d,e,f,g}/{h,i}
+ mkdir -p "$ROOT"/{a,b,c,d,e,f,g}/{h,i}
DIRS=$(find "$ROOT")
for DIR in $DIRS; do
COUNT=$((RANDOM % MAX_DIR_SIZE))
- # shellcheck disable=SC2034
- for i in $(seq $COUNT); do
+ for _ in $(seq $COUNT); do
FILE=$(mktemp -p "$DIR")
SIZE=$((RANDOM % MAX_FILE_SIZE))
dd if=/dev/urandom of="$FILE" bs=1k \
@@ -334,9 +332,8 @@ fi
for TAG in $POOL_TAGS; do
if [ "$TAG" = "all" ]; then
- # shellcheck disable=SC2010
- ALL_TAGS=$(ls "$IMAGES_DIR" | grep "tar.bz2" | \
- sed 's/.tar.bz2//' | tr '\n' ' ')
+ ALL_TAGS=$(echo "$IMAGES_DIR"/*.tar.bz2 | \
+ sed "s|$IMAGES_DIR/||g;s|.tar.bz2||g")
NEW_TAGS="$NEW_TAGS $ALL_TAGS"
else
NEW_TAGS="$NEW_TAGS $TAG"
@@ -491,10 +488,8 @@ for TAG in $POOL_TAGS; do
POOL_NAME=$($ZPOOL_CMD import -d "$POOL_DIR_COPY" | \
awk '/pool:/ { print $2; exit 0 }')
- $ZPOOL_CMD import -N -d "$POOL_DIR_COPY" \
- "$POOL_NAME" &>/dev/null
- # shellcheck disable=SC2181
- if [ $? -ne 0 ]; then
+ if ! $ZPOOL_CMD import -N -d "$POOL_DIR_COPY"
+ "$POOL_NAME" &>/dev/null; then
fail_nonewline
ERROR=1
else
diff --git a/sys/contrib/openzfs/scripts/zloop.sh b/sys/contrib/openzfs/scripts/zloop.sh
index bbe326aa07e0..546e7001776d 100755
--- a/sys/contrib/openzfs/scripts/zloop.sh
+++ b/sys/contrib/openzfs/scripts/zloop.sh
@@ -62,11 +62,8 @@ function usage
function or_die
{
# shellcheck disable=SC2068
- $@
- # shellcheck disable=SC2181
- if [[ $? -ne 0 ]]; then
- # shellcheck disable=SC2145
- echo "Command failed: $@"
+ if ! $@; then
+ echo "Command failed: $*"
exit 1
fi
}
@@ -94,8 +91,8 @@ esac
function core_file
{
- # shellcheck disable=SC2012 disable=2086
- printf "%s" "$(ls -tr1 $coreglob 2> /dev/null | head -1)"
+ # shellcheck disable=SC2012,SC2086
+ ls -tr1 $coreglob 2>/dev/null | head -1
}
function core_prog
@@ -103,8 +100,7 @@ function core_prog
prog=$ZTEST
core_id=$($GDB --batch -c "$1" | grep "Core was generated by" | \
tr \' ' ')
- # shellcheck disable=SC2076
- if [[ "$core_id" =~ "zdb " ]]; then
+ if [[ "$core_id" == *"zdb "* ]]; then
prog=$ZDB
fi
printf "%s" "$prog"
@@ -306,8 +302,7 @@ while [[ $timeout -eq 0 ]] || [[ $curtime -le $((starttime + timeout)) ]]; do
zopt="$zopt -s $size"
zopt="$zopt -f $workdir"
- # shellcheck disable=SC2124
- cmd="$ZTEST $zopt $@"
+ cmd="$ZTEST $zopt $*"
desc="$(date '+%m/%d %T') $cmd"
echo "$desc" | tee -a ztest.history
echo "$desc" >>ztest.out
diff --git a/sys/contrib/openzfs/scripts/zol2zfs-patch.sed b/sys/contrib/openzfs/scripts/zol2zfs-patch.sed
index bb6d9faac450..0ca4b6cd6b7e 100755
--- a/sys/contrib/openzfs/scripts/zol2zfs-patch.sed
+++ b/sys/contrib/openzfs/scripts/zol2zfs-patch.sed
@@ -12,7 +12,7 @@ s:lib/libzfs:usr/src/lib/libzfs/common:g
s:lib/libzfs_core:usr/src/lib/libzfs_core/common:g
s:lib/libzpool:lib/libzpool/common:g
s:lib/libzpool:usr/src/lib/libzpool:g
-s:man/man5/zpool-features.5:usr/src/man/man5/zpool-features.5:g
+s:man/man7/zpool-features.7:usr/src/man/man5/zpool-features.5:g
s:man/man8/zfs.8:usr/src/man/man1m/zfs.1m:g
s:module/nvpair:usr/src/common/nvpair:g
s:module/zcommon:usr/src/common/zfs/:g
diff --git a/sys/contrib/openzfs/tests/Makefile.am b/sys/contrib/openzfs/tests/Makefile.am
index f13b19613b01..4bdde9c4508a 100644
--- a/sys/contrib/openzfs/tests/Makefile.am
+++ b/sys/contrib/openzfs/tests/Makefile.am
@@ -1,3 +1,8 @@
+include $(top_srcdir)/config/Shellcheck.am
+
SUBDIRS = runfiles test-runner zfs-tests
EXTRA_DIST = README.md
+
+SHELLCHECKSCRIPTS = $$(find -name '*.sh')
+.PHONY: $(SHELLCHECKSCRIPTS)
diff --git a/sys/contrib/openzfs/tests/runfiles/common.run b/sys/contrib/openzfs/tests/runfiles/common.run
index 703407a7d03d..dd25a55edfd4 100644
--- a/sys/contrib/openzfs/tests/runfiles/common.run
+++ b/sys/contrib/openzfs/tests/runfiles/common.run
@@ -166,8 +166,8 @@ tags = ['functional', 'cli_root', 'zfs_create']
[tests/functional/cli_root/zfs_destroy]
tests = ['zfs_clone_livelist_condense_and_disable',
- 'zfs_clone_livelist_condense_races', 'zfs_destroy_001_pos',
- 'zfs_destroy_002_pos', 'zfs_destroy_003_pos',
+ 'zfs_clone_livelist_condense_races', 'zfs_clone_livelist_dedup',
+ 'zfs_destroy_001_pos', 'zfs_destroy_002_pos', 'zfs_destroy_003_pos',
'zfs_destroy_004_pos', 'zfs_destroy_005_neg', 'zfs_destroy_006_neg',
'zfs_destroy_007_neg', 'zfs_destroy_008_pos', 'zfs_destroy_009_pos',
'zfs_destroy_010_pos', 'zfs_destroy_011_pos', 'zfs_destroy_012_pos',
diff --git a/sys/contrib/openzfs/tests/test-runner/man/test-runner.1 b/sys/contrib/openzfs/tests/test-runner/man/test-runner.1
index 19c636c8cb7c..f7cbcbc5b9e9 100644
--- a/sys/contrib/openzfs/tests/test-runner/man/test-runner.1
+++ b/sys/contrib/openzfs/tests/test-runner/man/test-runner.1
@@ -8,316 +8,255 @@
.\" source. A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
.\"
-.\"
.\" Copyright (c) 2012 by Delphix. All rights reserved.
.\"
-.TH run 1 "23 Sep 2012"
-.SH NAME
-run \- find, execute, and log the results of tests
-.SH SYNOPSIS
-.LP
-.nf
-\fBrun\fR [\fB-dgq] [\fB-o\fR \fIoutputdir\fR] [\fB-pP\fR \fIscript\fR] [\fB-t\fR \fIseconds\fR] [\fB-uxX\fR \fIusername\fR]
- \fIpathname\fR ...
-.fi
-
-.LP
-.nf
-\fBrun\fR \fB-w\fR \fIrunfile\fR [\fB-gq\fR] [\fB-o\fR \fIoutputdir\fR] [\fB-pP\fR \fIscript\fR] [\fB-t\fR \fIseconds\fR]
- [\fB-uxX\fR \fIusername\fR] \fIpathname\fR ...
-.fi
-
-.LP
-.nf
-\fBrun\fR \fB-c\fR \fIrunfile\fR [\fB-dq\fR]
-.fi
-
-.LP
-.nf
-\fBrun\fR [\fB-h\fR]
-.fi
-
-.SH DESCRIPTION
-.sp
-.LP
-The \fBrun\fR command has three basic modes of operation. With neither the
-\fB-c\fR nor the \fB-w\fR option, \fBrun\fR processes the arguments provided on
-the command line, adding them to the list for this run. If a specified
-\fIpathname\fR is an executable file, it is added as a test. If a specified
-\fIpathname\fR is a directory, the behavior depends upon the \fB-g\fR option.
-If \fB-g\fR is specified, the directory is treated as a test group. See the
-section on "Test Groups" below. Without the \fB-g\fR option, \fBrun\fR simply
-descends into the directory looking for executable files. The tests are then
-executed, and the results are logged.
-
-With the \fB-w\fR option, \fBrun\fR finds tests in the manner described above.
+.Dd May 26, 2021
+.Dt RUN 1
+.Os
+.
+.Sh NAME
+.Nm run
+.Nd find, execute, and log the results of tests
+.Sh SYNOPSIS
+.Nm
+.Op Fl dgq
+.Op Fl o Ar outputdir
+.Op Fl pP Ar script
+.Op Fl t seconds
+.Op Fl uxX Ar username
+.Ar pathname Ns No …
+.Pp
+.Nm
+.Fl w Ar runfile
+.Op Fl gq
+.Op Fl o Ar outputdir
+.Op Fl pP Ar script
+.Op Fl t seconds
+.Op Fl uxX Ar username
+.Ar pathname Ns No …
+.Pp
+.Nm
+.Fl c Ar runfile
+.Op Fl dq
+.Pp
+.Nm
+.Op Fl h
+.
+.Sh DESCRIPTION
+.Nm
+command has three basic modes of operation.
+With neither
+.Fl c
+nor
+.Fl w ,
+.Nm
+processes the arguments provided on
+the command line, adding them to the list for this run.
+If a specified
+.Ar pathname
+is an executable file, it is added as a test.
+If a specified
+.Ar pathname
+is a directory, the behavior depends upon the presence of
+.Fl g .
+If
+.Fl g
+is specified, the directory is treated as a test group.
+See the section on
+.Sy Test Groups
+below.
+Without
+.Fl g ,
+.Nm
+simply descends into the directory looking for executable files.
+The tests are then executed, and the results are logged.
+.Pp
+With
+.Fl w ,
+.Nm
+finds tests in the manner described above.
Rather than executing the tests and logging the results, the test configuration
-is stored in a \fIrunfile\fR which can be used in future invocations, or edited
-to modify which tests are executed and which options are applied. Options
-included on the command line with \fB-w\fR become defaults in the
-\fIrunfile\fR.
-
-With the \fB-c\fR option, \fBrun\fR parses a \fIrunfile\fR, which can specify a
-series of tests and test groups to be executed. The tests are then executed,
-and the results are logged.
-.sp
-.SS "Test Groups"
-.sp
-.LP
+is stored in a
+.Ar runfile ,
+which can be used in future invocations, or edited
+to modify which tests are executed and which options are applied.
+Options included on the command line with
+.Fl w
+become defaults in the
+.Ar runfile .
+.Pp
+With
+.Fl c ,
+.Nm
+parses a
+.Ar runfile ,
+which can specify a series of tests and test groups to be executed.
+The tests are then executed, and the results are logged.
+.
+.Ss Test Groups
A test group is comprised of a set of executable files, all of which exist in
-one directory. The options specified on the command line or in a \fIrunfile\fR
-apply to individual tests in the group. The exception is options pertaining to
-pre and post scripts, which act on all tests as a group. Rather than running
-before and after each test, these scripts are run only once each at the start
-and end of the test group.
-.SS "Test Execution"
-.sp
-.LP
+one directory.
+The options specified on the command line or in a
+.Ar runfile
+apply to individual tests in the group.
+The exception is options pertaining to pre and post scripts, which act on all tests as a group.
+Rather than running before and after each test,
+these scripts are run only once each at the start and end of the test group.
+.Ss Test Execution
The specified tests run serially, and are typically assigned results according
-to exit values. Tests that exit zero and non-zero are marked "PASS" and "FAIL"
-respectively. When a pre script fails for a test group, only the post script is
-executed, and the remaining tests are marked "SKIPPED." Any test that exceeds
-its \fItimeout\fR is terminated, and marked "KILLED."
-
-By default, tests are executed with the credentials of the \fBrun\fR script.
-Executing tests with other credentials is done via \fBsudo\fR(1m), which must
-be configured to allow execution without prompting for a password. Environment
-variables from the calling shell are available to individual tests. During test
-execution, the working directory is changed to \fIoutputdir\fR.
-.SS "Output Logging"
-.sp
-.LP
-By default, \fBrun\fR will print one line on standard output at the conclusion
-of each test indicating the test name, result and elapsed time. Additionally,
-for each invocation of \fBrun\fR, a directory is created using the ISO 8601
-date format. Within this directory is a file named \fIlog\fR containing all the
-test output with timestamps, and a directory for each test. Within the test
-directories, there is one file each for standard output, standard error and
-merged output. The default location for the \fIoutputdir\fR is
-\fI/var/tmp/test_results\fR.
-.SS "Runfiles"
-.sp
-.LP
-The \fIrunfile\fR is an ini style configuration file that describes a test run.
-The file has one section named "DEFAULT," which contains configuration option
-names and their values in "name = value" format. The values in this section
-apply to all the subsequent sections, unless they are also specified there, in
-which case the default is overridden. The remaining section names are the
-absolute pathnames of files and directories, describing tests and test groups
-respectively. The legal option names are:
-.sp
-.ne 2
-.na
-\fBoutputdir\fR = \fIpathname\fR
-.ad
-.sp .6
-.RS 4n
+to exit values.
+Tests that exit zero and non-zero are marked
+.Sy PASS
+and
+.Sy FAIL ,
+respectively.
+When a pre script fails for a test group, only the post script is executed,
+and the remaining tests are marked
+.Sy SKIPPED .
+Any test that exceeds
+its
+.Ar timeout
+is terminated, and marked
+.Sy KILLED .
+.Pp
+By default, tests are executed with the credentials of the
+.Nm
+script.
+Executing tests with other credentials is done via
+.Xr sudo 1m ,
+which must
+be configured to allow execution without prompting for a password.
+Environment variables from the calling shell are available to individual tests.
+During test execution, the working directory is changed to
+.Ar outputdir .
+.
+.Ss Output Logging
+By default,
+.Nm
+will print one line on standard output at the conclusion
+of each test indicating the test name, result and elapsed time.
+Additionally, for each invocation of
+.Nm ,
+a directory is created using the ISO 8601 date format.
+Within this directory is a file named
+.Sy log
+containing all the
+test output with timestamps, and a directory for each test.
+Within the test directories, there is one file each for standard output,
+standard error and merged output.
+The default location for the
+.Ar outputdir
+is
+.Pa /var/tmp/test_results .
+.Ss "Runfiles"
+The
+.Ar runfile
+is an INI-style configuration file that describes a test run.
+The file has one section named
+.Sy DEFAULT ,
+which contains configuration option
+names and their values in
+.Sy name No = Ar value
+format.
+The values in this section apply to all the subsequent sections,
+unless they are also specified there, in which case the default is overridden.
+The remaining section names are the absolute pathnames of files and directories,
+describing tests and test groups respectively.
+The legal option names are:
+.Bl -tag -width "tests = ['filename', …]"
+.It Sy outputdir No = Ar pathname
The name of the directory that holds test logs.
-.RE
-.sp
-.ne 2
-.na
-\fBpre\fR = \fIscript\fR
-.ad
-.sp .6
-.RS 4n
-Run \fIscript\fR prior to the test or test group.
-.RE
-.sp
-.ne 2
-.na
-\fBpre_user\fR = \fIusername\fR
-.ad
-.sp .6
-.RS 4n
-Execute the pre script as \fIusername\fR.
-.RE
-.sp
-.ne 2
-.na
-\fBpost\fR = \fIscript\fR
-.ad
-.sp .6
-.RS 4n
-Run \fIscript\fR after the test or test group.
-.RE
-.sp
-.ne 2
-.na
-\fBpost_user\fR = \fIusername\fR
-.ad
-.sp .6
-.RS 4n
-Execute the post script as \fIusername\fR.
-.RE
-.sp
-.ne 2
-.na
-\fBquiet\fR = [\fITrue\fR|\fIFalse\fR]
-.ad
-.sp .6
-.RS 4n
-If set to True, only the results summary is printed to standard out.
-.RE
-.sp
-.ne 2
-.na
-\fBtests\fR = [\fI'filename'\fR [,...]]
-.ad
-.sp .6
-.RS 4n
-Specify a list of \fIfilenames\fR for this test group. Only the basename of the
-absolute path is required. This option is only valid for test groups, and each
-\fIfilename\fR must be single quoted.
-.RE
-.sp
-.ne 2
-.na
-\fBtimeout\fR = \fIn\fR
-.ad
-.sp .6
-.RS 4n
-A timeout value of \fIn\fR seconds.
-.RE
-.sp
-.ne 2
-.na
-\fBuser\fR = \fIusername\fR
-.ad
-.sp .6
-.RS 4n
-Execute the test or test group as \fIusername\fR.
-.RE
-
-.SH OPTIONS
-.sp
-.LP
-The following options are available for the \fBrun\fR command.
-.sp
-.ne 2
-.na
-\fB-c\fR \fIrunfile\fR
-.ad
-.RS 6n
-Specify a \fIrunfile\fR to be consumed by the run command.
-.RE
-
-.ne 2
-.na
-\fB-d\fR
-.ad
-.RS 6n
-Dry run mode. Execute no tests, but print a description of each test that would
-have been run.
-.RE
-
-.ne 2
-.na
-\fB-g\fR
-.ad
-.RS 6n
+.It Sy pre No = Ar script
+Run
+.Ar script
+prior to the test or test group.
+.It Sy pre_user No = Ar username
+Execute the pre script as
+.Ar username .
+.It Sy post No = Ar script
+Run
+.Ar script
+after the test or test group.
+.It Sy post_user No = Ar username
+Execute the post script as
+.Ar username .
+.It Sy quiet No = Sy True Ns | Ns Sy False
+If
+.Sy True ,
+only the results summary is printed to standard out.
+.It Sy tests No = [ Ns Ar 'filename' , No … ]
+Specify a list of
+.Ar filenames
+for this test group.
+Only the basename of the absolute path is required.
+This option is only valid for test groups, and each
+.Ar filename
+must be single quoted.
+.It Sy timeout No = Ar n
+A timeout value of
+.Ar n
+seconds.
+.It Sy user No = Ar username
+Execute the test or test group as
+.Ar username .
+.El
+.
+.Sh OPTIONS
+.Bl -tag -width "-o outputdir"
+.It Fl c Ar runfile
+Specify a
+.Ar runfile
+to be consumed by the run command.
+.It Fl d
+Dry run mode.
+Execute no tests, but print a description of each test that would have been run.
+.It Fl g
Create test groups from any directories found while searching for tests.
-.RE
-
-.ne 2
-.na
-\fB-o\fR \fIoutputdir\fR
-.ad
-.RS 6n
+.It Fl o Ar outputdir
Specify the directory in which to write test results.
-.RE
-
-.ne 2
-.na
-\fB-p\fR \fIscript\fR
-.ad
-.RS 6n
-Run \fIscript\fR prior to any test or test group.
-.RE
-
-.ne 2
-.na
-\fB-P\fR \fIscript\fR
-.ad
-.RS 6n
-Run \fIscript\fR after any test or test group.
-.RE
-
-.ne 2
-.na
-\fB-q\fR
-.ad
-.RS 6n
+.It Fl p Ar script
+Run
+.Ar script
+prior to any test or test group.
+.It Fl P Ar script
+Run
+.Ar script
+after any test or test group.
+.It Fl q
Print only the results summary to the standard output.
-.RE
-
-.ne 2
-.na
-\fB-s\fR \fIscript\fR
-.ad
-.RS 6n
-Run \fIscript\fR as a failsafe after any test is killed.
-.RE
-
-.ne 2
-.na
-\fB-S\fR \fIusername\fR
-.ad
-.RS 6n
-Execute the failsafe script as \fIusername\fR.
-.RE
-
-.ne 2
-.na
-\fB-t\fR \fIn\fR
-.ad
-.RS 6n
-Specify a timeout value of \fIn\fR seconds per test.
-.RE
-
-.ne 2
-.na
-\fB-u\fR \fIusername\fR
-.ad
-.RS 6n
-Execute tests or test groups as \fIusername\fR.
-.RE
-
-.ne 2
-.na
-\fB-w\fR \fIrunfile\fR
-.ad
-.RS 6n
-Specify the name of the \fIrunfile\fR to create.
-.RE
-
-.ne 2
-.na
-\fB-x\fR \fIusername\fR
-.ad
-.RS 6n
-Execute the pre script as \fIusername\fR.
-.RE
-
-.ne 2
-.na
-\fB-X\fR \fIusername\fR
-.ad
-.RS 6n
-Execute the post script as \fIusername\fR.
-.RE
-
-.SH EXAMPLES
-.LP
-\fBExample 1\fR Running ad-hoc tests.
-.sp
-.LP
-This example demonstrates the simplest invocation of \fBrun\fR.
-
-.sp
-.in +2
-.nf
-% \fBrun my-tests\fR
+.It Fl s Ar script
+Run
+.Ar script
+as a failsafe after any test is killed.
+.It Fl S Ar username
+Execute the failsafe script as
+.Ar username .
+.It Fl t Ar n
+Specify a timeout value of
+.Ar n
+seconds per test.
+.It Fl u Ar username
+Execute tests or test groups as
+.Ar username .
+.It Fl w Ar runfile
+Specify the name of the
+.Ar runfile
+to create.
+.It Fl x Ar username
+Execute the pre script as
+.Ar username .
+.It Fl X Ar username
+Execute the post script as
+.Ar username .
+.El
+.
+.Sh EXAMPLES
+.Bl -tag -width "-h"
+.It Sy Example 1 : No Running ad-hoc tests.
+This example demonstrates the simplest invocation of
+.Nm .
+.Bd -literal
+.No % Nm run Ar my-tests
Test: /home/jkennedy/my-tests/test-01 [00:02] [PASS]
Test: /home/jkennedy/my-tests/test-02 [00:04] [PASS]
Test: /home/jkennedy/my-tests/test-03 [00:01] [PASS]
@@ -328,20 +267,14 @@ PASS 3
Running Time: 00:00:07
Percent passed: 100.0%
Log directory: /var/tmp/test_results/20120923T180654
-.fi
-.in -2
-
-.LP
-\fBExample 2\fR Creating a \fIrunfile\fR for future use.
-.sp
-.LP
-This example demonstrates creating a \fIrunfile\fR with non default options.
-
-.sp
-.in +2
-.nf
-% \fBrun -p setup -x root -g -w new-tests.run new-tests\fR
-% \fBcat new-tests.run\fR
+.Ed
+.It Sy Example 2 : No Creating a Ar runfile No for future use.
+This example demonstrates creating a
+.Ar runfile
+with non-default options.
+.Bd -literal
+.No % Nm run Fl p Ar setup Fl x Ar root Fl g Fl w Ar new-tests.run Ar new-tests
+.No % Nm cat Pa new-tests.run
[DEFAULT]
pre = setup
post_user =
@@ -354,33 +287,8 @@ outputdir = /var/tmp/test_results
[/home/jkennedy/new-tests]
tests = ['test-01', 'test-02', 'test-03']
-.fi
-.in -2
-
-.SH EXIT STATUS
-.sp
-.LP
-The following exit values are returned:
-.sp
-.ne 2
-.na
-\fB\fB0\fR\fR
-.ad
-.sp .6
-.RS 4n
-Successful completion.
-.RE
-.sp
-.ne 2
-.na
-\fB\fB1\fR\fR
-.ad
-.sp .6
-.RS 4n
-An error occurred.
-.RE
-
-.SH SEE ALSO
-.sp
-.LP
-\fBsudo\fR(1m)
+.Ed
+.El
+.
+.Sh SEE ALSO
+.Xr sudo 1m
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh
index eeff6575f0f4..4f661262a72d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh
@@ -50,6 +50,7 @@ listing=$(ls -i $init_data)
set -A array $listing
obj=${array[0]}
log_note "file $init_data has object number $obj"
+sync_pool $TESTPOOL
output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \
|grep -m 1 "L0 DVA" |head -n1)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_objset_id.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_objset_id.ksh
index f0c1076c97bd..d23cc43c90ef 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_objset_id.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_objset_id.ksh
@@ -57,6 +57,7 @@ listing=$(ls -i $init_data)
set -A array $listing
obj=${array[0]}
log_note "file $init_data has object number $obj"
+sync_pool $TESTPOOL
output=$(zdb -d $TESTPOOL/$TESTFS)
objset_id=$(echo $output | awk '{split($0,array,",")} END{print array[2]}' |
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_clone_livelist_dedup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_clone_livelist_dedup.ksh
new file mode 100755
index 000000000000..5f356967a457
--- /dev/null
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_clone_livelist_dedup.ksh
@@ -0,0 +1,88 @@
+#!/bin/ksh -p
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright (c) 2021 by Delphix. All rights reserved.
+#
+
+# DESCRIPTION
+# Verify zfs destroy test for clones with livelists that contain
+# dedup blocks. This test is a baseline regression test created
+# to ensure that past bugs that we've encountered between dedup
+# and the livelist logic don't resurface.
+
+# STRATEGY
+# 1. Create a clone from a test filesystem and enable dedup.
+# 2. Write some data and create a livelist.
+# 3. Copy the data within the clone to create dedup blocks.
+# 4. Remove some of the dedup data to create multiple free
+# entries for the same block pointers.
+# 5. Process all the livelist entries by destroying the clone.
+
+. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zfs_destroy/zfs_destroy_common.kshlib
+
+function cleanup
+{
+ log_must zfs destroy -Rf $TESTPOOL/$TESTFS1
+ # Reset the minimum percent shared to 75
+ set_tunable32 LIVELIST_MIN_PERCENT_SHARED $ORIGINAL_MIN_SHARED
+}
+
+function test_dedup
+{
+ # Set a small percent shared threshold so the livelist is not disabled
+ set_tunable32 LIVELIST_MIN_PERCENT_SHARED 10
+ clone_dataset $TESTFS1 snap $TESTCLONE
+
+ # Enable dedup
+ log_must zfs set dedup=on $TESTPOOL/$TESTCLONE
+
+ # Create some data to be deduped
+ log_must dd if=/dev/urandom of="/$TESTPOOL/$TESTCLONE/data" bs=512 count=10k
+
+ # Create dedup blocks
+ # Note: We sync before and after so all dedup blocks belong to the
+ # same TXG, otherwise they won't look identical to the livelist
+ # iterator due to their logical birth TXG being different.
+ log_must zpool sync $TESTPOOL
+ log_must cp /$TESTPOOL/$TESTCLONE/data /$TESTPOOL/$TESTCLONE/data-dup-0
+ log_must cp /$TESTPOOL/$TESTCLONE/data /$TESTPOOL/$TESTCLONE/data-dup-1
+ log_must cp /$TESTPOOL/$TESTCLONE/data /$TESTPOOL/$TESTCLONE/data-dup-2
+ log_must cp /$TESTPOOL/$TESTCLONE/data /$TESTPOOL/$TESTCLONE/data-dup-3
+ log_must zpool sync $TESTPOOL
+ check_livelist_exists $TESTCLONE
+
+ # Introduce "double frees"
+ # We want to introduce consecutive FREEs of the same block as this
+ # was what triggered past panics.
+ # Note: Similarly to the previouys step we sync before and after our
+ # our deletions so all the entries end up in the same TXG.
+ log_must zpool sync $TESTPOOL
+ log_must rm /$TESTPOOL/$TESTCLONE/data-dup-2
+ log_must rm /$TESTPOOL/$TESTCLONE/data-dup-3
+ log_must zpool sync $TESTPOOL
+ check_livelist_exists $TESTCLONE
+
+ log_must zfs destroy $TESTPOOL/$TESTCLONE
+ check_livelist_gone
+}
+
+ORIGINAL_MIN_SHARED=$(get_tunable LIVELIST_MIN_PERCENT_SHARED)
+
+log_onexit cleanup
+log_must zfs create $TESTPOOL/$TESTFS1
+log_must mkfile 5m /$TESTPOOL/$TESTFS1/atestfile
+log_must zfs snapshot $TESTPOOL/$TESTFS1@snap
+test_dedup
+
+log_pass "Clone's livelist processes dedup blocks as expected."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh
index d4194a5b8f5b..595eacf5b4b0 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh
@@ -102,8 +102,7 @@ function do_dup_test
# Read the file a few times to generate some
# duplicate errors of the same blocks
- # shellcheck disable=SC2034
- for i in {1..15}; do
+ for _ in {1..15}; do
dd if=$FILEPATH of=/dev/null bs=128K > /dev/null 2>&1
done
log_must zinject -c all
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh
index 489360d8c523..5d0198c90c16 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh
@@ -84,7 +84,7 @@ log_must zpool import -d $VDIR $TESTPOOL
# from ARC, accessed later on as prefetches and transition to MRU as
# prefetches.
# If accessed again they are counted as MRU and the l2arc_mru_asize arcstat
-# will not be 0 (mentioned also in zfs-module-parameters.5)
+# will not be 0 (mentioned also in zfs.4)
# For the purposes of this test we mitigate this by disabling (predictive)
# ZFS prefetches with zfs_prefetch_disable=1.
log_must test $(get_arcstat l2_mru_asize) -eq 0
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/perf/scripts/prefetch_io.sh b/sys/contrib/openzfs/tests/zfs-tests/tests/perf/scripts/prefetch_io.sh
index b8d8ae8859da..07688ef21b59 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/perf/scripts/prefetch_io.sh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/perf/scripts/prefetch_io.sh
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
+# shellcheck disable=SC1004
#
# This file and its contents are supplied under the terms of the
@@ -24,38 +25,37 @@ zfs_kstats="/proc/spl/kstat/zfs"
function get_prefetch_ios
{
- typeset -l data_misses=`awk '$1 == "prefetch_data_misses" \
- { print $3 }' $zfs_kstats/arcstats`
- typeset -l metadata_misses=`awk '$1 == "prefetch_metadata_misses" \
- { print $3 }' $zfs_kstats/arcstats`
- typeset -l total_misses=$(( $data_misses + $metadata_misses ))
+ typeset -l data_misses="$(awk '$1 == "prefetch_data_misses" \
+ { print $3; exit }' "$zfs_kstats/arcstats")"
+ typeset -l metadata_misses="$(awk '$1 == "prefetch_metadata_misses" \
+ { print $3; exit }' "$zfs_kstats/arcstats")"
+ typeset -l total_misses=$(( data_misses + metadata_misses ))
- echo $total_misses
+ echo "$total_misses"
}
function get_prefetched_demand_reads
{
- typeset -l demand_reads=`awk '$1 == "demand_hit_predictive_prefetch" \
- { print $3 }' $zfs_kstats/arcstats`
+ typeset -l demand_reads="$(awk '$1 == "demand_hit_predictive_prefetch" \
+ { print $3; exit }' "$zfs_kstats/arcstats")"
- echo $demand_reads
+ echo "$demand_reads"
}
function get_async_upgrade_sync
{
- typeset -l sync_wait=`awk '$1 == "async_upgrade_sync" \
- { print $3 }' $zfs_kstats/arcstats`
+ typeset -l sync_wait="$(awk '$1 == "async_upgrade_sync" \
+ { print $3; exit }' "$zfs_kstats/arcstats")"
- echo $sync_wait
+ echo "$sync_wait"
}
if [ $# -ne 2 ]
then
- echo "Usage: `basename $0` <poolname> interval" >&2
+ echo "Usage: ${0##*/} poolname interval" >&2
exit 1
fi
-poolname=$1
interval=$2
prefetch_ios=$(get_prefetch_ios)
prefetched_demand_reads=$(get_prefetched_demand_reads)
@@ -64,19 +64,19 @@ async_upgrade_sync=$(get_async_upgrade_sync)
while true
do
new_prefetch_ios=$(get_prefetch_ios)
- printf "%u\n%-24s\t%u\n" $(date +%s) "prefetch_ios" \
- $(( $new_prefetch_ios - $prefetch_ios ))
+ printf '%u\n%-24s\t%u\n' "$(date +%s)" "prefetch_ios" \
+ $(( new_prefetch_ios - prefetch_ios ))
prefetch_ios=$new_prefetch_ios
new_prefetched_demand_reads=$(get_prefetched_demand_reads)
- printf "%-24s\t%u\n" "prefetched_demand_reads" \
- $(( $new_prefetched_demand_reads - $prefetched_demand_reads ))
+ printf '%-24s\t%u\n' "prefetched_demand_reads" \
+ $(( new_prefetched_demand_reads - prefetched_demand_reads ))
prefetched_demand_reads=$new_prefetched_demand_reads
new_async_upgrade_sync=$(get_async_upgrade_sync)
- printf "%-24s\t%u\n" "async_upgrade_sync" \
- $(( $new_async_upgrade_sync - $async_upgrade_sync ))
+ printf '%-24s\t%u\n' "async_upgrade_sync" \
+ $(( new_async_upgrade_sync - async_upgrade_sync ))
async_upgrade_sync=$new_async_upgrade_sync
- sleep $interval
+ sleep "$interval"
done
diff --git a/sys/contrib/openzfs/udev/rules.d/.gitignore b/sys/contrib/openzfs/udev/rules.d/.gitignore
index e7f7be8f3802..aba25616f5e0 100644
--- a/sys/contrib/openzfs/udev/rules.d/.gitignore
+++ b/sys/contrib/openzfs/udev/rules.d/.gitignore
@@ -1,4 +1 @@
-69-vdev.rules
-60-zpool.rules
-60-zvol.rules
-90-zfs.rules
+*.rules
diff --git a/sys/modules/zfs/zfs_config.h b/sys/modules/zfs/zfs_config.h
index 7e910ef6ec43..aaf35705dbc0 100644
--- a/sys/modules/zfs/zfs_config.h
+++ b/sys/modules/zfs/zfs_config.h
@@ -734,7 +734,7 @@
/* #undef ZFS_IS_GPL_COMPATIBLE */
/* Define the project alias string. */
-#define ZFS_META_ALIAS "zfs-2.1.0-FreeBSD_g7d9f3ef0e"
+#define ZFS_META_ALIAS "zfs-2.1.0-FreeBSD_gc3b60eded"
/* Define the project author. */
#define ZFS_META_AUTHOR "OpenZFS"
@@ -764,7 +764,7 @@
#define ZFS_META_NAME "zfs"
/* Define the project release. */
-#define ZFS_META_RELEASE "FreeBSD_g7d9f3ef0e"
+#define ZFS_META_RELEASE "FreeBSD_gc3b60eded"
/* Define the project version. */
#define ZFS_META_VERSION "2.1.0"