linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@wdc.com>
To: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 3/7] block: Remove sysfs lock from elevator_init_rq()
Date: Fri, 23 Aug 2019 09:15:24 +0900	[thread overview]
Message-ID: <20190823001528.5673-4-damien.lemoal@wdc.com> (raw)
In-Reply-To: <20190823001528.5673-1-damien.lemoal@wdc.com>

Since elevator_init_rq() is called before the device queue is registered
in sysfs, there is no possible conflict with elevator_switch(). Remove
the unnecessary locking of q->sysfs_lock mutex.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 block/elevator.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/block/elevator.c b/block/elevator.c
index 7fff06751633..6208ddc334ef 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -617,17 +617,12 @@ void elevator_init_mq(struct request_queue *q)
 	if (q->nr_hw_queues != 1)
 		return;
 
-	/*
-	 * q->sysfs_lock must be held to provide mutual exclusion between
-	 * elevator_switch() and here.
-	 */
-	mutex_lock(&q->sysfs_lock);
 	if (unlikely(q->elevator))
-		goto out_unlock;
+		return;
 
 	e = elevator_get(q, "mq-deadline", false);
 	if (!e)
-		goto out_unlock;
+		return;
 
 	err = blk_mq_init_sched(q, e);
 	if (err) {
@@ -635,9 +630,6 @@ void elevator_init_mq(struct request_queue *q)
 			"falling back to \"none\"\n", e->elevator_name);
 		elevator_put(e);
 	}
-
-out_unlock:
-	mutex_unlock(&q->sysfs_lock);
 }
 
 
-- 
2.21.0


  parent reply	other threads:[~2019-08-23  0:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23  0:15 [PATCH 0/7] Elevator cleanups and improvements Damien Le Moal
2019-08-23  0:15 ` [PATCH 1/7] block: Cleanup elevator_init_mq() use Damien Le Moal
2019-08-23  8:08   ` Johannes Thumshirn
2019-08-23  0:15 ` [PATCH 2/7] block: Change elevator_init_mq() to always succeed Damien Le Moal
2019-08-23  8:54   ` Johannes Thumshirn
2019-08-23  0:15 ` Damien Le Moal [this message]
2019-08-23  9:00   ` [PATCH 3/7] block: Remove sysfs lock from elevator_init_rq() Johannes Thumshirn
2019-08-23 20:32   ` Bart Van Assche
2019-08-23  0:15 ` [PATCH 4/7] block: Introduce elevator features Damien Le Moal
2019-08-23 11:19   ` Johannes Thumshirn
2019-08-23  0:15 ` [PATCH 5/7] block: Introduce zoned block device elevator feature Damien Le Moal
2019-08-23 11:41   ` Johannes Thumshirn
2019-08-23  0:15 ` [PATCH 6/7] block: Improve default elevator selection Damien Le Moal
2019-08-23  0:15 ` [PATCH 7/7] block: Delay default elevator initialization Damien Le Moal

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=20190823001528.5673-4-damien.lemoal@wdc.com \
    --to=damien.lemoal@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).