MCPcopy Create free account
hub / github.com/F-Stack/f-stack / aio_aqueue

Function aio_aqueue

freebsd/kern/vfs_aio.c:1499–1733  ·  view source on GitHub ↗

* Queue a new AIO request. Choosing either the threaded or direct bio VCHR * technique is done in this code. */

Source from the content-addressed store, hash-verified

1497 * technique is done in this code.
1498 */
1499int
1500aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lj,
1501 int type, struct aiocb_ops *ops)
1502{
1503 struct proc *p = td->td_proc;
1504 struct file *fp = NULL;
1505 struct kaiocb *job;
1506 struct kaioinfo *ki;
1507 struct kevent kev;
1508 int opcode;
1509 int error;
1510 int fd, kqfd;
1511 int jid;
1512 u_short evflags;
1513
1514 if (p->p_aioinfo == NULL)
1515 aio_init_aioinfo(p);
1516
1517 ki = p->p_aioinfo;
1518
1519 ops->store_status(ujob, -1);
1520 ops->store_error(ujob, 0);
1521 ops->store_kernelinfo(ujob, -1);
1522
1523 if (num_queue_count >= max_queue_count ||
1524 ki->kaio_count >= max_aio_queue_per_proc) {
1525 error = EAGAIN;
1526 goto err1;
1527 }
1528
1529 job = uma_zalloc(aiocb_zone, M_WAITOK | M_ZERO);
1530 knlist_init_mtx(&job->klist, AIO_MTX(ki));
1531
1532 error = ops->aio_copyin(ujob, job, type);
1533 if (error)
1534 goto err2;
1535
1536 if (job->uaiocb.aio_nbytes > IOSIZE_MAX) {
1537 error = EINVAL;
1538 goto err2;
1539 }
1540
1541 if (job->uaiocb.aio_sigevent.sigev_notify != SIGEV_KEVENT &&
1542 job->uaiocb.aio_sigevent.sigev_notify != SIGEV_SIGNAL &&
1543 job->uaiocb.aio_sigevent.sigev_notify != SIGEV_THREAD_ID &&
1544 job->uaiocb.aio_sigevent.sigev_notify != SIGEV_NONE) {
1545 error = EINVAL;
1546 goto err2;
1547 }
1548
1549 if ((job->uaiocb.aio_sigevent.sigev_notify == SIGEV_SIGNAL ||
1550 job->uaiocb.aio_sigevent.sigev_notify == SIGEV_THREAD_ID) &&
1551 !_SIG_VALID(job->uaiocb.aio_sigevent.sigev_signo)) {
1552 error = EINVAL;
1553 goto err2;
1554 }
1555
1556 /* Get the opcode. */

Callers 15

freebsd6_aio_readFunction · 0.85
sys_aio_readFunction · 0.85
sys_aio_readvFunction · 0.85
freebsd6_aio_writeFunction · 0.85
sys_aio_writeFunction · 0.85
sys_aio_writevFunction · 0.85
sys_aio_mlockFunction · 0.85
kern_lio_listioFunction · 0.85
kern_aio_fsyncFunction · 0.85
freebsd32_aio_readFunction · 0.85
freebsd32_aio_readvFunction · 0.85

Calls 15

aio_init_aioinfoFunction · 0.85
knlist_init_mtxFunction · 0.85
fget_writeFunction · 0.85
fget_readFunction · 0.85
fgetFunction · 0.85
memsetFunction · 0.85
kqfd_registerFunction · 0.85
aio_scheduleFunction · 0.85
aio_queue_fileFunction · 0.85
fo_aio_queueFunction · 0.85
aio_bio_done_notifyFunction · 0.85
mtx_lockFunction · 0.70

Tested by

no test coverage detected