Re: [PATCH] USB-gadget: remove alignment assumption in mass-storage gadgets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 18, 2011 at 02:29:00PM -0400, Alan Stern wrote:
> 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@xxxxxxxxxxxxxxxxxxx>
> CC: Michal Nazarewicz <mina86@xxxxxxxxxx>

applied, thanks

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux