On Mon, 2012-11-12 at 15:31 +0100, Paolo Bonzini wrote:
> Il 12/11/2012 12:33, James Bottomley ha scritto:
> > On Fri, 2012-11-09 at 11:08 -0500, Jason J. Herne wrote:
> >> diff --git a/drivers/usb/storage/scsiglue.c
> >> b/drivers/usb/storage/scsiglue.c
> >> index 13b8bcd..6ff785e 100644
> >> --- a/drivers/usb/storage/scsiglue.c
> >> +++ b/drivers/usb/storage/scsiglue.c
> >> @@ -251,6 +251,11 @@ static int slave_configure(struct scsi_device
> >> *sdev)
> >>                                         US_FL_SCM_MULT_TARG)) &&
> >>                                 us->protocol == USB_PR_BULK)
> >>                         us->use_last_sector_hacks = 1;
> >> +
> >> +               /* Force read-16 for large capacity drives. */
> >> +               sdev->force_read_16 = 1;
> >> +
> >> +
> > 
> > This turns READ_16 on unconditionally for all USB disks ... is that
> > safe?  As in have you tested this with older USB thumb drives?
> 
> Actually it only turns it on for large capacity drives, as said in the
> comment.  sdp->force_read_16 only matters for >2TB drives: 

If you follow the discussion, we'll need to turn it on for some drives
regardless of size.

> >> +  /* Many large capacity USB drives/controllers require the use of 
> >> read(16). */
> >> +  force_read16 = (sdkp->capacity > 0xffffffffULL && sdp->force_read_16);
> >> +
> >>    if (host_dif == SD_DIF_TYPE2_PROTECTION) {
> >>            SCpnt->cmnd = mempool_alloc(sd_cdb_pool, GFP_ATOMIC);
> >>  
> >> @@ -833,7 +836,7 @@ static int sd_prep_fn(struct request_queue *q, struct 
> >> request *rq)
> >>            SCpnt->cmnd[29] = (unsigned char) (this_count >> 16) & 0xff;
> >>            SCpnt->cmnd[30] = (unsigned char) (this_count >> 8) & 0xff;
> >>            SCpnt->cmnd[31] = (unsigned char) this_count & 0xff;
> >> -  } else if (block > 0xffffffff) {
> >> +  } else if (block > 0xffffffff || force_read16) {
> 
> so the better name would be never_use_10_for_rw_on_large_disks.  For
> some definitions of better. :)

Hm.

> Any reason not to do this always on >2TB drives, which basically means
> changing this:
> 
> -     } else if (block > 0xffffffff) {
> +     } else if (sdkp->capacity > 0xffffffff) {
> 
> and nothing else?

Because of the coming T10 mandate in SBC-4 deprecating everything other
than the 16 byte commands.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" 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