From d51cf486921485b49e84bd16b384f4fc57fc2f33 Mon Sep 17 00:00:00 2001 From: Sagi Grimberg Date: Tue, 3 Jan 2017 08:40:50 -0800 Subject: [PATCH] blk-mq: Export tagset iter function 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 [hch: carefully check for valid tagsets] Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Signed-off-by: Jens Axboe (cherry picked from commit e0489487ec9cd79ee1fa0dc5d3789c08b0e51a2c) Orabug: 25130845 Signed-off-by: Ashok Vairavan Reviewed-by: Martin K. Petersen --- block/blk-mq-tag.c | 12 ++++++++++++ drivers/nvme/host/pci.c | 4 ---- include/linux/blk-mq.h | 2 ++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index 9115c6d59948..57a480d1d826 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -471,6 +471,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_tag_busy_iter(struct blk_mq_hw_ctx *hctx, busy_iter_fn *fn, void *priv) { diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 60b13a65b70f..4e8a26d1591e 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -80,7 +80,6 @@ struct nvme_queue; static int nvme_reset(struct nvme_dev *dev); static int nvme_process_cq(struct nvme_queue *nvmeq); -static void nvme_unmap_data(struct nvme_dev *dev, struct nvme_iod *iod); static void nvme_remove_dead_ctrl(struct nvme_dev *dev); static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown); @@ -1819,9 +1818,6 @@ static void nvme_reset_work(struct work_struct *work) if (dev->bar) nvme_dev_disable(dev, false); - if (test_bit(NVME_CTRL_REMOVING, &dev->flags)) - goto out; - if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING)) goto out; diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 4563ce91788d..6953e53cc839 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -233,6 +233,8 @@ void blk_mq_tag_busy_iter(struct blk_mq_hw_ctx *hctx, busy_iter_fn *fn, void *priv); 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); -- 2.50.1