diff options
author | Christoph Hellwig <hch@lst.de> | 2016-07-19 05:31:53 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-07-20 19:38:35 -0400 |
commit | 4613c5f1df92f3cb5a8f89c7dfefc37402c16bd8 (patch) | |
tree | e31b141cd7540e79c4d0bc199f5a4a71db261b69 /drivers/scsi/osd | |
parent | dd9cf04611c566f980638ec0c592c38ea5d463ce (diff) |
scsi/osd: open code blk_make_request
I wish the OSD code could simply use blk_rq_map_* helpers like
everyone else, but the complex nature of deciding if we have
DATA IN and/or DATA OUT buffers might make this impossible
(at least for a mere human like me).
But using blk_rq_append_bio at least allows sharing the setup code
between request with or without dat a buffers, and given that this
is the last user of blk_make_request it allows getting rid of that
somewhat awkward interface.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Boaz Harrosh <ooo@electrozaur.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/scsi/osd')
-rw-r--r-- | drivers/scsi/osd/osd_initiator.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index daa4dc17f172..2f2a9910e30e 100644 --- a/drivers/scsi/osd/osd_initiator.c +++ b/drivers/scsi/osd/osd_initiator.c | |||
@@ -1558,18 +1558,25 @@ static int _osd_req_finalize_data_integrity(struct osd_request *or, | |||
1558 | static struct request *_make_request(struct request_queue *q, bool has_write, | 1558 | static struct request *_make_request(struct request_queue *q, bool has_write, |
1559 | struct _osd_io_info *oii, gfp_t flags) | 1559 | struct _osd_io_info *oii, gfp_t flags) |
1560 | { | 1560 | { |
1561 | if (oii->bio) | 1561 | struct request *req; |
1562 | return blk_make_request(q, oii->bio, flags); | 1562 | struct bio *bio = oii->bio; |
1563 | else { | 1563 | int ret; |
1564 | struct request *req; | ||
1565 | |||
1566 | req = blk_get_request(q, has_write ? WRITE : READ, flags); | ||
1567 | if (IS_ERR(req)) | ||
1568 | return req; | ||
1569 | 1564 | ||
1570 | blk_rq_set_block_pc(req); | 1565 | req = blk_get_request(q, has_write ? WRITE : READ, flags); |
1566 | if (IS_ERR(req)) | ||
1571 | return req; | 1567 | return req; |
1568 | blk_rq_set_block_pc(req); | ||
1569 | |||
1570 | for_each_bio(bio) { | ||
1571 | struct bio *bounce_bio = bio; | ||
1572 | |||
1573 | blk_queue_bounce(req->q, &bounce_bio); | ||
1574 | ret = blk_rq_append_bio(req, bounce_bio); | ||
1575 | if (ret) | ||
1576 | return ERR_PTR(ret); | ||
1572 | } | 1577 | } |
1578 | |||
1579 | return req; | ||
1573 | } | 1580 | } |
1574 | 1581 | ||
1575 | static int _init_blk_request(struct osd_request *or, | 1582 | static int _init_blk_request(struct osd_request *or, |