From: "Ira W. Snyder" <iws@ovro.caltech.edu>
To: Stefani Seibold <stefani@seibold.net>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
andi@firstfloor.org, gregkh@suse.de, alan@lxorguk.ukuu.org.uk,
tytso@mit.edu, jens.axboe@oracle.com
Subject: Re: [PATCH 2/4] add the new generic kfifo API
Date: Sat, 29 May 2010 12:09:16 -0700 [thread overview]
Message-ID: <20100529190916.GA18696@ovro.caltech.edu> (raw)
In-Reply-To: <1275158894.9189.6.camel@wall-e.seibold.net>
On Sat, May 29, 2010 at 08:48:14PM +0200, Stefani Seibold wrote:
> Hi Ira,
>
> please don't send me back the hole patch. If you want enhance something,
> please write a clean patch which can i apply against the generic API
> patch.
>
If you looked down far enough, I put my comments inline. I should have
snipped out the extra noise, sorry.
Here is a completely untested patch that should fix kfifo when used with
chained scatterlists (AKA struct sg_table). Feel free to roll it into
the main patch.
Ira
>From 01d90fc6fb35e16b034f0893cd717af51c690cc7 Mon Sep 17 00:00:00 2001
From: Ira W. Snyder <kernel@irasnyder.com>
Date: Sat, 29 May 2010 12:02:47 -0700
Subject: [PATCH] kfifo: fix scatterlist usage
The current kfifo scatterlist implementation will not work with chained
scatterlists. It assumes that struct scatterlist arrays are allocated
contiguously, which is not the case when chained scatterlists (struct
sg_table) are in use.
Signed-off-by: Ira W. Snyder <kernel@irasnyder.com>
---
kernel/kfifo.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/kernel/kfifo.c b/kernel/kfifo.c
index 02192dd..bd4e083 100644
--- a/kernel/kfifo.c
+++ b/kernel/kfifo.c
@@ -333,17 +333,16 @@ static int setup_sgl_buf(struct scatterlist *sgl, void *buf,
buf += PAGE_SIZE;
npage = virt_to_page(buf);
if (page_to_phys(page) != page_to_phys(npage) - l) {
- sgl->page_link = 0;
- sg_set_page(sgl++, page, l - off, off);
- if (++n == nents)
+ sg_set_page(sgl, page, l - off, off);
+ sgl = sg_next(sgl);
+ if (++n == nents || sgl == NULL)
return n;
page = npage;
len -= l - off;
l = off = 0;
}
}
- sgl->page_link = 0;
- sg_set_page(sgl++, page, len, off);
+ sg_set_page(sgl, page, len, off);
return n + 1;
}
--
1.7.1
next prev parent reply other threads:[~2010-05-29 19:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-12 8:49 really generic, type save and type definable stefani
2010-05-12 8:49 ` [PATCH 1/4] fix kfifo miss use of nozami.c stefani
2010-05-12 8:49 ` [PATCH 2/4] add the new generic kfifo API stefani
2010-05-29 18:30 ` Ira W. Snyder
2010-05-29 18:48 ` Stefani Seibold
2010-05-29 19:09 ` Ira W. Snyder [this message]
2010-05-12 8:49 ` [PATCH 3/4] replace the old non generic API stefani
2010-05-12 8:49 ` [PATCH 4/4] add example files to the kernel sample directory stefani
2010-05-14 20:46 ` Andrew Morton
2010-05-15 13:33 ` Stefani Seibold
2010-05-15 13:39 ` Andrew Morton
2010-05-28 7:43 ` really generic, type save and type definable Henrik Rydberg
2010-05-28 10:32 ` Stefani Seibold
2010-05-28 11:11 ` Henrik Rydberg
-- strict thread matches above, loose matches on Subject: below --
2010-08-10 6:40 [PATCH 0/4] enhanced reimplemention of the kfifo API stefani
2010-08-10 6:40 ` [PATCH 2/4] add the new generic " stefani
2010-07-20 13:05 [PATCH 0/4] enhanced reimplemention of the " stefani
2010-07-20 13:05 ` [PATCH 2/4] add the new generic " stefani
2010-04-20 20:06 [PATCH 0/4] enhanced reimplemention of the " stefani
2010-04-20 20:06 ` [PATCH 2/4] add the new generic " stefani
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=20100529190916.GA18696@ovro.caltech.edu \
--to=iws@ovro.caltech.edu \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=andi@firstfloor.org \
--cc=gregkh@suse.de \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stefani@seibold.net \
--cc=tytso@mit.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