| 4456 | } |
| 4457 | |
| 4458 | static zio_t * |
| 4459 | zio_done(zio_t *zio) |
| 4460 | { |
| 4461 | /* |
| 4462 | * Always attempt to keep stack usage minimal here since |
| 4463 | * we can be called recursively up to 19 levels deep. |
| 4464 | */ |
| 4465 | const uint64_t psize = zio->io_size; |
| 4466 | zio_t *pio, *pio_next; |
| 4467 | zio_link_t *zl = NULL; |
| 4468 | |
| 4469 | /* |
| 4470 | * If our children haven't all completed, |
| 4471 | * wait for them and then repeat this pipeline stage. |
| 4472 | */ |
| 4473 | if (zio_wait_for_children(zio, ZIO_CHILD_ALL_BITS, ZIO_WAIT_DONE)) { |
| 4474 | return (NULL); |
| 4475 | } |
| 4476 | |
| 4477 | /* |
| 4478 | * If the allocation throttle is enabled, then update the accounting. |
| 4479 | * We only track child I/Os that are part of an allocating async |
| 4480 | * write. We must do this since the allocation is performed |
| 4481 | * by the logical I/O but the actual write is done by child I/Os. |
| 4482 | */ |
| 4483 | if (zio->io_flags & ZIO_FLAG_IO_ALLOCATING && |
| 4484 | zio->io_child_type == ZIO_CHILD_VDEV) { |
| 4485 | ASSERT(zio->io_metaslab_class != NULL); |
| 4486 | ASSERT(zio->io_metaslab_class->mc_alloc_throttle_enabled); |
| 4487 | zio_dva_throttle_done(zio); |
| 4488 | } |
| 4489 | |
| 4490 | /* |
| 4491 | * If the allocation throttle is enabled, verify that |
| 4492 | * we have decremented the refcounts for every I/O that was throttled. |
| 4493 | */ |
| 4494 | if (zio->io_flags & ZIO_FLAG_IO_ALLOCATING) { |
| 4495 | ASSERT(zio->io_type == ZIO_TYPE_WRITE); |
| 4496 | ASSERT(zio->io_priority == ZIO_PRIORITY_ASYNC_WRITE); |
| 4497 | ASSERT(zio->io_bp != NULL); |
| 4498 | |
| 4499 | metaslab_group_alloc_verify(zio->io_spa, zio->io_bp, zio, |
| 4500 | zio->io_allocator); |
| 4501 | VERIFY(zfs_refcount_not_held(&zio->io_metaslab_class-> |
| 4502 | mc_allocator[zio->io_allocator].mca_alloc_slots, zio)); |
| 4503 | } |
| 4504 | |
| 4505 | |
| 4506 | for (int c = 0; c < ZIO_CHILD_TYPES; c++) |
| 4507 | for (int w = 0; w < ZIO_WAIT_TYPES; w++) |
| 4508 | ASSERT(zio->io_children[c][w] == 0); |
| 4509 | |
| 4510 | if (zio->io_bp != NULL && !BP_IS_EMBEDDED(zio->io_bp)) { |
| 4511 | ASSERT(zio->io_bp->blk_pad[0] == 0); |
| 4512 | ASSERT(zio->io_bp->blk_pad[1] == 0); |
| 4513 | ASSERT(bcmp(zio->io_bp, &zio->io_bp_copy, |
| 4514 | sizeof (blkptr_t)) == 0 || |
| 4515 | (zio->io_bp == zio_unique_parent(zio)->io_bp)); |
nothing calls this directly
no test coverage detected