From 55d41b16eec5041bf94de9b687bf51a67fdf736d Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Thu, 6 Jul 2017 13:15:14 -0700 Subject: [PATCH 1/2] util/aio-win32: Only select on what we are actually waiting for MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alistair Francis Acked-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Message-id: 9307b70e9876c4e9e3c4478524a32a23a3d5dd05.1499368180.git.alistair.francis@xilinx.com Signed-off-by: Stefan Hajnoczi --- util/aio-win32.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/util/aio-win32.c b/util/aio-win32.c index bca496a47a..d6d5e02f00 100644 --- a/util/aio-win32.c +++ b/util/aio-win32.c @@ -71,6 +71,7 @@ void aio_set_fd_handler(AioContext *ctx, } } else { HANDLE event; + long bitmask = 0; if (node == NULL) { /* Alloc and insert if it's not already there */ @@ -95,10 +96,16 @@ void aio_set_fd_handler(AioContext *ctx, node->io_write = io_write; node->is_external = is_external; + if (io_read) { + bitmask |= FD_READ | FD_ACCEPT | FD_CLOSE; + } + + if (io_write) { + bitmask |= FD_WRITE | FD_CONNECT; + } + event = event_notifier_get_handle(&ctx->notifier); - WSAEventSelect(node->pfd.fd, event, - FD_READ | FD_ACCEPT | FD_CLOSE | - FD_CONNECT | FD_WRITE | FD_OOB); + WSAEventSelect(node->pfd.fd, event, bitmask); } qemu_lockcnt_unlock(&ctx->list_lock); From 593ed6f0a3c827a13a274e47f6fa980344234f9c Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Mon, 10 Jul 2017 18:05:59 +0300 Subject: [PATCH 2/2] block: fix shadowed variable in bdrv_co_pdiscard We've had a shadowed 'ret' variable, which risks returning the wrong value, introduced in commit b9c64947. Signed-off-by: Denis V. Lunev Reviewed-by: Fam Zheng Reviewed-by: Eric Blake Message-id: 20170710150559.30163-1-den@openvz.org CC: Stefan Hajnoczi CC: Kevin Wolf CC: Eric Blake Signed-off-by: Stefan Hajnoczi --- block/io.c | 1 - 1 file changed, 1 deletion(-) diff --git a/block/io.c b/block/io.c index b413727524..a73153ddfe 100644 --- a/block/io.c +++ b/block/io.c @@ -2335,7 +2335,6 @@ int coroutine_fn bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset, assert(max_pdiscard >= bs->bl.request_alignment); while (bytes > 0) { - int ret; int num = bytes; if (head) {