public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Ramya Desai <ramya.desai@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	James Bottomley <James.Bottomley@suse.de>,
	USB list <linux-usb@vger.kernel.org>,
	SCSI development list <linux-scsi@vger.kernel.org>,
	Greg KH <greg@kroah.com>
Subject: Re: Maximum data size in a single transfer for MS driver
Date: Wed, 24 Feb 2010 14:12:11 +0100	[thread overview]
Message-ID: <20100224131211.GA1025@kernel.dk> (raw)
In-Reply-To: <3e7aae31002240507r5d5c4c2bj8e653a3d65fa6709@mail.gmail.com>

On Wed, Feb 24 2010, Ramya Desai wrote:
> On Tue, Feb 23, 2010 at 11:31 PM, Alan Stern <stern@rowland.harvard.edu> 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-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-02-24 13:12 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-17 12:37 Maximum data size in a single transfer for MS driver Ramya Desai
     [not found] ` <3e7aae31002170437i52ba4ba1w10c1ff224d9b37ef-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-02-17 15:02   ` James Bottomley
2010-02-18  8:46     ` Ramya Desai
2010-02-18 15:47       ` James Bottomley
     [not found]         ` <1266508049.4355.37.camel-0iu6Cu4xQGLYCGPCin2YbQ@public.gmane.org>
2010-02-18 16:24           ` Alan Stern
     [not found]             ` <Pine.LNX.4.44L0.1002181115120.1294-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2010-02-18 16:30               ` James Bottomley
     [not found]                 ` <1266510627.4355.41.camel-0iu6Cu4xQGLYCGPCin2YbQ@public.gmane.org>
2010-02-18 16:51                   ` Alan Stern
2010-02-19 12:43         ` Ramya Desai
2010-02-19 14:26           ` James Bottomley
2010-02-22 12:50             ` Ramya Desai
     [not found]               ` <3e7aae31002220450o6f83d2f3n45c795d70ef01f72-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-02-22 13:06                 ` James Bottomley
2010-02-22 14:15                   ` Ramya Desai
2010-02-22 17:44                   ` Alan Stern
2010-02-22 18:07                     ` Alan Stern
     [not found]                     ` <Pine.LNX.4.44L0.1002221232160.1251-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2010-02-23 15:29                       ` Ramya Desai
2010-02-23 16:49                         ` Alan Stern
2010-02-23 17:00                           ` Martin K. Petersen
2010-02-23 18:01                             ` Alan Stern
     [not found]                               ` <Pine.LNX.4.44L0.1002231253320.1308-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2010-02-24 13:07                                 ` Ramya Desai
2010-02-24 13:12                                   ` Jens Axboe [this message]
2010-02-24 16:30                                   ` Alan Stern
2010-02-24 19:07                                     ` Jens Axboe
2010-02-25 14:47                                       ` Ramya Desai
2010-02-25 14:44                                     ` Ramya Desai
2010-02-25 16:37                             ` Alan Stern
2010-02-25 16:49                               ` Martin K. Petersen
2010-02-25 16:53                                 ` Martin K. Petersen
2010-02-25 17:54                                   ` Jens Axboe
     [not found]                                   ` <yq1zl2xl0j3.fsf-+q57XtR/GgMb6DWv4sQWN6xOck334EZe@public.gmane.org>
2010-02-25 18:28                                     ` Alan Stern
2010-02-25 19:05                                       ` Martin K. Petersen
     [not found]                                         ` <yq1iq9lkueh.fsf-+q57XtR/GgMb6DWv4sQWN6xOck334EZe@public.gmane.org>
2010-02-25 19:47                                           ` Alan Stern
2010-02-26  3:37                                             ` Martin K. Petersen
     [not found]                               ` <Pine.LNX.4.44L0.1002251132170.1686-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2010-02-25 17:52                                 ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2010-02-25 16:59 scameron
2010-02-25 17:00 ` scameron
2010-02-25 17:18 ` scameron
2010-02-25 17:28   ` Martin K. Petersen
2010-02-25 17:41     ` Boaz Harrosh
2010-02-25 17:58       ` Martin K. Petersen
2010-02-25 19:07       ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100224131211.GA1025@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=James.Bottomley@suse.de \
    --cc=greg@kroah.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ramya.desai@gmail.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox