Commit fded8abe authored by James Bottomley's avatar James Bottomley

SCSI: make SCSI REPORT LUNS the default

From: garloff@suse.de

Cleanup/Feature

Remove CONFIG_SCSI_REPORT_LUNS config option.
Instead provide BLIST_NOREPORTLUN that can be passed as default_dev_flags
(but also per device if needed).
Provide BLIST_REPORTLUN2 that allows trying to use REPORT_LUNS for SCSI-2
devices, if they are connected to a host adapter supporting more than 8 LUNs
(and thus avoiding the usual USB crap to render this feature useless when
used with default_dev_flags).

 drivers/scsi/Kconfig        |   11 -----------
 drivers/scsi/scsi_scan.c    |   19 +++++++++----------
 include/scsi/scsi_devinfo.h |    3 +++
 3 files changed, 12 insertions(+), 21 deletions(-)
parent 71d5da93
...@@ -152,17 +152,6 @@ config SCSI_MULTI_LUN ...@@ -152,17 +152,6 @@ config SCSI_MULTI_LUN
so most people can say N here. The max_luns boot/module parameter so most people can say N here. The max_luns boot/module parameter
allows to override this setting. allows to override this setting.
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 config SCSI_CONSTANTS
bool "Verbose SCSI error reporting (kernel size +=12K)" bool "Verbose SCSI error reporting (kernel size +=12K)"
depends on SCSI depends on SCSI
......
...@@ -80,7 +80,6 @@ module_param_named(max_luns, max_scsi_luns, int, S_IRUGO|S_IWUSR); ...@@ -80,7 +80,6 @@ module_param_named(max_luns, max_scsi_luns, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(max_luns, MODULE_PARM_DESC(max_luns,
"last scsi LUN (should be between 1 and 2^32-1)"); "last scsi LUN (should be between 1 and 2^32-1)");
#ifdef CONFIG_SCSI_REPORT_LUNS
/* /*
* max_scsi_report_luns: the maximum number of LUNS that will be * max_scsi_report_luns: the maximum number of LUNS that will be
* returned from the REPORT LUNS command. 8 times this value must * returned from the REPORT LUNS command. 8 times this value must
...@@ -88,13 +87,12 @@ MODULE_PARM_DESC(max_luns, ...@@ -88,13 +87,12 @@ MODULE_PARM_DESC(max_luns,
* in practice, the maximum number of LUNs suppored by any device * in practice, the maximum number of LUNs suppored by any device
* is about 16k. * 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_param_named(max_report_luns, max_scsi_report_luns, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(max_report_luns, MODULE_PARM_DESC(max_report_luns,
"REPORT LUNS maximum number of LUNS received (should be" "REPORT LUNS maximum number of LUNS received (should be"
" between 1 and 16384)"); " between 1 and 16384)");
#endif
/** /**
* scsi_unlock_floptical - unlock device via a special MODE SENSE command * scsi_unlock_floptical - unlock device via a special MODE SENSE command
...@@ -864,7 +862,6 @@ static void scsi_sequential_lun_scan(struct Scsi_Host *shost, uint channel, ...@@ -864,7 +862,6 @@ static void scsi_sequential_lun_scan(struct Scsi_Host *shost, uint channel,
return; return;
} }
#ifdef CONFIG_SCSI_REPORT_LUNS
/** /**
* scsilun_to_int: convert a scsi_lun to an int * scsilun_to_int: convert a scsi_lun to an int
* @scsilun: struct scsi_lun to be converted. * @scsilun: struct scsi_lun to be converted.
...@@ -925,9 +922,14 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, ...@@ -925,9 +922,14 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags,
u8 *data; u8 *data;
/* /*
* Only support SCSI-3 and up devices. * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set.
* Also allow SCSI-2 if BLIST_REPORTLUN2 is set and host adapter does
* support more than 8 LUNs.
*/ */
if (sdev->scsi_level < SCSI_3) if ((bflags & BLIST_NOREPORTLUN) ||
sdev->scsi_level < SCSI_2 ||
(sdev->scsi_level < SCSI_3 &&
(!(bflags & BLIST_REPORTLUN2) || sdev->host->max_lun <= 8)) )
return 1; return 1;
if (bflags & BLIST_NOLUN) if (bflags & BLIST_NOLUN)
return 0; return 0;
...@@ -1091,9 +1093,6 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, ...@@ -1091,9 +1093,6 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags,
printk(ALLOC_FAILURE_MSG, __FUNCTION__); printk(ALLOC_FAILURE_MSG, __FUNCTION__);
return 0; 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, struct scsi_device *scsi_add_device(struct Scsi_Host *shost,
uint channel, uint id, uint lun) uint channel, uint id, uint lun)
......
...@@ -21,4 +21,7 @@ ...@@ -21,4 +21,7 @@
#define BLIST_MS_SKIP_PAGE_3F 0x4000 /* do not send ms page 0x3f */ #define BLIST_MS_SKIP_PAGE_3F 0x4000 /* do not send ms page 0x3f */
#define BLIST_USE_10_BYTE_MS 0x8000 /* use 10 byte ms before 6 byte ms */ #define BLIST_USE_10_BYTE_MS 0x8000 /* use 10 byte ms before 6 byte ms */
#define BLIST_MS_192_BYTES_FOR_3F 0x10000 /* 192 byte ms page 0x3f request */ #define BLIST_MS_192_BYTES_FOR_3F 0x10000 /* 192 byte ms page 0x3f request */
#define BLIST_REPORTLUN2 0x20000 /* try REPORT_LUNS even for SCSI-2 devs
(if HBA supports more than 8 LUNs) */
#define BLIST_NOREPORTLUN 0x40000 /* don't try REPORT_LUNS scan (SCSI-3 devs) */
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment