aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 2120155929a6..167765c47747 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -484,23 +484,20 @@ static void dec_pending(struct dm_io *io, int error)
484 blk_add_trace_bio(io->md->queue, io->bio, 484 blk_add_trace_bio(io->md->queue, io->bio,
485 BLK_TA_COMPLETE); 485 BLK_TA_COMPLETE);
486 486
487 bio_endio(io->bio, io->bio->bi_size, io->error); 487 bio_endio(io->bio, io->error);
488 } 488 }
489 489
490 free_io(io->md, io); 490 free_io(io->md, io);
491 } 491 }
492} 492}
493 493
494static int clone_endio(struct bio *bio, unsigned int done, int error) 494static void clone_endio(struct bio *bio, int error)
495{ 495{
496 int r = 0; 496 int r = 0;
497 struct dm_target_io *tio = bio->bi_private; 497 struct dm_target_io *tio = bio->bi_private;
498 struct mapped_device *md = tio->io->md; 498 struct mapped_device *md = tio->io->md;
499 dm_endio_fn endio = tio->ti->type->end_io; 499 dm_endio_fn endio = tio->ti->type->end_io;
500 500
501 if (bio->bi_size)
502 return 1;
503
504 if (!bio_flagged(bio, BIO_UPTODATE) && !error) 501 if (!bio_flagged(bio, BIO_UPTODATE) && !error)
505 error = -EIO; 502 error = -EIO;
506 503
@@ -514,7 +511,7 @@ static int clone_endio(struct bio *bio, unsigned int done, int error)
514 error = r; 511 error = r;
515 else if (r == DM_ENDIO_INCOMPLETE) 512 else if (r == DM_ENDIO_INCOMPLETE)
516 /* The target will handle the io */ 513 /* The target will handle the io */
517 return 1; 514 return;
518 else if (r) { 515 else if (r) {
519 DMWARN("unimplemented target endio return value: %d", r); 516 DMWARN("unimplemented target endio return value: %d", r);
520 BUG(); 517 BUG();
@@ -530,7 +527,6 @@ static int clone_endio(struct bio *bio, unsigned int done, int error)
530 527
531 bio_put(bio); 528 bio_put(bio);
532 free_tio(md, tio); 529 free_tio(md, tio);
533 return r;
534} 530}
535 531
536static sector_t max_io_len(struct mapped_device *md, 532static sector_t max_io_len(struct mapped_device *md,
@@ -761,7 +757,7 @@ static void __split_bio(struct mapped_device *md, struct bio *bio)
761 757
762 ci.map = dm_get_table(md); 758 ci.map = dm_get_table(md);
763 if (!ci.map) { 759 if (!ci.map) {
764 bio_io_error(bio, bio->bi_size); 760 bio_io_error(bio);
765 return; 761 return;
766 } 762 }
767 763
@@ -803,7 +799,7 @@ static int dm_request(struct request_queue *q, struct bio *bio)
803 * guarantee it is (or can be) handled by the targets correctly. 799 * guarantee it is (or can be) handled by the targets correctly.
804 */ 800 */
805 if (unlikely(bio_barrier(bio))) { 801 if (unlikely(bio_barrier(bio))) {
806 bio_endio(bio, bio->bi_size, -EOPNOTSUPP); 802 bio_endio(bio, -EOPNOTSUPP);
807 return 0; 803 return 0;
808 } 804 }
809 805
@@ -820,13 +816,13 @@ static int dm_request(struct request_queue *q, struct bio *bio)
820 up_read(&md->io_lock); 816 up_read(&md->io_lock);
821 817
822 if (bio_rw(bio) == READA) { 818 if (bio_rw(bio) == READA) {
823 bio_io_error(bio, bio->bi_size); 819 bio_io_error(bio);
824 return 0; 820 return 0;
825 } 821 }
826 822
827 r = queue_io(md, bio); 823 r = queue_io(md, bio);
828 if (r < 0) { 824 if (r < 0) {
829 bio_io_error(bio, bio->bi_size); 825 bio_io_error(bio);
830 return 0; 826 return 0;
831 827
832 } else if (r == 0) 828 } else if (r == 0)