[PATCH V5 4/4] nvme: use blk_mq_[un]quiesce_tagset
Ming Lei
ming.lei at redhat.com
Thu Sep 10 22:41:17 EDT 2020
From: Sagi Grimberg <sagi at grimberg.me>
All controller namespaces share the same tagset, so we
can use this interface which does the optimal operation
for parallel quiesce based on the tagset type (e.g.
blocking tagsets and non-blocking tagsets).
Reviewed-by: Hannes Reinecke <hare at suse.de>
Cc: Sagi Grimberg <sagi at grimberg.me>
Cc: Bart Van Assche <bvanassche at acm.org>
Cc: Johannes Thumshirn <Johannes.Thumshirn at wdc.com>
Cc: Chao Leng <lengchao at huawei.com>
Add code to unquiesce ctrl->connect_q in nvme_stop_queues(), meantime
avoid to call blk_mq_quiesce_tagset()/blk_mq_unquiesce_tagset() if
this tagset isn't initialized.
Signed-off-by: Ming Lei <ming.lei at redhat.com>
Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
drivers/nvme/host/core.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ea1fa41fbba8..a6af8978a3ba 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4623,23 +4623,22 @@ EXPORT_SYMBOL_GPL(nvme_start_freeze);
void nvme_stop_queues(struct nvme_ctrl *ctrl)
{
- struct nvme_ns *ns;
+ if (list_empty_careful(&ctrl->namespaces))
+ return;
- down_read(&ctrl->namespaces_rwsem);
- list_for_each_entry(ns, &ctrl->namespaces, list)
- blk_mq_quiesce_queue(ns->queue);
- up_read(&ctrl->namespaces_rwsem);
+ blk_mq_quiesce_tagset(ctrl->tagset);
+
+ if (ctrl->connect_q)
+ blk_mq_unquiesce_queue(ctrl->connect_q);
}
EXPORT_SYMBOL_GPL(nvme_stop_queues);
void nvme_start_queues(struct nvme_ctrl *ctrl)
{
- struct nvme_ns *ns;
+ if (list_empty_careful(&ctrl->namespaces))
+ return;
- down_read(&ctrl->namespaces_rwsem);
- list_for_each_entry(ns, &ctrl->namespaces, list)
- blk_mq_unquiesce_queue(ns->queue);
- up_read(&ctrl->namespaces_rwsem);
+ blk_mq_unquiesce_tagset(ctrl->tagset);
}
EXPORT_SYMBOL_GPL(nvme_start_queues);
--
2.25.2
More information about the Linux-nvme
mailing list