Print this page
Possibility to physically reserve space without writing leaf blocks

@@ -808,10 +808,32 @@
         dnode_rele(dn, FTAG);
         return (err);
 }
 
 void
+dmu_write_zero(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, dmu_tx_t *tx)
+{
+        dmu_buf_t       **dbp;
+        int             numbufs, i;
+
+        VERIFY(0 == dmu_buf_hold_array(os, object, offset, size,
+            FALSE, FTAG, &numbufs, &dbp));
+
+        for (i = 0; i < numbufs; i++) {
+                dmu_buf_t *db = dbp[i];
+
+                dmu_buf_will_zero_fill(db, tx);
+
+                memset(db->db_data, 0, db->db_size);
+
+                dmu_buf_fill_done(db, tx);
+        }
+
+        dmu_buf_rele_array(dbp, numbufs, FTAG);
+}
+
+void
 dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
     const void *buf, dmu_tx_t *tx)
 {
         dmu_buf_t **dbp;
         int numbufs, i;

@@ -1794,10 +1816,11 @@
         zp->zp_level = level;
         zp->zp_copies = MIN(copies, spa_max_replication(os->os_spa));
         zp->zp_dedup = dedup;
         zp->zp_dedup_verify = dedup && dedup_verify;
         zp->zp_nopwrite = nopwrite;
+        zp->zp_zero_write = B_FALSE;
 }
 
 int
 dmu_offset_next(objset_t *os, uint64_t object, boolean_t hole, uint64_t *off)
 {