[PATCH] block: don't grab block_class_lock unnecessarily

From: Tejun Heo
Date: Mon Aug 25 2008 - 05:17:32 EST


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@xxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/