Deleted Added
full compact
vfs_aio.c (42957) vfs_aio.c (43301)
1/*
2 * Copyright (c) 1997 John S. Dyson. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. John S. Dyson's name may not be used to endorse or promote products
10 * derived from this software without specific prior written permission.
11 *
12 * DISCLAIMER: This code isn't warranted to do anything useful. Anything
13 * bad that happens because of using this software isn't the responsibility
14 * of the author. This software is distributed AS-IS.
15 *
1/*
2 * Copyright (c) 1997 John S. Dyson. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. John S. Dyson's name may not be used to endorse or promote products
10 * derived from this software without specific prior written permission.
11 *
12 * DISCLAIMER: This code isn't warranted to do anything useful. Anything
13 * bad that happens because of using this software isn't the responsibility
14 * of the author. This software is distributed AS-IS.
15 *
16 * $Id: vfs_aio.c,v 1.36 1998/12/15 17:38:33 des Exp $
16 * $Id: vfs_aio.c,v 1.37 1999/01/21 08:29:05 dillon Exp $
17 */
18
19/*
20 * This file contains support for the POSIX 1003.1B AIO/LIO facility.
21 */
22
23#include <sys/param.h>
24#include <sys/systm.h>

--- 690 unchanged lines hidden (view full) ---

715 TAILQ_INSERT_TAIL(&aio_activeproc, aiop, list);
716 aiop->aioprocflags &= ~AIOP_FREE;
717 }
718 aiop->aioprocflags &= ~AIOP_SCHED;
719
720 /*
721 * Check for jobs
722 */
17 */
18
19/*
20 * This file contains support for the POSIX 1003.1B AIO/LIO facility.
21 */
22
23#include <sys/param.h>
24#include <sys/systm.h>

--- 690 unchanged lines hidden (view full) ---

715 TAILQ_INSERT_TAIL(&aio_activeproc, aiop, list);
716 aiop->aioprocflags &= ~AIOP_FREE;
717 }
718 aiop->aioprocflags &= ~AIOP_SCHED;
719
720 /*
721 * Check for jobs
722 */
723 while ( aiocbe = aio_selectjob(aiop)) {
723 while ((aiocbe = aio_selectjob(aiop)) != NULL) {
724 struct proc *userp;
725 struct aiocb *cb;
726 struct kaioinfo *ki;
727 struct aio_liojob *lj;
728
729 cb = &aiocbe->uaiocb;
730 userp = aiocbe->userproc;
731

--- 188 unchanged lines hidden (view full) ---

920{
921 int error;
922 struct rfork_args rfa;
923 struct proc *p, *np;
924
925 rfa.flags = RFPROC | RFCFDG;
926
927 p = curproc;
724 struct proc *userp;
725 struct aiocb *cb;
726 struct kaioinfo *ki;
727 struct aio_liojob *lj;
728
729 cb = &aiocbe->uaiocb;
730 userp = aiocbe->userproc;
731

--- 188 unchanged lines hidden (view full) ---

920{
921 int error;
922 struct rfork_args rfa;
923 struct proc *p, *np;
924
925 rfa.flags = RFPROC | RFCFDG;
926
927 p = curproc;
928 if (error = rfork(p, &rfa))
928 if ((error = rfork(p, &rfa)) != 0)
929 return error;
930
931 np = pfind(p->p_retval[0]);
932 cpu_set_fork_handler(np, aio_daemon, p);
933
934 /*
935 * Wait until daemon is started, but continue on just in case (to
936 * handle error conditions.

--- 251 unchanged lines hidden (view full) ---

1188 unsigned int fd;
1189
1190 int error;
1191 int opcode;
1192 struct aiocblist *aiocbe;
1193 struct aioproclist *aiop;
1194 struct kaioinfo *ki;
1195
929 return error;
930
931 np = pfind(p->p_retval[0]);
932 cpu_set_fork_handler(np, aio_daemon, p);
933
934 /*
935 * Wait until daemon is started, but continue on just in case (to
936 * handle error conditions.

--- 251 unchanged lines hidden (view full) ---

1188 unsigned int fd;
1189
1190 int error;
1191 int opcode;
1192 struct aiocblist *aiocbe;
1193 struct aioproclist *aiop;
1194 struct kaioinfo *ki;
1195
1196 if (aiocbe = TAILQ_FIRST(&aio_freejobs)) {
1196 if ((aiocbe = TAILQ_FIRST(&aio_freejobs)) != NULL) {
1197 TAILQ_REMOVE(&aio_freejobs, aiocbe, list);
1198 } else {
1199 aiocbe = zalloc (aiocb_zone);
1200 }
1201
1202 aiocbe->inputcharge = 0;
1203 aiocbe->outputcharge = 0;
1204

--- 128 unchanged lines hidden (view full) ---

1333 * If we don't have a free AIO process, and we are below our
1334 * quota, then start one. Otherwise, depend on the subsequent
1335 * I/O completions to pick-up this job. If we don't sucessfully
1336 * create the new process (thread) due to resource issues, we
1337 * return an error for now (EAGAIN), which is likely not the
1338 * correct thing to do.
1339 */
1340retryproc:
1197 TAILQ_REMOVE(&aio_freejobs, aiocbe, list);
1198 } else {
1199 aiocbe = zalloc (aiocb_zone);
1200 }
1201
1202 aiocbe->inputcharge = 0;
1203 aiocbe->outputcharge = 0;
1204

--- 128 unchanged lines hidden (view full) ---

1333 * If we don't have a free AIO process, and we are below our
1334 * quota, then start one. Otherwise, depend on the subsequent
1335 * I/O completions to pick-up this job. If we don't sucessfully
1336 * create the new process (thread) due to resource issues, we
1337 * return an error for now (EAGAIN), which is likely not the
1338 * correct thing to do.
1339 */
1340retryproc:
1341 if (aiop = TAILQ_FIRST(&aio_freeproc)) {
1341 if ((aiop = TAILQ_FIRST(&aio_freeproc)) != NULL) {
1342 TAILQ_REMOVE(&aio_freeproc, aiop, list);
1343 TAILQ_INSERT_TAIL(&aio_activeproc, aiop, list);
1344 aiop->aioprocflags &= ~AIOP_FREE;
1345 wakeup(aiop->aioproc);
1346 } else if (((num_aio_resv_start + num_aio_procs) < max_aio_procs) &&
1347 ((ki->kaio_active_count + num_aio_resv_start) <
1348 ki->kaio_maxactive_count)) {
1349 num_aio_resv_start++;

--- 116 unchanged lines hidden (view full) ---

1466 if (uap->nent >= AIO_LISTIO_MAX)
1467 return EINVAL;
1468
1469 timo = 0;
1470 if (uap->timeout) {
1471 /*
1472 * Get timespec struct
1473 */
1342 TAILQ_REMOVE(&aio_freeproc, aiop, list);
1343 TAILQ_INSERT_TAIL(&aio_activeproc, aiop, list);
1344 aiop->aioprocflags &= ~AIOP_FREE;
1345 wakeup(aiop->aioproc);
1346 } else if (((num_aio_resv_start + num_aio_procs) < max_aio_procs) &&
1347 ((ki->kaio_active_count + num_aio_resv_start) <
1348 ki->kaio_maxactive_count)) {
1349 num_aio_resv_start++;

--- 116 unchanged lines hidden (view full) ---

1466 if (uap->nent >= AIO_LISTIO_MAX)
1467 return EINVAL;
1468
1469 timo = 0;
1470 if (uap->timeout) {
1471 /*
1472 * Get timespec struct
1473 */
1474 if (error = copyin((caddr_t) uap->timeout, (caddr_t) &ts, sizeof ts)) {
1474 if ((error = copyin((caddr_t) uap->timeout, (caddr_t) &ts, sizeof ts)) != 0) {
1475 return error;
1476 }
1477
1478 if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000)
1479 return (EINVAL);
1480
1481 TIMESPEC_TO_TIMEVAL(&atv, &ts);
1482 if (itimerfix(&atv))

--- 177 unchanged lines hidden (view full) ---

1660 pmodes = fuword(&uap->aiocbp->_aiocb_private.privatemodes);
1661 if ((pmodes & AIO_PMODE_SYNC) == 0) {
1662 return aio_aqueue(p, (struct aiocb *) uap->aiocbp, LIO_READ);
1663 }
1664
1665 /*
1666 * Get control block
1667 */
1475 return error;
1476 }
1477
1478 if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000)
1479 return (EINVAL);
1480
1481 TIMESPEC_TO_TIMEVAL(&atv, &ts);
1482 if (itimerfix(&atv))

--- 177 unchanged lines hidden (view full) ---

1660 pmodes = fuword(&uap->aiocbp->_aiocb_private.privatemodes);
1661 if ((pmodes & AIO_PMODE_SYNC) == 0) {
1662 return aio_aqueue(p, (struct aiocb *) uap->aiocbp, LIO_READ);
1663 }
1664
1665 /*
1666 * Get control block
1667 */
1668 if (error = copyin((caddr_t) uap->aiocbp, (caddr_t) &iocb, sizeof iocb))
1668 if ((error = copyin((caddr_t) uap->aiocbp, (caddr_t) &iocb, sizeof iocb)) != 0)
1669 return error;
1670
1671 /*
1672 * Get the fd info for process
1673 */
1674 fdp = p->p_fd;
1675
1676 /*

--- 56 unchanged lines hidden (view full) ---

1733 /*
1734 * Process sync simply -- queue async request.
1735 */
1736 pmodes = fuword(&uap->aiocbp->_aiocb_private.privatemodes);
1737 if ((pmodes & AIO_PMODE_SYNC) == 0) {
1738 return aio_aqueue(p, (struct aiocb *) uap->aiocbp, LIO_WRITE);
1739 }
1740
1669 return error;
1670
1671 /*
1672 * Get the fd info for process
1673 */
1674 fdp = p->p_fd;
1675
1676 /*

--- 56 unchanged lines hidden (view full) ---

1733 /*
1734 * Process sync simply -- queue async request.
1735 */
1736 pmodes = fuword(&uap->aiocbp->_aiocb_private.privatemodes);
1737 if ((pmodes & AIO_PMODE_SYNC) == 0) {
1738 return aio_aqueue(p, (struct aiocb *) uap->aiocbp, LIO_WRITE);
1739 }
1740
1741 if (error = copyin((caddr_t) uap->aiocbp, (caddr_t) &iocb, sizeof iocb))
1741 if ((error = copyin((caddr_t) uap->aiocbp, (caddr_t) &iocb, sizeof iocb)) != 0)
1742 return error;
1743
1744 /*
1745 * Get the fd info for process
1746 */
1747 fdp = p->p_fd;
1748
1749 /*

--- 297 unchanged lines hidden ---
1742 return error;
1743
1744 /*
1745 * Get the fd info for process
1746 */
1747 fdp = p->p_fd;
1748
1749 /*

--- 297 unchanged lines hidden ---