qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] nvme: simplify code around completion
@ 2018-08-13 14:43 Paolo Bonzini
  2018-08-14  2:44 ` Fam Zheng
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2018-08-13 14:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: famz, qemu-block

nvme_poll_queues is already protected by q->lock, and
AIO callbacks are invoked outside the AioContext lock.
So remove the acquire/release pair in nvme_handle_event.

Remove unnecessary variable in in nvme_poll_cb.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/nvme.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/block/nvme.c b/block/nvme.c
index 6f71122bf5..df2e16fabe 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -489,10 +489,8 @@ static void nvme_handle_event(EventNotifier *n)
     BDRVNVMeState *s = container_of(n, BDRVNVMeState, irq_notifier);
 
     trace_nvme_handle_event(s);
-    aio_context_acquire(s->aio_context);
     event_notifier_test_and_clear(n);
     nvme_poll_queues(s);
-    aio_context_release(s->aio_context);
 }
 
 static bool nvme_add_io_queue(BlockDriverState *bs, Error **errp)
@@ -539,11 +537,9 @@ static bool nvme_poll_cb(void *opaque)
 {
     EventNotifier *e = opaque;
     BDRVNVMeState *s = container_of(e, BDRVNVMeState, irq_notifier);
-    bool progress = false;
 
     trace_nvme_poll_cb(s);
-    progress = nvme_poll_queues(s);
-    return progress;
+    return nvme_poll_queues(s);
 }
 
 static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] nvme: simplify code around completion
  2018-08-13 14:43 [Qemu-devel] [PATCH] nvme: simplify code around completion Paolo Bonzini
@ 2018-08-14  2:44 ` Fam Zheng
  0 siblings, 0 replies; 2+ messages in thread
From: Fam Zheng @ 2018-08-14  2:44 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, qemu-block

On Mon, 08/13 16:43, Paolo Bonzini wrote:
> nvme_poll_queues is already protected by q->lock, and
> AIO callbacks are invoked outside the AioContext lock.
> So remove the acquire/release pair in nvme_handle_event.
> 
> Remove unnecessary variable in in nvme_poll_cb.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  block/nvme.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/block/nvme.c b/block/nvme.c
> index 6f71122bf5..df2e16fabe 100644
> --- a/block/nvme.c
> +++ b/block/nvme.c
> @@ -489,10 +489,8 @@ static void nvme_handle_event(EventNotifier *n)
>      BDRVNVMeState *s = container_of(n, BDRVNVMeState, irq_notifier);
>  
>      trace_nvme_handle_event(s);
> -    aio_context_acquire(s->aio_context);
>      event_notifier_test_and_clear(n);
>      nvme_poll_queues(s);
> -    aio_context_release(s->aio_context);
>  }
>  
>  static bool nvme_add_io_queue(BlockDriverState *bs, Error **errp)
> @@ -539,11 +537,9 @@ static bool nvme_poll_cb(void *opaque)
>  {
>      EventNotifier *e = opaque;
>      BDRVNVMeState *s = container_of(e, BDRVNVMeState, irq_notifier);
> -    bool progress = false;
>  
>      trace_nvme_poll_cb(s);
> -    progress = nvme_poll_queues(s);
> -    return progress;
> +    return nvme_poll_queues(s);
>  }
>  
>  static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
> -- 
> 2.17.1
> 

Could you please split it into two patches? Because the significance of the two
hunks feels overwhelmingly imbalanced to me. :)

Fam

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-14  2:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-13 14:43 [Qemu-devel] [PATCH] nvme: simplify code around completion Paolo Bonzini
2018-08-14  2:44 ` Fam Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).