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

Function dbuf_read_done

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

Source from the content-addressed store, hash-verified

1246}
1247
1248static void
1249dbuf_read_done(zio_t *zio, const zbookmark_phys_t *zb, const blkptr_t *bp,
1250 arc_buf_t *buf, void *vdb)
1251{
1252 dmu_buf_impl_t *db = vdb;
1253
1254 mutex_enter(&db->db_mtx);
1255 ASSERT3U(db->db_state, ==, DB_READ);
1256 /*
1257 * All reads are synchronous, so we must have a hold on the dbuf
1258 */
1259 ASSERT(zfs_refcount_count(&db->db_holds) > 0);
1260 ASSERT(db->db_buf == NULL);
1261 ASSERT(db->db.db_data == NULL);
1262 if (buf == NULL) {
1263 /* i/o error */
1264 ASSERT(zio == NULL || zio->io_error != 0);
1265 ASSERT(db->db_blkid != DMU_BONUS_BLKID);
1266 ASSERT3P(db->db_buf, ==, NULL);
1267 db->db_state = DB_UNCACHED;
1268 DTRACE_SET_STATE(db, "i/o error");
1269 } else if (db->db_level == 0 && db->db_freed_in_flight) {
1270 /* freed in flight */
1271 ASSERT(zio == NULL || zio->io_error == 0);
1272 arc_release(buf, db);
1273 bzero(buf->b_data, db->db.db_size);
1274 arc_buf_freeze(buf);
1275 db->db_freed_in_flight = FALSE;
1276 dbuf_set_data(db, buf);
1277 db->db_state = DB_CACHED;
1278 DTRACE_SET_STATE(db, "freed in flight");
1279 } else {
1280 /* success */
1281 ASSERT(zio == NULL || zio->io_error == 0);
1282 dbuf_set_data(db, buf);
1283 db->db_state = DB_CACHED;
1284 DTRACE_SET_STATE(db, "successful read");
1285 }
1286 cv_broadcast(&db->db_changed);
1287 dbuf_rele_and_unlock(db, NULL, B_FALSE);
1288}
1289
1290/*
1291 * Shortcut for performing reads on bonus dbufs. Returns

Callers

nothing calls this directly

Calls 8

mutex_enterFunction · 0.85
zfs_refcount_countFunction · 0.85
arc_releaseFunction · 0.85
bzeroFunction · 0.85
arc_buf_freezeFunction · 0.85
dbuf_set_dataFunction · 0.85
cv_broadcastFunction · 0.85
dbuf_rele_and_unlockFunction · 0.85

Tested by

no test coverage detected