Re: Maximum data size in a single transfer for MS driver

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

 



On Wed, Feb 24 2010, Ramya Desai wrote:
> On Tue, Feb 23, 2010 at 11:31 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> 
> Dear Alan,
> 
> Thanks a lot.
> 
> > So Ramya, it looks like you need to edit store_max_sectors() in
> > drivers/usb/storage/scsiglue.c.  Get rid of the " && ms <=
> > SCSI_DEFAULT_MAX_SECTORS" part.
> >
> > Then you should be able to write a large value to
> > /sys/block/sdX/device/max_sectors to increase the hardware limit.  The
> > new value divided by 2 will show up in
> > /sys/block/sdX/queue/max_hw_sectors_kb.
> >
> > Once that limit is increased, you can write a large value to
> > /sys/block/sdX/queue/max_sectors_kb.  That should give you long
> > transfer lengths.
> 
> I did exactly. I removed the following statement from
> store_max_sectors (drivers/usb/storage/scsiglue.c) function.
> " && ms <= SCSI_DEFAULT_MAX_SECTORS". I also changed the .max_sectors
> = 2048 in the host template.
> 
> Then I restarted the system and build the usb-storage without any issue.
> 
> After inserting my device, I found 1024 in
> /sys/block/sdb/device/max_sectors. So, I tried to increase the value
> through echo 2048 > /sys/block/sdb/device/max_sectors. When I do this,
> it invoked the store_max_sectors() in the scsiglue.c file and able to
> see ms (the variable in the store_max_sectors()) is 2048. But, the
> value in the /sys/block/sdb/device/max_sectors is still 1024 only.
> 
> When I looked into the /sys/block/sdb/queue/max_hw_sectors_kb, it
> shows 1024, which is 2048 sectors. Then, I tried to increase the value
> in /sys/block/sdb/queue/max_sectors_kb through echo 1024 >
> /sys/block/sdb/queue/max_sectors_kb. After this, I saw 1024 in the
> /sys/block/sdb/queue/max_sectors_kb. When I see 1024 in
> /sys/block/sdb/queue/max_sectors_kb then I found 2048 in
> /sys/block/sdb/device/max_sectors. However, this time, still my device
> received 512 KB (1024) data transfer buffers in scsi_command.
> 
> Please let me know If I missed any thing here?

You cannot make max_sectors_kb larger than max_hw_sectors_kb, as the
latter implies a hardware restriction (as seen by the block layer).
Drivers should not fiddle with max_sectors_kb, they should only concern
themselves with max_hw_sectors. The former is then set to a reasonable
value, which is either the system default or the hardware limit, which
ever one is lower.

-- 
Jens Axboe

--
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