aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index a417a6ff9f97..604f4d717933 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -263,25 +263,12 @@ static int scsi_merge_bio(struct request *rq, struct bio *bio)
263 bio->bi_rw |= (1 << BIO_RW); 263 bio->bi_rw |= (1 << BIO_RW);
264 blk_queue_bounce(q, &bio); 264 blk_queue_bounce(q, &bio);
265 265
266 if (!rq->bio) 266 return blk_rq_append_bio(q, rq, bio);
267 blk_rq_bio_prep(q, rq, bio);
268 else if (!ll_back_merge_fn(q, rq, bio))
269 return -EINVAL;
270 else {
271 rq->biotail->bi_next = bio;
272 rq->biotail = bio;
273 }
274
275 return 0;
276} 267}
277 268
278static int scsi_bi_endio(struct bio *bio, unsigned int bytes_done, int error) 269static void scsi_bi_endio(struct bio *bio, int error)
279{ 270{
280 if (bio->bi_size)
281 return 1;
282
283 bio_put(bio); 271 bio_put(bio);
284 return 0;
285} 272}
286 273
287/** 274/**
@@ -337,7 +324,7 @@ static int scsi_req_map_sg(struct request *rq, struct scatterlist *sgl,
337 if (bio->bi_vcnt >= nr_vecs) { 324 if (bio->bi_vcnt >= nr_vecs) {
338 err = scsi_merge_bio(rq, bio); 325 err = scsi_merge_bio(rq, bio);
339 if (err) { 326 if (err) {
340 bio_endio(bio, bio->bi_size, 0); 327 bio_endio(bio, 0);
341 goto free_bios; 328 goto free_bios;
342 } 329 }
343 bio = NULL; 330 bio = NULL;
@@ -359,7 +346,7 @@ free_bios:
359 /* 346 /*
360 * call endio instead of bio_put incase it was bounced 347 * call endio instead of bio_put incase it was bounced
361 */ 348 */
362 bio_endio(bio, bio->bi_size, 0); 349 bio_endio(bio, 0);
363 } 350 }
364 351
365 return err; 352 return err;