Fixup rwmixread/write options
[fio.git] / options.c
index 51914af4531e453d126aeecfa500fe8b4496cbf6..b8df1da1f90756f68cd5fd15b50500b646ba55b3 100644 (file)
--- a/options.c
+++ b/options.c
@@ -178,6 +178,24 @@ static int str_lockmem_cb(void fio_unused *data, unsigned long *val)
        return 0;
 }
 
        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)
 {
 #ifdef FIO_HAVE_IOPRIO
 static int str_prioclass_cb(void *data, unsigned int *val)
 {
@@ -982,7 +1000,7 @@ static struct fio_option options[] = {
        {
                .name   = "rwmixread",
                .type   = FIO_OPT_INT,
        {
                .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",
                .maxval = 100,
                .help   = "Percentage of mixed workload that is reads",
                .def    = "50",
@@ -990,7 +1008,7 @@ static struct fio_option options[] = {
        {
                .name   = "rwmixwrite",
                .type   = FIO_OPT_INT,
        {
                .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",
                .maxval = 100,
                .help   = "Percentage of mixed workload that is writes",
                .def    = "50",