[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v2] aio: add missing aio_notify() to aio_enable_
From: |
Fam Zheng |
Subject: |
Re: [Qemu-block] [PATCH v2] aio: add missing aio_notify() to aio_enable_external() |
Date: |
Fri, 5 May 2017 18:19:55 +0800 |
User-agent: |
Mutt/1.8.0 (2017-02-23) |
On Fri, 05/05 11:02, Stefan Hajnoczi wrote:
> diff --git a/include/block/aio.h b/include/block/aio.h
> index 406e323..b3d6f76 100644
> --- a/include/block/aio.h
> +++ b/include/block/aio.h
> @@ -454,8 +454,14 @@ static inline void aio_disable_external(AioContext *ctx)
> */
> static inline void aio_enable_external(AioContext *ctx)
> {
> - assert(ctx->external_disable_cnt > 0);
> - atomic_dec(&ctx->external_disable_cnt);
> + int old;
> +
> + old = atomic_dec_fetch(&ctx->external_disable_cnt);
Did you mean atomic_fetch_dec? atomic_dec_fetch is new, not old.
> + assert(old > 0);
> + if (old == 1) {
> + /* Kick event loop so it re-arms file descriptors */
> + aio_notify(ctx);
> + }
> }
>
> /**
> --
> 2.9.3
>