Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147570049
D12120.id34270.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D12120.id34270.diff
View Options
Index: head/lib/libc/sys/aio_suspend.2
===================================================================
--- head/lib/libc/sys/aio_suspend.2
+++ head/lib/libc/sys/aio_suspend.2
@@ -85,10 +85,10 @@
The
.Fa iocbs
argument
-contains more than
-.Dv AIO_LISTIO_MAX
-asynchronous I/O requests, or at least one of the requests is not
-valid.
+contains more asynchronous I/O requests than the
+.Va vfs.aio.max_aio_queue_per_proc
+.Xr sysctl 8
+variable, or at least one of the requests is not valid.
.It Bq Er EINTR
the suspend was interrupted by a signal.
.El
Index: head/lib/libc/sys/lio_listio.2
===================================================================
--- head/lib/libc/sys/lio_listio.2
+++ head/lib/libc/sys/lio_listio.2
@@ -161,7 +161,7 @@
There are not enough resources to enqueue the requests.
.It Bq Er EAGAIN
The request would cause the system-wide limit
-.Dv AIO_MAX
+.Dv {AIO_MAX}
to be exceeded.
.It Bq Er EINVAL
The
@@ -173,7 +173,7 @@
or
.Fa nent
is greater than
-.Dv AIO_LISTIO_MAX .
+.Dv {AIO_LISTIO_MAX} .
.It Bq Er EINVAL
The asynchronous notification method in
.Fa sig->sigev_notify
Index: head/sys/kern/vfs_aio.c
===================================================================
--- head/sys/kern/vfs_aio.c
+++ head/sys/kern/vfs_aio.c
@@ -90,11 +90,11 @@
#endif
#ifndef MAX_AIO_QUEUE_PER_PROC
-#define MAX_AIO_QUEUE_PER_PROC 256 /* Bigger than AIO_LISTIO_MAX */
+#define MAX_AIO_QUEUE_PER_PROC 256
#endif
#ifndef MAX_AIO_QUEUE
-#define MAX_AIO_QUEUE 1024 /* Bigger than AIO_LISTIO_MAX */
+#define MAX_AIO_QUEUE 1024 /* Bigger than MAX_AIO_QUEUE_PER_PROC */
#endif
#ifndef MAX_BUF_AIO
@@ -105,6 +105,7 @@
SYSCTL_DECL(_p1003_1b);
static MALLOC_DEFINE(M_LIO, "lio", "listio aio control block list");
+static MALLOC_DEFINE(M_AIOS, "aios", "aio_suspend aio control block list");
static SYSCTL_NODE(_vfs, OID_AUTO, aio, CTLFLAG_RW, 0,
"Async IO management");
@@ -169,10 +170,14 @@
SYSCTL_INT(_vfs_aio, OID_AUTO, max_buf_aio, CTLFLAG_RW, &max_buf_aio, 0,
"Maximum buf aio requests per process (stored in the process)");
-static int aio_listio_max = AIO_LISTIO_MAX;
+/*
+ * Though redundant with vfs.aio.max_aio_queue_per_proc, POSIX requires
+ * sysconf(3) to support AIO_LISTIO_MAX, and we implement that with
+ * vfs.aio.aio_listio_max.
+ */
SYSCTL_INT(_p1003_1b, CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max,
- CTLFLAG_RDTUN | CTLFLAG_CAPRD, &aio_listio_max, 0,
- "Maximum aio requests for a single lio_listio call");
+ CTLFLAG_RD | CTLFLAG_CAPRD, &max_aio_queue_per_proc,
+ 0, "Maximum aio requests for a single lio_listio call");
#ifdef COMPAT_FREEBSD6
typedef struct oaiocb {
@@ -334,10 +339,9 @@
* kaio Per process async io info
* aiop async io process data
* aiocb async io jobs
- * aiol list io job pointer - internal to aio_suspend XXX
* aiolio list io jobs
*/
-static uma_zone_t kaio_zone, aiop_zone, aiocb_zone, aiol_zone, aiolio_zone;
+static uma_zone_t kaio_zone, aiop_zone, aiocb_zone, aiolio_zone;
/* kqueue filters for aio */
static struct filterops aio_filtops = {
@@ -394,11 +398,6 @@
aio_onceonly(void)
{
- if (aio_listio_max < AIO_LISTIO_MAX)
- aio_listio_max = AIO_LISTIO_MAX;
- if (aio_listio_max > MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count))
- aio_listio_max = MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count);
-
exit_tag = EVENTHANDLER_REGISTER(process_exit, aio_proc_rundown, NULL,
EVENTHANDLER_PRI_ANY);
exec_tag = EVENTHANDLER_REGISTER(process_exec, aio_proc_rundown_exec,
@@ -416,8 +415,6 @@
NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
aiocb_zone = uma_zcreate("AIOCB", sizeof(struct kaiocb), NULL, NULL,
NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
- aiol_zone = uma_zcreate("AIOL", aio_listio_max * sizeof(intptr_t) ,
- NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
aiolio_zone = uma_zcreate("AIOLIO", sizeof(struct aioliojob), NULL,
NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
aiod_lifetime = AIOD_LIFETIME_DEFAULT;
@@ -1953,7 +1950,7 @@
struct aiocb **ujoblist;
int error;
- if (uap->nent < 0 || uap->nent > aio_listio_max)
+ if (uap->nent < 0 || uap->nent > max_aio_queue_per_proc)
return (EINVAL);
if (uap->timeout) {
@@ -1964,11 +1961,11 @@
} else
tsp = NULL;
- ujoblist = uma_zalloc(aiol_zone, M_WAITOK);
+ ujoblist = malloc(uap->nent * sizeof(ujoblist[0]), M_AIOS, M_WAITOK);
error = copyin(uap->aiocbp, ujoblist, uap->nent * sizeof(ujoblist[0]));
if (error == 0)
error = kern_aio_suspend(td, uap->nent, ujoblist, tsp);
- uma_zfree(aiol_zone, ujoblist);
+ free(ujoblist, M_AIOS);
return (error);
}
@@ -2161,7 +2158,7 @@
if ((mode != LIO_NOWAIT) && (mode != LIO_WAIT))
return (EINVAL);
- if (nent < 0 || nent > aio_listio_max)
+ if (nent < 0 || nent > max_aio_queue_per_proc)
return (EINVAL);
if (p->p_aioinfo == NULL)
@@ -2293,7 +2290,7 @@
return (EINVAL);
nent = uap->nent;
- if (nent < 0 || nent > aio_listio_max)
+ if (nent < 0 || nent > max_aio_queue_per_proc)
return (EINVAL);
if (uap->sig && (uap->mode == LIO_NOWAIT)) {
@@ -2330,7 +2327,7 @@
return (EINVAL);
nent = uap->nent;
- if (nent < 0 || nent > aio_listio_max)
+ if (nent < 0 || nent > max_aio_queue_per_proc)
return (EINVAL);
if (uap->sig && (uap->mode == LIO_NOWAIT)) {
@@ -2799,7 +2796,7 @@
uint32_t *ujoblist32;
int error, i;
- if (uap->nent < 0 || uap->nent > aio_listio_max)
+ if (uap->nent < 0 || uap->nent > max_aio_queue_per_proc)
return (EINVAL);
if (uap->timeout) {
@@ -2812,7 +2809,7 @@
} else
tsp = NULL;
- ujoblist = uma_zalloc(aiol_zone, M_WAITOK);
+ ujoblist = malloc(uap->nent * sizeof(ujoblist[0]), M_AIOS, M_WAITOK);
ujoblist32 = (uint32_t *)ujoblist;
error = copyin(uap->aiocbp, ujoblist32, uap->nent *
sizeof(ujoblist32[0]));
@@ -2822,7 +2819,7 @@
error = kern_aio_suspend(td, uap->nent, ujoblist, tsp);
}
- uma_zfree(aiol_zone, ujoblist);
+ free(ujoblist, M_AIOS);
return (error);
}
@@ -2925,7 +2922,7 @@
return (EINVAL);
nent = uap->nent;
- if (nent < 0 || nent > aio_listio_max)
+ if (nent < 0 || nent > max_aio_queue_per_proc)
return (EINVAL);
if (uap->sig && (uap->mode == LIO_NOWAIT)) {
@@ -2971,7 +2968,7 @@
return (EINVAL);
nent = uap->nent;
- if (nent < 0 || nent > aio_listio_max)
+ if (nent < 0 || nent > max_aio_queue_per_proc)
return (EINVAL);
if (uap->sig && (uap->mode == LIO_NOWAIT)) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 13, 12:19 AM (14 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29601936
Default Alt Text
D12120.id34270.diff (6 KB)
Attached To
Mode
D12120: Remove artificial restriction on lio_listio's operation count
Attached
Detach File
Event Timeline
Log In to Comment