Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 110469
b: refs/heads/master
c: 2ac3cee
h: refs/heads/master
i:
  110467: b903ecd
v: v3
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Oct 9, 2008
1 parent 3bca979 commit 6737f7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ac65ece4eee10b03ac29ee925cadc179dc810bab
refs/heads/master: 2ac3cee5298a247b2774f3319b28a05f588c3f0e
28 changes: 9 additions & 19 deletions trunk/block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,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
Expand All @@ -305,17 +303,15 @@ static int find_start(struct device *dev, void *data)
static void *part_start(struct seq_file *part, loff_t *pos)
{
struct device *dev;
loff_t k = *pos;
loff_t n = *pos;

if (!k)
if (!n)
part->private = (void *)1LU; /* tell show to print header */

mutex_lock(&block_class_lock);
dev = class_find_device(&block_class, NULL, &k, find_start);
if (dev) {
put_device(dev);
dev = class_find_device(&block_class, NULL, &n, find_start);
if (dev)
return dev_to_disk(dev);
}

return NULL;
}

Expand All @@ -341,7 +337,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)
Expand Down Expand Up @@ -583,14 +578,12 @@ static struct device_type disk_type = {
static void *diskstats_start(struct seq_file *part, loff_t *pos)
{
struct device *dev;
loff_t k = *pos;
loff_t n = *pos;

mutex_lock(&block_class_lock);
dev = class_find_device(&block_class, NULL, &k, find_start);
if (dev) {
put_device(dev);
dev = class_find_device(&block_class, NULL, &n, find_start);
if (dev)
return dev_to_disk(dev);
}

return NULL;
}

Expand All @@ -610,7 +603,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)
Expand Down Expand Up @@ -729,7 +721,6 @@ 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, &find, match_id);
Expand All @@ -738,7 +729,6 @@ dev_t blk_lookup_devt(const char *name, int part)
devt = MKDEV(MAJOR(dev->devt),
MINOR(dev->devt) + part);
}
mutex_unlock(&block_class_lock);

return devt;
}
Expand Down

0 comments on commit 6737f7b

Please sign in to comment.