X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;ds=inline;f=options.c;h=5aad00501c42b124cf9a7198c45aba5769c9baa2;hb=6839616ff2ac013c8b0fbeb2a97f6cf20976b9f3;hp=51914af4531e453d126aeecfa500fe8b4496cbf6;hpb=fcef0b35e58d0d676b1560d563b518212f84e78b;p=fio.git diff --git a/options.c b/options.c index 51914af4..5aad0050 100644 --- a/options.c +++ b/options.c @@ -6,6 +6,9 @@ #include #include #include +#include +#include +#include #include "fio.h" #include "parse.h" @@ -178,6 +181,24 @@ static int str_lockmem_cb(void fio_unused *data, unsigned long *val) return 0; } +static int str_rwmix_read_cb(void *data, unsigned int *val) +{ + struct thread_data *td = data; + + td->o.rwmix[DDIR_READ] = *val; + td->o.rwmix[DDIR_WRITE] = 100 - *val; + return 0; +} + +static int str_rwmix_write_cb(void *data, unsigned int *val) +{ + struct thread_data *td = data; + + td->o.rwmix[DDIR_WRITE] = *val; + td->o.rwmix[DDIR_READ] = 100 - *val; + return 0; +} + #ifdef FIO_HAVE_IOPRIO static int str_prioclass_cb(void *data, unsigned int *val) { @@ -982,7 +1003,7 @@ static struct fio_option options[] = { { .name = "rwmixread", .type = FIO_OPT_INT, - .off1 = td_var_offset(rwmix[DDIR_READ]), + .cb = str_rwmix_read_cb, .maxval = 100, .help = "Percentage of mixed workload that is reads", .def = "50", @@ -990,7 +1011,7 @@ static struct fio_option options[] = { { .name = "rwmixwrite", .type = FIO_OPT_INT, - .off1 = td_var_offset(rwmix[DDIR_WRITE]), + .cb = str_rwmix_write_cb, .maxval = 100, .help = "Percentage of mixed workload that is writes", .def = "50", @@ -1257,7 +1278,7 @@ void fio_options_dup_and_init(struct option *long_options) o = &options[0]; while (o->name) { - long_options[i].name = o->name; + long_options[i].name = (char *) o->name; long_options[i].val = FIO_GETOPT_JOB; if (o->type == FIO_OPT_STR_SET) long_options[i].has_arg = no_argument;