MCPcopy Create free account
hub / github.com/F-Stack/f-stack / zio_claim

Function zio_claim

freebsd/contrib/openzfs/module/zfs/zio.c:1277–1312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1275}
1276
1277zio_t *
1278zio_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
1314zio_t *
1315zio_ioctl(zio_t *pio, spa_t *spa, vdev_t *vd, int cmd,

Callers 3

zio_claim_gangFunction · 0.85
zil_claim_log_blockFunction · 0.85
zdb_count_blockFunction · 0.85

Calls 5

zfs_blkptr_verifyFunction · 0.85
zio_nullFunction · 0.85
spa_min_claim_txgFunction · 0.85
spa_writeableFunction · 0.85
zio_createFunction · 0.85

Tested by

no test coverage detected