From: Tom Zanussi <zanussi@us.ibm.com>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: David Wilder <dwilder@us.ibm.com>,
linux-kernel@vger.kernel.org,
systemtap@sources.redhat.com,
Yumiko Sugita <yumiko.sugita.yf@hitachi.com>,
Satoshi Oshima <soshima@redhat.com>,
Hideo Aoki <haoki@redhat.com>
Subject: Re: [PATCH] relay-file-read-start-pos-fix.patch
Date: Wed, 20 Jun 2007 14:52:00 -0000 [thread overview]
Message-ID: <1182350817.30702.112.camel@ubuntu> (raw)
In-Reply-To: <4678E5FF.7030301@hitachi.com>
On Wed, 2007-06-20 at 17:31 +0900, Masami Hiramatsu wrote:
[...]
> P.S.
> I attached my patch (relay-file-read-overwrite-mode-fix.patch)
> which fixed the problem pointed in previous mail.
>
> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
>
Hi,
Thanks for sending the test case. I wrote my own program that tests for
the same thing, and it also works fine. To make sure it doesn't break
no-overwrite mode, I also ran several tests with blktrace and that looks
good too.
Thanks very much for analyzing the problem and providing the patch!
Just to summarize - the problem this fixes is that in overwrite mode,
the current read code doesn't pick up all the data it could if the whole
buffer is filled - it will leave behind sub-buffers at the beginning.
With this patch, the data in those sub-buffers is read as well.
Acked-by: Tom Zanussi <zanussi@us.ibm.com>
> ---
> kernel/relay.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> Index: linux-2.6.22-rc4-mm2/kernel/relay.c
> ===================================================================
> --- linux-2.6.22-rc4-mm2.orig/kernel/relay.c 2007-06-13 20:22:02.000000000 +0900
> +++ linux-2.6.22-rc4-mm2/kernel/relay.c 2007-06-20 10:53:06.000000000 +0900
> @@ -812,7 +812,10 @@
> }
>
> buf->bytes_consumed += bytes_consumed;
> - read_subbuf = read_pos / buf->chan->subbuf_size;
> + if (!read_pos)
> + read_subbuf = buf->subbufs_consumed % n_subbufs;
> + else
> + read_subbuf = read_pos / buf->chan->subbuf_size;
> if (buf->bytes_consumed + buf->padding[read_subbuf] == subbuf_size) {
> if ((read_subbuf == buf->subbufs_produced % n_subbufs) &&
> (buf->offset == subbuf_size))
> @@ -841,8 +844,9 @@
> }
>
> if (unlikely(produced - consumed >= n_subbufs)) {
> - consumed = (produced / n_subbufs) * n_subbufs;
> + consumed = produced - n_subbufs + 1;
> buf->subbufs_consumed = consumed;
> + buf->bytes_consumed = 0;
> }
>
> produced = (produced % n_subbufs) * subbuf_size + buf->offset;
>
>
>
>
next prev parent reply other threads:[~2007-06-20 14:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-18 4:57 David Wilder
2007-06-19 3:44 ` Masami Hiramatsu
2007-06-19 5:36 ` Tom Zanussi
2007-06-20 8:32 ` Masami Hiramatsu
2007-06-20 14:52 ` Tom Zanussi [this message]
2007-06-21 18:06 ` David Wilder
2007-06-19 16:27 ` Tom Zanussi
2007-06-20 1:22 ` Masami Hiramatsu
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=1182350817.30702.112.camel@ubuntu \
--to=zanussi@us.ibm.com \
--cc=dwilder@us.ibm.com \
--cc=haoki@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=soshima@redhat.com \
--cc=systemtap@sources.redhat.com \
--cc=yumiko.sugita.yf@hitachi.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).