[PATCH for-8.1] block-backend: remove qatomic_mb_read()

Paolo Bonzini posted 1 patch 1 year ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230406100759.240870-2-pbonzini@redhat.com
Maintainers: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
block/block-backend.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH for-8.1] block-backend: remove qatomic_mb_read()
Posted by Paolo Bonzini 1 year ago
There is already a barrier in AIO_WAIT_WHILE_INTERNAL(), thus the
qatomic_mb_read() is not adding anything.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/block-backend.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index 2ee39229e4cf..b6297aae6ad0 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1821,7 +1821,7 @@ void blk_drain(BlockBackend *blk)
 
     /* We may have -ENOMEDIUM completions in flight */
     AIO_WAIT_WHILE(blk_get_aio_context(blk),
-                   qatomic_mb_read(&blk->in_flight) > 0);
+                   qatomic_read(&blk->in_flight) > 0);
 
     if (bs) {
         bdrv_drained_end(bs);
@@ -1843,7 +1843,7 @@ void blk_drain_all(void)
         aio_context_acquire(ctx);
 
         /* We may have -ENOMEDIUM completions in flight */
-        AIO_WAIT_WHILE(ctx, qatomic_mb_read(&blk->in_flight) > 0);
+        AIO_WAIT_WHILE(ctx, qatomic_read(&blk->in_flight) > 0);
 
         aio_context_release(ctx);
     }
-- 
2.39.2
Re: [PATCH for-8.1] block-backend: remove qatomic_mb_read()
Posted by Stefan Hajnoczi 1 year ago
On Thu, 6 Apr 2023 at 06:08, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> There is already a barrier in AIO_WAIT_WHILE_INTERNAL(), thus the
> qatomic_mb_read() is not adding anything.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  block/block-backend.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>