aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/blkdev.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r--include/linux/blkdev.h128
1 files changed, 8 insertions, 120 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 1069f4483c6e..f9d60a78c08a 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -872,126 +872,14 @@ extern struct request *blk_fetch_request(struct request_queue *q);
872 */ 872 */
873extern bool blk_update_request(struct request *rq, int error, 873extern bool blk_update_request(struct request *rq, int error,
874 unsigned int nr_bytes); 874 unsigned int nr_bytes);
875extern bool blk_end_bidi_request(struct request *rq, int error, 875extern bool blk_end_request(struct request *rq, int error,
876 unsigned int nr_bytes, 876 unsigned int nr_bytes);
877 unsigned int bidi_bytes); 877extern void blk_end_request_all(struct request *rq, int error);
878extern bool __blk_end_bidi_request(struct request *rq, int error, 878extern bool blk_end_request_cur(struct request *rq, int error);
879 unsigned int nr_bytes, 879extern bool __blk_end_request(struct request *rq, int error,
880 unsigned int bidi_bytes); 880 unsigned int nr_bytes);
881 881extern void __blk_end_request_all(struct request *rq, int error);
882/** 882extern bool __blk_end_request_cur(struct request *rq, int error);
883 * blk_end_request - Helper function for drivers to complete the request.
884 * @rq: the request being processed
885 * @error: %0 for success, < %0 for error
886 * @nr_bytes: number of bytes to complete
887 *
888 * Description:
889 * Ends I/O on a number of bytes attached to @rq.
890 * If @rq has leftover, sets it up for the next range of segments.
891 *
892 * Return:
893 * %false - we are done with this request
894 * %true - still buffers pending for this request
895 **/
896static inline bool blk_end_request(struct request *rq, int error,
897 unsigned int nr_bytes)
898{
899 return blk_end_bidi_request(rq, error, nr_bytes, 0);
900}
901
902/**
903 * blk_end_request_all - Helper function for drives to finish the request.
904 * @rq: the request to finish
905 * @err: %0 for success, < %0 for error
906 *
907 * Description:
908 * Completely finish @rq.
909 */
910static inline void blk_end_request_all(struct request *rq, int error)
911{
912 bool pending;
913 unsigned int bidi_bytes = 0;
914
915 if (unlikely(blk_bidi_rq(rq)))
916 bidi_bytes = blk_rq_bytes(rq->next_rq);
917
918 pending = blk_end_bidi_request(rq, error, blk_rq_bytes(rq), bidi_bytes);
919 BUG_ON(pending);
920}
921
922/**
923 * blk_end_request_cur - Helper function to finish the current request chunk.
924 * @rq: the request to finish the current chunk for
925 * @err: %0 for success, < %0 for error
926 *
927 * Description:
928 * Complete the current consecutively mapped chunk from @rq.
929 *
930 * Return:
931 * %false - we are done with this request
932 * %true - still buffers pending for this request
933 */
934static inline bool blk_end_request_cur(struct request *rq, int error)
935{
936 return blk_end_request(rq, error, blk_rq_cur_bytes(rq));
937}
938
939/**
940 * __blk_end_request - Helper function for drivers to complete the request.
941 * @rq: the request being processed
942 * @error: %0 for success, < %0 for error
943 * @nr_bytes: number of bytes to complete
944 *
945 * Description:
946 * Must be called with queue lock held unlike blk_end_request().
947 *
948 * Return:
949 * %false - we are done with this request
950 * %true - still buffers pending for this request
951 **/
952static inline bool __blk_end_request(struct request *rq, int error,
953 unsigned int nr_bytes)
954{
955 return __blk_end_bidi_request(rq, error, nr_bytes, 0);
956}
957
958/**
959 * __blk_end_request_all - Helper function for drives to finish the request.
960 * @rq: the request to finish
961 * @err: %0 for success, < %0 for error
962 *
963 * Description:
964 * Completely finish @rq. Must be called with queue lock held.
965 */
966static inline void __blk_end_request_all(struct request *rq, int error)
967{
968 bool pending;
969 unsigned int bidi_bytes = 0;
970
971 if (unlikely(blk_bidi_rq(rq)))
972 bidi_bytes = blk_rq_bytes(rq->next_rq);
973
974 pending = __blk_end_bidi_request(rq, error, blk_rq_bytes(rq), bidi_bytes);
975 BUG_ON(pending);
976}
977
978/**
979 * __blk_end_request_cur - Helper function to finish the current request chunk.
980 * @rq: the request to finish the current chunk for
981 * @err: %0 for success, < %0 for error
982 *
983 * Description:
984 * Complete the current consecutively mapped chunk from @rq. Must
985 * be called with queue lock held.
986 *
987 * Return:
988 * %false - we are done with this request
989 * %true - still buffers pending for this request
990 */
991static inline bool __blk_end_request_cur(struct request *rq, int error)
992{
993 return __blk_end_request(rq, error, blk_rq_cur_bytes(rq));
994}
995 883
996extern void blk_complete_request(struct request *); 884extern void blk_complete_request(struct request *);
997extern void __blk_complete_request(struct request *); 885extern void __blk_complete_request(struct request *);