From ec87e8c198a341f5649020a24516c04293ed8787 Mon Sep 17 00:00:00 2001 From: Caleb Sander Mateos Date: Thu, 17 Jul 2025 11:03:20 -0600 Subject: [PATCH] engines/io_uring: consolidate fio_ioring_cqring_reap() arguments fio_ioring_cqring_reap() takes both an events and a max argument and will return up to events - max CQEs. Only one of the two callers passes an existing events count. So remove the events argument and have fio_ioring_getevents() pass events - max instead. This simplifies the function signature and avoids an addition inside the loop over CQEs. Signed-off-by: Caleb Sander Mateos --- engines/io_uring.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/engines/io_uring.c b/engines/io_uring.c index 083e1679..2d7edcc8 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -674,8 +674,7 @@ static char *fio_ioring_cmd_errdetails(struct thread_data *td, return msg; } -static int fio_ioring_cqring_reap(struct thread_data *td, unsigned int events, - unsigned int max) +static int fio_ioring_cqring_reap(struct thread_data *td, unsigned int max) { struct ioring_data *ld = td->io_ops_data; struct io_cq_ring *ring = &ld->cq_ring; @@ -687,7 +686,7 @@ static int fio_ioring_cqring_reap(struct thread_data *td, unsigned int events, break; reaped++; head++; - } while (reaped + events < max); + } while (reaped < max); if (reaped) atomic_store_release(ring->head, head); @@ -707,7 +706,7 @@ static int fio_ioring_getevents(struct thread_data *td, unsigned int min, ld->cq_ring_off = *ring->head; do { - r = fio_ioring_cqring_reap(td, events, max); + r = fio_ioring_cqring_reap(td, max - events); if (r) { events += r; if (actual_min != 0) @@ -883,7 +882,7 @@ static int fio_ioring_commit(struct thread_data *td) continue; } else { if (errno == EAGAIN || errno == EINTR) { - ret = fio_ioring_cqring_reap(td, 0, ld->queued); + ret = fio_ioring_cqring_reap(td, ld->queued); if (ret) continue; /* Shouldn't happen */ -- 2.25.1