diff options
Diffstat (limited to 'src/liburing.h')
-rw-r--r-- | src/liburing.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/liburing.h b/src/liburing.h index a544fa5..158239a 100644 --- a/src/liburing.h +++ b/src/liburing.h @@ -6,6 +6,7 @@ #include <inttypes.h> #include "compat.h" #include "io_uring.h" +#include "barrier.h" /* * Library interface to io_uring @@ -68,6 +69,25 @@ extern int io_uring_submit(struct io_uring *ring); extern struct io_uring_sqe *io_uring_get_sqe(struct io_uring *ring); /* + * Must be called after io_uring_{get,wait}_completion() after the cqe has + * been processed by the application. + */ +static inline void io_uring_cqe_seen(struct io_uring *ring, + struct io_uring_cqe *cqe) +{ + if (cqe) { + struct io_uring_cq *cq = &ring->cq; + + (*cq->khead)++; + /* + * Ensure that the kernel sees our new head, the kernel has + * the matching read barrier. + */ + write_barrier(); + } +} + +/* * Command prep helpers */ static inline void io_uring_sqe_set_data(struct io_uring_sqe *sqe, void *data) |