engines/libaio: Use atomic_store_release() instead of read_barrier()
authorBart Van Assche <bvanassche@acm.org>
Sun, 21 Jun 2020 21:16:59 +0000 (14:16 -0700)
committerBart Van Assche <bvanassche@acm.org>
Mon, 22 Jun 2020 02:19:27 +0000 (19:19 -0700)
This is a micro-optimization that does not affect the functionality of the
code.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
engines/libaio.c

index daa576dad3e64b97f4af427633921f0ab9c61e6c..398fdf91d55b3b89cb0307bb68ef8bf38753bf39 100644 (file)
@@ -195,8 +195,8 @@ static int user_io_getevents(io_context_t aio_ctx, unsigned int max,
                } else {
                        /* There is another completion to reap */
                        events[i] = ring->events[head];
-                       read_barrier();
-                       ring->head = (head + 1) % ring->nr;
+                       atomic_store_release(&ring->head,
+                                            (head + 1) % ring->nr);
                        i++;
                }
        }