]> git.proxmox.com Git - mirror_zfs.git/commit
OpenZFS 9102 - zfs should be able to initialize storage devices
authorGeorge Wilson <george.wilson@delphix.com>
Wed, 19 Dec 2018 14:54:59 +0000 (07:54 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 7 Jan 2019 18:37:26 +0000 (10:37 -0800)
commit619f09769393d4e0cbaa5f662362138e1c699159
tree6a94855931e5bf9e353270c72fba43316a44baa6
parentc87db591967507de027d6bb0c683ffd09dd70105
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
54 files changed:
cmd/zpool/zpool_main.c
cmd/ztest/ztest.c
configure.ac
include/libzfs.h
include/libzfs_core.h
include/sys/Makefile.am
include/sys/fs/zfs.h
include/sys/metaslab_impl.h
include/sys/spa.h
include/sys/vdev_impl.h
include/sys/vdev_initialize.h [new file with mode: 0644]
include/sys/zio_priority.h
lib/libzfs/libzfs_pool.c
lib/libzfs/libzfs_util.c
lib/libzfs_core/libzfs_core.c
lib/libzpool/Makefile.am
man/man5/zfs-module-parameters.5
man/man8/zpool.8
module/zfs/Makefile.in
module/zfs/metaslab.c
module/zfs/spa.c
module/zfs/spa_misc.c
module/zfs/vdev.c
module/zfs/vdev_disk.c
module/zfs/vdev_file.c
module/zfs/vdev_indirect.c
module/zfs/vdev_initialize.c [new file with mode: 0644]
module/zfs/vdev_mirror.c
module/zfs/vdev_missing.c
module/zfs/vdev_queue.c
module/zfs/vdev_raidz.c
module/zfs/vdev_removal.c
module/zfs/vdev_root.c
module/zfs/zfs_ioctl.c
module/zfs/zfs_sysfs.c
tests/runfiles/linux.run
tests/zfs-tests/cmd/libzfs_input_check/libzfs_input_check.c
tests/zfs-tests/include/commands.cfg
tests/zfs-tests/tests/functional/cli_root/Makefile.am
tests/zfs-tests/tests/functional/cli_root/zpool_clear/zpool_clear_001_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am [new file with mode: 0644]
tests/zfs-tests/tests/functional/cli_root/zpool_initialize/cleanup.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize.kshlib [new file with mode: 0644]
tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_attach_detach_add_remove.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_import_export.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_offline_export_import_online.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_online_offline.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_split.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_start_and_cancel_neg.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_start_and_cancel_pos.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_suspend_resume.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_unsupported_vdevs.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_verify_checksums.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_verify_initialized.ksh [new file with mode: 0755]