If we need to complete some events (min > 0), make sure we
have committed a pending batch.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
struct timespec *tvp = NULL;
int ret;
- if (min_events > 0) {
- ret = td_io_commit(td);
- if (ret < 0) {
- td_verror(td, -ret, "td_io_commit");
- return ret;
- }
- } else {
+ if (!min_events) {
struct timespec ts = { .tv_sec = 0, .tv_nsec = 0, };
tvp = &ts;
int td_io_getevents(struct thread_data *td, int min, int max,
struct timespec *t)
{
+ if (min > 0 && td->io_ops->commit) {
+ int r = td->io_ops->commit(td);
+
+ if (r < 0)
+ return r;
+ }
if (td->io_ops->getevents)
return td->io_ops->getevents(td, min, max, t);