#define IOCB_FLAG_IOPRIO (1 << 1)
#endif
+/* Hack for libaio < 0.3.111 */
+#ifndef CONFIG_LIBAIO_RW_FLAGS
+#define aio_rw_flags __pad2
+#endif
+
static int fio_libaio_commit(struct thread_data *td);
static int fio_libaio_init(struct thread_data *td);
void *pad;
unsigned int userspace_reap;
unsigned int cmdprio_percentage;
+ unsigned int nowait;
};
static struct fio_option options[] = {
.help = "Your platform does not support I/O priority classes",
},
#endif
+ {
+ .name = "nowait",
+ .lname = "RWF_NOWAIT",
+ .type = FIO_OPT_BOOL,
+ .off1 = offsetof(struct libaio_options, nowait),
+ .help = "Set RWF_NOWAIT for reads/writes",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_LIBAIO,
+ },
{
.name = NULL,
},
*val = (*val + add) % ld->entries;
}
-static int fio_libaio_prep(struct thread_data fio_unused *td, struct io_u *io_u)
+static int fio_libaio_prep(struct thread_data *td, struct io_u *io_u)
{
+ struct libaio_options *o = td->eo;
struct fio_file *f = io_u->file;
struct iocb *iocb = &io_u->iocb;
if (io_u->ddir == DDIR_READ) {
io_prep_pread(iocb, f->fd, io_u->xfer_buf, io_u->xfer_buflen, io_u->offset);
+ if (o->nowait)
+ iocb->aio_rw_flags |= RWF_NOWAIT;
} else if (io_u->ddir == DDIR_WRITE) {
io_prep_pwrite(iocb, f->fd, io_u->xfer_buf, io_u->xfer_buflen, io_u->offset);
+ if (o->nowait)
+ iocb->aio_rw_flags |= RWF_NOWAIT;
} else if (ddir_sync(io_u->ddir))
io_prep_fsync(iocb, f->fd);
} else {
/* There is another completion to reap */
events[i] = ring->events[head];
- read_barrier();
- ring->head = (head + 1) % ring->nr;
+ atomic_store_release(&ring->head,
+ (head + 1) % ring->nr);
i++;
}
}
return 0;
}
-static struct ioengine_ops ioengine = {
+FIO_STATIC struct ioengine_ops ioengine = {
.name = "libaio",
.version = FIO_IOOPS_VERSION,
.flags = FIO_ASYNCIO_SYNC_TRIM,