public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: FUJITA Tomonori <tomof@acm.org>
To: matthew@wil.cx
Cc: James.Bottomley@HansenPartnership.com, tomof@acm.org,
	dougg@torque.net, linux-scsi@vger.kernel.org,
	fujita.tomonori@lab.ntt.co.jpfujita.tomonori@lab.ntt.co.jp
Subject: Re: [PATCH] scsi_debug: disable clustering
Date: Sun, 17 Feb 2008 23:52:23 +0900	[thread overview]
Message-ID: <20080217235244N.tomof@acm.org> (raw)
In-Reply-To: <20080217142848.GD21012@parisc-linux.org>

On Sun, 17 Feb 2008 07:28:48 -0700
Matthew Wilcox <matthew@wil.cx> wrote:

> On Sun, Feb 17, 2008 at 08:18:11AM -0600, James Bottomley wrote:
> > No, he means that kmap_atomic can only map a page of data.  This makes
> > single page only sg list entries and input assumption into this loop.
> > with ENABLE_CLUSTERING, that's potentially not true.   Of course, this
> > accidentally works most of the time because of the way kmap functions.
> 
> Ah, right.  I'm on the verge of releasing a ram-based scsi driver I've
> been working on ... this loop should work fine with clustering as it
> takes account of the sg potentially having multiple pages:
> 
>         scsi_for_each_sg(cmnd, sg, scsi_sg_count(cmnd), i) {
>                 struct page *sgpage = sg_page(sg);
>                 unsigned int to_off = sg->offset;
>                 unsigned int sg_copy = sg->length;
>                 if (sg_copy > len)
>                         sg_copy = len;
>                 len -= sg_copy;

stex driver has a similar function to copies data between a buffer and
a scatter list. I think that scsi_kmap_atomic_sg is a bit primitive
(and not very popular).  I'll send a patch to add a helper function to
scsi_lib.c that copies data between a buffer and a scatter list. It
would be useful for several drivers.

  reply	other threads:[~2008-02-17 14:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-16 14:57 [PATCH] scsi_debug: disable clustering FUJITA Tomonori
2008-02-17  5:53 ` Douglas Gilbert
2008-02-17 14:10 ` Matthew Wilcox
2008-02-17 14:18   ` James Bottomley
2008-02-17 14:28     ` Matthew Wilcox
2008-02-17 14:52       ` FUJITA Tomonori [this message]
2008-02-17 15:02         ` James Bottomley
2008-02-17 15:11           ` FUJITA Tomonori
2008-02-17 15:22             ` James Bottomley

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=20080217235244N.tomof@acm.org \
    --to=tomof@acm.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=dougg@torque.net \
    --cc=fujita.tomonori@lab.ntt.co.jpfujita.tomonori \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew@wil.cx \
    /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