From: Felipe Balbi Date: Mon, 18 Apr 2016 10:09:10 +0000 (+0300) Subject: usb: storage: scsiglue: limit USB3 devices to 2048 sectors X-Git-Tag: v4.7-rc1~93^2~64 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5b91dfe187bbe3a8116432016375f39fff91a237;p=karo-tx-linux.git usb: storage: scsiglue: limit USB3 devices to 2048 sectors 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 Acked-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 9da1fb3d0ff4..88920142e375 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -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.