Lines Matching refs:db
44 dmu_buf_impl_t *db; in dnode_increase_indirection() local
57 db = dbuf_hold_level(dn, dn->dn_phys->dn_nlevels, 0, FTAG); in dnode_increase_indirection()
58 ASSERT(db != NULL); in dnode_increase_indirection()
78 (void) dbuf_read(db, NULL, DB_RF_MUST_SUCCEED|DB_RF_HAVESTRUCT); in dnode_increase_indirection()
81 rw_enter(&db->db_rwlock, RW_WRITER); in dnode_increase_indirection()
82 ASSERT(db->db.db_data); in dnode_increase_indirection()
83 ASSERT(arc_released(db->db_buf)); in dnode_increase_indirection()
84 ASSERT3U(sizeof (blkptr_t) * nblkptr, <=, db->db.db_size); in dnode_increase_indirection()
85 memcpy(db->db.db_data, dn->dn_phys->dn_blkptr, in dnode_increase_indirection()
87 arc_buf_freeze(db->db_buf); in dnode_increase_indirection()
101 ASSERT(child->db_parent->db_level == db->db_level); in dnode_increase_indirection()
110 child->db_parent = db; in dnode_increase_indirection()
111 dbuf_add_ref(db, child); in dnode_increase_indirection()
112 if (db->db.db_data) in dnode_increase_indirection()
113 child->db_blkptr = (blkptr_t *)db->db.db_data + i; in dnode_increase_indirection()
124 rw_exit(&db->db_rwlock); in dnode_increase_indirection()
128 dbuf_rele(db, FTAG); in dnode_increase_indirection()
176 free_verify(dmu_buf_impl_t *db, uint64_t start, uint64_t end, dmu_tx_t *tx) in free_verify() argument
184 DB_DNODE_ENTER(db); in free_verify()
185 dn = DB_DNODE(db); in free_verify()
187 off = start - (db->db_blkid << epbs); in free_verify()
192 ASSERT3U(start, >=, (db->db_blkid << epbs)); in free_verify()
193 ASSERT3U(db->db_level, >, 0); in free_verify()
194 ASSERT3U(db->db.db_size, ==, 1 << dn->dn_phys->dn_indblkshift); in free_verify()
195 ASSERT3U(off+num, <=, db->db.db_size >> SPA_BLKPTRSHIFT); in free_verify()
196 ASSERT(db->db_blkptr != NULL); in free_verify()
203 ASSERT(db->db_level == 1); in free_verify()
206 err = dbuf_hold_impl(dn, db->db_level - 1, in free_verify()
207 (db->db_blkid << epbs) + i, TRUE, FALSE, FTAG, &child); in free_verify()
218 for (j = 0; j < child->db.db_size >> 3; j++) { in free_verify()
235 buf = child->db.db_data; in free_verify()
238 for (j = 0; j < child->db.db_size >> 3; j++) { in free_verify()
253 DB_DNODE_EXIT(db); in free_verify()
273 free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, in free_children() argument
288 if (db->db_state != DB_CACHED) in free_children()
289 (void) dbuf_read(db, NULL, DB_RF_MUST_SUCCEED); in free_children()
307 db_lock_type_t dblt = dmu_buf_lock_parent(db, RW_READER, FTAG); in free_children()
308 VERIFY(BP_GET_FILL(db->db_blkptr) == 0 || db->db_dirtycnt > 0); in free_children()
309 dmu_buf_unlock_parent(db, dblt, FTAG); in free_children()
311 dbuf_release_bp(db); in free_children()
312 bp = db->db.db_data; in free_children()
314 DB_DNODE_ENTER(db); in free_children()
315 dn = DB_DNODE(db); in free_children()
318 shift = (db->db_level - 1) * epbs; in free_children()
319 dbstart = db->db_blkid << epbs; in free_children()
326 dbend = ((db->db_blkid + 1) << epbs) - 1; in free_children()
333 if (db->db_level == 1) { in free_children()
334 FREE_VERIFY(db, start, end, tx); in free_children()
335 rw_enter(&db->db_rwlock, RW_WRITER); in free_children()
337 rw_exit(&db->db_rwlock); in free_children()
343 VERIFY0(dbuf_hold_impl(dn, db->db_level - 1, in free_children()
354 rw_enter(&db->db_rwlock, RW_WRITER); in free_children()
355 for (i = 0, bp = db->db.db_data; i < 1 << epbs; i++, bp++) in free_children()
357 memset(db->db.db_data, 0, db->db.db_size); in free_children()
358 free_blocks(dn, db->db_blkptr, 1, tx); in free_children()
359 rw_exit(&db->db_rwlock); in free_children()
362 DB_DNODE_EXIT(db); in free_children()
363 arc_buf_freeze(db->db_buf); in free_children()
400 dmu_buf_impl_t *db; in dnode_sync_free_range_impl() local
409 TRUE, FALSE, FTAG, &db)); in dnode_sync_free_range_impl()
411 free_children(db, blkid, nblks, free_indirects, tx); in dnode_sync_free_range_impl()
412 dbuf_rele(db, FTAG); in dnode_sync_free_range_impl()
467 dmu_buf_impl_t *db, *db_next; in dnode_evict_dbufs() local
472 for (db = avl_first(&dn->dn_dbufs); db != NULL; db = db_next) { in dnode_evict_dbufs()
475 DB_DNODE_ENTER(db); in dnode_evict_dbufs()
476 ASSERT3P(DB_DNODE(db), ==, dn); in dnode_evict_dbufs()
477 DB_DNODE_EXIT(db); in dnode_evict_dbufs()
480 mutex_enter(&db->db_mtx); in dnode_evict_dbufs()
481 if (db->db_state != DB_EVICTING && in dnode_evict_dbufs()
482 zfs_refcount_is_zero(&db->db_holds)) { in dnode_evict_dbufs()
483 db_marker->db_level = db->db_level; in dnode_evict_dbufs()
484 db_marker->db_blkid = db->db_blkid; in dnode_evict_dbufs()
492 db_marker->db_parent = (void *)((uintptr_t)db - 1); in dnode_evict_dbufs()
493 avl_insert_here(&dn->dn_dbufs, db_marker, db, in dnode_evict_dbufs()
509 dbuf_destroy(db); in dnode_evict_dbufs()
514 db->db_pending_evict = TRUE; in dnode_evict_dbufs()
515 mutex_exit(&db->db_mtx); in dnode_evict_dbufs()
516 db_next = AVL_NEXT(&dn->dn_dbufs, db); in dnode_evict_dbufs()
548 dmu_buf_impl_t *db = dr->dr_dbuf; in dnode_undirty_dbufs() local
551 if (db->db_level != 0) in dnode_undirty_dbufs()
554 mutex_enter(&db->db_mtx); in dnode_undirty_dbufs()
557 ASSERT(list_head(&db->db_dirty_records) == dr); in dnode_undirty_dbufs()
558 list_remove_head(&db->db_dirty_records); in dnode_undirty_dbufs()
559 ASSERT(list_is_empty(&db->db_dirty_records)); in dnode_undirty_dbufs()
560 db->db_dirtycnt -= 1; in dnode_undirty_dbufs()
561 if (db->db_level == 0) { in dnode_undirty_dbufs()
562 ASSERT(db->db_blkid == DMU_BONUS_BLKID || in dnode_undirty_dbufs()
563 dr->dt.dl.dr_data == db->db_buf); in dnode_undirty_dbufs()
570 dbuf_rele_and_unlock(db, (void *)(uintptr_t)txg, B_FALSE); in dnode_undirty_dbufs()
613 dmu_buf_will_dirty(&dn->dn_dbuf->db, tx); in dnode_sync_free()