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>
This commit is contained in:
@@ -291,23 +291,6 @@ static int send_request(struct request *req)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void viocd_end_request(struct request *req, int error)
|
||||
{
|
||||
int nsectors = req->hard_nr_sectors;
|
||||
|
||||
/*
|
||||
* Make sure it's fully ended, and ensure that we process
|
||||
* at least one sector.
|
||||
*/
|
||||
if (blk_pc_request(req))
|
||||
nsectors = (req->data_len + 511) >> 9;
|
||||
if (!nsectors)
|
||||
nsectors = 1;
|
||||
|
||||
if (__blk_end_request(req, error, nsectors << 9))
|
||||
BUG();
|
||||
}
|
||||
|
||||
static int rwreq;
|
||||
|
||||
static void do_viocd_request(struct request_queue *q)
|
||||
@@ -316,11 +299,11 @@ static void do_viocd_request(struct request_queue *q)
|
||||
|
||||
while ((rwreq == 0) && ((req = elv_next_request(q)) != NULL)) {
|
||||
if (!blk_fs_request(req))
|
||||
viocd_end_request(req, -EIO);
|
||||
__blk_end_request_all(req, -EIO);
|
||||
else if (send_request(req) < 0) {
|
||||
printk(VIOCD_KERN_WARNING
|
||||
"unable to send message to OS/400!");
|
||||
viocd_end_request(req, -EIO);
|
||||
__blk_end_request_all(req, -EIO);
|
||||
} else
|
||||
rwreq++;
|
||||
}
|
||||
@@ -531,9 +514,9 @@ return_complete:
|
||||
"with rc %d:0x%04X: %s\n",
|
||||
req, event->xRc,
|
||||
bevent->sub_result, err->msg);
|
||||
viocd_end_request(req, -EIO);
|
||||
__blk_end_request_all(req, -EIO);
|
||||
} else
|
||||
viocd_end_request(req, 0);
|
||||
__blk_end_request_all(req, 0);
|
||||
|
||||
/* restart handling of incoming requests */
|
||||
spin_unlock_irqrestore(&viocd_reqlock, flags);
|
||||
|
Reference in New Issue
Block a user