#include "../lib/pow2.h"
#include "../optgroup.h"
+#define IOCB_CMD_PREAD_POLL 9
+#define IOCB_CMD_PWRITE_POLL 10
+
static int fio_libaio_commit(struct thread_data *td);
struct libaio_data {
struct libaio_options {
void *pad;
unsigned int userspace_reap;
+ unsigned int hipri;
};
static struct fio_option options[] = {
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_LIBAIO,
},
+ {
+ .name = "hipri",
+ .lname = "RWF_HIPRI",
+ .type = FIO_OPT_STR_SET,
+ .off1 = offsetof(struct libaio_options, hipri),
+ .help = "Set RWF_HIPRI for pwritev2/preadv2",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_LIBAIO,
+ },
{
.name = NULL,
},
static int fio_libaio_prep(struct thread_data fio_unused *td, struct io_u *io_u)
{
struct fio_file *f = io_u->file;
+ struct libaio_options *o = td->eo;
- if (io_u->ddir == DDIR_READ)
+ if (io_u->ddir == DDIR_READ) {
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)
+ if (o->hipri)
+ io_u->iocb.aio_lio_opcode = IOCB_CMD_PREAD_POLL;
+ } 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 (ddir_sync(io_u->ddir))
+ if (o->hipri)
+ io_u->iocb.aio_lio_opcode = IOCB_CMD_PWRITE_POLL;
+ } else if (ddir_sync(io_u->ddir))
io_prep_fsync(&io_u->iocb, f->fd);
return 0;