aiomaxevents : This patch adds a posix_aio_default_maxevents sysctl variable for configuring the default AIO context event ring size at runtime. This way, calling sys_io_setup with nr_events=0, will result in the kernel using the default system value. This tunable is accessible via /proc/sys/fs/posix-aio-default-max-nr. Makefile | 2 +- fs/Kconfig | 8 ++++++++ fs/aio.c | 8 ++++++++ include/linux/aio.h | 3 +++ include/linux/sysctl.h | 3 +++ kernel/sysctl.c | 10 ++++++++++ 6 files changed, 33 insertions(+), 1 deletion(-) Signed-off-by: Sébastien Dugué Index: linux-2.6.12/fs/aio.c =================================================================== --- linux-2.6.12.orig/fs/aio.c 2005-06-23 13:58:03.000000000 +0200 +++ linux-2.6.12/fs/aio.c 2005-06-23 13:59:08.000000000 +0200 @@ -43,6 +43,9 @@ /*------ sysctl variables----*/ atomic_t aio_nr = ATOMIC_INIT(0); /* current system wide number of aio requests */ unsigned aio_max_nr = 0x10000; /* system wide maximum number of aio requests */ +#if defined(CONFIG_POSIX_AIO) +unsigned posix_aio_default_maxevents = 1024; /* FIXME: default value for POSIX AIO */ +#endif /* CONFIG_POSIX_AIO */ /*----end sysctl variables---*/ static kmem_cache_t *kiocb_cachep; @@ -1244,6 +1247,11 @@ unsigned long ctx; long ret; +#if defined(CONFIG_POSIX_AIO) + if (nr_events == 0) + nr_events = posix_aio_default_maxevents; +#endif + ret = get_user(ctx, ctxp); if (unlikely(ret)) goto out; Index: linux-2.6.12/fs/Kconfig =================================================================== --- linux-2.6.12.orig/fs/Kconfig 2005-06-23 13:58:03.000000000 +0200 +++ linux-2.6.12/fs/Kconfig 2005-06-23 13:59:08.000000000 +0200 @@ -4,6 +4,14 @@ menu "File systems" +config POSIX_AIO + bool "POSIX AIO Support" + help + Enable POSIX Asynchronous IO + + If unsure, say N. + + config EXT2_FS tristate "Second extended fs support" help Index: linux-2.6.12/include/linux/aio.h =================================================================== --- linux-2.6.12.orig/include/linux/aio.h 2005-06-23 13:58:03.000000000 +0200 +++ linux-2.6.12/include/linux/aio.h 2005-06-23 13:59:08.000000000 +0200 @@ -153,6 +153,9 @@ /* prototypes */ extern unsigned aio_max_size; +#if defined(CONFIG_POSIX_AIO) +extern unsigned posix_aio_default_maxevents; +#endif /* CONFIG_POSIX_AIO */ extern ssize_t FASTCALL(wait_on_sync_kiocb(struct kiocb *iocb)); extern int FASTCALL(aio_put_req(struct kiocb *iocb)); Index: linux-2.6.12/include/linux/sysctl.h =================================================================== --- linux-2.6.12.orig/include/linux/sysctl.h 2005-06-23 13:58:03.000000000 +0200 +++ linux-2.6.12/include/linux/sysctl.h 2005-06-23 13:59:08.000000000 +0200 @@ -680,6 +680,9 @@ FS_XFS=17, /* struct: control xfs parameters */ FS_AIO_NR=18, /* current system-wide number of aio requests */ FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */ +#if defined(CONFIG_POSIX_AIO) + FS_POSIX_AIO_MAX_NR=20, /* default value for POSIX AIO max request */ +#endif /* CONFIG_POSIX_AIO */ }; /* /proc/sys/fs/quota/ */ Index: linux-2.6.12/kernel/sysctl.c =================================================================== --- linux-2.6.12.orig/kernel/sysctl.c 2005-06-23 13:58:03.000000000 +0200 +++ linux-2.6.12/kernel/sysctl.c 2005-06-23 13:59:08.000000000 +0200 @@ -949,6 +949,16 @@ .mode = 0644, .proc_handler = &proc_dointvec, }, +#if defined(CONFIG_POSIX_AIO) + { + .ctl_name = FS_POSIX_AIO_MAX_NR, + .procname = "posix-aio-default-max-nr", + .data = &posix_aio_default_maxevents, + .maxlen = sizeof(posix_aio_default_maxevents), + .mode = 0644, + .proc_handler = &proc_dointvec, + }, +#endif /* CONFIG_POSIX_AIO */ #endif { .ctl_name = 0 } }; Index: linux-2.6.12/Makefile =================================================================== --- linux-2.6.12.orig/Makefile 2005-06-23 13:58:03.000000000 +0200 +++ linux-2.6.12/Makefile 2005-06-23 13:59:08.000000000 +0200 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 12 -EXTRAVERSION = +EXTRAVERSION = .PAIO-aiomaxevents NAME=Woozy Numbat # *DOCUMENTATION*