Reviewed by: John Wren Kennedy <john.kenn...@delphix.com> Reviewed by: Matthew Ahrens <mahr...@delphix.com> Reviewed by: Pavel Zakharov <pavel.zakha...@delphix.com> Reviewed by: Prakash Surya <prakash.su...@delphix.com>
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 videos that are initializing You can view, comment on, or merge this pull request online at: https://github.com/openzfs/openzfs/pull/586 -- Commit Summary -- * 9102 zfs should be able to initialize storage devices -- File Changes -- M usr/src/cmd/truss/codes.c (4) M usr/src/cmd/zpool/zpool_main.c (156) M usr/src/cmd/ztest/ztest.c (98) M usr/src/lib/libzfs/common/libzfs.h (5) M usr/src/lib/libzfs/common/libzfs_pool.c (94) M usr/src/lib/libzfs/common/libzfs_util.c (9) M usr/src/lib/libzfs/common/mapfile-vers (1) M usr/src/lib/libzfs_core/common/libzfs_core.c (37) M usr/src/lib/libzfs_core/common/libzfs_core.h (4) M usr/src/lib/libzfs_core/common/mapfile-vers (6) M usr/src/lib/libzpool/common/llib-lzpool (3) M usr/src/man/man1m/zpool.1m (31) M usr/src/pkg/manifests/system-test-zfstest.mf (39) M usr/src/test/zfs-tests/include/commands.cfg (1) M usr/src/test/zfs-tests/runfiles/delphix.run (13) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile (21) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_initialize/cleanup.ksh (31) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize.kshlib (43) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_attach_detach_add_remove.ksh (68) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_import_export.ksh (78) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_offline_export_import_online.ksh (66) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_online_offline.ksh (74) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_split.ksh (64) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_start_and_cancel_neg.ksh (60) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_start_and_cancel_pos.ksh (52) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_suspend_resume.ksh (63) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_unsupported_vdevs.ksh (74) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_verify_checksums.ksh (59) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_verify_initialized.ksh (88) M usr/src/uts/common/Makefile.files (1) M usr/src/uts/common/fs/zfs/metaslab.c (36) M usr/src/uts/common/fs/zfs/spa.c (158) M usr/src/uts/common/fs/zfs/spa_misc.c (7) M usr/src/uts/common/fs/zfs/sys/metaslab_impl.h (12) M usr/src/uts/common/fs/zfs/sys/range_tree.h (2) M usr/src/uts/common/fs/zfs/sys/spa.h (2) M usr/src/uts/common/fs/zfs/sys/vdev_impl.h (33) A usr/src/uts/common/fs/zfs/sys/vdev_initialize.h (46) M usr/src/uts/common/fs/zfs/sys/zio_priority.h (3) M usr/src/uts/common/fs/zfs/vdev.c (44) M usr/src/uts/common/fs/zfs/vdev_disk.c (1) M usr/src/uts/common/fs/zfs/vdev_file.c (4) M usr/src/uts/common/fs/zfs/vdev_indirect.c (1) A usr/src/uts/common/fs/zfs/vdev_initialize.c (790) M usr/src/uts/common/fs/zfs/vdev_mirror.c (5) M usr/src/uts/common/fs/zfs/vdev_missing.c (4) M usr/src/uts/common/fs/zfs/vdev_queue.c (16) M usr/src/uts/common/fs/zfs/vdev_raidz.c (75) M usr/src/uts/common/fs/zfs/vdev_removal.c (17) M usr/src/uts/common/fs/zfs/vdev_root.c (3) M usr/src/uts/common/fs/zfs/zfs_ioctl.c (80) M usr/src/uts/common/sys/fs/zfs.h (35) -- Patch Links -- https://github.com/openzfs/openzfs/pull/586.patch https://github.com/openzfs/openzfs/pull/586.diff -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/openzfs/openzfs/pull/586 ------------------------------------------ openzfs: openzfs-developer Permalink: https://openzfs.topicbox.com/groups/developer/discussions/T6777d2c2033b2134-Mf6840b2308522a2620a5a2f5 Delivery options: https://openzfs.topicbox.com/groups