Skip to content

Commit

Permalink
aio: abstract out io_event filler helper
Browse files Browse the repository at this point in the history
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Jens Axboe committed Dec 18, 2018
1 parent 88a6f18 commit 875736b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions fs/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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]);
Expand Down

0 comments on commit 875736b

Please sign in to comment.