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;
345 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
346 td->o.mmapfile = get_opt_postfix(mem);
351 static int fio_clock_source_cb(void *data, const char *str)
353 struct thread_data *td = data;
355 fio_clock_source = td->o.clocksource;
356 fio_clock_source_set = 1;
361 static int str_rwmix_read_cb(void *data, unsigned long long *val)
363 struct thread_data *td = data;
365 td->o.rwmix[DDIR_READ] = *val;
366 td->o.rwmix[DDIR_WRITE] = 100 - *val;
370 static int str_rwmix_write_cb(void *data, unsigned long long *val)
372 struct thread_data *td = data;
374 td->o.rwmix[DDIR_WRITE] = *val;
375 td->o.rwmix[DDIR_READ] = 100 - *val;
379 static int str_exitall_cb(void)
381 exitall_on_terminate = 1;
385 #ifdef FIO_HAVE_CPU_AFFINITY
386 static int str_cpumask_cb(void *data, unsigned long long *val)
388 struct thread_data *td = data;
393 ret = fio_cpuset_init(&td->o.cpumask);
395 log_err("fio: cpuset_init failed\n");
396 td_verror(td, ret, "fio_cpuset_init");
400 max_cpu = cpus_online();
402 for (i = 0; i < sizeof(int) * 8; i++) {
403 if ((1 << i) & *val) {
405 log_err("fio: CPU %d too large (max=%ld)\n", i,
409 dprint(FD_PARSE, "set cpu allowed %d\n", i);
410 fio_cpu_set(&td->o.cpumask, i);
414 td->o.cpumask_set = 1;
418 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
425 ret = fio_cpuset_init(mask);
427 log_err("fio: cpuset_init failed\n");
428 td_verror(td, ret, "fio_cpuset_init");
432 p = str = strdup(input);
434 strip_blank_front(&str);
435 strip_blank_end(str);
437 max_cpu = cpus_online();
439 while ((cpu = strsep(&str, ",")) != NULL) {
448 while ((cpu2 = strsep(&str2, "-")) != NULL) {
458 while (icpu <= icpu2) {
459 if (icpu >= FIO_MAX_CPUS) {
460 log_err("fio: your OS only supports up to"
461 " %d CPUs\n", (int) FIO_MAX_CPUS);
465 if (icpu > max_cpu) {
466 log_err("fio: CPU %d too large (max=%ld)\n",
472 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
473 fio_cpu_set(mask, icpu);
482 td->o.cpumask_set = 1;
486 static int str_cpus_allowed_cb(void *data, const char *input)
488 struct thread_data *td = data;
491 ret = set_cpus_allowed(td, &td->o.cpumask, input);
493 td->o.cpumask_set = 1;
498 static int str_verify_cpus_allowed_cb(void *data, const char *input)
500 struct thread_data *td = data;
503 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
505 td->o.verify_cpumask_set = 1;
511 #ifdef CONFIG_LIBNUMA
512 static int str_numa_cpunodes_cb(void *data, char *input)
514 struct thread_data *td = data;
516 /* numa_parse_nodestring() parses a character string list
517 * of nodes into a bit mask. The bit mask is allocated by
518 * numa_allocate_nodemask(), so it should be freed by
519 * numa_free_nodemask().
521 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
522 if (td->o.numa_cpunodesmask == NULL) {
523 log_err("fio: numa_parse_nodestring failed\n");
524 td_verror(td, 1, "str_numa_cpunodes_cb");
528 td->o.numa_cpumask_set = 1;
532 static int str_numa_mpol_cb(void *data, char *input)
534 struct thread_data *td = data;
535 const char * const policy_types[] =
536 { "default", "prefer", "bind", "interleave", "local" };
539 char *nodelist = strchr(input, ':');
541 /* NUL-terminate mode */
545 for (i = 0; i <= MPOL_LOCAL; i++) {
546 if (!strcmp(input, policy_types[i])) {
547 td->o.numa_mem_mode = i;
551 if (i > MPOL_LOCAL) {
552 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
556 switch (td->o.numa_mem_mode) {
559 * Insist on a nodelist of one node only
562 char *rest = nodelist;
563 while (isdigit(*rest))
566 log_err("fio: one node only for \'prefer\'\n");
570 log_err("fio: one node is needed for \'prefer\'\n");
574 case MPOL_INTERLEAVE:
576 * Default to online nodes with memory if no nodelist
579 nodelist = strdup("all");
584 * Don't allow a nodelist
587 log_err("fio: NO nodelist for \'local\'\n");
593 * Insist on a nodelist
596 log_err("fio: a nodelist is needed for \'bind\'\n");
603 /* numa_parse_nodestring() parses a character string list
604 * of nodes into a bit mask. The bit mask is allocated by
605 * numa_allocate_nodemask(), so it should be freed by
606 * numa_free_nodemask().
608 switch (td->o.numa_mem_mode) {
610 td->o.numa_mem_prefer_node = atoi(nodelist);
612 case MPOL_INTERLEAVE:
614 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
615 if (td->o.numa_memnodesmask == NULL) {
616 log_err("fio: numa_parse_nodestring failed\n");
617 td_verror(td, 1, "str_numa_memnodes_cb");
627 td->o.numa_memmask_set = 1;
635 static int str_fst_cb(void *data, const char *str)
637 struct thread_data *td = data;
638 char *nr = get_opt_postfix(str);
640 td->file_service_nr = 1;
642 td->file_service_nr = atoi(nr);
649 #ifdef CONFIG_SYNC_FILE_RANGE
650 static int str_sfr_cb(void *data, const char *str)
652 struct thread_data *td = data;
653 char *nr = get_opt_postfix(str);
655 td->sync_file_range_nr = 1;
657 td->sync_file_range_nr = atoi(nr);
665 static int str_random_distribution_cb(void *data, const char *str)
667 struct thread_data *td = data;
671 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
673 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
678 nr = get_opt_postfix(str);
679 if (nr && !str_to_float(nr, &val)) {
680 log_err("fio: random postfix parsing failed\n");
687 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
689 log_err("fio: zipf theta must different than 1.0\n");
692 td->o.zipf_theta.u.f = val;
694 if (val <= 0.00 || val >= 1.00) {
695 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
698 td->o.pareto_h.u.f = val;
705 * Return next file in the string. Files are separated with ':'. If the ':'
706 * is escaped with a '\', then that ':' is part of the filename and does not
707 * indicate a new file.
709 static char *get_next_file_name(char **ptr)
714 if (!str || !strlen(str))
720 * No colon, we are done
722 p = strchr(str, ':');
729 * We got a colon, but it's the first character. Skip and
737 if (*(p - 1) != '\\') {
743 memmove(p - 1, p, strlen(p) + 1);
750 static int str_filename_cb(void *data, const char *input)
752 struct thread_data *td = data;
753 char *fname, *str, *p;
755 p = str = strdup(input);
757 strip_blank_front(&str);
758 strip_blank_end(str);
760 if (!td->files_index)
763 while ((fname = get_next_file_name(&str)) != NULL) {
774 static int str_directory_cb(void *data, const char fio_unused *str)
776 struct thread_data *td = data;
779 if (lstat(td->o.directory, &sb) < 0) {
782 log_err("fio: %s is not a directory\n", td->o.directory);
783 td_verror(td, ret, "lstat");
786 if (!S_ISDIR(sb.st_mode)) {
787 log_err("fio: %s is not a directory\n", td->o.directory);
794 static int str_opendir_cb(void *data, const char fio_unused *str)
796 struct thread_data *td = data;
798 if (!td->files_index)
801 return add_dir_files(td, td->o.opendir);
804 static int str_verify_pattern_cb(void *data, const char *input)
806 struct thread_data *td = data;
808 int i = 0, j = 0, len, k, base = 10;
811 loc1 = strstr(input, "0x");
812 loc2 = strstr(input, "0X");
815 off = strtol(input, NULL, base);
816 if (off != LONG_MAX || errno != ERANGE) {
818 td->o.verify_pattern[i] = off & 0xff;
827 j = loc1 - input + 2;
829 j = loc2 - input + 2;
832 if (len - j < MAX_PATTERN_SIZE * 2) {
834 off = converthexchartoint(input[k--]);
836 off += (converthexchartoint(input[k--])
838 td->o.verify_pattern[i++] = (char) off;
844 * Fill the pattern all the way to the end. This greatly reduces
845 * the number of memcpy's we have to do when verifying the IO.
847 while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) {
848 memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i);
853 * The code in verify_io_u_pattern assumes a single byte pattern
854 * fills the whole verify pattern buffer.
856 memset(td->o.verify_pattern, td->o.verify_pattern[0],
860 td->o.verify_pattern_bytes = i;
863 * VERIFY_META could already be set
865 if (td->o.verify == VERIFY_NONE)
866 td->o.verify = VERIFY_PATTERN;
871 static int str_gtod_reduce_cb(void *data, int *il)
873 struct thread_data *td = data;
876 td->o.disable_lat = !!val;
877 td->o.disable_clat = !!val;
878 td->o.disable_slat = !!val;
879 td->o.disable_bw = !!val;
880 td->o.clat_percentiles = !val;
882 td->tv_cache_mask = 63;
887 static int str_gtod_cpu_cb(void *data, long long *il)
889 struct thread_data *td = data;
892 td->o.gtod_cpu = val;
893 td->o.gtod_offload = 1;
897 static int str_size_cb(void *data, unsigned long long *__val)
899 struct thread_data *td = data;
900 unsigned long long v = *__val;
902 if (parse_is_percent(v)) {
904 td->o.size_percent = -1ULL - v;
911 static int rw_verify(struct fio_option *o, void *data)
913 struct thread_data *td = data;
915 if (read_only && td_write(td)) {
916 log_err("fio: job <%s> has write bit set, but fio is in"
917 " read-only mode\n", td->o.name);
924 static int gtod_cpu_verify(struct fio_option *o, void *data)
926 #ifndef FIO_HAVE_CPU_AFFINITY
927 struct thread_data *td = data;
929 if (td->o.gtod_cpu) {
930 log_err("fio: platform must support CPU affinity for"
931 "gettimeofday() offloading\n");
939 static int kb_base_verify(struct fio_option *o, void *data)
941 struct thread_data *td = data;
943 if (td->o.kb_base != 1024 && td->o.kb_base != 1000) {
944 log_err("fio: kb_base set to nonsensical value: %u\n",
955 static struct opt_group fio_opt_groups[] = {
958 .mask = FIO_OPT_C_GENERAL,
962 .mask = FIO_OPT_C_IO,
966 .mask = FIO_OPT_C_FILE,
969 .name = "Statistics",
970 .mask = FIO_OPT_C_STAT,
974 .mask = FIO_OPT_C_LOG,
978 .mask = FIO_OPT_C_PROFILE,
985 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
986 unsigned int inv_mask)
988 struct opt_group *og;
991 if (*mask == inv_mask || !*mask)
994 for (i = 0; ogs[i].name; i++) {
997 if (*mask & og->mask) {
998 *mask &= ~(og->mask);
1006 struct opt_group *opt_group_from_mask(unsigned int *mask)
1008 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1011 static struct opt_group fio_opt_cat_groups[] = {
1014 .mask = FIO_OPT_G_RATE,
1018 .mask = FIO_OPT_G_ZONE,
1021 .name = "Read/write mix",
1022 .mask = FIO_OPT_G_RWMIX,
1026 .mask = FIO_OPT_G_VERIFY,
1030 .mask = FIO_OPT_G_TRIM,
1033 .name = "I/O Logging",
1034 .mask = FIO_OPT_G_IOLOG,
1037 .name = "I/O Depth",
1038 .mask = FIO_OPT_G_IO_DEPTH,
1042 .mask = FIO_OPT_G_IO_FLOW,
1045 .name = "Description",
1046 .mask = FIO_OPT_G_DESC,
1050 .mask = FIO_OPT_G_FILENAME,
1053 .name = "General I/O",
1054 .mask = FIO_OPT_G_IO_BASIC,
1058 .mask = FIO_OPT_G_CGROUP,
1062 .mask = FIO_OPT_G_RUNTIME,
1066 .mask = FIO_OPT_G_PROCESS,
1069 .name = "Job credentials / priority",
1070 .mask = FIO_OPT_G_CRED,
1073 .name = "Clock settings",
1074 .mask = FIO_OPT_G_CLOCK,
1078 .mask = FIO_OPT_G_IO_TYPE,
1081 .name = "I/O Thinktime",
1082 .mask = FIO_OPT_G_THINKTIME,
1085 .name = "Randomizations",
1086 .mask = FIO_OPT_G_RANDOM,
1089 .name = "I/O buffers",
1090 .mask = FIO_OPT_G_IO_BUF,
1093 .name = "Tiobench profile",
1094 .mask = FIO_OPT_G_TIOBENCH,
1102 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1104 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1108 * Map of job/command line options
1110 struct fio_option fio_options[FIO_MAX_OPTS] = {
1112 .name = "description",
1113 .lname = "Description of job",
1114 .type = FIO_OPT_STR_STORE,
1115 .off1 = td_var_offset(description),
1116 .help = "Text job description",
1117 .category = FIO_OPT_C_GENERAL,
1118 .group = FIO_OPT_G_DESC,
1122 .lname = "Job name",
1123 .type = FIO_OPT_STR_STORE,
1124 .off1 = td_var_offset(name),
1125 .help = "Name of this job",
1126 .category = FIO_OPT_C_GENERAL,
1127 .group = FIO_OPT_G_DESC,
1131 .lname = "Filename(s)",
1132 .type = FIO_OPT_STR_STORE,
1133 .off1 = td_var_offset(filename),
1134 .cb = str_filename_cb,
1135 .prio = -1, /* must come after "directory" */
1136 .help = "File(s) to use for the workload",
1137 .category = FIO_OPT_C_FILE,
1138 .group = FIO_OPT_G_FILENAME,
1141 .name = "directory",
1142 .lname = "Directory",
1143 .type = FIO_OPT_STR_STORE,
1144 .off1 = td_var_offset(directory),
1145 .cb = str_directory_cb,
1146 .help = "Directory to store files in",
1147 .category = FIO_OPT_C_FILE,
1148 .group = FIO_OPT_G_FILENAME,
1151 .name = "filename_format",
1152 .type = FIO_OPT_STR_STORE,
1153 .off1 = td_var_offset(filename_format),
1154 .prio = -1, /* must come after "directory" */
1155 .help = "Override default $jobname.$jobnum.$filenum naming",
1156 .def = "$jobname.$jobnum.$filenum",
1157 .category = FIO_OPT_C_FILE,
1158 .group = FIO_OPT_G_FILENAME,
1162 .lname = "Lockfile",
1163 .type = FIO_OPT_STR,
1164 .off1 = td_var_offset(file_lock_mode),
1165 .help = "Lock file when doing IO to it",
1166 .parent = "filename",
1169 .category = FIO_OPT_C_FILE,
1170 .group = FIO_OPT_G_FILENAME,
1173 .oval = FILE_LOCK_NONE,
1174 .help = "No file locking",
1176 { .ival = "exclusive",
1177 .oval = FILE_LOCK_EXCLUSIVE,
1178 .help = "Exclusive file lock",
1181 .ival = "readwrite",
1182 .oval = FILE_LOCK_READWRITE,
1183 .help = "Read vs write lock",
1189 .lname = "Open directory",
1190 .type = FIO_OPT_STR_STORE,
1191 .off1 = td_var_offset(opendir),
1192 .cb = str_opendir_cb,
1193 .help = "Recursively add files from this directory and down",
1194 .category = FIO_OPT_C_FILE,
1195 .group = FIO_OPT_G_FILENAME,
1199 .lname = "Read/write",
1200 .alias = "readwrite",
1201 .type = FIO_OPT_STR,
1203 .off1 = td_var_offset(td_ddir),
1204 .help = "IO direction",
1206 .verify = rw_verify,
1207 .category = FIO_OPT_C_IO,
1208 .group = FIO_OPT_G_IO_BASIC,
1211 .oval = TD_DDIR_READ,
1212 .help = "Sequential read",
1215 .oval = TD_DDIR_WRITE,
1216 .help = "Sequential write",
1219 .oval = TD_DDIR_TRIM,
1220 .help = "Sequential trim",
1222 { .ival = "randread",
1223 .oval = TD_DDIR_RANDREAD,
1224 .help = "Random read",
1226 { .ival = "randwrite",
1227 .oval = TD_DDIR_RANDWRITE,
1228 .help = "Random write",
1230 { .ival = "randtrim",
1231 .oval = TD_DDIR_RANDTRIM,
1232 .help = "Random trim",
1236 .help = "Sequential read and write mix",
1238 { .ival = "readwrite",
1240 .help = "Sequential read and write mix",
1243 .oval = TD_DDIR_RANDRW,
1244 .help = "Random read and write mix"
1249 .name = "rw_sequencer",
1250 .lname = "RW Sequencer",
1251 .type = FIO_OPT_STR,
1252 .off1 = td_var_offset(rw_seq),
1253 .help = "IO offset generator modifier",
1254 .def = "sequential",
1255 .category = FIO_OPT_C_IO,
1256 .group = FIO_OPT_G_IO_BASIC,
1258 { .ival = "sequential",
1260 .help = "Generate sequential offsets",
1262 { .ival = "identical",
1263 .oval = RW_SEQ_IDENT,
1264 .help = "Generate identical offsets",
1271 .lname = "IO Engine",
1272 .type = FIO_OPT_STR_STORE,
1273 .off1 = td_var_offset(ioengine),
1274 .help = "IO engine to use",
1275 .def = FIO_PREFERRED_ENGINE,
1276 .category = FIO_OPT_C_IO,
1277 .group = FIO_OPT_G_IO_BASIC,
1280 .help = "Use read/write",
1283 .help = "Use pread/pwrite",
1286 .help = "Use readv/writev",
1288 #ifdef CONFIG_LIBAIO
1290 .help = "Linux native asynchronous IO",
1293 #ifdef CONFIG_POSIXAIO
1294 { .ival = "posixaio",
1295 .help = "POSIX asynchronous IO",
1298 #ifdef CONFIG_SOLARISAIO
1299 { .ival = "solarisaio",
1300 .help = "Solaris native asynchronous IO",
1303 #ifdef CONFIG_WINDOWSAIO
1304 { .ival = "windowsaio",
1305 .help = "Windows native asynchronous IO"
1309 .help = "Memory mapped IO"
1311 #ifdef CONFIG_LINUX_SPLICE
1313 .help = "splice/vmsplice based IO",
1315 { .ival = "netsplice",
1316 .help = "splice/vmsplice to/from the network",
1319 #ifdef FIO_HAVE_SGIO
1321 .help = "SCSI generic v3 IO",
1325 .help = "Testing engine (no data transfer)",
1328 .help = "Network IO",
1331 .help = "CPU cycle burner engine",
1335 .help = "GUASI IO engine",
1338 #ifdef FIO_HAVE_BINJECT
1339 { .ival = "binject",
1340 .help = "binject direct inject block engine",
1345 .help = "RDMA IO engine",
1348 #ifdef CONFIG_FUSION_AW
1349 { .ival = "fusion-aw-sync",
1350 .help = "Fusion-io atomic write engine",
1353 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1354 { .ival = "e4defrag",
1355 .help = "ext4 defrag engine",
1358 #ifdef CONFIG_LINUX_FALLOCATE
1360 .help = "fallocate() file based engine",
1363 { .ival = "external",
1364 .help = "Load external engine (append name)",
1370 .lname = "IO Depth",
1371 .type = FIO_OPT_INT,
1372 .off1 = td_var_offset(iodepth),
1373 .help = "Number of IO buffers to keep in flight",
1377 .category = FIO_OPT_C_IO,
1378 .group = FIO_OPT_G_IO_BASIC,
1381 .name = "iodepth_batch",
1382 .lname = "IO Depth batch",
1383 .alias = "iodepth_batch_submit",
1384 .type = FIO_OPT_INT,
1385 .off1 = td_var_offset(iodepth_batch),
1386 .help = "Number of IO buffers to submit in one go",
1387 .parent = "iodepth",
1392 .category = FIO_OPT_C_IO,
1393 .group = FIO_OPT_G_IO_BASIC,
1396 .name = "iodepth_batch_complete",
1397 .lname = "IO Depth batch complete",
1398 .type = FIO_OPT_INT,
1399 .off1 = td_var_offset(iodepth_batch_complete),
1400 .help = "Number of IO buffers to retrieve in one go",
1401 .parent = "iodepth",
1406 .category = FIO_OPT_C_IO,
1407 .group = FIO_OPT_G_IO_BASIC,
1410 .name = "iodepth_low",
1411 .lname = "IO Depth batch low",
1412 .type = FIO_OPT_INT,
1413 .off1 = td_var_offset(iodepth_low),
1414 .help = "Low water mark for queuing depth",
1415 .parent = "iodepth",
1418 .category = FIO_OPT_C_IO,
1419 .group = FIO_OPT_G_IO_BASIC,
1424 .type = FIO_OPT_STR_VAL,
1426 .help = "Total size of device or files",
1427 .interval = 1024 * 1024,
1428 .category = FIO_OPT_C_IO,
1429 .group = FIO_OPT_G_INVALID,
1432 .name = "fill_device",
1433 .lname = "Fill device",
1435 .type = FIO_OPT_BOOL,
1436 .off1 = td_var_offset(fill_device),
1437 .help = "Write until an ENOSPC error occurs",
1439 .category = FIO_OPT_C_FILE,
1440 .group = FIO_OPT_G_INVALID,
1444 .lname = "File size",
1445 .type = FIO_OPT_STR_VAL,
1446 .off1 = td_var_offset(file_size_low),
1447 .off2 = td_var_offset(file_size_high),
1449 .help = "Size of individual files",
1450 .interval = 1024 * 1024,
1451 .category = FIO_OPT_C_FILE,
1452 .group = FIO_OPT_G_INVALID,
1456 .lname = "IO offset",
1457 .alias = "fileoffset",
1458 .type = FIO_OPT_STR_VAL,
1459 .off1 = td_var_offset(start_offset),
1460 .help = "Start IO from this offset",
1462 .interval = 1024 * 1024,
1463 .category = FIO_OPT_C_IO,
1464 .group = FIO_OPT_G_INVALID,
1467 .name = "offset_increment",
1468 .lname = "IO offset increment",
1469 .type = FIO_OPT_STR_VAL,
1470 .off1 = td_var_offset(offset_increment),
1471 .help = "What is the increment from one offset to the next",
1475 .interval = 1024 * 1024,
1476 .category = FIO_OPT_C_IO,
1477 .group = FIO_OPT_G_INVALID,
1481 .lname = "Block size",
1482 .alias = "blocksize",
1483 .type = FIO_OPT_INT,
1484 .off1 = td_var_offset(bs[DDIR_READ]),
1485 .off2 = td_var_offset(bs[DDIR_WRITE]),
1486 .off3 = td_var_offset(bs[DDIR_TRIM]),
1488 .help = "Block size unit",
1493 .category = FIO_OPT_C_IO,
1494 .group = FIO_OPT_G_INVALID,
1498 .lname = "Block size align",
1499 .alias = "blockalign",
1500 .type = FIO_OPT_INT,
1501 .off1 = td_var_offset(ba[DDIR_READ]),
1502 .off2 = td_var_offset(ba[DDIR_WRITE]),
1503 .off3 = td_var_offset(ba[DDIR_TRIM]),
1505 .help = "IO block offset alignment",
1509 .category = FIO_OPT_C_IO,
1510 .group = FIO_OPT_G_INVALID,
1514 .lname = "Block size range",
1515 .alias = "blocksize_range",
1516 .type = FIO_OPT_RANGE,
1517 .off1 = td_var_offset(min_bs[DDIR_READ]),
1518 .off2 = td_var_offset(max_bs[DDIR_READ]),
1519 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1520 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1521 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1522 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1524 .help = "Set block size range (in more detail than bs)",
1528 .category = FIO_OPT_C_IO,
1529 .group = FIO_OPT_G_INVALID,
1533 .lname = "Block size split",
1534 .type = FIO_OPT_STR,
1535 .cb = str_bssplit_cb,
1536 .help = "Set a specific mix of block sizes",
1539 .category = FIO_OPT_C_IO,
1540 .group = FIO_OPT_G_INVALID,
1543 .name = "bs_unaligned",
1544 .lname = "Block size unaligned",
1545 .alias = "blocksize_unaligned",
1546 .type = FIO_OPT_STR_SET,
1547 .off1 = td_var_offset(bs_unaligned),
1548 .help = "Don't sector align IO buffer sizes",
1551 .category = FIO_OPT_C_IO,
1552 .group = FIO_OPT_G_INVALID,
1555 .name = "randrepeat",
1556 .lname = "Random repeatable",
1557 .type = FIO_OPT_BOOL,
1558 .off1 = td_var_offset(rand_repeatable),
1559 .help = "Use repeatable random IO pattern",
1563 .category = FIO_OPT_C_IO,
1564 .group = FIO_OPT_G_RANDOM,
1567 .name = "use_os_rand",
1568 .lname = "Use OS random",
1569 .type = FIO_OPT_BOOL,
1570 .off1 = td_var_offset(use_os_rand),
1571 .help = "Set to use OS random generator",
1575 .category = FIO_OPT_C_IO,
1576 .group = FIO_OPT_G_RANDOM,
1579 .name = "norandommap",
1580 .lname = "No randommap",
1581 .type = FIO_OPT_STR_SET,
1582 .off1 = td_var_offset(norandommap),
1583 .help = "Accept potential duplicate random blocks",
1587 .category = FIO_OPT_C_IO,
1588 .group = FIO_OPT_G_RANDOM,
1591 .name = "softrandommap",
1592 .lname = "Soft randommap",
1593 .type = FIO_OPT_BOOL,
1594 .off1 = td_var_offset(softrandommap),
1595 .help = "Set norandommap if randommap allocation fails",
1596 .parent = "norandommap",
1599 .category = FIO_OPT_C_IO,
1600 .group = FIO_OPT_G_RANDOM,
1603 .name = "random_generator",
1604 .type = FIO_OPT_STR,
1605 .off1 = td_var_offset(random_generator),
1606 .help = "Type of random number generator to use",
1607 .def = "tausworthe",
1609 { .ival = "tausworthe",
1610 .oval = FIO_RAND_GEN_TAUSWORTHE,
1611 .help = "Strong Tausworthe generator",
1614 .oval = FIO_RAND_GEN_LFSR,
1615 .help = "Variable length LFSR",
1618 .category = FIO_OPT_C_IO,
1619 .group = FIO_OPT_G_RANDOM,
1622 .name = "random_distribution",
1623 .type = FIO_OPT_STR,
1624 .off1 = td_var_offset(random_distribution),
1625 .cb = str_random_distribution_cb,
1626 .help = "Random offset distribution generator",
1630 .oval = FIO_RAND_DIST_RANDOM,
1631 .help = "Completely random",
1634 .oval = FIO_RAND_DIST_ZIPF,
1635 .help = "Zipf distribution",
1638 .oval = FIO_RAND_DIST_PARETO,
1639 .help = "Pareto distribution",
1642 .category = FIO_OPT_C_IO,
1643 .group = FIO_OPT_G_RANDOM,
1647 .lname = "Number of files",
1648 .alias = "nr_files",
1649 .type = FIO_OPT_INT,
1650 .off1 = td_var_offset(nr_files),
1651 .help = "Split job workload between this number of files",
1654 .category = FIO_OPT_C_FILE,
1655 .group = FIO_OPT_G_INVALID,
1658 .name = "openfiles",
1659 .lname = "Number of open files",
1660 .type = FIO_OPT_INT,
1661 .off1 = td_var_offset(open_files),
1662 .help = "Number of files to keep open at the same time",
1663 .category = FIO_OPT_C_FILE,
1664 .group = FIO_OPT_G_INVALID,
1667 .name = "file_service_type",
1668 .lname = "File service type",
1669 .type = FIO_OPT_STR,
1671 .off1 = td_var_offset(file_service_type),
1672 .help = "How to select which file to service next",
1673 .def = "roundrobin",
1674 .category = FIO_OPT_C_FILE,
1675 .group = FIO_OPT_G_INVALID,
1678 .oval = FIO_FSERVICE_RANDOM,
1679 .help = "Choose a file at random",
1681 { .ival = "roundrobin",
1682 .oval = FIO_FSERVICE_RR,
1683 .help = "Round robin select files",
1685 { .ival = "sequential",
1686 .oval = FIO_FSERVICE_SEQ,
1687 .help = "Finish one file before moving to the next",
1690 .parent = "nrfiles",
1693 #ifdef CONFIG_POSIX_FALLOCATE
1695 .name = "fallocate",
1696 .lname = "Fallocate",
1697 .type = FIO_OPT_STR,
1698 .off1 = td_var_offset(fallocate_mode),
1699 .help = "Whether pre-allocation is performed when laying out files",
1701 .category = FIO_OPT_C_FILE,
1702 .group = FIO_OPT_G_INVALID,
1705 .oval = FIO_FALLOCATE_NONE,
1706 .help = "Do not pre-allocate space",
1709 .oval = FIO_FALLOCATE_POSIX,
1710 .help = "Use posix_fallocate()",
1712 #ifdef CONFIG_LINUX_FALLOCATE
1714 .oval = FIO_FALLOCATE_KEEP_SIZE,
1715 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1718 /* Compatibility with former boolean values */
1720 .oval = FIO_FALLOCATE_NONE,
1721 .help = "Alias for 'none'",
1724 .oval = FIO_FALLOCATE_POSIX,
1725 .help = "Alias for 'posix'",
1729 #endif /* CONFIG_POSIX_FALLOCATE */
1731 .name = "fadvise_hint",
1732 .lname = "Fadvise hint",
1733 .type = FIO_OPT_BOOL,
1734 .off1 = td_var_offset(fadvise_hint),
1735 .help = "Use fadvise() to advise the kernel on IO pattern",
1737 .category = FIO_OPT_C_FILE,
1738 .group = FIO_OPT_G_INVALID,
1743 .type = FIO_OPT_INT,
1744 .off1 = td_var_offset(fsync_blocks),
1745 .help = "Issue fsync for writes every given number of blocks",
1748 .category = FIO_OPT_C_FILE,
1749 .group = FIO_OPT_G_INVALID,
1752 .name = "fdatasync",
1753 .lname = "Fdatasync",
1754 .type = FIO_OPT_INT,
1755 .off1 = td_var_offset(fdatasync_blocks),
1756 .help = "Issue fdatasync for writes every given number of blocks",
1759 .category = FIO_OPT_C_FILE,
1760 .group = FIO_OPT_G_INVALID,
1763 .name = "write_barrier",
1764 .lname = "Write barrier",
1765 .type = FIO_OPT_INT,
1766 .off1 = td_var_offset(barrier_blocks),
1767 .help = "Make every Nth write a barrier write",
1770 .category = FIO_OPT_C_IO,
1771 .group = FIO_OPT_G_INVALID,
1773 #ifdef CONFIG_SYNC_FILE_RANGE
1775 .name = "sync_file_range",
1776 .lname = "Sync file range",
1778 { .ival = "wait_before",
1779 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1780 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
1784 .oval = SYNC_FILE_RANGE_WRITE,
1785 .help = "SYNC_FILE_RANGE_WRITE",
1789 .ival = "wait_after",
1790 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1791 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
1795 .type = FIO_OPT_STR_MULTI,
1797 .off1 = td_var_offset(sync_file_range),
1798 .help = "Use sync_file_range()",
1799 .category = FIO_OPT_C_FILE,
1800 .group = FIO_OPT_G_INVALID,
1805 .lname = "Direct I/O",
1806 .type = FIO_OPT_BOOL,
1807 .off1 = td_var_offset(odirect),
1808 .help = "Use O_DIRECT IO (negates buffered)",
1810 .inverse = "buffered",
1811 .category = FIO_OPT_C_IO,
1812 .group = FIO_OPT_G_IO_TYPE,
1816 .lname = "Buffered I/O",
1817 .type = FIO_OPT_BOOL,
1818 .off1 = td_var_offset(odirect),
1820 .help = "Use buffered IO (negates direct)",
1822 .inverse = "direct",
1823 .category = FIO_OPT_C_IO,
1824 .group = FIO_OPT_G_IO_TYPE,
1827 .name = "overwrite",
1828 .lname = "Overwrite",
1829 .type = FIO_OPT_BOOL,
1830 .off1 = td_var_offset(overwrite),
1831 .help = "When writing, set whether to overwrite current data",
1833 .category = FIO_OPT_C_FILE,
1834 .group = FIO_OPT_G_INVALID,
1839 .type = FIO_OPT_INT,
1840 .off1 = td_var_offset(loops),
1841 .help = "Number of times to run the job",
1844 .category = FIO_OPT_C_GENERAL,
1845 .group = FIO_OPT_G_RUNTIME,
1849 .lname = "Number of jobs",
1850 .type = FIO_OPT_INT,
1851 .off1 = td_var_offset(numjobs),
1852 .help = "Duplicate this job this many times",
1855 .category = FIO_OPT_C_GENERAL,
1856 .group = FIO_OPT_G_RUNTIME,
1859 .name = "startdelay",
1860 .lname = "Start delay",
1861 .type = FIO_OPT_STR_VAL_TIME,
1862 .off1 = td_var_offset(start_delay),
1863 .help = "Only start job when this period has passed",
1865 .category = FIO_OPT_C_GENERAL,
1866 .group = FIO_OPT_G_RUNTIME,
1872 .type = FIO_OPT_STR_VAL_TIME,
1873 .off1 = td_var_offset(timeout),
1874 .help = "Stop workload when this amount of time has passed",
1876 .category = FIO_OPT_C_GENERAL,
1877 .group = FIO_OPT_G_RUNTIME,
1880 .name = "time_based",
1881 .lname = "Time based",
1882 .type = FIO_OPT_STR_SET,
1883 .off1 = td_var_offset(time_based),
1884 .help = "Keep running until runtime/timeout is met",
1885 .category = FIO_OPT_C_GENERAL,
1886 .group = FIO_OPT_G_RUNTIME,
1889 .name = "ramp_time",
1890 .lname = "Ramp time",
1891 .type = FIO_OPT_STR_VAL_TIME,
1892 .off1 = td_var_offset(ramp_time),
1893 .help = "Ramp up time before measuring performance",
1894 .category = FIO_OPT_C_GENERAL,
1895 .group = FIO_OPT_G_RUNTIME,
1898 .name = "clocksource",
1899 .lname = "Clock source",
1900 .type = FIO_OPT_STR,
1901 .cb = fio_clock_source_cb,
1902 .off1 = td_var_offset(clocksource),
1903 .help = "What type of timing source to use",
1904 .category = FIO_OPT_C_GENERAL,
1905 .group = FIO_OPT_G_CLOCK,
1907 #ifdef CONFIG_GETTIMEOFDAY
1908 { .ival = "gettimeofday",
1910 .help = "Use gettimeofday(2) for timing",
1913 #ifdef CONFIG_CLOCK_GETTIME
1914 { .ival = "clock_gettime",
1915 .oval = CS_CGETTIME,
1916 .help = "Use clock_gettime(2) for timing",
1919 #ifdef ARCH_HAVE_CPU_CLOCK
1921 .oval = CS_CPUCLOCK,
1922 .help = "Use CPU private clock",
1930 .lname = "I/O Memory",
1931 .type = FIO_OPT_STR,
1933 .off1 = td_var_offset(mem_type),
1934 .help = "Backing type for IO buffers",
1936 .category = FIO_OPT_C_IO,
1937 .group = FIO_OPT_G_INVALID,
1941 .help = "Use malloc(3) for IO buffers",
1945 .help = "Use shared memory segments for IO buffers",
1947 #ifdef FIO_HAVE_HUGETLB
1948 { .ival = "shmhuge",
1949 .oval = MEM_SHMHUGE,
1950 .help = "Like shm, but use huge pages",
1955 .help = "Use mmap(2) (file or anon) for IO buffers",
1957 #ifdef FIO_HAVE_HUGETLB
1958 { .ival = "mmaphuge",
1959 .oval = MEM_MMAPHUGE,
1960 .help = "Like mmap, but use huge pages",
1966 .name = "iomem_align",
1967 .alias = "mem_align",
1968 .lname = "I/O memory alignment",
1969 .type = FIO_OPT_INT,
1970 .off1 = td_var_offset(mem_align),
1972 .help = "IO memory buffer offset alignment",
1976 .category = FIO_OPT_C_IO,
1977 .group = FIO_OPT_G_INVALID,
1982 .type = FIO_OPT_STR,
1983 .off1 = td_var_offset(verify),
1984 .help = "Verify data written",
1986 .category = FIO_OPT_C_IO,
1987 .group = FIO_OPT_G_VERIFY,
1990 .oval = VERIFY_NONE,
1991 .help = "Don't do IO verification",
1995 .help = "Use md5 checksums for verification",
1998 .oval = VERIFY_CRC64,
1999 .help = "Use crc64 checksums for verification",
2002 .oval = VERIFY_CRC32,
2003 .help = "Use crc32 checksums for verification",
2005 { .ival = "crc32c-intel",
2006 .oval = VERIFY_CRC32C,
2007 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2010 .oval = VERIFY_CRC32C,
2011 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2014 .oval = VERIFY_CRC16,
2015 .help = "Use crc16 checksums for verification",
2018 .oval = VERIFY_CRC7,
2019 .help = "Use crc7 checksums for verification",
2022 .oval = VERIFY_SHA1,
2023 .help = "Use sha1 checksums for verification",
2026 .oval = VERIFY_SHA256,
2027 .help = "Use sha256 checksums for verification",
2030 .oval = VERIFY_SHA512,
2031 .help = "Use sha512 checksums for verification",
2034 .oval = VERIFY_META,
2035 .help = "Use io information",
2039 .oval = VERIFY_NULL,
2040 .help = "Pretend to verify",
2045 .name = "do_verify",
2046 .lname = "Perform verify step",
2047 .type = FIO_OPT_BOOL,
2048 .off1 = td_var_offset(do_verify),
2049 .help = "Run verification stage after write",
2053 .category = FIO_OPT_C_IO,
2054 .group = FIO_OPT_G_VERIFY,
2057 .name = "verifysort",
2058 .lname = "Verify sort",
2059 .type = FIO_OPT_BOOL,
2060 .off1 = td_var_offset(verifysort),
2061 .help = "Sort written verify blocks for read back",
2065 .category = FIO_OPT_C_IO,
2066 .group = FIO_OPT_G_VERIFY,
2069 .name = "verifysort_nr",
2070 .type = FIO_OPT_INT,
2071 .off1 = td_var_offset(verifysort_nr),
2072 .help = "Pre-load and sort verify blocks for a read workload",
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,
2188 .name = "experimental_verify",
2189 .off1 = td_var_offset(experimental_verify),
2190 .type = FIO_OPT_BOOL,
2191 .help = "Enable experimental verification",
2192 .category = FIO_OPT_C_IO,
2193 .group = FIO_OPT_G_VERIFY,
2195 #ifdef FIO_HAVE_TRIM
2197 .name = "trim_percentage",
2198 .lname = "Trim percentage",
2199 .type = FIO_OPT_INT,
2200 .off1 = td_var_offset(trim_percentage),
2203 .help = "Number of verify blocks to discard/trim",
2208 .category = FIO_OPT_C_IO,
2209 .group = FIO_OPT_G_TRIM,
2212 .name = "trim_verify_zero",
2213 .lname = "Verify trim zero",
2214 .type = FIO_OPT_BOOL,
2215 .help = "Verify that trim/discarded blocks are returned as zeroes",
2216 .off1 = td_var_offset(trim_zero),
2217 .parent = "trim_percentage",
2220 .category = FIO_OPT_C_IO,
2221 .group = FIO_OPT_G_TRIM,
2224 .name = "trim_backlog",
2225 .lname = "Trim backlog",
2226 .type = FIO_OPT_STR_VAL,
2227 .off1 = td_var_offset(trim_backlog),
2228 .help = "Trim after this number of blocks are written",
2229 .parent = "trim_percentage",
2232 .category = FIO_OPT_C_IO,
2233 .group = FIO_OPT_G_TRIM,
2236 .name = "trim_backlog_batch",
2237 .lname = "Trim backlog batch",
2238 .type = FIO_OPT_INT,
2239 .off1 = td_var_offset(trim_batch),
2240 .help = "Trim this number of IO blocks",
2241 .parent = "trim_percentage",
2244 .category = FIO_OPT_C_IO,
2245 .group = FIO_OPT_G_TRIM,
2249 .name = "write_iolog",
2250 .lname = "Write I/O log",
2251 .type = FIO_OPT_STR_STORE,
2252 .off1 = td_var_offset(write_iolog_file),
2253 .help = "Store IO pattern to file",
2254 .category = FIO_OPT_C_IO,
2255 .group = FIO_OPT_G_IOLOG,
2258 .name = "read_iolog",
2259 .lname = "Read I/O log",
2260 .type = FIO_OPT_STR_STORE,
2261 .off1 = td_var_offset(read_iolog_file),
2262 .help = "Playback IO pattern from file",
2263 .category = FIO_OPT_C_IO,
2264 .group = FIO_OPT_G_IOLOG,
2267 .name = "replay_no_stall",
2268 .lname = "Don't stall on replay",
2269 .type = FIO_OPT_BOOL,
2270 .off1 = td_var_offset(no_stall),
2272 .parent = "read_iolog",
2274 .help = "Playback IO pattern file as fast as possible without stalls",
2275 .category = FIO_OPT_C_IO,
2276 .group = FIO_OPT_G_IOLOG,
2279 .name = "replay_redirect",
2280 .lname = "Redirect device for replay",
2281 .type = FIO_OPT_STR_STORE,
2282 .off1 = td_var_offset(replay_redirect),
2283 .parent = "read_iolog",
2285 .help = "Replay all I/O onto this device, regardless of trace device",
2286 .category = FIO_OPT_C_IO,
2287 .group = FIO_OPT_G_IOLOG,
2290 .name = "exec_prerun",
2291 .lname = "Pre-execute runnable",
2292 .type = FIO_OPT_STR_STORE,
2293 .off1 = td_var_offset(exec_prerun),
2294 .help = "Execute this file prior to running job",
2295 .category = FIO_OPT_C_GENERAL,
2296 .group = FIO_OPT_G_INVALID,
2299 .name = "exec_postrun",
2300 .lname = "Post-execute runnable",
2301 .type = FIO_OPT_STR_STORE,
2302 .off1 = td_var_offset(exec_postrun),
2303 .help = "Execute this file after running job",
2304 .category = FIO_OPT_C_GENERAL,
2305 .group = FIO_OPT_G_INVALID,
2307 #ifdef FIO_HAVE_IOSCHED_SWITCH
2309 .name = "ioscheduler",
2310 .lname = "I/O scheduler",
2311 .type = FIO_OPT_STR_STORE,
2312 .off1 = td_var_offset(ioscheduler),
2313 .help = "Use this IO scheduler on the backing device",
2314 .category = FIO_OPT_C_FILE,
2315 .group = FIO_OPT_G_INVALID,
2320 .lname = "Zone size",
2321 .type = FIO_OPT_STR_VAL,
2322 .off1 = td_var_offset(zone_size),
2323 .help = "Amount of data to read per zone",
2325 .interval = 1024 * 1024,
2326 .category = FIO_OPT_C_IO,
2327 .group = FIO_OPT_G_ZONE,
2330 .name = "zonerange",
2331 .lname = "Zone range",
2332 .type = FIO_OPT_STR_VAL,
2333 .off1 = td_var_offset(zone_range),
2334 .help = "Give size of an IO zone",
2336 .interval = 1024 * 1024,
2337 .category = FIO_OPT_C_IO,
2338 .group = FIO_OPT_G_ZONE,
2342 .lname = "Zone skip",
2343 .type = FIO_OPT_STR_VAL,
2344 .off1 = td_var_offset(zone_skip),
2345 .help = "Space between IO zones",
2347 .interval = 1024 * 1024,
2348 .category = FIO_OPT_C_IO,
2349 .group = FIO_OPT_G_ZONE,
2353 .lname = "Lock memory",
2354 .type = FIO_OPT_STR_VAL,
2355 .off1 = td_var_offset(lockmem),
2356 .help = "Lock down this amount of memory",
2358 .interval = 1024 * 1024,
2359 .category = FIO_OPT_C_GENERAL,
2360 .group = FIO_OPT_G_INVALID,
2363 .name = "rwmixread",
2364 .lname = "Read/write mix read",
2365 .type = FIO_OPT_INT,
2366 .cb = str_rwmix_read_cb,
2368 .help = "Percentage of mixed workload that is reads",
2371 .inverse = "rwmixwrite",
2372 .category = FIO_OPT_C_IO,
2373 .group = FIO_OPT_G_RWMIX,
2376 .name = "rwmixwrite",
2377 .lname = "Read/write mix write",
2378 .type = FIO_OPT_INT,
2379 .cb = str_rwmix_write_cb,
2381 .help = "Percentage of mixed workload that is writes",
2384 .inverse = "rwmixread",
2385 .category = FIO_OPT_C_IO,
2386 .group = FIO_OPT_G_RWMIX,
2389 .name = "rwmixcycle",
2390 .lname = "Read/write mix cycle",
2391 .type = FIO_OPT_DEPRECATED,
2392 .category = FIO_OPT_C_IO,
2393 .group = FIO_OPT_G_RWMIX,
2398 .type = FIO_OPT_INT,
2399 .off1 = td_var_offset(nice),
2400 .help = "Set job CPU nice value",
2405 .category = FIO_OPT_C_GENERAL,
2406 .group = FIO_OPT_G_CRED,
2408 #ifdef FIO_HAVE_IOPRIO
2411 .lname = "I/O nice priority",
2412 .type = FIO_OPT_INT,
2413 .off1 = td_var_offset(ioprio),
2414 .help = "Set job IO priority value",
2418 .category = FIO_OPT_C_GENERAL,
2419 .group = FIO_OPT_G_CRED,
2422 .name = "prioclass",
2423 .lname = "I/O nice priority class",
2424 .type = FIO_OPT_INT,
2425 .off1 = td_var_offset(ioprio_class),
2426 .help = "Set job IO priority class",
2430 .category = FIO_OPT_C_GENERAL,
2431 .group = FIO_OPT_G_CRED,
2435 .name = "thinktime",
2436 .lname = "Thinktime",
2437 .type = FIO_OPT_INT,
2438 .off1 = td_var_offset(thinktime),
2439 .help = "Idle time between IO buffers (usec)",
2441 .category = FIO_OPT_C_IO,
2442 .group = FIO_OPT_G_THINKTIME,
2445 .name = "thinktime_spin",
2446 .lname = "Thinktime spin",
2447 .type = FIO_OPT_INT,
2448 .off1 = td_var_offset(thinktime_spin),
2449 .help = "Start think time by spinning this amount (usec)",
2451 .parent = "thinktime",
2453 .category = FIO_OPT_C_IO,
2454 .group = FIO_OPT_G_THINKTIME,
2457 .name = "thinktime_blocks",
2458 .lname = "Thinktime blocks",
2459 .type = FIO_OPT_INT,
2460 .off1 = td_var_offset(thinktime_blocks),
2461 .help = "IO buffer period between 'thinktime'",
2463 .parent = "thinktime",
2465 .category = FIO_OPT_C_IO,
2466 .group = FIO_OPT_G_THINKTIME,
2470 .lname = "I/O rate",
2471 .type = FIO_OPT_INT,
2472 .off1 = td_var_offset(rate[DDIR_READ]),
2473 .off2 = td_var_offset(rate[DDIR_WRITE]),
2474 .off3 = td_var_offset(rate[DDIR_TRIM]),
2475 .help = "Set bandwidth rate",
2476 .category = FIO_OPT_C_IO,
2477 .group = FIO_OPT_G_RATE,
2481 .lname = "I/O min rate",
2482 .type = FIO_OPT_INT,
2483 .off1 = td_var_offset(ratemin[DDIR_READ]),
2484 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2485 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2486 .help = "Job must meet this rate or it will be shutdown",
2489 .category = FIO_OPT_C_IO,
2490 .group = FIO_OPT_G_RATE,
2493 .name = "rate_iops",
2494 .lname = "I/O rate IOPS",
2495 .type = FIO_OPT_INT,
2496 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2497 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2498 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2499 .help = "Limit IO used to this number of IO operations/sec",
2501 .category = FIO_OPT_C_IO,
2502 .group = FIO_OPT_G_RATE,
2505 .name = "rate_iops_min",
2506 .lname = "I/O min rate IOPS",
2507 .type = FIO_OPT_INT,
2508 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2509 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2510 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2511 .help = "Job must meet this rate or it will be shut down",
2512 .parent = "rate_iops",
2514 .category = FIO_OPT_C_IO,
2515 .group = FIO_OPT_G_RATE,
2518 .name = "ratecycle",
2519 .lname = "I/O rate cycle",
2520 .type = FIO_OPT_INT,
2521 .off1 = td_var_offset(ratecycle),
2522 .help = "Window average for rate limits (msec)",
2526 .category = FIO_OPT_C_IO,
2527 .group = FIO_OPT_G_RATE,
2530 .name = "max_latency",
2531 .type = FIO_OPT_INT,
2532 .off1 = td_var_offset(max_latency),
2533 .help = "Maximum tolerated IO latency (usec)",
2534 .category = FIO_OPT_C_IO,
2535 .group = FIO_OPT_G_RATE,
2538 .name = "invalidate",
2539 .lname = "Cache invalidate",
2540 .type = FIO_OPT_BOOL,
2541 .off1 = td_var_offset(invalidate_cache),
2542 .help = "Invalidate buffer/page cache prior to running job",
2544 .category = FIO_OPT_C_IO,
2545 .group = FIO_OPT_G_IO_TYPE,
2549 .lname = "Synchronous I/O",
2550 .type = FIO_OPT_BOOL,
2551 .off1 = td_var_offset(sync_io),
2552 .help = "Use O_SYNC for buffered writes",
2554 .parent = "buffered",
2556 .category = FIO_OPT_C_IO,
2557 .group = FIO_OPT_G_IO_TYPE,
2560 .name = "create_serialize",
2561 .lname = "Create serialize",
2562 .type = FIO_OPT_BOOL,
2563 .off1 = td_var_offset(create_serialize),
2564 .help = "Serialize creating of job files",
2566 .category = FIO_OPT_C_FILE,
2567 .group = FIO_OPT_G_INVALID,
2570 .name = "create_fsync",
2571 .lname = "Create fsync",
2572 .type = FIO_OPT_BOOL,
2573 .off1 = td_var_offset(create_fsync),
2574 .help = "fsync file after creation",
2576 .category = FIO_OPT_C_FILE,
2577 .group = FIO_OPT_G_INVALID,
2580 .name = "create_on_open",
2581 .lname = "Create on open",
2582 .type = FIO_OPT_BOOL,
2583 .off1 = td_var_offset(create_on_open),
2584 .help = "Create files when they are opened for IO",
2586 .category = FIO_OPT_C_FILE,
2587 .group = FIO_OPT_G_INVALID,
2590 .name = "create_only",
2591 .type = FIO_OPT_BOOL,
2592 .off1 = td_var_offset(create_only),
2593 .help = "Only perform file creation phase",
2594 .category = FIO_OPT_C_FILE,
2599 .lname = "Pre-read files",
2600 .type = FIO_OPT_BOOL,
2601 .off1 = td_var_offset(pre_read),
2602 .help = "Pre-read files before starting official testing",
2604 .category = FIO_OPT_C_FILE,
2605 .group = FIO_OPT_G_INVALID,
2607 #ifdef FIO_HAVE_CPU_AFFINITY
2610 .lname = "CPU mask",
2611 .type = FIO_OPT_INT,
2612 .cb = str_cpumask_cb,
2613 .help = "CPU affinity mask",
2614 .category = FIO_OPT_C_GENERAL,
2615 .group = FIO_OPT_G_CRED,
2618 .name = "cpus_allowed",
2619 .lname = "CPUs allowed",
2620 .type = FIO_OPT_STR,
2621 .cb = str_cpus_allowed_cb,
2622 .help = "Set CPUs allowed",
2623 .category = FIO_OPT_C_GENERAL,
2624 .group = FIO_OPT_G_CRED,
2627 #ifdef CONFIG_LIBNUMA
2629 .name = "numa_cpu_nodes",
2630 .type = FIO_OPT_STR,
2631 .cb = str_numa_cpunodes_cb,
2632 .help = "NUMA CPU nodes bind",
2635 .name = "numa_mem_policy",
2636 .type = FIO_OPT_STR,
2637 .cb = str_numa_mpol_cb,
2638 .help = "NUMA memory policy setup",
2642 .name = "end_fsync",
2643 .lname = "End fsync",
2644 .type = FIO_OPT_BOOL,
2645 .off1 = td_var_offset(end_fsync),
2646 .help = "Include fsync at the end of job",
2648 .category = FIO_OPT_C_FILE,
2649 .group = FIO_OPT_G_INVALID,
2652 .name = "fsync_on_close",
2653 .lname = "Fsync on close",
2654 .type = FIO_OPT_BOOL,
2655 .off1 = td_var_offset(fsync_on_close),
2656 .help = "fsync files on close",
2658 .category = FIO_OPT_C_FILE,
2659 .group = FIO_OPT_G_INVALID,
2663 .lname = "Unlink file",
2664 .type = FIO_OPT_BOOL,
2665 .off1 = td_var_offset(unlink),
2666 .help = "Unlink created files after job has completed",
2668 .category = FIO_OPT_C_FILE,
2669 .group = FIO_OPT_G_INVALID,
2673 .lname = "Exit-all on terminate",
2674 .type = FIO_OPT_STR_SET,
2675 .cb = str_exitall_cb,
2676 .help = "Terminate all jobs when one exits",
2677 .category = FIO_OPT_C_GENERAL,
2678 .group = FIO_OPT_G_PROCESS,
2681 .name = "stonewall",
2682 .lname = "Wait for previous",
2683 .alias = "wait_for_previous",
2684 .type = FIO_OPT_STR_SET,
2685 .off1 = td_var_offset(stonewall),
2686 .help = "Insert a hard barrier between this job and previous",
2687 .category = FIO_OPT_C_GENERAL,
2688 .group = FIO_OPT_G_PROCESS,
2691 .name = "new_group",
2692 .lname = "New group",
2693 .type = FIO_OPT_STR_SET,
2694 .off1 = td_var_offset(new_group),
2695 .help = "Mark the start of a new group (for reporting)",
2696 .category = FIO_OPT_C_GENERAL,
2697 .group = FIO_OPT_G_PROCESS,
2702 .type = FIO_OPT_STR_SET,
2703 .off1 = td_var_offset(use_thread),
2704 .help = "Use threads instead of processes",
2705 .category = FIO_OPT_C_GENERAL,
2706 .group = FIO_OPT_G_PROCESS,
2709 .name = "write_bw_log",
2710 .lname = "Write bandwidth log",
2711 .type = FIO_OPT_STR_STORE,
2712 .off1 = td_var_offset(bw_log_file),
2713 .help = "Write log of bandwidth during run",
2714 .category = FIO_OPT_C_LOG,
2715 .group = FIO_OPT_G_INVALID,
2718 .name = "write_lat_log",
2719 .lname = "Write latency log",
2720 .type = FIO_OPT_STR_STORE,
2721 .off1 = td_var_offset(lat_log_file),
2722 .help = "Write log of latency during run",
2723 .category = FIO_OPT_C_LOG,
2724 .group = FIO_OPT_G_INVALID,
2727 .name = "write_iops_log",
2728 .lname = "Write IOPS log",
2729 .type = FIO_OPT_STR,
2730 .off1 = td_var_offset(iops_log_file),
2731 .help = "Write log of IOPS during run",
2732 .category = FIO_OPT_C_LOG,
2733 .group = FIO_OPT_G_INVALID,
2736 .name = "log_avg_msec",
2737 .lname = "Log averaging (msec)",
2738 .type = FIO_OPT_INT,
2739 .off1 = td_var_offset(log_avg_msec),
2740 .help = "Average bw/iops/lat logs over this period of time",
2742 .category = FIO_OPT_C_LOG,
2743 .group = FIO_OPT_G_INVALID,
2746 .name = "bwavgtime",
2747 .lname = "Bandwidth average time",
2748 .type = FIO_OPT_INT,
2749 .off1 = td_var_offset(bw_avg_time),
2750 .help = "Time window over which to calculate bandwidth"
2753 .parent = "write_bw_log",
2756 .category = FIO_OPT_C_LOG,
2757 .group = FIO_OPT_G_INVALID,
2760 .name = "iopsavgtime",
2761 .lname = "IOPS average time",
2762 .type = FIO_OPT_INT,
2763 .off1 = td_var_offset(iops_avg_time),
2764 .help = "Time window over which to calculate IOPS (msec)",
2766 .parent = "write_iops_log",
2769 .category = FIO_OPT_C_LOG,
2770 .group = FIO_OPT_G_INVALID,
2773 .name = "group_reporting",
2774 .lname = "Group reporting",
2775 .type = FIO_OPT_BOOL,
2776 .off1 = td_var_offset(group_reporting),
2777 .help = "Do reporting on a per-group basis",
2779 .category = FIO_OPT_C_STAT,
2780 .group = FIO_OPT_G_INVALID,
2783 .name = "zero_buffers",
2784 .lname = "Zero I/O buffers",
2785 .type = FIO_OPT_STR_SET,
2786 .off1 = td_var_offset(zero_buffers),
2787 .help = "Init IO buffers to all zeroes",
2788 .category = FIO_OPT_C_IO,
2789 .group = FIO_OPT_G_IO_BUF,
2792 .name = "refill_buffers",
2793 .lname = "Refill I/O buffers",
2794 .type = FIO_OPT_STR_SET,
2795 .off1 = td_var_offset(refill_buffers),
2796 .help = "Refill IO buffers on every IO submit",
2797 .category = FIO_OPT_C_IO,
2798 .group = FIO_OPT_G_IO_BUF,
2801 .name = "scramble_buffers",
2802 .lname = "Scramble I/O buffers",
2803 .type = FIO_OPT_BOOL,
2804 .off1 = td_var_offset(scramble_buffers),
2805 .help = "Slightly scramble buffers on every IO submit",
2807 .category = FIO_OPT_C_IO,
2808 .group = FIO_OPT_G_IO_BUF,
2811 .name = "buffer_compress_percentage",
2812 .lname = "Buffer compression percentage",
2813 .type = FIO_OPT_INT,
2814 .off1 = td_var_offset(compress_percentage),
2817 .help = "How compressible the buffer is (approximately)",
2819 .category = FIO_OPT_C_IO,
2820 .group = FIO_OPT_G_IO_BUF,
2823 .name = "buffer_compress_chunk",
2824 .lname = "Buffer compression chunk size",
2825 .type = FIO_OPT_INT,
2826 .off1 = td_var_offset(compress_chunk),
2827 .parent = "buffer_compress_percentage",
2829 .help = "Size of compressible region in buffer",
2831 .category = FIO_OPT_C_IO,
2832 .group = FIO_OPT_G_IO_BUF,
2835 .name = "clat_percentiles",
2836 .lname = "Completion latency percentiles",
2837 .type = FIO_OPT_BOOL,
2838 .off1 = td_var_offset(clat_percentiles),
2839 .help = "Enable the reporting of completion latency percentiles",
2841 .category = FIO_OPT_C_STAT,
2842 .group = FIO_OPT_G_INVALID,
2845 .name = "percentile_list",
2846 .lname = "Completion latency percentile list",
2847 .type = FIO_OPT_FLOAT_LIST,
2848 .off1 = td_var_offset(percentile_list),
2849 .off2 = td_var_offset(percentile_precision),
2850 .help = "Specify a custom list of percentiles to report",
2851 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
2852 .maxlen = FIO_IO_U_LIST_MAX_LEN,
2855 .category = FIO_OPT_C_STAT,
2856 .group = FIO_OPT_G_INVALID,
2859 #ifdef FIO_HAVE_DISK_UTIL
2861 .name = "disk_util",
2862 .lname = "Disk utilization",
2863 .type = FIO_OPT_BOOL,
2864 .off1 = td_var_offset(do_disk_util),
2865 .help = "Log disk utilization statistics",
2867 .category = FIO_OPT_C_STAT,
2868 .group = FIO_OPT_G_INVALID,
2872 .name = "gtod_reduce",
2873 .lname = "Reduce gettimeofday() calls",
2874 .type = FIO_OPT_BOOL,
2875 .help = "Greatly reduce number of gettimeofday() calls",
2876 .cb = str_gtod_reduce_cb,
2879 .category = FIO_OPT_C_STAT,
2880 .group = FIO_OPT_G_INVALID,
2883 .name = "disable_lat",
2884 .lname = "Disable all latency stats",
2885 .type = FIO_OPT_BOOL,
2886 .off1 = td_var_offset(disable_lat),
2887 .help = "Disable latency numbers",
2888 .parent = "gtod_reduce",
2891 .category = FIO_OPT_C_STAT,
2892 .group = FIO_OPT_G_INVALID,
2895 .name = "disable_clat",
2896 .lname = "Disable completion latency stats",
2897 .type = FIO_OPT_BOOL,
2898 .off1 = td_var_offset(disable_clat),
2899 .help = "Disable completion latency numbers",
2900 .parent = "gtod_reduce",
2903 .category = FIO_OPT_C_STAT,
2904 .group = FIO_OPT_G_INVALID,
2907 .name = "disable_slat",
2908 .lname = "Disable submission latency stats",
2909 .type = FIO_OPT_BOOL,
2910 .off1 = td_var_offset(disable_slat),
2911 .help = "Disable submission latency numbers",
2912 .parent = "gtod_reduce",
2915 .category = FIO_OPT_C_STAT,
2916 .group = FIO_OPT_G_INVALID,
2919 .name = "disable_bw_measurement",
2920 .lname = "Disable bandwidth stats",
2921 .type = FIO_OPT_BOOL,
2922 .off1 = td_var_offset(disable_bw),
2923 .help = "Disable bandwidth logging",
2924 .parent = "gtod_reduce",
2927 .category = FIO_OPT_C_STAT,
2928 .group = FIO_OPT_G_INVALID,
2932 .lname = "Dedicated gettimeofday() CPU",
2933 .type = FIO_OPT_INT,
2934 .cb = str_gtod_cpu_cb,
2935 .help = "Set up dedicated gettimeofday() thread on this CPU",
2936 .verify = gtod_cpu_verify,
2937 .category = FIO_OPT_C_GENERAL,
2938 .group = FIO_OPT_G_CLOCK,
2941 .name = "unified_rw_reporting",
2942 .type = FIO_OPT_BOOL,
2943 .off1 = td_var_offset(unified_rw_rep),
2944 .help = "Unify reporting across data direction",
2946 .category = FIO_OPT_C_GENERAL,
2947 .group = FIO_OPT_G_INVALID,
2950 .name = "continue_on_error",
2951 .lname = "Continue on error",
2952 .type = FIO_OPT_STR,
2953 .off1 = td_var_offset(continue_on_error),
2954 .help = "Continue on non-fatal errors during IO",
2956 .category = FIO_OPT_C_GENERAL,
2957 .group = FIO_OPT_G_ERR,
2960 .oval = ERROR_TYPE_NONE,
2961 .help = "Exit when an error is encountered",
2964 .oval = ERROR_TYPE_READ,
2965 .help = "Continue on read errors only",
2968 .oval = ERROR_TYPE_WRITE,
2969 .help = "Continue on write errors only",
2972 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
2973 .help = "Continue on any IO errors",
2976 .oval = ERROR_TYPE_VERIFY,
2977 .help = "Continue on verify errors only",
2980 .oval = ERROR_TYPE_ANY,
2981 .help = "Continue on all io and verify errors",
2984 .oval = ERROR_TYPE_NONE,
2985 .help = "Alias for 'none'",
2988 .oval = ERROR_TYPE_ANY,
2989 .help = "Alias for 'all'",
2994 .name = "ignore_error",
2995 .type = FIO_OPT_STR,
2996 .cb = str_ignore_error_cb,
2997 .help = "Set a specific list of errors to ignore",
2999 .category = FIO_OPT_C_GENERAL,
3000 .group = FIO_OPT_G_ERR,
3003 .name = "error_dump",
3004 .type = FIO_OPT_BOOL,
3005 .off1 = td_var_offset(error_dump),
3007 .help = "Dump info on each error",
3008 .category = FIO_OPT_C_GENERAL,
3009 .group = FIO_OPT_G_ERR,
3014 .type = FIO_OPT_STR_STORE,
3015 .off1 = td_var_offset(profile),
3016 .help = "Select a specific builtin performance test",
3017 .category = FIO_OPT_C_PROFILE,
3018 .group = FIO_OPT_G_INVALID,
3023 .type = FIO_OPT_STR_STORE,
3024 .off1 = td_var_offset(cgroup),
3025 .help = "Add job to cgroup of this name",
3026 .category = FIO_OPT_C_GENERAL,
3027 .group = FIO_OPT_G_CGROUP,
3030 .name = "cgroup_nodelete",
3031 .lname = "Cgroup no-delete",
3032 .type = FIO_OPT_BOOL,
3033 .off1 = td_var_offset(cgroup_nodelete),
3034 .help = "Do not delete cgroups after job completion",
3037 .category = FIO_OPT_C_GENERAL,
3038 .group = FIO_OPT_G_CGROUP,
3041 .name = "cgroup_weight",
3042 .lname = "Cgroup weight",
3043 .type = FIO_OPT_INT,
3044 .off1 = td_var_offset(cgroup_weight),
3045 .help = "Use given weight for cgroup",
3049 .category = FIO_OPT_C_GENERAL,
3050 .group = FIO_OPT_G_CGROUP,
3055 .type = FIO_OPT_INT,
3056 .off1 = td_var_offset(uid),
3057 .help = "Run job with this user ID",
3058 .category = FIO_OPT_C_GENERAL,
3059 .group = FIO_OPT_G_CRED,
3063 .lname = "Group ID",
3064 .type = FIO_OPT_INT,
3065 .off1 = td_var_offset(gid),
3066 .help = "Run job with this group ID",
3067 .category = FIO_OPT_C_GENERAL,
3068 .group = FIO_OPT_G_CRED,
3073 .type = FIO_OPT_INT,
3074 .off1 = td_var_offset(kb_base),
3075 .verify = kb_base_verify,
3078 .help = "How many bytes per KB for reporting (1000 or 1024)",
3079 .category = FIO_OPT_C_GENERAL,
3080 .group = FIO_OPT_G_INVALID,
3083 .name = "unit_base",
3084 .type = FIO_OPT_INT,
3085 .off1 = td_var_offset(unit_base),
3090 .help = "Auto-detect",
3094 .help = "Normal (byte based)",
3098 .help = "Bit based",
3101 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3102 .category = FIO_OPT_C_GENERAL,
3103 .group = FIO_OPT_G_INVALID,
3106 .name = "hugepage-size",
3107 .lname = "Hugepage size",
3108 .type = FIO_OPT_INT,
3109 .off1 = td_var_offset(hugepage_size),
3110 .help = "When using hugepages, specify size of each page",
3111 .def = __fio_stringify(FIO_HUGE_PAGE),
3112 .interval = 1024 * 1024,
3113 .category = FIO_OPT_C_GENERAL,
3114 .group = FIO_OPT_G_INVALID,
3118 .lname = "I/O flow ID",
3119 .type = FIO_OPT_INT,
3120 .off1 = td_var_offset(flow_id),
3121 .help = "The flow index ID to use",
3123 .category = FIO_OPT_C_IO,
3124 .group = FIO_OPT_G_IO_FLOW,
3128 .lname = "I/O flow weight",
3129 .type = FIO_OPT_INT,
3130 .off1 = td_var_offset(flow),
3131 .help = "Weight for flow control of this job",
3132 .parent = "flow_id",
3135 .category = FIO_OPT_C_IO,
3136 .group = FIO_OPT_G_IO_FLOW,
3139 .name = "flow_watermark",
3140 .lname = "I/O flow watermark",
3141 .type = FIO_OPT_INT,
3142 .off1 = td_var_offset(flow_watermark),
3143 .help = "High watermark for flow control. This option"
3144 " should be set to the same value for all threads"
3145 " with non-zero flow.",
3146 .parent = "flow_id",
3149 .category = FIO_OPT_C_IO,
3150 .group = FIO_OPT_G_IO_FLOW,
3153 .name = "flow_sleep",
3154 .lname = "I/O flow sleep",
3155 .type = FIO_OPT_INT,
3156 .off1 = td_var_offset(flow_sleep),
3157 .help = "How many microseconds to sleep after being held"
3158 " back by the flow control mechanism",
3159 .parent = "flow_id",
3162 .category = FIO_OPT_C_IO,
3163 .group = FIO_OPT_G_IO_FLOW,
3170 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3171 const char *name, int val)
3173 lopt->name = (char *) name;
3175 if (o->type == FIO_OPT_STR_SET)
3176 lopt->has_arg = no_argument;
3178 lopt->has_arg = required_argument;
3181 static void options_to_lopts(struct fio_option *opts,
3182 struct option *long_options,
3183 int i, int option_type)
3185 struct fio_option *o = &opts[0];
3187 add_to_lopt(&long_options[i], o, o->name, option_type);
3190 add_to_lopt(&long_options[i], o, o->alias, option_type);
3195 assert(i < FIO_NR_OPTIONS);
3199 void fio_options_set_ioengine_opts(struct option *long_options,
3200 struct thread_data *td)
3205 while (long_options[i].name) {
3206 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3207 memset(&long_options[i], 0, sizeof(*long_options));
3214 * Just clear out the prior ioengine options.
3219 options_to_lopts(td->io_ops->options, long_options, i,
3220 FIO_GETOPT_IOENGINE);
3223 void fio_options_dup_and_init(struct option *long_options)
3227 options_init(fio_options);
3230 while (long_options[i].name)
3233 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3236 struct fio_keyword {
3242 static struct fio_keyword fio_keywords[] = {
3244 .word = "$pagesize",
3245 .desc = "Page size in the system",
3248 .word = "$mb_memory",
3249 .desc = "Megabytes of memory online",
3253 .desc = "Number of CPUs online in the system",
3260 void fio_keywords_init(void)
3262 unsigned long long mb_memory;
3266 sprintf(buf, "%lu", (unsigned long) page_size);
3267 fio_keywords[0].replace = strdup(buf);
3269 mb_memory = os_phys_mem() / (1024 * 1024);
3270 sprintf(buf, "%llu", mb_memory);
3271 fio_keywords[1].replace = strdup(buf);
3274 sprintf(buf, "%lu", l);
3275 fio_keywords[2].replace = strdup(buf);
3280 static char *bc_calc(char *str)
3282 char buf[128], *tmp;
3287 * No math, just return string
3289 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3290 !strchr(str, '/')) || strchr(str, '\''))
3294 * Split option from value, we only need to calculate the value
3296 tmp = strchr(str, '=');
3303 * Prevent buffer overflows; such a case isn't reasonable anyway
3305 if (strlen(str) >= 128 || strlen(tmp) > 100)
3308 sprintf(buf, "which %s > /dev/null", BC_APP);
3310 log_err("fio: bc is needed for performing math\n");
3314 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3315 f = popen(buf, "r");
3319 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3324 buf[(tmp - str) + ret - 1] = '\0';
3325 memcpy(buf, str, tmp - str);
3331 * Return a copy of the input string with substrings of the form ${VARNAME}
3332 * substituted with the value of the environment variable VARNAME. The
3333 * substitution always occurs, even if VARNAME is empty or the corresponding
3334 * environment variable undefined.
3336 static char *option_dup_subs(const char *opt)
3338 char out[OPT_LEN_MAX+1];
3339 char in[OPT_LEN_MAX+1];
3342 char *ch1, *ch2, *env;
3343 ssize_t nchr = OPT_LEN_MAX;
3346 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3347 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3351 in[OPT_LEN_MAX] = '\0';
3352 strncpy(in, opt, OPT_LEN_MAX);
3354 while (*inptr && nchr > 0) {
3355 if (inptr[0] == '$' && inptr[1] == '{') {
3356 ch2 = strchr(inptr, '}');
3357 if (ch2 && inptr+1 < ch2) {