6/6: llun_blklst
PATCH 1/1 6/6: llun_blklst
Feature.
This patch alloes the user to set the flags BLIST_LARGELUN|BLIST_SPARSELUN for single devices (up to 8) by specifying
llun_blklst=C,B,T[C,B,T[,...]
where C,B,T is the host controller number, the channel number and the SCSI target ID of the SCSI device resp.
This is mainly useful for arrays that report as SCSI-2, where REPORT_LUNS is not used. It's more selective than the global scsi_sparselun and _largelun paramters.
drivers/scsi/scsi_scan.c renamed from drivers/scsi/scsi_scan.c.orig +54 -2
@@ -142,6 +142,56 @@ MODULE_PARM_DESC(scsi_inq_timeout,"Timeout (in seconds) waiting for devices to answer INQUIRY." " Default is 6. Some non-compliant devices need more."); +#define MAX_LLUN_BLKLEN 8 +static int llun_blklst[3 *MAX_LLUN_BLKLEN ] = { +-1 ,-1 ,-1 ,-1 ,-1 ,-1 , +-1 ,-1 ,-1 ,-1 ,-1 ,-1 , +-1 ,-1 ,-1 ,-1 ,-1 ,-1 , +-1 ,-1 ,-1 ,-1 ,-1 ,-1 }; + +MODULE_PARM (llun_blklst,"3-24i" ); +MODULE_PARM_DESC (llun_blklst,"SCSI-2 devs (C,B,T) that need LARGELUN|SPARSELUN support" ); + +static int __init llun_blklst_setup (char *str) +{ +unsigned int tmp; +int i =0 ; +do { +int rc; +if (get_option (&str, &tmp) ==2 ) + llun_blklst[i++] = tmp; +else +break ; +if (get_option (&str, &tmp) ==2 ) + llun_blklst[i++] = tmp; +else +break ; +if ((rc =get_option (&str, &tmp)) >=1 ) + llun_blklst[i++] = tmp; +if (rc !=2 ) +break ; + }while (1 ); +return i; +} +__setup ("llun_blklst=" , llun_blklst_setup); + +static inline int is_on_llun_blklst (int hostno,int channel,int target) +{ +int i; +for (i =0 ; i <MAX_LLUN_BLKLEN ; ++i) { +if (llun_blklst[i*3 ] ==-1 ) +break ; +if (llun_blklst[i*3 +0 ] == hostno && + llun_blklst[i*3 +1 ] == channel && + llun_blklst[i*3 +2 ] == target) { +printk (KERN_DEBUG "Found c%ib%it%i on llun_blklst\n" , + hostno, channel, target); +return 1 ; + } + } +return 0 ; +} +/** * scsi_unlock_floptical - unlock device via a special MODE SENSE command * @sreq: used to send the command
@@ -847,7 +897,8 @@ 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 || scsi_sparselun) { +if (bflags &BLIST_SPARSELUN || scsi_sparselun || +is_on_llun_blklst (shost->host_no, channel, id)) { max_dev_lun =min (shost->max_lun, max_scsi_sparseluns? max_scsi_sparseluns: max_scsi_luns); sparse_lun =1 ;
@@ -893,7 +944,8 @@ 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 ) && !scsi_largelun) +if (scsi_level <SCSI_3 && !(bflags &BLIST_LARGELUN ) && !scsi_largelun && + !is_on_llun_blklst (shost->host_no, channel, id)) 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)