Date: Wed, 10 Jan 2018 00:02:06 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327753 - head/sys/kern Message-ID: <201801100002.w0A026Oi079442@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Wed Jan 10 00:02:06 2018 New Revision: 327753 URL: https://svnweb.freebsd.org/changeset/base/327753 Log: 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. MFC after: 2 weeks Sponsored by: Chelsio Communications Modified: head/sys/kern/vfs_aio.c Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Tue Jan 9 23:57:29 2018 (r327752) +++ head/sys/kern/vfs_aio.c Wed Jan 10 00:02:06 2018 (r327753) @@ -1736,7 +1736,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 && @@ -1758,15 +1764,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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801100002.w0A026Oi079442>