mirror_zfs/tests/zfs-tests/cmd
George Wilson 619f097693 OpenZFS 9102 - zfs should be able to initialize storage devices
PROBLEM
========

The first access to a block incurs a performance penalty on some platforms
(e.g. AWS's EBS, VMware VMDKs). Therefore we recommend that volumes are
"thick provisioned", where supported by the platform (VMware). This can
create a large delay in getting a new virtual machines up and running (or
adding storage to an existing Engine). If the thick provision step is
omitted, write performance will be suboptimal until all blocks on the LUN
have been written.

SOLUTION
=========

This feature introduces a way to 'initialize' the disks at install or in the
background to make sure we don't incur this first read penalty.

When an entire LUN is added to ZFS, we make all space available immediately,
and allow ZFS to find unallocated space and zero it out. This works with
concurrent writes to arbitrary offsets, ensuring that we don't zero out
something that has been (or is in the middle of being) written. This scheme
can also be applied to existing pools (affecting only free regions on the
vdev). Detailed design:
        - new subcommand:zpool initialize [-cs] <pool> [<vdev> ...]
                - start, suspend, or cancel initialization
        - Creates new open-context thread for each vdev
        - Thread iterates through all metaslabs in this vdev
        - Each metaslab:
                - select a metaslab
                - load the metaslab
                - mark the metaslab as being zeroed
                - walk all free ranges within that metaslab and translate
                  them to ranges on the leaf vdev
                - issue a "zeroing" I/O on the leaf vdev that corresponds to
                  a free range on the metaslab we're working on
                - continue until all free ranges for this metaslab have been
                  "zeroed"
                - reset/unmark the metaslab being zeroed
                - if more metaslabs exist, then repeat above tasks.
                - if no more metaslabs, then we're done.

        - progress for the initialization is stored on-disk in the vdev’s
          leaf zap object. The following information is stored:
                - the last offset that has been initialized
                - the state of the initialization process (i.e. active,
                  suspended, or canceled)
                - the start time for the initialization

        - progress is reported via the zpool status command and shows
          information for each of the vdevs that are initializing

Porting notes:
- Added zfs_initialize_value module parameter to set the pattern
  written by "zpool initialize".
- Added zfs_vdev_{initializing,removal}_{min,max}_active module options.

Authored by: George Wilson <george.wilson@delphix.com>
Reviewed by: John Wren Kennedy <john.kennedy@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: loli10K <ezomori.nozomu@gmail.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Approved by: Richard Lowe <richlowe@richlowe.net>
Signed-off-by: Tim Chase <tim@chase2k.com>
Ported-by: Tim Chase <tim@chase2k.com>

OpenZFS-issue: https://www.illumos.org/issues/9102
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/c3963210eb
Closes #8230
2019-01-07 10:37:26 -08:00
..
chg_usr_exec Add the ZFS Test Suite 2016-03-16 13:46:16 -07:00
devname2devid Fedora 28: Fix misc bounds check compiler warnings 2018-04-04 10:16:47 -07:00
dir_rd_update Use cstyle -cpP in make cstyle check 2016-12-12 10:46:26 -08:00
file_check Add the ZFS Test Suite 2016-03-16 13:46:16 -07:00
file_trunc Enable remaining tests 2017-05-22 12:34:32 -04:00
file_write OpenZFS 4185 - add new cryptographic checksums to ZFS: SHA-512, Skein, Edon-R 2016-10-03 14:51:15 -07:00
largest_file Enable remaining tests 2017-05-22 12:34:32 -04:00
libzfs_input_check OpenZFS 9102 - zfs should be able to initialize storage devices 2019-01-07 10:37:26 -08:00
mkbusy Fedora 28: Fix misc bounds check compiler warnings 2018-04-04 10:16:47 -07:00
mkfile Fix calloc(3) arguments order 2018-04-12 10:50:39 -07:00
mkfiles Add support for user/group dnode accounting & quota 2016-10-07 09:45:13 -07:00
mktree Fedora 28: Fix misc bounds check compiler warnings 2018-04-04 10:16:47 -07:00
mmap_exec Enable remaining tests 2017-05-22 12:34:32 -04:00
mmap_libaio Fix mmap / libaio deadlock 2018-03-28 10:19:22 -07:00
mmapwrite deadlock between mm_sem and tx assign in zfs_write() and page fault 2018-10-16 11:11:24 -07:00
nvlist_to_lua OpenZFS 7431 - ZFS Channel Programs 2018-02-08 15:28:18 -08:00
randfree_file Fix coverity defects: CID 147692, 147693, 147694 2016-10-13 14:38:59 -07:00
randwritecomp OpenZFS 9166 - zfs storage pool checkpoint 2018-06-26 10:07:42 -07:00
readmmap Add the ZFS Test Suite 2016-03-16 13:46:16 -07:00
rename_dir Add the ZFS Test Suite 2016-03-16 13:46:16 -07:00
rm_lnkcnt_zero_file Fix file permissions 2016-10-08 14:57:56 -07:00
threadsappend Add the ZFS Test Suite 2016-03-16 13:46:16 -07:00
user_ns_exec Take user namespaces into account in policy checks 2018-03-07 15:40:42 -08:00
xattrtest Fedora 28: Fix misc bounds check compiler warnings 2018-04-04 10:16:47 -07:00
file_common.h Enable remaining tests 2017-05-22 12:34:32 -04:00
Makefile.am Add basic zfs ioc input nvpair validation 2018-09-02 12:14:01 -07:00