From owner-svn-src-head@freebsd.org Tue Sep 26 15:38:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD8AFE0EB46; Tue, 26 Sep 2017 15:38:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98F876A9EE; Tue, 26 Sep 2017 15:38:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8QFcGDm013080; Tue, 26 Sep 2017 15:38:16 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QFcGcA013078; Tue, 26 Sep 2017 15:38:16 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709261538.v8QFcGcA013078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 26 Sep 2017 15:38:16 +0000 (UTC) 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 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 324016 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Sep 2017 15:38:17 -0000 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" , 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