blk-mq: Export tagset iter function
authorSagi Grimberg <sagig@mellanox.com>
Thu, 10 Mar 2016 11:58:46 +0000 (13:58 +0200)
committerJens Axboe <axboe@fb.com>
Tue, 12 Apr 2016 19:43:53 +0000 (13:43 -0600)
Its useful to iterate on all the active tags in cases
where we will need to fail all the queues IO.

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
[hch: carefully check for valid tagsets]
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq-tag.c
include/linux/blk-mq.h

index abdbb47405cb840c7005618cdece6b3165850ecc..2fd04286f103520a8fd9b370b4dba1633be810ef 100644 (file)
@@ -474,6 +474,18 @@ void blk_mq_all_tag_busy_iter(struct blk_mq_tags *tags, busy_tag_iter_fn *fn,
 }
 EXPORT_SYMBOL(blk_mq_all_tag_busy_iter);
 
+void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset,
+               busy_tag_iter_fn *fn, void *priv)
+{
+       int i;
+
+       for (i = 0; i < tagset->nr_hw_queues; i++) {
+               if (tagset->tags && tagset->tags[i])
+                       blk_mq_all_tag_busy_iter(tagset->tags[i], fn, priv);
+       }
+}
+EXPORT_SYMBOL(blk_mq_tagset_busy_iter);
+
 void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_iter_fn *fn,
                void *priv)
 {
index 9ac9799b702b94617dcbc5842af002030440ccf3..c808fec1ce446914aa8b193284ad3cf41a5ca886 100644 (file)
@@ -240,6 +240,8 @@ void blk_mq_run_hw_queues(struct request_queue *q, bool async);
 void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);
 void blk_mq_all_tag_busy_iter(struct blk_mq_tags *tags, busy_tag_iter_fn *fn,
                void *priv);
+void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset,
+               busy_tag_iter_fn *fn, void *priv);
 void blk_mq_freeze_queue(struct request_queue *q);
 void blk_mq_unfreeze_queue(struct request_queue *q);
 void blk_mq_freeze_queue_start(struct request_queue *q);