diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/ll_rw_blk.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c index 5c01911af47c..8b2b2509f60e 100644 --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c | |||
@@ -3723,13 +3723,32 @@ static inline void __end_request(struct request *rq, int uptodate, | |||
3723 | } | 3723 | } |
3724 | } | 3724 | } |
3725 | 3725 | ||
3726 | static unsigned int rq_byte_size(struct request *rq) | 3726 | /** |
3727 | * blk_rq_bytes - Returns bytes left to complete in the entire request | ||
3728 | **/ | ||
3729 | unsigned int blk_rq_bytes(struct request *rq) | ||
3727 | { | 3730 | { |
3728 | if (blk_fs_request(rq)) | 3731 | if (blk_fs_request(rq)) |
3729 | return rq->hard_nr_sectors << 9; | 3732 | return rq->hard_nr_sectors << 9; |
3730 | 3733 | ||
3731 | return rq->data_len; | 3734 | return rq->data_len; |
3732 | } | 3735 | } |
3736 | EXPORT_SYMBOL_GPL(blk_rq_bytes); | ||
3737 | |||
3738 | /** | ||
3739 | * blk_rq_cur_bytes - Returns bytes left to complete in the current segment | ||
3740 | **/ | ||
3741 | unsigned int blk_rq_cur_bytes(struct request *rq) | ||
3742 | { | ||
3743 | if (blk_fs_request(rq)) | ||
3744 | return rq->current_nr_sectors << 9; | ||
3745 | |||
3746 | if (rq->bio) | ||
3747 | return rq->bio->bi_size; | ||
3748 | |||
3749 | return rq->data_len; | ||
3750 | } | ||
3751 | EXPORT_SYMBOL_GPL(blk_rq_cur_bytes); | ||
3733 | 3752 | ||
3734 | /** | 3753 | /** |
3735 | * end_queued_request - end all I/O on a queued request | 3754 | * end_queued_request - end all I/O on a queued request |
@@ -3744,7 +3763,7 @@ static unsigned int rq_byte_size(struct request *rq) | |||
3744 | **/ | 3763 | **/ |
3745 | void end_queued_request(struct request *rq, int uptodate) | 3764 | void end_queued_request(struct request *rq, int uptodate) |
3746 | { | 3765 | { |
3747 | __end_request(rq, uptodate, rq_byte_size(rq), 1); | 3766 | __end_request(rq, uptodate, blk_rq_bytes(rq), 1); |
3748 | } | 3767 | } |
3749 | EXPORT_SYMBOL(end_queued_request); | 3768 | EXPORT_SYMBOL(end_queued_request); |
3750 | 3769 | ||
@@ -3761,7 +3780,7 @@ EXPORT_SYMBOL(end_queued_request); | |||
3761 | **/ | 3780 | **/ |
3762 | void end_dequeued_request(struct request *rq, int uptodate) | 3781 | void end_dequeued_request(struct request *rq, int uptodate) |
3763 | { | 3782 | { |
3764 | __end_request(rq, uptodate, rq_byte_size(rq), 0); | 3783 | __end_request(rq, uptodate, blk_rq_bytes(rq), 0); |
3765 | } | 3784 | } |
3766 | EXPORT_SYMBOL(end_dequeued_request); | 3785 | EXPORT_SYMBOL(end_dequeued_request); |
3767 | 3786 | ||