From: Aravind Parchuri <aravind.parchuri@gmail.com>
To: michaelc@cs.wisc.edu
Cc: linux-scsi@vger.kernel.org
Subject: Re: WRITE BUFFER commands through SG_IO getting rounded up to sector past 32k
Date: Thu, 08 Mar 2007 13:59:19 -0800 [thread overview]
Message-ID: <45F08737.3060100@gmail.com> (raw)
In-Reply-To: <45EE09A6.7030004@cs.wisc.edu>
The patch has some problem. While ioctls with dxfer_len < 32k still make
it through properly, the problematic ones now show up in open-iscsi's
queuecommand with request_bufflen = 0. I'm not sure what the problem is now.
Aravind.
michaelc@cs.wisc.edu wrote:
> Aravind Parchuri wrote:
>
>> In fact, even with the newer kernel, all commands smaller than 32k make
>> it through with the right size, which leads me to think it's something
>> to do with the scatter-gather list. I'm not particularly familiar with
>> the scsi code, but inside scsi_execute_async, in scsi_map_req_sg, should
>> the request's data_len be set to the dxfer_len instead of summing up the
>> scatter-gather list lengths? I must mention again that I haven't really
>> gone through the code thoroughly.
>>
>>
>
> You are right. sg_build_indirect will do this
> blk_size = (blk_size + SG_SECTOR_MSK) & (~SG_SECTOR_MSK)
> so we should be using the bufflen passed into us. Attached is a patch
> made over scsi-misc. It should also apply to scsi rc fixes.
>
> ------------------------------------------------------------------------
>
> sg's may have setup a the buffer with a different length than
> the transfer length so we should be using the bufflen passed
> in as the request's data len.
>
> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
>
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 9f7482d..dfe3ccd 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -301,7 +301,7 @@ static int scsi_req_map_sg(struct reques
> {
> struct request_queue *q = rq->q;
> int nr_pages = (bufflen + sgl[0].offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
> - unsigned int data_len = 0, len, bytes, off;
> + unsigned int len, bytes, off;
> struct page *page;
> struct bio *bio = NULL;
> int i, err, nr_vecs = 0;
> @@ -310,7 +310,6 @@ static int scsi_req_map_sg(struct reques
> page = sgl[i].page;
> off = sgl[i].offset;
> len = sgl[i].length;
> - data_len += len;
>
> while (len > 0) {
> bytes = min_t(unsigned int, len, PAGE_SIZE - off);
> @@ -350,7 +349,7 @@ static int scsi_req_map_sg(struct reques
> }
>
> rq->buffer = rq->data = NULL;
> - rq->data_len = data_len;
> + rq->data_len = bufflen;
> return 0;
>
> free_bios:
>
next prev parent reply other threads:[~2007-03-08 21:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-07 0:01 WRITE BUFFER commands through SG_IO getting rounded up to sector past 32k Aravind Parchuri
2007-03-07 0:39 ` Mike Christie
2007-03-08 21:59 ` Aravind Parchuri [this message]
2007-03-08 22:53 ` Mike Christie
2007-03-09 23:37 ` Aravind Parchuri
2007-03-10 4:56 ` Aravind Parchuri
2007-03-10 20:59 ` Mike Christie
2007-03-11 1:11 ` Aravind Parchuri
2007-03-12 18:06 ` Mike Christie
2007-03-12 23:58 ` Aravind Parchuri
2007-03-13 17:52 ` Mike Christie
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=45F08737.3060100@gmail.com \
--to=aravind.parchuri@gmail.com \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.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