X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=options.c;h=0954ccdb2bd9138b45ad36d9b7cd25e0d8a2bdd3;hb=d561f2ab37ef5729882ef3c6e6ed8ee49414955f;hp=7135231eefeed59b73cf720c73aab14c5c66a3c8;hpb=d529ee1932bc85598900a3ef62f01293af87fbd8;p=fio.git diff --git a/options.c b/options.c index 7135231e..0954ccdb 100644 --- a/options.c +++ b/options.c @@ -303,14 +303,14 @@ static int str_cpumask_cb(void *data, unsigned int *val) return 0; } -static int str_cpus_allowed_cb(void *data, const char *input) +static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask, + const char *input) { - struct thread_data *td = data; char *cpu, *str, *p; long max_cpu; int ret = 0; - ret = fio_cpuset_init(&td->o.cpumask); + ret = fio_cpuset_init(mask); if (ret < 0) { log_err("fio: cpuset_init failed\n"); td_verror(td, ret, "fio_cpuset_init"); @@ -358,7 +358,7 @@ static int str_cpus_allowed_cb(void *data, const char *input) } dprint(FD_PARSE, "set cpu allowed %d\n", icpu); - fio_cpu_set(&td->o.cpumask, icpu); + fio_cpu_set(mask, icpu); icpu++; } if (ret) @@ -370,6 +370,30 @@ static int str_cpus_allowed_cb(void *data, const char *input) td->o.cpumask_set = 1; return ret; } + +static int str_cpus_allowed_cb(void *data, const char *input) +{ + struct thread_data *td = data; + int ret; + + ret = set_cpus_allowed(td, &td->o.cpumask, input); + if (!ret) + td->o.cpumask_set = 1; + + return ret; +} + +static int str_verify_cpus_allowed_cb(void *data, const char *input) +{ + struct thread_data *td = data; + int ret; + + ret = set_cpus_allowed(td, &td->o.verify_cpumask, input); + if (!ret) + td->o.verify_cpumask_set = 1; + + return ret; +} #endif static int str_fst_cb(void *data, const char *str) @@ -575,6 +599,34 @@ static int str_gtod_cpu_cb(void *data, int *il) return 0; } +static int rw_verify(struct fio_option *o, void *data) +{ + struct thread_data *td = data; + + if (read_only && td_write(td)) { + log_err("fio: job <%s> has write bit set, but fio is in" + " read-only mode\n", td->o.name); + return 1; + } + + return 0; +} + +static int gtod_cpu_verify(struct fio_option *o, void *data) +{ +#ifndef FIO_HAVE_CPU_AFFINITY + struct thread_data *td = data; + + if (td->o.gtod_cpu) { + log_err("fio: platform must support CPU affinity for" + "gettimeofday() offloading\n"); + return 1; + } +#endif + + return 0; +} + #define __stringify_1(x) #x #define __stringify(x) __stringify_1(x) @@ -648,6 +700,7 @@ static struct fio_option options[] = { .off1 = td_var_offset(td_ddir), .help = "IO direction", .def = "read", + .verify = rw_verify, .posval = { { .ival = "read", .oval = TD_DDIR_READ, @@ -1151,6 +1204,23 @@ static struct fio_option options[] = { .help = "Exit on a single verify failure, don't continue", .parent = "verify", }, + { + .name = "verify_async", + .type = FIO_OPT_INT, + .off1 = td_var_offset(verify_async), + .def = "0", + .help = "Number of async verifier threads to use", + .parent = "verify", + }, +#ifdef FIO_HAVE_CPU_AFFINITY + { + .name = "verify_async_cpus", + .type = FIO_OPT_STR, + .cb = str_verify_cpus_allowed_cb, + .help = "Set CPUs allowed for async verify threads", + .parent = "verify_async", + }, +#endif { .name = "write_iolog", .type = FIO_OPT_STR_STORE, @@ -1520,6 +1590,7 @@ static struct fio_option options[] = { .type = FIO_OPT_INT, .cb = str_gtod_cpu_cb, .help = "Setup dedicated gettimeofday() thread on this CPU", + .verify = gtod_cpu_verify, }, { .name = "continue_on_error",