From: Jens Axboe <jens.axboe@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/13] Add sg helpers for iterating over a scatterlist table
Date: Thu, 10 May 2007 12:42:17 +0200 [thread overview]
Message-ID: <20070510104216.GK4629@kernel.dk> (raw)
In-Reply-To: <20070510033956.9eebe437.akpm@linux-foundation.org>
On Thu, May 10 2007, Andrew Morton wrote:
> On Thu, 10 May 2007 12:21:44 +0200 Jens Axboe <jens.axboe@oracle.com> wrote:
>
> > First step to being able to change the scatterlist setup without
> > having to modify drivers (a lot :-)
> >
> > Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
> > ---
> > include/linux/scatterlist.h | 9 +++++++++
> > 1 files changed, 9 insertions(+), 0 deletions(-)
> >
> > diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
> > index 4efbd9c..c5bffde 100644
> > --- a/include/linux/scatterlist.h
> > +++ b/include/linux/scatterlist.h
> > @@ -20,4 +20,13 @@ static inline void sg_init_one(struct scatterlist *sg, const void *buf,
> > sg_set_buf(sg, buf, buflen);
> > }
> >
> > +#define sg_next(sg) ((sg) + 1)
> > +#define sg_last(sg, nents) (&(sg[nents - 1]))
>
> Looks a bit underparenthesised.
>
> > +/*
> > + * Loop over each sg element, following the pointer to a new list if necessary
> > + */
> > +#define for_each_sg(sglist, sg, nr, __i) \
> > + for (__i = 0, sg = (sglist); __i < nr; __i++, sg = sg_next(sg))
> > +
>
> So does this.
Yeah I know, both of these are fixed up when the chain support is added
(patch 07). So I didn't bother fixing these up, but I will make a note
of it for the first round.
> I don't see how it "follows the pointer to a new list". All it's doing is
> iterating across an array?
It doesn't, this first patch just allows you to convert drivers to
using for_each_sg() to loop over sg elements. Then you can later
introduce sg chaining behind their back, they don't have to know about
that.
Patch 07 is the one that enables sg chaining for x86 and includes the
generic bits for linux/scatterlist.h.
--
Jens Axboe
next prev parent reply other threads:[~2007-05-10 10:42 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-10 10:21 [PATCH 0/13] Chaining sg lists for bio IO commands v3 Jens Axboe
2007-05-10 10:21 ` [PATCH 1/13] crypto: don't pollute the global namespace with sg_next() Jens Axboe
2007-05-10 10:21 ` [PATCH 2/13] Add sg helpers for iterating over a scatterlist table Jens Axboe
2007-05-10 10:39 ` Andrew Morton
2007-05-10 10:42 ` Jens Axboe [this message]
2007-05-10 10:21 ` [PATCH 3/13] libata: convert to using sg helpers Jens Axboe
2007-05-10 10:21 ` [PATCH 4/13] block: " Jens Axboe
2007-05-10 10:21 ` [PATCH 5/13] scsi: " Jens Axboe
2007-05-10 10:21 ` [PATCH 6/13] i386 dma_map_sg: " Jens Axboe
2007-05-10 10:21 ` [PATCH 7/13] i386 sg: add support for chaining scatterlists Jens Axboe
2007-05-10 10:43 ` Andrew Morton
2007-05-10 10:44 ` Jens Axboe
2007-05-10 10:46 ` Jens Axboe
2007-05-10 10:52 ` Andrew Morton
2007-05-10 11:21 ` Jens Axboe
2007-05-10 10:59 ` Benny Halevy
2007-05-10 11:23 ` Jens Axboe
2007-05-10 10:21 ` [PATCH 8/13] x86-64: update iommu/dma mapping functions to sg helpers Jens Axboe
2007-05-10 10:21 ` [PATCH 9/13] [PATCH] x86-64: enable sg chaining Jens Axboe
2007-05-10 10:21 ` [PATCH 10/13] scsi: simplify scsi_free_sgtable() Jens Axboe
2007-05-10 10:21 ` [PATCH 11/13] SCSI: support for allocating large scatterlists Jens Axboe
2007-05-10 10:48 ` Andrew Morton
2007-05-10 10:52 ` Jens Axboe
2007-05-10 12:38 ` Alan Cox
2007-05-10 10:21 ` [PATCH 12/13] ll_rw_blk: temporarily enable max_segments tweaking Jens Axboe
2007-05-10 10:49 ` Andrew Morton
2007-05-10 11:20 ` Jens Axboe
2007-05-10 10:21 ` [PATCH 13/13] scsi drivers: sg chaining Jens Axboe
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=20070510104216.GK4629@kernel.dk \
--to=jens.axboe@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/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