* Issue an I/O to the underlying vdev. Typically the issue pipeline * stops after this stage and will resume upon I/O completion. * However, there are instances where the vdev layer may need to * continue the pipeline when an I/O was not issued. Since the I/O * that was sent to the vdev layer might be different than the one * currently active in the pipeline (see vdev_queue_io()), we explicit
| 3684 | * zio_interrupt() to ensure that the pipeline continues with the correct I/O. |
| 3685 | */ |
| 3686 | static zio_t * |
| 3687 | zio_vdev_io_start(zio_t *zio) |
| 3688 | { |
| 3689 | vdev_t *vd = zio->io_vd; |
| 3690 | uint64_t align; |
| 3691 | spa_t *spa = zio->io_spa; |
| 3692 | |
| 3693 | zio->io_delay = 0; |
| 3694 | |
| 3695 | ASSERT(zio->io_error == 0); |
| 3696 | ASSERT(zio->io_child_error[ZIO_CHILD_VDEV] == 0); |
| 3697 | |
| 3698 | if (vd == NULL) { |
| 3699 | if (!(zio->io_flags & ZIO_FLAG_CONFIG_WRITER)) |
| 3700 | spa_config_enter(spa, SCL_ZIO, zio, RW_READER); |
| 3701 | |
| 3702 | /* |
| 3703 | * The mirror_ops handle multiple DVAs in a single BP. |
| 3704 | */ |
| 3705 | vdev_mirror_ops.vdev_op_io_start(zio); |
| 3706 | return (NULL); |
| 3707 | } |
| 3708 | |
| 3709 | ASSERT3P(zio->io_logical, !=, zio); |
| 3710 | if (zio->io_type == ZIO_TYPE_WRITE) { |
| 3711 | ASSERT(spa->spa_trust_config); |
| 3712 | |
| 3713 | /* |
| 3714 | * Note: the code can handle other kinds of writes, |
| 3715 | * but we don't expect them. |
| 3716 | */ |
| 3717 | if (zio->io_vd->vdev_removing) { |
| 3718 | ASSERT(zio->io_flags & |
| 3719 | (ZIO_FLAG_PHYSICAL | ZIO_FLAG_SELF_HEAL | |
| 3720 | ZIO_FLAG_RESILVER | ZIO_FLAG_INDUCE_DAMAGE)); |
| 3721 | } |
| 3722 | } |
| 3723 | |
| 3724 | align = 1ULL << vd->vdev_top->vdev_ashift; |
| 3725 | |
| 3726 | if (!(zio->io_flags & ZIO_FLAG_PHYSICAL) && |
| 3727 | P2PHASE(zio->io_size, align) != 0) { |
| 3728 | /* Transform logical writes to be a full physical block size. */ |
| 3729 | uint64_t asize = P2ROUNDUP(zio->io_size, align); |
| 3730 | abd_t *abuf = abd_alloc_sametype(zio->io_abd, asize); |
| 3731 | ASSERT(vd == vd->vdev_top); |
| 3732 | if (zio->io_type == ZIO_TYPE_WRITE) { |
| 3733 | abd_copy(abuf, zio->io_abd, zio->io_size); |
| 3734 | abd_zero_off(abuf, zio->io_size, asize - zio->io_size); |
| 3735 | } |
| 3736 | zio_push_transform(zio, abuf, asize, asize, zio_subblock); |
| 3737 | } |
| 3738 | |
| 3739 | /* |
| 3740 | * If this is not a physical io, make sure that it is properly aligned |
| 3741 | * before proceeding. |
| 3742 | */ |
| 3743 | if (!(zio->io_flags & ZIO_FLAG_PHYSICAL)) { |
nothing calls this directly
no test coverage detected