From: Janet Morgan <janetmor@us.ibm.com>

It looks like aio_nr and aio_max_nr were intended to be sysctl parameters. 



 25-akpm/Documentation/filesystems/proc.txt |    9 +++++++++
 25-akpm/Documentation/sysctl/fs.txt        |   10 ++++++++++
 25-akpm/include/linux/aio.h                |    3 ++-
 25-akpm/include/linux/sysctl.h             |    2 ++
 25-akpm/kernel/sysctl.c                    |   16 ++++++++++++++++
 5 files changed, 39 insertions(+), 1 deletion(-)

diff -puN Documentation/filesystems/proc.txt~aio-sysctl-parms Documentation/filesystems/proc.txt
--- 25/Documentation/filesystems/proc.txt~aio-sysctl-parms	Fri Oct 31 14:12:06 2003
+++ 25-akpm/Documentation/filesystems/proc.txt	Fri Oct 31 14:12:06 2003
@@ -900,6 +900,15 @@ super-nr shows the number of currently a
 Every mounted file system needs a super block, so if you plan to mount lots of
 file systems, you may want to increase these numbers.
 
+aio-nr and aio-max-nr
+---------------------
+
+aio-nr is the running total of the number of events specified on the
+io_setup system call for all currently active aio contexts.  If aio-nr
+reaches aio-max-nr then io_setup will fail with EAGAIN.  Note that
+raising aio-max-nr does not result in the pre-allocation or re-sizing
+of any kernel data structures.
+
 2.2 /proc/sys/fs/binfmt_misc - Miscellaneous binary formats
 -----------------------------------------------------------
 
diff -puN Documentation/sysctl/fs.txt~aio-sysctl-parms Documentation/sysctl/fs.txt
--- 25/Documentation/sysctl/fs.txt~aio-sysctl-parms	Fri Oct 31 14:12:06 2003
+++ 25-akpm/Documentation/sysctl/fs.txt	Fri Oct 31 14:12:06 2003
@@ -138,3 +138,13 @@ thus the maximum number of mounted files
 can have. You only need to increase super-max if you need to
 mount more filesystems than the current value in super-max
 allows you to.
+
+==============================================================
+
+aio-nr & aio-max-nr:
+
+aio-nr shows the current system-wide number of asynchronous io
+requests.  aio-max-nr allows you to change the maximum value
+aio-nr can grow to.
+
+==============================================================
diff -puN include/linux/aio.h~aio-sysctl-parms include/linux/aio.h
--- 25/include/linux/aio.h~aio-sysctl-parms	Fri Oct 31 14:12:06 2003
+++ 25-akpm/include/linux/aio.h	Fri Oct 31 14:12:09 2003
@@ -167,6 +167,7 @@ static inline struct kiocb *list_kiocb(s
 }
 
 /* for sysctl: */
-extern unsigned aio_max_nr, aio_max_size, aio_max_pinned;
+extern atomic_t aio_nr;
+extern unsigned aio_max_nr;
 
 #endif /* __LINUX__AIO_H */
diff -puN include/linux/sysctl.h~aio-sysctl-parms include/linux/sysctl.h
--- 25/include/linux/sysctl.h~aio-sysctl-parms	Fri Oct 31 14:12:06 2003
+++ 25-akpm/include/linux/sysctl.h	Fri Oct 31 14:12:06 2003
@@ -601,6 +601,8 @@ enum
 	FS_LEASE_TIME=15,	/* int: maximum time to wait for a lease break */
 	FS_DQSTATS=16,	/* disc quota usage statistics */
 	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 */
 };
 
 /* /proc/sys/fs/quota/ */
diff -puN kernel/sysctl.c~aio-sysctl-parms kernel/sysctl.c
--- 25/kernel/sysctl.c~aio-sysctl-parms	Fri Oct 31 14:12:06 2003
+++ 25-akpm/kernel/sysctl.c	Fri Oct 31 14:12:06 2003
@@ -794,6 +794,22 @@ static ctl_table fs_table[] = {
 		.mode		= 0644,
 		.proc_handler	= &proc_dointvec,
 	},
+	{
+		.ctl_name	= FS_AIO_NR,
+		.procname	= "aio-nr",
+		.data		= &aio_nr,
+		.maxlen		= sizeof(aio_nr),
+		.mode		= 0444,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= FS_AIO_MAX_NR,
+		.procname	= "aio-max-nr",
+		.data		= &aio_max_nr,
+		.maxlen		= sizeof(aio_max_nr),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
 	{ .ctl_name = 0 }
 };
 

_