diff options
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r-- | include/linux/blkdev.h | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index e33c8356b3da..cfeb3c2feb27 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -845,9 +845,8 @@ extern unsigned int blk_rq_cur_bytes(struct request *rq); | |||
845 | * blk_update_request() completes given number of bytes and updates | 845 | * blk_update_request() completes given number of bytes and updates |
846 | * the request without completing it. | 846 | * the request without completing it. |
847 | * | 847 | * |
848 | * blk_end_request() and friends. __blk_end_request() and | 848 | * blk_end_request() and friends. __blk_end_request() must be called |
849 | * end_request() must be called with the request queue spinlock | 849 | * with the request queue spinlock acquired. |
850 | * acquired. | ||
851 | * | 850 | * |
852 | * Several drivers define their own end_request and call | 851 | * Several drivers define their own end_request and call |
853 | * blk_end_request() for parts of the original function. | 852 | * blk_end_request() for parts of the original function. |
@@ -899,6 +898,19 @@ static inline void blk_end_request_all(struct request *rq, int error) | |||
899 | } | 898 | } |
900 | 899 | ||
901 | /** | 900 | /** |
901 | * blk_end_request_cur - Helper function to finish the current request chunk. | ||
902 | * @rq: the request to finish the current chunk for | ||
903 | * @err: %0 for success, < %0 for error | ||
904 | * | ||
905 | * Description: | ||
906 | * Complete the current consecutively mapped chunk from @rq. | ||
907 | */ | ||
908 | static inline void blk_end_request_cur(struct request *rq, int error) | ||
909 | { | ||
910 | blk_end_request(rq, error, rq->hard_cur_sectors << 9); | ||
911 | } | ||
912 | |||
913 | /** | ||
902 | * __blk_end_request - Helper function for drivers to complete the request. | 914 | * __blk_end_request - Helper function for drivers to complete the request. |
903 | * @rq: the request being processed | 915 | * @rq: the request being processed |
904 | * @error: %0 for success, < %0 for error | 916 | * @error: %0 for success, < %0 for error |
@@ -934,29 +946,17 @@ static inline void __blk_end_request_all(struct request *rq, int error) | |||
934 | } | 946 | } |
935 | 947 | ||
936 | /** | 948 | /** |
937 | * end_request - end I/O on the current segment of the request | 949 | * __blk_end_request_cur - Helper function to finish the current request chunk. |
938 | * @rq: the request being processed | 950 | * @rq: the request to finish the current chunk for |
939 | * @uptodate: error value or %0/%1 uptodate flag | 951 | * @err: %0 for success, < %0 for error |
940 | * | 952 | * |
941 | * Description: | 953 | * Description: |
942 | * Ends I/O on the current segment of a request. If that is the only | 954 | * Complete the current consecutively mapped chunk from @rq. Must |
943 | * remaining segment, the request is also completed and freed. | 955 | * be called with queue lock held. |
944 | * | 956 | */ |
945 | * This is a remnant of how older block drivers handled I/O completions. | 957 | static inline void __blk_end_request_cur(struct request *rq, int error) |
946 | * Modern drivers typically end I/O on the full request in one go, unless | ||
947 | * they have a residual value to account for. For that case this function | ||
948 | * isn't really useful, unless the residual just happens to be the | ||
949 | * full current segment. In other words, don't use this function in new | ||
950 | * code. Use blk_end_request() or __blk_end_request() to end a request. | ||
951 | **/ | ||
952 | static inline void end_request(struct request *rq, int uptodate) | ||
953 | { | 958 | { |
954 | int error = 0; | 959 | __blk_end_request(rq, error, rq->hard_cur_sectors << 9); |
955 | |||
956 | if (uptodate <= 0) | ||
957 | error = uptodate ? uptodate : -EIO; | ||
958 | |||
959 | __blk_end_bidi_request(rq, error, rq->hard_cur_sectors << 9, 0); | ||
960 | } | 960 | } |
961 | 961 | ||
962 | extern void blk_complete_request(struct request *); | 962 | extern void blk_complete_request(struct request *); |