All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>, Fam Zheng <famz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	jcody@redhat.com, qemu-devel@nongnu.org,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/3] mirror: Go through ready -> complete process for 0 len image
Date: Thu, 05 Jun 2014 13:26:56 +0200	[thread overview]
Message-ID: <53905400.4050605@redhat.com> (raw)
In-Reply-To: <20140605111724.GI27366@stefanha-thinkpad.redhat.com>

Il 05/06/2014 13:17, Stefan Hajnoczi ha scritto:
> On Thu, Jun 05, 2014 at 11:42:34AM +0800, Fam Zheng wrote:
>> diff --git a/block/mirror.c b/block/mirror.c
>> index 94c8661..2bef5f3 100644
>> --- a/block/mirror.c
>> +++ b/block/mirror.c
>> @@ -324,9 +324,18 @@ static void coroutine_fn mirror_run(void *opaque)
>>      }
>>
>>      s->common.len = bdrv_getlength(bs);
>> -    if (s->common.len <= 0) {
>> +    if (s->common.len < 0) {
>>          ret = s->common.len;
>>          goto immediate_exit;
>> +    } else if (s->common.len == 0) {
>> +        /* Report BLOCK_JOB_READY and wait for complete. */
>> +        block_job_ready(&s->common);
>> +        s->synced = true;
>> +        while (!block_job_is_cancelled(&s->common) && !s->should_complete) {
>> +            block_job_sleep_ns(&s->common, QEMU_CLOCK_REALTIME, SLICE_TIME);
>
> Please take a look at block_job_resume() and how it's used when
> cancelling or completing block jobs.  There is no need to sleep, instead
> we can yield until we get resumed.
>

You still need to set job->busy = false.  So I guess we need a new 
function block_job_yield.

Paolo

  reply	other threads:[~2014-06-05 11:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-05  3:42 [Qemu-devel] [PATCH 0/3] mirror: Fix behavior for zero byte image Fam Zheng
2014-06-05  3:42 ` [Qemu-devel] [PATCH 1/3] mirror: Go through ready -> complete process for 0 len image Fam Zheng
2014-06-05 11:17   ` Stefan Hajnoczi
2014-06-05 11:26     ` Paolo Bonzini [this message]
2014-06-05  3:42 ` [Qemu-devel] [PATCH 2/3] qemu-iotests: Test BLOCK_JOB_READY event for 0Kb image active commit Fam Zheng
2014-06-05 11:22   ` Stefan Hajnoczi
2014-06-05  3:42 ` [Qemu-devel] [PATCH 3/3] qemu-iotests: Test 0-length image for mirror Fam Zheng
2014-06-05 11:26   ` Stefan Hajnoczi
2014-06-05  3:57 ` [Qemu-devel] [PATCH 0/3] mirror: Fix behavior for zero byte image Eric Blake

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=53905400.4050605@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.