diff options
-rw-r--r-- | block/genhd.c | 16 | ||||
-rw-r--r-- | drivers/ide/ide-disk.c | 14 | ||||
-rw-r--r-- | drivers/scsi/sd.c | 9 | ||||
-rw-r--r-- | fs/partitions/check.h | 4 | ||||
-rw-r--r-- | include/linux/genhd.h | 16 |
5 files changed, 17 insertions, 42 deletions
diff --git a/block/genhd.c b/block/genhd.c index c2b14aa69d58..eedab5b4685b 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -1024,19 +1024,10 @@ struct gendisk *alloc_disk(int minors) | |||
1024 | { | 1024 | { |
1025 | return alloc_disk_node(minors, -1); | 1025 | return alloc_disk_node(minors, -1); |
1026 | } | 1026 | } |
1027 | EXPORT_SYMBOL(alloc_disk); | ||
1027 | 1028 | ||
1028 | struct gendisk *alloc_disk_node(int minors, int node_id) | 1029 | struct gendisk *alloc_disk_node(int minors, int node_id) |
1029 | { | 1030 | { |
1030 | return alloc_disk_ext_node(minors, 0, node_id); | ||
1031 | } | ||
1032 | |||
1033 | struct gendisk *alloc_disk_ext(int minors, int ext_minors) | ||
1034 | { | ||
1035 | return alloc_disk_ext_node(minors, ext_minors, -1); | ||
1036 | } | ||
1037 | |||
1038 | struct gendisk *alloc_disk_ext_node(int minors, int ext_minors, int node_id) | ||
1039 | { | ||
1040 | struct gendisk *disk; | 1031 | struct gendisk *disk; |
1041 | 1032 | ||
1042 | disk = kmalloc_node(sizeof(struct gendisk), | 1033 | disk = kmalloc_node(sizeof(struct gendisk), |
@@ -1054,7 +1045,6 @@ struct gendisk *alloc_disk_ext_node(int minors, int ext_minors, int node_id) | |||
1054 | disk->part_tbl->part[0] = &disk->part0; | 1045 | disk->part_tbl->part[0] = &disk->part0; |
1055 | 1046 | ||
1056 | disk->minors = minors; | 1047 | disk->minors = minors; |
1057 | disk->ext_minors = ext_minors; | ||
1058 | rand_initialize_disk(disk); | 1048 | rand_initialize_disk(disk); |
1059 | disk_to_dev(disk)->class = &block_class; | 1049 | disk_to_dev(disk)->class = &block_class; |
1060 | disk_to_dev(disk)->type = &disk_type; | 1050 | disk_to_dev(disk)->type = &disk_type; |
@@ -1065,11 +1055,7 @@ struct gendisk *alloc_disk_ext_node(int minors, int ext_minors, int node_id) | |||
1065 | } | 1055 | } |
1066 | return disk; | 1056 | return disk; |
1067 | } | 1057 | } |
1068 | |||
1069 | EXPORT_SYMBOL(alloc_disk); | ||
1070 | EXPORT_SYMBOL(alloc_disk_node); | 1058 | EXPORT_SYMBOL(alloc_disk_node); |
1071 | EXPORT_SYMBOL(alloc_disk_ext); | ||
1072 | EXPORT_SYMBOL(alloc_disk_ext_node); | ||
1073 | 1059 | ||
1074 | struct kobject *get_disk(struct gendisk *disk) | 1060 | struct kobject *get_disk(struct gendisk *disk) |
1075 | { | 1061 | { |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index a072df5053ae..29c8ae752683 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -41,16 +41,12 @@ | |||
41 | #include <asm/io.h> | 41 | #include <asm/io.h> |
42 | #include <asm/div64.h> | 42 | #include <asm/div64.h> |
43 | 43 | ||
44 | #define IDE_DISK_PARTS (1 << PARTN_BITS) | ||
45 | |||
46 | #if !defined(CONFIG_DEBUG_BLOCK_EXT_DEVT) | 44 | #if !defined(CONFIG_DEBUG_BLOCK_EXT_DEVT) |
47 | #define IDE_DISK_MINORS IDE_DISK_PARTS | 45 | #define IDE_DISK_MINORS (1 << PARTN_BITS) |
48 | #else | 46 | #else |
49 | #define IDE_DISK_MINORS 1 | 47 | #define IDE_DISK_MINORS 1 |
50 | #endif | 48 | #endif |
51 | 49 | ||
52 | #define IDE_DISK_EXT_MINORS (IDE_DISK_PARTS - IDE_DISK_MINORS) | ||
53 | |||
54 | struct ide_disk_obj { | 50 | struct ide_disk_obj { |
55 | ide_drive_t *drive; | 51 | ide_drive_t *drive; |
56 | ide_driver_t *driver; | 52 | ide_driver_t *driver; |
@@ -1161,8 +1157,7 @@ static int ide_disk_probe(ide_drive_t *drive) | |||
1161 | if (!idkp) | 1157 | if (!idkp) |
1162 | goto failed; | 1158 | goto failed; |
1163 | 1159 | ||
1164 | g = alloc_disk_ext_node(IDE_DISK_MINORS, IDE_DISK_EXT_MINORS, | 1160 | g = alloc_disk_node(IDE_DISK_MINORS, hwif_to_node(drive->hwif)); |
1165 | hwif_to_node(drive->hwif)); | ||
1166 | if (!g) | 1161 | if (!g) |
1167 | goto out_free_idkp; | 1162 | goto out_free_idkp; |
1168 | 1163 | ||
@@ -1189,9 +1184,10 @@ static int ide_disk_probe(ide_drive_t *drive) | |||
1189 | drive->attach = 1; | 1184 | drive->attach = 1; |
1190 | 1185 | ||
1191 | g->minors = IDE_DISK_MINORS; | 1186 | g->minors = IDE_DISK_MINORS; |
1192 | g->ext_minors = IDE_DISK_EXT_MINORS; | ||
1193 | g->driverfs_dev = &drive->gendev; | 1187 | g->driverfs_dev = &drive->gendev; |
1194 | g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0; | 1188 | g->flags |= GENHD_FL_EXT_DEVT; |
1189 | if (drive->removable) | ||
1190 | g->flags |= GENHD_FL_REMOVABLE; | ||
1195 | set_capacity(g, idedisk_capacity(drive)); | 1191 | set_capacity(g, idedisk_capacity(drive)); |
1196 | g->fops = &idedisk_ops; | 1192 | g->fops = &idedisk_ops; |
1197 | add_disk(g); | 1193 | add_disk(g); |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 280d231a86ed..6598024531dd 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -86,16 +86,12 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_DISK); | |||
86 | MODULE_ALIAS_SCSI_DEVICE(TYPE_MOD); | 86 | MODULE_ALIAS_SCSI_DEVICE(TYPE_MOD); |
87 | MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC); | 87 | MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC); |
88 | 88 | ||
89 | #define SD_PARTS 64 | ||
90 | |||
91 | #if !defined(CONFIG_DEBUG_BLOCK_EXT_DEVT) | 89 | #if !defined(CONFIG_DEBUG_BLOCK_EXT_DEVT) |
92 | #define SD_MINORS 16 | 90 | #define SD_MINORS 16 |
93 | #else | 91 | #else |
94 | #define SD_MINORS 1 | 92 | #define SD_MINORS 1 |
95 | #endif | 93 | #endif |
96 | 94 | ||
97 | #define SD_EXT_MINORS (SD_PARTS - SD_MINORS) | ||
98 | |||
99 | static int sd_revalidate_disk(struct gendisk *); | 95 | static int sd_revalidate_disk(struct gendisk *); |
100 | static int sd_probe(struct device *); | 96 | static int sd_probe(struct device *); |
101 | static int sd_remove(struct device *); | 97 | static int sd_remove(struct device *); |
@@ -1811,7 +1807,7 @@ static int sd_probe(struct device *dev) | |||
1811 | if (!sdkp) | 1807 | if (!sdkp) |
1812 | goto out; | 1808 | goto out; |
1813 | 1809 | ||
1814 | gd = alloc_disk_ext(SD_MINORS, SD_EXT_MINORS); | 1810 | gd = alloc_disk(SD_MINORS); |
1815 | if (!gd) | 1811 | if (!gd) |
1816 | goto out_free; | 1812 | goto out_free; |
1817 | 1813 | ||
@@ -1856,7 +1852,6 @@ static int sd_probe(struct device *dev) | |||
1856 | gd->major = sd_major((index & 0xf0) >> 4); | 1852 | gd->major = sd_major((index & 0xf0) >> 4); |
1857 | gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); | 1853 | gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); |
1858 | gd->minors = SD_MINORS; | 1854 | gd->minors = SD_MINORS; |
1859 | gd->ext_minors = SD_EXT_MINORS; | ||
1860 | gd->fops = &sd_fops; | 1855 | gd->fops = &sd_fops; |
1861 | 1856 | ||
1862 | if (index < 26) { | 1857 | if (index < 26) { |
@@ -1880,7 +1875,7 @@ static int sd_probe(struct device *dev) | |||
1880 | blk_queue_prep_rq(sdp->request_queue, sd_prep_fn); | 1875 | blk_queue_prep_rq(sdp->request_queue, sd_prep_fn); |
1881 | 1876 | ||
1882 | gd->driverfs_dev = &sdp->sdev_gendev; | 1877 | gd->driverfs_dev = &sdp->sdev_gendev; |
1883 | gd->flags = GENHD_FL_DRIVERFS; | 1878 | gd->flags = GENHD_FL_EXT_DEVT | GENHD_FL_DRIVERFS; |
1884 | if (sdp->removable) | 1879 | if (sdp->removable) |
1885 | gd->flags |= GENHD_FL_REMOVABLE; | 1880 | gd->flags |= GENHD_FL_REMOVABLE; |
1886 | 1881 | ||
diff --git a/fs/partitions/check.h b/fs/partitions/check.h index 17ae8ecd9e8b..98dbe1a84528 100644 --- a/fs/partitions/check.h +++ b/fs/partitions/check.h | |||
@@ -5,15 +5,13 @@ | |||
5 | * add_gd_partition adds a partitions details to the devices partition | 5 | * add_gd_partition adds a partitions details to the devices partition |
6 | * description. | 6 | * description. |
7 | */ | 7 | */ |
8 | enum { MAX_PART = 256 }; | ||
9 | |||
10 | struct parsed_partitions { | 8 | struct parsed_partitions { |
11 | char name[BDEVNAME_SIZE]; | 9 | char name[BDEVNAME_SIZE]; |
12 | struct { | 10 | struct { |
13 | sector_t from; | 11 | sector_t from; |
14 | sector_t size; | 12 | sector_t size; |
15 | int flags; | 13 | int flags; |
16 | } parts[MAX_PART]; | 14 | } parts[DISK_MAX_PARTS]; |
17 | int next; | 15 | int next; |
18 | int limit; | 16 | int limit; |
19 | }; | 17 | }; |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index ecf649c3deed..04524c213de1 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -58,6 +58,8 @@ enum { | |||
58 | UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */ | 58 | UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */ |
59 | }; | 59 | }; |
60 | 60 | ||
61 | #define DISK_MAX_PARTS 256 | ||
62 | |||
61 | #include <linux/major.h> | 63 | #include <linux/major.h> |
62 | #include <linux/device.h> | 64 | #include <linux/device.h> |
63 | #include <linux/smp.h> | 65 | #include <linux/smp.h> |
@@ -112,6 +114,7 @@ struct hd_struct { | |||
112 | #define GENHD_FL_CD 8 | 114 | #define GENHD_FL_CD 8 |
113 | #define GENHD_FL_UP 16 | 115 | #define GENHD_FL_UP 16 |
114 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 | 116 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 |
117 | #define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ | ||
115 | 118 | ||
116 | #define BLK_SCSI_MAX_CMDS (256) | 119 | #define BLK_SCSI_MAX_CMDS (256) |
117 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) | 120 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) |
@@ -129,15 +132,13 @@ struct disk_part_tbl { | |||
129 | }; | 132 | }; |
130 | 133 | ||
131 | struct gendisk { | 134 | struct gendisk { |
132 | /* major, first_minor, minors and ext_minors are input | 135 | /* major, first_minor and minors are input parameters only, |
133 | * parameters only, don't use directly. Use disk_devt() and | 136 | * don't use directly. Use disk_devt() and disk_max_parts(). |
134 | * disk_max_parts(). | ||
135 | */ | 137 | */ |
136 | int major; /* major number of driver */ | 138 | int major; /* major number of driver */ |
137 | int first_minor; | 139 | int first_minor; |
138 | int minors; /* maximum number of minors, =1 for | 140 | int minors; /* maximum number of minors, =1 for |
139 | * disks that can't be partitioned. */ | 141 | * disks that can't be partitioned. */ |
140 | int ext_minors; /* number of extended dynamic minors */ | ||
141 | 142 | ||
142 | char disk_name[32]; /* name of major driver */ | 143 | char disk_name[32]; /* name of major driver */ |
143 | 144 | ||
@@ -180,7 +181,9 @@ static inline struct gendisk *part_to_disk(struct hd_struct *part) | |||
180 | 181 | ||
181 | static inline int disk_max_parts(struct gendisk *disk) | 182 | static inline int disk_max_parts(struct gendisk *disk) |
182 | { | 183 | { |
183 | return disk->minors + disk->ext_minors; | 184 | if (disk->flags & GENHD_FL_EXT_DEVT) |
185 | return DISK_MAX_PARTS; | ||
186 | return disk->minors; | ||
184 | } | 187 | } |
185 | 188 | ||
186 | static inline bool disk_partitionable(struct gendisk *disk) | 189 | static inline bool disk_partitionable(struct gendisk *disk) |
@@ -527,9 +530,6 @@ extern void printk_all_partitions(void); | |||
527 | 530 | ||
528 | extern struct gendisk *alloc_disk_node(int minors, int node_id); | 531 | extern struct gendisk *alloc_disk_node(int minors, int node_id); |
529 | extern struct gendisk *alloc_disk(int minors); | 532 | extern struct gendisk *alloc_disk(int minors); |
530 | extern struct gendisk *alloc_disk_ext_node(int minors, int ext_minrs, | ||
531 | int node_id); | ||
532 | extern struct gendisk *alloc_disk_ext(int minors, int ext_minors); | ||
533 | extern struct kobject *get_disk(struct gendisk *disk); | 533 | extern struct kobject *get_disk(struct gendisk *disk); |
534 | extern void put_disk(struct gendisk *disk); | 534 | extern void put_disk(struct gendisk *disk); |
535 | extern void blk_register_region(dev_t devt, unsigned long range, | 535 | extern void blk_register_region(dev_t devt, unsigned long range, |