[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 4/5] mirror: follow AioContext change gracefu
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v4 4/5] mirror: follow AioContext change gracefully |
Date: |
Thu, 16 Jun 2016 12:21:52 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 |
On 16/06/2016 12:17, Stefan Hajnoczi wrote:
> On Wed, Jun 15, 2016 at 10:57:49AM +0200, Paolo Bonzini wrote:
>> On 14/06/2016 20:17, Stefan Hajnoczi wrote:
>>> +/* There is no matching mirror_resume() because mirror_run() will begin
>>> + * iterating again when the job is resumed.
>>> + */
>>> +static void mirror_pause(BlockJob *job)
>>> +{
>>> + MirrorBlockJob *s = container_of(job, MirrorBlockJob, common);
>>> +
>>> + while (s->in_flight > 0) {
>>> + aio_poll(blk_get_aio_context(job->blk), true);
>>> + }
>>
>> This is calling aio_poll from a coroutine, which is ugly -- see Fam's
>> recent introduction of bdrv_co_drain. I think this should call
>> mirror_drain instead.
>
> This is not called from coroutine context, so I couldn't use
> mirror_drain().
>
> BlockJobDriver->pause() and attached_aio_context() are both not
> coroutine_fn. That's because bdrv_attach_aio_context() is not
> coroutine_fn and can be called from a monitor command or device
> emulation code.
But mirror_pause is only called from block_job_pause_point, isn't it?
And block_job_pause_point is a coroutine_fn.
I think what you say was true for v3, though.
Paolo
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH v4 2/5] blockjob: add pause points, Stefan Hajnoczi, 2016/06/14
Re: [Qemu-devel] [PATCH v4 2/5] blockjob: add pause points, Fam Zheng, 2016/06/15
[Qemu-devel] [PATCH v4 1/5] blockjob: move iostatus reset out of block_job_enter(), Stefan Hajnoczi, 2016/06/14