| 1123 | } |
| 1124 | |
| 1125 | zio_t * |
| 1126 | zio_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, |
| 1127 | abd_t *data, uint64_t lsize, uint64_t psize, const zio_prop_t *zp, |
| 1128 | zio_done_func_t *ready, zio_done_func_t *children_ready, |
| 1129 | zio_done_func_t *physdone, zio_done_func_t *done, |
| 1130 | void *private, zio_priority_t priority, enum zio_flag flags, |
| 1131 | const zbookmark_phys_t *zb) |
| 1132 | { |
| 1133 | zio_t *zio; |
| 1134 | |
| 1135 | ASSERT(zp->zp_checksum >= ZIO_CHECKSUM_OFF && |
| 1136 | zp->zp_checksum < ZIO_CHECKSUM_FUNCTIONS && |
| 1137 | zp->zp_compress >= ZIO_COMPRESS_OFF && |
| 1138 | zp->zp_compress < ZIO_COMPRESS_FUNCTIONS && |
| 1139 | DMU_OT_IS_VALID(zp->zp_type) && |
| 1140 | zp->zp_level < 32 && |
| 1141 | zp->zp_copies > 0 && |
| 1142 | zp->zp_copies <= spa_max_replication(spa)); |
| 1143 | |
| 1144 | zio = zio_create(pio, spa, txg, bp, data, lsize, psize, done, private, |
| 1145 | ZIO_TYPE_WRITE, priority, flags, NULL, 0, zb, |
| 1146 | ZIO_STAGE_OPEN, (flags & ZIO_FLAG_DDT_CHILD) ? |
| 1147 | ZIO_DDT_CHILD_WRITE_PIPELINE : ZIO_WRITE_PIPELINE); |
| 1148 | |
| 1149 | zio->io_ready = ready; |
| 1150 | zio->io_children_ready = children_ready; |
| 1151 | zio->io_physdone = physdone; |
| 1152 | zio->io_prop = *zp; |
| 1153 | |
| 1154 | /* |
| 1155 | * Data can be NULL if we are going to call zio_write_override() to |
| 1156 | * provide the already-allocated BP. But we may need the data to |
| 1157 | * verify a dedup hit (if requested). In this case, don't try to |
| 1158 | * dedup (just take the already-allocated BP verbatim). Encrypted |
| 1159 | * dedup blocks need data as well so we also disable dedup in this |
| 1160 | * case. |
| 1161 | */ |
| 1162 | if (data == NULL && |
| 1163 | (zio->io_prop.zp_dedup_verify || zio->io_prop.zp_encrypt)) { |
| 1164 | zio->io_prop.zp_dedup = zio->io_prop.zp_dedup_verify = B_FALSE; |
| 1165 | } |
| 1166 | |
| 1167 | return (zio); |
| 1168 | } |
| 1169 | |
| 1170 | zio_t * |
| 1171 | zio_rewrite(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, abd_t *data, |
no test coverage detected