svn commit: r314549 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

Alexander Motin mav at FreeBSD.org
Thu Mar 2 07:55:49 UTC 2017


Author: mav
Date: Thu Mar  2 07:55:47 2017
New Revision: 314549
URL: https://svnweb.freebsd.org/changeset/base/314549

Log:
  Execute last ZIO of log commit synchronously.
  
  For short transactions overhead of context switch can be too large.
  Skipping it gives significant latency reduction.  For large ones,
  including multiple ZIOs, latency is less critical, while throughput
  there may become limited by checksumming speed of single CPU core.
  To get best of both cases, execute last ZIO directly from calling
  thread context to save latency, while all others (if there are any)
  enqueue to taskqueues in traditional way.
  
  MFC after:	2 weeks
  Sponsored by:	iXsystems, Inc.

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c	Thu Mar  2 07:50:06 2017	(r314548)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c	Thu Mar  2 07:55:47 2017	(r314549)
@@ -959,7 +959,7 @@ uint64_t zil_block_buckets[] = {
  * Calls are serialized.
  */
 static lwb_t *
-zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb)
+zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb, boolean_t last)
 {
 	lwb_t *nlwb = NULL;
 	zil_chain_t *zilc;
@@ -1060,6 +1060,8 @@ zil_lwb_write_start(zilog_t *zilog, lwb_
 	 */
 	bzero(lwb->lwb_buf + lwb->lwb_nused, wsz - lwb->lwb_nused);
 
+	if (last)
+		lwb->lwb_zio->io_pipeline &= ~ZIO_STAGE_ISSUE_ASYNC;
 	zio_nowait(lwb->lwb_zio); /* Kick off the write for the old log block */
 
 	/*
@@ -1103,7 +1105,7 @@ cont:
 	if (reclen > lwb_sp || (reclen + dlen > lwb_sp &&
 	    lwb_sp < ZIL_MAX_LOG_DATA / 8 && (dlen % ZIL_MAX_LOG_DATA == 0 ||
 	    lwb_sp < reclen + dlen % ZIL_MAX_LOG_DATA))) {
-		lwb = zil_lwb_write_start(zilog, lwb);
+		lwb = zil_lwb_write_start(zilog, lwb, B_FALSE);
 		if (lwb == NULL)
 			return (NULL);
 		zil_lwb_write_init(zilog, lwb);
@@ -1560,7 +1562,7 @@ zil_commit_writer(zilog_t *zilog)
 
 	/* write the last block out */
 	if (lwb != NULL && lwb->lwb_zio != NULL)
-		lwb = zil_lwb_write_start(zilog, lwb);
+		lwb = zil_lwb_write_start(zilog, lwb, B_TRUE);
 
 	zilog->zl_cur_used = 0;
 


More information about the svn-src-head mailing list