mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 11:18:52 +03:00
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
This commit is contained in:
committed by
Brian Behlendorf
parent
c87db59196
commit
619f097693
@@ -1372,6 +1372,30 @@ further increasing latency.
|
||||
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
|
||||
@@ -1385,6 +1409,30 @@ queue's min_active. See the section "ZFS I/O SCHEDULER".
|
||||
Default value: \fB1,000\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
|
||||
@@ -1612,6 +1660,17 @@ dataset being written to had the property setting \fBlogbias=throughput\fR.
|
||||
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
|
||||
|
||||
@@ -115,6 +115,11 @@
|
||||
.Ar pool Ns | Ns Ar id
|
||||
.Op Ar newpool Oo Fl t Oc
|
||||
.Nm
|
||||
.Cm initialize
|
||||
.Op Fl cs
|
||||
.Ar pool
|
||||
.Op Ar device Ns ...
|
||||
.Nm
|
||||
.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
|
||||
@@ -1597,6 +1602,32 @@ Will also set -o cachefile=none when not explicitly specified.
|
||||
.El
|
||||
.It Xo
|
||||
.Nm
|
||||
.Cm initialize
|
||||
.Op Fl cs
|
||||
.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
|
||||
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
|
||||
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
|
||||
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.
|
||||
.El
|
||||
.It Xo
|
||||
.Nm
|
||||
.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
|
||||
|
||||
Reference in New Issue
Block a user