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

Function dnode_setbonuslen

freebsd/contrib/openzfs/module/zfs/dnode.c:385–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383}
384
385void
386dnode_setbonuslen(dnode_t *dn, int newsize, dmu_tx_t *tx)
387{
388 ASSERT3U(zfs_refcount_count(&dn->dn_holds), >=, 1);
389
390 dnode_setdirty(dn, tx);
391 rw_enter(&dn->dn_struct_rwlock, RW_WRITER);
392 ASSERT3U(newsize, <=, DN_SLOTS_TO_BONUSLEN(dn->dn_num_slots) -
393 (dn->dn_nblkptr-1) * sizeof (blkptr_t));
394
395 if (newsize < dn->dn_bonuslen) {
396 /* clear any data after the end of the new size */
397 size_t diff = dn->dn_bonuslen - newsize;
398 char *data_end = ((char *)dn->dn_bonus->db.db_data) + newsize;
399 bzero(data_end, diff);
400 }
401
402 dn->dn_bonuslen = newsize;
403 if (newsize == 0)
404 dn->dn_next_bonuslen[tx->tx_txg & TXG_MASK] = DN_ZERO_BONUSLEN;
405 else
406 dn->dn_next_bonuslen[tx->tx_txg & TXG_MASK] = dn->dn_bonuslen;
407 rw_exit(&dn->dn_struct_rwlock);
408}
409
410void
411dnode_setbonus_type(dnode_t *dn, dmu_object_type_t newtype, dmu_tx_t *tx)

Callers 1

dmu_set_bonusFunction · 0.85

Calls 5

zfs_refcount_countFunction · 0.85
dnode_setdirtyFunction · 0.85
rw_enterFunction · 0.85
bzeroFunction · 0.85
rw_exitFunction · 0.85

Tested by

no test coverage detected