svn commit: r328580 - stable/11/sys/kern

John Baldwin jhb at FreeBSD.org
Tue Jan 30 00:38:25 UTC 2018


Author: jhb
Date: Tue Jan 30 00:38:24 2018
New Revision: 328580
URL: https://svnweb.freebsd.org/changeset/base/328580

Log:
  MFC 327753: Simplify some logic by merging an if test with a subsequent switch.
  
  Specifically, in aio_queue_file() the code was doing this:
  
     if (opcode == LIO_SYNC) {
         ...
     }
  
     switch (opcode) {
     ...
     case LIO_SYNC:
         ...
     }
  
  This moves the body of the if statement into the LIO_SYNC case of the
  switch statement.
  
  Sponsored by:	Chelsio Communications

Modified:
  stable/11/sys/kern/vfs_aio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/vfs_aio.c
==============================================================================
--- stable/11/sys/kern/vfs_aio.c	Tue Jan 30 00:24:03 2018	(r328579)
+++ stable/11/sys/kern/vfs_aio.c	Tue Jan 30 00:38:24 2018	(r328580)
@@ -1738,7 +1738,13 @@ queueit:
 		return (EOPNOTSUPP);
 	}
 
-	if (opcode == LIO_SYNC) {
+	switch (job->uaiocb.aio_lio_opcode) {
+	case LIO_READ:
+	case LIO_WRITE:
+		aio_schedule(job, aio_process_rw);
+		error = 0;
+		break;
+	case LIO_SYNC:
 		AIO_LOCK(ki);
 		TAILQ_FOREACH(job2, &ki->kaio_jobqueue, plist) {
 			if (job2->fd_file == job->fd_file &&
@@ -1760,15 +1766,6 @@ queueit:
 			return (0);
 		}
 		AIO_UNLOCK(ki);
-	}
-
-	switch (opcode) {
-	case LIO_READ:
-	case LIO_WRITE:
-		aio_schedule(job, aio_process_rw);
-		error = 0;
-		break;
-	case LIO_SYNC:
 		aio_schedule(job, aio_process_sync);
 		error = 0;
 		break;


More information about the svn-src-all mailing list