aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/ll_rw_blk.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index f5e091bc027d..4bf95b602f36 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -3638,6 +3638,12 @@ static void end_that_request_last(struct request *req, int error)
3638{ 3638{
3639 struct gendisk *disk = req->rq_disk; 3639 struct gendisk *disk = req->rq_disk;
3640 3640
3641 if (blk_rq_tagged(req))
3642 blk_queue_end_tag(req->q, req);
3643
3644 if (blk_queued_rq(req))
3645 blkdev_dequeue_request(req);
3646
3641 if (unlikely(laptop_mode) && blk_fs_request(req)) 3647 if (unlikely(laptop_mode) && blk_fs_request(req))
3642 laptop_io_completion(); 3648 laptop_io_completion();
3643 3649
@@ -3655,10 +3661,15 @@ static void end_that_request_last(struct request *req, int error)
3655 disk_round_stats(disk); 3661 disk_round_stats(disk);
3656 disk->in_flight--; 3662 disk->in_flight--;
3657 } 3663 }
3664
3658 if (req->end_io) 3665 if (req->end_io)
3659 req->end_io(req, error); 3666 req->end_io(req, error);
3660 else 3667 else {
3668 if (blk_bidi_rq(req))
3669 __blk_put_request(req->next_rq->q, req->next_rq);
3670
3661 __blk_put_request(req->q, req); 3671 __blk_put_request(req->q, req);
3672 }
3662} 3673}
3663 3674
3664static inline void __end_request(struct request *rq, int uptodate, 3675static inline void __end_request(struct request *rq, int uptodate,
@@ -3759,20 +3770,6 @@ void end_request(struct request *req, int uptodate)
3759} 3770}
3760EXPORT_SYMBOL(end_request); 3771EXPORT_SYMBOL(end_request);
3761 3772
3762static void complete_request(struct request *rq, int error)
3763{
3764 if (blk_rq_tagged(rq))
3765 blk_queue_end_tag(rq->q, rq);
3766
3767 if (blk_queued_rq(rq))
3768 blkdev_dequeue_request(rq);
3769
3770 if (blk_bidi_rq(rq) && !rq->end_io)
3771 __blk_put_request(rq->next_rq->q, rq->next_rq);
3772
3773 end_that_request_last(rq, error);
3774}
3775
3776/** 3773/**
3777 * blk_end_io - Generic end_io function to complete a request. 3774 * blk_end_io - Generic end_io function to complete a request.
3778 * @rq: the request being processed 3775 * @rq: the request being processed
@@ -3815,7 +3812,7 @@ static int blk_end_io(struct request *rq, int error, int nr_bytes,
3815 add_disk_randomness(rq->rq_disk); 3812 add_disk_randomness(rq->rq_disk);
3816 3813
3817 spin_lock_irqsave(q->queue_lock, flags); 3814 spin_lock_irqsave(q->queue_lock, flags);
3818 complete_request(rq, error); 3815 end_that_request_last(rq, error);
3819 spin_unlock_irqrestore(q->queue_lock, flags); 3816 spin_unlock_irqrestore(q->queue_lock, flags);
3820 3817
3821 return 0; 3818 return 0;
@@ -3863,7 +3860,7 @@ int __blk_end_request(struct request *rq, int error, int nr_bytes)
3863 3860
3864 add_disk_randomness(rq->rq_disk); 3861 add_disk_randomness(rq->rq_disk);
3865 3862
3866 complete_request(rq, error); 3863 end_that_request_last(rq, error);
3867 3864
3868 return 0; 3865 return 0;
3869} 3866}