lkml.org 
[lkml]   [2014]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] aio: make aio_read_events_ring be aware of aio_complete
ping...

On 02/28/2014 06:27 PM, Gu Zheng wrote:

> 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));




\
 
 \ /
  Last update: 2014-03-07 12:41    [W:0.057 / U:0.960 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site