| 716 | } |
| 717 | |
| 718 | static void |
| 719 | vdev_mirror_io_done(zio_t *zio) |
| 720 | { |
| 721 | mirror_map_t *mm = zio->io_vsd; |
| 722 | mirror_child_t *mc; |
| 723 | int c; |
| 724 | int good_copies = 0; |
| 725 | int unexpected_errors = 0; |
| 726 | |
| 727 | if (mm == NULL) |
| 728 | return; |
| 729 | |
| 730 | for (c = 0; c < mm->mm_children; c++) { |
| 731 | mc = &mm->mm_child[c]; |
| 732 | |
| 733 | if (mc->mc_error) { |
| 734 | if (!mc->mc_skipped) |
| 735 | unexpected_errors++; |
| 736 | } else if (mc->mc_tried) { |
| 737 | good_copies++; |
| 738 | } |
| 739 | } |
| 740 | |
| 741 | if (zio->io_type == ZIO_TYPE_WRITE) { |
| 742 | /* |
| 743 | * XXX -- for now, treat partial writes as success. |
| 744 | * |
| 745 | * Now that we support write reallocation, it would be better |
| 746 | * to treat partial failure as real failure unless there are |
| 747 | * no non-degraded top-level vdevs left, and not update DTLs |
| 748 | * if we intend to reallocate. |
| 749 | */ |
| 750 | /* XXPOLICY */ |
| 751 | if (good_copies != mm->mm_children) { |
| 752 | /* |
| 753 | * Always require at least one good copy. |
| 754 | * |
| 755 | * For ditto blocks (io_vd == NULL), require |
| 756 | * all copies to be good. |
| 757 | * |
| 758 | * XXX -- for replacing vdevs, there's no great answer. |
| 759 | * If the old device is really dead, we may not even |
| 760 | * be able to access it -- so we only want to |
| 761 | * require good writes to the new device. But if |
| 762 | * the new device turns out to be flaky, we want |
| 763 | * to be able to detach it -- which requires all |
| 764 | * writes to the old device to have succeeded. |
| 765 | */ |
| 766 | if (good_copies == 0 || zio->io_vd == NULL) |
| 767 | zio->io_error = vdev_mirror_worst_error(mm); |
| 768 | } |
| 769 | return; |
| 770 | } |
| 771 | |
| 772 | ASSERT(zio->io_type == ZIO_TYPE_READ); |
| 773 | |
| 774 | /* |
| 775 | * If we don't have a good copy yet, keep trying other children. |
nothing calls this directly
no test coverage detected