Skip to contentSkip to conversation

Block patches

GIT PULL Applied Stefan Hajnoczi 4 participants 6 messages Jul 17, 2017 – Jul 19, 2017 Block layer

lore
Share & tools
lore
#0 lore raw

The following changes since commit 4871b51b9241b10f4fd8e04bbb21577886795e25:

vmgenid-test: use boot-sector infrastructure (2017-07-14 17:03:03 +0100)

are available in the git repository at:

git://github.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to 593ed6f0a3c827a13a274e47f6fa980344234f9c:

block: fix shadowed variable in bdrv_co_pdiscard (2017-07-17 15:58:37 +0100)

----------------------------------------------------------------

----------------------------------------------------------------

Alistair Francis (1):
util/aio-win32: Only select on what we are actually waiting for

Denis V. Lunev (1):
block: fix shadowed variable in bdrv_co_pdiscard

 block/io.c       |  1 -
 util/aio-win32.c | 13 ++++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)
Signature · 1 line
2.9.4
#1 lore raw

[Qemu-devel] [PULL 1/2] util/aio-win32: Only select on what we are actually waiting for

From: Alistair Francis <[email protected]>

Message-id: 9307b70e9876c4e9e3c4478524a32a23a3d5dd05.1499368180.git.alistair.francis@xilinx.com

---
 util/aio-win32.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
util/aio-win32.c +10 -3
index bca496a..d6d5e02 100644
@@ -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);
Signature · 1 line
2.9.4
#4 lore raw

[Qemu-devel] [PULL 2/2] block: fix shadowed variable in bdrv_co_pdiscard

In reply to Stefan Hajnoczi

From: "Denis V. Lunev" <[email protected]>

We've had a shadowed 'ret' variable, which risks returning the wrong value, introduced in commit b9c64947.

Message-id: [email protected]

CC Stefan Hajnoczi <[email protected]>
CC Kevin Wolf <[email protected]>
CC Eric Blake <[email protected]>
---
 block/io.c | 1 -
 1 file changed, 1 deletion(-)
block/io.c +0 -1
index b413727..a73153d 100644
@@ -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) {
Signature · 1 line
2.9.4
#2 lore raw

Re: [Qemu-devel] [PULL 1/2] util/aio-win32: Only select on what we are actually waiting for

In reply to Stefan Hajnoczi
Quoted 5 lines
util/aio-win32.c +4 -0
+        if (io_read) {
+            bitmask |= FD_READ | FD_ACCEPT | FD_CLOSE;
+        }
+

util/aio-win32.c void aio_set_fd_handler(AioContext *ctx, · line 109

Quoted 10 lines
util/aio-win32.c +5 -3
+        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);
     }

As noticed by Eric, if the same socket is in use via both aio-win32 and another GSource, or via multiple AioContexts, this would break because there is only one WSAEventSelect mask for each socket handle.

It is probably not going to break anything in the case of aio-win32, but I think it is worth at least a comment. And because WSAEventSelect is edge-triggered (e.g. an FD_WRITE event doesn't trigger again until the next write) it shouldn't be that bad for performance. If there's time to revert this patch, I think it would be preferable.

Paolo

#5 lore raw
In reply to Stefan Hajnoczi
Quoted 19 lines · Stefan Hajnoczi

The following changes since commit 4871b51b9241b10f4fd8e04bbb21577886795e25:

vmgenid-test: use boot-sector infrastructure (2017-07-14 17:03:03 +0100)

are available in the git repository at:

git://github.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to 593ed6f0a3c827a13a274e47f6fa980344234f9c:

block: fix shadowed variable in bdrv_co_pdiscard (2017-07-17 15:58:37 +0100)

----------------------------------------------------------------

----------------------------------------------------------------

Alistair Francis (1):
util/aio-win32: Only select on what we are actually waiting for

Quoted 6 lines

Denis V. Lunev (1):
block: fix shadowed variable in bdrv_co_pdiscard

 block/io.c       |  1 -
 util/aio-win32.c | 13 ++++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

Applied, thanks.

-- PMM

#3 lore raw

Re: [Qemu-devel] [PULL 1/2] util/aio-win32: Only select on what we are actually waiting for

In reply to Paolo Bonzini
Quoted 20 lines · Paolo Bonzini
Quoted 5 lines
util/aio-win32.c +4 -0
+        if (io_read) {
+            bitmask |= FD_READ | FD_ACCEPT | FD_CLOSE;
+        }
+

util/aio-win32.c void aio_set_fd_handler(AioContext *ctx, · line 109

Quoted 10 lines
util/aio-win32.c +5 -3
+        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);
     }

As noticed by Eric, if the same socket is in use via both aio-win32 and another GSource, or via multiple AioContexts, this would break because there is only one WSAEventSelect mask for each socket handle.

Quoted 5 lines

It is probably not going to break anything in the case of aio-win32, but I think it is worth at least a comment. And because WSAEventSelect is edge-triggered (e.g. an FD_WRITE event doesn't trigger again until the next write) it shouldn't be that bad for performance. If there's time to revert this patch, I think it would be preferable.

It looks like this was applied, I'll be back in the office next week should I try and revert this or just add a comment explaining the limitation.

Either that or store the current mask and OR then all together.

Thanks,
Alistair

Quoted 2 lines

Paolo