Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

blk-map: call blk_queue_bounce from blk_rq_append_bio

This makes moves the knowledge about bouncing out of the callers into the
block core (just like we do for the normal I/O path), and allows to unexport
blk_queue_bounce.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
caa4b024 e442cbf9

+4 -10
+3 -4
block/blk-map.c
··· 16 16 */ 17 17 int blk_rq_append_bio(struct request *rq, struct bio *bio) 18 18 { 19 + blk_queue_bounce(rq->q, &bio); 20 + 19 21 if (!rq->bio) { 20 22 blk_rq_bio_prep(rq->q, rq, bio); 21 23 } else { ··· 74 72 map_data->offset += bio->bi_iter.bi_size; 75 73 76 74 orig_bio = bio; 77 - blk_queue_bounce(q, &bio); 78 75 79 76 /* 80 77 * We link the bounce buffer in and could have to traverse it 81 78 * later so we have to get a ref to prevent it from being freed 82 79 */ 83 - bio_get(bio); 84 - 85 80 ret = blk_rq_append_bio(rq, bio); 81 + bio_get(bio); 86 82 if (ret) { 87 83 bio_endio(bio); 88 84 __blk_rq_unmap_user(orig_bio); ··· 249 249 return ret; 250 250 } 251 251 252 - blk_queue_bounce(q, &rq->bio); 253 252 return 0; 254 253 } 255 254 EXPORT_SYMBOL(blk_rq_map_kern);
-2
block/bounce.c
··· 284 284 */ 285 285 __blk_queue_bounce(q, bio_orig, pool); 286 286 } 287 - 288 - EXPORT_SYMBOL(blk_queue_bounce);
+1 -4
drivers/scsi/osd/osd_initiator.c
··· 1576 1576 return req; 1577 1577 1578 1578 for_each_bio(bio) { 1579 - struct bio *bounce_bio = bio; 1580 - 1581 - blk_queue_bounce(req->q, &bounce_bio); 1582 - ret = blk_rq_append_bio(req, bounce_bio); 1579 + ret = blk_rq_append_bio(req, bio); 1583 1580 if (ret) 1584 1581 return ERR_PTR(ret); 1585 1582 }