diff options
author | Jens Axboe <axboe@fb.com> | 2015-01-07 20:55:45 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-01-08 10:55:53 -0500 |
commit | 1885b24d23716e09b9c952822b05fd7f68099cdb (patch) | |
tree | 13cfd695ad4548766095cfff8afee07bba49b5a1 /block/blk-mq.c | |
parent | c68ed59f534c318716c6189050af3c5ea03b8071 (diff) |
blk-mq: Add helper to abort requeued requests
Adds a helper function a driver can use to abort requeued requests in
case any are pending when h/w queues are being removed.
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r-- | block/blk-mq.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index e73a5dd89fc4..261ccd89e15d 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -539,6 +539,26 @@ void blk_mq_kick_requeue_list(struct request_queue *q) | |||
539 | } | 539 | } |
540 | EXPORT_SYMBOL(blk_mq_kick_requeue_list); | 540 | EXPORT_SYMBOL(blk_mq_kick_requeue_list); |
541 | 541 | ||
542 | void blk_mq_abort_requeue_list(struct request_queue *q) | ||
543 | { | ||
544 | unsigned long flags; | ||
545 | LIST_HEAD(rq_list); | ||
546 | |||
547 | spin_lock_irqsave(&q->requeue_lock, flags); | ||
548 | list_splice_init(&q->requeue_list, &rq_list); | ||
549 | spin_unlock_irqrestore(&q->requeue_lock, flags); | ||
550 | |||
551 | while (!list_empty(&rq_list)) { | ||
552 | struct request *rq; | ||
553 | |||
554 | rq = list_first_entry(&rq_list, struct request, queuelist); | ||
555 | list_del_init(&rq->queuelist); | ||
556 | rq->errors = -EIO; | ||
557 | blk_mq_end_request(rq, rq->errors); | ||
558 | } | ||
559 | } | ||
560 | EXPORT_SYMBOL(blk_mq_abort_requeue_list); | ||
561 | |||
542 | static inline bool is_flush_request(struct request *rq, | 562 | static inline bool is_flush_request(struct request *rq, |
543 | struct blk_flush_queue *fq, unsigned int tag) | 563 | struct blk_flush_queue *fq, unsigned int tag) |
544 | { | 564 | { |