summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2013-06-25 13:32:34 -0700
committerKent Overstreet <kmo@daterainc.com>2013-10-10 20:50:46 -0700
commit8613f0c75e242dd806ae7b84c67e1761a0ed6a9d (patch)
tree76ae425c3076f1aa78598341af8f39bb56d8c5ca
parentab0322b7e84ad524f549409080f1369b0b7c8e11 (diff)
block: blk_abort_request()
-rw-r--r--block/blk-core.c40
-rw-r--r--block/elevator.c7
-rw-r--r--drivers/block/aoe/aoeblk.c6
-rw-r--r--drivers/block/aoe/aoedev.c9
-rw-r--r--drivers/block/xsysace.c3
-rw-r--r--drivers/message/i2o/i2o_block.c3
-rw-r--r--drivers/s390/block/dasd.c6
-rw-r--r--include/linux/blkdev.h1
8 files changed, 36 insertions, 39 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 4d3a9e1461c1..cfbde698cc81 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2166,12 +2166,7 @@ struct request *blk_peek_request(struct request_queue *q)
break;
} else if (ret == BLKPREP_KILL) {
rq->cmd_flags |= REQ_QUIET;
- /*
- * Mark this request as started so we don't trigger
- * any debug logic in the end I/O path.
- */
- blk_start_request(rq);
- __blk_end_request_all(rq, -EIO);
+ blk_start_abort_request(rq, -EIO);
} else {
printk(KERN_ERR "%s: bad return=%d\n", __func__, ret);
break;
@@ -2202,6 +2197,19 @@ void blk_dequeue_request(struct request *rq)
}
}
+static void __blk_start_request(struct request *req)
+{
+ blk_dequeue_request(req);
+
+ /*
+ * We are now handing the request to the hardware, initialize
+ * resid_len to full count and add the timeout handler.
+ */
+ req->resid_len = blk_rq_bytes(req);
+ if (unlikely(blk_bidi_rq(req)))
+ req->next_rq->resid_len = blk_rq_bytes(req->next_rq);
+}
+
/**
* blk_start_request - start request processing on the driver
* @req: request to dequeue
@@ -2218,19 +2226,21 @@ void blk_dequeue_request(struct request *rq)
*/
void blk_start_request(struct request *req)
{
- blk_dequeue_request(req);
+ __blk_start_request(req);
+ blk_add_timer(req);
+}
+EXPORT_SYMBOL(blk_start_request);
+void blk_start_abort_request(struct request *req, int error)
+{
/*
- * We are now handing the request to the hardware, initialize
- * resid_len to full count and add the timeout handler.
+ * Mark this request as started so we don't trigger
+ * any debug logic in the end I/O path.
*/
- req->resid_len = blk_rq_bytes(req);
- if (unlikely(blk_bidi_rq(req)))
- req->next_rq->resid_len = blk_rq_bytes(req->next_rq);
-
- blk_add_timer(req);
+ __blk_start_request(req);
+ __blk_end_request_all(req, error);
}
-EXPORT_SYMBOL(blk_start_request);
+EXPORT_SYMBOL(blk_start_abort_request);
/**
* blk_fetch_request - fetch a request from a request queue
diff --git a/block/elevator.c b/block/elevator.c
index 2bcbd8cc14d4..9c97f719ec10 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -731,12 +731,7 @@ void elv_abort_queue(struct request_queue *q)
rq = list_entry_rq(q->queue_head.next);
rq->cmd_flags |= REQ_QUIET;
trace_block_rq_abort(q, rq);
- /*
- * Mark this request as started so we don't trigger
- * any debug logic in the end I/O path.
- */
- blk_start_request(rq);
- __blk_end_request_all(rq, -EIO);
+ blk_start_abort_request(rq, -EIO);
}
}
EXPORT_SYMBOL(elv_abort_queue);
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index dd73e1ff1759..0c356066b321 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -284,10 +284,8 @@ aoeblk_request(struct request_queue *q)
if ((d->flags & DEVFL_UP) == 0) {
pr_info_ratelimited("aoe: device %ld.%d is not up\n",
d->aoemajor, d->aoeminor);
- while ((rq = blk_peek_request(q))) {
- blk_start_request(rq);
- aoe_end_request(d, rq, 1);
- }
+ while ((rq = blk_peek_request(q)))
+ blk_start_abort_request(rq, -EIO);
return;
}
aoecmd_work(d);
diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c
index e774c50b6842..1db269199ff2 100644
--- a/drivers/block/aoe/aoedev.c
+++ b/drivers/block/aoe/aoedev.c
@@ -225,12 +225,9 @@ aoedev_downdev(struct aoedev *d)
aoe_failip(d);
/* fast fail all pending I/O */
- if (d->blkq) {
- while ((rq = blk_peek_request(d->blkq))) {
- blk_start_request(rq);
- aoe_end_request(d, rq, 1);
- }
- }
+ if (d->blkq)
+ while ((rq = blk_peek_request(d->blkq)))
+ blk_start_abort_request(rq, -EIO);
if (d->gd)
set_capacity(d->gd, 0);
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 1393b8871a28..edd25aecc41a 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -470,8 +470,7 @@ static struct request *ace_get_next_request(struct request_queue *q)
while ((req = blk_peek_request(q)) != NULL) {
if (req->cmd_type == REQ_TYPE_FS)
break;
- blk_start_request(req);
- __blk_end_request_all(req, -EIO);
+ blk_start_abort_request(req, -EIO);
}
return req;
}
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index 6fc3866965df..0b7ba5d34586 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -930,8 +930,7 @@ static void i2o_block_request_fn(struct request_queue *q)
break;
}
} else {
- blk_start_request(req);
- __blk_end_request_all(req, -EIO);
+ blk_start_abort_request(req, -EIO);
}
}
};
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 451bf99582ff..6cda7ede0d96 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -2534,8 +2534,7 @@ static void __dasd_process_request_queue(struct dasd_block *block)
DBF_DEV_EVENT(DBF_ERR, basedev,
"Rejecting write request %p",
req);
- blk_start_request(req);
- __blk_end_request_all(req, -EIO);
+ blk_start_abort_request(req, -EIO);
continue;
}
if (test_bit(DASD_FLAG_ABORTALL, &basedev->flags) &&
@@ -2576,8 +2575,7 @@ static void __dasd_process_request_queue(struct dasd_block *block)
"CCW creation failed (rc=%ld) "
"on request %p",
PTR_ERR(cqr), req);
- blk_start_request(req);
- __blk_end_request_all(req, -EIO);
+ blk_start_abort_request(req, -EIO);
continue;
}
/*
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index b540f35603ba..854bbcd5fb20 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -878,6 +878,7 @@ static inline unsigned int blk_rq_count_bios(struct request *rq)
*/
extern struct request *blk_peek_request(struct request_queue *q);
extern void blk_start_request(struct request *rq);
+extern void blk_start_abort_request(struct request *req, int error);
extern struct request *blk_fetch_request(struct request_queue *q);
/*