415 * Not only is it unnecessary, it could
416 * actually be harmful: if the system lost
417 * power while rewriting the only good copy,
418 * there would be no good copies left!
419 */
420 mc = &mm->mm_child[c];
421
422 if (mc->mc_error == 0) {
423 if (mc->mc_tried)
424 continue;
425 if (!(zio->io_flags & ZIO_FLAG_SCRUB) &&
426 !vdev_dtl_contains(mc->mc_vd, DTL_PARTIAL,
427 zio->io_txg, 1))
428 continue;
429 mc->mc_error = SET_ERROR(ESTALE);
430 }
431
432 zio_nowait(zio_vdev_child_io(zio, zio->io_bp,
433 mc->mc_vd, mc->mc_offset,
434 zio->io_data, zio->io_size,
435 ZIO_TYPE_WRITE, zio->io_priority,
436 ZIO_FLAG_IO_REPAIR | (unexpected_errors ?
437 ZIO_FLAG_SELF_HEAL : 0), NULL, NULL));
438 }
439 }
440 }
441
442 static void
443 vdev_mirror_state_change(vdev_t *vd, int faulted, int degraded)
444 {
445 if (faulted == vd->vdev_children)
446 vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN,
447 VDEV_AUX_NO_REPLICAS);
448 else if (degraded + faulted != 0)
449 vdev_set_state(vd, B_FALSE, VDEV_STATE_DEGRADED, VDEV_AUX_NONE);
450 else
451 vdev_set_state(vd, B_FALSE, VDEV_STATE_HEALTHY, VDEV_AUX_NONE);
452 }
453
454 vdev_ops_t vdev_mirror_ops = {
455 vdev_mirror_open,
|
415 * Not only is it unnecessary, it could
416 * actually be harmful: if the system lost
417 * power while rewriting the only good copy,
418 * there would be no good copies left!
419 */
420 mc = &mm->mm_child[c];
421
422 if (mc->mc_error == 0) {
423 if (mc->mc_tried)
424 continue;
425 if (!(zio->io_flags & ZIO_FLAG_SCRUB) &&
426 !vdev_dtl_contains(mc->mc_vd, DTL_PARTIAL,
427 zio->io_txg, 1))
428 continue;
429 mc->mc_error = SET_ERROR(ESTALE);
430 }
431
432 zio_nowait(zio_vdev_child_io(zio, zio->io_bp,
433 mc->mc_vd, mc->mc_offset,
434 zio->io_data, zio->io_size,
435 ZIO_TYPE_WRITE, ZIO_PRIORITY_ASYNC_WRITE,
436 ZIO_FLAG_IO_REPAIR | (unexpected_errors ?
437 ZIO_FLAG_SELF_HEAL : 0), NULL, NULL));
438 }
439 }
440 }
441
442 static void
443 vdev_mirror_state_change(vdev_t *vd, int faulted, int degraded)
444 {
445 if (faulted == vd->vdev_children)
446 vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN,
447 VDEV_AUX_NO_REPLICAS);
448 else if (degraded + faulted != 0)
449 vdev_set_state(vd, B_FALSE, VDEV_STATE_DEGRADED, VDEV_AUX_NONE);
450 else
451 vdev_set_state(vd, B_FALSE, VDEV_STATE_HEALTHY, VDEV_AUX_NONE);
452 }
453
454 vdev_ops_t vdev_mirror_ops = {
455 vdev_mirror_open,
|