io_uring_buf_ring_cq_advance(3)

✨ io_uring_buf_ring_cq_advance ✨

okay bestie, welcome to liburing manual page io_uring_buf_ring_cq_advance πŸ’– it's giving "advance index of provided buffer and CQ ring" and honestly? iconic behaviour.


🌸 SYNOPSIS 🌸

#include <liburing.h>

void io_uring_buf_ring_cq_advance(struct io_uring *ring,
                                  struct io_uring_buf_ring *br,
                                  int count);

void __io_uring_buf_ring_cq_advance(struct io_uring *ring,
                                    struct io_uring_buf_ring *br,
                                    int cq_count,
                                    int buf_count);

πŸ¦‹ DESCRIPTION πŸ¦‹

so. io_uring_buf_ring_cq_advance(3) is the moment where you finally commit β€” it takes count buffers that you already added and commits them into the shared buffer ring br, which makes them visible to the kernel and therefore consumable. the way this works is that it literally passes ownership of the buffer over to the ring, no takebacks 🫢

and while it's doing all that, it also advances the CQ ring of ring by count amount. so yeah, it's basically bundling a whole io_uring_buf_ring_advance(3) call and a io_uring_cq_advance(3) call into one single operation. two birds, one slay ✨

why does that matter? because updating either ring index entails a store memory barrier, so doing both of them at the same time is just more efficient. it's giving efficiency queen πŸ‘‘

now, __io_uring_buf_ring_cq_advance(3) does the exact same thing, except it lets you split the counts into two separate values instead of one. so it advances the CQ ring by cq_count entries and the buffer ring by buf_count entries, rather than incrementing both by the same number. lowkey more flexible, highkey still the same vibe πŸ’…


πŸŽ€ RETURN VALUE πŸŽ€

None. that's it. it returns nothing. no cap 🚫


🌈 SEE ALSO 🌈


and that's the whole page bestie!! this lil slice of wisdom came to you from liburing-2.2, dated May 18, 2022 β€” go forth and advance those rings, you absolute main character πŸ§šπŸ’œ

πŸ“¦ where this page comes from