On Wed, Aug 17, 2011 at 10:52:59PM -0700, Barry Song wrote: > From: Peiyu Li <peiyu.li@xxxxxxx> > > Now the mass storage driver has fixed logic block size of 512 bytes. > > The mass storage gadget read/write bound devices only through VFS, so the bottom level > devices actually are just RAW devices to the driver and connected PC. As a RAW, hosts > can always format, read and write it right in 512 bytes logic block and don't care about > the actual logic block size of devices bound to the gadget. > > But if we want to share the bound block device partition between target board and PC, > in case the logic block size of the bound block device is 4KB, we execute the following > steps: > 1. connect a board with mass storage gadget to PC(the board has set one partition of > on-board block device as file name of the mass storage) > 2. PC format the mass storage to VFAT by default logic block size and read/write it > 3. disconnect boards from PC > 4. target board mount the partition as VFAT > Step 4 will fail since kernel on target thinks the logic block size of the bound partition > as 4KB. > A typical error is > "FAT: logical sector size too small for device (logical sector size = 512)" > > If we execute opposite steps: > 1. format the partition to VFAT on target board and read/write this partition > 2. connect the board to Windows PC as usb mass storage gadget, windows will think the disk > is not formatted > > So the conclusion is that only as a gadget, the mass storage driver has no any problem. > But being shared VFAT or other filesystem on PC and target board, it will fail. > > This patch adapts logic block size to bound block devices and fix the issue. > > Cc: Michal Nazarewicz <mina86@xxxxxxxxxx> > Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> > Signed-off-by: Peiyu Li <peiyu.li@xxxxxxx> > Signed-off-by: Xianglong Du <xianglong.du@xxxxxxx> > Signed-off-by: Huayi Li <huayi.li@xxxxxxx> > Signed-off-by: Barry Song <Baohua.Song@xxxxxxx> applied, thanks -- balbi
Attachment:
signature.asc
Description: Digital signature