static int vdev_root_open(vdev_t *vd, uint64_t *asize, uint64_t *ashift) { vdev_t *cvd; int c, error; int lasterror = 0; int numerrors = 0; if (vd->vdev_children == 0) { vd->vdev_stat.vs_aux = VDEV_AUX_BAD_LABEL; return (EINVAL); } for (c = 0; c < vd->vdev_children; c++) { cvd = vd->vdev_child[c]; if ((error = vdev_open(cvd)) != 0) { lasterror = error; numerrors++; continue; } } if (too_many_errors(vd, numerrors)) { vd->vdev_stat.vs_aux = VDEV_AUX_NO_REPLICAS; return (lasterror); } *asize = 0; *ashift = 0; return (0); }
static void vdev_root_state_change(vdev_t *vd, int faulted, int degraded) { if (too_many_errors(vd, faulted)) vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_NO_REPLICAS); else if (degraded != 0) vdev_set_state(vd, B_FALSE, VDEV_STATE_DEGRADED, VDEV_AUX_NONE); else vdev_set_state(vd, B_FALSE, VDEV_STATE_HEALTHY, VDEV_AUX_NONE); }
static int vdev_root_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize, uint64_t *ashift) { spa_t *spa = vd->vdev_spa; int lasterror = 0; int numerrors = 0; int c; if (vd->vdev_children == 0) { vd->vdev_stat.vs_aux = VDEV_AUX_BAD_LABEL; return (SET_ERROR(EINVAL)); } vdev_open_children(vd); for (c = 0; c < vd->vdev_children; c++) { vdev_t *cvd = vd->vdev_child[c]; if (cvd->vdev_open_error && !cvd->vdev_islog) { lasterror = cvd->vdev_open_error; numerrors++; } } if (spa_load_state(spa) != SPA_LOAD_NONE) spa_set_missing_tvds(spa, numerrors); if (too_many_errors(vd, numerrors)) { vd->vdev_stat.vs_aux = VDEV_AUX_NO_REPLICAS; return (lasterror); } *asize = 0; *max_asize = 0; *ashift = 0; return (0); }