+static struct fio_option options[] = {
+ {
+ .name = "userspace_reap",
+ .lname = "Libaio userspace reaping",
+ .type = FIO_OPT_STR_SET,
+ .off1 = offsetof(struct libaio_options, userspace_reap),
+ .help = "Use alternative user-space reap implementation",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_LIBAIO,
+ },
+#ifdef FIO_HAVE_IOPRIO_CLASS
+ {
+ .name = "cmdprio_percentage",
+ .lname = "high priority percentage",
+ .type = FIO_OPT_INT,
+ .off1 = offsetof(struct libaio_options,
+ cmdprio_options.percentage[DDIR_READ]),
+ .off2 = offsetof(struct libaio_options,
+ cmdprio_options.percentage[DDIR_WRITE]),
+ .minval = 0,
+ .maxval = 100,
+ .help = "Send high priority I/O this percentage of the time",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_LIBAIO,
+ },
+ {
+ .name = "cmdprio_class",
+ .lname = "Asynchronous I/O priority class",
+ .type = FIO_OPT_INT,
+ .off1 = offsetof(struct libaio_options,
+ cmdprio_options.class[DDIR_READ]),
+ .off2 = offsetof(struct libaio_options,
+ cmdprio_options.class[DDIR_WRITE]),
+ .help = "Set asynchronous IO priority class",
+ .minval = IOPRIO_MIN_PRIO_CLASS + 1,
+ .maxval = IOPRIO_MAX_PRIO_CLASS,
+ .interval = 1,
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_LIBAIO,
+ },
+ {
+ .name = "cmdprio",
+ .lname = "Asynchronous I/O priority level",
+ .type = FIO_OPT_INT,
+ .off1 = offsetof(struct libaio_options,
+ cmdprio_options.level[DDIR_READ]),
+ .off2 = offsetof(struct libaio_options,
+ cmdprio_options.level[DDIR_WRITE]),
+ .help = "Set asynchronous IO priority level",
+ .minval = IOPRIO_MIN_PRIO,
+ .maxval = IOPRIO_MAX_PRIO,
+ .interval = 1,
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_LIBAIO,
+ },
+ {
+ .name = "cmdprio_bssplit",
+ .lname = "Priority percentage block size split",
+ .type = FIO_OPT_STR_STORE,
+ .off1 = offsetof(struct libaio_options,
+ cmdprio_options.bssplit_str),
+ .help = "Set priority percentages for different block sizes",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_LIBAIO,
+ },
+#else
+ {
+ .name = "cmdprio_percentage",
+ .lname = "high priority percentage",
+ .type = FIO_OPT_UNSUPPORTED,
+ .help = "Your platform does not support I/O priority classes",
+ },
+ {
+ .name = "cmdprio_class",
+ .lname = "Asynchronous I/O priority class",
+ .type = FIO_OPT_UNSUPPORTED,
+ .help = "Your platform does not support I/O priority classes",
+ },
+ {
+ .name = "cmdprio",
+ .lname = "Asynchronous I/O priority level",
+ .type = FIO_OPT_UNSUPPORTED,
+ .help = "Your platform does not support I/O priority classes",
+ },
+ {
+ .name = "cmdprio_bssplit",
+ .lname = "Priority percentage block size split",
+ .type = FIO_OPT_UNSUPPORTED,
+ .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,
+ },
+};
+
+static inline void ring_inc(struct libaio_data *ld, unsigned int *val,
+ unsigned int add)
+{
+ if (ld->is_pow2)
+ *val = (*val + add) & (ld->entries - 1);