From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>, Keith Busch <kbusch@kernel.org>,
Sagi Grimberg <sagi@grimberg.me>, Chao Leng <lengchao@huawei.com>
Cc: Ming Lei <ming.lei@redhat.com>,
linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
Hannes Reinecke <hare@suse.de>
Subject: [PATCH 12/14] blk-mq: pass a tagset to blk_mq_wait_quiesce_done
Date: Tue, 1 Nov 2022 16:00:48 +0100 [thread overview]
Message-ID: <20221101150050.3510-13-hch@lst.de> (raw)
In-Reply-To: <20221101150050.3510-1-hch@lst.de>
Nothing in blk_mq_wait_quiesce_done needs the request_queue now, so just
pass the tagset, and move the non-mq check into the only caller that
needs it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chao Leng <lengchao@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
block/blk-mq.c | 16 +++++++++-------
drivers/nvme/host/core.c | 4 ++--
drivers/scsi/scsi_lib.c | 2 +-
include/linux/blk-mq.h | 2 +-
4 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 3479325fc86c3..b358328a1dce3 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -254,15 +254,17 @@ EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue_nowait);
/**
* blk_mq_wait_quiesce_done() - wait until in-progress quiesce is done
- * @q: request queue.
+ * @set: tag_set to wait on
*
* Note: it is driver's responsibility for making sure that quiesce has
- * been started.
+ * been started on or more of the request_queues of the tag_set. This
+ * function only waits for the quiesce on those request_queues that had
+ * the quiesce flag set using blk_mq_quiesce_queue_nowait.
*/
-void blk_mq_wait_quiesce_done(struct request_queue *q)
+void blk_mq_wait_quiesce_done(struct blk_mq_tag_set *set)
{
- if (q->tag_set->flags & BLK_MQ_F_BLOCKING)
- synchronize_srcu(q->tag_set->srcu);
+ if (set->flags & BLK_MQ_F_BLOCKING)
+ synchronize_srcu(set->srcu);
else
synchronize_rcu();
}
@@ -282,7 +284,7 @@ void blk_mq_quiesce_queue(struct request_queue *q)
blk_mq_quiesce_queue_nowait(q);
/* nothing to wait for non-mq queues */
if (queue_is_mq(q))
- blk_mq_wait_quiesce_done(q);
+ blk_mq_wait_quiesce_done(q->tag_set);
}
EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue);
@@ -1623,7 +1625,7 @@ static void blk_mq_timeout_work(struct work_struct *work)
* uses srcu or rcu, wait for a synchronization point to
* ensure all running submits have finished
*/
- blk_mq_wait_quiesce_done(q);
+ blk_mq_wait_quiesce_done(q->tag_set);
expired.next = 0;
blk_mq_queue_tag_busy_iter(q, blk_mq_handle_expired, &expired);
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ed06fcb87f93a..66b0b6e110024 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -5107,7 +5107,7 @@ static void nvme_stop_ns_queue(struct nvme_ns *ns)
if (!test_and_set_bit(NVME_NS_STOPPED, &ns->flags))
blk_mq_quiesce_queue(ns->queue);
else
- blk_mq_wait_quiesce_done(ns->queue);
+ blk_mq_wait_quiesce_done(ns->queue->tag_set);
}
/* let I/O to all namespaces fail in preparation for surprise removal */
@@ -5197,7 +5197,7 @@ void nvme_stop_admin_queue(struct nvme_ctrl *ctrl)
if (!test_and_set_bit(NVME_CTRL_ADMIN_Q_STOPPED, &ctrl->flags))
blk_mq_quiesce_queue(ctrl->admin_q);
else
- blk_mq_wait_quiesce_done(ctrl->admin_q);
+ blk_mq_wait_quiesce_done(ctrl->admin_q->tag_set);
}
EXPORT_SYMBOL_GPL(nvme_stop_admin_queue);
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 8b89fab7c4206..249757ddd8fea 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2735,7 +2735,7 @@ static void scsi_stop_queue(struct scsi_device *sdev, bool nowait)
blk_mq_quiesce_queue(sdev->request_queue);
} else {
if (!nowait)
- blk_mq_wait_quiesce_done(sdev->request_queue);
+ blk_mq_wait_quiesce_done(sdev->request_queue->tag_set);
}
}
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index f059edebb11d8..061ea6e7af017 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -880,7 +880,7 @@ void blk_mq_start_hw_queues(struct request_queue *q);
void blk_mq_start_stopped_hw_queue(struct blk_mq_hw_ctx *hctx, bool async);
void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async);
void blk_mq_quiesce_queue(struct request_queue *q);
-void blk_mq_wait_quiesce_done(struct request_queue *q);
+void blk_mq_wait_quiesce_done(struct blk_mq_tag_set *set);
void blk_mq_unquiesce_queue(struct request_queue *q);
void blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);
void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async);
--
2.30.2
next prev parent reply other threads:[~2022-11-01 15:02 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-01 15:00 per-tagset SRCU struct and quiesce v3 Christoph Hellwig
2022-11-01 15:00 ` [PATCH 01/14] block: set the disk capacity to 0 in blk_mark_disk_dead Christoph Hellwig
2022-11-02 1:18 ` Chaitanya Kulkarni
2022-11-02 14:35 ` Jens Axboe
2022-11-01 15:00 ` [PATCH 02/14] nvme-pci: refactor the tagset handling in nvme_reset_work Christoph Hellwig
2022-11-02 1:19 ` Chaitanya Kulkarni
2022-11-01 15:00 ` [PATCH 03/14] nvme: don't remove namespaces in nvme_passthru_end Christoph Hellwig
2022-11-02 1:20 ` Chaitanya Kulkarni
2022-11-01 15:00 ` [PATCH 04/14] nvme: remove the NVME_NS_DEAD check in nvme_remove_invalid_namespaces Christoph Hellwig
2022-11-02 1:21 ` Chaitanya Kulkarni
2022-11-01 15:00 ` [PATCH 05/14] nvme: remove the NVME_NS_DEAD check in nvme_validate_ns Christoph Hellwig
2022-11-02 1:21 ` Chaitanya Kulkarni
2022-11-01 15:00 ` [PATCH 06/14] nvme: don't unquiesce the admin queue in nvme_kill_queues Christoph Hellwig
2022-11-02 1:24 ` Chaitanya Kulkarni
2022-11-01 15:00 ` [PATCH 07/14] nvme: split nvme_kill_queues Christoph Hellwig
2022-11-02 1:25 ` Chaitanya Kulkarni
2022-11-01 15:00 ` [PATCH 08/14] nvme-pci: don't unquiesce the I/O queues in nvme_remove_dead_ctrl Christoph Hellwig
2022-11-02 1:26 ` Chaitanya Kulkarni
2022-11-01 15:00 ` [PATCH 09/14] nvme-apple: don't unquiesce the I/O queues in apple_nvme_reset_work Christoph Hellwig
2022-11-02 5:47 ` Chaitanya Kulkarni
2022-11-01 15:00 ` [PATCH 10/14] blk-mq: skip non-mq queues in blk_mq_quiesce_queue Christoph Hellwig
2022-11-02 5:47 ` Chaitanya Kulkarni
2022-11-01 15:00 ` [PATCH 11/14] blk-mq: move the srcu_struct used for quiescing to the tagset Christoph Hellwig
2022-11-02 5:49 ` Chaitanya Kulkarni
2022-11-01 15:00 ` Christoph Hellwig [this message]
2022-11-02 5:50 ` [PATCH 12/14] blk-mq: pass a tagset to blk_mq_wait_quiesce_done Chaitanya Kulkarni
2022-11-01 15:00 ` [PATCH 13/14] blk-mq: add tagset quiesce interface Christoph Hellwig
2022-11-02 5:51 ` Chaitanya Kulkarni
2022-11-01 15:00 ` [PATCH 14/14] nvme: use blk_mq_[un]quiesce_tagset Christoph Hellwig
2022-11-02 5:51 ` Chaitanya Kulkarni
2022-11-21 20:44 ` Shakeel Butt
2022-11-22 2:53 ` Chao Leng
2022-11-22 6:08 ` Christoph Hellwig
2022-11-22 9:44 ` Sagi Grimberg
2022-11-22 16:40 ` Shakeel Butt
2022-11-01 15:25 ` per-tagset SRCU struct and quiesce v3 Keith Busch
2022-11-02 1:21 ` Chao Leng
2022-11-02 6:49 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221101150050.3510-13-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=hare@suse.de \
--cc=kbusch@kernel.org \
--cc=lengchao@huawei.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=ming.lei@redhat.com \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox