8 #include <netinet/in.h>
13 #include "lib/pattern.h"
18 char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
20 #define cb_data_to_td(data) container_of(data, struct thread_data, o)
22 static const struct pattern_fmt_desc fmt_desc[] = {
25 .len = FIO_FIELD_SIZE(struct io_u *, offset),
26 .paste = paste_blockoff
32 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
34 static char *get_opt_postfix(const char *str)
36 char *p = strstr(str, ":");
42 strip_blank_front(&p);
47 static bool split_parse_distr(const char *str, double *val, double *center)
61 r = str_to_float(cp, center, 0);
63 r = r && str_to_float(p, val, 0);
68 static int bs_cmp(const void *p1, const void *p2)
70 const struct bssplit *bsp1 = p1;
71 const struct bssplit *bsp2 = p2;
73 return (int) bsp1->perc - (int) bsp2->perc;
76 int split_parse_ddir(struct thread_options *o, struct split *split,
77 char *str, bool absolute, unsigned int max_splits)
79 unsigned long long perc;
87 while ((fname = strsep(&str, ":")) != NULL) {
93 perc_str = strstr(fname, "/");
98 if (str_to_decimal(perc_str, &val, 1, o, 0, 0)) {
99 log_err("fio: split conversion failed\n");
104 perc = atoi(perc_str);
117 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
118 log_err("fio: split conversion failed\n");
122 split->val1[i] = val;
123 split->val2[i] = perc;
125 if (i == max_splits) {
126 log_err("fio: hit max of %d split entries\n", i);
135 static int bssplit_ddir(struct thread_options *o, void *eo,
136 enum fio_ddir ddir, char *str, bool data)
138 unsigned int i, perc, perc_missing;
139 unsigned long long max_bs, min_bs;
142 memset(&split, 0, sizeof(split));
144 if (split_parse_ddir(o, &split, str, data, BSSPLIT_MAX))
151 o->bssplit[ddir] = malloc(split.nr * sizeof(struct bssplit));
152 o->bssplit_nr[ddir] = split.nr;
153 for (i = 0; i < split.nr; i++) {
154 if (split.val1[i] > max_bs)
155 max_bs = split.val1[i];
156 if (split.val1[i] < min_bs)
157 min_bs = split.val1[i];
159 o->bssplit[ddir][i].bs = split.val1[i];
160 o->bssplit[ddir][i].perc =split.val2[i];
164 * Now check if the percentages add up, and how much is missing
166 perc = perc_missing = 0;
167 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
168 struct bssplit *bsp = &o->bssplit[ddir][i];
170 if (bsp->perc == -1U)
176 if (perc > 100 && perc_missing > 1) {
177 log_err("fio: bssplit percentages add to more than 100%%\n");
178 free(o->bssplit[ddir]);
179 o->bssplit[ddir] = NULL;
184 * If values didn't have a percentage set, divide the remains between
188 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
190 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
191 struct bssplit *bsp = &o->bssplit[ddir][i];
193 if (bsp->perc == -1U)
194 bsp->perc = (100 - perc) / perc_missing;
198 o->min_bs[ddir] = min_bs;
199 o->max_bs[ddir] = max_bs;
202 * now sort based on percentages, for ease of lookup
204 qsort(o->bssplit[ddir], o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
208 int str_split_parse(struct thread_data *td, char *str,
209 split_parse_fn *fn, void *eo, bool data)
214 odir = strchr(str, ',');
216 ddir = strchr(odir + 1, ',');
218 ret = fn(&td->o, eo, DDIR_TRIM, ddir + 1, data);
224 op = strdup(odir + 1);
225 ret = fn(&td->o, eo, DDIR_TRIM, op, data);
230 ret = fn(&td->o, eo, DDIR_WRITE, odir + 1, data);
233 ret = fn(&td->o, eo, DDIR_READ, str, data);
239 ret = fn(&td->o, eo, DDIR_WRITE, op, data);
244 ret = fn(&td->o, eo, DDIR_TRIM, op, data);
248 ret = fn(&td->o, eo, DDIR_READ, str, data);
254 static int str_bssplit_cb(void *data, const char *input)
256 struct thread_data *td = cb_data_to_td(data);
260 p = str = strdup(input);
262 strip_blank_front(&str);
263 strip_blank_end(str);
265 ret = str_split_parse(td, str, bssplit_ddir, NULL, false);
267 if (parse_dryrun()) {
270 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
271 free(td->o.bssplit[i]);
272 td->o.bssplit[i] = NULL;
273 td->o.bssplit_nr[i] = 0;
281 static int parse_cmdprio_bssplit_entry(struct thread_options *o,
282 struct split_prio *entry, char *str)
287 unsigned int perc = 0, class, level;
290 * valid entry formats:
291 * bs/ - %s/ - set perc to 0, prio to -1.
292 * bs/perc - %s/%u - set prio to -1.
293 * bs/perc/class/level - %s/%u/%u/%u
295 matches = sscanf(str, "%m[^/]/%u/%u/%u", &bs_str, &perc, &class, &level);
297 log_err("fio: invalid cmdprio_bssplit format\n");
301 if (str_to_decimal(bs_str, &bs_val, 1, o, 0, 0)) {
302 log_err("fio: split conversion failed\n");
309 entry->perc = min(perc, 100u);
312 case 1: /* bs/ case */
313 case 2: /* bs/perc case */
315 case 4: /* bs/perc/class/level case */
316 class = min(class, (unsigned int) IOPRIO_MAX_PRIO_CLASS);
317 level = min(level, (unsigned int) IOPRIO_MAX_PRIO);
318 entry->prio = ioprio_value(class, level);
321 log_err("fio: invalid cmdprio_bssplit format\n");
329 * Returns a negative integer if the first argument should be before the second
330 * argument in the sorted list. A positive integer if the first argument should
331 * be after the second argument in the sorted list. A zero if they are equal.
333 static int fio_split_prio_cmp(const void *p1, const void *p2)
335 const struct split_prio *tmp1 = p1;
336 const struct split_prio *tmp2 = p2;
338 if (tmp1->bs > tmp2->bs)
340 if (tmp1->bs < tmp2->bs)
345 int split_parse_prio_ddir(struct thread_options *o, struct split_prio **entries,
346 int *nr_entries, char *str)
348 struct split_prio *tmp_entries;
349 unsigned int nr_bssplits;
350 char *str_cpy, *p, *fname;
352 /* strsep modifies the string, dup it so that we can use strsep twice */
353 p = str_cpy = strdup(str);
358 while ((fname = strsep(&str_cpy, ":")) != NULL) {
365 if (nr_bssplits > BSSPLIT_MAX) {
366 log_err("fio: too many cmdprio_bssplit entries\n");
370 tmp_entries = calloc(nr_bssplits, sizeof(*tmp_entries));
375 while ((fname = strsep(&str, ":")) != NULL) {
376 struct split_prio *entry;
381 entry = &tmp_entries[nr_bssplits];
383 if (parse_cmdprio_bssplit_entry(o, entry, fname)) {
384 log_err("fio: failed to parse cmdprio_bssplit entry\n");
389 /* skip zero perc entries, they provide no useful information */
394 qsort(tmp_entries, nr_bssplits, sizeof(*tmp_entries),
397 *entries = tmp_entries;
398 *nr_entries = nr_bssplits;
403 static int str2error(char *str)
405 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
406 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
407 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
408 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
409 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
410 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
411 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
412 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
413 int i = 0, num = sizeof(err) / sizeof(char *);
416 if (!strcmp(err[i], str))
423 static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
430 if (etype >= ERROR_TYPE_CNT) {
431 log_err("Illegal error type\n");
435 td->o.ignore_error_nr[etype] = 4;
436 error = calloc(4, sizeof(int));
439 while ((fname = strsep(&str, ":")) != NULL) {
445 * grow struct buffer, if needed
447 if (i == td->o.ignore_error_nr[etype]) {
448 td->o.ignore_error_nr[etype] <<= 1;
449 error = realloc(error, td->o.ignore_error_nr[etype]
452 if (fname[0] == 'E') {
453 error[i] = str2error(fname);
455 error[i] = atoi(fname);
457 error[i] = -error[i];
460 log_err("Unknown error %s, please use number value\n",
462 td->o.ignore_error_nr[etype] = 0;
469 td->o.continue_on_error |= 1 << etype;
470 td->o.ignore_error_nr[etype] = i;
471 td->o.ignore_error[etype] = error;
473 td->o.ignore_error_nr[etype] = 0;
481 static int str_replay_skip_cb(void *data, const char *input)
483 struct thread_data *td = cb_data_to_td(data);
490 p = str = strdup(input);
492 strip_blank_front(&str);
493 strip_blank_end(str);
499 if (!strcmp(p, "read"))
500 td->o.replay_skip |= 1u << DDIR_READ;
501 else if (!strcmp(p, "write"))
502 td->o.replay_skip |= 1u << DDIR_WRITE;
503 else if (!strcmp(p, "trim"))
504 td->o.replay_skip |= 1u << DDIR_TRIM;
505 else if (!strcmp(p, "sync"))
506 td->o.replay_skip |= 1u << DDIR_SYNC;
508 log_err("Unknown skip type: %s\n", p);
518 static int str_ignore_error_cb(void *data, const char *input)
520 struct thread_data *td = cb_data_to_td(data);
523 enum error_type_bit type = 0;
528 p = str = strdup(input);
530 strip_blank_front(&str);
531 strip_blank_end(str);
537 ret = ignore_error_type(td, type, p);
547 static int str_rw_cb(void *data, const char *str)
549 struct thread_data *td = cb_data_to_td(data);
550 struct thread_options *o = &td->o;
559 nr = get_opt_postfix(str);
564 o->ddir_seq_nr = atoi(nr);
568 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
569 log_err("fio: rw postfix parsing failed\n");
574 o->ddir_seq_add = val;
581 static int str_mem_cb(void *data, const char *mem)
583 struct thread_data *td = cb_data_to_td(data);
585 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
586 td->o.mem_type == MEM_MMAPSHARED)
587 td->o.mmapfile = get_opt_postfix(mem);
592 static int fio_clock_source_cb(void *data, const char *str)
594 struct thread_data *td = cb_data_to_td(data);
596 fio_clock_source = td->o.clocksource;
597 fio_clock_source_set = 1;
602 static int str_rwmix_read_cb(void *data, unsigned long long *val)
604 struct thread_data *td = cb_data_to_td(data);
606 td->o.rwmix[DDIR_READ] = *val;
607 td->o.rwmix[DDIR_WRITE] = 100 - *val;
611 static int str_rwmix_write_cb(void *data, unsigned long long *val)
613 struct thread_data *td = cb_data_to_td(data);
615 td->o.rwmix[DDIR_WRITE] = *val;
616 td->o.rwmix[DDIR_READ] = 100 - *val;
620 static int str_exitall_cb(void)
622 exitall_on_terminate = true;
626 #ifdef FIO_HAVE_CPU_AFFINITY
627 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
629 unsigned int i, index, cpus_in_mask;
630 const long max_cpu = cpus_online();
632 cpus_in_mask = fio_cpu_count(mask);
636 cpu_index = cpu_index % cpus_in_mask;
639 for (i = 0; i < max_cpu; i++) {
640 if (!fio_cpu_isset(mask, i))
643 if (cpu_index != index)
644 fio_cpu_clear(mask, i);
649 return fio_cpu_count(mask);
652 static int str_cpumask_cb(void *data, unsigned long long *val)
654 struct thread_data *td = cb_data_to_td(data);
662 ret = fio_cpuset_init(&td->o.cpumask);
664 log_err("fio: cpuset_init failed\n");
665 td_verror(td, ret, "fio_cpuset_init");
669 max_cpu = cpus_online();
671 for (i = 0; i < sizeof(int) * 8; i++) {
672 if ((1 << i) & *val) {
674 log_err("fio: CPU %d too large (max=%ld)\n", i,
678 dprint(FD_PARSE, "set cpu allowed %d\n", i);
679 fio_cpu_set(&td->o.cpumask, i);
686 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
693 ret = fio_cpuset_init(mask);
695 log_err("fio: cpuset_init failed\n");
696 td_verror(td, ret, "fio_cpuset_init");
700 p = str = strdup(input);
702 strip_blank_front(&str);
703 strip_blank_end(str);
705 max_cpu = cpus_online();
707 while ((cpu = strsep(&str, ",")) != NULL) {
716 while ((cpu2 = strsep(&str2, "-")) != NULL) {
726 while (icpu <= icpu2) {
727 if (icpu >= FIO_MAX_CPUS) {
728 log_err("fio: your OS only supports up to"
729 " %d CPUs\n", (int) FIO_MAX_CPUS);
733 if (icpu >= max_cpu) {
734 log_err("fio: CPU %d too large (max=%ld)\n",
740 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
741 fio_cpu_set(mask, icpu);
752 static int str_cpus_allowed_cb(void *data, const char *input)
754 struct thread_data *td = cb_data_to_td(data);
759 return set_cpus_allowed(td, &td->o.cpumask, input);
762 static int str_verify_cpus_allowed_cb(void *data, const char *input)
764 struct thread_data *td = cb_data_to_td(data);
769 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
773 static int str_log_cpus_allowed_cb(void *data, const char *input)
775 struct thread_data *td = cb_data_to_td(data);
780 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
782 #endif /* CONFIG_ZLIB */
784 #endif /* FIO_HAVE_CPU_AFFINITY */
786 #ifdef CONFIG_LIBNUMA
787 static int str_numa_cpunodes_cb(void *data, char *input)
789 struct thread_data *td = cb_data_to_td(data);
790 struct bitmask *verify_bitmask;
795 /* numa_parse_nodestring() parses a character string list
796 * of nodes into a bit mask. The bit mask is allocated by
797 * numa_allocate_nodemask(), so it should be freed by
798 * numa_free_nodemask().
800 verify_bitmask = numa_parse_nodestring(input);
801 if (verify_bitmask == NULL) {
802 log_err("fio: numa_parse_nodestring failed\n");
803 td_verror(td, 1, "str_numa_cpunodes_cb");
806 numa_free_nodemask(verify_bitmask);
808 td->o.numa_cpunodes = strdup(input);
812 static int str_numa_mpol_cb(void *data, char *input)
814 struct thread_data *td = cb_data_to_td(data);
815 const char * const policy_types[] =
816 { "default", "prefer", "bind", "interleave", "local", NULL };
819 struct bitmask *verify_bitmask;
824 nodelist = strchr(input, ':');
826 /* NUL-terminate mode */
830 for (i = 0; i <= MPOL_LOCAL; i++) {
831 if (!strcmp(input, policy_types[i])) {
832 td->o.numa_mem_mode = i;
836 if (i > MPOL_LOCAL) {
837 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
841 switch (td->o.numa_mem_mode) {
844 * Insist on a nodelist of one node only
847 char *rest = nodelist;
848 while (isdigit(*rest))
851 log_err("fio: one node only for \'prefer\'\n");
855 log_err("fio: one node is needed for \'prefer\'\n");
859 case MPOL_INTERLEAVE:
861 * Default to online nodes with memory if no nodelist
864 nodelist = strdup("all");
869 * Don't allow a nodelist
872 log_err("fio: NO nodelist for \'local\'\n");
878 * Insist on a nodelist
881 log_err("fio: a nodelist is needed for \'bind\'\n");
888 /* numa_parse_nodestring() parses a character string list
889 * of nodes into a bit mask. The bit mask is allocated by
890 * numa_allocate_nodemask(), so it should be freed by
891 * numa_free_nodemask().
893 switch (td->o.numa_mem_mode) {
895 td->o.numa_mem_prefer_node = atoi(nodelist);
897 case MPOL_INTERLEAVE:
899 verify_bitmask = numa_parse_nodestring(nodelist);
900 if (verify_bitmask == NULL) {
901 log_err("fio: numa_parse_nodestring failed\n");
902 td_verror(td, 1, "str_numa_memnodes_cb");
905 td->o.numa_memnodes = strdup(nodelist);
906 numa_free_nodemask(verify_bitmask);
921 static int str_fst_cb(void *data, const char *str)
923 struct thread_data *td = cb_data_to_td(data);
929 td->file_service_nr = 1;
931 switch (td->o.file_service_type) {
932 case FIO_FSERVICE_RANDOM:
933 case FIO_FSERVICE_RR:
934 case FIO_FSERVICE_SEQ:
935 nr = get_opt_postfix(str);
937 td->file_service_nr = atoi(nr);
942 case FIO_FSERVICE_ZIPF:
945 case FIO_FSERVICE_PARETO:
946 val = FIO_DEF_PARETO;
948 case FIO_FSERVICE_GAUSS:
952 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
959 nr = get_opt_postfix(str);
960 if (nr && !split_parse_distr(nr, &val, ¢er)) {
961 log_err("fio: file service type random postfix parsing failed\n");
968 if (center != -1 && (center < 0.00 || center > 1.00)) {
969 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
972 td->random_center = center;
974 switch (td->o.file_service_type) {
975 case FIO_FSERVICE_ZIPF:
977 log_err("fio: zipf theta must be different than 1.0\n");
982 td->zipf_theta = val;
984 case FIO_FSERVICE_PARETO:
985 if (val <= 0.00 || val >= 1.00) {
986 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
993 case FIO_FSERVICE_GAUSS:
994 if (val < 0.00 || val >= 100.00) {
995 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1000 td->gauss_dev = val;
1007 #ifdef CONFIG_SYNC_FILE_RANGE
1008 static int str_sfr_cb(void *data, const char *str)
1010 struct thread_data *td = cb_data_to_td(data);
1011 char *nr = get_opt_postfix(str);
1013 td->sync_file_range_nr = 1;
1015 td->sync_file_range_nr = atoi(nr);
1023 static int zone_split_ddir(struct thread_options *o, void *eo,
1024 enum fio_ddir ddir, char *str, bool absolute)
1026 unsigned int i, perc, perc_missing, sperc, sperc_missing;
1029 memset(&split, 0, sizeof(split));
1031 if (split_parse_ddir(o, &split, str, absolute, ZONESPLIT_MAX))
1036 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
1037 o->zone_split_nr[ddir] = split.nr;
1038 for (i = 0; i < split.nr; i++) {
1039 o->zone_split[ddir][i].access_perc = split.val1[i];
1041 o->zone_split[ddir][i].size = split.val2[i];
1043 o->zone_split[ddir][i].size_perc = split.val2[i];
1047 * Now check if the percentages add up, and how much is missing
1049 perc = perc_missing = 0;
1050 sperc = sperc_missing = 0;
1051 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1052 struct zone_split *zsp = &o->zone_split[ddir][i];
1054 if (zsp->access_perc == (uint8_t) -1U)
1057 perc += zsp->access_perc;
1060 if (zsp->size_perc == (uint8_t) -1U)
1063 sperc += zsp->size_perc;
1067 if (perc > 100 || sperc > 100) {
1068 log_err("fio: zone_split percentages add to more than 100%%\n");
1069 free(o->zone_split[ddir]);
1070 o->zone_split[ddir] = NULL;
1074 log_err("fio: access percentage don't add up to 100 for zoned "
1075 "random distribution (got=%u)\n", perc);
1076 free(o->zone_split[ddir]);
1077 o->zone_split[ddir] = NULL;
1082 * If values didn't have a percentage set, divide the remains between
1086 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
1088 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1089 struct zone_split *zsp = &o->zone_split[ddir][i];
1091 if (zsp->access_perc == (uint8_t) -1U)
1092 zsp->access_perc = (100 - perc) / perc_missing;
1095 if (sperc_missing) {
1096 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
1098 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1099 struct zone_split *zsp = &o->zone_split[ddir][i];
1101 if (zsp->size_perc == (uint8_t) -1U)
1102 zsp->size_perc = (100 - sperc) / sperc_missing;
1109 static int parse_zoned_distribution(struct thread_data *td, const char *input,
1112 const char *pre = absolute ? "zoned_abs:" : "zoned:";
1116 p = str = strdup(input);
1118 strip_blank_front(&str);
1119 strip_blank_end(str);
1121 /* We expect it to start like that, bail if not */
1122 if (strncmp(str, pre, strlen(pre))) {
1123 log_err("fio: mismatch in zoned input <%s>\n", str);
1129 ret = str_split_parse(td, str, zone_split_ddir, NULL, absolute);
1133 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1136 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
1138 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
1139 struct zone_split *zsp = &td->o.zone_split[i][j];
1142 dprint(FD_PARSE, "\t%d: %u/%llu\n", j,
1144 (unsigned long long) zsp->size);
1146 dprint(FD_PARSE, "\t%d: %u/%u\n", j,
1153 if (parse_dryrun()) {
1154 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1155 free(td->o.zone_split[i]);
1156 td->o.zone_split[i] = NULL;
1157 td->o.zone_split_nr[i] = 0;
1164 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1165 td->o.zone_split_nr[i] = 0;
1171 static int str_random_distribution_cb(void *data, const char *str)
1173 struct thread_data *td = cb_data_to_td(data);
1178 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1180 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1181 val = FIO_DEF_PARETO;
1182 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1184 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1185 return parse_zoned_distribution(td, str, false);
1186 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED_ABS)
1187 return parse_zoned_distribution(td, str, true);
1191 nr = get_opt_postfix(str);
1192 if (nr && !split_parse_distr(nr, &val, ¢er)) {
1193 log_err("fio: random postfix parsing failed\n");
1200 if (center != -1 && (center < 0.00 || center > 1.00)) {
1201 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
1204 td->o.random_center.u.f = center;
1206 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1208 log_err("fio: zipf theta must different than 1.0\n");
1213 td->o.zipf_theta.u.f = val;
1214 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1215 if (val <= 0.00 || val >= 1.00) {
1216 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1221 td->o.pareto_h.u.f = val;
1223 if (val < 0.00 || val >= 100.0) {
1224 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1229 td->o.gauss_dev.u.f = val;
1235 static int str_steadystate_cb(void *data, const char *str)
1237 struct thread_data *td = cb_data_to_td(data);
1243 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1244 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
1245 /* should be impossible to get here */
1246 log_err("fio: unknown steady state criterion\n");
1250 nr = get_opt_postfix(str);
1252 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1257 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1258 pct = strstr(nr, "%");
1261 strip_blank_end(nr);
1262 if (!str_to_float(nr, &val, 0)) {
1263 log_err("fio: could not parse steadystate threshold percentage\n");
1268 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1273 td->o.ss_state |= FIO_SS_PCT;
1274 td->o.ss_limit.u.f = val;
1275 } else if (td->o.ss_state & FIO_SS_IOPS) {
1276 if (!str_to_float(nr, &val, 0)) {
1277 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1282 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1287 td->o.ss_limit.u.f = val;
1288 } else { /* bandwidth criterion */
1289 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1290 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1295 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1300 td->o.ss_limit.u.f = (double) ll;
1303 td->ss.state = td->o.ss_state;
1308 * Return next name in the string. Files are separated with ':'. If the ':'
1309 * is escaped with a '\', then that ':' is part of the filename and does not
1310 * indicate a new file.
1312 char *get_next_str(char **ptr)
1317 if (!str || !strlen(str))
1323 * No colon, we are done
1325 p = strchr(str, ':');
1332 * We got a colon, but it's the first character. Skip and
1340 if (*(p - 1) != '\\') {
1346 memmove(p - 1, p, strlen(p) + 1);
1354 int get_max_str_idx(char *input)
1356 unsigned int cur_idx;
1359 p = str = strdup(input);
1360 for (cur_idx = 0; ; cur_idx++)
1361 if (get_next_str(&str) == NULL)
1369 * Returns the directory at the index, indexes > entries will be
1370 * assigned via modulo division of the index
1372 int set_name_idx(char *target, size_t tlen, char *input, int index,
1373 bool unique_filename)
1375 unsigned int cur_idx;
1377 char *fname, *str, *p;
1379 p = str = strdup(input);
1381 index %= get_max_str_idx(input);
1382 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1383 fname = get_next_str(&str);
1385 if (client_sockaddr_str[0] && unique_filename) {
1386 len = snprintf(target, tlen, "%s/%s.", fname,
1387 client_sockaddr_str);
1389 len = snprintf(target, tlen, "%s%c", fname,
1390 FIO_OS_PATH_SEPARATOR);
1392 target[tlen - 1] = '\0';
1398 char* get_name_by_idx(char *input, int index)
1400 unsigned int cur_idx;
1401 char *fname, *str, *p;
1403 p = str = strdup(input);
1405 index %= get_max_str_idx(input);
1406 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1407 fname = get_next_str(&str);
1409 fname = strdup(fname);
1415 static int str_filename_cb(void *data, const char *input)
1417 struct thread_data *td = cb_data_to_td(data);
1418 char *fname, *str, *p;
1420 p = str = strdup(input);
1422 strip_blank_front(&str);
1423 strip_blank_end(str);
1426 * Ignore what we may already have from nrfiles option.
1428 if (!td->files_index)
1431 while ((fname = get_next_str(&str)) != NULL) {
1434 add_file(td, fname, 0, 1);
1441 static int str_directory_cb(void *data, const char fio_unused *unused)
1443 struct thread_data *td = cb_data_to_td(data);
1445 char *dirname, *str, *p;
1451 p = str = strdup(td->o.directory);
1452 while ((dirname = get_next_str(&str)) != NULL) {
1453 if (lstat(dirname, &sb) < 0) {
1456 log_err("fio: %s is not a directory\n", dirname);
1457 td_verror(td, ret, "lstat");
1460 if (!S_ISDIR(sb.st_mode)) {
1461 log_err("fio: %s is not a directory\n", dirname);
1472 static int str_opendir_cb(void *data, const char fio_unused *str)
1474 struct thread_data *td = cb_data_to_td(data);
1479 if (!td->files_index)
1482 return add_dir_files(td, td->o.opendir);
1485 static int str_buffer_pattern_cb(void *data, const char *input)
1487 struct thread_data *td = cb_data_to_td(data);
1490 /* FIXME: for now buffer pattern does not support formats */
1491 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
1492 MAX_PATTERN_SIZE, NULL, NULL, NULL);
1497 td->o.buffer_pattern_bytes = ret;
1500 * If this job is doing any reading or has compression set,
1501 * ensure that we refill buffers for writes or we could be
1502 * invalidating the pattern through reads.
1504 if (!td->o.compress_percentage && !td_read(td))
1505 td->o.refill_buffers = 0;
1507 td->o.refill_buffers = 1;
1509 td->o.scramble_buffers = 0;
1510 td->o.zero_buffers = 0;
1515 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1517 struct thread_data *td = cb_data_to_td(data);
1519 td->flags |= TD_F_COMPRESS;
1520 td->o.compress_percentage = *il;
1524 static int str_dedupe_cb(void *data, unsigned long long *il)
1526 struct thread_data *td = cb_data_to_td(data);
1528 td->flags |= TD_F_COMPRESS;
1529 td->o.dedupe_percentage = *il;
1530 td->o.refill_buffers = 1;
1534 static int str_verify_pattern_cb(void *data, const char *input)
1536 struct thread_data *td = cb_data_to_td(data);
1539 td->o.verify_fmt_sz = FIO_ARRAY_SIZE(td->o.verify_fmt);
1540 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
1541 MAX_PATTERN_SIZE, fmt_desc,
1542 td->o.verify_fmt, &td->o.verify_fmt_sz);
1547 td->o.verify_pattern_bytes = ret;
1549 * VERIFY_* could already be set
1551 if (!fio_option_is_set(&td->o, verify))
1552 td->o.verify = VERIFY_PATTERN;
1557 static int str_gtod_reduce_cb(void *data, int *il)
1559 struct thread_data *td = cb_data_to_td(data);
1563 * Only modify options if gtod_reduce==1
1564 * Otherwise leave settings alone.
1567 td->o.disable_lat = 1;
1568 td->o.disable_clat = 1;
1569 td->o.disable_slat = 1;
1570 td->o.disable_bw = 1;
1571 td->o.clat_percentiles = 0;
1572 td->o.lat_percentiles = 0;
1573 td->o.slat_percentiles = 0;
1574 td->ts_cache_mask = 63;
1580 static int str_offset_cb(void *data, unsigned long long *__val)
1582 struct thread_data *td = cb_data_to_td(data);
1583 unsigned long long v = *__val;
1585 if (parse_is_percent(v)) {
1586 td->o.start_offset = 0;
1587 td->o.start_offset_percent = -1ULL - v;
1588 td->o.start_offset_nz = 0;
1589 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1590 td->o.start_offset_percent);
1591 } else if (parse_is_zone(v)) {
1592 td->o.start_offset = 0;
1593 td->o.start_offset_percent = 0;
1594 td->o.start_offset_nz = v - ZONE_BASE_VAL;
1596 td->o.start_offset = v;
1601 static int str_offset_increment_cb(void *data, unsigned long long *__val)
1603 struct thread_data *td = cb_data_to_td(data);
1604 unsigned long long v = *__val;
1606 if (parse_is_percent(v)) {
1607 td->o.offset_increment = 0;
1608 td->o.offset_increment_percent = -1ULL - v;
1609 td->o.offset_increment_nz = 0;
1610 dprint(FD_PARSE, "SET offset_increment_percent %d\n",
1611 td->o.offset_increment_percent);
1612 } else if (parse_is_zone(v)) {
1613 td->o.offset_increment = 0;
1614 td->o.offset_increment_percent = 0;
1615 td->o.offset_increment_nz = v - ZONE_BASE_VAL;
1617 td->o.offset_increment = v;
1622 static int str_size_cb(void *data, unsigned long long *__val)
1624 struct thread_data *td = cb_data_to_td(data);
1625 unsigned long long v = *__val;
1627 if (parse_is_percent(v)) {
1629 td->o.size_percent = -1ULL - v;
1630 dprint(FD_PARSE, "SET size_percent %d\n",
1631 td->o.size_percent);
1632 } else if (parse_is_zone(v)) {
1634 td->o.size_percent = 0;
1635 td->o.size_nz = v - ZONE_BASE_VAL;
1642 static int str_io_size_cb(void *data, unsigned long long *__val)
1644 struct thread_data *td = cb_data_to_td(data);
1645 unsigned long long v = *__val;
1647 if (parse_is_percent_uncapped(v)) {
1649 td->o.io_size_percent = -1ULL - v;
1650 if (td->o.io_size_percent > 100) {
1651 log_err("fio: io_size values greater than 100%% aren't supported\n");
1654 dprint(FD_PARSE, "SET io_size_percent %d\n",
1655 td->o.io_size_percent);
1656 } else if (parse_is_zone(v)) {
1658 td->o.io_size_percent = 0;
1659 td->o.io_size_nz = v - ZONE_BASE_VAL;
1666 static int str_zoneskip_cb(void *data, unsigned long long *__val)
1668 struct thread_data *td = cb_data_to_td(data);
1669 unsigned long long v = *__val;
1671 if (parse_is_zone(v)) {
1672 td->o.zone_skip = 0;
1673 td->o.zone_skip_nz = v - ZONE_BASE_VAL;
1675 td->o.zone_skip = v;
1680 static int str_write_bw_log_cb(void *data, const char *str)
1682 struct thread_data *td = cb_data_to_td(data);
1685 td->o.bw_log_file = strdup(str);
1687 td->o.write_bw_log = 1;
1691 static int str_write_lat_log_cb(void *data, const char *str)
1693 struct thread_data *td = cb_data_to_td(data);
1696 td->o.lat_log_file = strdup(str);
1698 td->o.write_lat_log = 1;
1702 static int str_write_iops_log_cb(void *data, const char *str)
1704 struct thread_data *td = cb_data_to_td(data);
1707 td->o.iops_log_file = strdup(str);
1709 td->o.write_iops_log = 1;
1713 static int str_write_hist_log_cb(void *data, const char *str)
1715 struct thread_data *td = cb_data_to_td(data);
1718 td->o.hist_log_file = strdup(str);
1720 td->o.write_hist_log = 1;
1725 * str is supposed to be a substring of the strdup'd original string,
1726 * and is valid only if it's a regular file path.
1727 * This function keeps the pointer to the path as needed later.
1729 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1730 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1731 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1733 static int str_ioengine_external_cb(void *data, const char *str)
1735 struct thread_data *td = cb_data_to_td(data);
1740 log_err("fio: null external ioengine path\n");
1744 p = (char *)str; /* str is mutable */
1745 strip_blank_front(&p);
1748 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1749 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1753 td->o.ioengine_so_path = p;
1757 static int rw_verify(const struct fio_option *o, void *data)
1759 struct thread_data *td = cb_data_to_td(data);
1761 if (read_only && (td_write(td) || td_trim(td))) {
1762 log_err("fio: job <%s> has write or trim bit set, but"
1763 " fio is in read-only mode\n", td->o.name);
1770 static int gtod_cpu_verify(const struct fio_option *o, void *data)
1772 #ifndef FIO_HAVE_CPU_AFFINITY
1773 struct thread_data *td = cb_data_to_td(data);
1775 if (td->o.gtod_cpu) {
1776 log_err("fio: platform must support CPU affinity for"
1777 "gettimeofday() offloading\n");
1786 * Map of job/command line options
1788 struct fio_option fio_options[FIO_MAX_OPTS] = {
1790 .name = "description",
1791 .lname = "Description of job",
1792 .type = FIO_OPT_STR_STORE,
1793 .off1 = offsetof(struct thread_options, description),
1794 .help = "Text job description",
1795 .category = FIO_OPT_C_GENERAL,
1796 .group = FIO_OPT_G_DESC,
1800 .lname = "Job name",
1801 .type = FIO_OPT_STR_STORE,
1802 .off1 = offsetof(struct thread_options, name),
1803 .help = "Name of this job",
1804 .category = FIO_OPT_C_GENERAL,
1805 .group = FIO_OPT_G_DESC,
1809 .lname = "Waitee name",
1810 .type = FIO_OPT_STR_STORE,
1811 .off1 = offsetof(struct thread_options, wait_for),
1812 .help = "Name of the job this one wants to wait for before starting",
1813 .category = FIO_OPT_C_GENERAL,
1814 .group = FIO_OPT_G_DESC,
1818 .lname = "Filename(s)",
1819 .type = FIO_OPT_STR_STORE,
1820 .off1 = offsetof(struct thread_options, filename),
1822 .cb = str_filename_cb,
1823 .prio = -1, /* must come after "directory" */
1824 .help = "File(s) to use for the workload",
1825 .category = FIO_OPT_C_FILE,
1826 .group = FIO_OPT_G_FILENAME,
1829 .name = "directory",
1830 .lname = "Directory",
1831 .type = FIO_OPT_STR_STORE,
1832 .off1 = offsetof(struct thread_options, directory),
1833 .cb = str_directory_cb,
1834 .help = "Directory to store files in",
1835 .category = FIO_OPT_C_FILE,
1836 .group = FIO_OPT_G_FILENAME,
1839 .name = "filename_format",
1840 .lname = "Filename Format",
1841 .type = FIO_OPT_STR_STORE,
1842 .off1 = offsetof(struct thread_options, filename_format),
1843 .prio = -1, /* must come after "directory" */
1844 .help = "Override default $jobname.$jobnum.$filenum naming",
1845 .def = "$jobname.$jobnum.$filenum",
1846 .category = FIO_OPT_C_FILE,
1847 .group = FIO_OPT_G_FILENAME,
1850 .name = "unique_filename",
1851 .lname = "Unique Filename",
1852 .type = FIO_OPT_BOOL,
1853 .off1 = offsetof(struct thread_options, unique_filename),
1854 .help = "For network clients, prefix file with source IP",
1856 .category = FIO_OPT_C_FILE,
1857 .group = FIO_OPT_G_FILENAME,
1861 .lname = "Lockfile",
1862 .type = FIO_OPT_STR,
1863 .off1 = offsetof(struct thread_options, file_lock_mode),
1864 .help = "Lock file when doing IO to it",
1866 .parent = "filename",
1869 .category = FIO_OPT_C_FILE,
1870 .group = FIO_OPT_G_FILENAME,
1873 .oval = FILE_LOCK_NONE,
1874 .help = "No file locking",
1876 { .ival = "exclusive",
1877 .oval = FILE_LOCK_EXCLUSIVE,
1878 .help = "Exclusive file lock",
1881 .ival = "readwrite",
1882 .oval = FILE_LOCK_READWRITE,
1883 .help = "Read vs write lock",
1889 .lname = "Open directory",
1890 .type = FIO_OPT_STR_STORE,
1891 .off1 = offsetof(struct thread_options, opendir),
1892 .cb = str_opendir_cb,
1893 .help = "Recursively add files from this directory and down",
1894 .category = FIO_OPT_C_FILE,
1895 .group = FIO_OPT_G_FILENAME,
1899 .lname = "Read/write",
1900 .alias = "readwrite",
1901 .type = FIO_OPT_STR,
1903 .off1 = offsetof(struct thread_options, td_ddir),
1904 .help = "IO direction",
1906 .verify = rw_verify,
1907 .category = FIO_OPT_C_IO,
1908 .group = FIO_OPT_G_IO_BASIC,
1911 .oval = TD_DDIR_READ,
1912 .help = "Sequential read",
1915 .oval = TD_DDIR_WRITE,
1916 .help = "Sequential write",
1919 .oval = TD_DDIR_TRIM,
1920 .help = "Sequential trim",
1922 { .ival = "randread",
1923 .oval = TD_DDIR_RANDREAD,
1924 .help = "Random read",
1926 { .ival = "randwrite",
1927 .oval = TD_DDIR_RANDWRITE,
1928 .help = "Random write",
1930 { .ival = "randtrim",
1931 .oval = TD_DDIR_RANDTRIM,
1932 .help = "Random trim",
1936 .help = "Sequential read and write mix",
1938 { .ival = "readwrite",
1940 .help = "Sequential read and write mix",
1943 .oval = TD_DDIR_RANDRW,
1944 .help = "Random read and write mix"
1946 { .ival = "trimwrite",
1947 .oval = TD_DDIR_TRIMWRITE,
1948 .help = "Trim and write mix, trims preceding writes"
1953 .name = "rw_sequencer",
1954 .lname = "RW Sequencer",
1955 .type = FIO_OPT_STR,
1956 .off1 = offsetof(struct thread_options, rw_seq),
1957 .help = "IO offset generator modifier",
1958 .def = "sequential",
1959 .category = FIO_OPT_C_IO,
1960 .group = FIO_OPT_G_IO_BASIC,
1962 { .ival = "sequential",
1964 .help = "Generate sequential offsets",
1966 { .ival = "identical",
1967 .oval = RW_SEQ_IDENT,
1968 .help = "Generate identical offsets",
1975 .lname = "IO Engine",
1976 .type = FIO_OPT_STR_STORE,
1977 .off1 = offsetof(struct thread_options, ioengine),
1978 .help = "IO engine to use",
1979 .def = FIO_PREFERRED_ENGINE,
1980 .category = FIO_OPT_C_IO,
1981 .group = FIO_OPT_G_IO_BASIC,
1984 .help = "Use read/write",
1987 .help = "Use pread/pwrite",
1990 .help = "Use readv/writev",
1992 #ifdef CONFIG_PWRITEV
1994 .help = "Use preadv/pwritev",
1997 #ifdef FIO_HAVE_PWRITEV2
1998 { .ival = "pvsync2",
1999 .help = "Use preadv2/pwritev2",
2002 #ifdef CONFIG_LIBAIO
2004 .help = "Linux native asynchronous IO",
2007 #ifdef ARCH_HAVE_IOURING
2008 { .ival = "io_uring",
2009 .help = "Fast Linux native aio",
2012 #ifdef CONFIG_POSIXAIO
2013 { .ival = "posixaio",
2014 .help = "POSIX asynchronous IO",
2017 #ifdef CONFIG_SOLARISAIO
2018 { .ival = "solarisaio",
2019 .help = "Solaris native asynchronous IO",
2022 #ifdef CONFIG_WINDOWSAIO
2023 { .ival = "windowsaio",
2024 .help = "Windows native asynchronous IO"
2029 .help = "Rados Block Device asynchronous IO"
2033 .help = "Memory mapped IO"
2035 #ifdef CONFIG_LINUX_SPLICE
2037 .help = "splice/vmsplice based IO",
2039 { .ival = "netsplice",
2040 .help = "splice/vmsplice to/from the network",
2043 #ifdef FIO_HAVE_SGIO
2045 .help = "SCSI generic v3 IO",
2049 .help = "Testing engine (no data transfer)",
2052 .help = "Network IO",
2055 .help = "CPU cycle burner engine",
2059 .help = "RDMA IO engine",
2062 #ifdef CONFIG_LIBRPMA_APM
2063 { .ival = "librpma_apm",
2064 .help = "librpma IO engine in APM mode",
2067 #ifdef CONFIG_LIBRPMA_GPSPM
2068 { .ival = "librpma_gpspm",
2069 .help = "librpma IO engine in GPSPM mode",
2072 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
2073 { .ival = "e4defrag",
2074 .help = "ext4 defrag engine",
2077 #ifdef CONFIG_LINUX_FALLOCATE
2079 .help = "fallocate() file based engine",
2084 .help = "Glusterfs libgfapi(sync) based engine"
2086 { .ival = "gfapi_async",
2087 .help = "Glusterfs libgfapi(async) based engine"
2090 #ifdef CONFIG_LIBHDFS
2091 { .ival = "libhdfs",
2092 .help = "Hadoop Distributed Filesystem (HDFS) engine"
2095 #ifdef CONFIG_PMEMBLK
2096 { .ival = "pmemblk",
2097 .help = "PMDK libpmemblk based IO engine",
2102 { .ival = "ime_psync",
2103 .help = "DDN's IME synchronous IO engine",
2105 { .ival = "ime_psyncv",
2106 .help = "DDN's IME synchronous IO engine using iovecs",
2108 { .ival = "ime_aio",
2109 .help = "DDN's IME asynchronous IO engine",
2112 #ifdef CONFIG_LINUX_DEVDAX
2113 { .ival = "dev-dax",
2114 .help = "DAX Device based IO engine",
2118 .ival = "filecreate",
2119 .help = "File creation engine",
2121 { .ival = "external",
2122 .help = "Load external engine (append name)",
2123 .cb = str_ioengine_external_cb,
2125 #ifdef CONFIG_LIBPMEM
2126 { .ival = "libpmem",
2127 .help = "PMDK libpmem based IO engine",
2132 .help = "HTTP (WebDAV/S3) IO engine",
2136 .help = "Network Block Device (NBD) IO engine"
2140 .help = "DAOS File System (dfs) IO engine",
2145 .help = "NFS IO engine",
2148 #ifdef CONFIG_LIBXNVME
2150 .help = "XNVME IO engine",
2157 .lname = "IO Depth",
2158 .type = FIO_OPT_INT,
2159 .off1 = offsetof(struct thread_options, iodepth),
2160 .help = "Number of IO buffers to keep in flight",
2164 .category = FIO_OPT_C_IO,
2165 .group = FIO_OPT_G_IO_BASIC,
2168 .name = "iodepth_batch",
2169 .lname = "IO Depth batch",
2170 .alias = "iodepth_batch_submit",
2171 .type = FIO_OPT_INT,
2172 .off1 = offsetof(struct thread_options, iodepth_batch),
2173 .help = "Number of IO buffers to submit in one go",
2174 .parent = "iodepth",
2178 .category = FIO_OPT_C_IO,
2179 .group = FIO_OPT_G_IO_BASIC,
2182 .name = "iodepth_batch_complete_min",
2183 .lname = "Min IO depth batch complete",
2184 .alias = "iodepth_batch_complete",
2185 .type = FIO_OPT_INT,
2186 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
2187 .help = "Min number of IO buffers to retrieve in one go",
2188 .parent = "iodepth",
2193 .category = FIO_OPT_C_IO,
2194 .group = FIO_OPT_G_IO_BASIC,
2197 .name = "iodepth_batch_complete_max",
2198 .lname = "Max IO depth batch complete",
2199 .type = FIO_OPT_INT,
2200 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
2201 .help = "Max number of IO buffers to retrieve in one go",
2202 .parent = "iodepth",
2206 .category = FIO_OPT_C_IO,
2207 .group = FIO_OPT_G_IO_BASIC,
2210 .name = "iodepth_low",
2211 .lname = "IO Depth batch low",
2212 .type = FIO_OPT_INT,
2213 .off1 = offsetof(struct thread_options, iodepth_low),
2214 .help = "Low water mark for queuing depth",
2215 .parent = "iodepth",
2218 .category = FIO_OPT_C_IO,
2219 .group = FIO_OPT_G_IO_BASIC,
2222 .name = "serialize_overlap",
2223 .lname = "Serialize overlap",
2224 .off1 = offsetof(struct thread_options, serialize_overlap),
2225 .type = FIO_OPT_BOOL,
2226 .help = "Wait for in-flight IOs that collide to complete",
2227 .parent = "iodepth",
2229 .category = FIO_OPT_C_IO,
2230 .group = FIO_OPT_G_IO_BASIC,
2233 .name = "io_submit_mode",
2234 .lname = "IO submit mode",
2235 .type = FIO_OPT_STR,
2236 .off1 = offsetof(struct thread_options, io_submit_mode),
2237 .help = "How IO submissions and completions are done",
2239 .category = FIO_OPT_C_IO,
2240 .group = FIO_OPT_G_IO_BASIC,
2243 .oval = IO_MODE_INLINE,
2244 .help = "Submit and complete IO inline",
2246 { .ival = "offload",
2247 .oval = IO_MODE_OFFLOAD,
2248 .help = "Offload submit and complete to threads",
2255 .type = FIO_OPT_STR_VAL_ZONE,
2257 .off1 = offsetof(struct thread_options, size),
2258 .help = "Total size of device or files",
2259 .category = FIO_OPT_C_IO,
2260 .group = FIO_OPT_G_INVALID,
2264 .alias = "io_limit",
2266 .type = FIO_OPT_STR_VAL_ZONE,
2267 .cb = str_io_size_cb,
2268 .off1 = offsetof(struct thread_options, io_size),
2269 .help = "Total size of I/O to be performed",
2270 .category = FIO_OPT_C_IO,
2271 .group = FIO_OPT_G_INVALID,
2274 .name = "fill_device",
2275 .lname = "Fill device",
2277 .type = FIO_OPT_BOOL,
2278 .off1 = offsetof(struct thread_options, fill_device),
2279 .help = "Write until an ENOSPC error occurs",
2281 .category = FIO_OPT_C_FILE,
2282 .group = FIO_OPT_G_INVALID,
2286 .lname = "File size",
2287 .type = FIO_OPT_STR_VAL,
2288 .off1 = offsetof(struct thread_options, file_size_low),
2289 .off2 = offsetof(struct thread_options, file_size_high),
2291 .help = "Size of individual files",
2292 .interval = 1024 * 1024,
2293 .category = FIO_OPT_C_FILE,
2294 .group = FIO_OPT_G_INVALID,
2297 .name = "file_append",
2298 .lname = "File append",
2299 .type = FIO_OPT_BOOL,
2300 .off1 = offsetof(struct thread_options, file_append),
2301 .help = "IO will start at the end of the file(s)",
2303 .category = FIO_OPT_C_FILE,
2304 .group = FIO_OPT_G_INVALID,
2308 .lname = "IO offset",
2309 .alias = "fileoffset",
2310 .type = FIO_OPT_STR_VAL_ZONE,
2311 .cb = str_offset_cb,
2312 .off1 = offsetof(struct thread_options, start_offset),
2313 .help = "Start IO from this offset",
2315 .category = FIO_OPT_C_IO,
2316 .group = FIO_OPT_G_INVALID,
2319 .name = "offset_align",
2320 .lname = "IO offset alignment",
2321 .type = FIO_OPT_INT,
2322 .off1 = offsetof(struct thread_options, start_offset_align),
2323 .help = "Start IO from this offset alignment",
2326 .category = FIO_OPT_C_IO,
2327 .group = FIO_OPT_G_INVALID,
2330 .name = "offset_increment",
2331 .lname = "IO offset increment",
2332 .type = FIO_OPT_STR_VAL_ZONE,
2333 .cb = str_offset_increment_cb,
2334 .off1 = offsetof(struct thread_options, offset_increment),
2335 .help = "What is the increment from one offset to the next",
2339 .category = FIO_OPT_C_IO,
2340 .group = FIO_OPT_G_INVALID,
2343 .name = "number_ios",
2344 .lname = "Number of IOs to perform",
2345 .type = FIO_OPT_STR_VAL,
2346 .off1 = offsetof(struct thread_options, number_ios),
2347 .help = "Force job completion after this number of IOs",
2349 .category = FIO_OPT_C_IO,
2350 .group = FIO_OPT_G_INVALID,
2354 .lname = "Block size",
2355 .alias = "blocksize",
2356 .type = FIO_OPT_ULL,
2357 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2358 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2359 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2361 .help = "Block size unit",
2366 .category = FIO_OPT_C_IO,
2367 .group = FIO_OPT_G_INVALID,
2371 .lname = "Block size align",
2372 .alias = "blockalign",
2373 .type = FIO_OPT_ULL,
2374 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2375 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2376 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2378 .help = "IO block offset alignment",
2382 .category = FIO_OPT_C_IO,
2383 .group = FIO_OPT_G_INVALID,
2387 .lname = "Block size range",
2388 .alias = "blocksize_range",
2389 .type = FIO_OPT_RANGE,
2390 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2391 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2392 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2393 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2394 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2395 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2397 .help = "Set block size range (in more detail than bs)",
2401 .category = FIO_OPT_C_IO,
2402 .group = FIO_OPT_G_INVALID,
2406 .lname = "Block size split",
2407 .type = FIO_OPT_STR_ULL,
2408 .cb = str_bssplit_cb,
2409 .off1 = offsetof(struct thread_options, bssplit),
2410 .help = "Set a specific mix of block sizes",
2413 .category = FIO_OPT_C_IO,
2414 .group = FIO_OPT_G_INVALID,
2417 .name = "bs_unaligned",
2418 .lname = "Block size unaligned",
2419 .alias = "blocksize_unaligned",
2420 .type = FIO_OPT_STR_SET,
2421 .off1 = offsetof(struct thread_options, bs_unaligned),
2422 .help = "Don't sector align IO buffer sizes",
2425 .category = FIO_OPT_C_IO,
2426 .group = FIO_OPT_G_INVALID,
2429 .name = "bs_is_seq_rand",
2430 .lname = "Block size division is seq/random (not read/write)",
2431 .type = FIO_OPT_BOOL,
2432 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2433 .help = "Consider any blocksize setting to be sequential,random",
2435 .parent = "blocksize",
2436 .category = FIO_OPT_C_IO,
2437 .group = FIO_OPT_G_INVALID,
2440 .name = "randrepeat",
2441 .lname = "Random repeatable",
2442 .type = FIO_OPT_BOOL,
2443 .off1 = offsetof(struct thread_options, rand_repeatable),
2444 .help = "Use repeatable random IO pattern",
2448 .category = FIO_OPT_C_IO,
2449 .group = FIO_OPT_G_RANDOM,
2453 .lname = "The random generator seed",
2454 .type = FIO_OPT_STR_VAL,
2455 .off1 = offsetof(struct thread_options, rand_seed),
2456 .help = "Set the random generator seed value",
2459 .category = FIO_OPT_C_IO,
2460 .group = FIO_OPT_G_RANDOM,
2463 .name = "norandommap",
2464 .lname = "No randommap",
2465 .type = FIO_OPT_STR_SET,
2466 .off1 = offsetof(struct thread_options, norandommap),
2467 .help = "Accept potential duplicate random blocks",
2471 .category = FIO_OPT_C_IO,
2472 .group = FIO_OPT_G_RANDOM,
2475 .name = "softrandommap",
2476 .lname = "Soft randommap",
2477 .type = FIO_OPT_BOOL,
2478 .off1 = offsetof(struct thread_options, softrandommap),
2479 .help = "Set norandommap if randommap allocation fails",
2480 .parent = "norandommap",
2483 .category = FIO_OPT_C_IO,
2484 .group = FIO_OPT_G_RANDOM,
2487 .name = "random_generator",
2488 .lname = "Random Generator",
2489 .type = FIO_OPT_STR,
2490 .off1 = offsetof(struct thread_options, random_generator),
2491 .help = "Type of random number generator to use",
2492 .def = "tausworthe",
2494 { .ival = "tausworthe",
2495 .oval = FIO_RAND_GEN_TAUSWORTHE,
2496 .help = "Strong Tausworthe generator",
2499 .oval = FIO_RAND_GEN_LFSR,
2500 .help = "Variable length LFSR",
2503 .ival = "tausworthe64",
2504 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2505 .help = "64-bit Tausworthe variant",
2508 .category = FIO_OPT_C_IO,
2509 .group = FIO_OPT_G_RANDOM,
2512 .name = "random_distribution",
2513 .lname = "Random Distribution",
2514 .type = FIO_OPT_STR,
2515 .off1 = offsetof(struct thread_options, random_distribution),
2516 .cb = str_random_distribution_cb,
2517 .help = "Random offset distribution generator",
2521 .oval = FIO_RAND_DIST_RANDOM,
2522 .help = "Completely random",
2525 .oval = FIO_RAND_DIST_ZIPF,
2526 .help = "Zipf distribution",
2529 .oval = FIO_RAND_DIST_PARETO,
2530 .help = "Pareto distribution",
2533 .oval = FIO_RAND_DIST_GAUSS,
2534 .help = "Normal (Gaussian) distribution",
2537 .oval = FIO_RAND_DIST_ZONED,
2538 .help = "Zoned random distribution",
2540 { .ival = "zoned_abs",
2541 .oval = FIO_RAND_DIST_ZONED_ABS,
2542 .help = "Zoned absolute random distribution",
2545 .category = FIO_OPT_C_IO,
2546 .group = FIO_OPT_G_RANDOM,
2549 .name = "percentage_random",
2550 .lname = "Percentage Random",
2551 .type = FIO_OPT_INT,
2552 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2553 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2554 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2556 .help = "Percentage of seq/random mix that should be random",
2557 .def = "100,100,100",
2559 .inverse = "percentage_sequential",
2560 .category = FIO_OPT_C_IO,
2561 .group = FIO_OPT_G_RANDOM,
2564 .name = "percentage_sequential",
2565 .lname = "Percentage Sequential",
2566 .type = FIO_OPT_DEPRECATED,
2567 .category = FIO_OPT_C_IO,
2568 .group = FIO_OPT_G_RANDOM,
2571 .name = "allrandrepeat",
2572 .lname = "All Random Repeat",
2573 .type = FIO_OPT_BOOL,
2574 .off1 = offsetof(struct thread_options, allrand_repeatable),
2575 .help = "Use repeatable random numbers for everything",
2577 .category = FIO_OPT_C_IO,
2578 .group = FIO_OPT_G_RANDOM,
2582 .lname = "Number of files",
2583 .alias = "nr_files",
2584 .type = FIO_OPT_INT,
2585 .off1 = offsetof(struct thread_options, nr_files),
2586 .help = "Split job workload between this number of files",
2589 .category = FIO_OPT_C_FILE,
2590 .group = FIO_OPT_G_INVALID,
2593 .name = "openfiles",
2594 .lname = "Number of open files",
2595 .type = FIO_OPT_INT,
2596 .off1 = offsetof(struct thread_options, open_files),
2597 .help = "Number of files to keep open at the same time",
2598 .category = FIO_OPT_C_FILE,
2599 .group = FIO_OPT_G_INVALID,
2602 .name = "file_service_type",
2603 .lname = "File service type",
2604 .type = FIO_OPT_STR,
2606 .off1 = offsetof(struct thread_options, file_service_type),
2607 .help = "How to select which file to service next",
2608 .def = "roundrobin",
2609 .category = FIO_OPT_C_FILE,
2610 .group = FIO_OPT_G_INVALID,
2613 .oval = FIO_FSERVICE_RANDOM,
2614 .help = "Choose a file at random (uniform)",
2617 .oval = FIO_FSERVICE_ZIPF,
2618 .help = "Zipf randomized",
2621 .oval = FIO_FSERVICE_PARETO,
2622 .help = "Pareto randomized",
2625 .oval = FIO_FSERVICE_GAUSS,
2626 .help = "Normal (Gaussian) randomized",
2629 .oval = FIO_FSERVICE_GAUSS,
2630 .help = "Alias for normal",
2632 { .ival = "roundrobin",
2633 .oval = FIO_FSERVICE_RR,
2634 .help = "Round robin select files",
2636 { .ival = "sequential",
2637 .oval = FIO_FSERVICE_SEQ,
2638 .help = "Finish one file before moving to the next",
2641 .parent = "nrfiles",
2645 .name = "fallocate",
2646 .lname = "Fallocate",
2647 .type = FIO_OPT_STR,
2648 .off1 = offsetof(struct thread_options, fallocate_mode),
2649 .help = "Whether pre-allocation is performed when laying out files",
2650 #ifdef FIO_HAVE_DEFAULT_FALLOCATE
2655 .category = FIO_OPT_C_FILE,
2656 .group = FIO_OPT_G_INVALID,
2659 .oval = FIO_FALLOCATE_NONE,
2660 .help = "Do not pre-allocate space",
2663 .oval = FIO_FALLOCATE_NATIVE,
2664 .help = "Use native pre-allocation if possible",
2666 #ifdef CONFIG_POSIX_FALLOCATE
2668 .oval = FIO_FALLOCATE_POSIX,
2669 .help = "Use posix_fallocate()",
2672 #ifdef CONFIG_LINUX_FALLOCATE
2674 .oval = FIO_FALLOCATE_KEEP_SIZE,
2675 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2678 { .ival = "truncate",
2679 .oval = FIO_FALLOCATE_TRUNCATE,
2680 .help = "Truncate file to final size instead of allocating"
2682 /* Compatibility with former boolean values */
2684 .oval = FIO_FALLOCATE_NONE,
2685 .help = "Alias for 'none'",
2687 #ifdef CONFIG_POSIX_FALLOCATE
2689 .oval = FIO_FALLOCATE_POSIX,
2690 .help = "Alias for 'posix'",
2696 .name = "fadvise_hint",
2697 .lname = "Fadvise hint",
2698 .type = FIO_OPT_STR,
2699 .off1 = offsetof(struct thread_options, fadvise_hint),
2703 .help = "Don't issue fadvise/madvise",
2707 .help = "Advise using fio IO pattern",
2710 .oval = F_ADV_RANDOM,
2711 .help = "Advise using FADV_RANDOM",
2713 { .ival = "sequential",
2714 .oval = F_ADV_SEQUENTIAL,
2715 .help = "Advise using FADV_SEQUENTIAL",
2718 .help = "Use fadvise() to advise the kernel on IO pattern",
2720 .category = FIO_OPT_C_FILE,
2721 .group = FIO_OPT_G_INVALID,
2726 .type = FIO_OPT_INT,
2727 .off1 = offsetof(struct thread_options, fsync_blocks),
2728 .help = "Issue fsync for writes every given number of blocks",
2731 .category = FIO_OPT_C_FILE,
2732 .group = FIO_OPT_G_INVALID,
2735 .name = "fdatasync",
2736 .lname = "Fdatasync",
2737 .type = FIO_OPT_INT,
2738 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2739 .help = "Issue fdatasync for writes every given number of blocks",
2742 .category = FIO_OPT_C_FILE,
2743 .group = FIO_OPT_G_INVALID,
2746 .name = "write_barrier",
2747 .lname = "Write barrier",
2748 .type = FIO_OPT_INT,
2749 .off1 = offsetof(struct thread_options, barrier_blocks),
2750 .help = "Make every Nth write a barrier write",
2753 .category = FIO_OPT_C_IO,
2754 .group = FIO_OPT_G_INVALID,
2756 #ifdef CONFIG_SYNC_FILE_RANGE
2758 .name = "sync_file_range",
2759 .lname = "Sync file range",
2761 { .ival = "wait_before",
2762 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2763 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2767 .oval = SYNC_FILE_RANGE_WRITE,
2768 .help = "SYNC_FILE_RANGE_WRITE",
2772 .ival = "wait_after",
2773 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2774 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2778 .type = FIO_OPT_STR_MULTI,
2780 .off1 = offsetof(struct thread_options, sync_file_range),
2781 .help = "Use sync_file_range()",
2782 .category = FIO_OPT_C_FILE,
2783 .group = FIO_OPT_G_INVALID,
2787 .name = "sync_file_range",
2788 .lname = "Sync file range",
2789 .type = FIO_OPT_UNSUPPORTED,
2790 .help = "Your platform does not support sync_file_range",
2795 .lname = "Direct I/O",
2796 .type = FIO_OPT_BOOL,
2797 .off1 = offsetof(struct thread_options, odirect),
2798 .help = "Use O_DIRECT IO (negates buffered)",
2800 .inverse = "buffered",
2801 .category = FIO_OPT_C_IO,
2802 .group = FIO_OPT_G_IO_TYPE,
2806 .lname = "Atomic I/O",
2807 .type = FIO_OPT_BOOL,
2808 .off1 = offsetof(struct thread_options, oatomic),
2809 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2811 .category = FIO_OPT_C_IO,
2812 .group = FIO_OPT_G_IO_TYPE,
2816 .lname = "Buffered I/O",
2817 .type = FIO_OPT_BOOL,
2818 .off1 = offsetof(struct thread_options, odirect),
2820 .help = "Use buffered IO (negates direct)",
2822 .inverse = "direct",
2823 .category = FIO_OPT_C_IO,
2824 .group = FIO_OPT_G_IO_TYPE,
2827 .name = "overwrite",
2828 .lname = "Overwrite",
2829 .type = FIO_OPT_BOOL,
2830 .off1 = offsetof(struct thread_options, overwrite),
2831 .help = "When writing, set whether to overwrite current data",
2833 .category = FIO_OPT_C_FILE,
2834 .group = FIO_OPT_G_INVALID,
2839 .type = FIO_OPT_INT,
2840 .off1 = offsetof(struct thread_options, loops),
2841 .help = "Number of times to run the job",
2844 .category = FIO_OPT_C_GENERAL,
2845 .group = FIO_OPT_G_RUNTIME,
2849 .lname = "Number of jobs",
2850 .type = FIO_OPT_INT,
2851 .off1 = offsetof(struct thread_options, numjobs),
2852 .help = "Duplicate this job this many times",
2855 .category = FIO_OPT_C_GENERAL,
2856 .group = FIO_OPT_G_RUNTIME,
2859 .name = "startdelay",
2860 .lname = "Start delay",
2861 .type = FIO_OPT_STR_VAL_TIME,
2862 .off1 = offsetof(struct thread_options, start_delay),
2863 .off2 = offsetof(struct thread_options, start_delay_high),
2864 .help = "Only start job when this period has passed",
2868 .category = FIO_OPT_C_GENERAL,
2869 .group = FIO_OPT_G_RUNTIME,
2875 .type = FIO_OPT_STR_VAL_TIME,
2876 .off1 = offsetof(struct thread_options, timeout),
2877 .help = "Stop workload when this amount of time has passed",
2881 .category = FIO_OPT_C_GENERAL,
2882 .group = FIO_OPT_G_RUNTIME,
2885 .name = "time_based",
2886 .lname = "Time based",
2887 .type = FIO_OPT_STR_SET,
2888 .off1 = offsetof(struct thread_options, time_based),
2889 .help = "Keep running until runtime/timeout is met",
2890 .category = FIO_OPT_C_GENERAL,
2891 .group = FIO_OPT_G_RUNTIME,
2894 .name = "verify_only",
2895 .lname = "Verify only",
2896 .type = FIO_OPT_STR_SET,
2897 .off1 = offsetof(struct thread_options, verify_only),
2898 .help = "Verifies previously written data is still valid",
2899 .category = FIO_OPT_C_GENERAL,
2900 .group = FIO_OPT_G_RUNTIME,
2903 .name = "ramp_time",
2904 .lname = "Ramp time",
2905 .type = FIO_OPT_STR_VAL_TIME,
2906 .off1 = offsetof(struct thread_options, ramp_time),
2907 .help = "Ramp up time before measuring performance",
2910 .category = FIO_OPT_C_GENERAL,
2911 .group = FIO_OPT_G_RUNTIME,
2914 .name = "clocksource",
2915 .lname = "Clock source",
2916 .type = FIO_OPT_STR,
2917 .cb = fio_clock_source_cb,
2918 .off1 = offsetof(struct thread_options, clocksource),
2919 .help = "What type of timing source to use",
2920 .category = FIO_OPT_C_GENERAL,
2921 .group = FIO_OPT_G_CLOCK,
2923 #ifdef CONFIG_GETTIMEOFDAY
2924 { .ival = "gettimeofday",
2926 .help = "Use gettimeofday(2) for timing",
2929 #ifdef CONFIG_CLOCK_GETTIME
2930 { .ival = "clock_gettime",
2931 .oval = CS_CGETTIME,
2932 .help = "Use clock_gettime(2) for timing",
2935 #ifdef ARCH_HAVE_CPU_CLOCK
2937 .oval = CS_CPUCLOCK,
2938 .help = "Use CPU private clock",
2946 .lname = "I/O Memory",
2947 .type = FIO_OPT_STR,
2949 .off1 = offsetof(struct thread_options, mem_type),
2950 .help = "Backing type for IO buffers",
2952 .category = FIO_OPT_C_IO,
2953 .group = FIO_OPT_G_INVALID,
2957 .help = "Use malloc(3) for IO buffers",
2959 #ifndef CONFIG_NO_SHM
2962 .help = "Use shared memory segments for IO buffers",
2964 #ifdef FIO_HAVE_HUGETLB
2965 { .ival = "shmhuge",
2966 .oval = MEM_SHMHUGE,
2967 .help = "Like shm, but use huge pages",
2973 .help = "Use mmap(2) (file or anon) for IO buffers",
2975 { .ival = "mmapshared",
2976 .oval = MEM_MMAPSHARED,
2977 .help = "Like mmap, but use the shared flag",
2979 #ifdef FIO_HAVE_HUGETLB
2980 { .ival = "mmaphuge",
2981 .oval = MEM_MMAPHUGE,
2982 .help = "Like mmap, but use huge pages",
2986 { .ival = "cudamalloc",
2987 .oval = MEM_CUDA_MALLOC,
2988 .help = "Allocate GPU device memory for GPUDirect RDMA",
2994 .name = "iomem_align",
2995 .alias = "mem_align",
2996 .lname = "I/O memory alignment",
2997 .type = FIO_OPT_INT,
2998 .off1 = offsetof(struct thread_options, mem_align),
3000 .help = "IO memory buffer offset alignment",
3004 .category = FIO_OPT_C_IO,
3005 .group = FIO_OPT_G_INVALID,
3010 .type = FIO_OPT_STR,
3011 .off1 = offsetof(struct thread_options, verify),
3012 .help = "Verify data written",
3014 .category = FIO_OPT_C_IO,
3015 .group = FIO_OPT_G_VERIFY,
3018 .oval = VERIFY_NONE,
3019 .help = "Don't do IO verification",
3023 .help = "Use md5 checksums for verification",
3026 .oval = VERIFY_CRC64,
3027 .help = "Use crc64 checksums for verification",
3030 .oval = VERIFY_CRC32,
3031 .help = "Use crc32 checksums for verification",
3033 { .ival = "crc32c-intel",
3034 .oval = VERIFY_CRC32C,
3035 .help = "Use crc32c checksums for verification (hw assisted, if available)",
3038 .oval = VERIFY_CRC32C,
3039 .help = "Use crc32c checksums for verification (hw assisted, if available)",
3042 .oval = VERIFY_CRC16,
3043 .help = "Use crc16 checksums for verification",
3046 .oval = VERIFY_CRC7,
3047 .help = "Use crc7 checksums for verification",
3050 .oval = VERIFY_SHA1,
3051 .help = "Use sha1 checksums for verification",
3054 .oval = VERIFY_SHA256,
3055 .help = "Use sha256 checksums for verification",
3058 .oval = VERIFY_SHA512,
3059 .help = "Use sha512 checksums for verification",
3061 { .ival = "sha3-224",
3062 .oval = VERIFY_SHA3_224,
3063 .help = "Use sha3-224 checksums for verification",
3065 { .ival = "sha3-256",
3066 .oval = VERIFY_SHA3_256,
3067 .help = "Use sha3-256 checksums for verification",
3069 { .ival = "sha3-384",
3070 .oval = VERIFY_SHA3_384,
3071 .help = "Use sha3-384 checksums for verification",
3073 { .ival = "sha3-512",
3074 .oval = VERIFY_SHA3_512,
3075 .help = "Use sha3-512 checksums for verification",
3078 .oval = VERIFY_XXHASH,
3079 .help = "Use xxhash checksums for verification",
3081 /* Meta information was included into verify_header,
3082 * 'meta' verification is implied by default. */
3084 .oval = VERIFY_HDR_ONLY,
3085 .help = "Use io information for verification. "
3086 "Now is implied by default, thus option is obsolete, "
3089 { .ival = "pattern",
3090 .oval = VERIFY_PATTERN_NO_HDR,
3091 .help = "Verify strict pattern",
3095 .oval = VERIFY_NULL,
3096 .help = "Pretend to verify",
3101 .name = "do_verify",
3102 .lname = "Perform verify step",
3103 .type = FIO_OPT_BOOL,
3104 .off1 = offsetof(struct thread_options, do_verify),
3105 .help = "Run verification stage after write",
3109 .category = FIO_OPT_C_IO,
3110 .group = FIO_OPT_G_VERIFY,
3113 .name = "verifysort",
3114 .lname = "Verify sort",
3115 .type = FIO_OPT_SOFT_DEPRECATED,
3116 .category = FIO_OPT_C_IO,
3117 .group = FIO_OPT_G_VERIFY,
3120 .name = "verifysort_nr",
3121 .lname = "Verify Sort Nr",
3122 .type = FIO_OPT_SOFT_DEPRECATED,
3123 .category = FIO_OPT_C_IO,
3124 .group = FIO_OPT_G_VERIFY,
3127 .name = "verify_interval",
3128 .lname = "Verify interval",
3129 .type = FIO_OPT_INT,
3130 .off1 = offsetof(struct thread_options, verify_interval),
3131 .minval = 2 * sizeof(struct verify_header),
3132 .help = "Store verify buffer header every N bytes",
3135 .interval = 2 * sizeof(struct verify_header),
3136 .category = FIO_OPT_C_IO,
3137 .group = FIO_OPT_G_VERIFY,
3140 .name = "verify_offset",
3141 .lname = "Verify offset",
3142 .type = FIO_OPT_INT,
3143 .help = "Offset verify header location by N bytes",
3144 .off1 = offsetof(struct thread_options, verify_offset),
3145 .minval = sizeof(struct verify_header),
3148 .category = FIO_OPT_C_IO,
3149 .group = FIO_OPT_G_VERIFY,
3152 .name = "verify_pattern",
3153 .lname = "Verify pattern",
3154 .type = FIO_OPT_STR,
3155 .cb = str_verify_pattern_cb,
3156 .off1 = offsetof(struct thread_options, verify_pattern),
3157 .help = "Fill pattern for IO buffers",
3160 .category = FIO_OPT_C_IO,
3161 .group = FIO_OPT_G_VERIFY,
3164 .name = "verify_fatal",
3165 .lname = "Verify fatal",
3166 .type = FIO_OPT_BOOL,
3167 .off1 = offsetof(struct thread_options, verify_fatal),
3169 .help = "Exit on a single verify failure, don't continue",
3172 .category = FIO_OPT_C_IO,
3173 .group = FIO_OPT_G_VERIFY,
3176 .name = "verify_dump",
3177 .lname = "Verify dump",
3178 .type = FIO_OPT_BOOL,
3179 .off1 = offsetof(struct thread_options, verify_dump),
3181 .help = "Dump contents of good and bad blocks on failure",
3184 .category = FIO_OPT_C_IO,
3185 .group = FIO_OPT_G_VERIFY,
3188 .name = "verify_async",
3189 .lname = "Verify asynchronously",
3190 .type = FIO_OPT_INT,
3191 .off1 = offsetof(struct thread_options, verify_async),
3193 .help = "Number of async verifier threads to use",
3196 .category = FIO_OPT_C_IO,
3197 .group = FIO_OPT_G_VERIFY,
3200 .name = "verify_backlog",
3201 .lname = "Verify backlog",
3202 .type = FIO_OPT_STR_VAL,
3203 .off1 = offsetof(struct thread_options, verify_backlog),
3204 .help = "Verify after this number of blocks are written",
3207 .category = FIO_OPT_C_IO,
3208 .group = FIO_OPT_G_VERIFY,
3211 .name = "verify_backlog_batch",
3212 .lname = "Verify backlog batch",
3213 .type = FIO_OPT_INT,
3214 .off1 = offsetof(struct thread_options, verify_batch),
3215 .help = "Verify this number of IO blocks",
3218 .category = FIO_OPT_C_IO,
3219 .group = FIO_OPT_G_VERIFY,
3221 #ifdef FIO_HAVE_CPU_AFFINITY
3223 .name = "verify_async_cpus",
3224 .lname = "Async verify CPUs",
3225 .type = FIO_OPT_STR,
3226 .cb = str_verify_cpus_allowed_cb,
3227 .off1 = offsetof(struct thread_options, verify_cpumask),
3228 .help = "Set CPUs allowed for async verify threads",
3229 .parent = "verify_async",
3231 .category = FIO_OPT_C_IO,
3232 .group = FIO_OPT_G_VERIFY,
3236 .name = "verify_async_cpus",
3237 .lname = "Async verify CPUs",
3238 .type = FIO_OPT_UNSUPPORTED,
3239 .help = "Your platform does not support CPU affinities",
3243 .name = "experimental_verify",
3244 .lname = "Experimental Verify",
3245 .off1 = offsetof(struct thread_options, experimental_verify),
3246 .type = FIO_OPT_BOOL,
3247 .help = "Enable experimental verification",
3249 .category = FIO_OPT_C_IO,
3250 .group = FIO_OPT_G_VERIFY,
3253 .name = "verify_state_load",
3254 .lname = "Load verify state",
3255 .off1 = offsetof(struct thread_options, verify_state),
3256 .type = FIO_OPT_BOOL,
3257 .help = "Load verify termination state",
3259 .category = FIO_OPT_C_IO,
3260 .group = FIO_OPT_G_VERIFY,
3263 .name = "verify_state_save",
3264 .lname = "Save verify state",
3265 .off1 = offsetof(struct thread_options, verify_state_save),
3266 .type = FIO_OPT_BOOL,
3268 .help = "Save verify state on termination",
3270 .category = FIO_OPT_C_IO,
3271 .group = FIO_OPT_G_VERIFY,
3273 #ifdef FIO_HAVE_TRIM
3275 .name = "trim_percentage",
3276 .lname = "Trim percentage",
3277 .type = FIO_OPT_INT,
3278 .off1 = offsetof(struct thread_options, trim_percentage),
3281 .help = "Number of verify blocks to trim (i.e., discard)",
3286 .category = FIO_OPT_C_IO,
3287 .group = FIO_OPT_G_TRIM,
3290 .name = "trim_verify_zero",
3291 .lname = "Verify trim zero",
3292 .type = FIO_OPT_BOOL,
3293 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3294 .off1 = offsetof(struct thread_options, trim_zero),
3295 .parent = "trim_percentage",
3298 .category = FIO_OPT_C_IO,
3299 .group = FIO_OPT_G_TRIM,
3302 .name = "trim_backlog",
3303 .lname = "Trim backlog",
3304 .type = FIO_OPT_STR_VAL,
3305 .off1 = offsetof(struct thread_options, trim_backlog),
3306 .help = "Trim after this number of blocks are written",
3307 .parent = "trim_percentage",
3310 .category = FIO_OPT_C_IO,
3311 .group = FIO_OPT_G_TRIM,
3314 .name = "trim_backlog_batch",
3315 .lname = "Trim backlog batch",
3316 .type = FIO_OPT_INT,
3317 .off1 = offsetof(struct thread_options, trim_batch),
3318 .help = "Trim this number of IO blocks",
3319 .parent = "trim_percentage",
3322 .category = FIO_OPT_C_IO,
3323 .group = FIO_OPT_G_TRIM,
3327 .name = "trim_percentage",
3328 .lname = "Trim percentage",
3329 .type = FIO_OPT_UNSUPPORTED,
3330 .help = "Fio does not support TRIM on your platform",
3333 .name = "trim_verify_zero",
3334 .lname = "Verify trim zero",
3335 .type = FIO_OPT_UNSUPPORTED,
3336 .help = "Fio does not support TRIM on your platform",
3339 .name = "trim_backlog",
3340 .lname = "Trim backlog",
3341 .type = FIO_OPT_UNSUPPORTED,
3342 .help = "Fio does not support TRIM on your platform",
3345 .name = "trim_backlog_batch",
3346 .lname = "Trim backlog batch",
3347 .type = FIO_OPT_UNSUPPORTED,
3348 .help = "Fio does not support TRIM on your platform",
3352 .name = "write_iolog",
3353 .lname = "Write I/O log",
3354 .type = FIO_OPT_STR_STORE,
3355 .off1 = offsetof(struct thread_options, write_iolog_file),
3356 .help = "Store IO pattern to file",
3357 .category = FIO_OPT_C_IO,
3358 .group = FIO_OPT_G_IOLOG,
3361 .name = "read_iolog",
3362 .lname = "Read I/O log",
3363 .type = FIO_OPT_STR_STORE,
3364 .off1 = offsetof(struct thread_options, read_iolog_file),
3365 .help = "Playback IO pattern from file",
3366 .category = FIO_OPT_C_IO,
3367 .group = FIO_OPT_G_IOLOG,
3370 .name = "read_iolog_chunked",
3371 .lname = "Read I/O log in parts",
3372 .type = FIO_OPT_BOOL,
3373 .off1 = offsetof(struct thread_options, read_iolog_chunked),
3375 .parent = "read_iolog",
3376 .help = "Parse IO pattern in chunks",
3377 .category = FIO_OPT_C_IO,
3378 .group = FIO_OPT_G_IOLOG,
3381 .name = "replay_no_stall",
3382 .lname = "Don't stall on replay",
3383 .type = FIO_OPT_BOOL,
3384 .off1 = offsetof(struct thread_options, no_stall),
3386 .parent = "read_iolog",
3388 .help = "Playback IO pattern file as fast as possible without stalls",
3389 .category = FIO_OPT_C_IO,
3390 .group = FIO_OPT_G_IOLOG,
3393 .name = "replay_redirect",
3394 .lname = "Redirect device for replay",
3395 .type = FIO_OPT_STR_STORE,
3396 .off1 = offsetof(struct thread_options, replay_redirect),
3397 .parent = "read_iolog",
3399 .help = "Replay all I/O onto this device, regardless of trace device",
3400 .category = FIO_OPT_C_IO,
3401 .group = FIO_OPT_G_IOLOG,
3404 .name = "replay_scale",
3405 .lname = "Replace offset scale factor",
3406 .type = FIO_OPT_INT,
3407 .off1 = offsetof(struct thread_options, replay_scale),
3408 .parent = "read_iolog",
3410 .help = "Align offsets to this blocksize",
3411 .category = FIO_OPT_C_IO,
3412 .group = FIO_OPT_G_IOLOG,
3415 .name = "replay_align",
3416 .lname = "Replace alignment",
3417 .type = FIO_OPT_INT,
3418 .off1 = offsetof(struct thread_options, replay_align),
3419 .parent = "read_iolog",
3420 .help = "Scale offset down by this factor",
3421 .category = FIO_OPT_C_IO,
3422 .group = FIO_OPT_G_IOLOG,
3426 .name = "replay_time_scale",
3427 .lname = "Replay Time Scale",
3428 .type = FIO_OPT_INT,
3429 .off1 = offsetof(struct thread_options, replay_time_scale),
3432 .parent = "read_iolog",
3434 .help = "Scale time for replay events",
3435 .category = FIO_OPT_C_IO,
3436 .group = FIO_OPT_G_IOLOG,
3439 .name = "replay_skip",
3440 .lname = "Replay Skip",
3441 .type = FIO_OPT_STR,
3442 .cb = str_replay_skip_cb,
3443 .off1 = offsetof(struct thread_options, replay_skip),
3444 .parent = "read_iolog",
3445 .help = "Skip certain IO types (read,write,trim,flush)",
3446 .category = FIO_OPT_C_IO,
3447 .group = FIO_OPT_G_IOLOG,
3450 .name = "merge_blktrace_file",
3451 .lname = "Merged blktrace output filename",
3452 .type = FIO_OPT_STR_STORE,
3453 .off1 = offsetof(struct thread_options, merge_blktrace_file),
3454 .help = "Merged blktrace output filename",
3455 .category = FIO_OPT_C_IO,
3456 .group = FIO_OPT_G_IOLOG,
3459 .name = "merge_blktrace_scalars",
3460 .lname = "Percentage to scale each trace",
3461 .type = FIO_OPT_FLOAT_LIST,
3462 .off1 = offsetof(struct thread_options, merge_blktrace_scalars),
3463 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3464 .help = "Percentage to scale each trace",
3465 .category = FIO_OPT_C_IO,
3466 .group = FIO_OPT_G_IOLOG,
3469 .name = "merge_blktrace_iters",
3470 .lname = "Number of iterations to run per trace",
3471 .type = FIO_OPT_FLOAT_LIST,
3472 .off1 = offsetof(struct thread_options, merge_blktrace_iters),
3473 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3474 .help = "Number of iterations to run per trace",
3475 .category = FIO_OPT_C_IO,
3476 .group = FIO_OPT_G_IOLOG,
3479 .name = "exec_prerun",
3480 .lname = "Pre-execute runnable",
3481 .type = FIO_OPT_STR_STORE,
3482 .off1 = offsetof(struct thread_options, exec_prerun),
3483 .help = "Execute this file prior to running job",
3484 .category = FIO_OPT_C_GENERAL,
3485 .group = FIO_OPT_G_INVALID,
3488 .name = "exec_postrun",
3489 .lname = "Post-execute runnable",
3490 .type = FIO_OPT_STR_STORE,
3491 .off1 = offsetof(struct thread_options, exec_postrun),
3492 .help = "Execute this file after running job",
3493 .category = FIO_OPT_C_GENERAL,
3494 .group = FIO_OPT_G_INVALID,
3496 #ifdef FIO_HAVE_IOSCHED_SWITCH
3498 .name = "ioscheduler",
3499 .lname = "I/O scheduler",
3500 .type = FIO_OPT_STR_STORE,
3501 .off1 = offsetof(struct thread_options, ioscheduler),
3502 .help = "Use this IO scheduler on the backing device",
3503 .category = FIO_OPT_C_FILE,
3504 .group = FIO_OPT_G_INVALID,
3508 .name = "ioscheduler",
3509 .lname = "I/O scheduler",
3510 .type = FIO_OPT_UNSUPPORTED,
3511 .help = "Your platform does not support IO scheduler switching",
3516 .lname = "Zone mode",
3517 .help = "Mode for the zonesize, zonerange and zoneskip parameters",
3518 .type = FIO_OPT_STR,
3519 .off1 = offsetof(struct thread_options, zone_mode),
3521 .category = FIO_OPT_C_IO,
3522 .group = FIO_OPT_G_ZONE,
3525 .oval = ZONE_MODE_NONE,
3526 .help = "no zoning",
3528 { .ival = "strided",
3529 .oval = ZONE_MODE_STRIDED,
3530 .help = "strided mode - random I/O is restricted to a single zone",
3533 .oval = ZONE_MODE_ZBD,
3534 .help = "zoned block device mode - random I/O selects one of multiple zones randomly",
3540 .lname = "Zone size",
3541 .type = FIO_OPT_STR_VAL,
3542 .off1 = offsetof(struct thread_options, zone_size),
3543 .help = "Amount of data to read per zone",
3545 .interval = 1024 * 1024,
3546 .category = FIO_OPT_C_IO,
3547 .group = FIO_OPT_G_ZONE,
3550 .name = "zonecapacity",
3551 .lname = "Zone capacity",
3552 .type = FIO_OPT_STR_VAL,
3553 .off1 = offsetof(struct thread_options, zone_capacity),
3554 .help = "Capacity per zone",
3556 .interval = 1024 * 1024,
3557 .category = FIO_OPT_C_IO,
3558 .group = FIO_OPT_G_ZONE,
3561 .name = "zonerange",
3562 .lname = "Zone range",
3563 .type = FIO_OPT_STR_VAL,
3564 .off1 = offsetof(struct thread_options, zone_range),
3565 .help = "Give size of an IO zone",
3567 .interval = 1024 * 1024,
3568 .category = FIO_OPT_C_IO,
3569 .group = FIO_OPT_G_ZONE,
3573 .lname = "Zone skip",
3574 .type = FIO_OPT_STR_VAL_ZONE,
3575 .cb = str_zoneskip_cb,
3576 .off1 = offsetof(struct thread_options, zone_skip),
3577 .help = "Space between IO zones",
3579 .category = FIO_OPT_C_IO,
3580 .group = FIO_OPT_G_ZONE,
3583 .name = "read_beyond_wp",
3584 .lname = "Allow reads beyond the zone write pointer",
3585 .type = FIO_OPT_BOOL,
3586 .off1 = offsetof(struct thread_options, read_beyond_wp),
3587 .help = "Allow reads beyond the zone write pointer",
3589 .category = FIO_OPT_C_IO,
3590 .group = FIO_OPT_G_INVALID,
3593 .name = "max_open_zones",
3594 .lname = "Per device/file maximum number of open zones",
3595 .type = FIO_OPT_INT,
3596 .off1 = offsetof(struct thread_options, max_open_zones),
3597 .maxval = ZBD_MAX_OPEN_ZONES,
3598 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd",
3600 .category = FIO_OPT_C_IO,
3601 .group = FIO_OPT_G_INVALID,
3604 .name = "job_max_open_zones",
3605 .lname = "Job maximum number of open zones",
3606 .type = FIO_OPT_INT,
3607 .off1 = offsetof(struct thread_options, job_max_open_zones),
3608 .maxval = ZBD_MAX_OPEN_ZONES,
3609 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd by one thread/process",
3611 .category = FIO_OPT_C_IO,
3612 .group = FIO_OPT_G_INVALID,
3615 .name = "ignore_zone_limits",
3616 .lname = "Ignore zone resource limits",
3617 .type = FIO_OPT_BOOL,
3618 .off1 = offsetof(struct thread_options, ignore_zone_limits),
3620 .help = "Ignore the zone resource limits (max open/active zones) reported by the device",
3621 .category = FIO_OPT_C_IO,
3622 .group = FIO_OPT_G_INVALID,
3625 .name = "zone_reset_threshold",
3626 .lname = "Zone reset threshold",
3627 .help = "Zoned block device reset threshold",
3628 .type = FIO_OPT_FLOAT_LIST,
3630 .off1 = offsetof(struct thread_options, zrt),
3633 .category = FIO_OPT_C_IO,
3634 .group = FIO_OPT_G_ZONE,
3637 .name = "zone_reset_frequency",
3638 .lname = "Zone reset frequency",
3639 .help = "Zoned block device zone reset frequency in HZ",
3640 .type = FIO_OPT_FLOAT_LIST,
3642 .off1 = offsetof(struct thread_options, zrf),
3645 .category = FIO_OPT_C_IO,
3646 .group = FIO_OPT_G_ZONE,
3650 .lname = "Lock memory",
3651 .type = FIO_OPT_STR_VAL,
3652 .off1 = offsetof(struct thread_options, lockmem),
3653 .help = "Lock down this amount of memory (per worker)",
3655 .interval = 1024 * 1024,
3656 .category = FIO_OPT_C_GENERAL,
3657 .group = FIO_OPT_G_INVALID,
3660 .name = "rwmixread",
3661 .lname = "Read/write mix read",
3662 .type = FIO_OPT_INT,
3663 .cb = str_rwmix_read_cb,
3664 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3666 .help = "Percentage of mixed workload that is reads",
3669 .inverse = "rwmixwrite",
3670 .category = FIO_OPT_C_IO,
3671 .group = FIO_OPT_G_RWMIX,
3674 .name = "rwmixwrite",
3675 .lname = "Read/write mix write",
3676 .type = FIO_OPT_INT,
3677 .cb = str_rwmix_write_cb,
3678 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3680 .help = "Percentage of mixed workload that is writes",
3683 .inverse = "rwmixread",
3684 .category = FIO_OPT_C_IO,
3685 .group = FIO_OPT_G_RWMIX,
3688 .name = "rwmixcycle",
3689 .lname = "Read/write mix cycle",
3690 .type = FIO_OPT_DEPRECATED,
3691 .category = FIO_OPT_C_IO,
3692 .group = FIO_OPT_G_RWMIX,
3697 .type = FIO_OPT_INT,
3698 .off1 = offsetof(struct thread_options, nice),
3699 .help = "Set job CPU nice value",
3704 .category = FIO_OPT_C_GENERAL,
3705 .group = FIO_OPT_G_CRED,
3707 #ifdef FIO_HAVE_IOPRIO
3710 .lname = "I/O nice priority",
3711 .type = FIO_OPT_INT,
3712 .off1 = offsetof(struct thread_options, ioprio),
3713 .help = "Set job IO priority value",
3714 .minval = IOPRIO_MIN_PRIO,
3715 .maxval = IOPRIO_MAX_PRIO,
3717 .category = FIO_OPT_C_GENERAL,
3718 .group = FIO_OPT_G_CRED,
3723 .lname = "I/O nice priority",
3724 .type = FIO_OPT_UNSUPPORTED,
3725 .help = "Your platform does not support IO priorities",
3728 #ifdef FIO_HAVE_IOPRIO_CLASS
3729 #ifndef FIO_HAVE_IOPRIO
3730 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3733 .name = "prioclass",
3734 .lname = "I/O nice priority class",
3735 .type = FIO_OPT_INT,
3736 .off1 = offsetof(struct thread_options, ioprio_class),
3737 .help = "Set job IO priority class",
3738 .minval = IOPRIO_MIN_PRIO_CLASS,
3739 .maxval = IOPRIO_MAX_PRIO_CLASS,
3741 .category = FIO_OPT_C_GENERAL,
3742 .group = FIO_OPT_G_CRED,
3746 .name = "prioclass",
3747 .lname = "I/O nice priority class",
3748 .type = FIO_OPT_UNSUPPORTED,
3749 .help = "Your platform does not support IO priority classes",
3753 .name = "thinktime",
3754 .lname = "Thinktime",
3755 .type = FIO_OPT_INT,
3756 .off1 = offsetof(struct thread_options, thinktime),
3757 .help = "Idle time between IO buffers (usec)",
3760 .category = FIO_OPT_C_IO,
3761 .group = FIO_OPT_G_THINKTIME,
3764 .name = "thinktime_spin",
3765 .lname = "Thinktime spin",
3766 .type = FIO_OPT_INT,
3767 .off1 = offsetof(struct thread_options, thinktime_spin),
3768 .help = "Start think time by spinning this amount (usec)",
3771 .parent = "thinktime",
3773 .category = FIO_OPT_C_IO,
3774 .group = FIO_OPT_G_THINKTIME,
3777 .name = "thinktime_blocks",
3778 .lname = "Thinktime blocks",
3779 .type = FIO_OPT_INT,
3780 .off1 = offsetof(struct thread_options, thinktime_blocks),
3781 .help = "IO buffer period between 'thinktime'",
3783 .parent = "thinktime",
3785 .category = FIO_OPT_C_IO,
3786 .group = FIO_OPT_G_THINKTIME,
3789 .name = "thinktime_blocks_type",
3790 .lname = "Thinktime blocks type",
3791 .type = FIO_OPT_STR,
3792 .off1 = offsetof(struct thread_options, thinktime_blocks_type),
3793 .help = "How thinktime_blocks takes effect",
3795 .category = FIO_OPT_C_IO,
3796 .group = FIO_OPT_G_THINKTIME,
3798 { .ival = "complete",
3799 .oval = THINKTIME_BLOCKS_TYPE_COMPLETE,
3800 .help = "thinktime_blocks takes effect at the completion side",
3804 .oval = THINKTIME_BLOCKS_TYPE_ISSUE,
3805 .help = "thinktime_blocks takes effect at the issue side",
3808 .parent = "thinktime",
3811 .name = "thinktime_iotime",
3812 .lname = "Thinktime interval",
3813 .type = FIO_OPT_INT,
3814 .off1 = offsetof(struct thread_options, thinktime_iotime),
3815 .help = "IO time interval between 'thinktime'",
3817 .parent = "thinktime",
3821 .category = FIO_OPT_C_IO,
3822 .group = FIO_OPT_G_THINKTIME,
3826 .lname = "I/O rate",
3827 .type = FIO_OPT_ULL,
3828 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3829 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3830 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
3831 .help = "Set bandwidth rate",
3832 .category = FIO_OPT_C_IO,
3833 .group = FIO_OPT_G_RATE,
3838 .lname = "I/O min rate",
3839 .type = FIO_OPT_ULL,
3840 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
3841 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
3842 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
3843 .help = "Job must meet this rate or it will be shutdown",
3846 .category = FIO_OPT_C_IO,
3847 .group = FIO_OPT_G_RATE,
3850 .name = "rate_iops",
3851 .lname = "I/O rate IOPS",
3852 .type = FIO_OPT_INT,
3853 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
3854 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
3855 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
3856 .help = "Limit IO used to this number of IO operations/sec",
3858 .category = FIO_OPT_C_IO,
3859 .group = FIO_OPT_G_RATE,
3862 .name = "rate_iops_min",
3863 .lname = "I/O min rate IOPS",
3864 .type = FIO_OPT_INT,
3865 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
3866 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
3867 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
3868 .help = "Job must meet this rate or it will be shut down",
3869 .parent = "rate_iops",
3871 .category = FIO_OPT_C_IO,
3872 .group = FIO_OPT_G_RATE,
3875 .name = "rate_process",
3876 .lname = "Rate Process",
3877 .type = FIO_OPT_STR,
3878 .off1 = offsetof(struct thread_options, rate_process),
3879 .help = "What process controls how rated IO is managed",
3881 .category = FIO_OPT_C_IO,
3882 .group = FIO_OPT_G_RATE,
3885 .oval = RATE_PROCESS_LINEAR,
3886 .help = "Linear rate of IO",
3890 .oval = RATE_PROCESS_POISSON,
3891 .help = "Rate follows Poisson process",
3897 .name = "rate_cycle",
3898 .alias = "ratecycle",
3899 .lname = "I/O rate cycle",
3900 .type = FIO_OPT_INT,
3901 .off1 = offsetof(struct thread_options, ratecycle),
3902 .help = "Window average for rate limits (msec)",
3906 .category = FIO_OPT_C_IO,
3907 .group = FIO_OPT_G_RATE,
3910 .name = "rate_ignore_thinktime",
3911 .lname = "Rate ignore thinktime",
3912 .type = FIO_OPT_BOOL,
3913 .off1 = offsetof(struct thread_options, rate_ign_think),
3914 .help = "Rated IO ignores thinktime settings",
3916 .category = FIO_OPT_C_IO,
3917 .group = FIO_OPT_G_RATE,
3920 .name = "max_latency",
3921 .lname = "Max Latency (usec)",
3922 .type = FIO_OPT_ULL,
3923 .off1 = offsetof(struct thread_options, max_latency[DDIR_READ]),
3924 .off2 = offsetof(struct thread_options, max_latency[DDIR_WRITE]),
3925 .off3 = offsetof(struct thread_options, max_latency[DDIR_TRIM]),
3926 .help = "Maximum tolerated IO latency (usec)",
3928 .category = FIO_OPT_C_IO,
3929 .group = FIO_OPT_G_LATPROF,
3932 .name = "latency_target",
3933 .lname = "Latency Target (usec)",
3934 .type = FIO_OPT_STR_VAL_TIME,
3935 .off1 = offsetof(struct thread_options, latency_target),
3936 .help = "Ramp to max queue depth supporting this latency",
3938 .category = FIO_OPT_C_IO,
3939 .group = FIO_OPT_G_LATPROF,
3942 .name = "latency_window",
3943 .lname = "Latency Window (usec)",
3944 .type = FIO_OPT_STR_VAL_TIME,
3945 .off1 = offsetof(struct thread_options, latency_window),
3946 .help = "Time to sustain latency_target",
3948 .category = FIO_OPT_C_IO,
3949 .group = FIO_OPT_G_LATPROF,
3952 .name = "latency_percentile",
3953 .lname = "Latency Percentile",
3954 .type = FIO_OPT_FLOAT_LIST,
3955 .off1 = offsetof(struct thread_options, latency_percentile),
3956 .help = "Percentile of IOs must be below latency_target",
3961 .category = FIO_OPT_C_IO,
3962 .group = FIO_OPT_G_LATPROF,
3965 .name = "latency_run",
3966 .lname = "Latency Run",
3967 .type = FIO_OPT_BOOL,
3968 .off1 = offsetof(struct thread_options, latency_run),
3969 .help = "Keep adjusting queue depth to match latency_target",
3971 .category = FIO_OPT_C_IO,
3972 .group = FIO_OPT_G_LATPROF,
3975 .name = "invalidate",
3976 .lname = "Cache invalidate",
3977 .type = FIO_OPT_BOOL,
3978 .off1 = offsetof(struct thread_options, invalidate_cache),
3979 .help = "Invalidate buffer/page cache prior to running job",
3981 .category = FIO_OPT_C_IO,
3982 .group = FIO_OPT_G_IO_TYPE,
3986 .lname = "Synchronous I/O",
3987 .type = FIO_OPT_STR,
3988 .off1 = offsetof(struct thread_options, sync_io),
3989 .help = "Use synchronous write IO",
3992 .category = FIO_OPT_C_IO,
3993 .group = FIO_OPT_G_IO_TYPE,
4014 #ifdef FIO_HAVE_WRITE_HINT
4016 .name = "write_hint",
4017 .lname = "Write hint",
4018 .type = FIO_OPT_STR,
4019 .off1 = offsetof(struct thread_options, write_hint),
4020 .help = "Set expected write life time",
4021 .category = FIO_OPT_C_ENGINE,
4022 .group = FIO_OPT_G_INVALID,
4025 .oval = RWH_WRITE_LIFE_NONE,
4028 .oval = RWH_WRITE_LIFE_SHORT,
4031 .oval = RWH_WRITE_LIFE_MEDIUM,
4034 .oval = RWH_WRITE_LIFE_LONG,
4036 { .ival = "extreme",
4037 .oval = RWH_WRITE_LIFE_EXTREME,
4043 .name = "create_serialize",
4044 .lname = "Create serialize",
4045 .type = FIO_OPT_BOOL,
4046 .off1 = offsetof(struct thread_options, create_serialize),
4047 .help = "Serialize creation of job files",
4049 .category = FIO_OPT_C_FILE,
4050 .group = FIO_OPT_G_INVALID,
4053 .name = "create_fsync",
4054 .lname = "Create fsync",
4055 .type = FIO_OPT_BOOL,
4056 .off1 = offsetof(struct thread_options, create_fsync),
4057 .help = "fsync file after creation",
4059 .category = FIO_OPT_C_FILE,
4060 .group = FIO_OPT_G_INVALID,
4063 .name = "create_on_open",
4064 .lname = "Create on open",
4065 .type = FIO_OPT_BOOL,
4066 .off1 = offsetof(struct thread_options, create_on_open),
4067 .help = "Create files when they are opened for IO",
4069 .category = FIO_OPT_C_FILE,
4070 .group = FIO_OPT_G_INVALID,
4073 .name = "create_only",
4074 .lname = "Create Only",
4075 .type = FIO_OPT_BOOL,
4076 .off1 = offsetof(struct thread_options, create_only),
4077 .help = "Only perform file creation phase",
4078 .category = FIO_OPT_C_FILE,
4082 .name = "allow_file_create",
4083 .lname = "Allow file create",
4084 .type = FIO_OPT_BOOL,
4085 .off1 = offsetof(struct thread_options, allow_create),
4086 .help = "Permit fio to create files, if they don't exist",
4088 .category = FIO_OPT_C_FILE,
4089 .group = FIO_OPT_G_FILENAME,
4092 .name = "allow_mounted_write",
4093 .lname = "Allow mounted write",
4094 .type = FIO_OPT_BOOL,
4095 .off1 = offsetof(struct thread_options, allow_mounted_write),
4096 .help = "Allow writes to a mounted partition",
4098 .category = FIO_OPT_C_FILE,
4099 .group = FIO_OPT_G_FILENAME,
4103 .lname = "Pre-read files",
4104 .type = FIO_OPT_BOOL,
4105 .off1 = offsetof(struct thread_options, pre_read),
4106 .help = "Pre-read files before starting official testing",
4108 .category = FIO_OPT_C_FILE,
4109 .group = FIO_OPT_G_INVALID,
4111 #ifdef FIO_HAVE_CPU_AFFINITY
4114 .lname = "CPU mask",
4115 .type = FIO_OPT_INT,
4116 .cb = str_cpumask_cb,
4117 .off1 = offsetof(struct thread_options, cpumask),
4118 .help = "CPU affinity mask",
4119 .category = FIO_OPT_C_GENERAL,
4120 .group = FIO_OPT_G_CRED,
4123 .name = "cpus_allowed",
4124 .lname = "CPUs allowed",
4125 .type = FIO_OPT_STR,
4126 .cb = str_cpus_allowed_cb,
4127 .off1 = offsetof(struct thread_options, cpumask),
4128 .help = "Set CPUs allowed",
4129 .category = FIO_OPT_C_GENERAL,
4130 .group = FIO_OPT_G_CRED,
4133 .name = "cpus_allowed_policy",
4134 .lname = "CPUs allowed distribution policy",
4135 .type = FIO_OPT_STR,
4136 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
4137 .help = "Distribution policy for cpus_allowed",
4138 .parent = "cpus_allowed",
4142 .oval = FIO_CPUS_SHARED,
4143 .help = "Mask shared between threads",
4146 .oval = FIO_CPUS_SPLIT,
4147 .help = "Mask split between threads",
4150 .category = FIO_OPT_C_GENERAL,
4151 .group = FIO_OPT_G_CRED,
4156 .lname = "CPU mask",
4157 .type = FIO_OPT_UNSUPPORTED,
4158 .help = "Your platform does not support CPU affinities",
4161 .name = "cpus_allowed",
4162 .lname = "CPUs allowed",
4163 .type = FIO_OPT_UNSUPPORTED,
4164 .help = "Your platform does not support CPU affinities",
4167 .name = "cpus_allowed_policy",
4168 .lname = "CPUs allowed distribution policy",
4169 .type = FIO_OPT_UNSUPPORTED,
4170 .help = "Your platform does not support CPU affinities",
4173 #ifdef CONFIG_LIBNUMA
4175 .name = "numa_cpu_nodes",
4176 .lname = "NUMA CPU Nodes",
4177 .type = FIO_OPT_STR,
4178 .cb = str_numa_cpunodes_cb,
4179 .off1 = offsetof(struct thread_options, numa_cpunodes),
4180 .help = "NUMA CPU nodes bind",
4181 .category = FIO_OPT_C_GENERAL,
4182 .group = FIO_OPT_G_INVALID,
4185 .name = "numa_mem_policy",
4186 .lname = "NUMA Memory Policy",
4187 .type = FIO_OPT_STR,
4188 .cb = str_numa_mpol_cb,
4189 .off1 = offsetof(struct thread_options, numa_memnodes),
4190 .help = "NUMA memory policy setup",
4191 .category = FIO_OPT_C_GENERAL,
4192 .group = FIO_OPT_G_INVALID,
4196 .name = "numa_cpu_nodes",
4197 .lname = "NUMA CPU Nodes",
4198 .type = FIO_OPT_UNSUPPORTED,
4199 .help = "Build fio with libnuma-dev(el) to enable this option",
4202 .name = "numa_mem_policy",
4203 .lname = "NUMA Memory Policy",
4204 .type = FIO_OPT_UNSUPPORTED,
4205 .help = "Build fio with libnuma-dev(el) to enable this option",
4210 .name = "gpu_dev_id",
4211 .lname = "GPU device ID",
4212 .type = FIO_OPT_INT,
4213 .off1 = offsetof(struct thread_options, gpu_dev_id),
4214 .help = "Set GPU device ID for GPUDirect RDMA",
4216 .category = FIO_OPT_C_GENERAL,
4217 .group = FIO_OPT_G_INVALID,
4221 .name = "end_fsync",
4222 .lname = "End fsync",
4223 .type = FIO_OPT_BOOL,
4224 .off1 = offsetof(struct thread_options, end_fsync),
4225 .help = "Include fsync at the end of job",
4227 .category = FIO_OPT_C_FILE,
4228 .group = FIO_OPT_G_INVALID,
4231 .name = "fsync_on_close",
4232 .lname = "Fsync on close",
4233 .type = FIO_OPT_BOOL,
4234 .off1 = offsetof(struct thread_options, fsync_on_close),
4235 .help = "fsync files on close",
4237 .category = FIO_OPT_C_FILE,
4238 .group = FIO_OPT_G_INVALID,
4242 .lname = "Unlink file",
4243 .type = FIO_OPT_BOOL,
4244 .off1 = offsetof(struct thread_options, unlink),
4245 .help = "Unlink created files after job has completed",
4247 .category = FIO_OPT_C_FILE,
4248 .group = FIO_OPT_G_INVALID,
4251 .name = "unlink_each_loop",
4252 .lname = "Unlink file after each loop of a job",
4253 .type = FIO_OPT_BOOL,
4254 .off1 = offsetof(struct thread_options, unlink_each_loop),
4255 .help = "Unlink created files after each loop in a job has completed",
4257 .category = FIO_OPT_C_FILE,
4258 .group = FIO_OPT_G_INVALID,
4262 .lname = "Exit-all on terminate",
4263 .type = FIO_OPT_STR_SET,
4264 .cb = str_exitall_cb,
4265 .help = "Terminate all jobs when one exits",
4266 .category = FIO_OPT_C_GENERAL,
4267 .group = FIO_OPT_G_PROCESS,
4270 .name = "exit_what",
4271 .lname = "What jobs to quit on terminate",
4272 .type = FIO_OPT_STR,
4273 .off1 = offsetof(struct thread_options, exit_what),
4274 .help = "Fine-grained control for exitall",
4276 .category = FIO_OPT_C_GENERAL,
4277 .group = FIO_OPT_G_PROCESS,
4280 .oval = TERMINATE_GROUP,
4281 .help = "exit_all=1 default behaviour",
4283 { .ival = "stonewall",
4284 .oval = TERMINATE_STONEWALL,
4285 .help = "quit all currently running jobs; continue with next stonewall",
4288 .oval = TERMINATE_ALL,
4289 .help = "Quit everything",
4294 .name = "exitall_on_error",
4295 .lname = "Exit-all on terminate in error",
4296 .type = FIO_OPT_STR_SET,
4297 .off1 = offsetof(struct thread_options, exitall_error),
4298 .help = "Terminate all jobs when one exits in error",
4299 .category = FIO_OPT_C_GENERAL,
4300 .group = FIO_OPT_G_PROCESS,
4303 .name = "stonewall",
4304 .lname = "Wait for previous",
4305 .alias = "wait_for_previous",
4306 .type = FIO_OPT_STR_SET,
4307 .off1 = offsetof(struct thread_options, stonewall),
4308 .help = "Insert a hard barrier between this job and previous",
4309 .category = FIO_OPT_C_GENERAL,
4310 .group = FIO_OPT_G_PROCESS,
4313 .name = "new_group",
4314 .lname = "New group",
4315 .type = FIO_OPT_STR_SET,
4316 .off1 = offsetof(struct thread_options, new_group),
4317 .help = "Mark the start of a new group (for reporting)",
4318 .category = FIO_OPT_C_GENERAL,
4319 .group = FIO_OPT_G_PROCESS,
4324 .type = FIO_OPT_STR_SET,
4325 .off1 = offsetof(struct thread_options, use_thread),
4326 .help = "Use threads instead of processes",
4327 #ifdef CONFIG_NO_SHM
4331 .category = FIO_OPT_C_GENERAL,
4332 .group = FIO_OPT_G_PROCESS,
4335 .name = "per_job_logs",
4336 .lname = "Per Job Logs",
4337 .type = FIO_OPT_BOOL,
4338 .off1 = offsetof(struct thread_options, per_job_logs),
4339 .help = "Include job number in generated log files or not",
4341 .category = FIO_OPT_C_LOG,
4342 .group = FIO_OPT_G_INVALID,
4345 .name = "write_bw_log",
4346 .lname = "Write bandwidth log",
4347 .type = FIO_OPT_STR,
4348 .off1 = offsetof(struct thread_options, bw_log_file),
4349 .cb = str_write_bw_log_cb,
4350 .help = "Write log of bandwidth during run",
4351 .category = FIO_OPT_C_LOG,
4352 .group = FIO_OPT_G_INVALID,
4355 .name = "write_lat_log",
4356 .lname = "Write latency log",
4357 .type = FIO_OPT_STR,
4358 .off1 = offsetof(struct thread_options, lat_log_file),
4359 .cb = str_write_lat_log_cb,
4360 .help = "Write log of latency during run",
4361 .category = FIO_OPT_C_LOG,
4362 .group = FIO_OPT_G_INVALID,
4365 .name = "write_iops_log",
4366 .lname = "Write IOPS log",
4367 .type = FIO_OPT_STR,
4368 .off1 = offsetof(struct thread_options, iops_log_file),
4369 .cb = str_write_iops_log_cb,
4370 .help = "Write log of IOPS during run",
4371 .category = FIO_OPT_C_LOG,
4372 .group = FIO_OPT_G_INVALID,
4375 .name = "log_entries",
4376 .lname = "Log entries",
4377 .type = FIO_OPT_INT,
4378 .off1 = offsetof(struct thread_options, log_entries),
4379 .help = "Initial number of entries in a job IO log",
4380 .def = __fio_stringify(DEF_LOG_ENTRIES),
4381 .minval = DEF_LOG_ENTRIES,
4382 .maxval = MAX_LOG_ENTRIES,
4383 .category = FIO_OPT_C_LOG,
4384 .group = FIO_OPT_G_INVALID,
4387 .name = "log_avg_msec",
4388 .lname = "Log averaging (msec)",
4389 .type = FIO_OPT_INT,
4390 .off1 = offsetof(struct thread_options, log_avg_msec),
4391 .help = "Average bw/iops/lat logs over this period of time",
4393 .category = FIO_OPT_C_LOG,
4394 .group = FIO_OPT_G_INVALID,
4397 .name = "log_hist_msec",
4398 .lname = "Log histograms (msec)",
4399 .type = FIO_OPT_INT,
4400 .off1 = offsetof(struct thread_options, log_hist_msec),
4401 .help = "Dump completion latency histograms at frequency of this time value",
4403 .category = FIO_OPT_C_LOG,
4404 .group = FIO_OPT_G_INVALID,
4407 .name = "log_hist_coarseness",
4408 .lname = "Histogram logs coarseness",
4409 .type = FIO_OPT_INT,
4410 .off1 = offsetof(struct thread_options, log_hist_coarseness),
4411 .help = "Integer in range [0,6]. Higher coarseness outputs"
4412 " fewer histogram bins per sample. The number of bins for"
4413 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
4415 .category = FIO_OPT_C_LOG,
4416 .group = FIO_OPT_G_INVALID,
4419 .name = "write_hist_log",
4420 .lname = "Write latency histogram logs",
4421 .type = FIO_OPT_STR,
4422 .off1 = offsetof(struct thread_options, hist_log_file),
4423 .cb = str_write_hist_log_cb,
4424 .help = "Write log of latency histograms during run",
4425 .category = FIO_OPT_C_LOG,
4426 .group = FIO_OPT_G_INVALID,
4429 .name = "log_max_value",
4430 .lname = "Log maximum instead of average",
4431 .type = FIO_OPT_BOOL,
4432 .off1 = offsetof(struct thread_options, log_max),
4433 .help = "Log max sample in a window instead of average",
4435 .category = FIO_OPT_C_LOG,
4436 .group = FIO_OPT_G_INVALID,
4439 .name = "log_offset",
4440 .lname = "Log offset of IO",
4441 .type = FIO_OPT_BOOL,
4442 .off1 = offsetof(struct thread_options, log_offset),
4443 .help = "Include offset of IO for each log entry",
4445 .category = FIO_OPT_C_LOG,
4446 .group = FIO_OPT_G_INVALID,
4450 .lname = "Log priority of IO",
4451 .type = FIO_OPT_BOOL,
4452 .off1 = offsetof(struct thread_options, log_prio),
4453 .help = "Include priority value of IO for each log entry",
4455 .category = FIO_OPT_C_LOG,
4456 .group = FIO_OPT_G_INVALID,
4460 .name = "log_compression",
4461 .lname = "Log compression",
4462 .type = FIO_OPT_INT,
4463 .off1 = offsetof(struct thread_options, log_gz),
4464 .help = "Log in compressed chunks of this size",
4466 .maxval = 512 * 1024 * 1024ULL,
4467 .category = FIO_OPT_C_LOG,
4468 .group = FIO_OPT_G_INVALID,
4470 #ifdef FIO_HAVE_CPU_AFFINITY
4472 .name = "log_compression_cpus",
4473 .lname = "Log Compression CPUs",
4474 .type = FIO_OPT_STR,
4475 .cb = str_log_cpus_allowed_cb,
4476 .off1 = offsetof(struct thread_options, log_gz_cpumask),
4477 .parent = "log_compression",
4478 .help = "Limit log compression to these CPUs",
4479 .category = FIO_OPT_C_LOG,
4480 .group = FIO_OPT_G_INVALID,
4484 .name = "log_compression_cpus",
4485 .lname = "Log Compression CPUs",
4486 .type = FIO_OPT_UNSUPPORTED,
4487 .help = "Your platform does not support CPU affinities",
4491 .name = "log_store_compressed",
4492 .lname = "Log store compressed",
4493 .type = FIO_OPT_BOOL,
4494 .off1 = offsetof(struct thread_options, log_gz_store),
4495 .help = "Store logs in a compressed format",
4496 .category = FIO_OPT_C_LOG,
4497 .group = FIO_OPT_G_INVALID,
4501 .name = "log_compression",
4502 .lname = "Log compression",
4503 .type = FIO_OPT_UNSUPPORTED,
4504 .help = "Install libz-dev(el) to get compression support",
4507 .name = "log_store_compressed",
4508 .lname = "Log store compressed",
4509 .type = FIO_OPT_UNSUPPORTED,
4510 .help = "Install libz-dev(el) to get compression support",
4514 .name = "log_unix_epoch",
4515 .lname = "Log epoch unix",
4516 .type = FIO_OPT_BOOL,
4517 .off1 = offsetof(struct thread_options, log_unix_epoch),
4518 .help = "Use Unix time in log files",
4519 .category = FIO_OPT_C_LOG,
4520 .group = FIO_OPT_G_INVALID,
4523 .name = "log_alternate_epoch",
4524 .lname = "Log epoch alternate",
4525 .type = FIO_OPT_BOOL,
4526 .off1 = offsetof(struct thread_options, log_alternate_epoch),
4527 .help = "Use alternate epoch time in log files. Uses the same epoch as that is used by clock_gettime with specified log_alternate_epoch_clock_id.",
4528 .category = FIO_OPT_C_LOG,
4529 .group = FIO_OPT_G_INVALID,
4532 .name = "log_alternate_epoch_clock_id",
4533 .lname = "Log alternate epoch clock_id",
4534 .type = FIO_OPT_INT,
4535 .off1 = offsetof(struct thread_options, log_alternate_epoch_clock_id),
4536 .help = "If log_alternate_epoch or log_unix_epoch is true, this option specifies the clock_id from clock_gettime whose epoch should be used. If neither of those is true, this option has no effect. Default value is 0, or CLOCK_REALTIME",
4537 .category = FIO_OPT_C_LOG,
4538 .group = FIO_OPT_G_INVALID,
4541 .name = "block_error_percentiles",
4542 .lname = "Block error percentiles",
4543 .type = FIO_OPT_BOOL,
4544 .off1 = offsetof(struct thread_options, block_error_hist),
4545 .help = "Record trim block errors and make a histogram",
4547 .category = FIO_OPT_C_LOG,
4548 .group = FIO_OPT_G_INVALID,
4551 .name = "bwavgtime",
4552 .lname = "Bandwidth average time",
4553 .type = FIO_OPT_INT,
4554 .off1 = offsetof(struct thread_options, bw_avg_time),
4555 .help = "Time window over which to calculate bandwidth"
4558 .parent = "write_bw_log",
4561 .category = FIO_OPT_C_LOG,
4562 .group = FIO_OPT_G_INVALID,
4565 .name = "iopsavgtime",
4566 .lname = "IOPS average time",
4567 .type = FIO_OPT_INT,
4568 .off1 = offsetof(struct thread_options, iops_avg_time),
4569 .help = "Time window over which to calculate IOPS (msec)",
4571 .parent = "write_iops_log",
4574 .category = FIO_OPT_C_LOG,
4575 .group = FIO_OPT_G_INVALID,
4578 .name = "group_reporting",
4579 .lname = "Group reporting",
4580 .type = FIO_OPT_STR_SET,
4581 .off1 = offsetof(struct thread_options, group_reporting),
4582 .help = "Do reporting on a per-group basis",
4583 .category = FIO_OPT_C_STAT,
4584 .group = FIO_OPT_G_INVALID,
4589 .type = FIO_OPT_BOOL,
4590 .off1 = offsetof(struct thread_options, stats),
4591 .help = "Enable collection of stats",
4593 .category = FIO_OPT_C_STAT,
4594 .group = FIO_OPT_G_INVALID,
4597 .name = "zero_buffers",
4598 .lname = "Zero I/O buffers",
4599 .type = FIO_OPT_STR_SET,
4600 .off1 = offsetof(struct thread_options, zero_buffers),
4601 .help = "Init IO buffers to all zeroes",
4602 .category = FIO_OPT_C_IO,
4603 .group = FIO_OPT_G_IO_BUF,
4606 .name = "refill_buffers",
4607 .lname = "Refill I/O buffers",
4608 .type = FIO_OPT_STR_SET,
4609 .off1 = offsetof(struct thread_options, refill_buffers),
4610 .help = "Refill IO buffers on every IO submit",
4611 .category = FIO_OPT_C_IO,
4612 .group = FIO_OPT_G_IO_BUF,
4615 .name = "scramble_buffers",
4616 .lname = "Scramble I/O buffers",
4617 .type = FIO_OPT_BOOL,
4618 .off1 = offsetof(struct thread_options, scramble_buffers),
4619 .help = "Slightly scramble buffers on every IO submit",
4621 .category = FIO_OPT_C_IO,
4622 .group = FIO_OPT_G_IO_BUF,
4625 .name = "buffer_pattern",
4626 .lname = "Buffer pattern",
4627 .type = FIO_OPT_STR,
4628 .cb = str_buffer_pattern_cb,
4629 .off1 = offsetof(struct thread_options, buffer_pattern),
4630 .help = "Fill pattern for IO buffers",
4631 .category = FIO_OPT_C_IO,
4632 .group = FIO_OPT_G_IO_BUF,
4635 .name = "buffer_compress_percentage",
4636 .lname = "Buffer compression percentage",
4637 .type = FIO_OPT_INT,
4638 .cb = str_buffer_compress_cb,
4639 .off1 = offsetof(struct thread_options, compress_percentage),
4642 .help = "How compressible the buffer is (approximately)",
4644 .category = FIO_OPT_C_IO,
4645 .group = FIO_OPT_G_IO_BUF,
4648 .name = "buffer_compress_chunk",
4649 .lname = "Buffer compression chunk size",
4650 .type = FIO_OPT_INT,
4651 .off1 = offsetof(struct thread_options, compress_chunk),
4652 .parent = "buffer_compress_percentage",
4654 .help = "Size of compressible region in buffer",
4657 .category = FIO_OPT_C_IO,
4658 .group = FIO_OPT_G_IO_BUF,
4661 .name = "dedupe_percentage",
4662 .lname = "Dedupe percentage",
4663 .type = FIO_OPT_INT,
4664 .cb = str_dedupe_cb,
4665 .off1 = offsetof(struct thread_options, dedupe_percentage),
4668 .help = "Percentage of buffers that are dedupable",
4670 .category = FIO_OPT_C_IO,
4671 .group = FIO_OPT_G_IO_BUF,
4674 .name = "dedupe_global",
4675 .lname = "Global deduplication",
4676 .type = FIO_OPT_BOOL,
4677 .off1 = offsetof(struct thread_options, dedupe_global),
4678 .help = "Share deduplication buffers across jobs",
4680 .category = FIO_OPT_C_IO,
4681 .group = FIO_OPT_G_IO_BUF,
4684 .name = "dedupe_mode",
4685 .lname = "Dedupe mode",
4686 .help = "Mode for the deduplication buffer generation",
4687 .type = FIO_OPT_STR,
4688 .off1 = offsetof(struct thread_options, dedupe_mode),
4689 .parent = "dedupe_percentage",
4691 .category = FIO_OPT_C_IO,
4692 .group = FIO_OPT_G_IO_BUF,
4695 .oval = DEDUPE_MODE_REPEAT,
4696 .help = "repeat previous page",
4698 { .ival = "working_set",
4699 .oval = DEDUPE_MODE_WORKING_SET,
4700 .help = "choose a page randomly from limited working set defined in dedupe_working_set_percentage",
4705 .name = "dedupe_working_set_percentage",
4706 .lname = "Dedupe working set percentage",
4707 .help = "Dedupe working set size in percentages from file or device size used to generate dedupe patterns from",
4708 .type = FIO_OPT_INT,
4709 .off1 = offsetof(struct thread_options, dedupe_working_set_percentage),
4710 .parent = "dedupe_percentage",
4714 .category = FIO_OPT_C_IO,
4715 .group = FIO_OPT_G_IO_BUF,
4718 .name = "clat_percentiles",
4719 .lname = "Completion latency percentiles",
4720 .type = FIO_OPT_BOOL,
4721 .off1 = offsetof(struct thread_options, clat_percentiles),
4722 .help = "Enable the reporting of completion latency percentiles",
4724 .category = FIO_OPT_C_STAT,
4725 .group = FIO_OPT_G_INVALID,
4728 .name = "lat_percentiles",
4729 .lname = "IO latency percentiles",
4730 .type = FIO_OPT_BOOL,
4731 .off1 = offsetof(struct thread_options, lat_percentiles),
4732 .help = "Enable the reporting of IO latency percentiles",
4734 .category = FIO_OPT_C_STAT,
4735 .group = FIO_OPT_G_INVALID,
4738 .name = "slat_percentiles",
4739 .lname = "Submission latency percentiles",
4740 .type = FIO_OPT_BOOL,
4741 .off1 = offsetof(struct thread_options, slat_percentiles),
4742 .help = "Enable the reporting of submission latency percentiles",
4744 .category = FIO_OPT_C_STAT,
4745 .group = FIO_OPT_G_INVALID,
4748 .name = "percentile_list",
4749 .lname = "Percentile list",
4750 .type = FIO_OPT_FLOAT_LIST,
4751 .off1 = offsetof(struct thread_options, percentile_list),
4752 .off2 = offsetof(struct thread_options, percentile_precision),
4753 .help = "Specify a custom list of percentiles to report for "
4754 "completion latency and block errors",
4755 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
4756 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4759 .category = FIO_OPT_C_STAT,
4760 .group = FIO_OPT_G_INVALID,
4763 .name = "significant_figures",
4764 .lname = "Significant figures",
4765 .type = FIO_OPT_INT,
4766 .off1 = offsetof(struct thread_options, sig_figs),
4769 .help = "Significant figures for output-format set to normal",
4772 .category = FIO_OPT_C_STAT,
4773 .group = FIO_OPT_G_INVALID,
4776 #ifdef FIO_HAVE_DISK_UTIL
4778 .name = "disk_util",
4779 .lname = "Disk utilization",
4780 .type = FIO_OPT_BOOL,
4781 .off1 = offsetof(struct thread_options, do_disk_util),
4782 .help = "Log disk utilization statistics",
4784 .category = FIO_OPT_C_STAT,
4785 .group = FIO_OPT_G_INVALID,
4789 .name = "disk_util",
4790 .lname = "Disk utilization",
4791 .type = FIO_OPT_UNSUPPORTED,
4792 .help = "Your platform does not support disk utilization",
4796 .name = "gtod_reduce",
4797 .lname = "Reduce gettimeofday() calls",
4798 .type = FIO_OPT_BOOL,
4799 .help = "Greatly reduce number of gettimeofday() calls",
4800 .cb = str_gtod_reduce_cb,
4803 .category = FIO_OPT_C_STAT,
4804 .group = FIO_OPT_G_INVALID,
4807 .name = "disable_lat",
4808 .lname = "Disable all latency stats",
4809 .type = FIO_OPT_BOOL,
4810 .off1 = offsetof(struct thread_options, disable_lat),
4811 .help = "Disable latency numbers",
4812 .parent = "gtod_reduce",
4815 .category = FIO_OPT_C_STAT,
4816 .group = FIO_OPT_G_INVALID,
4819 .name = "disable_clat",
4820 .lname = "Disable completion latency stats",
4821 .type = FIO_OPT_BOOL,
4822 .off1 = offsetof(struct thread_options, disable_clat),
4823 .help = "Disable completion latency numbers",
4824 .parent = "gtod_reduce",
4827 .category = FIO_OPT_C_STAT,
4828 .group = FIO_OPT_G_INVALID,
4831 .name = "disable_slat",
4832 .lname = "Disable submission latency stats",
4833 .type = FIO_OPT_BOOL,
4834 .off1 = offsetof(struct thread_options, disable_slat),
4835 .help = "Disable submission latency numbers",
4836 .parent = "gtod_reduce",
4839 .category = FIO_OPT_C_STAT,
4840 .group = FIO_OPT_G_INVALID,
4843 .name = "disable_bw_measurement",
4844 .alias = "disable_bw",
4845 .lname = "Disable bandwidth stats",
4846 .type = FIO_OPT_BOOL,
4847 .off1 = offsetof(struct thread_options, disable_bw),
4848 .help = "Disable bandwidth logging",
4849 .parent = "gtod_reduce",
4852 .category = FIO_OPT_C_STAT,
4853 .group = FIO_OPT_G_INVALID,
4857 .lname = "Dedicated gettimeofday() CPU",
4858 .type = FIO_OPT_INT,
4859 .off1 = offsetof(struct thread_options, gtod_cpu),
4860 .help = "Set up dedicated gettimeofday() thread on this CPU",
4861 .verify = gtod_cpu_verify,
4862 .category = FIO_OPT_C_GENERAL,
4863 .group = FIO_OPT_G_CLOCK,
4866 .name = "unified_rw_reporting",
4867 .lname = "Unified RW Reporting",
4868 .type = FIO_OPT_STR,
4869 .off1 = offsetof(struct thread_options, unified_rw_rep),
4870 .help = "Unify reporting across data direction",
4872 .category = FIO_OPT_C_GENERAL,
4873 .group = FIO_OPT_G_INVALID,
4876 .oval = UNIFIED_SPLIT,
4877 .help = "Normal statistics reporting",
4880 .oval = UNIFIED_MIXED,
4881 .help = "Statistics are summed per data direction and reported together",
4884 .oval = UNIFIED_BOTH,
4885 .help = "Statistics are reported normally, followed by the mixed statistics"
4887 /* Compatibility with former boolean values */
4889 .oval = UNIFIED_SPLIT,
4890 .help = "Alias for 'none'",
4893 .oval = UNIFIED_MIXED,
4894 .help = "Alias for 'mixed'",
4897 .oval = UNIFIED_BOTH,
4898 .help = "Alias for 'both'",
4903 .name = "continue_on_error",
4904 .lname = "Continue on error",
4905 .type = FIO_OPT_STR,
4906 .off1 = offsetof(struct thread_options, continue_on_error),
4907 .help = "Continue on non-fatal errors during IO",
4909 .category = FIO_OPT_C_GENERAL,
4910 .group = FIO_OPT_G_ERR,
4913 .oval = ERROR_TYPE_NONE,
4914 .help = "Exit when an error is encountered",
4917 .oval = ERROR_TYPE_READ,
4918 .help = "Continue on read errors only",
4921 .oval = ERROR_TYPE_WRITE,
4922 .help = "Continue on write errors only",
4925 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
4926 .help = "Continue on any IO errors",
4929 .oval = ERROR_TYPE_VERIFY,
4930 .help = "Continue on verify errors only",
4933 .oval = ERROR_TYPE_ANY,
4934 .help = "Continue on all io and verify errors",
4937 .oval = ERROR_TYPE_NONE,
4938 .help = "Alias for 'none'",
4941 .oval = ERROR_TYPE_ANY,
4942 .help = "Alias for 'all'",
4947 .name = "ignore_error",
4948 .lname = "Ignore Error",
4949 .type = FIO_OPT_STR,
4950 .cb = str_ignore_error_cb,
4951 .off1 = offsetof(struct thread_options, ignore_error_nr),
4952 .help = "Set a specific list of errors to ignore",
4954 .category = FIO_OPT_C_GENERAL,
4955 .group = FIO_OPT_G_ERR,
4958 .name = "error_dump",
4959 .lname = "Error Dump",
4960 .type = FIO_OPT_BOOL,
4961 .off1 = offsetof(struct thread_options, error_dump),
4963 .help = "Dump info on each error",
4964 .category = FIO_OPT_C_GENERAL,
4965 .group = FIO_OPT_G_ERR,
4970 .type = FIO_OPT_STR_STORE,
4971 .off1 = offsetof(struct thread_options, profile),
4972 .help = "Select a specific builtin performance test",
4973 .category = FIO_OPT_C_PROFILE,
4974 .group = FIO_OPT_G_INVALID,
4979 .type = FIO_OPT_STR_STORE,
4980 .off1 = offsetof(struct thread_options, cgroup),
4981 .help = "Add job to cgroup of this name",
4982 .category = FIO_OPT_C_GENERAL,
4983 .group = FIO_OPT_G_CGROUP,
4986 .name = "cgroup_nodelete",
4987 .lname = "Cgroup no-delete",
4988 .type = FIO_OPT_BOOL,
4989 .off1 = offsetof(struct thread_options, cgroup_nodelete),
4990 .help = "Do not delete cgroups after job completion",
4993 .category = FIO_OPT_C_GENERAL,
4994 .group = FIO_OPT_G_CGROUP,
4997 .name = "cgroup_weight",
4998 .lname = "Cgroup weight",
4999 .type = FIO_OPT_INT,
5000 .off1 = offsetof(struct thread_options, cgroup_weight),
5001 .help = "Use given weight for cgroup",
5005 .category = FIO_OPT_C_GENERAL,
5006 .group = FIO_OPT_G_CGROUP,
5011 .type = FIO_OPT_INT,
5012 .off1 = offsetof(struct thread_options, uid),
5013 .help = "Run job with this user ID",
5014 .category = FIO_OPT_C_GENERAL,
5015 .group = FIO_OPT_G_CRED,
5019 .lname = "Group ID",
5020 .type = FIO_OPT_INT,
5021 .off1 = offsetof(struct thread_options, gid),
5022 .help = "Run job with this group ID",
5023 .category = FIO_OPT_C_GENERAL,
5024 .group = FIO_OPT_G_CRED,
5029 .type = FIO_OPT_STR,
5030 .off1 = offsetof(struct thread_options, kb_base),
5036 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
5040 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
5043 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
5044 .category = FIO_OPT_C_GENERAL,
5045 .group = FIO_OPT_G_INVALID,
5048 .name = "unit_base",
5049 .lname = "Unit for quantities of data (Bits or Bytes)",
5050 .type = FIO_OPT_STR,
5051 .off1 = offsetof(struct thread_options, unit_base),
5056 .help = "Auto-detect",
5059 .oval = N2S_BYTEPERSEC,
5060 .help = "Normal (byte based)",
5063 .oval = N2S_BITPERSEC,
5064 .help = "Bit based",
5067 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
5068 .category = FIO_OPT_C_GENERAL,
5069 .group = FIO_OPT_G_INVALID,
5072 .name = "hugepage-size",
5073 .lname = "Hugepage size",
5074 .type = FIO_OPT_INT,
5075 .off1 = offsetof(struct thread_options, hugepage_size),
5076 .help = "When using hugepages, specify size of each page",
5077 .def = __fio_stringify(FIO_HUGE_PAGE),
5078 .interval = 1024 * 1024,
5079 .category = FIO_OPT_C_GENERAL,
5080 .group = FIO_OPT_G_INVALID,
5084 .lname = "I/O flow ID",
5085 .type = FIO_OPT_INT,
5086 .off1 = offsetof(struct thread_options, flow_id),
5087 .help = "The flow index ID to use",
5089 .category = FIO_OPT_C_IO,
5090 .group = FIO_OPT_G_IO_FLOW,
5094 .lname = "I/O flow weight",
5095 .type = FIO_OPT_INT,
5096 .off1 = offsetof(struct thread_options, flow),
5097 .help = "Weight for flow control of this job",
5098 .parent = "flow_id",
5101 .maxval = FLOW_MAX_WEIGHT,
5102 .category = FIO_OPT_C_IO,
5103 .group = FIO_OPT_G_IO_FLOW,
5106 .name = "flow_watermark",
5107 .lname = "I/O flow watermark",
5108 .type = FIO_OPT_SOFT_DEPRECATED,
5109 .category = FIO_OPT_C_IO,
5110 .group = FIO_OPT_G_IO_FLOW,
5113 .name = "flow_sleep",
5114 .lname = "I/O flow sleep",
5115 .type = FIO_OPT_INT,
5116 .off1 = offsetof(struct thread_options, flow_sleep),
5117 .help = "How many microseconds to sleep after being held"
5118 " back by the flow control mechanism",
5119 .parent = "flow_id",
5122 .category = FIO_OPT_C_IO,
5123 .group = FIO_OPT_G_IO_FLOW,
5126 .name = "steadystate",
5127 .lname = "Steady state threshold",
5129 .type = FIO_OPT_STR,
5130 .off1 = offsetof(struct thread_options, ss_state),
5131 .cb = str_steadystate_cb,
5132 .help = "Define the criterion and limit to judge when a job has reached steady state",
5133 .def = "iops_slope:0.01%",
5136 .oval = FIO_SS_IOPS,
5137 .help = "maximum mean deviation of IOPS measurements",
5139 { .ival = "iops_slope",
5140 .oval = FIO_SS_IOPS_SLOPE,
5141 .help = "slope calculated from IOPS measurements",
5145 .help = "maximum mean deviation of bandwidth measurements",
5149 .oval = FIO_SS_BW_SLOPE,
5150 .help = "slope calculated from bandwidth measurements",
5153 .category = FIO_OPT_C_GENERAL,
5154 .group = FIO_OPT_G_RUNTIME,
5157 .name = "steadystate_duration",
5158 .lname = "Steady state duration",
5160 .parent = "steadystate",
5161 .type = FIO_OPT_STR_VAL_TIME,
5162 .off1 = offsetof(struct thread_options, ss_dur),
5163 .help = "Stop workload upon attaining steady state for specified duration",
5167 .category = FIO_OPT_C_GENERAL,
5168 .group = FIO_OPT_G_RUNTIME,
5171 .name = "steadystate_ramp_time",
5172 .lname = "Steady state ramp time",
5174 .parent = "steadystate",
5175 .type = FIO_OPT_STR_VAL_TIME,
5176 .off1 = offsetof(struct thread_options, ss_ramp_time),
5177 .help = "Delay before initiation of data collection for steady state job termination testing",
5181 .category = FIO_OPT_C_GENERAL,
5182 .group = FIO_OPT_G_RUNTIME,
5189 static void add_to_lopt(struct option *lopt, struct fio_option *o,
5190 const char *name, int val)
5192 lopt->name = (char *) name;
5194 if (o->type == FIO_OPT_STR_SET)
5195 lopt->has_arg = optional_argument;
5197 lopt->has_arg = required_argument;
5200 static void options_to_lopts(struct fio_option *opts,
5201 struct option *long_options,
5202 int i, int option_type)
5204 struct fio_option *o = &opts[0];
5206 add_to_lopt(&long_options[i], o, o->name, option_type);
5209 add_to_lopt(&long_options[i], o, o->alias, option_type);
5214 assert(i < FIO_NR_OPTIONS);
5218 void fio_options_set_ioengine_opts(struct option *long_options,
5219 struct thread_data *td)
5224 while (long_options[i].name) {
5225 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
5226 memset(&long_options[i], 0, sizeof(*long_options));
5233 * Just clear out the prior ioengine options.
5238 options_to_lopts(td->io_ops->options, long_options, i,
5239 FIO_GETOPT_IOENGINE);
5242 void fio_options_dup_and_init(struct option *long_options)
5246 options_init(fio_options);
5249 while (long_options[i].name)
5252 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
5255 struct fio_keyword {
5261 static struct fio_keyword fio_keywords[] = {
5263 .word = "$pagesize",
5264 .desc = "Page size in the system",
5267 .word = "$mb_memory",
5268 .desc = "Megabytes of memory online",
5272 .desc = "Number of CPUs online in the system",
5279 void fio_keywords_exit(void)
5281 struct fio_keyword *kw;
5283 kw = &fio_keywords[0];
5291 void fio_keywords_init(void)
5293 unsigned long long mb_memory;
5297 sprintf(buf, "%lu", (unsigned long) page_size);
5298 fio_keywords[0].replace = strdup(buf);
5300 mb_memory = os_phys_mem() / (1024 * 1024);
5301 sprintf(buf, "%llu", mb_memory);
5302 fio_keywords[1].replace = strdup(buf);
5305 sprintf(buf, "%lu", l);
5306 fio_keywords[2].replace = strdup(buf);
5311 static char *bc_calc(char *str)
5313 char buf[128], *tmp;
5318 * No math, just return string
5320 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
5321 !strchr(str, '/')) || strchr(str, '\''))
5325 * Split option from value, we only need to calculate the value
5327 tmp = strchr(str, '=');
5334 * Prevent buffer overflows; such a case isn't reasonable anyway
5336 if (strlen(str) >= 128 || strlen(tmp) > 100)
5339 sprintf(buf, "which %s > /dev/null", BC_APP);
5341 log_err("fio: bc is needed for performing math\n");
5345 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
5346 f = popen(buf, "r");
5350 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
5357 buf[(tmp - str) + ret - 1] = '\0';
5358 memcpy(buf, str, tmp - str);
5364 * Return a copy of the input string with substrings of the form ${VARNAME}
5365 * substituted with the value of the environment variable VARNAME. The
5366 * substitution always occurs, even if VARNAME is empty or the corresponding
5367 * environment variable undefined.
5369 char *fio_option_dup_subs(const char *opt)
5371 char out[OPT_LEN_MAX+1];
5372 char in[OPT_LEN_MAX+1];
5375 char *ch1, *ch2, *env;
5376 ssize_t nchr = OPT_LEN_MAX;
5379 if (strlen(opt) + 1 > OPT_LEN_MAX) {
5380 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
5384 snprintf(in, sizeof(in), "%s", opt);
5386 while (*inptr && nchr > 0) {
5387 if (inptr[0] == '$' && inptr[1] == '{') {
5388 ch2 = strchr(inptr, '}');
5389 if (ch2 && inptr+1 < ch2) {
5396 envlen = strlen(env);
5397 if (envlen <= nchr) {
5398 memcpy(outptr, env, envlen);
5408 *outptr++ = *inptr++;
5417 * Look for reserved variable names and replace them with real values
5419 static char *fio_keyword_replace(char *opt)
5425 for (i = 0; fio_keywords[i].word != NULL; i++) {
5426 struct fio_keyword *kw = &fio_keywords[i];
5428 while ((s = strstr(opt, kw->word)) != NULL) {
5429 char *new = calloc(strlen(opt) + 1, 1);
5435 * Copy part of the string before the keyword and
5436 * sprintf() the replacement after it.
5438 memcpy(new, opt, olen);
5439 len = sprintf(new + olen, "%s", kw->replace);
5442 * If there's more in the original string, copy that
5445 opt += olen + strlen(kw->word);
5446 /* keeps final zero thanks to calloc */
5448 memcpy(new + olen + len, opt, strlen(opt));
5451 * replace opt and free the old opt
5461 * Check for potential math and invoke bc, if possible
5469 static char **dup_and_sub_options(char **opts, int num_opts)
5472 char **opts_copy = malloc(num_opts * sizeof(*opts));
5473 for (i = 0; i < num_opts; i++) {
5474 opts_copy[i] = fio_option_dup_subs(opts[i]);
5477 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
5482 static void show_closest_option(const char *opt)
5484 int best_option, best_distance;
5493 while (name[i] != '\0' && name[i] != '=')
5498 best_distance = INT_MAX;
5500 while (fio_options[i].name) {
5501 distance = string_distance(name, fio_options[i].name);
5502 if (distance < best_distance) {
5503 best_distance = distance;
5509 if (best_option != -1 && string_distance_ok(name, best_distance) &&
5510 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
5511 log_err("Did you mean %s?\n", fio_options[best_option].name);
5516 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
5518 int i, ret, unknown;
5521 sort_options(opts, fio_options, num_opts);
5522 opts_copy = dup_and_sub_options(opts, num_opts);
5524 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
5525 const struct fio_option *o;
5526 int newret = parse_option(opts_copy[i], opts[i], fio_options,
5527 &o, &td->o, &td->opt_list);
5530 fio_option_mark_set(&td->o, o);
5538 opts_copy[i] = NULL;
5545 ret |= ioengine_load(td);
5547 sort_options(opts_copy, td->io_ops->options, num_opts);
5550 for (i = 0; i < num_opts; i++) {
5551 const struct fio_option *o = NULL;
5558 newret = parse_option(opts_copy[i], opts[i],
5559 td->io_ops->options, &o,
5560 td->eo, &td->opt_list);
5564 log_err("Bad option <%s>\n", opts[i]);
5565 show_closest_option(opts[i]);
5568 opts_copy[i] = NULL;
5576 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
5580 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
5582 const struct fio_option *o;
5584 o = find_option_c(fio_options, opt);
5586 fio_option_mark_set(&td->o, o);
5592 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
5595 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
5599 void fio_fill_default_options(struct thread_data *td)
5601 td->o.magic = OPT_MAGIC;
5602 fill_default_options(&td->o, fio_options);
5605 int fio_show_option_help(const char *opt)
5607 return show_cmd_help(fio_options, opt);
5611 * dupe FIO_OPT_STR_STORE options
5613 void fio_options_mem_dupe(struct thread_data *td)
5615 options_mem_dupe(fio_options, &td->o);
5617 if (td->eo && td->io_ops) {
5618 void *oldeo = td->eo;
5620 td->eo = malloc(td->io_ops->option_struct_size);
5621 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
5622 options_mem_dupe(td->io_ops->options, td->eo);
5626 unsigned int fio_get_kb_base(void *data)
5628 struct thread_data *td = cb_data_to_td(data);
5629 struct thread_options *o = &td->o;
5630 unsigned int kb_base = 0;
5633 * This is a hack... For private options, *data is not holding
5634 * a pointer to the thread_options, but to private data. This means
5635 * we can't safely dereference it, but magic is first so mem wise
5636 * it is valid. But this also means that if the job first sets
5637 * kb_base and expects that to be honored by private options,
5638 * it will be disappointed. We will return the global default
5641 if (o && o->magic == OPT_MAGIC)
5642 kb_base = o->kb_base;
5649 int add_option(const struct fio_option *o)
5651 struct fio_option *__o;
5660 if (opt_index + 1 == FIO_MAX_OPTS) {
5661 log_err("fio: FIO_MAX_OPTS is too small\n");
5665 memcpy(&fio_options[opt_index], o, sizeof(*o));
5666 fio_options[opt_index + 1].name = NULL;
5670 void invalidate_profile_options(const char *prof_name)
5672 struct fio_option *o;
5676 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5677 o->type = FIO_OPT_INVALID;
5678 o->prof_name = NULL;
5684 void add_opt_posval(const char *optname, const char *ival, const char *help)
5686 struct fio_option *o;
5689 o = find_option(fio_options, optname);
5693 for (i = 0; i < PARSE_MAX_VP; i++) {
5694 if (o->posval[i].ival)
5697 o->posval[i].ival = ival;
5698 o->posval[i].help = help;
5703 void del_opt_posval(const char *optname, const char *ival)
5705 struct fio_option *o;
5708 o = find_option(fio_options, optname);
5712 for (i = 0; i < PARSE_MAX_VP; i++) {
5713 if (!o->posval[i].ival)
5715 if (strcmp(o->posval[i].ival, ival))
5718 o->posval[i].ival = NULL;
5719 o->posval[i].help = NULL;
5723 void fio_options_free(struct thread_data *td)
5725 options_free(fio_options, &td->o);
5726 if (td->eo && td->io_ops && td->io_ops->options) {
5727 options_free(td->io_ops->options, td->eo);
5733 void fio_dump_options_free(struct thread_data *td)
5735 while (!flist_empty(&td->opt_list)) {
5736 struct print_option *p;
5738 p = flist_first_entry(&td->opt_list, struct print_option, list);
5739 flist_del_init(&p->list);
5746 struct fio_option *fio_option_find(const char *name)
5748 return find_option(fio_options, name);
5751 static struct fio_option *find_next_opt(struct fio_option *from,
5754 struct fio_option *opt;
5757 from = &fio_options[0];
5763 if (off1 == from->off1) {
5768 } while (from->name);
5773 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5775 unsigned int opt_off, index, offset;
5777 opt_off = opt - &fio_options[0];
5778 index = opt_off / (8 * sizeof(uint64_t));
5779 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5780 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
5783 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
5785 struct fio_option *opt, *next;
5788 while ((opt = find_next_opt(next, off1)) != NULL) {
5789 if (opt_is_set(o, opt))
5798 void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt)
5800 unsigned int opt_off, index, offset;
5802 opt_off = opt - &fio_options[0];
5803 index = opt_off / (8 * sizeof(uint64_t));
5804 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5805 o->set_options[index] |= (uint64_t)1 << offset;