Respect iodepth_batch_complete=0 in main loop
[fio.git] / engines / libaio.c
index e452f1ca7c55f630c18c49186ece3f091713d0db..439cd242dd9e0aab6df2ad65cda1daba35ee0140 100644 (file)
@@ -32,10 +32,8 @@ static int fio_libaio_prep(struct thread_data fio_unused *td, struct io_u *io_u)
                io_prep_pread(&io_u->iocb, f->fd, io_u->xfer_buf, io_u->xfer_buflen, io_u->offset);
        else if (io_u->ddir == DDIR_WRITE)
                io_prep_pwrite(&io_u->iocb, f->fd, io_u->xfer_buf, io_u->xfer_buflen, io_u->offset);
-       else if (io_u->ddir == DDIR_SYNC)
+       else if (ddir_sync(io_u->ddir))
                io_prep_fsync(&io_u->iocb, f->fd);
-       else
-               return 1;
 
        return 0;
 }
@@ -97,12 +95,19 @@ static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u)
         * 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 (ddir_sync(io_u->ddir)) {
+               if (ld->iocbs_nr)
+                       return FIO_Q_BUSY;
+
+               do_io_u_sync(td, io_u);
+               return FIO_Q_COMPLETED;
+       }
+
+       if (io_u->ddir == DDIR_TRIM) {
                if (ld->iocbs_nr)
                        return FIO_Q_BUSY;
-               if (fsync(io_u->file->fd) < 0)
-                       io_u->error = errno;
 
+               do_io_u_trim(td, io_u);
                return FIO_Q_COMPLETED;
        }
 
@@ -235,7 +240,7 @@ static struct ioengine_ops ioengine = {
  */
 static int fio_libaio_init(struct thread_data fio_unused *td)
 {
-       fprintf(stderr, "fio: libaio not available\n");
+       log_err("fio: libaio not available\n");
        return 1;
 }