Lines Matching refs:reqp
347 aio_req_t *reqp;
421 if ((reqp = _aio_req_alloc()) == NULL) {
427 * _aio_do_request() checks reqp->req_op to differentiate
430 reqp->req_op = mode;
431 reqp->req_resultp = resultp;
432 ap = &reqp->req_args;
438 if (_aio_hash_insert(resultp, reqp) != 0) {
439 _aio_req_free(reqp);
447 _aio_req_add(reqp, &__nextworker_rw, umode);
454 aio_req_t *reqp;
466 reqp = _aio_hash_find(resultp);
467 if (reqp == NULL) {
474 aiowp = reqp->req_worker;
476 (void) _aio_cancel_req(aiowp, reqp, &canceled, &done);
687 aio_req_t *reqp;
719 while ((reqp = *reqpp) != NULL) {
720 if (cancelall || reqp->req_args.fd == fd) {
721 *reqpp = reqp->req_next;
722 if (last == reqp) {
723 last = reqp->req_next;
725 if (_aio_done_head == reqp) {
730 _aio_set_result(reqp, -1, ECANCELED);
731 (void) _aio_hash_del(reqp->req_resultp);
732 _aio_req_free(reqp);
734 reqpp = &reqp->req_next;
735 last = reqp;
763 aio_req_t *reqp;
769 reqp = aiowp->work_tail1;
770 while (reqp != NULL) {
771 if (fd < 0 || reqp->req_args.fd == fd) {
772 if (_aio_cancel_req(aiowp, reqp, canceled, done)) {
775 * reqp is invalid; start traversing
778 reqp = aiowp->work_tail1;
782 reqp = reqp->req_next;
788 if ((reqp = aiowp->work_req) != NULL &&
789 (fd < 0 || reqp->req_args.fd == fd))
790 (void) _aio_cancel_req(aiowp, reqp, canceled, done);
799 _aio_cancel_req(aio_worker_t *aiowp, aio_req_t *reqp, int *canceled, int *done)
801 int ostate = reqp->req_state;
807 if (ostate == AIO_REQ_DONE && !POSIX_AIO(reqp) &&
808 aiowp->work_prev1 == reqp) {
817 _aio_set_result(reqp, -1, ECANCELED);
818 (void) _aio_hash_del(reqp->req_resultp);
819 reqp->req_state = AIO_REQ_CANCELED;
828 if (reqp->req_op == AIOFSYNC && reqp != aiowp->work_req) {
829 ASSERT(POSIX_AIO(reqp));
831 if (!reqp->req_head->lio_canned) {
832 reqp->req_head->lio_canned = 1;
838 reqp->req_state = AIO_REQ_CANCELED;
839 _aio_req_del(aiowp, reqp, ostate);
840 (void) _aio_hash_del(reqp->req_resultp);
842 if (reqp == aiowp->work_req) {
851 _aio_set_result(reqp, -1, ECANCELED);
855 if (!POSIX_AIO(reqp)) {
857 _aio_set_result(reqp, -1, ECANCELED);
858 _aio_req_free(reqp);
863 _aiodone(reqp, -1, ECANCELED);
870 _aio_create_worker(aio_req_t *reqp, int mode)
909 if (reqp) {
910 reqp->req_state = AIO_REQ_QUEUED;
911 reqp->req_worker = aiowp;
912 aiowp->work_head1 = reqp;
913 aiowp->work_tail1 = reqp;
914 aiowp->work_next1 = reqp;
924 if (reqp) {
925 reqp->req_state = 0;
926 reqp->req_worker = NULL;
1026 aio_req_t *reqp; /* current AIO request */
1062 while ((reqp = _aio_req_get(aiowp)) == NULL) {
1066 arg = &reqp->req_args;
1067 ASSERT(reqp->req_state == AIO_REQ_INPROGRESS ||
1068 reqp->req_state == AIO_REQ_CANCELED);
1071 switch (reqp->req_op) {
1167 if (_aio_fsync_del(aiowp, reqp))
1169 ASSERT(reqp->req_head == NULL);
1175 if (reqp->req_state == AIO_REQ_CANCELED) {
1184 if (_aio_hash_insert(reqp->req_resultp, reqp) != 0)
1205 aio_req_t *reqp;
1208 if ((reqp = aiowp->work_req) == NULL)
1212 if (reqp->req_state == AIO_REQ_CANCELED) {
1216 if (!POSIX_AIO(reqp)) {
1218 if (reqp->req_state == AIO_REQ_INPROGRESS) {
1219 reqp->req_state = AIO_REQ_DONE;
1220 _aio_set_result(reqp, retval, error);
1230 _aio_req_free(reqp);
1247 if (reqp->req_state == AIO_REQ_INPROGRESS)
1248 reqp->req_state = AIO_REQ_DONE;
1250 _aiodone(reqp, retval, error);
1256 _aio_req_mark_done(aio_req_t *reqp)
1259 if (reqp->req_largefile)
1260 ((aiocb64_t *)reqp->req_aiocbp)->aio_state = USERAIO_DONE;
1263 ((aiocb_t *)reqp->req_aiocbp)->aio_state = USERAIO_DONE;
1306 aio_req_t *reqp;
1319 while ((reqp = _aio_req_get(aiowp)) == NULL) {
1323 send_notification(&reqp->req_notify);
1324 _aio_req_free(reqp);
1336 _aiodone(aio_req_t *reqp, ssize_t retval, int error)
1338 aio_result_t *resultp = reqp->req_resultp;
1350 ASSERT(POSIX_AIO(reqp));
1361 switch (reqp->req_sigevent.sigev_notify) {
1389 if ((np.np_signo = reqp->req_sigevent.sigev_signo) != 0)
1391 np.np_user = reqp->req_sigevent.sigev_value.sival_ptr;
1393 if ((np.np_port = reqp->req_sigevent.sigev_signo) >= 0)
1395 np.np_event = reqp->req_op;
1396 if (np.np_event == AIOFSYNC && reqp->req_largefile)
1398 np.np_object = (uintptr_t)reqp->req_aiocbp;
1399 np.np_user = reqp->req_sigevent.sigev_value.sival_ptr;
1403 _aio_set_result(reqp, retval, error);
1407 head = reqp->req_head;
1408 reqp->req_head = NULL;
1411 _aio_enq_doneq(reqp);
1412 reqp = NULL;
1415 _aio_req_mark_done(reqp);
1474 if (reqp != NULL) {
1484 reqp->req_notify = np;
1485 reqp->req_op = AIONOTIFY;
1486 _aio_req_add(reqp, &__workers_no, AIONOTIFY);
1487 reqp = NULL;
1498 if (reqp != NULL)
1499 _aio_req_free(reqp);
1508 _aio_fsync_del(aio_worker_t *aiowp, aio_req_t *reqp)
1510 aio_lio_t *head = reqp->req_head;
1513 ASSERT(reqp == aiowp->work_req);
1526 _aio_req_free(reqp);
1530 reqp->req_head = NULL;
1532 reqp->req_state = AIO_REQ_CANCELED;
1543 _aio_req_free(reqp);
1587 aio_req_t *reqp;
1591 reqp = aiowp->work_prev1;
1592 reqp->req_next = NULL;
1600 if (reqp->req_state == AIO_REQ_CANCELED) {
1608 _aio_req_free(reqp);
1622 ASSERT(reqp != NULL);
1625 _aio_done_head = _aio_done_tail = reqp;
1627 _aio_done_head->req_next = reqp;
1628 _aio_done_head = reqp;
1650 aio_req_t *reqp;
1655 if ((reqp = _aio_done_tail) != NULL) {
1656 if ((_aio_done_tail = reqp->req_next) == NULL)
1660 (void) _aio_hash_del(reqp->req_resultp);
1661 resultp = reqp->req_resultp;
1662 ASSERT(reqp->req_state == AIO_REQ_DONE);
1663 _aio_req_free(reqp);
1667 if (reqp == NULL && _aio_outstand_cnt == 0) {
1686 _aio_set_result(aio_req_t *reqp, ssize_t retval, int error)
1688 aio_result_t *resultp = reqp->req_resultp;
1690 if (POSIX_AIO(reqp)) {
1706 _aio_req_add(aio_req_t *reqp, aio_worker_t **nextworker, int mode)
1714 ASSERT(reqp->req_state != AIO_REQ_DONEQ);
1715 reqp->req_next = NULL;
1770 if (_aio_create_worker(reqp, mode))
1797 if (_aio_create_worker(reqp, mode))
1818 aiowp->work_tail1 = reqp;
1819 aiowp->work_next1 = reqp;
1821 aiowp->work_head1->req_next = reqp;
1823 aiowp->work_next1 = reqp;
1825 reqp->req_state = AIO_REQ_QUEUED;
1826 reqp->req_worker = aiowp;
1827 aiowp->work_head1 = reqp;
1852 aio_req_t *reqp;
1855 if ((reqp = aiowp->work_next1) != NULL) {
1866 if (POSIX_AIO(reqp)) {
1868 aiowp->work_tail1 = reqp->req_next;
1872 aiowp->work_prev1->req_next = reqp->req_next;
1873 if (aiowp->work_head1 == reqp)
1874 aiowp->work_head1 = reqp->req_next;
1878 aiowp->work_prev1 = reqp;
1882 ASSERT(reqp != reqp->req_next);
1883 aiowp->work_next1 = reqp->req_next;
1886 switch (reqp->req_op) {
1899 reqp->req_state = AIO_REQ_INPROGRESS;
1901 aiowp->work_req = reqp;
1902 ASSERT(reqp != NULL || aiowp->work_count1 == 0);
1904 return (reqp);
1908 _aio_req_del(aio_worker_t *aiowp, aio_req_t *reqp, int ostate)
1916 if (POSIX_AIO(reqp)) {
1924 if (next == reqp) {
1956 !POSIX_AIO(reqp) && aiowp->work_done1 > 0);
1976 _aio_enq_doneq(aio_req_t *reqp)
1979 _aio_doneq = reqp;
1980 reqp->req_next = reqp->req_prev = reqp;
1982 reqp->req_next = _aio_doneq;
1983 reqp->req_prev = _aio_doneq->req_prev;
1984 _aio_doneq->req_prev->req_next = reqp;
1985 _aio_doneq->req_prev = reqp;
1987 reqp->req_state = AIO_REQ_DONEQ;
1995 _aio_req_remove(aio_req_t *reqp)
1997 if (reqp && reqp->req_state != AIO_REQ_DONEQ)
2000 if (reqp) {
2002 if (_aio_doneq == reqp)
2003 _aio_doneq = reqp->req_next;
2004 if (_aio_doneq == reqp) {
2008 aio_req_t *tmp = reqp->req_next;
2009 reqp->req_prev->req_next = tmp;
2010 tmp->req_prev = reqp->req_prev;
2012 } else if ((reqp = _aio_doneq) != NULL) {
2013 if (reqp == reqp->req_next) {
2017 reqp->req_prev->req_next = _aio_doneq = reqp->req_next;
2018 _aio_doneq->req_prev = reqp->req_prev;
2021 if (reqp) {
2023 reqp->req_next = reqp->req_prev = reqp;
2024 reqp->req_state = AIO_REQ_DONE;
2026 return (reqp);
2035 _aio_hash_insert(aio_result_t *resultp, aio_req_t *reqp)
2051 *prev = reqp;
2052 ASSERT(reqp->req_link == NULL);
2115 aio_req_t *reqp;
2165 if ((reqp = _aio_req_alloc()) == NULL) {
2173 reqp->req_head = lio_head;
2174 reqp->req_type = AIO_POSIX_REQ;
2175 reqp->req_op = mode;
2176 reqp->req_largefile = 0;
2179 reqp->req_sigevent.sigev_notify = SIGEV_NONE;
2181 reqp->req_sigevent.sigev_notify = SIGEV_SIGNAL;
2182 reqp->req_sigevent.sigev_signo =
2184 reqp->req_sigevent.sigev_value.sival_ptr =
2188 reqp->req_sigevent.sigev_notify = SIGEV_PORT;
2193 reqp->req_sigevent.sigev_signo =
2195 reqp->req_sigevent.sigev_value.sival_ptr =
2198 reqp->req_sigevent.sigev_notify = SIGEV_THREAD;
2203 reqp->req_sigevent.sigev_signo =
2205 reqp->req_sigevent.sigev_value.sival_ptr =
2209 reqp->req_resultp = &aiocbp->aio_resultp;
2210 reqp->req_aiocbp = aiocbp;
2211 ap = &reqp->req_args;
2218 _aio_hash_insert(&aiocbp->aio_resultp, reqp) != 0) {
2220 _aio_req_free(reqp);
2224 _aio_req_add(reqp, nextworker, mode);
2236 aio_req_t *reqp;
2286 if ((reqp = _aio_req_alloc()) == NULL) {
2294 reqp->req_head = lio_head;
2295 reqp->req_type = AIO_POSIX_REQ;
2296 reqp->req_op = mode;
2297 reqp->req_largefile = 1;
2300 reqp->req_sigevent.sigev_notify = SIGEV_NONE;
2302 reqp->req_sigevent.sigev_notify = SIGEV_SIGNAL;
2303 reqp->req_sigevent.sigev_signo =
2305 reqp->req_sigevent.sigev_value.sival_ptr =
2309 reqp->req_sigevent.sigev_notify = SIGEV_PORT;
2310 reqp->req_sigevent.sigev_signo =
2312 reqp->req_sigevent.sigev_value.sival_ptr =
2315 reqp->req_sigevent.sigev_notify = SIGEV_THREAD;
2316 reqp->req_sigevent.sigev_signo =
2318 reqp->req_sigevent.sigev_value.sival_ptr =
2322 reqp->req_resultp = &aiocbp->aio_resultp;
2323 reqp->req_aiocbp = aiocbp;
2324 ap = &reqp->req_args;
2331 _aio_hash_insert(&aiocbp->aio_resultp, reqp) != 0) {
2333 _aio_req_free(reqp);
2337 _aio_req_add(reqp, nextworker, mode);