From: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
To: "'Andrew Morton'" <akpm@osdl.org>, <zach.brown@oracle.com>
Cc: <linux-aio@kvack.org>, <linux-kernel@vger.kernel.org>,
"'Benjamin LaHaise'" <bcrl@kvack.org>, <suparna@in.ibm.com>
Subject: [patch] aio: remove spurious ring head index modulo info->nr
Date: Fri, 29 Dec 2006 18:59:14 -0800 [thread overview]
Message-ID: <000401c72bbe$7d715b30$d634030a@amr.corp.intel.com> (raw)
In aio_read_evt(), the ring->head will never wrap info->nr because
we already does the wrap when updating the ring head index:
if (head != ring->tail) {
...
head = (head + 1) % info->nr;
ring->head = head;
}
This makes the modulo of ring->head into local variable head unnecessary.
This patch removes that bogus code.
Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>
--- ./fs/aio.c.orig 2006-12-24 22:01:36.000000000 -0800
+++ ./fs/aio.c 2006-12-24 22:34:48.000000000 -0800
@@ -1019,7 +1019,7 @@ static int aio_read_evt(struct kioctx *i
{
struct aio_ring_info *info = &ioctx->ring_info;
struct aio_ring *ring;
- unsigned long head;
+ unsigned int head;
int ret = 0;
ring = kmap_atomic(info->ring_pages[0], KM_USER0);
@@ -1032,7 +1032,7 @@ static int aio_read_evt(struct kioctx *i
spin_lock(&info->ring_lock);
- head = ring->head % info->nr;
+ head = ring->head;
if (head != ring->tail) {
struct io_event *evp = aio_ring_event(info, head, KM_USER1);
*ent = *evp;
next reply other threads:[~2006-12-30 2:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-30 2:59 Chen, Kenneth W [this message]
2007-01-03 1:12 ` Zach Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000401c72bbe$7d715b30$d634030a@amr.corp.intel.com' \
--to=kenneth.w.chen@intel.com \
--cc=akpm@osdl.org \
--cc=bcrl@kvack.org \
--cc=linux-aio@kvack.org \
--cc=linux-kernel@vger.kernel.org \
--cc=suparna@in.ibm.com \
--cc=zach.brown@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®