From: "Michael S. Tsirkin" <mst@redhat.com>
To: David L Stevens <dlstevens@us.ibm.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] fix multi-buffer logging with mergeable buffers
Date: Sun, 9 May 2010 14:10:16 +0300 [thread overview]
Message-ID: <20100509111016.GA19453@redhat.com> (raw)
In-Reply-To: <1273263068.24088.1.camel@w-dls.beaverton.ibm.com>
On Fri, May 07, 2010 at 01:11:08PM -0700, David L Stevens wrote:
> This patch fixes the multibuffer case of logging with
> mergeable buffers.
>
> Signed-off-by: David L Stevens <dlstevens@us.ibm.com>
So, I folded this into your original patch submission,
this way we don't get broken logging followed
by a fix (better for bisect). Further, I think it's better to only use log_num
on success. After fixing whitespace (+ needs space around it:
didn't checkpatch complain?) I merged the below,
and rebased my tweaks patch on top.
The result can be found here:
git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git vhost-mrg-rxbuf
Compiles fine but I'm a bit busy with other things,
and didn't test at all yet, I'd appreciate testing and reports.
--
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 8ef5e3f..1964ab0 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -877,7 +877,7 @@ int vhost_get_desc_n(struct vhost_virtqueue *vq, struct vring_used_elem *heads,
unsigned int out, in;
int seg = 0;
int headcount = 0;
- int r;
+ int r, nlogs = 0;
while (datalen > 0) {
if (headcount >= VHOST_NET_MAX_SG) {
@@ -897,12 +897,18 @@ int vhost_get_desc_n(struct vhost_virtqueue *vq, struct vring_used_elem *heads,
r = -EINVAL;
goto err;
}
+ if (unlikely(log)) {
+ nlogs += *log_num;
+ log += *log_num;
+ }
heads[headcount].len = iov_length(vq->iov + seg, in);
datalen -= heads[headcount].len;
++headcount;
seg += in;
}
*iovcount = seg;
+ if (unlikely(log))
+ *log_num = nlogs;
return headcount;
err:
vhost_discard_desc(vq, headcount);
--
MST
next prev parent reply other threads:[~2010-05-09 11:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-07 20:11 [PATCH] fix multi-buffer logging with mergeable buffers David L Stevens
2010-05-09 11:10 ` Michael S. Tsirkin [this message]
2010-05-09 15:46 ` David Stevens
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=20100509111016.GA19453@redhat.com \
--to=mst@redhat.com \
--cc=dlstevens@us.ibm.com \
--cc=netdev@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;
as well as URLs for NNTP newsgroup(s).