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: Fam Zheng
Subject: Re: [Qemu-block] [PATCH v7 05/10] block: Introduce "drained begin/end" API
Date: Mon, 26 Oct 2015 09:35:56 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, 10/23 16:13, Stefan Hajnoczi wrote:
> 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?

It was added because bdrv_drain was conditional in a previous version, so yes
it can now be dropped, but we lose the explcitness of the assertion in
bdrv_drained_end. I was thinking that more "assert(!bs->quiesce_counter)" can
be useful in blk_aio_read/write etc..

Fam



reply via email to

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