summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_aio.c
Commit message (Collapse)AuthorAgeFilesLines
* Change the way support for asynchronous I/O is indicated to applicationswollman2002-10-271-0/+2
| | | | | | | | | | to conform to 1003.1-2001. Make it possible for applications to actually tell whether or not asynchronous I/O is supported. Since FreeBSD's aio implementation works on all descriptor types, don't call down into file or vnode ops when [f]pathconf() is asked about _PC_ASYNC_IO; this avoids the need for every file and vnode op to know about it.
* fdfree() clears p_fd for us, no need to do it again.jhb2002-10-181-1/+0
|
* Eliminate the unnecessary clearing of flag bits that are already clearalc2002-10-141-4/+1
| | | | in lio_listio(2).
* Some kernel threads try to do significant work, and the default KSTACK_PAGESscottl2002-10-021-1/+1
| | | | | | | | | | | | | doesn't give them enough stack to do much before blowing away the pcb. This adds MI and MD code to allow the allocation of an alternate kstack who's size can be speficied when calling kthread_create. Passing the value 0 prevents the alternate kstack from being created. Note that the ia64 MD code is missing for now, and PowerPC was only partially written due to the pmap.c being incomplete there. Though this patch does not modify anything to make use of the alternate kstack, acpi and usb are good candidates. Reviewed by: jake, peter, jhb
* Replace (ab)uses of "NULL" where "0" is really meant.archie2002-08-221-1/+1
|
* o Remove the AIOCBLIST_ASYNCFREE flag and related code. It's never set.alc2002-08-221-19/+2
| | | | Submitted by: Romer Gil <rgil@cs.rice.edu>
* o Make a correction to the last change: In aio_cancel(2) return AIO_ALLDONEalc2002-08-111-2/+2
| | | | instead of EINVAL if p->p_aioinfo is NULL.
* o In aio_cancel(2), make sure that p->p_aioinfo isn't NULL beforealc2002-08-111-0/+2
| | | | | | dereferencing it. Submitted by: saureen <sshah@apple.com>
* Set the ident field of the struct kevent that is registered by _aio_aqueue()alc2002-08-061-4/+5
| | | | | | | | to the address of the user's aiocb rather than the kernel's aiocb. (In other words, prior to this change, the ident field returned by kevent(2) on completion of an AIO was effectively garbage.) Submitted by: Romer Gil <rgil@cs.rice.edu>
* o The introduction of kevent() broke lio_listio(): _aio_aqueue() thoughtalc2002-08-051-6/+6
| | | | | | | | | | | | | that LIO_READ and LIO_WRITE were requests for kevent()-based notification of completion. Modify _aio_aqueue() to recognize LIO_READ and LIO_WRITE. Notes: (1) The patch provided by the PR perpetuates a second bug in this code, a direct access to user-space memory. This change fixes that bug as well. (2) This change is to code that implements a deprecated interface. It should probably be removed after an MFC. PR: kern/39556
* Back out my lats commit of locking down a socket, it conflicts with hsu's work.tanimura2002-05-311-3/+0
| | | | Requested by: hsu
* o Remove some unnecessary casting from and add some necessary casting toalc2002-05-251-3/+3
| | | | | | aio_suspend() and lio_listio(). Submitted by: bde
* Fix warnings. Also, removed an unused variable that I found that was justpeter2002-05-241-6/+4
| | | | initialized and never used afterwards.
* Lock down a socket, milestone 1.tanimura2002-05-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Add a mutex (sb_mtx) to struct sockbuf. This protects the data in a socket buffer. The mutex in the receive buffer also protects the data in struct socket. o Determine the lock strategy for each members in struct socket. o Lock down the following members: - so_count - so_options - so_linger - so_state o Remove *_locked() socket APIs. Make the following socket APIs touching the members above now require a locked socket: - sodisconnect() - soisconnected() - soisconnecting() - soisdisconnected() - soisdisconnecting() - sofree() - soref() - sorele() - sorwakeup() - sotryfree() - sowakeup() - sowwakeup() Reviewed by: alfred
* As malloc(9) and free(9) are now Giant-free, remove the Giant locktanimura2002-05-031-1/+1
| | | | across malloc(9) and free(9) of a pgrp or a session.
* Push down Giant for setpgid(), setsid() and aio_daemon(). Giant protects onlytanimura2002-04-201-0/+2
| | | | malloc(9) and free(9).
* Lock proctree_lock instead of pgrpsess_lock.jhb2002-04-161-2/+2
|
* o Use aiocblist::fd_file in the AIO threads rather than recomputingalc2002-04-141-45/+3
| | | | | | the file * from the calling process's descriptor table. o Eliminate sharing of the calling process's descriptor table with the AIO threads.
* Restructure aio_return() to eliminate duplicated code and facilitate Giantalc2002-04-081-21/+15
| | | | push down.
* Reduce the duplication of code for error handling in _aio_aqueue().alc2002-04-071-19/+7
|
* Change jobref and *ijoblist from int to long in order to avoidalc2002-04-071-3/+3
| | | | a catastrophe after the 2^32nd AIO operation on 64-bit architectures.
* o aio_process needn't fhold()/fdrop() the fp now that _aio_aqueue() andalc2002-04-041-13/+6
| | | | | | aio_free_entry() do this. o Remove two unnecessary/unused variables from aio_process() and one field from aiocblist.
* Keep the reference to the file acquired in _aio_aqueue() until the operationalc2002-03-311-3/+7
| | | | | | completes. The reference is released in aio_free_entry(). Submitted by: tegge
* Added used include of <sys/sx.h>. Don't depend on namespace pollution inbde2002-03-251-0/+1
| | | | <sys/file.h> or <sys/socketvar.h>.
* Remove references to vm_zone.h and switch over to the new uma API.jeff2002-03-201-40/+45
| | | | | Also, remove maxsockets. If you look carefully you'll notice that the old zone allocator never honored this anyway.
* Document all functions, global and static variables, and sysctls.eivind2002-03-051-43/+80
| | | | | | | | Includes some minor whitespace changes, and re-ordering to be able to document properly (e.g, grouping of variables and the SYSCTL macro calls for them, where the documentation has been added.) Reviewed by: phk (but all errors are mine)
* Lock struct pgrp, session and sigio.tanimura2002-02-231-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | New locks are: - pgrpsess_lock which locks the whole pgrps and sessions, - pg_mtx which protects the pgrp members, and - s_mtx which protects the session members. Please refer to sys/proc.h for the coverage of these locks. Changes on the pgrp/session interface: - pgfind() needs the pgrpsess_lock held. - The caller of enterpgrp() is responsible to allocate a new pgrp and session. - Call enterthispgrp() in order to enter an existing pgrp. - pgsignal() requires a pgrp lock held. Reviewed by: jhb, alfred Tested on: cvsup.jp.FreeBSD.org (which is a quad-CPU machine running -current)
* o Clearing p/td_retval[0] after aio_newproc() is unnecessary. (We stoppedalc2002-02-121-6/+1
| | | | | calling rfork() to create aio threads in revision 1.46.) o Don't recompute the FILE * when it's already stored in the kernel's AIOCB.
* Pre-KSE/M3 commit.julian2002-02-071-4/+4
| | | | | | | | | | this is a low-functionality change that changes the kernel to access the main thread of a process via the linked list of threads rather than assuming that it is embedded in the process. It IS still embeded there but remove all teh code that assumes that in preparation for the next commit which will actually move it out. Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,
* o Remove the unused vestiges of JOBST_JOBQPROC andalc2002-01-201-15/+1
| | | | | the per-thread jobtorun queue. o Use TAILQ_EMPTY() instead of TAILQ_FIRST(...) == NULL.
* o Revision 1.99 ("KSE Milestone 2") left the aio daemonsalc2002-01-201-2/+2
| | | | | | | | | sleeping on a process object but changed the corresponding wakeup()s to the thread object. The result was that non-raw aio ops waited for an aio daemon to timeout before action was taken. Now, we sleep on the thread object. PR: kern/34016
* o Eliminate an unused parameter from aio_fphysio().alc2002-01-171-3/+3
|
* o Correct the initialization of aiolio_zone: Each entry was 16 times largeralc2002-01-141-13/+5
| | | | | | | | | than necessary. o Move a rarely-used goto label inside a critical section so that we don't perform an splnet() for which there is no corresponding splx(). o Remove unnecessary splnet()/splx() around accesses to kaioinfo::kaio_jobdone in aio_return(). o Use TAILQ_FOREACH for simple cases of iteration over kaioinfo::kaio_jobdone.
* o Correct a 32/64-bit error in the initialization of aiol_zone, specifically,alc2002-01-091-1/+1
| | | | sizeof(int) is not the size of a pointer.
* o Add missing synchronization (splnet()/splx()) in aio_free_entry().alc2002-01-061-1/+27
| | | | | o Move the definition of struct aiocblist from sys/aio.h to kern/vfs_aio.c. o Make aio_swake_cb() static.
* o Properly check the file descriptor passed to aio_cancel(2). (Previously,alc2002-01-021-14/+3
| | | | | no out-of-bounds check was performed on the file descriptor.) o Eliminate some excessive white space from aio_cancel(2).
* o Some style(9)-motivated changes to white space.alc2002-01-011-13/+13
|
* o Correct an off-by-one error in aio_suspend(2).alc2001-12-311-1/+1
| | | | PR: 18350
* o Use "td->td_proc" instead of "curproc" where possible.alc2001-12-311-10/+8
| | | | | o Eliminate the unnecessary initialization of several static variables to zero.
* Make AIO a loadable module.alfred2001-12-291-72/+85
| | | | | | | | | | | | | | | | | | | | | | | | Remove the explicit call to aio_proc_rundown() from exit1(), instead AIO will use at_exit(9). Add functions at_exec(9), rm_at_exec(9) which function nearly the same as at_exec(9) and rm_at_exec(9), these functions are called on behalf of modules at the time of execve(2) after the image activator has run. Use a modified version of tegge's suggestion via at_exec(9) to close an exploitable race in AIO. Fix SYSCALL_MODULE_HELPER such that it's archetecuterally neutral, the problem was that one had to pass it a paramater indicating the number of arguments which were actually the number of "int". Fix it by using an inline version of the AS macro against the syscall arguments. (AS should be available globally but we'll get to that later.) Add a primative system for dynamically adding kqueue ops, it's really not as sophisticated as it should be, but I'll discuss with jlemon when he's around.
* o Eliminate compilation warnings on 64-bit architectures.alc2001-12-101-3/+3
|
* o Eliminate unnecessary synchronization from filt_aiodetach().alc2001-12-091-5/+3
| | | | | | | | o The manual page for kevent says that EVFILT_AIO returns under the same conditions as aio_error(). With that in mind, set the data field of the returned struct kevent to the value that would be returned by aio_error(). o Fix two compilation warnings.
* The aio kthreads start off with a root credential just like all otherjhb2001-10-051-7/+0
| | | | | kthreads, so don't malloc a ucred just so we can create a duplicate of the one we already have.
* KSE Milestone 2julian2001-09-121-76/+93
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Check validity of signal callback requested via aio routines.alfred2001-04-181-2/+13
| | | | | | | | | | | | | Also move the insertion of the request to after the request is validated, there's still looks like there may be some problems if an invalid address is passed to the aio routines, basically a possible leak or having a not completely initialized structure on the queue may still be possible. A new sig macro was made _SIG_VALID to check the validity of a signal, it would be advisable to use it from now on (in kern/kern_sig.c) rather than rolling your own. PR: kern/17152
* When aio_read/write() is used on a raw device, physical buffers arealc2001-03-101-7/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | used for up to "vfs.aio.max_buf_aio" of the requests. If a request size is MAXPHYS, but the request base isn't page aligned, vmapbuf() will map the end of the user space buffer into the start of the kva allocated for the next physical buffer. Don't use a physical buffer in this case. (This change addresses problem report 25617.) When an aio_read/write() on a raw device has completed, timeout() is used to schedule a signal to the process. Thus, the reporting is delayed up to 10 ms (assuming hz is 100). The process might have terminated in the meantime, causing a trap 12 when attempting to deliver the signal. Thus, the timeout must be cancelled when removing the job. aio jobs in state JOBST_JOBQGLOBAL should be removed from the kaio_jobqueue list during process rundown. During process rundown, some aio jobs might move from one list to a different list that has already been "emptied", causing the rundown to be incomplete. Retry the rundown. A call to BUF_KERNPROC() is needed after obtaining a physical buffer to disassociate the lock from the running process since it can return to userland without releasing that lock. PR: 25617 Submitted by: tegge
* Use the kthread API to create and destroy AIO daemons.alc2001-03-091-9/+7
| | | | Submitted by: jhb
* Grab the process lock while calling psignal and before calling psignal.jhb2001-03-071-9/+26
|
* Add a missing splx() to aio_fphysio(). (This change is a no-op in -5.0,alc2001-03-061-12/+6
| | | | | | | | but potentially significant in -4.x.) Eliminate a pointless parameter to aio_fphysio(). Remove unnecessary casts from aio_fphysio() and aio_physwakeup().
* Eliminate the aio_freejobs list. Its purpose was to store freealc2001-03-051-40/+30
| | | | | | | | | | | | | | | | | | | | | aiocb's allocated by zalloc(). In other words, zfree() was never called. Now, we call zfree(). Why eliminate this micro- optimization? At some later point, when we multithread the AIO system, we would need a mutex to synchronize access to aio_freejobs, making its use nearly indistinguishable in cost from zalloc() and zfree(). Remove unnecessary fhold() and fdrop() calls from aio_qphysio(), undo'ing a part of revision 1.86. The reference count on the file structure is already incremented by _aio_aqueue() before it calls aio_qphysio(). (Update the comments to document this fact.) Remove unnecessary casts from _aio_aqueue(), aio_read(), aio_write() and aio_waitcomplete(). Remove an unnecessary "return;" from aio_process(). Add "static" in various places.
OpenPOWER on IntegriCloud