summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorMike Anderson <andmike@linux.vnet.ibm.com>2008-08-29 09:35:40 +0200
committerJens Axboe <jens.axboe@oracle.com>2008-08-29 12:33:03 +0200
commit4fab7055b5a39d9c8bdd952c962ffc8e80055a17 (patch)
tree4dd7b72251b6d6a80a90780b4addc5f196b105a1 /block
parent2f3b104a76db7089d071dec1011cae03be8f577a (diff)
block: Add interface to abort queued requests
Signed-off-by: Mike Anderson <andmike@linux.vnet.ibm.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-timeout.c23
-rw-r--r--block/elevator.c13
2 files changed, 36 insertions, 0 deletions
diff --git a/block/blk-timeout.c b/block/blk-timeout.c
index 6c70a06f51aa..9d2db7cfbc91 100644
--- a/block/blk-timeout.c
+++ b/block/blk-timeout.c
@@ -143,3 +143,26 @@ void blk_add_timer(struct request *req)
mod_timer(&q->timeout, expiry);
}
EXPORT_SYMBOL_GPL(blk_add_timer);
+
+ /**
+ * blk_abort_queue -- Abort all request on given queue
+ * @queue: pointer to queue
+ *
+ */
+void blk_abort_queue(struct request_queue *q)
+{
+ unsigned long flags;
+ struct request *rq, *tmp;
+
+ spin_lock_irqsave(q->queue_lock, flags);
+
+ elv_abort_queue(q);
+
+ list_for_each_entry_safe(rq, tmp, &q->timeout_list, timeout_list) {
+ blk_abort_request(rq);
+ }
+
+ spin_unlock_irqrestore(q->queue_lock, flags);
+
+}
+EXPORT_SYMBOL_GPL(blk_abort_queue);
diff --git a/block/elevator.c b/block/elevator.c
index 8e3fc3afc77b..6a8f8d99e244 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -906,6 +906,19 @@ int elv_may_queue(struct request_queue *q, int rw)
return ELV_MQUEUE_MAY;
}
+void elv_abort_queue(struct request_queue *q)
+{
+ struct request *rq;
+
+ while (!list_empty(&q->queue_head)) {
+ rq = list_entry_rq(q->queue_head.next);
+ rq->cmd_flags |= REQ_QUIET;
+ blk_add_trace_rq(q, rq, BLK_TA_ABORT);
+ end_queued_request(rq, 0);
+ }
+}
+EXPORT_SYMBOL(elv_abort_queue);
+
void elv_completed_request(struct request_queue *q, struct request *rq)
{
elevator_t *e = q->elevator;