aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Chen <kenneth.w.chen@intel.com>2005-05-01 11:59:15 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 11:59:15 -0400
commit4bf69b2a06090c01c27f25ea5cd1440f7bf9256f (patch)
tree35bed1e865ee9f8b086954d866cee9c1c2b92b0f
parent212079cf4ee99e492a57b817e796825d423a30bb (diff)
[PATCH] aio: ring wrapping simplification
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> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/aio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 9f807a541fbe..40517f35daae 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -978,7 +978,8 @@ int fastcall aio_complete(struct kiocb *iocb, long res, long res2)
978 978
979 tail = info->tail; 979 tail = info->tail;
980 event = aio_ring_event(info, tail, KM_IRQ0); 980 event = aio_ring_event(info, tail, KM_IRQ0);
981 tail = (tail + 1) % info->nr; 981 if (++tail >= info->nr)
982 tail = 0;
982 983
983 event->obj = (u64)(unsigned long)iocb->ki_obj.user; 984 event->obj = (u64)(unsigned long)iocb->ki_obj.user;
984 event->data = iocb->ki_user_data; 985 event->data = iocb->ki_user_data;