* For read operations: * 1. The vdev_draid_map_alloc() function will create a minimal raidz * mapping for the read based on the zio->io_flags. There are two * possible mappings either 1) a normal read, or 2) a scrub/resilver. * 2. Create the zio read operations. This will include all parity * columns and skip sectors for a scrub/resilver. */
| 2076 | * columns and skip sectors for a scrub/resilver. |
| 2077 | */ |
| 2078 | static void |
| 2079 | vdev_draid_io_start_read(zio_t *zio, raidz_row_t *rr) |
| 2080 | { |
| 2081 | vdev_t *vd = zio->io_vd; |
| 2082 | |
| 2083 | /* Sequential rebuild must do IO at redundancy group boundary. */ |
| 2084 | IMPLY(zio->io_priority == ZIO_PRIORITY_REBUILD, rr->rr_nempty == 0); |
| 2085 | |
| 2086 | /* |
| 2087 | * Iterate over the columns in reverse order so that we hit the parity |
| 2088 | * last. Any errors along the way will force us to read the parity. |
| 2089 | * For scrub/resilver IOs which verify skip sectors, a gang ABD will |
| 2090 | * have been allocated to store them and rc->rc_size is increased. |
| 2091 | */ |
| 2092 | for (int c = rr->rr_cols - 1; c >= 0; c--) { |
| 2093 | raidz_col_t *rc = &rr->rr_col[c]; |
| 2094 | vdev_t *cvd = vd->vdev_child[rc->rc_devidx]; |
| 2095 | |
| 2096 | if (!vdev_draid_readable(cvd, rc->rc_offset)) { |
| 2097 | if (c >= rr->rr_firstdatacol) |
| 2098 | rr->rr_missingdata++; |
| 2099 | else |
| 2100 | rr->rr_missingparity++; |
| 2101 | rc->rc_error = SET_ERROR(ENXIO); |
| 2102 | rc->rc_tried = 1; |
| 2103 | rc->rc_skipped = 1; |
| 2104 | continue; |
| 2105 | } |
| 2106 | |
| 2107 | if (vdev_draid_missing(cvd, rc->rc_offset, zio->io_txg, 1)) { |
| 2108 | if (c >= rr->rr_firstdatacol) |
| 2109 | rr->rr_missingdata++; |
| 2110 | else |
| 2111 | rr->rr_missingparity++; |
| 2112 | rc->rc_error = SET_ERROR(ESTALE); |
| 2113 | rc->rc_skipped = 1; |
| 2114 | continue; |
| 2115 | } |
| 2116 | |
| 2117 | /* |
| 2118 | * Empty columns may be read during vdev_draid_io_done(). |
| 2119 | * Only skip them after the readable and missing checks |
| 2120 | * verify they are available. |
| 2121 | */ |
| 2122 | if (rc->rc_size == 0) { |
| 2123 | rc->rc_skipped = 1; |
| 2124 | continue; |
| 2125 | } |
| 2126 | |
| 2127 | if (zio->io_flags & ZIO_FLAG_RESILVER) { |
| 2128 | vdev_t *svd; |
| 2129 | |
| 2130 | /* |
| 2131 | * If this child is a distributed spare then the |
| 2132 | * offset might reside on the vdev being replaced. |
| 2133 | * In which case this data must be written to the |
| 2134 | * new device. Failure to do so would result in |
| 2135 | * checksum errors when the old device is detached |
no test coverage detected