Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Sep 2017 15:38:16 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r324016 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201709261538.v8QFcGcA013078@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Tue Sep 26 15:38:16 2017
New Revision: 324016
URL: https://svnweb.freebsd.org/changeset/base/324016

Log:
  fix r324011, MFV of r323535, 8585 improve batching done in zil_commit()
  
  I managed to commit an older version of the change.
  Plus, even the latest version was not ready for userland compilation.
  
  Reported by:	"O. Hartmann" <ohartmann@walstatt.org>,
  		cy
  MFC after:	1 week
  X-MFC with:	r324011

Modified:
  head/sys/cddl/compat/opensolaris/sys/time.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c

Modified: head/sys/cddl/compat/opensolaris/sys/time.h
==============================================================================
--- head/sys/cddl/compat/opensolaris/sys/time.h	Tue Sep 26 12:46:17 2017	(r324015)
+++ head/sys/cddl/compat/opensolaris/sys/time.h	Tue Sep 26 15:38:16 2017	(r324016)
@@ -40,6 +40,9 @@
 #define	MSEC2NSEC(m)	((hrtime_t)(m) * (NANOSEC / MILLISEC))
 #define	NSEC2MSEC(n)	((n) / (NANOSEC / MILLISEC))
 
+#define	USEC2NSEC(m)	((hrtime_t)(m) * (NANOSEC / MICROSEC))
+#define	NSEC2USEC(n)	((n) / (NANOSEC / MICROSEC))
+
 #define	NSEC2SEC(n)	((n) / (NANOSEC / SEC))
 #define	SEC2NSEC(m)	((hrtime_t)(m) * (NANOSEC / SEC))
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c	Tue Sep 26 12:46:17 2017	(r324015)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c	Tue Sep 26 15:38:16 2017	(r324016)
@@ -2283,8 +2283,13 @@ zil_commit_waiter(zilog_t *zilog, zil_commit_waiter_t 
 	 * zil_process_commit_list() function.
 	 */
 	int pct = MAX(zfs_commit_timeout_pct, 1);
+#if defined(illumos) || !defined(_KERNEL)
 	hrtime_t sleep = (zilog->zl_last_lwb_latency * pct) / 100;
 	hrtime_t wakeup = gethrtime() + sleep;
+#else
+	sbintime_t sleep = nstosbt((zilog->zl_last_lwb_latency * pct) / 100);
+	sbintime_t wakeup = getsbinuptime() + sleep;
+#endif
 	boolean_t timedout = B_FALSE;
 
 	while (!zcw->zcw_done) {
@@ -2322,7 +2327,7 @@ zil_commit_waiter(zilog_t *zilog, zil_commit_waiter_t 
 			 * timeout is reached; responsibility (2) from
 			 * the comment above this function.
 			 */
-#ifdef illumos
+#if defined(illumos) || !defined(_KERNEL)
 			clock_t timeleft = cv_timedwait_hires(&zcw->zcw_cv,
 			    &zcw->zcw_lock, wakeup, USEC2NSEC(1),
 			    CALLOUT_FLAG_ABSOLUTE);
@@ -2331,8 +2336,7 @@ zil_commit_waiter(zilog_t *zilog, zil_commit_waiter_t 
 				continue;
 #else
 			int wait_err = cv_timedwait_sbt(&zcw->zcw_cv,
-			    &zcw->zcw_lock, wakeup * SBT_1NS, SBT_1NS,
-			    C_ABSOLUTE);
+			    &zcw->zcw_lock, wakeup, SBT_1NS, C_ABSOLUTE);
 			if (wait_err != EWOULDBLOCK || zcw->zcw_done)
 				continue;
 #endif



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