2165 }
2166 }
2167
2168 done:
2169 zio_checksum_verified(zio);
2170
2171 if (zio->io_error == 0 && spa_writeable(zio->io_spa) &&
2172 (unexpected_errors || (zio->io_flags & ZIO_FLAG_RESILVER))) {
2173 /*
2174 * Use the good data we have in hand to repair damaged children.
2175 */
2176 for (c = 0; c < rm->rm_cols; c++) {
2177 rc = &rm->rm_col[c];
2178 cvd = vd->vdev_child[rc->rc_devidx];
2179
2180 if (rc->rc_error == 0)
2181 continue;
2182
2183 zio_nowait(zio_vdev_child_io(zio, NULL, cvd,
2184 rc->rc_offset, rc->rc_data, rc->rc_size,
2185 ZIO_TYPE_WRITE, zio->io_priority,
2186 ZIO_FLAG_IO_REPAIR | (unexpected_errors ?
2187 ZIO_FLAG_SELF_HEAL : 0), NULL, NULL));
2188 }
2189 }
2190 }
2191
2192 static void
2193 vdev_raidz_state_change(vdev_t *vd, int faulted, int degraded)
2194 {
2195 if (faulted > vd->vdev_nparity)
2196 vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN,
2197 VDEV_AUX_NO_REPLICAS);
2198 else if (degraded + faulted != 0)
2199 vdev_set_state(vd, B_FALSE, VDEV_STATE_DEGRADED, VDEV_AUX_NONE);
2200 else
2201 vdev_set_state(vd, B_FALSE, VDEV_STATE_HEALTHY, VDEV_AUX_NONE);
2202 }
2203
2204 vdev_ops_t vdev_raidz_ops = {
2205 vdev_raidz_open,
|
2165 }
2166 }
2167
2168 done:
2169 zio_checksum_verified(zio);
2170
2171 if (zio->io_error == 0 && spa_writeable(zio->io_spa) &&
2172 (unexpected_errors || (zio->io_flags & ZIO_FLAG_RESILVER))) {
2173 /*
2174 * Use the good data we have in hand to repair damaged children.
2175 */
2176 for (c = 0; c < rm->rm_cols; c++) {
2177 rc = &rm->rm_col[c];
2178 cvd = vd->vdev_child[rc->rc_devidx];
2179
2180 if (rc->rc_error == 0)
2181 continue;
2182
2183 zio_nowait(zio_vdev_child_io(zio, NULL, cvd,
2184 rc->rc_offset, rc->rc_data, rc->rc_size,
2185 ZIO_TYPE_WRITE, ZIO_PRIORITY_ASYNC_WRITE,
2186 ZIO_FLAG_IO_REPAIR | (unexpected_errors ?
2187 ZIO_FLAG_SELF_HEAL : 0), NULL, NULL));
2188 }
2189 }
2190 }
2191
2192 static void
2193 vdev_raidz_state_change(vdev_t *vd, int faulted, int degraded)
2194 {
2195 if (faulted > vd->vdev_nparity)
2196 vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN,
2197 VDEV_AUX_NO_REPLICAS);
2198 else if (degraded + faulted != 0)
2199 vdev_set_state(vd, B_FALSE, VDEV_STATE_DEGRADED, VDEV_AUX_NONE);
2200 else
2201 vdev_set_state(vd, B_FALSE, VDEV_STATE_HEALTHY, VDEV_AUX_NONE);
2202 }
2203
2204 vdev_ops_t vdev_raidz_ops = {
2205 vdev_raidz_open,
|