Commit 0c39a2fa authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix display of NBD in /proc/partitions

The recent change to /proc/partitions which prevents it from displaying
removeable media accidentally caused 128 NBD and 16 ramdisk partitions to
appear in /proc/partitions instead.

So add a specific gendisk flag which says "don't show me in /proc/partitions"
and use that.
parent 0b9ce3ae
...@@ -262,8 +262,9 @@ static int show_partition(struct seq_file *part, void *v) ...@@ -262,8 +262,9 @@ static int show_partition(struct seq_file *part, void *v)
/* Don't show non-partitionable removeable devices or empty devices */ /* Don't show non-partitionable removeable devices or empty devices */
if (!get_capacity(sgp) || if (!get_capacity(sgp) ||
(sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE)) (sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE)))
) return 0;
if (sgp->flags & GENHD_FL_SUPPRESS_PARTITION_INFO)
return 0; return 0;
/* show the full disk and all non-0 size partitions of it */ /* show the full disk and all non-0 size partitions of it */
......
...@@ -741,6 +741,7 @@ static int __init nbd_init(void) ...@@ -741,6 +741,7 @@ static int __init nbd_init(void)
disk->first_minor = i; disk->first_minor = i;
disk->fops = &nbd_fops; disk->fops = &nbd_fops;
disk->private_data = &nbd_dev[i]; disk->private_data = &nbd_dev[i];
disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO;
sprintf(disk->disk_name, "nbd%d", i); sprintf(disk->disk_name, "nbd%d", i);
sprintf(disk->devfs_name, "nbd/%d", i); sprintf(disk->devfs_name, "nbd/%d", i);
set_capacity(disk, 0x3ffffe); set_capacity(disk, 0x3ffffe);
......
...@@ -354,6 +354,7 @@ static int __init rd_init (void) ...@@ -354,6 +354,7 @@ static int __init rd_init (void)
disk->first_minor = i; disk->first_minor = i;
disk->fops = &rd_bd_op; disk->fops = &rd_bd_op;
disk->queue = rd_queue[i]; disk->queue = rd_queue[i];
disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO;
sprintf(disk->disk_name, "ram%d", i); sprintf(disk->disk_name, "ram%d", i);
sprintf(disk->devfs_name, "rd/%d", i); sprintf(disk->devfs_name, "rd/%d", i);
set_capacity(disk, rd_size * 2); set_capacity(disk, rd_size * 2);
......
...@@ -64,10 +64,11 @@ struct hd_struct { ...@@ -64,10 +64,11 @@ struct hd_struct {
int policy, partno; int policy, partno;
}; };
#define GENHD_FL_REMOVABLE 1 #define GENHD_FL_REMOVABLE 1
#define GENHD_FL_DRIVERFS 2 #define GENHD_FL_DRIVERFS 2
#define GENHD_FL_CD 8 #define GENHD_FL_CD 8
#define GENHD_FL_UP 16 #define GENHD_FL_UP 16
#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
struct disk_stats { struct disk_stats {
unsigned read_sectors, write_sectors; unsigned read_sectors, write_sectors;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment