18 #include "crc/crc32c.h"
21 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
23 static char *get_opt_postfix(const char *str)
25 char *p = strstr(str, ":");
31 strip_blank_front(&p);
36 static int converthexchartoint(char a)
56 static int bs_cmp(const void *p1, const void *p2)
58 const struct bssplit *bsp1 = p1;
59 const struct bssplit *bsp2 = p2;
61 return bsp1->perc < bsp2->perc;
64 static int bssplit_ddir(struct thread_options *o, int ddir, char *str)
66 struct bssplit *bssplit;
67 unsigned int i, perc, perc_missing;
68 unsigned int max_bs, min_bs;
72 o->bssplit_nr[ddir] = 4;
73 bssplit = malloc(4 * sizeof(struct bssplit));
78 while ((fname = strsep(&str, ":")) != NULL) {
85 * grow struct buffer, if needed
87 if (i == o->bssplit_nr[ddir]) {
88 o->bssplit_nr[ddir] <<= 1;
89 bssplit = realloc(bssplit, o->bssplit_nr[ddir]
90 * sizeof(struct bssplit));
93 perc_str = strstr(fname, "/");
97 perc = atoi(perc_str);
105 if (str_to_decimal(fname, &val, 1, o)) {
106 log_err("fio: bssplit conversion failed\n");
117 bssplit[i].perc = perc;
121 o->bssplit_nr[ddir] = i;
124 * Now check if the percentages add up, and how much is missing
126 perc = perc_missing = 0;
127 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
128 struct bssplit *bsp = &bssplit[i];
130 if (bsp->perc == (unsigned char) -1)
137 log_err("fio: bssplit percentages add to more than 100%%\n");
142 * If values didn't have a percentage set, divide the remains between
146 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
147 struct bssplit *bsp = &bssplit[i];
149 if (bsp->perc == (unsigned char) -1)
150 bsp->perc = (100 - perc) / perc_missing;
154 o->min_bs[ddir] = min_bs;
155 o->max_bs[ddir] = max_bs;
158 * now sort based on percentages, for ease of lookup
160 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
161 o->bssplit[ddir] = bssplit;
165 static int str_bssplit_cb(void *data, const char *input)
167 struct thread_data *td = data;
168 char *str, *p, *odir, *ddir;
171 p = str = strdup(input);
173 strip_blank_front(&str);
174 strip_blank_end(str);
176 odir = strchr(str, ',');
178 ddir = strchr(odir + 1, ',');
180 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
186 op = strdup(odir + 1);
187 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
192 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
195 ret = bssplit_ddir(&td->o, DDIR_READ, str);
201 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
206 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
209 ret = bssplit_ddir(&td->o, DDIR_READ, str);
216 static int str2error(char *str)
218 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
219 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
220 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
221 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
222 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
223 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
224 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
225 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
226 int i = 0, num = sizeof(err) / sizeof(void *);
229 if (!strcmp(err[i], str))
236 static int ignore_error_type(struct thread_data *td, int etype, char *str)
242 if (etype >= ERROR_TYPE_CNT) {
243 log_err("Illegal error type\n");
247 td->o.ignore_error_nr[etype] = 4;
248 error = malloc(4 * sizeof(struct bssplit));
251 while ((fname = strsep(&str, ":")) != NULL) {
257 * grow struct buffer, if needed
259 if (i == td->o.ignore_error_nr[etype]) {
260 td->o.ignore_error_nr[etype] <<= 1;
261 error = realloc(error, td->o.ignore_error_nr[etype]
264 if (fname[0] == 'E') {
265 error[i] = str2error(fname);
267 error[i] = atoi(fname);
272 log_err("Unknown error %s, please use number value \n",
279 td->o.continue_on_error |= 1 << etype;
280 td->o.ignore_error_nr[etype] = i;
281 td->o.ignore_error[etype] = error;
287 static int str_ignore_error_cb(void *data, const char *input)
289 struct thread_data *td = data;
291 int type = 0, ret = 1;
292 p = str = strdup(input);
294 strip_blank_front(&str);
295 strip_blank_end(str);
301 ret = ignore_error_type(td, type, p);
311 static int str_rw_cb(void *data, const char *str)
313 struct thread_data *td = data;
314 struct thread_options *o = &td->o;
315 char *nr = get_opt_postfix(str);
324 o->ddir_seq_nr = atoi(nr);
328 if (str_to_decimal(nr, &val, 1, o)) {
329 log_err("fio: rw postfix parsing failed\n");
334 o->ddir_seq_add = val;
341 static int str_mem_cb(void *data, const char *mem)
343 struct thread_data *td = data;
344 struct thread_options *o = &td->o;
346 if (o->mem_type == MEM_MMAPHUGE || o->mem_type == MEM_MMAP) {
347 o->mmapfile = get_opt_postfix(mem);
348 if (o->mem_type == MEM_MMAPHUGE && !o->mmapfile) {
349 log_err("fio: mmaphuge:/path/to/file\n");
357 static int fio_clock_source_cb(void *data, const char *str)
359 struct thread_data *td = data;
361 fio_clock_source = td->o.clocksource;
362 fio_clock_source_set = 1;
367 static int str_rwmix_read_cb(void *data, unsigned long long *val)
369 struct thread_data *td = data;
371 td->o.rwmix[DDIR_READ] = *val;
372 td->o.rwmix[DDIR_WRITE] = 100 - *val;
376 static int str_rwmix_write_cb(void *data, unsigned long long *val)
378 struct thread_data *td = data;
380 td->o.rwmix[DDIR_WRITE] = *val;
381 td->o.rwmix[DDIR_READ] = 100 - *val;
385 static int str_exitall_cb(void)
387 exitall_on_terminate = 1;
391 #ifdef FIO_HAVE_CPU_AFFINITY
392 static int str_cpumask_cb(void *data, unsigned long long *val)
394 struct thread_data *td = data;
399 ret = fio_cpuset_init(&td->o.cpumask);
401 log_err("fio: cpuset_init failed\n");
402 td_verror(td, ret, "fio_cpuset_init");
406 max_cpu = cpus_online();
408 for (i = 0; i < sizeof(int) * 8; i++) {
409 if ((1 << i) & *val) {
411 log_err("fio: CPU %d too large (max=%ld)\n", i,
415 dprint(FD_PARSE, "set cpu allowed %d\n", i);
416 fio_cpu_set(&td->o.cpumask, i);
420 td->o.cpumask_set = 1;
424 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
431 ret = fio_cpuset_init(mask);
433 log_err("fio: cpuset_init failed\n");
434 td_verror(td, ret, "fio_cpuset_init");
438 p = str = strdup(input);
440 strip_blank_front(&str);
441 strip_blank_end(str);
443 max_cpu = cpus_online();
445 while ((cpu = strsep(&str, ",")) != NULL) {
454 while ((cpu2 = strsep(&str2, "-")) != NULL) {
464 while (icpu <= icpu2) {
465 if (icpu >= FIO_MAX_CPUS) {
466 log_err("fio: your OS only supports up to"
467 " %d CPUs\n", (int) FIO_MAX_CPUS);
471 if (icpu > max_cpu) {
472 log_err("fio: CPU %d too large (max=%ld)\n",
478 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
479 fio_cpu_set(mask, icpu);
488 td->o.cpumask_set = 1;
492 static int str_cpus_allowed_cb(void *data, const char *input)
494 struct thread_data *td = data;
497 ret = set_cpus_allowed(td, &td->o.cpumask, input);
499 td->o.cpumask_set = 1;
504 static int str_verify_cpus_allowed_cb(void *data, const char *input)
506 struct thread_data *td = data;
509 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
511 td->o.verify_cpumask_set = 1;
517 #ifdef FIO_HAVE_LIBNUMA
518 static int str_numa_cpunodes_cb(void *data, char *input)
520 struct thread_data *td = data;
522 /* numa_parse_nodestring() parses a character string list
523 * of nodes into a bit mask. The bit mask is allocated by
524 * numa_allocate_nodemask(), so it should be freed by
525 * numa_free_nodemask().
527 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
528 if (td->o.numa_cpunodesmask == NULL) {
529 log_err("fio: numa_parse_nodestring failed\n");
530 td_verror(td, 1, "str_numa_cpunodes_cb");
534 td->o.numa_cpumask_set = 1;
538 static int str_numa_mpol_cb(void *data, char *input)
540 struct thread_data *td = data;
541 const char * const policy_types[] =
542 { "default", "prefer", "bind", "interleave", "local" };
545 char *nodelist = strchr(input, ':');
547 /* NUL-terminate mode */
551 for (i = 0; i <= MPOL_LOCAL; i++) {
552 if (!strcmp(input, policy_types[i])) {
553 td->o.numa_mem_mode = i;
557 if (i > MPOL_LOCAL) {
558 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
562 switch (td->o.numa_mem_mode) {
565 * Insist on a nodelist of one node only
568 char *rest = nodelist;
569 while (isdigit(*rest))
572 log_err("fio: one node only for \'prefer\'\n");
576 log_err("fio: one node is needed for \'prefer\'\n");
580 case MPOL_INTERLEAVE:
582 * Default to online nodes with memory if no nodelist
585 nodelist = strdup("all");
590 * Don't allow a nodelist
593 log_err("fio: NO nodelist for \'local\'\n");
599 * Insist on a nodelist
602 log_err("fio: a nodelist is needed for \'bind\'\n");
609 /* numa_parse_nodestring() parses a character string list
610 * of nodes into a bit mask. The bit mask is allocated by
611 * numa_allocate_nodemask(), so it should be freed by
612 * numa_free_nodemask().
614 switch (td->o.numa_mem_mode) {
616 td->o.numa_mem_prefer_node = atoi(nodelist);
618 case MPOL_INTERLEAVE:
620 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
621 if (td->o.numa_memnodesmask == NULL) {
622 log_err("fio: numa_parse_nodestring failed\n");
623 td_verror(td, 1, "str_numa_memnodes_cb");
633 td->o.numa_memmask_set = 1;
641 static int str_fst_cb(void *data, const char *str)
643 struct thread_data *td = data;
644 char *nr = get_opt_postfix(str);
646 td->file_service_nr = 1;
648 td->file_service_nr = atoi(nr);
655 #ifdef FIO_HAVE_SYNC_FILE_RANGE
656 static int str_sfr_cb(void *data, const char *str)
658 struct thread_data *td = data;
659 char *nr = get_opt_postfix(str);
661 td->sync_file_range_nr = 1;
663 td->sync_file_range_nr = atoi(nr);
671 static int str_random_distribution_cb(void *data, const char *str)
673 struct thread_data *td = data;
677 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
679 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
684 nr = get_opt_postfix(str);
685 if (nr && !str_to_float(nr, &val)) {
686 log_err("fio: random postfix parsing failed\n");
693 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
695 log_err("fio: zipf theta must different than 1.0\n");
698 td->o.zipf_theta.u.f = val;
700 if (val <= 0.00 || val >= 1.00) {
701 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
704 td->o.pareto_h.u.f = val;
711 * Return next file in the string. Files are separated with ':'. If the ':'
712 * is escaped with a '\', then that ':' is part of the filename and does not
713 * indicate a new file.
715 static char *get_next_file_name(char **ptr)
720 if (!str || !strlen(str))
726 * No colon, we are done
728 p = strchr(str, ':');
735 * We got a colon, but it's the first character. Skip and
743 if (*(p - 1) != '\\') {
749 memmove(p - 1, p, strlen(p) + 1);
756 static int str_filename_cb(void *data, const char *input)
758 struct thread_data *td = data;
759 char *fname, *str, *p;
761 p = str = strdup(input);
763 strip_blank_front(&str);
764 strip_blank_end(str);
766 if (!td->files_index)
769 while ((fname = get_next_file_name(&str)) != NULL) {
780 static int str_directory_cb(void *data, const char fio_unused *str)
782 struct thread_data *td = data;
785 if (lstat(td->o.directory, &sb) < 0) {
788 log_err("fio: %s is not a directory\n", td->o.directory);
789 td_verror(td, ret, "lstat");
792 if (!S_ISDIR(sb.st_mode)) {
793 log_err("fio: %s is not a directory\n", td->o.directory);
800 static int str_opendir_cb(void *data, const char fio_unused *str)
802 struct thread_data *td = data;
804 if (!td->files_index)
807 return add_dir_files(td, td->o.opendir);
810 static int str_verify_pattern_cb(void *data, const char *input)
812 struct thread_data *td = data;
814 int i = 0, j = 0, len, k, base = 10;
817 loc1 = strstr(input, "0x");
818 loc2 = strstr(input, "0X");
821 off = strtol(input, NULL, base);
822 if (off != LONG_MAX || errno != ERANGE) {
824 td->o.verify_pattern[i] = off & 0xff;
833 j = loc1 - input + 2;
835 j = loc2 - input + 2;
838 if (len - j < MAX_PATTERN_SIZE * 2) {
840 off = converthexchartoint(input[k--]);
842 off += (converthexchartoint(input[k--])
844 td->o.verify_pattern[i++] = (char) off;
850 * Fill the pattern all the way to the end. This greatly reduces
851 * the number of memcpy's we have to do when verifying the IO.
853 while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) {
854 memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i);
859 * The code in verify_io_u_pattern assumes a single byte pattern
860 * fills the whole verify pattern buffer.
862 memset(td->o.verify_pattern, td->o.verify_pattern[0],
866 td->o.verify_pattern_bytes = i;
869 * VERIFY_META could already be set
871 if (td->o.verify == VERIFY_NONE)
872 td->o.verify = VERIFY_PATTERN;
877 static int str_lockfile_cb(void *data, const char *str)
879 struct thread_data *td = data;
880 char *nr = get_opt_postfix(str);
882 td->o.lockfile_batch = 1;
884 td->o.lockfile_batch = atoi(nr);
891 static int str_gtod_reduce_cb(void *data, int *il)
893 struct thread_data *td = data;
896 td->o.disable_lat = !!val;
897 td->o.disable_clat = !!val;
898 td->o.disable_slat = !!val;
899 td->o.disable_bw = !!val;
900 td->o.clat_percentiles = !val;
902 td->tv_cache_mask = 63;
907 static int str_gtod_cpu_cb(void *data, long long *il)
909 struct thread_data *td = data;
912 td->o.gtod_cpu = val;
913 td->o.gtod_offload = 1;
917 static int str_size_cb(void *data, unsigned long long *__val)
919 struct thread_data *td = data;
920 unsigned long long v = *__val;
922 if (parse_is_percent(v)) {
924 td->o.size_percent = -1ULL - v;
931 static int rw_verify(struct fio_option *o, void *data)
933 struct thread_data *td = data;
935 if (read_only && td_write(td)) {
936 log_err("fio: job <%s> has write bit set, but fio is in"
937 " read-only mode\n", td->o.name);
944 static int gtod_cpu_verify(struct fio_option *o, void *data)
946 #ifndef FIO_HAVE_CPU_AFFINITY
947 struct thread_data *td = data;
949 if (td->o.gtod_cpu) {
950 log_err("fio: platform must support CPU affinity for"
951 "gettimeofday() offloading\n");
959 static int kb_base_verify(struct fio_option *o, void *data)
961 struct thread_data *td = data;
963 if (td->o.kb_base != 1024 && td->o.kb_base != 1000) {
964 log_err("fio: kb_base set to nonsensical value: %u\n",
975 static struct opt_group fio_opt_groups[] = {
978 .mask = FIO_OPT_C_GENERAL,
982 .mask = FIO_OPT_C_IO,
986 .mask = FIO_OPT_C_FILE,
989 .name = "Statistics",
990 .mask = FIO_OPT_C_STAT,
994 .mask = FIO_OPT_C_LOG,
998 .mask = FIO_OPT_C_PROFILE,
1005 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1006 unsigned int inv_mask)
1008 struct opt_group *og;
1011 if (*mask == inv_mask || !*mask)
1014 for (i = 0; ogs[i].name; i++) {
1017 if (*mask & og->mask) {
1018 *mask &= ~(og->mask);
1026 struct opt_group *opt_group_from_mask(unsigned int *mask)
1028 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1031 static struct opt_group fio_opt_cat_groups[] = {
1034 .mask = FIO_OPT_G_RATE,
1038 .mask = FIO_OPT_G_ZONE,
1041 .name = "Read/write mix",
1042 .mask = FIO_OPT_G_RWMIX,
1046 .mask = FIO_OPT_G_VERIFY,
1050 .mask = FIO_OPT_G_TRIM,
1053 .name = "I/O Logging",
1054 .mask = FIO_OPT_G_IOLOG,
1057 .name = "I/O Depth",
1058 .mask = FIO_OPT_G_IO_DEPTH,
1062 .mask = FIO_OPT_G_IO_FLOW,
1065 .name = "Description",
1066 .mask = FIO_OPT_G_DESC,
1070 .mask = FIO_OPT_G_FILENAME,
1073 .name = "General I/O",
1074 .mask = FIO_OPT_G_IO_BASIC,
1078 .mask = FIO_OPT_G_CGROUP,
1082 .mask = FIO_OPT_G_RUNTIME,
1086 .mask = FIO_OPT_G_PROCESS,
1089 .name = "Job credentials / priority",
1090 .mask = FIO_OPT_G_CRED,
1093 .name = "Clock settings",
1094 .mask = FIO_OPT_G_CLOCK,
1098 .mask = FIO_OPT_G_IO_TYPE,
1101 .name = "I/O Thinktime",
1102 .mask = FIO_OPT_G_THINKTIME,
1105 .name = "Randomizations",
1106 .mask = FIO_OPT_G_RANDOM,
1109 .name = "I/O buffers",
1110 .mask = FIO_OPT_G_IO_BUF,
1113 .name = "Tiobench profile",
1114 .mask = FIO_OPT_G_TIOBENCH,
1122 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1124 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1128 * Map of job/command line options
1130 struct fio_option fio_options[FIO_MAX_OPTS] = {
1132 .name = "description",
1133 .lname = "Description of job",
1134 .type = FIO_OPT_STR_STORE,
1135 .off1 = td_var_offset(description),
1136 .help = "Text job description",
1137 .category = FIO_OPT_C_GENERAL,
1138 .group = FIO_OPT_G_DESC,
1142 .lname = "Job name",
1143 .type = FIO_OPT_STR_STORE,
1144 .off1 = td_var_offset(name),
1145 .help = "Name of this job",
1146 .category = FIO_OPT_C_GENERAL,
1147 .group = FIO_OPT_G_DESC,
1151 .lname = "Filename(s)",
1152 .type = FIO_OPT_STR_STORE,
1153 .off1 = td_var_offset(filename),
1154 .cb = str_filename_cb,
1155 .prio = -1, /* must come after "directory" */
1156 .help = "File(s) to use for the workload",
1157 .category = FIO_OPT_C_FILE,
1158 .group = FIO_OPT_G_FILENAME,
1161 .name = "directory",
1162 .lname = "Directory",
1163 .type = FIO_OPT_STR_STORE,
1164 .off1 = td_var_offset(directory),
1165 .cb = str_directory_cb,
1166 .help = "Directory to store files in",
1167 .category = FIO_OPT_C_FILE,
1168 .group = FIO_OPT_G_FILENAME,
1172 .lname = "Lockfile",
1173 .type = FIO_OPT_STR,
1174 .cb = str_lockfile_cb,
1175 .off1 = td_var_offset(file_lock_mode),
1176 .help = "Lock file when doing IO to it",
1177 .parent = "filename",
1180 .category = FIO_OPT_C_FILE,
1181 .group = FIO_OPT_G_FILENAME,
1184 .oval = FILE_LOCK_NONE,
1185 .help = "No file locking",
1187 { .ival = "exclusive",
1188 .oval = FILE_LOCK_EXCLUSIVE,
1189 .help = "Exclusive file lock",
1192 .ival = "readwrite",
1193 .oval = FILE_LOCK_READWRITE,
1194 .help = "Read vs write lock",
1200 .lname = "Open directory",
1201 .type = FIO_OPT_STR_STORE,
1202 .off1 = td_var_offset(opendir),
1203 .cb = str_opendir_cb,
1204 .help = "Recursively add files from this directory and down",
1205 .category = FIO_OPT_C_FILE,
1206 .group = FIO_OPT_G_FILENAME,
1210 .lname = "Read/write",
1211 .alias = "readwrite",
1212 .type = FIO_OPT_STR,
1214 .off1 = td_var_offset(td_ddir),
1215 .help = "IO direction",
1217 .verify = rw_verify,
1218 .category = FIO_OPT_C_IO,
1219 .group = FIO_OPT_G_IO_BASIC,
1222 .oval = TD_DDIR_READ,
1223 .help = "Sequential read",
1226 .oval = TD_DDIR_WRITE,
1227 .help = "Sequential write",
1230 .oval = TD_DDIR_TRIM,
1231 .help = "Sequential trim",
1233 { .ival = "randread",
1234 .oval = TD_DDIR_RANDREAD,
1235 .help = "Random read",
1237 { .ival = "randwrite",
1238 .oval = TD_DDIR_RANDWRITE,
1239 .help = "Random write",
1241 { .ival = "randtrim",
1242 .oval = TD_DDIR_RANDTRIM,
1243 .help = "Random trim",
1247 .help = "Sequential read and write mix",
1249 { .ival = "readwrite",
1251 .help = "Sequential read and write mix",
1254 .oval = TD_DDIR_RANDRW,
1255 .help = "Random read and write mix"
1260 .name = "rw_sequencer",
1261 .lname = "RW Sequencer",
1262 .type = FIO_OPT_STR,
1263 .off1 = td_var_offset(rw_seq),
1264 .help = "IO offset generator modifier",
1265 .def = "sequential",
1266 .category = FIO_OPT_C_IO,
1267 .group = FIO_OPT_G_IO_BASIC,
1269 { .ival = "sequential",
1271 .help = "Generate sequential offsets",
1273 { .ival = "identical",
1274 .oval = RW_SEQ_IDENT,
1275 .help = "Generate identical offsets",
1282 .lname = "IO Engine",
1283 .type = FIO_OPT_STR_STORE,
1284 .off1 = td_var_offset(ioengine),
1285 .help = "IO engine to use",
1286 .def = FIO_PREFERRED_ENGINE,
1287 .category = FIO_OPT_C_IO,
1288 .group = FIO_OPT_G_IO_BASIC,
1291 .help = "Use read/write",
1294 .help = "Use pread/pwrite",
1297 .help = "Use readv/writev",
1299 #ifdef FIO_HAVE_LIBAIO
1301 .help = "Linux native asynchronous IO",
1304 #ifdef FIO_HAVE_POSIXAIO
1305 { .ival = "posixaio",
1306 .help = "POSIX asynchronous IO",
1309 #ifdef FIO_HAVE_SOLARISAIO
1310 { .ival = "solarisaio",
1311 .help = "Solaris native asynchronous IO",
1314 #ifdef FIO_HAVE_WINDOWSAIO
1315 { .ival = "windowsaio",
1316 .help = "Windows native asynchronous IO"
1320 .help = "Memory mapped IO"
1322 #ifdef FIO_HAVE_SPLICE
1324 .help = "splice/vmsplice based IO",
1326 { .ival = "netsplice",
1327 .help = "splice/vmsplice to/from the network",
1330 #ifdef FIO_HAVE_SGIO
1332 .help = "SCSI generic v3 IO",
1336 .help = "Testing engine (no data transfer)",
1339 .help = "Network IO",
1341 #ifdef FIO_HAVE_SYSLET
1342 { .ival = "syslet-rw",
1343 .help = "syslet enabled async pread/pwrite IO",
1347 .help = "CPU cycle burner engine",
1349 #ifdef FIO_HAVE_GUASI
1351 .help = "GUASI IO engine",
1354 #ifdef FIO_HAVE_BINJECT
1355 { .ival = "binject",
1356 .help = "binject direct inject block engine",
1359 #ifdef FIO_HAVE_RDMA
1361 .help = "RDMA IO engine",
1364 #ifdef FIO_HAVE_FUSION_AW
1365 { .ival = "fusion-aw-sync",
1366 .help = "Fusion-io atomic write engine",
1369 #ifdef FIO_HAVE_E4_ENG
1370 { .ival = "e4defrag",
1371 .help = "ext4 defrag engine",
1374 #ifdef FIO_HAVE_FALLOC_ENG
1376 .help = "fallocate() file based engine",
1379 { .ival = "external",
1380 .help = "Load external engine (append name)",
1386 .lname = "IO Depth",
1387 .type = FIO_OPT_INT,
1388 .off1 = td_var_offset(iodepth),
1389 .help = "Number of IO buffers to keep in flight",
1393 .category = FIO_OPT_C_IO,
1394 .group = FIO_OPT_G_IO_BASIC,
1397 .name = "iodepth_batch",
1398 .lname = "IO Depth batch",
1399 .alias = "iodepth_batch_submit",
1400 .type = FIO_OPT_INT,
1401 .off1 = td_var_offset(iodepth_batch),
1402 .help = "Number of IO buffers to submit in one go",
1403 .parent = "iodepth",
1408 .category = FIO_OPT_C_IO,
1409 .group = FIO_OPT_G_IO_BASIC,
1412 .name = "iodepth_batch_complete",
1413 .lname = "IO Depth batch complete",
1414 .type = FIO_OPT_INT,
1415 .off1 = td_var_offset(iodepth_batch_complete),
1416 .help = "Number of IO buffers to retrieve in one go",
1417 .parent = "iodepth",
1422 .category = FIO_OPT_C_IO,
1423 .group = FIO_OPT_G_IO_BASIC,
1426 .name = "iodepth_low",
1427 .lname = "IO Depth batch low",
1428 .type = FIO_OPT_INT,
1429 .off1 = td_var_offset(iodepth_low),
1430 .help = "Low water mark for queuing depth",
1431 .parent = "iodepth",
1434 .category = FIO_OPT_C_IO,
1435 .group = FIO_OPT_G_IO_BASIC,
1440 .type = FIO_OPT_STR_VAL,
1442 .help = "Total size of device or files",
1443 .interval = 1024 * 1024,
1444 .category = FIO_OPT_C_IO,
1445 .group = FIO_OPT_G_INVALID,
1448 .name = "fill_device",
1449 .lname = "Fill device",
1451 .type = FIO_OPT_BOOL,
1452 .off1 = td_var_offset(fill_device),
1453 .help = "Write until an ENOSPC error occurs",
1455 .category = FIO_OPT_C_FILE,
1456 .group = FIO_OPT_G_INVALID,
1460 .lname = "File size",
1461 .type = FIO_OPT_STR_VAL,
1462 .off1 = td_var_offset(file_size_low),
1463 .off2 = td_var_offset(file_size_high),
1465 .help = "Size of individual files",
1466 .interval = 1024 * 1024,
1467 .category = FIO_OPT_C_FILE,
1468 .group = FIO_OPT_G_INVALID,
1472 .lname = "IO offset",
1473 .alias = "fileoffset",
1474 .type = FIO_OPT_STR_VAL,
1475 .off1 = td_var_offset(start_offset),
1476 .help = "Start IO from this offset",
1478 .interval = 1024 * 1024,
1479 .category = FIO_OPT_C_IO,
1480 .group = FIO_OPT_G_INVALID,
1483 .name = "offset_increment",
1484 .lname = "IO offset increment",
1485 .type = FIO_OPT_STR_VAL,
1486 .off1 = td_var_offset(offset_increment),
1487 .help = "What is the increment from one offset to the next",
1491 .interval = 1024 * 1024,
1492 .category = FIO_OPT_C_IO,
1493 .group = FIO_OPT_G_INVALID,
1497 .lname = "Block size",
1498 .alias = "blocksize",
1499 .type = FIO_OPT_INT,
1500 .off1 = td_var_offset(bs[DDIR_READ]),
1501 .off2 = td_var_offset(bs[DDIR_WRITE]),
1502 .off3 = td_var_offset(bs[DDIR_TRIM]),
1504 .help = "Block size unit",
1509 .category = FIO_OPT_C_IO,
1510 .group = FIO_OPT_G_INVALID,
1514 .lname = "Block size align",
1515 .alias = "blockalign",
1516 .type = FIO_OPT_INT,
1517 .off1 = td_var_offset(ba[DDIR_READ]),
1518 .off2 = td_var_offset(ba[DDIR_WRITE]),
1519 .off3 = td_var_offset(ba[DDIR_TRIM]),
1521 .help = "IO block offset alignment",
1525 .category = FIO_OPT_C_IO,
1526 .group = FIO_OPT_G_INVALID,
1530 .lname = "Block size range",
1531 .alias = "blocksize_range",
1532 .type = FIO_OPT_RANGE,
1533 .off1 = td_var_offset(min_bs[DDIR_READ]),
1534 .off2 = td_var_offset(max_bs[DDIR_READ]),
1535 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1536 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1537 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1538 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1540 .help = "Set block size range (in more detail than bs)",
1544 .category = FIO_OPT_C_IO,
1545 .group = FIO_OPT_G_INVALID,
1549 .lname = "Block size split",
1550 .type = FIO_OPT_STR,
1551 .cb = str_bssplit_cb,
1552 .help = "Set a specific mix of block sizes",
1555 .category = FIO_OPT_C_IO,
1556 .group = FIO_OPT_G_INVALID,
1559 .name = "bs_unaligned",
1560 .lname = "Block size unaligned",
1561 .alias = "blocksize_unaligned",
1562 .type = FIO_OPT_STR_SET,
1563 .off1 = td_var_offset(bs_unaligned),
1564 .help = "Don't sector align IO buffer sizes",
1567 .category = FIO_OPT_C_IO,
1568 .group = FIO_OPT_G_INVALID,
1571 .name = "randrepeat",
1572 .lname = "Random repeatable",
1573 .type = FIO_OPT_BOOL,
1574 .off1 = td_var_offset(rand_repeatable),
1575 .help = "Use repeatable random IO pattern",
1579 .category = FIO_OPT_C_IO,
1580 .group = FIO_OPT_G_RANDOM,
1583 .name = "use_os_rand",
1584 .lname = "Use OS random",
1585 .type = FIO_OPT_BOOL,
1586 .off1 = td_var_offset(use_os_rand),
1587 .help = "Set to use OS random generator",
1591 .category = FIO_OPT_C_IO,
1592 .group = FIO_OPT_G_RANDOM,
1595 .name = "norandommap",
1596 .lname = "No randommap",
1597 .type = FIO_OPT_STR_SET,
1598 .off1 = td_var_offset(norandommap),
1599 .help = "Accept potential duplicate random blocks",
1603 .category = FIO_OPT_C_IO,
1604 .group = FIO_OPT_G_RANDOM,
1607 .name = "softrandommap",
1608 .lname = "Soft randommap",
1609 .type = FIO_OPT_BOOL,
1610 .off1 = td_var_offset(softrandommap),
1611 .help = "Set norandommap if randommap allocation fails",
1612 .parent = "norandommap",
1615 .category = FIO_OPT_C_IO,
1616 .group = FIO_OPT_G_RANDOM,
1619 .name = "random_generator",
1620 .type = FIO_OPT_STR,
1621 .off1 = td_var_offset(random_generator),
1622 .help = "Type of random number generator to use",
1623 .def = "tausworthe",
1625 { .ival = "tausworthe",
1626 .oval = FIO_RAND_GEN_TAUSWORTHE,
1627 .help = "Strong Tausworthe generator",
1630 .oval = FIO_RAND_GEN_LFSR,
1631 .help = "Variable length LFSR",
1634 .category = FIO_OPT_C_IO,
1635 .group = FIO_OPT_G_RANDOM,
1638 .name = "random_distribution",
1639 .type = FIO_OPT_STR,
1640 .off1 = td_var_offset(random_distribution),
1641 .cb = str_random_distribution_cb,
1642 .help = "Random offset distribution generator",
1646 .oval = FIO_RAND_DIST_RANDOM,
1647 .help = "Completely random",
1650 .oval = FIO_RAND_DIST_ZIPF,
1651 .help = "Zipf distribution",
1654 .oval = FIO_RAND_DIST_PARETO,
1655 .help = "Pareto distribution",
1658 .category = FIO_OPT_C_IO,
1659 .group = FIO_OPT_G_RANDOM,
1663 .lname = "Number of files",
1664 .alias = "nr_files",
1665 .type = FIO_OPT_INT,
1666 .off1 = td_var_offset(nr_files),
1667 .help = "Split job workload between this number of files",
1670 .category = FIO_OPT_C_FILE,
1671 .group = FIO_OPT_G_INVALID,
1674 .name = "openfiles",
1675 .lname = "Number of open files",
1676 .type = FIO_OPT_INT,
1677 .off1 = td_var_offset(open_files),
1678 .help = "Number of files to keep open at the same time",
1679 .category = FIO_OPT_C_FILE,
1680 .group = FIO_OPT_G_INVALID,
1683 .name = "file_service_type",
1684 .lname = "File service type",
1685 .type = FIO_OPT_STR,
1687 .off1 = td_var_offset(file_service_type),
1688 .help = "How to select which file to service next",
1689 .def = "roundrobin",
1690 .category = FIO_OPT_C_FILE,
1691 .group = FIO_OPT_G_INVALID,
1694 .oval = FIO_FSERVICE_RANDOM,
1695 .help = "Choose a file at random",
1697 { .ival = "roundrobin",
1698 .oval = FIO_FSERVICE_RR,
1699 .help = "Round robin select files",
1701 { .ival = "sequential",
1702 .oval = FIO_FSERVICE_SEQ,
1703 .help = "Finish one file before moving to the next",
1706 .parent = "nrfiles",
1709 #ifdef FIO_HAVE_FALLOCATE
1711 .name = "fallocate",
1712 .lname = "Fallocate",
1713 .type = FIO_OPT_STR,
1714 .off1 = td_var_offset(fallocate_mode),
1715 .help = "Whether pre-allocation is performed when laying out files",
1717 .category = FIO_OPT_C_FILE,
1718 .group = FIO_OPT_G_INVALID,
1721 .oval = FIO_FALLOCATE_NONE,
1722 .help = "Do not pre-allocate space",
1725 .oval = FIO_FALLOCATE_POSIX,
1726 .help = "Use posix_fallocate()",
1728 #ifdef FIO_HAVE_LINUX_FALLOCATE
1730 .oval = FIO_FALLOCATE_KEEP_SIZE,
1731 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1734 /* Compatibility with former boolean values */
1736 .oval = FIO_FALLOCATE_NONE,
1737 .help = "Alias for 'none'",
1740 .oval = FIO_FALLOCATE_POSIX,
1741 .help = "Alias for 'posix'",
1745 #endif /* FIO_HAVE_FALLOCATE */
1747 .name = "fadvise_hint",
1748 .lname = "Fadvise hint",
1749 .type = FIO_OPT_BOOL,
1750 .off1 = td_var_offset(fadvise_hint),
1751 .help = "Use fadvise() to advise the kernel on IO pattern",
1753 .category = FIO_OPT_C_FILE,
1754 .group = FIO_OPT_G_INVALID,
1759 .type = FIO_OPT_INT,
1760 .off1 = td_var_offset(fsync_blocks),
1761 .help = "Issue fsync for writes every given number of blocks",
1764 .category = FIO_OPT_C_FILE,
1765 .group = FIO_OPT_G_INVALID,
1768 .name = "fdatasync",
1769 .lname = "Fdatasync",
1770 .type = FIO_OPT_INT,
1771 .off1 = td_var_offset(fdatasync_blocks),
1772 .help = "Issue fdatasync for writes every given number of blocks",
1775 .category = FIO_OPT_C_FILE,
1776 .group = FIO_OPT_G_INVALID,
1779 .name = "write_barrier",
1780 .lname = "Write barrier",
1781 .type = FIO_OPT_INT,
1782 .off1 = td_var_offset(barrier_blocks),
1783 .help = "Make every Nth write a barrier write",
1786 .category = FIO_OPT_C_IO,
1787 .group = FIO_OPT_G_INVALID,
1789 #ifdef FIO_HAVE_SYNC_FILE_RANGE
1791 .name = "sync_file_range",
1792 .lname = "Sync file range",
1794 { .ival = "wait_before",
1795 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1796 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
1800 .oval = SYNC_FILE_RANGE_WRITE,
1801 .help = "SYNC_FILE_RANGE_WRITE",
1805 .ival = "wait_after",
1806 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1807 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
1811 .type = FIO_OPT_STR_MULTI,
1813 .off1 = td_var_offset(sync_file_range),
1814 .help = "Use sync_file_range()",
1815 .category = FIO_OPT_C_FILE,
1816 .group = FIO_OPT_G_INVALID,
1821 .lname = "Direct I/O",
1822 .type = FIO_OPT_BOOL,
1823 .off1 = td_var_offset(odirect),
1824 .help = "Use O_DIRECT IO (negates buffered)",
1826 .inverse = "buffered",
1827 .category = FIO_OPT_C_IO,
1828 .group = FIO_OPT_G_IO_TYPE,
1832 .lname = "Buffered I/O",
1833 .type = FIO_OPT_BOOL,
1834 .off1 = td_var_offset(odirect),
1836 .help = "Use buffered IO (negates direct)",
1838 .inverse = "direct",
1839 .category = FIO_OPT_C_IO,
1840 .group = FIO_OPT_G_IO_TYPE,
1843 .name = "overwrite",
1844 .lname = "Overwrite",
1845 .type = FIO_OPT_BOOL,
1846 .off1 = td_var_offset(overwrite),
1847 .help = "When writing, set whether to overwrite current data",
1849 .category = FIO_OPT_C_FILE,
1850 .group = FIO_OPT_G_INVALID,
1855 .type = FIO_OPT_INT,
1856 .off1 = td_var_offset(loops),
1857 .help = "Number of times to run the job",
1860 .category = FIO_OPT_C_GENERAL,
1861 .group = FIO_OPT_G_RUNTIME,
1865 .lname = "Number of jobs",
1866 .type = FIO_OPT_INT,
1867 .off1 = td_var_offset(numjobs),
1868 .help = "Duplicate this job this many times",
1871 .category = FIO_OPT_C_GENERAL,
1872 .group = FIO_OPT_G_RUNTIME,
1875 .name = "startdelay",
1876 .lname = "Start delay",
1877 .type = FIO_OPT_STR_VAL_TIME,
1878 .off1 = td_var_offset(start_delay),
1879 .help = "Only start job when this period has passed",
1881 .category = FIO_OPT_C_GENERAL,
1882 .group = FIO_OPT_G_RUNTIME,
1888 .type = FIO_OPT_STR_VAL_TIME,
1889 .off1 = td_var_offset(timeout),
1890 .help = "Stop workload when this amount of time has passed",
1892 .category = FIO_OPT_C_GENERAL,
1893 .group = FIO_OPT_G_RUNTIME,
1896 .name = "time_based",
1897 .lname = "Time based",
1898 .type = FIO_OPT_STR_SET,
1899 .off1 = td_var_offset(time_based),
1900 .help = "Keep running until runtime/timeout is met",
1901 .category = FIO_OPT_C_GENERAL,
1902 .group = FIO_OPT_G_RUNTIME,
1905 .name = "ramp_time",
1906 .lname = "Ramp time",
1907 .type = FIO_OPT_STR_VAL_TIME,
1908 .off1 = td_var_offset(ramp_time),
1909 .help = "Ramp up time before measuring performance",
1910 .category = FIO_OPT_C_GENERAL,
1911 .group = FIO_OPT_G_RUNTIME,
1914 .name = "clocksource",
1915 .lname = "Clock source",
1916 .type = FIO_OPT_STR,
1917 .cb = fio_clock_source_cb,
1918 .off1 = td_var_offset(clocksource),
1919 .help = "What type of timing source to use",
1920 .category = FIO_OPT_C_GENERAL,
1921 .group = FIO_OPT_G_CLOCK,
1923 { .ival = "gettimeofday",
1925 .help = "Use gettimeofday(2) for timing",
1927 { .ival = "clock_gettime",
1928 .oval = CS_CGETTIME,
1929 .help = "Use clock_gettime(2) for timing",
1931 #ifdef ARCH_HAVE_CPU_CLOCK
1933 .oval = CS_CPUCLOCK,
1934 .help = "Use CPU private clock",
1942 .lname = "I/O Memory",
1943 .type = FIO_OPT_STR,
1945 .off1 = td_var_offset(mem_type),
1946 .help = "Backing type for IO buffers",
1948 .category = FIO_OPT_C_IO,
1949 .group = FIO_OPT_G_INVALID,
1953 .help = "Use malloc(3) for IO buffers",
1957 .help = "Use shared memory segments for IO buffers",
1959 #ifdef FIO_HAVE_HUGETLB
1960 { .ival = "shmhuge",
1961 .oval = MEM_SHMHUGE,
1962 .help = "Like shm, but use huge pages",
1967 .help = "Use mmap(2) (file or anon) for IO buffers",
1969 #ifdef FIO_HAVE_HUGETLB
1970 { .ival = "mmaphuge",
1971 .oval = MEM_MMAPHUGE,
1972 .help = "Like mmap, but use huge pages",
1978 .name = "iomem_align",
1979 .alias = "mem_align",
1980 .lname = "I/O memory alignment",
1981 .type = FIO_OPT_INT,
1982 .off1 = td_var_offset(mem_align),
1984 .help = "IO memory buffer offset alignment",
1988 .category = FIO_OPT_C_IO,
1989 .group = FIO_OPT_G_INVALID,
1994 .type = FIO_OPT_STR,
1995 .off1 = td_var_offset(verify),
1996 .help = "Verify data written",
1998 .category = FIO_OPT_C_IO,
1999 .group = FIO_OPT_G_VERIFY,
2002 .oval = VERIFY_NONE,
2003 .help = "Don't do IO verification",
2007 .help = "Use md5 checksums for verification",
2010 .oval = VERIFY_CRC64,
2011 .help = "Use crc64 checksums for verification",
2014 .oval = VERIFY_CRC32,
2015 .help = "Use crc32 checksums for verification",
2017 { .ival = "crc32c-intel",
2018 .oval = VERIFY_CRC32C,
2019 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2022 .oval = VERIFY_CRC32C,
2023 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2026 .oval = VERIFY_CRC16,
2027 .help = "Use crc16 checksums for verification",
2030 .oval = VERIFY_CRC7,
2031 .help = "Use crc7 checksums for verification",
2034 .oval = VERIFY_SHA1,
2035 .help = "Use sha1 checksums for verification",
2038 .oval = VERIFY_SHA256,
2039 .help = "Use sha256 checksums for verification",
2042 .oval = VERIFY_SHA512,
2043 .help = "Use sha512 checksums for verification",
2046 .oval = VERIFY_META,
2047 .help = "Use io information",
2051 .oval = VERIFY_NULL,
2052 .help = "Pretend to verify",
2057 .name = "do_verify",
2058 .lname = "Perform verify step",
2059 .type = FIO_OPT_BOOL,
2060 .off1 = td_var_offset(do_verify),
2061 .help = "Run verification stage after write",
2065 .category = FIO_OPT_C_IO,
2066 .group = FIO_OPT_G_VERIFY,
2069 .name = "verifysort",
2070 .lname = "Verify sort",
2071 .type = FIO_OPT_BOOL,
2072 .off1 = td_var_offset(verifysort),
2073 .help = "Sort written verify blocks for read back",
2077 .category = FIO_OPT_C_IO,
2078 .group = FIO_OPT_G_VERIFY,
2081 .name = "verify_interval",
2082 .lname = "Verify interval",
2083 .type = FIO_OPT_INT,
2084 .off1 = td_var_offset(verify_interval),
2085 .minval = 2 * sizeof(struct verify_header),
2086 .help = "Store verify buffer header every N bytes",
2089 .interval = 2 * sizeof(struct verify_header),
2090 .category = FIO_OPT_C_IO,
2091 .group = FIO_OPT_G_VERIFY,
2094 .name = "verify_offset",
2095 .lname = "Verify offset",
2096 .type = FIO_OPT_INT,
2097 .help = "Offset verify header location by N bytes",
2098 .off1 = td_var_offset(verify_offset),
2099 .minval = sizeof(struct verify_header),
2102 .category = FIO_OPT_C_IO,
2103 .group = FIO_OPT_G_VERIFY,
2106 .name = "verify_pattern",
2107 .lname = "Verify pattern",
2108 .type = FIO_OPT_STR,
2109 .cb = str_verify_pattern_cb,
2110 .help = "Fill pattern for IO buffers",
2113 .category = FIO_OPT_C_IO,
2114 .group = FIO_OPT_G_VERIFY,
2117 .name = "verify_fatal",
2118 .lname = "Verify fatal",
2119 .type = FIO_OPT_BOOL,
2120 .off1 = td_var_offset(verify_fatal),
2122 .help = "Exit on a single verify failure, don't continue",
2125 .category = FIO_OPT_C_IO,
2126 .group = FIO_OPT_G_VERIFY,
2129 .name = "verify_dump",
2130 .lname = "Verify dump",
2131 .type = FIO_OPT_BOOL,
2132 .off1 = td_var_offset(verify_dump),
2134 .help = "Dump contents of good and bad blocks on failure",
2137 .category = FIO_OPT_C_IO,
2138 .group = FIO_OPT_G_VERIFY,
2141 .name = "verify_async",
2142 .lname = "Verify asynchronously",
2143 .type = FIO_OPT_INT,
2144 .off1 = td_var_offset(verify_async),
2146 .help = "Number of async verifier threads to use",
2149 .category = FIO_OPT_C_IO,
2150 .group = FIO_OPT_G_VERIFY,
2153 .name = "verify_backlog",
2154 .lname = "Verify backlog",
2155 .type = FIO_OPT_STR_VAL,
2156 .off1 = td_var_offset(verify_backlog),
2157 .help = "Verify after this number of blocks are written",
2160 .category = FIO_OPT_C_IO,
2161 .group = FIO_OPT_G_VERIFY,
2164 .name = "verify_backlog_batch",
2165 .lname = "Verify backlog batch",
2166 .type = FIO_OPT_INT,
2167 .off1 = td_var_offset(verify_batch),
2168 .help = "Verify this number of IO blocks",
2171 .category = FIO_OPT_C_IO,
2172 .group = FIO_OPT_G_VERIFY,
2174 #ifdef FIO_HAVE_CPU_AFFINITY
2176 .name = "verify_async_cpus",
2177 .lname = "Async verify CPUs",
2178 .type = FIO_OPT_STR,
2179 .cb = str_verify_cpus_allowed_cb,
2180 .help = "Set CPUs allowed for async verify threads",
2181 .parent = "verify_async",
2183 .category = FIO_OPT_C_IO,
2184 .group = FIO_OPT_G_VERIFY,
2187 #ifdef FIO_HAVE_TRIM
2189 .name = "trim_percentage",
2190 .lname = "Trim percentage",
2191 .type = FIO_OPT_INT,
2192 .off1 = td_var_offset(trim_percentage),
2195 .help = "Number of verify blocks to discard/trim",
2200 .category = FIO_OPT_C_IO,
2201 .group = FIO_OPT_G_TRIM,
2204 .name = "trim_verify_zero",
2205 .lname = "Verify trim zero",
2206 .type = FIO_OPT_BOOL,
2207 .help = "Verify that trim/discarded blocks are returned as zeroes",
2208 .off1 = td_var_offset(trim_zero),
2209 .parent = "trim_percentage",
2212 .category = FIO_OPT_C_IO,
2213 .group = FIO_OPT_G_TRIM,
2216 .name = "trim_backlog",
2217 .lname = "Trim backlog",
2218 .type = FIO_OPT_STR_VAL,
2219 .off1 = td_var_offset(trim_backlog),
2220 .help = "Trim after this number of blocks are written",
2221 .parent = "trim_percentage",
2224 .category = FIO_OPT_C_IO,
2225 .group = FIO_OPT_G_TRIM,
2228 .name = "trim_backlog_batch",
2229 .lname = "Trim backlog batch",
2230 .type = FIO_OPT_INT,
2231 .off1 = td_var_offset(trim_batch),
2232 .help = "Trim this number of IO blocks",
2233 .parent = "trim_percentage",
2236 .category = FIO_OPT_C_IO,
2237 .group = FIO_OPT_G_TRIM,
2241 .name = "write_iolog",
2242 .lname = "Write I/O log",
2243 .type = FIO_OPT_STR_STORE,
2244 .off1 = td_var_offset(write_iolog_file),
2245 .help = "Store IO pattern to file",
2246 .category = FIO_OPT_C_IO,
2247 .group = FIO_OPT_G_IOLOG,
2250 .name = "read_iolog",
2251 .lname = "Read I/O log",
2252 .type = FIO_OPT_STR_STORE,
2253 .off1 = td_var_offset(read_iolog_file),
2254 .help = "Playback IO pattern from file",
2255 .category = FIO_OPT_C_IO,
2256 .group = FIO_OPT_G_IOLOG,
2259 .name = "replay_no_stall",
2260 .lname = "Don't stall on replay",
2261 .type = FIO_OPT_BOOL,
2262 .off1 = td_var_offset(no_stall),
2264 .parent = "read_iolog",
2266 .help = "Playback IO pattern file as fast as possible without stalls",
2267 .category = FIO_OPT_C_IO,
2268 .group = FIO_OPT_G_IOLOG,
2271 .name = "replay_redirect",
2272 .lname = "Redirect device for replay",
2273 .type = FIO_OPT_STR_STORE,
2274 .off1 = td_var_offset(replay_redirect),
2275 .parent = "read_iolog",
2277 .help = "Replay all I/O onto this device, regardless of trace device",
2278 .category = FIO_OPT_C_IO,
2279 .group = FIO_OPT_G_IOLOG,
2282 .name = "exec_prerun",
2283 .lname = "Pre-execute runnable",
2284 .type = FIO_OPT_STR_STORE,
2285 .off1 = td_var_offset(exec_prerun),
2286 .help = "Execute this file prior to running job",
2287 .category = FIO_OPT_C_GENERAL,
2288 .group = FIO_OPT_G_INVALID,
2291 .name = "exec_postrun",
2292 .lname = "Post-execute runnable",
2293 .type = FIO_OPT_STR_STORE,
2294 .off1 = td_var_offset(exec_postrun),
2295 .help = "Execute this file after running job",
2296 .category = FIO_OPT_C_GENERAL,
2297 .group = FIO_OPT_G_INVALID,
2299 #ifdef FIO_HAVE_IOSCHED_SWITCH
2301 .name = "ioscheduler",
2302 .lname = "I/O scheduler",
2303 .type = FIO_OPT_STR_STORE,
2304 .off1 = td_var_offset(ioscheduler),
2305 .help = "Use this IO scheduler on the backing device",
2306 .category = FIO_OPT_C_FILE,
2307 .group = FIO_OPT_G_INVALID,
2312 .lname = "Zone size",
2313 .type = FIO_OPT_STR_VAL,
2314 .off1 = td_var_offset(zone_size),
2315 .help = "Amount of data to read per zone",
2317 .interval = 1024 * 1024,
2318 .category = FIO_OPT_C_IO,
2319 .group = FIO_OPT_G_ZONE,
2322 .name = "zonerange",
2323 .lname = "Zone range",
2324 .type = FIO_OPT_STR_VAL,
2325 .off1 = td_var_offset(zone_range),
2326 .help = "Give size of an IO zone",
2328 .interval = 1024 * 1024,
2329 .category = FIO_OPT_C_IO,
2330 .group = FIO_OPT_G_ZONE,
2334 .lname = "Zone skip",
2335 .type = FIO_OPT_STR_VAL,
2336 .off1 = td_var_offset(zone_skip),
2337 .help = "Space between IO zones",
2339 .interval = 1024 * 1024,
2340 .category = FIO_OPT_C_IO,
2341 .group = FIO_OPT_G_ZONE,
2345 .lname = "Lock memory",
2346 .type = FIO_OPT_STR_VAL,
2347 .off1 = td_var_offset(lockmem),
2348 .help = "Lock down this amount of memory",
2350 .interval = 1024 * 1024,
2351 .category = FIO_OPT_C_GENERAL,
2352 .group = FIO_OPT_G_INVALID,
2355 .name = "rwmixread",
2356 .lname = "Read/write mix read",
2357 .type = FIO_OPT_INT,
2358 .cb = str_rwmix_read_cb,
2360 .help = "Percentage of mixed workload that is reads",
2363 .inverse = "rwmixwrite",
2364 .category = FIO_OPT_C_IO,
2365 .group = FIO_OPT_G_RWMIX,
2368 .name = "rwmixwrite",
2369 .lname = "Read/write mix write",
2370 .type = FIO_OPT_INT,
2371 .cb = str_rwmix_write_cb,
2373 .help = "Percentage of mixed workload that is writes",
2376 .inverse = "rwmixread",
2377 .category = FIO_OPT_C_IO,
2378 .group = FIO_OPT_G_RWMIX,
2381 .name = "rwmixcycle",
2382 .lname = "Read/write mix cycle",
2383 .type = FIO_OPT_DEPRECATED,
2384 .category = FIO_OPT_C_IO,
2385 .group = FIO_OPT_G_RWMIX,
2390 .type = FIO_OPT_INT,
2391 .off1 = td_var_offset(nice),
2392 .help = "Set job CPU nice value",
2397 .category = FIO_OPT_C_GENERAL,
2398 .group = FIO_OPT_G_CRED,
2400 #ifdef FIO_HAVE_IOPRIO
2403 .lname = "I/O nice priority",
2404 .type = FIO_OPT_INT,
2405 .off1 = td_var_offset(ioprio),
2406 .help = "Set job IO priority value",
2410 .category = FIO_OPT_C_GENERAL,
2411 .group = FIO_OPT_G_CRED,
2414 .name = "prioclass",
2415 .lname = "I/O nice priority class",
2416 .type = FIO_OPT_INT,
2417 .off1 = td_var_offset(ioprio_class),
2418 .help = "Set job IO priority class",
2422 .category = FIO_OPT_C_GENERAL,
2423 .group = FIO_OPT_G_CRED,
2427 .name = "thinktime",
2428 .lname = "Thinktime",
2429 .type = FIO_OPT_INT,
2430 .off1 = td_var_offset(thinktime),
2431 .help = "Idle time between IO buffers (usec)",
2433 .category = FIO_OPT_C_IO,
2434 .group = FIO_OPT_G_THINKTIME,
2437 .name = "thinktime_spin",
2438 .lname = "Thinktime spin",
2439 .type = FIO_OPT_INT,
2440 .off1 = td_var_offset(thinktime_spin),
2441 .help = "Start think time by spinning this amount (usec)",
2443 .parent = "thinktime",
2445 .category = FIO_OPT_C_IO,
2446 .group = FIO_OPT_G_THINKTIME,
2449 .name = "thinktime_blocks",
2450 .lname = "Thinktime blocks",
2451 .type = FIO_OPT_INT,
2452 .off1 = td_var_offset(thinktime_blocks),
2453 .help = "IO buffer period between 'thinktime'",
2455 .parent = "thinktime",
2457 .category = FIO_OPT_C_IO,
2458 .group = FIO_OPT_G_THINKTIME,
2462 .lname = "I/O rate",
2463 .type = FIO_OPT_INT,
2464 .off1 = td_var_offset(rate[DDIR_READ]),
2465 .off2 = td_var_offset(rate[DDIR_WRITE]),
2466 .off3 = td_var_offset(rate[DDIR_TRIM]),
2467 .help = "Set bandwidth rate",
2468 .category = FIO_OPT_C_IO,
2469 .group = FIO_OPT_G_RATE,
2473 .lname = "I/O min rate",
2474 .type = FIO_OPT_INT,
2475 .off1 = td_var_offset(ratemin[DDIR_READ]),
2476 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2477 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2478 .help = "Job must meet this rate or it will be shutdown",
2481 .category = FIO_OPT_C_IO,
2482 .group = FIO_OPT_G_RATE,
2485 .name = "rate_iops",
2486 .lname = "I/O rate IOPS",
2487 .type = FIO_OPT_INT,
2488 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2489 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2490 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2491 .help = "Limit IO used to this number of IO operations/sec",
2493 .category = FIO_OPT_C_IO,
2494 .group = FIO_OPT_G_RATE,
2497 .name = "rate_iops_min",
2498 .lname = "I/O min rate IOPS",
2499 .type = FIO_OPT_INT,
2500 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2501 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2502 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2503 .help = "Job must meet this rate or it will be shut down",
2504 .parent = "rate_iops",
2506 .category = FIO_OPT_C_IO,
2507 .group = FIO_OPT_G_RATE,
2510 .name = "ratecycle",
2511 .lname = "I/O rate cycle",
2512 .type = FIO_OPT_INT,
2513 .off1 = td_var_offset(ratecycle),
2514 .help = "Window average for rate limits (msec)",
2518 .category = FIO_OPT_C_IO,
2519 .group = FIO_OPT_G_RATE,
2522 .name = "max_latency",
2523 .type = FIO_OPT_INT,
2524 .off1 = td_var_offset(max_latency),
2525 .help = "Maximum tolerated IO latency (usec)",
2526 .category = FIO_OPT_C_IO,
2527 .group = FIO_OPT_G_RATE,
2530 .name = "invalidate",
2531 .lname = "Cache invalidate",
2532 .type = FIO_OPT_BOOL,
2533 .off1 = td_var_offset(invalidate_cache),
2534 .help = "Invalidate buffer/page cache prior to running job",
2536 .category = FIO_OPT_C_IO,
2537 .group = FIO_OPT_G_IO_TYPE,
2541 .lname = "Synchronous I/O",
2542 .type = FIO_OPT_BOOL,
2543 .off1 = td_var_offset(sync_io),
2544 .help = "Use O_SYNC for buffered writes",
2546 .parent = "buffered",
2548 .category = FIO_OPT_C_IO,
2549 .group = FIO_OPT_G_IO_TYPE,
2552 .name = "create_serialize",
2553 .lname = "Create serialize",
2554 .type = FIO_OPT_BOOL,
2555 .off1 = td_var_offset(create_serialize),
2556 .help = "Serialize creating of job files",
2558 .category = FIO_OPT_C_FILE,
2559 .group = FIO_OPT_G_INVALID,
2562 .name = "create_fsync",
2563 .lname = "Create fsync",
2564 .type = FIO_OPT_BOOL,
2565 .off1 = td_var_offset(create_fsync),
2566 .help = "fsync file after creation",
2568 .category = FIO_OPT_C_FILE,
2569 .group = FIO_OPT_G_INVALID,
2572 .name = "create_on_open",
2573 .lname = "Create on open",
2574 .type = FIO_OPT_BOOL,
2575 .off1 = td_var_offset(create_on_open),
2576 .help = "Create files when they are opened for IO",
2578 .category = FIO_OPT_C_FILE,
2579 .group = FIO_OPT_G_INVALID,
2582 .name = "create_only",
2583 .type = FIO_OPT_BOOL,
2584 .off1 = td_var_offset(create_only),
2585 .help = "Only perform file creation phase",
2586 .category = FIO_OPT_C_FILE,
2591 .lname = "Pre-read files",
2592 .type = FIO_OPT_BOOL,
2593 .off1 = td_var_offset(pre_read),
2594 .help = "Pre-read files before starting official testing",
2596 .category = FIO_OPT_C_FILE,
2597 .group = FIO_OPT_G_INVALID,
2599 #ifdef FIO_HAVE_CPU_AFFINITY
2602 .lname = "CPU mask",
2603 .type = FIO_OPT_INT,
2604 .cb = str_cpumask_cb,
2605 .help = "CPU affinity mask",
2606 .category = FIO_OPT_C_GENERAL,
2607 .group = FIO_OPT_G_CRED,
2610 .name = "cpus_allowed",
2611 .lname = "CPUs allowed",
2612 .type = FIO_OPT_STR,
2613 .cb = str_cpus_allowed_cb,
2614 .help = "Set CPUs allowed",
2615 .category = FIO_OPT_C_GENERAL,
2616 .group = FIO_OPT_G_CRED,
2619 #ifdef FIO_HAVE_LIBNUMA
2621 .name = "numa_cpu_nodes",
2622 .type = FIO_OPT_STR,
2623 .cb = str_numa_cpunodes_cb,
2624 .help = "NUMA CPU nodes bind",
2627 .name = "numa_mem_policy",
2628 .type = FIO_OPT_STR,
2629 .cb = str_numa_mpol_cb,
2630 .help = "NUMA memory policy setup",
2634 .name = "end_fsync",
2635 .lname = "End fsync",
2636 .type = FIO_OPT_BOOL,
2637 .off1 = td_var_offset(end_fsync),
2638 .help = "Include fsync at the end of job",
2640 .category = FIO_OPT_C_FILE,
2641 .group = FIO_OPT_G_INVALID,
2644 .name = "fsync_on_close",
2645 .lname = "Fsync on close",
2646 .type = FIO_OPT_BOOL,
2647 .off1 = td_var_offset(fsync_on_close),
2648 .help = "fsync files on close",
2650 .category = FIO_OPT_C_FILE,
2651 .group = FIO_OPT_G_INVALID,
2655 .lname = "Unlink file",
2656 .type = FIO_OPT_BOOL,
2657 .off1 = td_var_offset(unlink),
2658 .help = "Unlink created files after job has completed",
2660 .category = FIO_OPT_C_FILE,
2661 .group = FIO_OPT_G_INVALID,
2665 .lname = "Exit-all on terminate",
2666 .type = FIO_OPT_STR_SET,
2667 .cb = str_exitall_cb,
2668 .help = "Terminate all jobs when one exits",
2669 .category = FIO_OPT_C_GENERAL,
2670 .group = FIO_OPT_G_PROCESS,
2673 .name = "stonewall",
2674 .lname = "Wait for previous",
2675 .alias = "wait_for_previous",
2676 .type = FIO_OPT_STR_SET,
2677 .off1 = td_var_offset(stonewall),
2678 .help = "Insert a hard barrier between this job and previous",
2679 .category = FIO_OPT_C_GENERAL,
2680 .group = FIO_OPT_G_PROCESS,
2683 .name = "new_group",
2684 .lname = "New group",
2685 .type = FIO_OPT_STR_SET,
2686 .off1 = td_var_offset(new_group),
2687 .help = "Mark the start of a new group (for reporting)",
2688 .category = FIO_OPT_C_GENERAL,
2689 .group = FIO_OPT_G_PROCESS,
2694 .type = FIO_OPT_STR_SET,
2695 .off1 = td_var_offset(use_thread),
2696 .help = "Use threads instead of processes",
2697 .category = FIO_OPT_C_GENERAL,
2698 .group = FIO_OPT_G_PROCESS,
2701 .name = "write_bw_log",
2702 .lname = "Write bandwidth log",
2703 .type = FIO_OPT_STR_STORE,
2704 .off1 = td_var_offset(bw_log_file),
2705 .help = "Write log of bandwidth during run",
2706 .category = FIO_OPT_C_LOG,
2707 .group = FIO_OPT_G_INVALID,
2710 .name = "write_lat_log",
2711 .lname = "Write latency log",
2712 .type = FIO_OPT_STR_STORE,
2713 .off1 = td_var_offset(lat_log_file),
2714 .help = "Write log of latency during run",
2715 .category = FIO_OPT_C_LOG,
2716 .group = FIO_OPT_G_INVALID,
2719 .name = "write_iops_log",
2720 .lname = "Write IOPS log",
2721 .type = FIO_OPT_STR,
2722 .off1 = td_var_offset(iops_log_file),
2723 .help = "Write log of IOPS during run",
2724 .category = FIO_OPT_C_LOG,
2725 .group = FIO_OPT_G_INVALID,
2728 .name = "log_avg_msec",
2729 .lname = "Log averaging (msec)",
2730 .type = FIO_OPT_INT,
2731 .off1 = td_var_offset(log_avg_msec),
2732 .help = "Average bw/iops/lat logs over this period of time",
2734 .category = FIO_OPT_C_LOG,
2735 .group = FIO_OPT_G_INVALID,
2738 .name = "bwavgtime",
2739 .lname = "Bandwidth average time",
2740 .type = FIO_OPT_INT,
2741 .off1 = td_var_offset(bw_avg_time),
2742 .help = "Time window over which to calculate bandwidth"
2745 .parent = "write_bw_log",
2748 .category = FIO_OPT_C_LOG,
2749 .group = FIO_OPT_G_INVALID,
2752 .name = "iopsavgtime",
2753 .lname = "IOPS average time",
2754 .type = FIO_OPT_INT,
2755 .off1 = td_var_offset(iops_avg_time),
2756 .help = "Time window over which to calculate IOPS (msec)",
2758 .parent = "write_iops_log",
2761 .category = FIO_OPT_C_LOG,
2762 .group = FIO_OPT_G_INVALID,
2765 .name = "group_reporting",
2766 .lname = "Group reporting",
2767 .type = FIO_OPT_BOOL,
2768 .off1 = td_var_offset(group_reporting),
2769 .help = "Do reporting on a per-group basis",
2771 .category = FIO_OPT_C_STAT,
2772 .group = FIO_OPT_G_INVALID,
2775 .name = "zero_buffers",
2776 .lname = "Zero I/O buffers",
2777 .type = FIO_OPT_STR_SET,
2778 .off1 = td_var_offset(zero_buffers),
2779 .help = "Init IO buffers to all zeroes",
2780 .category = FIO_OPT_C_IO,
2781 .group = FIO_OPT_G_IO_BUF,
2784 .name = "refill_buffers",
2785 .lname = "Refill I/O buffers",
2786 .type = FIO_OPT_STR_SET,
2787 .off1 = td_var_offset(refill_buffers),
2788 .help = "Refill IO buffers on every IO submit",
2789 .category = FIO_OPT_C_IO,
2790 .group = FIO_OPT_G_IO_BUF,
2793 .name = "scramble_buffers",
2794 .lname = "Scramble I/O buffers",
2795 .type = FIO_OPT_BOOL,
2796 .off1 = td_var_offset(scramble_buffers),
2797 .help = "Slightly scramble buffers on every IO submit",
2799 .category = FIO_OPT_C_IO,
2800 .group = FIO_OPT_G_IO_BUF,
2803 .name = "buffer_compress_percentage",
2804 .lname = "Buffer compression percentage",
2805 .type = FIO_OPT_INT,
2806 .off1 = td_var_offset(compress_percentage),
2809 .help = "How compressible the buffer is (approximately)",
2811 .category = FIO_OPT_C_IO,
2812 .group = FIO_OPT_G_IO_BUF,
2815 .name = "buffer_compress_chunk",
2816 .lname = "Buffer compression chunk size",
2817 .type = FIO_OPT_INT,
2818 .off1 = td_var_offset(compress_chunk),
2819 .parent = "buffer_compress_percentage",
2821 .help = "Size of compressible region in buffer",
2823 .category = FIO_OPT_C_IO,
2824 .group = FIO_OPT_G_IO_BUF,
2827 .name = "clat_percentiles",
2828 .lname = "Completion latency percentiles",
2829 .type = FIO_OPT_BOOL,
2830 .off1 = td_var_offset(clat_percentiles),
2831 .help = "Enable the reporting of completion latency percentiles",
2833 .category = FIO_OPT_C_STAT,
2834 .group = FIO_OPT_G_INVALID,
2837 .name = "percentile_list",
2838 .lname = "Completion latency percentile list",
2839 .type = FIO_OPT_FLOAT_LIST,
2840 .off1 = td_var_offset(percentile_list),
2841 .off2 = td_var_offset(overwrite_plist),
2842 .help = "Specify a custom list of percentiles to report",
2843 .maxlen = FIO_IO_U_LIST_MAX_LEN,
2846 .category = FIO_OPT_C_STAT,
2847 .group = FIO_OPT_G_INVALID,
2850 #ifdef FIO_HAVE_DISK_UTIL
2852 .name = "disk_util",
2853 .lname = "Disk utilization",
2854 .type = FIO_OPT_BOOL,
2855 .off1 = td_var_offset(do_disk_util),
2856 .help = "Log disk utilization statistics",
2858 .category = FIO_OPT_C_STAT,
2859 .group = FIO_OPT_G_INVALID,
2863 .name = "gtod_reduce",
2864 .lname = "Reduce gettimeofday() calls",
2865 .type = FIO_OPT_BOOL,
2866 .help = "Greatly reduce number of gettimeofday() calls",
2867 .cb = str_gtod_reduce_cb,
2870 .category = FIO_OPT_C_STAT,
2871 .group = FIO_OPT_G_INVALID,
2874 .name = "disable_lat",
2875 .lname = "Disable all latency stats",
2876 .type = FIO_OPT_BOOL,
2877 .off1 = td_var_offset(disable_lat),
2878 .help = "Disable latency numbers",
2879 .parent = "gtod_reduce",
2882 .category = FIO_OPT_C_STAT,
2883 .group = FIO_OPT_G_INVALID,
2886 .name = "disable_clat",
2887 .lname = "Disable completion latency stats",
2888 .type = FIO_OPT_BOOL,
2889 .off1 = td_var_offset(disable_clat),
2890 .help = "Disable completion latency numbers",
2891 .parent = "gtod_reduce",
2894 .category = FIO_OPT_C_STAT,
2895 .group = FIO_OPT_G_INVALID,
2898 .name = "disable_slat",
2899 .lname = "Disable submission latency stats",
2900 .type = FIO_OPT_BOOL,
2901 .off1 = td_var_offset(disable_slat),
2902 .help = "Disable submission latency numbers",
2903 .parent = "gtod_reduce",
2906 .category = FIO_OPT_C_STAT,
2907 .group = FIO_OPT_G_INVALID,
2910 .name = "disable_bw_measurement",
2911 .lname = "Disable bandwidth stats",
2912 .type = FIO_OPT_BOOL,
2913 .off1 = td_var_offset(disable_bw),
2914 .help = "Disable bandwidth logging",
2915 .parent = "gtod_reduce",
2918 .category = FIO_OPT_C_STAT,
2919 .group = FIO_OPT_G_INVALID,
2923 .lname = "Dedicated gettimeofday() CPU",
2924 .type = FIO_OPT_INT,
2925 .cb = str_gtod_cpu_cb,
2926 .help = "Set up dedicated gettimeofday() thread on this CPU",
2927 .verify = gtod_cpu_verify,
2928 .category = FIO_OPT_C_GENERAL,
2929 .group = FIO_OPT_G_CLOCK,
2932 .name = "continue_on_error",
2933 .lname = "Continue on error",
2934 .type = FIO_OPT_STR,
2935 .off1 = td_var_offset(continue_on_error),
2936 .help = "Continue on non-fatal errors during IO",
2938 .category = FIO_OPT_C_GENERAL,
2939 .group = FIO_OPT_G_ERR,
2942 .oval = ERROR_TYPE_NONE,
2943 .help = "Exit when an error is encountered",
2946 .oval = ERROR_TYPE_READ,
2947 .help = "Continue on read errors only",
2950 .oval = ERROR_TYPE_WRITE,
2951 .help = "Continue on write errors only",
2954 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
2955 .help = "Continue on any IO errors",
2958 .oval = ERROR_TYPE_VERIFY,
2959 .help = "Continue on verify errors only",
2962 .oval = ERROR_TYPE_ANY,
2963 .help = "Continue on all io and verify errors",
2966 .oval = ERROR_TYPE_NONE,
2967 .help = "Alias for 'none'",
2970 .oval = ERROR_TYPE_ANY,
2971 .help = "Alias for 'all'",
2976 .name = "ignore_error",
2977 .type = FIO_OPT_STR,
2978 .cb = str_ignore_error_cb,
2979 .help = "Set a specific list of errors to ignore",
2981 .category = FIO_OPT_C_GENERAL,
2982 .group = FIO_OPT_G_ERR,
2985 .name = "error_dump",
2986 .type = FIO_OPT_BOOL,
2987 .off1 = td_var_offset(error_dump),
2989 .help = "Dump info on each error",
2990 .category = FIO_OPT_C_GENERAL,
2991 .group = FIO_OPT_G_ERR,
2996 .type = FIO_OPT_STR_STORE,
2997 .off1 = td_var_offset(profile),
2998 .help = "Select a specific builtin performance test",
2999 .category = FIO_OPT_C_PROFILE,
3000 .group = FIO_OPT_G_INVALID,
3005 .type = FIO_OPT_STR_STORE,
3006 .off1 = td_var_offset(cgroup),
3007 .help = "Add job to cgroup of this name",
3008 .category = FIO_OPT_C_GENERAL,
3009 .group = FIO_OPT_G_CGROUP,
3012 .name = "cgroup_nodelete",
3013 .lname = "Cgroup no-delete",
3014 .type = FIO_OPT_BOOL,
3015 .off1 = td_var_offset(cgroup_nodelete),
3016 .help = "Do not delete cgroups after job completion",
3019 .category = FIO_OPT_C_GENERAL,
3020 .group = FIO_OPT_G_CGROUP,
3023 .name = "cgroup_weight",
3024 .lname = "Cgroup weight",
3025 .type = FIO_OPT_INT,
3026 .off1 = td_var_offset(cgroup_weight),
3027 .help = "Use given weight for cgroup",
3031 .category = FIO_OPT_C_GENERAL,
3032 .group = FIO_OPT_G_CGROUP,
3037 .type = FIO_OPT_INT,
3038 .off1 = td_var_offset(uid),
3039 .help = "Run job with this user ID",
3040 .category = FIO_OPT_C_GENERAL,
3041 .group = FIO_OPT_G_CRED,
3045 .lname = "Group ID",
3046 .type = FIO_OPT_INT,
3047 .off1 = td_var_offset(gid),
3048 .help = "Run job with this group ID",
3049 .category = FIO_OPT_C_GENERAL,
3050 .group = FIO_OPT_G_CRED,
3055 .type = FIO_OPT_INT,
3056 .off1 = td_var_offset(kb_base),
3057 .verify = kb_base_verify,
3060 .help = "How many bytes per KB for reporting (1000 or 1024)",
3061 .category = FIO_OPT_C_GENERAL,
3062 .group = FIO_OPT_G_INVALID,
3065 .name = "hugepage-size",
3066 .lname = "Hugepage size",
3067 .type = FIO_OPT_INT,
3068 .off1 = td_var_offset(hugepage_size),
3069 .help = "When using hugepages, specify size of each page",
3070 .def = __fio_stringify(FIO_HUGE_PAGE),
3071 .interval = 1024 * 1024,
3072 .category = FIO_OPT_C_GENERAL,
3073 .group = FIO_OPT_G_INVALID,
3077 .lname = "I/O flow ID",
3078 .type = FIO_OPT_INT,
3079 .off1 = td_var_offset(flow_id),
3080 .help = "The flow index ID to use",
3082 .category = FIO_OPT_C_IO,
3083 .group = FIO_OPT_G_IO_FLOW,
3087 .lname = "I/O flow weight",
3088 .type = FIO_OPT_INT,
3089 .off1 = td_var_offset(flow),
3090 .help = "Weight for flow control of this job",
3091 .parent = "flow_id",
3094 .category = FIO_OPT_C_IO,
3095 .group = FIO_OPT_G_IO_FLOW,
3098 .name = "flow_watermark",
3099 .lname = "I/O flow watermark",
3100 .type = FIO_OPT_INT,
3101 .off1 = td_var_offset(flow_watermark),
3102 .help = "High watermark for flow control. This option"
3103 " should be set to the same value for all threads"
3104 " with non-zero flow.",
3105 .parent = "flow_id",
3108 .category = FIO_OPT_C_IO,
3109 .group = FIO_OPT_G_IO_FLOW,
3112 .name = "flow_sleep",
3113 .lname = "I/O flow sleep",
3114 .type = FIO_OPT_INT,
3115 .off1 = td_var_offset(flow_sleep),
3116 .help = "How many microseconds to sleep after being held"
3117 " back by the flow control mechanism",
3118 .parent = "flow_id",
3121 .category = FIO_OPT_C_IO,
3122 .group = FIO_OPT_G_IO_FLOW,
3129 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3130 const char *name, int val)
3132 lopt->name = (char *) name;
3134 if (o->type == FIO_OPT_STR_SET)
3135 lopt->has_arg = no_argument;
3137 lopt->has_arg = required_argument;
3140 static void options_to_lopts(struct fio_option *opts,
3141 struct option *long_options,
3142 int i, int option_type)
3144 struct fio_option *o = &opts[0];
3146 add_to_lopt(&long_options[i], o, o->name, option_type);
3149 add_to_lopt(&long_options[i], o, o->alias, option_type);
3154 assert(i < FIO_NR_OPTIONS);
3158 void fio_options_set_ioengine_opts(struct option *long_options,
3159 struct thread_data *td)
3164 while (long_options[i].name) {
3165 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3166 memset(&long_options[i], 0, sizeof(*long_options));
3173 * Just clear out the prior ioengine options.
3178 options_to_lopts(td->io_ops->options, long_options, i,
3179 FIO_GETOPT_IOENGINE);
3182 void fio_options_dup_and_init(struct option *long_options)
3186 options_init(fio_options);
3189 while (long_options[i].name)
3192 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3195 struct fio_keyword {
3201 static struct fio_keyword fio_keywords[] = {
3203 .word = "$pagesize",
3204 .desc = "Page size in the system",
3207 .word = "$mb_memory",
3208 .desc = "Megabytes of memory online",
3212 .desc = "Number of CPUs online in the system",
3219 void fio_keywords_init(void)
3221 unsigned long long mb_memory;
3225 sprintf(buf, "%lu", (unsigned long) page_size);
3226 fio_keywords[0].replace = strdup(buf);
3228 mb_memory = os_phys_mem() / (1024 * 1024);
3229 sprintf(buf, "%llu", mb_memory);
3230 fio_keywords[1].replace = strdup(buf);
3233 sprintf(buf, "%lu", l);
3234 fio_keywords[2].replace = strdup(buf);
3239 static char *bc_calc(char *str)
3241 char buf[128], *tmp;
3246 * No math, just return string
3248 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3249 !strchr(str, '/')) || strchr(str, '\''))
3253 * Split option from value, we only need to calculate the value
3255 tmp = strchr(str, '=');
3262 * Prevent buffer overflows; such a case isn't reasonable anyway
3264 if (strlen(str) >= 128 || strlen(tmp) > 100)
3267 sprintf(buf, "which %s > /dev/null", BC_APP);
3269 log_err("fio: bc is needed for performing math\n");
3273 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3274 f = popen(buf, "r");
3278 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3283 buf[(tmp - str) + ret - 1] = '\0';
3284 memcpy(buf, str, tmp - str);
3290 * Return a copy of the input string with substrings of the form ${VARNAME}
3291 * substituted with the value of the environment variable VARNAME. The
3292 * substitution always occurs, even if VARNAME is empty or the corresponding
3293 * environment variable undefined.
3295 static char *option_dup_subs(const char *opt)
3297 char out[OPT_LEN_MAX+1];
3298 char in[OPT_LEN_MAX+1];
3301 char *ch1, *ch2, *env;
3302 ssize_t nchr = OPT_LEN_MAX;
3305 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3306 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3310 in[OPT_LEN_MAX] = '\0';
3311 strncpy(in, opt, OPT_LEN_MAX);
3313 while (*inptr && nchr > 0) {
3314 if (inptr[0] == '$' && inptr[1] == '{') {
3315 ch2 = strchr(inptr, '}');
3316 if (ch2 && inptr+1 < ch2) {
3323 envlen = strlen(env);
3324 if (envlen <= nchr) {
3325 memcpy(outptr, env, envlen);
3335 *outptr++ = *inptr++;
3344 * Look for reserved variable names and replace them with real values
3346 static char *fio_keyword_replace(char *opt)
3352 for (i = 0; fio_keywords[i].word != NULL; i++) {
3353 struct fio_keyword *kw = &fio_keywords[i];
3355 while ((s = strstr(opt, kw->word)) != NULL) {
3356 char *new = malloc(strlen(opt) + 1);
3362 * Copy part of the string before the keyword and
3363 * sprintf() the replacement after it.
3365 memcpy(new, opt, olen);
3366 len = sprintf(new + olen, "%s", kw->replace);
3369 * If there's more in the original string, copy that
3372 opt += strlen(kw->word) + olen;
3374 memcpy(new + olen + len, opt, opt - o_org - 1);
3377 * replace opt and free the old opt
3387 * Check for potential math and invoke bc, if possible
3395 static char **dup_and_sub_options(char **opts, int num_opts)
3398 char **opts_copy = malloc(num_opts * sizeof(*opts));
3399 for (i = 0; i < num_opts; i++) {
3400 opts_copy[i] = option_dup_subs(opts[i]);
3403 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3408 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
3410 int i, ret, unknown;
3413 sort_options(opts, fio_options, num_opts);
3414 opts_copy = dup_and_sub_options(opts, num_opts);
3416 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3417 struct fio_option *o;
3418 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3427 opts_copy[i] = NULL;
3434 ret |= ioengine_load(td);
3436 sort_options(opts_copy, td->io_ops->options, num_opts);
3439 for (i = 0; i < num_opts; i++) {
3440 struct fio_option *o = NULL;
3446 newret = parse_option(opts_copy[i], opts[i],
3447 td->io_ops->options, &o,
3452 log_err("Bad option <%s>\n", opts[i]);
3455 opts_copy[i] = NULL;
3463 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3465 return parse_cmd_option(opt, val, fio_options, td);
3468 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3471 return parse_cmd_option(opt, val, td->io_ops->options, td);
3474 void fio_fill_default_options(struct thread_data *td)
3476 fill_default_options(td, fio_options);
3479 int fio_show_option_help(const char *opt)
3481 return show_cmd_help(fio_options, opt);
3484 void options_mem_dupe(void *data, struct fio_option *options)
3486 struct fio_option *o;
3489 for (o = &options[0]; o->name; o++) {
3490 if (o->type != FIO_OPT_STR_STORE)
3493 ptr = td_var(data, o->off1);
3495 *ptr = strdup(*ptr);
3500 * dupe FIO_OPT_STR_STORE options
3502 void fio_options_mem_dupe(struct thread_data *td)
3504 options_mem_dupe(&td->o, fio_options);
3506 if (td->eo && td->io_ops) {
3507 void *oldeo = td->eo;
3509 td->eo = malloc(td->io_ops->option_struct_size);
3510 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3511 options_mem_dupe(td->eo, td->io_ops->options);
3515 unsigned int fio_get_kb_base(void *data)
3517 struct thread_options *o = data;
3518 unsigned int kb_base = 0;
3521 kb_base = o->kb_base;
3528 int add_option(struct fio_option *o)
3530 struct fio_option *__o;
3539 memcpy(&fio_options[opt_index], o, sizeof(*o));
3543 void invalidate_profile_options(const char *prof_name)
3545 struct fio_option *o;
3549 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3550 o->type = FIO_OPT_INVALID;
3551 o->prof_name = NULL;
3557 void add_opt_posval(const char *optname, const char *ival, const char *help)
3559 struct fio_option *o;
3562 o = find_option(fio_options, optname);
3566 for (i = 0; i < PARSE_MAX_VP; i++) {
3567 if (o->posval[i].ival)
3570 o->posval[i].ival = ival;
3571 o->posval[i].help = help;
3576 void del_opt_posval(const char *optname, const char *ival)
3578 struct fio_option *o;
3581 o = find_option(fio_options, optname);
3585 for (i = 0; i < PARSE_MAX_VP; i++) {
3586 if (!o->posval[i].ival)
3588 if (strcmp(o->posval[i].ival, ival))
3591 o->posval[i].ival = NULL;
3592 o->posval[i].help = NULL;
3596 void fio_options_free(struct thread_data *td)
3598 options_free(fio_options, td);
3599 if (td->eo && td->io_ops && td->io_ops->options) {
3600 options_free(td->io_ops->options, td->eo);
3606 struct fio_option *fio_option_find(const char *name)
3608 return find_option(fio_options, name);