Changeset View
Changeset View
Standalone View
Standalone View
sys/contrib/openzfs/module/zfs/vdev_draid.c
Show First 20 Lines • Show All 710 Lines • ▼ Show 20 Lines | if (rr->rr_col[0].rc_gdata == NULL) { | ||||
* Fill in the data columns from good_data being | * Fill in the data columns from good_data being | ||||
* careful to pad short columns and empty columns | * careful to pad short columns and empty columns | ||||
* with a skip sector. | * with a skip sector. | ||||
*/ | */ | ||||
uint64_t good_size = abd_get_size((abd_t *)good_data); | uint64_t good_size = abd_get_size((abd_t *)good_data); | ||||
offset = 0; | offset = 0; | ||||
for (; x < rr->rr_cols; x++) { | for (; x < rr->rr_cols; x++) { | ||||
abd_put(rr->rr_col[x].rc_abd); | abd_free(rr->rr_col[x].rc_abd); | ||||
if (offset == good_size) { | if (offset == good_size) { | ||||
/* empty data column (small write) */ | /* empty data column (small write) */ | ||||
rr->rr_col[x].rc_abd = | rr->rr_col[x].rc_abd = | ||||
abd_get_zeros(skip_size); | abd_get_zeros(skip_size); | ||||
} else if (x < rr->rr_bigcols) { | } else if (x < rr->rr_bigcols) { | ||||
/* this is a "big column" */ | /* this is a "big column" */ | ||||
size = rr->rr_col[x].rc_size; | size = rr->rr_col[x].rc_size; | ||||
Show All 21 Lines | if (rr->rr_col[0].rc_gdata == NULL) { | ||||
vdev_raidz_generate_parity_row(rm, rr); | vdev_raidz_generate_parity_row(rm, rr); | ||||
/* restore everything back to its original state */ | /* restore everything back to its original state */ | ||||
for (x = 0; x < rr->rr_firstdatacol; x++) | for (x = 0; x < rr->rr_firstdatacol; x++) | ||||
rr->rr_col[x].rc_abd = bad_parity[x]; | rr->rr_col[x].rc_abd = bad_parity[x]; | ||||
offset = 0; | offset = 0; | ||||
for (x = rr->rr_firstdatacol; x < rr->rr_cols; x++) { | for (x = rr->rr_firstdatacol; x < rr->rr_cols; x++) { | ||||
if (offset == good_size || x < rr->rr_bigcols) | |||||
abd_put(rr->rr_col[x].rc_abd); | |||||
else | |||||
abd_free(rr->rr_col[x].rc_abd); | abd_free(rr->rr_col[x].rc_abd); | ||||
rr->rr_col[x].rc_abd = abd_get_offset_size( | rr->rr_col[x].rc_abd = abd_get_offset_size( | ||||
rr->rr_abd_copy, offset, | rr->rr_abd_copy, offset, | ||||
rr->rr_col[x].rc_size); | rr->rr_col[x].rc_size); | ||||
offset += rr->rr_col[x].rc_size; | offset += rr->rr_col[x].rc_size; | ||||
} | } | ||||
} | } | ||||
ASSERT3P(rr->rr_col[c].rc_gdata, !=, NULL); | ASSERT3P(rr->rr_col[c].rc_gdata, !=, NULL); | ||||
Show All 22 Lines | for (x = rr->rr_firstdatacol; x < c; x++) { | ||||
} | } | ||||
} | } | ||||
good = abd_get_offset_size((abd_t *)good_data, offset, size); | good = abd_get_offset_size((abd_t *)good_data, offset, size); | ||||
} | } | ||||
/* we drop the ereport if it ends up that the data was good */ | /* we drop the ereport if it ends up that the data was good */ | ||||
zfs_ereport_finish_checksum(zcr, good, bad, B_TRUE); | zfs_ereport_finish_checksum(zcr, good, bad, B_TRUE); | ||||
abd_put((abd_t *)good); | abd_free((abd_t *)good); | ||||
} | } | ||||
/* | /* | ||||
* Invoked indirectly by zfs_ereport_start_checksum(), called | * Invoked indirectly by zfs_ereport_start_checksum(), called | ||||
* below when our read operation fails completely. The main point | * below when our read operation fails completely. The main point | ||||
* is to keep a copy of everything we read from disk, so that at | * is to keep a copy of everything we read from disk, so that at | ||||
* vdev_draid_cksum_finish() time we can compare it with the good data. | * vdev_draid_cksum_finish() time we can compare it with the good data. | ||||
*/ | */ | ||||
Show All 38 Lines | for (int i = 0; i < rm->rm_nrows; i++) { | ||||
rr->rr_abd_copy = abd_alloc_for_io(size, B_FALSE); | rr->rr_abd_copy = abd_alloc_for_io(size, B_FALSE); | ||||
for (c = rr->rr_firstdatacol; c < rr->rr_cols; c++) { | for (c = rr->rr_firstdatacol; c < rr->rr_cols; c++) { | ||||
raidz_col_t *col = &rr->rr_col[c]; | raidz_col_t *col = &rr->rr_col[c]; | ||||
abd_t *tmp = abd_get_offset_size(rr->rr_abd_copy, | abd_t *tmp = abd_get_offset_size(rr->rr_abd_copy, | ||||
offset, col->rc_size); | offset, col->rc_size); | ||||
abd_copy(tmp, col->rc_abd, col->rc_size); | abd_copy(tmp, col->rc_abd, col->rc_size); | ||||
if (abd_is_gang(col->rc_abd)) | |||||
abd_free(col->rc_abd); | abd_free(col->rc_abd); | ||||
else | |||||
abd_put(col->rc_abd); | |||||
col->rc_abd = tmp; | col->rc_abd = tmp; | ||||
offset += col->rc_size; | offset += col->rc_size; | ||||
} | } | ||||
ASSERT3U(offset, ==, size); | ASSERT3U(offset, ==, size); | ||||
} | } | ||||
} | } | ||||
Show All 29 Lines | for (uint64_t c = rr->rr_firstdatacol; c < rr->rr_cols; c++) { | ||||
raidz_col_t *rc = &rr->rr_col[c]; | raidz_col_t *rc = &rr->rr_col[c]; | ||||
if (rc->rc_size == 0) { | if (rc->rc_size == 0) { | ||||
/* empty data column (small write), add a skip sector */ | /* empty data column (small write), add a skip sector */ | ||||
ASSERT3U(skip_size, ==, parity_size); | ASSERT3U(skip_size, ==, parity_size); | ||||
rc->rc_abd = abd_get_zeros(skip_size); | rc->rc_abd = abd_get_zeros(skip_size); | ||||
} else if (rc->rc_size == parity_size) { | } else if (rc->rc_size == parity_size) { | ||||
/* this is a "big column" */ | /* this is a "big column" */ | ||||
rc->rc_abd = abd_get_offset_size(zio->io_abd, | rc->rc_abd = abd_get_offset_struct(&rc->rc_abdstruct, | ||||
abd_off, rc->rc_size); | zio->io_abd, abd_off, rc->rc_size); | ||||
} else { | } else { | ||||
/* short data column, add a skip sector */ | /* short data column, add a skip sector */ | ||||
ASSERT3U(rc->rc_size + skip_size, ==, parity_size); | ASSERT3U(rc->rc_size + skip_size, ==, parity_size); | ||||
rc->rc_abd = abd_alloc_gang_abd(); | rc->rc_abd = abd_alloc_gang(); | ||||
abd_gang_add(rc->rc_abd, abd_get_offset_size( | abd_gang_add(rc->rc_abd, abd_get_offset_size( | ||||
zio->io_abd, abd_off, rc->rc_size), B_TRUE); | zio->io_abd, abd_off, rc->rc_size), B_TRUE); | ||||
abd_gang_add(rc->rc_abd, abd_get_zeros(skip_size), | abd_gang_add(rc->rc_abd, abd_get_zeros(skip_size), | ||||
B_TRUE); | B_TRUE); | ||||
} | } | ||||
ASSERT3U(abd_get_size(rc->rc_abd), ==, parity_size); | ASSERT3U(abd_get_size(rc->rc_abd), ==, parity_size); | ||||
Show All 34 Lines | if (rc->rc_size == 0) { | ||||
/* empty data column (small read), add a skip sector */ | /* empty data column (small read), add a skip sector */ | ||||
ASSERT3U(skip_size, ==, parity_size); | ASSERT3U(skip_size, ==, parity_size); | ||||
ASSERT3U(rr->rr_nempty, !=, 0); | ASSERT3U(rr->rr_nempty, !=, 0); | ||||
rc->rc_abd = abd_get_offset_size(rr->rr_abd_empty, | rc->rc_abd = abd_get_offset_size(rr->rr_abd_empty, | ||||
skip_off, skip_size); | skip_off, skip_size); | ||||
skip_off += skip_size; | skip_off += skip_size; | ||||
} else if (rc->rc_size == parity_size) { | } else if (rc->rc_size == parity_size) { | ||||
/* this is a "big column" */ | /* this is a "big column" */ | ||||
rc->rc_abd = abd_get_offset_size(zio->io_abd, | rc->rc_abd = abd_get_offset_struct(&rc->rc_abdstruct, | ||||
abd_off, rc->rc_size); | zio->io_abd, abd_off, rc->rc_size); | ||||
} else { | } else { | ||||
/* short data column, add a skip sector */ | /* short data column, add a skip sector */ | ||||
ASSERT3U(rc->rc_size + skip_size, ==, parity_size); | ASSERT3U(rc->rc_size + skip_size, ==, parity_size); | ||||
ASSERT3U(rr->rr_nempty, !=, 0); | ASSERT3U(rr->rr_nempty, !=, 0); | ||||
rc->rc_abd = abd_alloc_gang_abd(); | rc->rc_abd = abd_alloc_gang(); | ||||
abd_gang_add(rc->rc_abd, abd_get_offset_size( | abd_gang_add(rc->rc_abd, abd_get_offset_size( | ||||
zio->io_abd, abd_off, rc->rc_size), B_TRUE); | zio->io_abd, abd_off, rc->rc_size), B_TRUE); | ||||
abd_gang_add(rc->rc_abd, abd_get_offset_size( | abd_gang_add(rc->rc_abd, abd_get_offset_size( | ||||
rr->rr_abd_empty, skip_off, skip_size), B_TRUE); | rr->rr_abd_empty, skip_off, skip_size), B_TRUE); | ||||
skip_off += skip_size; | skip_off += skip_size; | ||||
} | } | ||||
uint64_t abd_size = abd_get_size(rc->rc_abd); | uint64_t abd_size = abd_get_size(rc->rc_abd); | ||||
Show All 25 Lines | vdev_draid_map_alloc_read(zio_t *zio, uint64_t abd_offset, raidz_row_t *rr) | ||||
uint64_t abd_off = abd_offset; | uint64_t abd_off = abd_offset; | ||||
ASSERT3U(zio->io_type, ==, ZIO_TYPE_READ); | ASSERT3U(zio->io_type, ==, ZIO_TYPE_READ); | ||||
for (uint64_t c = rr->rr_firstdatacol; c < rr->rr_cols; c++) { | for (uint64_t c = rr->rr_firstdatacol; c < rr->rr_cols; c++) { | ||||
raidz_col_t *rc = &rr->rr_col[c]; | raidz_col_t *rc = &rr->rr_col[c]; | ||||
if (rc->rc_size > 0) { | if (rc->rc_size > 0) { | ||||
rc->rc_abd = abd_get_offset_size(zio->io_abd, | rc->rc_abd = abd_get_offset_struct(&rc->rc_abdstruct, | ||||
abd_off, rc->rc_size); | zio->io_abd, abd_off, rc->rc_size); | ||||
abd_off += rc->rc_size; | abd_off += rc->rc_size; | ||||
} | } | ||||
} | } | ||||
IMPLY(abd_offset != 0, abd_off == zio->io_size); | IMPLY(abd_offset != 0, abd_off == zio->io_size); | ||||
} | } | ||||
/* | /* | ||||
Show All 32 Lines | if (rc->rc_size == 0) { | ||||
ASSERT3P(rc->rc_abd, !=, NULL); | ASSERT3P(rc->rc_abd, !=, NULL); | ||||
} else { | } else { | ||||
/* short data column, add a skip sector */ | /* short data column, add a skip sector */ | ||||
ASSERT3U(rc->rc_size + skip_size, ==, parity_size); | ASSERT3U(rc->rc_size + skip_size, ==, parity_size); | ||||
ASSERT3U(rr->rr_nempty, !=, 0); | ASSERT3U(rr->rr_nempty, !=, 0); | ||||
ASSERT3P(rc->rc_abd, !=, NULL); | ASSERT3P(rc->rc_abd, !=, NULL); | ||||
ASSERT(!abd_is_gang(rc->rc_abd)); | ASSERT(!abd_is_gang(rc->rc_abd)); | ||||
abd_t *read_abd = rc->rc_abd; | abd_t *read_abd = rc->rc_abd; | ||||
rc->rc_abd = abd_alloc_gang_abd(); | rc->rc_abd = abd_alloc_gang(); | ||||
abd_gang_add(rc->rc_abd, read_abd, B_TRUE); | abd_gang_add(rc->rc_abd, read_abd, B_TRUE); | ||||
abd_gang_add(rc->rc_abd, abd_get_offset_size( | abd_gang_add(rc->rc_abd, abd_get_offset_size( | ||||
rr->rr_abd_empty, skip_off, skip_size), B_TRUE); | rr->rr_abd_empty, skip_off, skip_size), B_TRUE); | ||||
skip_off += skip_size; | skip_off += skip_size; | ||||
} | } | ||||
/* | /* | ||||
* Increase rc_size so the empty ABD is included in subsequent | * Increase rc_size so the empty ABD is included in subsequent | ||||
▲ Show 20 Lines • Show All 1,917 Lines • Show Last 20 Lines |