[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [RFC patch 1/3] blockjob: add block_job_start_shim
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-block] [RFC patch 1/3] blockjob: add block_job_start_shim |
Date: |
Thu, 16 Mar 2017 09:20:20 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 16/03/2017 01:46, John Snow wrote:
> +/**
> + * This code must run after the job's coroutine has been entered,
> + * but not before.
> + */
> +static void coroutine_fn block_job_start_shim(void *opaque)
> +{
> + BlockJob *job = opaque;
> +
> + assert(job && job->driver && job->driver->start);
> + block_job_pause_point(job);
> + job->driver->start(job);
> +}
Poor function, don't call it a shim :) Let's just call it
block_job_co_entry.
Paolo
> void block_job_start(BlockJob *job)
> {
> assert(job && !block_job_started(job) && job->paused &&
> - !job->busy && job->driver->start);
> - job->co = qemu_coroutine_create(job->driver->start, job);
> - if (--job->pause_count == 0) {
> - job->paused = false;
> - job->busy = true;
> - qemu_coroutine_enter(job->co);
> - }
> + job->driver && job->driver->start);
> + job->co = qemu_coroutine_create(block_job_start_shim, job);
> + job->pause_count--;
> + job->busy = true;
> + job->paused = false;
> + qemu_coroutine_enter(job->co);
> }
>
> void block_job_ref(BlockJob *job)