9 #include <netinet/in.h>
14 #include "lib/pattern.h"
19 char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
21 #define cb_data_to_td(data) container_of(data, struct thread_data, o)
23 static const struct pattern_fmt_desc fmt_desc[] = {
26 .len = FIO_FIELD_SIZE(struct io_u *, offset),
27 .paste = paste_blockoff
33 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
35 static char *get_opt_postfix(const char *str)
37 char *p = strstr(str, ":");
43 strip_blank_front(&p);
48 static bool split_parse_distr(const char *str, double *val, double *center)
62 r = str_to_float(cp, center, 0);
64 r = r && str_to_float(p, val, 0);
69 static int bs_cmp(const void *p1, const void *p2)
71 const struct bssplit *bsp1 = p1;
72 const struct bssplit *bsp2 = p2;
74 return (int) bsp1->perc - (int) bsp2->perc;
77 int split_parse_ddir(struct thread_options *o, struct split *split,
78 char *str, bool absolute, unsigned int max_splits)
80 unsigned long long perc;
88 while ((fname = strsep(&str, ":")) != NULL) {
94 perc_str = strstr(fname, "/");
99 if (str_to_decimal(perc_str, &val, 1, o, 0, 0)) {
100 log_err("fio: split conversion failed\n");
105 perc = atoi(perc_str);
118 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
119 log_err("fio: split conversion failed\n");
123 split->val1[i] = val;
124 split->val2[i] = perc;
126 if (i == max_splits) {
127 log_err("fio: hit max of %d split entries\n", i);
136 static int bssplit_ddir(struct thread_options *o, void *eo,
137 enum fio_ddir ddir, char *str, bool data)
139 unsigned int i, perc, perc_missing;
140 unsigned long long max_bs, min_bs;
143 memset(&split, 0, sizeof(split));
145 if (split_parse_ddir(o, &split, str, data, BSSPLIT_MAX))
152 o->bssplit[ddir] = malloc(split.nr * sizeof(struct bssplit));
153 o->bssplit_nr[ddir] = split.nr;
154 for (i = 0; i < split.nr; i++) {
155 if (split.val1[i] > max_bs)
156 max_bs = split.val1[i];
157 if (split.val1[i] < min_bs)
158 min_bs = split.val1[i];
160 o->bssplit[ddir][i].bs = split.val1[i];
161 o->bssplit[ddir][i].perc =split.val2[i];
165 * Now check if the percentages add up, and how much is missing
167 perc = perc_missing = 0;
168 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
169 struct bssplit *bsp = &o->bssplit[ddir][i];
171 if (bsp->perc == -1U)
177 if (perc > 100 && perc_missing > 1) {
178 log_err("fio: bssplit percentages add to more than 100%%\n");
179 free(o->bssplit[ddir]);
180 o->bssplit[ddir] = NULL;
185 * If values didn't have a percentage set, divide the remains between
189 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
191 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
192 struct bssplit *bsp = &o->bssplit[ddir][i];
194 if (bsp->perc == -1U)
195 bsp->perc = (100 - perc) / perc_missing;
199 o->min_bs[ddir] = min_bs;
200 o->max_bs[ddir] = max_bs;
203 * now sort based on percentages, for ease of lookup
205 qsort(o->bssplit[ddir], o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
209 int str_split_parse(struct thread_data *td, char *str,
210 split_parse_fn *fn, void *eo, bool data)
215 odir = strchr(str, ',');
217 ddir = strchr(odir + 1, ',');
219 ret = fn(&td->o, eo, DDIR_TRIM, ddir + 1, data);
225 op = strdup(odir + 1);
226 ret = fn(&td->o, eo, DDIR_TRIM, op, data);
231 ret = fn(&td->o, eo, DDIR_WRITE, odir + 1, data);
234 ret = fn(&td->o, eo, DDIR_READ, str, data);
240 ret = fn(&td->o, eo, DDIR_WRITE, op, data);
245 ret = fn(&td->o, eo, DDIR_TRIM, op, data);
249 ret = fn(&td->o, eo, DDIR_READ, str, data);
255 static int fio_fdp_cmp(const void *p1, const void *p2)
257 const uint16_t *t1 = p1;
258 const uint16_t *t2 = p2;
263 static int str_fdp_pli_cb(void *data, const char *input)
265 struct thread_data *td = cb_data_to_td(data);
269 p = str = strdup(input);
270 strip_blank_front(&str);
271 strip_blank_end(str);
273 while ((v = strsep(&str, ",")) != NULL && i < FIO_MAX_DP_IDS) {
274 unsigned long long id = strtoull(v, NULL, 0);
276 log_err("Placement IDs cannot exceed 0xFFFF\n");
280 td->o.dp_ids[i++] = id;
284 qsort(td->o.dp_ids, i, sizeof(*td->o.dp_ids), fio_fdp_cmp);
290 /* str_dp_scheme_cb() is a callback function for parsing the fdp_scheme option
291 This function validates the fdp_scheme filename. */
292 static int str_dp_scheme_cb(void *data, const char *input)
294 struct thread_data *td = cb_data_to_td(data);
302 filename = strdup(td->o.dp_scheme_file);
303 strip_blank_front(&filename);
304 strip_blank_end(filename);
306 strcpy(td->o.dp_scheme_file, filename);
308 if (lstat(filename, &sb) < 0){
310 log_err("fio: lstat() error related to %s\n", filename);
311 td_verror(td, ret, "lstat");
315 if (!S_ISREG(sb.st_mode)) {
317 log_err("fio: %s is not a file\n", filename);
318 td_verror(td, ret, "S_ISREG");
327 static int str_bssplit_cb(void *data, const char *input)
329 struct thread_data *td = cb_data_to_td(data);
333 p = str = strdup(input);
335 strip_blank_front(&str);
336 strip_blank_end(str);
338 ret = str_split_parse(td, str, bssplit_ddir, NULL, false);
340 if (parse_dryrun()) {
343 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
344 free(td->o.bssplit[i]);
345 td->o.bssplit[i] = NULL;
346 td->o.bssplit_nr[i] = 0;
354 static int parse_cmdprio_bssplit_entry(struct thread_options *o,
355 struct split_prio *entry, char *str)
360 unsigned int perc = 0, class, level, hint;
363 * valid entry formats:
364 * bs/ - %s/ - set perc to 0, prio to -1.
365 * bs/perc - %s/%u - set prio to -1.
366 * bs/perc/class/level - %s/%u/%u/%u
367 * bs/perc/class/level/hint - %s/%u/%u/%u/%u
369 matches = sscanf(str, "%m[^/]/%u/%u/%u/%u",
370 &bs_str, &perc, &class, &level, &hint);
372 log_err("fio: invalid cmdprio_bssplit format\n");
376 if (str_to_decimal(bs_str, &bs_val, 1, o, 0, 0)) {
377 log_err("fio: split conversion failed\n");
384 entry->perc = min(perc, 100u);
387 case 1: /* bs/ case */
388 case 2: /* bs/perc case */
390 case 4: /* bs/perc/class/level case */
391 case 5: /* bs/perc/class/level/hint case */
392 class = min(class, (unsigned int) IOPRIO_MAX_PRIO_CLASS);
393 level = min(level, (unsigned int) IOPRIO_MAX_PRIO);
395 hint = min(hint, (unsigned int) IOPRIO_MAX_PRIO_HINT);
398 entry->prio = ioprio_value(class, level, hint);
401 log_err("fio: invalid cmdprio_bssplit format\n");
409 * Returns a negative integer if the first argument should be before the second
410 * argument in the sorted list. A positive integer if the first argument should
411 * be after the second argument in the sorted list. A zero if they are equal.
413 static int fio_split_prio_cmp(const void *p1, const void *p2)
415 const struct split_prio *tmp1 = p1;
416 const struct split_prio *tmp2 = p2;
418 if (tmp1->bs > tmp2->bs)
420 if (tmp1->bs < tmp2->bs)
425 int split_parse_prio_ddir(struct thread_options *o, struct split_prio **entries,
426 int *nr_entries, char *str)
428 struct split_prio *tmp_entries;
429 unsigned int nr_bssplits;
430 char *str_cpy, *p, *fname;
432 /* strsep modifies the string, dup it so that we can use strsep twice */
433 p = str_cpy = strdup(str);
438 while ((fname = strsep(&str_cpy, ":")) != NULL) {
445 if (nr_bssplits > BSSPLIT_MAX) {
446 log_err("fio: too many cmdprio_bssplit entries\n");
450 tmp_entries = calloc(nr_bssplits, sizeof(*tmp_entries));
455 while ((fname = strsep(&str, ":")) != NULL) {
456 struct split_prio *entry;
461 entry = &tmp_entries[nr_bssplits];
463 if (parse_cmdprio_bssplit_entry(o, entry, fname)) {
464 log_err("fio: failed to parse cmdprio_bssplit entry\n");
469 /* skip zero perc entries, they provide no useful information */
474 qsort(tmp_entries, nr_bssplits, sizeof(*tmp_entries),
477 *entries = tmp_entries;
478 *nr_entries = nr_bssplits;
483 static int str2error(char *str)
485 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
486 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
487 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
488 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
489 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
490 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
491 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
492 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
493 int i = 0, num = sizeof(err) / sizeof(char *);
496 if (!strcmp(err[i], str))
503 static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
510 if (etype >= ERROR_TYPE_CNT) {
511 log_err("Illegal error type\n");
515 td->o.ignore_error_nr[etype] = 4;
516 error = calloc(4, sizeof(int));
519 while ((fname = strsep(&str, ":")) != NULL) {
525 * grow struct buffer, if needed
527 if (i == td->o.ignore_error_nr[etype]) {
528 td->o.ignore_error_nr[etype] <<= 1;
529 error = realloc(error, td->o.ignore_error_nr[etype]
532 if (fname[0] == 'E') {
533 error[i] = str2error(fname);
535 error[i] = atoi(fname);
537 error[i] = -error[i];
540 log_err("Unknown error %s, please use number value\n",
542 td->o.ignore_error_nr[etype] = 0;
549 td->o.continue_on_error |= 1 << etype;
550 td->o.ignore_error_nr[etype] = i;
551 td->o.ignore_error[etype] = error;
553 td->o.ignore_error_nr[etype] = 0;
561 static int str_replay_skip_cb(void *data, const char *input)
563 struct thread_data *td = cb_data_to_td(data);
570 p = str = strdup(input);
572 strip_blank_front(&str);
573 strip_blank_end(str);
579 if (!strcmp(p, "read"))
580 td->o.replay_skip |= 1u << DDIR_READ;
581 else if (!strcmp(p, "write"))
582 td->o.replay_skip |= 1u << DDIR_WRITE;
583 else if (!strcmp(p, "trim"))
584 td->o.replay_skip |= 1u << DDIR_TRIM;
585 else if (!strcmp(p, "sync"))
586 td->o.replay_skip |= 1u << DDIR_SYNC;
588 log_err("Unknown skip type: %s\n", p);
598 static int str_ignore_error_cb(void *data, const char *input)
600 struct thread_data *td = cb_data_to_td(data);
603 enum error_type_bit type = 0;
608 p = str = strdup(input);
610 strip_blank_front(&str);
611 strip_blank_end(str);
617 ret = ignore_error_type(td, type, p);
627 static int str_rw_cb(void *data, const char *str)
629 struct thread_data *td = cb_data_to_td(data);
630 struct thread_options *o = &td->o;
639 nr = get_opt_postfix(str);
646 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
647 log_err("fio: randrw postfix parsing failed\n");
651 if ((val <= 0) || (val > UINT_MAX)) {
652 log_err("fio: randrw postfix parsing out of range\n");
656 o->ddir_seq_nr = (unsigned int) val;
660 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
661 log_err("fio: rw postfix parsing failed\n");
666 o->ddir_seq_add = val;
673 static int str_mem_cb(void *data, const char *mem)
675 struct thread_data *td = cb_data_to_td(data);
677 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
678 td->o.mem_type == MEM_MMAPSHARED)
679 td->o.mmapfile = get_opt_postfix(mem);
684 static int fio_clock_source_cb(void *data, const char *str)
686 struct thread_data *td = cb_data_to_td(data);
688 fio_clock_source = td->o.clocksource;
689 fio_clock_source_set = 1;
694 static int str_rwmix_read_cb(void *data, long long *val)
696 struct thread_data *td = cb_data_to_td(data);
698 td->o.rwmix[DDIR_READ] = *val;
699 td->o.rwmix[DDIR_WRITE] = 100 - *val;
703 static int str_rwmix_write_cb(void *data, long long *val)
705 struct thread_data *td = cb_data_to_td(data);
707 td->o.rwmix[DDIR_WRITE] = *val;
708 td->o.rwmix[DDIR_READ] = 100 - *val;
712 static int str_exitall_cb(void)
714 exitall_on_terminate = true;
718 #ifdef FIO_HAVE_CPU_AFFINITY
719 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
721 unsigned int i, index, cpus_in_mask;
722 const long max_cpu = cpus_configured();
724 cpus_in_mask = fio_cpu_count(mask);
728 cpu_index = cpu_index % cpus_in_mask;
731 for (i = 0; i < max_cpu; i++) {
732 if (!fio_cpu_isset(mask, i))
735 if (cpu_index != index)
736 fio_cpu_clear(mask, i);
741 return fio_cpu_count(mask);
744 static int str_cpumask_cb(void *data, unsigned long long *val)
746 struct thread_data *td = cb_data_to_td(data);
754 ret = fio_cpuset_init(&td->o.cpumask);
756 log_err("fio: cpuset_init failed\n");
757 td_verror(td, ret, "fio_cpuset_init");
761 max_cpu = cpus_configured();
763 for (i = 0; i < sizeof(int) * 8; i++) {
764 if ((1 << i) & *val) {
766 log_err("fio: CPU %d too large (max=%ld)\n", i,
770 dprint(FD_PARSE, "set cpu allowed %d\n", i);
771 fio_cpu_set(&td->o.cpumask, i);
778 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
785 ret = fio_cpuset_init(mask);
787 log_err("fio: cpuset_init failed\n");
788 td_verror(td, ret, "fio_cpuset_init");
792 p = str = strdup(input);
794 strip_blank_front(&str);
795 strip_blank_end(str);
797 max_cpu = cpus_configured();
799 while ((cpu = strsep(&str, ",")) != NULL) {
808 while ((cpu2 = strsep(&str2, "-")) != NULL) {
818 while (icpu <= icpu2) {
819 if (icpu >= FIO_MAX_CPUS) {
820 log_err("fio: your OS only supports up to"
821 " %d CPUs\n", (int) FIO_MAX_CPUS);
825 if (icpu >= max_cpu) {
826 log_err("fio: CPU %d too large (max=%ld)\n",
832 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
833 fio_cpu_set(mask, icpu);
844 static int str_cpus_allowed_cb(void *data, const char *input)
846 struct thread_data *td = cb_data_to_td(data);
851 return set_cpus_allowed(td, &td->o.cpumask, input);
854 static int str_verify_cpus_allowed_cb(void *data, const char *input)
856 struct thread_data *td = cb_data_to_td(data);
861 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
865 static int str_log_cpus_allowed_cb(void *data, const char *input)
867 struct thread_data *td = cb_data_to_td(data);
872 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
874 #endif /* CONFIG_ZLIB */
876 #endif /* FIO_HAVE_CPU_AFFINITY */
878 #ifdef CONFIG_LIBNUMA
879 static int str_numa_cpunodes_cb(void *data, char *input)
881 struct thread_data *td = cb_data_to_td(data);
882 struct bitmask *verify_bitmask;
887 /* numa_parse_nodestring() parses a character string list
888 * of nodes into a bit mask. The bit mask is allocated by
889 * numa_allocate_nodemask(), so it should be freed by
890 * numa_free_nodemask().
892 verify_bitmask = numa_parse_nodestring(input);
893 if (verify_bitmask == NULL) {
894 log_err("fio: numa_parse_nodestring failed\n");
895 td_verror(td, 1, "str_numa_cpunodes_cb");
898 numa_free_nodemask(verify_bitmask);
900 td->o.numa_cpunodes = strdup(input);
904 static int str_numa_mpol_cb(void *data, char *input)
906 struct thread_data *td = cb_data_to_td(data);
907 const char * const policy_types[] =
908 { "default", "prefer", "bind", "interleave", "local", NULL };
911 struct bitmask *verify_bitmask;
916 nodelist = strchr(input, ':');
918 /* NUL-terminate mode */
922 for (i = 0; i <= MPOL_LOCAL; i++) {
923 if (!strcmp(input, policy_types[i])) {
924 td->o.numa_mem_mode = i;
928 if (i > MPOL_LOCAL) {
929 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
933 switch (td->o.numa_mem_mode) {
936 * Insist on a nodelist of one node only
939 char *rest = nodelist;
940 while (isdigit(*rest))
943 log_err("fio: one node only for \'prefer\'\n");
947 log_err("fio: one node is needed for \'prefer\'\n");
951 case MPOL_INTERLEAVE:
953 * Default to online nodes with memory if no nodelist
956 nodelist = strdup("all");
961 * Don't allow a nodelist
964 log_err("fio: NO nodelist for \'local\'\n");
970 * Insist on a nodelist
973 log_err("fio: a nodelist is needed for \'bind\'\n");
980 /* numa_parse_nodestring() parses a character string list
981 * of nodes into a bit mask. The bit mask is allocated by
982 * numa_allocate_nodemask(), so it should be freed by
983 * numa_free_nodemask().
985 switch (td->o.numa_mem_mode) {
987 td->o.numa_mem_prefer_node = atoi(nodelist);
989 case MPOL_INTERLEAVE:
991 verify_bitmask = numa_parse_nodestring(nodelist);
992 if (verify_bitmask == NULL) {
993 log_err("fio: numa_parse_nodestring failed\n");
994 td_verror(td, 1, "str_numa_memnodes_cb");
997 td->o.numa_memnodes = strdup(nodelist);
998 numa_free_nodemask(verify_bitmask);
1013 static int str_fst_cb(void *data, const char *str)
1015 struct thread_data *td = cb_data_to_td(data);
1021 td->file_service_nr = 1;
1023 switch (td->o.file_service_type) {
1024 case FIO_FSERVICE_RANDOM:
1025 case FIO_FSERVICE_RR:
1026 case FIO_FSERVICE_SEQ:
1027 nr = get_opt_postfix(str);
1029 td->file_service_nr = atoi(nr);
1034 case FIO_FSERVICE_ZIPF:
1037 case FIO_FSERVICE_PARETO:
1038 val = FIO_DEF_PARETO;
1040 case FIO_FSERVICE_GAUSS:
1044 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
1051 nr = get_opt_postfix(str);
1052 if (nr && !split_parse_distr(nr, &val, ¢er)) {
1053 log_err("fio: file service type random postfix parsing failed\n");
1060 if (center != -1 && (center < 0.00 || center > 1.00)) {
1061 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
1064 td->random_center = center;
1066 switch (td->o.file_service_type) {
1067 case FIO_FSERVICE_ZIPF:
1069 log_err("fio: zipf theta must be different than 1.0\n");
1074 td->zipf_theta = val;
1076 case FIO_FSERVICE_PARETO:
1077 if (val <= 0.00 || val >= 1.00) {
1078 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1085 case FIO_FSERVICE_GAUSS:
1086 if (val < 0.00 || val >= 100.00) {
1087 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1092 td->gauss_dev = val;
1099 #ifdef CONFIG_SYNC_FILE_RANGE
1100 static int str_sfr_cb(void *data, const char *str)
1102 struct thread_data *td = cb_data_to_td(data);
1103 char *nr = get_opt_postfix(str);
1105 td->sync_file_range_nr = 1;
1107 td->sync_file_range_nr = atoi(nr);
1115 static int zone_split_ddir(struct thread_options *o, void *eo,
1116 enum fio_ddir ddir, char *str, bool absolute)
1118 unsigned int i, perc, perc_missing, sperc, sperc_missing;
1121 memset(&split, 0, sizeof(split));
1123 if (split_parse_ddir(o, &split, str, absolute, ZONESPLIT_MAX))
1128 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
1129 o->zone_split_nr[ddir] = split.nr;
1130 for (i = 0; i < split.nr; i++) {
1131 o->zone_split[ddir][i].access_perc = split.val1[i];
1133 o->zone_split[ddir][i].size = split.val2[i];
1135 o->zone_split[ddir][i].size_perc = split.val2[i];
1139 * Now check if the percentages add up, and how much is missing
1141 perc = perc_missing = 0;
1142 sperc = sperc_missing = 0;
1143 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1144 struct zone_split *zsp = &o->zone_split[ddir][i];
1146 if (zsp->access_perc == (uint8_t) -1U)
1149 perc += zsp->access_perc;
1152 if (zsp->size_perc == (uint8_t) -1U)
1155 sperc += zsp->size_perc;
1159 if (perc > 100 || sperc > 100) {
1160 log_err("fio: zone_split percentages add to more than 100%%\n");
1161 free(o->zone_split[ddir]);
1162 o->zone_split[ddir] = NULL;
1166 log_err("fio: access percentage don't add up to 100 for zoned "
1167 "random distribution (got=%u)\n", perc);
1168 free(o->zone_split[ddir]);
1169 o->zone_split[ddir] = NULL;
1174 * If values didn't have a percentage set, divide the remains between
1178 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
1180 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1181 struct zone_split *zsp = &o->zone_split[ddir][i];
1183 if (zsp->access_perc == (uint8_t) -1U)
1184 zsp->access_perc = (100 - perc) / perc_missing;
1187 if (sperc_missing) {
1188 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
1190 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1191 struct zone_split *zsp = &o->zone_split[ddir][i];
1193 if (zsp->size_perc == (uint8_t) -1U)
1194 zsp->size_perc = (100 - sperc) / sperc_missing;
1201 static int parse_zoned_distribution(struct thread_data *td, const char *input,
1204 const char *pre = absolute ? "zoned_abs:" : "zoned:";
1208 p = str = strdup(input);
1210 strip_blank_front(&str);
1211 strip_blank_end(str);
1213 /* We expect it to start like that, bail if not */
1214 if (strncmp(str, pre, strlen(pre))) {
1215 log_err("fio: mismatch in zoned input <%s>\n", str);
1221 ret = str_split_parse(td, str, zone_split_ddir, NULL, absolute);
1225 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1228 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
1230 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
1231 struct zone_split *zsp = &td->o.zone_split[i][j];
1234 dprint(FD_PARSE, "\t%d: %u/%llu\n", j,
1236 (unsigned long long) zsp->size);
1238 dprint(FD_PARSE, "\t%d: %u/%u\n", j,
1245 if (parse_dryrun()) {
1246 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1247 free(td->o.zone_split[i]);
1248 td->o.zone_split[i] = NULL;
1249 td->o.zone_split_nr[i] = 0;
1256 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1257 td->o.zone_split_nr[i] = 0;
1263 static int str_random_distribution_cb(void *data, const char *str)
1265 struct thread_data *td = cb_data_to_td(data);
1270 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1272 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1273 val = FIO_DEF_PARETO;
1274 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1276 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1277 return parse_zoned_distribution(td, str, false);
1278 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED_ABS)
1279 return parse_zoned_distribution(td, str, true);
1283 nr = get_opt_postfix(str);
1284 if (nr && !split_parse_distr(nr, &val, ¢er)) {
1285 log_err("fio: random postfix parsing failed\n");
1292 if (center != -1 && (center < 0.00 || center > 1.00)) {
1293 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
1296 td->o.random_center.u.f = center;
1298 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1300 log_err("fio: zipf theta must different than 1.0\n");
1305 td->o.zipf_theta.u.f = val;
1306 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1307 if (val <= 0.00 || val >= 1.00) {
1308 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1313 td->o.pareto_h.u.f = val;
1315 if (val < 0.00 || val >= 100.0) {
1316 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1321 td->o.gauss_dev.u.f = val;
1327 static int str_steadystate_cb(void *data, const char *str)
1329 struct thread_data *td = cb_data_to_td(data);
1335 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1336 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
1337 /* should be impossible to get here */
1338 log_err("fio: unknown steady state criterion\n");
1342 nr = get_opt_postfix(str);
1344 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1349 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1350 pct = strstr(nr, "%");
1353 strip_blank_end(nr);
1354 if (!str_to_float(nr, &val, 0)) {
1355 log_err("fio: could not parse steadystate threshold percentage\n");
1360 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1365 td->o.ss_state |= FIO_SS_PCT;
1366 td->o.ss_limit.u.f = val;
1367 } else if (td->o.ss_state & FIO_SS_IOPS) {
1368 if (!str_to_float(nr, &val, 0)) {
1369 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1374 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1379 td->o.ss_limit.u.f = val;
1380 } else { /* bandwidth criterion */
1381 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1382 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1387 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1392 td->o.ss_limit.u.f = (double) ll;
1395 td->ss.state = td->o.ss_state;
1400 * Return next name in the string. Files are separated with ':'. If the ':'
1401 * is escaped with a '\', then that ':' is part of the filename and does not
1402 * indicate a new file.
1404 char *get_next_str(char **ptr)
1409 if (!str || !strlen(str))
1415 * No colon, we are done
1417 p = strchr(str, ':');
1424 * We got a colon, but it's the first character. Skip and
1432 if (*(p - 1) != '\\') {
1438 memmove(p - 1, p, strlen(p) + 1);
1446 int get_max_str_idx(char *input)
1448 unsigned int cur_idx;
1451 p = str = strdup(input);
1452 for (cur_idx = 0; ; cur_idx++)
1453 if (get_next_str(&str) == NULL)
1461 * Returns the directory at the index, indexes > entries will be
1462 * assigned via modulo division of the index
1464 int set_name_idx(char *target, size_t tlen, char *input, int index,
1465 bool unique_filename)
1467 unsigned int cur_idx;
1469 char *fname, *str, *p;
1471 p = str = strdup(input);
1473 index %= get_max_str_idx(input);
1474 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1475 fname = get_next_str(&str);
1477 if (client_sockaddr_str[0] && unique_filename) {
1478 len = snprintf(target, tlen, "%s/%s.", fname,
1479 client_sockaddr_str);
1481 len = snprintf(target, tlen, "%s%c", fname,
1482 FIO_OS_PATH_SEPARATOR);
1484 target[tlen - 1] = '\0';
1490 char* get_name_by_idx(char *input, int index)
1492 unsigned int cur_idx;
1493 char *fname, *str, *p;
1495 p = str = strdup(input);
1497 index %= get_max_str_idx(input);
1498 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1499 fname = get_next_str(&str);
1501 fname = strdup(fname);
1507 static int str_filename_cb(void *data, const char *input)
1509 struct thread_data *td = cb_data_to_td(data);
1510 char *fname, *str, *p;
1512 p = str = strdup(input);
1514 strip_blank_front(&str);
1515 strip_blank_end(str);
1518 * Ignore what we may already have from nrfiles option.
1520 if (!td->files_index)
1523 while ((fname = get_next_str(&str)) != NULL) {
1526 add_file(td, fname, 0, 1);
1533 static int str_directory_cb(void *data, const char fio_unused *unused)
1535 struct thread_data *td = cb_data_to_td(data);
1537 char *dirname, *str, *p;
1543 p = str = strdup(td->o.directory);
1544 while ((dirname = get_next_str(&str)) != NULL) {
1545 if (lstat(dirname, &sb) < 0) {
1548 log_err("fio: %s is not a directory\n", dirname);
1549 td_verror(td, ret, "lstat");
1552 if (!S_ISDIR(sb.st_mode)) {
1553 log_err("fio: %s is not a directory\n", dirname);
1564 static int str_opendir_cb(void *data, const char fio_unused *str)
1566 struct thread_data *td = cb_data_to_td(data);
1571 if (!td->files_index)
1574 return add_dir_files(td, td->o.opendir);
1577 static int str_buffer_pattern_cb(void *data, const char *input)
1579 struct thread_data *td = cb_data_to_td(data);
1582 /* FIXME: for now buffer pattern does not support formats */
1583 ret = parse_and_fill_pattern_alloc(input, strlen(input),
1584 &td->o.buffer_pattern, NULL, NULL, NULL);
1589 td->o.buffer_pattern_bytes = ret;
1592 * If this job is doing any reading or has compression set,
1593 * ensure that we refill buffers for writes or we could be
1594 * invalidating the pattern through reads.
1596 if (!td->o.compress_percentage && !td_read(td))
1597 td->o.refill_buffers = 0;
1599 td->o.refill_buffers = 1;
1601 td->o.scramble_buffers = 0;
1602 td->o.zero_buffers = 0;
1607 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1609 struct thread_data *td = cb_data_to_td(data);
1611 td->flags |= TD_F_COMPRESS;
1612 td->o.compress_percentage = *il;
1616 static int str_dedupe_cb(void *data, unsigned long long *il)
1618 struct thread_data *td = cb_data_to_td(data);
1620 td->flags |= TD_F_COMPRESS;
1621 td->o.dedupe_percentage = *il;
1622 td->o.refill_buffers = 1;
1626 static int str_verify_pattern_cb(void *data, const char *input)
1628 struct thread_data *td = cb_data_to_td(data);
1631 td->o.verify_fmt_sz = FIO_ARRAY_SIZE(td->o.verify_fmt);
1632 ret = parse_and_fill_pattern_alloc(input, strlen(input),
1633 &td->o.verify_pattern, fmt_desc, td->o.verify_fmt,
1634 &td->o.verify_fmt_sz);
1639 td->o.verify_pattern_bytes = ret;
1641 * VERIFY_* could already be set
1643 if (!fio_option_is_set(&td->o, verify))
1644 td->o.verify = VERIFY_PATTERN;
1649 static int str_gtod_reduce_cb(void *data, int *il)
1651 struct thread_data *td = cb_data_to_td(data);
1655 * Only modify options if gtod_reduce==1
1656 * Otherwise leave settings alone.
1659 td->o.disable_lat = 1;
1660 td->o.disable_clat = 1;
1661 td->o.disable_slat = 1;
1662 td->o.disable_bw = 1;
1663 td->o.clat_percentiles = 0;
1664 td->o.lat_percentiles = 0;
1665 td->o.slat_percentiles = 0;
1666 td->ts_cache_mask = 63;
1672 static int str_offset_cb(void *data, long long *__val)
1674 struct thread_data *td = cb_data_to_td(data);
1675 unsigned long long v = *__val;
1677 if (parse_is_percent(v)) {
1678 td->o.start_offset = 0;
1679 td->o.start_offset_percent = -1ULL - v;
1680 td->o.start_offset_nz = 0;
1681 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1682 td->o.start_offset_percent);
1683 } else if (parse_is_zone(v)) {
1684 td->o.start_offset = 0;
1685 td->o.start_offset_percent = 0;
1686 td->o.start_offset_nz = v - ZONE_BASE_VAL;
1688 td->o.start_offset = v;
1693 static int str_offset_increment_cb(void *data, long long *__val)
1695 struct thread_data *td = cb_data_to_td(data);
1696 unsigned long long v = *__val;
1698 if (parse_is_percent(v)) {
1699 td->o.offset_increment = 0;
1700 td->o.offset_increment_percent = -1ULL - v;
1701 td->o.offset_increment_nz = 0;
1702 dprint(FD_PARSE, "SET offset_increment_percent %d\n",
1703 td->o.offset_increment_percent);
1704 } else if (parse_is_zone(v)) {
1705 td->o.offset_increment = 0;
1706 td->o.offset_increment_percent = 0;
1707 td->o.offset_increment_nz = v - ZONE_BASE_VAL;
1709 td->o.offset_increment = v;
1714 static int str_size_cb(void *data, long long *__val)
1716 struct thread_data *td = cb_data_to_td(data);
1717 unsigned long long v = *__val;
1719 if (parse_is_percent(v)) {
1721 td->o.size_percent = -1ULL - v;
1722 dprint(FD_PARSE, "SET size_percent %d\n",
1723 td->o.size_percent);
1724 } else if (parse_is_zone(v)) {
1726 td->o.size_percent = 0;
1727 td->o.size_nz = v - ZONE_BASE_VAL;
1734 static int str_io_size_cb(void *data, unsigned long long *__val)
1736 struct thread_data *td = cb_data_to_td(data);
1737 unsigned long long v = *__val;
1739 if (parse_is_percent_uncapped(v)) {
1741 td->o.io_size_percent = -1ULL - v;
1742 if (td->o.io_size_percent > 100) {
1743 log_err("fio: io_size values greater than 100%% aren't supported\n");
1746 dprint(FD_PARSE, "SET io_size_percent %d\n",
1747 td->o.io_size_percent);
1748 } else if (parse_is_zone(v)) {
1750 td->o.io_size_percent = 0;
1751 td->o.io_size_nz = v - ZONE_BASE_VAL;
1758 static int str_zoneskip_cb(void *data, long long *__val)
1760 struct thread_data *td = cb_data_to_td(data);
1761 unsigned long long v = *__val;
1763 if (parse_is_zone(v)) {
1764 td->o.zone_skip = 0;
1765 td->o.zone_skip_nz = v - ZONE_BASE_VAL;
1767 td->o.zone_skip = v;
1772 static int str_write_bw_log_cb(void *data, const char *str)
1774 struct thread_data *td = cb_data_to_td(data);
1777 td->o.bw_log_file = strdup(str);
1779 td->o.write_bw_log = 1;
1783 static int str_write_lat_log_cb(void *data, const char *str)
1785 struct thread_data *td = cb_data_to_td(data);
1788 td->o.lat_log_file = strdup(str);
1790 td->o.write_lat_log = 1;
1794 static int str_write_iops_log_cb(void *data, const char *str)
1796 struct thread_data *td = cb_data_to_td(data);
1799 td->o.iops_log_file = strdup(str);
1801 td->o.write_iops_log = 1;
1805 static int str_write_hist_log_cb(void *data, const char *str)
1807 struct thread_data *td = cb_data_to_td(data);
1810 td->o.hist_log_file = strdup(str);
1812 td->o.write_hist_log = 1;
1817 * str is supposed to be a substring of the strdup'd original string,
1818 * and is valid only if it's a regular file path.
1819 * This function keeps the pointer to the path as needed later.
1821 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1822 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1823 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1825 static int str_ioengine_external_cb(void *data, const char *str)
1827 struct thread_data *td = cb_data_to_td(data);
1832 log_err("fio: null external ioengine path\n");
1836 p = (char *)str; /* str is mutable */
1837 strip_blank_front(&p);
1840 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1841 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1845 td->o.ioengine_so_path = p;
1849 static int rw_verify(const struct fio_option *o, void *data)
1851 struct thread_data *td = cb_data_to_td(data);
1853 if (read_only && (td_write(td) || td_trim(td))) {
1854 log_err("fio: job <%s> has write or trim bit set, but"
1855 " fio is in read-only mode\n", td->o.name);
1862 static int gtod_cpu_verify(const struct fio_option *o, void *data)
1864 #ifndef FIO_HAVE_CPU_AFFINITY
1865 struct thread_data *td = cb_data_to_td(data);
1867 if (td->o.gtod_cpu) {
1868 log_err("fio: platform must support CPU affinity for"
1869 "gettimeofday() offloading\n");
1878 * Map of job/command line options
1880 struct fio_option fio_options[FIO_MAX_OPTS] = {
1882 .name = "description",
1883 .lname = "Description of job",
1884 .type = FIO_OPT_STR_STORE,
1885 .off1 = offsetof(struct thread_options, description),
1886 .help = "Text job description",
1887 .category = FIO_OPT_C_GENERAL,
1888 .group = FIO_OPT_G_DESC,
1892 .lname = "Job name",
1893 .type = FIO_OPT_STR_STORE,
1894 .off1 = offsetof(struct thread_options, name),
1895 .help = "Name of this job",
1896 .category = FIO_OPT_C_GENERAL,
1897 .group = FIO_OPT_G_DESC,
1901 .lname = "Waitee name",
1902 .type = FIO_OPT_STR_STORE,
1903 .off1 = offsetof(struct thread_options, wait_for),
1904 .help = "Name of the job this one wants to wait for before starting",
1905 .category = FIO_OPT_C_GENERAL,
1906 .group = FIO_OPT_G_DESC,
1910 .lname = "Filename(s)",
1911 .type = FIO_OPT_STR_STORE,
1912 .off1 = offsetof(struct thread_options, filename),
1914 .cb = str_filename_cb,
1915 .prio = -1, /* must come after "directory" */
1916 .help = "File(s) to use for the workload",
1917 .category = FIO_OPT_C_FILE,
1918 .group = FIO_OPT_G_FILENAME,
1921 .name = "directory",
1922 .lname = "Directory",
1923 .type = FIO_OPT_STR_STORE,
1924 .off1 = offsetof(struct thread_options, directory),
1925 .cb = str_directory_cb,
1926 .help = "Directory to store files in",
1927 .category = FIO_OPT_C_FILE,
1928 .group = FIO_OPT_G_FILENAME,
1931 .name = "filename_format",
1932 .lname = "Filename Format",
1933 .type = FIO_OPT_STR_STORE,
1934 .off1 = offsetof(struct thread_options, filename_format),
1935 .prio = -1, /* must come after "directory" */
1936 .help = "Override default $jobname.$jobnum.$filenum naming",
1937 .def = "$jobname.$jobnum.$filenum",
1938 .category = FIO_OPT_C_FILE,
1939 .group = FIO_OPT_G_FILENAME,
1942 .name = "unique_filename",
1943 .lname = "Unique Filename",
1944 .type = FIO_OPT_BOOL,
1945 .off1 = offsetof(struct thread_options, unique_filename),
1946 .help = "For network clients, prefix file with source IP",
1948 .category = FIO_OPT_C_FILE,
1949 .group = FIO_OPT_G_FILENAME,
1953 .lname = "Lockfile",
1954 .type = FIO_OPT_STR,
1955 .off1 = offsetof(struct thread_options, file_lock_mode),
1956 .help = "Lock file when doing IO to it",
1958 .parent = "filename",
1961 .category = FIO_OPT_C_FILE,
1962 .group = FIO_OPT_G_FILENAME,
1965 .oval = FILE_LOCK_NONE,
1966 .help = "No file locking",
1968 { .ival = "exclusive",
1969 .oval = FILE_LOCK_EXCLUSIVE,
1970 .help = "Exclusive file lock",
1973 .ival = "readwrite",
1974 .oval = FILE_LOCK_READWRITE,
1975 .help = "Read vs write lock",
1981 .lname = "Open directory",
1982 .type = FIO_OPT_STR_STORE,
1983 .off1 = offsetof(struct thread_options, opendir),
1984 .cb = str_opendir_cb,
1985 .help = "Recursively add files from this directory and down",
1986 .category = FIO_OPT_C_FILE,
1987 .group = FIO_OPT_G_FILENAME,
1991 .lname = "Read/write",
1992 .alias = "readwrite",
1993 .type = FIO_OPT_STR,
1995 .off1 = offsetof(struct thread_options, td_ddir),
1996 .help = "IO direction",
1998 .verify = rw_verify,
1999 .category = FIO_OPT_C_IO,
2000 .group = FIO_OPT_G_IO_BASIC,
2003 .oval = TD_DDIR_READ,
2004 .help = "Sequential read",
2007 .oval = TD_DDIR_WRITE,
2008 .help = "Sequential write",
2011 .oval = TD_DDIR_TRIM,
2012 .help = "Sequential trim",
2014 { .ival = "randread",
2015 .oval = TD_DDIR_RANDREAD,
2016 .help = "Random read",
2018 { .ival = "randwrite",
2019 .oval = TD_DDIR_RANDWRITE,
2020 .help = "Random write",
2022 { .ival = "randtrim",
2023 .oval = TD_DDIR_RANDTRIM,
2024 .help = "Random trim",
2028 .help = "Sequential read and write mix",
2030 { .ival = "readwrite",
2032 .help = "Sequential read and write mix",
2035 .oval = TD_DDIR_RANDRW,
2036 .help = "Random read and write mix"
2038 { .ival = "trimwrite",
2039 .oval = TD_DDIR_TRIMWRITE,
2040 .help = "Trim and write mix, trims preceding writes"
2042 { .ival = "randtrimwrite",
2043 .oval = TD_DDIR_RANDTRIMWRITE,
2044 .help = "Randomly trim and write mix, trims preceding writes"
2049 .name = "rw_sequencer",
2050 .lname = "RW Sequencer",
2051 .type = FIO_OPT_STR,
2052 .off1 = offsetof(struct thread_options, rw_seq),
2053 .help = "IO offset generator modifier",
2054 .def = "sequential",
2055 .category = FIO_OPT_C_IO,
2056 .group = FIO_OPT_G_IO_BASIC,
2058 { .ival = "sequential",
2060 .help = "Generate sequential offsets",
2062 { .ival = "identical",
2063 .oval = RW_SEQ_IDENT,
2064 .help = "Generate identical offsets",
2071 .lname = "IO Engine",
2072 .type = FIO_OPT_STR_STORE,
2073 .off1 = offsetof(struct thread_options, ioengine),
2074 .help = "IO engine to use",
2075 .def = FIO_PREFERRED_ENGINE,
2076 .category = FIO_OPT_C_IO,
2077 .group = FIO_OPT_G_IO_BASIC,
2080 .help = "Use read/write",
2083 .help = "Use pread/pwrite",
2086 .help = "Use readv/writev",
2088 #ifdef CONFIG_PWRITEV
2090 .help = "Use preadv/pwritev",
2093 #ifdef FIO_HAVE_PWRITEV2
2094 { .ival = "pvsync2",
2095 .help = "Use preadv2/pwritev2",
2098 #ifdef CONFIG_LIBAIO
2100 .help = "Linux native asynchronous IO",
2103 #ifdef ARCH_HAVE_IOURING
2104 { .ival = "io_uring",
2105 .help = "Fast Linux native aio",
2108 #ifdef CONFIG_POSIXAIO
2109 { .ival = "posixaio",
2110 .help = "POSIX asynchronous IO",
2113 #ifdef CONFIG_SOLARISAIO
2114 { .ival = "solarisaio",
2115 .help = "Solaris native asynchronous IO",
2118 #ifdef CONFIG_WINDOWSAIO
2119 { .ival = "windowsaio",
2120 .help = "Windows native asynchronous IO"
2125 .help = "Rados Block Device asynchronous IO"
2129 .help = "Memory mapped IO"
2131 #ifdef CONFIG_LINUX_SPLICE
2133 .help = "splice/vmsplice based IO",
2135 { .ival = "netsplice",
2136 .help = "splice/vmsplice to/from the network",
2139 #ifdef FIO_HAVE_SGIO
2141 .help = "SCSI generic v3 IO",
2145 .help = "Testing engine (no data transfer)",
2148 .help = "Network IO",
2151 .help = "CPU cycle burner engine",
2155 .help = "RDMA IO engine",
2158 #ifdef CONFIG_LIBRPMA_APM
2159 { .ival = "librpma_apm",
2160 .help = "librpma IO engine in APM mode",
2163 #ifdef CONFIG_LIBRPMA_GPSPM
2164 { .ival = "librpma_gpspm",
2165 .help = "librpma IO engine in GPSPM mode",
2168 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
2169 { .ival = "e4defrag",
2170 .help = "ext4 defrag engine",
2173 #ifdef CONFIG_LINUX_FALLOCATE
2175 .help = "fallocate() file based engine",
2180 .help = "Glusterfs libgfapi(sync) based engine"
2182 { .ival = "gfapi_async",
2183 .help = "Glusterfs libgfapi(async) based engine"
2186 #ifdef CONFIG_LIBHDFS
2187 { .ival = "libhdfs",
2188 .help = "Hadoop Distributed Filesystem (HDFS) engine"
2192 { .ival = "ime_psync",
2193 .help = "DDN's IME synchronous IO engine",
2195 { .ival = "ime_psyncv",
2196 .help = "DDN's IME synchronous IO engine using iovecs",
2198 { .ival = "ime_aio",
2199 .help = "DDN's IME asynchronous IO engine",
2202 #ifdef CONFIG_LINUX_DEVDAX
2203 { .ival = "dev-dax",
2204 .help = "DAX Device based IO engine",
2208 .ival = "filecreate",
2209 .help = "File creation engine",
2211 { .ival = "external",
2212 .help = "Load external engine (append name)",
2213 .cb = str_ioengine_external_cb,
2215 #ifdef CONFIG_LIBPMEM
2216 { .ival = "libpmem",
2217 .help = "PMDK libpmem based IO engine",
2222 .help = "HTTP (WebDAV/S3) IO engine",
2226 .help = "Network Block Device (NBD) IO engine"
2230 .help = "DAOS File System (dfs) IO engine",
2233 #ifdef CONFIG_LIBNFS
2235 .help = "NFS IO engine",
2238 #ifdef CONFIG_LIBXNVME
2240 .help = "XNVME IO engine",
2247 .lname = "IO Depth",
2248 .type = FIO_OPT_INT,
2249 .off1 = offsetof(struct thread_options, iodepth),
2250 .help = "Number of IO buffers to keep in flight",
2254 .category = FIO_OPT_C_IO,
2255 .group = FIO_OPT_G_IO_BASIC,
2258 .name = "iodepth_batch",
2259 .lname = "IO Depth batch",
2260 .alias = "iodepth_batch_submit",
2261 .type = FIO_OPT_INT,
2262 .off1 = offsetof(struct thread_options, iodepth_batch),
2263 .help = "Number of IO buffers to submit in one go",
2264 .parent = "iodepth",
2268 .category = FIO_OPT_C_IO,
2269 .group = FIO_OPT_G_IO_BASIC,
2272 .name = "iodepth_batch_complete_min",
2273 .lname = "Min IO depth batch complete",
2274 .alias = "iodepth_batch_complete",
2275 .type = FIO_OPT_INT,
2276 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
2277 .help = "Min number of IO buffers to retrieve in one go",
2278 .parent = "iodepth",
2283 .category = FIO_OPT_C_IO,
2284 .group = FIO_OPT_G_IO_BASIC,
2287 .name = "iodepth_batch_complete_max",
2288 .lname = "Max IO depth batch complete",
2289 .type = FIO_OPT_INT,
2290 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
2291 .help = "Max number of IO buffers to retrieve in one go",
2292 .parent = "iodepth",
2296 .category = FIO_OPT_C_IO,
2297 .group = FIO_OPT_G_IO_BASIC,
2300 .name = "iodepth_low",
2301 .lname = "IO Depth batch low",
2302 .type = FIO_OPT_INT,
2303 .off1 = offsetof(struct thread_options, iodepth_low),
2304 .help = "Low water mark for queuing depth",
2305 .parent = "iodepth",
2308 .category = FIO_OPT_C_IO,
2309 .group = FIO_OPT_G_IO_BASIC,
2312 .name = "serialize_overlap",
2313 .lname = "Serialize overlap",
2314 .off1 = offsetof(struct thread_options, serialize_overlap),
2315 .type = FIO_OPT_BOOL,
2316 .help = "Wait for in-flight IOs that collide to complete",
2317 .parent = "iodepth",
2319 .category = FIO_OPT_C_IO,
2320 .group = FIO_OPT_G_IO_BASIC,
2323 .name = "io_submit_mode",
2324 .lname = "IO submit mode",
2325 .type = FIO_OPT_STR,
2326 .off1 = offsetof(struct thread_options, io_submit_mode),
2327 .help = "How IO submissions and completions are done",
2329 .category = FIO_OPT_C_IO,
2330 .group = FIO_OPT_G_IO_BASIC,
2333 .oval = IO_MODE_INLINE,
2334 .help = "Submit and complete IO inline",
2336 { .ival = "offload",
2337 .oval = IO_MODE_OFFLOAD,
2338 .help = "Offload submit and complete to threads",
2345 .type = FIO_OPT_STR_VAL_ZONE,
2347 .off1 = offsetof(struct thread_options, size),
2348 .help = "Total size of device or files",
2349 .category = FIO_OPT_C_IO,
2350 .group = FIO_OPT_G_INVALID,
2354 .alias = "io_limit",
2356 .type = FIO_OPT_STR_VAL_ZONE,
2357 .cb = str_io_size_cb,
2358 .off1 = offsetof(struct thread_options, io_size),
2359 .help = "Total size of I/O to be performed",
2360 .category = FIO_OPT_C_IO,
2361 .group = FIO_OPT_G_INVALID,
2364 .name = "fill_device",
2365 .lname = "Fill device",
2367 .type = FIO_OPT_BOOL,
2368 .off1 = offsetof(struct thread_options, fill_device),
2369 .help = "Write until an ENOSPC error occurs",
2371 .category = FIO_OPT_C_FILE,
2372 .group = FIO_OPT_G_INVALID,
2376 .lname = "File size",
2377 .type = FIO_OPT_STR_VAL,
2378 .off1 = offsetof(struct thread_options, file_size_low),
2379 .off2 = offsetof(struct thread_options, file_size_high),
2381 .help = "Size of individual files",
2382 .interval = 1024 * 1024,
2383 .category = FIO_OPT_C_FILE,
2384 .group = FIO_OPT_G_INVALID,
2387 .name = "file_append",
2388 .lname = "File append",
2389 .type = FIO_OPT_BOOL,
2390 .off1 = offsetof(struct thread_options, file_append),
2391 .help = "IO will start at the end of the file(s)",
2393 .category = FIO_OPT_C_FILE,
2394 .group = FIO_OPT_G_INVALID,
2398 .lname = "IO offset",
2399 .alias = "fileoffset",
2400 .type = FIO_OPT_STR_VAL_ZONE,
2401 .cb = str_offset_cb,
2402 .off1 = offsetof(struct thread_options, start_offset),
2403 .help = "Start IO from this offset",
2405 .category = FIO_OPT_C_IO,
2406 .group = FIO_OPT_G_INVALID,
2409 .name = "offset_align",
2410 .lname = "IO offset alignment",
2411 .type = FIO_OPT_INT,
2412 .off1 = offsetof(struct thread_options, start_offset_align),
2413 .help = "Start IO from this offset alignment",
2416 .category = FIO_OPT_C_IO,
2417 .group = FIO_OPT_G_INVALID,
2420 .name = "offset_increment",
2421 .lname = "IO offset increment",
2422 .type = FIO_OPT_STR_VAL_ZONE,
2423 .cb = str_offset_increment_cb,
2424 .off1 = offsetof(struct thread_options, offset_increment),
2425 .help = "What is the increment from one offset to the next",
2429 .category = FIO_OPT_C_IO,
2430 .group = FIO_OPT_G_INVALID,
2433 .name = "number_ios",
2434 .lname = "Number of IOs to perform",
2435 .type = FIO_OPT_STR_VAL,
2436 .off1 = offsetof(struct thread_options, number_ios),
2437 .help = "Force job completion after this number of IOs",
2439 .category = FIO_OPT_C_IO,
2440 .group = FIO_OPT_G_INVALID,
2443 .name = "num_range",
2444 .lname = "Number of ranges",
2445 .type = FIO_OPT_INT,
2446 .off1 = offsetof(struct thread_options, num_range),
2447 .maxval = MAX_TRIM_RANGE,
2448 .help = "Number of ranges for trim command",
2450 .category = FIO_OPT_C_IO,
2451 .group = FIO_OPT_G_INVALID,
2455 .lname = "Block size",
2456 .alias = "blocksize",
2457 .type = FIO_OPT_ULL,
2458 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2459 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2460 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2462 .help = "Block size unit",
2467 .category = FIO_OPT_C_IO,
2468 .group = FIO_OPT_G_INVALID,
2472 .lname = "Block size align",
2473 .alias = "blockalign",
2474 .type = FIO_OPT_ULL,
2475 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2476 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2477 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2479 .help = "IO block offset alignment",
2483 .category = FIO_OPT_C_IO,
2484 .group = FIO_OPT_G_INVALID,
2488 .lname = "Block size range",
2489 .alias = "blocksize_range",
2490 .type = FIO_OPT_RANGE,
2491 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2492 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2493 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2494 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2495 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2496 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2498 .help = "Set block size range (in more detail than bs)",
2502 .category = FIO_OPT_C_IO,
2503 .group = FIO_OPT_G_INVALID,
2507 .lname = "Block size split",
2508 .type = FIO_OPT_STR_ULL,
2509 .cb = str_bssplit_cb,
2510 .off1 = offsetof(struct thread_options, bssplit),
2511 .help = "Set a specific mix of block sizes",
2514 .category = FIO_OPT_C_IO,
2515 .group = FIO_OPT_G_INVALID,
2518 .name = "bs_unaligned",
2519 .lname = "Block size unaligned",
2520 .alias = "blocksize_unaligned",
2521 .type = FIO_OPT_STR_SET,
2522 .off1 = offsetof(struct thread_options, bs_unaligned),
2523 .help = "Don't sector align IO buffer sizes",
2526 .category = FIO_OPT_C_IO,
2527 .group = FIO_OPT_G_INVALID,
2530 .name = "bs_is_seq_rand",
2531 .lname = "Block size division is seq/random (not read/write)",
2532 .type = FIO_OPT_BOOL,
2533 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2534 .help = "Consider any blocksize setting to be sequential,random",
2536 .parent = "blocksize",
2537 .category = FIO_OPT_C_IO,
2538 .group = FIO_OPT_G_INVALID,
2541 .name = "randrepeat",
2542 .alias = "allrandrepeat",
2543 .lname = "Random repeatable",
2544 .type = FIO_OPT_BOOL,
2545 .off1 = offsetof(struct thread_options, rand_repeatable),
2546 .help = "Use repeatable random IO pattern",
2550 .category = FIO_OPT_C_IO,
2551 .group = FIO_OPT_G_RANDOM,
2555 .lname = "The random generator seed",
2556 .type = FIO_OPT_STR_VAL,
2557 .off1 = offsetof(struct thread_options, rand_seed),
2558 .help = "Set the random generator seed value",
2561 .category = FIO_OPT_C_IO,
2562 .group = FIO_OPT_G_RANDOM,
2565 .name = "norandommap",
2566 .lname = "No randommap",
2567 .type = FIO_OPT_STR_SET,
2568 .off1 = offsetof(struct thread_options, norandommap),
2569 .help = "Accept potential duplicate random blocks",
2573 .category = FIO_OPT_C_IO,
2574 .group = FIO_OPT_G_RANDOM,
2577 .name = "softrandommap",
2578 .lname = "Soft randommap",
2579 .type = FIO_OPT_BOOL,
2580 .off1 = offsetof(struct thread_options, softrandommap),
2581 .help = "Set norandommap if randommap allocation fails",
2582 .parent = "norandommap",
2585 .category = FIO_OPT_C_IO,
2586 .group = FIO_OPT_G_RANDOM,
2589 .name = "random_generator",
2590 .lname = "Random Generator",
2591 .type = FIO_OPT_STR,
2592 .off1 = offsetof(struct thread_options, random_generator),
2593 .help = "Type of random number generator to use",
2594 .def = "tausworthe",
2596 { .ival = "tausworthe",
2597 .oval = FIO_RAND_GEN_TAUSWORTHE,
2598 .help = "Strong Tausworthe generator",
2601 .oval = FIO_RAND_GEN_LFSR,
2602 .help = "Variable length LFSR",
2605 .ival = "tausworthe64",
2606 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2607 .help = "64-bit Tausworthe variant",
2610 .category = FIO_OPT_C_IO,
2611 .group = FIO_OPT_G_RANDOM,
2614 .name = "random_distribution",
2615 .lname = "Random Distribution",
2616 .type = FIO_OPT_STR,
2617 .off1 = offsetof(struct thread_options, random_distribution),
2618 .cb = str_random_distribution_cb,
2619 .help = "Random offset distribution generator",
2623 .oval = FIO_RAND_DIST_RANDOM,
2624 .help = "Completely random",
2627 .oval = FIO_RAND_DIST_ZIPF,
2628 .help = "Zipf distribution",
2631 .oval = FIO_RAND_DIST_PARETO,
2632 .help = "Pareto distribution",
2635 .oval = FIO_RAND_DIST_GAUSS,
2636 .help = "Normal (Gaussian) distribution",
2639 .oval = FIO_RAND_DIST_ZONED,
2640 .help = "Zoned random distribution",
2642 { .ival = "zoned_abs",
2643 .oval = FIO_RAND_DIST_ZONED_ABS,
2644 .help = "Zoned absolute random distribution",
2647 .category = FIO_OPT_C_IO,
2648 .group = FIO_OPT_G_RANDOM,
2651 .name = "percentage_random",
2652 .lname = "Percentage Random",
2653 .type = FIO_OPT_INT,
2654 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2655 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2656 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2658 .help = "Percentage of seq/random mix that should be random",
2659 .def = "100,100,100",
2661 .inverse = "percentage_sequential",
2662 .category = FIO_OPT_C_IO,
2663 .group = FIO_OPT_G_RANDOM,
2666 .name = "percentage_sequential",
2667 .lname = "Percentage Sequential",
2668 .type = FIO_OPT_DEPRECATED,
2669 .category = FIO_OPT_C_IO,
2670 .group = FIO_OPT_G_RANDOM,
2674 .lname = "Number of files",
2675 .alias = "nr_files",
2676 .type = FIO_OPT_INT,
2677 .off1 = offsetof(struct thread_options, nr_files),
2678 .help = "Split job workload between this number of files",
2681 .category = FIO_OPT_C_FILE,
2682 .group = FIO_OPT_G_INVALID,
2685 .name = "openfiles",
2686 .lname = "Number of open files",
2687 .type = FIO_OPT_INT,
2688 .off1 = offsetof(struct thread_options, open_files),
2689 .help = "Number of files to keep open at the same time",
2690 .category = FIO_OPT_C_FILE,
2691 .group = FIO_OPT_G_INVALID,
2694 .name = "file_service_type",
2695 .lname = "File service type",
2696 .type = FIO_OPT_STR,
2698 .off1 = offsetof(struct thread_options, file_service_type),
2699 .help = "How to select which file to service next",
2700 .def = "roundrobin",
2701 .category = FIO_OPT_C_FILE,
2702 .group = FIO_OPT_G_INVALID,
2705 .oval = FIO_FSERVICE_RANDOM,
2706 .help = "Choose a file at random (uniform)",
2709 .oval = FIO_FSERVICE_ZIPF,
2710 .help = "Zipf randomized",
2713 .oval = FIO_FSERVICE_PARETO,
2714 .help = "Pareto randomized",
2717 .oval = FIO_FSERVICE_GAUSS,
2718 .help = "Normal (Gaussian) randomized",
2721 .oval = FIO_FSERVICE_GAUSS,
2722 .help = "Alias for normal",
2724 { .ival = "roundrobin",
2725 .oval = FIO_FSERVICE_RR,
2726 .help = "Round robin select files",
2728 { .ival = "sequential",
2729 .oval = FIO_FSERVICE_SEQ,
2730 .help = "Finish one file before moving to the next",
2733 .parent = "nrfiles",
2737 .name = "fallocate",
2738 .lname = "Fallocate",
2739 .type = FIO_OPT_STR,
2740 .off1 = offsetof(struct thread_options, fallocate_mode),
2741 .help = "Whether pre-allocation is performed when laying out files",
2742 #ifdef FIO_HAVE_DEFAULT_FALLOCATE
2747 .category = FIO_OPT_C_FILE,
2748 .group = FIO_OPT_G_INVALID,
2751 .oval = FIO_FALLOCATE_NONE,
2752 .help = "Do not pre-allocate space",
2755 .oval = FIO_FALLOCATE_NATIVE,
2756 .help = "Use native pre-allocation if possible",
2758 #ifdef CONFIG_POSIX_FALLOCATE
2760 .oval = FIO_FALLOCATE_POSIX,
2761 .help = "Use posix_fallocate()",
2764 #ifdef CONFIG_LINUX_FALLOCATE
2766 .oval = FIO_FALLOCATE_KEEP_SIZE,
2767 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2770 { .ival = "truncate",
2771 .oval = FIO_FALLOCATE_TRUNCATE,
2772 .help = "Truncate file to final size instead of allocating"
2774 /* Compatibility with former boolean values */
2776 .oval = FIO_FALLOCATE_NONE,
2777 .help = "Alias for 'none'",
2779 #ifdef CONFIG_POSIX_FALLOCATE
2781 .oval = FIO_FALLOCATE_POSIX,
2782 .help = "Alias for 'posix'",
2788 .name = "fadvise_hint",
2789 .lname = "Fadvise hint",
2790 .type = FIO_OPT_STR,
2791 .off1 = offsetof(struct thread_options, fadvise_hint),
2795 .help = "Don't issue fadvise/madvise",
2799 .help = "Advise using fio IO pattern",
2802 .oval = F_ADV_RANDOM,
2803 .help = "Advise using FADV_RANDOM",
2805 { .ival = "sequential",
2806 .oval = F_ADV_SEQUENTIAL,
2807 .help = "Advise using FADV_SEQUENTIAL",
2809 #ifdef POSIX_FADV_NOREUSE
2810 { .ival = "noreuse",
2811 .oval = F_ADV_NOREUSE,
2812 .help = "Advise using FADV_NOREUSE",
2816 .help = "Use fadvise() to advise the kernel on IO pattern",
2818 .category = FIO_OPT_C_FILE,
2819 .group = FIO_OPT_G_INVALID,
2824 .type = FIO_OPT_INT,
2825 .off1 = offsetof(struct thread_options, fsync_blocks),
2826 .help = "Issue fsync for writes every given number of blocks",
2829 .category = FIO_OPT_C_FILE,
2830 .group = FIO_OPT_G_INVALID,
2833 .name = "fdatasync",
2834 .lname = "Fdatasync",
2835 .type = FIO_OPT_INT,
2836 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2837 .help = "Issue fdatasync for writes every given number of blocks",
2840 .category = FIO_OPT_C_FILE,
2841 .group = FIO_OPT_G_INVALID,
2844 .name = "write_barrier",
2845 .lname = "Write barrier",
2846 .type = FIO_OPT_INT,
2847 .off1 = offsetof(struct thread_options, barrier_blocks),
2848 .help = "Make every Nth write a barrier write",
2851 .category = FIO_OPT_C_IO,
2852 .group = FIO_OPT_G_INVALID,
2854 #ifdef CONFIG_SYNC_FILE_RANGE
2856 .name = "sync_file_range",
2857 .lname = "Sync file range",
2859 { .ival = "wait_before",
2860 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2861 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2865 .oval = SYNC_FILE_RANGE_WRITE,
2866 .help = "SYNC_FILE_RANGE_WRITE",
2870 .ival = "wait_after",
2871 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2872 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2876 .type = FIO_OPT_STR_MULTI,
2878 .off1 = offsetof(struct thread_options, sync_file_range),
2879 .help = "Use sync_file_range()",
2880 .category = FIO_OPT_C_FILE,
2881 .group = FIO_OPT_G_INVALID,
2885 .name = "sync_file_range",
2886 .lname = "Sync file range",
2887 .type = FIO_OPT_UNSUPPORTED,
2888 .help = "Your platform does not support sync_file_range",
2893 .lname = "Direct I/O",
2894 .type = FIO_OPT_BOOL,
2895 .off1 = offsetof(struct thread_options, odirect),
2896 .help = "Use O_DIRECT IO (negates buffered)",
2898 .inverse = "buffered",
2899 .category = FIO_OPT_C_IO,
2900 .group = FIO_OPT_G_IO_TYPE,
2904 .lname = "Atomic I/O",
2905 .type = FIO_OPT_BOOL,
2906 .off1 = offsetof(struct thread_options, oatomic),
2907 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2909 .category = FIO_OPT_C_IO,
2910 .group = FIO_OPT_G_IO_TYPE,
2914 .lname = "Buffered I/O",
2915 .type = FIO_OPT_BOOL,
2916 .off1 = offsetof(struct thread_options, odirect),
2918 .help = "Use buffered IO (negates direct)",
2920 .inverse = "direct",
2921 .category = FIO_OPT_C_IO,
2922 .group = FIO_OPT_G_IO_TYPE,
2925 .name = "overwrite",
2926 .lname = "Overwrite",
2927 .type = FIO_OPT_BOOL,
2928 .off1 = offsetof(struct thread_options, overwrite),
2929 .help = "When writing, set whether to overwrite current data",
2931 .category = FIO_OPT_C_FILE,
2932 .group = FIO_OPT_G_INVALID,
2937 .type = FIO_OPT_INT,
2938 .off1 = offsetof(struct thread_options, loops),
2939 .help = "Number of times to run the job",
2942 .category = FIO_OPT_C_GENERAL,
2943 .group = FIO_OPT_G_RUNTIME,
2947 .lname = "Number of jobs",
2948 .type = FIO_OPT_INT,
2949 .off1 = offsetof(struct thread_options, numjobs),
2950 .help = "Duplicate this job this many times",
2953 .category = FIO_OPT_C_GENERAL,
2954 .group = FIO_OPT_G_RUNTIME,
2957 .name = "startdelay",
2958 .lname = "Start delay",
2959 .type = FIO_OPT_STR_VAL_TIME,
2960 .off1 = offsetof(struct thread_options, start_delay),
2961 .off2 = offsetof(struct thread_options, start_delay_high),
2962 .help = "Only start job when this period has passed",
2966 .category = FIO_OPT_C_GENERAL,
2967 .group = FIO_OPT_G_RUNTIME,
2973 .type = FIO_OPT_STR_VAL_TIME,
2974 .off1 = offsetof(struct thread_options, timeout),
2975 .help = "Stop workload when this amount of time has passed",
2979 .category = FIO_OPT_C_GENERAL,
2980 .group = FIO_OPT_G_RUNTIME,
2983 .name = "time_based",
2984 .lname = "Time based",
2985 .type = FIO_OPT_STR_SET,
2986 .off1 = offsetof(struct thread_options, time_based),
2987 .help = "Keep running until runtime/timeout is met",
2988 .category = FIO_OPT_C_GENERAL,
2989 .group = FIO_OPT_G_RUNTIME,
2992 .name = "verify_only",
2993 .lname = "Verify only",
2994 .type = FIO_OPT_STR_SET,
2995 .off1 = offsetof(struct thread_options, verify_only),
2996 .help = "Verifies previously written data is still valid",
2997 .category = FIO_OPT_C_GENERAL,
2998 .group = FIO_OPT_G_RUNTIME,
3001 .name = "ramp_time",
3002 .lname = "Ramp time",
3003 .type = FIO_OPT_STR_VAL_TIME,
3004 .off1 = offsetof(struct thread_options, ramp_time),
3005 .help = "Ramp up time before measuring performance",
3008 .category = FIO_OPT_C_GENERAL,
3009 .group = FIO_OPT_G_RUNTIME,
3012 .name = "clocksource",
3013 .lname = "Clock source",
3014 .type = FIO_OPT_STR,
3015 .cb = fio_clock_source_cb,
3016 .off1 = offsetof(struct thread_options, clocksource),
3017 .help = "What type of timing source to use",
3018 .category = FIO_OPT_C_GENERAL,
3019 .group = FIO_OPT_G_CLOCK,
3021 #ifdef CONFIG_GETTIMEOFDAY
3022 { .ival = "gettimeofday",
3024 .help = "Use gettimeofday(2) for timing",
3027 #ifdef CONFIG_CLOCK_GETTIME
3028 { .ival = "clock_gettime",
3029 .oval = CS_CGETTIME,
3030 .help = "Use clock_gettime(2) for timing",
3033 #ifdef ARCH_HAVE_CPU_CLOCK
3035 .oval = CS_CPUCLOCK,
3036 .help = "Use CPU private clock",
3044 .lname = "I/O Memory",
3045 .type = FIO_OPT_STR,
3047 .off1 = offsetof(struct thread_options, mem_type),
3048 .help = "Backing type for IO buffers",
3050 .category = FIO_OPT_C_IO,
3051 .group = FIO_OPT_G_INVALID,
3055 .help = "Use malloc(3) for IO buffers",
3057 #ifndef CONFIG_NO_SHM
3060 .help = "Use shared memory segments for IO buffers",
3062 #ifdef FIO_HAVE_HUGETLB
3063 { .ival = "shmhuge",
3064 .oval = MEM_SHMHUGE,
3065 .help = "Like shm, but use huge pages",
3071 .help = "Use mmap(2) (file or anon) for IO buffers",
3073 { .ival = "mmapshared",
3074 .oval = MEM_MMAPSHARED,
3075 .help = "Like mmap, but use the shared flag",
3077 #ifdef FIO_HAVE_HUGETLB
3078 { .ival = "mmaphuge",
3079 .oval = MEM_MMAPHUGE,
3080 .help = "Like mmap, but use huge pages",
3084 { .ival = "cudamalloc",
3085 .oval = MEM_CUDA_MALLOC,
3086 .help = "Allocate GPU device memory for GPUDirect RDMA",
3092 .name = "iomem_align",
3093 .alias = "mem_align",
3094 .lname = "I/O memory alignment",
3095 .type = FIO_OPT_INT,
3096 .off1 = offsetof(struct thread_options, mem_align),
3098 .help = "IO memory buffer offset alignment",
3102 .category = FIO_OPT_C_IO,
3103 .group = FIO_OPT_G_INVALID,
3108 .type = FIO_OPT_STR,
3109 .off1 = offsetof(struct thread_options, verify),
3110 .help = "Verify data written",
3112 .category = FIO_OPT_C_IO,
3113 .group = FIO_OPT_G_VERIFY,
3116 .oval = VERIFY_NONE,
3117 .help = "Don't do IO verification",
3121 .help = "Use md5 checksums for verification",
3124 .oval = VERIFY_CRC64,
3125 .help = "Use crc64 checksums for verification",
3128 .oval = VERIFY_CRC32,
3129 .help = "Use crc32 checksums for verification",
3131 { .ival = "crc32c-intel",
3132 .oval = VERIFY_CRC32C,
3133 .help = "Use crc32c checksums for verification (hw assisted, if available)",
3136 .oval = VERIFY_CRC32C,
3137 .help = "Use crc32c checksums for verification (hw assisted, if available)",
3140 .oval = VERIFY_CRC16,
3141 .help = "Use crc16 checksums for verification",
3144 .oval = VERIFY_CRC7,
3145 .help = "Use crc7 checksums for verification",
3148 .oval = VERIFY_SHA1,
3149 .help = "Use sha1 checksums for verification",
3152 .oval = VERIFY_SHA256,
3153 .help = "Use sha256 checksums for verification",
3156 .oval = VERIFY_SHA512,
3157 .help = "Use sha512 checksums for verification",
3159 { .ival = "sha3-224",
3160 .oval = VERIFY_SHA3_224,
3161 .help = "Use sha3-224 checksums for verification",
3163 { .ival = "sha3-256",
3164 .oval = VERIFY_SHA3_256,
3165 .help = "Use sha3-256 checksums for verification",
3167 { .ival = "sha3-384",
3168 .oval = VERIFY_SHA3_384,
3169 .help = "Use sha3-384 checksums for verification",
3171 { .ival = "sha3-512",
3172 .oval = VERIFY_SHA3_512,
3173 .help = "Use sha3-512 checksums for verification",
3176 .oval = VERIFY_XXHASH,
3177 .help = "Use xxhash checksums for verification",
3179 /* Meta information was included into verify_header,
3180 * 'meta' verification is implied by default. */
3182 .oval = VERIFY_HDR_ONLY,
3183 .help = "Use io information for verification. "
3184 "Now is implied by default, thus option is obsolete, "
3187 { .ival = "pattern",
3188 .oval = VERIFY_PATTERN_NO_HDR,
3189 .help = "Verify strict pattern",
3193 .oval = VERIFY_NULL,
3194 .help = "Pretend to verify",
3199 .name = "do_verify",
3200 .lname = "Perform verify step",
3201 .type = FIO_OPT_BOOL,
3202 .off1 = offsetof(struct thread_options, do_verify),
3203 .help = "Run verification stage after write",
3207 .category = FIO_OPT_C_IO,
3208 .group = FIO_OPT_G_VERIFY,
3211 .name = "verifysort",
3212 .lname = "Verify sort",
3213 .type = FIO_OPT_SOFT_DEPRECATED,
3214 .category = FIO_OPT_C_IO,
3215 .group = FIO_OPT_G_VERIFY,
3218 .name = "verifysort_nr",
3219 .lname = "Verify Sort Nr",
3220 .type = FIO_OPT_SOFT_DEPRECATED,
3221 .category = FIO_OPT_C_IO,
3222 .group = FIO_OPT_G_VERIFY,
3225 .name = "verify_interval",
3226 .lname = "Verify interval",
3227 .type = FIO_OPT_INT,
3228 .off1 = offsetof(struct thread_options, verify_interval),
3229 .minval = 2 * sizeof(struct verify_header),
3230 .help = "Store verify buffer header every N bytes",
3233 .interval = 2 * sizeof(struct verify_header),
3234 .category = FIO_OPT_C_IO,
3235 .group = FIO_OPT_G_VERIFY,
3238 .name = "verify_offset",
3239 .lname = "Verify offset",
3240 .type = FIO_OPT_INT,
3241 .help = "Offset verify header location by N bytes",
3242 .off1 = offsetof(struct thread_options, verify_offset),
3243 .minval = sizeof(struct verify_header),
3246 .category = FIO_OPT_C_IO,
3247 .group = FIO_OPT_G_VERIFY,
3250 .name = "verify_pattern",
3251 .lname = "Verify pattern",
3252 .type = FIO_OPT_STR,
3253 .cb = str_verify_pattern_cb,
3254 .off1 = offsetof(struct thread_options, verify_pattern),
3255 .help = "Fill pattern for IO buffers",
3258 .category = FIO_OPT_C_IO,
3259 .group = FIO_OPT_G_VERIFY,
3262 .name = "verify_fatal",
3263 .lname = "Verify fatal",
3264 .type = FIO_OPT_BOOL,
3265 .off1 = offsetof(struct thread_options, verify_fatal),
3267 .help = "Exit on a single verify failure, don't continue",
3270 .category = FIO_OPT_C_IO,
3271 .group = FIO_OPT_G_VERIFY,
3274 .name = "verify_dump",
3275 .lname = "Verify dump",
3276 .type = FIO_OPT_BOOL,
3277 .off1 = offsetof(struct thread_options, verify_dump),
3279 .help = "Dump contents of good and bad blocks on failure",
3282 .category = FIO_OPT_C_IO,
3283 .group = FIO_OPT_G_VERIFY,
3286 .name = "verify_async",
3287 .lname = "Verify asynchronously",
3288 .type = FIO_OPT_INT,
3289 .off1 = offsetof(struct thread_options, verify_async),
3291 .help = "Number of async verifier threads to use",
3294 .category = FIO_OPT_C_IO,
3295 .group = FIO_OPT_G_VERIFY,
3298 .name = "verify_backlog",
3299 .lname = "Verify backlog",
3300 .type = FIO_OPT_STR_VAL,
3301 .off1 = offsetof(struct thread_options, verify_backlog),
3302 .help = "Verify after this number of blocks are written",
3305 .category = FIO_OPT_C_IO,
3306 .group = FIO_OPT_G_VERIFY,
3309 .name = "verify_backlog_batch",
3310 .lname = "Verify backlog batch",
3311 .type = FIO_OPT_INT,
3312 .off1 = offsetof(struct thread_options, verify_batch),
3313 .help = "Verify this number of IO blocks",
3316 .category = FIO_OPT_C_IO,
3317 .group = FIO_OPT_G_VERIFY,
3319 #ifdef FIO_HAVE_CPU_AFFINITY
3321 .name = "verify_async_cpus",
3322 .lname = "Async verify CPUs",
3323 .type = FIO_OPT_STR,
3324 .cb = str_verify_cpus_allowed_cb,
3325 .off1 = offsetof(struct thread_options, verify_cpumask),
3326 .help = "Set CPUs allowed for async verify threads",
3327 .parent = "verify_async",
3329 .category = FIO_OPT_C_IO,
3330 .group = FIO_OPT_G_VERIFY,
3334 .name = "verify_async_cpus",
3335 .lname = "Async verify CPUs",
3336 .type = FIO_OPT_UNSUPPORTED,
3337 .help = "Your platform does not support CPU affinities",
3341 .name = "experimental_verify",
3342 .lname = "Experimental Verify",
3343 .off1 = offsetof(struct thread_options, experimental_verify),
3344 .type = FIO_OPT_BOOL,
3345 .help = "Enable experimental verification",
3347 .category = FIO_OPT_C_IO,
3348 .group = FIO_OPT_G_VERIFY,
3351 .name = "verify_state_load",
3352 .lname = "Load verify state",
3353 .off1 = offsetof(struct thread_options, verify_state),
3354 .type = FIO_OPT_BOOL,
3355 .help = "Load verify termination state",
3357 .category = FIO_OPT_C_IO,
3358 .group = FIO_OPT_G_VERIFY,
3361 .name = "verify_state_save",
3362 .lname = "Save verify state",
3363 .off1 = offsetof(struct thread_options, verify_state_save),
3364 .type = FIO_OPT_BOOL,
3366 .help = "Save verify state on termination",
3368 .category = FIO_OPT_C_IO,
3369 .group = FIO_OPT_G_VERIFY,
3371 #ifdef FIO_HAVE_TRIM
3373 .name = "trim_percentage",
3374 .lname = "Trim percentage",
3375 .type = FIO_OPT_INT,
3376 .off1 = offsetof(struct thread_options, trim_percentage),
3379 .help = "Number of verify blocks to trim (i.e., discard)",
3384 .category = FIO_OPT_C_IO,
3385 .group = FIO_OPT_G_TRIM,
3388 .name = "trim_verify_zero",
3389 .lname = "Verify trim zero",
3390 .type = FIO_OPT_BOOL,
3391 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3392 .off1 = offsetof(struct thread_options, trim_zero),
3393 .parent = "trim_percentage",
3396 .category = FIO_OPT_C_IO,
3397 .group = FIO_OPT_G_TRIM,
3400 .name = "trim_backlog",
3401 .lname = "Trim backlog",
3402 .type = FIO_OPT_STR_VAL,
3403 .off1 = offsetof(struct thread_options, trim_backlog),
3404 .help = "Trim after this number of blocks are written",
3405 .parent = "trim_percentage",
3408 .category = FIO_OPT_C_IO,
3409 .group = FIO_OPT_G_TRIM,
3412 .name = "trim_backlog_batch",
3413 .lname = "Trim backlog batch",
3414 .type = FIO_OPT_INT,
3415 .off1 = offsetof(struct thread_options, trim_batch),
3416 .help = "Trim this number of IO blocks",
3417 .parent = "trim_percentage",
3420 .category = FIO_OPT_C_IO,
3421 .group = FIO_OPT_G_TRIM,
3425 .name = "trim_percentage",
3426 .lname = "Trim percentage",
3427 .type = FIO_OPT_UNSUPPORTED,
3428 .help = "Fio does not support TRIM on your platform",
3431 .name = "trim_verify_zero",
3432 .lname = "Verify trim zero",
3433 .type = FIO_OPT_UNSUPPORTED,
3434 .help = "Fio does not support TRIM on your platform",
3437 .name = "trim_backlog",
3438 .lname = "Trim backlog",
3439 .type = FIO_OPT_UNSUPPORTED,
3440 .help = "Fio does not support TRIM on your platform",
3443 .name = "trim_backlog_batch",
3444 .lname = "Trim backlog batch",
3445 .type = FIO_OPT_UNSUPPORTED,
3446 .help = "Fio does not support TRIM on your platform",
3450 .name = "write_iolog",
3451 .lname = "Write I/O log",
3452 .type = FIO_OPT_STR_STORE,
3453 .off1 = offsetof(struct thread_options, write_iolog_file),
3454 .help = "Store IO pattern to file",
3455 .category = FIO_OPT_C_IO,
3456 .group = FIO_OPT_G_IOLOG,
3459 .name = "read_iolog",
3460 .lname = "Read I/O log",
3461 .type = FIO_OPT_STR_STORE,
3462 .off1 = offsetof(struct thread_options, read_iolog_file),
3463 .help = "Playback IO pattern from file",
3464 .category = FIO_OPT_C_IO,
3465 .group = FIO_OPT_G_IOLOG,
3468 .name = "read_iolog_chunked",
3469 .lname = "Read I/O log in parts",
3470 .type = FIO_OPT_BOOL,
3471 .off1 = offsetof(struct thread_options, read_iolog_chunked),
3473 .parent = "read_iolog",
3474 .help = "Parse IO pattern in chunks",
3475 .category = FIO_OPT_C_IO,
3476 .group = FIO_OPT_G_IOLOG,
3479 .name = "replay_no_stall",
3480 .lname = "Don't stall on replay",
3481 .type = FIO_OPT_BOOL,
3482 .off1 = offsetof(struct thread_options, no_stall),
3484 .parent = "read_iolog",
3486 .help = "Playback IO pattern file as fast as possible without stalls",
3487 .category = FIO_OPT_C_IO,
3488 .group = FIO_OPT_G_IOLOG,
3491 .name = "replay_redirect",
3492 .lname = "Redirect device for replay",
3493 .type = FIO_OPT_STR_STORE,
3494 .off1 = offsetof(struct thread_options, replay_redirect),
3495 .parent = "read_iolog",
3497 .help = "Replay all I/O onto this device, regardless of trace device",
3498 .category = FIO_OPT_C_IO,
3499 .group = FIO_OPT_G_IOLOG,
3502 .name = "replay_scale",
3503 .lname = "Replace offset scale factor",
3504 .type = FIO_OPT_INT,
3505 .off1 = offsetof(struct thread_options, replay_scale),
3506 .parent = "read_iolog",
3508 .help = "Align offsets to this blocksize",
3509 .category = FIO_OPT_C_IO,
3510 .group = FIO_OPT_G_IOLOG,
3513 .name = "replay_align",
3514 .lname = "Replace alignment",
3515 .type = FIO_OPT_INT,
3516 .off1 = offsetof(struct thread_options, replay_align),
3517 .parent = "read_iolog",
3518 .help = "Scale offset down by this factor",
3519 .category = FIO_OPT_C_IO,
3520 .group = FIO_OPT_G_IOLOG,
3524 .name = "replay_time_scale",
3525 .lname = "Replay Time Scale",
3526 .type = FIO_OPT_INT,
3527 .off1 = offsetof(struct thread_options, replay_time_scale),
3530 .parent = "read_iolog",
3532 .help = "Scale time for replay events",
3533 .category = FIO_OPT_C_IO,
3534 .group = FIO_OPT_G_IOLOG,
3537 .name = "replay_skip",
3538 .lname = "Replay Skip",
3539 .type = FIO_OPT_STR,
3540 .cb = str_replay_skip_cb,
3541 .off1 = offsetof(struct thread_options, replay_skip),
3542 .parent = "read_iolog",
3543 .help = "Skip certain IO types (read,write,trim,flush)",
3544 .category = FIO_OPT_C_IO,
3545 .group = FIO_OPT_G_IOLOG,
3548 .name = "merge_blktrace_file",
3549 .lname = "Merged blktrace output filename",
3550 .type = FIO_OPT_STR_STORE,
3551 .off1 = offsetof(struct thread_options, merge_blktrace_file),
3552 .help = "Merged blktrace output filename",
3553 .category = FIO_OPT_C_IO,
3554 .group = FIO_OPT_G_IOLOG,
3557 .name = "merge_blktrace_scalars",
3558 .lname = "Percentage to scale each trace",
3559 .type = FIO_OPT_FLOAT_LIST,
3560 .off1 = offsetof(struct thread_options, merge_blktrace_scalars),
3561 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3562 .help = "Percentage to scale each trace",
3563 .category = FIO_OPT_C_IO,
3564 .group = FIO_OPT_G_IOLOG,
3567 .name = "merge_blktrace_iters",
3568 .lname = "Number of iterations to run per trace",
3569 .type = FIO_OPT_FLOAT_LIST,
3570 .off1 = offsetof(struct thread_options, merge_blktrace_iters),
3571 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3572 .help = "Number of iterations to run per trace",
3573 .category = FIO_OPT_C_IO,
3574 .group = FIO_OPT_G_IOLOG,
3577 .name = "exec_prerun",
3578 .lname = "Pre-execute runnable",
3579 .type = FIO_OPT_STR_STORE,
3580 .off1 = offsetof(struct thread_options, exec_prerun),
3581 .help = "Execute this file prior to running job",
3582 .category = FIO_OPT_C_GENERAL,
3583 .group = FIO_OPT_G_INVALID,
3586 .name = "exec_postrun",
3587 .lname = "Post-execute runnable",
3588 .type = FIO_OPT_STR_STORE,
3589 .off1 = offsetof(struct thread_options, exec_postrun),
3590 .help = "Execute this file after running job",
3591 .category = FIO_OPT_C_GENERAL,
3592 .group = FIO_OPT_G_INVALID,
3594 #ifdef FIO_HAVE_IOSCHED_SWITCH
3596 .name = "ioscheduler",
3597 .lname = "I/O scheduler",
3598 .type = FIO_OPT_STR_STORE,
3599 .off1 = offsetof(struct thread_options, ioscheduler),
3600 .help = "Use this IO scheduler on the backing device",
3601 .category = FIO_OPT_C_FILE,
3602 .group = FIO_OPT_G_INVALID,
3606 .name = "ioscheduler",
3607 .lname = "I/O scheduler",
3608 .type = FIO_OPT_UNSUPPORTED,
3609 .help = "Your platform does not support IO scheduler switching",
3614 .lname = "Zone mode",
3615 .help = "Mode for the zonesize, zonerange and zoneskip parameters",
3616 .type = FIO_OPT_STR,
3617 .off1 = offsetof(struct thread_options, zone_mode),
3619 .category = FIO_OPT_C_IO,
3620 .group = FIO_OPT_G_ZONE,
3623 .oval = ZONE_MODE_NONE,
3624 .help = "no zoning",
3626 { .ival = "strided",
3627 .oval = ZONE_MODE_STRIDED,
3628 .help = "strided mode - random I/O is restricted to a single zone",
3631 .oval = ZONE_MODE_ZBD,
3632 .help = "zoned block device mode - random I/O selects one of multiple zones randomly",
3638 .lname = "Zone size",
3639 .type = FIO_OPT_STR_VAL,
3640 .off1 = offsetof(struct thread_options, zone_size),
3641 .help = "Amount of data to read per zone",
3643 .interval = 1024 * 1024,
3644 .category = FIO_OPT_C_IO,
3645 .group = FIO_OPT_G_ZONE,
3648 .name = "zonecapacity",
3649 .lname = "Zone capacity",
3650 .type = FIO_OPT_STR_VAL,
3651 .off1 = offsetof(struct thread_options, zone_capacity),
3652 .help = "Capacity per zone",
3654 .interval = 1024 * 1024,
3655 .category = FIO_OPT_C_IO,
3656 .group = FIO_OPT_G_ZONE,
3659 .name = "zonerange",
3660 .lname = "Zone range",
3661 .type = FIO_OPT_STR_VAL,
3662 .off1 = offsetof(struct thread_options, zone_range),
3663 .help = "Give size of an IO zone",
3665 .interval = 1024 * 1024,
3666 .category = FIO_OPT_C_IO,
3667 .group = FIO_OPT_G_ZONE,
3671 .lname = "Zone skip",
3672 .type = FIO_OPT_STR_VAL_ZONE,
3673 .cb = str_zoneskip_cb,
3674 .off1 = offsetof(struct thread_options, zone_skip),
3675 .help = "Space between IO zones",
3677 .category = FIO_OPT_C_IO,
3678 .group = FIO_OPT_G_ZONE,
3681 .name = "read_beyond_wp",
3682 .lname = "Allow reads beyond the zone write pointer",
3683 .type = FIO_OPT_BOOL,
3684 .off1 = offsetof(struct thread_options, read_beyond_wp),
3685 .help = "Allow reads beyond the zone write pointer",
3687 .category = FIO_OPT_C_IO,
3688 .group = FIO_OPT_G_INVALID,
3691 .name = "max_open_zones",
3692 .lname = "Per device/file maximum number of open zones",
3693 .type = FIO_OPT_INT,
3694 .off1 = offsetof(struct thread_options, max_open_zones),
3695 .maxval = ZBD_MAX_WRITE_ZONES,
3696 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd",
3698 .category = FIO_OPT_C_IO,
3699 .group = FIO_OPT_G_INVALID,
3702 .name = "job_max_open_zones",
3703 .lname = "Job maximum number of open zones",
3704 .type = FIO_OPT_INT,
3705 .off1 = offsetof(struct thread_options, job_max_open_zones),
3706 .maxval = ZBD_MAX_WRITE_ZONES,
3707 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd by one thread/process",
3709 .category = FIO_OPT_C_IO,
3710 .group = FIO_OPT_G_INVALID,
3713 .name = "ignore_zone_limits",
3714 .lname = "Ignore zone resource limits",
3715 .type = FIO_OPT_BOOL,
3716 .off1 = offsetof(struct thread_options, ignore_zone_limits),
3718 .help = "Ignore the zone resource limits (max open/active zones) reported by the device",
3719 .category = FIO_OPT_C_IO,
3720 .group = FIO_OPT_G_INVALID,
3723 .name = "zone_reset_threshold",
3724 .lname = "Zone reset threshold",
3725 .help = "Zoned block device reset threshold",
3726 .type = FIO_OPT_FLOAT_LIST,
3728 .off1 = offsetof(struct thread_options, zrt),
3731 .category = FIO_OPT_C_IO,
3732 .group = FIO_OPT_G_ZONE,
3735 .name = "zone_reset_frequency",
3736 .lname = "Zone reset frequency",
3737 .help = "Zoned block device zone reset frequency in HZ",
3738 .type = FIO_OPT_FLOAT_LIST,
3740 .off1 = offsetof(struct thread_options, zrf),
3743 .category = FIO_OPT_C_IO,
3744 .group = FIO_OPT_G_ZONE,
3748 .lname = "Flexible data placement",
3749 .type = FIO_OPT_BOOL,
3750 .off1 = offsetof(struct thread_options, fdp),
3751 .help = "Use Data placement directive (FDP)",
3753 .category = FIO_OPT_C_IO,
3754 .group = FIO_OPT_G_INVALID,
3757 .name = "dataplacement",
3758 .alias = "data_placement",
3759 .lname = "Data Placement interface",
3760 .type = FIO_OPT_STR,
3761 .off1 = offsetof(struct thread_options, dp_type),
3762 .help = "Data Placement interface to use",
3764 .category = FIO_OPT_C_IO,
3765 .group = FIO_OPT_G_INVALID,
3768 .oval = FIO_DP_NONE,
3769 .help = "Do not specify a data placement interface",
3773 .help = "Use Flexible Data Placement interface",
3775 { .ival = "streams",
3776 .oval = FIO_DP_STREAMS,
3777 .help = "Use Streams interface",
3782 .name = "plid_select",
3783 .alias = "fdp_pli_select",
3784 .lname = "Data Placement ID selection strategy",
3785 .type = FIO_OPT_STR,
3786 .off1 = offsetof(struct thread_options, dp_id_select),
3787 .help = "Strategy for selecting next Data Placement ID",
3788 .def = "roundrobin",
3789 .category = FIO_OPT_C_IO,
3790 .group = FIO_OPT_G_INVALID,
3793 .oval = FIO_DP_RANDOM,
3794 .help = "Choose a Placement ID at random (uniform)",
3796 { .ival = "roundrobin",
3798 .help = "Round robin select Placement IDs",
3801 .oval = FIO_DP_SCHEME,
3802 .help = "Use a scheme(based on LBA) to select Placement IDs",
3809 .lname = "Stream IDs/Data Placement ID indices",
3810 .type = FIO_OPT_STR,
3811 .cb = str_fdp_pli_cb,
3812 .off1 = offsetof(struct thread_options, dp_ids),
3813 .help = "Sets which Data Placement ids to use (defaults to all for FDP)",
3815 .category = FIO_OPT_C_IO,
3816 .group = FIO_OPT_G_INVALID,
3819 .name = "dp_scheme",
3820 .lname = "Data Placement Scheme",
3821 .type = FIO_OPT_STR_STORE,
3822 .cb = str_dp_scheme_cb,
3823 .off1 = offsetof(struct thread_options, dp_scheme_file),
3825 .help = "scheme file that specifies offset-RUH mapping",
3826 .category = FIO_OPT_C_IO,
3827 .group = FIO_OPT_G_INVALID,
3831 .lname = "Lock memory",
3832 .type = FIO_OPT_STR_VAL,
3833 .off1 = offsetof(struct thread_options, lockmem),
3834 .help = "Lock down this amount of memory (per worker)",
3836 .interval = 1024 * 1024,
3837 .category = FIO_OPT_C_GENERAL,
3838 .group = FIO_OPT_G_INVALID,
3841 .name = "rwmixread",
3842 .lname = "Read/write mix read",
3843 .type = FIO_OPT_INT,
3844 .cb = str_rwmix_read_cb,
3845 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3847 .help = "Percentage of mixed workload that is reads",
3850 .inverse = "rwmixwrite",
3851 .category = FIO_OPT_C_IO,
3852 .group = FIO_OPT_G_RWMIX,
3855 .name = "rwmixwrite",
3856 .lname = "Read/write mix write",
3857 .type = FIO_OPT_INT,
3858 .cb = str_rwmix_write_cb,
3859 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3861 .help = "Percentage of mixed workload that is writes",
3864 .inverse = "rwmixread",
3865 .category = FIO_OPT_C_IO,
3866 .group = FIO_OPT_G_RWMIX,
3869 .name = "rwmixcycle",
3870 .lname = "Read/write mix cycle",
3871 .type = FIO_OPT_DEPRECATED,
3872 .category = FIO_OPT_C_IO,
3873 .group = FIO_OPT_G_RWMIX,
3878 .type = FIO_OPT_INT,
3879 .off1 = offsetof(struct thread_options, nice),
3880 .help = "Set job CPU nice value",
3885 .category = FIO_OPT_C_GENERAL,
3886 .group = FIO_OPT_G_CRED,
3888 #ifdef FIO_HAVE_IOPRIO
3891 .lname = "I/O nice priority",
3892 .type = FIO_OPT_INT,
3893 .off1 = offsetof(struct thread_options, ioprio),
3894 .help = "Set job IO priority value",
3895 .minval = IOPRIO_MIN_PRIO,
3896 .maxval = IOPRIO_MAX_PRIO,
3898 .category = FIO_OPT_C_GENERAL,
3899 .group = FIO_OPT_G_CRED,
3904 .lname = "I/O nice priority",
3905 .type = FIO_OPT_UNSUPPORTED,
3906 .help = "Your platform does not support IO priorities",
3909 #ifdef FIO_HAVE_IOPRIO_CLASS
3910 #ifndef FIO_HAVE_IOPRIO
3911 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3914 .name = "prioclass",
3915 .lname = "I/O nice priority class",
3916 .type = FIO_OPT_INT,
3917 .off1 = offsetof(struct thread_options, ioprio_class),
3918 .help = "Set job IO priority class",
3919 .minval = IOPRIO_MIN_PRIO_CLASS,
3920 .maxval = IOPRIO_MAX_PRIO_CLASS,
3922 .category = FIO_OPT_C_GENERAL,
3923 .group = FIO_OPT_G_CRED,
3927 .lname = "I/O nice priority hint",
3928 .type = FIO_OPT_INT,
3929 .off1 = offsetof(struct thread_options, ioprio_hint),
3930 .help = "Set job IO priority hint",
3931 .minval = IOPRIO_MIN_PRIO_HINT,
3932 .maxval = IOPRIO_MAX_PRIO_HINT,
3934 .category = FIO_OPT_C_GENERAL,
3935 .group = FIO_OPT_G_CRED,
3939 .name = "prioclass",
3940 .lname = "I/O nice priority class",
3941 .type = FIO_OPT_UNSUPPORTED,
3942 .help = "Your platform does not support IO priority classes",
3946 .lname = "I/O nice priority hint",
3947 .type = FIO_OPT_UNSUPPORTED,
3948 .help = "Your platform does not support IO priority hints",
3952 .name = "thinktime",
3953 .lname = "Thinktime",
3954 .type = FIO_OPT_INT,
3955 .off1 = offsetof(struct thread_options, thinktime),
3956 .help = "Idle time between IO buffers (usec)",
3959 .category = FIO_OPT_C_IO,
3960 .group = FIO_OPT_G_THINKTIME,
3963 .name = "thinktime_spin",
3964 .lname = "Thinktime spin",
3965 .type = FIO_OPT_INT,
3966 .off1 = offsetof(struct thread_options, thinktime_spin),
3967 .help = "Start think time by spinning this amount (usec)",
3970 .parent = "thinktime",
3972 .category = FIO_OPT_C_IO,
3973 .group = FIO_OPT_G_THINKTIME,
3976 .name = "thinkcycles",
3977 .lname = "Think cycles",
3978 .type = FIO_OPT_INT,
3979 .off1 = offsetof(struct thread_options, thinkcycles),
3980 .help = "Spin for a constant amount of cycles between requests",
3982 .parent = "thinktime",
3984 .category = FIO_OPT_C_IO,
3985 .group = FIO_OPT_G_THINKTIME,
3988 .name = "thinktime_blocks",
3989 .lname = "Thinktime blocks",
3990 .type = FIO_OPT_INT,
3991 .off1 = offsetof(struct thread_options, thinktime_blocks),
3992 .help = "IO buffer period between 'thinktime'",
3994 .parent = "thinktime",
3996 .category = FIO_OPT_C_IO,
3997 .group = FIO_OPT_G_THINKTIME,
4000 .name = "thinktime_blocks_type",
4001 .lname = "Thinktime blocks type",
4002 .type = FIO_OPT_STR,
4003 .off1 = offsetof(struct thread_options, thinktime_blocks_type),
4004 .help = "How thinktime_blocks takes effect",
4006 .category = FIO_OPT_C_IO,
4007 .group = FIO_OPT_G_THINKTIME,
4009 { .ival = "complete",
4010 .oval = THINKTIME_BLOCKS_TYPE_COMPLETE,
4011 .help = "thinktime_blocks takes effect at the completion side",
4015 .oval = THINKTIME_BLOCKS_TYPE_ISSUE,
4016 .help = "thinktime_blocks takes effect at the issue side",
4019 .parent = "thinktime",
4022 .name = "thinktime_iotime",
4023 .lname = "Thinktime interval",
4024 .type = FIO_OPT_INT,
4025 .off1 = offsetof(struct thread_options, thinktime_iotime),
4026 .help = "IO time interval between 'thinktime'",
4028 .parent = "thinktime",
4032 .category = FIO_OPT_C_IO,
4033 .group = FIO_OPT_G_THINKTIME,
4037 .lname = "I/O rate",
4038 .type = FIO_OPT_ULL,
4039 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
4040 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
4041 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
4042 .help = "Set bandwidth rate",
4043 .category = FIO_OPT_C_IO,
4044 .group = FIO_OPT_G_RATE,
4049 .lname = "I/O min rate",
4050 .type = FIO_OPT_ULL,
4051 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
4052 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
4053 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
4054 .help = "Job must meet this rate or it will be shutdown",
4057 .category = FIO_OPT_C_IO,
4058 .group = FIO_OPT_G_RATE,
4061 .name = "rate_iops",
4062 .lname = "I/O rate IOPS",
4063 .type = FIO_OPT_INT,
4064 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
4065 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
4066 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
4067 .help = "Limit IO used to this number of IO operations/sec",
4069 .category = FIO_OPT_C_IO,
4070 .group = FIO_OPT_G_RATE,
4073 .name = "rate_iops_min",
4074 .lname = "I/O min rate IOPS",
4075 .type = FIO_OPT_INT,
4076 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
4077 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
4078 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
4079 .help = "Job must meet this rate or it will be shut down",
4080 .parent = "rate_iops",
4082 .category = FIO_OPT_C_IO,
4083 .group = FIO_OPT_G_RATE,
4086 .name = "rate_process",
4087 .lname = "Rate Process",
4088 .type = FIO_OPT_STR,
4089 .off1 = offsetof(struct thread_options, rate_process),
4090 .help = "What process controls how rated IO is managed",
4092 .category = FIO_OPT_C_IO,
4093 .group = FIO_OPT_G_RATE,
4096 .oval = RATE_PROCESS_LINEAR,
4097 .help = "Linear rate of IO",
4101 .oval = RATE_PROCESS_POISSON,
4102 .help = "Rate follows Poisson process",
4108 .name = "rate_cycle",
4109 .alias = "ratecycle",
4110 .lname = "I/O rate cycle",
4111 .type = FIO_OPT_INT,
4112 .off1 = offsetof(struct thread_options, ratecycle),
4113 .help = "Window average for rate limits (msec)",
4117 .category = FIO_OPT_C_IO,
4118 .group = FIO_OPT_G_RATE,
4121 .name = "rate_ignore_thinktime",
4122 .lname = "Rate ignore thinktime",
4123 .type = FIO_OPT_BOOL,
4124 .off1 = offsetof(struct thread_options, rate_ign_think),
4125 .help = "Rated IO ignores thinktime settings",
4127 .category = FIO_OPT_C_IO,
4128 .group = FIO_OPT_G_RATE,
4131 .name = "max_latency",
4132 .lname = "Max Latency (usec)",
4133 .type = FIO_OPT_ULL,
4134 .off1 = offsetof(struct thread_options, max_latency[DDIR_READ]),
4135 .off2 = offsetof(struct thread_options, max_latency[DDIR_WRITE]),
4136 .off3 = offsetof(struct thread_options, max_latency[DDIR_TRIM]),
4137 .help = "Maximum tolerated IO latency (usec)",
4139 .category = FIO_OPT_C_IO,
4140 .group = FIO_OPT_G_LATPROF,
4143 .name = "latency_target",
4144 .lname = "Latency Target (usec)",
4145 .type = FIO_OPT_STR_VAL_TIME,
4146 .off1 = offsetof(struct thread_options, latency_target),
4147 .help = "Ramp to max queue depth supporting this latency",
4149 .category = FIO_OPT_C_IO,
4150 .group = FIO_OPT_G_LATPROF,
4153 .name = "latency_window",
4154 .lname = "Latency Window (usec)",
4155 .type = FIO_OPT_STR_VAL_TIME,
4156 .off1 = offsetof(struct thread_options, latency_window),
4157 .help = "Time to sustain latency_target",
4159 .category = FIO_OPT_C_IO,
4160 .group = FIO_OPT_G_LATPROF,
4163 .name = "latency_percentile",
4164 .lname = "Latency Percentile",
4165 .type = FIO_OPT_FLOAT_LIST,
4166 .off1 = offsetof(struct thread_options, latency_percentile),
4167 .help = "Percentile of IOs must be below latency_target",
4172 .category = FIO_OPT_C_IO,
4173 .group = FIO_OPT_G_LATPROF,
4176 .name = "latency_run",
4177 .lname = "Latency Run",
4178 .type = FIO_OPT_BOOL,
4179 .off1 = offsetof(struct thread_options, latency_run),
4180 .help = "Keep adjusting queue depth to match latency_target",
4182 .category = FIO_OPT_C_IO,
4183 .group = FIO_OPT_G_LATPROF,
4186 .name = "invalidate",
4187 .lname = "Cache invalidate",
4188 .type = FIO_OPT_BOOL,
4189 .off1 = offsetof(struct thread_options, invalidate_cache),
4190 .help = "Invalidate buffer/page cache prior to running job",
4192 .category = FIO_OPT_C_IO,
4193 .group = FIO_OPT_G_IO_TYPE,
4197 .lname = "Synchronous I/O",
4198 .type = FIO_OPT_STR,
4199 .off1 = offsetof(struct thread_options, sync_io),
4200 .help = "Use synchronous write IO",
4203 .category = FIO_OPT_C_IO,
4204 .group = FIO_OPT_G_IO_TYPE,
4225 #ifdef FIO_HAVE_WRITE_HINT
4227 .name = "write_hint",
4228 .lname = "Write hint",
4229 .type = FIO_OPT_STR,
4230 .off1 = offsetof(struct thread_options, write_hint),
4231 .help = "Set expected write life time",
4232 .category = FIO_OPT_C_ENGINE,
4233 .group = FIO_OPT_G_INVALID,
4236 .oval = RWH_WRITE_LIFE_NONE,
4239 .oval = RWH_WRITE_LIFE_SHORT,
4242 .oval = RWH_WRITE_LIFE_MEDIUM,
4245 .oval = RWH_WRITE_LIFE_LONG,
4247 { .ival = "extreme",
4248 .oval = RWH_WRITE_LIFE_EXTREME,
4254 .name = "create_serialize",
4255 .lname = "Create serialize",
4256 .type = FIO_OPT_BOOL,
4257 .off1 = offsetof(struct thread_options, create_serialize),
4258 .help = "Serialize creation of job files",
4260 .category = FIO_OPT_C_FILE,
4261 .group = FIO_OPT_G_INVALID,
4264 .name = "create_fsync",
4265 .lname = "Create fsync",
4266 .type = FIO_OPT_BOOL,
4267 .off1 = offsetof(struct thread_options, create_fsync),
4268 .help = "fsync file after creation",
4270 .category = FIO_OPT_C_FILE,
4271 .group = FIO_OPT_G_INVALID,
4274 .name = "create_on_open",
4275 .lname = "Create on open",
4276 .type = FIO_OPT_BOOL,
4277 .off1 = offsetof(struct thread_options, create_on_open),
4278 .help = "Create files when they are opened for IO",
4280 .category = FIO_OPT_C_FILE,
4281 .group = FIO_OPT_G_INVALID,
4284 .name = "create_only",
4285 .lname = "Create Only",
4286 .type = FIO_OPT_BOOL,
4287 .off1 = offsetof(struct thread_options, create_only),
4288 .help = "Only perform file creation phase",
4289 .category = FIO_OPT_C_FILE,
4293 .name = "allow_file_create",
4294 .lname = "Allow file create",
4295 .type = FIO_OPT_BOOL,
4296 .off1 = offsetof(struct thread_options, allow_create),
4297 .help = "Permit fio to create files, if they don't exist",
4299 .category = FIO_OPT_C_FILE,
4300 .group = FIO_OPT_G_FILENAME,
4303 .name = "allow_mounted_write",
4304 .lname = "Allow mounted write",
4305 .type = FIO_OPT_BOOL,
4306 .off1 = offsetof(struct thread_options, allow_mounted_write),
4307 .help = "Allow writes to a mounted partition",
4309 .category = FIO_OPT_C_FILE,
4310 .group = FIO_OPT_G_FILENAME,
4314 .lname = "Pre-read files",
4315 .type = FIO_OPT_BOOL,
4316 .off1 = offsetof(struct thread_options, pre_read),
4317 .help = "Pre-read files before starting official testing",
4319 .category = FIO_OPT_C_FILE,
4320 .group = FIO_OPT_G_INVALID,
4322 #ifdef FIO_HAVE_CPU_AFFINITY
4325 .lname = "CPU mask",
4326 .type = FIO_OPT_INT,
4327 .cb = str_cpumask_cb,
4328 .off1 = offsetof(struct thread_options, cpumask),
4329 .help = "CPU affinity mask",
4330 .category = FIO_OPT_C_GENERAL,
4331 .group = FIO_OPT_G_CRED,
4334 .name = "cpus_allowed",
4335 .lname = "CPUs allowed",
4336 .type = FIO_OPT_STR,
4337 .cb = str_cpus_allowed_cb,
4338 .off1 = offsetof(struct thread_options, cpumask),
4339 .help = "Set CPUs allowed",
4340 .category = FIO_OPT_C_GENERAL,
4341 .group = FIO_OPT_G_CRED,
4344 .name = "cpus_allowed_policy",
4345 .lname = "CPUs allowed distribution policy",
4346 .type = FIO_OPT_STR,
4347 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
4348 .help = "Distribution policy for cpus_allowed",
4349 .parent = "cpus_allowed",
4353 .oval = FIO_CPUS_SHARED,
4354 .help = "Mask shared between threads",
4357 .oval = FIO_CPUS_SPLIT,
4358 .help = "Mask split between threads",
4361 .category = FIO_OPT_C_GENERAL,
4362 .group = FIO_OPT_G_CRED,
4367 .lname = "CPU mask",
4368 .type = FIO_OPT_UNSUPPORTED,
4369 .help = "Your platform does not support CPU affinities",
4372 .name = "cpus_allowed",
4373 .lname = "CPUs allowed",
4374 .type = FIO_OPT_UNSUPPORTED,
4375 .help = "Your platform does not support CPU affinities",
4378 .name = "cpus_allowed_policy",
4379 .lname = "CPUs allowed distribution policy",
4380 .type = FIO_OPT_UNSUPPORTED,
4381 .help = "Your platform does not support CPU affinities",
4384 #ifdef CONFIG_LIBNUMA
4386 .name = "numa_cpu_nodes",
4387 .lname = "NUMA CPU Nodes",
4388 .type = FIO_OPT_STR,
4389 .cb = str_numa_cpunodes_cb,
4390 .off1 = offsetof(struct thread_options, numa_cpunodes),
4391 .help = "NUMA CPU nodes bind",
4392 .category = FIO_OPT_C_GENERAL,
4393 .group = FIO_OPT_G_INVALID,
4396 .name = "numa_mem_policy",
4397 .lname = "NUMA Memory Policy",
4398 .type = FIO_OPT_STR,
4399 .cb = str_numa_mpol_cb,
4400 .off1 = offsetof(struct thread_options, numa_memnodes),
4401 .help = "NUMA memory policy setup",
4402 .category = FIO_OPT_C_GENERAL,
4403 .group = FIO_OPT_G_INVALID,
4407 .name = "numa_cpu_nodes",
4408 .lname = "NUMA CPU Nodes",
4409 .type = FIO_OPT_UNSUPPORTED,
4410 .help = "Build fio with libnuma-dev(el) to enable this option",
4413 .name = "numa_mem_policy",
4414 .lname = "NUMA Memory Policy",
4415 .type = FIO_OPT_UNSUPPORTED,
4416 .help = "Build fio with libnuma-dev(el) to enable this option",
4421 .name = "gpu_dev_id",
4422 .lname = "GPU device ID",
4423 .type = FIO_OPT_INT,
4424 .off1 = offsetof(struct thread_options, gpu_dev_id),
4425 .help = "Set GPU device ID for GPUDirect RDMA",
4427 .category = FIO_OPT_C_GENERAL,
4428 .group = FIO_OPT_G_INVALID,
4432 .name = "end_fsync",
4433 .lname = "End fsync",
4434 .type = FIO_OPT_BOOL,
4435 .off1 = offsetof(struct thread_options, end_fsync),
4436 .help = "Include fsync at the end of job",
4438 .category = FIO_OPT_C_FILE,
4439 .group = FIO_OPT_G_INVALID,
4442 .name = "fsync_on_close",
4443 .lname = "Fsync on close",
4444 .type = FIO_OPT_BOOL,
4445 .off1 = offsetof(struct thread_options, fsync_on_close),
4446 .help = "fsync files on close",
4448 .category = FIO_OPT_C_FILE,
4449 .group = FIO_OPT_G_INVALID,
4453 .lname = "Unlink file",
4454 .type = FIO_OPT_BOOL,
4455 .off1 = offsetof(struct thread_options, unlink),
4456 .help = "Unlink created files after job has completed",
4458 .category = FIO_OPT_C_FILE,
4459 .group = FIO_OPT_G_INVALID,
4462 .name = "unlink_each_loop",
4463 .lname = "Unlink file after each loop of a job",
4464 .type = FIO_OPT_BOOL,
4465 .off1 = offsetof(struct thread_options, unlink_each_loop),
4466 .help = "Unlink created files after each loop in a job has completed",
4468 .category = FIO_OPT_C_FILE,
4469 .group = FIO_OPT_G_INVALID,
4473 .lname = "Exit-all on terminate",
4474 .type = FIO_OPT_STR_SET,
4475 .cb = str_exitall_cb,
4476 .help = "Terminate all jobs when one exits",
4477 .category = FIO_OPT_C_GENERAL,
4478 .group = FIO_OPT_G_PROCESS,
4481 .name = "exit_what",
4482 .lname = "What jobs to quit on terminate",
4483 .type = FIO_OPT_STR,
4484 .off1 = offsetof(struct thread_options, exit_what),
4485 .help = "Fine-grained control for exitall",
4487 .category = FIO_OPT_C_GENERAL,
4488 .group = FIO_OPT_G_PROCESS,
4491 .oval = TERMINATE_GROUP,
4492 .help = "exit_all=1 default behaviour",
4494 { .ival = "stonewall",
4495 .oval = TERMINATE_STONEWALL,
4496 .help = "quit all currently running jobs; continue with next stonewall",
4499 .oval = TERMINATE_ALL,
4500 .help = "Quit everything",
4505 .name = "exitall_on_error",
4506 .lname = "Exit-all on terminate in error",
4507 .type = FIO_OPT_STR_SET,
4508 .off1 = offsetof(struct thread_options, exitall_error),
4509 .help = "Terminate all jobs when one exits in error",
4510 .category = FIO_OPT_C_GENERAL,
4511 .group = FIO_OPT_G_PROCESS,
4514 .name = "stonewall",
4515 .lname = "Wait for previous",
4516 .alias = "wait_for_previous",
4517 .type = FIO_OPT_STR_SET,
4518 .off1 = offsetof(struct thread_options, stonewall),
4519 .help = "Insert a hard barrier between this job and previous",
4520 .category = FIO_OPT_C_GENERAL,
4521 .group = FIO_OPT_G_PROCESS,
4524 .name = "new_group",
4525 .lname = "New group",
4526 .type = FIO_OPT_STR_SET,
4527 .off1 = offsetof(struct thread_options, new_group),
4528 .help = "Mark the start of a new group (for reporting)",
4529 .category = FIO_OPT_C_GENERAL,
4530 .group = FIO_OPT_G_PROCESS,
4535 .type = FIO_OPT_STR_SET,
4536 .off1 = offsetof(struct thread_options, use_thread),
4537 .help = "Use threads instead of processes",
4538 #ifdef CONFIG_NO_SHM
4542 .category = FIO_OPT_C_GENERAL,
4543 .group = FIO_OPT_G_PROCESS,
4546 .name = "per_job_logs",
4547 .lname = "Per Job Logs",
4548 .type = FIO_OPT_BOOL,
4549 .off1 = offsetof(struct thread_options, per_job_logs),
4550 .help = "Include job number in generated log files or not",
4552 .category = FIO_OPT_C_LOG,
4553 .group = FIO_OPT_G_INVALID,
4556 .name = "write_bw_log",
4557 .lname = "Write bandwidth log",
4558 .type = FIO_OPT_STR,
4559 .off1 = offsetof(struct thread_options, bw_log_file),
4560 .cb = str_write_bw_log_cb,
4561 .help = "Write log of bandwidth during run",
4562 .category = FIO_OPT_C_LOG,
4563 .group = FIO_OPT_G_INVALID,
4566 .name = "write_lat_log",
4567 .lname = "Write latency log",
4568 .type = FIO_OPT_STR,
4569 .off1 = offsetof(struct thread_options, lat_log_file),
4570 .cb = str_write_lat_log_cb,
4571 .help = "Write log of latency during run",
4572 .category = FIO_OPT_C_LOG,
4573 .group = FIO_OPT_G_INVALID,
4576 .name = "write_iops_log",
4577 .lname = "Write IOPS log",
4578 .type = FIO_OPT_STR,
4579 .off1 = offsetof(struct thread_options, iops_log_file),
4580 .cb = str_write_iops_log_cb,
4581 .help = "Write log of IOPS during run",
4582 .category = FIO_OPT_C_LOG,
4583 .group = FIO_OPT_G_INVALID,
4586 .name = "log_entries",
4587 .lname = "Log entries",
4588 .type = FIO_OPT_INT,
4589 .off1 = offsetof(struct thread_options, log_entries),
4590 .help = "Initial number of entries in a job IO log",
4591 .def = __fio_stringify(DEF_LOG_ENTRIES),
4592 .minval = DEF_LOG_ENTRIES,
4593 .maxval = MAX_LOG_ENTRIES,
4594 .category = FIO_OPT_C_LOG,
4595 .group = FIO_OPT_G_INVALID,
4598 .name = "log_avg_msec",
4599 .lname = "Log averaging (msec)",
4600 .type = FIO_OPT_INT,
4601 .off1 = offsetof(struct thread_options, log_avg_msec),
4602 .help = "Average bw/iops/lat logs over this period of time",
4604 .category = FIO_OPT_C_LOG,
4605 .group = FIO_OPT_G_INVALID,
4608 .name = "log_hist_msec",
4609 .lname = "Log histograms (msec)",
4610 .type = FIO_OPT_INT,
4611 .off1 = offsetof(struct thread_options, log_hist_msec),
4612 .help = "Dump completion latency histograms at frequency of this time value",
4614 .category = FIO_OPT_C_LOG,
4615 .group = FIO_OPT_G_INVALID,
4618 .name = "log_hist_coarseness",
4619 .lname = "Histogram logs coarseness",
4620 .type = FIO_OPT_INT,
4621 .off1 = offsetof(struct thread_options, log_hist_coarseness),
4622 .help = "Integer in range [0,6]. Higher coarseness outputs"
4623 " fewer histogram bins per sample. The number of bins for"
4624 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
4626 .category = FIO_OPT_C_LOG,
4627 .group = FIO_OPT_G_INVALID,
4630 .name = "write_hist_log",
4631 .lname = "Write latency histogram logs",
4632 .type = FIO_OPT_STR,
4633 .off1 = offsetof(struct thread_options, hist_log_file),
4634 .cb = str_write_hist_log_cb,
4635 .help = "Write log of latency histograms during run",
4636 .category = FIO_OPT_C_LOG,
4637 .group = FIO_OPT_G_INVALID,
4640 .name = "log_window_value",
4641 .alias = "log_max_value",
4642 .lname = "Log maximum, average or both values",
4643 .type = FIO_OPT_STR,
4644 .off1 = offsetof(struct thread_options, log_max),
4645 .help = "Log max, average or both sample in a window",
4647 .category = FIO_OPT_C_LOG,
4648 .group = FIO_OPT_G_INVALID,
4651 .oval = IO_LOG_SAMPLE_AVG,
4652 .help = "Log average value over the window",
4655 .oval = IO_LOG_SAMPLE_MAX,
4656 .help = "Log maximum value in the window",
4659 .oval = IO_LOG_SAMPLE_BOTH,
4660 .help = "Log both average and maximum values over the window"
4662 /* Compatibility with former boolean values */
4664 .oval = IO_LOG_SAMPLE_AVG,
4665 .help = "Alias for 'avg'",
4668 .oval = IO_LOG_SAMPLE_MAX,
4669 .help = "Alias for 'max'",
4674 .name = "log_offset",
4675 .lname = "Log offset of IO",
4676 .type = FIO_OPT_BOOL,
4677 .off1 = offsetof(struct thread_options, log_offset),
4678 .help = "Include offset of IO for each log entry",
4680 .category = FIO_OPT_C_LOG,
4681 .group = FIO_OPT_G_INVALID,
4685 .lname = "Log priority of IO",
4686 .type = FIO_OPT_BOOL,
4687 .off1 = offsetof(struct thread_options, log_prio),
4688 .help = "Include priority value of IO for each log entry",
4690 .category = FIO_OPT_C_LOG,
4691 .group = FIO_OPT_G_INVALID,
4695 .name = "log_compression",
4696 .lname = "Log compression",
4697 .type = FIO_OPT_INT,
4698 .off1 = offsetof(struct thread_options, log_gz),
4699 .help = "Log in compressed chunks of this size",
4701 .maxval = 512 * 1024 * 1024ULL,
4702 .category = FIO_OPT_C_LOG,
4703 .group = FIO_OPT_G_INVALID,
4705 #ifdef FIO_HAVE_CPU_AFFINITY
4707 .name = "log_compression_cpus",
4708 .lname = "Log Compression CPUs",
4709 .type = FIO_OPT_STR,
4710 .cb = str_log_cpus_allowed_cb,
4711 .off1 = offsetof(struct thread_options, log_gz_cpumask),
4712 .parent = "log_compression",
4713 .help = "Limit log compression to these CPUs",
4714 .category = FIO_OPT_C_LOG,
4715 .group = FIO_OPT_G_INVALID,
4719 .name = "log_compression_cpus",
4720 .lname = "Log Compression CPUs",
4721 .type = FIO_OPT_UNSUPPORTED,
4722 .help = "Your platform does not support CPU affinities",
4726 .name = "log_store_compressed",
4727 .lname = "Log store compressed",
4728 .type = FIO_OPT_BOOL,
4729 .off1 = offsetof(struct thread_options, log_gz_store),
4730 .help = "Store logs in a compressed format",
4731 .category = FIO_OPT_C_LOG,
4732 .group = FIO_OPT_G_INVALID,
4736 .name = "log_compression",
4737 .lname = "Log compression",
4738 .type = FIO_OPT_UNSUPPORTED,
4739 .help = "Install libz-dev(el) to get compression support",
4742 .name = "log_store_compressed",
4743 .lname = "Log store compressed",
4744 .type = FIO_OPT_UNSUPPORTED,
4745 .help = "Install libz-dev(el) to get compression support",
4749 .name = "log_alternate_epoch",
4750 .alias = "log_unix_epoch",
4751 .lname = "Log epoch alternate",
4752 .type = FIO_OPT_BOOL,
4753 .off1 = offsetof(struct thread_options, log_alternate_epoch),
4754 .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.",
4755 .category = FIO_OPT_C_LOG,
4756 .group = FIO_OPT_G_INVALID,
4759 .name = "log_alternate_epoch_clock_id",
4760 .lname = "Log alternate epoch clock_id",
4761 .type = FIO_OPT_INT,
4762 .off1 = offsetof(struct thread_options, log_alternate_epoch_clock_id),
4763 .help = "If log_alternate_epoch is true, this option specifies the clock_id from clock_gettime whose epoch should be used. If log_alternate_epoch is false, this option has no effect. Default value is 0, or CLOCK_REALTIME",
4764 .category = FIO_OPT_C_LOG,
4765 .group = FIO_OPT_G_INVALID,
4768 .name = "block_error_percentiles",
4769 .lname = "Block error percentiles",
4770 .type = FIO_OPT_BOOL,
4771 .off1 = offsetof(struct thread_options, block_error_hist),
4772 .help = "Record trim block errors and make a histogram",
4774 .category = FIO_OPT_C_LOG,
4775 .group = FIO_OPT_G_INVALID,
4778 .name = "bwavgtime",
4779 .lname = "Bandwidth average time",
4780 .type = FIO_OPT_INT,
4781 .off1 = offsetof(struct thread_options, bw_avg_time),
4782 .help = "Time window over which to calculate bandwidth"
4785 .parent = "write_bw_log",
4788 .category = FIO_OPT_C_LOG,
4789 .group = FIO_OPT_G_INVALID,
4792 .name = "iopsavgtime",
4793 .lname = "IOPS average time",
4794 .type = FIO_OPT_INT,
4795 .off1 = offsetof(struct thread_options, iops_avg_time),
4796 .help = "Time window over which to calculate IOPS (msec)",
4798 .parent = "write_iops_log",
4801 .category = FIO_OPT_C_LOG,
4802 .group = FIO_OPT_G_INVALID,
4805 .name = "group_reporting",
4806 .lname = "Group reporting",
4807 .type = FIO_OPT_STR_SET,
4808 .off1 = offsetof(struct thread_options, group_reporting),
4809 .help = "Do reporting on a per-group basis",
4810 .category = FIO_OPT_C_STAT,
4811 .group = FIO_OPT_G_INVALID,
4816 .type = FIO_OPT_BOOL,
4817 .off1 = offsetof(struct thread_options, stats),
4818 .help = "Enable collection of stats",
4820 .category = FIO_OPT_C_STAT,
4821 .group = FIO_OPT_G_INVALID,
4824 .name = "zero_buffers",
4825 .lname = "Zero I/O buffers",
4826 .type = FIO_OPT_STR_SET,
4827 .off1 = offsetof(struct thread_options, zero_buffers),
4828 .help = "Init IO buffers to all zeroes",
4829 .category = FIO_OPT_C_IO,
4830 .group = FIO_OPT_G_IO_BUF,
4833 .name = "refill_buffers",
4834 .lname = "Refill I/O buffers",
4835 .type = FIO_OPT_STR_SET,
4836 .off1 = offsetof(struct thread_options, refill_buffers),
4837 .help = "Refill IO buffers on every IO submit",
4838 .category = FIO_OPT_C_IO,
4839 .group = FIO_OPT_G_IO_BUF,
4842 .name = "scramble_buffers",
4843 .lname = "Scramble I/O buffers",
4844 .type = FIO_OPT_BOOL,
4845 .off1 = offsetof(struct thread_options, scramble_buffers),
4846 .help = "Slightly scramble buffers on every IO submit",
4848 .category = FIO_OPT_C_IO,
4849 .group = FIO_OPT_G_IO_BUF,
4852 .name = "buffer_pattern",
4853 .lname = "Buffer pattern",
4854 .type = FIO_OPT_STR,
4855 .cb = str_buffer_pattern_cb,
4856 .off1 = offsetof(struct thread_options, buffer_pattern),
4857 .help = "Fill pattern for IO buffers",
4858 .category = FIO_OPT_C_IO,
4859 .group = FIO_OPT_G_IO_BUF,
4862 .name = "buffer_compress_percentage",
4863 .lname = "Buffer compression percentage",
4864 .type = FIO_OPT_INT,
4865 .cb = str_buffer_compress_cb,
4866 .off1 = offsetof(struct thread_options, compress_percentage),
4869 .help = "How compressible the buffer is (approximately)",
4871 .category = FIO_OPT_C_IO,
4872 .group = FIO_OPT_G_IO_BUF,
4875 .name = "buffer_compress_chunk",
4876 .lname = "Buffer compression chunk size",
4877 .type = FIO_OPT_INT,
4878 .off1 = offsetof(struct thread_options, compress_chunk),
4879 .parent = "buffer_compress_percentage",
4881 .help = "Size of compressible region in buffer",
4884 .category = FIO_OPT_C_IO,
4885 .group = FIO_OPT_G_IO_BUF,
4888 .name = "dedupe_percentage",
4889 .lname = "Dedupe percentage",
4890 .type = FIO_OPT_INT,
4891 .cb = str_dedupe_cb,
4892 .off1 = offsetof(struct thread_options, dedupe_percentage),
4895 .help = "Percentage of buffers that are dedupable",
4897 .category = FIO_OPT_C_IO,
4898 .group = FIO_OPT_G_IO_BUF,
4901 .name = "dedupe_global",
4902 .lname = "Global deduplication",
4903 .type = FIO_OPT_BOOL,
4904 .off1 = offsetof(struct thread_options, dedupe_global),
4905 .help = "Share deduplication buffers across jobs",
4907 .category = FIO_OPT_C_IO,
4908 .group = FIO_OPT_G_IO_BUF,
4911 .name = "dedupe_mode",
4912 .lname = "Dedupe mode",
4913 .help = "Mode for the deduplication buffer generation",
4914 .type = FIO_OPT_STR,
4915 .off1 = offsetof(struct thread_options, dedupe_mode),
4916 .parent = "dedupe_percentage",
4918 .category = FIO_OPT_C_IO,
4919 .group = FIO_OPT_G_IO_BUF,
4922 .oval = DEDUPE_MODE_REPEAT,
4923 .help = "repeat previous page",
4925 { .ival = "working_set",
4926 .oval = DEDUPE_MODE_WORKING_SET,
4927 .help = "choose a page randomly from limited working set defined in dedupe_working_set_percentage",
4932 .name = "dedupe_working_set_percentage",
4933 .lname = "Dedupe working set percentage",
4934 .help = "Dedupe working set size in percentages from file or device size used to generate dedupe patterns from",
4935 .type = FIO_OPT_INT,
4936 .off1 = offsetof(struct thread_options, dedupe_working_set_percentage),
4937 .parent = "dedupe_percentage",
4941 .category = FIO_OPT_C_IO,
4942 .group = FIO_OPT_G_IO_BUF,
4945 .name = "clat_percentiles",
4946 .lname = "Completion latency percentiles",
4947 .type = FIO_OPT_BOOL,
4948 .off1 = offsetof(struct thread_options, clat_percentiles),
4949 .help = "Enable the reporting of completion latency percentiles",
4951 .category = FIO_OPT_C_STAT,
4952 .group = FIO_OPT_G_INVALID,
4955 .name = "lat_percentiles",
4956 .lname = "IO latency percentiles",
4957 .type = FIO_OPT_BOOL,
4958 .off1 = offsetof(struct thread_options, lat_percentiles),
4959 .help = "Enable the reporting of IO latency percentiles",
4961 .category = FIO_OPT_C_STAT,
4962 .group = FIO_OPT_G_INVALID,
4965 .name = "slat_percentiles",
4966 .lname = "Submission latency percentiles",
4967 .type = FIO_OPT_BOOL,
4968 .off1 = offsetof(struct thread_options, slat_percentiles),
4969 .help = "Enable the reporting of submission latency percentiles",
4971 .category = FIO_OPT_C_STAT,
4972 .group = FIO_OPT_G_INVALID,
4975 .name = "percentile_list",
4976 .lname = "Percentile list",
4977 .type = FIO_OPT_FLOAT_LIST,
4978 .off1 = offsetof(struct thread_options, percentile_list),
4979 .off2 = offsetof(struct thread_options, percentile_precision),
4980 .help = "Specify a custom list of percentiles to report for "
4981 "completion latency and block errors",
4982 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
4983 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4986 .category = FIO_OPT_C_STAT,
4987 .group = FIO_OPT_G_INVALID,
4990 .name = "significant_figures",
4991 .lname = "Significant figures",
4992 .type = FIO_OPT_INT,
4993 .off1 = offsetof(struct thread_options, sig_figs),
4996 .help = "Significant figures for output-format set to normal",
4999 .category = FIO_OPT_C_STAT,
5000 .group = FIO_OPT_G_INVALID,
5003 #ifdef FIO_HAVE_DISK_UTIL
5005 .name = "disk_util",
5006 .lname = "Disk utilization",
5007 .type = FIO_OPT_BOOL,
5008 .off1 = offsetof(struct thread_options, do_disk_util),
5009 .help = "Log disk utilization statistics",
5011 .category = FIO_OPT_C_STAT,
5012 .group = FIO_OPT_G_INVALID,
5016 .name = "disk_util",
5017 .lname = "Disk utilization",
5018 .type = FIO_OPT_UNSUPPORTED,
5019 .help = "Your platform does not support disk utilization",
5023 .name = "gtod_reduce",
5024 .lname = "Reduce gettimeofday() calls",
5025 .type = FIO_OPT_BOOL,
5026 .help = "Greatly reduce number of gettimeofday() calls",
5027 .cb = str_gtod_reduce_cb,
5030 .category = FIO_OPT_C_STAT,
5031 .group = FIO_OPT_G_INVALID,
5034 .name = "disable_lat",
5035 .lname = "Disable all latency stats",
5036 .type = FIO_OPT_BOOL,
5037 .off1 = offsetof(struct thread_options, disable_lat),
5038 .help = "Disable latency numbers",
5039 .parent = "gtod_reduce",
5042 .category = FIO_OPT_C_STAT,
5043 .group = FIO_OPT_G_INVALID,
5046 .name = "disable_clat",
5047 .lname = "Disable completion latency stats",
5048 .type = FIO_OPT_BOOL,
5049 .off1 = offsetof(struct thread_options, disable_clat),
5050 .help = "Disable completion latency numbers",
5051 .parent = "gtod_reduce",
5054 .category = FIO_OPT_C_STAT,
5055 .group = FIO_OPT_G_INVALID,
5058 .name = "disable_slat",
5059 .lname = "Disable submission latency stats",
5060 .type = FIO_OPT_BOOL,
5061 .off1 = offsetof(struct thread_options, disable_slat),
5062 .help = "Disable submission latency numbers",
5063 .parent = "gtod_reduce",
5066 .category = FIO_OPT_C_STAT,
5067 .group = FIO_OPT_G_INVALID,
5070 .name = "disable_bw_measurement",
5071 .alias = "disable_bw",
5072 .lname = "Disable bandwidth stats",
5073 .type = FIO_OPT_BOOL,
5074 .off1 = offsetof(struct thread_options, disable_bw),
5075 .help = "Disable bandwidth logging",
5076 .parent = "gtod_reduce",
5079 .category = FIO_OPT_C_STAT,
5080 .group = FIO_OPT_G_INVALID,
5084 .lname = "Dedicated gettimeofday() CPU",
5085 .type = FIO_OPT_INT,
5086 .off1 = offsetof(struct thread_options, gtod_cpu),
5087 .help = "Set up dedicated gettimeofday() thread on this CPU",
5088 .verify = gtod_cpu_verify,
5089 .category = FIO_OPT_C_GENERAL,
5090 .group = FIO_OPT_G_CLOCK,
5093 .name = "job_start_clock_id",
5094 .lname = "Job start clock_id",
5095 .type = FIO_OPT_INT,
5096 .off1 = offsetof(struct thread_options, job_start_clock_id),
5097 .help = "The clock_id passed to the call to clock_gettime used to record job_start in the json output format. Default is 0, or CLOCK_REALTIME",
5098 .verify = gtod_cpu_verify,
5099 .category = FIO_OPT_C_GENERAL,
5100 .group = FIO_OPT_G_CLOCK,
5103 .name = "unified_rw_reporting",
5104 .lname = "Unified RW Reporting",
5105 .type = FIO_OPT_STR,
5106 .off1 = offsetof(struct thread_options, unified_rw_rep),
5107 .help = "Unify reporting across data direction",
5109 .category = FIO_OPT_C_GENERAL,
5110 .group = FIO_OPT_G_INVALID,
5113 .oval = UNIFIED_SPLIT,
5114 .help = "Normal statistics reporting",
5117 .oval = UNIFIED_MIXED,
5118 .help = "Statistics are summed per data direction and reported together",
5121 .oval = UNIFIED_BOTH,
5122 .help = "Statistics are reported normally, followed by the mixed statistics"
5124 /* Compatibility with former boolean values */
5126 .oval = UNIFIED_SPLIT,
5127 .help = "Alias for 'none'",
5130 .oval = UNIFIED_MIXED,
5131 .help = "Alias for 'mixed'",
5134 .oval = UNIFIED_BOTH,
5135 .help = "Alias for 'both'",
5140 .name = "continue_on_error",
5141 .lname = "Continue on error",
5142 .type = FIO_OPT_STR,
5143 .off1 = offsetof(struct thread_options, continue_on_error),
5144 .help = "Continue on non-fatal errors during IO",
5146 .category = FIO_OPT_C_GENERAL,
5147 .group = FIO_OPT_G_ERR,
5150 .oval = ERROR_TYPE_NONE,
5151 .help = "Exit when an error is encountered",
5154 .oval = ERROR_TYPE_READ,
5155 .help = "Continue on read errors only",
5158 .oval = ERROR_TYPE_WRITE,
5159 .help = "Continue on write errors only",
5162 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
5163 .help = "Continue on any IO errors",
5166 .oval = ERROR_TYPE_VERIFY,
5167 .help = "Continue on verify errors only",
5170 .oval = ERROR_TYPE_ANY,
5171 .help = "Continue on all io and verify errors",
5174 .oval = ERROR_TYPE_NONE,
5175 .help = "Alias for 'none'",
5178 .oval = ERROR_TYPE_ANY,
5179 .help = "Alias for 'all'",
5184 .name = "ignore_error",
5185 .lname = "Ignore Error",
5186 .type = FIO_OPT_STR,
5187 .cb = str_ignore_error_cb,
5188 .off1 = offsetof(struct thread_options, ignore_error_nr),
5189 .help = "Set a specific list of errors to ignore",
5191 .category = FIO_OPT_C_GENERAL,
5192 .group = FIO_OPT_G_ERR,
5195 .name = "error_dump",
5196 .lname = "Error Dump",
5197 .type = FIO_OPT_BOOL,
5198 .off1 = offsetof(struct thread_options, error_dump),
5200 .help = "Dump info on each error",
5201 .category = FIO_OPT_C_GENERAL,
5202 .group = FIO_OPT_G_ERR,
5207 .type = FIO_OPT_STR_STORE,
5208 .off1 = offsetof(struct thread_options, profile),
5209 .help = "Select a specific builtin performance test",
5210 .category = FIO_OPT_C_PROFILE,
5211 .group = FIO_OPT_G_INVALID,
5216 .type = FIO_OPT_STR_STORE,
5217 .off1 = offsetof(struct thread_options, cgroup),
5218 .help = "Add job to cgroup of this name",
5219 .category = FIO_OPT_C_GENERAL,
5220 .group = FIO_OPT_G_CGROUP,
5223 .name = "cgroup_nodelete",
5224 .lname = "Cgroup no-delete",
5225 .type = FIO_OPT_BOOL,
5226 .off1 = offsetof(struct thread_options, cgroup_nodelete),
5227 .help = "Do not delete cgroups after job completion",
5230 .category = FIO_OPT_C_GENERAL,
5231 .group = FIO_OPT_G_CGROUP,
5234 .name = "cgroup_weight",
5235 .lname = "Cgroup weight",
5236 .type = FIO_OPT_INT,
5237 .off1 = offsetof(struct thread_options, cgroup_weight),
5238 .help = "Use given weight for cgroup",
5242 .category = FIO_OPT_C_GENERAL,
5243 .group = FIO_OPT_G_CGROUP,
5248 .type = FIO_OPT_INT,
5249 .off1 = offsetof(struct thread_options, uid),
5250 .help = "Run job with this user ID",
5251 .category = FIO_OPT_C_GENERAL,
5252 .group = FIO_OPT_G_CRED,
5256 .lname = "Group ID",
5257 .type = FIO_OPT_INT,
5258 .off1 = offsetof(struct thread_options, gid),
5259 .help = "Run job with this group ID",
5260 .category = FIO_OPT_C_GENERAL,
5261 .group = FIO_OPT_G_CRED,
5266 .type = FIO_OPT_STR,
5267 .off1 = offsetof(struct thread_options, kb_base),
5273 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
5277 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
5280 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
5281 .category = FIO_OPT_C_GENERAL,
5282 .group = FIO_OPT_G_INVALID,
5285 .name = "unit_base",
5286 .lname = "Unit for quantities of data (Bits or Bytes)",
5287 .type = FIO_OPT_STR,
5288 .off1 = offsetof(struct thread_options, unit_base),
5293 .help = "Auto-detect",
5296 .oval = N2S_BYTEPERSEC,
5297 .help = "Normal (byte based)",
5300 .oval = N2S_BITPERSEC,
5301 .help = "Bit based",
5304 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
5305 .category = FIO_OPT_C_GENERAL,
5306 .group = FIO_OPT_G_INVALID,
5309 .name = "hugepage-size",
5310 .lname = "Hugepage size",
5311 .type = FIO_OPT_INT,
5312 .off1 = offsetof(struct thread_options, hugepage_size),
5313 .help = "When using hugepages, specify size of each page",
5314 .def = __fio_stringify(FIO_HUGE_PAGE),
5315 .interval = 1024 * 1024,
5316 .category = FIO_OPT_C_GENERAL,
5317 .group = FIO_OPT_G_INVALID,
5321 .lname = "I/O flow ID",
5322 .type = FIO_OPT_INT,
5323 .off1 = offsetof(struct thread_options, flow_id),
5324 .help = "The flow index ID to use",
5326 .category = FIO_OPT_C_IO,
5327 .group = FIO_OPT_G_IO_FLOW,
5331 .lname = "I/O flow weight",
5332 .type = FIO_OPT_INT,
5333 .off1 = offsetof(struct thread_options, flow),
5334 .help = "Weight for flow control of this job",
5335 .parent = "flow_id",
5338 .maxval = FLOW_MAX_WEIGHT,
5339 .category = FIO_OPT_C_IO,
5340 .group = FIO_OPT_G_IO_FLOW,
5343 .name = "flow_watermark",
5344 .lname = "I/O flow watermark",
5345 .type = FIO_OPT_SOFT_DEPRECATED,
5346 .category = FIO_OPT_C_IO,
5347 .group = FIO_OPT_G_IO_FLOW,
5350 .name = "flow_sleep",
5351 .lname = "I/O flow sleep",
5352 .type = FIO_OPT_INT,
5353 .off1 = offsetof(struct thread_options, flow_sleep),
5354 .help = "How many microseconds to sleep after being held"
5355 " back by the flow control mechanism",
5356 .parent = "flow_id",
5359 .category = FIO_OPT_C_IO,
5360 .group = FIO_OPT_G_IO_FLOW,
5363 .name = "steadystate",
5364 .lname = "Steady state threshold",
5366 .type = FIO_OPT_STR,
5367 .off1 = offsetof(struct thread_options, ss_state),
5368 .cb = str_steadystate_cb,
5369 .help = "Define the criterion and limit to judge when a job has reached steady state",
5370 .def = "iops_slope:0.01%",
5373 .oval = FIO_SS_IOPS,
5374 .help = "maximum mean deviation of IOPS measurements",
5376 { .ival = "iops_slope",
5377 .oval = FIO_SS_IOPS_SLOPE,
5378 .help = "slope calculated from IOPS measurements",
5382 .help = "maximum mean deviation of bandwidth measurements",
5386 .oval = FIO_SS_BW_SLOPE,
5387 .help = "slope calculated from bandwidth measurements",
5390 .category = FIO_OPT_C_GENERAL,
5391 .group = FIO_OPT_G_RUNTIME,
5394 .name = "steadystate_duration",
5395 .lname = "Steady state duration",
5397 .parent = "steadystate",
5398 .type = FIO_OPT_STR_VAL_TIME,
5399 .off1 = offsetof(struct thread_options, ss_dur),
5400 .help = "Stop workload upon attaining steady state for specified duration",
5404 .category = FIO_OPT_C_GENERAL,
5405 .group = FIO_OPT_G_RUNTIME,
5408 .name = "steadystate_ramp_time",
5409 .lname = "Steady state ramp time",
5411 .parent = "steadystate",
5412 .type = FIO_OPT_STR_VAL_TIME,
5413 .off1 = offsetof(struct thread_options, ss_ramp_time),
5414 .help = "Delay before initiation of data collection for steady state job termination testing",
5418 .category = FIO_OPT_C_GENERAL,
5419 .group = FIO_OPT_G_RUNTIME,
5422 .name = "steadystate_check_interval",
5423 .lname = "Steady state check interval",
5424 .alias = "ss_interval",
5425 .parent = "steadystate",
5426 .type = FIO_OPT_STR_VAL_TIME,
5427 .off1 = offsetof(struct thread_options, ss_check_interval),
5428 .help = "Polling interval for the steady state check (too low means steadystate will not converge)",
5432 .category = FIO_OPT_C_GENERAL,
5433 .group = FIO_OPT_G_RUNTIME,
5440 static void add_to_lopt(struct option *lopt, struct fio_option *o,
5441 const char *name, int val)
5443 lopt->name = (char *) name;
5445 if (o->type == FIO_OPT_STR_SET)
5446 lopt->has_arg = optional_argument;
5448 lopt->has_arg = required_argument;
5451 static void options_to_lopts(struct fio_option *opts,
5452 struct option *long_options,
5453 int i, int option_type)
5455 struct fio_option *o = &opts[0];
5457 add_to_lopt(&long_options[i], o, o->name, option_type);
5460 add_to_lopt(&long_options[i], o, o->alias, option_type);
5465 assert(i < FIO_NR_OPTIONS);
5469 void fio_options_set_ioengine_opts(struct option *long_options,
5470 struct thread_data *td)
5475 while (long_options[i].name) {
5476 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
5477 memset(&long_options[i], 0, sizeof(*long_options));
5484 * Just clear out the prior ioengine options.
5489 options_to_lopts(td->io_ops->options, long_options, i,
5490 FIO_GETOPT_IOENGINE);
5493 void fio_options_dup_and_init(struct option *long_options)
5497 options_init(fio_options);
5500 while (long_options[i].name)
5503 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
5506 struct fio_keyword {
5512 static struct fio_keyword fio_keywords[] = {
5514 .word = "$pagesize",
5515 .desc = "Page size in the system",
5518 .word = "$mb_memory",
5519 .desc = "Megabytes of memory online",
5523 .desc = "Number of CPUs online in the system",
5530 void fio_keywords_exit(void)
5532 struct fio_keyword *kw;
5534 kw = &fio_keywords[0];
5542 void fio_keywords_init(void)
5544 unsigned long long mb_memory;
5548 sprintf(buf, "%lu", (unsigned long) page_size);
5549 fio_keywords[0].replace = strdup(buf);
5551 mb_memory = os_phys_mem() / (1024 * 1024);
5552 sprintf(buf, "%llu", mb_memory);
5553 fio_keywords[1].replace = strdup(buf);
5555 l = cpus_configured();
5556 sprintf(buf, "%lu", l);
5557 fio_keywords[2].replace = strdup(buf);
5562 static char *bc_calc(char *str)
5564 char buf[128], *tmp;
5569 * No math, just return string
5571 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
5572 !strchr(str, '/')) || strchr(str, '\''))
5576 * Split option from value, we only need to calculate the value
5578 tmp = strchr(str, '=');
5585 * Prevent buffer overflows; such a case isn't reasonable anyway
5587 if (strlen(str) >= 128 || strlen(tmp) > 100)
5590 sprintf(buf, "which %s > /dev/null", BC_APP);
5592 log_err("fio: bc is needed for performing math\n");
5596 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
5597 f = popen(buf, "r");
5601 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
5608 buf[(tmp - str) + ret - 1] = '\0';
5609 memcpy(buf, str, tmp - str);
5615 * Return a copy of the input string with substrings of the form ${VARNAME}
5616 * substituted with the value of the environment variable VARNAME. The
5617 * substitution always occurs, even if VARNAME is empty or the corresponding
5618 * environment variable undefined.
5620 char *fio_option_dup_subs(const char *opt)
5622 char out[OPT_LEN_MAX+1];
5623 char in[OPT_LEN_MAX+1];
5626 char *ch1, *ch2, *env;
5627 ssize_t nchr = OPT_LEN_MAX;
5630 if (strlen(opt) + 1 > OPT_LEN_MAX) {
5631 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
5635 snprintf(in, sizeof(in), "%s", opt);
5637 while (*inptr && nchr > 0) {
5638 if (inptr[0] == '$' && inptr[1] == '{') {
5639 ch2 = strchr(inptr, '}');
5640 if (ch2 && inptr+1 < ch2) {
5647 envlen = strlen(env);
5648 if (envlen <= nchr) {
5649 memcpy(outptr, env, envlen);
5659 *outptr++ = *inptr++;
5668 * Look for reserved variable names and replace them with real values
5670 static char *fio_keyword_replace(char *opt)
5676 for (i = 0; fio_keywords[i].word != NULL; i++) {
5677 struct fio_keyword *kw = &fio_keywords[i];
5679 while ((s = strstr(opt, kw->word)) != NULL) {
5680 char *new = calloc(strlen(opt) + 1, 1);
5686 * Copy part of the string before the keyword and
5687 * sprintf() the replacement after it.
5689 memcpy(new, opt, olen);
5690 len = sprintf(new + olen, "%s", kw->replace);
5693 * If there's more in the original string, copy that
5696 opt += olen + strlen(kw->word);
5697 /* keeps final zero thanks to calloc */
5699 memcpy(new + olen + len, opt, strlen(opt));
5702 * replace opt and free the old opt
5712 * Check for potential math and invoke bc, if possible
5720 static char **dup_and_sub_options(char **opts, int num_opts)
5723 char **opts_copy = malloc(num_opts * sizeof(*opts));
5724 for (i = 0; i < num_opts; i++) {
5725 opts_copy[i] = fio_option_dup_subs(opts[i]);
5728 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
5733 static void show_closest_option(const char *opt)
5735 int best_option, best_distance;
5744 while (name[i] != '\0' && name[i] != '=')
5749 best_distance = INT_MAX;
5751 while (fio_options[i].name) {
5752 distance = string_distance(name, fio_options[i].name);
5753 if (distance < best_distance) {
5754 best_distance = distance;
5760 if (best_option != -1 && string_distance_ok(name, best_distance) &&
5761 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
5762 log_err("Did you mean %s?\n", fio_options[best_option].name);
5767 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
5769 int i, ret, unknown;
5772 sort_options(opts, fio_options, num_opts);
5773 opts_copy = dup_and_sub_options(opts, num_opts);
5775 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
5776 const struct fio_option *o;
5777 int newret = parse_option(opts_copy[i], opts[i], fio_options,
5778 &o, &td->o, &td->opt_list);
5781 fio_option_mark_set(&td->o, o);
5789 opts_copy[i] = NULL;
5796 ret |= ioengine_load(td);
5798 sort_options(opts_copy, td->io_ops->options, num_opts);
5801 for (i = 0; i < num_opts; i++) {
5802 const struct fio_option *o = NULL;
5809 newret = parse_option(opts_copy[i], opts[i],
5810 td->io_ops->options, &o,
5811 td->eo, &td->opt_list);
5815 log_err("Bad option <%s>\n", opts[i]);
5816 show_closest_option(opts[i]);
5819 opts_copy[i] = NULL;
5827 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
5831 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
5833 const struct fio_option *o;
5835 o = find_option_c(fio_options, opt);
5837 fio_option_mark_set(&td->o, o);
5843 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
5846 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
5850 void fio_fill_default_options(struct thread_data *td)
5852 td->o.magic = OPT_MAGIC;
5853 fill_default_options(&td->o, fio_options);
5856 int fio_show_option_help(const char *opt)
5858 return show_cmd_help(fio_options, opt);
5862 * dupe FIO_OPT_STR_STORE options
5864 void fio_options_mem_dupe(struct thread_data *td)
5866 options_mem_dupe(fio_options, &td->o);
5868 if (td->eo && td->io_ops) {
5869 void *oldeo = td->eo;
5871 td->eo = malloc(td->io_ops->option_struct_size);
5872 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
5873 options_mem_dupe(td->io_ops->options, td->eo);
5877 unsigned int fio_get_kb_base(void *data)
5879 struct thread_data *td = cb_data_to_td(data);
5880 struct thread_options *o = &td->o;
5881 unsigned int kb_base = 0;
5884 * This is a hack... For private options, *data is not holding
5885 * a pointer to the thread_options, but to private data. This means
5886 * we can't safely dereference it, but magic is first so mem wise
5887 * it is valid. But this also means that if the job first sets
5888 * kb_base and expects that to be honored by private options,
5889 * it will be disappointed. We will return the global default
5892 if (o && o->magic == OPT_MAGIC)
5893 kb_base = o->kb_base;
5900 int add_option(const struct fio_option *o)
5902 struct fio_option *__o;
5911 if (opt_index + 1 == FIO_MAX_OPTS) {
5912 log_err("fio: FIO_MAX_OPTS is too small\n");
5916 memcpy(&fio_options[opt_index], o, sizeof(*o));
5917 fio_options[opt_index + 1].name = NULL;
5921 void invalidate_profile_options(const char *prof_name)
5923 struct fio_option *o;
5927 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5928 o->type = FIO_OPT_INVALID;
5929 o->prof_name = NULL;
5935 void add_opt_posval(const char *optname, const char *ival, const char *help)
5937 struct fio_option *o;
5940 o = find_option(fio_options, optname);
5944 for (i = 0; i < PARSE_MAX_VP; i++) {
5945 if (o->posval[i].ival)
5948 o->posval[i].ival = ival;
5949 o->posval[i].help = help;
5954 void del_opt_posval(const char *optname, const char *ival)
5956 struct fio_option *o;
5959 o = find_option(fio_options, optname);
5963 for (i = 0; i < PARSE_MAX_VP; i++) {
5964 if (!o->posval[i].ival)
5966 if (strcmp(o->posval[i].ival, ival))
5969 o->posval[i].ival = NULL;
5970 o->posval[i].help = NULL;
5974 void fio_options_free(struct thread_data *td)
5976 options_free(fio_options, &td->o);
5977 if (td->eo && td->io_ops && td->io_ops->options) {
5978 options_free(td->io_ops->options, td->eo);
5984 void fio_dump_options_free(struct thread_data *td)
5986 while (!flist_empty(&td->opt_list)) {
5987 struct print_option *p;
5989 p = flist_first_entry(&td->opt_list, struct print_option, list);
5990 flist_del_init(&p->list);
5997 struct fio_option *fio_option_find(const char *name)
5999 return find_option(fio_options, name);
6002 static struct fio_option *find_next_opt(struct fio_option *from,
6005 struct fio_option *opt;
6008 from = &fio_options[0];
6014 if (off1 == from->off1) {
6019 } while (from->name);
6024 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
6026 unsigned int opt_off, index, offset;
6028 opt_off = opt - &fio_options[0];
6029 index = opt_off / (8 * sizeof(uint64_t));
6030 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
6031 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
6034 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
6036 struct fio_option *opt, *next;
6039 while ((opt = find_next_opt(next, off1)) != NULL) {
6040 if (opt_is_set(o, opt))
6049 void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt)
6051 unsigned int opt_off, index, offset;
6053 opt_off = opt - &fio_options[0];
6054 index = opt_off / (8 * sizeof(uint64_t));
6055 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
6056 o->set_options[index] |= (uint64_t)1 << offset;