Bugfix for drivers/scsi/sd.c

Heinz Mauelshagen (mauelsha@ez-darmstadt.telekom.de)
Fri, 04 Dec 1998 0:12:30 MET


Sorry folks, i've send this twice already but didn't find it in 2.1.130 8*(

The patch fixes:

1. registration 1 scsi major too much
2. getting stuck with _zero_ scsi disks recognized in case
of having "12 + n * 16" disks (n = 0 to 7).

Please let it make it into 2.1.131!

Thanks,
Heinz

--- linux-2.1.130.orig/drivers/scsi/sd.c Thu Nov 19 01:42:44 1998
+++ linux-2.1.130/drivers/scsi/sd.c Wed Dec 2 01:03:16 1998
@@ -1487,7 +1487,7 @@
sd_template.dev_max = 128;

if(!sd_registered) {
- for (i=0; i <= sd_template.dev_max / SCSI_DISKS_PER_MAJOR; i++) {
+ for (i=0; i <= ( sd_template.dev_max - 1) / SCSI_DISKS_PER_MAJOR; i++) {
if (register_blkdev(SD_MAJOR(i),"sd",&sd_fops)) {
printk("Unable to get major %d for SCSI disk\n", SD_MAJOR(i));
return 1;
@@ -1540,8 +1540,12 @@
sd_gendisks[i].real_devices =
(void *) (rscsi_disks + i * SCSI_DISKS_PER_MAJOR);
}
- LAST_SD_GENDISK.max_nr =
- sd_template.dev_max % SCSI_DISKS_PER_MAJOR;
+ if ( sd_template.dev_max == 0)
+ LAST_SD_GENDISK.max_nr = 0;
+ else if ( sd_template.dev_max % SCSI_DISKS_PER_MAJOR == 0)
+ LAST_SD_GENDISK.max_nr = SCSI_DISKS_PER_MAJOR;
+ else
+ LAST_SD_GENDISK.max_nr = sd_template.dev_max % SCSI_DISKS_PER_MAJOR;
LAST_SD_GENDISK.next = NULL;
return 0;
}

--

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Systemmanagement Entwicklungsbereich 2 Deutsche Telekom AG Entwicklungszentrum Darmstadt Heinz Mauelshagen Otto-Roehm-Strasse 71c Postfach 10 05 41 mge@ez-darmstadt.telekom.de 64205 Darmstadt Germany +49 6151 886-425 FAX-386 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/