Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Oct 2014 17:27:50 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r272665 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201410061727.s96HRoMP001229@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Mon Oct  6 17:27:49 2014
New Revision: 272665
URL: https://svnweb.freebsd.org/changeset/base/272665

Log:
  MFC r271532: MFV r271515:
  
  Add a new tunable/sysctl, vfs.zfs.free_max_blocks, which can be used to
  limit how many blocks can be free'ed before a new transaction group is
  created.  The default is no limit (infinite), but we should probably have
  a lower default, e.g. 100,000.
  
  With this limit, we can guard against the case where ZFS could run out of
  memory when destroying large numbers of blocks in a single transaction
  group, as the entire DDT needs to be brought into memory.
  
  Illumos issue:
      5138 add tunable for maximum number of blocks freed in one txg

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c	Mon Oct  6 17:14:31 2014	(r272664)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c	Mon Oct  6 17:27:49 2014	(r272665)
@@ -99,6 +99,11 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, no_scrub_
     &zfs_no_scrub_prefetch, 0, "Disable scrub prefetching");
 
 enum ddt_class zfs_scrub_ddt_class_max = DDT_CLASS_DUPLICATE;
+/* max number of blocks to free in a single TXG */
+uint64_t zfs_free_max_blocks = UINT64_MAX;
+SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, free_max_blocks, CTLFLAG_RWTUN,
+    &zfs_free_max_blocks, 0, "Maximum number of blocks to free in one TXG");
+
 
 #define	DSL_SCAN_IS_SCRUB_RESILVER(scn) \
 	((scn)->scn_phys.scn_func == POOL_SCAN_SCRUB || \
@@ -1350,6 +1355,9 @@ dsl_scan_free_should_pause(dsl_scan_t *s
 	if (zfs_recover)
 		return (B_FALSE);
 
+	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 &&



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410061727.s96HRoMP001229>