MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vdev_open_children_impl

Function vdev_open_children_impl

freebsd/contrib/openzfs/module/zfs/vdev.c:1675–1704  ·  view source on GitHub ↗

* Open the requested child vdevs. If any of the leaf vdevs are using * a ZFS volume then do the opens in a single thread. This avoids a * deadlock when the current thread is holding the spa_namespace_lock. */

Source from the content-addressed store, hash-verified

1673 * deadlock when the current thread is holding the spa_namespace_lock.
1674 */
1675static void
1676vdev_open_children_impl(vdev_t *vd, vdev_open_children_func_t *open_func)
1677{
1678 int children = vd->vdev_children;
1679
1680 taskq_t *tq = taskq_create("vdev_open", children, minclsyspri,
1681 children, children, TASKQ_PREPOPULATE);
1682 vd->vdev_nonrot = B_TRUE;
1683
1684 for (int c = 0; c < children; c++) {
1685 vdev_t *cvd = vd->vdev_child[c];
1686
1687 if (open_func(cvd) == B_FALSE)
1688 continue;
1689
1690 if (tq == NULL || vdev_uses_zvols(vd)) {
1691 cvd->vdev_open_error = vdev_open(cvd);
1692 } else {
1693 VERIFY(taskq_dispatch(tq, vdev_open_child,
1694 cvd, TQ_SLEEP) != TASKQID_INVALID);
1695 }
1696
1697 vd->vdev_nonrot &= cvd->vdev_nonrot;
1698 }
1699
1700 if (tq != NULL) {
1701 taskq_wait(tq);
1702 taskq_destroy(tq);
1703 }
1704}
1705
1706/*
1707 * Open all child vdevs.

Callers 2

vdev_open_childrenFunction · 0.85

Calls 7

vdev_uses_zvolsFunction · 0.85
vdev_openFunction · 0.85
taskq_createFunction · 0.50
open_funcFunction · 0.50
taskq_dispatchFunction · 0.50
taskq_waitFunction · 0.50
taskq_destroyFunction · 0.50

Tested by

no test coverage detected