aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-08-25 06:47:24 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 02:56:06 -0400
commitf615b48cc7df7cac3865ec76ac1a5bb04d3e07f4 (patch)
treea61ba32641118296ecc942814e03b4b0ababfa63 /drivers
parent1f0142905d4812966831613847db38a66da29eb8 (diff)
sd/ide-disk: apply extended minors to sd and ide
Update sd and ide-disk such that they can take advantage of extended minors. ide-disk already has 64 minors per device and currently doesn't use extended minors although after this patch it can be turned on by simply tweaking constants. sd only had 16 minors per device causing problems on certain peculiar configurations. This patch lifts the restriction and enables it to use upto 64 minors. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-disk.c11
-rw-r--r--drivers/scsi/sd.c9
2 files changed, 15 insertions, 5 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 07ef88bd109b..7a88de9ada29 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -41,6 +41,10 @@
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#define IDE_DISK_MINORS IDE_DISK_PARTS
46#define IDE_DISK_EXT_MINORS (IDE_DISK_PARTS - IDE_DISK_MINORS)
47
44struct ide_disk_obj { 48struct ide_disk_obj {
45 ide_drive_t *drive; 49 ide_drive_t *drive;
46 ide_driver_t *driver; 50 ide_driver_t *driver;
@@ -1151,8 +1155,8 @@ static int ide_disk_probe(ide_drive_t *drive)
1151 if (!idkp) 1155 if (!idkp)
1152 goto failed; 1156 goto failed;
1153 1157
1154 g = alloc_disk_node(1 << PARTN_BITS, 1158 g = alloc_disk_ext_node(IDE_DISK_MINORS, IDE_DISK_EXT_MINORS,
1155 hwif_to_node(drive->hwif)); 1159 hwif_to_node(drive->hwif));
1156 if (!g) 1160 if (!g)
1157 goto out_free_idkp; 1161 goto out_free_idkp;
1158 1162
@@ -1178,7 +1182,8 @@ static int ide_disk_probe(ide_drive_t *drive)
1178 } else 1182 } else
1179 drive->attach = 1; 1183 drive->attach = 1;
1180 1184
1181 g->minors = 1 << PARTN_BITS; 1185 g->minors = IDE_DISK_MINORS;
1186 g->ext_minors = IDE_DISK_EXT_MINORS;
1182 g->driverfs_dev = &drive->gendev; 1187 g->driverfs_dev = &drive->gendev;
1183 g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0; 1188 g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0;
1184 set_capacity(g, idedisk_capacity(drive)); 1189 set_capacity(g, idedisk_capacity(drive));
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index e5e7d7856454..d1bb0e1d2d28 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -86,6 +86,10 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_DISK);
86MODULE_ALIAS_SCSI_DEVICE(TYPE_MOD); 86MODULE_ALIAS_SCSI_DEVICE(TYPE_MOD);
87MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC); 87MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC);
88 88
89#define SD_PARTS 64
90#define SD_MINORS 16
91#define SD_EXT_MINORS (SD_PARTS - SD_MINORS)
92
89static int sd_revalidate_disk(struct gendisk *); 93static int sd_revalidate_disk(struct gendisk *);
90static int sd_probe(struct device *); 94static int sd_probe(struct device *);
91static int sd_remove(struct device *); 95static int sd_remove(struct device *);
@@ -1801,7 +1805,7 @@ static int sd_probe(struct device *dev)
1801 if (!sdkp) 1805 if (!sdkp)
1802 goto out; 1806 goto out;
1803 1807
1804 gd = alloc_disk(16); 1808 gd = alloc_disk_ext(SD_MINORS, SD_EXT_MINORS);
1805 if (!gd) 1809 if (!gd)
1806 goto out_free; 1810 goto out_free;
1807 1811
@@ -1845,7 +1849,8 @@ static int sd_probe(struct device *dev)
1845 1849
1846 gd->major = sd_major((index & 0xf0) >> 4); 1850 gd->major = sd_major((index & 0xf0) >> 4);
1847 gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); 1851 gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00);
1848 gd->minors = 16; 1852 gd->minors = SD_MINORS;
1853 gd->ext_minors = SD_EXT_MINORS;
1849 gd->fops = &sd_fops; 1854 gd->fops = &sd_fops;
1850 1855
1851 if (index < 26) { 1856 if (index < 26) {