diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2011-08-18 14:29:00 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-09-09 13:06:03 +0300 |
commit | 04eee25b1d754a837360504b7af426d1f86ffeb7 (patch) | |
tree | dbfc8c0087143db8f039c4e41887c21a3f52233f /drivers/usb/c67x00 | |
parent | 3f565a363cee14d2ed281823196d455bfc7c4170 (diff) |
USB: gadget: storage: remove alignment assumption
This patch (as1481) fixes a problem affecting g_file_storage and
g_mass_storage when running at SuperSpeed. The two drivers currently
assume that the bulk-out maxpacket size can evenly divide the SCSI
block size, which is 512 bytes. But SuperSpeed bulk endpoints have a
maxpacket size of 1024, so the assumption is no longer true.
This patch removes that assumption from the drivers, by getting rid of
a small optimization (they try to align VFS reads and writes on page
cache boundaries). If a command's starting logical block address is
512 bytes below the end of a page, it's not okay to issue a USB
command for just those 512 bytes when the maxpacket size is 1024 -- it
would result in either babble (for an OUT transfer) or a short packet
(for an IN transfer).
Also, for backward compatibility, the test for writes extending beyond
the end of the backing storage has to be changed. If the host tries
to do this, we should accept the data that fits in the backing storage
and ignore the rest. Because the storage's end may not align with a
USB packet boundary, this means we may have to accept a USB OUT
transfer that extends beyond the end of the storage and then write out
only the part of the data that fits.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/c67x00')
0 files changed, 0 insertions, 0 deletions