summaryrefslogtreecommitdiffstats
path: root/fs/aio.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2018-11-20 20:06:23 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-02 09:58:58 +0200
commita812f7b68a3940e0369fd0fb24febec794a67623 (patch)
treed1576d2fc8bb3f115943295632888e2058b5aa9d /fs/aio.c
parentd384f8b855a573ea301fd7f5558cc64cb22107e6 (diff)
downloadlinux-stable-a812f7b68a3940e0369fd0fb24febec794a67623.tar.gz
linux-stable-a812f7b68a3940e0369fd0fb24febec794a67623.tar.bz2
linux-stable-a812f7b68a3940e0369fd0fb24febec794a67623.zip
aio: abstract out io_event filler helper
commit 875736bb3f3ded168469f6a14df7a938416a99d5 upstream. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/aio.c')
-rw-r--r--fs/aio.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 6e1da220f04b..f6ce01ca6903 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1059,6 +1059,15 @@ static inline void iocb_put(struct aio_kiocb *iocb)
}
}
+static void aio_fill_event(struct io_event *ev, struct aio_kiocb *iocb,
+ long res, long res2)
+{
+ ev->obj = (u64)(unsigned long)iocb->ki_user_iocb;
+ ev->data = iocb->ki_user_data;
+ ev->res = res;
+ ev->res2 = res2;
+}
+
/* aio_complete
* Called when the io request on the given iocb is complete.
*/
@@ -1086,10 +1095,7 @@ static void aio_complete(struct aio_kiocb *iocb, long res, long res2)
ev_page = kmap_atomic(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]);
event = ev_page + pos % AIO_EVENTS_PER_PAGE;
- event->obj = (u64)(unsigned long)iocb->ki_user_iocb;
- event->data = iocb->ki_user_data;
- event->res = res;
- event->res2 = res2;
+ aio_fill_event(event, iocb, res, res2);
kunmap_atomic(ev_page);
flush_dcache_page(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]);