aio: abstract out io_event filler helper
authorJens Axboe <axboe@kernel.dk>
Wed, 21 Nov 2018 03:06:23 +0000 (20:06 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 18 Dec 2018 15:29:59 +0000 (08:29 -0700)
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/aio.c

index 278956d..e288233 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1065,6 +1065,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.
  */
@@ -1092,10 +1101,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]);