Print this page
3970 add tunable for maximum number of blocks freed in one txg
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Adam Leventhal <ahl@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 ↓ 62 lines elided ↑ open up ↑
  63   63  int zfs_scrub_delay = 4;                /* number of ticks to delay scrub */
  64   64  int zfs_scan_idle = 50;                 /* idle window in clock ticks */
  65   65  
  66   66  int zfs_scan_min_time_ms = 1000; /* min millisecs to scrub per txg */
  67   67  int zfs_free_min_time_ms = 1000; /* min millisecs to free per txg */
  68   68  int zfs_resilver_min_time_ms = 3000; /* min millisecs to resilver per txg */
  69   69  boolean_t zfs_no_scrub_io = B_FALSE; /* set to disable scrub i/o */
  70   70  boolean_t zfs_no_scrub_prefetch = B_FALSE; /* set to disable srub prefetching */
  71   71  enum ddt_class zfs_scrub_ddt_class_max = DDT_CLASS_DUPLICATE;
  72   72  int dsl_scan_delay_completion = B_FALSE; /* set to delay scan completion */
       73 +/* max number of blocks to free in a single TXG */
       74 +uint64_t zfs_free_max_blocks = UINT64_MAX;
  73   75  
  74   76  #define DSL_SCAN_IS_SCRUB_RESILVER(scn) \
  75   77          ((scn)->scn_phys.scn_func == POOL_SCAN_SCRUB || \
  76   78          (scn)->scn_phys.scn_func == POOL_SCAN_RESILVER)
  77   79  
  78   80  extern int zfs_txg_timeout;
  79   81  
  80   82  /* the order has to match pool_scan_type */
  81   83  static scan_cb_t *scan_funcs[POOL_SCAN_FUNCS] = {
  82   84          NULL,
↓ open down ↓ 1225 lines elided ↑ open up ↑
1308 1310                          return;
1309 1311          }
1310 1312          zap_cursor_fini(&zc);
1311 1313  }
1312 1314  
1313 1315  static boolean_t
1314 1316  dsl_scan_free_should_pause(dsl_scan_t *scn)
1315 1317  {
1316 1318          uint64_t elapsed_nanosecs;
1317 1319  
     1320 +        if (scn->scn_visited_this_txg >= zfs_free_max_blocks)
     1321 +                return (B_TRUE);
     1322 +
1318 1323          elapsed_nanosecs = gethrtime() - scn->scn_sync_start_time;
1319 1324          return (elapsed_nanosecs / NANOSEC > zfs_txg_timeout ||
1320 1325              (NSEC2MSEC(elapsed_nanosecs) > zfs_free_min_time_ms &&
1321 1326              txg_sync_waiting(scn->scn_dp)) ||
1322 1327              spa_shutting_down(scn->scn_dp->dp_spa));
1323 1328  }
1324 1329  
1325 1330  static int
1326 1331  dsl_scan_free_block_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx)
1327 1332  {
↓ open down ↓ 396 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX