From: Stefan Hajnoczi <stefanha@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu block <qemu-block@nongnu.org>,
qemu-devel <qemu-devel@nongnu.org>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] block/mirror: limit qiov to IOV_MAX elements
Date: Wed, 1 Jul 2015 17:05:56 +0100 [thread overview]
Message-ID: <CAJSP0QWk7fbQurTBcBkdb_vqb7XZpLu9mnQPnLHeQSThuoOA1A@mail.gmail.com> (raw)
In-Reply-To: <5594015C.20104@redhat.com>
On Wed, Jul 1, 2015 at 4:03 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 01/07/2015 16:59, Stefan Hajnoczi wrote:
>> I found it annoying to write it backwards too, but it's for consistency:
>>
>> if (s->buf_free_count < nb_chunks + added_chunks) {
>> trace_mirror_break_buf_busy(s, nb_chunks, s->in_flight);
>> break;
>> }
>> if (IOV_MAX < nb_chunks + added_chunks) {
>> trace_mirror_break_iov_max(s, nb_chunks, added_chunks);
>> break;
>> }
>>
>> It's the same type of check as s->buf_free_count (which isn't modified
>> by this loop either so it's a yoda conditional).
>
> Hmm, right. The problem goes back to:
>
> while (nb_chunks == 0 && s->buf_free_count < added_chunks) {
> trace_mirror_yield_buf_busy(s, nb_chunks, s->in_flight);
> qemu_coroutine_yield();
> }
>
> where s->buf_free_count _is_ modified by the loop. The if below:
>
> if (s->buf_free_count < nb_chunks + added_chunks) {
> trace_mirror_break_buf_busy(s, nb_chunks, s->in_flight);
> break;
> }
>
> is written as a < check for consistency, and the one you add exacerbates
> the problem. If you want you can change the < to > in the "while" loop
> as well; otherwise the patch is okay as is.
Let's leave it.
next prev parent reply other threads:[~2015-07-01 16:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-01 14:45 [Qemu-devel] [PATCH] block/mirror: limit qiov to IOV_MAX elements Stefan Hajnoczi
2015-07-01 14:47 ` Paolo Bonzini
2015-07-01 14:59 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2015-07-01 15:03 ` Paolo Bonzini
2015-07-01 16:05 ` Stefan Hajnoczi [this message]
2015-07-08 11:14 ` Kevin Wolf
2015-07-08 12:34 ` Stefan Hajnoczi
2015-08-04 16:13 ` Stefan Hajnoczi
2015-08-06 8:50 ` [Qemu-devel] " Jeff Cody
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=CAJSP0QWk7fbQurTBcBkdb_vqb7XZpLu9mnQPnLHeQSThuoOA1A@mail.gmail.com \
--to=stefanha@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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 NNTP newsgroup(s).