aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/ll_rw_blk.c61
-rw-r--r--include/linux/blkdev.h13
2 files changed, 20 insertions, 54 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 4889f7a8c2b7..4bd1803919ce 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -3432,6 +3432,20 @@ static void blk_recalc_rq_sectors(struct request *rq, int nsect)
3432 } 3432 }
3433} 3433}
3434 3434
3435/**
3436 * __end_that_request_first - end I/O on a request
3437 * @req: the request being processed
3438 * @uptodate: 1 for success, 0 for I/O error, < 0 for specific error
3439 * @nr_bytes: number of bytes to complete
3440 *
3441 * Description:
3442 * Ends I/O on a number of bytes attached to @req, and sets it up
3443 * for the next range of segments (if any) in the cluster.
3444 *
3445 * Return:
3446 * 0 - we are done with this request, call end_that_request_last()
3447 * 1 - still buffers pending for this request
3448 **/
3435static int __end_that_request_first(struct request *req, int uptodate, 3449static int __end_that_request_first(struct request *req, int uptodate,
3436 int nr_bytes) 3450 int nr_bytes)
3437{ 3451{
@@ -3548,49 +3562,6 @@ static int __end_that_request_first(struct request *req, int uptodate,
3548 return 1; 3562 return 1;
3549} 3563}
3550 3564
3551/**
3552 * end_that_request_first - end I/O on a request
3553 * @req: the request being processed
3554 * @uptodate: 1 for success, 0 for I/O error, < 0 for specific error
3555 * @nr_sectors: number of sectors to end I/O on
3556 *
3557 * Description:
3558 * Ends I/O on a number of sectors attached to @req, and sets it up
3559 * for the next range of segments (if any) in the cluster.
3560 *
3561 * Return:
3562 * 0 - we are done with this request, call end_that_request_last()
3563 * 1 - still buffers pending for this request
3564 **/
3565int end_that_request_first(struct request *req, int uptodate, int nr_sectors)
3566{
3567 return __end_that_request_first(req, uptodate, nr_sectors << 9);
3568}
3569
3570EXPORT_SYMBOL(end_that_request_first);
3571
3572/**
3573 * end_that_request_chunk - end I/O on a request
3574 * @req: the request being processed
3575 * @uptodate: 1 for success, 0 for I/O error, < 0 for specific error
3576 * @nr_bytes: number of bytes to complete
3577 *
3578 * Description:
3579 * Ends I/O on a number of bytes attached to @req, and sets it up
3580 * for the next range of segments (if any). Like end_that_request_first(),
3581 * but deals with bytes instead of sectors.
3582 *
3583 * Return:
3584 * 0 - we are done with this request, call end_that_request_last()
3585 * 1 - still buffers pending for this request
3586 **/
3587int end_that_request_chunk(struct request *req, int uptodate, int nr_bytes)
3588{
3589 return __end_that_request_first(req, uptodate, nr_bytes);
3590}
3591
3592EXPORT_SYMBOL(end_that_request_chunk);
3593
3594/* 3565/*
3595 * splice the completion data to a local structure and hand off to 3566 * splice the completion data to a local structure and hand off to
3596 * process_completion_queue() to complete the requests 3567 * process_completion_queue() to complete the requests
@@ -3670,7 +3641,7 @@ EXPORT_SYMBOL(blk_complete_request);
3670/* 3641/*
3671 * queue lock must be held 3642 * queue lock must be held
3672 */ 3643 */
3673void end_that_request_last(struct request *req, int uptodate) 3644static void end_that_request_last(struct request *req, int uptodate)
3674{ 3645{
3675 struct gendisk *disk = req->rq_disk; 3646 struct gendisk *disk = req->rq_disk;
3676 int error; 3647 int error;
@@ -3705,8 +3676,6 @@ void end_that_request_last(struct request *req, int uptodate)
3705 __blk_put_request(req->q, req); 3676 __blk_put_request(req->q, req);
3706} 3677}
3707 3678
3708EXPORT_SYMBOL(end_that_request_last);
3709
3710static inline void __end_request(struct request *rq, int uptodate, 3679static inline void __end_request(struct request *rq, int uptodate,
3711 unsigned int nr_bytes) 3680 unsigned int nr_bytes)
3712{ 3681{
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 029b7097f9e5..0c39ac75bed4 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -718,21 +718,18 @@ static inline void blk_run_address_space(struct address_space *mapping)
718} 718}
719 719
720/* 720/*
721 * end_request() and friends. Must be called with the request queue spinlock 721 * blk_end_request() and friends.
722 * acquired. All functions called within end_request() _must_be_ atomic. 722 * __blk_end_request() and end_request() must be called with
723 * the request queue spinlock acquired.
723 * 724 *
724 * Several drivers define their own end_request and call 725 * Several drivers define their own end_request and call
725 * end_that_request_first() and end_that_request_last() 726 * blk_end_request() for parts of the original function.
726 * for parts of the original function. This prevents 727 * This prevents code duplication in drivers.
727 * code duplication in drivers.
728 */ 728 */
729extern int blk_end_request(struct request *rq, int error, int nr_bytes); 729extern int blk_end_request(struct request *rq, int error, int nr_bytes);
730extern int __blk_end_request(struct request *rq, int error, int nr_bytes); 730extern int __blk_end_request(struct request *rq, int error, int nr_bytes);
731extern int blk_end_bidi_request(struct request *rq, int error, int nr_bytes, 731extern int blk_end_bidi_request(struct request *rq, int error, int nr_bytes,
732 int bidi_bytes); 732 int bidi_bytes);
733extern int end_that_request_first(struct request *, int, int);
734extern int end_that_request_chunk(struct request *, int, int);
735extern void end_that_request_last(struct request *, int);
736extern void end_request(struct request *, int); 733extern void end_request(struct request *, int);
737extern void end_queued_request(struct request *, int); 734extern void end_queued_request(struct request *, int);
738extern void end_dequeued_request(struct request *, int); 735extern void end_dequeued_request(struct request *, int);