Skip to contentSkip to conversation

2/6: scsi_noreportlun and scsi_reportlun2

PATCH New Kurt Garloff 1 participant 1 message Apr 18, 2004 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2/6: scsi_noreportlun and scsi_reportlun2

Feature.

Remove CONFIG_SCSI_REPORT_LUNS config option.
Instead provide two boot/module parameters that affect SCSI scanning:

* scsi_noreportlun:
Allows the user to disable the use of REPORT_LUNS during SCSI scanning.
* scsi_reportlun2:
Tell the kernel to try REPORT_LUNS for scanning also for SCSI-2 devices, if the host adapter supports more than 8 LUNs.

 Kconfig     |   11 -----------
 scsi_scan.c |   29 ++++++++++++++++++++---------
 2 files changed, 20 insertions(+), 20 deletions(-)
drivers/scsi/Kconfig +0 -11
diff -uNrp linux-2.6.5/drivers/scsi/Kconfig linux-2.6.5.replun2/drivers/scsi/Kconfig
@@ -170,17 +170,6 @@ config SCSI_MULTI_LUN
 	  so most people can say N here and should in fact do so, because it
 	  is safer.
 
-config SCSI_REPORT_LUNS
-	bool "Build with SCSI REPORT LUNS support"
-	depends on SCSI
-	default y
-	help
-	  If you want support for SCSI REPORT LUNS, say Y here.
-	  The REPORT LUNS command is useful for devices (such as disk arrays)
-	  with large numbers of LUNs where the LUN values are not contiguous
-	  (sparse LUN).  REPORT LUNS scanning is done only for SCSI-3 devices.
-	  Most users can safely answer N here.
-
 config SCSI_CONSTANTS
 	bool "Verbose SCSI error reporting (kernel size +=12K)"
 	depends on SCSI
drivers/scsi/scsi_scan.c +20 -9
diff -uNrp linux-2.6.5/drivers/scsi/scsi_scan.c linux-2.6.5.replun2/drivers/scsi/scsi_scan.c
@@ -95,7 +95,6 @@ module_param_named(max_scsi_sparseluns, 
 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
  * returned from the REPORT LUNS command. 8 times this value must
@@ -103,13 +102,23 @@ MODULE_PARM_DESC(max_scsi_sparseluns,
  * in practice, the maximum number of LUNs suppored by any device
  * is about 16k.
  */
-static unsigned int max_scsi_report_luns = 128;
+static unsigned int max_scsi_report_luns = 511;
 
 module_param_named(max_report_luns, max_scsi_report_luns, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(max_report_luns,
 		 "REPORT LUNS maximum number of LUNS received (should be"
 		 " between 1 and 16384)");
-#endif
+
+static int scsi_noreportlun;
+module_param_named(scsi_noreportlun, scsi_noreportlun, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(scsi_noreportlun,
+		 "Don't use REPORT_LUNs for scanning SCSI-3 devs");
+
+static int scsi_reportlun2;
+module_param_named(scsi_reportlun2, scsi_reportlun2, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(scsi_reportlun2,
+		 "Use REPORT_LUNs for scanning SCSI-2 devs as well");
+
 
 /**
  * scsi_unlock_floptical - unlock device via a special MODE SENSE command
@@ -876,7 +885,6 @@ static void scsi_sequential_lun_scan(str
 			return;
 }
 
-#ifdef CONFIG_SCSI_REPORT_LUNS
 /**
  * scsilun_to_int: convert a scsi_lun to an int
  * @scsilun:	struct scsi_lun to be converted.
@@ -937,9 +945,15 @@ static int scsi_report_lun_scan(struct s
 	u8 *data;
 
 	/*
-	 * Only support SCSI-3 and up devices.
+	 * Only support SCSI-3 devices unless scsi_noreportlun is set.
+	 * SCSI-2 is supported is scsi_reportlun2 is set and the host
+	 * adapter claims to support more than 8 LUNS (likely FC). 
 	 */
-	if (sdev->scsi_level < SCSI_3)
+	
+	if ( scsi_noreportlun ||
+	     sdev->scsi_level < SCSI_2 || 
+	    (sdev->scsi_level < SCSI_3 &&
+	     (!scsi_reportlun2 || sdev->host->max_lun <= 8)))
 		return 1;
 	if (bflags & BLIST_NOLUN)
 		return 0;
@@ -1103,9 +1117,6 @@ static int scsi_report_lun_scan(struct s
 	printk(ALLOC_FAILURE_MSG, __FUNCTION__);
 	return 0;
 }
-#else
-# define scsi_report_lun_scan(sdev, blags, rescan)	(1)
-#endif	/* CONFIG_SCSI_REPORT_LUNS */
 
 struct scsi_device *scsi_add_device(struct Scsi_Host *shost,
 				    uint channel, uint id, uint lun)
Signature · 2 lines
Kurt Garloff  <[email protected]>                            Cologne, DE 
SUSE LINUX AG, Nuernberg, DE                          SUSE Labs (Head)