Re: [Qemu-block] [RFC v1 1/4] util/aio-win32: Only select on what we are actually waiting for
On 28/06/2017 01:57, Alistair Francis wrote: > Signed-off-by: Alistair Francis > Acked-by: Edgar E. Iglesias > --- > > 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..949979c2f5 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; > +} > + > +if (io_write) { > +bitmask |= FD_WRITE; > +} The read case should also include FD_ACCEPT, and the write case should also include FD_CONNECT. FD_CLOSE probably also goes under "read", since it's signaled when read()/recv() return 0. FD_OOB is unnecessary, indeed. Paolo > 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); >
Re: [Qemu-block] [RFC v1 1/4] util/aio-win32: Only select on what we are actually waiting for
On Tue, 06/27 16:57, Alistair Francis wrote: > Signed-off-by: Alistair Francis > Acked-by: Edgar E. Iglesias > --- > > 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..949979c2f5 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; > +} > + > +if (io_write) { > +bitmask |= FD_WRITE; > +} > + > 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); Not sure if it's okay to drop accept/close/connect/oob altogether, Cc'ing Paolo who knows Windows stuff. Fam
[Qemu-block] [RFC v1 1/4] util/aio-win32: Only select on what we are actually waiting for
Signed-off-by: Alistair Francis Acked-by: Edgar E. Iglesias --- 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..949979c2f5 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; +} + +if (io_write) { +bitmask |= FD_WRITE; +} + 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); -- 2.11.0