Re: [PATCH] gadget: mass_storage: make mass_storage support multi-luns with different logic block size

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

 



2011/10/18 yingchun li <sword.l.dragon@xxxxxxxxx>:
> On Wed, Oct 12, 2011 at 9:36 AM, Barry Song <Baohua.Song@xxxxxxx> wrote:
>> From: YuPing Luo <yuping.luo@xxxxxxx>
>>
>> With Peiyu's patch "gadget: mass_storage: adapt logic block size to bound block
>> devices" (http://www.spinics.net/lists/linux-usb/msg50791.html), now mass storage
>> can adjust logic block size dynamically based on real devices.
>> Then there is one issue caused by it, if two luns have different logic block size,
>> mass storage can't work.
>> Let's check the current software flow:
>> 1. get_next_command(): call received_cbw();
>> 2. received_cbw(): update common->lun = cbw->Lun, but common->curlen is not updated;
>> 3. do_scsi_command(): in READ_X and WRITE_X commands, common->data_size_from_cmnd is
>> updated by common->curlun->blkbits;
>> 4. check_command(): update common->curlun according to common->lun
>> As you can see, the step 3 uses wrong common->curlun, then wrong common->curlun->blkbits.
>> If the two luns have same blkbits, there isn't issue. Otherwise, both will fail.
>> This patch moves the common->curlun update to step 2(received_cbw()), then make sure
>> step 3 gets right blkbits and right data_size_from_cmnd.
>>
>> Cc: Peiyu Li <peiyu.li@xxxxxxx>
>> Signed-off-by: YuPing Luo <yuping.luo@xxxxxxx>
>> Signed-off-by: Barry Song <Baohua.Song@xxxxxxx>
>> ---
>>  drivers/usb/gadget/f_mass_storage.c |   20 +++++++++++++++++---
>>  drivers/usb/gadget/file_storage.c   |   20 ++++++++++++++++++--
>>  2 files changed, 35 insertions(+), 5 deletions(-)

>
> Does this mean usb mass storage gadget can be uses as CDROM and disk
> simutaneously? I wan't to export two media to PC, one is normal usb-disk,
> one is CDROM.

not sure it can work now. but definitely this patch makes the driver
closer to what you want.

you might test, if fail, you send patch.

>
> Br,
> yingchun
-barry
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

  Powered by Linux