From: Jens Axboe Date: Wed, 28 May 2008 08:33:32 +0000 (+0200) Subject: Fixup rwmixread/write options X-Git-Tag: fio-1.21-rc3~3^2 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=cb499fc4216eb4266c70ae238608f67def1758fe Fixup rwmixread/write options They would always end up as 50/50. Signed-off-by: Jens Axboe --- diff --git a/init.c b/init.c index ca4e2bf6..12913615 100644 --- a/init.c +++ b/init.c @@ -220,9 +220,6 @@ static int fixup_options(struct thread_data *td) return 1; } - if (o->rwmix[DDIR_READ] + o->rwmix[DDIR_WRITE] > 100) - o->rwmix[DDIR_WRITE] = 100 - o->rwmix[DDIR_READ]; - if (o->write_iolog_file && o->read_iolog_file) { log_err("fio: read iolog overrides write_iolog\n"); free(o->write_iolog_file); diff --git a/options.c b/options.c index 51914af4..b8df1da1 100644 --- a/options.c +++ b/options.c @@ -178,6 +178,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 +1000,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 +1008,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",