From: Doug Ledford <dledford@redhat.com>
To: Douglas Gilbert <dougg@torque.net>,
Andries.Brouwer@cwi.nl, linux-scsi@vger.kernel.org,
usb-storage@one-eyed-alien.net
Subject: Re: [usb-storage] Re: 2 PATCHES: fix request_tranferlength
Date: Wed, 31 Jul 2002 01:14:27 -0400 [thread overview]
Message-ID: <20020731011427.C27756@redhat.com> (raw)
In-Reply-To: <20020730212909.A1546@one-eyed-alien.net>; from mdharm-scsi@one-eyed-alien.net on Tue, Jul 30, 2002 at 09:29:09PM -0700
On Tue, Jul 30, 2002 at 09:29:09PM -0700, Matthew Dharm wrote:
> On Tue, Jul 30, 2002 at 09:40:12AM -0400, Douglas Gilbert wrote:
> > Matthew Dharm wrote:
> > >
> > > Out of curiosity... which value does the sg interface pass through? It
> > > collects both the buffer length and the requested transfer length, if my
> > > memory serves...
> >
> > Matt,
> > The sg driver does not attempt to decode SCSI commands (and,
> > for example, calculate allocation lengths) but simply passes
> > them through. In the sg_io_hdr interface what the user gives
> > as dxfer_len becomes the 4th argument to scsi_do_req() and
> > hence becomes Scsi_Request::sr_bufflen in the mid and lower
> > levels. The cumulative length of the elements in scatter gather
> > list built by sg (or the single buffer) is greater than or
> > equal to dxfer_len.
>
> Hrm....
>
> Are you saying then that the sum of the sg segments can be greater than the
> requested length?
>
> After some discussions with Linus and others, I was under the impression
> that this was a no-no...
Only if the last element in the list were allowed to be oversized.
Obviously, if element 2 in a 3 element list has a size that was larger
than it should be then the sg DMA code would end up dropping the data in
the wrong place. All the sizes on the sg segments up to the last one must
be exact, and then the last one could only be overly long, not short.
But, in practice, I think the real answer is that the length of all the
elements in the sg list == dxfer_len in all cases.
--
Doug Ledford <dledford@redhat.com> 919-754-3700 x44233
Red Hat, Inc.
1801 Varsity Dr.
Raleigh, NC 27606
next prev parent reply other threads:[~2002-07-31 5:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-27 22:48 [usb-storage] Re: 2 PATCHES: fix request_tranferlength Andries.Brouwer
2002-07-28 2:55 ` Matthew Dharm
2002-07-28 4:54 ` Douglas Gilbert
2002-07-28 9:11 ` Matthew Dharm
2002-07-30 5:24 ` Matthew Dharm
2002-07-30 13:40 ` Douglas Gilbert
2002-07-31 4:29 ` Matthew Dharm
2002-07-31 5:14 ` Doug Ledford [this message]
2002-07-31 5:35 ` Douglas Gilbert
2002-07-28 10:22 ` Kai Makisara
2002-07-28 19:31 ` Matthew Dharm
2002-07-28 21:01 ` Kai Makisara
2002-07-29 19:51 ` Doug Ledford
2002-07-29 20:50 ` Kai Makisara
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=20020731011427.C27756@redhat.com \
--to=dledford@redhat.com \
--cc=Andries.Brouwer@cwi.nl \
--cc=dougg@torque.net \
--cc=linux-scsi@vger.kernel.org \
--cc=usb-storage@one-eyed-alien.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.