qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/3] mirror: Go through ready -> complete proces


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 1/3] mirror: Go through ready -> complete process for 0 len image
Date: Thu, 5 Jun 2014 13:17:24 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

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.



reply via email to

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