aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-core.c57
-rw-r--r--drivers/scsi/osd/osd_initiator.c25
-rw-r--r--include/linux/blkdev.h2
3 files changed, 16 insertions, 68 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index a2230186c36d..91b339f4d2ad 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1318,63 +1318,6 @@ struct request *blk_get_request(struct request_queue *q, int rw, gfp_t gfp_mask)
1318EXPORT_SYMBOL(blk_get_request); 1318EXPORT_SYMBOL(blk_get_request);
1319 1319
1320/** 1320/**
1321 * blk_make_request - given a bio, allocate a corresponding struct request.
1322 * @q: target request queue
1323 * @bio: The bio describing the memory mappings that will be submitted for IO.
1324 * It may be a chained-bio properly constructed by block/bio layer.
1325 * @gfp_mask: gfp flags to be used for memory allocation
1326 *
1327 * blk_make_request is the parallel of generic_make_request for BLOCK_PC
1328 * type commands. Where the struct request needs to be farther initialized by
1329 * the caller. It is passed a &struct bio, which describes the memory info of
1330 * the I/O transfer.
1331 *
1332 * The caller of blk_make_request must make sure that bi_io_vec
1333 * are set to describe the memory buffers. That bio_data_dir() will return
1334 * the needed direction of the request. (And all bio's in the passed bio-chain
1335 * are properly set accordingly)
1336 *
1337 * If called under none-sleepable conditions, mapped bio buffers must not
1338 * need bouncing, by calling the appropriate masked or flagged allocator,
1339 * suitable for the target device. Otherwise the call to blk_queue_bounce will
1340 * BUG.
1341 *
1342 * WARNING: When allocating/cloning a bio-chain, careful consideration should be
1343 * given to how you allocate bios. In particular, you cannot use
1344 * __GFP_DIRECT_RECLAIM for anything but the first bio in the chain. Otherwise
1345 * you risk waiting for IO completion of a bio that hasn't been submitted yet,
1346 * thus resulting in a deadlock. Alternatively bios should be allocated using
1347 * bio_kmalloc() instead of bio_alloc(), as that avoids the mempool deadlock.
1348 * If possible a big IO should be split into smaller parts when allocation
1349 * fails. Partial allocation should not be an error, or you risk a live-lock.
1350 */
1351struct request *blk_make_request(struct request_queue *q, struct bio *bio,
1352 gfp_t gfp_mask)
1353{
1354 struct request *rq = blk_get_request(q, bio_data_dir(bio), gfp_mask);
1355
1356 if (IS_ERR(rq))
1357 return rq;
1358
1359 blk_rq_set_block_pc(rq);
1360
1361 for_each_bio(bio) {
1362 struct bio *bounce_bio = bio;
1363 int ret;
1364
1365 blk_queue_bounce(q, &bounce_bio);
1366 ret = blk_rq_append_bio(rq, bounce_bio);
1367 if (unlikely(ret)) {
1368 blk_put_request(rq);
1369 return ERR_PTR(ret);
1370 }
1371 }
1372
1373 return rq;
1374}
1375EXPORT_SYMBOL(blk_make_request);
1376
1377/**
1378 * blk_rq_set_block_pc - initialize a request to type BLOCK_PC 1321 * blk_rq_set_block_pc - initialize a request to type BLOCK_PC
1379 * @rq: request to be initialized 1322 * @rq: request to be initialized
1380 * 1323 *
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,
1558static struct request *_make_request(struct request_queue *q, bool has_write, 1558static 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
1575static int _init_blk_request(struct osd_request *or, 1582static int _init_blk_request(struct osd_request *or,
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 706c8bf61c84..0cdea75a6614 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -788,8 +788,6 @@ extern void blk_rq_init(struct request_queue *q, struct request *rq);
788extern void blk_put_request(struct request *); 788extern void blk_put_request(struct request *);
789extern void __blk_put_request(struct request_queue *, struct request *); 789extern void __blk_put_request(struct request_queue *, struct request *);
790extern struct request *blk_get_request(struct request_queue *, int, gfp_t); 790extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
791extern struct request *blk_make_request(struct request_queue *, struct bio *,
792 gfp_t);
793extern void blk_rq_set_block_pc(struct request *); 791extern void blk_rq_set_block_pc(struct request *);
794extern void blk_requeue_request(struct request_queue *, struct request *); 792extern void blk_requeue_request(struct request_queue *, struct request *);
795extern void blk_add_request_payload(struct request *rq, struct page *page, 793extern void blk_add_request_payload(struct request *rq, struct page *page,