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_PLIS)
274 td->o.fdp_plis[i++] = strtoll(v, NULL, 0);
277 qsort(td->o.fdp_plis, i, sizeof(*td->o.fdp_plis), fio_fdp_cmp);
283 static int str_bssplit_cb(void *data, const char *input)
285 struct thread_data *td = cb_data_to_td(data);
289 p = str = strdup(input);
291 strip_blank_front(&str);
292 strip_blank_end(str);
294 ret = str_split_parse(td, str, bssplit_ddir, NULL, false);
296 if (parse_dryrun()) {
299 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
300 free(td->o.bssplit[i]);
301 td->o.bssplit[i] = NULL;
302 td->o.bssplit_nr[i] = 0;
310 static int parse_cmdprio_bssplit_entry(struct thread_options *o,
311 struct split_prio *entry, char *str)
316 unsigned int perc = 0, class, level, hint;
319 * valid entry formats:
320 * bs/ - %s/ - set perc to 0, prio to -1.
321 * bs/perc - %s/%u - set prio to -1.
322 * bs/perc/class/level - %s/%u/%u/%u
323 * bs/perc/class/level/hint - %s/%u/%u/%u/%u
325 matches = sscanf(str, "%m[^/]/%u/%u/%u/%u",
326 &bs_str, &perc, &class, &level, &hint);
328 log_err("fio: invalid cmdprio_bssplit format\n");
332 if (str_to_decimal(bs_str, &bs_val, 1, o, 0, 0)) {
333 log_err("fio: split conversion failed\n");
340 entry->perc = min(perc, 100u);
343 case 1: /* bs/ case */
344 case 2: /* bs/perc case */
346 case 4: /* bs/perc/class/level case */
347 case 5: /* bs/perc/class/level/hint case */
348 class = min(class, (unsigned int) IOPRIO_MAX_PRIO_CLASS);
349 level = min(level, (unsigned int) IOPRIO_MAX_PRIO);
351 hint = min(hint, (unsigned int) IOPRIO_MAX_PRIO_HINT);
354 entry->prio = ioprio_value(class, level, hint);
357 log_err("fio: invalid cmdprio_bssplit format\n");
365 * Returns a negative integer if the first argument should be before the second
366 * argument in the sorted list. A positive integer if the first argument should
367 * be after the second argument in the sorted list. A zero if they are equal.
369 static int fio_split_prio_cmp(const void *p1, const void *p2)
371 const struct split_prio *tmp1 = p1;
372 const struct split_prio *tmp2 = p2;
374 if (tmp1->bs > tmp2->bs)
376 if (tmp1->bs < tmp2->bs)
381 int split_parse_prio_ddir(struct thread_options *o, struct split_prio **entries,
382 int *nr_entries, char *str)
384 struct split_prio *tmp_entries;
385 unsigned int nr_bssplits;
386 char *str_cpy, *p, *fname;
388 /* strsep modifies the string, dup it so that we can use strsep twice */
389 p = str_cpy = strdup(str);
394 while ((fname = strsep(&str_cpy, ":")) != NULL) {
401 if (nr_bssplits > BSSPLIT_MAX) {
402 log_err("fio: too many cmdprio_bssplit entries\n");
406 tmp_entries = calloc(nr_bssplits, sizeof(*tmp_entries));
411 while ((fname = strsep(&str, ":")) != NULL) {
412 struct split_prio *entry;
417 entry = &tmp_entries[nr_bssplits];
419 if (parse_cmdprio_bssplit_entry(o, entry, fname)) {
420 log_err("fio: failed to parse cmdprio_bssplit entry\n");
425 /* skip zero perc entries, they provide no useful information */
430 qsort(tmp_entries, nr_bssplits, sizeof(*tmp_entries),
433 *entries = tmp_entries;
434 *nr_entries = nr_bssplits;
439 static int str2error(char *str)
441 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
442 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
443 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
444 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
445 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
446 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
447 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
448 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
449 int i = 0, num = sizeof(err) / sizeof(char *);
452 if (!strcmp(err[i], str))
459 static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
466 if (etype >= ERROR_TYPE_CNT) {
467 log_err("Illegal error type\n");
471 td->o.ignore_error_nr[etype] = 4;
472 error = calloc(4, sizeof(int));
475 while ((fname = strsep(&str, ":")) != NULL) {
481 * grow struct buffer, if needed
483 if (i == td->o.ignore_error_nr[etype]) {
484 td->o.ignore_error_nr[etype] <<= 1;
485 error = realloc(error, td->o.ignore_error_nr[etype]
488 if (fname[0] == 'E') {
489 error[i] = str2error(fname);
491 error[i] = atoi(fname);
493 error[i] = -error[i];
496 log_err("Unknown error %s, please use number value\n",
498 td->o.ignore_error_nr[etype] = 0;
505 td->o.continue_on_error |= 1 << etype;
506 td->o.ignore_error_nr[etype] = i;
507 td->o.ignore_error[etype] = error;
509 td->o.ignore_error_nr[etype] = 0;
517 static int str_replay_skip_cb(void *data, const char *input)
519 struct thread_data *td = cb_data_to_td(data);
526 p = str = strdup(input);
528 strip_blank_front(&str);
529 strip_blank_end(str);
535 if (!strcmp(p, "read"))
536 td->o.replay_skip |= 1u << DDIR_READ;
537 else if (!strcmp(p, "write"))
538 td->o.replay_skip |= 1u << DDIR_WRITE;
539 else if (!strcmp(p, "trim"))
540 td->o.replay_skip |= 1u << DDIR_TRIM;
541 else if (!strcmp(p, "sync"))
542 td->o.replay_skip |= 1u << DDIR_SYNC;
544 log_err("Unknown skip type: %s\n", p);
554 static int str_ignore_error_cb(void *data, const char *input)
556 struct thread_data *td = cb_data_to_td(data);
559 enum error_type_bit type = 0;
564 p = str = strdup(input);
566 strip_blank_front(&str);
567 strip_blank_end(str);
573 ret = ignore_error_type(td, type, p);
583 static int str_rw_cb(void *data, const char *str)
585 struct thread_data *td = cb_data_to_td(data);
586 struct thread_options *o = &td->o;
595 nr = get_opt_postfix(str);
600 o->ddir_seq_nr = atoi(nr);
604 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
605 log_err("fio: rw postfix parsing failed\n");
610 o->ddir_seq_add = val;
617 static int str_mem_cb(void *data, const char *mem)
619 struct thread_data *td = cb_data_to_td(data);
621 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
622 td->o.mem_type == MEM_MMAPSHARED)
623 td->o.mmapfile = get_opt_postfix(mem);
628 static int fio_clock_source_cb(void *data, const char *str)
630 struct thread_data *td = cb_data_to_td(data);
632 fio_clock_source = td->o.clocksource;
633 fio_clock_source_set = 1;
638 static int str_rwmix_read_cb(void *data, unsigned long long *val)
640 struct thread_data *td = cb_data_to_td(data);
642 td->o.rwmix[DDIR_READ] = *val;
643 td->o.rwmix[DDIR_WRITE] = 100 - *val;
647 static int str_rwmix_write_cb(void *data, unsigned long long *val)
649 struct thread_data *td = cb_data_to_td(data);
651 td->o.rwmix[DDIR_WRITE] = *val;
652 td->o.rwmix[DDIR_READ] = 100 - *val;
656 static int str_exitall_cb(void)
658 exitall_on_terminate = true;
662 #ifdef FIO_HAVE_CPU_AFFINITY
663 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
665 unsigned int i, index, cpus_in_mask;
666 const long max_cpu = cpus_configured();
668 cpus_in_mask = fio_cpu_count(mask);
672 cpu_index = cpu_index % cpus_in_mask;
675 for (i = 0; i < max_cpu; i++) {
676 if (!fio_cpu_isset(mask, i))
679 if (cpu_index != index)
680 fio_cpu_clear(mask, i);
685 return fio_cpu_count(mask);
688 static int str_cpumask_cb(void *data, unsigned long long *val)
690 struct thread_data *td = cb_data_to_td(data);
698 ret = fio_cpuset_init(&td->o.cpumask);
700 log_err("fio: cpuset_init failed\n");
701 td_verror(td, ret, "fio_cpuset_init");
705 max_cpu = cpus_configured();
707 for (i = 0; i < sizeof(int) * 8; i++) {
708 if ((1 << i) & *val) {
710 log_err("fio: CPU %d too large (max=%ld)\n", i,
714 dprint(FD_PARSE, "set cpu allowed %d\n", i);
715 fio_cpu_set(&td->o.cpumask, i);
722 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
729 ret = fio_cpuset_init(mask);
731 log_err("fio: cpuset_init failed\n");
732 td_verror(td, ret, "fio_cpuset_init");
736 p = str = strdup(input);
738 strip_blank_front(&str);
739 strip_blank_end(str);
741 max_cpu = cpus_configured();
743 while ((cpu = strsep(&str, ",")) != NULL) {
752 while ((cpu2 = strsep(&str2, "-")) != NULL) {
762 while (icpu <= icpu2) {
763 if (icpu >= FIO_MAX_CPUS) {
764 log_err("fio: your OS only supports up to"
765 " %d CPUs\n", (int) FIO_MAX_CPUS);
769 if (icpu >= max_cpu) {
770 log_err("fio: CPU %d too large (max=%ld)\n",
776 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
777 fio_cpu_set(mask, icpu);
788 static int str_cpus_allowed_cb(void *data, const char *input)
790 struct thread_data *td = cb_data_to_td(data);
795 return set_cpus_allowed(td, &td->o.cpumask, input);
798 static int str_verify_cpus_allowed_cb(void *data, const char *input)
800 struct thread_data *td = cb_data_to_td(data);
805 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
809 static int str_log_cpus_allowed_cb(void *data, const char *input)
811 struct thread_data *td = cb_data_to_td(data);
816 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
818 #endif /* CONFIG_ZLIB */
820 #endif /* FIO_HAVE_CPU_AFFINITY */
822 #ifdef CONFIG_LIBNUMA
823 static int str_numa_cpunodes_cb(void *data, char *input)
825 struct thread_data *td = cb_data_to_td(data);
826 struct bitmask *verify_bitmask;
831 /* numa_parse_nodestring() parses a character string list
832 * of nodes into a bit mask. The bit mask is allocated by
833 * numa_allocate_nodemask(), so it should be freed by
834 * numa_free_nodemask().
836 verify_bitmask = numa_parse_nodestring(input);
837 if (verify_bitmask == NULL) {
838 log_err("fio: numa_parse_nodestring failed\n");
839 td_verror(td, 1, "str_numa_cpunodes_cb");
842 numa_free_nodemask(verify_bitmask);
844 td->o.numa_cpunodes = strdup(input);
848 static int str_numa_mpol_cb(void *data, char *input)
850 struct thread_data *td = cb_data_to_td(data);
851 const char * const policy_types[] =
852 { "default", "prefer", "bind", "interleave", "local", NULL };
855 struct bitmask *verify_bitmask;
860 nodelist = strchr(input, ':');
862 /* NUL-terminate mode */
866 for (i = 0; i <= MPOL_LOCAL; i++) {
867 if (!strcmp(input, policy_types[i])) {
868 td->o.numa_mem_mode = i;
872 if (i > MPOL_LOCAL) {
873 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
877 switch (td->o.numa_mem_mode) {
880 * Insist on a nodelist of one node only
883 char *rest = nodelist;
884 while (isdigit(*rest))
887 log_err("fio: one node only for \'prefer\'\n");
891 log_err("fio: one node is needed for \'prefer\'\n");
895 case MPOL_INTERLEAVE:
897 * Default to online nodes with memory if no nodelist
900 nodelist = strdup("all");
905 * Don't allow a nodelist
908 log_err("fio: NO nodelist for \'local\'\n");
914 * Insist on a nodelist
917 log_err("fio: a nodelist is needed for \'bind\'\n");
924 /* numa_parse_nodestring() parses a character string list
925 * of nodes into a bit mask. The bit mask is allocated by
926 * numa_allocate_nodemask(), so it should be freed by
927 * numa_free_nodemask().
929 switch (td->o.numa_mem_mode) {
931 td->o.numa_mem_prefer_node = atoi(nodelist);
933 case MPOL_INTERLEAVE:
935 verify_bitmask = numa_parse_nodestring(nodelist);
936 if (verify_bitmask == NULL) {
937 log_err("fio: numa_parse_nodestring failed\n");
938 td_verror(td, 1, "str_numa_memnodes_cb");
941 td->o.numa_memnodes = strdup(nodelist);
942 numa_free_nodemask(verify_bitmask);
957 static int str_fst_cb(void *data, const char *str)
959 struct thread_data *td = cb_data_to_td(data);
965 td->file_service_nr = 1;
967 switch (td->o.file_service_type) {
968 case FIO_FSERVICE_RANDOM:
969 case FIO_FSERVICE_RR:
970 case FIO_FSERVICE_SEQ:
971 nr = get_opt_postfix(str);
973 td->file_service_nr = atoi(nr);
978 case FIO_FSERVICE_ZIPF:
981 case FIO_FSERVICE_PARETO:
982 val = FIO_DEF_PARETO;
984 case FIO_FSERVICE_GAUSS:
988 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
995 nr = get_opt_postfix(str);
996 if (nr && !split_parse_distr(nr, &val, ¢er)) {
997 log_err("fio: file service type random postfix parsing failed\n");
1004 if (center != -1 && (center < 0.00 || center > 1.00)) {
1005 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
1008 td->random_center = center;
1010 switch (td->o.file_service_type) {
1011 case FIO_FSERVICE_ZIPF:
1013 log_err("fio: zipf theta must be different than 1.0\n");
1018 td->zipf_theta = val;
1020 case FIO_FSERVICE_PARETO:
1021 if (val <= 0.00 || val >= 1.00) {
1022 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1029 case FIO_FSERVICE_GAUSS:
1030 if (val < 0.00 || val >= 100.00) {
1031 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1036 td->gauss_dev = val;
1043 #ifdef CONFIG_SYNC_FILE_RANGE
1044 static int str_sfr_cb(void *data, const char *str)
1046 struct thread_data *td = cb_data_to_td(data);
1047 char *nr = get_opt_postfix(str);
1049 td->sync_file_range_nr = 1;
1051 td->sync_file_range_nr = atoi(nr);
1059 static int zone_split_ddir(struct thread_options *o, void *eo,
1060 enum fio_ddir ddir, char *str, bool absolute)
1062 unsigned int i, perc, perc_missing, sperc, sperc_missing;
1065 memset(&split, 0, sizeof(split));
1067 if (split_parse_ddir(o, &split, str, absolute, ZONESPLIT_MAX))
1072 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
1073 o->zone_split_nr[ddir] = split.nr;
1074 for (i = 0; i < split.nr; i++) {
1075 o->zone_split[ddir][i].access_perc = split.val1[i];
1077 o->zone_split[ddir][i].size = split.val2[i];
1079 o->zone_split[ddir][i].size_perc = split.val2[i];
1083 * Now check if the percentages add up, and how much is missing
1085 perc = perc_missing = 0;
1086 sperc = sperc_missing = 0;
1087 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1088 struct zone_split *zsp = &o->zone_split[ddir][i];
1090 if (zsp->access_perc == (uint8_t) -1U)
1093 perc += zsp->access_perc;
1096 if (zsp->size_perc == (uint8_t) -1U)
1099 sperc += zsp->size_perc;
1103 if (perc > 100 || sperc > 100) {
1104 log_err("fio: zone_split percentages add to more than 100%%\n");
1105 free(o->zone_split[ddir]);
1106 o->zone_split[ddir] = NULL;
1110 log_err("fio: access percentage don't add up to 100 for zoned "
1111 "random distribution (got=%u)\n", perc);
1112 free(o->zone_split[ddir]);
1113 o->zone_split[ddir] = NULL;
1118 * If values didn't have a percentage set, divide the remains between
1122 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
1124 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1125 struct zone_split *zsp = &o->zone_split[ddir][i];
1127 if (zsp->access_perc == (uint8_t) -1U)
1128 zsp->access_perc = (100 - perc) / perc_missing;
1131 if (sperc_missing) {
1132 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
1134 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1135 struct zone_split *zsp = &o->zone_split[ddir][i];
1137 if (zsp->size_perc == (uint8_t) -1U)
1138 zsp->size_perc = (100 - sperc) / sperc_missing;
1145 static int parse_zoned_distribution(struct thread_data *td, const char *input,
1148 const char *pre = absolute ? "zoned_abs:" : "zoned:";
1152 p = str = strdup(input);
1154 strip_blank_front(&str);
1155 strip_blank_end(str);
1157 /* We expect it to start like that, bail if not */
1158 if (strncmp(str, pre, strlen(pre))) {
1159 log_err("fio: mismatch in zoned input <%s>\n", str);
1165 ret = str_split_parse(td, str, zone_split_ddir, NULL, absolute);
1169 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1172 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
1174 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
1175 struct zone_split *zsp = &td->o.zone_split[i][j];
1178 dprint(FD_PARSE, "\t%d: %u/%llu\n", j,
1180 (unsigned long long) zsp->size);
1182 dprint(FD_PARSE, "\t%d: %u/%u\n", j,
1189 if (parse_dryrun()) {
1190 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1191 free(td->o.zone_split[i]);
1192 td->o.zone_split[i] = NULL;
1193 td->o.zone_split_nr[i] = 0;
1200 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1201 td->o.zone_split_nr[i] = 0;
1207 static int str_random_distribution_cb(void *data, const char *str)
1209 struct thread_data *td = cb_data_to_td(data);
1214 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1216 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1217 val = FIO_DEF_PARETO;
1218 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1220 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1221 return parse_zoned_distribution(td, str, false);
1222 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED_ABS)
1223 return parse_zoned_distribution(td, str, true);
1227 nr = get_opt_postfix(str);
1228 if (nr && !split_parse_distr(nr, &val, ¢er)) {
1229 log_err("fio: random postfix parsing failed\n");
1236 if (center != -1 && (center < 0.00 || center > 1.00)) {
1237 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
1240 td->o.random_center.u.f = center;
1242 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1244 log_err("fio: zipf theta must different than 1.0\n");
1249 td->o.zipf_theta.u.f = val;
1250 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1251 if (val <= 0.00 || val >= 1.00) {
1252 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1257 td->o.pareto_h.u.f = val;
1259 if (val < 0.00 || val >= 100.0) {
1260 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1265 td->o.gauss_dev.u.f = val;
1271 static int str_steadystate_cb(void *data, const char *str)
1273 struct thread_data *td = cb_data_to_td(data);
1279 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1280 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
1281 /* should be impossible to get here */
1282 log_err("fio: unknown steady state criterion\n");
1286 nr = get_opt_postfix(str);
1288 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1293 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1294 pct = strstr(nr, "%");
1297 strip_blank_end(nr);
1298 if (!str_to_float(nr, &val, 0)) {
1299 log_err("fio: could not parse steadystate threshold percentage\n");
1304 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1309 td->o.ss_state |= FIO_SS_PCT;
1310 td->o.ss_limit.u.f = val;
1311 } else if (td->o.ss_state & FIO_SS_IOPS) {
1312 if (!str_to_float(nr, &val, 0)) {
1313 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1318 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1323 td->o.ss_limit.u.f = val;
1324 } else { /* bandwidth criterion */
1325 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1326 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1331 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1336 td->o.ss_limit.u.f = (double) ll;
1339 td->ss.state = td->o.ss_state;
1344 * Return next name in the string. Files are separated with ':'. If the ':'
1345 * is escaped with a '\', then that ':' is part of the filename and does not
1346 * indicate a new file.
1348 char *get_next_str(char **ptr)
1353 if (!str || !strlen(str))
1359 * No colon, we are done
1361 p = strchr(str, ':');
1368 * We got a colon, but it's the first character. Skip and
1376 if (*(p - 1) != '\\') {
1382 memmove(p - 1, p, strlen(p) + 1);
1390 int get_max_str_idx(char *input)
1392 unsigned int cur_idx;
1395 p = str = strdup(input);
1396 for (cur_idx = 0; ; cur_idx++)
1397 if (get_next_str(&str) == NULL)
1405 * Returns the directory at the index, indexes > entries will be
1406 * assigned via modulo division of the index
1408 int set_name_idx(char *target, size_t tlen, char *input, int index,
1409 bool unique_filename)
1411 unsigned int cur_idx;
1413 char *fname, *str, *p;
1415 p = str = strdup(input);
1417 index %= get_max_str_idx(input);
1418 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1419 fname = get_next_str(&str);
1421 if (client_sockaddr_str[0] && unique_filename) {
1422 len = snprintf(target, tlen, "%s/%s.", fname,
1423 client_sockaddr_str);
1425 len = snprintf(target, tlen, "%s%c", fname,
1426 FIO_OS_PATH_SEPARATOR);
1428 target[tlen - 1] = '\0';
1434 char* get_name_by_idx(char *input, int index)
1436 unsigned int cur_idx;
1437 char *fname, *str, *p;
1439 p = str = strdup(input);
1441 index %= get_max_str_idx(input);
1442 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1443 fname = get_next_str(&str);
1445 fname = strdup(fname);
1451 static int str_filename_cb(void *data, const char *input)
1453 struct thread_data *td = cb_data_to_td(data);
1454 char *fname, *str, *p;
1456 p = str = strdup(input);
1458 strip_blank_front(&str);
1459 strip_blank_end(str);
1462 * Ignore what we may already have from nrfiles option.
1464 if (!td->files_index)
1467 while ((fname = get_next_str(&str)) != NULL) {
1470 add_file(td, fname, 0, 1);
1477 static int str_directory_cb(void *data, const char fio_unused *unused)
1479 struct thread_data *td = cb_data_to_td(data);
1481 char *dirname, *str, *p;
1487 p = str = strdup(td->o.directory);
1488 while ((dirname = get_next_str(&str)) != NULL) {
1489 if (lstat(dirname, &sb) < 0) {
1492 log_err("fio: %s is not a directory\n", dirname);
1493 td_verror(td, ret, "lstat");
1496 if (!S_ISDIR(sb.st_mode)) {
1497 log_err("fio: %s is not a directory\n", dirname);
1508 static int str_opendir_cb(void *data, const char fio_unused *str)
1510 struct thread_data *td = cb_data_to_td(data);
1515 if (!td->files_index)
1518 return add_dir_files(td, td->o.opendir);
1521 static int str_buffer_pattern_cb(void *data, const char *input)
1523 struct thread_data *td = cb_data_to_td(data);
1526 /* FIXME: for now buffer pattern does not support formats */
1527 ret = parse_and_fill_pattern_alloc(input, strlen(input),
1528 &td->o.buffer_pattern, NULL, NULL, NULL);
1533 td->o.buffer_pattern_bytes = ret;
1536 * If this job is doing any reading or has compression set,
1537 * ensure that we refill buffers for writes or we could be
1538 * invalidating the pattern through reads.
1540 if (!td->o.compress_percentage && !td_read(td))
1541 td->o.refill_buffers = 0;
1543 td->o.refill_buffers = 1;
1545 td->o.scramble_buffers = 0;
1546 td->o.zero_buffers = 0;
1551 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1553 struct thread_data *td = cb_data_to_td(data);
1555 td->flags |= TD_F_COMPRESS;
1556 td->o.compress_percentage = *il;
1560 static int str_dedupe_cb(void *data, unsigned long long *il)
1562 struct thread_data *td = cb_data_to_td(data);
1564 td->flags |= TD_F_COMPRESS;
1565 td->o.dedupe_percentage = *il;
1566 td->o.refill_buffers = 1;
1570 static int str_verify_pattern_cb(void *data, const char *input)
1572 struct thread_data *td = cb_data_to_td(data);
1575 td->o.verify_fmt_sz = FIO_ARRAY_SIZE(td->o.verify_fmt);
1576 ret = parse_and_fill_pattern_alloc(input, strlen(input),
1577 &td->o.verify_pattern, fmt_desc, td->o.verify_fmt,
1578 &td->o.verify_fmt_sz);
1583 td->o.verify_pattern_bytes = ret;
1585 * VERIFY_* could already be set
1587 if (!fio_option_is_set(&td->o, verify))
1588 td->o.verify = VERIFY_PATTERN;
1593 static int str_gtod_reduce_cb(void *data, int *il)
1595 struct thread_data *td = cb_data_to_td(data);
1599 * Only modify options if gtod_reduce==1
1600 * Otherwise leave settings alone.
1603 td->o.disable_lat = 1;
1604 td->o.disable_clat = 1;
1605 td->o.disable_slat = 1;
1606 td->o.disable_bw = 1;
1607 td->o.clat_percentiles = 0;
1608 td->o.lat_percentiles = 0;
1609 td->o.slat_percentiles = 0;
1610 td->ts_cache_mask = 63;
1616 static int str_offset_cb(void *data, unsigned long long *__val)
1618 struct thread_data *td = cb_data_to_td(data);
1619 unsigned long long v = *__val;
1621 if (parse_is_percent(v)) {
1622 td->o.start_offset = 0;
1623 td->o.start_offset_percent = -1ULL - v;
1624 td->o.start_offset_nz = 0;
1625 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1626 td->o.start_offset_percent);
1627 } else if (parse_is_zone(v)) {
1628 td->o.start_offset = 0;
1629 td->o.start_offset_percent = 0;
1630 td->o.start_offset_nz = v - ZONE_BASE_VAL;
1632 td->o.start_offset = v;
1637 static int str_offset_increment_cb(void *data, unsigned long long *__val)
1639 struct thread_data *td = cb_data_to_td(data);
1640 unsigned long long v = *__val;
1642 if (parse_is_percent(v)) {
1643 td->o.offset_increment = 0;
1644 td->o.offset_increment_percent = -1ULL - v;
1645 td->o.offset_increment_nz = 0;
1646 dprint(FD_PARSE, "SET offset_increment_percent %d\n",
1647 td->o.offset_increment_percent);
1648 } else if (parse_is_zone(v)) {
1649 td->o.offset_increment = 0;
1650 td->o.offset_increment_percent = 0;
1651 td->o.offset_increment_nz = v - ZONE_BASE_VAL;
1653 td->o.offset_increment = v;
1658 static int str_size_cb(void *data, unsigned long long *__val)
1660 struct thread_data *td = cb_data_to_td(data);
1661 unsigned long long v = *__val;
1663 if (parse_is_percent(v)) {
1665 td->o.size_percent = -1ULL - v;
1666 dprint(FD_PARSE, "SET size_percent %d\n",
1667 td->o.size_percent);
1668 } else if (parse_is_zone(v)) {
1670 td->o.size_percent = 0;
1671 td->o.size_nz = v - ZONE_BASE_VAL;
1678 static int str_io_size_cb(void *data, unsigned long long *__val)
1680 struct thread_data *td = cb_data_to_td(data);
1681 unsigned long long v = *__val;
1683 if (parse_is_percent_uncapped(v)) {
1685 td->o.io_size_percent = -1ULL - v;
1686 if (td->o.io_size_percent > 100) {
1687 log_err("fio: io_size values greater than 100%% aren't supported\n");
1690 dprint(FD_PARSE, "SET io_size_percent %d\n",
1691 td->o.io_size_percent);
1692 } else if (parse_is_zone(v)) {
1694 td->o.io_size_percent = 0;
1695 td->o.io_size_nz = v - ZONE_BASE_VAL;
1702 static int str_zoneskip_cb(void *data, unsigned long long *__val)
1704 struct thread_data *td = cb_data_to_td(data);
1705 unsigned long long v = *__val;
1707 if (parse_is_zone(v)) {
1708 td->o.zone_skip = 0;
1709 td->o.zone_skip_nz = v - ZONE_BASE_VAL;
1711 td->o.zone_skip = v;
1716 static int str_write_bw_log_cb(void *data, const char *str)
1718 struct thread_data *td = cb_data_to_td(data);
1721 td->o.bw_log_file = strdup(str);
1723 td->o.write_bw_log = 1;
1727 static int str_write_lat_log_cb(void *data, const char *str)
1729 struct thread_data *td = cb_data_to_td(data);
1732 td->o.lat_log_file = strdup(str);
1734 td->o.write_lat_log = 1;
1738 static int str_write_iops_log_cb(void *data, const char *str)
1740 struct thread_data *td = cb_data_to_td(data);
1743 td->o.iops_log_file = strdup(str);
1745 td->o.write_iops_log = 1;
1749 static int str_write_hist_log_cb(void *data, const char *str)
1751 struct thread_data *td = cb_data_to_td(data);
1754 td->o.hist_log_file = strdup(str);
1756 td->o.write_hist_log = 1;
1761 * str is supposed to be a substring of the strdup'd original string,
1762 * and is valid only if it's a regular file path.
1763 * This function keeps the pointer to the path as needed later.
1765 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1766 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1767 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1769 static int str_ioengine_external_cb(void *data, const char *str)
1771 struct thread_data *td = cb_data_to_td(data);
1776 log_err("fio: null external ioengine path\n");
1780 p = (char *)str; /* str is mutable */
1781 strip_blank_front(&p);
1784 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1785 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1789 td->o.ioengine_so_path = p;
1793 static int rw_verify(const struct fio_option *o, void *data)
1795 struct thread_data *td = cb_data_to_td(data);
1797 if (read_only && (td_write(td) || td_trim(td))) {
1798 log_err("fio: job <%s> has write or trim bit set, but"
1799 " fio is in read-only mode\n", td->o.name);
1806 static int gtod_cpu_verify(const struct fio_option *o, void *data)
1808 #ifndef FIO_HAVE_CPU_AFFINITY
1809 struct thread_data *td = cb_data_to_td(data);
1811 if (td->o.gtod_cpu) {
1812 log_err("fio: platform must support CPU affinity for"
1813 "gettimeofday() offloading\n");
1822 * Map of job/command line options
1824 struct fio_option fio_options[FIO_MAX_OPTS] = {
1826 .name = "description",
1827 .lname = "Description of job",
1828 .type = FIO_OPT_STR_STORE,
1829 .off1 = offsetof(struct thread_options, description),
1830 .help = "Text job description",
1831 .category = FIO_OPT_C_GENERAL,
1832 .group = FIO_OPT_G_DESC,
1836 .lname = "Job name",
1837 .type = FIO_OPT_STR_STORE,
1838 .off1 = offsetof(struct thread_options, name),
1839 .help = "Name of this job",
1840 .category = FIO_OPT_C_GENERAL,
1841 .group = FIO_OPT_G_DESC,
1845 .lname = "Waitee name",
1846 .type = FIO_OPT_STR_STORE,
1847 .off1 = offsetof(struct thread_options, wait_for),
1848 .help = "Name of the job this one wants to wait for before starting",
1849 .category = FIO_OPT_C_GENERAL,
1850 .group = FIO_OPT_G_DESC,
1854 .lname = "Filename(s)",
1855 .type = FIO_OPT_STR_STORE,
1856 .off1 = offsetof(struct thread_options, filename),
1858 .cb = str_filename_cb,
1859 .prio = -1, /* must come after "directory" */
1860 .help = "File(s) to use for the workload",
1861 .category = FIO_OPT_C_FILE,
1862 .group = FIO_OPT_G_FILENAME,
1865 .name = "directory",
1866 .lname = "Directory",
1867 .type = FIO_OPT_STR_STORE,
1868 .off1 = offsetof(struct thread_options, directory),
1869 .cb = str_directory_cb,
1870 .help = "Directory to store files in",
1871 .category = FIO_OPT_C_FILE,
1872 .group = FIO_OPT_G_FILENAME,
1875 .name = "filename_format",
1876 .lname = "Filename Format",
1877 .type = FIO_OPT_STR_STORE,
1878 .off1 = offsetof(struct thread_options, filename_format),
1879 .prio = -1, /* must come after "directory" */
1880 .help = "Override default $jobname.$jobnum.$filenum naming",
1881 .def = "$jobname.$jobnum.$filenum",
1882 .category = FIO_OPT_C_FILE,
1883 .group = FIO_OPT_G_FILENAME,
1886 .name = "unique_filename",
1887 .lname = "Unique Filename",
1888 .type = FIO_OPT_BOOL,
1889 .off1 = offsetof(struct thread_options, unique_filename),
1890 .help = "For network clients, prefix file with source IP",
1892 .category = FIO_OPT_C_FILE,
1893 .group = FIO_OPT_G_FILENAME,
1897 .lname = "Lockfile",
1898 .type = FIO_OPT_STR,
1899 .off1 = offsetof(struct thread_options, file_lock_mode),
1900 .help = "Lock file when doing IO to it",
1902 .parent = "filename",
1905 .category = FIO_OPT_C_FILE,
1906 .group = FIO_OPT_G_FILENAME,
1909 .oval = FILE_LOCK_NONE,
1910 .help = "No file locking",
1912 { .ival = "exclusive",
1913 .oval = FILE_LOCK_EXCLUSIVE,
1914 .help = "Exclusive file lock",
1917 .ival = "readwrite",
1918 .oval = FILE_LOCK_READWRITE,
1919 .help = "Read vs write lock",
1925 .lname = "Open directory",
1926 .type = FIO_OPT_STR_STORE,
1927 .off1 = offsetof(struct thread_options, opendir),
1928 .cb = str_opendir_cb,
1929 .help = "Recursively add files from this directory and down",
1930 .category = FIO_OPT_C_FILE,
1931 .group = FIO_OPT_G_FILENAME,
1935 .lname = "Read/write",
1936 .alias = "readwrite",
1937 .type = FIO_OPT_STR,
1939 .off1 = offsetof(struct thread_options, td_ddir),
1940 .help = "IO direction",
1942 .verify = rw_verify,
1943 .category = FIO_OPT_C_IO,
1944 .group = FIO_OPT_G_IO_BASIC,
1947 .oval = TD_DDIR_READ,
1948 .help = "Sequential read",
1951 .oval = TD_DDIR_WRITE,
1952 .help = "Sequential write",
1955 .oval = TD_DDIR_TRIM,
1956 .help = "Sequential trim",
1958 { .ival = "randread",
1959 .oval = TD_DDIR_RANDREAD,
1960 .help = "Random read",
1962 { .ival = "randwrite",
1963 .oval = TD_DDIR_RANDWRITE,
1964 .help = "Random write",
1966 { .ival = "randtrim",
1967 .oval = TD_DDIR_RANDTRIM,
1968 .help = "Random trim",
1972 .help = "Sequential read and write mix",
1974 { .ival = "readwrite",
1976 .help = "Sequential read and write mix",
1979 .oval = TD_DDIR_RANDRW,
1980 .help = "Random read and write mix"
1982 { .ival = "trimwrite",
1983 .oval = TD_DDIR_TRIMWRITE,
1984 .help = "Trim and write mix, trims preceding writes"
1986 { .ival = "randtrimwrite",
1987 .oval = TD_DDIR_RANDTRIMWRITE,
1988 .help = "Randomly trim and write mix, trims preceding writes"
1993 .name = "rw_sequencer",
1994 .lname = "RW Sequencer",
1995 .type = FIO_OPT_STR,
1996 .off1 = offsetof(struct thread_options, rw_seq),
1997 .help = "IO offset generator modifier",
1998 .def = "sequential",
1999 .category = FIO_OPT_C_IO,
2000 .group = FIO_OPT_G_IO_BASIC,
2002 { .ival = "sequential",
2004 .help = "Generate sequential offsets",
2006 { .ival = "identical",
2007 .oval = RW_SEQ_IDENT,
2008 .help = "Generate identical offsets",
2015 .lname = "IO Engine",
2016 .type = FIO_OPT_STR_STORE,
2017 .off1 = offsetof(struct thread_options, ioengine),
2018 .help = "IO engine to use",
2019 .def = FIO_PREFERRED_ENGINE,
2020 .category = FIO_OPT_C_IO,
2021 .group = FIO_OPT_G_IO_BASIC,
2024 .help = "Use read/write",
2027 .help = "Use pread/pwrite",
2030 .help = "Use readv/writev",
2032 #ifdef CONFIG_PWRITEV
2034 .help = "Use preadv/pwritev",
2037 #ifdef FIO_HAVE_PWRITEV2
2038 { .ival = "pvsync2",
2039 .help = "Use preadv2/pwritev2",
2042 #ifdef CONFIG_LIBAIO
2044 .help = "Linux native asynchronous IO",
2047 #ifdef ARCH_HAVE_IOURING
2048 { .ival = "io_uring",
2049 .help = "Fast Linux native aio",
2052 #ifdef CONFIG_POSIXAIO
2053 { .ival = "posixaio",
2054 .help = "POSIX asynchronous IO",
2057 #ifdef CONFIG_SOLARISAIO
2058 { .ival = "solarisaio",
2059 .help = "Solaris native asynchronous IO",
2062 #ifdef CONFIG_WINDOWSAIO
2063 { .ival = "windowsaio",
2064 .help = "Windows native asynchronous IO"
2069 .help = "Rados Block Device asynchronous IO"
2073 .help = "Memory mapped IO"
2075 #ifdef CONFIG_LINUX_SPLICE
2077 .help = "splice/vmsplice based IO",
2079 { .ival = "netsplice",
2080 .help = "splice/vmsplice to/from the network",
2083 #ifdef FIO_HAVE_SGIO
2085 .help = "SCSI generic v3 IO",
2089 .help = "Testing engine (no data transfer)",
2092 .help = "Network IO",
2095 .help = "CPU cycle burner engine",
2099 .help = "RDMA IO engine",
2102 #ifdef CONFIG_LIBRPMA_APM
2103 { .ival = "librpma_apm",
2104 .help = "librpma IO engine in APM mode",
2107 #ifdef CONFIG_LIBRPMA_GPSPM
2108 { .ival = "librpma_gpspm",
2109 .help = "librpma IO engine in GPSPM mode",
2112 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
2113 { .ival = "e4defrag",
2114 .help = "ext4 defrag engine",
2117 #ifdef CONFIG_LINUX_FALLOCATE
2119 .help = "fallocate() file based engine",
2124 .help = "Glusterfs libgfapi(sync) based engine"
2126 { .ival = "gfapi_async",
2127 .help = "Glusterfs libgfapi(async) based engine"
2130 #ifdef CONFIG_LIBHDFS
2131 { .ival = "libhdfs",
2132 .help = "Hadoop Distributed Filesystem (HDFS) engine"
2136 { .ival = "ime_psync",
2137 .help = "DDN's IME synchronous IO engine",
2139 { .ival = "ime_psyncv",
2140 .help = "DDN's IME synchronous IO engine using iovecs",
2142 { .ival = "ime_aio",
2143 .help = "DDN's IME asynchronous IO engine",
2146 #ifdef CONFIG_LINUX_DEVDAX
2147 { .ival = "dev-dax",
2148 .help = "DAX Device based IO engine",
2152 .ival = "filecreate",
2153 .help = "File creation engine",
2155 { .ival = "external",
2156 .help = "Load external engine (append name)",
2157 .cb = str_ioengine_external_cb,
2159 #ifdef CONFIG_LIBPMEM
2160 { .ival = "libpmem",
2161 .help = "PMDK libpmem based IO engine",
2166 .help = "HTTP (WebDAV/S3) IO engine",
2170 .help = "Network Block Device (NBD) IO engine"
2174 .help = "DAOS File System (dfs) IO engine",
2177 #ifdef CONFIG_LIBNFS
2179 .help = "NFS IO engine",
2182 #ifdef CONFIG_LIBXNVME
2184 .help = "XNVME IO engine",
2191 .lname = "IO Depth",
2192 .type = FIO_OPT_INT,
2193 .off1 = offsetof(struct thread_options, iodepth),
2194 .help = "Number of IO buffers to keep in flight",
2198 .category = FIO_OPT_C_IO,
2199 .group = FIO_OPT_G_IO_BASIC,
2202 .name = "iodepth_batch",
2203 .lname = "IO Depth batch",
2204 .alias = "iodepth_batch_submit",
2205 .type = FIO_OPT_INT,
2206 .off1 = offsetof(struct thread_options, iodepth_batch),
2207 .help = "Number of IO buffers to submit in one go",
2208 .parent = "iodepth",
2212 .category = FIO_OPT_C_IO,
2213 .group = FIO_OPT_G_IO_BASIC,
2216 .name = "iodepth_batch_complete_min",
2217 .lname = "Min IO depth batch complete",
2218 .alias = "iodepth_batch_complete",
2219 .type = FIO_OPT_INT,
2220 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
2221 .help = "Min number of IO buffers to retrieve in one go",
2222 .parent = "iodepth",
2227 .category = FIO_OPT_C_IO,
2228 .group = FIO_OPT_G_IO_BASIC,
2231 .name = "iodepth_batch_complete_max",
2232 .lname = "Max IO depth batch complete",
2233 .type = FIO_OPT_INT,
2234 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
2235 .help = "Max number of IO buffers to retrieve in one go",
2236 .parent = "iodepth",
2240 .category = FIO_OPT_C_IO,
2241 .group = FIO_OPT_G_IO_BASIC,
2244 .name = "iodepth_low",
2245 .lname = "IO Depth batch low",
2246 .type = FIO_OPT_INT,
2247 .off1 = offsetof(struct thread_options, iodepth_low),
2248 .help = "Low water mark for queuing depth",
2249 .parent = "iodepth",
2252 .category = FIO_OPT_C_IO,
2253 .group = FIO_OPT_G_IO_BASIC,
2256 .name = "serialize_overlap",
2257 .lname = "Serialize overlap",
2258 .off1 = offsetof(struct thread_options, serialize_overlap),
2259 .type = FIO_OPT_BOOL,
2260 .help = "Wait for in-flight IOs that collide to complete",
2261 .parent = "iodepth",
2263 .category = FIO_OPT_C_IO,
2264 .group = FIO_OPT_G_IO_BASIC,
2267 .name = "io_submit_mode",
2268 .lname = "IO submit mode",
2269 .type = FIO_OPT_STR,
2270 .off1 = offsetof(struct thread_options, io_submit_mode),
2271 .help = "How IO submissions and completions are done",
2273 .category = FIO_OPT_C_IO,
2274 .group = FIO_OPT_G_IO_BASIC,
2277 .oval = IO_MODE_INLINE,
2278 .help = "Submit and complete IO inline",
2280 { .ival = "offload",
2281 .oval = IO_MODE_OFFLOAD,
2282 .help = "Offload submit and complete to threads",
2289 .type = FIO_OPT_STR_VAL_ZONE,
2291 .off1 = offsetof(struct thread_options, size),
2292 .help = "Total size of device or files",
2293 .category = FIO_OPT_C_IO,
2294 .group = FIO_OPT_G_INVALID,
2298 .alias = "io_limit",
2300 .type = FIO_OPT_STR_VAL_ZONE,
2301 .cb = str_io_size_cb,
2302 .off1 = offsetof(struct thread_options, io_size),
2303 .help = "Total size of I/O to be performed",
2304 .category = FIO_OPT_C_IO,
2305 .group = FIO_OPT_G_INVALID,
2308 .name = "fill_device",
2309 .lname = "Fill device",
2311 .type = FIO_OPT_BOOL,
2312 .off1 = offsetof(struct thread_options, fill_device),
2313 .help = "Write until an ENOSPC error occurs",
2315 .category = FIO_OPT_C_FILE,
2316 .group = FIO_OPT_G_INVALID,
2320 .lname = "File size",
2321 .type = FIO_OPT_STR_VAL,
2322 .off1 = offsetof(struct thread_options, file_size_low),
2323 .off2 = offsetof(struct thread_options, file_size_high),
2325 .help = "Size of individual files",
2326 .interval = 1024 * 1024,
2327 .category = FIO_OPT_C_FILE,
2328 .group = FIO_OPT_G_INVALID,
2331 .name = "file_append",
2332 .lname = "File append",
2333 .type = FIO_OPT_BOOL,
2334 .off1 = offsetof(struct thread_options, file_append),
2335 .help = "IO will start at the end of the file(s)",
2337 .category = FIO_OPT_C_FILE,
2338 .group = FIO_OPT_G_INVALID,
2342 .lname = "IO offset",
2343 .alias = "fileoffset",
2344 .type = FIO_OPT_STR_VAL_ZONE,
2345 .cb = str_offset_cb,
2346 .off1 = offsetof(struct thread_options, start_offset),
2347 .help = "Start IO from this offset",
2349 .category = FIO_OPT_C_IO,
2350 .group = FIO_OPT_G_INVALID,
2353 .name = "offset_align",
2354 .lname = "IO offset alignment",
2355 .type = FIO_OPT_INT,
2356 .off1 = offsetof(struct thread_options, start_offset_align),
2357 .help = "Start IO from this offset alignment",
2360 .category = FIO_OPT_C_IO,
2361 .group = FIO_OPT_G_INVALID,
2364 .name = "offset_increment",
2365 .lname = "IO offset increment",
2366 .type = FIO_OPT_STR_VAL_ZONE,
2367 .cb = str_offset_increment_cb,
2368 .off1 = offsetof(struct thread_options, offset_increment),
2369 .help = "What is the increment from one offset to the next",
2373 .category = FIO_OPT_C_IO,
2374 .group = FIO_OPT_G_INVALID,
2377 .name = "number_ios",
2378 .lname = "Number of IOs to perform",
2379 .type = FIO_OPT_STR_VAL,
2380 .off1 = offsetof(struct thread_options, number_ios),
2381 .help = "Force job completion after this number of IOs",
2383 .category = FIO_OPT_C_IO,
2384 .group = FIO_OPT_G_INVALID,
2388 .lname = "Block size",
2389 .alias = "blocksize",
2390 .type = FIO_OPT_ULL,
2391 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2392 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2393 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2395 .help = "Block size unit",
2400 .category = FIO_OPT_C_IO,
2401 .group = FIO_OPT_G_INVALID,
2405 .lname = "Block size align",
2406 .alias = "blockalign",
2407 .type = FIO_OPT_ULL,
2408 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2409 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2410 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2412 .help = "IO block offset alignment",
2416 .category = FIO_OPT_C_IO,
2417 .group = FIO_OPT_G_INVALID,
2421 .lname = "Block size range",
2422 .alias = "blocksize_range",
2423 .type = FIO_OPT_RANGE,
2424 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2425 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2426 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2427 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2428 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2429 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2431 .help = "Set block size range (in more detail than bs)",
2435 .category = FIO_OPT_C_IO,
2436 .group = FIO_OPT_G_INVALID,
2440 .lname = "Block size split",
2441 .type = FIO_OPT_STR_ULL,
2442 .cb = str_bssplit_cb,
2443 .off1 = offsetof(struct thread_options, bssplit),
2444 .help = "Set a specific mix of block sizes",
2447 .category = FIO_OPT_C_IO,
2448 .group = FIO_OPT_G_INVALID,
2451 .name = "bs_unaligned",
2452 .lname = "Block size unaligned",
2453 .alias = "blocksize_unaligned",
2454 .type = FIO_OPT_STR_SET,
2455 .off1 = offsetof(struct thread_options, bs_unaligned),
2456 .help = "Don't sector align IO buffer sizes",
2459 .category = FIO_OPT_C_IO,
2460 .group = FIO_OPT_G_INVALID,
2463 .name = "bs_is_seq_rand",
2464 .lname = "Block size division is seq/random (not read/write)",
2465 .type = FIO_OPT_BOOL,
2466 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2467 .help = "Consider any blocksize setting to be sequential,random",
2469 .parent = "blocksize",
2470 .category = FIO_OPT_C_IO,
2471 .group = FIO_OPT_G_INVALID,
2474 .name = "randrepeat",
2475 .alias = "allrandrepeat",
2476 .lname = "Random repeatable",
2477 .type = FIO_OPT_BOOL,
2478 .off1 = offsetof(struct thread_options, rand_repeatable),
2479 .help = "Use repeatable random IO pattern",
2483 .category = FIO_OPT_C_IO,
2484 .group = FIO_OPT_G_RANDOM,
2488 .lname = "The random generator seed",
2489 .type = FIO_OPT_STR_VAL,
2490 .off1 = offsetof(struct thread_options, rand_seed),
2491 .help = "Set the random generator seed value",
2494 .category = FIO_OPT_C_IO,
2495 .group = FIO_OPT_G_RANDOM,
2498 .name = "norandommap",
2499 .lname = "No randommap",
2500 .type = FIO_OPT_STR_SET,
2501 .off1 = offsetof(struct thread_options, norandommap),
2502 .help = "Accept potential duplicate random blocks",
2506 .category = FIO_OPT_C_IO,
2507 .group = FIO_OPT_G_RANDOM,
2510 .name = "softrandommap",
2511 .lname = "Soft randommap",
2512 .type = FIO_OPT_BOOL,
2513 .off1 = offsetof(struct thread_options, softrandommap),
2514 .help = "Set norandommap if randommap allocation fails",
2515 .parent = "norandommap",
2518 .category = FIO_OPT_C_IO,
2519 .group = FIO_OPT_G_RANDOM,
2522 .name = "random_generator",
2523 .lname = "Random Generator",
2524 .type = FIO_OPT_STR,
2525 .off1 = offsetof(struct thread_options, random_generator),
2526 .help = "Type of random number generator to use",
2527 .def = "tausworthe",
2529 { .ival = "tausworthe",
2530 .oval = FIO_RAND_GEN_TAUSWORTHE,
2531 .help = "Strong Tausworthe generator",
2534 .oval = FIO_RAND_GEN_LFSR,
2535 .help = "Variable length LFSR",
2538 .ival = "tausworthe64",
2539 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2540 .help = "64-bit Tausworthe variant",
2543 .category = FIO_OPT_C_IO,
2544 .group = FIO_OPT_G_RANDOM,
2547 .name = "random_distribution",
2548 .lname = "Random Distribution",
2549 .type = FIO_OPT_STR,
2550 .off1 = offsetof(struct thread_options, random_distribution),
2551 .cb = str_random_distribution_cb,
2552 .help = "Random offset distribution generator",
2556 .oval = FIO_RAND_DIST_RANDOM,
2557 .help = "Completely random",
2560 .oval = FIO_RAND_DIST_ZIPF,
2561 .help = "Zipf distribution",
2564 .oval = FIO_RAND_DIST_PARETO,
2565 .help = "Pareto distribution",
2568 .oval = FIO_RAND_DIST_GAUSS,
2569 .help = "Normal (Gaussian) distribution",
2572 .oval = FIO_RAND_DIST_ZONED,
2573 .help = "Zoned random distribution",
2575 { .ival = "zoned_abs",
2576 .oval = FIO_RAND_DIST_ZONED_ABS,
2577 .help = "Zoned absolute random distribution",
2580 .category = FIO_OPT_C_IO,
2581 .group = FIO_OPT_G_RANDOM,
2584 .name = "percentage_random",
2585 .lname = "Percentage Random",
2586 .type = FIO_OPT_INT,
2587 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2588 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2589 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2591 .help = "Percentage of seq/random mix that should be random",
2592 .def = "100,100,100",
2594 .inverse = "percentage_sequential",
2595 .category = FIO_OPT_C_IO,
2596 .group = FIO_OPT_G_RANDOM,
2599 .name = "percentage_sequential",
2600 .lname = "Percentage Sequential",
2601 .type = FIO_OPT_DEPRECATED,
2602 .category = FIO_OPT_C_IO,
2603 .group = FIO_OPT_G_RANDOM,
2607 .lname = "Number of files",
2608 .alias = "nr_files",
2609 .type = FIO_OPT_INT,
2610 .off1 = offsetof(struct thread_options, nr_files),
2611 .help = "Split job workload between this number of files",
2614 .category = FIO_OPT_C_FILE,
2615 .group = FIO_OPT_G_INVALID,
2618 .name = "openfiles",
2619 .lname = "Number of open files",
2620 .type = FIO_OPT_INT,
2621 .off1 = offsetof(struct thread_options, open_files),
2622 .help = "Number of files to keep open at the same time",
2623 .category = FIO_OPT_C_FILE,
2624 .group = FIO_OPT_G_INVALID,
2627 .name = "file_service_type",
2628 .lname = "File service type",
2629 .type = FIO_OPT_STR,
2631 .off1 = offsetof(struct thread_options, file_service_type),
2632 .help = "How to select which file to service next",
2633 .def = "roundrobin",
2634 .category = FIO_OPT_C_FILE,
2635 .group = FIO_OPT_G_INVALID,
2638 .oval = FIO_FSERVICE_RANDOM,
2639 .help = "Choose a file at random (uniform)",
2642 .oval = FIO_FSERVICE_ZIPF,
2643 .help = "Zipf randomized",
2646 .oval = FIO_FSERVICE_PARETO,
2647 .help = "Pareto randomized",
2650 .oval = FIO_FSERVICE_GAUSS,
2651 .help = "Normal (Gaussian) randomized",
2654 .oval = FIO_FSERVICE_GAUSS,
2655 .help = "Alias for normal",
2657 { .ival = "roundrobin",
2658 .oval = FIO_FSERVICE_RR,
2659 .help = "Round robin select files",
2661 { .ival = "sequential",
2662 .oval = FIO_FSERVICE_SEQ,
2663 .help = "Finish one file before moving to the next",
2666 .parent = "nrfiles",
2670 .name = "fallocate",
2671 .lname = "Fallocate",
2672 .type = FIO_OPT_STR,
2673 .off1 = offsetof(struct thread_options, fallocate_mode),
2674 .help = "Whether pre-allocation is performed when laying out files",
2675 #ifdef FIO_HAVE_DEFAULT_FALLOCATE
2680 .category = FIO_OPT_C_FILE,
2681 .group = FIO_OPT_G_INVALID,
2684 .oval = FIO_FALLOCATE_NONE,
2685 .help = "Do not pre-allocate space",
2688 .oval = FIO_FALLOCATE_NATIVE,
2689 .help = "Use native pre-allocation if possible",
2691 #ifdef CONFIG_POSIX_FALLOCATE
2693 .oval = FIO_FALLOCATE_POSIX,
2694 .help = "Use posix_fallocate()",
2697 #ifdef CONFIG_LINUX_FALLOCATE
2699 .oval = FIO_FALLOCATE_KEEP_SIZE,
2700 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2703 { .ival = "truncate",
2704 .oval = FIO_FALLOCATE_TRUNCATE,
2705 .help = "Truncate file to final size instead of allocating"
2707 /* Compatibility with former boolean values */
2709 .oval = FIO_FALLOCATE_NONE,
2710 .help = "Alias for 'none'",
2712 #ifdef CONFIG_POSIX_FALLOCATE
2714 .oval = FIO_FALLOCATE_POSIX,
2715 .help = "Alias for 'posix'",
2721 .name = "fadvise_hint",
2722 .lname = "Fadvise hint",
2723 .type = FIO_OPT_STR,
2724 .off1 = offsetof(struct thread_options, fadvise_hint),
2728 .help = "Don't issue fadvise/madvise",
2732 .help = "Advise using fio IO pattern",
2735 .oval = F_ADV_RANDOM,
2736 .help = "Advise using FADV_RANDOM",
2738 { .ival = "sequential",
2739 .oval = F_ADV_SEQUENTIAL,
2740 .help = "Advise using FADV_SEQUENTIAL",
2742 #ifdef POSIX_FADV_NOREUSE
2743 { .ival = "noreuse",
2744 .oval = F_ADV_NOREUSE,
2745 .help = "Advise using FADV_NOREUSE",
2749 .help = "Use fadvise() to advise the kernel on IO pattern",
2751 .category = FIO_OPT_C_FILE,
2752 .group = FIO_OPT_G_INVALID,
2757 .type = FIO_OPT_INT,
2758 .off1 = offsetof(struct thread_options, fsync_blocks),
2759 .help = "Issue fsync for writes every given number of blocks",
2762 .category = FIO_OPT_C_FILE,
2763 .group = FIO_OPT_G_INVALID,
2766 .name = "fdatasync",
2767 .lname = "Fdatasync",
2768 .type = FIO_OPT_INT,
2769 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2770 .help = "Issue fdatasync for writes every given number of blocks",
2773 .category = FIO_OPT_C_FILE,
2774 .group = FIO_OPT_G_INVALID,
2777 .name = "write_barrier",
2778 .lname = "Write barrier",
2779 .type = FIO_OPT_INT,
2780 .off1 = offsetof(struct thread_options, barrier_blocks),
2781 .help = "Make every Nth write a barrier write",
2784 .category = FIO_OPT_C_IO,
2785 .group = FIO_OPT_G_INVALID,
2787 #ifdef CONFIG_SYNC_FILE_RANGE
2789 .name = "sync_file_range",
2790 .lname = "Sync file range",
2792 { .ival = "wait_before",
2793 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2794 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2798 .oval = SYNC_FILE_RANGE_WRITE,
2799 .help = "SYNC_FILE_RANGE_WRITE",
2803 .ival = "wait_after",
2804 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2805 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2809 .type = FIO_OPT_STR_MULTI,
2811 .off1 = offsetof(struct thread_options, sync_file_range),
2812 .help = "Use sync_file_range()",
2813 .category = FIO_OPT_C_FILE,
2814 .group = FIO_OPT_G_INVALID,
2818 .name = "sync_file_range",
2819 .lname = "Sync file range",
2820 .type = FIO_OPT_UNSUPPORTED,
2821 .help = "Your platform does not support sync_file_range",
2826 .lname = "Direct I/O",
2827 .type = FIO_OPT_BOOL,
2828 .off1 = offsetof(struct thread_options, odirect),
2829 .help = "Use O_DIRECT IO (negates buffered)",
2831 .inverse = "buffered",
2832 .category = FIO_OPT_C_IO,
2833 .group = FIO_OPT_G_IO_TYPE,
2837 .lname = "Atomic I/O",
2838 .type = FIO_OPT_BOOL,
2839 .off1 = offsetof(struct thread_options, oatomic),
2840 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2842 .category = FIO_OPT_C_IO,
2843 .group = FIO_OPT_G_IO_TYPE,
2847 .lname = "Buffered I/O",
2848 .type = FIO_OPT_BOOL,
2849 .off1 = offsetof(struct thread_options, odirect),
2851 .help = "Use buffered IO (negates direct)",
2853 .inverse = "direct",
2854 .category = FIO_OPT_C_IO,
2855 .group = FIO_OPT_G_IO_TYPE,
2858 .name = "overwrite",
2859 .lname = "Overwrite",
2860 .type = FIO_OPT_BOOL,
2861 .off1 = offsetof(struct thread_options, overwrite),
2862 .help = "When writing, set whether to overwrite current data",
2864 .category = FIO_OPT_C_FILE,
2865 .group = FIO_OPT_G_INVALID,
2870 .type = FIO_OPT_INT,
2871 .off1 = offsetof(struct thread_options, loops),
2872 .help = "Number of times to run the job",
2875 .category = FIO_OPT_C_GENERAL,
2876 .group = FIO_OPT_G_RUNTIME,
2880 .lname = "Number of jobs",
2881 .type = FIO_OPT_INT,
2882 .off1 = offsetof(struct thread_options, numjobs),
2883 .help = "Duplicate this job this many times",
2886 .category = FIO_OPT_C_GENERAL,
2887 .group = FIO_OPT_G_RUNTIME,
2890 .name = "startdelay",
2891 .lname = "Start delay",
2892 .type = FIO_OPT_STR_VAL_TIME,
2893 .off1 = offsetof(struct thread_options, start_delay),
2894 .off2 = offsetof(struct thread_options, start_delay_high),
2895 .help = "Only start job when this period has passed",
2899 .category = FIO_OPT_C_GENERAL,
2900 .group = FIO_OPT_G_RUNTIME,
2906 .type = FIO_OPT_STR_VAL_TIME,
2907 .off1 = offsetof(struct thread_options, timeout),
2908 .help = "Stop workload when this amount of time has passed",
2912 .category = FIO_OPT_C_GENERAL,
2913 .group = FIO_OPT_G_RUNTIME,
2916 .name = "time_based",
2917 .lname = "Time based",
2918 .type = FIO_OPT_STR_SET,
2919 .off1 = offsetof(struct thread_options, time_based),
2920 .help = "Keep running until runtime/timeout is met",
2921 .category = FIO_OPT_C_GENERAL,
2922 .group = FIO_OPT_G_RUNTIME,
2925 .name = "verify_only",
2926 .lname = "Verify only",
2927 .type = FIO_OPT_STR_SET,
2928 .off1 = offsetof(struct thread_options, verify_only),
2929 .help = "Verifies previously written data is still valid",
2930 .category = FIO_OPT_C_GENERAL,
2931 .group = FIO_OPT_G_RUNTIME,
2934 .name = "ramp_time",
2935 .lname = "Ramp time",
2936 .type = FIO_OPT_STR_VAL_TIME,
2937 .off1 = offsetof(struct thread_options, ramp_time),
2938 .help = "Ramp up time before measuring performance",
2941 .category = FIO_OPT_C_GENERAL,
2942 .group = FIO_OPT_G_RUNTIME,
2945 .name = "clocksource",
2946 .lname = "Clock source",
2947 .type = FIO_OPT_STR,
2948 .cb = fio_clock_source_cb,
2949 .off1 = offsetof(struct thread_options, clocksource),
2950 .help = "What type of timing source to use",
2951 .category = FIO_OPT_C_GENERAL,
2952 .group = FIO_OPT_G_CLOCK,
2954 #ifdef CONFIG_GETTIMEOFDAY
2955 { .ival = "gettimeofday",
2957 .help = "Use gettimeofday(2) for timing",
2960 #ifdef CONFIG_CLOCK_GETTIME
2961 { .ival = "clock_gettime",
2962 .oval = CS_CGETTIME,
2963 .help = "Use clock_gettime(2) for timing",
2966 #ifdef ARCH_HAVE_CPU_CLOCK
2968 .oval = CS_CPUCLOCK,
2969 .help = "Use CPU private clock",
2977 .lname = "I/O Memory",
2978 .type = FIO_OPT_STR,
2980 .off1 = offsetof(struct thread_options, mem_type),
2981 .help = "Backing type for IO buffers",
2983 .category = FIO_OPT_C_IO,
2984 .group = FIO_OPT_G_INVALID,
2988 .help = "Use malloc(3) for IO buffers",
2990 #ifndef CONFIG_NO_SHM
2993 .help = "Use shared memory segments for IO buffers",
2995 #ifdef FIO_HAVE_HUGETLB
2996 { .ival = "shmhuge",
2997 .oval = MEM_SHMHUGE,
2998 .help = "Like shm, but use huge pages",
3004 .help = "Use mmap(2) (file or anon) for IO buffers",
3006 { .ival = "mmapshared",
3007 .oval = MEM_MMAPSHARED,
3008 .help = "Like mmap, but use the shared flag",
3010 #ifdef FIO_HAVE_HUGETLB
3011 { .ival = "mmaphuge",
3012 .oval = MEM_MMAPHUGE,
3013 .help = "Like mmap, but use huge pages",
3017 { .ival = "cudamalloc",
3018 .oval = MEM_CUDA_MALLOC,
3019 .help = "Allocate GPU device memory for GPUDirect RDMA",
3025 .name = "iomem_align",
3026 .alias = "mem_align",
3027 .lname = "I/O memory alignment",
3028 .type = FIO_OPT_INT,
3029 .off1 = offsetof(struct thread_options, mem_align),
3031 .help = "IO memory buffer offset alignment",
3035 .category = FIO_OPT_C_IO,
3036 .group = FIO_OPT_G_INVALID,
3041 .type = FIO_OPT_STR,
3042 .off1 = offsetof(struct thread_options, verify),
3043 .help = "Verify data written",
3045 .category = FIO_OPT_C_IO,
3046 .group = FIO_OPT_G_VERIFY,
3049 .oval = VERIFY_NONE,
3050 .help = "Don't do IO verification",
3054 .help = "Use md5 checksums for verification",
3057 .oval = VERIFY_CRC64,
3058 .help = "Use crc64 checksums for verification",
3061 .oval = VERIFY_CRC32,
3062 .help = "Use crc32 checksums for verification",
3064 { .ival = "crc32c-intel",
3065 .oval = VERIFY_CRC32C,
3066 .help = "Use crc32c checksums for verification (hw assisted, if available)",
3069 .oval = VERIFY_CRC32C,
3070 .help = "Use crc32c checksums for verification (hw assisted, if available)",
3073 .oval = VERIFY_CRC16,
3074 .help = "Use crc16 checksums for verification",
3077 .oval = VERIFY_CRC7,
3078 .help = "Use crc7 checksums for verification",
3081 .oval = VERIFY_SHA1,
3082 .help = "Use sha1 checksums for verification",
3085 .oval = VERIFY_SHA256,
3086 .help = "Use sha256 checksums for verification",
3089 .oval = VERIFY_SHA512,
3090 .help = "Use sha512 checksums for verification",
3092 { .ival = "sha3-224",
3093 .oval = VERIFY_SHA3_224,
3094 .help = "Use sha3-224 checksums for verification",
3096 { .ival = "sha3-256",
3097 .oval = VERIFY_SHA3_256,
3098 .help = "Use sha3-256 checksums for verification",
3100 { .ival = "sha3-384",
3101 .oval = VERIFY_SHA3_384,
3102 .help = "Use sha3-384 checksums for verification",
3104 { .ival = "sha3-512",
3105 .oval = VERIFY_SHA3_512,
3106 .help = "Use sha3-512 checksums for verification",
3109 .oval = VERIFY_XXHASH,
3110 .help = "Use xxhash checksums for verification",
3112 /* Meta information was included into verify_header,
3113 * 'meta' verification is implied by default. */
3115 .oval = VERIFY_HDR_ONLY,
3116 .help = "Use io information for verification. "
3117 "Now is implied by default, thus option is obsolete, "
3120 { .ival = "pattern",
3121 .oval = VERIFY_PATTERN_NO_HDR,
3122 .help = "Verify strict pattern",
3126 .oval = VERIFY_NULL,
3127 .help = "Pretend to verify",
3132 .name = "do_verify",
3133 .lname = "Perform verify step",
3134 .type = FIO_OPT_BOOL,
3135 .off1 = offsetof(struct thread_options, do_verify),
3136 .help = "Run verification stage after write",
3140 .category = FIO_OPT_C_IO,
3141 .group = FIO_OPT_G_VERIFY,
3144 .name = "verifysort",
3145 .lname = "Verify sort",
3146 .type = FIO_OPT_SOFT_DEPRECATED,
3147 .category = FIO_OPT_C_IO,
3148 .group = FIO_OPT_G_VERIFY,
3151 .name = "verifysort_nr",
3152 .lname = "Verify Sort Nr",
3153 .type = FIO_OPT_SOFT_DEPRECATED,
3154 .category = FIO_OPT_C_IO,
3155 .group = FIO_OPT_G_VERIFY,
3158 .name = "verify_interval",
3159 .lname = "Verify interval",
3160 .type = FIO_OPT_INT,
3161 .off1 = offsetof(struct thread_options, verify_interval),
3162 .minval = 2 * sizeof(struct verify_header),
3163 .help = "Store verify buffer header every N bytes",
3166 .interval = 2 * sizeof(struct verify_header),
3167 .category = FIO_OPT_C_IO,
3168 .group = FIO_OPT_G_VERIFY,
3171 .name = "verify_offset",
3172 .lname = "Verify offset",
3173 .type = FIO_OPT_INT,
3174 .help = "Offset verify header location by N bytes",
3175 .off1 = offsetof(struct thread_options, verify_offset),
3176 .minval = sizeof(struct verify_header),
3179 .category = FIO_OPT_C_IO,
3180 .group = FIO_OPT_G_VERIFY,
3183 .name = "verify_pattern",
3184 .lname = "Verify pattern",
3185 .type = FIO_OPT_STR,
3186 .cb = str_verify_pattern_cb,
3187 .off1 = offsetof(struct thread_options, verify_pattern),
3188 .help = "Fill pattern for IO buffers",
3191 .category = FIO_OPT_C_IO,
3192 .group = FIO_OPT_G_VERIFY,
3195 .name = "verify_fatal",
3196 .lname = "Verify fatal",
3197 .type = FIO_OPT_BOOL,
3198 .off1 = offsetof(struct thread_options, verify_fatal),
3200 .help = "Exit on a single verify failure, don't continue",
3203 .category = FIO_OPT_C_IO,
3204 .group = FIO_OPT_G_VERIFY,
3207 .name = "verify_dump",
3208 .lname = "Verify dump",
3209 .type = FIO_OPT_BOOL,
3210 .off1 = offsetof(struct thread_options, verify_dump),
3212 .help = "Dump contents of good and bad blocks on failure",
3215 .category = FIO_OPT_C_IO,
3216 .group = FIO_OPT_G_VERIFY,
3219 .name = "verify_async",
3220 .lname = "Verify asynchronously",
3221 .type = FIO_OPT_INT,
3222 .off1 = offsetof(struct thread_options, verify_async),
3224 .help = "Number of async verifier threads to use",
3227 .category = FIO_OPT_C_IO,
3228 .group = FIO_OPT_G_VERIFY,
3231 .name = "verify_backlog",
3232 .lname = "Verify backlog",
3233 .type = FIO_OPT_STR_VAL,
3234 .off1 = offsetof(struct thread_options, verify_backlog),
3235 .help = "Verify after this number of blocks are written",
3238 .category = FIO_OPT_C_IO,
3239 .group = FIO_OPT_G_VERIFY,
3242 .name = "verify_backlog_batch",
3243 .lname = "Verify backlog batch",
3244 .type = FIO_OPT_INT,
3245 .off1 = offsetof(struct thread_options, verify_batch),
3246 .help = "Verify this number of IO blocks",
3249 .category = FIO_OPT_C_IO,
3250 .group = FIO_OPT_G_VERIFY,
3252 #ifdef FIO_HAVE_CPU_AFFINITY
3254 .name = "verify_async_cpus",
3255 .lname = "Async verify CPUs",
3256 .type = FIO_OPT_STR,
3257 .cb = str_verify_cpus_allowed_cb,
3258 .off1 = offsetof(struct thread_options, verify_cpumask),
3259 .help = "Set CPUs allowed for async verify threads",
3260 .parent = "verify_async",
3262 .category = FIO_OPT_C_IO,
3263 .group = FIO_OPT_G_VERIFY,
3267 .name = "verify_async_cpus",
3268 .lname = "Async verify CPUs",
3269 .type = FIO_OPT_UNSUPPORTED,
3270 .help = "Your platform does not support CPU affinities",
3274 .name = "experimental_verify",
3275 .lname = "Experimental Verify",
3276 .off1 = offsetof(struct thread_options, experimental_verify),
3277 .type = FIO_OPT_BOOL,
3278 .help = "Enable experimental verification",
3280 .category = FIO_OPT_C_IO,
3281 .group = FIO_OPT_G_VERIFY,
3284 .name = "verify_state_load",
3285 .lname = "Load verify state",
3286 .off1 = offsetof(struct thread_options, verify_state),
3287 .type = FIO_OPT_BOOL,
3288 .help = "Load verify termination state",
3290 .category = FIO_OPT_C_IO,
3291 .group = FIO_OPT_G_VERIFY,
3294 .name = "verify_state_save",
3295 .lname = "Save verify state",
3296 .off1 = offsetof(struct thread_options, verify_state_save),
3297 .type = FIO_OPT_BOOL,
3299 .help = "Save verify state on termination",
3301 .category = FIO_OPT_C_IO,
3302 .group = FIO_OPT_G_VERIFY,
3304 #ifdef FIO_HAVE_TRIM
3306 .name = "trim_percentage",
3307 .lname = "Trim percentage",
3308 .type = FIO_OPT_INT,
3309 .off1 = offsetof(struct thread_options, trim_percentage),
3312 .help = "Number of verify blocks to trim (i.e., discard)",
3317 .category = FIO_OPT_C_IO,
3318 .group = FIO_OPT_G_TRIM,
3321 .name = "trim_verify_zero",
3322 .lname = "Verify trim zero",
3323 .type = FIO_OPT_BOOL,
3324 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3325 .off1 = offsetof(struct thread_options, trim_zero),
3326 .parent = "trim_percentage",
3329 .category = FIO_OPT_C_IO,
3330 .group = FIO_OPT_G_TRIM,
3333 .name = "trim_backlog",
3334 .lname = "Trim backlog",
3335 .type = FIO_OPT_STR_VAL,
3336 .off1 = offsetof(struct thread_options, trim_backlog),
3337 .help = "Trim after this number of blocks are written",
3338 .parent = "trim_percentage",
3341 .category = FIO_OPT_C_IO,
3342 .group = FIO_OPT_G_TRIM,
3345 .name = "trim_backlog_batch",
3346 .lname = "Trim backlog batch",
3347 .type = FIO_OPT_INT,
3348 .off1 = offsetof(struct thread_options, trim_batch),
3349 .help = "Trim this number of IO blocks",
3350 .parent = "trim_percentage",
3353 .category = FIO_OPT_C_IO,
3354 .group = FIO_OPT_G_TRIM,
3358 .name = "trim_percentage",
3359 .lname = "Trim percentage",
3360 .type = FIO_OPT_UNSUPPORTED,
3361 .help = "Fio does not support TRIM on your platform",
3364 .name = "trim_verify_zero",
3365 .lname = "Verify trim zero",
3366 .type = FIO_OPT_UNSUPPORTED,
3367 .help = "Fio does not support TRIM on your platform",
3370 .name = "trim_backlog",
3371 .lname = "Trim backlog",
3372 .type = FIO_OPT_UNSUPPORTED,
3373 .help = "Fio does not support TRIM on your platform",
3376 .name = "trim_backlog_batch",
3377 .lname = "Trim backlog batch",
3378 .type = FIO_OPT_UNSUPPORTED,
3379 .help = "Fio does not support TRIM on your platform",
3383 .name = "write_iolog",
3384 .lname = "Write I/O log",
3385 .type = FIO_OPT_STR_STORE,
3386 .off1 = offsetof(struct thread_options, write_iolog_file),
3387 .help = "Store IO pattern to file",
3388 .category = FIO_OPT_C_IO,
3389 .group = FIO_OPT_G_IOLOG,
3392 .name = "read_iolog",
3393 .lname = "Read I/O log",
3394 .type = FIO_OPT_STR_STORE,
3395 .off1 = offsetof(struct thread_options, read_iolog_file),
3396 .help = "Playback IO pattern from file",
3397 .category = FIO_OPT_C_IO,
3398 .group = FIO_OPT_G_IOLOG,
3401 .name = "read_iolog_chunked",
3402 .lname = "Read I/O log in parts",
3403 .type = FIO_OPT_BOOL,
3404 .off1 = offsetof(struct thread_options, read_iolog_chunked),
3406 .parent = "read_iolog",
3407 .help = "Parse IO pattern in chunks",
3408 .category = FIO_OPT_C_IO,
3409 .group = FIO_OPT_G_IOLOG,
3412 .name = "replay_no_stall",
3413 .lname = "Don't stall on replay",
3414 .type = FIO_OPT_BOOL,
3415 .off1 = offsetof(struct thread_options, no_stall),
3417 .parent = "read_iolog",
3419 .help = "Playback IO pattern file as fast as possible without stalls",
3420 .category = FIO_OPT_C_IO,
3421 .group = FIO_OPT_G_IOLOG,
3424 .name = "replay_redirect",
3425 .lname = "Redirect device for replay",
3426 .type = FIO_OPT_STR_STORE,
3427 .off1 = offsetof(struct thread_options, replay_redirect),
3428 .parent = "read_iolog",
3430 .help = "Replay all I/O onto this device, regardless of trace device",
3431 .category = FIO_OPT_C_IO,
3432 .group = FIO_OPT_G_IOLOG,
3435 .name = "replay_scale",
3436 .lname = "Replace offset scale factor",
3437 .type = FIO_OPT_INT,
3438 .off1 = offsetof(struct thread_options, replay_scale),
3439 .parent = "read_iolog",
3441 .help = "Align offsets to this blocksize",
3442 .category = FIO_OPT_C_IO,
3443 .group = FIO_OPT_G_IOLOG,
3446 .name = "replay_align",
3447 .lname = "Replace alignment",
3448 .type = FIO_OPT_INT,
3449 .off1 = offsetof(struct thread_options, replay_align),
3450 .parent = "read_iolog",
3451 .help = "Scale offset down by this factor",
3452 .category = FIO_OPT_C_IO,
3453 .group = FIO_OPT_G_IOLOG,
3457 .name = "replay_time_scale",
3458 .lname = "Replay Time Scale",
3459 .type = FIO_OPT_INT,
3460 .off1 = offsetof(struct thread_options, replay_time_scale),
3463 .parent = "read_iolog",
3465 .help = "Scale time for replay events",
3466 .category = FIO_OPT_C_IO,
3467 .group = FIO_OPT_G_IOLOG,
3470 .name = "replay_skip",
3471 .lname = "Replay Skip",
3472 .type = FIO_OPT_STR,
3473 .cb = str_replay_skip_cb,
3474 .off1 = offsetof(struct thread_options, replay_skip),
3475 .parent = "read_iolog",
3476 .help = "Skip certain IO types (read,write,trim,flush)",
3477 .category = FIO_OPT_C_IO,
3478 .group = FIO_OPT_G_IOLOG,
3481 .name = "merge_blktrace_file",
3482 .lname = "Merged blktrace output filename",
3483 .type = FIO_OPT_STR_STORE,
3484 .off1 = offsetof(struct thread_options, merge_blktrace_file),
3485 .help = "Merged blktrace output filename",
3486 .category = FIO_OPT_C_IO,
3487 .group = FIO_OPT_G_IOLOG,
3490 .name = "merge_blktrace_scalars",
3491 .lname = "Percentage to scale each trace",
3492 .type = FIO_OPT_FLOAT_LIST,
3493 .off1 = offsetof(struct thread_options, merge_blktrace_scalars),
3494 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3495 .help = "Percentage to scale each trace",
3496 .category = FIO_OPT_C_IO,
3497 .group = FIO_OPT_G_IOLOG,
3500 .name = "merge_blktrace_iters",
3501 .lname = "Number of iterations to run per trace",
3502 .type = FIO_OPT_FLOAT_LIST,
3503 .off1 = offsetof(struct thread_options, merge_blktrace_iters),
3504 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3505 .help = "Number of iterations to run per trace",
3506 .category = FIO_OPT_C_IO,
3507 .group = FIO_OPT_G_IOLOG,
3510 .name = "exec_prerun",
3511 .lname = "Pre-execute runnable",
3512 .type = FIO_OPT_STR_STORE,
3513 .off1 = offsetof(struct thread_options, exec_prerun),
3514 .help = "Execute this file prior to running job",
3515 .category = FIO_OPT_C_GENERAL,
3516 .group = FIO_OPT_G_INVALID,
3519 .name = "exec_postrun",
3520 .lname = "Post-execute runnable",
3521 .type = FIO_OPT_STR_STORE,
3522 .off1 = offsetof(struct thread_options, exec_postrun),
3523 .help = "Execute this file after running job",
3524 .category = FIO_OPT_C_GENERAL,
3525 .group = FIO_OPT_G_INVALID,
3527 #ifdef FIO_HAVE_IOSCHED_SWITCH
3529 .name = "ioscheduler",
3530 .lname = "I/O scheduler",
3531 .type = FIO_OPT_STR_STORE,
3532 .off1 = offsetof(struct thread_options, ioscheduler),
3533 .help = "Use this IO scheduler on the backing device",
3534 .category = FIO_OPT_C_FILE,
3535 .group = FIO_OPT_G_INVALID,
3539 .name = "ioscheduler",
3540 .lname = "I/O scheduler",
3541 .type = FIO_OPT_UNSUPPORTED,
3542 .help = "Your platform does not support IO scheduler switching",
3547 .lname = "Zone mode",
3548 .help = "Mode for the zonesize, zonerange and zoneskip parameters",
3549 .type = FIO_OPT_STR,
3550 .off1 = offsetof(struct thread_options, zone_mode),
3552 .category = FIO_OPT_C_IO,
3553 .group = FIO_OPT_G_ZONE,
3556 .oval = ZONE_MODE_NONE,
3557 .help = "no zoning",
3559 { .ival = "strided",
3560 .oval = ZONE_MODE_STRIDED,
3561 .help = "strided mode - random I/O is restricted to a single zone",
3564 .oval = ZONE_MODE_ZBD,
3565 .help = "zoned block device mode - random I/O selects one of multiple zones randomly",
3571 .lname = "Zone size",
3572 .type = FIO_OPT_STR_VAL,
3573 .off1 = offsetof(struct thread_options, zone_size),
3574 .help = "Amount of data to read per zone",
3576 .interval = 1024 * 1024,
3577 .category = FIO_OPT_C_IO,
3578 .group = FIO_OPT_G_ZONE,
3581 .name = "zonecapacity",
3582 .lname = "Zone capacity",
3583 .type = FIO_OPT_STR_VAL,
3584 .off1 = offsetof(struct thread_options, zone_capacity),
3585 .help = "Capacity per zone",
3587 .interval = 1024 * 1024,
3588 .category = FIO_OPT_C_IO,
3589 .group = FIO_OPT_G_ZONE,
3592 .name = "zonerange",
3593 .lname = "Zone range",
3594 .type = FIO_OPT_STR_VAL,
3595 .off1 = offsetof(struct thread_options, zone_range),
3596 .help = "Give size of an IO zone",
3598 .interval = 1024 * 1024,
3599 .category = FIO_OPT_C_IO,
3600 .group = FIO_OPT_G_ZONE,
3604 .lname = "Zone skip",
3605 .type = FIO_OPT_STR_VAL_ZONE,
3606 .cb = str_zoneskip_cb,
3607 .off1 = offsetof(struct thread_options, zone_skip),
3608 .help = "Space between IO zones",
3610 .category = FIO_OPT_C_IO,
3611 .group = FIO_OPT_G_ZONE,
3614 .name = "read_beyond_wp",
3615 .lname = "Allow reads beyond the zone write pointer",
3616 .type = FIO_OPT_BOOL,
3617 .off1 = offsetof(struct thread_options, read_beyond_wp),
3618 .help = "Allow reads beyond the zone write pointer",
3620 .category = FIO_OPT_C_IO,
3621 .group = FIO_OPT_G_INVALID,
3624 .name = "max_open_zones",
3625 .lname = "Per device/file maximum number of open zones",
3626 .type = FIO_OPT_INT,
3627 .off1 = offsetof(struct thread_options, max_open_zones),
3628 .maxval = ZBD_MAX_WRITE_ZONES,
3629 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd",
3631 .category = FIO_OPT_C_IO,
3632 .group = FIO_OPT_G_INVALID,
3635 .name = "job_max_open_zones",
3636 .lname = "Job maximum number of open zones",
3637 .type = FIO_OPT_INT,
3638 .off1 = offsetof(struct thread_options, job_max_open_zones),
3639 .maxval = ZBD_MAX_WRITE_ZONES,
3640 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd by one thread/process",
3642 .category = FIO_OPT_C_IO,
3643 .group = FIO_OPT_G_INVALID,
3646 .name = "ignore_zone_limits",
3647 .lname = "Ignore zone resource limits",
3648 .type = FIO_OPT_BOOL,
3649 .off1 = offsetof(struct thread_options, ignore_zone_limits),
3651 .help = "Ignore the zone resource limits (max open/active zones) reported by the device",
3652 .category = FIO_OPT_C_IO,
3653 .group = FIO_OPT_G_INVALID,
3656 .name = "zone_reset_threshold",
3657 .lname = "Zone reset threshold",
3658 .help = "Zoned block device reset threshold",
3659 .type = FIO_OPT_FLOAT_LIST,
3661 .off1 = offsetof(struct thread_options, zrt),
3664 .category = FIO_OPT_C_IO,
3665 .group = FIO_OPT_G_ZONE,
3668 .name = "zone_reset_frequency",
3669 .lname = "Zone reset frequency",
3670 .help = "Zoned block device zone reset frequency in HZ",
3671 .type = FIO_OPT_FLOAT_LIST,
3673 .off1 = offsetof(struct thread_options, zrf),
3676 .category = FIO_OPT_C_IO,
3677 .group = FIO_OPT_G_ZONE,
3681 .lname = "Flexible data placement",
3682 .type = FIO_OPT_BOOL,
3683 .off1 = offsetof(struct thread_options, fdp),
3684 .help = "Use Data placement directive (FDP)",
3686 .category = FIO_OPT_C_IO,
3687 .group = FIO_OPT_G_INVALID,
3690 .name = "fdp_pli_select",
3691 .lname = "FDP Placement ID select",
3692 .type = FIO_OPT_STR,
3693 .off1 = offsetof(struct thread_options, fdp_pli_select),
3694 .help = "Select which FDP placement ID to use next",
3695 .def = "roundrobin",
3696 .category = FIO_OPT_C_IO,
3697 .group = FIO_OPT_G_INVALID,
3700 .oval = FIO_FDP_RANDOM,
3701 .help = "Choose a Placement ID at random (uniform)",
3703 { .ival = "roundrobin",
3705 .help = "Round robin select Placement IDs",
3711 .lname = "FDP Placement ID indicies",
3712 .type = FIO_OPT_STR,
3713 .cb = str_fdp_pli_cb,
3714 .off1 = offsetof(struct thread_options, fdp_plis),
3715 .help = "Sets which placement ids to use (defaults to all)",
3717 .category = FIO_OPT_C_IO,
3718 .group = FIO_OPT_G_INVALID,
3722 .lname = "Lock memory",
3723 .type = FIO_OPT_STR_VAL,
3724 .off1 = offsetof(struct thread_options, lockmem),
3725 .help = "Lock down this amount of memory (per worker)",
3727 .interval = 1024 * 1024,
3728 .category = FIO_OPT_C_GENERAL,
3729 .group = FIO_OPT_G_INVALID,
3732 .name = "rwmixread",
3733 .lname = "Read/write mix read",
3734 .type = FIO_OPT_INT,
3735 .cb = str_rwmix_read_cb,
3736 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3738 .help = "Percentage of mixed workload that is reads",
3741 .inverse = "rwmixwrite",
3742 .category = FIO_OPT_C_IO,
3743 .group = FIO_OPT_G_RWMIX,
3746 .name = "rwmixwrite",
3747 .lname = "Read/write mix write",
3748 .type = FIO_OPT_INT,
3749 .cb = str_rwmix_write_cb,
3750 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3752 .help = "Percentage of mixed workload that is writes",
3755 .inverse = "rwmixread",
3756 .category = FIO_OPT_C_IO,
3757 .group = FIO_OPT_G_RWMIX,
3760 .name = "rwmixcycle",
3761 .lname = "Read/write mix cycle",
3762 .type = FIO_OPT_DEPRECATED,
3763 .category = FIO_OPT_C_IO,
3764 .group = FIO_OPT_G_RWMIX,
3769 .type = FIO_OPT_INT,
3770 .off1 = offsetof(struct thread_options, nice),
3771 .help = "Set job CPU nice value",
3776 .category = FIO_OPT_C_GENERAL,
3777 .group = FIO_OPT_G_CRED,
3779 #ifdef FIO_HAVE_IOPRIO
3782 .lname = "I/O nice priority",
3783 .type = FIO_OPT_INT,
3784 .off1 = offsetof(struct thread_options, ioprio),
3785 .help = "Set job IO priority value",
3786 .minval = IOPRIO_MIN_PRIO,
3787 .maxval = IOPRIO_MAX_PRIO,
3789 .category = FIO_OPT_C_GENERAL,
3790 .group = FIO_OPT_G_CRED,
3795 .lname = "I/O nice priority",
3796 .type = FIO_OPT_UNSUPPORTED,
3797 .help = "Your platform does not support IO priorities",
3800 #ifdef FIO_HAVE_IOPRIO_CLASS
3801 #ifndef FIO_HAVE_IOPRIO
3802 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3805 .name = "prioclass",
3806 .lname = "I/O nice priority class",
3807 .type = FIO_OPT_INT,
3808 .off1 = offsetof(struct thread_options, ioprio_class),
3809 .help = "Set job IO priority class",
3810 .minval = IOPRIO_MIN_PRIO_CLASS,
3811 .maxval = IOPRIO_MAX_PRIO_CLASS,
3813 .category = FIO_OPT_C_GENERAL,
3814 .group = FIO_OPT_G_CRED,
3818 .lname = "I/O nice priority hint",
3819 .type = FIO_OPT_INT,
3820 .off1 = offsetof(struct thread_options, ioprio_hint),
3821 .help = "Set job IO priority hint",
3822 .minval = IOPRIO_MIN_PRIO_HINT,
3823 .maxval = IOPRIO_MAX_PRIO_HINT,
3825 .category = FIO_OPT_C_GENERAL,
3826 .group = FIO_OPT_G_CRED,
3830 .name = "prioclass",
3831 .lname = "I/O nice priority class",
3832 .type = FIO_OPT_UNSUPPORTED,
3833 .help = "Your platform does not support IO priority classes",
3837 .lname = "I/O nice priority hint",
3838 .type = FIO_OPT_UNSUPPORTED,
3839 .help = "Your platform does not support IO priority hints",
3843 .name = "thinktime",
3844 .lname = "Thinktime",
3845 .type = FIO_OPT_INT,
3846 .off1 = offsetof(struct thread_options, thinktime),
3847 .help = "Idle time between IO buffers (usec)",
3850 .category = FIO_OPT_C_IO,
3851 .group = FIO_OPT_G_THINKTIME,
3854 .name = "thinktime_spin",
3855 .lname = "Thinktime spin",
3856 .type = FIO_OPT_INT,
3857 .off1 = offsetof(struct thread_options, thinktime_spin),
3858 .help = "Start think time by spinning this amount (usec)",
3861 .parent = "thinktime",
3863 .category = FIO_OPT_C_IO,
3864 .group = FIO_OPT_G_THINKTIME,
3867 .name = "thinktime_blocks",
3868 .lname = "Thinktime blocks",
3869 .type = FIO_OPT_INT,
3870 .off1 = offsetof(struct thread_options, thinktime_blocks),
3871 .help = "IO buffer period between 'thinktime'",
3873 .parent = "thinktime",
3875 .category = FIO_OPT_C_IO,
3876 .group = FIO_OPT_G_THINKTIME,
3879 .name = "thinktime_blocks_type",
3880 .lname = "Thinktime blocks type",
3881 .type = FIO_OPT_STR,
3882 .off1 = offsetof(struct thread_options, thinktime_blocks_type),
3883 .help = "How thinktime_blocks takes effect",
3885 .category = FIO_OPT_C_IO,
3886 .group = FIO_OPT_G_THINKTIME,
3888 { .ival = "complete",
3889 .oval = THINKTIME_BLOCKS_TYPE_COMPLETE,
3890 .help = "thinktime_blocks takes effect at the completion side",
3894 .oval = THINKTIME_BLOCKS_TYPE_ISSUE,
3895 .help = "thinktime_blocks takes effect at the issue side",
3898 .parent = "thinktime",
3901 .name = "thinktime_iotime",
3902 .lname = "Thinktime interval",
3903 .type = FIO_OPT_INT,
3904 .off1 = offsetof(struct thread_options, thinktime_iotime),
3905 .help = "IO time interval between 'thinktime'",
3907 .parent = "thinktime",
3911 .category = FIO_OPT_C_IO,
3912 .group = FIO_OPT_G_THINKTIME,
3916 .lname = "I/O rate",
3917 .type = FIO_OPT_ULL,
3918 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3919 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3920 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
3921 .help = "Set bandwidth rate",
3922 .category = FIO_OPT_C_IO,
3923 .group = FIO_OPT_G_RATE,
3928 .lname = "I/O min rate",
3929 .type = FIO_OPT_ULL,
3930 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
3931 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
3932 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
3933 .help = "Job must meet this rate or it will be shutdown",
3936 .category = FIO_OPT_C_IO,
3937 .group = FIO_OPT_G_RATE,
3940 .name = "rate_iops",
3941 .lname = "I/O rate IOPS",
3942 .type = FIO_OPT_INT,
3943 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
3944 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
3945 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
3946 .help = "Limit IO used to this number of IO operations/sec",
3948 .category = FIO_OPT_C_IO,
3949 .group = FIO_OPT_G_RATE,
3952 .name = "rate_iops_min",
3953 .lname = "I/O min rate IOPS",
3954 .type = FIO_OPT_INT,
3955 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
3956 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
3957 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
3958 .help = "Job must meet this rate or it will be shut down",
3959 .parent = "rate_iops",
3961 .category = FIO_OPT_C_IO,
3962 .group = FIO_OPT_G_RATE,
3965 .name = "rate_process",
3966 .lname = "Rate Process",
3967 .type = FIO_OPT_STR,
3968 .off1 = offsetof(struct thread_options, rate_process),
3969 .help = "What process controls how rated IO is managed",
3971 .category = FIO_OPT_C_IO,
3972 .group = FIO_OPT_G_RATE,
3975 .oval = RATE_PROCESS_LINEAR,
3976 .help = "Linear rate of IO",
3980 .oval = RATE_PROCESS_POISSON,
3981 .help = "Rate follows Poisson process",
3987 .name = "rate_cycle",
3988 .alias = "ratecycle",
3989 .lname = "I/O rate cycle",
3990 .type = FIO_OPT_INT,
3991 .off1 = offsetof(struct thread_options, ratecycle),
3992 .help = "Window average for rate limits (msec)",
3996 .category = FIO_OPT_C_IO,
3997 .group = FIO_OPT_G_RATE,
4000 .name = "rate_ignore_thinktime",
4001 .lname = "Rate ignore thinktime",
4002 .type = FIO_OPT_BOOL,
4003 .off1 = offsetof(struct thread_options, rate_ign_think),
4004 .help = "Rated IO ignores thinktime settings",
4006 .category = FIO_OPT_C_IO,
4007 .group = FIO_OPT_G_RATE,
4010 .name = "max_latency",
4011 .lname = "Max Latency (usec)",
4012 .type = FIO_OPT_ULL,
4013 .off1 = offsetof(struct thread_options, max_latency[DDIR_READ]),
4014 .off2 = offsetof(struct thread_options, max_latency[DDIR_WRITE]),
4015 .off3 = offsetof(struct thread_options, max_latency[DDIR_TRIM]),
4016 .help = "Maximum tolerated IO latency (usec)",
4018 .category = FIO_OPT_C_IO,
4019 .group = FIO_OPT_G_LATPROF,
4022 .name = "latency_target",
4023 .lname = "Latency Target (usec)",
4024 .type = FIO_OPT_STR_VAL_TIME,
4025 .off1 = offsetof(struct thread_options, latency_target),
4026 .help = "Ramp to max queue depth supporting this latency",
4028 .category = FIO_OPT_C_IO,
4029 .group = FIO_OPT_G_LATPROF,
4032 .name = "latency_window",
4033 .lname = "Latency Window (usec)",
4034 .type = FIO_OPT_STR_VAL_TIME,
4035 .off1 = offsetof(struct thread_options, latency_window),
4036 .help = "Time to sustain latency_target",
4038 .category = FIO_OPT_C_IO,
4039 .group = FIO_OPT_G_LATPROF,
4042 .name = "latency_percentile",
4043 .lname = "Latency Percentile",
4044 .type = FIO_OPT_FLOAT_LIST,
4045 .off1 = offsetof(struct thread_options, latency_percentile),
4046 .help = "Percentile of IOs must be below latency_target",
4051 .category = FIO_OPT_C_IO,
4052 .group = FIO_OPT_G_LATPROF,
4055 .name = "latency_run",
4056 .lname = "Latency Run",
4057 .type = FIO_OPT_BOOL,
4058 .off1 = offsetof(struct thread_options, latency_run),
4059 .help = "Keep adjusting queue depth to match latency_target",
4061 .category = FIO_OPT_C_IO,
4062 .group = FIO_OPT_G_LATPROF,
4065 .name = "invalidate",
4066 .lname = "Cache invalidate",
4067 .type = FIO_OPT_BOOL,
4068 .off1 = offsetof(struct thread_options, invalidate_cache),
4069 .help = "Invalidate buffer/page cache prior to running job",
4071 .category = FIO_OPT_C_IO,
4072 .group = FIO_OPT_G_IO_TYPE,
4076 .lname = "Synchronous I/O",
4077 .type = FIO_OPT_STR,
4078 .off1 = offsetof(struct thread_options, sync_io),
4079 .help = "Use synchronous write IO",
4082 .category = FIO_OPT_C_IO,
4083 .group = FIO_OPT_G_IO_TYPE,
4104 #ifdef FIO_HAVE_WRITE_HINT
4106 .name = "write_hint",
4107 .lname = "Write hint",
4108 .type = FIO_OPT_STR,
4109 .off1 = offsetof(struct thread_options, write_hint),
4110 .help = "Set expected write life time",
4111 .category = FIO_OPT_C_ENGINE,
4112 .group = FIO_OPT_G_INVALID,
4115 .oval = RWH_WRITE_LIFE_NONE,
4118 .oval = RWH_WRITE_LIFE_SHORT,
4121 .oval = RWH_WRITE_LIFE_MEDIUM,
4124 .oval = RWH_WRITE_LIFE_LONG,
4126 { .ival = "extreme",
4127 .oval = RWH_WRITE_LIFE_EXTREME,
4133 .name = "create_serialize",
4134 .lname = "Create serialize",
4135 .type = FIO_OPT_BOOL,
4136 .off1 = offsetof(struct thread_options, create_serialize),
4137 .help = "Serialize creation of job files",
4139 .category = FIO_OPT_C_FILE,
4140 .group = FIO_OPT_G_INVALID,
4143 .name = "create_fsync",
4144 .lname = "Create fsync",
4145 .type = FIO_OPT_BOOL,
4146 .off1 = offsetof(struct thread_options, create_fsync),
4147 .help = "fsync file after creation",
4149 .category = FIO_OPT_C_FILE,
4150 .group = FIO_OPT_G_INVALID,
4153 .name = "create_on_open",
4154 .lname = "Create on open",
4155 .type = FIO_OPT_BOOL,
4156 .off1 = offsetof(struct thread_options, create_on_open),
4157 .help = "Create files when they are opened for IO",
4159 .category = FIO_OPT_C_FILE,
4160 .group = FIO_OPT_G_INVALID,
4163 .name = "create_only",
4164 .lname = "Create Only",
4165 .type = FIO_OPT_BOOL,
4166 .off1 = offsetof(struct thread_options, create_only),
4167 .help = "Only perform file creation phase",
4168 .category = FIO_OPT_C_FILE,
4172 .name = "allow_file_create",
4173 .lname = "Allow file create",
4174 .type = FIO_OPT_BOOL,
4175 .off1 = offsetof(struct thread_options, allow_create),
4176 .help = "Permit fio to create files, if they don't exist",
4178 .category = FIO_OPT_C_FILE,
4179 .group = FIO_OPT_G_FILENAME,
4182 .name = "allow_mounted_write",
4183 .lname = "Allow mounted write",
4184 .type = FIO_OPT_BOOL,
4185 .off1 = offsetof(struct thread_options, allow_mounted_write),
4186 .help = "Allow writes to a mounted partition",
4188 .category = FIO_OPT_C_FILE,
4189 .group = FIO_OPT_G_FILENAME,
4193 .lname = "Pre-read files",
4194 .type = FIO_OPT_BOOL,
4195 .off1 = offsetof(struct thread_options, pre_read),
4196 .help = "Pre-read files before starting official testing",
4198 .category = FIO_OPT_C_FILE,
4199 .group = FIO_OPT_G_INVALID,
4201 #ifdef FIO_HAVE_CPU_AFFINITY
4204 .lname = "CPU mask",
4205 .type = FIO_OPT_INT,
4206 .cb = str_cpumask_cb,
4207 .off1 = offsetof(struct thread_options, cpumask),
4208 .help = "CPU affinity mask",
4209 .category = FIO_OPT_C_GENERAL,
4210 .group = FIO_OPT_G_CRED,
4213 .name = "cpus_allowed",
4214 .lname = "CPUs allowed",
4215 .type = FIO_OPT_STR,
4216 .cb = str_cpus_allowed_cb,
4217 .off1 = offsetof(struct thread_options, cpumask),
4218 .help = "Set CPUs allowed",
4219 .category = FIO_OPT_C_GENERAL,
4220 .group = FIO_OPT_G_CRED,
4223 .name = "cpus_allowed_policy",
4224 .lname = "CPUs allowed distribution policy",
4225 .type = FIO_OPT_STR,
4226 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
4227 .help = "Distribution policy for cpus_allowed",
4228 .parent = "cpus_allowed",
4232 .oval = FIO_CPUS_SHARED,
4233 .help = "Mask shared between threads",
4236 .oval = FIO_CPUS_SPLIT,
4237 .help = "Mask split between threads",
4240 .category = FIO_OPT_C_GENERAL,
4241 .group = FIO_OPT_G_CRED,
4246 .lname = "CPU mask",
4247 .type = FIO_OPT_UNSUPPORTED,
4248 .help = "Your platform does not support CPU affinities",
4251 .name = "cpus_allowed",
4252 .lname = "CPUs allowed",
4253 .type = FIO_OPT_UNSUPPORTED,
4254 .help = "Your platform does not support CPU affinities",
4257 .name = "cpus_allowed_policy",
4258 .lname = "CPUs allowed distribution policy",
4259 .type = FIO_OPT_UNSUPPORTED,
4260 .help = "Your platform does not support CPU affinities",
4263 #ifdef CONFIG_LIBNUMA
4265 .name = "numa_cpu_nodes",
4266 .lname = "NUMA CPU Nodes",
4267 .type = FIO_OPT_STR,
4268 .cb = str_numa_cpunodes_cb,
4269 .off1 = offsetof(struct thread_options, numa_cpunodes),
4270 .help = "NUMA CPU nodes bind",
4271 .category = FIO_OPT_C_GENERAL,
4272 .group = FIO_OPT_G_INVALID,
4275 .name = "numa_mem_policy",
4276 .lname = "NUMA Memory Policy",
4277 .type = FIO_OPT_STR,
4278 .cb = str_numa_mpol_cb,
4279 .off1 = offsetof(struct thread_options, numa_memnodes),
4280 .help = "NUMA memory policy setup",
4281 .category = FIO_OPT_C_GENERAL,
4282 .group = FIO_OPT_G_INVALID,
4286 .name = "numa_cpu_nodes",
4287 .lname = "NUMA CPU Nodes",
4288 .type = FIO_OPT_UNSUPPORTED,
4289 .help = "Build fio with libnuma-dev(el) to enable this option",
4292 .name = "numa_mem_policy",
4293 .lname = "NUMA Memory Policy",
4294 .type = FIO_OPT_UNSUPPORTED,
4295 .help = "Build fio with libnuma-dev(el) to enable this option",
4300 .name = "gpu_dev_id",
4301 .lname = "GPU device ID",
4302 .type = FIO_OPT_INT,
4303 .off1 = offsetof(struct thread_options, gpu_dev_id),
4304 .help = "Set GPU device ID for GPUDirect RDMA",
4306 .category = FIO_OPT_C_GENERAL,
4307 .group = FIO_OPT_G_INVALID,
4311 .name = "end_fsync",
4312 .lname = "End fsync",
4313 .type = FIO_OPT_BOOL,
4314 .off1 = offsetof(struct thread_options, end_fsync),
4315 .help = "Include fsync at the end of job",
4317 .category = FIO_OPT_C_FILE,
4318 .group = FIO_OPT_G_INVALID,
4321 .name = "fsync_on_close",
4322 .lname = "Fsync on close",
4323 .type = FIO_OPT_BOOL,
4324 .off1 = offsetof(struct thread_options, fsync_on_close),
4325 .help = "fsync files on close",
4327 .category = FIO_OPT_C_FILE,
4328 .group = FIO_OPT_G_INVALID,
4332 .lname = "Unlink file",
4333 .type = FIO_OPT_BOOL,
4334 .off1 = offsetof(struct thread_options, unlink),
4335 .help = "Unlink created files after job has completed",
4337 .category = FIO_OPT_C_FILE,
4338 .group = FIO_OPT_G_INVALID,
4341 .name = "unlink_each_loop",
4342 .lname = "Unlink file after each loop of a job",
4343 .type = FIO_OPT_BOOL,
4344 .off1 = offsetof(struct thread_options, unlink_each_loop),
4345 .help = "Unlink created files after each loop in a job has completed",
4347 .category = FIO_OPT_C_FILE,
4348 .group = FIO_OPT_G_INVALID,
4352 .lname = "Exit-all on terminate",
4353 .type = FIO_OPT_STR_SET,
4354 .cb = str_exitall_cb,
4355 .help = "Terminate all jobs when one exits",
4356 .category = FIO_OPT_C_GENERAL,
4357 .group = FIO_OPT_G_PROCESS,
4360 .name = "exit_what",
4361 .lname = "What jobs to quit on terminate",
4362 .type = FIO_OPT_STR,
4363 .off1 = offsetof(struct thread_options, exit_what),
4364 .help = "Fine-grained control for exitall",
4366 .category = FIO_OPT_C_GENERAL,
4367 .group = FIO_OPT_G_PROCESS,
4370 .oval = TERMINATE_GROUP,
4371 .help = "exit_all=1 default behaviour",
4373 { .ival = "stonewall",
4374 .oval = TERMINATE_STONEWALL,
4375 .help = "quit all currently running jobs; continue with next stonewall",
4378 .oval = TERMINATE_ALL,
4379 .help = "Quit everything",
4384 .name = "exitall_on_error",
4385 .lname = "Exit-all on terminate in error",
4386 .type = FIO_OPT_STR_SET,
4387 .off1 = offsetof(struct thread_options, exitall_error),
4388 .help = "Terminate all jobs when one exits in error",
4389 .category = FIO_OPT_C_GENERAL,
4390 .group = FIO_OPT_G_PROCESS,
4393 .name = "stonewall",
4394 .lname = "Wait for previous",
4395 .alias = "wait_for_previous",
4396 .type = FIO_OPT_STR_SET,
4397 .off1 = offsetof(struct thread_options, stonewall),
4398 .help = "Insert a hard barrier between this job and previous",
4399 .category = FIO_OPT_C_GENERAL,
4400 .group = FIO_OPT_G_PROCESS,
4403 .name = "new_group",
4404 .lname = "New group",
4405 .type = FIO_OPT_STR_SET,
4406 .off1 = offsetof(struct thread_options, new_group),
4407 .help = "Mark the start of a new group (for reporting)",
4408 .category = FIO_OPT_C_GENERAL,
4409 .group = FIO_OPT_G_PROCESS,
4414 .type = FIO_OPT_STR_SET,
4415 .off1 = offsetof(struct thread_options, use_thread),
4416 .help = "Use threads instead of processes",
4417 #ifdef CONFIG_NO_SHM
4421 .category = FIO_OPT_C_GENERAL,
4422 .group = FIO_OPT_G_PROCESS,
4425 .name = "per_job_logs",
4426 .lname = "Per Job Logs",
4427 .type = FIO_OPT_BOOL,
4428 .off1 = offsetof(struct thread_options, per_job_logs),
4429 .help = "Include job number in generated log files or not",
4431 .category = FIO_OPT_C_LOG,
4432 .group = FIO_OPT_G_INVALID,
4435 .name = "write_bw_log",
4436 .lname = "Write bandwidth log",
4437 .type = FIO_OPT_STR,
4438 .off1 = offsetof(struct thread_options, bw_log_file),
4439 .cb = str_write_bw_log_cb,
4440 .help = "Write log of bandwidth during run",
4441 .category = FIO_OPT_C_LOG,
4442 .group = FIO_OPT_G_INVALID,
4445 .name = "write_lat_log",
4446 .lname = "Write latency log",
4447 .type = FIO_OPT_STR,
4448 .off1 = offsetof(struct thread_options, lat_log_file),
4449 .cb = str_write_lat_log_cb,
4450 .help = "Write log of latency during run",
4451 .category = FIO_OPT_C_LOG,
4452 .group = FIO_OPT_G_INVALID,
4455 .name = "write_iops_log",
4456 .lname = "Write IOPS log",
4457 .type = FIO_OPT_STR,
4458 .off1 = offsetof(struct thread_options, iops_log_file),
4459 .cb = str_write_iops_log_cb,
4460 .help = "Write log of IOPS during run",
4461 .category = FIO_OPT_C_LOG,
4462 .group = FIO_OPT_G_INVALID,
4465 .name = "log_entries",
4466 .lname = "Log entries",
4467 .type = FIO_OPT_INT,
4468 .off1 = offsetof(struct thread_options, log_entries),
4469 .help = "Initial number of entries in a job IO log",
4470 .def = __fio_stringify(DEF_LOG_ENTRIES),
4471 .minval = DEF_LOG_ENTRIES,
4472 .maxval = MAX_LOG_ENTRIES,
4473 .category = FIO_OPT_C_LOG,
4474 .group = FIO_OPT_G_INVALID,
4477 .name = "log_avg_msec",
4478 .lname = "Log averaging (msec)",
4479 .type = FIO_OPT_INT,
4480 .off1 = offsetof(struct thread_options, log_avg_msec),
4481 .help = "Average bw/iops/lat logs over this period of time",
4483 .category = FIO_OPT_C_LOG,
4484 .group = FIO_OPT_G_INVALID,
4487 .name = "log_hist_msec",
4488 .lname = "Log histograms (msec)",
4489 .type = FIO_OPT_INT,
4490 .off1 = offsetof(struct thread_options, log_hist_msec),
4491 .help = "Dump completion latency histograms at frequency of this time value",
4493 .category = FIO_OPT_C_LOG,
4494 .group = FIO_OPT_G_INVALID,
4497 .name = "log_hist_coarseness",
4498 .lname = "Histogram logs coarseness",
4499 .type = FIO_OPT_INT,
4500 .off1 = offsetof(struct thread_options, log_hist_coarseness),
4501 .help = "Integer in range [0,6]. Higher coarseness outputs"
4502 " fewer histogram bins per sample. The number of bins for"
4503 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
4505 .category = FIO_OPT_C_LOG,
4506 .group = FIO_OPT_G_INVALID,
4509 .name = "write_hist_log",
4510 .lname = "Write latency histogram logs",
4511 .type = FIO_OPT_STR,
4512 .off1 = offsetof(struct thread_options, hist_log_file),
4513 .cb = str_write_hist_log_cb,
4514 .help = "Write log of latency histograms during run",
4515 .category = FIO_OPT_C_LOG,
4516 .group = FIO_OPT_G_INVALID,
4519 .name = "log_max_value",
4520 .lname = "Log maximum instead of average",
4521 .type = FIO_OPT_BOOL,
4522 .off1 = offsetof(struct thread_options, log_max),
4523 .help = "Log max sample in a window instead of average",
4525 .category = FIO_OPT_C_LOG,
4526 .group = FIO_OPT_G_INVALID,
4529 .name = "log_offset",
4530 .lname = "Log offset of IO",
4531 .type = FIO_OPT_BOOL,
4532 .off1 = offsetof(struct thread_options, log_offset),
4533 .help = "Include offset of IO for each log entry",
4535 .category = FIO_OPT_C_LOG,
4536 .group = FIO_OPT_G_INVALID,
4540 .lname = "Log priority of IO",
4541 .type = FIO_OPT_BOOL,
4542 .off1 = offsetof(struct thread_options, log_prio),
4543 .help = "Include priority value of IO for each log entry",
4545 .category = FIO_OPT_C_LOG,
4546 .group = FIO_OPT_G_INVALID,
4550 .name = "log_compression",
4551 .lname = "Log compression",
4552 .type = FIO_OPT_INT,
4553 .off1 = offsetof(struct thread_options, log_gz),
4554 .help = "Log in compressed chunks of this size",
4556 .maxval = 512 * 1024 * 1024ULL,
4557 .category = FIO_OPT_C_LOG,
4558 .group = FIO_OPT_G_INVALID,
4560 #ifdef FIO_HAVE_CPU_AFFINITY
4562 .name = "log_compression_cpus",
4563 .lname = "Log Compression CPUs",
4564 .type = FIO_OPT_STR,
4565 .cb = str_log_cpus_allowed_cb,
4566 .off1 = offsetof(struct thread_options, log_gz_cpumask),
4567 .parent = "log_compression",
4568 .help = "Limit log compression to these CPUs",
4569 .category = FIO_OPT_C_LOG,
4570 .group = FIO_OPT_G_INVALID,
4574 .name = "log_compression_cpus",
4575 .lname = "Log Compression CPUs",
4576 .type = FIO_OPT_UNSUPPORTED,
4577 .help = "Your platform does not support CPU affinities",
4581 .name = "log_store_compressed",
4582 .lname = "Log store compressed",
4583 .type = FIO_OPT_BOOL,
4584 .off1 = offsetof(struct thread_options, log_gz_store),
4585 .help = "Store logs in a compressed format",
4586 .category = FIO_OPT_C_LOG,
4587 .group = FIO_OPT_G_INVALID,
4591 .name = "log_compression",
4592 .lname = "Log compression",
4593 .type = FIO_OPT_UNSUPPORTED,
4594 .help = "Install libz-dev(el) to get compression support",
4597 .name = "log_store_compressed",
4598 .lname = "Log store compressed",
4599 .type = FIO_OPT_UNSUPPORTED,
4600 .help = "Install libz-dev(el) to get compression support",
4604 .name = "log_unix_epoch",
4605 .lname = "Log epoch unix",
4606 .type = FIO_OPT_BOOL,
4607 .off1 = offsetof(struct thread_options, log_unix_epoch),
4608 .help = "Use Unix time in log files",
4609 .category = FIO_OPT_C_LOG,
4610 .group = FIO_OPT_G_INVALID,
4613 .name = "log_alternate_epoch",
4614 .lname = "Log epoch alternate",
4615 .type = FIO_OPT_BOOL,
4616 .off1 = offsetof(struct thread_options, log_alternate_epoch),
4617 .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.",
4618 .category = FIO_OPT_C_LOG,
4619 .group = FIO_OPT_G_INVALID,
4622 .name = "log_alternate_epoch_clock_id",
4623 .lname = "Log alternate epoch clock_id",
4624 .type = FIO_OPT_INT,
4625 .off1 = offsetof(struct thread_options, log_alternate_epoch_clock_id),
4626 .help = "If log_alternate_epoch or log_unix_epoch is true, this option specifies the clock_id from clock_gettime whose epoch should be used. If neither of those is true, this option has no effect. Default value is 0, or CLOCK_REALTIME",
4627 .category = FIO_OPT_C_LOG,
4628 .group = FIO_OPT_G_INVALID,
4631 .name = "block_error_percentiles",
4632 .lname = "Block error percentiles",
4633 .type = FIO_OPT_BOOL,
4634 .off1 = offsetof(struct thread_options, block_error_hist),
4635 .help = "Record trim block errors and make a histogram",
4637 .category = FIO_OPT_C_LOG,
4638 .group = FIO_OPT_G_INVALID,
4641 .name = "bwavgtime",
4642 .lname = "Bandwidth average time",
4643 .type = FIO_OPT_INT,
4644 .off1 = offsetof(struct thread_options, bw_avg_time),
4645 .help = "Time window over which to calculate bandwidth"
4648 .parent = "write_bw_log",
4651 .category = FIO_OPT_C_LOG,
4652 .group = FIO_OPT_G_INVALID,
4655 .name = "iopsavgtime",
4656 .lname = "IOPS average time",
4657 .type = FIO_OPT_INT,
4658 .off1 = offsetof(struct thread_options, iops_avg_time),
4659 .help = "Time window over which to calculate IOPS (msec)",
4661 .parent = "write_iops_log",
4664 .category = FIO_OPT_C_LOG,
4665 .group = FIO_OPT_G_INVALID,
4668 .name = "group_reporting",
4669 .lname = "Group reporting",
4670 .type = FIO_OPT_STR_SET,
4671 .off1 = offsetof(struct thread_options, group_reporting),
4672 .help = "Do reporting on a per-group basis",
4673 .category = FIO_OPT_C_STAT,
4674 .group = FIO_OPT_G_INVALID,
4679 .type = FIO_OPT_BOOL,
4680 .off1 = offsetof(struct thread_options, stats),
4681 .help = "Enable collection of stats",
4683 .category = FIO_OPT_C_STAT,
4684 .group = FIO_OPT_G_INVALID,
4687 .name = "zero_buffers",
4688 .lname = "Zero I/O buffers",
4689 .type = FIO_OPT_STR_SET,
4690 .off1 = offsetof(struct thread_options, zero_buffers),
4691 .help = "Init IO buffers to all zeroes",
4692 .category = FIO_OPT_C_IO,
4693 .group = FIO_OPT_G_IO_BUF,
4696 .name = "refill_buffers",
4697 .lname = "Refill I/O buffers",
4698 .type = FIO_OPT_STR_SET,
4699 .off1 = offsetof(struct thread_options, refill_buffers),
4700 .help = "Refill IO buffers on every IO submit",
4701 .category = FIO_OPT_C_IO,
4702 .group = FIO_OPT_G_IO_BUF,
4705 .name = "scramble_buffers",
4706 .lname = "Scramble I/O buffers",
4707 .type = FIO_OPT_BOOL,
4708 .off1 = offsetof(struct thread_options, scramble_buffers),
4709 .help = "Slightly scramble buffers on every IO submit",
4711 .category = FIO_OPT_C_IO,
4712 .group = FIO_OPT_G_IO_BUF,
4715 .name = "buffer_pattern",
4716 .lname = "Buffer pattern",
4717 .type = FIO_OPT_STR,
4718 .cb = str_buffer_pattern_cb,
4719 .off1 = offsetof(struct thread_options, buffer_pattern),
4720 .help = "Fill pattern for IO buffers",
4721 .category = FIO_OPT_C_IO,
4722 .group = FIO_OPT_G_IO_BUF,
4725 .name = "buffer_compress_percentage",
4726 .lname = "Buffer compression percentage",
4727 .type = FIO_OPT_INT,
4728 .cb = str_buffer_compress_cb,
4729 .off1 = offsetof(struct thread_options, compress_percentage),
4732 .help = "How compressible the buffer is (approximately)",
4734 .category = FIO_OPT_C_IO,
4735 .group = FIO_OPT_G_IO_BUF,
4738 .name = "buffer_compress_chunk",
4739 .lname = "Buffer compression chunk size",
4740 .type = FIO_OPT_INT,
4741 .off1 = offsetof(struct thread_options, compress_chunk),
4742 .parent = "buffer_compress_percentage",
4744 .help = "Size of compressible region in buffer",
4747 .category = FIO_OPT_C_IO,
4748 .group = FIO_OPT_G_IO_BUF,
4751 .name = "dedupe_percentage",
4752 .lname = "Dedupe percentage",
4753 .type = FIO_OPT_INT,
4754 .cb = str_dedupe_cb,
4755 .off1 = offsetof(struct thread_options, dedupe_percentage),
4758 .help = "Percentage of buffers that are dedupable",
4760 .category = FIO_OPT_C_IO,
4761 .group = FIO_OPT_G_IO_BUF,
4764 .name = "dedupe_global",
4765 .lname = "Global deduplication",
4766 .type = FIO_OPT_BOOL,
4767 .off1 = offsetof(struct thread_options, dedupe_global),
4768 .help = "Share deduplication buffers across jobs",
4770 .category = FIO_OPT_C_IO,
4771 .group = FIO_OPT_G_IO_BUF,
4774 .name = "dedupe_mode",
4775 .lname = "Dedupe mode",
4776 .help = "Mode for the deduplication buffer generation",
4777 .type = FIO_OPT_STR,
4778 .off1 = offsetof(struct thread_options, dedupe_mode),
4779 .parent = "dedupe_percentage",
4781 .category = FIO_OPT_C_IO,
4782 .group = FIO_OPT_G_IO_BUF,
4785 .oval = DEDUPE_MODE_REPEAT,
4786 .help = "repeat previous page",
4788 { .ival = "working_set",
4789 .oval = DEDUPE_MODE_WORKING_SET,
4790 .help = "choose a page randomly from limited working set defined in dedupe_working_set_percentage",
4795 .name = "dedupe_working_set_percentage",
4796 .lname = "Dedupe working set percentage",
4797 .help = "Dedupe working set size in percentages from file or device size used to generate dedupe patterns from",
4798 .type = FIO_OPT_INT,
4799 .off1 = offsetof(struct thread_options, dedupe_working_set_percentage),
4800 .parent = "dedupe_percentage",
4804 .category = FIO_OPT_C_IO,
4805 .group = FIO_OPT_G_IO_BUF,
4808 .name = "clat_percentiles",
4809 .lname = "Completion latency percentiles",
4810 .type = FIO_OPT_BOOL,
4811 .off1 = offsetof(struct thread_options, clat_percentiles),
4812 .help = "Enable the reporting of completion latency percentiles",
4814 .category = FIO_OPT_C_STAT,
4815 .group = FIO_OPT_G_INVALID,
4818 .name = "lat_percentiles",
4819 .lname = "IO latency percentiles",
4820 .type = FIO_OPT_BOOL,
4821 .off1 = offsetof(struct thread_options, lat_percentiles),
4822 .help = "Enable the reporting of IO latency percentiles",
4824 .category = FIO_OPT_C_STAT,
4825 .group = FIO_OPT_G_INVALID,
4828 .name = "slat_percentiles",
4829 .lname = "Submission latency percentiles",
4830 .type = FIO_OPT_BOOL,
4831 .off1 = offsetof(struct thread_options, slat_percentiles),
4832 .help = "Enable the reporting of submission latency percentiles",
4834 .category = FIO_OPT_C_STAT,
4835 .group = FIO_OPT_G_INVALID,
4838 .name = "percentile_list",
4839 .lname = "Percentile list",
4840 .type = FIO_OPT_FLOAT_LIST,
4841 .off1 = offsetof(struct thread_options, percentile_list),
4842 .off2 = offsetof(struct thread_options, percentile_precision),
4843 .help = "Specify a custom list of percentiles to report for "
4844 "completion latency and block errors",
4845 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
4846 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4849 .category = FIO_OPT_C_STAT,
4850 .group = FIO_OPT_G_INVALID,
4853 .name = "significant_figures",
4854 .lname = "Significant figures",
4855 .type = FIO_OPT_INT,
4856 .off1 = offsetof(struct thread_options, sig_figs),
4859 .help = "Significant figures for output-format set to normal",
4862 .category = FIO_OPT_C_STAT,
4863 .group = FIO_OPT_G_INVALID,
4866 #ifdef FIO_HAVE_DISK_UTIL
4868 .name = "disk_util",
4869 .lname = "Disk utilization",
4870 .type = FIO_OPT_BOOL,
4871 .off1 = offsetof(struct thread_options, do_disk_util),
4872 .help = "Log disk utilization statistics",
4874 .category = FIO_OPT_C_STAT,
4875 .group = FIO_OPT_G_INVALID,
4879 .name = "disk_util",
4880 .lname = "Disk utilization",
4881 .type = FIO_OPT_UNSUPPORTED,
4882 .help = "Your platform does not support disk utilization",
4886 .name = "gtod_reduce",
4887 .lname = "Reduce gettimeofday() calls",
4888 .type = FIO_OPT_BOOL,
4889 .help = "Greatly reduce number of gettimeofday() calls",
4890 .cb = str_gtod_reduce_cb,
4893 .category = FIO_OPT_C_STAT,
4894 .group = FIO_OPT_G_INVALID,
4897 .name = "disable_lat",
4898 .lname = "Disable all latency stats",
4899 .type = FIO_OPT_BOOL,
4900 .off1 = offsetof(struct thread_options, disable_lat),
4901 .help = "Disable latency numbers",
4902 .parent = "gtod_reduce",
4905 .category = FIO_OPT_C_STAT,
4906 .group = FIO_OPT_G_INVALID,
4909 .name = "disable_clat",
4910 .lname = "Disable completion latency stats",
4911 .type = FIO_OPT_BOOL,
4912 .off1 = offsetof(struct thread_options, disable_clat),
4913 .help = "Disable completion latency numbers",
4914 .parent = "gtod_reduce",
4917 .category = FIO_OPT_C_STAT,
4918 .group = FIO_OPT_G_INVALID,
4921 .name = "disable_slat",
4922 .lname = "Disable submission latency stats",
4923 .type = FIO_OPT_BOOL,
4924 .off1 = offsetof(struct thread_options, disable_slat),
4925 .help = "Disable submission latency numbers",
4926 .parent = "gtod_reduce",
4929 .category = FIO_OPT_C_STAT,
4930 .group = FIO_OPT_G_INVALID,
4933 .name = "disable_bw_measurement",
4934 .alias = "disable_bw",
4935 .lname = "Disable bandwidth stats",
4936 .type = FIO_OPT_BOOL,
4937 .off1 = offsetof(struct thread_options, disable_bw),
4938 .help = "Disable bandwidth logging",
4939 .parent = "gtod_reduce",
4942 .category = FIO_OPT_C_STAT,
4943 .group = FIO_OPT_G_INVALID,
4947 .lname = "Dedicated gettimeofday() CPU",
4948 .type = FIO_OPT_INT,
4949 .off1 = offsetof(struct thread_options, gtod_cpu),
4950 .help = "Set up dedicated gettimeofday() thread on this CPU",
4951 .verify = gtod_cpu_verify,
4952 .category = FIO_OPT_C_GENERAL,
4953 .group = FIO_OPT_G_CLOCK,
4956 .name = "unified_rw_reporting",
4957 .lname = "Unified RW Reporting",
4958 .type = FIO_OPT_STR,
4959 .off1 = offsetof(struct thread_options, unified_rw_rep),
4960 .help = "Unify reporting across data direction",
4962 .category = FIO_OPT_C_GENERAL,
4963 .group = FIO_OPT_G_INVALID,
4966 .oval = UNIFIED_SPLIT,
4967 .help = "Normal statistics reporting",
4970 .oval = UNIFIED_MIXED,
4971 .help = "Statistics are summed per data direction and reported together",
4974 .oval = UNIFIED_BOTH,
4975 .help = "Statistics are reported normally, followed by the mixed statistics"
4977 /* Compatibility with former boolean values */
4979 .oval = UNIFIED_SPLIT,
4980 .help = "Alias for 'none'",
4983 .oval = UNIFIED_MIXED,
4984 .help = "Alias for 'mixed'",
4987 .oval = UNIFIED_BOTH,
4988 .help = "Alias for 'both'",
4993 .name = "continue_on_error",
4994 .lname = "Continue on error",
4995 .type = FIO_OPT_STR,
4996 .off1 = offsetof(struct thread_options, continue_on_error),
4997 .help = "Continue on non-fatal errors during IO",
4999 .category = FIO_OPT_C_GENERAL,
5000 .group = FIO_OPT_G_ERR,
5003 .oval = ERROR_TYPE_NONE,
5004 .help = "Exit when an error is encountered",
5007 .oval = ERROR_TYPE_READ,
5008 .help = "Continue on read errors only",
5011 .oval = ERROR_TYPE_WRITE,
5012 .help = "Continue on write errors only",
5015 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
5016 .help = "Continue on any IO errors",
5019 .oval = ERROR_TYPE_VERIFY,
5020 .help = "Continue on verify errors only",
5023 .oval = ERROR_TYPE_ANY,
5024 .help = "Continue on all io and verify errors",
5027 .oval = ERROR_TYPE_NONE,
5028 .help = "Alias for 'none'",
5031 .oval = ERROR_TYPE_ANY,
5032 .help = "Alias for 'all'",
5037 .name = "ignore_error",
5038 .lname = "Ignore Error",
5039 .type = FIO_OPT_STR,
5040 .cb = str_ignore_error_cb,
5041 .off1 = offsetof(struct thread_options, ignore_error_nr),
5042 .help = "Set a specific list of errors to ignore",
5044 .category = FIO_OPT_C_GENERAL,
5045 .group = FIO_OPT_G_ERR,
5048 .name = "error_dump",
5049 .lname = "Error Dump",
5050 .type = FIO_OPT_BOOL,
5051 .off1 = offsetof(struct thread_options, error_dump),
5053 .help = "Dump info on each error",
5054 .category = FIO_OPT_C_GENERAL,
5055 .group = FIO_OPT_G_ERR,
5060 .type = FIO_OPT_STR_STORE,
5061 .off1 = offsetof(struct thread_options, profile),
5062 .help = "Select a specific builtin performance test",
5063 .category = FIO_OPT_C_PROFILE,
5064 .group = FIO_OPT_G_INVALID,
5069 .type = FIO_OPT_STR_STORE,
5070 .off1 = offsetof(struct thread_options, cgroup),
5071 .help = "Add job to cgroup of this name",
5072 .category = FIO_OPT_C_GENERAL,
5073 .group = FIO_OPT_G_CGROUP,
5076 .name = "cgroup_nodelete",
5077 .lname = "Cgroup no-delete",
5078 .type = FIO_OPT_BOOL,
5079 .off1 = offsetof(struct thread_options, cgroup_nodelete),
5080 .help = "Do not delete cgroups after job completion",
5083 .category = FIO_OPT_C_GENERAL,
5084 .group = FIO_OPT_G_CGROUP,
5087 .name = "cgroup_weight",
5088 .lname = "Cgroup weight",
5089 .type = FIO_OPT_INT,
5090 .off1 = offsetof(struct thread_options, cgroup_weight),
5091 .help = "Use given weight for cgroup",
5095 .category = FIO_OPT_C_GENERAL,
5096 .group = FIO_OPT_G_CGROUP,
5101 .type = FIO_OPT_INT,
5102 .off1 = offsetof(struct thread_options, uid),
5103 .help = "Run job with this user ID",
5104 .category = FIO_OPT_C_GENERAL,
5105 .group = FIO_OPT_G_CRED,
5109 .lname = "Group ID",
5110 .type = FIO_OPT_INT,
5111 .off1 = offsetof(struct thread_options, gid),
5112 .help = "Run job with this group ID",
5113 .category = FIO_OPT_C_GENERAL,
5114 .group = FIO_OPT_G_CRED,
5119 .type = FIO_OPT_STR,
5120 .off1 = offsetof(struct thread_options, kb_base),
5126 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
5130 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
5133 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
5134 .category = FIO_OPT_C_GENERAL,
5135 .group = FIO_OPT_G_INVALID,
5138 .name = "unit_base",
5139 .lname = "Unit for quantities of data (Bits or Bytes)",
5140 .type = FIO_OPT_STR,
5141 .off1 = offsetof(struct thread_options, unit_base),
5146 .help = "Auto-detect",
5149 .oval = N2S_BYTEPERSEC,
5150 .help = "Normal (byte based)",
5153 .oval = N2S_BITPERSEC,
5154 .help = "Bit based",
5157 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
5158 .category = FIO_OPT_C_GENERAL,
5159 .group = FIO_OPT_G_INVALID,
5162 .name = "hugepage-size",
5163 .lname = "Hugepage size",
5164 .type = FIO_OPT_INT,
5165 .off1 = offsetof(struct thread_options, hugepage_size),
5166 .help = "When using hugepages, specify size of each page",
5167 .def = __fio_stringify(FIO_HUGE_PAGE),
5168 .interval = 1024 * 1024,
5169 .category = FIO_OPT_C_GENERAL,
5170 .group = FIO_OPT_G_INVALID,
5174 .lname = "I/O flow ID",
5175 .type = FIO_OPT_INT,
5176 .off1 = offsetof(struct thread_options, flow_id),
5177 .help = "The flow index ID to use",
5179 .category = FIO_OPT_C_IO,
5180 .group = FIO_OPT_G_IO_FLOW,
5184 .lname = "I/O flow weight",
5185 .type = FIO_OPT_INT,
5186 .off1 = offsetof(struct thread_options, flow),
5187 .help = "Weight for flow control of this job",
5188 .parent = "flow_id",
5191 .maxval = FLOW_MAX_WEIGHT,
5192 .category = FIO_OPT_C_IO,
5193 .group = FIO_OPT_G_IO_FLOW,
5196 .name = "flow_watermark",
5197 .lname = "I/O flow watermark",
5198 .type = FIO_OPT_SOFT_DEPRECATED,
5199 .category = FIO_OPT_C_IO,
5200 .group = FIO_OPT_G_IO_FLOW,
5203 .name = "flow_sleep",
5204 .lname = "I/O flow sleep",
5205 .type = FIO_OPT_INT,
5206 .off1 = offsetof(struct thread_options, flow_sleep),
5207 .help = "How many microseconds to sleep after being held"
5208 " back by the flow control mechanism",
5209 .parent = "flow_id",
5212 .category = FIO_OPT_C_IO,
5213 .group = FIO_OPT_G_IO_FLOW,
5216 .name = "steadystate",
5217 .lname = "Steady state threshold",
5219 .type = FIO_OPT_STR,
5220 .off1 = offsetof(struct thread_options, ss_state),
5221 .cb = str_steadystate_cb,
5222 .help = "Define the criterion and limit to judge when a job has reached steady state",
5223 .def = "iops_slope:0.01%",
5226 .oval = FIO_SS_IOPS,
5227 .help = "maximum mean deviation of IOPS measurements",
5229 { .ival = "iops_slope",
5230 .oval = FIO_SS_IOPS_SLOPE,
5231 .help = "slope calculated from IOPS measurements",
5235 .help = "maximum mean deviation of bandwidth measurements",
5239 .oval = FIO_SS_BW_SLOPE,
5240 .help = "slope calculated from bandwidth measurements",
5243 .category = FIO_OPT_C_GENERAL,
5244 .group = FIO_OPT_G_RUNTIME,
5247 .name = "steadystate_duration",
5248 .lname = "Steady state duration",
5250 .parent = "steadystate",
5251 .type = FIO_OPT_STR_VAL_TIME,
5252 .off1 = offsetof(struct thread_options, ss_dur),
5253 .help = "Stop workload upon attaining steady state for specified duration",
5257 .category = FIO_OPT_C_GENERAL,
5258 .group = FIO_OPT_G_RUNTIME,
5261 .name = "steadystate_ramp_time",
5262 .lname = "Steady state ramp time",
5264 .parent = "steadystate",
5265 .type = FIO_OPT_STR_VAL_TIME,
5266 .off1 = offsetof(struct thread_options, ss_ramp_time),
5267 .help = "Delay before initiation of data collection for steady state job termination testing",
5271 .category = FIO_OPT_C_GENERAL,
5272 .group = FIO_OPT_G_RUNTIME,
5275 .name = "steadystate_check_interval",
5276 .lname = "Steady state check interval",
5277 .alias = "ss_interval",
5278 .parent = "steadystate",
5279 .type = FIO_OPT_STR_VAL_TIME,
5280 .off1 = offsetof(struct thread_options, ss_check_interval),
5281 .help = "Polling interval for the steady state check (too low means steadystate will not converge)",
5285 .category = FIO_OPT_C_GENERAL,
5286 .group = FIO_OPT_G_RUNTIME,
5293 static void add_to_lopt(struct option *lopt, struct fio_option *o,
5294 const char *name, int val)
5296 lopt->name = (char *) name;
5298 if (o->type == FIO_OPT_STR_SET)
5299 lopt->has_arg = optional_argument;
5301 lopt->has_arg = required_argument;
5304 static void options_to_lopts(struct fio_option *opts,
5305 struct option *long_options,
5306 int i, int option_type)
5308 struct fio_option *o = &opts[0];
5310 add_to_lopt(&long_options[i], o, o->name, option_type);
5313 add_to_lopt(&long_options[i], o, o->alias, option_type);
5318 assert(i < FIO_NR_OPTIONS);
5322 void fio_options_set_ioengine_opts(struct option *long_options,
5323 struct thread_data *td)
5328 while (long_options[i].name) {
5329 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
5330 memset(&long_options[i], 0, sizeof(*long_options));
5337 * Just clear out the prior ioengine options.
5342 options_to_lopts(td->io_ops->options, long_options, i,
5343 FIO_GETOPT_IOENGINE);
5346 void fio_options_dup_and_init(struct option *long_options)
5350 options_init(fio_options);
5353 while (long_options[i].name)
5356 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
5359 struct fio_keyword {
5365 static struct fio_keyword fio_keywords[] = {
5367 .word = "$pagesize",
5368 .desc = "Page size in the system",
5371 .word = "$mb_memory",
5372 .desc = "Megabytes of memory online",
5376 .desc = "Number of CPUs online in the system",
5383 void fio_keywords_exit(void)
5385 struct fio_keyword *kw;
5387 kw = &fio_keywords[0];
5395 void fio_keywords_init(void)
5397 unsigned long long mb_memory;
5401 sprintf(buf, "%lu", (unsigned long) page_size);
5402 fio_keywords[0].replace = strdup(buf);
5404 mb_memory = os_phys_mem() / (1024 * 1024);
5405 sprintf(buf, "%llu", mb_memory);
5406 fio_keywords[1].replace = strdup(buf);
5408 l = cpus_configured();
5409 sprintf(buf, "%lu", l);
5410 fio_keywords[2].replace = strdup(buf);
5415 static char *bc_calc(char *str)
5417 char buf[128], *tmp;
5422 * No math, just return string
5424 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
5425 !strchr(str, '/')) || strchr(str, '\''))
5429 * Split option from value, we only need to calculate the value
5431 tmp = strchr(str, '=');
5438 * Prevent buffer overflows; such a case isn't reasonable anyway
5440 if (strlen(str) >= 128 || strlen(tmp) > 100)
5443 sprintf(buf, "which %s > /dev/null", BC_APP);
5445 log_err("fio: bc is needed for performing math\n");
5449 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
5450 f = popen(buf, "r");
5454 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
5461 buf[(tmp - str) + ret - 1] = '\0';
5462 memcpy(buf, str, tmp - str);
5468 * Return a copy of the input string with substrings of the form ${VARNAME}
5469 * substituted with the value of the environment variable VARNAME. The
5470 * substitution always occurs, even if VARNAME is empty or the corresponding
5471 * environment variable undefined.
5473 char *fio_option_dup_subs(const char *opt)
5475 char out[OPT_LEN_MAX+1];
5476 char in[OPT_LEN_MAX+1];
5479 char *ch1, *ch2, *env;
5480 ssize_t nchr = OPT_LEN_MAX;
5483 if (strlen(opt) + 1 > OPT_LEN_MAX) {
5484 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
5488 snprintf(in, sizeof(in), "%s", opt);
5490 while (*inptr && nchr > 0) {
5491 if (inptr[0] == '$' && inptr[1] == '{') {
5492 ch2 = strchr(inptr, '}');
5493 if (ch2 && inptr+1 < ch2) {
5500 envlen = strlen(env);
5501 if (envlen <= nchr) {
5502 memcpy(outptr, env, envlen);
5512 *outptr++ = *inptr++;
5521 * Look for reserved variable names and replace them with real values
5523 static char *fio_keyword_replace(char *opt)
5529 for (i = 0; fio_keywords[i].word != NULL; i++) {
5530 struct fio_keyword *kw = &fio_keywords[i];
5532 while ((s = strstr(opt, kw->word)) != NULL) {
5533 char *new = calloc(strlen(opt) + 1, 1);
5539 * Copy part of the string before the keyword and
5540 * sprintf() the replacement after it.
5542 memcpy(new, opt, olen);
5543 len = sprintf(new + olen, "%s", kw->replace);
5546 * If there's more in the original string, copy that
5549 opt += olen + strlen(kw->word);
5550 /* keeps final zero thanks to calloc */
5552 memcpy(new + olen + len, opt, strlen(opt));
5555 * replace opt and free the old opt
5565 * Check for potential math and invoke bc, if possible
5573 static char **dup_and_sub_options(char **opts, int num_opts)
5576 char **opts_copy = malloc(num_opts * sizeof(*opts));
5577 for (i = 0; i < num_opts; i++) {
5578 opts_copy[i] = fio_option_dup_subs(opts[i]);
5581 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
5586 static void show_closest_option(const char *opt)
5588 int best_option, best_distance;
5597 while (name[i] != '\0' && name[i] != '=')
5602 best_distance = INT_MAX;
5604 while (fio_options[i].name) {
5605 distance = string_distance(name, fio_options[i].name);
5606 if (distance < best_distance) {
5607 best_distance = distance;
5613 if (best_option != -1 && string_distance_ok(name, best_distance) &&
5614 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
5615 log_err("Did you mean %s?\n", fio_options[best_option].name);
5620 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
5622 int i, ret, unknown;
5625 sort_options(opts, fio_options, num_opts);
5626 opts_copy = dup_and_sub_options(opts, num_opts);
5628 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
5629 const struct fio_option *o;
5630 int newret = parse_option(opts_copy[i], opts[i], fio_options,
5631 &o, &td->o, &td->opt_list);
5634 fio_option_mark_set(&td->o, o);
5642 opts_copy[i] = NULL;
5649 ret |= ioengine_load(td);
5651 sort_options(opts_copy, td->io_ops->options, num_opts);
5654 for (i = 0; i < num_opts; i++) {
5655 const struct fio_option *o = NULL;
5662 newret = parse_option(opts_copy[i], opts[i],
5663 td->io_ops->options, &o,
5664 td->eo, &td->opt_list);
5668 log_err("Bad option <%s>\n", opts[i]);
5669 show_closest_option(opts[i]);
5672 opts_copy[i] = NULL;
5680 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
5684 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
5686 const struct fio_option *o;
5688 o = find_option_c(fio_options, opt);
5690 fio_option_mark_set(&td->o, o);
5696 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
5699 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
5703 void fio_fill_default_options(struct thread_data *td)
5705 td->o.magic = OPT_MAGIC;
5706 fill_default_options(&td->o, fio_options);
5709 int fio_show_option_help(const char *opt)
5711 return show_cmd_help(fio_options, opt);
5715 * dupe FIO_OPT_STR_STORE options
5717 void fio_options_mem_dupe(struct thread_data *td)
5719 options_mem_dupe(fio_options, &td->o);
5721 if (td->eo && td->io_ops) {
5722 void *oldeo = td->eo;
5724 td->eo = malloc(td->io_ops->option_struct_size);
5725 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
5726 options_mem_dupe(td->io_ops->options, td->eo);
5730 unsigned int fio_get_kb_base(void *data)
5732 struct thread_data *td = cb_data_to_td(data);
5733 struct thread_options *o = &td->o;
5734 unsigned int kb_base = 0;
5737 * This is a hack... For private options, *data is not holding
5738 * a pointer to the thread_options, but to private data. This means
5739 * we can't safely dereference it, but magic is first so mem wise
5740 * it is valid. But this also means that if the job first sets
5741 * kb_base and expects that to be honored by private options,
5742 * it will be disappointed. We will return the global default
5745 if (o && o->magic == OPT_MAGIC)
5746 kb_base = o->kb_base;
5753 int add_option(const struct fio_option *o)
5755 struct fio_option *__o;
5764 if (opt_index + 1 == FIO_MAX_OPTS) {
5765 log_err("fio: FIO_MAX_OPTS is too small\n");
5769 memcpy(&fio_options[opt_index], o, sizeof(*o));
5770 fio_options[opt_index + 1].name = NULL;
5774 void invalidate_profile_options(const char *prof_name)
5776 struct fio_option *o;
5780 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5781 o->type = FIO_OPT_INVALID;
5782 o->prof_name = NULL;
5788 void add_opt_posval(const char *optname, const char *ival, const char *help)
5790 struct fio_option *o;
5793 o = find_option(fio_options, optname);
5797 for (i = 0; i < PARSE_MAX_VP; i++) {
5798 if (o->posval[i].ival)
5801 o->posval[i].ival = ival;
5802 o->posval[i].help = help;
5807 void del_opt_posval(const char *optname, const char *ival)
5809 struct fio_option *o;
5812 o = find_option(fio_options, optname);
5816 for (i = 0; i < PARSE_MAX_VP; i++) {
5817 if (!o->posval[i].ival)
5819 if (strcmp(o->posval[i].ival, ival))
5822 o->posval[i].ival = NULL;
5823 o->posval[i].help = NULL;
5827 void fio_options_free(struct thread_data *td)
5829 options_free(fio_options, &td->o);
5830 if (td->eo && td->io_ops && td->io_ops->options) {
5831 options_free(td->io_ops->options, td->eo);
5837 void fio_dump_options_free(struct thread_data *td)
5839 while (!flist_empty(&td->opt_list)) {
5840 struct print_option *p;
5842 p = flist_first_entry(&td->opt_list, struct print_option, list);
5843 flist_del_init(&p->list);
5850 struct fio_option *fio_option_find(const char *name)
5852 return find_option(fio_options, name);
5855 static struct fio_option *find_next_opt(struct fio_option *from,
5858 struct fio_option *opt;
5861 from = &fio_options[0];
5867 if (off1 == from->off1) {
5872 } while (from->name);
5877 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5879 unsigned int opt_off, index, offset;
5881 opt_off = opt - &fio_options[0];
5882 index = opt_off / (8 * sizeof(uint64_t));
5883 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5884 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
5887 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
5889 struct fio_option *opt, *next;
5892 while ((opt = find_next_opt(next, off1)) != NULL) {
5893 if (opt_is_set(o, opt))
5902 void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt)
5904 unsigned int opt_off, index, offset;
5906 opt_off = opt - &fio_options[0];
5907 index = opt_off / (8 * sizeof(uint64_t));
5908 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5909 o->set_options[index] |= (uint64_t)1 << offset;