mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Read all disk labels concurrently in vdev_label_read_config
This is similar to what we already do in vdev_geom_read_config. Sponsored by: Axcient Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alan Somers <asomers@gmail.com> Closes #11470
This commit is contained in:
parent
a0e01997ec
commit
67874d5487
@ -754,9 +754,9 @@ vdev_label_read_config(vdev_t *vd, uint64_t txg)
|
||||
{
|
||||
spa_t *spa = vd->vdev_spa;
|
||||
nvlist_t *config = NULL;
|
||||
vdev_phys_t *vp;
|
||||
abd_t *vp_abd;
|
||||
zio_t *zio;
|
||||
vdev_phys_t *vp[VDEV_LABELS];
|
||||
abd_t *vp_abd[VDEV_LABELS];
|
||||
zio_t *zio[VDEV_LABELS];
|
||||
uint64_t best_txg = 0;
|
||||
uint64_t label_txg = 0;
|
||||
int error = 0;
|
||||
@ -776,21 +776,24 @@ vdev_label_read_config(vdev_t *vd, uint64_t txg)
|
||||
if (vd->vdev_ops == &vdev_draid_spare_ops)
|
||||
return (vdev_draid_read_config_spare(vd));
|
||||
|
||||
vp_abd = abd_alloc_linear(sizeof (vdev_phys_t), B_TRUE);
|
||||
vp = abd_to_buf(vp_abd);
|
||||
for (int l = 0; l < VDEV_LABELS; l++) {
|
||||
vp_abd[l] = abd_alloc_linear(sizeof (vdev_phys_t), B_TRUE);
|
||||
vp[l] = abd_to_buf(vp_abd[l]);
|
||||
}
|
||||
|
||||
retry:
|
||||
for (int l = 0; l < VDEV_LABELS; l++) {
|
||||
zio[l] = zio_root(spa, NULL, NULL, flags);
|
||||
|
||||
vdev_label_read(zio[l], vd, l, vp_abd[l],
|
||||
offsetof(vdev_label_t, vl_vdev_phys), sizeof (vdev_phys_t),
|
||||
NULL, NULL, flags);
|
||||
}
|
||||
for (int l = 0; l < VDEV_LABELS; l++) {
|
||||
nvlist_t *label = NULL;
|
||||
|
||||
zio = zio_root(spa, NULL, NULL, flags);
|
||||
|
||||
vdev_label_read(zio, vd, l, vp_abd,
|
||||
offsetof(vdev_label_t, vl_vdev_phys),
|
||||
sizeof (vdev_phys_t), NULL, NULL, flags);
|
||||
|
||||
if (zio_wait(zio) == 0 &&
|
||||
nvlist_unpack(vp->vp_nvlist, sizeof (vp->vp_nvlist),
|
||||
if (zio_wait(zio[l]) == 0 &&
|
||||
nvlist_unpack(vp[l]->vp_nvlist, sizeof (vp[l]->vp_nvlist),
|
||||
&label, 0) == 0) {
|
||||
/*
|
||||
* Auxiliary vdevs won't have txg values in their
|
||||
@ -803,6 +806,8 @@ retry:
|
||||
ZPOOL_CONFIG_POOL_TXG, &label_txg);
|
||||
if ((error || label_txg == 0) && !config) {
|
||||
config = label;
|
||||
for (l++; l < VDEV_LABELS; l++)
|
||||
zio_wait(zio[l]);
|
||||
break;
|
||||
} else if (label_txg <= txg && label_txg > best_txg) {
|
||||
best_txg = label_txg;
|
||||
@ -831,7 +836,9 @@ retry:
|
||||
(u_longlong_t)txg);
|
||||
}
|
||||
|
||||
abd_free(vp_abd);
|
||||
for (int l = 0; l < VDEV_LABELS; l++) {
|
||||
abd_free(vp_abd[l]);
|
||||
}
|
||||
|
||||
return (config);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user