Lines Matching full:aio
82 /* used for aio completion */
98 static void backing_aio_put(struct backing_aio *aio) in backing_aio_put() argument
100 if (refcount_dec_and_test(&aio->ref)) { in backing_aio_put()
101 fput(aio->iocb.ki_filp); in backing_aio_put()
102 kmem_cache_free(backing_aio_cachep, aio); in backing_aio_put()
106 static void backing_aio_cleanup(struct backing_aio *aio, long res) in backing_aio_cleanup() argument
108 struct kiocb *iocb = &aio->iocb; in backing_aio_cleanup()
109 struct kiocb *orig_iocb = aio->orig_iocb; in backing_aio_cleanup()
111 if (aio->end_write) in backing_aio_cleanup()
112 aio->end_write(orig_iocb->ki_filp, iocb->ki_pos, res); in backing_aio_cleanup()
115 backing_aio_put(aio); in backing_aio_cleanup()
120 struct backing_aio *aio = container_of(iocb, struct backing_aio, iocb); in backing_aio_rw_complete() local
121 struct kiocb *orig_iocb = aio->orig_iocb; in backing_aio_rw_complete()
126 backing_aio_cleanup(aio, res); in backing_aio_rw_complete()
132 struct backing_aio *aio = container_of(work, struct backing_aio, work); in backing_aio_complete_work() local
134 backing_aio_rw_complete(&aio->iocb, aio->res); in backing_aio_complete_work()
139 struct backing_aio *aio = container_of(iocb, struct backing_aio, iocb); in backing_aio_queue_completion() local
144 aio->res = res; in backing_aio_queue_completion()
145 INIT_WORK(&aio->work, backing_aio_complete_work); in backing_aio_queue_completion()
146 queue_work(file_inode(aio->orig_iocb->ki_filp)->i_sb->s_dio_done_wq, in backing_aio_queue_completion()
147 &aio->work); in backing_aio_queue_completion()
165 struct backing_aio *aio = NULL; in backing_file_read_iter() local
186 aio = kmem_cache_zalloc(backing_aio_cachep, GFP_KERNEL); in backing_file_read_iter()
187 if (!aio) in backing_file_read_iter()
190 aio->orig_iocb = iocb; in backing_file_read_iter()
191 kiocb_clone(&aio->iocb, iocb, get_file(file)); in backing_file_read_iter()
192 aio->iocb.ki_complete = backing_aio_rw_complete; in backing_file_read_iter()
193 refcount_set(&aio->ref, 2); in backing_file_read_iter()
194 ret = vfs_iocb_iter_read(file, &aio->iocb, iter); in backing_file_read_iter()
195 backing_aio_put(aio); in backing_file_read_iter()
197 backing_aio_cleanup(aio, ret); in backing_file_read_iter()
244 struct backing_aio *aio; in backing_file_write_iter() local
251 aio = kmem_cache_zalloc(backing_aio_cachep, GFP_KERNEL); in backing_file_write_iter()
252 if (!aio) in backing_file_write_iter()
255 aio->orig_iocb = iocb; in backing_file_write_iter()
256 aio->end_write = ctx->end_write; in backing_file_write_iter()
257 kiocb_clone(&aio->iocb, iocb, get_file(file)); in backing_file_write_iter()
258 aio->iocb.ki_flags = flags; in backing_file_write_iter()
259 aio->iocb.ki_complete = backing_aio_queue_completion; in backing_file_write_iter()
260 refcount_set(&aio->ref, 2); in backing_file_write_iter()
261 ret = vfs_iocb_iter_write(file, &aio->iocb, iter); in backing_file_write_iter()
262 backing_aio_put(aio); in backing_file_write_iter()
264 backing_aio_cleanup(aio, ret); in backing_file_write_iter()