+ if (ld->iocbs_nr == (int) td->iodepth)
+ return FIO_Q_BUSY;
+
+ /*
+ * fsync is tricky, since it can fail and we need to do it
+ * serialized with other io. the reason is that linux doesn't
+ * support aio fsync yet. So return busy for the case where we
+ * have pending io, to let fio complete those first.
+ */
+ if (io_u->ddir == DDIR_SYNC) {
+ if (ld->iocbs_nr)
+ return FIO_Q_BUSY;
+ if (fsync(io_u->file->fd) < 0)
+ io_u->error = errno;
+
+ return FIO_Q_COMPLETED;
+ }
+
+ ld->iocbs[ld->iocbs_nr] = &io_u->iocb;
+ ld->iocbs_nr++;
+ return FIO_Q_QUEUED;
+}
+
+static int fio_libaio_commit(struct thread_data *td)
+{
+ struct libaio_data *ld = td->io_ops->data;
+ struct iocb **iocbs;
+ int ret, iocbs_nr;
+
+ if (!ld->iocbs_nr)
+ return 0;
+
+ iocbs_nr = ld->iocbs_nr;
+ iocbs = ld->iocbs;