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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/dmu.c
          +++ new/usr/src/uts/common/fs/zfs/dmu.c
↓ open down ↓ 802 lines elided ↑ open up ↑
 803  803                          size -= tocpy;
 804  804                          buf = (char *)buf + tocpy;
 805  805                  }
 806  806                  dmu_buf_rele_array(dbp, numbufs, FTAG);
 807  807          }
 808  808          dnode_rele(dn, FTAG);
 809  809          return (err);
 810  810  }
 811  811  
 812  812  void
      813 +dmu_write_zero(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, dmu_tx_t *tx)
      814 +{
      815 +        dmu_buf_t       **dbp;
      816 +        int             numbufs, i;
      817 +
      818 +        VERIFY(0 == dmu_buf_hold_array(os, object, offset, size,
      819 +            FALSE, FTAG, &numbufs, &dbp));
      820 +
      821 +        for (i = 0; i < numbufs; i++) {
      822 +                dmu_buf_t *db = dbp[i];
      823 +
      824 +                dmu_buf_will_zero_fill(db, tx);
      825 +
      826 +                memset(db->db_data, 0, db->db_size);
      827 +
      828 +                dmu_buf_fill_done(db, tx);
      829 +        }
      830 +
      831 +        dmu_buf_rele_array(dbp, numbufs, FTAG);
      832 +}
      833 +
      834 +void
 813  835  dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
 814  836      const void *buf, dmu_tx_t *tx)
 815  837  {
 816  838          dmu_buf_t **dbp;
 817  839          int numbufs, i;
 818  840  
 819  841          if (size == 0)
 820  842                  return;
 821  843  
 822  844          VERIFY(0 == dmu_buf_hold_array(os, object, offset, size,
↓ open down ↓ 966 lines elided ↑ open up ↑
1789 1811          }
1790 1812  
1791 1813          zp->zp_checksum = checksum;
1792 1814          zp->zp_compress = compress;
1793 1815          zp->zp_type = (wp & WP_SPILL) ? dn->dn_bonustype : type;
1794 1816          zp->zp_level = level;
1795 1817          zp->zp_copies = MIN(copies, spa_max_replication(os->os_spa));
1796 1818          zp->zp_dedup = dedup;
1797 1819          zp->zp_dedup_verify = dedup && dedup_verify;
1798 1820          zp->zp_nopwrite = nopwrite;
     1821 +        zp->zp_zero_write = B_FALSE;
1799 1822  }
1800 1823  
1801 1824  int
1802 1825  dmu_offset_next(objset_t *os, uint64_t object, boolean_t hole, uint64_t *off)
1803 1826  {
1804 1827          dnode_t *dn;
1805 1828          int i, err;
1806 1829  
1807 1830          err = dnode_hold(os, object, FTAG, &dn);
1808 1831          if (err)
↓ open down ↓ 179 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX