]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Parallelize vdev_load
authorAlan Somers <asomers@FreeBSD.org>
Tue, 12 Jan 2021 00:00:19 +0000 (17:00 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 27 Jan 2021 03:35:59 +0000 (19:35 -0800)
commita0e01997ec013fa24a570a36689235ee6c21d9e1
tree3a4f7e1ad7e950e725b161d432283d22aff26eca
parentdfb44c500e0b05b2e3ff058e6e5cbf2431d4f80b
Parallelize vdev_load

metaslab_init is the slowest part of importing a mature pool, and it
must be repeated hundreds of times for each top-level vdev.  But its
speed is dominated by a few serialized disk accesses.  That can lead to
import times of > 1 hour for pools with many top-level vdevs on spinny
disks.

Speed up the import by using a taskqueue to parallelize vdev_load across
all top-level vdevs.

This also requires adding mutex protection to
metaslab_class_t.mc_historgram.  The mc_histogram fields were
unprotected when that code was first written in "Illumos 4976-4984 -
metaslab improvements" (OpenZFS
f3a7f6610f2df0217ba3b99099019417a954b673).  The lock wasn't added until
3dfb57a35e8cbaa7c424611235d669f3c575ada1, though it's unclear exactly
which fields it's supposed to protect.  In any case, it wasn't until
vdev_load was parallelized that any code attempted concurrent access to
those fields.

Sponsored by: Axcient
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alan Somers <asomers@gmail.com>
Closes #11470
include/sys/vdev_impl.h
module/zfs/metaslab.c
module/zfs/vdev.c