engines/io_uring: update getevents max to reflect previously seen events
authorLeah Rumancik <leah.rumancik@gmail.com>
Mon, 10 Apr 2023 18:57:15 +0000 (11:57 -0700)
committerLeah Rumancik <leah.rumancik@gmail.com>
Mon, 10 Apr 2023 21:10:56 +0000 (14:10 -0700)
To ensure we don't return more than the requested number of events,
update the max events variable after reaping events before subsequent
calls to io_getevents system call.

Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
engines/io_uring.c

index f10a45933ff5bb1877b072538547ee2e637a69d5..7f743c2a88ade6e964edda2a6f6f306db6299f39 100644 (file)
@@ -529,6 +529,7 @@ static int fio_ioring_getevents(struct thread_data *td, unsigned int min,
                r = fio_ioring_cqring_reap(td, events, max);
                if (r) {
                        events += r;
+                       max -= r;
                        if (actual_min != 0)
                                actual_min -= r;
                        continue;