summaryrefslogtreecommitdiffstats
path: root/include/block
diff options
context:
space:
mode:
authorStefan Hajnoczi2017-05-12 16:39:19 +0200
committerStefan Hajnoczi2017-05-12 16:39:23 +0200
commitb54933eed532b10c8a1967d9f988262ccbb94ee2 (patch)
tree091671b3016466aef7664e5beb42de15d6b62ca8 /include/block
parentMerge remote-tracking branch 'kwolf/tags/for-upstream' into staging (diff)
parentaio: add missing aio_notify() to aio_enable_external() (diff)
downloadqemu-b54933eed532b10c8a1967d9f988262ccbb94ee2.tar.gz
qemu-b54933eed532b10c8a1967d9f988262ccbb94ee2.tar.xz
qemu-b54933eed532b10c8a1967d9f988262ccbb94ee2.zip
Merge tag 'block-pull-request' into staging
# gpg: Signature made Fri 12 May 2017 10:37:12 AM EDT # gpg: using RSA key 0x9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * tag 'block-pull-request': aio: add missing aio_notify() to aio_enable_external() block: Simplify BDRV_BLOCK_RAW recursion coroutine: remove GThread implementation Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'include/block')
-rw-r--r--include/block/aio.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/block/aio.h b/include/block/aio.h
index 406e32305a..e9aeeaec94 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_fetch_dec(&ctx->external_disable_cnt);
+ assert(old > 0);
+ if (old == 1) {
+ /* Kick event loop so it re-arms file descriptors */
+ aio_notify(ctx);
+ }
}
/**