aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-04-22 22:05:19 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-04-28 01:37:35 -0400
commit40cbbb781d3eba5d6ac0860db078af490e5c7c6b (patch)
treedec374543cf045fc630bccddbb7646c695094b0d /include
parentb243ddcbe9be146172baa544dadecebf156eda0e (diff)
block: implement and use [__]blk_end_request_all()
There are many [__]blk_end_request() call sites which call it with full request length and expect full completion. Many of them ensure that the request actually completes by doing BUG_ON() the return value, which is awkward and error-prone. This patch adds [__]blk_end_request_all() which takes @rq and @error and fully completes the request. BUG_ON() is added to to ensure that this actually happens. Most conversions are simple but there are a few noteworthy ones. * cdrom/viocd: viocd_end_request() replaced with direct calls to __blk_end_request_all(). * s390/block/dasd: dasd_end_request() replaced with direct calls to __blk_end_request_all(). * s390/char/tape_block: tapeblock_end_request() replaced with direct calls to blk_end_request_all(). [ Impact: cleanup ] Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Mike Miller <mike.miller@hp.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Jeff Garzik <jgarzik@pobox.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Jeremy Fitzhardinge <jeremy@xensource.com> Cc: Alex Dubov <oakad@yahoo.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/blkdev.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 501f6845cc73..e33c8356b3da 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -883,6 +883,22 @@ static inline bool blk_end_request(struct request *rq, int error,
883} 883}
884 884
885/** 885/**
886 * blk_end_request_all - Helper function for drives to finish the request.
887 * @rq: the request to finish
888 * @err: %0 for success, < %0 for error
889 *
890 * Description:
891 * Completely finish @rq.
892 */
893static inline void blk_end_request_all(struct request *rq, int error)
894{
895 bool pending;
896
897 pending = blk_end_request(rq, error, blk_rq_bytes(rq));
898 BUG_ON(pending);
899}
900
901/**
886 * __blk_end_request - Helper function for drivers to complete the request. 902 * __blk_end_request - Helper function for drivers to complete the request.
887 * @rq: the request being processed 903 * @rq: the request being processed
888 * @error: %0 for success, < %0 for error 904 * @error: %0 for success, < %0 for error
@@ -902,6 +918,22 @@ static inline bool __blk_end_request(struct request *rq, int error,
902} 918}
903 919
904/** 920/**
921 * __blk_end_request_all - Helper function for drives to finish the request.
922 * @rq: the request to finish
923 * @err: %0 for success, < %0 for error
924 *
925 * Description:
926 * Completely finish @rq. Must be called with queue lock held.
927 */
928static inline void __blk_end_request_all(struct request *rq, int error)
929{
930 bool pending;
931
932 pending = __blk_end_request(rq, error, blk_rq_bytes(rq));
933 BUG_ON(pending);
934}
935
936/**
905 * end_request - end I/O on the current segment of the request 937 * end_request - end I/O on the current segment of the request
906 * @rq: the request being processed 938 * @rq: the request being processed
907 * @uptodate: error value or %0/%1 uptodate flag 939 * @uptodate: error value or %0/%1 uptodate flag