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/dsl_scan.c
          +++ new/usr/src/uts/common/fs/zfs/dsl_scan.c
↓ open down ↓ 1619 lines elided ↑ open up ↑
1620 1620  static int
1621 1621  dsl_scan_scrub_cb(dsl_pool_t *dp,
1622 1622      const blkptr_t *bp, const zbookmark_t *zb)
1623 1623  {
1624 1624          dsl_scan_t *scn = dp->dp_scan;
1625 1625          size_t size = BP_GET_PSIZE(bp);
1626 1626          spa_t *spa = dp->dp_spa;
1627 1627          uint64_t phys_birth = BP_PHYSICAL_BIRTH(bp);
1628 1628          boolean_t needs_io;
1629 1629          int zio_flags = ZIO_FLAG_SCAN_THREAD | ZIO_FLAG_RAW | ZIO_FLAG_CANFAIL;
1630      -        int zio_priority;
1631 1630          int scan_delay = 0;
1632 1631  
1633 1632          if (phys_birth <= scn->scn_phys.scn_min_txg ||
1634 1633              phys_birth >= scn->scn_phys.scn_max_txg)
1635 1634                  return (0);
1636 1635  
1637 1636          count_block(dp->dp_blkstats, bp);
1638 1637  
1639 1638          ASSERT(DSL_SCAN_IS_SCRUB_RESILVER(scn));
1640 1639          if (scn->scn_phys.scn_func == POOL_SCAN_SCRUB) {
1641 1640                  zio_flags |= ZIO_FLAG_SCRUB;
1642      -                zio_priority = ZIO_PRIORITY_SCRUB;
1643 1641                  needs_io = B_TRUE;
1644 1642                  scan_delay = zfs_scrub_delay;
1645 1643          } else {
1646 1644                  ASSERT3U(scn->scn_phys.scn_func, ==, POOL_SCAN_RESILVER);
1647 1645                  zio_flags |= ZIO_FLAG_RESILVER;
1648      -                zio_priority = ZIO_PRIORITY_RESILVER;
1649 1646                  needs_io = B_FALSE;
1650 1647                  scan_delay = zfs_resilver_delay;
1651 1648          }
1652 1649  
1653 1650          /* If it's an intent log block, failure is expected. */
1654 1651          if (zb->zb_level == ZB_ZIL_LEVEL)
1655 1652                  zio_flags |= ZIO_FLAG_SPECULATIVE;
1656 1653  
1657 1654          for (int d = 0; d < BP_GET_NDVAS(bp); d++) {
1658 1655                  vdev_t *vd = vdev_lookup_top(spa,
↓ open down ↓ 37 lines elided ↑ open up ↑
1696 1693                  mutex_exit(&spa->spa_scrub_lock);
1697 1694  
1698 1695                  /*
1699 1696                   * If we're seeing recent (zfs_scan_idle) "important" I/Os
1700 1697                   * then throttle our workload to limit the impact of a scan.
1701 1698                   */
1702 1699                  if (ddi_get_lbolt64() - spa->spa_last_io <= zfs_scan_idle)
1703 1700                          delay(scan_delay);
1704 1701  
1705 1702                  zio_nowait(zio_read(NULL, spa, bp, data, size,
1706      -                    dsl_scan_scrub_done, NULL, zio_priority,
     1703 +                    dsl_scan_scrub_done, NULL, ZIO_PRIORITY_SCRUB,
1707 1704                      zio_flags, zb));
1708 1705          }
1709 1706  
1710 1707          /* do not relocate this block */
1711 1708          return (0);
1712 1709  }
1713 1710  
1714 1711  int
1715 1712  dsl_scan(dsl_pool_t *dp, pool_scan_func_t func)
1716 1713  {
↓ open down ↓ 18 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX