usb: storage: scsiglue: limit USB3 devices to 2048 sectors
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 18 Apr 2016 10:09:10 +0000 (13:09 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Apr 2016 22:04:38 +0000 (15:04 -0700)
USB3 devices, because they are much newer, have much
less chance of having issues with larger transfers.

We still keep a limit because anything above 2048
sectors really rendered negligible speed
improvements, so we will simply ignore
that. Transferring 1MiB should already give us
pretty good performance.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/storage/scsiglue.c

index 9da1fb3..8892014 100644 (file)
@@ -133,6 +133,11 @@ static int slave_configure(struct scsi_device *sdev)
                 * let the queue segment size sort out the real limit.
                 */
                blk_queue_max_hw_sectors(sdev->request_queue, 0x7FFFFF);
+       } else if (us->pusb_dev->speed >= USB_SPEED_SUPER) {
+               /* USB3 devices will be limited to 2048 sectors. This gives us
+                * better throughput on most devices.
+                */
+               blk_queue_max_hw_sectors(sdev->request_queue, 2048);
        }
 
        /* Some USB host controllers can't do DMA; they have to use PIO.