* Allocate the raidz mapping to be applied to the dRAID I/O. The parity * calculations for dRAID are identical to raidz however there are a few * differences in the layout. * * - dRAID always allocates a full stripe width. Any extra sectors due * this padding are zero filled and written to disk. They will be read * back during a scrub or repair operation since they are included in *
| 1299 | * the first group and the other at the start of the following group. |
| 1300 | */ |
| 1301 | static raidz_map_t * |
| 1302 | vdev_draid_map_alloc(zio_t *zio) |
| 1303 | { |
| 1304 | raidz_row_t *rr[2]; |
| 1305 | uint64_t abd_offset = 0; |
| 1306 | uint64_t abd_size = zio->io_size; |
| 1307 | uint64_t io_offset = zio->io_offset; |
| 1308 | uint64_t size; |
| 1309 | int nrows = 1; |
| 1310 | |
| 1311 | size = vdev_draid_map_alloc_row(zio, &rr[0], io_offset, |
| 1312 | abd_offset, abd_size); |
| 1313 | if (size < abd_size) { |
| 1314 | vdev_t *vd = zio->io_vd; |
| 1315 | |
| 1316 | io_offset += vdev_draid_asize(vd, size); |
| 1317 | abd_offset += size; |
| 1318 | abd_size -= size; |
| 1319 | nrows++; |
| 1320 | |
| 1321 | ASSERT3U(io_offset, ==, vdev_draid_group_to_offset( |
| 1322 | vd, vdev_draid_offset_to_group(vd, io_offset))); |
| 1323 | ASSERT3U(abd_offset, <, zio->io_size); |
| 1324 | ASSERT3U(abd_size, !=, 0); |
| 1325 | |
| 1326 | size = vdev_draid_map_alloc_row(zio, &rr[1], |
| 1327 | io_offset, abd_offset, abd_size); |
| 1328 | VERIFY3U(size, ==, abd_size); |
| 1329 | } |
| 1330 | |
| 1331 | raidz_map_t *rm; |
| 1332 | rm = kmem_zalloc(offsetof(raidz_map_t, rm_row[nrows]), KM_SLEEP); |
| 1333 | rm->rm_ops = vdev_raidz_math_get_ops(); |
| 1334 | rm->rm_nrows = nrows; |
| 1335 | rm->rm_row[0] = rr[0]; |
| 1336 | if (nrows == 2) |
| 1337 | rm->rm_row[1] = rr[1]; |
| 1338 | |
| 1339 | zio->io_vsd = rm; |
| 1340 | zio->io_vsd_ops = &vdev_draid_vsd_ops; |
| 1341 | |
| 1342 | return (rm); |
| 1343 | } |
| 1344 | |
| 1345 | /* |
| 1346 | * Given an offset into a dRAID return the next group width aligned offset |
no test coverage detected