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

Function dbuf_write

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

Issue I/O to commit a dirty buffer to disk. */

Source from the content-addressed store, hash-verified

4771
4772/* Issue I/O to commit a dirty buffer to disk. */
4773static void
4774dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx)
4775{
4776 dmu_buf_impl_t *db = dr->dr_dbuf;
4777 dnode_t *dn = dr->dr_dnode;
4778 objset_t *os;
4779 dmu_buf_impl_t *parent = db->db_parent;
4780 uint64_t txg = tx->tx_txg;
4781 zbookmark_phys_t zb;
4782 zio_prop_t zp;
4783 zio_t *pio; /* parent I/O */
4784 int wp_flag = 0;
4785
4786 ASSERT(dmu_tx_is_syncing(tx));
4787
4788 os = dn->dn_objset;
4789
4790 if (db->db_state != DB_NOFILL) {
4791 if (db->db_level > 0 || dn->dn_type == DMU_OT_DNODE) {
4792 /*
4793 * Private object buffers are released here rather
4794 * than in dbuf_dirty() since they are only modified
4795 * in the syncing context and we don't want the
4796 * overhead of making multiple copies of the data.
4797 */
4798 if (BP_IS_HOLE(db->db_blkptr)) {
4799 arc_buf_thaw(data);
4800 } else {
4801 dbuf_release_bp(db);
4802 }
4803 dbuf_remap(dn, db, tx);
4804 }
4805 }
4806
4807 if (parent != dn->dn_dbuf) {
4808 /* Our parent is an indirect block. */
4809 /* We have a dirty parent that has been scheduled for write. */
4810 ASSERT(parent && parent->db_data_pending);
4811 /* Our parent's buffer is one level closer to the dnode. */
4812 ASSERT(db->db_level == parent->db_level-1);
4813 /*
4814 * We're about to modify our parent's db_data by modifying
4815 * our block pointer, so the parent must be released.
4816 */
4817 ASSERT(arc_released(parent->db_buf));
4818 pio = parent->db_data_pending->dr_zio;
4819 } else {
4820 /* Our parent is the dnode itself. */
4821 ASSERT((db->db_level == dn->dn_phys->dn_nlevels-1 &&
4822 db->db_blkid != DMU_SPILL_BLKID) ||
4823 (db->db_blkid == DMU_SPILL_BLKID && db->db_level == 0));
4824 if (db->db_blkid != DMU_SPILL_BLKID)
4825 ASSERT3P(db->db_blkptr, ==,
4826 &dn->dn_phys->dn_blkptr[db->db_blkid]);
4827 pio = dn->dn_zio;
4828 }
4829
4830 ASSERT(db->db_level == 0 || data == db->db_buf);

Callers 2

dbuf_sync_indirectFunction · 0.85
dbuf_sync_leafFunction · 0.85

Calls 13

dmu_tx_is_syncingFunction · 0.85
arc_buf_thawFunction · 0.85
dbuf_release_bpFunction · 0.85
dbuf_remapFunction · 0.85
arc_releasedFunction · 0.85
dmu_write_policyFunction · 0.85
abd_get_from_bufFunction · 0.85
arc_buf_sizeFunction · 0.85
zio_writeFunction · 0.85
mutex_enterFunction · 0.85
zio_write_overrideFunction · 0.85
mutex_exitFunction · 0.85

Tested by

no test coverage detected