Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: usb-storage: increase max_sectors for tape drives

This patch (as1203) increases the max_sector limit for USB tape
drives. By default usb-storage sets max_sectors to 240 (i.e., 120 KB)
for all devices. But tape drives need a higher limit, since tapes can
and do have very large block sizes. Without the ability to transfer
an entire large block in a single command, such tapes can't be used.

This fixes Bugzilla #12207.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: Phil Mitchell <philipm@sybase.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Alan Stern and committed by
Greg Kroah-Hartman
5c16034d 090b9011

+6
+6
drivers/usb/storage/scsiglue.c
··· 135 135 if (sdev->request_queue->max_sectors > max_sectors) 136 136 blk_queue_max_sectors(sdev->request_queue, 137 137 max_sectors); 138 + } else if (sdev->type == TYPE_TAPE) { 139 + /* Tapes need much higher max_sector limits, so just 140 + * raise it to the maximum possible (4 GB / 512) and 141 + * let the queue segment size sort out the real limit. 142 + */ 143 + blk_queue_max_sectors(sdev->request_queue, 0x7FFFFF); 138 144 } 139 145 140 146 /* Some USB host controllers can't do DMA; they have to use PIO.