All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Greg Kroah-Hartman <gregkh@suse.de>,
	Abdel Benamrouche <draconux@gmail.com>
Cc: linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>
Subject: [PATCH] block: don't grab block_class_lock unnecessarily
Date: Mon, 25 Aug 2008 18:15:37 +0900	[thread overview]
Message-ID: <1219655740-11672-3-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1219655740-11672-1-git-send-email-tj@kernel.org>

block_class_lock protects major_names array and bdev_map and doesn't
have anything to do with block class devices.  Don't grab them while
iterating over block class devices.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
 block/genhd.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 3a43c1d..5a1511e 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -285,9 +285,7 @@ static int printk_partition(struct device *dev, void *data)
  */
 void __init printk_all_partitions(void)
 {
-	mutex_lock(&block_class_lock);
 	class_for_each_device(&block_class, NULL, NULL, printk_partition);
-	mutex_unlock(&block_class_lock);
 }
 
 #ifdef CONFIG_PROC_FS
@@ -311,7 +309,6 @@ static void *part_start(struct seq_file *part, loff_t *pos)
 	if (!n)
 		seq_puts(part, "major minor  #blocks  name\n\n");
 
-	mutex_lock(&block_class_lock);
 	dev = class_find_device(&block_class, NULL, &n, find_start);
 	if (dev)
 		return dev_to_disk(dev);
@@ -338,7 +335,6 @@ static void *part_next(struct seq_file *part, void *v, loff_t *pos)
 
 static void part_stop(struct seq_file *part, void *v)
 {
-	mutex_unlock(&block_class_lock);
 }
 
 static int show_partition(struct seq_file *part, void *v)
@@ -571,7 +567,6 @@ static void *diskstats_start(struct seq_file *part, loff_t *pos)
 	struct device *dev;
 	loff_t n = *pos;
 
-	mutex_lock(&block_class_lock);
 	dev = class_find_device(&block_class, NULL, &n, find_start);
 	if (dev)
 		return dev_to_disk(dev);
@@ -592,7 +587,6 @@ static void *diskstats_next(struct seq_file *part, void *v, loff_t *pos)
 
 static void diskstats_stop(struct seq_file *part, void *v)
 {
-	mutex_unlock(&block_class_lock);
 }
 
 static int diskstats_show(struct seq_file *s, void *v)
@@ -711,14 +705,12 @@ dev_t blk_lookup_devt(const char *name, int part)
 	dev_t devt = MKDEV(0, 0);
 	struct find_block find;
 
-	mutex_lock(&block_class_lock);
 	find.name = name;
 	find.part = part;
 	dev = class_find_device(&block_class, NULL, (void *)&find, match_id);
 	if (dev)
 		devt = MKDEV(MAJOR(dev->devt),
 			     MINOR(dev->devt) + part);
-	mutex_unlock(&block_class_lock);
 
 	return devt;
 }
-- 
1.5.4.5


  parent reply	other threads:[~2008-08-25  9:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-25  9:15 [PATCHSET 1/3 blk-for-2.6.28] block: misc fixes and improvements Tejun Heo
2008-08-25  9:15 ` [PATCH] block: fix partition info printouts Tejun Heo
2008-08-25  9:15 ` Tejun Heo [this message]
2008-08-25  9:15 ` [PATCH] block: use class_dev_iterator instead of class_for_each_device() Tejun Heo
2008-08-25  9:15 ` [PATCH] block: allow deleting zero length partition Tejun Heo
2008-08-25  9:15 ` [PATCH] block: update add_partition() error handling Tejun Heo
2008-08-25 10:23 ` [PATCHSET 1/3 blk-for-2.6.28] block: misc fixes and improvements Tejun Heo
2008-08-25 14:47 ` Greg KH
2008-08-25 14:58   ` Tejun Heo
2008-08-25 14:59     ` Tejun Heo
2008-08-25 14:58   ` Jens Axboe
2008-08-25 21:42     ` Greg KH

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=1219655740-11672-3-git-send-email-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=draconux@gmail.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.