qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Qemu-block] [PATCH] block/mirror: limit qiov to IOV_MA


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] block/mirror: limit qiov to IOV_MAX elements
Date: Wed, 1 Jul 2015 17:05:56 +0100

On Wed, Jul 1, 2015 at 4:03 PM, Paolo Bonzini <address@hidden> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]