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/cdrom | |
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/cdrom')
-rw-r--r-- | drivers/cdrom/gdrom.c | 2 | ||||
-rw-r--r-- | drivers/cdrom/viocd.c | 25 |
2 files changed, 5 insertions, 22 deletions
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index 2eecb779437b..fee9a9e83fc9 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c | |||
@@ -632,7 +632,7 @@ static void gdrom_readdisk_dma(struct work_struct *work) | |||
632 | * before handling ending the request */ | 632 | * before handling ending the request */ |
633 | spin_lock(&gdrom_lock); | 633 | spin_lock(&gdrom_lock); |
634 | list_del_init(&req->queuelist); | 634 | list_del_init(&req->queuelist); |
635 | __blk_end_request(req, err, blk_rq_bytes(req)); | 635 | __blk_end_request_all(req, err); |
636 | } | 636 | } |
637 | spin_unlock(&gdrom_lock); | 637 | spin_unlock(&gdrom_lock); |
638 | kfree(read_command); | 638 | kfree(read_command); |
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index 13929356135c..cc3efa096e1a 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c | |||
@@ -291,23 +291,6 @@ static int send_request(struct request *req) | |||
291 | return 0; | 291 | return 0; |
292 | } | 292 | } |
293 | 293 | ||
294 | static void viocd_end_request(struct request *req, int error) | ||
295 | { | ||
296 | int nsectors = req->hard_nr_sectors; | ||
297 | |||
298 | /* | ||
299 | * Make sure it's fully ended, and ensure that we process | ||
300 | * at least one sector. | ||
301 | */ | ||
302 | if (blk_pc_request(req)) | ||
303 | nsectors = (req->data_len + 511) >> 9; | ||
304 | if (!nsectors) | ||
305 | nsectors = 1; | ||
306 | |||
307 | if (__blk_end_request(req, error, nsectors << 9)) | ||
308 | BUG(); | ||
309 | } | ||
310 | |||
311 | static int rwreq; | 294 | static int rwreq; |
312 | 295 | ||
313 | static void do_viocd_request(struct request_queue *q) | 296 | static void do_viocd_request(struct request_queue *q) |
@@ -316,11 +299,11 @@ static void do_viocd_request(struct request_queue *q) | |||
316 | 299 | ||
317 | while ((rwreq == 0) && ((req = elv_next_request(q)) != NULL)) { | 300 | while ((rwreq == 0) && ((req = elv_next_request(q)) != NULL)) { |
318 | if (!blk_fs_request(req)) | 301 | if (!blk_fs_request(req)) |
319 | viocd_end_request(req, -EIO); | 302 | __blk_end_request_all(req, -EIO); |
320 | else if (send_request(req) < 0) { | 303 | else if (send_request(req) < 0) { |
321 | printk(VIOCD_KERN_WARNING | 304 | printk(VIOCD_KERN_WARNING |
322 | "unable to send message to OS/400!"); | 305 | "unable to send message to OS/400!"); |
323 | viocd_end_request(req, -EIO); | 306 | __blk_end_request_all(req, -EIO); |
324 | } else | 307 | } else |
325 | rwreq++; | 308 | rwreq++; |
326 | } | 309 | } |
@@ -531,9 +514,9 @@ return_complete: | |||
531 | "with rc %d:0x%04X: %s\n", | 514 | "with rc %d:0x%04X: %s\n", |
532 | req, event->xRc, | 515 | req, event->xRc, |
533 | bevent->sub_result, err->msg); | 516 | bevent->sub_result, err->msg); |
534 | viocd_end_request(req, -EIO); | 517 | __blk_end_request_all(req, -EIO); |
535 | } else | 518 | } else |
536 | viocd_end_request(req, 0); | 519 | __blk_end_request_all(req, 0); |
537 | 520 | ||
538 | /* restart handling of incoming requests */ | 521 | /* restart handling of incoming requests */ |
539 | spin_unlock_irqrestore(&viocd_reqlock, flags); | 522 | spin_unlock_irqrestore(&viocd_reqlock, flags); |