From: Ken Chen <kenneth.w.chen@intel.com>

Since the tail pointer in aio_ring structure never wrap ring size more than
once, so a simple compare is sufficient to wrap the index around.  This avoid
a more expensive mod operation.

Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Cc: Suparna Bhattacharya <suparna@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 fs/aio.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff -puN fs/aio.c~aio-ring-tail fs/aio.c
--- 25/fs/aio.c~aio-ring-tail	2005-04-26 20:12:18.807405192 -0700
+++ 25-akpm/fs/aio.c	2005-04-26 20:12:18.811404584 -0700
@@ -978,7 +978,8 @@ int fastcall aio_complete(struct kiocb *
 
 	tail = info->tail;
 	event = aio_ring_event(info, tail, KM_IRQ0);
-	tail = (tail + 1) % info->nr;
+	if (++tail >= info->nr)
+		tail = 0;
 
 	event->obj = (u64)(unsigned long)iocb->ki_obj.user;
 	event->data = iocb->ki_user_data;
_