On Mon, 2015-02-09 at 11:10 -0500, Alan Stern wrote:
> On Mon, 9 Feb 2015, Oliver Neukum wrote:
> 
> > This is necessary to make some storage arrays work.
> > 
> > Some storage devices have more than 8 LUNs. In addition
> > you can hook up a WideSCSI bus to USB. In these cases even
> > level 2 devices can have more than 8 devices. For them
> > it is necessary to simply believe the class specific
> > command and report its result back to the SCSI layer.
> > 
> > Signed-off-by: Oliver Neukum <oneu...@suse.de>
> > ---
> >  drivers/usb/storage/usb.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
> > index d468d02..cf2fafb 100644
> > --- a/drivers/usb/storage/usb.c
> > +++ b/drivers/usb/storage/usb.c
> > @@ -889,6 +889,12 @@ static void usb_stor_scan_dwork(struct work_struct 
> > *work)
> >         !(us->fflags & US_FL_SCM_MULT_TARG)) {
> >             mutex_lock(&us->dev_mutex);
> >             us->max_lun = usb_stor_Bulk_max_lun(us);
> > +           /*
> > +            * Allow proper scanning of devices that present more than 8 
> > LUNs
> > +            * While not affecting other devices that may need the previous 
> > behavior
> > +            */
> > +           if (us->max_lun > 8)
> 
> >= 8, not > 8.  Or, if you prefer, > 7.
> 
> > +                   us_to_host(us)->max_lun = us->max_lun+1;
> 
> What about the fact that you may be overriding max_scsi_luns?

As far as I can tell scsi_sequential_lun_scan() will prevent that by
max_dev_lun = min(max_scsi_luns, shost->max_lun);

> Also, since the protocol allows only 4 bits for the LUN value, would it 
> be safer to use min(us->max_lun+1, 16)?

usb_stor_Bulk_max_lun() will always return a number between 0 and 15

        Regards
                Oliver



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to