|
Lines 477-484
zio_add_child(zio_t *pio, zio_t *cio)
Link Here
|
| 477 |
|
477 |
|
| 478 |
ASSERT(pio->io_state[ZIO_WAIT_DONE] == 0); |
478 |
ASSERT(pio->io_state[ZIO_WAIT_DONE] == 0); |
| 479 |
|
479 |
|
| 480 |
for (int w = 0; w < ZIO_WAIT_TYPES; w++) |
480 |
for (int w = 0; w < ZIO_WAIT_TYPES; w++) { |
| 481 |
pio->io_children[cio->io_child_type][w] += !cio->io_state[w]; |
481 |
int child = zio_child(cio->io_child_type); |
|
|
482 |
pio->io_children[child][w] += !cio->io_state[w]; |
| 483 |
} |
| 482 |
|
484 |
|
| 483 |
list_insert_head(&pio->io_child_list, zl); |
485 |
list_insert_head(&pio->io_child_list, zl); |
| 484 |
list_insert_head(&cio->io_parent_list, zl); |
486 |
list_insert_head(&cio->io_parent_list, zl); |
|
Lines 512-529
zio_remove_child(zio_t *pio, zio_t *cio, zio_link_
Link Here
|
| 512 |
} |
514 |
} |
| 513 |
|
515 |
|
| 514 |
static boolean_t |
516 |
static boolean_t |
| 515 |
zio_wait_for_children(zio_t *zio, enum zio_child child, enum zio_wait_type wait) |
517 |
zio_wait_for_children(zio_t *zio, enum zio_child children, |
|
|
518 |
enum zio_wait_type wait) |
| 516 |
{ |
519 |
{ |
| 517 |
uint64_t *countp = &zio->io_children[child][wait]; |
|
|
| 518 |
boolean_t waiting = B_FALSE; |
520 |
boolean_t waiting = B_FALSE; |
| 519 |
|
521 |
|
| 520 |
mutex_enter(&zio->io_lock); |
522 |
mutex_enter(&zio->io_lock); |
| 521 |
ASSERT(zio->io_stall == NULL); |
523 |
for (int child = 0; child < ZIO_CHILD_TYPES; child++) { |
| 522 |
if (*countp != 0) { |
524 |
if (!(children & (1 << child))) |
| 523 |
zio->io_stage >>= 1; |
525 |
continue; |
| 524 |
ASSERT3U(zio->io_stage, !=, ZIO_STAGE_OPEN); |
526 |
|
| 525 |
zio->io_stall = countp; |
527 |
uint64_t *countp = &zio->io_children[child][wait]; |
| 526 |
waiting = B_TRUE; |
528 |
|
|
|
529 |
ASSERT(zio->io_stall == NULL); |
| 530 |
if (*countp != 0) { |
| 531 |
zio->io_stage >>= 1; |
| 532 |
ASSERT3U(zio->io_stage, !=, ZIO_STAGE_OPEN); |
| 533 |
zio->io_stall = countp; |
| 534 |
waiting = B_TRUE; |
| 535 |
break; |
| 536 |
} |
| 527 |
} |
537 |
} |
| 528 |
mutex_exit(&zio->io_lock); |
538 |
mutex_exit(&zio->io_lock); |
| 529 |
|
539 |
|
|
Lines 533-540
static boolean_t
Link Here
|
| 533 |
static void |
543 |
static void |
| 534 |
zio_notify_parent(zio_t *pio, zio_t *zio, enum zio_wait_type wait) |
544 |
zio_notify_parent(zio_t *pio, zio_t *zio, enum zio_wait_type wait) |
| 535 |
{ |
545 |
{ |
| 536 |
uint64_t *countp = &pio->io_children[zio->io_child_type][wait]; |
546 |
int child = zio_child(zio->io_child_type); |
| 537 |
int *errorp = &pio->io_child_error[zio->io_child_type]; |
547 |
uint64_t *countp = |
|
|
548 |
&pio->io_children[child][wait]; |
| 549 |
int *errorp = &pio->io_child_error[child]; |
| 538 |
|
550 |
|
| 539 |
mutex_enter(&pio->io_lock); |
551 |
mutex_enter(&pio->io_lock); |
| 540 |
if (zio->io_error && !(zio->io_flags & ZIO_FLAG_DONT_PROPAGATE)) |
552 |
if (zio->io_error && !(zio->io_flags & ZIO_FLAG_DONT_PROPAGATE)) |
|
Lines 565-572
zio_notify_parent(zio_t *pio, zio_t *zio, enum zio
Link Here
|
| 565 |
static void |
577 |
static void |
| 566 |
zio_inherit_child_errors(zio_t *zio, enum zio_child c) |
578 |
zio_inherit_child_errors(zio_t *zio, enum zio_child c) |
| 567 |
{ |
579 |
{ |
| 568 |
if (zio->io_child_error[c] != 0 && zio->io_error == 0) |
580 |
if (zio->io_child_error[zio_child(c)] != 0 && zio->io_error == 0) |
| 569 |
zio->io_error = zio->io_child_error[c]; |
581 |
zio->io_error = zio->io_child_error[zio_child(c)]; |
| 570 |
} |
582 |
} |
| 571 |
|
583 |
|
| 572 |
int |
584 |
int |
|
Lines 1330-1338
zio_write_compress(zio_t *zio)
Link Here
|
| 1330 |
* If our children haven't all reached the ready stage, |
1342 |
* If our children haven't all reached the ready stage, |
| 1331 |
* wait for them and then repeat this pipeline stage. |
1343 |
* wait for them and then repeat this pipeline stage. |
| 1332 |
*/ |
1344 |
*/ |
| 1333 |
if (zio_wait_for_children(zio, ZIO_CHILD_GANG, ZIO_WAIT_READY) || |
1345 |
if (zio_wait_for_children(zio, ZIO_CHILD_GANG | ZIO_CHILD_LOGICAL, |
| 1334 |
zio_wait_for_children(zio, ZIO_CHILD_LOGICAL, ZIO_WAIT_READY)) |
1346 |
ZIO_WAIT_READY)) { |
| 1335 |
return (ZIO_PIPELINE_STOP); |
1347 |
return (ZIO_PIPELINE_STOP); |
|
|
1348 |
} |
| 1336 |
|
1349 |
|
| 1337 |
if (!IO_IS_ALLOCATING(zio)) |
1350 |
if (!IO_IS_ALLOCATING(zio)) |
| 1338 |
return (ZIO_PIPELINE_CONTINUE); |
1351 |
return (ZIO_PIPELINE_CONTINUE); |
|
Lines 1795-1804
zio_reexecute(zio_t *pio)
Link Here
|
| 1795 |
*/ |
1808 |
*/ |
| 1796 |
zio_link_t *zl = NULL; |
1809 |
zio_link_t *zl = NULL; |
| 1797 |
for (cio = zio_walk_children(pio, &zl); cio != NULL; cio = cio_next) { |
1810 |
for (cio = zio_walk_children(pio, &zl); cio != NULL; cio = cio_next) { |
|
|
1811 |
int child = zio_child(cio->io_child_type); |
| 1798 |
cio_next = zio_walk_children(pio, &zl); |
1812 |
cio_next = zio_walk_children(pio, &zl); |
| 1799 |
mutex_enter(&pio->io_lock); |
1813 |
mutex_enter(&pio->io_lock); |
| 1800 |
for (int w = 0; w < ZIO_WAIT_TYPES; w++) |
1814 |
for (int w = 0; w < ZIO_WAIT_TYPES; w++) |
| 1801 |
pio->io_children[cio->io_child_type][w]++; |
1815 |
pio->io_children[child][w]++; |
| 1802 |
mutex_exit(&pio->io_lock); |
1816 |
mutex_exit(&pio->io_lock); |
| 1803 |
zio_reexecute(cio); |
1817 |
zio_reexecute(cio); |
| 1804 |
} |
1818 |
} |
|
Lines 2200-2206
zio_gang_issue(zio_t *zio)
Link Here
|
| 2200 |
ASSERT(BP_IS_GANG(bp) && zio->io_gang_leader == zio); |
2214 |
ASSERT(BP_IS_GANG(bp) && zio->io_gang_leader == zio); |
| 2201 |
ASSERT(zio->io_child_type > ZIO_CHILD_GANG); |
2215 |
ASSERT(zio->io_child_type > ZIO_CHILD_GANG); |
| 2202 |
|
2216 |
|
| 2203 |
if (zio->io_child_error[ZIO_CHILD_GANG] == 0) |
2217 |
if (zio->io_child_error[zio_child(ZIO_CHILD_GANG)] == 0) |
| 2204 |
zio_gang_tree_issue(zio, zio->io_gang_tree, bp, zio->io_abd, |
2218 |
zio_gang_tree_issue(zio, zio->io_gang_tree, bp, zio->io_abd, |
| 2205 |
0); |
2219 |
0); |
| 2206 |
else |
2220 |
else |
|
Lines 2477-2483
zio_ddt_read_start(zio_t *zio)
Link Here
|
| 2477 |
ASSERT(BP_GET_PSIZE(bp) == zio->io_size); |
2491 |
ASSERT(BP_GET_PSIZE(bp) == zio->io_size); |
| 2478 |
ASSERT(zio->io_child_type == ZIO_CHILD_LOGICAL); |
2492 |
ASSERT(zio->io_child_type == ZIO_CHILD_LOGICAL); |
| 2479 |
|
2493 |
|
| 2480 |
if (zio->io_child_error[ZIO_CHILD_DDT]) { |
2494 |
if (zio->io_child_error[zio_child(ZIO_CHILD_DDT)]) { |
| 2481 |
ddt_t *ddt = ddt_select(zio->io_spa, bp); |
2495 |
ddt_t *ddt = ddt_select(zio->io_spa, bp); |
| 2482 |
ddt_entry_t *dde = ddt_repair_start(ddt, bp); |
2496 |
ddt_entry_t *dde = ddt_repair_start(ddt, bp); |
| 2483 |
ddt_phys_t *ddp = dde->dde_phys; |
2497 |
ddt_phys_t *ddp = dde->dde_phys; |
|
Lines 2523-2529
zio_ddt_read_done(zio_t *zio)
Link Here
|
| 2523 |
ASSERT(BP_GET_PSIZE(bp) == zio->io_size); |
2537 |
ASSERT(BP_GET_PSIZE(bp) == zio->io_size); |
| 2524 |
ASSERT(zio->io_child_type == ZIO_CHILD_LOGICAL); |
2538 |
ASSERT(zio->io_child_type == ZIO_CHILD_LOGICAL); |
| 2525 |
|
2539 |
|
| 2526 |
if (zio->io_child_error[ZIO_CHILD_DDT]) { |
2540 |
if (zio->io_child_error[zio_child(ZIO_CHILD_DDT)]) { |
| 2527 |
ddt_t *ddt = ddt_select(zio->io_spa, bp); |
2541 |
ddt_t *ddt = ddt_select(zio->io_spa, bp); |
| 2528 |
ddt_entry_t *dde = zio->io_vsd; |
2542 |
ddt_entry_t *dde = zio->io_vsd; |
| 2529 |
if (ddt == NULL) { |
2543 |
if (ddt == NULL) { |
|
Lines 2538-2544
zio_ddt_read_done(zio_t *zio)
Link Here
|
| 2538 |
if (dde->dde_repair_abd != NULL) { |
2552 |
if (dde->dde_repair_abd != NULL) { |
| 2539 |
abd_copy(zio->io_abd, dde->dde_repair_abd, |
2553 |
abd_copy(zio->io_abd, dde->dde_repair_abd, |
| 2540 |
zio->io_size); |
2554 |
zio->io_size); |
| 2541 |
zio->io_child_error[ZIO_CHILD_DDT] = 0; |
2555 |
zio->io_child_error[zio_child(ZIO_CHILD_DDT)] = 0; |
| 2542 |
} |
2556 |
} |
| 2543 |
ddt_repair_done(ddt, dde); |
2557 |
ddt_repair_done(ddt, dde); |
| 2544 |
zio->io_vsd = NULL; |
2558 |
zio->io_vsd = NULL; |
|
Lines 3107-3113
zio_vdev_io_start(zio_t *zio)
Link Here
|
| 3107 |
int ret; |
3121 |
int ret; |
| 3108 |
|
3122 |
|
| 3109 |
ASSERT(zio->io_error == 0); |
3123 |
ASSERT(zio->io_error == 0); |
| 3110 |
ASSERT(zio->io_child_error[ZIO_CHILD_VDEV] == 0); |
3124 |
ASSERT(zio->io_child_error[zio_child(ZIO_CHILD_VDEV)] == 0); |
| 3111 |
|
3125 |
|
| 3112 |
if (vd == NULL) { |
3126 |
if (vd == NULL) { |
| 3113 |
if (!(zio->io_flags & ZIO_FLAG_CONFIG_WRITER)) |
3127 |
if (!(zio->io_flags & ZIO_FLAG_CONFIG_WRITER)) |
|
Lines 3558-3572
zio_ready(zio_t *zio)
Link Here
|
| 3558 |
zio_t *pio, *pio_next; |
3572 |
zio_t *pio, *pio_next; |
| 3559 |
zio_link_t *zl = NULL; |
3573 |
zio_link_t *zl = NULL; |
| 3560 |
|
3574 |
|
| 3561 |
if (zio_wait_for_children(zio, ZIO_CHILD_GANG, ZIO_WAIT_READY) || |
3575 |
if (zio_wait_for_children(zio, ZIO_CHILD_GANG | ZIO_CHILD_DDT, |
| 3562 |
zio_wait_for_children(zio, ZIO_CHILD_DDT, ZIO_WAIT_READY)) |
3576 |
ZIO_WAIT_READY)) { |
| 3563 |
return (ZIO_PIPELINE_STOP); |
3577 |
return (ZIO_PIPELINE_STOP); |
|
|
3578 |
} |
| 3564 |
|
3579 |
|
| 3565 |
if (zio->io_ready) { |
3580 |
if (zio->io_ready) { |
| 3566 |
ASSERT(IO_IS_ALLOCATING(zio)); |
3581 |
ASSERT(IO_IS_ALLOCATING(zio)); |
| 3567 |
ASSERT(bp->blk_birth == zio->io_txg || BP_IS_HOLE(bp) || |
3582 |
ASSERT(bp->blk_birth == zio->io_txg || BP_IS_HOLE(bp) || |
| 3568 |
(zio->io_flags & ZIO_FLAG_NOPWRITE)); |
3583 |
(zio->io_flags & ZIO_FLAG_NOPWRITE)); |
| 3569 |
ASSERT(zio->io_children[ZIO_CHILD_GANG][ZIO_WAIT_READY] == 0); |
3584 |
ASSERT0(zio->io_children[zio_child( |
|
|
3585 |
ZIO_CHILD_GANG)][ZIO_WAIT_READY]); |
| 3570 |
|
3586 |
|
| 3571 |
zio->io_ready(zio); |
3587 |
zio->io_ready(zio); |
| 3572 |
} |
3588 |
} |
|
Lines 3700-3710
zio_done(zio_t *zio)
Link Here
|
| 3700 |
* If our children haven't all completed, |
3716 |
* If our children haven't all completed, |
| 3701 |
* wait for them and then repeat this pipeline stage. |
3717 |
* wait for them and then repeat this pipeline stage. |
| 3702 |
*/ |
3718 |
*/ |
| 3703 |
if (zio_wait_for_children(zio, ZIO_CHILD_VDEV, ZIO_WAIT_DONE) || |
3719 |
if (zio_wait_for_children(zio, ZIO_CHILD_VDEV | ZIO_CHILD_GANG | |
| 3704 |
zio_wait_for_children(zio, ZIO_CHILD_GANG, ZIO_WAIT_DONE) || |
3720 |
ZIO_CHILD_DDT | ZIO_CHILD_LOGICAL, ZIO_WAIT_DONE)) { |
| 3705 |
zio_wait_for_children(zio, ZIO_CHILD_DDT, ZIO_WAIT_DONE) || |
|
|
| 3706 |
zio_wait_for_children(zio, ZIO_CHILD_LOGICAL, ZIO_WAIT_DONE)) |
| 3707 |
return (ZIO_PIPELINE_STOP); |
3721 |
return (ZIO_PIPELINE_STOP); |
|
|
3722 |
} |
| 3708 |
|
3723 |
|
| 3709 |
/* |
3724 |
/* |
| 3710 |
* If the allocation throttle is enabled, then update the accounting. |
3725 |
* If the allocation throttle is enabled, then update the accounting. |
|
Lines 3730-3738
zio_done(zio_t *zio)
Link Here
|
| 3730 |
VERIFY(refcount_not_held(&mc->mc_alloc_slots, zio)); |
3745 |
VERIFY(refcount_not_held(&mc->mc_alloc_slots, zio)); |
| 3731 |
} |
3746 |
} |
| 3732 |
|
3747 |
|
| 3733 |
for (int c = 0; c < ZIO_CHILD_TYPES; c++) |
3748 |
for (int child = 0; child < ZIO_CHILD_TYPES; child++) |
| 3734 |
for (int w = 0; w < ZIO_WAIT_TYPES; w++) |
3749 |
for (int w = 0; w < ZIO_WAIT_TYPES; w++) |
| 3735 |
ASSERT(zio->io_children[c][w] == 0); |
3750 |
ASSERT0(zio->io_children[child][w]); |
| 3736 |
|
3751 |
|
| 3737 |
if (bp != NULL && !BP_IS_EMBEDDED(bp)) { |
3752 |
if (bp != NULL && !BP_IS_EMBEDDED(bp)) { |
| 3738 |
ASSERT(bp->blk_pad[0] == 0); |
3753 |
ASSERT(bp->blk_pad[0] == 0); |