qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 07/11] aio-posix: introduce aio_{disable, ena


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH v2 07/11] aio-posix: introduce aio_{disable, enable}_clients
Date: Mon, 7 Sep 2015 13:26:29 +0800
User-agent: Mutt/1.5.23 (2014-03-12)

On Thu, 08/27 18:23, Stefan Hajnoczi wrote:
> On Wed, Jul 29, 2015 at 12:42:10PM +0800, Fam Zheng wrote:
> > +void aio_disable_enable_clients(AioContext *ctx, int clients_mask,
> > +                                bool is_disable)
> > +{
> > +    AioHandler *node;
> > +    aio_context_acquire(ctx);
> > +
> > +    QLIST_FOREACH(node, &ctx->aio_handlers, node) {
> > +        if (!node->deleted && node->type & clients_mask) {
> > +            node->disable_cnt += is_disable ? 1 : -1;
> > +        }
> > +    }
> > +    aio_context_release(ctx);
> > +}
> 
> If someone adds an fd of a disabled type *after* the call to
> aio_disable_clients() then it won't be disabled.
> 
> Another approach is to keep an array of counters per AioContext and
> check the counters during aio_poll() when deciding which fds to monitor.

Good idea, I'll change that way.

> 
> Also, this function acquires/releases AioContext so it's worth
> mentioning in the doc comments that this function is thread-safe.
> 

OK.

Fam



reply via email to

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