Print this page
zpool import speedup
@@ -170,10 +170,31 @@
return (mvd);
return (NULL);
}
+int
+vdev_count_leaves_impl(vdev_t *vd)
+{
+ vdev_t *mvd;
+ int n = 0;
+
+ if (vd->vdev_children == 0)
+ return (1);
+
+ for (int 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)
{
size_t oldsize, newsize;
uint64_t id = cvd->vdev_id;