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

Function dbuf_loan_arcbuf

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

* Loan out an arc_buf for read. Return the loaned arc_buf. */

Source from the content-addressed store, hash-verified

1138 * Loan out an arc_buf for read. Return the loaned arc_buf.
1139 */
1140arc_buf_t *
1141dbuf_loan_arcbuf(dmu_buf_impl_t *db)
1142{
1143 arc_buf_t *abuf;
1144
1145 ASSERT(db->db_blkid != DMU_BONUS_BLKID);
1146 mutex_enter(&db->db_mtx);
1147 if (arc_released(db->db_buf) || zfs_refcount_count(&db->db_holds) > 1) {
1148 int blksz = db->db.db_size;
1149 spa_t *spa = db->db_objset->os_spa;
1150
1151 mutex_exit(&db->db_mtx);
1152 abuf = arc_loan_buf(spa, B_FALSE, blksz);
1153 bcopy(db->db.db_data, abuf->b_data, blksz);
1154 } else {
1155 abuf = db->db_buf;
1156 arc_loan_inuse_buf(abuf, db);
1157 db->db_buf = NULL;
1158 dbuf_clear_data(db);
1159 mutex_exit(&db->db_mtx);
1160 }
1161 return (abuf);
1162}
1163
1164/*
1165 * Calculate which level n block references the data at the level 0 offset

Callers

nothing calls this directly

Calls 7

mutex_enterFunction · 0.85
arc_releasedFunction · 0.85
zfs_refcount_countFunction · 0.85
mutex_exitFunction · 0.85
arc_loan_bufFunction · 0.85
arc_loan_inuse_bufFunction · 0.85
dbuf_clear_dataFunction · 0.85

Tested by

no test coverage detected