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");
942 static struct opt_group fio_opt_groups[] = {
945 .mask = FIO_OPT_C_GENERAL,
949 .mask = FIO_OPT_C_IO,
953 .mask = FIO_OPT_C_FILE,
956 .name = "Statistics",
957 .mask = FIO_OPT_C_STAT,
961 .mask = FIO_OPT_C_LOG,
965 .mask = FIO_OPT_C_PROFILE,
972 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
973 unsigned int inv_mask)
975 struct opt_group *og;
978 if (*mask == inv_mask || !*mask)
981 for (i = 0; ogs[i].name; i++) {
984 if (*mask & og->mask) {
985 *mask &= ~(og->mask);
993 struct opt_group *opt_group_from_mask(unsigned int *mask)
995 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
998 static struct opt_group fio_opt_cat_groups[] = {
1001 .mask = FIO_OPT_G_RATE,
1005 .mask = FIO_OPT_G_ZONE,
1008 .name = "Read/write mix",
1009 .mask = FIO_OPT_G_RWMIX,
1013 .mask = FIO_OPT_G_VERIFY,
1017 .mask = FIO_OPT_G_TRIM,
1020 .name = "I/O Logging",
1021 .mask = FIO_OPT_G_IOLOG,
1024 .name = "I/O Depth",
1025 .mask = FIO_OPT_G_IO_DEPTH,
1029 .mask = FIO_OPT_G_IO_FLOW,
1032 .name = "Description",
1033 .mask = FIO_OPT_G_DESC,
1037 .mask = FIO_OPT_G_FILENAME,
1040 .name = "General I/O",
1041 .mask = FIO_OPT_G_IO_BASIC,
1045 .mask = FIO_OPT_G_CGROUP,
1049 .mask = FIO_OPT_G_RUNTIME,
1053 .mask = FIO_OPT_G_PROCESS,
1056 .name = "Job credentials / priority",
1057 .mask = FIO_OPT_G_CRED,
1060 .name = "Clock settings",
1061 .mask = FIO_OPT_G_CLOCK,
1065 .mask = FIO_OPT_G_IO_TYPE,
1068 .name = "I/O Thinktime",
1069 .mask = FIO_OPT_G_THINKTIME,
1072 .name = "Randomizations",
1073 .mask = FIO_OPT_G_RANDOM,
1076 .name = "I/O buffers",
1077 .mask = FIO_OPT_G_IO_BUF,
1080 .name = "Tiobench profile",
1081 .mask = FIO_OPT_G_TIOBENCH,
1089 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1091 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1095 * Map of job/command line options
1097 struct fio_option fio_options[FIO_MAX_OPTS] = {
1099 .name = "description",
1100 .lname = "Description of job",
1101 .type = FIO_OPT_STR_STORE,
1102 .off1 = td_var_offset(description),
1103 .help = "Text job description",
1104 .category = FIO_OPT_C_GENERAL,
1105 .group = FIO_OPT_G_DESC,
1109 .lname = "Job name",
1110 .type = FIO_OPT_STR_STORE,
1111 .off1 = td_var_offset(name),
1112 .help = "Name of this job",
1113 .category = FIO_OPT_C_GENERAL,
1114 .group = FIO_OPT_G_DESC,
1118 .lname = "Filename(s)",
1119 .type = FIO_OPT_STR_STORE,
1120 .off1 = td_var_offset(filename),
1121 .cb = str_filename_cb,
1122 .prio = -1, /* must come after "directory" */
1123 .help = "File(s) to use for the workload",
1124 .category = FIO_OPT_C_FILE,
1125 .group = FIO_OPT_G_FILENAME,
1128 .name = "directory",
1129 .lname = "Directory",
1130 .type = FIO_OPT_STR_STORE,
1131 .off1 = td_var_offset(directory),
1132 .cb = str_directory_cb,
1133 .help = "Directory to store files in",
1134 .category = FIO_OPT_C_FILE,
1135 .group = FIO_OPT_G_FILENAME,
1138 .name = "filename_format",
1139 .type = FIO_OPT_STR_STORE,
1140 .off1 = td_var_offset(filename_format),
1141 .prio = -1, /* must come after "directory" */
1142 .help = "Override default $jobname.$jobnum.$filenum naming",
1143 .def = "$jobname.$jobnum.$filenum",
1144 .category = FIO_OPT_C_FILE,
1145 .group = FIO_OPT_G_FILENAME,
1149 .lname = "Lockfile",
1150 .type = FIO_OPT_STR,
1151 .off1 = td_var_offset(file_lock_mode),
1152 .help = "Lock file when doing IO to it",
1153 .parent = "filename",
1156 .category = FIO_OPT_C_FILE,
1157 .group = FIO_OPT_G_FILENAME,
1160 .oval = FILE_LOCK_NONE,
1161 .help = "No file locking",
1163 { .ival = "exclusive",
1164 .oval = FILE_LOCK_EXCLUSIVE,
1165 .help = "Exclusive file lock",
1168 .ival = "readwrite",
1169 .oval = FILE_LOCK_READWRITE,
1170 .help = "Read vs write lock",
1176 .lname = "Open directory",
1177 .type = FIO_OPT_STR_STORE,
1178 .off1 = td_var_offset(opendir),
1179 .cb = str_opendir_cb,
1180 .help = "Recursively add files from this directory and down",
1181 .category = FIO_OPT_C_FILE,
1182 .group = FIO_OPT_G_FILENAME,
1186 .lname = "Read/write",
1187 .alias = "readwrite",
1188 .type = FIO_OPT_STR,
1190 .off1 = td_var_offset(td_ddir),
1191 .help = "IO direction",
1193 .verify = rw_verify,
1194 .category = FIO_OPT_C_IO,
1195 .group = FIO_OPT_G_IO_BASIC,
1198 .oval = TD_DDIR_READ,
1199 .help = "Sequential read",
1202 .oval = TD_DDIR_WRITE,
1203 .help = "Sequential write",
1206 .oval = TD_DDIR_TRIM,
1207 .help = "Sequential trim",
1209 { .ival = "randread",
1210 .oval = TD_DDIR_RANDREAD,
1211 .help = "Random read",
1213 { .ival = "randwrite",
1214 .oval = TD_DDIR_RANDWRITE,
1215 .help = "Random write",
1217 { .ival = "randtrim",
1218 .oval = TD_DDIR_RANDTRIM,
1219 .help = "Random trim",
1223 .help = "Sequential read and write mix",
1225 { .ival = "readwrite",
1227 .help = "Sequential read and write mix",
1230 .oval = TD_DDIR_RANDRW,
1231 .help = "Random read and write mix"
1236 .name = "rw_sequencer",
1237 .lname = "RW Sequencer",
1238 .type = FIO_OPT_STR,
1239 .off1 = td_var_offset(rw_seq),
1240 .help = "IO offset generator modifier",
1241 .def = "sequential",
1242 .category = FIO_OPT_C_IO,
1243 .group = FIO_OPT_G_IO_BASIC,
1245 { .ival = "sequential",
1247 .help = "Generate sequential offsets",
1249 { .ival = "identical",
1250 .oval = RW_SEQ_IDENT,
1251 .help = "Generate identical offsets",
1258 .lname = "IO Engine",
1259 .type = FIO_OPT_STR_STORE,
1260 .off1 = td_var_offset(ioengine),
1261 .help = "IO engine to use",
1262 .def = FIO_PREFERRED_ENGINE,
1263 .category = FIO_OPT_C_IO,
1264 .group = FIO_OPT_G_IO_BASIC,
1267 .help = "Use read/write",
1270 .help = "Use pread/pwrite",
1273 .help = "Use readv/writev",
1275 #ifdef CONFIG_LIBAIO
1277 .help = "Linux native asynchronous IO",
1280 #ifdef CONFIG_POSIXAIO
1281 { .ival = "posixaio",
1282 .help = "POSIX asynchronous IO",
1285 #ifdef CONFIG_SOLARISAIO
1286 { .ival = "solarisaio",
1287 .help = "Solaris native asynchronous IO",
1290 #ifdef CONFIG_WINDOWSAIO
1291 { .ival = "windowsaio",
1292 .help = "Windows native asynchronous IO"
1296 .help = "Memory mapped IO"
1298 #ifdef CONFIG_LINUX_SPLICE
1300 .help = "splice/vmsplice based IO",
1302 { .ival = "netsplice",
1303 .help = "splice/vmsplice to/from the network",
1306 #ifdef FIO_HAVE_SGIO
1308 .help = "SCSI generic v3 IO",
1312 .help = "Testing engine (no data transfer)",
1315 .help = "Network IO",
1318 .help = "CPU cycle burner engine",
1322 .help = "GUASI IO engine",
1325 #ifdef FIO_HAVE_BINJECT
1326 { .ival = "binject",
1327 .help = "binject direct inject block engine",
1332 .help = "RDMA IO engine",
1335 #ifdef CONFIG_FUSION_AW
1336 { .ival = "fusion-aw-sync",
1337 .help = "Fusion-io atomic write engine",
1340 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1341 { .ival = "e4defrag",
1342 .help = "ext4 defrag engine",
1345 #ifdef CONFIG_LINUX_FALLOCATE
1347 .help = "fallocate() file based engine",
1350 { .ival = "external",
1351 .help = "Load external engine (append name)",
1357 .lname = "IO Depth",
1358 .type = FIO_OPT_INT,
1359 .off1 = td_var_offset(iodepth),
1360 .help = "Number of IO buffers to keep in flight",
1364 .category = FIO_OPT_C_IO,
1365 .group = FIO_OPT_G_IO_BASIC,
1368 .name = "iodepth_batch",
1369 .lname = "IO Depth batch",
1370 .alias = "iodepth_batch_submit",
1371 .type = FIO_OPT_INT,
1372 .off1 = td_var_offset(iodepth_batch),
1373 .help = "Number of IO buffers to submit in one go",
1374 .parent = "iodepth",
1379 .category = FIO_OPT_C_IO,
1380 .group = FIO_OPT_G_IO_BASIC,
1383 .name = "iodepth_batch_complete",
1384 .lname = "IO Depth batch complete",
1385 .type = FIO_OPT_INT,
1386 .off1 = td_var_offset(iodepth_batch_complete),
1387 .help = "Number of IO buffers to retrieve in one go",
1388 .parent = "iodepth",
1393 .category = FIO_OPT_C_IO,
1394 .group = FIO_OPT_G_IO_BASIC,
1397 .name = "iodepth_low",
1398 .lname = "IO Depth batch low",
1399 .type = FIO_OPT_INT,
1400 .off1 = td_var_offset(iodepth_low),
1401 .help = "Low water mark for queuing depth",
1402 .parent = "iodepth",
1405 .category = FIO_OPT_C_IO,
1406 .group = FIO_OPT_G_IO_BASIC,
1411 .type = FIO_OPT_STR_VAL,
1413 .help = "Total size of device or files",
1414 .interval = 1024 * 1024,
1415 .category = FIO_OPT_C_IO,
1416 .group = FIO_OPT_G_INVALID,
1419 .name = "fill_device",
1420 .lname = "Fill device",
1422 .type = FIO_OPT_BOOL,
1423 .off1 = td_var_offset(fill_device),
1424 .help = "Write until an ENOSPC error occurs",
1426 .category = FIO_OPT_C_FILE,
1427 .group = FIO_OPT_G_INVALID,
1431 .lname = "File size",
1432 .type = FIO_OPT_STR_VAL,
1433 .off1 = td_var_offset(file_size_low),
1434 .off2 = td_var_offset(file_size_high),
1436 .help = "Size of individual files",
1437 .interval = 1024 * 1024,
1438 .category = FIO_OPT_C_FILE,
1439 .group = FIO_OPT_G_INVALID,
1443 .lname = "IO offset",
1444 .alias = "fileoffset",
1445 .type = FIO_OPT_STR_VAL,
1446 .off1 = td_var_offset(start_offset),
1447 .help = "Start IO from this offset",
1449 .interval = 1024 * 1024,
1450 .category = FIO_OPT_C_IO,
1451 .group = FIO_OPT_G_INVALID,
1454 .name = "offset_increment",
1455 .lname = "IO offset increment",
1456 .type = FIO_OPT_STR_VAL,
1457 .off1 = td_var_offset(offset_increment),
1458 .help = "What is the increment from one offset to the next",
1462 .interval = 1024 * 1024,
1463 .category = FIO_OPT_C_IO,
1464 .group = FIO_OPT_G_INVALID,
1468 .lname = "Block size",
1469 .alias = "blocksize",
1470 .type = FIO_OPT_INT,
1471 .off1 = td_var_offset(bs[DDIR_READ]),
1472 .off2 = td_var_offset(bs[DDIR_WRITE]),
1473 .off3 = td_var_offset(bs[DDIR_TRIM]),
1475 .help = "Block size unit",
1480 .category = FIO_OPT_C_IO,
1481 .group = FIO_OPT_G_INVALID,
1485 .lname = "Block size align",
1486 .alias = "blockalign",
1487 .type = FIO_OPT_INT,
1488 .off1 = td_var_offset(ba[DDIR_READ]),
1489 .off2 = td_var_offset(ba[DDIR_WRITE]),
1490 .off3 = td_var_offset(ba[DDIR_TRIM]),
1492 .help = "IO block offset alignment",
1496 .category = FIO_OPT_C_IO,
1497 .group = FIO_OPT_G_INVALID,
1501 .lname = "Block size range",
1502 .alias = "blocksize_range",
1503 .type = FIO_OPT_RANGE,
1504 .off1 = td_var_offset(min_bs[DDIR_READ]),
1505 .off2 = td_var_offset(max_bs[DDIR_READ]),
1506 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1507 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1508 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1509 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1511 .help = "Set block size range (in more detail than bs)",
1515 .category = FIO_OPT_C_IO,
1516 .group = FIO_OPT_G_INVALID,
1520 .lname = "Block size split",
1521 .type = FIO_OPT_STR,
1522 .cb = str_bssplit_cb,
1523 .help = "Set a specific mix of block sizes",
1526 .category = FIO_OPT_C_IO,
1527 .group = FIO_OPT_G_INVALID,
1530 .name = "bs_unaligned",
1531 .lname = "Block size unaligned",
1532 .alias = "blocksize_unaligned",
1533 .type = FIO_OPT_STR_SET,
1534 .off1 = td_var_offset(bs_unaligned),
1535 .help = "Don't sector align IO buffer sizes",
1538 .category = FIO_OPT_C_IO,
1539 .group = FIO_OPT_G_INVALID,
1542 .name = "randrepeat",
1543 .lname = "Random repeatable",
1544 .type = FIO_OPT_BOOL,
1545 .off1 = td_var_offset(rand_repeatable),
1546 .help = "Use repeatable random IO pattern",
1550 .category = FIO_OPT_C_IO,
1551 .group = FIO_OPT_G_RANDOM,
1554 .name = "use_os_rand",
1555 .lname = "Use OS random",
1556 .type = FIO_OPT_BOOL,
1557 .off1 = td_var_offset(use_os_rand),
1558 .help = "Set to use OS random generator",
1562 .category = FIO_OPT_C_IO,
1563 .group = FIO_OPT_G_RANDOM,
1566 .name = "norandommap",
1567 .lname = "No randommap",
1568 .type = FIO_OPT_STR_SET,
1569 .off1 = td_var_offset(norandommap),
1570 .help = "Accept potential duplicate random blocks",
1574 .category = FIO_OPT_C_IO,
1575 .group = FIO_OPT_G_RANDOM,
1578 .name = "softrandommap",
1579 .lname = "Soft randommap",
1580 .type = FIO_OPT_BOOL,
1581 .off1 = td_var_offset(softrandommap),
1582 .help = "Set norandommap if randommap allocation fails",
1583 .parent = "norandommap",
1586 .category = FIO_OPT_C_IO,
1587 .group = FIO_OPT_G_RANDOM,
1590 .name = "random_generator",
1591 .type = FIO_OPT_STR,
1592 .off1 = td_var_offset(random_generator),
1593 .help = "Type of random number generator to use",
1594 .def = "tausworthe",
1596 { .ival = "tausworthe",
1597 .oval = FIO_RAND_GEN_TAUSWORTHE,
1598 .help = "Strong Tausworthe generator",
1601 .oval = FIO_RAND_GEN_LFSR,
1602 .help = "Variable length LFSR",
1605 .category = FIO_OPT_C_IO,
1606 .group = FIO_OPT_G_RANDOM,
1609 .name = "random_distribution",
1610 .type = FIO_OPT_STR,
1611 .off1 = td_var_offset(random_distribution),
1612 .cb = str_random_distribution_cb,
1613 .help = "Random offset distribution generator",
1617 .oval = FIO_RAND_DIST_RANDOM,
1618 .help = "Completely random",
1621 .oval = FIO_RAND_DIST_ZIPF,
1622 .help = "Zipf distribution",
1625 .oval = FIO_RAND_DIST_PARETO,
1626 .help = "Pareto distribution",
1629 .category = FIO_OPT_C_IO,
1630 .group = FIO_OPT_G_RANDOM,
1634 .lname = "Number of files",
1635 .alias = "nr_files",
1636 .type = FIO_OPT_INT,
1637 .off1 = td_var_offset(nr_files),
1638 .help = "Split job workload between this number of files",
1641 .category = FIO_OPT_C_FILE,
1642 .group = FIO_OPT_G_INVALID,
1645 .name = "openfiles",
1646 .lname = "Number of open files",
1647 .type = FIO_OPT_INT,
1648 .off1 = td_var_offset(open_files),
1649 .help = "Number of files to keep open at the same time",
1650 .category = FIO_OPT_C_FILE,
1651 .group = FIO_OPT_G_INVALID,
1654 .name = "file_service_type",
1655 .lname = "File service type",
1656 .type = FIO_OPT_STR,
1658 .off1 = td_var_offset(file_service_type),
1659 .help = "How to select which file to service next",
1660 .def = "roundrobin",
1661 .category = FIO_OPT_C_FILE,
1662 .group = FIO_OPT_G_INVALID,
1665 .oval = FIO_FSERVICE_RANDOM,
1666 .help = "Choose a file at random",
1668 { .ival = "roundrobin",
1669 .oval = FIO_FSERVICE_RR,
1670 .help = "Round robin select files",
1672 { .ival = "sequential",
1673 .oval = FIO_FSERVICE_SEQ,
1674 .help = "Finish one file before moving to the next",
1677 .parent = "nrfiles",
1680 #ifdef CONFIG_POSIX_FALLOCATE
1682 .name = "fallocate",
1683 .lname = "Fallocate",
1684 .type = FIO_OPT_STR,
1685 .off1 = td_var_offset(fallocate_mode),
1686 .help = "Whether pre-allocation is performed when laying out files",
1688 .category = FIO_OPT_C_FILE,
1689 .group = FIO_OPT_G_INVALID,
1692 .oval = FIO_FALLOCATE_NONE,
1693 .help = "Do not pre-allocate space",
1696 .oval = FIO_FALLOCATE_POSIX,
1697 .help = "Use posix_fallocate()",
1699 #ifdef CONFIG_LINUX_FALLOCATE
1701 .oval = FIO_FALLOCATE_KEEP_SIZE,
1702 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1705 /* Compatibility with former boolean values */
1707 .oval = FIO_FALLOCATE_NONE,
1708 .help = "Alias for 'none'",
1711 .oval = FIO_FALLOCATE_POSIX,
1712 .help = "Alias for 'posix'",
1716 #endif /* CONFIG_POSIX_FALLOCATE */
1718 .name = "fadvise_hint",
1719 .lname = "Fadvise hint",
1720 .type = FIO_OPT_BOOL,
1721 .off1 = td_var_offset(fadvise_hint),
1722 .help = "Use fadvise() to advise the kernel on IO pattern",
1724 .category = FIO_OPT_C_FILE,
1725 .group = FIO_OPT_G_INVALID,
1730 .type = FIO_OPT_INT,
1731 .off1 = td_var_offset(fsync_blocks),
1732 .help = "Issue fsync for writes every given number of blocks",
1735 .category = FIO_OPT_C_FILE,
1736 .group = FIO_OPT_G_INVALID,
1739 .name = "fdatasync",
1740 .lname = "Fdatasync",
1741 .type = FIO_OPT_INT,
1742 .off1 = td_var_offset(fdatasync_blocks),
1743 .help = "Issue fdatasync for writes every given number of blocks",
1746 .category = FIO_OPT_C_FILE,
1747 .group = FIO_OPT_G_INVALID,
1750 .name = "write_barrier",
1751 .lname = "Write barrier",
1752 .type = FIO_OPT_INT,
1753 .off1 = td_var_offset(barrier_blocks),
1754 .help = "Make every Nth write a barrier write",
1757 .category = FIO_OPT_C_IO,
1758 .group = FIO_OPT_G_INVALID,
1760 #ifdef CONFIG_SYNC_FILE_RANGE
1762 .name = "sync_file_range",
1763 .lname = "Sync file range",
1765 { .ival = "wait_before",
1766 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1767 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
1771 .oval = SYNC_FILE_RANGE_WRITE,
1772 .help = "SYNC_FILE_RANGE_WRITE",
1776 .ival = "wait_after",
1777 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1778 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
1782 .type = FIO_OPT_STR_MULTI,
1784 .off1 = td_var_offset(sync_file_range),
1785 .help = "Use sync_file_range()",
1786 .category = FIO_OPT_C_FILE,
1787 .group = FIO_OPT_G_INVALID,
1792 .lname = "Direct I/O",
1793 .type = FIO_OPT_BOOL,
1794 .off1 = td_var_offset(odirect),
1795 .help = "Use O_DIRECT IO (negates buffered)",
1797 .inverse = "buffered",
1798 .category = FIO_OPT_C_IO,
1799 .group = FIO_OPT_G_IO_TYPE,
1803 .lname = "Buffered I/O",
1804 .type = FIO_OPT_BOOL,
1805 .off1 = td_var_offset(odirect),
1807 .help = "Use buffered IO (negates direct)",
1809 .inverse = "direct",
1810 .category = FIO_OPT_C_IO,
1811 .group = FIO_OPT_G_IO_TYPE,
1814 .name = "overwrite",
1815 .lname = "Overwrite",
1816 .type = FIO_OPT_BOOL,
1817 .off1 = td_var_offset(overwrite),
1818 .help = "When writing, set whether to overwrite current data",
1820 .category = FIO_OPT_C_FILE,
1821 .group = FIO_OPT_G_INVALID,
1826 .type = FIO_OPT_INT,
1827 .off1 = td_var_offset(loops),
1828 .help = "Number of times to run the job",
1831 .category = FIO_OPT_C_GENERAL,
1832 .group = FIO_OPT_G_RUNTIME,
1836 .lname = "Number of jobs",
1837 .type = FIO_OPT_INT,
1838 .off1 = td_var_offset(numjobs),
1839 .help = "Duplicate this job this many times",
1842 .category = FIO_OPT_C_GENERAL,
1843 .group = FIO_OPT_G_RUNTIME,
1846 .name = "startdelay",
1847 .lname = "Start delay",
1848 .type = FIO_OPT_STR_VAL_TIME,
1849 .off1 = td_var_offset(start_delay),
1850 .help = "Only start job when this period has passed",
1852 .category = FIO_OPT_C_GENERAL,
1853 .group = FIO_OPT_G_RUNTIME,
1859 .type = FIO_OPT_STR_VAL_TIME,
1860 .off1 = td_var_offset(timeout),
1861 .help = "Stop workload when this amount of time has passed",
1863 .category = FIO_OPT_C_GENERAL,
1864 .group = FIO_OPT_G_RUNTIME,
1867 .name = "time_based",
1868 .lname = "Time based",
1869 .type = FIO_OPT_STR_SET,
1870 .off1 = td_var_offset(time_based),
1871 .help = "Keep running until runtime/timeout is met",
1872 .category = FIO_OPT_C_GENERAL,
1873 .group = FIO_OPT_G_RUNTIME,
1876 .name = "ramp_time",
1877 .lname = "Ramp time",
1878 .type = FIO_OPT_STR_VAL_TIME,
1879 .off1 = td_var_offset(ramp_time),
1880 .help = "Ramp up time before measuring performance",
1881 .category = FIO_OPT_C_GENERAL,
1882 .group = FIO_OPT_G_RUNTIME,
1885 .name = "clocksource",
1886 .lname = "Clock source",
1887 .type = FIO_OPT_STR,
1888 .cb = fio_clock_source_cb,
1889 .off1 = td_var_offset(clocksource),
1890 .help = "What type of timing source to use",
1891 .category = FIO_OPT_C_GENERAL,
1892 .group = FIO_OPT_G_CLOCK,
1894 #ifdef CONFIG_GETTIMEOFDAY
1895 { .ival = "gettimeofday",
1897 .help = "Use gettimeofday(2) for timing",
1900 #ifdef CONFIG_CLOCK_GETTIME
1901 { .ival = "clock_gettime",
1902 .oval = CS_CGETTIME,
1903 .help = "Use clock_gettime(2) for timing",
1906 #ifdef ARCH_HAVE_CPU_CLOCK
1908 .oval = CS_CPUCLOCK,
1909 .help = "Use CPU private clock",
1917 .lname = "I/O Memory",
1918 .type = FIO_OPT_STR,
1920 .off1 = td_var_offset(mem_type),
1921 .help = "Backing type for IO buffers",
1923 .category = FIO_OPT_C_IO,
1924 .group = FIO_OPT_G_INVALID,
1928 .help = "Use malloc(3) for IO buffers",
1932 .help = "Use shared memory segments for IO buffers",
1934 #ifdef FIO_HAVE_HUGETLB
1935 { .ival = "shmhuge",
1936 .oval = MEM_SHMHUGE,
1937 .help = "Like shm, but use huge pages",
1942 .help = "Use mmap(2) (file or anon) for IO buffers",
1944 #ifdef FIO_HAVE_HUGETLB
1945 { .ival = "mmaphuge",
1946 .oval = MEM_MMAPHUGE,
1947 .help = "Like mmap, but use huge pages",
1953 .name = "iomem_align",
1954 .alias = "mem_align",
1955 .lname = "I/O memory alignment",
1956 .type = FIO_OPT_INT,
1957 .off1 = td_var_offset(mem_align),
1959 .help = "IO memory buffer offset alignment",
1963 .category = FIO_OPT_C_IO,
1964 .group = FIO_OPT_G_INVALID,
1969 .type = FIO_OPT_STR,
1970 .off1 = td_var_offset(verify),
1971 .help = "Verify data written",
1973 .category = FIO_OPT_C_IO,
1974 .group = FIO_OPT_G_VERIFY,
1977 .oval = VERIFY_NONE,
1978 .help = "Don't do IO verification",
1982 .help = "Use md5 checksums for verification",
1985 .oval = VERIFY_CRC64,
1986 .help = "Use crc64 checksums for verification",
1989 .oval = VERIFY_CRC32,
1990 .help = "Use crc32 checksums for verification",
1992 { .ival = "crc32c-intel",
1993 .oval = VERIFY_CRC32C,
1994 .help = "Use crc32c checksums for verification (hw assisted, if available)",
1997 .oval = VERIFY_CRC32C,
1998 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2001 .oval = VERIFY_CRC16,
2002 .help = "Use crc16 checksums for verification",
2005 .oval = VERIFY_CRC7,
2006 .help = "Use crc7 checksums for verification",
2009 .oval = VERIFY_SHA1,
2010 .help = "Use sha1 checksums for verification",
2013 .oval = VERIFY_SHA256,
2014 .help = "Use sha256 checksums for verification",
2017 .oval = VERIFY_SHA512,
2018 .help = "Use sha512 checksums for verification",
2021 .oval = VERIFY_META,
2022 .help = "Use io information",
2026 .oval = VERIFY_NULL,
2027 .help = "Pretend to verify",
2032 .name = "do_verify",
2033 .lname = "Perform verify step",
2034 .type = FIO_OPT_BOOL,
2035 .off1 = td_var_offset(do_verify),
2036 .help = "Run verification stage after write",
2040 .category = FIO_OPT_C_IO,
2041 .group = FIO_OPT_G_VERIFY,
2044 .name = "verifysort",
2045 .lname = "Verify sort",
2046 .type = FIO_OPT_BOOL,
2047 .off1 = td_var_offset(verifysort),
2048 .help = "Sort written verify blocks for read back",
2052 .category = FIO_OPT_C_IO,
2053 .group = FIO_OPT_G_VERIFY,
2056 .name = "verifysort_nr",
2057 .type = FIO_OPT_INT,
2058 .off1 = td_var_offset(verifysort_nr),
2059 .help = "Pre-load and sort verify blocks for a read workload",
2064 .category = FIO_OPT_C_IO,
2065 .group = FIO_OPT_G_VERIFY,
2068 .name = "verify_interval",
2069 .lname = "Verify interval",
2070 .type = FIO_OPT_INT,
2071 .off1 = td_var_offset(verify_interval),
2072 .minval = 2 * sizeof(struct verify_header),
2073 .help = "Store verify buffer header every N bytes",
2076 .interval = 2 * sizeof(struct verify_header),
2077 .category = FIO_OPT_C_IO,
2078 .group = FIO_OPT_G_VERIFY,
2081 .name = "verify_offset",
2082 .lname = "Verify offset",
2083 .type = FIO_OPT_INT,
2084 .help = "Offset verify header location by N bytes",
2085 .off1 = td_var_offset(verify_offset),
2086 .minval = sizeof(struct verify_header),
2089 .category = FIO_OPT_C_IO,
2090 .group = FIO_OPT_G_VERIFY,
2093 .name = "verify_pattern",
2094 .lname = "Verify pattern",
2095 .type = FIO_OPT_STR,
2096 .cb = str_verify_pattern_cb,
2097 .help = "Fill pattern for IO buffers",
2100 .category = FIO_OPT_C_IO,
2101 .group = FIO_OPT_G_VERIFY,
2104 .name = "verify_fatal",
2105 .lname = "Verify fatal",
2106 .type = FIO_OPT_BOOL,
2107 .off1 = td_var_offset(verify_fatal),
2109 .help = "Exit on a single verify failure, don't continue",
2112 .category = FIO_OPT_C_IO,
2113 .group = FIO_OPT_G_VERIFY,
2116 .name = "verify_dump",
2117 .lname = "Verify dump",
2118 .type = FIO_OPT_BOOL,
2119 .off1 = td_var_offset(verify_dump),
2121 .help = "Dump contents of good and bad blocks on failure",
2124 .category = FIO_OPT_C_IO,
2125 .group = FIO_OPT_G_VERIFY,
2128 .name = "verify_async",
2129 .lname = "Verify asynchronously",
2130 .type = FIO_OPT_INT,
2131 .off1 = td_var_offset(verify_async),
2133 .help = "Number of async verifier threads to use",
2136 .category = FIO_OPT_C_IO,
2137 .group = FIO_OPT_G_VERIFY,
2140 .name = "verify_backlog",
2141 .lname = "Verify backlog",
2142 .type = FIO_OPT_STR_VAL,
2143 .off1 = td_var_offset(verify_backlog),
2144 .help = "Verify after this number of blocks are written",
2147 .category = FIO_OPT_C_IO,
2148 .group = FIO_OPT_G_VERIFY,
2151 .name = "verify_backlog_batch",
2152 .lname = "Verify backlog batch",
2153 .type = FIO_OPT_INT,
2154 .off1 = td_var_offset(verify_batch),
2155 .help = "Verify this number of IO blocks",
2158 .category = FIO_OPT_C_IO,
2159 .group = FIO_OPT_G_VERIFY,
2161 #ifdef FIO_HAVE_CPU_AFFINITY
2163 .name = "verify_async_cpus",
2164 .lname = "Async verify CPUs",
2165 .type = FIO_OPT_STR,
2166 .cb = str_verify_cpus_allowed_cb,
2167 .help = "Set CPUs allowed for async verify threads",
2168 .parent = "verify_async",
2170 .category = FIO_OPT_C_IO,
2171 .group = FIO_OPT_G_VERIFY,
2175 .name = "experimental_verify",
2176 .off1 = td_var_offset(experimental_verify),
2177 .type = FIO_OPT_BOOL,
2178 .help = "Enable experimental verification",
2179 .category = FIO_OPT_C_IO,
2180 .group = FIO_OPT_G_VERIFY,
2182 #ifdef FIO_HAVE_TRIM
2184 .name = "trim_percentage",
2185 .lname = "Trim percentage",
2186 .type = FIO_OPT_INT,
2187 .off1 = td_var_offset(trim_percentage),
2190 .help = "Number of verify blocks to discard/trim",
2195 .category = FIO_OPT_C_IO,
2196 .group = FIO_OPT_G_TRIM,
2199 .name = "trim_verify_zero",
2200 .lname = "Verify trim zero",
2201 .type = FIO_OPT_BOOL,
2202 .help = "Verify that trim/discarded blocks are returned as zeroes",
2203 .off1 = td_var_offset(trim_zero),
2204 .parent = "trim_percentage",
2207 .category = FIO_OPT_C_IO,
2208 .group = FIO_OPT_G_TRIM,
2211 .name = "trim_backlog",
2212 .lname = "Trim backlog",
2213 .type = FIO_OPT_STR_VAL,
2214 .off1 = td_var_offset(trim_backlog),
2215 .help = "Trim after this number of blocks are written",
2216 .parent = "trim_percentage",
2219 .category = FIO_OPT_C_IO,
2220 .group = FIO_OPT_G_TRIM,
2223 .name = "trim_backlog_batch",
2224 .lname = "Trim backlog batch",
2225 .type = FIO_OPT_INT,
2226 .off1 = td_var_offset(trim_batch),
2227 .help = "Trim this number of IO blocks",
2228 .parent = "trim_percentage",
2231 .category = FIO_OPT_C_IO,
2232 .group = FIO_OPT_G_TRIM,
2236 .name = "write_iolog",
2237 .lname = "Write I/O log",
2238 .type = FIO_OPT_STR_STORE,
2239 .off1 = td_var_offset(write_iolog_file),
2240 .help = "Store IO pattern to file",
2241 .category = FIO_OPT_C_IO,
2242 .group = FIO_OPT_G_IOLOG,
2245 .name = "read_iolog",
2246 .lname = "Read I/O log",
2247 .type = FIO_OPT_STR_STORE,
2248 .off1 = td_var_offset(read_iolog_file),
2249 .help = "Playback IO pattern from file",
2250 .category = FIO_OPT_C_IO,
2251 .group = FIO_OPT_G_IOLOG,
2254 .name = "replay_no_stall",
2255 .lname = "Don't stall on replay",
2256 .type = FIO_OPT_BOOL,
2257 .off1 = td_var_offset(no_stall),
2259 .parent = "read_iolog",
2261 .help = "Playback IO pattern file as fast as possible without stalls",
2262 .category = FIO_OPT_C_IO,
2263 .group = FIO_OPT_G_IOLOG,
2266 .name = "replay_redirect",
2267 .lname = "Redirect device for replay",
2268 .type = FIO_OPT_STR_STORE,
2269 .off1 = td_var_offset(replay_redirect),
2270 .parent = "read_iolog",
2272 .help = "Replay all I/O onto this device, regardless of trace device",
2273 .category = FIO_OPT_C_IO,
2274 .group = FIO_OPT_G_IOLOG,
2277 .name = "exec_prerun",
2278 .lname = "Pre-execute runnable",
2279 .type = FIO_OPT_STR_STORE,
2280 .off1 = td_var_offset(exec_prerun),
2281 .help = "Execute this file prior to running job",
2282 .category = FIO_OPT_C_GENERAL,
2283 .group = FIO_OPT_G_INVALID,
2286 .name = "exec_postrun",
2287 .lname = "Post-execute runnable",
2288 .type = FIO_OPT_STR_STORE,
2289 .off1 = td_var_offset(exec_postrun),
2290 .help = "Execute this file after running job",
2291 .category = FIO_OPT_C_GENERAL,
2292 .group = FIO_OPT_G_INVALID,
2294 #ifdef FIO_HAVE_IOSCHED_SWITCH
2296 .name = "ioscheduler",
2297 .lname = "I/O scheduler",
2298 .type = FIO_OPT_STR_STORE,
2299 .off1 = td_var_offset(ioscheduler),
2300 .help = "Use this IO scheduler on the backing device",
2301 .category = FIO_OPT_C_FILE,
2302 .group = FIO_OPT_G_INVALID,
2307 .lname = "Zone size",
2308 .type = FIO_OPT_STR_VAL,
2309 .off1 = td_var_offset(zone_size),
2310 .help = "Amount of data to read per zone",
2312 .interval = 1024 * 1024,
2313 .category = FIO_OPT_C_IO,
2314 .group = FIO_OPT_G_ZONE,
2317 .name = "zonerange",
2318 .lname = "Zone range",
2319 .type = FIO_OPT_STR_VAL,
2320 .off1 = td_var_offset(zone_range),
2321 .help = "Give size of an IO zone",
2323 .interval = 1024 * 1024,
2324 .category = FIO_OPT_C_IO,
2325 .group = FIO_OPT_G_ZONE,
2329 .lname = "Zone skip",
2330 .type = FIO_OPT_STR_VAL,
2331 .off1 = td_var_offset(zone_skip),
2332 .help = "Space between IO zones",
2334 .interval = 1024 * 1024,
2335 .category = FIO_OPT_C_IO,
2336 .group = FIO_OPT_G_ZONE,
2340 .lname = "Lock memory",
2341 .type = FIO_OPT_STR_VAL,
2342 .off1 = td_var_offset(lockmem),
2343 .help = "Lock down this amount of memory (per worker)",
2345 .interval = 1024 * 1024,
2346 .category = FIO_OPT_C_GENERAL,
2347 .group = FIO_OPT_G_INVALID,
2350 .name = "rwmixread",
2351 .lname = "Read/write mix read",
2352 .type = FIO_OPT_INT,
2353 .cb = str_rwmix_read_cb,
2355 .help = "Percentage of mixed workload that is reads",
2358 .inverse = "rwmixwrite",
2359 .category = FIO_OPT_C_IO,
2360 .group = FIO_OPT_G_RWMIX,
2363 .name = "rwmixwrite",
2364 .lname = "Read/write mix write",
2365 .type = FIO_OPT_INT,
2366 .cb = str_rwmix_write_cb,
2368 .help = "Percentage of mixed workload that is writes",
2371 .inverse = "rwmixread",
2372 .category = FIO_OPT_C_IO,
2373 .group = FIO_OPT_G_RWMIX,
2376 .name = "rwmixcycle",
2377 .lname = "Read/write mix cycle",
2378 .type = FIO_OPT_DEPRECATED,
2379 .category = FIO_OPT_C_IO,
2380 .group = FIO_OPT_G_RWMIX,
2385 .type = FIO_OPT_INT,
2386 .off1 = td_var_offset(nice),
2387 .help = "Set job CPU nice value",
2392 .category = FIO_OPT_C_GENERAL,
2393 .group = FIO_OPT_G_CRED,
2395 #ifdef FIO_HAVE_IOPRIO
2398 .lname = "I/O nice priority",
2399 .type = FIO_OPT_INT,
2400 .off1 = td_var_offset(ioprio),
2401 .help = "Set job IO priority value",
2405 .category = FIO_OPT_C_GENERAL,
2406 .group = FIO_OPT_G_CRED,
2409 .name = "prioclass",
2410 .lname = "I/O nice priority class",
2411 .type = FIO_OPT_INT,
2412 .off1 = td_var_offset(ioprio_class),
2413 .help = "Set job IO priority class",
2417 .category = FIO_OPT_C_GENERAL,
2418 .group = FIO_OPT_G_CRED,
2422 .name = "thinktime",
2423 .lname = "Thinktime",
2424 .type = FIO_OPT_INT,
2425 .off1 = td_var_offset(thinktime),
2426 .help = "Idle time between IO buffers (usec)",
2428 .category = FIO_OPT_C_IO,
2429 .group = FIO_OPT_G_THINKTIME,
2432 .name = "thinktime_spin",
2433 .lname = "Thinktime spin",
2434 .type = FIO_OPT_INT,
2435 .off1 = td_var_offset(thinktime_spin),
2436 .help = "Start think time by spinning this amount (usec)",
2438 .parent = "thinktime",
2440 .category = FIO_OPT_C_IO,
2441 .group = FIO_OPT_G_THINKTIME,
2444 .name = "thinktime_blocks",
2445 .lname = "Thinktime blocks",
2446 .type = FIO_OPT_INT,
2447 .off1 = td_var_offset(thinktime_blocks),
2448 .help = "IO buffer period between 'thinktime'",
2450 .parent = "thinktime",
2452 .category = FIO_OPT_C_IO,
2453 .group = FIO_OPT_G_THINKTIME,
2457 .lname = "I/O rate",
2458 .type = FIO_OPT_INT,
2459 .off1 = td_var_offset(rate[DDIR_READ]),
2460 .off2 = td_var_offset(rate[DDIR_WRITE]),
2461 .off3 = td_var_offset(rate[DDIR_TRIM]),
2462 .help = "Set bandwidth rate",
2463 .category = FIO_OPT_C_IO,
2464 .group = FIO_OPT_G_RATE,
2468 .lname = "I/O min rate",
2469 .type = FIO_OPT_INT,
2470 .off1 = td_var_offset(ratemin[DDIR_READ]),
2471 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2472 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2473 .help = "Job must meet this rate or it will be shutdown",
2476 .category = FIO_OPT_C_IO,
2477 .group = FIO_OPT_G_RATE,
2480 .name = "rate_iops",
2481 .lname = "I/O rate IOPS",
2482 .type = FIO_OPT_INT,
2483 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2484 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2485 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2486 .help = "Limit IO used to this number of IO operations/sec",
2488 .category = FIO_OPT_C_IO,
2489 .group = FIO_OPT_G_RATE,
2492 .name = "rate_iops_min",
2493 .lname = "I/O min rate IOPS",
2494 .type = FIO_OPT_INT,
2495 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2496 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2497 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2498 .help = "Job must meet this rate or it will be shut down",
2499 .parent = "rate_iops",
2501 .category = FIO_OPT_C_IO,
2502 .group = FIO_OPT_G_RATE,
2505 .name = "ratecycle",
2506 .lname = "I/O rate cycle",
2507 .type = FIO_OPT_INT,
2508 .off1 = td_var_offset(ratecycle),
2509 .help = "Window average for rate limits (msec)",
2513 .category = FIO_OPT_C_IO,
2514 .group = FIO_OPT_G_RATE,
2517 .name = "max_latency",
2518 .type = FIO_OPT_INT,
2519 .off1 = td_var_offset(max_latency),
2520 .help = "Maximum tolerated IO latency (usec)",
2521 .category = FIO_OPT_C_IO,
2522 .group = FIO_OPT_G_RATE,
2525 .name = "invalidate",
2526 .lname = "Cache invalidate",
2527 .type = FIO_OPT_BOOL,
2528 .off1 = td_var_offset(invalidate_cache),
2529 .help = "Invalidate buffer/page cache prior to running job",
2531 .category = FIO_OPT_C_IO,
2532 .group = FIO_OPT_G_IO_TYPE,
2536 .lname = "Synchronous I/O",
2537 .type = FIO_OPT_BOOL,
2538 .off1 = td_var_offset(sync_io),
2539 .help = "Use O_SYNC for buffered writes",
2541 .parent = "buffered",
2543 .category = FIO_OPT_C_IO,
2544 .group = FIO_OPT_G_IO_TYPE,
2547 .name = "create_serialize",
2548 .lname = "Create serialize",
2549 .type = FIO_OPT_BOOL,
2550 .off1 = td_var_offset(create_serialize),
2551 .help = "Serialize creating of job files",
2553 .category = FIO_OPT_C_FILE,
2554 .group = FIO_OPT_G_INVALID,
2557 .name = "create_fsync",
2558 .lname = "Create fsync",
2559 .type = FIO_OPT_BOOL,
2560 .off1 = td_var_offset(create_fsync),
2561 .help = "fsync file after creation",
2563 .category = FIO_OPT_C_FILE,
2564 .group = FIO_OPT_G_INVALID,
2567 .name = "create_on_open",
2568 .lname = "Create on open",
2569 .type = FIO_OPT_BOOL,
2570 .off1 = td_var_offset(create_on_open),
2571 .help = "Create files when they are opened for IO",
2573 .category = FIO_OPT_C_FILE,
2574 .group = FIO_OPT_G_INVALID,
2577 .name = "create_only",
2578 .type = FIO_OPT_BOOL,
2579 .off1 = td_var_offset(create_only),
2580 .help = "Only perform file creation phase",
2581 .category = FIO_OPT_C_FILE,
2586 .lname = "Pre-read files",
2587 .type = FIO_OPT_BOOL,
2588 .off1 = td_var_offset(pre_read),
2589 .help = "Pre-read files before starting official testing",
2591 .category = FIO_OPT_C_FILE,
2592 .group = FIO_OPT_G_INVALID,
2594 #ifdef FIO_HAVE_CPU_AFFINITY
2597 .lname = "CPU mask",
2598 .type = FIO_OPT_INT,
2599 .cb = str_cpumask_cb,
2600 .help = "CPU affinity mask",
2601 .category = FIO_OPT_C_GENERAL,
2602 .group = FIO_OPT_G_CRED,
2605 .name = "cpus_allowed",
2606 .lname = "CPUs allowed",
2607 .type = FIO_OPT_STR,
2608 .cb = str_cpus_allowed_cb,
2609 .help = "Set CPUs allowed",
2610 .category = FIO_OPT_C_GENERAL,
2611 .group = FIO_OPT_G_CRED,
2614 #ifdef CONFIG_LIBNUMA
2616 .name = "numa_cpu_nodes",
2617 .type = FIO_OPT_STR,
2618 .cb = str_numa_cpunodes_cb,
2619 .help = "NUMA CPU nodes bind",
2620 .category = FIO_OPT_C_GENERAL,
2621 .group = FIO_OPT_G_INVALID,
2624 .name = "numa_mem_policy",
2625 .type = FIO_OPT_STR,
2626 .cb = str_numa_mpol_cb,
2627 .help = "NUMA memory policy setup",
2628 .category = FIO_OPT_C_GENERAL,
2629 .group = FIO_OPT_G_INVALID,
2633 .name = "end_fsync",
2634 .lname = "End fsync",
2635 .type = FIO_OPT_BOOL,
2636 .off1 = td_var_offset(end_fsync),
2637 .help = "Include fsync at the end of job",
2639 .category = FIO_OPT_C_FILE,
2640 .group = FIO_OPT_G_INVALID,
2643 .name = "fsync_on_close",
2644 .lname = "Fsync on close",
2645 .type = FIO_OPT_BOOL,
2646 .off1 = td_var_offset(fsync_on_close),
2647 .help = "fsync files on close",
2649 .category = FIO_OPT_C_FILE,
2650 .group = FIO_OPT_G_INVALID,
2654 .lname = "Unlink file",
2655 .type = FIO_OPT_BOOL,
2656 .off1 = td_var_offset(unlink),
2657 .help = "Unlink created files after job has completed",
2659 .category = FIO_OPT_C_FILE,
2660 .group = FIO_OPT_G_INVALID,
2664 .lname = "Exit-all on terminate",
2665 .type = FIO_OPT_STR_SET,
2666 .cb = str_exitall_cb,
2667 .help = "Terminate all jobs when one exits",
2668 .category = FIO_OPT_C_GENERAL,
2669 .group = FIO_OPT_G_PROCESS,
2672 .name = "stonewall",
2673 .lname = "Wait for previous",
2674 .alias = "wait_for_previous",
2675 .type = FIO_OPT_STR_SET,
2676 .off1 = td_var_offset(stonewall),
2677 .help = "Insert a hard barrier between this job and previous",
2678 .category = FIO_OPT_C_GENERAL,
2679 .group = FIO_OPT_G_PROCESS,
2682 .name = "new_group",
2683 .lname = "New group",
2684 .type = FIO_OPT_STR_SET,
2685 .off1 = td_var_offset(new_group),
2686 .help = "Mark the start of a new group (for reporting)",
2687 .category = FIO_OPT_C_GENERAL,
2688 .group = FIO_OPT_G_PROCESS,
2693 .type = FIO_OPT_STR_SET,
2694 .off1 = td_var_offset(use_thread),
2695 .help = "Use threads instead of processes",
2696 .category = FIO_OPT_C_GENERAL,
2697 .group = FIO_OPT_G_PROCESS,
2700 .name = "write_bw_log",
2701 .lname = "Write bandwidth log",
2702 .type = FIO_OPT_STR_STORE,
2703 .off1 = td_var_offset(bw_log_file),
2704 .help = "Write log of bandwidth during run",
2705 .category = FIO_OPT_C_LOG,
2706 .group = FIO_OPT_G_INVALID,
2709 .name = "write_lat_log",
2710 .lname = "Write latency log",
2711 .type = FIO_OPT_STR_STORE,
2712 .off1 = td_var_offset(lat_log_file),
2713 .help = "Write log of latency during run",
2714 .category = FIO_OPT_C_LOG,
2715 .group = FIO_OPT_G_INVALID,
2718 .name = "write_iops_log",
2719 .lname = "Write IOPS log",
2720 .type = FIO_OPT_STR,
2721 .off1 = td_var_offset(iops_log_file),
2722 .help = "Write log of IOPS during run",
2723 .category = FIO_OPT_C_LOG,
2724 .group = FIO_OPT_G_INVALID,
2727 .name = "log_avg_msec",
2728 .lname = "Log averaging (msec)",
2729 .type = FIO_OPT_INT,
2730 .off1 = td_var_offset(log_avg_msec),
2731 .help = "Average bw/iops/lat logs over this period of time",
2733 .category = FIO_OPT_C_LOG,
2734 .group = FIO_OPT_G_INVALID,
2737 .name = "bwavgtime",
2738 .lname = "Bandwidth average time",
2739 .type = FIO_OPT_INT,
2740 .off1 = td_var_offset(bw_avg_time),
2741 .help = "Time window over which to calculate bandwidth"
2744 .parent = "write_bw_log",
2747 .category = FIO_OPT_C_LOG,
2748 .group = FIO_OPT_G_INVALID,
2751 .name = "iopsavgtime",
2752 .lname = "IOPS average time",
2753 .type = FIO_OPT_INT,
2754 .off1 = td_var_offset(iops_avg_time),
2755 .help = "Time window over which to calculate IOPS (msec)",
2757 .parent = "write_iops_log",
2760 .category = FIO_OPT_C_LOG,
2761 .group = FIO_OPT_G_INVALID,
2764 .name = "group_reporting",
2765 .lname = "Group reporting",
2766 .type = FIO_OPT_BOOL,
2767 .off1 = td_var_offset(group_reporting),
2768 .help = "Do reporting on a per-group basis",
2770 .category = FIO_OPT_C_STAT,
2771 .group = FIO_OPT_G_INVALID,
2774 .name = "zero_buffers",
2775 .lname = "Zero I/O buffers",
2776 .type = FIO_OPT_STR_SET,
2777 .off1 = td_var_offset(zero_buffers),
2778 .help = "Init IO buffers to all zeroes",
2779 .category = FIO_OPT_C_IO,
2780 .group = FIO_OPT_G_IO_BUF,
2783 .name = "refill_buffers",
2784 .lname = "Refill I/O buffers",
2785 .type = FIO_OPT_STR_SET,
2786 .off1 = td_var_offset(refill_buffers),
2787 .help = "Refill IO buffers on every IO submit",
2788 .category = FIO_OPT_C_IO,
2789 .group = FIO_OPT_G_IO_BUF,
2792 .name = "scramble_buffers",
2793 .lname = "Scramble I/O buffers",
2794 .type = FIO_OPT_BOOL,
2795 .off1 = td_var_offset(scramble_buffers),
2796 .help = "Slightly scramble buffers on every IO submit",
2798 .category = FIO_OPT_C_IO,
2799 .group = FIO_OPT_G_IO_BUF,
2802 .name = "buffer_compress_percentage",
2803 .lname = "Buffer compression percentage",
2804 .type = FIO_OPT_INT,
2805 .off1 = td_var_offset(compress_percentage),
2808 .help = "How compressible the buffer is (approximately)",
2810 .category = FIO_OPT_C_IO,
2811 .group = FIO_OPT_G_IO_BUF,
2814 .name = "buffer_compress_chunk",
2815 .lname = "Buffer compression chunk size",
2816 .type = FIO_OPT_INT,
2817 .off1 = td_var_offset(compress_chunk),
2818 .parent = "buffer_compress_percentage",
2820 .help = "Size of compressible region in buffer",
2822 .category = FIO_OPT_C_IO,
2823 .group = FIO_OPT_G_IO_BUF,
2826 .name = "clat_percentiles",
2827 .lname = "Completion latency percentiles",
2828 .type = FIO_OPT_BOOL,
2829 .off1 = td_var_offset(clat_percentiles),
2830 .help = "Enable the reporting of completion latency percentiles",
2832 .category = FIO_OPT_C_STAT,
2833 .group = FIO_OPT_G_INVALID,
2836 .name = "percentile_list",
2837 .lname = "Completion latency percentile list",
2838 .type = FIO_OPT_FLOAT_LIST,
2839 .off1 = td_var_offset(percentile_list),
2840 .off2 = td_var_offset(percentile_precision),
2841 .help = "Specify a custom list of percentiles to report",
2842 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
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 = "unified_rw_reporting",
2933 .type = FIO_OPT_BOOL,
2934 .off1 = td_var_offset(unified_rw_rep),
2935 .help = "Unify reporting across data direction",
2937 .category = FIO_OPT_C_GENERAL,
2938 .group = FIO_OPT_G_INVALID,
2941 .name = "continue_on_error",
2942 .lname = "Continue on error",
2943 .type = FIO_OPT_STR,
2944 .off1 = td_var_offset(continue_on_error),
2945 .help = "Continue on non-fatal errors during IO",
2947 .category = FIO_OPT_C_GENERAL,
2948 .group = FIO_OPT_G_ERR,
2951 .oval = ERROR_TYPE_NONE,
2952 .help = "Exit when an error is encountered",
2955 .oval = ERROR_TYPE_READ,
2956 .help = "Continue on read errors only",
2959 .oval = ERROR_TYPE_WRITE,
2960 .help = "Continue on write errors only",
2963 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
2964 .help = "Continue on any IO errors",
2967 .oval = ERROR_TYPE_VERIFY,
2968 .help = "Continue on verify errors only",
2971 .oval = ERROR_TYPE_ANY,
2972 .help = "Continue on all io and verify errors",
2975 .oval = ERROR_TYPE_NONE,
2976 .help = "Alias for 'none'",
2979 .oval = ERROR_TYPE_ANY,
2980 .help = "Alias for 'all'",
2985 .name = "ignore_error",
2986 .type = FIO_OPT_STR,
2987 .cb = str_ignore_error_cb,
2988 .help = "Set a specific list of errors to ignore",
2990 .category = FIO_OPT_C_GENERAL,
2991 .group = FIO_OPT_G_ERR,
2994 .name = "error_dump",
2995 .type = FIO_OPT_BOOL,
2996 .off1 = td_var_offset(error_dump),
2998 .help = "Dump info on each error",
2999 .category = FIO_OPT_C_GENERAL,
3000 .group = FIO_OPT_G_ERR,
3005 .type = FIO_OPT_STR_STORE,
3006 .off1 = td_var_offset(profile),
3007 .help = "Select a specific builtin performance test",
3008 .category = FIO_OPT_C_PROFILE,
3009 .group = FIO_OPT_G_INVALID,
3014 .type = FIO_OPT_STR_STORE,
3015 .off1 = td_var_offset(cgroup),
3016 .help = "Add job to cgroup of this name",
3017 .category = FIO_OPT_C_GENERAL,
3018 .group = FIO_OPT_G_CGROUP,
3021 .name = "cgroup_nodelete",
3022 .lname = "Cgroup no-delete",
3023 .type = FIO_OPT_BOOL,
3024 .off1 = td_var_offset(cgroup_nodelete),
3025 .help = "Do not delete cgroups after job completion",
3028 .category = FIO_OPT_C_GENERAL,
3029 .group = FIO_OPT_G_CGROUP,
3032 .name = "cgroup_weight",
3033 .lname = "Cgroup weight",
3034 .type = FIO_OPT_INT,
3035 .off1 = td_var_offset(cgroup_weight),
3036 .help = "Use given weight for cgroup",
3040 .category = FIO_OPT_C_GENERAL,
3041 .group = FIO_OPT_G_CGROUP,
3046 .type = FIO_OPT_INT,
3047 .off1 = td_var_offset(uid),
3048 .help = "Run job with this user ID",
3049 .category = FIO_OPT_C_GENERAL,
3050 .group = FIO_OPT_G_CRED,
3054 .lname = "Group ID",
3055 .type = FIO_OPT_INT,
3056 .off1 = td_var_offset(gid),
3057 .help = "Run job with this group ID",
3058 .category = FIO_OPT_C_GENERAL,
3059 .group = FIO_OPT_G_CRED,
3064 .type = FIO_OPT_INT,
3065 .off1 = td_var_offset(kb_base),
3071 .help = "Use 1024 as the K base",
3075 .help = "Use 1000 as the K base",
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 .lname = "Base unit for reporting (Bits or Bytes)",
3085 .type = FIO_OPT_INT,
3086 .off1 = td_var_offset(unit_base),
3091 .help = "Auto-detect",
3095 .help = "Normal (byte based)",
3099 .help = "Bit based",
3102 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3103 .category = FIO_OPT_C_GENERAL,
3104 .group = FIO_OPT_G_INVALID,
3107 .name = "hugepage-size",
3108 .lname = "Hugepage size",
3109 .type = FIO_OPT_INT,
3110 .off1 = td_var_offset(hugepage_size),
3111 .help = "When using hugepages, specify size of each page",
3112 .def = __fio_stringify(FIO_HUGE_PAGE),
3113 .interval = 1024 * 1024,
3114 .category = FIO_OPT_C_GENERAL,
3115 .group = FIO_OPT_G_INVALID,
3119 .lname = "I/O flow ID",
3120 .type = FIO_OPT_INT,
3121 .off1 = td_var_offset(flow_id),
3122 .help = "The flow index ID to use",
3124 .category = FIO_OPT_C_IO,
3125 .group = FIO_OPT_G_IO_FLOW,
3129 .lname = "I/O flow weight",
3130 .type = FIO_OPT_INT,
3131 .off1 = td_var_offset(flow),
3132 .help = "Weight for flow control of this job",
3133 .parent = "flow_id",
3136 .category = FIO_OPT_C_IO,
3137 .group = FIO_OPT_G_IO_FLOW,
3140 .name = "flow_watermark",
3141 .lname = "I/O flow watermark",
3142 .type = FIO_OPT_INT,
3143 .off1 = td_var_offset(flow_watermark),
3144 .help = "High watermark for flow control. This option"
3145 " should be set to the same value for all threads"
3146 " with non-zero flow.",
3147 .parent = "flow_id",
3150 .category = FIO_OPT_C_IO,
3151 .group = FIO_OPT_G_IO_FLOW,
3154 .name = "flow_sleep",
3155 .lname = "I/O flow sleep",
3156 .type = FIO_OPT_INT,
3157 .off1 = td_var_offset(flow_sleep),
3158 .help = "How many microseconds to sleep after being held"
3159 " back by the flow control mechanism",
3160 .parent = "flow_id",
3163 .category = FIO_OPT_C_IO,
3164 .group = FIO_OPT_G_IO_FLOW,
3171 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3172 const char *name, int val)
3174 lopt->name = (char *) name;
3176 if (o->type == FIO_OPT_STR_SET)
3177 lopt->has_arg = no_argument;
3179 lopt->has_arg = required_argument;
3182 static void options_to_lopts(struct fio_option *opts,
3183 struct option *long_options,
3184 int i, int option_type)
3186 struct fio_option *o = &opts[0];
3188 add_to_lopt(&long_options[i], o, o->name, option_type);
3191 add_to_lopt(&long_options[i], o, o->alias, option_type);
3196 assert(i < FIO_NR_OPTIONS);
3200 void fio_options_set_ioengine_opts(struct option *long_options,
3201 struct thread_data *td)
3206 while (long_options[i].name) {
3207 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3208 memset(&long_options[i], 0, sizeof(*long_options));
3215 * Just clear out the prior ioengine options.
3220 options_to_lopts(td->io_ops->options, long_options, i,
3221 FIO_GETOPT_IOENGINE);
3224 void fio_options_dup_and_init(struct option *long_options)
3228 options_init(fio_options);
3231 while (long_options[i].name)
3234 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3237 struct fio_keyword {
3243 static struct fio_keyword fio_keywords[] = {
3245 .word = "$pagesize",
3246 .desc = "Page size in the system",
3249 .word = "$mb_memory",
3250 .desc = "Megabytes of memory online",
3254 .desc = "Number of CPUs online in the system",
3261 void fio_keywords_init(void)
3263 unsigned long long mb_memory;
3267 sprintf(buf, "%lu", (unsigned long) page_size);
3268 fio_keywords[0].replace = strdup(buf);
3270 mb_memory = os_phys_mem() / (1024 * 1024);
3271 sprintf(buf, "%llu", mb_memory);
3272 fio_keywords[1].replace = strdup(buf);
3275 sprintf(buf, "%lu", l);
3276 fio_keywords[2].replace = strdup(buf);
3281 static char *bc_calc(char *str)
3283 char buf[128], *tmp;
3288 * No math, just return string
3290 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3291 !strchr(str, '/')) || strchr(str, '\''))
3295 * Split option from value, we only need to calculate the value
3297 tmp = strchr(str, '=');
3304 * Prevent buffer overflows; such a case isn't reasonable anyway
3306 if (strlen(str) >= 128 || strlen(tmp) > 100)
3309 sprintf(buf, "which %s > /dev/null", BC_APP);
3311 log_err("fio: bc is needed for performing math\n");
3315 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3316 f = popen(buf, "r");
3320 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3325 buf[(tmp - str) + ret - 1] = '\0';
3326 memcpy(buf, str, tmp - str);
3332 * Return a copy of the input string with substrings of the form ${VARNAME}
3333 * substituted with the value of the environment variable VARNAME. The
3334 * substitution always occurs, even if VARNAME is empty or the corresponding
3335 * environment variable undefined.
3337 static char *option_dup_subs(const char *opt)
3339 char out[OPT_LEN_MAX+1];
3340 char in[OPT_LEN_MAX+1];
3343 char *ch1, *ch2, *env;
3344 ssize_t nchr = OPT_LEN_MAX;
3347 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3348 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3352 in[OPT_LEN_MAX] = '\0';
3353 strncpy(in, opt, OPT_LEN_MAX);
3355 while (*inptr && nchr > 0) {
3356 if (inptr[0] == '$' && inptr[1] == '{') {
3357 ch2 = strchr(inptr, '}');
3358 if (ch2 && inptr+1 < ch2) {
3365 envlen = strlen(env);
3366 if (envlen <= nchr) {
3367 memcpy(outptr, env, envlen);
3377 *outptr++ = *inptr++;
3386 * Look for reserved variable names and replace them with real values
3388 static char *fio_keyword_replace(char *opt)
3394 for (i = 0; fio_keywords[i].word != NULL; i++) {
3395 struct fio_keyword *kw = &fio_keywords[i];
3397 while ((s = strstr(opt, kw->word)) != NULL) {
3398 char *new = malloc(strlen(opt) + 1);
3404 * Copy part of the string before the keyword and
3405 * sprintf() the replacement after it.
3407 memcpy(new, opt, olen);
3408 len = sprintf(new + olen, "%s", kw->replace);
3411 * If there's more in the original string, copy that
3414 opt += strlen(kw->word) + olen;
3416 memcpy(new + olen + len, opt, opt - o_org - 1);
3419 * replace opt and free the old opt
3429 * Check for potential math and invoke bc, if possible
3437 static char **dup_and_sub_options(char **opts, int num_opts)
3440 char **opts_copy = malloc(num_opts * sizeof(*opts));
3441 for (i = 0; i < num_opts; i++) {
3442 opts_copy[i] = option_dup_subs(opts[i]);
3445 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3450 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
3452 int i, ret, unknown;
3455 sort_options(opts, fio_options, num_opts);
3456 opts_copy = dup_and_sub_options(opts, num_opts);
3458 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3459 struct fio_option *o;
3460 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3469 opts_copy[i] = NULL;
3476 ret |= ioengine_load(td);
3478 sort_options(opts_copy, td->io_ops->options, num_opts);
3481 for (i = 0; i < num_opts; i++) {
3482 struct fio_option *o = NULL;
3488 newret = parse_option(opts_copy[i], opts[i],
3489 td->io_ops->options, &o,
3494 log_err("Bad option <%s>\n", opts[i]);
3497 opts_copy[i] = NULL;
3505 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3507 return parse_cmd_option(opt, val, fio_options, td);
3510 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3513 return parse_cmd_option(opt, val, td->io_ops->options, td);
3516 void fio_fill_default_options(struct thread_data *td)
3518 fill_default_options(td, fio_options);
3521 int fio_show_option_help(const char *opt)
3523 return show_cmd_help(fio_options, opt);
3526 void options_mem_dupe(void *data, struct fio_option *options)
3528 struct fio_option *o;
3531 for (o = &options[0]; o->name; o++) {
3532 if (o->type != FIO_OPT_STR_STORE)
3535 ptr = td_var(data, o->off1);
3537 *ptr = strdup(*ptr);
3542 * dupe FIO_OPT_STR_STORE options
3544 void fio_options_mem_dupe(struct thread_data *td)
3546 options_mem_dupe(&td->o, fio_options);
3548 if (td->eo && td->io_ops) {
3549 void *oldeo = td->eo;
3551 td->eo = malloc(td->io_ops->option_struct_size);
3552 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3553 options_mem_dupe(td->eo, td->io_ops->options);
3557 unsigned int fio_get_kb_base(void *data)
3559 struct thread_options *o = data;
3560 unsigned int kb_base = 0;
3563 kb_base = o->kb_base;
3570 int add_option(struct fio_option *o)
3572 struct fio_option *__o;
3581 memcpy(&fio_options[opt_index], o, sizeof(*o));
3585 void invalidate_profile_options(const char *prof_name)
3587 struct fio_option *o;
3591 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3592 o->type = FIO_OPT_INVALID;
3593 o->prof_name = NULL;
3599 void add_opt_posval(const char *optname, const char *ival, const char *help)
3601 struct fio_option *o;
3604 o = find_option(fio_options, optname);
3608 for (i = 0; i < PARSE_MAX_VP; i++) {
3609 if (o->posval[i].ival)
3612 o->posval[i].ival = ival;
3613 o->posval[i].help = help;
3618 void del_opt_posval(const char *optname, const char *ival)
3620 struct fio_option *o;
3623 o = find_option(fio_options, optname);
3627 for (i = 0; i < PARSE_MAX_VP; i++) {
3628 if (!o->posval[i].ival)
3630 if (strcmp(o->posval[i].ival, ival))
3633 o->posval[i].ival = NULL;
3634 o->posval[i].help = NULL;
3638 void fio_options_free(struct thread_data *td)
3640 options_free(fio_options, td);
3641 if (td->eo && td->io_ops && td->io_ops->options) {
3642 options_free(td->io_ops->options, td->eo);
3648 struct fio_option *fio_option_find(const char *name)
3650 return find_option(fio_options, name);