freebsd-skq/sys/kern
John Dyson 11783b142b Fix error handling for VCHR type I/O. Also, fix another spl problem, and
remove alot of overly verbose debugging statements.
ioproclist {
	int aioprocflags;			/* AIO proc flags */
	TAILQ_ENTRY(aioproclist) list;		/* List of processes */
	struct proc *aioproc;			/* The AIO thread */
	TAILQ_HEAD (,aiocblist) jobtorun;	/* suggested job to run */
};

/*
 * data-structure for lio signal management
 */
struct aio_liojob {
	int lioj_flags;
	int	lioj_buffer_count;
	int	lioj_buffer_finished_count;
	int	lioj_queue_count;
	int	lioj_queue_finished_count;
	struct sigevent lioj_signal;	/* signal on all I/O done */
	TAILQ_ENTRY (aio_liojob) lioj_list;
	struct kaioinfo *lioj_ki;
};
#define	LIOJ_SIGNAL			0x1 /* signal on all done (lio) */
#define	LIOJ_SIGNAL_POSTED	0x2	/* signal has been posted */

/*
 * per process aio data structure
 */
struct kaioinfo {
	int	kaio_flags;			/* per process kaio flags */
	int	kaio_maxactive_count;	/* maximum number of AIOs */
	int	kaio_active_count;	/* number of currently used AIOs */
	int	kaio_qallowed_count;	/* maxiumu size of AIO queue */
	int	kaio_queue_count;	/* size of AIO queue */
	int	kaio_ballowed_count;	/* maximum number of buffers */
	int	kaio_queue_finished_count;	/* number of daemon jobs finished */
	int	kaio_buffer_count;	/* number of physio buffers */
	int	kaio_buffer_finished_count;	/* count of I/O done */
	struct proc *kaio_p;			/* process that uses this kaio block */
	TAILQ_HEAD (,aio_liojob) kaio_liojoblist;	/* list of lio jobs */
	TAILQ_HEAD (,aiocblist)	kaio_jobqueue;	/* job queue for process */
	TAILQ_HEAD (,aiocblist)	kaio_jobdone;	/* done queue for process */
	TAILQ_HEAD (,aiocblist)	kaio_bufqueue;	/* buffer job queue for process */
	TAILQ_HEAD (,aiocblist)	kaio_bufdone;	/* buffer done queue for process */
};

#define KAIO_RUNDOWN 0x1		/* process is being run down */
#define KAIO_WAKEUP 0x2			/* wakeup process when there is a significant
								   event */


TAILQ_HEAD (,aioproclist) aio_freeproc, aio_activeproc;
TAILQ_HEAD(,aiocblist) aio_jobs;			/* Async job list */
TAILQ_HEAD(,aiocblist) aio_bufjobs;			/* Phys I/O job list */
TAILQ_HEAD(,aiocblist) aio_freejobs;		/* Pool of free jobs */

static void aio_init_aioinfo(struct proc *p) ;
static void aio_onceonly(void *) ;
static int aio_free_entry(struct aiocblist *aiocbe);
static void aio_process(struct aiocblist *aiocbe);
static int aio_newproc(void) ;
static int aio_aqueue(struct proc *p, struct aiocb *job, int type) ;
static void aio_physwakeup(struct buf *bp);
static int aio_fphysio(struct proc *p, struct aiocblist *aiocbe, int type);
static int aio_qphysio(struct proc *p, struct aiocblist *iocb);
static void aio_daemon(void *uproc);

SYSINIT(aio, SI_SUB_VFS, SI_ORDER_ANY, aio_onceonly, NULL);

static vm_zone_t kaio_zone=0, aiop_zone=0,
	aiocb_zone=0, aiol_zone=0, aiolio_zone=0;

/*
 * Single AIOD vmspace shared amongst all of them
 */
static struct vmspace *aiovmspace = NULL;

/*
 * Startup initialization
 */
void
aio_onceonly(void *na)
{
	TAILQ_INIT(&aio_freeproc);
	TAILQ_INIT(&aio_activeproc);
	TAILQ_INIT(&aio_jobs);
	TAILQ_INIT(&aio_bufjobs);
	TAILQ_INIT(&aio_freejobs);
	kaio_zone = zinit("AIO", sizeof (struct kaioinfo), 0, 0, 1);
	aiop_zone = zinit("AIOP", sizeof (struct aioproclist), 0, 0, 1);
	aiocb_zone = zinit("AIOCB", sizeof (struct aiocblist), 0, 0, 1);
	aiol_zone = zinit("AIOL", AIO_LISTIO_MAX * sizeof (int), 0, 0, 1);
	aiolio_zone = zinit("AIOLIO",
		AIO_LISTIO_MAX * sizeof (struct aio_liojob), 0, 0, 1);
	aiod_timeout = AIOD_TIMEOUT_DEFAULT;
	aiod_lifetime = AIOD_LIFETIME_DEFAULT;
	jobrefid = 1;
}

/*
 * Init the per-process aioinfo structure.
 * The aioinfo limits are set per-process for user limit (resource) management.
 */
void
aio_init_aioinfo(struct proc *p)
{
	struct kaioinfo *ki;
	if (p->p_aioinfo == NULL) {
		ki = zalloc(kaio_zone);
		p->p_aioinfo = ki
1997-12-01 07:01:45 +00:00
..
imgact_aout.c Removed unused #includes. 1997-09-02 20:06:59 +00:00
imgact_elf.c We were (I think) missing a vrele() on the vnode for the object loaded 1997-09-21 03:13:21 +00:00
imgact_gzip.c Removed unused #includes. 1997-09-02 20:06:59 +00:00
imgact_shell.c Removed unused #includes. 1997-08-02 14:33:27 +00:00
inflate.c Last major round (Unless Bruce thinks of somthing :-) of malloc changes. 1997-10-12 20:26:33 +00:00
init_main.c Shift a few SYSINT() calls around. 1997-11-25 07:07:48 +00:00
init_sysent.c Remade syscalls.master derived files. 1997-10-26 20:28:54 +00:00
init_sysvec.c Removed unused #includes. 1997-08-02 14:33:27 +00:00
kern_acct.c Move the "retval" (3rd) parameter from all syscall functions and put 1997-11-06 19:29:57 +00:00
kern_clock.c Removed all traces of P_IDLEPROC. It was tested but never set. 1997-11-24 15:15:33 +00:00
kern_conf.c Staticized. 1997-11-22 08:35:46 +00:00
kern_descrip.c Fix and complete the AIO syscalls. There are some performance enhancements 1997-11-29 01:33:10 +00:00
kern_exec.c Move the "retval" (3rd) parameter from all syscall functions and put 1997-11-06 19:29:57 +00:00
kern_exit.c Avoid passing a `retval' to wait1() 1997-11-20 19:09:43 +00:00
kern_fork.c Removed unused includes. 1997-11-20 16:36:17 +00:00
kern_intr.c - Hide the 'device doesn't supported shared interrupts' code behind 1997-10-06 04:27:32 +00:00
kern_ktrace.c Move the "retval" (3rd) parameter from all syscall functions and put 1997-11-06 19:29:57 +00:00
kern_linker.c Fixed a sloppy common-style definitions. 1997-11-20 20:07:59 +00:00
kern_lkm.c Move the "retval" (3rd) parameter from all syscall functions and put 1997-11-06 19:29:57 +00:00
kern_lock.c Remove a bunch of variables which were unused both in GENERIC and LINT. 1997-11-07 08:53:44 +00:00
kern_lockf.c Last major round (Unless Bruce thinks of somthing :-) of malloc changes. 1997-10-12 20:26:33 +00:00
kern_malloc.c Remove the long description from the in-kernel datastructure. 1997-10-28 19:01:02 +00:00
kern_mib.c kern.maxproc is not writable since there are tables that are statically 1997-10-19 18:45:59 +00:00
kern_module.c Remove a bunch of variables which were unused both in GENERIC and LINT. 1997-11-07 08:53:44 +00:00
kern_ntptime.c Move the "retval" (3rd) parameter from all syscall functions and put 1997-11-06 19:29:57 +00:00
kern_opt.c Added a copyright and restored order. 1997-02-28 10:14:24 +00:00
kern_physio.c Removed unused #includes. 1997-09-02 20:06:59 +00:00
kern_proc.c Last major round (Unless Bruce thinks of somthing :-) of malloc changes. 1997-10-12 20:26:33 +00:00
kern_prot.c Move the "retval" (3rd) parameter from all syscall functions and put 1997-11-06 19:29:57 +00:00
kern_random.c Removed unused #includes. 1997-10-28 15:59:26 +00:00
kern_resource.c Remove a bunch of variables which were unused both in GENERIC and LINT. 1997-11-07 08:53:44 +00:00
kern_shutdown.c Shift a few SYSINT() calls around. 1997-11-25 07:07:48 +00:00
kern_sig.c Move the "retval" (3rd) parameter from all syscall functions and put 1997-11-06 19:29:57 +00:00
kern_subr.c Rename "struct kmemstats" to "struct malloc_type" it makes more sense now. 1997-10-10 18:14:23 +00:00
kern_synch.c Shift a few SYSINT() calls around. 1997-11-25 07:07:48 +00:00
kern_sysctl.c Move the "retval" (3rd) parameter from all syscall functions and put 1997-11-06 19:29:57 +00:00
kern_tc.c Removed all traces of P_IDLEPROC. It was tested but never set. 1997-11-24 15:15:33 +00:00
kern_threads.c Remove a bunch of variables which were unused both in GENERIC and LINT. 1997-11-07 08:53:44 +00:00
kern_time.c Remove a bunch of variables which were unused both in GENERIC and LINT. 1997-11-07 08:53:44 +00:00
kern_timeout.c Removed all traces of P_IDLEPROC. It was tested but never set. 1997-11-24 15:15:33 +00:00
kern_xxx.c Move the "retval" (3rd) parameter from all syscall functions and put 1997-11-06 19:29:57 +00:00
link_aout.c Fixed a sloppy common-style definitions. 1997-11-20 20:07:59 +00:00
Make.tags.inc Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not 1997-02-22 09:48:43 +00:00
Makefile Remove bogus architectures to allow make tags to work. 1996-03-31 18:53:43 +00:00
makesyscalls.sh Don't generate new prototype files with the extra int retval[] arg at 1997-11-18 03:34:39 +00:00
md5c.c Add const to a couple of casts to silence some of the warnings Bruce 1997-10-21 13:28:36 +00:00
subr_autoconf.c Removed an unused #include. Ifdefed a conditionally used #include. 1997-11-18 12:43:41 +00:00
subr_clist.c Last major round (Unless Bruce thinks of somthing :-) of malloc changes. 1997-10-12 20:26:33 +00:00
subr_disklabel.c Remove a bunch of variables which were unused both in GENERIC and LINT. 1997-11-07 08:53:44 +00:00
subr_diskmbr.c Hide the `no magic' babble behind bootverbose, since it has proven to 1997-09-27 15:34:34 +00:00
subr_diskslice.c Rename some local variables to avoid shadowing other local variables. 1997-11-07 09:21:01 +00:00
subr_dkbad.c Fix the buffer flag frobbing. Note: It is invalid to gratuitiously modify 1997-11-24 04:14:21 +00:00
subr_log.c Removed unused #includes. 1997-10-28 15:59:26 +00:00
subr_param.c Removed unused #includes. 1997-06-14 11:38:46 +00:00
subr_prf.c Last major round (Unless Bruce thinks of somthing :-) of malloc changes. 1997-10-12 20:26:33 +00:00
subr_prof.c Move the "retval" (3rd) parameter from all syscall functions and put 1997-11-06 19:29:57 +00:00
subr_rlist.c Fixed gratuitous ANSIisms. 1997-09-16 11:44:05 +00:00
subr_smp.c Use UPAGES when setting up private pages for SMP (which includes idle stack). 1997-11-07 19:58:34 +00:00
subr_trap.c Fixed some #include messes. 1997-11-24 13:25:37 +00:00
subr_xxx.c Zap nxselect and noselect. 1997-09-14 02:50:28 +00:00
sys_generic.c Fixed some style bugs in the poll() code. 1997-11-23 10:30:50 +00:00
sys_pipe.c Remove a bunch of variables which were unused both in GENERIC and LINT. 1997-11-07 08:53:44 +00:00
sys_process.c Set return value for the correct process in ptrace(). 1997-11-12 12:28:12 +00:00
sys_socket.c Various select -> poll changes 1997-09-14 02:52:18 +00:00
syscalls.c Remade syscalls.master derived files. 1997-10-26 20:28:54 +00:00
syscalls.master Add "NOIMPL" for syscalls we know what is, but don't implement as "STD". 1997-10-26 20:27:51 +00:00
sysv_ipc.c Removed an unused #include. Added an unsed #include of <sys/ucred.h> 1997-11-18 12:52:10 +00:00
sysv_msg.c Move the "retval" (3rd) parameter from all syscall functions and put 1997-11-06 19:29:57 +00:00
sysv_sem.c Move the "retval" (3rd) parameter from all syscall functions and put 1997-11-06 19:29:57 +00:00
sysv_shm.c Move the "retval" (3rd) parameter from all syscall functions and put 1997-11-06 19:29:57 +00:00
tty_compat.c Removed unused #includes. 1997-08-02 14:33:27 +00:00
tty_conf.c Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not 1997-02-22 09:48:43 +00:00
tty_cons.c Update select -> poll in drivers. 1997-09-14 03:19:42 +00:00
tty_pty.c Fixed gratuitous ANSIisms. 1997-09-16 11:44:05 +00:00
tty_snoop.c Removed unused #includes. Ifdefed a conditionally used #include. 1997-11-18 16:12:51 +00:00
tty_subr.c Last major round (Unless Bruce thinks of somthing :-) of malloc changes. 1997-10-12 20:26:33 +00:00
tty_tb.c Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not 1997-02-22 09:48:43 +00:00
tty_tty.c Get tty ioctl numbers by #including <sys/ttycom.h> instead of 1997-11-18 12:59:09 +00:00
tty.c Remove a bunch of variables which were unused both in GENERIC and LINT. 1997-11-07 08:53:44 +00:00
uipc_domain.c Fixed gratuitous ANSIisms. 1997-09-16 11:44:05 +00:00
uipc_mbuf.c Removed unused #includes. 1997-10-28 15:59:26 +00:00
uipc_proto.c Removed unused #includes. 1997-08-02 14:33:27 +00:00
uipc_sockbuf.c Removed trailing semicolons from the definitions of the sysctl 1997-09-07 16:53:52 +00:00
uipc_socket2.c Removed trailing semicolons from the definitions of the sysctl 1997-09-07 16:53:52 +00:00
uipc_socket.c MF22: MSG_EOR bug fix. 1997-11-09 05:07:40 +00:00
uipc_syscalls.c Move the "retval" (3rd) parameter from all syscall functions and put 1997-11-06 19:29:57 +00:00
uipc_usrreq.c Fixed duplicate definitions of M_FILE (one static). 1997-11-23 10:43:49 +00:00
vfs_aio.c Fix error handling for VCHR type I/O. Also, fix another spl problem, and 1997-12-01 07:01:45 +00:00
vfs_bio.c Avoid manipulating the buffer map at interrupt time by deferring bfreekva 1997-11-24 06:18:27 +00:00
vfs_cache.c Remove a bunch of variables which were unused both in GENERIC and LINT. 1997-11-07 08:53:44 +00:00
vfs_cluster.c Remove a bunch of variables which were unused both in GENERIC and LINT. 1997-11-07 08:53:44 +00:00
vfs_conf.c Shift a few SYSINT() calls around. 1997-11-25 07:07:48 +00:00
vfs_default.c Removed an unused #include. 1997-11-18 13:03:48 +00:00
vfs_export.c Staticized. 1997-11-22 08:35:46 +00:00
vfs_extattr.c Staticized. 1997-11-22 06:41:21 +00:00
vfs_init.c Simplify the lease_check stuff. 1997-10-26 20:26:33 +00:00
vfs_lookup.c Change the M_NAMEI allocations to use the zone allocator. This change 1997-09-21 04:24:27 +00:00
vfs_mount.c Shift a few SYSINT() calls around. 1997-11-25 07:07:48 +00:00
vfs_subr.c Staticized. 1997-11-22 08:35:46 +00:00
vfs_syscalls.c Staticized. 1997-11-22 06:41:21 +00:00
vfs_vnops.c Fix and complete the AIO syscalls. There are some performance enhancements 1997-11-29 01:33:10 +00:00
vnode_if.pl Removed unused #includes. 1997-10-28 15:59:26 +00:00
vnode_if.sh Removed unused #includes. 1997-10-28 15:59:26 +00:00
vnode_if.src Another VFS cleanup "kilo commit" 1997-10-16 20:32:40 +00:00