qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH v7 05/10] block: Introduce "drained begin/end" A


From: Stefan Hajnoczi
Subject: Re: [Qemu-block] [PATCH v7 05/10] block: Introduce "drained begin/end" API
Date: Fri, 23 Oct 2015 16:13:41 +0100
User-agent: Mutt/1.5.24 (2015-08-30)

On Fri, Oct 23, 2015 at 11:08:09AM +0800, Fam Zheng wrote:
> +void bdrv_drained_begin(BlockDriverState *bs)
> +{
> +    if (!bs->quiesce_counter++) {
> +        aio_disable_external(bdrv_get_aio_context(bs));
> +    }
> +    bdrv_drain(bs);
> +}
> +
> +void bdrv_drained_end(BlockDriverState *bs)
> +{
> +    assert(bs->quiesce_counter > 0);
> +    if (--bs->quiesce_counter > 0) {
> +        return;
> +    }
> +    aio_enable_external(bdrv_get_aio_context(bs));
> +}

Why is quiesce_counter necessary?  Can't we just rely on AioContext's
disable_external_cnt?

void bdrv_drained_begin(BlockDriverState *bs)
{
    aio_disable_external(bdrv_get_aio_context(bs));
    bdrv_drain(bs);
}

void bdrv_drained_end(BlockDriverState *bs)
{
    aio_enable_external(bdrv_get_aio_context(bs));
}



reply via email to

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