From: Gu Zheng <guz.fnst@cn.fujitsu.com>
To: Benjamin <bcrl@kvack.org>
Cc: Kent <kmo@daterainc.com>, Jens <axboe@kernel.dk>,
linux-aio@kvack.org, linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2] aio: make aio_read_events_ring be aware of aio_complete
Date: Fri, 28 Feb 2014 18:27:18 +0800 [thread overview]
Message-ID: <53106486.1090300@cn.fujitsu.com> (raw)
Commit 5ffac122dbda8(aio: Don't use ctx->tail unnecessarily) uses
ring->tail rather than the ctx->tail, but with this change, we fetch 'tail'
only once at the start, so that we can not be aware of adding event by aio_complete
when reading events. It seems a regression.
So here we fetch the ring->tail in start of the loop each time to make it be
aware of adding event from aio_complete.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
---
fs/aio.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/fs/aio.c b/fs/aio.c
index 7eaa631..f5b8551 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1029,10 +1029,14 @@ static long aio_read_events_ring(struct kioctx *ctx,
struct io_event *ev;
struct page *page;
- avail = (head <= tail ? tail : ctx->nr_events) - head;
+ ring = kmap_atomic(ctx->ring_pages[0]);
+ tail = ring->tail;
+ kunmap_atomic(ring);
+
if (head == tail)
break;
+ avail = (head <= tail ? tail : ctx->nr_events) - head;
avail = min(avail, nr - ret);
avail = min_t(long, avail, AIO_EVENTS_PER_PAGE -
((head + AIO_EVENTS_OFFSET) % AIO_EVENTS_PER_PAGE));
--
1.7.7
next reply other threads:[~2014-02-28 10:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 10:27 Gu Zheng [this message]
2014-02-28 20:52 ` [PATCH 2/2] aio: make aio_read_events_ring be aware of aio_complete Kent Overstreet
2014-03-03 2:17 ` Gu Zheng
2014-03-07 10:42 ` Gu Zheng
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=53106486.1090300@cn.fujitsu.com \
--to=guz.fnst@cn.fujitsu.com \
--cc=axboe@kernel.dk \
--cc=bcrl@kvack.org \
--cc=kmo@daterainc.com \
--cc=linux-aio@kvack.org \
--cc=linux-kernel@vger.kernel.org \
/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