aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorMike Anderson <andmike@linux.vnet.ibm.com>2008-09-13 14:31:27 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 02:56:13 -0400
commit11914a53d2ec2974a565311af327b8983d8c820d (patch)
tree72713d2661ed56fa5d9e29203541bad32c88a3ba /block
parent242f9dcb8ba6f68fcd217a119a7648a4f69290e9 (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.c22
-rw-r--r--block/elevator.c13
2 files changed, 35 insertions, 0 deletions
diff --git a/block/blk-timeout.c b/block/blk-timeout.c
index b36d07bf0afb..6e5c781c5af1 100644
--- a/block/blk-timeout.c
+++ b/block/blk-timeout.c
@@ -153,3 +153,25 @@ void blk_add_timer(struct request *req)
153 time_before(expiry, q->timeout.expires)) 153 time_before(expiry, q->timeout.expires))
154 mod_timer(&q->timeout, expiry); 154 mod_timer(&q->timeout, expiry);
155} 155}
156
157/**
158 * blk_abort_queue -- Abort all request on given queue
159 * @queue: pointer to queue
160 *
161 */
162void blk_abort_queue(struct request_queue *q)
163{
164 unsigned long flags;
165 struct request *rq, *tmp;
166
167 spin_lock_irqsave(q->queue_lock, flags);
168
169 elv_abort_queue(q);
170
171 list_for_each_entry_safe(rq, tmp, &q->timeout_list, timeout_list)
172 blk_abort_request(rq);
173
174 spin_unlock_irqrestore(q->queue_lock, flags);
175
176}
177EXPORT_SYMBOL_GPL(blk_abort_queue);
diff --git a/block/elevator.c b/block/elevator.c
index a91fc59edd01..8a74eedc3530 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -914,6 +914,19 @@ int elv_may_queue(struct request_queue *q, int rw)
914 return ELV_MQUEUE_MAY; 914 return ELV_MQUEUE_MAY;
915} 915}
916 916
917void elv_abort_queue(struct request_queue *q)
918{
919 struct request *rq;
920
921 while (!list_empty(&q->queue_head)) {
922 rq = list_entry_rq(q->queue_head.next);
923 rq->cmd_flags |= REQ_QUIET;
924 blk_add_trace_rq(q, rq, BLK_TA_ABORT);
925 end_queued_request(rq, 0);
926 }
927}
928EXPORT_SYMBOL(elv_abort_queue);
929
917void elv_completed_request(struct request_queue *q, struct request *rq) 930void elv_completed_request(struct request_queue *q, struct request *rq)
918{ 931{
919 elevator_t *e = q->elevator; 932 elevator_t *e = q->elevator;