Lines Matching defs:aio
70 MODULE(MODULE_CLASS_MISC, aio, NULL);
73 * System-wide limits and counter of AIO operations.
105 * Tear down all AIO state.
118 /* Abort if any processes are using AIO. */
140 * Initialize global AIO state.
182 struct aioproc *aio;
187 /* Allocate and initialize AIO structure */
188 aio = kmem_zalloc(sizeof(struct aioproc), KM_SLEEP);
191 mutex_init(&aio->aio_mtx, MUTEX_DEFAULT, IPL_NONE);
192 cv_init(&aio->aio_worker_cv, "aiowork");
193 cv_init(&aio->done_cv, "aiodone");
194 TAILQ_INIT(&aio->jobs_queue);
197 * Create an AIO worker thread.
198 * XXX: Currently, AIO thread is not protected against user's actions.
202 aio_exit(p, aio);
209 aio_exit(p, aio);
217 aio_exit(p, aio);
221 p->p_aio = aio;
224 aio->aio_worker = l;
241 struct aioproc *aio;
244 aio = cookie;
245 else if ((aio = p->p_aio) == NULL)
248 /* Free AIO queue */
249 while (!TAILQ_EMPTY(&aio->jobs_queue)) {
250 a_job = TAILQ_FIRST(&aio->jobs_queue);
251 TAILQ_REMOVE(&aio->jobs_queue, a_job, list);
256 /* Destroy and free the entire AIO data structure */
257 cv_destroy(&aio->aio_worker_cv);
258 cv_destroy(&aio->done_cv);
259 mutex_destroy(&aio->aio_mtx);
260 kmem_free(aio, sizeof(struct aioproc));
264 * AIO worker thread and processor.
270 struct aioproc *aio = p->p_aio;
291 mutex_enter(&aio->aio_mtx);
292 while ((a_job = TAILQ_FIRST(&aio->jobs_queue)) == NULL) {
293 if (cv_wait_sig(&aio->aio_worker_cv, &aio->aio_mtx)) {
298 mutex_exit(&aio->aio_mtx);
300 mutex_enter(&aio->aio_mtx);
305 aio->curjob = a_job;
306 TAILQ_REMOVE(&aio->jobs_queue, a_job, list);
309 aio->jobs_count--;
311 mutex_exit(&aio->aio_mtx);
313 /* Process an AIO operation */
320 mutex_enter(&aio->aio_mtx);
321 KASSERT(aio->curjob == a_job);
322 aio->curjob = NULL;
329 cv_broadcast(&aio->done_cv);
330 mutex_exit(&aio->aio_mtx);
457 * Send AIO signal.
483 struct aioproc *aio;
527 aio = p->p_aio;
528 if (aio) {
529 mutex_enter(&aio->aio_mtx);
530 TAILQ_FOREACH(a_job, &aio->jobs_queue, list) {
533 mutex_exit(&aio->aio_mtx);
536 mutex_exit(&aio->aio_mtx);
540 * Check if AIO structure is initialized, if not - initialize it.
547 aio = p->p_aio;
560 /* Allocate and initialize a new AIO job */
575 * notify the AIO worker thread to handle the job.
577 mutex_enter(&aio->aio_mtx);
581 aio->jobs_count >= aio_listio_max) {
583 mutex_exit(&aio->aio_mtx);
588 TAILQ_INSERT_TAIL(&aio->jobs_queue, a_job, list);
589 aio->jobs_count++;
592 cv_signal(&aio->aio_worker_cv);
594 mutex_exit(&aio->aio_mtx);
616 struct aioproc *aio;
634 /* Check if AIO structure is initialized */
640 aio = p->p_aio;
643 mutex_enter(&aio->aio_mtx);
648 TAILQ_FOREACH(a_job, &aio->jobs_queue, list) {
653 mutex_exit(&aio->aio_mtx);
659 TAILQ_REMOVE(&aio->jobs_queue, a_job, list);
664 aio->jobs_count--;
679 a_job = aio->curjob;
684 mutex_exit(&aio->aio_mtx);
725 struct aioproc *aio = p->p_aio;
729 if (aio == NULL)
781 struct aioproc *aio = p->p_aio;
785 if (aio == NULL)
846 struct aioproc *aio;
852 aio = p->p_aio;
863 mutex_enter(&aio->aio_mtx);
872 if (aio->curjob) {
873 a_job = aio->curjob;
879 TAILQ_FOREACH(a_job, &aio->jobs_queue, list)
886 mutex_exit(&aio->aio_mtx);
892 mutex_enter(&aio->aio_mtx);
900 error = cv_timedwait_sig(&aio->done_cv, &aio->aio_mtx, timo);
907 mutex_exit(&aio->aio_mtx);
933 struct aioproc *aio;
947 /* Check if AIO structure is initialized, if not - initialize it */
951 aio = p->p_aio;
993 mutex_enter(&aio->aio_mtx);
1009 mutex_enter(&aio->aio_mtx);
1019 * Wait for AIO completion. In such case,
1023 error = cv_wait_sig(&aio->done_cv, &aio->aio_mtx);
1031 mutex_exit(&aio->aio_mtx);
1086 SYSCTL_SETUP(sysctl_aio_init, "aio sysctl")
1132 struct aioproc *aio;
1137 (*pr)("AIO: We are not in the processes right now.\n");
1141 aio = p->p_aio;
1142 if (aio == NULL) {
1143 (*pr)("AIO data is not initialized (PID = %d).\n", p->p_pid);
1147 (*pr)("AIO: PID = %d\n", p->p_pid);
1148 (*pr)("AIO: Global count of the jobs = %u\n", aio_jobs_count);
1149 (*pr)("AIO: Count of the jobs = %u\n", aio->jobs_count);
1151 if (aio->curjob) {
1152 a_job = aio->curjob;
1164 TAILQ_FOREACH(a_job, &aio->jobs_queue, list) {