diff options
author | Jens Axboe <axboe@kernel.dk> | 2018-11-20 22:06:23 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-12-18 10:29:59 -0500 |
commit | 875736bb3f3ded168469f6a14df7a938416a99d5 (patch) | |
tree | 5be195ce582e53516779e130826c0045bf9a1307 | |
parent | 88a6f18b950e2e4dce57d31daa151105f4f3dcff (diff) |
aio: abstract out io_event filler helper
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | fs/aio.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -1065,6 +1065,15 @@ static inline void iocb_put(struct aio_kiocb *iocb) | |||
1065 | } | 1065 | } |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | static void aio_fill_event(struct io_event *ev, struct aio_kiocb *iocb, | ||
1069 | long res, long res2) | ||
1070 | { | ||
1071 | ev->obj = (u64)(unsigned long)iocb->ki_user_iocb; | ||
1072 | ev->data = iocb->ki_user_data; | ||
1073 | ev->res = res; | ||
1074 | ev->res2 = res2; | ||
1075 | } | ||
1076 | |||
1068 | /* aio_complete | 1077 | /* aio_complete |
1069 | * Called when the io request on the given iocb is complete. | 1078 | * Called when the io request on the given iocb is complete. |
1070 | */ | 1079 | */ |
@@ -1092,10 +1101,7 @@ static void aio_complete(struct aio_kiocb *iocb, long res, long res2) | |||
1092 | ev_page = kmap_atomic(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]); | 1101 | ev_page = kmap_atomic(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]); |
1093 | event = ev_page + pos % AIO_EVENTS_PER_PAGE; | 1102 | event = ev_page + pos % AIO_EVENTS_PER_PAGE; |
1094 | 1103 | ||
1095 | event->obj = (u64)(unsigned long)iocb->ki_user_iocb; | 1104 | aio_fill_event(event, iocb, res, res2); |
1096 | event->data = iocb->ki_user_data; | ||
1097 | event->res = res; | ||
1098 | event->res2 = res2; | ||
1099 | 1105 | ||
1100 | kunmap_atomic(ev_page); | 1106 | kunmap_atomic(ev_page); |
1101 | flush_dcache_page(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]); | 1107 | flush_dcache_page(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]); |