From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Cc: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>,
"Nilay Shroff" <nilay@linux.ibm.com>,
"Christoph Hellwig" <hch@lst.de>,
"Ming Lei" <ming.lei@redhat.com>
Subject: [PATCH 2/3] block: don't call freeze queue in elevator_switch() and elevator_disable()
Date: Wed, 2 Apr 2025 12:38:48 +0800 [thread overview]
Message-ID: <20250402043851.946498-3-ming.lei@redhat.com> (raw)
In-Reply-To: <20250402043851.946498-1-ming.lei@redhat.com>
Both elevator_switch() and elevator_disable() are called from sysfs
store and updating nr_hw_queue code paths only.
And in the two code paths, queue has been frozen already, so don't call
freeze queue in the two functions.
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
block/elevator.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/block/elevator.c b/block/elevator.c
index b4d08026b02c..4d3a8f996c91 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -615,12 +615,10 @@ void elevator_init_mq(struct request_queue *q)
*/
int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
{
- unsigned int memflags;
int ret;
lockdep_assert_held(&q->elevator_lock);
- memflags = blk_mq_freeze_queue(q);
blk_mq_quiesce_queue(q);
if (q->elevator) {
@@ -641,7 +639,6 @@ int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
out_unfreeze:
blk_mq_unquiesce_queue(q);
- blk_mq_unfreeze_queue(q, memflags);
if (ret) {
pr_warn("elv: switch to \"%s\" failed, falling back to \"none\"\n",
@@ -653,11 +650,8 @@ int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
void elevator_disable(struct request_queue *q)
{
- unsigned int memflags;
-
lockdep_assert_held(&q->elevator_lock);
- memflags = blk_mq_freeze_queue(q);
blk_mq_quiesce_queue(q);
elv_unregister_queue(q);
@@ -668,7 +662,6 @@ void elevator_disable(struct request_queue *q)
blk_add_trace_msg(q, "elv switch: none");
blk_mq_unquiesce_queue(q);
- blk_mq_unfreeze_queue(q, memflags);
}
/*
--
2.47.0
next prev parent reply other threads:[~2025-04-02 4:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-02 4:38 [PATCH 0/3] block: fix lock dependency between freeze and elevator lock Ming Lei
2025-04-02 4:38 ` [PATCH 1/3] block: add blk_mq_enter_no_io() and blk_mq_exit_no_io() Ming Lei
2025-04-02 7:55 ` Ming Lei
2025-04-02 13:50 ` Nilay Shroff
2025-04-02 4:38 ` Ming Lei [this message]
2025-04-02 13:45 ` [PATCH 2/3] block: don't call freeze queue in elevator_switch() and elevator_disable() Nilay Shroff
2025-04-02 4:38 ` [PATCH 3/3] block: use blk_mq_no_io() for avoiding lock dependency Ming Lei
2025-04-02 13:43 ` Nilay Shroff
2025-04-03 2:54 ` Ming Lei
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=20250402043851.946498-3-ming.lei@redhat.com \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=nilay@linux.ibm.com \
--cc=valdis.kletnieks@vt.edu \
/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