X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=options.c;h=8c0c2abd295c667ddc195f7acaa34f9aa7ce5f14;hp=21de222ff7b7d5a2066d3d35fa4e7f63a6222180;hb=29d43ff9b1f342fe6658b17f0e349afcb6b76014;hpb=720e84ad8292ab7b3a8e264fb00db71d796600d1 diff --git a/options.c b/options.c index 21de222f..8c0c2abd 100644 --- a/options.c +++ b/options.c @@ -11,6 +11,7 @@ #include #include "fio.h" +#include "verify.h" #include "parse.h" #include "lib/fls.h" @@ -574,6 +575,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_rw_verify(struct fio_option *o, void *data) +{ + struct thread_data *td = data; + +#ifndef FIO_HAVE_CPU_AFFINITY + 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) @@ -605,7 +634,7 @@ static struct fio_option options[] = { .type = FIO_OPT_STR_STORE, .off1 = td_var_offset(filename), .cb = str_filename_cb, - .prio = 1, /* must come before "directory" */ + .prio = -1, /* must come after "directory" */ .help = "File(s) to use for the workload", }, { @@ -647,6 +676,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, @@ -812,7 +842,7 @@ static struct fio_option options[] = { { .name = "bs", .alias = "blocksize", - .type = FIO_OPT_STR_VAL_INT, + .type = FIO_OPT_INT, .off1 = td_var_offset(bs[DDIR_READ]), .off2 = td_var_offset(bs[DDIR_WRITE]), .minval = 1, @@ -823,7 +853,7 @@ static struct fio_option options[] = { { .name = "ba", .alias = "blockalign", - .type = FIO_OPT_STR_VAL_INT, + .type = FIO_OPT_INT, .off1 = td_var_offset(ba[DDIR_READ]), .off2 = td_var_offset(ba[DDIR_WRITE]), .minval = 1, @@ -930,6 +960,13 @@ static struct fio_option options[] = { .help = "Issue fsync for writes every given number of blocks", .def = "0", }, + { + .name = "fdatasync", + .type = FIO_OPT_INT, + .off1 = td_var_offset(fdatasync_blocks), + .help = "Issue fdatasync for writes every given number of blocks", + .def = "0", + }, { .name = "direct", .type = FIO_OPT_BOOL, @@ -1028,6 +1065,16 @@ static struct fio_option options[] = { #endif }, }, + { + .name = "iomem_align", + .alias = "mem_align", + .type = FIO_OPT_INT, + .off1 = td_var_offset(mem_align), + .minval = 0, + .help = "IO memory buffer offset alignment", + .def = "0", + .parent = "iomem", + }, { .name = "verify", .type = FIO_OPT_STR, @@ -1104,7 +1151,7 @@ static struct fio_option options[] = { }, { .name = "verify_interval", - .type = FIO_OPT_STR_VAL_INT, + .type = FIO_OPT_INT, .off1 = td_var_offset(verify_interval), .minval = 2 * sizeof(struct verify_header), .help = "Store verify buffer header every N bytes", @@ -1112,7 +1159,7 @@ static struct fio_option options[] = { }, { .name = "verify_offset", - .type = FIO_OPT_STR_VAL_INT, + .type = FIO_OPT_INT, .help = "Offset verify header location by N bytes", .def = "0", .cb = str_verify_offset_cb, @@ -1259,26 +1306,30 @@ static struct fio_option options[] = { { .name = "rate", .type = FIO_OPT_INT, - .off1 = td_var_offset(rate), + .off1 = td_var_offset(rate[0]), + .off2 = td_var_offset(rate[1]), .help = "Set bandwidth rate", }, { .name = "ratemin", .type = FIO_OPT_INT, - .off1 = td_var_offset(ratemin), + .off1 = td_var_offset(ratemin[0]), + .off2 = td_var_offset(ratemin[1]), .help = "Job must meet this rate or it will be shutdown", .parent = "rate", }, { .name = "rate_iops", .type = FIO_OPT_INT, - .off1 = td_var_offset(rate_iops), + .off1 = td_var_offset(rate_iops[0]), + .off2 = td_var_offset(rate_iops[1]), .help = "Limit IO used to this number of IO operations/sec", }, { .name = "rate_iops_min", .type = FIO_OPT_INT, - .off1 = td_var_offset(rate_iops_min), + .off1 = td_var_offset(rate_iops_min[0]), + .off2 = td_var_offset(rate_iops_min[1]), .help = "Job must meet this rate or it will be shutdown", .parent = "rate_iops", }, @@ -1334,6 +1385,13 @@ static struct fio_option options[] = { .help = "Create files when they are opened for IO", .def = "0", }, + { + .name = "pre_read", + .type = FIO_OPT_BOOL, + .off1 = td_var_offset(pre_read), + .help = "Preread files before starting official testing", + .def = "0", + }, { .name = "cpuload", .type = FIO_OPT_INT, @@ -1423,7 +1481,7 @@ static struct fio_option options[] = { }, { .name = "hugepage-size", - .type = FIO_OPT_STR_VAL_INT, + .type = FIO_OPT_INT, .off1 = td_var_offset(hugepage_size), .help = "When using hugepages, specify size of each page", .def = __stringify(FIO_HUGE_PAGE), @@ -1491,6 +1549,14 @@ 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", + .type = FIO_OPT_BOOL, + .off1 = td_var_offset(continue_on_error), + .help = "Continue on non-fatal errors during I/O", + .def = "0", }, { .name = NULL,