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.h31
1 files changed, 18 insertions, 13 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2483a05231c7..b71c3900810d 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -464,6 +464,8 @@ enum {
464#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA) 464#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
465#define blk_bidi_rq(rq) ((rq)->next_rq != NULL) 465#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
466#define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors) 466#define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors)
467/* rq->queuelist of dequeued request must be list_empty() */
468#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist))
467 469
468#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) 470#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist)
469 471
@@ -643,29 +645,32 @@ static inline void blk_run_address_space(struct address_space *mapping)
643} 645}
644 646
645/* 647/*
646 * end_request() and friends. Must be called with the request queue spinlock 648 * blk_end_request() and friends.
647 * acquired. All functions called within end_request() _must_be_ atomic. 649 * __blk_end_request() and end_request() must be called with
650 * the request queue spinlock acquired.
648 * 651 *
649 * Several drivers define their own end_request and call 652 * Several drivers define their own end_request and call
650 * end_that_request_first() and end_that_request_last() 653 * blk_end_request() for parts of the original function.
651 * for parts of the original function. This prevents 654 * This prevents code duplication in drivers.
652 * code duplication in drivers.
653 */ 655 */
654extern int end_that_request_first(struct request *, int, int); 656extern int blk_end_request(struct request *rq, int error, int nr_bytes);
655extern int end_that_request_chunk(struct request *, int, int); 657extern int __blk_end_request(struct request *rq, int error, int nr_bytes);
656extern void end_that_request_last(struct request *, int); 658extern int blk_end_bidi_request(struct request *rq, int error, int nr_bytes,
659 int bidi_bytes);
657extern void end_request(struct request *, int); 660extern void end_request(struct request *, int);
658extern void end_queued_request(struct request *, int); 661extern void end_queued_request(struct request *, int);
659extern void end_dequeued_request(struct request *, int); 662extern void end_dequeued_request(struct request *, int);
663extern int blk_end_request_callback(struct request *rq, int error, int nr_bytes,
664 int (drv_callback)(struct request *));
660extern void blk_complete_request(struct request *); 665extern void blk_complete_request(struct request *);
661 666
662/* 667/*
663 * end_that_request_first/chunk() takes an uptodate argument. we account 668 * blk_end_request() takes bytes instead of sectors as a complete size.
664 * any value <= as an io error. 0 means -EIO for compatability reasons, 669 * blk_rq_bytes() returns bytes left to complete in the entire request.
665 * any other < 0 value is the direct error type. An uptodate value of 670 * blk_rq_cur_bytes() returns bytes left to complete in the current segment.
666 * 1 indicates successful io completion
667 */ 671 */
668#define end_io_error(uptodate) (unlikely((uptodate) <= 0)) 672extern unsigned int blk_rq_bytes(struct request *rq);
673extern unsigned int blk_rq_cur_bytes(struct request *rq);
669 674
670static inline void blkdev_dequeue_request(struct request *req) 675static inline void blkdev_dequeue_request(struct request *req)
671{ 676{