diff -uNr linux-2.4.18.S18.scsimany4/Documentation/Configure.help linux-2.4.18.S18.scsimany/Documentation/Configure.help --- linux-2.4.18.S18.scsimany4/Documentation/Configure.help Tue Jul 16 13:48:24 2002 +++ linux-2.4.18.S18.scsimany/Documentation/Configure.help Fri Jul 26 02:01:16 2002 @@ -7099,6 +7099,19 @@ is located on a SCSI disk. In this case, do not compile the driver for your SCSI host adapter (below) as a module either. +CONFIG_SD_MAX_MAJORS + There are 16 block major numers assigned to SCSI disks which means + that you may attach up to 256 SCSI disks to one Linux machine. + The driver does allows to dynamically allocate more major numbers + when more disks get attached. You will need a userspace script to + parse /proc/partitions though to dynamically create the device + nodes then. The driver allocates the memory as disks get attached, + so there's no cost for allowing more majors here. The theoretical + maximum is 244. + However, it's not recommended to use values higher than 16, as you + will end using unassigned numbers. So, unless you'll potentially + connect more than 256 SCSI disks, stay with the default (16). + Maximum number of SCSI tapes that can be loaded as modules CONFIG_ST_EXTRA_DEVS This controls the amount of additional space allocated in tables for diff -uNr linux-2.4.18.S18.scsimany4/drivers/char/sysrq.c linux-2.4.18.S18.scsimany/drivers/char/sysrq.c --- linux-2.4.18.S18.scsimany4/drivers/char/sysrq.c Wed Jun 12 11:37:02 2002 +++ linux-2.4.18.S18.scsimany/drivers/char/sysrq.c Fri Jul 26 02:42:04 2002 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -104,33 +105,31 @@ /* do_emergency_sync helper function */ /* Guesses if the device is a local hard drive */ static int is_local_disk(kdev_t dev) { - unsigned int major; - major = MAJOR(dev); - - switch (major) { - case IDE0_MAJOR: - case IDE1_MAJOR: - case IDE2_MAJOR: - case IDE3_MAJOR: - case IDE4_MAJOR: - case IDE5_MAJOR: - case IDE6_MAJOR: - case IDE7_MAJOR: - case IDE8_MAJOR: - case IDE9_MAJOR: - case SCSI_DISK0_MAJOR: - case SCSI_DISK1_MAJOR: - case SCSI_DISK2_MAJOR: - case SCSI_DISK3_MAJOR: - case SCSI_DISK4_MAJOR: - case SCSI_DISK5_MAJOR: - case SCSI_DISK6_MAJOR: - case SCSI_DISK7_MAJOR: - case XT_DISK_MAJOR: - return 1; - default: - return 0; + struct gendisk * gd = get_gendisk(dev); + if (gd && gd->major_name) { + if (!strcmp(gd->major_name, "hd")) /* IDE_MAJOR_NAME */ + return 1; + if (!strcmp(gd->major_name, "sd")) + return 1; + if (!strcmp(gd->major_name, "xd")) + return 1; + if (!strcmp(gd->major_name, "rd")) /* DAC960 */ + return 1; + if (!strcmp(gd->major_name, "dasd")) + return 1; + /* + * FIXME: More real devices missing ! + * i2o, iseriesvd, ppdd, pd, ftl, ed, ad, mfm, cbd, + * dos_hd, fd, pf + * + * What about meta devices, such as md, LVM, loop, ... + * + * Note that all disks with mounted filesystems are synced, + * only the ones listed here are considered stable and + * should be synced first. + */ } + return 0; } /* do_emergency_sync helper function */ diff -uNr linux-2.4.18.S18.scsimany4/drivers/scsi/Config.in linux-2.4.18.S18.scsimany/drivers/scsi/Config.in --- linux-2.4.18.S18.scsimany4/drivers/scsi/Config.in Mon Jul 15 14:37:57 2002 +++ linux-2.4.18.S18.scsimany/drivers/scsi/Config.in Fri Jul 26 01:51:49 2002 @@ -1,6 +1,9 @@ comment 'SCSI support type (disk, tape, CD-ROM)' dep_tristate ' SCSI disk support' CONFIG_BLK_DEV_SD $CONFIG_SCSI +if [ "$CONFIG_BLK_DEV_SD" != "n" ]; then + int 'Maximum number of SCSI major numbers' CONFIG_SD_MAX_MAJORS 16 +fi dep_tristate ' SCSI tape support' CONFIG_CHR_DEV_ST $CONFIG_SCSI diff -uNr linux-2.4.18.S18.scsimany4/drivers/scsi/aacraid/aachba.c linux-2.4.18.S18.scsimany/drivers/scsi/aacraid/aachba.c --- linux-2.4.18.S18.scsimany4/drivers/scsi/aacraid/aachba.c Fri Jul 26 03:30:02 2002 +++ linux-2.4.18.S18.scsimany/drivers/scsi/aacraid/aachba.c Fri Jul 26 03:26:18 2002 @@ -33,12 +33,11 @@ #include #include #include -//#define MAJOR_NR SCSI_DISK0_MAJOR /* For DEVICE_NR() */ +#define MAJOR_NR SCSI_DISK0_MAJOR /* For DEVICE_NR() */ #include #include "scsi.h" #include "hosts.h" #include "sd.h" -#include "sd_dynalloc.h" /* for KDEV_TO_DISKNO */ #include "aacraid.h" @@ -1004,7 +1003,7 @@ */ spin_unlock_irq(&io_request_lock); - fsa_dev_ptr->devno[cid] = KDEV_TO_DISKNO(scsicmd->request.rq_dev); + fsa_dev_ptr->devno[cid] = DEVICE_NR(scsicmd->request.rq_dev); ret = aac_read(scsicmd, cid); spin_lock_irq(&io_request_lock); return ret; diff -uNr linux-2.4.18.S18.scsimany4/drivers/scsi/sd_dynalloc.c linux-2.4.18.S18.scsimany/drivers/scsi/sd_dynalloc.c --- linux-2.4.18.S18.scsimany4/drivers/scsi/sd_dynalloc.c Wed Jul 17 15:19:23 2002 +++ linux-2.4.18.S18.scsimany/drivers/scsi/sd_dynalloc.c Fri Jul 26 03:24:55 2002 @@ -3,21 +3,28 @@ * (c) Kurt Garloff , 7/2002 * License: GNU GPL v2 */ -/* 2002-07-14: Initial write. (sd_many-2) +/* 2002-07-14: (sd_many-2) + * Initial write. * - * 2002-07-15: Fixes (sd_many-3) + * 2002-07-15: (sd_many-3) + * Fixes * Fix dynamic block major allocation to work with * non-devfs systems. * - * 2002-07-17: Reversed major mapping array: (sd_many-4) + * 2002-07-17: (sd_many-4) + * Reversed major mapping array: * We now map majors to an index in our ptr array. * Fix /proc/partitions by calling sd_devname() via gendisk * * TODO: - Check locking issues. - * - More intelligent reuse of sd slots - * - Proofread code + * - More intelligent reuse of sd slots(?) * - Remove debug printks * + * 2002-07-25: (sd_many-5) + * - Added the officially assigned SCSI majors 9--15. + * (Thanks to Pete Zaitvec for telling!) + * - Made maximum number of SCSI majors a config option + * - SysRq preference for all SCSI disk majors (Pete ...) */ @@ -110,14 +117,35 @@ } #ifndef CONFIG_DEVFS_FS -#define FIRST_MAJOR 127 // SCSI_DISK7_MAJOR would be another poss. choice +#define FIRST_MAJOR 143 static int sd_find_major (void) { + /* The get_blkfops() has the side-effect of triggering kmod + * on blockdevs. This makes it safe not to accidently + * take the major of sb. else. + * We try to avoid conflicts by allocating + * 8, 65--71, 128--135 ( 16, officially assigned to sd) + * 144--254 (111, not yet assigned) + * 72--127 ( 56, assigned to other devices) + * 136--143 ( 8, assigned to Mylex DAC960) + * 12-- 64 ( 53, assigned to other devices) + * Summary: 16 safe, 127 almost safe (poss. future confl.), + * 244 theoretical maximum, IOW 3904 disks. + */ int maj = FIRST_MAJOR; - /* This has the nasty side-effect of triggering kmod on blockdevs - * after FIRST_MAJOR. However, this also makes it safe not to - * use the major of sb. else. And: there is nobody ... KG. */ - while (++maj < (MAJORS-1)) + while (++maj < 255) /* 255 is RESERVED */ + if (!get_blkfops(maj)) + return maj; + maj = SCSI_DISK7_MAJOR; /* The search goes on */ + while (++maj < SCSI_DISK10_MAJOR) + if (!get_blkfops(maj)) + return maj; + maj = SCSI_DISK17_MAJOR; + while (++maj < FIRST_MAJOR) + if (!get_blkfops(maj)) + return maj; + maj = 11; + while (++maj < SCSI_DISK1_MAJOR) if (!get_blkfops(maj)) return maj; return SD_NO_MAJOR; @@ -141,6 +169,8 @@ major = SCSI_DISK0_MAJOR; else if (sd_majors < 8) major = SCSI_DISK1_MAJOR-1+sd_majors; + else if (sd_majors < 16) + major = SCSI_DISK10_MAJOR-8+sd_majors; else { #ifdef CONFIG_DEVFS_FS major = devfs_alloc_major(DEVFS_SPECIAL_BLK); @@ -186,7 +216,7 @@ dealloc_major: #ifdef CONFIG_DEVFS_FS - if (sd_majors >= 8) + if (sd_majors >= 16) devfs_dealloc_major(DEVFS_SPECIAL_BLK, major); #endif return SD_NO_MAJOR; @@ -208,7 +238,7 @@ blkdev_varyio[major] = NULL; blk_dev[major].queue = NULL; #ifdef CONFIG_DEVFS_FS - if (midx >= 8) + if (midx >= 16) devfs_dealloc_major(DEVFS_SPECIAL_BLK, major); #endif kfree (sd_major); diff -uNr linux-2.4.18.S18.scsimany4/drivers/scsi/sd_dynalloc.h linux-2.4.18.S18.scsimany/drivers/scsi/sd_dynalloc.h --- linux-2.4.18.S18.scsimany4/drivers/scsi/sd_dynalloc.h Wed Jul 17 14:08:13 2002 +++ linux-2.4.18.S18.scsimany/drivers/scsi/sd_dynalloc.h Fri Jul 26 02:49:42 2002 @@ -10,7 +10,8 @@ #include #include "sd.h" -#define MAX_SCSI_DYN_MAJORS 160 +/* Should default to the officially assigned 16 */ +#define MAX_SCSI_DYN_MAJORS CONFIG_SD_MAX_MAJORS #define MINORS (1U<> 4)) +/* The major calculation part duplicates SD_MAJOR_INDEX verbatim. */ +#define DEVICE_NR(device) \ + (( ( ((MAJOR(device) & 0x80) >> 4) + (MAJOR(device) & 7) ) << (8 - 4)) + \ + (MINOR(device) >> 4)) /* Kludge to use the same number for both char and block major numbers */ #elif (MAJOR_NR == MD_MAJOR) && defined(MD_DRIVER) diff -uNr linux-2.4.18.S18.scsimany4/include/linux/major.h linux-2.4.18.S18.scsimany/include/linux/major.h --- linux-2.4.18.S18.scsimany4/include/linux/major.h Wed Jun 12 11:37:13 2002 +++ linux-2.4.18.S18.scsimany/include/linux/major.h Fri Jul 26 02:32:42 2002 @@ -111,16 +111,25 @@ #define COMPAQ_CISS_MAJOR 104 #define COMPAQ_CISS_MAJOR1 105 -#define COMPAQ_CISS_MAJOR2 106 -#define COMPAQ_CISS_MAJOR3 107 -#define COMPAQ_CISS_MAJOR4 108 -#define COMPAQ_CISS_MAJOR5 109 -#define COMPAQ_CISS_MAJOR6 110 -#define COMPAQ_CISS_MAJOR7 111 +#define COMPAQ_CISS_MAJOR2 106 +#define COMPAQ_CISS_MAJOR3 107 +#define COMPAQ_CISS_MAJOR4 108 +#define COMPAQ_CISS_MAJOR5 109 +#define COMPAQ_CISS_MAJOR6 110 +#define COMPAQ_CISS_MAJOR7 111 #define ATARAID_MAJOR 114 -#define SCSI_CHANGER_MAJOR 86 +#define SCSI_CHANGER_MAJOR 86 + +#define SCSI_DISK10_MAJOR 128 +#define SCSI_DISK11_MAJOR 129 +#define SCSI_DISK12_MAJOR 130 +#define SCSI_DISK13_MAJOR 131 +#define SCSI_DISK14_MAJOR 132 +#define SCSI_DISK15_MAJOR 133 +#define SCSI_DISK16_MAJOR 134 +#define SCSI_DISK17_MAJOR 135 #define DASD_MAJOR 94 /* Official assignations from Peter */ @@ -173,7 +182,8 @@ */ #define SCSI_DISK_MAJOR(M) ((M) == SCSI_DISK0_MAJOR || \ - ((M) >= SCSI_DISK1_MAJOR && (M) <= SCSI_DISK7_MAJOR)) + ((M) >= SCSI_DISK1_MAJOR && (M) <= SCSI_DISK7_MAJOR) || \ + ((M) >= SCSI_DISK10_MAJOR && (M) <= SCSI_DISK17_MAJOR)) #define SCSI_BLK_MAJOR(M) \ (SCSI_DISK_MAJOR(M) \