* Returns true if the txg is only partially replicated on the leaf vdevs. */
| 1455 | * Returns true if the txg is only partially replicated on the leaf vdevs. |
| 1456 | */ |
| 1457 | static boolean_t |
| 1458 | vdev_draid_partial(vdev_t *vd, uint64_t physical_offset, uint64_t txg, |
| 1459 | uint64_t size) |
| 1460 | { |
| 1461 | if (vd->vdev_ops == &vdev_spare_ops || |
| 1462 | vd->vdev_ops == &vdev_replacing_ops) { |
| 1463 | /* |
| 1464 | * Check all of the readable children, if any child is |
| 1465 | * missing the txg range then it is partially replicated. |
| 1466 | */ |
| 1467 | for (int c = 0; c < vd->vdev_children; c++) { |
| 1468 | vdev_t *cvd = vd->vdev_child[c]; |
| 1469 | |
| 1470 | if (!vdev_readable(cvd)) |
| 1471 | continue; |
| 1472 | |
| 1473 | if (vdev_draid_partial(cvd, physical_offset, txg, size)) |
| 1474 | return (B_TRUE); |
| 1475 | } |
| 1476 | |
| 1477 | return (B_FALSE); |
| 1478 | } |
| 1479 | |
| 1480 | if (vd->vdev_ops == &vdev_draid_spare_ops) { |
| 1481 | /* |
| 1482 | * When sequentially resilvering we don't have a proper |
| 1483 | * txg range so instead we must presume all txgs are |
| 1484 | * missing on this vdev until the resilver completes. |
| 1485 | */ |
| 1486 | if (vd->vdev_rebuild_txg != 0) |
| 1487 | return (B_TRUE); |
| 1488 | |
| 1489 | /* |
| 1490 | * DTL_MISSING is set for all prior txgs when a resilver |
| 1491 | * is started in spa_vdev_attach(). |
| 1492 | */ |
| 1493 | if (vdev_dtl_contains(vd, DTL_MISSING, txg, size)) |
| 1494 | return (B_TRUE); |
| 1495 | |
| 1496 | /* |
| 1497 | * Consult the DTL on the relevant vdev. Either a vdev |
| 1498 | * leaf or spare/replace mirror child may be returned so |
| 1499 | * we must recursively call vdev_draid_missing_impl(). |
| 1500 | */ |
| 1501 | vd = vdev_draid_spare_get_child(vd, physical_offset); |
| 1502 | if (vd == NULL) |
| 1503 | return (B_TRUE); |
| 1504 | |
| 1505 | return (vdev_draid_partial(vd, physical_offset, txg, size)); |
| 1506 | } |
| 1507 | |
| 1508 | return (vdev_dtl_contains(vd, DTL_MISSING, txg, size)); |
| 1509 | } |
| 1510 | |
| 1511 | /* |
| 1512 | * Determine if the vdev is readable at the given offset. |
no test coverage detected