| 1275 | } |
| 1276 | |
| 1277 | zio_t * |
| 1278 | zio_claim(zio_t *pio, spa_t *spa, uint64_t txg, const blkptr_t *bp, |
| 1279 | zio_done_func_t *done, void *private, enum zio_flag flags) |
| 1280 | { |
| 1281 | zio_t *zio; |
| 1282 | |
| 1283 | (void) zfs_blkptr_verify(spa, bp, flags & ZIO_FLAG_CONFIG_WRITER, |
| 1284 | BLK_VERIFY_HALT); |
| 1285 | |
| 1286 | if (BP_IS_EMBEDDED(bp)) |
| 1287 | return (zio_null(pio, spa, NULL, NULL, NULL, 0)); |
| 1288 | |
| 1289 | /* |
| 1290 | * A claim is an allocation of a specific block. Claims are needed |
| 1291 | * to support immediate writes in the intent log. The issue is that |
| 1292 | * immediate writes contain committed data, but in a txg that was |
| 1293 | * *not* committed. Upon opening the pool after an unclean shutdown, |
| 1294 | * the intent log claims all blocks that contain immediate write data |
| 1295 | * so that the SPA knows they're in use. |
| 1296 | * |
| 1297 | * All claims *must* be resolved in the first txg -- before the SPA |
| 1298 | * starts allocating blocks -- so that nothing is allocated twice. |
| 1299 | * If txg == 0 we just verify that the block is claimable. |
| 1300 | */ |
| 1301 | ASSERT3U(spa->spa_uberblock.ub_rootbp.blk_birth, <, |
| 1302 | spa_min_claim_txg(spa)); |
| 1303 | ASSERT(txg == spa_min_claim_txg(spa) || txg == 0); |
| 1304 | ASSERT(!BP_GET_DEDUP(bp) || !spa_writeable(spa)); /* zdb(8) */ |
| 1305 | |
| 1306 | zio = zio_create(pio, spa, txg, bp, NULL, BP_GET_PSIZE(bp), |
| 1307 | BP_GET_PSIZE(bp), done, private, ZIO_TYPE_CLAIM, ZIO_PRIORITY_NOW, |
| 1308 | flags, NULL, 0, NULL, ZIO_STAGE_OPEN, ZIO_CLAIM_PIPELINE); |
| 1309 | ASSERT0(zio->io_queued_timestamp); |
| 1310 | |
| 1311 | return (zio); |
| 1312 | } |
| 1313 | |
| 1314 | zio_t * |
| 1315 | zio_ioctl(zio_t *pio, spa_t *spa, vdev_t *vd, int cmd, |
no test coverage detected