Lines Matching refs:rq

131 static int bio_copy_user_iov(struct request *rq, struct rq_map_data *map_data,
160 bio_init(bio, NULL, bio->bi_inline_vecs, nr_pages, req_op(rq));
192 if (bio_add_pc_page(rq->q, bio, page, bytes, offset) < bytes) {
229 ret = blk_rq_append_bio(rq, bio);
253 static struct bio *blk_rq_map_bio_alloc(struct request *rq,
258 if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) {
259 bio = bio_alloc_bioset(NULL, nr_vecs, rq->cmd_flags, gfp_mask,
267 bio_init(bio, NULL, bio->bi_inline_vecs, nr_vecs, req_op(rq));
272 static int bio_map_user_iov(struct request *rq, struct iov_iter *iter,
276 unsigned int max_sectors = queue_max_hw_sectors(rq->q);
285 bio = blk_rq_map_bio_alloc(rq, nr_vecs, gfp_mask);
289 if (blk_queue_pci_p2pdma(rq->q))
313 if (unlikely(offs & queue_dma_alignment(rq->q)))
324 if (!bio_add_hw_page(rq->q, bio, page, n, offs,
348 ret = blk_rq_append_bio(rq, bio);
537 int blk_rq_append_bio(struct request *rq, struct bio *bio)
546 if (!rq->bio) {
547 blk_rq_bio_prep(rq, bio, nr_segs);
549 if (!ll_back_merge_fn(rq, bio, nr_segs))
551 rq->biotail->bi_next = bio;
552 rq->biotail = bio;
553 rq->__data_len += (bio)->bi_iter.bi_size;
562 static int blk_rq_map_user_bvec(struct request *rq, const struct iov_iter *iter)
564 struct request_queue *q = rq->q;
579 bio = blk_rq_map_bio_alloc(rq, 0, GFP_KERNEL);
584 blk_rq_bio_prep(rq, bio, nr_segs);
620 * @rq: request to map data to
632 int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
656 ret = blk_rq_map_user_bvec(rq, iter);
668 ret = bio_copy_user_iov(rq, map_data, &i, gfp_mask);
670 ret = bio_map_user_iov(rq, &i, gfp_mask);
674 bio = rq->bio;
682 rq->bio = NULL;
687 int blk_rq_map_user(struct request_queue *q, struct request *rq,
692 int ret = import_ubuf(rq_data_dir(rq), ubuf, len, &i);
697 return blk_rq_map_user_iov(q, rq, map_data, &i, gfp_mask);
742 * Unmap a rq previously mapped by blk_rq_map_user(). The caller must
743 * supply the original rq->bio from the blk_rq_map_user() return, since
744 * the I/O completion may have changed rq->bio.
772 * @rq: request to fill
782 int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
785 int reading = rq_data_dir(rq) == READ;
805 bio->bi_opf |= req_op(rq);
807 ret = blk_rq_append_bio(rq, bio);