Lines Matching refs:db

33 make_abd_for_dbuf(dmu_buf_impl_t *db, abd_t *data, uint64_t offset,  in make_abd_for_dbuf()  argument
36 size_t buf_size = db->db.db_size; in make_abd_for_dbuf()
40 ASSERT(MUTEX_HELD(&db->db_mtx)); in make_abd_for_dbuf()
42 if (offset > db->db.db_offset) { in make_abd_for_dbuf()
43 size_t pre_size = offset - db->db.db_offset; in make_abd_for_dbuf()
48 buf_off = db->db.db_offset - offset; in make_abd_for_dbuf()
92 dmu_buf_impl_t *db = dr->dr_dbuf; in dmu_write_direct_done() local
96 mutex_enter(&db->db_mtx); in dmu_write_direct_done()
97 ASSERT3P(db->db_buf, ==, NULL); in dmu_write_direct_done()
99 ASSERT3P(db->db.db_data, ==, NULL); in dmu_write_direct_done()
100 db->db_state = DB_UNCACHED; in dmu_write_direct_done()
101 mutex_exit(&db->db_mtx); in dmu_write_direct_done()
121 mutex_enter(&db->db_mtx); in dmu_write_direct_done()
122 VERIFY3B(dbuf_undirty(db, dsa->dsa_tx), ==, B_FALSE); in dmu_write_direct_done()
123 mutex_exit(&db->db_mtx); in dmu_write_direct_done()
131 dmu_write_direct(zio_t *pio, dmu_buf_impl_t *db, abd_t *data, dmu_tx_t *tx) in dmu_write_direct() argument
133 objset_t *os = db->db_objset; in dmu_write_direct()
139 db->db.db_object, db->db_level, db->db_blkid); in dmu_write_direct()
141 DB_DNODE_ENTER(db); in dmu_write_direct()
143 dmu_write_policy(os, DB_DNODE(db), db->db_level, in dmu_write_direct()
145 DB_DNODE_EXIT(db); in dmu_write_direct()
151 dmu_buf_will_clone_or_dio(&db->db, tx); in dmu_write_direct()
153 mutex_enter(&db->db_mtx); in dmu_write_direct()
159 dr_head = list_head(&db->db_dirty_records); in dmu_write_direct()
162 dr_head->dr_accounted = db->db.db_size; in dmu_write_direct()
165 if (db->db_blkptr != NULL) { in dmu_write_direct()
171 *bp = *db->db_blkptr; in dmu_write_direct()
180 if (list_next(&db->db_dirty_records, dr_head) != NULL) in dmu_write_direct()
187 mutex_exit(&db->db_mtx); in dmu_write_direct()
196 db->db.db_size, db->db.db_size, &zp, in dmu_write_direct()
226 dmu_buf_impl_t *db = (dmu_buf_impl_t *)dbp[i]; in dmu_write_abd() local
229 db->db.db_offset - offset, dn->dn_datablksz); in dmu_write_abd()
231 zfs_racct_write(spa, db->db.db_size, 1, flags); in dmu_write_abd()
232 err = dmu_write_direct(pio, db, abd, tx); in dmu_write_abd()
266 dmu_buf_impl_t *db = (dmu_buf_impl_t *)dbp[i]; in dmu_read_abd() local
271 mutex_enter(&db->db_mtx); in dmu_read_abd()
274 db->db.db_object, db->db_level, db->db_blkid); in dmu_read_abd()
280 while (db->db_state == DB_READ) in dmu_read_abd()
281 cv_wait(&db->db_changed, &db->db_mtx); in dmu_read_abd()
283 err = dmu_buf_get_bp_from_dbuf(db, &bp); in dmu_read_abd()
285 mutex_exit(&db->db_mtx); in dmu_read_abd()
294 if (bp == NULL || BP_IS_HOLE(bp) || db->db_state == DB_CACHED) { in dmu_read_abd()
295 size_t aoff = offset < db->db.db_offset ? in dmu_read_abd()
296 db->db.db_offset - offset : 0; in dmu_read_abd()
297 size_t boff = offset > db->db.db_offset ? in dmu_read_abd()
298 offset - db->db.db_offset : 0; in dmu_read_abd()
299 size_t len = MIN(size - aoff, db->db.db_size - boff); in dmu_read_abd()
301 if (db->db_state == DB_CACHED) { in dmu_read_abd()
306 err = dmu_buf_untransform_direct(db, spa); in dmu_read_abd()
309 (char *)db->db.db_data + boff, aoff, len); in dmu_read_abd()
314 mutex_exit(&db->db_mtx); in dmu_read_abd()
318 mbuf = make_abd_for_dbuf(db, data, offset, size); in dmu_read_abd()
332 zio_t *cio = zio_read(rio, spa, bp, mbuf, db->db.db_size, in dmu_read_abd()
335 mutex_exit(&db->db_mtx); in dmu_read_abd()
337 zfs_racct_read(spa, db->db.db_size, 1, flags); in dmu_read_abd()