Print this page
4045 zfs write throttle & i/o scheduler performance work
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/dnode.c
          +++ new/usr/src/uts/common/fs/zfs/dnode.c
↓ open down ↓ 1780 lines elided ↑ open up ↑
1781 1781                  ASSERT0(P2PHASE(space, 1<<DEV_BSHIFT));
1782 1782                  dn->dn_phys->dn_used = space >> DEV_BSHIFT;
1783 1783          } else {
1784 1784                  dn->dn_phys->dn_used = space;
1785 1785                  dn->dn_phys->dn_flags |= DNODE_FLAG_USED_BYTES;
1786 1786          }
1787 1787          mutex_exit(&dn->dn_mtx);
1788 1788  }
1789 1789  
1790 1790  /*
1791      - * Call when we think we're going to write/free space in open context.
1792      - * Be conservative (ie. OK to write less than this or free more than
1793      - * this, but don't write more or free less).
     1791 + * Call when we think we're going to write/free space in open context to track
     1792 + * the amount of memory in use by the currently open txg.
1794 1793   */
1795 1794  void
1796 1795  dnode_willuse_space(dnode_t *dn, int64_t space, dmu_tx_t *tx)
1797 1796  {
1798 1797          objset_t *os = dn->dn_objset;
1799 1798          dsl_dataset_t *ds = os->os_dsl_dataset;
     1799 +        int64_t aspace = spa_get_asize(os->os_spa, space);
1800 1800  
1801      -        if (space > 0)
1802      -                space = spa_get_asize(os->os_spa, space);
     1801 +        if (ds != NULL) {
     1802 +                dsl_dir_willuse_space(ds->ds_dir, aspace, tx);
     1803 +                dsl_pool_dirty_space(dmu_tx_pool(tx), space, tx);
     1804 +        }
1803 1805  
1804      -        if (ds)
1805      -                dsl_dir_willuse_space(ds->ds_dir, space, tx);
1806      -
1807      -        dmu_tx_willuse_space(tx, space);
     1806 +        dmu_tx_willuse_space(tx, aspace);
1808 1807  }
1809 1808  
1810 1809  /*
1811 1810   * Scans a block at the indicated "level" looking for a hole or data,
1812 1811   * depending on 'flags'.
1813 1812   *
1814 1813   * If level > 0, then we are scanning an indirect block looking at its
1815 1814   * pointers.  If level == 0, then we are looking at a block of dnodes.
1816 1815   *
1817 1816   * If we don't find what we are looking for in the block, we return ESRCH.
↓ open down ↓ 190 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX