Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104748
b: refs/heads/master
c: 68c4d4a
h: refs/heads/master
v: v3
  • Loading branch information
Greg Kroah-Hartman committed Jul 22, 2008
1 parent 8861d60 commit 01af68f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 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: a6e2ba88774bc5870ab3d9664cb86d70415f7402
refs/heads/master: 68c4d4a7875c59f2e4b72901ab11ba978e75bde0
31 changes: 17 additions & 14 deletions trunk/block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,18 +291,25 @@ void __init printk_all_partitions(void)

#ifdef CONFIG_PROC_FS
/* iterator */
static int find_start(struct device *dev, void *data)
{
loff_t k = *(loff_t *)data;

if (dev->type != &disk_type)
return 0;
if (!k--)
return 1;
return 0;
}

static void *part_start(struct seq_file *part, loff_t *pos)
{
loff_t k = *pos;
struct device *dev;

mutex_lock(&block_class_lock);
list_for_each_entry(dev, &block_class.devices, node) {
if (dev->type != &disk_type)
continue;
if (!k--)
return dev_to_disk(dev);
}
dev = class_find_device(&block_class, NULL, (void *)pos, find_start);
if (dev)
return dev_to_disk(dev);
return NULL;
}

Expand Down Expand Up @@ -555,16 +562,12 @@ static struct device_type disk_type = {

static void *diskstats_start(struct seq_file *part, loff_t *pos)
{
loff_t k = *pos;
struct device *dev;

mutex_lock(&block_class_lock);
list_for_each_entry(dev, &block_class.devices, node) {
if (dev->type != &disk_type)
continue;
if (!k--)
return dev_to_disk(dev);
}
dev = class_find_device(&block_class, NULL, (void *)pos, find_start);
if (dev)
return dev_to_disk(dev);
return NULL;
}

Expand Down

0 comments on commit 01af68f

Please sign in to comment.