Deleted Added
full compact
zio.c (339105) zio.c (339106)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 1136 unchanged lines hidden (view full) ---

1145 * Therefore, for correct operation the caller *must* check for
1146 * and handle the error in the child i/o's done callback.
1147 * The only exceptions are i/os that we don't care about
1148 * (OPTIONAL or REPAIR).
1149 */
1150 ASSERT((flags & ZIO_FLAG_OPTIONAL) || (flags & ZIO_FLAG_IO_REPAIR) ||
1151 done != NULL);
1152
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 1136 unchanged lines hidden (view full) ---

1145 * Therefore, for correct operation the caller *must* check for
1146 * and handle the error in the child i/o's done callback.
1147 * The only exceptions are i/os that we don't care about
1148 * (OPTIONAL or REPAIR).
1149 */
1150 ASSERT((flags & ZIO_FLAG_OPTIONAL) || (flags & ZIO_FLAG_IO_REPAIR) ||
1151 done != NULL);
1152
1153 /*
1154 * In the common case, where the parent zio was to a normal vdev,
1155 * the child zio must be to a child vdev of that vdev. Otherwise,
1156 * the child zio must be to a top-level vdev.
1157 */
1158 if (pio->io_vd != NULL && pio->io_vd->vdev_ops != &vdev_indirect_ops) {
1159 ASSERT3P(vd->vdev_parent, ==, pio->io_vd);
1160 } else {
1161 ASSERT3P(vd, ==, vd->vdev_top);
1162 }
1163
1164 if (type == ZIO_TYPE_READ && bp != NULL) {
1165 /*
1166 * If we have the bp, then the child should perform the
1167 * checksum and the parent need not. This pushes error
1168 * detection as close to the leaves as possible and
1169 * eliminates redundant checksums in the interior nodes.
1170 */
1171 pipeline |= ZIO_STAGE_CHECKSUM_VERIFY;

--- 47 unchanged lines hidden (view full) ---

1219 if (vd->vdev_ops->vdev_op_leaf && zio->io_logical != NULL)
1220 zio->io_logical->io_phys_children++;
1221
1222 return (zio);
1223}
1224
1225zio_t *
1226zio_vdev_delegated_io(vdev_t *vd, uint64_t offset, abd_t *data, uint64_t size,
1153 if (type == ZIO_TYPE_READ && bp != NULL) {
1154 /*
1155 * If we have the bp, then the child should perform the
1156 * checksum and the parent need not. This pushes error
1157 * detection as close to the leaves as possible and
1158 * eliminates redundant checksums in the interior nodes.
1159 */
1160 pipeline |= ZIO_STAGE_CHECKSUM_VERIFY;

--- 47 unchanged lines hidden (view full) ---

1208 if (vd->vdev_ops->vdev_op_leaf && zio->io_logical != NULL)
1209 zio->io_logical->io_phys_children++;
1210
1211 return (zio);
1212}
1213
1214zio_t *
1215zio_vdev_delegated_io(vdev_t *vd, uint64_t offset, abd_t *data, uint64_t size,
1227 int type, zio_priority_t priority, enum zio_flag flags,
1216 zio_type_t type, zio_priority_t priority, enum zio_flag flags,
1228 zio_done_func_t *done, void *private)
1229{
1230 zio_t *zio;
1231
1232 ASSERT(vd->vdev_ops->vdev_op_leaf);
1233
1234 zio = zio_create(NULL, vd->vdev_spa, 0, NULL,
1235 data, size, size, done, private, type, priority,

--- 1963 unchanged lines hidden (view full) ---

3199 return (ZIO_PIPELINE_CONTINUE);
3200 }
3201
3202 ASSERT3P(zio->io_logical, !=, zio);
3203 if (zio->io_type == ZIO_TYPE_WRITE) {
3204 ASSERT(spa->spa_trust_config);
3205
3206 if (zio->io_vd->vdev_removing) {
1217 zio_done_func_t *done, void *private)
1218{
1219 zio_t *zio;
1220
1221 ASSERT(vd->vdev_ops->vdev_op_leaf);
1222
1223 zio = zio_create(NULL, vd->vdev_spa, 0, NULL,
1224 data, size, size, done, private, type, priority,

--- 1963 unchanged lines hidden (view full) ---

3188 return (ZIO_PIPELINE_CONTINUE);
3189 }
3190
3191 ASSERT3P(zio->io_logical, !=, zio);
3192 if (zio->io_type == ZIO_TYPE_WRITE) {
3193 ASSERT(spa->spa_trust_config);
3194
3195 if (zio->io_vd->vdev_removing) {
3196 /*
3197 * Note: the code can handle other kinds of writes,
3198 * but we don't expect them.
3199 */
3207 ASSERT(zio->io_flags &
3208 (ZIO_FLAG_PHYSICAL | ZIO_FLAG_SELF_HEAL |
3200 ASSERT(zio->io_flags &
3201 (ZIO_FLAG_PHYSICAL | ZIO_FLAG_SELF_HEAL |
3209 ZIO_FLAG_INDUCE_DAMAGE));
3202 ZIO_FLAG_RESILVER | ZIO_FLAG_INDUCE_DAMAGE));
3210 }
3211 }
3212
3213 /*
3214 * We keep track of time-sensitive I/Os so that the scan thread
3215 * can quickly react to certain workloads. In particular, we care
3216 * about non-scrubbing, top-level reads and writes with the following
3217 * characteristics:

--- 49 unchanged lines hidden (view full) ---

3267 }
3268
3269 VERIFY(zio->io_type == ZIO_TYPE_READ || spa_writeable(spa));
3270
3271 /*
3272 * If this is a repair I/O, and there's no self-healing involved --
3273 * that is, we're just resilvering what we expect to resilver --
3274 * then don't do the I/O unless zio's txg is actually in vd's DTL.
3203 }
3204 }
3205
3206 /*
3207 * We keep track of time-sensitive I/Os so that the scan thread
3208 * can quickly react to certain workloads. In particular, we care
3209 * about non-scrubbing, top-level reads and writes with the following
3210 * characteristics:

--- 49 unchanged lines hidden (view full) ---

3260 }
3261
3262 VERIFY(zio->io_type == ZIO_TYPE_READ || spa_writeable(spa));
3263
3264 /*
3265 * If this is a repair I/O, and there's no self-healing involved --
3266 * that is, we're just resilvering what we expect to resilver --
3267 * then don't do the I/O unless zio's txg is actually in vd's DTL.
3275 * This prevents spurious resilvering with nested replication.
3276 * For example, given a mirror of mirrors, (A+B)+(C+D), if only
3277 * A is out of date, we'll read from C+D, then use the data to
3278 * resilver A+B -- but we don't actually want to resilver B, just A.
3279 * The top-level mirror has no way to know this, so instead we just
3280 * discard unnecessary repairs as we work our way down the vdev tree.
3281 * The same logic applies to any form of nested replication:
3282 * ditto + mirror, RAID-Z + replacing, etc. This covers them all.
3268 * This prevents spurious resilvering.
3269 *
3270 * There are a few ways that we can end up creating these spurious
3271 * resilver i/os:
3272 *
3273 * 1. A resilver i/o will be issued if any DVA in the BP has a
3274 * dirty DTL. The mirror code will issue resilver writes to
3275 * each DVA, including the one(s) that are not on vdevs with dirty
3276 * DTLs.
3277 *
3278 * 2. With nested replication, which happens when we have a
3279 * "replacing" or "spare" vdev that's a child of a mirror or raidz.
3280 * For example, given mirror(replacing(A+B), C), it's likely that
3281 * only A is out of date (it's the new device). In this case, we'll
3282 * read from C, then use the data to resilver A+B -- but we don't
3283 * actually want to resilver B, just A. The top-level mirror has no
3284 * way to know this, so instead we just discard unnecessary repairs
3285 * as we work our way down the vdev tree.
3286 *
3287 * 3. ZTEST also creates mirrors of mirrors, mirrors of raidz, etc.
3288 * The same logic applies to any form of nested replication: ditto
3289 * + mirror, RAID-Z + replacing, etc.
3290 *
3291 * However, indirect vdevs point off to other vdevs which may have
3292 * DTL's, so we never bypass them. The child i/os on concrete vdevs
3293 * will be properly bypassed instead.
3283 */
3284 if ((zio->io_flags & ZIO_FLAG_IO_REPAIR) &&
3285 !(zio->io_flags & ZIO_FLAG_SELF_HEAL) &&
3286 zio->io_txg != 0 && /* not a delegated i/o */
3294 */
3295 if ((zio->io_flags & ZIO_FLAG_IO_REPAIR) &&
3296 !(zio->io_flags & ZIO_FLAG_SELF_HEAL) &&
3297 zio->io_txg != 0 && /* not a delegated i/o */
3298 vd->vdev_ops != &vdev_indirect_ops &&
3287 !vdev_dtl_contains(vd, DTL_PARTIAL, zio->io_txg, 1)) {
3288 ASSERT(zio->io_type == ZIO_TYPE_WRITE);
3289 zio_vdev_io_bypass(zio);
3290 return (ZIO_PIPELINE_CONTINUE);
3291 }
3292
3293 if (vd->vdev_ops->vdev_op_leaf) {
3294 switch (zio->io_type) {

--- 976 unchanged lines hidden ---
3299 !vdev_dtl_contains(vd, DTL_PARTIAL, zio->io_txg, 1)) {
3300 ASSERT(zio->io_type == ZIO_TYPE_WRITE);
3301 zio_vdev_io_bypass(zio);
3302 return (ZIO_PIPELINE_CONTINUE);
3303 }
3304
3305 if (vd->vdev_ops->vdev_op_leaf) {
3306 switch (zio->io_type) {

--- 976 unchanged lines hidden ---