Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jun 2019 14:27:36 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r348919 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201906111427.x5BERajh015675@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Jun 11 14:27:35 2019
New Revision: 348919
URL: https://svnweb.freebsd.org/changeset/base/348919

Log:
  MFC r348577: MFV r348576: 9963 Seperate tunable for disabling ZIL vdev flush
  
  illumos/illumos-gate@f8fdf6812567ce1a3b76a6bee2ee3f04bd3fcaca
  
  Reviewed by: Matt Ahrens <matt@delphix.com>
  Reviewed by: Brad Lewis <brad.lewis@delphix.com>
  Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
  Approved by: Dan McDonald <danmcd@joyent.com>
  Author:     Prakash Surya <prakash.surya@delphix.com>

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
==============================================================================
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c	Tue Jun 11 14:26:55 2019	(r348918)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c	Tue Jun 11 14:27:35 2019	(r348919)
@@ -217,6 +217,15 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, standard_sm_blksz, CTLF
     &vdev_standard_sm_blksz, 0,
     "Block size for standard space map.  Power of 2 and greater than 4096.");
 
+/*
+ * Tunable parameter for debugging or performance analysis. Setting this
+ * will cause pool corruption on power loss if a volatile out-of-order
+ * write cache is enabled.
+ */
+boolean_t zfs_nocacheflush = B_FALSE;
+SYSCTL_INT(_vfs_zfs, OID_AUTO, cache_flush_disable, CTLFLAG_RWTUN,
+    &zfs_nocacheflush, 0, "Disable cache flush");
+
 /*PRINTFLIKE2*/
 void
 vdev_dbgmsg(vdev_t *vd, const char *fmt, ...)

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
==============================================================================
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c	Tue Jun 11 14:26:55 2019	(r348918)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c	Tue Jun 11 14:27:35 2019	(r348919)
@@ -239,6 +239,10 @@ vdev_file_io_start(zio_t *zio)
 
 		switch (zio->io_cmd) {
 		case DKIOCFLUSHWRITECACHE:
+
+			if (zfs_nocacheflush)
+				break;
+
 			zio->io_error = VOP_FSYNC(vf->vf_vnode, FSYNC | FDSYNC,
 			    kcred, NULL);
 			break;

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
==============================================================================
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c	Tue Jun 11 14:26:55 2019	(r348918)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c	Tue Jun 11 14:27:35 2019	(r348919)
@@ -98,13 +98,15 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, zil_replay_disable, CTL
     &zil_replay_disable, 0, "Disable intent logging replay");
 
 /*
- * Tunable parameter for debugging or performance analysis.  Setting
- * zfs_nocacheflush will cause corruption on power loss if a volatile
- * out-of-order write cache is enabled.
+ * Disable the DKIOCFLUSHWRITECACHE commands that are normally sent to
+ * the disk(s) by the ZIL after an LWB write has completed. Setting this
+ * will cause ZIL corruption on power loss if a volatile out-of-order
+ * write cache is enabled.
  */
-boolean_t zfs_nocacheflush = B_FALSE;
-SYSCTL_INT(_vfs_zfs, OID_AUTO, cache_flush_disable, CTLFLAG_RWTUN,
-    &zfs_nocacheflush, 0, "Disable cache flush");
+boolean_t zil_nocacheflush = B_FALSE;
+SYSCTL_INT(_vfs_zfs, OID_AUTO, zil_nocacheflush, CTLFLAG_RWTUN,
+    &zil_nocacheflush, 0, "Disable ZIL cache flush");
+
 boolean_t zfs_trim_enabled = B_TRUE;
 SYSCTL_DECL(_vfs_zfs_trim);
 SYSCTL_INT(_vfs_zfs_trim, OID_AUTO, enabled, CTLFLAG_RDTUN, &zfs_trim_enabled, 0,
@@ -989,7 +991,7 @@ zil_lwb_add_block(lwb_t *lwb, const blkptr_t *bp)
 	int ndvas = BP_GET_NDVAS(bp);
 	int i;
 
-	if (zfs_nocacheflush)
+	if (zil_nocacheflush)
 		return;
 
 	mutex_enter(&lwb->lwb_vdev_lock);
@@ -1013,7 +1015,7 @@ zil_lwb_add_txg(lwb_t *lwb, uint64_t txg)
 /*
  * This function is a called after all VDEVs associated with a given lwb
  * write have completed their DKIOCFLUSHWRITECACHE command; or as soon
- * as the lwb write completes, if "zfs_nocacheflush" is set.
+ * as the lwb write completes, if "zil_nocacheflush" is set.
  *
  * The intention is for this function to be called as soon as the
  * contents of an lwb are considered "stable" on disk, and will survive



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