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

Function dbuf_find

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

Source from the content-addressed store, hash-verified

320 (dbuf)->db_blkid == (blkid))
321
322dmu_buf_impl_t *
323dbuf_find(objset_t *os, uint64_t obj, uint8_t level, uint64_t blkid)
324{
325 dbuf_hash_table_t *h = &dbuf_hash_table;
326 uint64_t hv;
327 uint64_t idx;
328 dmu_buf_impl_t *db;
329
330 hv = dbuf_hash(os, obj, level, blkid);
331 idx = hv & h->hash_table_mask;
332
333 mutex_enter(DBUF_HASH_MUTEX(h, idx));
334 for (db = h->hash_table[idx]; db != NULL; db = db->db_hash_next) {
335 if (DBUF_EQUAL(db, os, obj, level, blkid)) {
336 mutex_enter(&db->db_mtx);
337 if (db->db_state != DB_EVICTING) {
338 mutex_exit(DBUF_HASH_MUTEX(h, idx));
339 return (db);
340 }
341 mutex_exit(&db->db_mtx);
342 }
343 }
344 mutex_exit(DBUF_HASH_MUTEX(h, idx));
345 return (NULL);
346}
347
348static dmu_buf_impl_t *
349dbuf_find_bonus(objset_t *os, uint64_t object)

Callers 5

dbuf_dirty_lightweightFunction · 0.85
dbuf_prefetch_implFunction · 0.85
dbuf_hold_implFunction · 0.85
dbuf_try_add_refFunction · 0.85

Calls 3

dbuf_hashFunction · 0.85
mutex_enterFunction · 0.85
mutex_exitFunction · 0.85

Tested by

no test coverage detected