diff options
author | Tejun Heo <tj@kernel.org> | 2009-04-22 22:05:19 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-04-28 01:37:35 -0400 |
commit | 40cbbb781d3eba5d6ac0860db078af490e5c7c6b (patch) | |
tree | dec374543cf045fc630bccddbb7646c695094b0d /drivers/s390/char/tape_block.c | |
parent | b243ddcbe9be146172baa544dadecebf156eda0e (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 'drivers/s390/char/tape_block.c')
-rw-r--r-- | drivers/s390/char/tape_block.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index f32e89e7c4f2..86596d3813b5 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c | |||
@@ -74,13 +74,6 @@ tapeblock_trigger_requeue(struct tape_device *device) | |||
74 | * Post finished request. | 74 | * Post finished request. |
75 | */ | 75 | */ |
76 | static void | 76 | static void |
77 | tapeblock_end_request(struct request *req, int error) | ||
78 | { | ||
79 | if (blk_end_request(req, error, blk_rq_bytes(req))) | ||
80 | BUG(); | ||
81 | } | ||
82 | |||
83 | static void | ||
84 | __tapeblock_end_request(struct tape_request *ccw_req, void *data) | 77 | __tapeblock_end_request(struct tape_request *ccw_req, void *data) |
85 | { | 78 | { |
86 | struct tape_device *device; | 79 | struct tape_device *device; |
@@ -90,7 +83,7 @@ __tapeblock_end_request(struct tape_request *ccw_req, void *data) | |||
90 | 83 | ||
91 | device = ccw_req->device; | 84 | device = ccw_req->device; |
92 | req = (struct request *) data; | 85 | req = (struct request *) data; |
93 | tapeblock_end_request(req, (ccw_req->rc == 0) ? 0 : -EIO); | 86 | blk_end_request_all(req, (ccw_req->rc == 0) ? 0 : -EIO); |
94 | if (ccw_req->rc == 0) | 87 | if (ccw_req->rc == 0) |
95 | /* Update position. */ | 88 | /* Update position. */ |
96 | device->blk_data.block_position = | 89 | device->blk_data.block_position = |
@@ -118,7 +111,7 @@ tapeblock_start_request(struct tape_device *device, struct request *req) | |||
118 | ccw_req = device->discipline->bread(device, req); | 111 | ccw_req = device->discipline->bread(device, req); |
119 | if (IS_ERR(ccw_req)) { | 112 | if (IS_ERR(ccw_req)) { |
120 | DBF_EVENT(1, "TBLOCK: bread failed\n"); | 113 | DBF_EVENT(1, "TBLOCK: bread failed\n"); |
121 | tapeblock_end_request(req, -EIO); | 114 | blk_end_request_all(req, -EIO); |
122 | return PTR_ERR(ccw_req); | 115 | return PTR_ERR(ccw_req); |
123 | } | 116 | } |
124 | ccw_req->callback = __tapeblock_end_request; | 117 | ccw_req->callback = __tapeblock_end_request; |
@@ -131,7 +124,7 @@ tapeblock_start_request(struct tape_device *device, struct request *req) | |||
131 | * Start/enqueueing failed. No retries in | 124 | * Start/enqueueing failed. No retries in |
132 | * this case. | 125 | * this case. |
133 | */ | 126 | */ |
134 | tapeblock_end_request(req, -EIO); | 127 | blk_end_request_all(req, -EIO); |
135 | device->discipline->free_bread(ccw_req); | 128 | device->discipline->free_bread(ccw_req); |
136 | } | 129 | } |
137 | 130 | ||
@@ -177,7 +170,7 @@ tapeblock_requeue(struct work_struct *work) { | |||
177 | DBF_EVENT(1, "TBLOCK: Rejecting write request\n"); | 170 | DBF_EVENT(1, "TBLOCK: Rejecting write request\n"); |
178 | blkdev_dequeue_request(req); | 171 | blkdev_dequeue_request(req); |
179 | spin_unlock_irq(&device->blk_data.request_queue_lock); | 172 | spin_unlock_irq(&device->blk_data.request_queue_lock); |
180 | tapeblock_end_request(req, -EIO); | 173 | blk_end_request_all(req, -EIO); |
181 | spin_lock_irq(&device->blk_data.request_queue_lock); | 174 | spin_lock_irq(&device->blk_data.request_queue_lock); |
182 | continue; | 175 | continue; |
183 | } | 176 | } |