diff options
author | alc <alc@FreeBSD.org> | 2002-04-07 07:17:59 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2002-04-07 07:17:59 +0000 |
commit | bfb320784e49d1eb96618d6f7e92500c4fed871f (patch) | |
tree | 1d52e68d68cf13695d60589d61679d7827f3f7b8 /sys/kern/vfs_aio.c | |
parent | b97d2b784da3dcabc93822baa3e10ffacb947a7c (diff) | |
download | FreeBSD-src-bfb320784e49d1eb96618d6f7e92500c4fed871f.zip FreeBSD-src-bfb320784e49d1eb96618d6f7e92500c4fed871f.tar.gz |
Reduce the duplication of code for error handling in _aio_aqueue().
Diffstat (limited to 'sys/kern/vfs_aio.c')
-rw-r--r-- | sys/kern/vfs_aio.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index f22152a..a272813 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -1387,22 +1387,14 @@ _aio_aqueue(struct thread *td, struct aiocb *job, struct aio_liojob *lj, int typ fhold(fp); if (aiocbe->uaiocb.aio_offset == -1LL) { - fdrop(fp, td); - uma_zfree(aiocb_zone, aiocbe); - if (type == 0) - suword(&job->_aiocb_private.error, EINVAL); - return EINVAL; + error = EINVAL; + goto aqueue_fail; } - error = suword(&job->_aiocb_private.kernelinfo, jobrefid); if (error) { - fdrop(fp, td); - uma_zfree(aiocb_zone, aiocbe); - if (type == 0) - suword(&job->_aiocb_private.error, EINVAL); - return error; + error = EINVAL; + goto aqueue_fail; } - aiocbe->uaiocb._aiocb_private.kernelinfo = (void *)(intptr_t)jobrefid; if (jobrefid == LONG_MAX) jobrefid = 1; @@ -1419,15 +1411,11 @@ _aio_aqueue(struct thread *td, struct aiocb *job, struct aio_liojob *lj, int typ } return 0; } - if ((opcode != LIO_READ) && (opcode != LIO_WRITE)) { - fdrop(fp, td); - uma_zfree(aiocb_zone, aiocbe); - if (type == 0) { + if (type == 0) suword(&job->_aiocb_private.status, 0); - suword(&job->_aiocb_private.error, EINVAL); - } - return EINVAL; + error = EINVAL; + goto aqueue_fail; } if (aiocbe->uaiocb.aio_sigevent.sigev_notify == SIGEV_KEVENT) { |