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

Function dbuf_write_ready

freebsd/contrib/openzfs/module/zfs/dbuf.c:4357–4445  ·  view source on GitHub ↗

ARGSUSED */

Source from the content-addressed store, hash-verified

4355
4356/* ARGSUSED */
4357static void
4358dbuf_write_ready(zio_t *zio, arc_buf_t *buf, void *vdb)
4359{
4360 dmu_buf_impl_t *db = vdb;
4361 dnode_t *dn;
4362 blkptr_t *bp = zio->io_bp;
4363 blkptr_t *bp_orig = &zio->io_bp_orig;
4364 spa_t *spa = zio->io_spa;
4365 int64_t delta;
4366 uint64_t fill = 0;
4367 int i;
4368
4369 ASSERT3P(db->db_blkptr, !=, NULL);
4370 ASSERT3P(&db->db_data_pending->dr_bp_copy, ==, bp);
4371
4372 DB_DNODE_ENTER(db);
4373 dn = DB_DNODE(db);
4374 delta = bp_get_dsize_sync(spa, bp) - bp_get_dsize_sync(spa, bp_orig);
4375 dnode_diduse_space(dn, delta - zio->io_prev_space_delta);
4376 zio->io_prev_space_delta = delta;
4377
4378 if (bp->blk_birth != 0) {
4379 ASSERT((db->db_blkid != DMU_SPILL_BLKID &&
4380 BP_GET_TYPE(bp) == dn->dn_type) ||
4381 (db->db_blkid == DMU_SPILL_BLKID &&
4382 BP_GET_TYPE(bp) == dn->dn_bonustype) ||
4383 BP_IS_EMBEDDED(bp));
4384 ASSERT(BP_GET_LEVEL(bp) == db->db_level);
4385 }
4386
4387 mutex_enter(&db->db_mtx);
4388
4389#ifdef ZFS_DEBUG
4390 if (db->db_blkid == DMU_SPILL_BLKID) {
4391 ASSERT(dn->dn_phys->dn_flags & DNODE_FLAG_SPILL_BLKPTR);
4392 ASSERT(!(BP_IS_HOLE(bp)) &&
4393 db->db_blkptr == DN_SPILL_BLKPTR(dn->dn_phys));
4394 }
4395#endif
4396
4397 if (db->db_level == 0) {
4398 mutex_enter(&dn->dn_mtx);
4399 if (db->db_blkid > dn->dn_phys->dn_maxblkid &&
4400 db->db_blkid != DMU_SPILL_BLKID) {
4401 ASSERT0(db->db_objset->os_raw_receive);
4402 dn->dn_phys->dn_maxblkid = db->db_blkid;
4403 }
4404 mutex_exit(&dn->dn_mtx);
4405
4406 if (dn->dn_type == DMU_OT_DNODE) {
4407 i = 0;
4408 while (i < db->db.db_size) {
4409 dnode_phys_t *dnp =
4410 (void *)(((char *)db->db.db_data) + i);
4411
4412 i += DNODE_MIN_SIZE;
4413 if (dnp->dn_type != DMU_OT_NONE) {
4414 fill++;

Callers 2

dbuf_write_nofill_readyFunction · 0.85

Calls 6

bp_get_dsize_syncFunction · 0.85
dnode_diduse_spaceFunction · 0.85
mutex_enterFunction · 0.85
mutex_exitFunction · 0.85
dmu_buf_lock_parentFunction · 0.85
dmu_buf_unlock_parentFunction · 0.85

Tested by

no test coverage detected