Illumos 5269 - zpool import slow

5269 zpool import slow
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Dan McDonald <danmcd@omniti.com>

References:
  https://www.illumos.org/issues/5269
  https://github.com/illumos/illumos-gate/commit/12380e1e

Ported-by: DHE <git@dehacked.net>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3396
This commit is contained in:
Arne Jansen
2015-05-06 09:07:55 -07:00
committed by Brian Behlendorf
parent d050c627b5
commit 9c43027b3f
10 changed files with 240 additions and 60 deletions
+21
View File
@@ -179,6 +179,27 @@ vdev_lookup_by_guid(vdev_t *vd, uint64_t guid)
return (NULL);
}
static int
vdev_count_leaves_impl(vdev_t *vd)
{
int n = 0;
int c;
if (vd->vdev_ops->vdev_op_leaf)
return (1);
for (c = 0; c < vd->vdev_children; c++)
n += vdev_count_leaves_impl(vd->vdev_child[c]);
return (n);
}
int
vdev_count_leaves(spa_t *spa)
{
return (vdev_count_leaves_impl(spa->spa_root_vdev));
}
void
vdev_add_child(vdev_t *pvd, vdev_t *cvd)
{