vfs_aio.c (109572) | vfs_aio.c (109623) |
---|---|
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 * $FreeBSD: head/sys/kern/vfs_aio.c 109572 2003-01-20 17:46:48Z dillon $ | 16 * $FreeBSD: head/sys/kern/vfs_aio.c 109623 2003-01-21 08:56:16Z alfred $ |
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> --- 362 unchanged lines hidden (view full) --- 387 * per-process for user limit (resource) management. 388 */ 389static void 390aio_init_aioinfo(struct proc *p) 391{ 392 struct kaioinfo *ki; 393 394 if (p->p_aioinfo == NULL) { | 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> --- 362 unchanged lines hidden (view full) --- 387 * per-process for user limit (resource) management. 388 */ 389static void 390aio_init_aioinfo(struct proc *p) 391{ 392 struct kaioinfo *ki; 393 394 if (p->p_aioinfo == NULL) { |
395 ki = uma_zalloc(kaio_zone, M_WAITOK); | 395 ki = uma_zalloc(kaio_zone, 0); |
396 p->p_aioinfo = ki; 397 ki->kaio_flags = 0; 398 ki->kaio_maxactive_count = max_aio_per_proc; 399 ki->kaio_active_count = 0; 400 ki->kaio_qallowed_count = max_aio_queue_per_proc; 401 ki->kaio_queue_count = 0; 402 ki->kaio_ballowed_count = max_buf_aio; 403 ki->kaio_buffer_count = 0; --- 368 unchanged lines hidden (view full) --- 772 vrele(mycp->p_textvp); 773 mycp->p_textvp = NULL; 774 } 775 776 /* 777 * Allocate and ready the aio control info. There is one aiop structure 778 * per daemon. 779 */ | 396 p->p_aioinfo = ki; 397 ki->kaio_flags = 0; 398 ki->kaio_maxactive_count = max_aio_per_proc; 399 ki->kaio_active_count = 0; 400 ki->kaio_qallowed_count = max_aio_queue_per_proc; 401 ki->kaio_queue_count = 0; 402 ki->kaio_ballowed_count = max_buf_aio; 403 ki->kaio_buffer_count = 0; --- 368 unchanged lines hidden (view full) --- 772 vrele(mycp->p_textvp); 773 mycp->p_textvp = NULL; 774 } 775 776 /* 777 * Allocate and ready the aio control info. There is one aiop structure 778 * per daemon. 779 */ |
780 aiop = uma_zalloc(aiop_zone, M_WAITOK); | 780 aiop = uma_zalloc(aiop_zone, 0); |
781 aiop->aiothread = td; 782 aiop->aiothreadflags |= AIOP_FREE; 783 784 s = splnet(); 785 786 /* 787 * Place thread (lightweight process) onto the AIO free thread list. 788 */ --- 7 unchanged lines hidden (view full) --- 796 * Get rid of our current filedescriptors. AIOD's don't need any 797 * filedescriptors, except as temporarily inherited from the client. 798 */ 799 fdfree(td); 800 801 mtx_unlock(&Giant); 802 /* The daemon resides in its own pgrp. */ 803 MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, | 781 aiop->aiothread = td; 782 aiop->aiothreadflags |= AIOP_FREE; 783 784 s = splnet(); 785 786 /* 787 * Place thread (lightweight process) onto the AIO free thread list. 788 */ --- 7 unchanged lines hidden (view full) --- 796 * Get rid of our current filedescriptors. AIOD's don't need any 797 * filedescriptors, except as temporarily inherited from the client. 798 */ 799 fdfree(td); 800 801 mtx_unlock(&Giant); 802 /* The daemon resides in its own pgrp. */ 803 MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, |
804 M_WAITOK | M_ZERO); | 804 M_ZERO); |
805 MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, | 805 MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, |
806 M_WAITOK | M_ZERO); | 806 M_ZERO); |
807 808 sx_xlock(&proctree_lock); 809 enterpgrp(mycp, mycp->p_pid, newpgrp, newsess); 810 sx_xunlock(&proctree_lock); 811 mtx_lock(&Giant); 812 813 /* Mark special process type. */ 814 mycp->p_flag |= P_SYSTEM; --- 481 unchanged lines hidden (view full) --- 1296 int opcode, user_opcode; 1297 struct aiocblist *aiocbe; 1298 struct aiothreadlist *aiop; 1299 struct kaioinfo *ki; 1300 struct kevent kev; 1301 struct kqueue *kq; 1302 struct file *kq_fp; 1303 | 807 808 sx_xlock(&proctree_lock); 809 enterpgrp(mycp, mycp->p_pid, newpgrp, newsess); 810 sx_xunlock(&proctree_lock); 811 mtx_lock(&Giant); 812 813 /* Mark special process type. */ 814 mycp->p_flag |= P_SYSTEM; --- 481 unchanged lines hidden (view full) --- 1296 int opcode, user_opcode; 1297 struct aiocblist *aiocbe; 1298 struct aiothreadlist *aiop; 1299 struct kaioinfo *ki; 1300 struct kevent kev; 1301 struct kqueue *kq; 1302 struct file *kq_fp; 1303 |
1304 aiocbe = uma_zalloc(aiocb_zone, M_WAITOK); | 1304 aiocbe = uma_zalloc(aiocb_zone, 0); |
1305 aiocbe->inputcharge = 0; 1306 aiocbe->outputcharge = 0; 1307 callout_handle_init(&aiocbe->timeouthandle); 1308 SLIST_INIT(&aiocbe->klist); 1309 1310 suword(&job->_aiocb_private.status, -1); 1311 suword(&job->_aiocb_private.error, 0); 1312 suword(&job->_aiocb_private.kernelinfo, -1); --- 329 unchanged lines hidden (view full) --- 1642 timo = tvtohz(&atv); 1643 } 1644 1645 ki = p->p_aioinfo; 1646 if (ki == NULL) 1647 return (EAGAIN); 1648 1649 njoblist = 0; | 1305 aiocbe->inputcharge = 0; 1306 aiocbe->outputcharge = 0; 1307 callout_handle_init(&aiocbe->timeouthandle); 1308 SLIST_INIT(&aiocbe->klist); 1309 1310 suword(&job->_aiocb_private.status, -1); 1311 suword(&job->_aiocb_private.error, 0); 1312 suword(&job->_aiocb_private.kernelinfo, -1); --- 329 unchanged lines hidden (view full) --- 1642 timo = tvtohz(&atv); 1643 } 1644 1645 ki = p->p_aioinfo; 1646 if (ki == NULL) 1647 return (EAGAIN); 1648 1649 njoblist = 0; |
1650 ijoblist = uma_zalloc(aiol_zone, M_WAITOK); 1651 ujoblist = uma_zalloc(aiol_zone, M_WAITOK); | 1650 ijoblist = uma_zalloc(aiol_zone, 0); 1651 ujoblist = uma_zalloc(aiol_zone, 0); |
1652 cbptr = uap->aiocbp; 1653 1654 for (i = 0; i < uap->nent; i++) { 1655 cbp = (struct aiocb *)(intptr_t)fuword(&cbptr[i]); 1656 if (cbp == 0) 1657 continue; 1658 ujoblist[njoblist] = cbp; 1659 ijoblist[njoblist] = fuword(&cbp->_aiocb_private.kernelinfo); --- 306 unchanged lines hidden (view full) --- 1966 1967 if ((nent + num_queue_count) > max_queue_count) 1968 return (EAGAIN); 1969 1970 ki = p->p_aioinfo; 1971 if ((nent + ki->kaio_queue_count) > ki->kaio_qallowed_count) 1972 return (EAGAIN); 1973 | 1652 cbptr = uap->aiocbp; 1653 1654 for (i = 0; i < uap->nent; i++) { 1655 cbp = (struct aiocb *)(intptr_t)fuword(&cbptr[i]); 1656 if (cbp == 0) 1657 continue; 1658 ujoblist[njoblist] = cbp; 1659 ijoblist[njoblist] = fuword(&cbp->_aiocb_private.kernelinfo); --- 306 unchanged lines hidden (view full) --- 1966 1967 if ((nent + num_queue_count) > max_queue_count) 1968 return (EAGAIN); 1969 1970 ki = p->p_aioinfo; 1971 if ((nent + ki->kaio_queue_count) > ki->kaio_qallowed_count) 1972 return (EAGAIN); 1973 |
1974 lj = uma_zalloc(aiolio_zone, M_WAITOK); | 1974 lj = uma_zalloc(aiolio_zone, 0); |
1975 if (!lj) 1976 return (EAGAIN); 1977 1978 lj->lioj_flags = 0; 1979 lj->lioj_buffer_count = 0; 1980 lj->lioj_buffer_finished_count = 0; 1981 lj->lioj_queue_count = 0; 1982 lj->lioj_queue_finished_count = 0; --- 340 unchanged lines hidden --- | 1975 if (!lj) 1976 return (EAGAIN); 1977 1978 lj->lioj_flags = 0; 1979 lj->lioj_buffer_count = 0; 1980 lj->lioj_buffer_finished_count = 0; 1981 lj->lioj_queue_count = 0; 1982 lj->lioj_queue_finished_count = 0; --- 340 unchanged lines hidden --- |