11 #include <netinet/in.h>
17 #include "lib/pattern.h"
21 char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
23 #define cb_data_to_td(data) container_of(data, struct thread_data, o)
25 static struct pattern_fmt_desc fmt_desc[] = {
28 .len = FIELD_SIZE(struct io_u *, offset),
29 .paste = paste_blockoff
34 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
36 static char *get_opt_postfix(const char *str)
38 char *p = strstr(str, ":");
44 strip_blank_front(&p);
49 static int bs_cmp(const void *p1, const void *p2)
51 const struct bssplit *bsp1 = p1;
52 const struct bssplit *bsp2 = p2;
54 return (int) bsp1->perc - (int) bsp2->perc;
59 unsigned int val1[ZONESPLIT_MAX];
60 unsigned long long val2[ZONESPLIT_MAX];
63 static int split_parse_ddir(struct thread_options *o, struct split *split,
64 enum fio_ddir ddir, char *str, bool absolute,
65 unsigned int max_splits)
67 unsigned long long perc;
75 while ((fname = strsep(&str, ":")) != NULL) {
81 perc_str = strstr(fname, "/");
86 if (str_to_decimal(perc_str, &val, 1, o, 0, 0)) {
87 log_err("fio: split conversion failed\n");
92 perc = atoi(perc_str);
105 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
106 log_err("fio: split conversion failed\n");
110 split->val1[i] = val;
111 split->val2[i] = perc;
121 static int bssplit_ddir(struct thread_options *o, enum fio_ddir ddir, char *str,
124 unsigned int i, perc, perc_missing;
125 unsigned int max_bs, min_bs;
128 memset(&split, 0, sizeof(split));
130 if (split_parse_ddir(o, &split, ddir, str, data, BSSPLIT_MAX))
137 o->bssplit[ddir] = malloc(split.nr * sizeof(struct bssplit));
138 o->bssplit_nr[ddir] = split.nr;
139 for (i = 0; i < split.nr; i++) {
140 if (split.val1[i] > max_bs)
141 max_bs = split.val1[i];
142 if (split.val1[i] < min_bs)
143 min_bs = split.val1[i];
145 o->bssplit[ddir][i].bs = split.val1[i];
146 o->bssplit[ddir][i].perc =split.val2[i];
150 * Now check if the percentages add up, and how much is missing
152 perc = perc_missing = 0;
153 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
154 struct bssplit *bsp = &o->bssplit[ddir][i];
156 if (bsp->perc == -1U)
162 if (perc > 100 && perc_missing > 1) {
163 log_err("fio: bssplit percentages add to more than 100%%\n");
164 free(o->bssplit[ddir]);
165 o->bssplit[ddir] = NULL;
170 * If values didn't have a percentage set, divide the remains between
174 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
176 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
177 struct bssplit *bsp = &o->bssplit[ddir][i];
179 if (bsp->perc == -1U)
180 bsp->perc = (100 - perc) / perc_missing;
184 o->min_bs[ddir] = min_bs;
185 o->max_bs[ddir] = max_bs;
188 * now sort based on percentages, for ease of lookup
190 qsort(o->bssplit[ddir], o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
194 typedef int (split_parse_fn)(struct thread_options *, enum fio_ddir, char *, bool);
196 static int str_split_parse(struct thread_data *td, char *str,
197 split_parse_fn *fn, bool data)
202 odir = strchr(str, ',');
204 ddir = strchr(odir + 1, ',');
206 ret = fn(&td->o, DDIR_TRIM, ddir + 1, data);
212 op = strdup(odir + 1);
213 ret = fn(&td->o, DDIR_TRIM, op, data);
218 ret = fn(&td->o, DDIR_WRITE, odir + 1, data);
221 ret = fn(&td->o, DDIR_READ, str, data);
227 ret = fn(&td->o, DDIR_WRITE, op, data);
232 ret = fn(&td->o, DDIR_TRIM, op, data);
236 ret = fn(&td->o, DDIR_READ, str, data);
242 static int str_bssplit_cb(void *data, const char *input)
244 struct thread_data *td = cb_data_to_td(data);
248 p = str = strdup(input);
250 strip_blank_front(&str);
251 strip_blank_end(str);
253 ret = str_split_parse(td, str, bssplit_ddir, false);
255 if (parse_dryrun()) {
258 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
259 free(td->o.bssplit[i]);
260 td->o.bssplit[i] = NULL;
261 td->o.bssplit_nr[i] = 0;
269 static int str2error(char *str)
271 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
272 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
273 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
274 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
275 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
276 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
277 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
278 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
279 int i = 0, num = sizeof(err) / sizeof(char *);
282 if (!strcmp(err[i], str))
289 static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
296 if (etype >= ERROR_TYPE_CNT) {
297 log_err("Illegal error type\n");
301 td->o.ignore_error_nr[etype] = 4;
302 error = calloc(4, sizeof(int));
305 while ((fname = strsep(&str, ":")) != NULL) {
311 * grow struct buffer, if needed
313 if (i == td->o.ignore_error_nr[etype]) {
314 td->o.ignore_error_nr[etype] <<= 1;
315 error = realloc(error, td->o.ignore_error_nr[etype]
318 if (fname[0] == 'E') {
319 error[i] = str2error(fname);
321 error[i] = atoi(fname);
323 error[i] = -error[i];
326 log_err("Unknown error %s, please use number value\n",
328 td->o.ignore_error_nr[etype] = 0;
335 td->o.continue_on_error |= 1 << etype;
336 td->o.ignore_error_nr[etype] = i;
337 td->o.ignore_error[etype] = error;
339 td->o.ignore_error_nr[etype] = 0;
347 static int str_ignore_error_cb(void *data, const char *input)
349 struct thread_data *td = cb_data_to_td(data);
352 enum error_type_bit type = 0;
357 p = str = strdup(input);
359 strip_blank_front(&str);
360 strip_blank_end(str);
366 ret = ignore_error_type(td, type, p);
376 static int str_rw_cb(void *data, const char *str)
378 struct thread_data *td = cb_data_to_td(data);
379 struct thread_options *o = &td->o;
388 nr = get_opt_postfix(str);
393 o->ddir_seq_nr = atoi(nr);
397 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
398 log_err("fio: rw postfix parsing failed\n");
403 o->ddir_seq_add = val;
410 static int str_mem_cb(void *data, const char *mem)
412 struct thread_data *td = cb_data_to_td(data);
414 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
415 td->o.mem_type == MEM_MMAPSHARED)
416 td->o.mmapfile = get_opt_postfix(mem);
421 static int fio_clock_source_cb(void *data, const char *str)
423 struct thread_data *td = cb_data_to_td(data);
425 fio_clock_source = td->o.clocksource;
426 fio_clock_source_set = 1;
431 static int str_rwmix_read_cb(void *data, unsigned long long *val)
433 struct thread_data *td = cb_data_to_td(data);
435 td->o.rwmix[DDIR_READ] = *val;
436 td->o.rwmix[DDIR_WRITE] = 100 - *val;
440 static int str_rwmix_write_cb(void *data, unsigned long long *val)
442 struct thread_data *td = cb_data_to_td(data);
444 td->o.rwmix[DDIR_WRITE] = *val;
445 td->o.rwmix[DDIR_READ] = 100 - *val;
449 static int str_exitall_cb(void)
451 exitall_on_terminate = 1;
455 #ifdef FIO_HAVE_CPU_AFFINITY
456 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
458 unsigned int i, index, cpus_in_mask;
459 const long max_cpu = cpus_online();
461 cpus_in_mask = fio_cpu_count(mask);
462 cpu_index = cpu_index % cpus_in_mask;
465 for (i = 0; i < max_cpu; i++) {
466 if (!fio_cpu_isset(mask, i))
469 if (cpu_index != index)
470 fio_cpu_clear(mask, i);
475 return fio_cpu_count(mask);
478 static int str_cpumask_cb(void *data, unsigned long long *val)
480 struct thread_data *td = cb_data_to_td(data);
488 ret = fio_cpuset_init(&td->o.cpumask);
490 log_err("fio: cpuset_init failed\n");
491 td_verror(td, ret, "fio_cpuset_init");
495 max_cpu = cpus_online();
497 for (i = 0; i < sizeof(int) * 8; i++) {
498 if ((1 << i) & *val) {
500 log_err("fio: CPU %d too large (max=%ld)\n", i,
504 dprint(FD_PARSE, "set cpu allowed %d\n", i);
505 fio_cpu_set(&td->o.cpumask, i);
512 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
519 ret = fio_cpuset_init(mask);
521 log_err("fio: cpuset_init failed\n");
522 td_verror(td, ret, "fio_cpuset_init");
526 p = str = strdup(input);
528 strip_blank_front(&str);
529 strip_blank_end(str);
531 max_cpu = cpus_online();
533 while ((cpu = strsep(&str, ",")) != NULL) {
542 while ((cpu2 = strsep(&str2, "-")) != NULL) {
552 while (icpu <= icpu2) {
553 if (icpu >= FIO_MAX_CPUS) {
554 log_err("fio: your OS only supports up to"
555 " %d CPUs\n", (int) FIO_MAX_CPUS);
559 if (icpu >= max_cpu) {
560 log_err("fio: CPU %d too large (max=%ld)\n",
566 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
567 fio_cpu_set(mask, icpu);
578 static int str_cpus_allowed_cb(void *data, const char *input)
580 struct thread_data *td = cb_data_to_td(data);
585 return set_cpus_allowed(td, &td->o.cpumask, input);
588 static int str_verify_cpus_allowed_cb(void *data, const char *input)
590 struct thread_data *td = cb_data_to_td(data);
595 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
599 static int str_log_cpus_allowed_cb(void *data, const char *input)
601 struct thread_data *td = cb_data_to_td(data);
606 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
608 #endif /* CONFIG_ZLIB */
610 #endif /* FIO_HAVE_CPU_AFFINITY */
612 #ifdef CONFIG_LIBNUMA
613 static int str_numa_cpunodes_cb(void *data, char *input)
615 struct thread_data *td = cb_data_to_td(data);
616 struct bitmask *verify_bitmask;
621 /* numa_parse_nodestring() parses a character string list
622 * of nodes into a bit mask. The bit mask is allocated by
623 * numa_allocate_nodemask(), so it should be freed by
624 * numa_free_nodemask().
626 verify_bitmask = numa_parse_nodestring(input);
627 if (verify_bitmask == NULL) {
628 log_err("fio: numa_parse_nodestring failed\n");
629 td_verror(td, 1, "str_numa_cpunodes_cb");
632 numa_free_nodemask(verify_bitmask);
634 td->o.numa_cpunodes = strdup(input);
638 static int str_numa_mpol_cb(void *data, char *input)
640 struct thread_data *td = cb_data_to_td(data);
641 const char * const policy_types[] =
642 { "default", "prefer", "bind", "interleave", "local", NULL };
645 struct bitmask *verify_bitmask;
650 nodelist = strchr(input, ':');
652 /* NUL-terminate mode */
656 for (i = 0; i <= MPOL_LOCAL; i++) {
657 if (!strcmp(input, policy_types[i])) {
658 td->o.numa_mem_mode = i;
662 if (i > MPOL_LOCAL) {
663 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
667 switch (td->o.numa_mem_mode) {
670 * Insist on a nodelist of one node only
673 char *rest = nodelist;
674 while (isdigit(*rest))
677 log_err("fio: one node only for \'prefer\'\n");
681 log_err("fio: one node is needed for \'prefer\'\n");
685 case MPOL_INTERLEAVE:
687 * Default to online nodes with memory if no nodelist
690 nodelist = strdup("all");
695 * Don't allow a nodelist
698 log_err("fio: NO nodelist for \'local\'\n");
704 * Insist on a nodelist
707 log_err("fio: a nodelist is needed for \'bind\'\n");
714 /* numa_parse_nodestring() parses a character string list
715 * of nodes into a bit mask. The bit mask is allocated by
716 * numa_allocate_nodemask(), so it should be freed by
717 * numa_free_nodemask().
719 switch (td->o.numa_mem_mode) {
721 td->o.numa_mem_prefer_node = atoi(nodelist);
723 case MPOL_INTERLEAVE:
725 verify_bitmask = numa_parse_nodestring(nodelist);
726 if (verify_bitmask == NULL) {
727 log_err("fio: numa_parse_nodestring failed\n");
728 td_verror(td, 1, "str_numa_memnodes_cb");
731 td->o.numa_memnodes = strdup(nodelist);
732 numa_free_nodemask(verify_bitmask);
747 static int str_fst_cb(void *data, const char *str)
749 struct thread_data *td = cb_data_to_td(data);
754 td->file_service_nr = 1;
756 switch (td->o.file_service_type) {
757 case FIO_FSERVICE_RANDOM:
758 case FIO_FSERVICE_RR:
759 case FIO_FSERVICE_SEQ:
760 nr = get_opt_postfix(str);
762 td->file_service_nr = atoi(nr);
767 case FIO_FSERVICE_ZIPF:
770 case FIO_FSERVICE_PARETO:
771 val = FIO_DEF_PARETO;
773 case FIO_FSERVICE_GAUSS:
777 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
784 nr = get_opt_postfix(str);
785 if (nr && !str_to_float(nr, &val, 0)) {
786 log_err("fio: file service type random postfix parsing failed\n");
793 switch (td->o.file_service_type) {
794 case FIO_FSERVICE_ZIPF:
796 log_err("fio: zipf theta must be different than 1.0\n");
801 td->zipf_theta = val;
803 case FIO_FSERVICE_PARETO:
804 if (val <= 0.00 || val >= 1.00) {
805 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
812 case FIO_FSERVICE_GAUSS:
813 if (val < 0.00 || val >= 100.00) {
814 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
826 #ifdef CONFIG_SYNC_FILE_RANGE
827 static int str_sfr_cb(void *data, const char *str)
829 struct thread_data *td = cb_data_to_td(data);
830 char *nr = get_opt_postfix(str);
832 td->sync_file_range_nr = 1;
834 td->sync_file_range_nr = atoi(nr);
842 static int zone_split_ddir(struct thread_options *o, enum fio_ddir ddir,
843 char *str, bool absolute)
845 unsigned int i, perc, perc_missing, sperc, sperc_missing;
848 memset(&split, 0, sizeof(split));
850 if (split_parse_ddir(o, &split, ddir, str, absolute, ZONESPLIT_MAX))
855 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
856 o->zone_split_nr[ddir] = split.nr;
857 for (i = 0; i < split.nr; i++) {
858 o->zone_split[ddir][i].access_perc = split.val1[i];
860 o->zone_split[ddir][i].size = split.val2[i];
862 o->zone_split[ddir][i].size_perc = split.val2[i];
866 * Now check if the percentages add up, and how much is missing
868 perc = perc_missing = 0;
869 sperc = sperc_missing = 0;
870 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
871 struct zone_split *zsp = &o->zone_split[ddir][i];
873 if (zsp->access_perc == (uint8_t) -1U)
876 perc += zsp->access_perc;
879 if (zsp->size_perc == (uint8_t) -1U)
882 sperc += zsp->size_perc;
886 if (perc > 100 || sperc > 100) {
887 log_err("fio: zone_split percentages add to more than 100%%\n");
888 free(o->zone_split[ddir]);
889 o->zone_split[ddir] = NULL;
893 log_err("fio: access percentage don't add up to 100 for zoned "
894 "random distribution (got=%u)\n", perc);
895 free(o->zone_split[ddir]);
896 o->zone_split[ddir] = NULL;
901 * If values didn't have a percentage set, divide the remains between
905 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
907 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
908 struct zone_split *zsp = &o->zone_split[ddir][i];
910 if (zsp->access_perc == (uint8_t) -1U)
911 zsp->access_perc = (100 - perc) / perc_missing;
915 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
917 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
918 struct zone_split *zsp = &o->zone_split[ddir][i];
920 if (zsp->size_perc == (uint8_t) -1U)
921 zsp->size_perc = (100 - sperc) / sperc_missing;
928 static void __td_zone_gen_index(struct thread_data *td, enum fio_ddir ddir)
930 unsigned int i, j, sprev, aprev;
933 td->zone_state_index[ddir] = malloc(sizeof(struct zone_split_index) * 100);
935 sprev_sz = sprev = aprev = 0;
936 for (i = 0; i < td->o.zone_split_nr[ddir]; i++) {
937 struct zone_split *zsp = &td->o.zone_split[ddir][i];
939 for (j = aprev; j < aprev + zsp->access_perc; j++) {
940 struct zone_split_index *zsi = &td->zone_state_index[ddir][j];
942 zsi->size_perc = sprev + zsp->size_perc;
943 zsi->size_perc_prev = sprev;
945 zsi->size = sprev_sz + zsp->size;
946 zsi->size_prev = sprev_sz;
949 aprev += zsp->access_perc;
950 sprev += zsp->size_perc;
951 sprev_sz += zsp->size;
956 * Generate state table for indexes, so we don't have to do it inline from
959 static void td_zone_gen_index(struct thread_data *td)
963 td->zone_state_index = malloc(DDIR_RWDIR_CNT *
964 sizeof(struct zone_split_index *));
966 for (i = 0; i < DDIR_RWDIR_CNT; i++)
967 __td_zone_gen_index(td, i);
970 static int parse_zoned_distribution(struct thread_data *td, const char *input,
973 const char *pre = absolute ? "zoned_abs:" : "zoned:";
977 p = str = strdup(input);
979 strip_blank_front(&str);
980 strip_blank_end(str);
982 /* We expect it to start like that, bail if not */
983 if (strncmp(str, pre, strlen(pre))) {
984 log_err("fio: mismatch in zoned input <%s>\n", str);
990 ret = str_split_parse(td, str, zone_split_ddir, absolute);
994 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
997 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
999 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
1000 struct zone_split *zsp = &td->o.zone_split[i][j];
1003 dprint(FD_PARSE, "\t%d: %u/%llu\n", j,
1005 (unsigned long long) zsp->size);
1007 dprint(FD_PARSE, "\t%d: %u/%u\n", j,
1014 if (parse_dryrun()) {
1017 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1018 free(td->o.zone_split[i]);
1019 td->o.zone_split[i] = NULL;
1020 td->o.zone_split_nr[i] = 0;
1027 td_zone_gen_index(td);
1029 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1030 td->o.zone_split_nr[i] = 0;
1036 static int str_random_distribution_cb(void *data, const char *str)
1038 struct thread_data *td = cb_data_to_td(data);
1042 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1044 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1045 val = FIO_DEF_PARETO;
1046 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1048 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1049 return parse_zoned_distribution(td, str, false);
1050 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED_ABS)
1051 return parse_zoned_distribution(td, str, true);
1055 nr = get_opt_postfix(str);
1056 if (nr && !str_to_float(nr, &val, 0)) {
1057 log_err("fio: random postfix parsing failed\n");
1064 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1066 log_err("fio: zipf theta must different than 1.0\n");
1071 td->o.zipf_theta.u.f = val;
1072 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1073 if (val <= 0.00 || val >= 1.00) {
1074 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1079 td->o.pareto_h.u.f = val;
1081 if (val < 0.00 || val >= 100.0) {
1082 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1087 td->o.gauss_dev.u.f = val;
1093 static int str_steadystate_cb(void *data, const char *str)
1095 struct thread_data *td = cb_data_to_td(data);
1101 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1102 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
1103 /* should be impossible to get here */
1104 log_err("fio: unknown steady state criterion\n");
1108 nr = get_opt_postfix(str);
1110 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1115 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1116 pct = strstr(nr, "%");
1119 strip_blank_end(nr);
1120 if (!str_to_float(nr, &val, 0)) {
1121 log_err("fio: could not parse steadystate threshold percentage\n");
1126 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1131 td->o.ss_state |= FIO_SS_PCT;
1132 td->o.ss_limit.u.f = val;
1133 } else if (td->o.ss_state & FIO_SS_IOPS) {
1134 if (!str_to_float(nr, &val, 0)) {
1135 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1140 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1145 td->o.ss_limit.u.f = val;
1146 } else { /* bandwidth criterion */
1147 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1148 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1153 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1158 td->o.ss_limit.u.f = (double) ll;
1161 td->ss.state = td->o.ss_state;
1166 * Return next name in the string. Files are separated with ':'. If the ':'
1167 * is escaped with a '\', then that ':' is part of the filename and does not
1168 * indicate a new file.
1170 static char *get_next_name(char **ptr)
1175 if (!str || !strlen(str))
1181 * No colon, we are done
1183 p = strchr(str, ':');
1190 * We got a colon, but it's the first character. Skip and
1198 if (*(p - 1) != '\\') {
1204 memmove(p - 1, p, strlen(p) + 1);
1212 static int get_max_name_idx(char *input)
1214 unsigned int cur_idx;
1217 p = str = strdup(input);
1218 for (cur_idx = 0; ; cur_idx++)
1219 if (get_next_name(&str) == NULL)
1227 * Returns the directory at the index, indexes > entires will be
1228 * assigned via modulo division of the index
1230 int set_name_idx(char *target, size_t tlen, char *input, int index,
1231 bool unique_filename)
1233 unsigned int cur_idx;
1235 char *fname, *str, *p;
1237 p = str = strdup(input);
1239 index %= get_max_name_idx(input);
1240 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1241 fname = get_next_name(&str);
1243 if (client_sockaddr_str[0] && unique_filename) {
1244 len = snprintf(target, tlen, "%s/%s.", fname,
1245 client_sockaddr_str);
1247 len = snprintf(target, tlen, "%s/", fname);
1249 target[tlen - 1] = '\0';
1255 static int str_filename_cb(void *data, const char *input)
1257 struct thread_data *td = cb_data_to_td(data);
1258 char *fname, *str, *p;
1260 p = str = strdup(input);
1262 strip_blank_front(&str);
1263 strip_blank_end(str);
1266 * Ignore what we may already have from nrfiles option.
1268 if (!td->files_index)
1271 while ((fname = get_next_name(&str)) != NULL) {
1274 add_file(td, fname, 0, 1);
1281 static int str_directory_cb(void *data, const char fio_unused *unused)
1283 struct thread_data *td = cb_data_to_td(data);
1285 char *dirname, *str, *p;
1291 p = str = strdup(td->o.directory);
1292 while ((dirname = get_next_name(&str)) != NULL) {
1293 if (lstat(dirname, &sb) < 0) {
1296 log_err("fio: %s is not a directory\n", dirname);
1297 td_verror(td, ret, "lstat");
1300 if (!S_ISDIR(sb.st_mode)) {
1301 log_err("fio: %s is not a directory\n", dirname);
1312 static int str_opendir_cb(void *data, const char fio_unused *str)
1314 struct thread_data *td = cb_data_to_td(data);
1319 if (!td->files_index)
1322 return add_dir_files(td, td->o.opendir);
1325 static int str_buffer_pattern_cb(void *data, const char *input)
1327 struct thread_data *td = cb_data_to_td(data);
1330 /* FIXME: for now buffer pattern does not support formats */
1331 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
1332 MAX_PATTERN_SIZE, NULL, 0, NULL, NULL);
1337 td->o.buffer_pattern_bytes = ret;
1340 * If this job is doing any reading or has compression set,
1341 * ensure that we refill buffers for writes or we could be
1342 * invalidating the pattern through reads.
1344 if (!td->o.compress_percentage && !td_read(td))
1345 td->o.refill_buffers = 0;
1347 td->o.refill_buffers = 1;
1349 td->o.scramble_buffers = 0;
1350 td->o.zero_buffers = 0;
1355 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1357 struct thread_data *td = cb_data_to_td(data);
1359 td->flags |= TD_F_COMPRESS;
1360 td->o.compress_percentage = *il;
1364 static int str_dedupe_cb(void *data, unsigned long long *il)
1366 struct thread_data *td = cb_data_to_td(data);
1368 td->flags |= TD_F_COMPRESS;
1369 td->o.dedupe_percentage = *il;
1370 td->o.refill_buffers = 1;
1374 static int str_verify_pattern_cb(void *data, const char *input)
1376 struct thread_data *td = cb_data_to_td(data);
1379 td->o.verify_fmt_sz = ARRAY_SIZE(td->o.verify_fmt);
1380 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
1381 MAX_PATTERN_SIZE, fmt_desc, sizeof(fmt_desc),
1382 td->o.verify_fmt, &td->o.verify_fmt_sz);
1387 td->o.verify_pattern_bytes = ret;
1389 * VERIFY_* could already be set
1391 if (!fio_option_is_set(&td->o, verify))
1392 td->o.verify = VERIFY_PATTERN;
1397 static int str_gtod_reduce_cb(void *data, int *il)
1399 struct thread_data *td = cb_data_to_td(data);
1402 td->o.disable_lat = !!val;
1403 td->o.disable_clat = !!val;
1404 td->o.disable_slat = !!val;
1405 td->o.disable_bw = !!val;
1406 td->o.clat_percentiles = !val;
1408 td->ts_cache_mask = 63;
1413 static int str_offset_cb(void *data, unsigned long long *__val)
1415 struct thread_data *td = cb_data_to_td(data);
1416 unsigned long long v = *__val;
1418 if (parse_is_percent(v)) {
1419 td->o.start_offset = 0;
1420 td->o.start_offset_percent = -1ULL - v;
1421 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1422 td->o.start_offset_percent);
1424 td->o.start_offset = v;
1429 static int str_size_cb(void *data, unsigned long long *__val)
1431 struct thread_data *td = cb_data_to_td(data);
1432 unsigned long long v = *__val;
1434 if (parse_is_percent(v)) {
1436 td->o.size_percent = -1ULL - v;
1437 dprint(FD_PARSE, "SET size_percent %d\n",
1438 td->o.size_percent);
1445 static int str_write_bw_log_cb(void *data, const char *str)
1447 struct thread_data *td = cb_data_to_td(data);
1450 td->o.bw_log_file = strdup(str);
1452 td->o.write_bw_log = 1;
1456 static int str_write_lat_log_cb(void *data, const char *str)
1458 struct thread_data *td = cb_data_to_td(data);
1461 td->o.lat_log_file = strdup(str);
1463 td->o.write_lat_log = 1;
1467 static int str_write_iops_log_cb(void *data, const char *str)
1469 struct thread_data *td = cb_data_to_td(data);
1472 td->o.iops_log_file = strdup(str);
1474 td->o.write_iops_log = 1;
1478 static int str_write_hist_log_cb(void *data, const char *str)
1480 struct thread_data *td = cb_data_to_td(data);
1483 td->o.hist_log_file = strdup(str);
1485 td->o.write_hist_log = 1;
1490 * str is supposed to be a substring of the strdup'd original string,
1491 * and is valid only if it's a regular file path.
1492 * This function keeps the pointer to the path as needed later.
1494 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1495 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1496 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1498 static int str_ioengine_external_cb(void *data, const char *str)
1500 struct thread_data *td = cb_data_to_td(data);
1505 log_err("fio: null external ioengine path\n");
1509 p = (char *)str; /* str is mutable */
1510 strip_blank_front(&p);
1513 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1514 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1518 td->o.ioengine_so_path = p;
1522 static int rw_verify(struct fio_option *o, void *data)
1524 struct thread_data *td = cb_data_to_td(data);
1526 if (read_only && td_write(td)) {
1527 log_err("fio: job <%s> has write bit set, but fio is in"
1528 " read-only mode\n", td->o.name);
1535 static int gtod_cpu_verify(struct fio_option *o, void *data)
1537 #ifndef FIO_HAVE_CPU_AFFINITY
1538 struct thread_data *td = cb_data_to_td(data);
1540 if (td->o.gtod_cpu) {
1541 log_err("fio: platform must support CPU affinity for"
1542 "gettimeofday() offloading\n");
1551 * Map of job/command line options
1553 struct fio_option fio_options[FIO_MAX_OPTS] = {
1555 .name = "description",
1556 .lname = "Description of job",
1557 .type = FIO_OPT_STR_STORE,
1558 .off1 = offsetof(struct thread_options, description),
1559 .help = "Text job description",
1560 .category = FIO_OPT_C_GENERAL,
1561 .group = FIO_OPT_G_DESC,
1565 .lname = "Job name",
1566 .type = FIO_OPT_STR_STORE,
1567 .off1 = offsetof(struct thread_options, name),
1568 .help = "Name of this job",
1569 .category = FIO_OPT_C_GENERAL,
1570 .group = FIO_OPT_G_DESC,
1574 .lname = "Waitee name",
1575 .type = FIO_OPT_STR_STORE,
1576 .off1 = offsetof(struct thread_options, wait_for),
1577 .help = "Name of the job this one wants to wait for before starting",
1578 .category = FIO_OPT_C_GENERAL,
1579 .group = FIO_OPT_G_DESC,
1583 .lname = "Filename(s)",
1584 .type = FIO_OPT_STR_STORE,
1585 .off1 = offsetof(struct thread_options, filename),
1586 .cb = str_filename_cb,
1587 .prio = -1, /* must come after "directory" */
1588 .help = "File(s) to use for the workload",
1589 .category = FIO_OPT_C_FILE,
1590 .group = FIO_OPT_G_FILENAME,
1593 .name = "directory",
1594 .lname = "Directory",
1595 .type = FIO_OPT_STR_STORE,
1596 .off1 = offsetof(struct thread_options, directory),
1597 .cb = str_directory_cb,
1598 .help = "Directory to store files in",
1599 .category = FIO_OPT_C_FILE,
1600 .group = FIO_OPT_G_FILENAME,
1603 .name = "filename_format",
1604 .lname = "Filename Format",
1605 .type = FIO_OPT_STR_STORE,
1606 .off1 = offsetof(struct thread_options, filename_format),
1607 .prio = -1, /* must come after "directory" */
1608 .help = "Override default $jobname.$jobnum.$filenum naming",
1609 .def = "$jobname.$jobnum.$filenum",
1610 .category = FIO_OPT_C_FILE,
1611 .group = FIO_OPT_G_FILENAME,
1614 .name = "unique_filename",
1615 .lname = "Unique Filename",
1616 .type = FIO_OPT_BOOL,
1617 .off1 = offsetof(struct thread_options, unique_filename),
1618 .help = "For network clients, prefix file with source IP",
1620 .category = FIO_OPT_C_FILE,
1621 .group = FIO_OPT_G_FILENAME,
1625 .lname = "Lockfile",
1626 .type = FIO_OPT_STR,
1627 .off1 = offsetof(struct thread_options, file_lock_mode),
1628 .help = "Lock file when doing IO to it",
1630 .parent = "filename",
1633 .category = FIO_OPT_C_FILE,
1634 .group = FIO_OPT_G_FILENAME,
1637 .oval = FILE_LOCK_NONE,
1638 .help = "No file locking",
1640 { .ival = "exclusive",
1641 .oval = FILE_LOCK_EXCLUSIVE,
1642 .help = "Exclusive file lock",
1645 .ival = "readwrite",
1646 .oval = FILE_LOCK_READWRITE,
1647 .help = "Read vs write lock",
1653 .lname = "Open directory",
1654 .type = FIO_OPT_STR_STORE,
1655 .off1 = offsetof(struct thread_options, opendir),
1656 .cb = str_opendir_cb,
1657 .help = "Recursively add files from this directory and down",
1658 .category = FIO_OPT_C_FILE,
1659 .group = FIO_OPT_G_FILENAME,
1663 .lname = "Read/write",
1664 .alias = "readwrite",
1665 .type = FIO_OPT_STR,
1667 .off1 = offsetof(struct thread_options, td_ddir),
1668 .help = "IO direction",
1670 .verify = rw_verify,
1671 .category = FIO_OPT_C_IO,
1672 .group = FIO_OPT_G_IO_BASIC,
1675 .oval = TD_DDIR_READ,
1676 .help = "Sequential read",
1679 .oval = TD_DDIR_WRITE,
1680 .help = "Sequential write",
1683 .oval = TD_DDIR_TRIM,
1684 .help = "Sequential trim",
1686 { .ival = "randread",
1687 .oval = TD_DDIR_RANDREAD,
1688 .help = "Random read",
1690 { .ival = "randwrite",
1691 .oval = TD_DDIR_RANDWRITE,
1692 .help = "Random write",
1694 { .ival = "randtrim",
1695 .oval = TD_DDIR_RANDTRIM,
1696 .help = "Random trim",
1700 .help = "Sequential read and write mix",
1702 { .ival = "readwrite",
1704 .help = "Sequential read and write mix",
1707 .oval = TD_DDIR_RANDRW,
1708 .help = "Random read and write mix"
1710 { .ival = "trimwrite",
1711 .oval = TD_DDIR_TRIMWRITE,
1712 .help = "Trim and write mix, trims preceding writes"
1717 .name = "rw_sequencer",
1718 .lname = "RW Sequencer",
1719 .type = FIO_OPT_STR,
1720 .off1 = offsetof(struct thread_options, rw_seq),
1721 .help = "IO offset generator modifier",
1722 .def = "sequential",
1723 .category = FIO_OPT_C_IO,
1724 .group = FIO_OPT_G_IO_BASIC,
1726 { .ival = "sequential",
1728 .help = "Generate sequential offsets",
1730 { .ival = "identical",
1731 .oval = RW_SEQ_IDENT,
1732 .help = "Generate identical offsets",
1739 .lname = "IO Engine",
1740 .type = FIO_OPT_STR_STORE,
1741 .off1 = offsetof(struct thread_options, ioengine),
1742 .help = "IO engine to use",
1743 .def = FIO_PREFERRED_ENGINE,
1744 .category = FIO_OPT_C_IO,
1745 .group = FIO_OPT_G_IO_BASIC,
1748 .help = "Use read/write",
1751 .help = "Use pread/pwrite",
1754 .help = "Use readv/writev",
1756 #ifdef CONFIG_PWRITEV
1758 .help = "Use preadv/pwritev",
1761 #ifdef FIO_HAVE_PWRITEV2
1762 { .ival = "pvsync2",
1763 .help = "Use preadv2/pwritev2",
1766 #ifdef CONFIG_LIBAIO
1768 .help = "Linux native asynchronous IO",
1771 #ifdef CONFIG_POSIXAIO
1772 { .ival = "posixaio",
1773 .help = "POSIX asynchronous IO",
1776 #ifdef CONFIG_SOLARISAIO
1777 { .ival = "solarisaio",
1778 .help = "Solaris native asynchronous IO",
1781 #ifdef CONFIG_WINDOWSAIO
1782 { .ival = "windowsaio",
1783 .help = "Windows native asynchronous IO"
1788 .help = "Rados Block Device asynchronous IO"
1792 .help = "Memory mapped IO"
1794 #ifdef CONFIG_LINUX_SPLICE
1796 .help = "splice/vmsplice based IO",
1798 { .ival = "netsplice",
1799 .help = "splice/vmsplice to/from the network",
1802 #ifdef FIO_HAVE_SGIO
1804 .help = "SCSI generic v3 IO",
1808 .help = "Testing engine (no data transfer)",
1811 .help = "Network IO",
1814 .help = "CPU cycle burner engine",
1818 .help = "GUASI IO engine",
1821 #ifdef FIO_HAVE_BINJECT
1822 { .ival = "binject",
1823 .help = "binject direct inject block engine",
1828 .help = "RDMA IO engine",
1831 #ifdef CONFIG_FUSION_AW
1832 { .ival = "fusion-aw-sync",
1833 .help = "Fusion-io atomic write engine",
1836 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1837 { .ival = "e4defrag",
1838 .help = "ext4 defrag engine",
1841 #ifdef CONFIG_LINUX_FALLOCATE
1843 .help = "fallocate() file based engine",
1848 .help = "Glusterfs libgfapi(sync) based engine"
1850 { .ival = "gfapi_async",
1851 .help = "Glusterfs libgfapi(async) based engine"
1854 #ifdef CONFIG_LIBHDFS
1855 { .ival = "libhdfs",
1856 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1859 #ifdef CONFIG_PMEMBLK
1860 { .ival = "pmemblk",
1861 .help = "NVML libpmemblk based IO engine",
1865 #ifdef CONFIG_LINUX_DEVDAX
1866 { .ival = "dev-dax",
1867 .help = "DAX Device based IO engine",
1871 .ival = "filecreate",
1872 .help = "File creation engine",
1874 { .ival = "external",
1875 .help = "Load external engine (append name)",
1876 .cb = str_ioengine_external_cb,
1878 #ifdef CONFIG_LIBPMEM
1879 { .ival = "libpmem",
1880 .help = "NVML libpmem based IO engine",
1887 .lname = "IO Depth",
1888 .type = FIO_OPT_INT,
1889 .off1 = offsetof(struct thread_options, iodepth),
1890 .help = "Number of IO buffers to keep in flight",
1894 .category = FIO_OPT_C_IO,
1895 .group = FIO_OPT_G_IO_BASIC,
1898 .name = "iodepth_batch",
1899 .lname = "IO Depth batch",
1900 .alias = "iodepth_batch_submit",
1901 .type = FIO_OPT_INT,
1902 .off1 = offsetof(struct thread_options, iodepth_batch),
1903 .help = "Number of IO buffers to submit in one go",
1904 .parent = "iodepth",
1908 .category = FIO_OPT_C_IO,
1909 .group = FIO_OPT_G_IO_BASIC,
1912 .name = "iodepth_batch_complete_min",
1913 .lname = "Min IO depth batch complete",
1914 .alias = "iodepth_batch_complete",
1915 .type = FIO_OPT_INT,
1916 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
1917 .help = "Min number of IO buffers to retrieve in one go",
1918 .parent = "iodepth",
1923 .category = FIO_OPT_C_IO,
1924 .group = FIO_OPT_G_IO_BASIC,
1927 .name = "iodepth_batch_complete_max",
1928 .lname = "Max IO depth batch complete",
1929 .type = FIO_OPT_INT,
1930 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
1931 .help = "Max number of IO buffers to retrieve in one go",
1932 .parent = "iodepth",
1936 .category = FIO_OPT_C_IO,
1937 .group = FIO_OPT_G_IO_BASIC,
1940 .name = "iodepth_low",
1941 .lname = "IO Depth batch low",
1942 .type = FIO_OPT_INT,
1943 .off1 = offsetof(struct thread_options, iodepth_low),
1944 .help = "Low water mark for queuing depth",
1945 .parent = "iodepth",
1948 .category = FIO_OPT_C_IO,
1949 .group = FIO_OPT_G_IO_BASIC,
1952 .name = "serialize_overlap",
1953 .lname = "Serialize overlap",
1954 .off1 = offsetof(struct thread_options, serialize_overlap),
1955 .type = FIO_OPT_BOOL,
1956 .help = "Wait for in-flight IOs that collide to complete",
1957 .parent = "iodepth",
1959 .category = FIO_OPT_C_IO,
1960 .group = FIO_OPT_G_IO_BASIC,
1963 .name = "io_submit_mode",
1964 .lname = "IO submit mode",
1965 .type = FIO_OPT_STR,
1966 .off1 = offsetof(struct thread_options, io_submit_mode),
1967 .help = "How IO submissions and completions are done",
1969 .category = FIO_OPT_C_IO,
1970 .group = FIO_OPT_G_IO_BASIC,
1973 .oval = IO_MODE_INLINE,
1974 .help = "Submit and complete IO inline",
1976 { .ival = "offload",
1977 .oval = IO_MODE_OFFLOAD,
1978 .help = "Offload submit and complete to threads",
1985 .type = FIO_OPT_STR_VAL,
1987 .off1 = offsetof(struct thread_options, size),
1988 .help = "Total size of device or files",
1989 .interval = 1024 * 1024,
1990 .category = FIO_OPT_C_IO,
1991 .group = FIO_OPT_G_INVALID,
1995 .alias = "io_limit",
1997 .type = FIO_OPT_STR_VAL,
1998 .off1 = offsetof(struct thread_options, io_size),
1999 .help = "Total size of I/O to be performed",
2000 .interval = 1024 * 1024,
2001 .category = FIO_OPT_C_IO,
2002 .group = FIO_OPT_G_INVALID,
2005 .name = "fill_device",
2006 .lname = "Fill device",
2008 .type = FIO_OPT_BOOL,
2009 .off1 = offsetof(struct thread_options, fill_device),
2010 .help = "Write until an ENOSPC error occurs",
2012 .category = FIO_OPT_C_FILE,
2013 .group = FIO_OPT_G_INVALID,
2017 .lname = "File size",
2018 .type = FIO_OPT_STR_VAL,
2019 .off1 = offsetof(struct thread_options, file_size_low),
2020 .off2 = offsetof(struct thread_options, file_size_high),
2022 .help = "Size of individual files",
2023 .interval = 1024 * 1024,
2024 .category = FIO_OPT_C_FILE,
2025 .group = FIO_OPT_G_INVALID,
2028 .name = "file_append",
2029 .lname = "File append",
2030 .type = FIO_OPT_BOOL,
2031 .off1 = offsetof(struct thread_options, file_append),
2032 .help = "IO will start at the end of the file(s)",
2034 .category = FIO_OPT_C_FILE,
2035 .group = FIO_OPT_G_INVALID,
2039 .lname = "IO offset",
2040 .alias = "fileoffset",
2041 .type = FIO_OPT_STR_VAL,
2042 .cb = str_offset_cb,
2043 .off1 = offsetof(struct thread_options, start_offset),
2044 .help = "Start IO from this offset",
2046 .interval = 1024 * 1024,
2047 .category = FIO_OPT_C_IO,
2048 .group = FIO_OPT_G_INVALID,
2051 .name = "offset_align",
2052 .lname = "IO offset alignment",
2053 .type = FIO_OPT_INT,
2054 .off1 = offsetof(struct thread_options, start_offset_align),
2055 .help = "Start IO from this offset alignment",
2058 .category = FIO_OPT_C_IO,
2059 .group = FIO_OPT_G_INVALID,
2062 .name = "offset_increment",
2063 .lname = "IO offset increment",
2064 .type = FIO_OPT_STR_VAL,
2065 .off1 = offsetof(struct thread_options, offset_increment),
2066 .help = "What is the increment from one offset to the next",
2070 .interval = 1024 * 1024,
2071 .category = FIO_OPT_C_IO,
2072 .group = FIO_OPT_G_INVALID,
2075 .name = "number_ios",
2076 .lname = "Number of IOs to perform",
2077 .type = FIO_OPT_STR_VAL,
2078 .off1 = offsetof(struct thread_options, number_ios),
2079 .help = "Force job completion after this number of IOs",
2081 .category = FIO_OPT_C_IO,
2082 .group = FIO_OPT_G_INVALID,
2086 .lname = "Block size",
2087 .alias = "blocksize",
2088 .type = FIO_OPT_INT,
2089 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2090 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2091 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2093 .help = "Block size unit",
2098 .category = FIO_OPT_C_IO,
2099 .group = FIO_OPT_G_INVALID,
2103 .lname = "Block size align",
2104 .alias = "blockalign",
2105 .type = FIO_OPT_INT,
2106 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2107 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2108 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2110 .help = "IO block offset alignment",
2114 .category = FIO_OPT_C_IO,
2115 .group = FIO_OPT_G_INVALID,
2119 .lname = "Block size range",
2120 .alias = "blocksize_range",
2121 .type = FIO_OPT_RANGE,
2122 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2123 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2124 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2125 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2126 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2127 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2129 .help = "Set block size range (in more detail than bs)",
2133 .category = FIO_OPT_C_IO,
2134 .group = FIO_OPT_G_INVALID,
2138 .lname = "Block size split",
2139 .type = FIO_OPT_STR,
2140 .cb = str_bssplit_cb,
2141 .off1 = offsetof(struct thread_options, bssplit),
2142 .help = "Set a specific mix of block sizes",
2145 .category = FIO_OPT_C_IO,
2146 .group = FIO_OPT_G_INVALID,
2149 .name = "bs_unaligned",
2150 .lname = "Block size unaligned",
2151 .alias = "blocksize_unaligned",
2152 .type = FIO_OPT_STR_SET,
2153 .off1 = offsetof(struct thread_options, bs_unaligned),
2154 .help = "Don't sector align IO buffer sizes",
2157 .category = FIO_OPT_C_IO,
2158 .group = FIO_OPT_G_INVALID,
2161 .name = "bs_is_seq_rand",
2162 .lname = "Block size division is seq/random (not read/write)",
2163 .type = FIO_OPT_BOOL,
2164 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2165 .help = "Consider any blocksize setting to be sequential,random",
2167 .parent = "blocksize",
2168 .category = FIO_OPT_C_IO,
2169 .group = FIO_OPT_G_INVALID,
2172 .name = "randrepeat",
2173 .lname = "Random repeatable",
2174 .type = FIO_OPT_BOOL,
2175 .off1 = offsetof(struct thread_options, rand_repeatable),
2176 .help = "Use repeatable random IO pattern",
2180 .category = FIO_OPT_C_IO,
2181 .group = FIO_OPT_G_RANDOM,
2185 .lname = "The random generator seed",
2186 .type = FIO_OPT_STR_VAL,
2187 .off1 = offsetof(struct thread_options, rand_seed),
2188 .help = "Set the random generator seed value",
2191 .category = FIO_OPT_C_IO,
2192 .group = FIO_OPT_G_RANDOM,
2195 .name = "use_os_rand",
2196 .lname = "Use OS random",
2197 .type = FIO_OPT_DEPRECATED,
2198 .off1 = offsetof(struct thread_options, dep_use_os_rand),
2199 .category = FIO_OPT_C_IO,
2200 .group = FIO_OPT_G_RANDOM,
2203 .name = "norandommap",
2204 .lname = "No randommap",
2205 .type = FIO_OPT_STR_SET,
2206 .off1 = offsetof(struct thread_options, norandommap),
2207 .help = "Accept potential duplicate random blocks",
2211 .category = FIO_OPT_C_IO,
2212 .group = FIO_OPT_G_RANDOM,
2215 .name = "softrandommap",
2216 .lname = "Soft randommap",
2217 .type = FIO_OPT_BOOL,
2218 .off1 = offsetof(struct thread_options, softrandommap),
2219 .help = "Set norandommap if randommap allocation fails",
2220 .parent = "norandommap",
2223 .category = FIO_OPT_C_IO,
2224 .group = FIO_OPT_G_RANDOM,
2227 .name = "random_generator",
2228 .lname = "Random Generator",
2229 .type = FIO_OPT_STR,
2230 .off1 = offsetof(struct thread_options, random_generator),
2231 .help = "Type of random number generator to use",
2232 .def = "tausworthe",
2234 { .ival = "tausworthe",
2235 .oval = FIO_RAND_GEN_TAUSWORTHE,
2236 .help = "Strong Tausworthe generator",
2239 .oval = FIO_RAND_GEN_LFSR,
2240 .help = "Variable length LFSR",
2243 .ival = "tausworthe64",
2244 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2245 .help = "64-bit Tausworthe variant",
2248 .category = FIO_OPT_C_IO,
2249 .group = FIO_OPT_G_RANDOM,
2252 .name = "random_distribution",
2253 .lname = "Random Distribution",
2254 .type = FIO_OPT_STR,
2255 .off1 = offsetof(struct thread_options, random_distribution),
2256 .cb = str_random_distribution_cb,
2257 .help = "Random offset distribution generator",
2261 .oval = FIO_RAND_DIST_RANDOM,
2262 .help = "Completely random",
2265 .oval = FIO_RAND_DIST_ZIPF,
2266 .help = "Zipf distribution",
2269 .oval = FIO_RAND_DIST_PARETO,
2270 .help = "Pareto distribution",
2273 .oval = FIO_RAND_DIST_GAUSS,
2274 .help = "Normal (Gaussian) distribution",
2277 .oval = FIO_RAND_DIST_ZONED,
2278 .help = "Zoned random distribution",
2280 { .ival = "zoned_abs",
2281 .oval = FIO_RAND_DIST_ZONED_ABS,
2282 .help = "Zoned absolute random distribution",
2285 .category = FIO_OPT_C_IO,
2286 .group = FIO_OPT_G_RANDOM,
2289 .name = "percentage_random",
2290 .lname = "Percentage Random",
2291 .type = FIO_OPT_INT,
2292 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2293 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2294 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2296 .help = "Percentage of seq/random mix that should be random",
2297 .def = "100,100,100",
2299 .inverse = "percentage_sequential",
2300 .category = FIO_OPT_C_IO,
2301 .group = FIO_OPT_G_RANDOM,
2304 .name = "percentage_sequential",
2305 .lname = "Percentage Sequential",
2306 .type = FIO_OPT_DEPRECATED,
2307 .category = FIO_OPT_C_IO,
2308 .group = FIO_OPT_G_RANDOM,
2311 .name = "allrandrepeat",
2312 .lname = "All Random Repeat",
2313 .type = FIO_OPT_BOOL,
2314 .off1 = offsetof(struct thread_options, allrand_repeatable),
2315 .help = "Use repeatable random numbers for everything",
2317 .category = FIO_OPT_C_IO,
2318 .group = FIO_OPT_G_RANDOM,
2322 .lname = "Number of files",
2323 .alias = "nr_files",
2324 .type = FIO_OPT_INT,
2325 .off1 = offsetof(struct thread_options, nr_files),
2326 .help = "Split job workload between this number of files",
2329 .category = FIO_OPT_C_FILE,
2330 .group = FIO_OPT_G_INVALID,
2333 .name = "openfiles",
2334 .lname = "Number of open files",
2335 .type = FIO_OPT_INT,
2336 .off1 = offsetof(struct thread_options, open_files),
2337 .help = "Number of files to keep open at the same time",
2338 .category = FIO_OPT_C_FILE,
2339 .group = FIO_OPT_G_INVALID,
2342 .name = "file_service_type",
2343 .lname = "File service type",
2344 .type = FIO_OPT_STR,
2346 .off1 = offsetof(struct thread_options, file_service_type),
2347 .help = "How to select which file to service next",
2348 .def = "roundrobin",
2349 .category = FIO_OPT_C_FILE,
2350 .group = FIO_OPT_G_INVALID,
2353 .oval = FIO_FSERVICE_RANDOM,
2354 .help = "Choose a file at random (uniform)",
2357 .oval = FIO_FSERVICE_ZIPF,
2358 .help = "Zipf randomized",
2361 .oval = FIO_FSERVICE_PARETO,
2362 .help = "Pareto randomized",
2365 .oval = FIO_FSERVICE_GAUSS,
2366 .help = "Normal (Gaussian) randomized",
2369 .oval = FIO_FSERVICE_GAUSS,
2370 .help = "Alias for normal",
2372 { .ival = "roundrobin",
2373 .oval = FIO_FSERVICE_RR,
2374 .help = "Round robin select files",
2376 { .ival = "sequential",
2377 .oval = FIO_FSERVICE_SEQ,
2378 .help = "Finish one file before moving to the next",
2381 .parent = "nrfiles",
2384 #ifdef FIO_HAVE_ANY_FALLOCATE
2386 .name = "fallocate",
2387 .lname = "Fallocate",
2388 .type = FIO_OPT_STR,
2389 .off1 = offsetof(struct thread_options, fallocate_mode),
2390 .help = "Whether pre-allocation is performed when laying out files",
2392 .category = FIO_OPT_C_FILE,
2393 .group = FIO_OPT_G_INVALID,
2396 .oval = FIO_FALLOCATE_NONE,
2397 .help = "Do not pre-allocate space",
2400 .oval = FIO_FALLOCATE_NATIVE,
2401 .help = "Use native pre-allocation if possible",
2403 #ifdef CONFIG_POSIX_FALLOCATE
2405 .oval = FIO_FALLOCATE_POSIX,
2406 .help = "Use posix_fallocate()",
2409 #ifdef CONFIG_LINUX_FALLOCATE
2411 .oval = FIO_FALLOCATE_KEEP_SIZE,
2412 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2415 /* Compatibility with former boolean values */
2417 .oval = FIO_FALLOCATE_NONE,
2418 .help = "Alias for 'none'",
2420 #ifdef CONFIG_POSIX_FALLOCATE
2422 .oval = FIO_FALLOCATE_POSIX,
2423 .help = "Alias for 'posix'",
2428 #else /* FIO_HAVE_ANY_FALLOCATE */
2430 .name = "fallocate",
2431 .lname = "Fallocate",
2432 .type = FIO_OPT_UNSUPPORTED,
2433 .help = "Your platform does not support fallocate",
2435 #endif /* FIO_HAVE_ANY_FALLOCATE */
2437 .name = "fadvise_hint",
2438 .lname = "Fadvise hint",
2439 .type = FIO_OPT_STR,
2440 .off1 = offsetof(struct thread_options, fadvise_hint),
2444 .help = "Don't issue fadvise",
2448 .help = "Advise using fio IO pattern",
2451 .oval = F_ADV_RANDOM,
2452 .help = "Advise using FADV_RANDOM",
2454 { .ival = "sequential",
2455 .oval = F_ADV_SEQUENTIAL,
2456 .help = "Advise using FADV_SEQUENTIAL",
2459 .help = "Use fadvise() to advise the kernel on IO pattern",
2461 .category = FIO_OPT_C_FILE,
2462 .group = FIO_OPT_G_INVALID,
2467 .type = FIO_OPT_INT,
2468 .off1 = offsetof(struct thread_options, fsync_blocks),
2469 .help = "Issue fsync for writes every given number of blocks",
2472 .category = FIO_OPT_C_FILE,
2473 .group = FIO_OPT_G_INVALID,
2476 .name = "fdatasync",
2477 .lname = "Fdatasync",
2478 .type = FIO_OPT_INT,
2479 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2480 .help = "Issue fdatasync for writes every given number of blocks",
2483 .category = FIO_OPT_C_FILE,
2484 .group = FIO_OPT_G_INVALID,
2487 .name = "write_barrier",
2488 .lname = "Write barrier",
2489 .type = FIO_OPT_INT,
2490 .off1 = offsetof(struct thread_options, barrier_blocks),
2491 .help = "Make every Nth write a barrier write",
2494 .category = FIO_OPT_C_IO,
2495 .group = FIO_OPT_G_INVALID,
2497 #ifdef CONFIG_SYNC_FILE_RANGE
2499 .name = "sync_file_range",
2500 .lname = "Sync file range",
2502 { .ival = "wait_before",
2503 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2504 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2508 .oval = SYNC_FILE_RANGE_WRITE,
2509 .help = "SYNC_FILE_RANGE_WRITE",
2513 .ival = "wait_after",
2514 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2515 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2519 .type = FIO_OPT_STR_MULTI,
2521 .off1 = offsetof(struct thread_options, sync_file_range),
2522 .help = "Use sync_file_range()",
2523 .category = FIO_OPT_C_FILE,
2524 .group = FIO_OPT_G_INVALID,
2528 .name = "sync_file_range",
2529 .lname = "Sync file range",
2530 .type = FIO_OPT_UNSUPPORTED,
2531 .help = "Your platform does not support sync_file_range",
2536 .lname = "Direct I/O",
2537 .type = FIO_OPT_BOOL,
2538 .off1 = offsetof(struct thread_options, odirect),
2539 .help = "Use O_DIRECT IO (negates buffered)",
2541 .inverse = "buffered",
2542 .category = FIO_OPT_C_IO,
2543 .group = FIO_OPT_G_IO_TYPE,
2547 .lname = "Atomic I/O",
2548 .type = FIO_OPT_BOOL,
2549 .off1 = offsetof(struct thread_options, oatomic),
2550 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2552 .category = FIO_OPT_C_IO,
2553 .group = FIO_OPT_G_IO_TYPE,
2557 .lname = "Buffered I/O",
2558 .type = FIO_OPT_BOOL,
2559 .off1 = offsetof(struct thread_options, odirect),
2561 .help = "Use buffered IO (negates direct)",
2563 .inverse = "direct",
2564 .category = FIO_OPT_C_IO,
2565 .group = FIO_OPT_G_IO_TYPE,
2568 .name = "overwrite",
2569 .lname = "Overwrite",
2570 .type = FIO_OPT_BOOL,
2571 .off1 = offsetof(struct thread_options, overwrite),
2572 .help = "When writing, set whether to overwrite current data",
2574 .category = FIO_OPT_C_FILE,
2575 .group = FIO_OPT_G_INVALID,
2580 .type = FIO_OPT_INT,
2581 .off1 = offsetof(struct thread_options, loops),
2582 .help = "Number of times to run the job",
2585 .category = FIO_OPT_C_GENERAL,
2586 .group = FIO_OPT_G_RUNTIME,
2590 .lname = "Number of jobs",
2591 .type = FIO_OPT_INT,
2592 .off1 = offsetof(struct thread_options, numjobs),
2593 .help = "Duplicate this job this many times",
2596 .category = FIO_OPT_C_GENERAL,
2597 .group = FIO_OPT_G_RUNTIME,
2600 .name = "startdelay",
2601 .lname = "Start delay",
2602 .type = FIO_OPT_STR_VAL_TIME,
2603 .off1 = offsetof(struct thread_options, start_delay),
2604 .off2 = offsetof(struct thread_options, start_delay_high),
2605 .help = "Only start job when this period has passed",
2609 .category = FIO_OPT_C_GENERAL,
2610 .group = FIO_OPT_G_RUNTIME,
2616 .type = FIO_OPT_STR_VAL_TIME,
2617 .off1 = offsetof(struct thread_options, timeout),
2618 .help = "Stop workload when this amount of time has passed",
2622 .category = FIO_OPT_C_GENERAL,
2623 .group = FIO_OPT_G_RUNTIME,
2626 .name = "time_based",
2627 .lname = "Time based",
2628 .type = FIO_OPT_STR_SET,
2629 .off1 = offsetof(struct thread_options, time_based),
2630 .help = "Keep running until runtime/timeout is met",
2631 .category = FIO_OPT_C_GENERAL,
2632 .group = FIO_OPT_G_RUNTIME,
2635 .name = "verify_only",
2636 .lname = "Verify only",
2637 .type = FIO_OPT_STR_SET,
2638 .off1 = offsetof(struct thread_options, verify_only),
2639 .help = "Verifies previously written data is still valid",
2640 .category = FIO_OPT_C_GENERAL,
2641 .group = FIO_OPT_G_RUNTIME,
2644 .name = "ramp_time",
2645 .lname = "Ramp time",
2646 .type = FIO_OPT_STR_VAL_TIME,
2647 .off1 = offsetof(struct thread_options, ramp_time),
2648 .help = "Ramp up time before measuring performance",
2651 .category = FIO_OPT_C_GENERAL,
2652 .group = FIO_OPT_G_RUNTIME,
2655 .name = "clocksource",
2656 .lname = "Clock source",
2657 .type = FIO_OPT_STR,
2658 .cb = fio_clock_source_cb,
2659 .off1 = offsetof(struct thread_options, clocksource),
2660 .help = "What type of timing source to use",
2661 .category = FIO_OPT_C_GENERAL,
2662 .group = FIO_OPT_G_CLOCK,
2664 #ifdef CONFIG_GETTIMEOFDAY
2665 { .ival = "gettimeofday",
2667 .help = "Use gettimeofday(2) for timing",
2670 #ifdef CONFIG_CLOCK_GETTIME
2671 { .ival = "clock_gettime",
2672 .oval = CS_CGETTIME,
2673 .help = "Use clock_gettime(2) for timing",
2676 #ifdef ARCH_HAVE_CPU_CLOCK
2678 .oval = CS_CPUCLOCK,
2679 .help = "Use CPU private clock",
2687 .lname = "I/O Memory",
2688 .type = FIO_OPT_STR,
2690 .off1 = offsetof(struct thread_options, mem_type),
2691 .help = "Backing type for IO buffers",
2693 .category = FIO_OPT_C_IO,
2694 .group = FIO_OPT_G_INVALID,
2698 .help = "Use malloc(3) for IO buffers",
2700 #ifndef CONFIG_NO_SHM
2703 .help = "Use shared memory segments for IO buffers",
2705 #ifdef FIO_HAVE_HUGETLB
2706 { .ival = "shmhuge",
2707 .oval = MEM_SHMHUGE,
2708 .help = "Like shm, but use huge pages",
2714 .help = "Use mmap(2) (file or anon) for IO buffers",
2716 { .ival = "mmapshared",
2717 .oval = MEM_MMAPSHARED,
2718 .help = "Like mmap, but use the shared flag",
2720 #ifdef FIO_HAVE_HUGETLB
2721 { .ival = "mmaphuge",
2722 .oval = MEM_MMAPHUGE,
2723 .help = "Like mmap, but use huge pages",
2727 { .ival = "cudamalloc",
2728 .oval = MEM_CUDA_MALLOC,
2729 .help = "Allocate GPU device memory for GPUDirect RDMA",
2735 .name = "iomem_align",
2736 .alias = "mem_align",
2737 .lname = "I/O memory alignment",
2738 .type = FIO_OPT_INT,
2739 .off1 = offsetof(struct thread_options, mem_align),
2741 .help = "IO memory buffer offset alignment",
2745 .category = FIO_OPT_C_IO,
2746 .group = FIO_OPT_G_INVALID,
2751 .type = FIO_OPT_STR,
2752 .off1 = offsetof(struct thread_options, verify),
2753 .help = "Verify data written",
2755 .category = FIO_OPT_C_IO,
2756 .group = FIO_OPT_G_VERIFY,
2759 .oval = VERIFY_NONE,
2760 .help = "Don't do IO verification",
2764 .help = "Use md5 checksums for verification",
2767 .oval = VERIFY_CRC64,
2768 .help = "Use crc64 checksums for verification",
2771 .oval = VERIFY_CRC32,
2772 .help = "Use crc32 checksums for verification",
2774 { .ival = "crc32c-intel",
2775 .oval = VERIFY_CRC32C,
2776 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2779 .oval = VERIFY_CRC32C,
2780 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2783 .oval = VERIFY_CRC16,
2784 .help = "Use crc16 checksums for verification",
2787 .oval = VERIFY_CRC7,
2788 .help = "Use crc7 checksums for verification",
2791 .oval = VERIFY_SHA1,
2792 .help = "Use sha1 checksums for verification",
2795 .oval = VERIFY_SHA256,
2796 .help = "Use sha256 checksums for verification",
2799 .oval = VERIFY_SHA512,
2800 .help = "Use sha512 checksums for verification",
2802 { .ival = "sha3-224",
2803 .oval = VERIFY_SHA3_224,
2804 .help = "Use sha3-224 checksums for verification",
2806 { .ival = "sha3-256",
2807 .oval = VERIFY_SHA3_256,
2808 .help = "Use sha3-256 checksums for verification",
2810 { .ival = "sha3-384",
2811 .oval = VERIFY_SHA3_384,
2812 .help = "Use sha3-384 checksums for verification",
2814 { .ival = "sha3-512",
2815 .oval = VERIFY_SHA3_512,
2816 .help = "Use sha3-512 checksums for verification",
2819 .oval = VERIFY_XXHASH,
2820 .help = "Use xxhash checksums for verification",
2822 /* Meta information was included into verify_header,
2823 * 'meta' verification is implied by default. */
2825 .oval = VERIFY_HDR_ONLY,
2826 .help = "Use io information for verification. "
2827 "Now is implied by default, thus option is obsolete, "
2830 { .ival = "pattern",
2831 .oval = VERIFY_PATTERN_NO_HDR,
2832 .help = "Verify strict pattern",
2836 .oval = VERIFY_NULL,
2837 .help = "Pretend to verify",
2842 .name = "do_verify",
2843 .lname = "Perform verify step",
2844 .type = FIO_OPT_BOOL,
2845 .off1 = offsetof(struct thread_options, do_verify),
2846 .help = "Run verification stage after write",
2850 .category = FIO_OPT_C_IO,
2851 .group = FIO_OPT_G_VERIFY,
2854 .name = "verifysort",
2855 .lname = "Verify sort",
2856 .type = FIO_OPT_BOOL,
2857 .off1 = offsetof(struct thread_options, verifysort),
2858 .help = "Sort written verify blocks for read back",
2862 .category = FIO_OPT_C_IO,
2863 .group = FIO_OPT_G_VERIFY,
2866 .name = "verifysort_nr",
2867 .lname = "Verify Sort Nr",
2868 .type = FIO_OPT_INT,
2869 .off1 = offsetof(struct thread_options, verifysort_nr),
2870 .help = "Pre-load and sort verify blocks for a read workload",
2875 .category = FIO_OPT_C_IO,
2876 .group = FIO_OPT_G_VERIFY,
2879 .name = "verify_interval",
2880 .lname = "Verify interval",
2881 .type = FIO_OPT_INT,
2882 .off1 = offsetof(struct thread_options, verify_interval),
2883 .minval = 2 * sizeof(struct verify_header),
2884 .help = "Store verify buffer header every N bytes",
2887 .interval = 2 * sizeof(struct verify_header),
2888 .category = FIO_OPT_C_IO,
2889 .group = FIO_OPT_G_VERIFY,
2892 .name = "verify_offset",
2893 .lname = "Verify offset",
2894 .type = FIO_OPT_INT,
2895 .help = "Offset verify header location by N bytes",
2896 .off1 = offsetof(struct thread_options, verify_offset),
2897 .minval = sizeof(struct verify_header),
2900 .category = FIO_OPT_C_IO,
2901 .group = FIO_OPT_G_VERIFY,
2904 .name = "verify_pattern",
2905 .lname = "Verify pattern",
2906 .type = FIO_OPT_STR,
2907 .cb = str_verify_pattern_cb,
2908 .off1 = offsetof(struct thread_options, verify_pattern),
2909 .help = "Fill pattern for IO buffers",
2912 .category = FIO_OPT_C_IO,
2913 .group = FIO_OPT_G_VERIFY,
2916 .name = "verify_fatal",
2917 .lname = "Verify fatal",
2918 .type = FIO_OPT_BOOL,
2919 .off1 = offsetof(struct thread_options, verify_fatal),
2921 .help = "Exit on a single verify failure, don't continue",
2924 .category = FIO_OPT_C_IO,
2925 .group = FIO_OPT_G_VERIFY,
2928 .name = "verify_dump",
2929 .lname = "Verify dump",
2930 .type = FIO_OPT_BOOL,
2931 .off1 = offsetof(struct thread_options, verify_dump),
2933 .help = "Dump contents of good and bad blocks on failure",
2936 .category = FIO_OPT_C_IO,
2937 .group = FIO_OPT_G_VERIFY,
2940 .name = "verify_async",
2941 .lname = "Verify asynchronously",
2942 .type = FIO_OPT_INT,
2943 .off1 = offsetof(struct thread_options, verify_async),
2945 .help = "Number of async verifier threads to use",
2948 .category = FIO_OPT_C_IO,
2949 .group = FIO_OPT_G_VERIFY,
2952 .name = "verify_backlog",
2953 .lname = "Verify backlog",
2954 .type = FIO_OPT_STR_VAL,
2955 .off1 = offsetof(struct thread_options, verify_backlog),
2956 .help = "Verify after this number of blocks are written",
2959 .category = FIO_OPT_C_IO,
2960 .group = FIO_OPT_G_VERIFY,
2963 .name = "verify_backlog_batch",
2964 .lname = "Verify backlog batch",
2965 .type = FIO_OPT_INT,
2966 .off1 = offsetof(struct thread_options, verify_batch),
2967 .help = "Verify this number of IO blocks",
2970 .category = FIO_OPT_C_IO,
2971 .group = FIO_OPT_G_VERIFY,
2973 #ifdef FIO_HAVE_CPU_AFFINITY
2975 .name = "verify_async_cpus",
2976 .lname = "Async verify CPUs",
2977 .type = FIO_OPT_STR,
2978 .cb = str_verify_cpus_allowed_cb,
2979 .off1 = offsetof(struct thread_options, verify_cpumask),
2980 .help = "Set CPUs allowed for async verify threads",
2981 .parent = "verify_async",
2983 .category = FIO_OPT_C_IO,
2984 .group = FIO_OPT_G_VERIFY,
2988 .name = "verify_async_cpus",
2989 .lname = "Async verify CPUs",
2990 .type = FIO_OPT_UNSUPPORTED,
2991 .help = "Your platform does not support CPU affinities",
2995 .name = "experimental_verify",
2996 .lname = "Experimental Verify",
2997 .off1 = offsetof(struct thread_options, experimental_verify),
2998 .type = FIO_OPT_BOOL,
2999 .help = "Enable experimental verification",
3001 .category = FIO_OPT_C_IO,
3002 .group = FIO_OPT_G_VERIFY,
3005 .name = "verify_state_load",
3006 .lname = "Load verify state",
3007 .off1 = offsetof(struct thread_options, verify_state),
3008 .type = FIO_OPT_BOOL,
3009 .help = "Load verify termination state",
3011 .category = FIO_OPT_C_IO,
3012 .group = FIO_OPT_G_VERIFY,
3015 .name = "verify_state_save",
3016 .lname = "Save verify state",
3017 .off1 = offsetof(struct thread_options, verify_state_save),
3018 .type = FIO_OPT_BOOL,
3020 .help = "Save verify state on termination",
3022 .category = FIO_OPT_C_IO,
3023 .group = FIO_OPT_G_VERIFY,
3025 #ifdef FIO_HAVE_TRIM
3027 .name = "trim_percentage",
3028 .lname = "Trim percentage",
3029 .type = FIO_OPT_INT,
3030 .off1 = offsetof(struct thread_options, trim_percentage),
3033 .help = "Number of verify blocks to trim (i.e., discard)",
3038 .category = FIO_OPT_C_IO,
3039 .group = FIO_OPT_G_TRIM,
3042 .name = "trim_verify_zero",
3043 .lname = "Verify trim zero",
3044 .type = FIO_OPT_BOOL,
3045 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3046 .off1 = offsetof(struct thread_options, trim_zero),
3047 .parent = "trim_percentage",
3050 .category = FIO_OPT_C_IO,
3051 .group = FIO_OPT_G_TRIM,
3054 .name = "trim_backlog",
3055 .lname = "Trim backlog",
3056 .type = FIO_OPT_STR_VAL,
3057 .off1 = offsetof(struct thread_options, trim_backlog),
3058 .help = "Trim after this number of blocks are written",
3059 .parent = "trim_percentage",
3062 .category = FIO_OPT_C_IO,
3063 .group = FIO_OPT_G_TRIM,
3066 .name = "trim_backlog_batch",
3067 .lname = "Trim backlog batch",
3068 .type = FIO_OPT_INT,
3069 .off1 = offsetof(struct thread_options, trim_batch),
3070 .help = "Trim this number of IO blocks",
3071 .parent = "trim_percentage",
3074 .category = FIO_OPT_C_IO,
3075 .group = FIO_OPT_G_TRIM,
3079 .name = "trim_percentage",
3080 .lname = "Trim percentage",
3081 .type = FIO_OPT_UNSUPPORTED,
3082 .help = "Fio does not support TRIM on your platform",
3085 .name = "trim_verify_zero",
3086 .lname = "Verify trim zero",
3087 .type = FIO_OPT_UNSUPPORTED,
3088 .help = "Fio does not support TRIM on your platform",
3091 .name = "trim_backlog",
3092 .lname = "Trim backlog",
3093 .type = FIO_OPT_UNSUPPORTED,
3094 .help = "Fio does not support TRIM on your platform",
3097 .name = "trim_backlog_batch",
3098 .lname = "Trim backlog batch",
3099 .type = FIO_OPT_UNSUPPORTED,
3100 .help = "Fio does not support TRIM on your platform",
3104 .name = "write_iolog",
3105 .lname = "Write I/O log",
3106 .type = FIO_OPT_STR_STORE,
3107 .off1 = offsetof(struct thread_options, write_iolog_file),
3108 .help = "Store IO pattern to file",
3109 .category = FIO_OPT_C_IO,
3110 .group = FIO_OPT_G_IOLOG,
3113 .name = "read_iolog",
3114 .lname = "Read I/O log",
3115 .type = FIO_OPT_STR_STORE,
3116 .off1 = offsetof(struct thread_options, read_iolog_file),
3117 .help = "Playback IO pattern from file",
3118 .category = FIO_OPT_C_IO,
3119 .group = FIO_OPT_G_IOLOG,
3122 .name = "replay_no_stall",
3123 .lname = "Don't stall on replay",
3124 .type = FIO_OPT_BOOL,
3125 .off1 = offsetof(struct thread_options, no_stall),
3127 .parent = "read_iolog",
3129 .help = "Playback IO pattern file as fast as possible without stalls",
3130 .category = FIO_OPT_C_IO,
3131 .group = FIO_OPT_G_IOLOG,
3134 .name = "replay_redirect",
3135 .lname = "Redirect device for replay",
3136 .type = FIO_OPT_STR_STORE,
3137 .off1 = offsetof(struct thread_options, replay_redirect),
3138 .parent = "read_iolog",
3140 .help = "Replay all I/O onto this device, regardless of trace device",
3141 .category = FIO_OPT_C_IO,
3142 .group = FIO_OPT_G_IOLOG,
3145 .name = "replay_scale",
3146 .lname = "Replace offset scale factor",
3147 .type = FIO_OPT_INT,
3148 .off1 = offsetof(struct thread_options, replay_scale),
3149 .parent = "read_iolog",
3151 .help = "Align offsets to this blocksize",
3152 .category = FIO_OPT_C_IO,
3153 .group = FIO_OPT_G_IOLOG,
3156 .name = "replay_align",
3157 .lname = "Replace alignment",
3158 .type = FIO_OPT_INT,
3159 .off1 = offsetof(struct thread_options, replay_align),
3160 .parent = "read_iolog",
3161 .help = "Scale offset down by this factor",
3162 .category = FIO_OPT_C_IO,
3163 .group = FIO_OPT_G_IOLOG,
3167 .name = "exec_prerun",
3168 .lname = "Pre-execute runnable",
3169 .type = FIO_OPT_STR_STORE,
3170 .off1 = offsetof(struct thread_options, exec_prerun),
3171 .help = "Execute this file prior to running job",
3172 .category = FIO_OPT_C_GENERAL,
3173 .group = FIO_OPT_G_INVALID,
3176 .name = "exec_postrun",
3177 .lname = "Post-execute runnable",
3178 .type = FIO_OPT_STR_STORE,
3179 .off1 = offsetof(struct thread_options, exec_postrun),
3180 .help = "Execute this file after running job",
3181 .category = FIO_OPT_C_GENERAL,
3182 .group = FIO_OPT_G_INVALID,
3184 #ifdef FIO_HAVE_IOSCHED_SWITCH
3186 .name = "ioscheduler",
3187 .lname = "I/O scheduler",
3188 .type = FIO_OPT_STR_STORE,
3189 .off1 = offsetof(struct thread_options, ioscheduler),
3190 .help = "Use this IO scheduler on the backing device",
3191 .category = FIO_OPT_C_FILE,
3192 .group = FIO_OPT_G_INVALID,
3196 .name = "ioscheduler",
3197 .lname = "I/O scheduler",
3198 .type = FIO_OPT_UNSUPPORTED,
3199 .help = "Your platform does not support IO scheduler switching",
3204 .lname = "Zone size",
3205 .type = FIO_OPT_STR_VAL,
3206 .off1 = offsetof(struct thread_options, zone_size),
3207 .help = "Amount of data to read per zone",
3209 .interval = 1024 * 1024,
3210 .category = FIO_OPT_C_IO,
3211 .group = FIO_OPT_G_ZONE,
3214 .name = "zonerange",
3215 .lname = "Zone range",
3216 .type = FIO_OPT_STR_VAL,
3217 .off1 = offsetof(struct thread_options, zone_range),
3218 .help = "Give size of an IO zone",
3220 .interval = 1024 * 1024,
3221 .category = FIO_OPT_C_IO,
3222 .group = FIO_OPT_G_ZONE,
3226 .lname = "Zone skip",
3227 .type = FIO_OPT_STR_VAL,
3228 .off1 = offsetof(struct thread_options, zone_skip),
3229 .help = "Space between IO zones",
3231 .interval = 1024 * 1024,
3232 .category = FIO_OPT_C_IO,
3233 .group = FIO_OPT_G_ZONE,
3237 .lname = "Lock memory",
3238 .type = FIO_OPT_STR_VAL,
3239 .off1 = offsetof(struct thread_options, lockmem),
3240 .help = "Lock down this amount of memory (per worker)",
3242 .interval = 1024 * 1024,
3243 .category = FIO_OPT_C_GENERAL,
3244 .group = FIO_OPT_G_INVALID,
3247 .name = "rwmixread",
3248 .lname = "Read/write mix read",
3249 .type = FIO_OPT_INT,
3250 .cb = str_rwmix_read_cb,
3251 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3253 .help = "Percentage of mixed workload that is reads",
3256 .inverse = "rwmixwrite",
3257 .category = FIO_OPT_C_IO,
3258 .group = FIO_OPT_G_RWMIX,
3261 .name = "rwmixwrite",
3262 .lname = "Read/write mix write",
3263 .type = FIO_OPT_INT,
3264 .cb = str_rwmix_write_cb,
3265 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3267 .help = "Percentage of mixed workload that is writes",
3270 .inverse = "rwmixread",
3271 .category = FIO_OPT_C_IO,
3272 .group = FIO_OPT_G_RWMIX,
3275 .name = "rwmixcycle",
3276 .lname = "Read/write mix cycle",
3277 .type = FIO_OPT_DEPRECATED,
3278 .category = FIO_OPT_C_IO,
3279 .group = FIO_OPT_G_RWMIX,
3284 .type = FIO_OPT_INT,
3285 .off1 = offsetof(struct thread_options, nice),
3286 .help = "Set job CPU nice value",
3291 .category = FIO_OPT_C_GENERAL,
3292 .group = FIO_OPT_G_CRED,
3294 #ifdef FIO_HAVE_IOPRIO
3297 .lname = "I/O nice priority",
3298 .type = FIO_OPT_INT,
3299 .off1 = offsetof(struct thread_options, ioprio),
3300 .help = "Set job IO priority value",
3301 .minval = IOPRIO_MIN_PRIO,
3302 .maxval = IOPRIO_MAX_PRIO,
3304 .category = FIO_OPT_C_GENERAL,
3305 .group = FIO_OPT_G_CRED,
3310 .lname = "I/O nice priority",
3311 .type = FIO_OPT_UNSUPPORTED,
3312 .help = "Your platform does not support IO priorities",
3315 #ifdef FIO_HAVE_IOPRIO_CLASS
3316 #ifndef FIO_HAVE_IOPRIO
3317 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3320 .name = "prioclass",
3321 .lname = "I/O nice priority class",
3322 .type = FIO_OPT_INT,
3323 .off1 = offsetof(struct thread_options, ioprio_class),
3324 .help = "Set job IO priority class",
3325 .minval = IOPRIO_MIN_PRIO_CLASS,
3326 .maxval = IOPRIO_MAX_PRIO_CLASS,
3328 .category = FIO_OPT_C_GENERAL,
3329 .group = FIO_OPT_G_CRED,
3333 .name = "prioclass",
3334 .lname = "I/O nice priority class",
3335 .type = FIO_OPT_UNSUPPORTED,
3336 .help = "Your platform does not support IO priority classes",
3340 .name = "thinktime",
3341 .lname = "Thinktime",
3342 .type = FIO_OPT_INT,
3343 .off1 = offsetof(struct thread_options, thinktime),
3344 .help = "Idle time between IO buffers (usec)",
3347 .category = FIO_OPT_C_IO,
3348 .group = FIO_OPT_G_THINKTIME,
3351 .name = "thinktime_spin",
3352 .lname = "Thinktime spin",
3353 .type = FIO_OPT_INT,
3354 .off1 = offsetof(struct thread_options, thinktime_spin),
3355 .help = "Start think time by spinning this amount (usec)",
3358 .parent = "thinktime",
3360 .category = FIO_OPT_C_IO,
3361 .group = FIO_OPT_G_THINKTIME,
3364 .name = "thinktime_blocks",
3365 .lname = "Thinktime blocks",
3366 .type = FIO_OPT_INT,
3367 .off1 = offsetof(struct thread_options, thinktime_blocks),
3368 .help = "IO buffer period between 'thinktime'",
3370 .parent = "thinktime",
3372 .category = FIO_OPT_C_IO,
3373 .group = FIO_OPT_G_THINKTIME,
3377 .lname = "I/O rate",
3378 .type = FIO_OPT_INT,
3379 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3380 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3381 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
3382 .help = "Set bandwidth rate",
3383 .category = FIO_OPT_C_IO,
3384 .group = FIO_OPT_G_RATE,
3389 .lname = "I/O min rate",
3390 .type = FIO_OPT_INT,
3391 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
3392 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
3393 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
3394 .help = "Job must meet this rate or it will be shutdown",
3397 .category = FIO_OPT_C_IO,
3398 .group = FIO_OPT_G_RATE,
3401 .name = "rate_iops",
3402 .lname = "I/O rate IOPS",
3403 .type = FIO_OPT_INT,
3404 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
3405 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
3406 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
3407 .help = "Limit IO used to this number of IO operations/sec",
3409 .category = FIO_OPT_C_IO,
3410 .group = FIO_OPT_G_RATE,
3413 .name = "rate_iops_min",
3414 .lname = "I/O min rate IOPS",
3415 .type = FIO_OPT_INT,
3416 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
3417 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
3418 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
3419 .help = "Job must meet this rate or it will be shut down",
3420 .parent = "rate_iops",
3422 .category = FIO_OPT_C_IO,
3423 .group = FIO_OPT_G_RATE,
3426 .name = "rate_process",
3427 .lname = "Rate Process",
3428 .type = FIO_OPT_STR,
3429 .off1 = offsetof(struct thread_options, rate_process),
3430 .help = "What process controls how rated IO is managed",
3432 .category = FIO_OPT_C_IO,
3433 .group = FIO_OPT_G_RATE,
3436 .oval = RATE_PROCESS_LINEAR,
3437 .help = "Linear rate of IO",
3441 .oval = RATE_PROCESS_POISSON,
3442 .help = "Rate follows Poisson process",
3448 .name = "rate_cycle",
3449 .alias = "ratecycle",
3450 .lname = "I/O rate cycle",
3451 .type = FIO_OPT_INT,
3452 .off1 = offsetof(struct thread_options, ratecycle),
3453 .help = "Window average for rate limits (msec)",
3457 .category = FIO_OPT_C_IO,
3458 .group = FIO_OPT_G_RATE,
3461 .name = "max_latency",
3462 .lname = "Max Latency (usec)",
3463 .type = FIO_OPT_STR_VAL_TIME,
3464 .off1 = offsetof(struct thread_options, max_latency),
3465 .help = "Maximum tolerated IO latency (usec)",
3467 .category = FIO_OPT_C_IO,
3468 .group = FIO_OPT_G_LATPROF,
3471 .name = "latency_target",
3472 .lname = "Latency Target (usec)",
3473 .type = FIO_OPT_STR_VAL_TIME,
3474 .off1 = offsetof(struct thread_options, latency_target),
3475 .help = "Ramp to max queue depth supporting this latency",
3477 .category = FIO_OPT_C_IO,
3478 .group = FIO_OPT_G_LATPROF,
3481 .name = "latency_window",
3482 .lname = "Latency Window (usec)",
3483 .type = FIO_OPT_STR_VAL_TIME,
3484 .off1 = offsetof(struct thread_options, latency_window),
3485 .help = "Time to sustain latency_target",
3487 .category = FIO_OPT_C_IO,
3488 .group = FIO_OPT_G_LATPROF,
3491 .name = "latency_percentile",
3492 .lname = "Latency Percentile",
3493 .type = FIO_OPT_FLOAT_LIST,
3494 .off1 = offsetof(struct thread_options, latency_percentile),
3495 .help = "Percentile of IOs must be below latency_target",
3500 .category = FIO_OPT_C_IO,
3501 .group = FIO_OPT_G_LATPROF,
3504 .name = "invalidate",
3505 .lname = "Cache invalidate",
3506 .type = FIO_OPT_BOOL,
3507 .off1 = offsetof(struct thread_options, invalidate_cache),
3508 .help = "Invalidate buffer/page cache prior to running job",
3510 .category = FIO_OPT_C_IO,
3511 .group = FIO_OPT_G_IO_TYPE,
3515 .lname = "Synchronous I/O",
3516 .type = FIO_OPT_BOOL,
3517 .off1 = offsetof(struct thread_options, sync_io),
3518 .help = "Use O_SYNC for buffered writes",
3520 .parent = "buffered",
3522 .category = FIO_OPT_C_IO,
3523 .group = FIO_OPT_G_IO_TYPE,
3525 #ifdef FIO_HAVE_WRITE_HINT
3527 .name = "write_hint",
3528 .lname = "Write hint",
3529 .type = FIO_OPT_STR,
3530 .off1 = offsetof(struct thread_options, write_hint),
3531 .help = "Set expected write life time",
3532 .category = FIO_OPT_C_ENGINE,
3533 .group = FIO_OPT_G_INVALID,
3536 .oval = RWH_WRITE_LIFE_NONE,
3539 .oval = RWH_WRITE_LIFE_SHORT,
3542 .oval = RWH_WRITE_LIFE_MEDIUM,
3545 .oval = RWH_WRITE_LIFE_LONG,
3547 { .ival = "extreme",
3548 .oval = RWH_WRITE_LIFE_EXTREME,
3554 .name = "create_serialize",
3555 .lname = "Create serialize",
3556 .type = FIO_OPT_BOOL,
3557 .off1 = offsetof(struct thread_options, create_serialize),
3558 .help = "Serialize creation of job files",
3560 .category = FIO_OPT_C_FILE,
3561 .group = FIO_OPT_G_INVALID,
3564 .name = "create_fsync",
3565 .lname = "Create fsync",
3566 .type = FIO_OPT_BOOL,
3567 .off1 = offsetof(struct thread_options, create_fsync),
3568 .help = "fsync file after creation",
3570 .category = FIO_OPT_C_FILE,
3571 .group = FIO_OPT_G_INVALID,
3574 .name = "create_on_open",
3575 .lname = "Create on open",
3576 .type = FIO_OPT_BOOL,
3577 .off1 = offsetof(struct thread_options, create_on_open),
3578 .help = "Create files when they are opened for IO",
3580 .category = FIO_OPT_C_FILE,
3581 .group = FIO_OPT_G_INVALID,
3584 .name = "create_only",
3585 .lname = "Create Only",
3586 .type = FIO_OPT_BOOL,
3587 .off1 = offsetof(struct thread_options, create_only),
3588 .help = "Only perform file creation phase",
3589 .category = FIO_OPT_C_FILE,
3593 .name = "allow_file_create",
3594 .lname = "Allow file create",
3595 .type = FIO_OPT_BOOL,
3596 .off1 = offsetof(struct thread_options, allow_create),
3597 .help = "Permit fio to create files, if they don't exist",
3599 .category = FIO_OPT_C_FILE,
3600 .group = FIO_OPT_G_FILENAME,
3603 .name = "allow_mounted_write",
3604 .lname = "Allow mounted write",
3605 .type = FIO_OPT_BOOL,
3606 .off1 = offsetof(struct thread_options, allow_mounted_write),
3607 .help = "Allow writes to a mounted partition",
3609 .category = FIO_OPT_C_FILE,
3610 .group = FIO_OPT_G_FILENAME,
3614 .lname = "Pre-read files",
3615 .type = FIO_OPT_BOOL,
3616 .off1 = offsetof(struct thread_options, pre_read),
3617 .help = "Pre-read files before starting official testing",
3619 .category = FIO_OPT_C_FILE,
3620 .group = FIO_OPT_G_INVALID,
3622 #ifdef FIO_HAVE_CPU_AFFINITY
3625 .lname = "CPU mask",
3626 .type = FIO_OPT_INT,
3627 .cb = str_cpumask_cb,
3628 .off1 = offsetof(struct thread_options, cpumask),
3629 .help = "CPU affinity mask",
3630 .category = FIO_OPT_C_GENERAL,
3631 .group = FIO_OPT_G_CRED,
3634 .name = "cpus_allowed",
3635 .lname = "CPUs allowed",
3636 .type = FIO_OPT_STR,
3637 .cb = str_cpus_allowed_cb,
3638 .off1 = offsetof(struct thread_options, cpumask),
3639 .help = "Set CPUs allowed",
3640 .category = FIO_OPT_C_GENERAL,
3641 .group = FIO_OPT_G_CRED,
3644 .name = "cpus_allowed_policy",
3645 .lname = "CPUs allowed distribution policy",
3646 .type = FIO_OPT_STR,
3647 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
3648 .help = "Distribution policy for cpus_allowed",
3649 .parent = "cpus_allowed",
3653 .oval = FIO_CPUS_SHARED,
3654 .help = "Mask shared between threads",
3657 .oval = FIO_CPUS_SPLIT,
3658 .help = "Mask split between threads",
3661 .category = FIO_OPT_C_GENERAL,
3662 .group = FIO_OPT_G_CRED,
3667 .lname = "CPU mask",
3668 .type = FIO_OPT_UNSUPPORTED,
3669 .help = "Your platform does not support CPU affinities",
3672 .name = "cpus_allowed",
3673 .lname = "CPUs allowed",
3674 .type = FIO_OPT_UNSUPPORTED,
3675 .help = "Your platform does not support CPU affinities",
3678 .name = "cpus_allowed_policy",
3679 .lname = "CPUs allowed distribution policy",
3680 .type = FIO_OPT_UNSUPPORTED,
3681 .help = "Your platform does not support CPU affinities",
3684 #ifdef CONFIG_LIBNUMA
3686 .name = "numa_cpu_nodes",
3687 .lname = "NUMA CPU Nodes",
3688 .type = FIO_OPT_STR,
3689 .cb = str_numa_cpunodes_cb,
3690 .off1 = offsetof(struct thread_options, numa_cpunodes),
3691 .help = "NUMA CPU nodes bind",
3692 .category = FIO_OPT_C_GENERAL,
3693 .group = FIO_OPT_G_INVALID,
3696 .name = "numa_mem_policy",
3697 .lname = "NUMA Memory Policy",
3698 .type = FIO_OPT_STR,
3699 .cb = str_numa_mpol_cb,
3700 .off1 = offsetof(struct thread_options, numa_memnodes),
3701 .help = "NUMA memory policy setup",
3702 .category = FIO_OPT_C_GENERAL,
3703 .group = FIO_OPT_G_INVALID,
3707 .name = "numa_cpu_nodes",
3708 .lname = "NUMA CPU Nodes",
3709 .type = FIO_OPT_UNSUPPORTED,
3710 .help = "Build fio with libnuma-dev(el) to enable this option",
3713 .name = "numa_mem_policy",
3714 .lname = "NUMA Memory Policy",
3715 .type = FIO_OPT_UNSUPPORTED,
3716 .help = "Build fio with libnuma-dev(el) to enable this option",
3721 .name = "gpu_dev_id",
3722 .lname = "GPU device ID",
3723 .type = FIO_OPT_INT,
3724 .off1 = offsetof(struct thread_options, gpu_dev_id),
3725 .help = "Set GPU device ID for GPUDirect RDMA",
3727 .category = FIO_OPT_C_GENERAL,
3728 .group = FIO_OPT_G_INVALID,
3732 .name = "end_fsync",
3733 .lname = "End fsync",
3734 .type = FIO_OPT_BOOL,
3735 .off1 = offsetof(struct thread_options, end_fsync),
3736 .help = "Include fsync at the end of job",
3738 .category = FIO_OPT_C_FILE,
3739 .group = FIO_OPT_G_INVALID,
3742 .name = "fsync_on_close",
3743 .lname = "Fsync on close",
3744 .type = FIO_OPT_BOOL,
3745 .off1 = offsetof(struct thread_options, fsync_on_close),
3746 .help = "fsync files on close",
3748 .category = FIO_OPT_C_FILE,
3749 .group = FIO_OPT_G_INVALID,
3753 .lname = "Unlink file",
3754 .type = FIO_OPT_BOOL,
3755 .off1 = offsetof(struct thread_options, unlink),
3756 .help = "Unlink created files after job has completed",
3758 .category = FIO_OPT_C_FILE,
3759 .group = FIO_OPT_G_INVALID,
3762 .name = "unlink_each_loop",
3763 .lname = "Unlink file after each loop of a job",
3764 .type = FIO_OPT_BOOL,
3765 .off1 = offsetof(struct thread_options, unlink_each_loop),
3766 .help = "Unlink created files after each loop in a job has completed",
3768 .category = FIO_OPT_C_FILE,
3769 .group = FIO_OPT_G_INVALID,
3773 .lname = "Exit-all on terminate",
3774 .type = FIO_OPT_STR_SET,
3775 .cb = str_exitall_cb,
3776 .help = "Terminate all jobs when one exits",
3777 .category = FIO_OPT_C_GENERAL,
3778 .group = FIO_OPT_G_PROCESS,
3781 .name = "exitall_on_error",
3782 .lname = "Exit-all on terminate in error",
3783 .type = FIO_OPT_STR_SET,
3784 .off1 = offsetof(struct thread_options, exitall_error),
3785 .help = "Terminate all jobs when one exits in error",
3786 .category = FIO_OPT_C_GENERAL,
3787 .group = FIO_OPT_G_PROCESS,
3790 .name = "stonewall",
3791 .lname = "Wait for previous",
3792 .alias = "wait_for_previous",
3793 .type = FIO_OPT_STR_SET,
3794 .off1 = offsetof(struct thread_options, stonewall),
3795 .help = "Insert a hard barrier between this job and previous",
3796 .category = FIO_OPT_C_GENERAL,
3797 .group = FIO_OPT_G_PROCESS,
3800 .name = "new_group",
3801 .lname = "New group",
3802 .type = FIO_OPT_STR_SET,
3803 .off1 = offsetof(struct thread_options, new_group),
3804 .help = "Mark the start of a new group (for reporting)",
3805 .category = FIO_OPT_C_GENERAL,
3806 .group = FIO_OPT_G_PROCESS,
3811 .type = FIO_OPT_STR_SET,
3812 .off1 = offsetof(struct thread_options, use_thread),
3813 .help = "Use threads instead of processes",
3814 #ifdef CONFIG_NO_SHM
3818 .category = FIO_OPT_C_GENERAL,
3819 .group = FIO_OPT_G_PROCESS,
3822 .name = "per_job_logs",
3823 .lname = "Per Job Logs",
3824 .type = FIO_OPT_BOOL,
3825 .off1 = offsetof(struct thread_options, per_job_logs),
3826 .help = "Include job number in generated log files or not",
3828 .category = FIO_OPT_C_LOG,
3829 .group = FIO_OPT_G_INVALID,
3832 .name = "write_bw_log",
3833 .lname = "Write bandwidth log",
3834 .type = FIO_OPT_STR,
3835 .off1 = offsetof(struct thread_options, bw_log_file),
3836 .cb = str_write_bw_log_cb,
3837 .help = "Write log of bandwidth during run",
3838 .category = FIO_OPT_C_LOG,
3839 .group = FIO_OPT_G_INVALID,
3842 .name = "write_lat_log",
3843 .lname = "Write latency log",
3844 .type = FIO_OPT_STR,
3845 .off1 = offsetof(struct thread_options, lat_log_file),
3846 .cb = str_write_lat_log_cb,
3847 .help = "Write log of latency during run",
3848 .category = FIO_OPT_C_LOG,
3849 .group = FIO_OPT_G_INVALID,
3852 .name = "write_iops_log",
3853 .lname = "Write IOPS log",
3854 .type = FIO_OPT_STR,
3855 .off1 = offsetof(struct thread_options, iops_log_file),
3856 .cb = str_write_iops_log_cb,
3857 .help = "Write log of IOPS during run",
3858 .category = FIO_OPT_C_LOG,
3859 .group = FIO_OPT_G_INVALID,
3862 .name = "log_avg_msec",
3863 .lname = "Log averaging (msec)",
3864 .type = FIO_OPT_INT,
3865 .off1 = offsetof(struct thread_options, log_avg_msec),
3866 .help = "Average bw/iops/lat logs over this period of time",
3868 .category = FIO_OPT_C_LOG,
3869 .group = FIO_OPT_G_INVALID,
3872 .name = "log_hist_msec",
3873 .lname = "Log histograms (msec)",
3874 .type = FIO_OPT_INT,
3875 .off1 = offsetof(struct thread_options, log_hist_msec),
3876 .help = "Dump completion latency histograms at frequency of this time value",
3878 .category = FIO_OPT_C_LOG,
3879 .group = FIO_OPT_G_INVALID,
3882 .name = "log_hist_coarseness",
3883 .lname = "Histogram logs coarseness",
3884 .type = FIO_OPT_INT,
3885 .off1 = offsetof(struct thread_options, log_hist_coarseness),
3886 .help = "Integer in range [0,6]. Higher coarseness outputs"
3887 " fewer histogram bins per sample. The number of bins for"
3888 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
3890 .category = FIO_OPT_C_LOG,
3891 .group = FIO_OPT_G_INVALID,
3894 .name = "write_hist_log",
3895 .lname = "Write latency histogram logs",
3896 .type = FIO_OPT_STR,
3897 .off1 = offsetof(struct thread_options, hist_log_file),
3898 .cb = str_write_hist_log_cb,
3899 .help = "Write log of latency histograms during run",
3900 .category = FIO_OPT_C_LOG,
3901 .group = FIO_OPT_G_INVALID,
3904 .name = "log_max_value",
3905 .lname = "Log maximum instead of average",
3906 .type = FIO_OPT_BOOL,
3907 .off1 = offsetof(struct thread_options, log_max),
3908 .help = "Log max sample in a window instead of average",
3910 .category = FIO_OPT_C_LOG,
3911 .group = FIO_OPT_G_INVALID,
3914 .name = "log_offset",
3915 .lname = "Log offset of IO",
3916 .type = FIO_OPT_BOOL,
3917 .off1 = offsetof(struct thread_options, log_offset),
3918 .help = "Include offset of IO for each log entry",
3920 .category = FIO_OPT_C_LOG,
3921 .group = FIO_OPT_G_INVALID,
3925 .name = "log_compression",
3926 .lname = "Log compression",
3927 .type = FIO_OPT_INT,
3928 .off1 = offsetof(struct thread_options, log_gz),
3929 .help = "Log in compressed chunks of this size",
3931 .maxval = 512 * 1024 * 1024ULL,
3932 .category = FIO_OPT_C_LOG,
3933 .group = FIO_OPT_G_INVALID,
3935 #ifdef FIO_HAVE_CPU_AFFINITY
3937 .name = "log_compression_cpus",
3938 .lname = "Log Compression CPUs",
3939 .type = FIO_OPT_STR,
3940 .cb = str_log_cpus_allowed_cb,
3941 .off1 = offsetof(struct thread_options, log_gz_cpumask),
3942 .parent = "log_compression",
3943 .help = "Limit log compression to these CPUs",
3944 .category = FIO_OPT_C_LOG,
3945 .group = FIO_OPT_G_INVALID,
3949 .name = "log_compression_cpus",
3950 .lname = "Log Compression CPUs",
3951 .type = FIO_OPT_UNSUPPORTED,
3952 .help = "Your platform does not support CPU affinities",
3956 .name = "log_store_compressed",
3957 .lname = "Log store compressed",
3958 .type = FIO_OPT_BOOL,
3959 .off1 = offsetof(struct thread_options, log_gz_store),
3960 .help = "Store logs in a compressed format",
3961 .category = FIO_OPT_C_LOG,
3962 .group = FIO_OPT_G_INVALID,
3966 .name = "log_compression",
3967 .lname = "Log compression",
3968 .type = FIO_OPT_UNSUPPORTED,
3969 .help = "Install libz-dev(el) to get compression support",
3972 .name = "log_store_compressed",
3973 .lname = "Log store compressed",
3974 .type = FIO_OPT_UNSUPPORTED,
3975 .help = "Install libz-dev(el) to get compression support",
3979 .name = "log_unix_epoch",
3980 .lname = "Log epoch unix",
3981 .type = FIO_OPT_BOOL,
3982 .off1 = offsetof(struct thread_options, log_unix_epoch),
3983 .help = "Use Unix time in log files",
3984 .category = FIO_OPT_C_LOG,
3985 .group = FIO_OPT_G_INVALID,
3988 .name = "block_error_percentiles",
3989 .lname = "Block error percentiles",
3990 .type = FIO_OPT_BOOL,
3991 .off1 = offsetof(struct thread_options, block_error_hist),
3992 .help = "Record trim block errors and make a histogram",
3994 .category = FIO_OPT_C_LOG,
3995 .group = FIO_OPT_G_INVALID,
3998 .name = "bwavgtime",
3999 .lname = "Bandwidth average time",
4000 .type = FIO_OPT_INT,
4001 .off1 = offsetof(struct thread_options, bw_avg_time),
4002 .help = "Time window over which to calculate bandwidth"
4005 .parent = "write_bw_log",
4008 .category = FIO_OPT_C_LOG,
4009 .group = FIO_OPT_G_INVALID,
4012 .name = "iopsavgtime",
4013 .lname = "IOPS average time",
4014 .type = FIO_OPT_INT,
4015 .off1 = offsetof(struct thread_options, iops_avg_time),
4016 .help = "Time window over which to calculate IOPS (msec)",
4018 .parent = "write_iops_log",
4021 .category = FIO_OPT_C_LOG,
4022 .group = FIO_OPT_G_INVALID,
4025 .name = "group_reporting",
4026 .lname = "Group reporting",
4027 .type = FIO_OPT_STR_SET,
4028 .off1 = offsetof(struct thread_options, group_reporting),
4029 .help = "Do reporting on a per-group basis",
4030 .category = FIO_OPT_C_STAT,
4031 .group = FIO_OPT_G_INVALID,
4036 .type = FIO_OPT_BOOL,
4037 .off1 = offsetof(struct thread_options, stats),
4038 .help = "Enable collection of stats",
4040 .category = FIO_OPT_C_STAT,
4041 .group = FIO_OPT_G_INVALID,
4044 .name = "zero_buffers",
4045 .lname = "Zero I/O buffers",
4046 .type = FIO_OPT_STR_SET,
4047 .off1 = offsetof(struct thread_options, zero_buffers),
4048 .help = "Init IO buffers to all zeroes",
4049 .category = FIO_OPT_C_IO,
4050 .group = FIO_OPT_G_IO_BUF,
4053 .name = "refill_buffers",
4054 .lname = "Refill I/O buffers",
4055 .type = FIO_OPT_STR_SET,
4056 .off1 = offsetof(struct thread_options, refill_buffers),
4057 .help = "Refill IO buffers on every IO submit",
4058 .category = FIO_OPT_C_IO,
4059 .group = FIO_OPT_G_IO_BUF,
4062 .name = "scramble_buffers",
4063 .lname = "Scramble I/O buffers",
4064 .type = FIO_OPT_BOOL,
4065 .off1 = offsetof(struct thread_options, scramble_buffers),
4066 .help = "Slightly scramble buffers on every IO submit",
4068 .category = FIO_OPT_C_IO,
4069 .group = FIO_OPT_G_IO_BUF,
4072 .name = "buffer_pattern",
4073 .lname = "Buffer pattern",
4074 .type = FIO_OPT_STR,
4075 .cb = str_buffer_pattern_cb,
4076 .off1 = offsetof(struct thread_options, buffer_pattern),
4077 .help = "Fill pattern for IO buffers",
4078 .category = FIO_OPT_C_IO,
4079 .group = FIO_OPT_G_IO_BUF,
4082 .name = "buffer_compress_percentage",
4083 .lname = "Buffer compression percentage",
4084 .type = FIO_OPT_INT,
4085 .cb = str_buffer_compress_cb,
4086 .off1 = offsetof(struct thread_options, compress_percentage),
4089 .help = "How compressible the buffer is (approximately)",
4091 .category = FIO_OPT_C_IO,
4092 .group = FIO_OPT_G_IO_BUF,
4095 .name = "buffer_compress_chunk",
4096 .lname = "Buffer compression chunk size",
4097 .type = FIO_OPT_INT,
4098 .off1 = offsetof(struct thread_options, compress_chunk),
4099 .parent = "buffer_compress_percentage",
4101 .help = "Size of compressible region in buffer",
4104 .category = FIO_OPT_C_IO,
4105 .group = FIO_OPT_G_IO_BUF,
4108 .name = "dedupe_percentage",
4109 .lname = "Dedupe percentage",
4110 .type = FIO_OPT_INT,
4111 .cb = str_dedupe_cb,
4112 .off1 = offsetof(struct thread_options, dedupe_percentage),
4115 .help = "Percentage of buffers that are dedupable",
4117 .category = FIO_OPT_C_IO,
4118 .group = FIO_OPT_G_IO_BUF,
4121 .name = "clat_percentiles",
4122 .lname = "Completion latency percentiles",
4123 .type = FIO_OPT_BOOL,
4124 .off1 = offsetof(struct thread_options, clat_percentiles),
4125 .help = "Enable the reporting of completion latency percentiles",
4127 .inverse = "lat_percentiles",
4128 .category = FIO_OPT_C_STAT,
4129 .group = FIO_OPT_G_INVALID,
4132 .name = "lat_percentiles",
4133 .lname = "IO latency percentiles",
4134 .type = FIO_OPT_BOOL,
4135 .off1 = offsetof(struct thread_options, lat_percentiles),
4136 .help = "Enable the reporting of IO latency percentiles",
4138 .inverse = "clat_percentiles",
4139 .category = FIO_OPT_C_STAT,
4140 .group = FIO_OPT_G_INVALID,
4143 .name = "percentile_list",
4144 .lname = "Percentile list",
4145 .type = FIO_OPT_FLOAT_LIST,
4146 .off1 = offsetof(struct thread_options, percentile_list),
4147 .off2 = offsetof(struct thread_options, percentile_precision),
4148 .help = "Specify a custom list of percentiles to report for "
4149 "completion latency and block errors",
4150 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
4151 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4154 .category = FIO_OPT_C_STAT,
4155 .group = FIO_OPT_G_INVALID,
4158 .name = "significant_figures",
4159 .lname = "Significant figures",
4160 .type = FIO_OPT_INT,
4161 .off1 = offsetof(struct thread_options, sig_figs),
4164 .help = "Significant figures for output-format set to normal",
4167 .category = FIO_OPT_C_STAT,
4168 .group = FIO_OPT_G_INVALID,
4171 #ifdef FIO_HAVE_DISK_UTIL
4173 .name = "disk_util",
4174 .lname = "Disk utilization",
4175 .type = FIO_OPT_BOOL,
4176 .off1 = offsetof(struct thread_options, do_disk_util),
4177 .help = "Log disk utilization statistics",
4179 .category = FIO_OPT_C_STAT,
4180 .group = FIO_OPT_G_INVALID,
4184 .name = "disk_util",
4185 .lname = "Disk utilization",
4186 .type = FIO_OPT_UNSUPPORTED,
4187 .help = "Your platform does not support disk utilization",
4191 .name = "gtod_reduce",
4192 .lname = "Reduce gettimeofday() calls",
4193 .type = FIO_OPT_BOOL,
4194 .help = "Greatly reduce number of gettimeofday() calls",
4195 .cb = str_gtod_reduce_cb,
4198 .category = FIO_OPT_C_STAT,
4199 .group = FIO_OPT_G_INVALID,
4202 .name = "disable_lat",
4203 .lname = "Disable all latency stats",
4204 .type = FIO_OPT_BOOL,
4205 .off1 = offsetof(struct thread_options, disable_lat),
4206 .help = "Disable latency numbers",
4207 .parent = "gtod_reduce",
4210 .category = FIO_OPT_C_STAT,
4211 .group = FIO_OPT_G_INVALID,
4214 .name = "disable_clat",
4215 .lname = "Disable completion latency stats",
4216 .type = FIO_OPT_BOOL,
4217 .off1 = offsetof(struct thread_options, disable_clat),
4218 .help = "Disable completion latency numbers",
4219 .parent = "gtod_reduce",
4222 .category = FIO_OPT_C_STAT,
4223 .group = FIO_OPT_G_INVALID,
4226 .name = "disable_slat",
4227 .lname = "Disable submission latency stats",
4228 .type = FIO_OPT_BOOL,
4229 .off1 = offsetof(struct thread_options, disable_slat),
4230 .help = "Disable submission latency numbers",
4231 .parent = "gtod_reduce",
4234 .category = FIO_OPT_C_STAT,
4235 .group = FIO_OPT_G_INVALID,
4238 .name = "disable_bw_measurement",
4239 .alias = "disable_bw",
4240 .lname = "Disable bandwidth stats",
4241 .type = FIO_OPT_BOOL,
4242 .off1 = offsetof(struct thread_options, disable_bw),
4243 .help = "Disable bandwidth logging",
4244 .parent = "gtod_reduce",
4247 .category = FIO_OPT_C_STAT,
4248 .group = FIO_OPT_G_INVALID,
4252 .lname = "Dedicated gettimeofday() CPU",
4253 .type = FIO_OPT_INT,
4254 .off1 = offsetof(struct thread_options, gtod_cpu),
4255 .help = "Set up dedicated gettimeofday() thread on this CPU",
4256 .verify = gtod_cpu_verify,
4257 .category = FIO_OPT_C_GENERAL,
4258 .group = FIO_OPT_G_CLOCK,
4261 .name = "unified_rw_reporting",
4262 .lname = "Unified RW Reporting",
4263 .type = FIO_OPT_BOOL,
4264 .off1 = offsetof(struct thread_options, unified_rw_rep),
4265 .help = "Unify reporting across data direction",
4267 .category = FIO_OPT_C_GENERAL,
4268 .group = FIO_OPT_G_INVALID,
4271 .name = "continue_on_error",
4272 .lname = "Continue on error",
4273 .type = FIO_OPT_STR,
4274 .off1 = offsetof(struct thread_options, continue_on_error),
4275 .help = "Continue on non-fatal errors during IO",
4277 .category = FIO_OPT_C_GENERAL,
4278 .group = FIO_OPT_G_ERR,
4281 .oval = ERROR_TYPE_NONE,
4282 .help = "Exit when an error is encountered",
4285 .oval = ERROR_TYPE_READ,
4286 .help = "Continue on read errors only",
4289 .oval = ERROR_TYPE_WRITE,
4290 .help = "Continue on write errors only",
4293 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
4294 .help = "Continue on any IO errors",
4297 .oval = ERROR_TYPE_VERIFY,
4298 .help = "Continue on verify errors only",
4301 .oval = ERROR_TYPE_ANY,
4302 .help = "Continue on all io and verify errors",
4305 .oval = ERROR_TYPE_NONE,
4306 .help = "Alias for 'none'",
4309 .oval = ERROR_TYPE_ANY,
4310 .help = "Alias for 'all'",
4315 .name = "ignore_error",
4316 .lname = "Ignore Error",
4317 .type = FIO_OPT_STR,
4318 .cb = str_ignore_error_cb,
4319 .off1 = offsetof(struct thread_options, ignore_error_nr),
4320 .help = "Set a specific list of errors to ignore",
4322 .category = FIO_OPT_C_GENERAL,
4323 .group = FIO_OPT_G_ERR,
4326 .name = "error_dump",
4327 .lname = "Error Dump",
4328 .type = FIO_OPT_BOOL,
4329 .off1 = offsetof(struct thread_options, error_dump),
4331 .help = "Dump info on each error",
4332 .category = FIO_OPT_C_GENERAL,
4333 .group = FIO_OPT_G_ERR,
4338 .type = FIO_OPT_STR_STORE,
4339 .off1 = offsetof(struct thread_options, profile),
4340 .help = "Select a specific builtin performance test",
4341 .category = FIO_OPT_C_PROFILE,
4342 .group = FIO_OPT_G_INVALID,
4347 .type = FIO_OPT_STR_STORE,
4348 .off1 = offsetof(struct thread_options, cgroup),
4349 .help = "Add job to cgroup of this name",
4350 .category = FIO_OPT_C_GENERAL,
4351 .group = FIO_OPT_G_CGROUP,
4354 .name = "cgroup_nodelete",
4355 .lname = "Cgroup no-delete",
4356 .type = FIO_OPT_BOOL,
4357 .off1 = offsetof(struct thread_options, cgroup_nodelete),
4358 .help = "Do not delete cgroups after job completion",
4361 .category = FIO_OPT_C_GENERAL,
4362 .group = FIO_OPT_G_CGROUP,
4365 .name = "cgroup_weight",
4366 .lname = "Cgroup weight",
4367 .type = FIO_OPT_INT,
4368 .off1 = offsetof(struct thread_options, cgroup_weight),
4369 .help = "Use given weight for cgroup",
4373 .category = FIO_OPT_C_GENERAL,
4374 .group = FIO_OPT_G_CGROUP,
4379 .type = FIO_OPT_INT,
4380 .off1 = offsetof(struct thread_options, uid),
4381 .help = "Run job with this user ID",
4382 .category = FIO_OPT_C_GENERAL,
4383 .group = FIO_OPT_G_CRED,
4387 .lname = "Group ID",
4388 .type = FIO_OPT_INT,
4389 .off1 = offsetof(struct thread_options, gid),
4390 .help = "Run job with this group ID",
4391 .category = FIO_OPT_C_GENERAL,
4392 .group = FIO_OPT_G_CRED,
4397 .type = FIO_OPT_INT,
4398 .off1 = offsetof(struct thread_options, kb_base),
4404 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
4408 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
4411 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
4412 .category = FIO_OPT_C_GENERAL,
4413 .group = FIO_OPT_G_INVALID,
4416 .name = "unit_base",
4417 .lname = "Unit for quantities of data (Bits or Bytes)",
4418 .type = FIO_OPT_INT,
4419 .off1 = offsetof(struct thread_options, unit_base),
4424 .help = "Auto-detect",
4428 .help = "Normal (byte based)",
4432 .help = "Bit based",
4435 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
4436 .category = FIO_OPT_C_GENERAL,
4437 .group = FIO_OPT_G_INVALID,
4440 .name = "hugepage-size",
4441 .lname = "Hugepage size",
4442 .type = FIO_OPT_INT,
4443 .off1 = offsetof(struct thread_options, hugepage_size),
4444 .help = "When using hugepages, specify size of each page",
4445 .def = __fio_stringify(FIO_HUGE_PAGE),
4446 .interval = 1024 * 1024,
4447 .category = FIO_OPT_C_GENERAL,
4448 .group = FIO_OPT_G_INVALID,
4452 .lname = "I/O flow ID",
4453 .type = FIO_OPT_INT,
4454 .off1 = offsetof(struct thread_options, flow_id),
4455 .help = "The flow index ID to use",
4457 .category = FIO_OPT_C_IO,
4458 .group = FIO_OPT_G_IO_FLOW,
4462 .lname = "I/O flow weight",
4463 .type = FIO_OPT_INT,
4464 .off1 = offsetof(struct thread_options, flow),
4465 .help = "Weight for flow control of this job",
4466 .parent = "flow_id",
4469 .category = FIO_OPT_C_IO,
4470 .group = FIO_OPT_G_IO_FLOW,
4473 .name = "flow_watermark",
4474 .lname = "I/O flow watermark",
4475 .type = FIO_OPT_INT,
4476 .off1 = offsetof(struct thread_options, flow_watermark),
4477 .help = "High watermark for flow control. This option"
4478 " should be set to the same value for all threads"
4479 " with non-zero flow.",
4480 .parent = "flow_id",
4483 .category = FIO_OPT_C_IO,
4484 .group = FIO_OPT_G_IO_FLOW,
4487 .name = "flow_sleep",
4488 .lname = "I/O flow sleep",
4489 .type = FIO_OPT_INT,
4490 .off1 = offsetof(struct thread_options, flow_sleep),
4491 .help = "How many microseconds to sleep after being held"
4492 " back by the flow control mechanism",
4493 .parent = "flow_id",
4496 .category = FIO_OPT_C_IO,
4497 .group = FIO_OPT_G_IO_FLOW,
4500 .name = "steadystate",
4501 .lname = "Steady state threshold",
4503 .type = FIO_OPT_STR,
4504 .off1 = offsetof(struct thread_options, ss_state),
4505 .cb = str_steadystate_cb,
4506 .help = "Define the criterion and limit to judge when a job has reached steady state",
4507 .def = "iops_slope:0.01%",
4510 .oval = FIO_SS_IOPS,
4511 .help = "maximum mean deviation of IOPS measurements",
4513 { .ival = "iops_slope",
4514 .oval = FIO_SS_IOPS_SLOPE,
4515 .help = "slope calculated from IOPS measurements",
4519 .help = "maximum mean deviation of bandwidth measurements",
4523 .oval = FIO_SS_BW_SLOPE,
4524 .help = "slope calculated from bandwidth measurements",
4527 .category = FIO_OPT_C_GENERAL,
4528 .group = FIO_OPT_G_RUNTIME,
4531 .name = "steadystate_duration",
4532 .lname = "Steady state duration",
4534 .parent = "steadystate",
4535 .type = FIO_OPT_STR_VAL_TIME,
4536 .off1 = offsetof(struct thread_options, ss_dur),
4537 .help = "Stop workload upon attaining steady state for specified duration",
4541 .category = FIO_OPT_C_GENERAL,
4542 .group = FIO_OPT_G_RUNTIME,
4545 .name = "steadystate_ramp_time",
4546 .lname = "Steady state ramp time",
4548 .parent = "steadystate",
4549 .type = FIO_OPT_STR_VAL_TIME,
4550 .off1 = offsetof(struct thread_options, ss_ramp_time),
4551 .help = "Delay before initiation of data collection for steady state job termination testing",
4555 .category = FIO_OPT_C_GENERAL,
4556 .group = FIO_OPT_G_RUNTIME,
4563 static void add_to_lopt(struct option *lopt, struct fio_option *o,
4564 const char *name, int val)
4566 lopt->name = (char *) name;
4568 if (o->type == FIO_OPT_STR_SET)
4569 lopt->has_arg = optional_argument;
4571 lopt->has_arg = required_argument;
4574 static void options_to_lopts(struct fio_option *opts,
4575 struct option *long_options,
4576 int i, int option_type)
4578 struct fio_option *o = &opts[0];
4580 add_to_lopt(&long_options[i], o, o->name, option_type);
4583 add_to_lopt(&long_options[i], o, o->alias, option_type);
4588 assert(i < FIO_NR_OPTIONS);
4592 void fio_options_set_ioengine_opts(struct option *long_options,
4593 struct thread_data *td)
4598 while (long_options[i].name) {
4599 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
4600 memset(&long_options[i], 0, sizeof(*long_options));
4607 * Just clear out the prior ioengine options.
4612 options_to_lopts(td->io_ops->options, long_options, i,
4613 FIO_GETOPT_IOENGINE);
4616 void fio_options_dup_and_init(struct option *long_options)
4620 options_init(fio_options);
4623 while (long_options[i].name)
4626 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
4629 struct fio_keyword {
4635 static struct fio_keyword fio_keywords[] = {
4637 .word = "$pagesize",
4638 .desc = "Page size in the system",
4641 .word = "$mb_memory",
4642 .desc = "Megabytes of memory online",
4646 .desc = "Number of CPUs online in the system",
4653 void fio_keywords_exit(void)
4655 struct fio_keyword *kw;
4657 kw = &fio_keywords[0];
4665 void fio_keywords_init(void)
4667 unsigned long long mb_memory;
4671 sprintf(buf, "%lu", (unsigned long) page_size);
4672 fio_keywords[0].replace = strdup(buf);
4674 mb_memory = os_phys_mem() / (1024 * 1024);
4675 sprintf(buf, "%llu", mb_memory);
4676 fio_keywords[1].replace = strdup(buf);
4679 sprintf(buf, "%lu", l);
4680 fio_keywords[2].replace = strdup(buf);
4685 static char *bc_calc(char *str)
4687 char buf[128], *tmp;
4692 * No math, just return string
4694 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
4695 !strchr(str, '/')) || strchr(str, '\''))
4699 * Split option from value, we only need to calculate the value
4701 tmp = strchr(str, '=');
4708 * Prevent buffer overflows; such a case isn't reasonable anyway
4710 if (strlen(str) >= 128 || strlen(tmp) > 100)
4713 sprintf(buf, "which %s > /dev/null", BC_APP);
4715 log_err("fio: bc is needed for performing math\n");
4719 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
4720 f = popen(buf, "r");
4724 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
4731 buf[(tmp - str) + ret - 1] = '\0';
4732 memcpy(buf, str, tmp - str);
4738 * Return a copy of the input string with substrings of the form ${VARNAME}
4739 * substituted with the value of the environment variable VARNAME. The
4740 * substitution always occurs, even if VARNAME is empty or the corresponding
4741 * environment variable undefined.
4743 static char *option_dup_subs(const char *opt)
4745 char out[OPT_LEN_MAX+1];
4746 char in[OPT_LEN_MAX+1];
4749 char *ch1, *ch2, *env;
4750 ssize_t nchr = OPT_LEN_MAX;
4753 if (strlen(opt) + 1 > OPT_LEN_MAX) {
4754 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
4758 in[OPT_LEN_MAX] = '\0';
4759 strncpy(in, opt, OPT_LEN_MAX);
4761 while (*inptr && nchr > 0) {
4762 if (inptr[0] == '$' && inptr[1] == '{') {
4763 ch2 = strchr(inptr, '}');
4764 if (ch2 && inptr+1 < ch2) {
4771 envlen = strlen(env);
4772 if (envlen <= nchr) {
4773 memcpy(outptr, env, envlen);
4783 *outptr++ = *inptr++;
4792 * Look for reserved variable names and replace them with real values
4794 static char *fio_keyword_replace(char *opt)
4800 for (i = 0; fio_keywords[i].word != NULL; i++) {
4801 struct fio_keyword *kw = &fio_keywords[i];
4803 while ((s = strstr(opt, kw->word)) != NULL) {
4804 char *new = malloc(strlen(opt) + 1);
4810 * Copy part of the string before the keyword and
4811 * sprintf() the replacement after it.
4813 memcpy(new, opt, olen);
4814 len = sprintf(new + olen, "%s", kw->replace);
4817 * If there's more in the original string, copy that
4820 opt += strlen(kw->word) + olen;
4822 memcpy(new + olen + len, opt, opt - o_org - 1);
4825 * replace opt and free the old opt
4835 * Check for potential math and invoke bc, if possible
4843 static char **dup_and_sub_options(char **opts, int num_opts)
4846 char **opts_copy = malloc(num_opts * sizeof(*opts));
4847 for (i = 0; i < num_opts; i++) {
4848 opts_copy[i] = option_dup_subs(opts[i]);
4851 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
4856 static void show_closest_option(const char *opt)
4858 int best_option, best_distance;
4867 while (name[i] != '\0' && name[i] != '=')
4872 best_distance = INT_MAX;
4874 while (fio_options[i].name) {
4875 distance = string_distance(name, fio_options[i].name);
4876 if (distance < best_distance) {
4877 best_distance = distance;
4883 if (best_option != -1 && string_distance_ok(name, best_distance) &&
4884 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
4885 log_err("Did you mean %s?\n", fio_options[best_option].name);
4890 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
4892 int i, ret, unknown;
4895 sort_options(opts, fio_options, num_opts);
4896 opts_copy = dup_and_sub_options(opts, num_opts);
4898 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
4899 struct fio_option *o;
4900 int newret = parse_option(opts_copy[i], opts[i], fio_options,
4901 &o, &td->o, &td->opt_list);
4904 fio_option_mark_set(&td->o, o);
4912 opts_copy[i] = NULL;
4919 ret |= ioengine_load(td);
4921 sort_options(opts_copy, td->io_ops->options, num_opts);
4924 for (i = 0; i < num_opts; i++) {
4925 struct fio_option *o = NULL;
4932 newret = parse_option(opts_copy[i], opts[i],
4933 td->io_ops->options, &o,
4934 td->eo, &td->opt_list);
4938 log_err("Bad option <%s>\n", opts[i]);
4939 show_closest_option(opts[i]);
4942 opts_copy[i] = NULL;
4950 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
4954 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
4956 struct fio_option *o;
4958 o = find_option(fio_options, opt);
4960 fio_option_mark_set(&td->o, o);
4966 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
4969 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
4973 void fio_fill_default_options(struct thread_data *td)
4975 td->o.magic = OPT_MAGIC;
4976 fill_default_options(&td->o, fio_options);
4979 int fio_show_option_help(const char *opt)
4981 return show_cmd_help(fio_options, opt);
4985 * dupe FIO_OPT_STR_STORE options
4987 void fio_options_mem_dupe(struct thread_data *td)
4989 options_mem_dupe(fio_options, &td->o);
4991 if (td->eo && td->io_ops) {
4992 void *oldeo = td->eo;
4994 td->eo = malloc(td->io_ops->option_struct_size);
4995 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
4996 options_mem_dupe(td->io_ops->options, td->eo);
5000 unsigned int fio_get_kb_base(void *data)
5002 struct thread_data *td = cb_data_to_td(data);
5003 struct thread_options *o = &td->o;
5004 unsigned int kb_base = 0;
5007 * This is a hack... For private options, *data is not holding
5008 * a pointer to the thread_options, but to private data. This means
5009 * we can't safely dereference it, but magic is first so mem wise
5010 * it is valid. But this also means that if the job first sets
5011 * kb_base and expects that to be honored by private options,
5012 * it will be disappointed. We will return the global default
5015 if (o && o->magic == OPT_MAGIC)
5016 kb_base = o->kb_base;
5023 int add_option(struct fio_option *o)
5025 struct fio_option *__o;
5034 if (opt_index + 1 == FIO_MAX_OPTS) {
5035 log_err("fio: FIO_MAX_OPTS is too small\n");
5039 memcpy(&fio_options[opt_index], o, sizeof(*o));
5040 fio_options[opt_index + 1].name = NULL;
5044 void invalidate_profile_options(const char *prof_name)
5046 struct fio_option *o;
5050 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5051 o->type = FIO_OPT_INVALID;
5052 o->prof_name = NULL;
5058 void add_opt_posval(const char *optname, const char *ival, const char *help)
5060 struct fio_option *o;
5063 o = find_option(fio_options, optname);
5067 for (i = 0; i < PARSE_MAX_VP; i++) {
5068 if (o->posval[i].ival)
5071 o->posval[i].ival = ival;
5072 o->posval[i].help = help;
5077 void del_opt_posval(const char *optname, const char *ival)
5079 struct fio_option *o;
5082 o = find_option(fio_options, optname);
5086 for (i = 0; i < PARSE_MAX_VP; i++) {
5087 if (!o->posval[i].ival)
5089 if (strcmp(o->posval[i].ival, ival))
5092 o->posval[i].ival = NULL;
5093 o->posval[i].help = NULL;
5097 void fio_options_free(struct thread_data *td)
5099 options_free(fio_options, &td->o);
5100 if (td->eo && td->io_ops && td->io_ops->options) {
5101 options_free(td->io_ops->options, td->eo);
5107 struct fio_option *fio_option_find(const char *name)
5109 return find_option(fio_options, name);
5112 static struct fio_option *find_next_opt(struct thread_options *o,
5113 struct fio_option *from,
5116 struct fio_option *opt;
5119 from = &fio_options[0];
5125 if (off1 == from->off1) {
5130 } while (from->name);
5135 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5137 unsigned int opt_off, index, offset;
5139 opt_off = opt - &fio_options[0];
5140 index = opt_off / (8 * sizeof(uint64_t));
5141 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5142 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
5145 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
5147 struct fio_option *opt, *next;
5150 while ((opt = find_next_opt(o, next, off1)) != NULL) {
5151 if (opt_is_set(o, opt))
5160 void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)
5162 unsigned int opt_off, index, offset;
5164 opt_off = opt - &fio_options[0];
5165 index = opt_off / (8 * sizeof(uint64_t));
5166 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5167 o->set_options[index] |= (uint64_t)1 << offset;