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

Function vdev_mirror_io_start

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

Source from the content-addressed store, hash-verified

622}
623
624static void
625vdev_mirror_io_start(zio_t *zio)
626{
627 mirror_map_t *mm;
628 mirror_child_t *mc;
629 int c, children;
630
631 mm = vdev_mirror_map_init(zio);
632
633 if (mm == NULL) {
634 ASSERT(!spa_trust_config(zio->io_spa));
635 ASSERT(zio->io_type == ZIO_TYPE_READ);
636 zio_execute(zio);
637 return;
638 }
639
640 if (zio->io_type == ZIO_TYPE_READ) {
641 if (zio->io_bp != NULL &&
642 (zio->io_flags & ZIO_FLAG_SCRUB) && !mm->mm_resilvering) {
643 /*
644 * For scrubbing reads (if we can verify the
645 * checksum here, as indicated by io_bp being
646 * non-NULL) we need to allocate a read buffer for
647 * each child and issue reads to all children. If
648 * any child succeeds, it will copy its data into
649 * zio->io_data in vdev_mirror_scrub_done.
650 */
651 for (c = 0; c < mm->mm_children; c++) {
652 mc = &mm->mm_child[c];
653 zio_nowait(zio_vdev_child_io(zio, zio->io_bp,
654 mc->mc_vd, mc->mc_offset,
655 abd_alloc_sametype(zio->io_abd,
656 zio->io_size), zio->io_size,
657 zio->io_type, zio->io_priority, 0,
658 vdev_mirror_scrub_done, mc));
659 }
660 zio_execute(zio);
661 return;
662 }
663 /*
664 * For normal reads just pick one child.
665 */
666 c = vdev_mirror_child_select(zio);
667 children = (c >= 0);
668 } else {
669 ASSERT(zio->io_type == ZIO_TYPE_WRITE);
670
671 /*
672 * Writes go to all children.
673 */
674 c = 0;
675 children = mm->mm_children;
676 }
677
678 while (children--) {
679 mc = &mm->mm_child[c];
680 c++;
681

Callers

nothing calls this directly

Calls 7

vdev_mirror_map_initFunction · 0.85
spa_trust_configFunction · 0.85
zio_executeFunction · 0.85
zio_nowaitFunction · 0.85
zio_vdev_child_ioFunction · 0.85
abd_alloc_sametypeFunction · 0.85
vdev_mirror_child_selectFunction · 0.85

Tested by

no test coverage detected