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>

@@ -68,10 +68,12 @@
 int zfs_resilver_min_time_ms = 3000; /* min millisecs to resilver per txg */
 boolean_t zfs_no_scrub_io = B_FALSE; /* set to disable scrub i/o */
 boolean_t zfs_no_scrub_prefetch = B_FALSE; /* set to disable srub prefetching */
 enum ddt_class zfs_scrub_ddt_class_max = DDT_CLASS_DUPLICATE;
 int dsl_scan_delay_completion = B_FALSE; /* set to delay scan completion */
+/* max number of blocks to free in a single TXG */
+uint64_t zfs_free_max_blocks = UINT64_MAX;
 
 #define DSL_SCAN_IS_SCRUB_RESILVER(scn) \
         ((scn)->scn_phys.scn_func == POOL_SCAN_SCRUB || \
         (scn)->scn_phys.scn_func == POOL_SCAN_RESILVER)
 

@@ -1313,10 +1315,13 @@
 static boolean_t
 dsl_scan_free_should_pause(dsl_scan_t *scn)
 {
         uint64_t elapsed_nanosecs;
 
+        if (scn->scn_visited_this_txg >= zfs_free_max_blocks)
+                return (B_TRUE);
+
         elapsed_nanosecs = gethrtime() - scn->scn_sync_start_time;
         return (elapsed_nanosecs / NANOSEC > zfs_txg_timeout ||
             (NSEC2MSEC(elapsed_nanosecs) > zfs_free_min_time_ms &&
             txg_sync_waiting(scn->scn_dp)) ||
             spa_shutting_down(scn->scn_dp->dp_spa));