Skip to contentSkip to conversation

1/6: scsi_largelun and scsi_sparselun

PATCH In review Kurt Garloff 2 participants 3 messages Apr 18, 2004 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 1/6: scsi_largelun and scsi_sparselun

Feature.

Three new kernel/module parameters that affect SCSI scanning, all relevant for SCSI-2 only, as for SCSI-3, REPORT_LUNS is normally used:
* scsi_sparselun allows the user to disable the Linux scanning optimization that assumes that LUNs are consecutive. Equivalent to setting BLIST_SPARSELUN blacklist entry for all devices.
* scsi_largelun alloes the user to disable the check to need SCSI-3 to allow LUNs >= 8. Equivalent to a global BLIST_LARGELUN.
* max_scsi_sparseluns: Allows to set a different limit for targets with sparse LUN numbering.

drivers/scsi/scsi_scan.c renamed from drivers/scsi/scsi_scan.c.orig +19 -3
@@ -80,6 +80,21 @@ module_param_named(max_luns, max_scsi_lu
 MODULE_PARM_DESC(max_luns,
 		 "last scsi LUN (should be between 1 and 2^32-1)");
 
+static int scsi_sparselun;
+module_param_named(scsi_sparselun, scsi_sparselun, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(scsi_sparselun,
+		 "Assume sparse LUNs for all SCSI devices");
+
+static int scsi_largelun;
+module_param_named(scsi_largelun, scsi_largelun, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(scsi_largelun,
+		 "Assume all SCSI-2 devs support more than 8 LUNs");
+
+static unsigned int max_scsi_sparseluns;
+module_param_named(max_scsi_sparseluns, max_scsi_sparseluns, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(max_scsi_sparseluns,
+		 "Limit LUNs for scanning sparse LUN devices");
+
 #ifdef CONFIG_SCSI_REPORT_LUNS
 /*
  * max_scsi_report_luns: the maximum number of LUNS that will be
@@ -800,8 +815,9 @@ static void scsi_sequential_lun_scan(str
 	 * override the other settings, and scan all of them. Normally,
 	 * SCSI-3 devices should be scanned via the REPORT LUNS.
 	 */
-	if (bflags & BLIST_SPARSELUN) {
-		max_dev_lun = shost->max_lun;
+	if (bflags & BLIST_SPARSELUN || scsi_sparselun) {
+		max_dev_lun = min(shost->max_lun, max_scsi_sparseluns? 
+				  max_scsi_sparseluns: max_scsi_luns);
 		sparse_lun = 1;
 	} else
 		sparse_lun = 0;
@@ -845,7 +861,7 @@ static void scsi_sequential_lun_scan(str
 	 * Do not scan SCSI-2 or lower device past LUN 7, unless
 	 * BLIST_LARGELUN.
 	 */
-	if (scsi_level < SCSI_3 && !(bflags & BLIST_LARGELUN))
+	if (scsi_level < SCSI_3 && !(bflags & BLIST_LARGELUN) && !scsi_largelun)
 		max_dev_lun = min(8U, max_dev_lun);
 
 	/*
Signature · 2 lines
Kurt Garloff  <[email protected]>                            Cologne, DE 
SUSE LINUX AG, Nuernberg, DE                          SUSE Labs (Head)
#1 lore raw

drivers/scsi/scsi_scan.c module_param_named(max_luns, max_scsi_lu · line 91

Quoted 9 lines · Kurt Garloff
drivers/scsi/scsi_scan.c renamed from drivers/scsi/scsi_scan.c.orig +9 -0
+static int scsi_sparselun;
+module_param_named(scsi_sparselun, scsi_sparselun, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(scsi_sparselun,
+		 "Assume sparse LUNs for all SCSI devices");
+
+static int scsi_largelun;
+module_param_named(scsi_largelun, scsi_largelun, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(scsi_largelun,
+		 "Assume all SCSI-2 devs support more than 8 LUNs");

The names are badly chosen. On the bootline commandline they already have a scsi_mod. prefix, so the additional scsi_ is superflous.

#2 lore raw
Quoted 3 lines · Christoph Hellwig

drivers/scsi/scsi_scan.c module_param_named(max_luns, max_scsi_lu · line 84

Quoted 2 lines · Kurt Garloff
drivers/scsi/scsi_scan.c renamed from drivers/scsi/scsi_scan.c.orig +2 -0
+static int scsi_sparselun;
+module_param_named(scsi_sparselun, scsi_sparselun, int, S_IRUGO|S_IWUSR);
                        ^^^^^
Quoted 1 line
Quoted 1 line

+MODULE_PARM_DESC(scsi_sparselun,

                      ^^^^^
Quoted 4 lines

drivers/scsi/scsi_scan.c module_param_named(max_luns, max_scsi_lu · line 89

Quoted 4 lines
drivers/scsi/scsi_scan.c renamed from drivers/scsi/scsi_scan.c.orig +4 -0
+		 "Assume sparse LUNs for all SCSI devices");
+
+static int scsi_largelun;
+module_param_named(scsi_largelun, scsi_largelun, int, S_IRUGO|S_IWUSR);
                        ^^^^^
Quoted 1 line
Quoted 1 line

+MODULE_PARM_DESC(scsi_largelun,

                      ^^^^^
Quoted 4 lines

drivers/scsi/scsi_scan.c module_param_named(max_luns, max_scsi_lu · line 91

Quoted 1 line
drivers/scsi/scsi_scan.c renamed from drivers/scsi/scsi_scan.c.orig +1 -0
+		 "Assume all SCSI-2 devs support more than 8 LUNs");

The names are badly chosen. On the bootline commandline they already have a scsi_mod. prefix, so the additional scsi_ is superflous.

Good point, so I'll remove all scsi_ prefixes.

Regards,

Signature · 3 lines
Kurt Garloff                   <[email protected]>             [Koeln, DE]
Physics:Plasma modeling <[email protected]> [TU Eindhoven, NL]
Linux: SUSE Labs (Head)        <[email protected]>    [SUSE Nuernberg, DE]