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

Function vdev_mirror_io_done

freebsd/contrib/openzfs/module/zfs/vdev_mirror.c:718–848  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

716}
717
718static void
719vdev_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.

Callers

nothing calls this directly

Calls 7

vdev_mirror_worst_errorFunction · 0.85
vdev_mirror_child_selectFunction · 0.85
zio_vdev_io_redoneFunction · 0.85
zio_nowaitFunction · 0.85
zio_vdev_child_ioFunction · 0.85
spa_writeableFunction · 0.85
vdev_dtl_containsFunction · 0.85

Tested by

no test coverage detected