Lines Matching full:io
45 static bool erofs_fscache_io_put(struct erofs_fscache_io *io) in erofs_fscache_io_put() argument
47 if (!refcount_dec_and_test(&io->ref)) in erofs_fscache_io_put()
49 if (io->cres.ops) in erofs_fscache_io_put()
50 io->cres.ops->end_operation(&io->cres); in erofs_fscache_io_put()
51 kfree(io); in erofs_fscache_io_put()
97 static void erofs_fscache_req_io_put(struct erofs_fscache_io *io) in erofs_fscache_req_io_put() argument
99 struct erofs_fscache_rq *req = io->private; in erofs_fscache_req_io_put()
101 if (erofs_fscache_io_put(io)) in erofs_fscache_req_io_put()
107 struct erofs_fscache_io *io = priv; in erofs_fscache_req_end_io() local
108 struct erofs_fscache_rq *req = io->private; in erofs_fscache_req_end_io()
112 erofs_fscache_req_io_put(io); in erofs_fscache_req_end_io()
117 struct erofs_fscache_io *io = kzalloc(sizeof(*io), GFP_KERNEL); in erofs_fscache_req_io_alloc() local
119 if (!io) in erofs_fscache_req_io_alloc()
121 io->end_io = erofs_fscache_req_end_io; in erofs_fscache_req_io_alloc()
122 io->private = req; in erofs_fscache_req_io_alloc()
124 refcount_set(&io->ref, 1); in erofs_fscache_req_io_alloc()
125 return io; in erofs_fscache_req_io_alloc()
130 * offset, and fill the read data into buffer described by io->iter.
133 loff_t pstart, struct erofs_fscache_io *io) in erofs_fscache_read_io_async() argument
136 struct netfs_cache_resources *cres = &io->cres; in erofs_fscache_read_io_async()
137 struct iov_iter *iter = &io->iter; in erofs_fscache_read_io_async()
158 refcount_inc(&io->ref); in erofs_fscache_read_io_async()
160 io->end_io, io); in erofs_fscache_read_io_async()
177 struct erofs_fscache_io io; member
184 struct erofs_fscache_bio *io = priv; in erofs_fscache_bio_endio() local
187 io->bio.bi_status = errno_to_blk_status(transferred_or_error); in erofs_fscache_bio_endio()
188 io->bio.bi_end_io(&io->bio); in erofs_fscache_bio_endio()
189 BUILD_BUG_ON(offsetof(struct erofs_fscache_bio, io) != 0); in erofs_fscache_bio_endio()
190 erofs_fscache_io_put(&io->io); in erofs_fscache_bio_endio()
195 struct erofs_fscache_bio *io; in erofs_fscache_bio_alloc() local
197 io = kmalloc(sizeof(*io), GFP_KERNEL | __GFP_NOFAIL); in erofs_fscache_bio_alloc()
198 bio_init(&io->bio, NULL, io->bvecs, BIO_MAX_VECS, REQ_OP_READ); in erofs_fscache_bio_alloc()
199 io->io.private = mdev->m_dif->fscache->cookie; in erofs_fscache_bio_alloc()
200 io->io.end_io = erofs_fscache_bio_endio; in erofs_fscache_bio_alloc()
201 refcount_set(&io->io.ref, 1); in erofs_fscache_bio_alloc()
202 return &io->bio; in erofs_fscache_bio_alloc()
207 struct erofs_fscache_bio *io = container_of(bio, in erofs_fscache_submit_bio() local
211 iov_iter_bvec(&io->io.iter, ITER_DEST, io->bvecs, bio->bi_vcnt, in erofs_fscache_submit_bio()
213 ret = erofs_fscache_read_io_async(io->io.private, in erofs_fscache_submit_bio()
214 bio->bi_iter.bi_sector << 9, &io->io); in erofs_fscache_submit_bio()
215 erofs_fscache_io_put(&io->io); in erofs_fscache_submit_bio()
227 struct erofs_fscache_io *io; in erofs_fscache_meta_read_folio() local
236 io = erofs_fscache_req_io_alloc(req); in erofs_fscache_meta_read_folio()
237 if (!io) { in erofs_fscache_meta_read_folio()
241 iov_iter_xarray(&io->iter, ITER_DEST, &folio->mapping->i_pages, in erofs_fscache_meta_read_folio()
244 ret = erofs_fscache_read_io_async(ctx->cookie, folio_pos(folio), io); in erofs_fscache_meta_read_folio()
248 erofs_fscache_req_io_put(io); in erofs_fscache_meta_read_folio()
259 struct erofs_fscache_io *io; in erofs_fscache_data_read_slice() local
314 io = erofs_fscache_req_io_alloc(req); in erofs_fscache_data_read_slice()
315 if (!io) in erofs_fscache_data_read_slice()
317 iov_iter_xarray(&io->iter, ITER_DEST, &mapping->i_pages, pos, count); in erofs_fscache_data_read_slice()
319 mdev.m_pa + (pos - map.m_la), io); in erofs_fscache_data_read_slice()
320 erofs_fscache_req_io_put(io); in erofs_fscache_data_read_slice()