diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/ll_rw_blk.c | 56 |
1 files changed, 9 insertions, 47 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c index 4bd1803919ce..f5e091bc027d 100644 --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c | |||
@@ -3435,7 +3435,7 @@ static void blk_recalc_rq_sectors(struct request *rq, int nsect) | |||
3435 | /** | 3435 | /** |
3436 | * __end_that_request_first - end I/O on a request | 3436 | * __end_that_request_first - end I/O on a request |
3437 | * @req: the request being processed | 3437 | * @req: the request being processed |
3438 | * @uptodate: 1 for success, 0 for I/O error, < 0 for specific error | 3438 | * @error: 0 for success, < 0 for error |
3439 | * @nr_bytes: number of bytes to complete | 3439 | * @nr_bytes: number of bytes to complete |
3440 | * | 3440 | * |
3441 | * Description: | 3441 | * Description: |
@@ -3446,29 +3446,22 @@ static void blk_recalc_rq_sectors(struct request *rq, int nsect) | |||
3446 | * 0 - we are done with this request, call end_that_request_last() | 3446 | * 0 - we are done with this request, call end_that_request_last() |
3447 | * 1 - still buffers pending for this request | 3447 | * 1 - still buffers pending for this request |
3448 | **/ | 3448 | **/ |
3449 | static int __end_that_request_first(struct request *req, int uptodate, | 3449 | static int __end_that_request_first(struct request *req, int error, |
3450 | int nr_bytes) | 3450 | int nr_bytes) |
3451 | { | 3451 | { |
3452 | int total_bytes, bio_nbytes, error, next_idx = 0; | 3452 | int total_bytes, bio_nbytes, next_idx = 0; |
3453 | struct bio *bio; | 3453 | struct bio *bio; |
3454 | 3454 | ||
3455 | blk_add_trace_rq(req->q, req, BLK_TA_COMPLETE); | 3455 | blk_add_trace_rq(req->q, req, BLK_TA_COMPLETE); |
3456 | 3456 | ||
3457 | /* | 3457 | /* |
3458 | * extend uptodate bool to allow < 0 value to be direct io error | ||
3459 | */ | ||
3460 | error = 0; | ||
3461 | if (end_io_error(uptodate)) | ||
3462 | error = !uptodate ? -EIO : uptodate; | ||
3463 | |||
3464 | /* | ||
3465 | * for a REQ_BLOCK_PC request, we want to carry any eventual | 3458 | * for a REQ_BLOCK_PC request, we want to carry any eventual |
3466 | * sense key with us all the way through | 3459 | * sense key with us all the way through |
3467 | */ | 3460 | */ |
3468 | if (!blk_pc_request(req)) | 3461 | if (!blk_pc_request(req)) |
3469 | req->errors = 0; | 3462 | req->errors = 0; |
3470 | 3463 | ||
3471 | if (!uptodate) { | 3464 | if (error) { |
3472 | if (blk_fs_request(req) && !(req->cmd_flags & REQ_QUIET)) | 3465 | if (blk_fs_request(req) && !(req->cmd_flags & REQ_QUIET)) |
3473 | printk("end_request: I/O error, dev %s, sector %llu\n", | 3466 | printk("end_request: I/O error, dev %s, sector %llu\n", |
3474 | req->rq_disk ? req->rq_disk->disk_name : "?", | 3467 | req->rq_disk ? req->rq_disk->disk_name : "?", |
@@ -3641,17 +3634,9 @@ EXPORT_SYMBOL(blk_complete_request); | |||
3641 | /* | 3634 | /* |
3642 | * queue lock must be held | 3635 | * queue lock must be held |
3643 | */ | 3636 | */ |
3644 | static void end_that_request_last(struct request *req, int uptodate) | 3637 | static void end_that_request_last(struct request *req, int error) |
3645 | { | 3638 | { |
3646 | struct gendisk *disk = req->rq_disk; | 3639 | struct gendisk *disk = req->rq_disk; |
3647 | int error; | ||
3648 | |||
3649 | /* | ||
3650 | * extend uptodate bool to allow < 0 value to be direct io error | ||
3651 | */ | ||
3652 | error = 0; | ||
3653 | if (end_io_error(uptodate)) | ||
3654 | error = !uptodate ? -EIO : uptodate; | ||
3655 | 3640 | ||
3656 | if (unlikely(laptop_mode) && blk_fs_request(req)) | 3641 | if (unlikely(laptop_mode) && blk_fs_request(req)) |
3657 | laptop_io_completion(); | 3642 | laptop_io_completion(); |
@@ -3776,14 +3761,6 @@ EXPORT_SYMBOL(end_request); | |||
3776 | 3761 | ||
3777 | static void complete_request(struct request *rq, int error) | 3762 | static void complete_request(struct request *rq, int error) |
3778 | { | 3763 | { |
3779 | /* | ||
3780 | * REMOVEME: This conversion is transitional and will be removed | ||
3781 | * when old end_that_request_* are unexported. | ||
3782 | */ | ||
3783 | int uptodate = 1; | ||
3784 | if (error) | ||
3785 | uptodate = (error == -EIO) ? 0 : error; | ||
3786 | |||
3787 | if (blk_rq_tagged(rq)) | 3764 | if (blk_rq_tagged(rq)) |
3788 | blk_queue_end_tag(rq->q, rq); | 3765 | blk_queue_end_tag(rq->q, rq); |
3789 | 3766 | ||
@@ -3793,7 +3770,7 @@ static void complete_request(struct request *rq, int error) | |||
3793 | if (blk_bidi_rq(rq) && !rq->end_io) | 3770 | if (blk_bidi_rq(rq) && !rq->end_io) |
3794 | __blk_put_request(rq->next_rq->q, rq->next_rq); | 3771 | __blk_put_request(rq->next_rq->q, rq->next_rq); |
3795 | 3772 | ||
3796 | end_that_request_last(rq, uptodate); | 3773 | end_that_request_last(rq, error); |
3797 | } | 3774 | } |
3798 | 3775 | ||
3799 | /** | 3776 | /** |
@@ -3820,21 +3797,14 @@ static int blk_end_io(struct request *rq, int error, int nr_bytes, | |||
3820 | { | 3797 | { |
3821 | struct request_queue *q = rq->q; | 3798 | struct request_queue *q = rq->q; |
3822 | unsigned long flags = 0UL; | 3799 | unsigned long flags = 0UL; |
3823 | /* | ||
3824 | * REMOVEME: This conversion is transitional and will be removed | ||
3825 | * when old end_that_request_* are unexported. | ||
3826 | */ | ||
3827 | int uptodate = 1; | ||
3828 | if (error) | ||
3829 | uptodate = (error == -EIO) ? 0 : error; | ||
3830 | 3800 | ||
3831 | if (blk_fs_request(rq) || blk_pc_request(rq)) { | 3801 | if (blk_fs_request(rq) || blk_pc_request(rq)) { |
3832 | if (__end_that_request_first(rq, uptodate, nr_bytes)) | 3802 | if (__end_that_request_first(rq, error, nr_bytes)) |
3833 | return 1; | 3803 | return 1; |
3834 | 3804 | ||
3835 | /* Bidi request must be completed as a whole */ | 3805 | /* Bidi request must be completed as a whole */ |
3836 | if (blk_bidi_rq(rq) && | 3806 | if (blk_bidi_rq(rq) && |
3837 | __end_that_request_first(rq->next_rq, uptodate, bidi_bytes)) | 3807 | __end_that_request_first(rq->next_rq, error, bidi_bytes)) |
3838 | return 1; | 3808 | return 1; |
3839 | } | 3809 | } |
3840 | 3810 | ||
@@ -3886,16 +3856,8 @@ EXPORT_SYMBOL_GPL(blk_end_request); | |||
3886 | **/ | 3856 | **/ |
3887 | int __blk_end_request(struct request *rq, int error, int nr_bytes) | 3857 | int __blk_end_request(struct request *rq, int error, int nr_bytes) |
3888 | { | 3858 | { |
3889 | /* | ||
3890 | * REMOVEME: This conversion is transitional and will be removed | ||
3891 | * when old end_that_request_* are unexported. | ||
3892 | */ | ||
3893 | int uptodate = 1; | ||
3894 | if (error) | ||
3895 | uptodate = (error == -EIO) ? 0 : error; | ||
3896 | |||
3897 | if (blk_fs_request(rq) || blk_pc_request(rq)) { | 3859 | if (blk_fs_request(rq) || blk_pc_request(rq)) { |
3898 | if (__end_that_request_first(rq, uptodate, nr_bytes)) | 3860 | if (__end_that_request_first(rq, error, nr_bytes)) |
3899 | return 1; | 3861 | return 1; |
3900 | } | 3862 | } |
3901 | 3863 | ||