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[100];
60 unsigned int val2[100];
63 static int split_parse_ddir(struct thread_options *o, struct split *split,
64 enum fio_ddir ddir, char *str)
73 while ((fname = strsep(&str, ":")) != NULL) {
79 perc_str = strstr(fname, "/");
83 perc = atoi(perc_str);
91 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
92 log_err("fio: bssplit conversion failed\n");
97 split->val2[i] = perc;
107 static int bssplit_ddir(struct thread_options *o, enum fio_ddir ddir, char *str)
109 unsigned int i, perc, perc_missing;
110 unsigned int max_bs, min_bs;
113 memset(&split, 0, sizeof(split));
115 if (split_parse_ddir(o, &split, ddir, str))
122 o->bssplit[ddir] = malloc(split.nr * sizeof(struct bssplit));
123 o->bssplit_nr[ddir] = split.nr;
124 for (i = 0; i < split.nr; i++) {
125 if (split.val1[i] > max_bs)
126 max_bs = split.val1[i];
127 if (split.val1[i] < min_bs)
128 min_bs = split.val1[i];
130 o->bssplit[ddir][i].bs = split.val1[i];
131 o->bssplit[ddir][i].perc =split.val2[i];
135 * Now check if the percentages add up, and how much is missing
137 perc = perc_missing = 0;
138 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
139 struct bssplit *bsp = &o->bssplit[ddir][i];
141 if (bsp->perc == -1U)
147 if (perc > 100 && perc_missing > 1) {
148 log_err("fio: bssplit percentages add to more than 100%%\n");
149 free(o->bssplit[ddir]);
150 o->bssplit[ddir] = NULL;
155 * If values didn't have a percentage set, divide the remains between
159 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
161 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
162 struct bssplit *bsp = &o->bssplit[ddir][i];
164 if (bsp->perc == -1U)
165 bsp->perc = (100 - perc) / perc_missing;
169 o->min_bs[ddir] = min_bs;
170 o->max_bs[ddir] = max_bs;
173 * now sort based on percentages, for ease of lookup
175 qsort(o->bssplit[ddir], o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
179 typedef int (split_parse_fn)(struct thread_options *, enum fio_ddir, char *);
181 static int str_split_parse(struct thread_data *td, char *str, split_parse_fn *fn)
186 odir = strchr(str, ',');
188 ddir = strchr(odir + 1, ',');
190 ret = fn(&td->o, DDIR_TRIM, ddir + 1);
196 op = strdup(odir + 1);
197 ret = fn(&td->o, DDIR_TRIM, op);
202 ret = fn(&td->o, DDIR_WRITE, odir + 1);
205 ret = fn(&td->o, DDIR_READ, str);
211 ret = fn(&td->o, DDIR_WRITE, op);
216 ret = fn(&td->o, DDIR_TRIM, op);
220 ret = fn(&td->o, DDIR_READ, str);
226 static int str_bssplit_cb(void *data, const char *input)
228 struct thread_data *td = cb_data_to_td(data);
232 p = str = strdup(input);
234 strip_blank_front(&str);
235 strip_blank_end(str);
237 ret = str_split_parse(td, str, bssplit_ddir);
239 if (parse_dryrun()) {
242 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
243 free(td->o.bssplit[i]);
244 td->o.bssplit[i] = NULL;
245 td->o.bssplit_nr[i] = 0;
253 static int str2error(char *str)
255 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
256 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
257 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
258 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
259 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
260 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
261 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
262 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
263 int i = 0, num = sizeof(err) / sizeof(char *);
266 if (!strcmp(err[i], str))
273 static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
280 if (etype >= ERROR_TYPE_CNT) {
281 log_err("Illegal error type\n");
285 td->o.ignore_error_nr[etype] = 4;
286 error = calloc(4, sizeof(int));
289 while ((fname = strsep(&str, ":")) != NULL) {
295 * grow struct buffer, if needed
297 if (i == td->o.ignore_error_nr[etype]) {
298 td->o.ignore_error_nr[etype] <<= 1;
299 error = realloc(error, td->o.ignore_error_nr[etype]
302 if (fname[0] == 'E') {
303 error[i] = str2error(fname);
305 error[i] = atoi(fname);
307 error[i] = -error[i];
310 log_err("Unknown error %s, please use number value\n",
312 td->o.ignore_error_nr[etype] = 0;
319 td->o.continue_on_error |= 1 << etype;
320 td->o.ignore_error_nr[etype] = i;
321 td->o.ignore_error[etype] = error;
323 td->o.ignore_error_nr[etype] = 0;
331 static int str_ignore_error_cb(void *data, const char *input)
333 struct thread_data *td = cb_data_to_td(data);
336 enum error_type_bit type = 0;
341 p = str = strdup(input);
343 strip_blank_front(&str);
344 strip_blank_end(str);
350 ret = ignore_error_type(td, type, p);
360 static int str_rw_cb(void *data, const char *str)
362 struct thread_data *td = cb_data_to_td(data);
363 struct thread_options *o = &td->o;
372 nr = get_opt_postfix(str);
377 o->ddir_seq_nr = atoi(nr);
381 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
382 log_err("fio: rw postfix parsing failed\n");
387 o->ddir_seq_add = val;
394 static int str_mem_cb(void *data, const char *mem)
396 struct thread_data *td = cb_data_to_td(data);
398 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
399 td->o.mem_type == MEM_MMAPSHARED)
400 td->o.mmapfile = get_opt_postfix(mem);
405 static int fio_clock_source_cb(void *data, const char *str)
407 struct thread_data *td = cb_data_to_td(data);
409 fio_clock_source = td->o.clocksource;
410 fio_clock_source_set = 1;
415 static int str_rwmix_read_cb(void *data, unsigned long long *val)
417 struct thread_data *td = cb_data_to_td(data);
419 td->o.rwmix[DDIR_READ] = *val;
420 td->o.rwmix[DDIR_WRITE] = 100 - *val;
424 static int str_rwmix_write_cb(void *data, unsigned long long *val)
426 struct thread_data *td = cb_data_to_td(data);
428 td->o.rwmix[DDIR_WRITE] = *val;
429 td->o.rwmix[DDIR_READ] = 100 - *val;
433 static int str_exitall_cb(void)
435 exitall_on_terminate = 1;
439 #ifdef FIO_HAVE_CPU_AFFINITY
440 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
442 unsigned int i, index, cpus_in_mask;
443 const long max_cpu = cpus_online();
445 cpus_in_mask = fio_cpu_count(mask);
446 cpu_index = cpu_index % cpus_in_mask;
449 for (i = 0; i < max_cpu; i++) {
450 if (!fio_cpu_isset(mask, i))
453 if (cpu_index != index)
454 fio_cpu_clear(mask, i);
459 return fio_cpu_count(mask);
462 static int str_cpumask_cb(void *data, unsigned long long *val)
464 struct thread_data *td = cb_data_to_td(data);
472 ret = fio_cpuset_init(&td->o.cpumask);
474 log_err("fio: cpuset_init failed\n");
475 td_verror(td, ret, "fio_cpuset_init");
479 max_cpu = cpus_online();
481 for (i = 0; i < sizeof(int) * 8; i++) {
482 if ((1 << i) & *val) {
484 log_err("fio: CPU %d too large (max=%ld)\n", i,
488 dprint(FD_PARSE, "set cpu allowed %d\n", i);
489 fio_cpu_set(&td->o.cpumask, i);
496 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
503 ret = fio_cpuset_init(mask);
505 log_err("fio: cpuset_init failed\n");
506 td_verror(td, ret, "fio_cpuset_init");
510 p = str = strdup(input);
512 strip_blank_front(&str);
513 strip_blank_end(str);
515 max_cpu = cpus_online();
517 while ((cpu = strsep(&str, ",")) != NULL) {
526 while ((cpu2 = strsep(&str2, "-")) != NULL) {
536 while (icpu <= icpu2) {
537 if (icpu >= FIO_MAX_CPUS) {
538 log_err("fio: your OS only supports up to"
539 " %d CPUs\n", (int) FIO_MAX_CPUS);
543 if (icpu >= max_cpu) {
544 log_err("fio: CPU %d too large (max=%ld)\n",
550 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
551 fio_cpu_set(mask, icpu);
562 static int str_cpus_allowed_cb(void *data, const char *input)
564 struct thread_data *td = cb_data_to_td(data);
569 return set_cpus_allowed(td, &td->o.cpumask, input);
572 static int str_verify_cpus_allowed_cb(void *data, const char *input)
574 struct thread_data *td = cb_data_to_td(data);
579 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
583 static int str_log_cpus_allowed_cb(void *data, const char *input)
585 struct thread_data *td = cb_data_to_td(data);
590 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
592 #endif /* CONFIG_ZLIB */
594 #endif /* FIO_HAVE_CPU_AFFINITY */
596 #ifdef CONFIG_LIBNUMA
597 static int str_numa_cpunodes_cb(void *data, char *input)
599 struct thread_data *td = cb_data_to_td(data);
600 struct bitmask *verify_bitmask;
605 /* numa_parse_nodestring() parses a character string list
606 * of nodes into a bit mask. The bit mask is allocated by
607 * numa_allocate_nodemask(), so it should be freed by
608 * numa_free_nodemask().
610 verify_bitmask = numa_parse_nodestring(input);
611 if (verify_bitmask == NULL) {
612 log_err("fio: numa_parse_nodestring failed\n");
613 td_verror(td, 1, "str_numa_cpunodes_cb");
616 numa_free_nodemask(verify_bitmask);
618 td->o.numa_cpunodes = strdup(input);
622 static int str_numa_mpol_cb(void *data, char *input)
624 struct thread_data *td = cb_data_to_td(data);
625 const char * const policy_types[] =
626 { "default", "prefer", "bind", "interleave", "local", NULL };
629 struct bitmask *verify_bitmask;
634 nodelist = strchr(input, ':');
636 /* NUL-terminate mode */
640 for (i = 0; i <= MPOL_LOCAL; i++) {
641 if (!strcmp(input, policy_types[i])) {
642 td->o.numa_mem_mode = i;
646 if (i > MPOL_LOCAL) {
647 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
651 switch (td->o.numa_mem_mode) {
654 * Insist on a nodelist of one node only
657 char *rest = nodelist;
658 while (isdigit(*rest))
661 log_err("fio: one node only for \'prefer\'\n");
665 log_err("fio: one node is needed for \'prefer\'\n");
669 case MPOL_INTERLEAVE:
671 * Default to online nodes with memory if no nodelist
674 nodelist = strdup("all");
679 * Don't allow a nodelist
682 log_err("fio: NO nodelist for \'local\'\n");
688 * Insist on a nodelist
691 log_err("fio: a nodelist is needed for \'bind\'\n");
698 /* numa_parse_nodestring() parses a character string list
699 * of nodes into a bit mask. The bit mask is allocated by
700 * numa_allocate_nodemask(), so it should be freed by
701 * numa_free_nodemask().
703 switch (td->o.numa_mem_mode) {
705 td->o.numa_mem_prefer_node = atoi(nodelist);
707 case MPOL_INTERLEAVE:
709 verify_bitmask = numa_parse_nodestring(nodelist);
710 if (verify_bitmask == NULL) {
711 log_err("fio: numa_parse_nodestring failed\n");
712 td_verror(td, 1, "str_numa_memnodes_cb");
715 td->o.numa_memnodes = strdup(nodelist);
716 numa_free_nodemask(verify_bitmask);
731 static int str_fst_cb(void *data, const char *str)
733 struct thread_data *td = cb_data_to_td(data);
738 td->file_service_nr = 1;
740 switch (td->o.file_service_type) {
741 case FIO_FSERVICE_RANDOM:
742 case FIO_FSERVICE_RR:
743 case FIO_FSERVICE_SEQ:
744 nr = get_opt_postfix(str);
746 td->file_service_nr = atoi(nr);
751 case FIO_FSERVICE_ZIPF:
754 case FIO_FSERVICE_PARETO:
755 val = FIO_DEF_PARETO;
757 case FIO_FSERVICE_GAUSS:
761 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
768 nr = get_opt_postfix(str);
769 if (nr && !str_to_float(nr, &val, 0)) {
770 log_err("fio: file service type random postfix parsing failed\n");
777 switch (td->o.file_service_type) {
778 case FIO_FSERVICE_ZIPF:
780 log_err("fio: zipf theta must be different than 1.0\n");
785 td->zipf_theta = val;
787 case FIO_FSERVICE_PARETO:
788 if (val <= 0.00 || val >= 1.00) {
789 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
796 case FIO_FSERVICE_GAUSS:
797 if (val < 0.00 || val >= 100.00) {
798 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
810 #ifdef CONFIG_SYNC_FILE_RANGE
811 static int str_sfr_cb(void *data, const char *str)
813 struct thread_data *td = cb_data_to_td(data);
814 char *nr = get_opt_postfix(str);
816 td->sync_file_range_nr = 1;
818 td->sync_file_range_nr = atoi(nr);
826 static int zone_split_ddir(struct thread_options *o, enum fio_ddir ddir,
829 unsigned int i, perc, perc_missing, sperc, sperc_missing;
832 memset(&split, 0, sizeof(split));
834 if (split_parse_ddir(o, &split, ddir, str))
839 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
840 o->zone_split_nr[ddir] = split.nr;
841 for (i = 0; i < split.nr; i++) {
842 o->zone_split[ddir][i].access_perc = split.val1[i];
843 o->zone_split[ddir][i].size_perc = split.val2[i];
847 * Now check if the percentages add up, and how much is missing
849 perc = perc_missing = 0;
850 sperc = sperc_missing = 0;
851 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
852 struct zone_split *zsp = &o->zone_split[ddir][i];
854 if (zsp->access_perc == (uint8_t) -1U)
857 perc += zsp->access_perc;
859 if (zsp->size_perc == (uint8_t) -1U)
862 sperc += zsp->size_perc;
866 if (perc > 100 || sperc > 100) {
867 log_err("fio: zone_split percentages add to more than 100%%\n");
868 free(o->zone_split[ddir]);
869 o->zone_split[ddir] = NULL;
873 log_err("fio: access percentage don't add up to 100 for zoned "
874 "random distribution (got=%u)\n", perc);
875 free(o->zone_split[ddir]);
876 o->zone_split[ddir] = NULL;
881 * If values didn't have a percentage set, divide the remains between
885 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
887 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
888 struct zone_split *zsp = &o->zone_split[ddir][i];
890 if (zsp->access_perc == (uint8_t) -1U)
891 zsp->access_perc = (100 - perc) / perc_missing;
895 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
897 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
898 struct zone_split *zsp = &o->zone_split[ddir][i];
900 if (zsp->size_perc == (uint8_t) -1U)
901 zsp->size_perc = (100 - sperc) / sperc_missing;
908 static void __td_zone_gen_index(struct thread_data *td, enum fio_ddir ddir)
910 unsigned int i, j, sprev, aprev;
912 td->zone_state_index[ddir] = malloc(sizeof(struct zone_split_index) * 100);
915 for (i = 0; i < td->o.zone_split_nr[ddir]; i++) {
916 struct zone_split *zsp = &td->o.zone_split[ddir][i];
918 for (j = aprev; j < aprev + zsp->access_perc; j++) {
919 struct zone_split_index *zsi = &td->zone_state_index[ddir][j];
921 zsi->size_perc = sprev + zsp->size_perc;
922 zsi->size_perc_prev = sprev;
925 aprev += zsp->access_perc;
926 sprev += zsp->size_perc;
931 * Generate state table for indexes, so we don't have to do it inline from
934 static void td_zone_gen_index(struct thread_data *td)
938 td->zone_state_index = malloc(DDIR_RWDIR_CNT *
939 sizeof(struct zone_split_index *));
941 for (i = 0; i < DDIR_RWDIR_CNT; i++)
942 __td_zone_gen_index(td, i);
945 static int parse_zoned_distribution(struct thread_data *td, const char *input)
950 p = str = strdup(input);
952 strip_blank_front(&str);
953 strip_blank_end(str);
955 /* We expect it to start like that, bail if not */
956 if (strncmp(str, "zoned:", 6)) {
957 log_err("fio: mismatch in zoned input <%s>\n", str);
961 str += strlen("zoned:");
963 ret = str_split_parse(td, str, zone_split_ddir);
967 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
970 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
972 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
973 struct zone_split *zsp = &td->o.zone_split[i][j];
975 dprint(FD_PARSE, "\t%d: %u/%u\n", j, zsp->access_perc,
980 if (parse_dryrun()) {
983 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
984 free(td->o.zone_split[i]);
985 td->o.zone_split[i] = NULL;
986 td->o.zone_split_nr[i] = 0;
993 td_zone_gen_index(td);
995 for (i = 0; i < DDIR_RWDIR_CNT; i++)
996 td->o.zone_split_nr[i] = 0;
1002 static int str_random_distribution_cb(void *data, const char *str)
1004 struct thread_data *td = cb_data_to_td(data);
1008 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1010 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1011 val = FIO_DEF_PARETO;
1012 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1014 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1015 return parse_zoned_distribution(td, str);
1019 nr = get_opt_postfix(str);
1020 if (nr && !str_to_float(nr, &val, 0)) {
1021 log_err("fio: random postfix parsing failed\n");
1028 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1030 log_err("fio: zipf theta must different than 1.0\n");
1035 td->o.zipf_theta.u.f = val;
1036 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1037 if (val <= 0.00 || val >= 1.00) {
1038 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1043 td->o.pareto_h.u.f = val;
1045 if (val < 0.00 || val >= 100.0) {
1046 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1051 td->o.gauss_dev.u.f = val;
1057 static int str_steadystate_cb(void *data, const char *str)
1059 struct thread_data *td = cb_data_to_td(data);
1065 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1066 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
1067 /* should be impossible to get here */
1068 log_err("fio: unknown steady state criterion\n");
1072 nr = get_opt_postfix(str);
1074 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1079 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1080 pct = strstr(nr, "%");
1083 strip_blank_end(nr);
1084 if (!str_to_float(nr, &val, 0)) {
1085 log_err("fio: could not parse steadystate threshold percentage\n");
1090 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1095 td->o.ss_state |= __FIO_SS_PCT;
1096 td->o.ss_limit.u.f = val;
1097 } else if (td->o.ss_state & __FIO_SS_IOPS) {
1098 if (!str_to_float(nr, &val, 0)) {
1099 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1104 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1109 td->o.ss_limit.u.f = val;
1110 } else { /* bandwidth criterion */
1111 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1112 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1117 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1122 td->o.ss_limit.u.f = (double) ll;
1125 td->ss.state = td->o.ss_state;
1130 * Return next name in the string. Files are separated with ':'. If the ':'
1131 * is escaped with a '\', then that ':' is part of the filename and does not
1132 * indicate a new file.
1134 static char *get_next_name(char **ptr)
1139 if (!str || !strlen(str))
1145 * No colon, we are done
1147 p = strchr(str, ':');
1154 * We got a colon, but it's the first character. Skip and
1162 if (*(p - 1) != '\\') {
1168 memmove(p - 1, p, strlen(p) + 1);
1176 static int get_max_name_idx(char *input)
1178 unsigned int cur_idx;
1181 p = str = strdup(input);
1182 for (cur_idx = 0; ; cur_idx++)
1183 if (get_next_name(&str) == NULL)
1191 * Returns the directory at the index, indexes > entires will be
1192 * assigned via modulo division of the index
1194 int set_name_idx(char *target, size_t tlen, char *input, int index,
1195 bool unique_filename)
1197 unsigned int cur_idx;
1199 char *fname, *str, *p;
1201 p = str = strdup(input);
1203 index %= get_max_name_idx(input);
1204 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1205 fname = get_next_name(&str);
1207 if (client_sockaddr_str[0] && unique_filename) {
1208 len = snprintf(target, tlen, "%s/%s.", fname,
1209 client_sockaddr_str);
1211 len = snprintf(target, tlen, "%s/", fname);
1213 target[tlen - 1] = '\0';
1219 static int str_filename_cb(void *data, const char *input)
1221 struct thread_data *td = cb_data_to_td(data);
1222 char *fname, *str, *p;
1224 p = str = strdup(input);
1226 strip_blank_front(&str);
1227 strip_blank_end(str);
1230 * Ignore what we may already have from nrfiles option.
1232 if (!td->files_index)
1235 while ((fname = get_next_name(&str)) != NULL) {
1238 add_file(td, fname, 0, 1);
1245 static int str_directory_cb(void *data, const char fio_unused *unused)
1247 struct thread_data *td = cb_data_to_td(data);
1249 char *dirname, *str, *p;
1255 p = str = strdup(td->o.directory);
1256 while ((dirname = get_next_name(&str)) != NULL) {
1257 if (lstat(dirname, &sb) < 0) {
1260 log_err("fio: %s is not a directory\n", dirname);
1261 td_verror(td, ret, "lstat");
1264 if (!S_ISDIR(sb.st_mode)) {
1265 log_err("fio: %s is not a directory\n", dirname);
1276 static int str_opendir_cb(void *data, const char fio_unused *str)
1278 struct thread_data *td = cb_data_to_td(data);
1283 if (!td->files_index)
1286 return add_dir_files(td, td->o.opendir);
1289 static int str_buffer_pattern_cb(void *data, const char *input)
1291 struct thread_data *td = cb_data_to_td(data);
1294 /* FIXME: for now buffer pattern does not support formats */
1295 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
1296 MAX_PATTERN_SIZE, NULL, 0, NULL, NULL);
1301 td->o.buffer_pattern_bytes = ret;
1304 * If this job is doing any reading or has compression set,
1305 * ensure that we refill buffers for writes or we could be
1306 * invalidating the pattern through reads.
1308 if (!td->o.compress_percentage && !td_read(td))
1309 td->o.refill_buffers = 0;
1311 td->o.refill_buffers = 1;
1313 td->o.scramble_buffers = 0;
1314 td->o.zero_buffers = 0;
1319 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1321 struct thread_data *td = cb_data_to_td(data);
1323 td->flags |= TD_F_COMPRESS;
1324 td->o.compress_percentage = *il;
1328 static int str_dedupe_cb(void *data, unsigned long long *il)
1330 struct thread_data *td = cb_data_to_td(data);
1332 td->flags |= TD_F_COMPRESS;
1333 td->o.dedupe_percentage = *il;
1334 td->o.refill_buffers = 1;
1338 static int str_verify_pattern_cb(void *data, const char *input)
1340 struct thread_data *td = cb_data_to_td(data);
1343 td->o.verify_fmt_sz = ARRAY_SIZE(td->o.verify_fmt);
1344 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
1345 MAX_PATTERN_SIZE, fmt_desc, sizeof(fmt_desc),
1346 td->o.verify_fmt, &td->o.verify_fmt_sz);
1351 td->o.verify_pattern_bytes = ret;
1353 * VERIFY_* could already be set
1355 if (!fio_option_is_set(&td->o, verify))
1356 td->o.verify = VERIFY_PATTERN;
1361 static int str_gtod_reduce_cb(void *data, int *il)
1363 struct thread_data *td = cb_data_to_td(data);
1366 td->o.disable_lat = !!val;
1367 td->o.disable_clat = !!val;
1368 td->o.disable_slat = !!val;
1369 td->o.disable_bw = !!val;
1370 td->o.clat_percentiles = !val;
1372 td->ts_cache_mask = 63;
1377 static int str_offset_cb(void *data, unsigned long long *__val)
1379 struct thread_data *td = cb_data_to_td(data);
1380 unsigned long long v = *__val;
1382 if (parse_is_percent(v)) {
1383 td->o.start_offset = 0;
1384 td->o.start_offset_percent = -1ULL - v;
1385 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1386 td->o.start_offset_percent);
1388 td->o.start_offset = v;
1393 static int str_size_cb(void *data, unsigned long long *__val)
1395 struct thread_data *td = cb_data_to_td(data);
1396 unsigned long long v = *__val;
1398 if (parse_is_percent(v)) {
1400 td->o.size_percent = -1ULL - v;
1401 dprint(FD_PARSE, "SET size_percent %d\n",
1402 td->o.size_percent);
1409 static int str_write_bw_log_cb(void *data, const char *str)
1411 struct thread_data *td = cb_data_to_td(data);
1414 td->o.bw_log_file = strdup(str);
1416 td->o.write_bw_log = 1;
1420 static int str_write_lat_log_cb(void *data, const char *str)
1422 struct thread_data *td = cb_data_to_td(data);
1425 td->o.lat_log_file = strdup(str);
1427 td->o.write_lat_log = 1;
1431 static int str_write_iops_log_cb(void *data, const char *str)
1433 struct thread_data *td = cb_data_to_td(data);
1436 td->o.iops_log_file = strdup(str);
1438 td->o.write_iops_log = 1;
1442 static int str_write_hist_log_cb(void *data, const char *str)
1444 struct thread_data *td = cb_data_to_td(data);
1447 td->o.hist_log_file = strdup(str);
1449 td->o.write_hist_log = 1;
1454 * str is supposed to be a substring of the strdup'd original string,
1455 * and is valid only if it's a regular file path.
1456 * This function keeps the pointer to the path as needed later.
1458 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1459 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1460 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1462 static int str_ioengine_external_cb(void *data, const char *str)
1464 struct thread_data *td = cb_data_to_td(data);
1469 log_err("fio: null external ioengine path\n");
1473 p = (char *)str; /* str is mutable */
1474 strip_blank_front(&p);
1477 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1478 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1482 td->o.ioengine_so_path = p;
1486 static int rw_verify(struct fio_option *o, void *data)
1488 struct thread_data *td = cb_data_to_td(data);
1490 if (read_only && td_write(td)) {
1491 log_err("fio: job <%s> has write bit set, but fio is in"
1492 " read-only mode\n", td->o.name);
1499 static int gtod_cpu_verify(struct fio_option *o, void *data)
1501 #ifndef FIO_HAVE_CPU_AFFINITY
1502 struct thread_data *td = cb_data_to_td(data);
1504 if (td->o.gtod_cpu) {
1505 log_err("fio: platform must support CPU affinity for"
1506 "gettimeofday() offloading\n");
1515 * Map of job/command line options
1517 struct fio_option fio_options[FIO_MAX_OPTS] = {
1519 .name = "description",
1520 .lname = "Description of job",
1521 .type = FIO_OPT_STR_STORE,
1522 .off1 = offsetof(struct thread_options, description),
1523 .help = "Text job description",
1524 .category = FIO_OPT_C_GENERAL,
1525 .group = FIO_OPT_G_DESC,
1529 .lname = "Job name",
1530 .type = FIO_OPT_STR_STORE,
1531 .off1 = offsetof(struct thread_options, name),
1532 .help = "Name of this job",
1533 .category = FIO_OPT_C_GENERAL,
1534 .group = FIO_OPT_G_DESC,
1538 .lname = "Waitee name",
1539 .type = FIO_OPT_STR_STORE,
1540 .off1 = offsetof(struct thread_options, wait_for),
1541 .help = "Name of the job this one wants to wait for before starting",
1542 .category = FIO_OPT_C_GENERAL,
1543 .group = FIO_OPT_G_DESC,
1547 .lname = "Filename(s)",
1548 .type = FIO_OPT_STR_STORE,
1549 .off1 = offsetof(struct thread_options, filename),
1550 .cb = str_filename_cb,
1551 .prio = -1, /* must come after "directory" */
1552 .help = "File(s) to use for the workload",
1553 .category = FIO_OPT_C_FILE,
1554 .group = FIO_OPT_G_FILENAME,
1557 .name = "directory",
1558 .lname = "Directory",
1559 .type = FIO_OPT_STR_STORE,
1560 .off1 = offsetof(struct thread_options, directory),
1561 .cb = str_directory_cb,
1562 .help = "Directory to store files in",
1563 .category = FIO_OPT_C_FILE,
1564 .group = FIO_OPT_G_FILENAME,
1567 .name = "filename_format",
1568 .lname = "Filename Format",
1569 .type = FIO_OPT_STR_STORE,
1570 .off1 = offsetof(struct thread_options, filename_format),
1571 .prio = -1, /* must come after "directory" */
1572 .help = "Override default $jobname.$jobnum.$filenum naming",
1573 .def = "$jobname.$jobnum.$filenum",
1574 .category = FIO_OPT_C_FILE,
1575 .group = FIO_OPT_G_FILENAME,
1578 .name = "unique_filename",
1579 .lname = "Unique Filename",
1580 .type = FIO_OPT_BOOL,
1581 .off1 = offsetof(struct thread_options, unique_filename),
1582 .help = "For network clients, prefix file with source IP",
1584 .category = FIO_OPT_C_FILE,
1585 .group = FIO_OPT_G_FILENAME,
1589 .lname = "Lockfile",
1590 .type = FIO_OPT_STR,
1591 .off1 = offsetof(struct thread_options, file_lock_mode),
1592 .help = "Lock file when doing IO to it",
1594 .parent = "filename",
1597 .category = FIO_OPT_C_FILE,
1598 .group = FIO_OPT_G_FILENAME,
1601 .oval = FILE_LOCK_NONE,
1602 .help = "No file locking",
1604 { .ival = "exclusive",
1605 .oval = FILE_LOCK_EXCLUSIVE,
1606 .help = "Exclusive file lock",
1609 .ival = "readwrite",
1610 .oval = FILE_LOCK_READWRITE,
1611 .help = "Read vs write lock",
1617 .lname = "Open directory",
1618 .type = FIO_OPT_STR_STORE,
1619 .off1 = offsetof(struct thread_options, opendir),
1620 .cb = str_opendir_cb,
1621 .help = "Recursively add files from this directory and down",
1622 .category = FIO_OPT_C_FILE,
1623 .group = FIO_OPT_G_FILENAME,
1627 .lname = "Read/write",
1628 .alias = "readwrite",
1629 .type = FIO_OPT_STR,
1631 .off1 = offsetof(struct thread_options, td_ddir),
1632 .help = "IO direction",
1634 .verify = rw_verify,
1635 .category = FIO_OPT_C_IO,
1636 .group = FIO_OPT_G_IO_BASIC,
1639 .oval = TD_DDIR_READ,
1640 .help = "Sequential read",
1643 .oval = TD_DDIR_WRITE,
1644 .help = "Sequential write",
1647 .oval = TD_DDIR_TRIM,
1648 .help = "Sequential trim",
1650 { .ival = "randread",
1651 .oval = TD_DDIR_RANDREAD,
1652 .help = "Random read",
1654 { .ival = "randwrite",
1655 .oval = TD_DDIR_RANDWRITE,
1656 .help = "Random write",
1658 { .ival = "randtrim",
1659 .oval = TD_DDIR_RANDTRIM,
1660 .help = "Random trim",
1664 .help = "Sequential read and write mix",
1666 { .ival = "readwrite",
1668 .help = "Sequential read and write mix",
1671 .oval = TD_DDIR_RANDRW,
1672 .help = "Random read and write mix"
1674 { .ival = "trimwrite",
1675 .oval = TD_DDIR_TRIMWRITE,
1676 .help = "Trim and write mix, trims preceding writes"
1681 .name = "rw_sequencer",
1682 .lname = "RW Sequencer",
1683 .type = FIO_OPT_STR,
1684 .off1 = offsetof(struct thread_options, rw_seq),
1685 .help = "IO offset generator modifier",
1686 .def = "sequential",
1687 .category = FIO_OPT_C_IO,
1688 .group = FIO_OPT_G_IO_BASIC,
1690 { .ival = "sequential",
1692 .help = "Generate sequential offsets",
1694 { .ival = "identical",
1695 .oval = RW_SEQ_IDENT,
1696 .help = "Generate identical offsets",
1703 .lname = "IO Engine",
1704 .type = FIO_OPT_STR_STORE,
1705 .off1 = offsetof(struct thread_options, ioengine),
1706 .help = "IO engine to use",
1707 .def = FIO_PREFERRED_ENGINE,
1708 .category = FIO_OPT_C_IO,
1709 .group = FIO_OPT_G_IO_BASIC,
1712 .help = "Use read/write",
1715 .help = "Use pread/pwrite",
1718 .help = "Use readv/writev",
1720 #ifdef CONFIG_PWRITEV
1722 .help = "Use preadv/pwritev",
1725 #ifdef FIO_HAVE_PWRITEV2
1726 { .ival = "pvsync2",
1727 .help = "Use preadv2/pwritev2",
1730 #ifdef CONFIG_LIBAIO
1732 .help = "Linux native asynchronous IO",
1735 #ifdef CONFIG_POSIXAIO
1736 { .ival = "posixaio",
1737 .help = "POSIX asynchronous IO",
1740 #ifdef CONFIG_SOLARISAIO
1741 { .ival = "solarisaio",
1742 .help = "Solaris native asynchronous IO",
1745 #ifdef CONFIG_WINDOWSAIO
1746 { .ival = "windowsaio",
1747 .help = "Windows native asynchronous IO"
1752 .help = "Rados Block Device asynchronous IO"
1756 .help = "Memory mapped IO"
1758 #ifdef CONFIG_LINUX_SPLICE
1760 .help = "splice/vmsplice based IO",
1762 { .ival = "netsplice",
1763 .help = "splice/vmsplice to/from the network",
1766 #ifdef FIO_HAVE_SGIO
1768 .help = "SCSI generic v3 IO",
1772 .help = "Testing engine (no data transfer)",
1775 .help = "Network IO",
1778 .help = "CPU cycle burner engine",
1782 .help = "GUASI IO engine",
1785 #ifdef FIO_HAVE_BINJECT
1786 { .ival = "binject",
1787 .help = "binject direct inject block engine",
1792 .help = "RDMA IO engine",
1795 #ifdef CONFIG_FUSION_AW
1796 { .ival = "fusion-aw-sync",
1797 .help = "Fusion-io atomic write engine",
1800 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1801 { .ival = "e4defrag",
1802 .help = "ext4 defrag engine",
1805 #ifdef CONFIG_LINUX_FALLOCATE
1807 .help = "fallocate() file based engine",
1812 .help = "Glusterfs libgfapi(sync) based engine"
1814 { .ival = "gfapi_async",
1815 .help = "Glusterfs libgfapi(async) based engine"
1818 #ifdef CONFIG_LIBHDFS
1819 { .ival = "libhdfs",
1820 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1823 #ifdef CONFIG_PMEMBLK
1824 { .ival = "pmemblk",
1825 .help = "NVML libpmemblk based IO engine",
1829 #ifdef CONFIG_LINUX_DEVDAX
1830 { .ival = "dev-dax",
1831 .help = "DAX Device based IO engine",
1835 .ival = "filecreate",
1836 .help = "File creation engine",
1838 { .ival = "external",
1839 .help = "Load external engine (append name)",
1840 .cb = str_ioengine_external_cb,
1842 #ifdef CONFIG_LIBPMEM
1843 { .ival = "libpmem",
1844 .help = "NVML libpmem based IO engine",
1851 .lname = "IO Depth",
1852 .type = FIO_OPT_INT,
1853 .off1 = offsetof(struct thread_options, iodepth),
1854 .help = "Number of IO buffers to keep in flight",
1858 .category = FIO_OPT_C_IO,
1859 .group = FIO_OPT_G_IO_BASIC,
1862 .name = "iodepth_batch",
1863 .lname = "IO Depth batch",
1864 .alias = "iodepth_batch_submit",
1865 .type = FIO_OPT_INT,
1866 .off1 = offsetof(struct thread_options, iodepth_batch),
1867 .help = "Number of IO buffers to submit in one go",
1868 .parent = "iodepth",
1872 .category = FIO_OPT_C_IO,
1873 .group = FIO_OPT_G_IO_BASIC,
1876 .name = "iodepth_batch_complete_min",
1877 .lname = "Min IO depth batch complete",
1878 .alias = "iodepth_batch_complete",
1879 .type = FIO_OPT_INT,
1880 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
1881 .help = "Min number of IO buffers to retrieve in one go",
1882 .parent = "iodepth",
1887 .category = FIO_OPT_C_IO,
1888 .group = FIO_OPT_G_IO_BASIC,
1891 .name = "iodepth_batch_complete_max",
1892 .lname = "Max IO depth batch complete",
1893 .type = FIO_OPT_INT,
1894 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
1895 .help = "Max number of IO buffers to retrieve in one go",
1896 .parent = "iodepth",
1900 .category = FIO_OPT_C_IO,
1901 .group = FIO_OPT_G_IO_BASIC,
1904 .name = "iodepth_low",
1905 .lname = "IO Depth batch low",
1906 .type = FIO_OPT_INT,
1907 .off1 = offsetof(struct thread_options, iodepth_low),
1908 .help = "Low water mark for queuing depth",
1909 .parent = "iodepth",
1912 .category = FIO_OPT_C_IO,
1913 .group = FIO_OPT_G_IO_BASIC,
1916 .name = "serialize_overlap",
1917 .lname = "Serialize overlap",
1918 .off1 = offsetof(struct thread_options, serialize_overlap),
1919 .type = FIO_OPT_BOOL,
1920 .help = "Wait for in-flight IOs that collide to complete",
1921 .parent = "iodepth",
1923 .category = FIO_OPT_C_IO,
1924 .group = FIO_OPT_G_IO_BASIC,
1927 .name = "io_submit_mode",
1928 .lname = "IO submit mode",
1929 .type = FIO_OPT_STR,
1930 .off1 = offsetof(struct thread_options, io_submit_mode),
1931 .help = "How IO submissions and completions are done",
1933 .category = FIO_OPT_C_IO,
1934 .group = FIO_OPT_G_IO_BASIC,
1937 .oval = IO_MODE_INLINE,
1938 .help = "Submit and complete IO inline",
1940 { .ival = "offload",
1941 .oval = IO_MODE_OFFLOAD,
1942 .help = "Offload submit and complete to threads",
1949 .type = FIO_OPT_STR_VAL,
1951 .off1 = offsetof(struct thread_options, size),
1952 .help = "Total size of device or files",
1953 .interval = 1024 * 1024,
1954 .category = FIO_OPT_C_IO,
1955 .group = FIO_OPT_G_INVALID,
1959 .alias = "io_limit",
1961 .type = FIO_OPT_STR_VAL,
1962 .off1 = offsetof(struct thread_options, io_size),
1963 .help = "Total size of I/O to be performed",
1964 .interval = 1024 * 1024,
1965 .category = FIO_OPT_C_IO,
1966 .group = FIO_OPT_G_INVALID,
1969 .name = "fill_device",
1970 .lname = "Fill device",
1972 .type = FIO_OPT_BOOL,
1973 .off1 = offsetof(struct thread_options, fill_device),
1974 .help = "Write until an ENOSPC error occurs",
1976 .category = FIO_OPT_C_FILE,
1977 .group = FIO_OPT_G_INVALID,
1981 .lname = "File size",
1982 .type = FIO_OPT_STR_VAL,
1983 .off1 = offsetof(struct thread_options, file_size_low),
1984 .off2 = offsetof(struct thread_options, file_size_high),
1986 .help = "Size of individual files",
1987 .interval = 1024 * 1024,
1988 .category = FIO_OPT_C_FILE,
1989 .group = FIO_OPT_G_INVALID,
1992 .name = "file_append",
1993 .lname = "File append",
1994 .type = FIO_OPT_BOOL,
1995 .off1 = offsetof(struct thread_options, file_append),
1996 .help = "IO will start at the end of the file(s)",
1998 .category = FIO_OPT_C_FILE,
1999 .group = FIO_OPT_G_INVALID,
2003 .lname = "IO offset",
2004 .alias = "fileoffset",
2005 .type = FIO_OPT_STR_VAL,
2006 .cb = str_offset_cb,
2007 .off1 = offsetof(struct thread_options, start_offset),
2008 .help = "Start IO from this offset",
2010 .interval = 1024 * 1024,
2011 .category = FIO_OPT_C_IO,
2012 .group = FIO_OPT_G_INVALID,
2015 .name = "offset_align",
2016 .lname = "IO offset alignment",
2017 .type = FIO_OPT_INT,
2018 .off1 = offsetof(struct thread_options, start_offset_align),
2019 .help = "Start IO from this offset alignment",
2022 .category = FIO_OPT_C_IO,
2023 .group = FIO_OPT_G_INVALID,
2026 .name = "offset_increment",
2027 .lname = "IO offset increment",
2028 .type = FIO_OPT_STR_VAL,
2029 .off1 = offsetof(struct thread_options, offset_increment),
2030 .help = "What is the increment from one offset to the next",
2034 .interval = 1024 * 1024,
2035 .category = FIO_OPT_C_IO,
2036 .group = FIO_OPT_G_INVALID,
2039 .name = "number_ios",
2040 .lname = "Number of IOs to perform",
2041 .type = FIO_OPT_STR_VAL,
2042 .off1 = offsetof(struct thread_options, number_ios),
2043 .help = "Force job completion after this number of IOs",
2045 .category = FIO_OPT_C_IO,
2046 .group = FIO_OPT_G_INVALID,
2050 .lname = "Block size",
2051 .alias = "blocksize",
2052 .type = FIO_OPT_INT,
2053 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2054 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2055 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2057 .help = "Block size unit",
2062 .category = FIO_OPT_C_IO,
2063 .group = FIO_OPT_G_INVALID,
2067 .lname = "Block size align",
2068 .alias = "blockalign",
2069 .type = FIO_OPT_INT,
2070 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2071 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2072 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2074 .help = "IO block offset alignment",
2078 .category = FIO_OPT_C_IO,
2079 .group = FIO_OPT_G_INVALID,
2083 .lname = "Block size range",
2084 .alias = "blocksize_range",
2085 .type = FIO_OPT_RANGE,
2086 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2087 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2088 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2089 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2090 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2091 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2093 .help = "Set block size range (in more detail than bs)",
2097 .category = FIO_OPT_C_IO,
2098 .group = FIO_OPT_G_INVALID,
2102 .lname = "Block size split",
2103 .type = FIO_OPT_STR,
2104 .cb = str_bssplit_cb,
2105 .off1 = offsetof(struct thread_options, bssplit),
2106 .help = "Set a specific mix of block sizes",
2109 .category = FIO_OPT_C_IO,
2110 .group = FIO_OPT_G_INVALID,
2113 .name = "bs_unaligned",
2114 .lname = "Block size unaligned",
2115 .alias = "blocksize_unaligned",
2116 .type = FIO_OPT_STR_SET,
2117 .off1 = offsetof(struct thread_options, bs_unaligned),
2118 .help = "Don't sector align IO buffer sizes",
2121 .category = FIO_OPT_C_IO,
2122 .group = FIO_OPT_G_INVALID,
2125 .name = "bs_is_seq_rand",
2126 .lname = "Block size division is seq/random (not read/write)",
2127 .type = FIO_OPT_BOOL,
2128 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2129 .help = "Consider any blocksize setting to be sequential,random",
2131 .parent = "blocksize",
2132 .category = FIO_OPT_C_IO,
2133 .group = FIO_OPT_G_INVALID,
2136 .name = "randrepeat",
2137 .lname = "Random repeatable",
2138 .type = FIO_OPT_BOOL,
2139 .off1 = offsetof(struct thread_options, rand_repeatable),
2140 .help = "Use repeatable random IO pattern",
2144 .category = FIO_OPT_C_IO,
2145 .group = FIO_OPT_G_RANDOM,
2149 .lname = "The random generator seed",
2150 .type = FIO_OPT_STR_VAL,
2151 .off1 = offsetof(struct thread_options, rand_seed),
2152 .help = "Set the random generator seed value",
2155 .category = FIO_OPT_C_IO,
2156 .group = FIO_OPT_G_RANDOM,
2159 .name = "use_os_rand",
2160 .lname = "Use OS random",
2161 .type = FIO_OPT_DEPRECATED,
2162 .off1 = offsetof(struct thread_options, dep_use_os_rand),
2163 .category = FIO_OPT_C_IO,
2164 .group = FIO_OPT_G_RANDOM,
2167 .name = "norandommap",
2168 .lname = "No randommap",
2169 .type = FIO_OPT_STR_SET,
2170 .off1 = offsetof(struct thread_options, norandommap),
2171 .help = "Accept potential duplicate random blocks",
2175 .category = FIO_OPT_C_IO,
2176 .group = FIO_OPT_G_RANDOM,
2179 .name = "softrandommap",
2180 .lname = "Soft randommap",
2181 .type = FIO_OPT_BOOL,
2182 .off1 = offsetof(struct thread_options, softrandommap),
2183 .help = "Set norandommap if randommap allocation fails",
2184 .parent = "norandommap",
2187 .category = FIO_OPT_C_IO,
2188 .group = FIO_OPT_G_RANDOM,
2191 .name = "random_generator",
2192 .lname = "Random Generator",
2193 .type = FIO_OPT_STR,
2194 .off1 = offsetof(struct thread_options, random_generator),
2195 .help = "Type of random number generator to use",
2196 .def = "tausworthe",
2198 { .ival = "tausworthe",
2199 .oval = FIO_RAND_GEN_TAUSWORTHE,
2200 .help = "Strong Tausworthe generator",
2203 .oval = FIO_RAND_GEN_LFSR,
2204 .help = "Variable length LFSR",
2207 .ival = "tausworthe64",
2208 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2209 .help = "64-bit Tausworthe variant",
2212 .category = FIO_OPT_C_IO,
2213 .group = FIO_OPT_G_RANDOM,
2216 .name = "random_distribution",
2217 .lname = "Random Distribution",
2218 .type = FIO_OPT_STR,
2219 .off1 = offsetof(struct thread_options, random_distribution),
2220 .cb = str_random_distribution_cb,
2221 .help = "Random offset distribution generator",
2225 .oval = FIO_RAND_DIST_RANDOM,
2226 .help = "Completely random",
2229 .oval = FIO_RAND_DIST_ZIPF,
2230 .help = "Zipf distribution",
2233 .oval = FIO_RAND_DIST_PARETO,
2234 .help = "Pareto distribution",
2237 .oval = FIO_RAND_DIST_GAUSS,
2238 .help = "Normal (Gaussian) distribution",
2241 .oval = FIO_RAND_DIST_ZONED,
2242 .help = "Zoned random distribution",
2246 .category = FIO_OPT_C_IO,
2247 .group = FIO_OPT_G_RANDOM,
2250 .name = "percentage_random",
2251 .lname = "Percentage Random",
2252 .type = FIO_OPT_INT,
2253 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2254 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2255 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2257 .help = "Percentage of seq/random mix that should be random",
2258 .def = "100,100,100",
2260 .inverse = "percentage_sequential",
2261 .category = FIO_OPT_C_IO,
2262 .group = FIO_OPT_G_RANDOM,
2265 .name = "percentage_sequential",
2266 .lname = "Percentage Sequential",
2267 .type = FIO_OPT_DEPRECATED,
2268 .category = FIO_OPT_C_IO,
2269 .group = FIO_OPT_G_RANDOM,
2272 .name = "allrandrepeat",
2273 .lname = "All Random Repeat",
2274 .type = FIO_OPT_BOOL,
2275 .off1 = offsetof(struct thread_options, allrand_repeatable),
2276 .help = "Use repeatable random numbers for everything",
2278 .category = FIO_OPT_C_IO,
2279 .group = FIO_OPT_G_RANDOM,
2283 .lname = "Number of files",
2284 .alias = "nr_files",
2285 .type = FIO_OPT_INT,
2286 .off1 = offsetof(struct thread_options, nr_files),
2287 .help = "Split job workload between this number of files",
2290 .category = FIO_OPT_C_FILE,
2291 .group = FIO_OPT_G_INVALID,
2294 .name = "openfiles",
2295 .lname = "Number of open files",
2296 .type = FIO_OPT_INT,
2297 .off1 = offsetof(struct thread_options, open_files),
2298 .help = "Number of files to keep open at the same time",
2299 .category = FIO_OPT_C_FILE,
2300 .group = FIO_OPT_G_INVALID,
2303 .name = "file_service_type",
2304 .lname = "File service type",
2305 .type = FIO_OPT_STR,
2307 .off1 = offsetof(struct thread_options, file_service_type),
2308 .help = "How to select which file to service next",
2309 .def = "roundrobin",
2310 .category = FIO_OPT_C_FILE,
2311 .group = FIO_OPT_G_INVALID,
2314 .oval = FIO_FSERVICE_RANDOM,
2315 .help = "Choose a file at random (uniform)",
2318 .oval = FIO_FSERVICE_ZIPF,
2319 .help = "Zipf randomized",
2322 .oval = FIO_FSERVICE_PARETO,
2323 .help = "Pareto randomized",
2326 .oval = FIO_FSERVICE_GAUSS,
2327 .help = "Normal (Gaussian) randomized",
2330 .oval = FIO_FSERVICE_GAUSS,
2331 .help = "Alias for normal",
2333 { .ival = "roundrobin",
2334 .oval = FIO_FSERVICE_RR,
2335 .help = "Round robin select files",
2337 { .ival = "sequential",
2338 .oval = FIO_FSERVICE_SEQ,
2339 .help = "Finish one file before moving to the next",
2342 .parent = "nrfiles",
2345 #ifdef FIO_HAVE_ANY_FALLOCATE
2347 .name = "fallocate",
2348 .lname = "Fallocate",
2349 .type = FIO_OPT_STR,
2350 .off1 = offsetof(struct thread_options, fallocate_mode),
2351 .help = "Whether pre-allocation is performed when laying out files",
2353 .category = FIO_OPT_C_FILE,
2354 .group = FIO_OPT_G_INVALID,
2357 .oval = FIO_FALLOCATE_NONE,
2358 .help = "Do not pre-allocate space",
2361 .oval = FIO_FALLOCATE_NATIVE,
2362 .help = "Use native pre-allocation if possible",
2364 #ifdef CONFIG_POSIX_FALLOCATE
2366 .oval = FIO_FALLOCATE_POSIX,
2367 .help = "Use posix_fallocate()",
2370 #ifdef CONFIG_LINUX_FALLOCATE
2372 .oval = FIO_FALLOCATE_KEEP_SIZE,
2373 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2376 /* Compatibility with former boolean values */
2378 .oval = FIO_FALLOCATE_NONE,
2379 .help = "Alias for 'none'",
2381 #ifdef CONFIG_POSIX_FALLOCATE
2383 .oval = FIO_FALLOCATE_POSIX,
2384 .help = "Alias for 'posix'",
2389 #else /* FIO_HAVE_ANY_FALLOCATE */
2391 .name = "fallocate",
2392 .lname = "Fallocate",
2393 .type = FIO_OPT_UNSUPPORTED,
2394 .help = "Your platform does not support fallocate",
2396 #endif /* FIO_HAVE_ANY_FALLOCATE */
2398 .name = "fadvise_hint",
2399 .lname = "Fadvise hint",
2400 .type = FIO_OPT_STR,
2401 .off1 = offsetof(struct thread_options, fadvise_hint),
2405 .help = "Don't issue fadvise",
2409 .help = "Advise using fio IO pattern",
2412 .oval = F_ADV_RANDOM,
2413 .help = "Advise using FADV_RANDOM",
2415 { .ival = "sequential",
2416 .oval = F_ADV_SEQUENTIAL,
2417 .help = "Advise using FADV_SEQUENTIAL",
2420 .help = "Use fadvise() to advise the kernel on IO pattern",
2422 .category = FIO_OPT_C_FILE,
2423 .group = FIO_OPT_G_INVALID,
2428 .type = FIO_OPT_INT,
2429 .off1 = offsetof(struct thread_options, fsync_blocks),
2430 .help = "Issue fsync for writes every given number of blocks",
2433 .category = FIO_OPT_C_FILE,
2434 .group = FIO_OPT_G_INVALID,
2437 .name = "fdatasync",
2438 .lname = "Fdatasync",
2439 .type = FIO_OPT_INT,
2440 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2441 .help = "Issue fdatasync for writes every given number of blocks",
2444 .category = FIO_OPT_C_FILE,
2445 .group = FIO_OPT_G_INVALID,
2448 .name = "write_barrier",
2449 .lname = "Write barrier",
2450 .type = FIO_OPT_INT,
2451 .off1 = offsetof(struct thread_options, barrier_blocks),
2452 .help = "Make every Nth write a barrier write",
2455 .category = FIO_OPT_C_IO,
2456 .group = FIO_OPT_G_INVALID,
2458 #ifdef CONFIG_SYNC_FILE_RANGE
2460 .name = "sync_file_range",
2461 .lname = "Sync file range",
2463 { .ival = "wait_before",
2464 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2465 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2469 .oval = SYNC_FILE_RANGE_WRITE,
2470 .help = "SYNC_FILE_RANGE_WRITE",
2474 .ival = "wait_after",
2475 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2476 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2480 .type = FIO_OPT_STR_MULTI,
2482 .off1 = offsetof(struct thread_options, sync_file_range),
2483 .help = "Use sync_file_range()",
2484 .category = FIO_OPT_C_FILE,
2485 .group = FIO_OPT_G_INVALID,
2489 .name = "sync_file_range",
2490 .lname = "Sync file range",
2491 .type = FIO_OPT_UNSUPPORTED,
2492 .help = "Your platform does not support sync_file_range",
2497 .lname = "Direct I/O",
2498 .type = FIO_OPT_BOOL,
2499 .off1 = offsetof(struct thread_options, odirect),
2500 .help = "Use O_DIRECT IO (negates buffered)",
2502 .inverse = "buffered",
2503 .category = FIO_OPT_C_IO,
2504 .group = FIO_OPT_G_IO_TYPE,
2508 .lname = "Atomic I/O",
2509 .type = FIO_OPT_BOOL,
2510 .off1 = offsetof(struct thread_options, oatomic),
2511 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2513 .category = FIO_OPT_C_IO,
2514 .group = FIO_OPT_G_IO_TYPE,
2518 .lname = "Buffered I/O",
2519 .type = FIO_OPT_BOOL,
2520 .off1 = offsetof(struct thread_options, odirect),
2522 .help = "Use buffered IO (negates direct)",
2524 .inverse = "direct",
2525 .category = FIO_OPT_C_IO,
2526 .group = FIO_OPT_G_IO_TYPE,
2529 .name = "overwrite",
2530 .lname = "Overwrite",
2531 .type = FIO_OPT_BOOL,
2532 .off1 = offsetof(struct thread_options, overwrite),
2533 .help = "When writing, set whether to overwrite current data",
2535 .category = FIO_OPT_C_FILE,
2536 .group = FIO_OPT_G_INVALID,
2541 .type = FIO_OPT_INT,
2542 .off1 = offsetof(struct thread_options, loops),
2543 .help = "Number of times to run the job",
2546 .category = FIO_OPT_C_GENERAL,
2547 .group = FIO_OPT_G_RUNTIME,
2551 .lname = "Number of jobs",
2552 .type = FIO_OPT_INT,
2553 .off1 = offsetof(struct thread_options, numjobs),
2554 .help = "Duplicate this job this many times",
2557 .category = FIO_OPT_C_GENERAL,
2558 .group = FIO_OPT_G_RUNTIME,
2561 .name = "startdelay",
2562 .lname = "Start delay",
2563 .type = FIO_OPT_STR_VAL_TIME,
2564 .off1 = offsetof(struct thread_options, start_delay),
2565 .off2 = offsetof(struct thread_options, start_delay_high),
2566 .help = "Only start job when this period has passed",
2570 .category = FIO_OPT_C_GENERAL,
2571 .group = FIO_OPT_G_RUNTIME,
2577 .type = FIO_OPT_STR_VAL_TIME,
2578 .off1 = offsetof(struct thread_options, timeout),
2579 .help = "Stop workload when this amount of time has passed",
2583 .category = FIO_OPT_C_GENERAL,
2584 .group = FIO_OPT_G_RUNTIME,
2587 .name = "time_based",
2588 .lname = "Time based",
2589 .type = FIO_OPT_STR_SET,
2590 .off1 = offsetof(struct thread_options, time_based),
2591 .help = "Keep running until runtime/timeout is met",
2592 .category = FIO_OPT_C_GENERAL,
2593 .group = FIO_OPT_G_RUNTIME,
2596 .name = "verify_only",
2597 .lname = "Verify only",
2598 .type = FIO_OPT_STR_SET,
2599 .off1 = offsetof(struct thread_options, verify_only),
2600 .help = "Verifies previously written data is still valid",
2601 .category = FIO_OPT_C_GENERAL,
2602 .group = FIO_OPT_G_RUNTIME,
2605 .name = "ramp_time",
2606 .lname = "Ramp time",
2607 .type = FIO_OPT_STR_VAL_TIME,
2608 .off1 = offsetof(struct thread_options, ramp_time),
2609 .help = "Ramp up time before measuring performance",
2612 .category = FIO_OPT_C_GENERAL,
2613 .group = FIO_OPT_G_RUNTIME,
2616 .name = "clocksource",
2617 .lname = "Clock source",
2618 .type = FIO_OPT_STR,
2619 .cb = fio_clock_source_cb,
2620 .off1 = offsetof(struct thread_options, clocksource),
2621 .help = "What type of timing source to use",
2622 .category = FIO_OPT_C_GENERAL,
2623 .group = FIO_OPT_G_CLOCK,
2625 #ifdef CONFIG_GETTIMEOFDAY
2626 { .ival = "gettimeofday",
2628 .help = "Use gettimeofday(2) for timing",
2631 #ifdef CONFIG_CLOCK_GETTIME
2632 { .ival = "clock_gettime",
2633 .oval = CS_CGETTIME,
2634 .help = "Use clock_gettime(2) for timing",
2637 #ifdef ARCH_HAVE_CPU_CLOCK
2639 .oval = CS_CPUCLOCK,
2640 .help = "Use CPU private clock",
2648 .lname = "I/O Memory",
2649 .type = FIO_OPT_STR,
2651 .off1 = offsetof(struct thread_options, mem_type),
2652 .help = "Backing type for IO buffers",
2654 .category = FIO_OPT_C_IO,
2655 .group = FIO_OPT_G_INVALID,
2659 .help = "Use malloc(3) for IO buffers",
2661 #ifndef CONFIG_NO_SHM
2664 .help = "Use shared memory segments for IO buffers",
2666 #ifdef FIO_HAVE_HUGETLB
2667 { .ival = "shmhuge",
2668 .oval = MEM_SHMHUGE,
2669 .help = "Like shm, but use huge pages",
2675 .help = "Use mmap(2) (file or anon) for IO buffers",
2677 { .ival = "mmapshared",
2678 .oval = MEM_MMAPSHARED,
2679 .help = "Like mmap, but use the shared flag",
2681 #ifdef FIO_HAVE_HUGETLB
2682 { .ival = "mmaphuge",
2683 .oval = MEM_MMAPHUGE,
2684 .help = "Like mmap, but use huge pages",
2688 { .ival = "cudamalloc",
2689 .oval = MEM_CUDA_MALLOC,
2690 .help = "Allocate GPU device memory for GPUDirect RDMA",
2696 .name = "iomem_align",
2697 .alias = "mem_align",
2698 .lname = "I/O memory alignment",
2699 .type = FIO_OPT_INT,
2700 .off1 = offsetof(struct thread_options, mem_align),
2702 .help = "IO memory buffer offset alignment",
2706 .category = FIO_OPT_C_IO,
2707 .group = FIO_OPT_G_INVALID,
2712 .type = FIO_OPT_STR,
2713 .off1 = offsetof(struct thread_options, verify),
2714 .help = "Verify data written",
2716 .category = FIO_OPT_C_IO,
2717 .group = FIO_OPT_G_VERIFY,
2720 .oval = VERIFY_NONE,
2721 .help = "Don't do IO verification",
2725 .help = "Use md5 checksums for verification",
2728 .oval = VERIFY_CRC64,
2729 .help = "Use crc64 checksums for verification",
2732 .oval = VERIFY_CRC32,
2733 .help = "Use crc32 checksums for verification",
2735 { .ival = "crc32c-intel",
2736 .oval = VERIFY_CRC32C,
2737 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2740 .oval = VERIFY_CRC32C,
2741 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2744 .oval = VERIFY_CRC16,
2745 .help = "Use crc16 checksums for verification",
2748 .oval = VERIFY_CRC7,
2749 .help = "Use crc7 checksums for verification",
2752 .oval = VERIFY_SHA1,
2753 .help = "Use sha1 checksums for verification",
2756 .oval = VERIFY_SHA256,
2757 .help = "Use sha256 checksums for verification",
2760 .oval = VERIFY_SHA512,
2761 .help = "Use sha512 checksums for verification",
2763 { .ival = "sha3-224",
2764 .oval = VERIFY_SHA3_224,
2765 .help = "Use sha3-224 checksums for verification",
2767 { .ival = "sha3-256",
2768 .oval = VERIFY_SHA3_256,
2769 .help = "Use sha3-256 checksums for verification",
2771 { .ival = "sha3-384",
2772 .oval = VERIFY_SHA3_384,
2773 .help = "Use sha3-384 checksums for verification",
2775 { .ival = "sha3-512",
2776 .oval = VERIFY_SHA3_512,
2777 .help = "Use sha3-512 checksums for verification",
2780 .oval = VERIFY_XXHASH,
2781 .help = "Use xxhash checksums for verification",
2783 /* Meta information was included into verify_header,
2784 * 'meta' verification is implied by default. */
2786 .oval = VERIFY_HDR_ONLY,
2787 .help = "Use io information for verification. "
2788 "Now is implied by default, thus option is obsolete, "
2791 { .ival = "pattern",
2792 .oval = VERIFY_PATTERN_NO_HDR,
2793 .help = "Verify strict pattern",
2797 .oval = VERIFY_NULL,
2798 .help = "Pretend to verify",
2803 .name = "do_verify",
2804 .lname = "Perform verify step",
2805 .type = FIO_OPT_BOOL,
2806 .off1 = offsetof(struct thread_options, do_verify),
2807 .help = "Run verification stage after write",
2811 .category = FIO_OPT_C_IO,
2812 .group = FIO_OPT_G_VERIFY,
2815 .name = "verifysort",
2816 .lname = "Verify sort",
2817 .type = FIO_OPT_BOOL,
2818 .off1 = offsetof(struct thread_options, verifysort),
2819 .help = "Sort written verify blocks for read back",
2823 .category = FIO_OPT_C_IO,
2824 .group = FIO_OPT_G_VERIFY,
2827 .name = "verifysort_nr",
2828 .lname = "Verify Sort Nr",
2829 .type = FIO_OPT_INT,
2830 .off1 = offsetof(struct thread_options, verifysort_nr),
2831 .help = "Pre-load and sort verify blocks for a read workload",
2836 .category = FIO_OPT_C_IO,
2837 .group = FIO_OPT_G_VERIFY,
2840 .name = "verify_interval",
2841 .lname = "Verify interval",
2842 .type = FIO_OPT_INT,
2843 .off1 = offsetof(struct thread_options, verify_interval),
2844 .minval = 2 * sizeof(struct verify_header),
2845 .help = "Store verify buffer header every N bytes",
2848 .interval = 2 * sizeof(struct verify_header),
2849 .category = FIO_OPT_C_IO,
2850 .group = FIO_OPT_G_VERIFY,
2853 .name = "verify_offset",
2854 .lname = "Verify offset",
2855 .type = FIO_OPT_INT,
2856 .help = "Offset verify header location by N bytes",
2857 .off1 = offsetof(struct thread_options, verify_offset),
2858 .minval = sizeof(struct verify_header),
2861 .category = FIO_OPT_C_IO,
2862 .group = FIO_OPT_G_VERIFY,
2865 .name = "verify_pattern",
2866 .lname = "Verify pattern",
2867 .type = FIO_OPT_STR,
2868 .cb = str_verify_pattern_cb,
2869 .off1 = offsetof(struct thread_options, verify_pattern),
2870 .help = "Fill pattern for IO buffers",
2873 .category = FIO_OPT_C_IO,
2874 .group = FIO_OPT_G_VERIFY,
2877 .name = "verify_fatal",
2878 .lname = "Verify fatal",
2879 .type = FIO_OPT_BOOL,
2880 .off1 = offsetof(struct thread_options, verify_fatal),
2882 .help = "Exit on a single verify failure, don't continue",
2885 .category = FIO_OPT_C_IO,
2886 .group = FIO_OPT_G_VERIFY,
2889 .name = "verify_dump",
2890 .lname = "Verify dump",
2891 .type = FIO_OPT_BOOL,
2892 .off1 = offsetof(struct thread_options, verify_dump),
2894 .help = "Dump contents of good and bad blocks on failure",
2897 .category = FIO_OPT_C_IO,
2898 .group = FIO_OPT_G_VERIFY,
2901 .name = "verify_async",
2902 .lname = "Verify asynchronously",
2903 .type = FIO_OPT_INT,
2904 .off1 = offsetof(struct thread_options, verify_async),
2906 .help = "Number of async verifier threads to use",
2909 .category = FIO_OPT_C_IO,
2910 .group = FIO_OPT_G_VERIFY,
2913 .name = "verify_backlog",
2914 .lname = "Verify backlog",
2915 .type = FIO_OPT_STR_VAL,
2916 .off1 = offsetof(struct thread_options, verify_backlog),
2917 .help = "Verify after this number of blocks are written",
2920 .category = FIO_OPT_C_IO,
2921 .group = FIO_OPT_G_VERIFY,
2924 .name = "verify_backlog_batch",
2925 .lname = "Verify backlog batch",
2926 .type = FIO_OPT_INT,
2927 .off1 = offsetof(struct thread_options, verify_batch),
2928 .help = "Verify this number of IO blocks",
2931 .category = FIO_OPT_C_IO,
2932 .group = FIO_OPT_G_VERIFY,
2934 #ifdef FIO_HAVE_CPU_AFFINITY
2936 .name = "verify_async_cpus",
2937 .lname = "Async verify CPUs",
2938 .type = FIO_OPT_STR,
2939 .cb = str_verify_cpus_allowed_cb,
2940 .off1 = offsetof(struct thread_options, verify_cpumask),
2941 .help = "Set CPUs allowed for async verify threads",
2942 .parent = "verify_async",
2944 .category = FIO_OPT_C_IO,
2945 .group = FIO_OPT_G_VERIFY,
2949 .name = "verify_async_cpus",
2950 .lname = "Async verify CPUs",
2951 .type = FIO_OPT_UNSUPPORTED,
2952 .help = "Your platform does not support CPU affinities",
2956 .name = "experimental_verify",
2957 .lname = "Experimental Verify",
2958 .off1 = offsetof(struct thread_options, experimental_verify),
2959 .type = FIO_OPT_BOOL,
2960 .help = "Enable experimental verification",
2962 .category = FIO_OPT_C_IO,
2963 .group = FIO_OPT_G_VERIFY,
2966 .name = "verify_state_load",
2967 .lname = "Load verify state",
2968 .off1 = offsetof(struct thread_options, verify_state),
2969 .type = FIO_OPT_BOOL,
2970 .help = "Load verify termination state",
2972 .category = FIO_OPT_C_IO,
2973 .group = FIO_OPT_G_VERIFY,
2976 .name = "verify_state_save",
2977 .lname = "Save verify state",
2978 .off1 = offsetof(struct thread_options, verify_state_save),
2979 .type = FIO_OPT_BOOL,
2981 .help = "Save verify state on termination",
2983 .category = FIO_OPT_C_IO,
2984 .group = FIO_OPT_G_VERIFY,
2986 #ifdef FIO_HAVE_TRIM
2988 .name = "trim_percentage",
2989 .lname = "Trim percentage",
2990 .type = FIO_OPT_INT,
2991 .off1 = offsetof(struct thread_options, trim_percentage),
2994 .help = "Number of verify blocks to trim (i.e., discard)",
2999 .category = FIO_OPT_C_IO,
3000 .group = FIO_OPT_G_TRIM,
3003 .name = "trim_verify_zero",
3004 .lname = "Verify trim zero",
3005 .type = FIO_OPT_BOOL,
3006 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3007 .off1 = offsetof(struct thread_options, trim_zero),
3008 .parent = "trim_percentage",
3011 .category = FIO_OPT_C_IO,
3012 .group = FIO_OPT_G_TRIM,
3015 .name = "trim_backlog",
3016 .lname = "Trim backlog",
3017 .type = FIO_OPT_STR_VAL,
3018 .off1 = offsetof(struct thread_options, trim_backlog),
3019 .help = "Trim after this number of blocks are written",
3020 .parent = "trim_percentage",
3023 .category = FIO_OPT_C_IO,
3024 .group = FIO_OPT_G_TRIM,
3027 .name = "trim_backlog_batch",
3028 .lname = "Trim backlog batch",
3029 .type = FIO_OPT_INT,
3030 .off1 = offsetof(struct thread_options, trim_batch),
3031 .help = "Trim this number of IO blocks",
3032 .parent = "trim_percentage",
3035 .category = FIO_OPT_C_IO,
3036 .group = FIO_OPT_G_TRIM,
3040 .name = "trim_percentage",
3041 .lname = "Trim percentage",
3042 .type = FIO_OPT_UNSUPPORTED,
3043 .help = "Fio does not support TRIM on your platform",
3046 .name = "trim_verify_zero",
3047 .lname = "Verify trim zero",
3048 .type = FIO_OPT_UNSUPPORTED,
3049 .help = "Fio does not support TRIM on your platform",
3052 .name = "trim_backlog",
3053 .lname = "Trim backlog",
3054 .type = FIO_OPT_UNSUPPORTED,
3055 .help = "Fio does not support TRIM on your platform",
3058 .name = "trim_backlog_batch",
3059 .lname = "Trim backlog batch",
3060 .type = FIO_OPT_UNSUPPORTED,
3061 .help = "Fio does not support TRIM on your platform",
3065 .name = "write_iolog",
3066 .lname = "Write I/O log",
3067 .type = FIO_OPT_STR_STORE,
3068 .off1 = offsetof(struct thread_options, write_iolog_file),
3069 .help = "Store IO pattern to file",
3070 .category = FIO_OPT_C_IO,
3071 .group = FIO_OPT_G_IOLOG,
3074 .name = "read_iolog",
3075 .lname = "Read I/O log",
3076 .type = FIO_OPT_STR_STORE,
3077 .off1 = offsetof(struct thread_options, read_iolog_file),
3078 .help = "Playback IO pattern from file",
3079 .category = FIO_OPT_C_IO,
3080 .group = FIO_OPT_G_IOLOG,
3083 .name = "replay_no_stall",
3084 .lname = "Don't stall on replay",
3085 .type = FIO_OPT_BOOL,
3086 .off1 = offsetof(struct thread_options, no_stall),
3088 .parent = "read_iolog",
3090 .help = "Playback IO pattern file as fast as possible without stalls",
3091 .category = FIO_OPT_C_IO,
3092 .group = FIO_OPT_G_IOLOG,
3095 .name = "replay_redirect",
3096 .lname = "Redirect device for replay",
3097 .type = FIO_OPT_STR_STORE,
3098 .off1 = offsetof(struct thread_options, replay_redirect),
3099 .parent = "read_iolog",
3101 .help = "Replay all I/O onto this device, regardless of trace device",
3102 .category = FIO_OPT_C_IO,
3103 .group = FIO_OPT_G_IOLOG,
3106 .name = "replay_scale",
3107 .lname = "Replace offset scale factor",
3108 .type = FIO_OPT_INT,
3109 .off1 = offsetof(struct thread_options, replay_scale),
3110 .parent = "read_iolog",
3112 .help = "Align offsets to this blocksize",
3113 .category = FIO_OPT_C_IO,
3114 .group = FIO_OPT_G_IOLOG,
3117 .name = "replay_align",
3118 .lname = "Replace alignment",
3119 .type = FIO_OPT_INT,
3120 .off1 = offsetof(struct thread_options, replay_align),
3121 .parent = "read_iolog",
3122 .help = "Scale offset down by this factor",
3123 .category = FIO_OPT_C_IO,
3124 .group = FIO_OPT_G_IOLOG,
3128 .name = "exec_prerun",
3129 .lname = "Pre-execute runnable",
3130 .type = FIO_OPT_STR_STORE,
3131 .off1 = offsetof(struct thread_options, exec_prerun),
3132 .help = "Execute this file prior to running job",
3133 .category = FIO_OPT_C_GENERAL,
3134 .group = FIO_OPT_G_INVALID,
3137 .name = "exec_postrun",
3138 .lname = "Post-execute runnable",
3139 .type = FIO_OPT_STR_STORE,
3140 .off1 = offsetof(struct thread_options, exec_postrun),
3141 .help = "Execute this file after running job",
3142 .category = FIO_OPT_C_GENERAL,
3143 .group = FIO_OPT_G_INVALID,
3145 #ifdef FIO_HAVE_IOSCHED_SWITCH
3147 .name = "ioscheduler",
3148 .lname = "I/O scheduler",
3149 .type = FIO_OPT_STR_STORE,
3150 .off1 = offsetof(struct thread_options, ioscheduler),
3151 .help = "Use this IO scheduler on the backing device",
3152 .category = FIO_OPT_C_FILE,
3153 .group = FIO_OPT_G_INVALID,
3157 .name = "ioscheduler",
3158 .lname = "I/O scheduler",
3159 .type = FIO_OPT_UNSUPPORTED,
3160 .help = "Your platform does not support IO scheduler switching",
3165 .lname = "Zone size",
3166 .type = FIO_OPT_STR_VAL,
3167 .off1 = offsetof(struct thread_options, zone_size),
3168 .help = "Amount of data to read per zone",
3170 .interval = 1024 * 1024,
3171 .category = FIO_OPT_C_IO,
3172 .group = FIO_OPT_G_ZONE,
3175 .name = "zonerange",
3176 .lname = "Zone range",
3177 .type = FIO_OPT_STR_VAL,
3178 .off1 = offsetof(struct thread_options, zone_range),
3179 .help = "Give size of an IO zone",
3181 .interval = 1024 * 1024,
3182 .category = FIO_OPT_C_IO,
3183 .group = FIO_OPT_G_ZONE,
3187 .lname = "Zone skip",
3188 .type = FIO_OPT_STR_VAL,
3189 .off1 = offsetof(struct thread_options, zone_skip),
3190 .help = "Space between IO zones",
3192 .interval = 1024 * 1024,
3193 .category = FIO_OPT_C_IO,
3194 .group = FIO_OPT_G_ZONE,
3198 .lname = "Lock memory",
3199 .type = FIO_OPT_STR_VAL,
3200 .off1 = offsetof(struct thread_options, lockmem),
3201 .help = "Lock down this amount of memory (per worker)",
3203 .interval = 1024 * 1024,
3204 .category = FIO_OPT_C_GENERAL,
3205 .group = FIO_OPT_G_INVALID,
3208 .name = "rwmixread",
3209 .lname = "Read/write mix read",
3210 .type = FIO_OPT_INT,
3211 .cb = str_rwmix_read_cb,
3212 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3214 .help = "Percentage of mixed workload that is reads",
3217 .inverse = "rwmixwrite",
3218 .category = FIO_OPT_C_IO,
3219 .group = FIO_OPT_G_RWMIX,
3222 .name = "rwmixwrite",
3223 .lname = "Read/write mix write",
3224 .type = FIO_OPT_INT,
3225 .cb = str_rwmix_write_cb,
3226 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3228 .help = "Percentage of mixed workload that is writes",
3231 .inverse = "rwmixread",
3232 .category = FIO_OPT_C_IO,
3233 .group = FIO_OPT_G_RWMIX,
3236 .name = "rwmixcycle",
3237 .lname = "Read/write mix cycle",
3238 .type = FIO_OPT_DEPRECATED,
3239 .category = FIO_OPT_C_IO,
3240 .group = FIO_OPT_G_RWMIX,
3245 .type = FIO_OPT_INT,
3246 .off1 = offsetof(struct thread_options, nice),
3247 .help = "Set job CPU nice value",
3252 .category = FIO_OPT_C_GENERAL,
3253 .group = FIO_OPT_G_CRED,
3255 #ifdef FIO_HAVE_IOPRIO
3258 .lname = "I/O nice priority",
3259 .type = FIO_OPT_INT,
3260 .off1 = offsetof(struct thread_options, ioprio),
3261 .help = "Set job IO priority value",
3262 .minval = IOPRIO_MIN_PRIO,
3263 .maxval = IOPRIO_MAX_PRIO,
3265 .category = FIO_OPT_C_GENERAL,
3266 .group = FIO_OPT_G_CRED,
3271 .lname = "I/O nice priority",
3272 .type = FIO_OPT_UNSUPPORTED,
3273 .help = "Your platform does not support IO priorities",
3276 #ifdef FIO_HAVE_IOPRIO_CLASS
3277 #ifndef FIO_HAVE_IOPRIO
3278 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3281 .name = "prioclass",
3282 .lname = "I/O nice priority class",
3283 .type = FIO_OPT_INT,
3284 .off1 = offsetof(struct thread_options, ioprio_class),
3285 .help = "Set job IO priority class",
3286 .minval = IOPRIO_MIN_PRIO_CLASS,
3287 .maxval = IOPRIO_MAX_PRIO_CLASS,
3289 .category = FIO_OPT_C_GENERAL,
3290 .group = FIO_OPT_G_CRED,
3294 .name = "prioclass",
3295 .lname = "I/O nice priority class",
3296 .type = FIO_OPT_UNSUPPORTED,
3297 .help = "Your platform does not support IO priority classes",
3301 .name = "thinktime",
3302 .lname = "Thinktime",
3303 .type = FIO_OPT_INT,
3304 .off1 = offsetof(struct thread_options, thinktime),
3305 .help = "Idle time between IO buffers (usec)",
3308 .category = FIO_OPT_C_IO,
3309 .group = FIO_OPT_G_THINKTIME,
3312 .name = "thinktime_spin",
3313 .lname = "Thinktime spin",
3314 .type = FIO_OPT_INT,
3315 .off1 = offsetof(struct thread_options, thinktime_spin),
3316 .help = "Start think time by spinning this amount (usec)",
3319 .parent = "thinktime",
3321 .category = FIO_OPT_C_IO,
3322 .group = FIO_OPT_G_THINKTIME,
3325 .name = "thinktime_blocks",
3326 .lname = "Thinktime blocks",
3327 .type = FIO_OPT_INT,
3328 .off1 = offsetof(struct thread_options, thinktime_blocks),
3329 .help = "IO buffer period between 'thinktime'",
3331 .parent = "thinktime",
3333 .category = FIO_OPT_C_IO,
3334 .group = FIO_OPT_G_THINKTIME,
3338 .lname = "I/O rate",
3339 .type = FIO_OPT_INT,
3340 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3341 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3342 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
3343 .help = "Set bandwidth rate",
3344 .category = FIO_OPT_C_IO,
3345 .group = FIO_OPT_G_RATE,
3350 .lname = "I/O min rate",
3351 .type = FIO_OPT_INT,
3352 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
3353 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
3354 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
3355 .help = "Job must meet this rate or it will be shutdown",
3358 .category = FIO_OPT_C_IO,
3359 .group = FIO_OPT_G_RATE,
3362 .name = "rate_iops",
3363 .lname = "I/O rate IOPS",
3364 .type = FIO_OPT_INT,
3365 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
3366 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
3367 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
3368 .help = "Limit IO used to this number of IO operations/sec",
3370 .category = FIO_OPT_C_IO,
3371 .group = FIO_OPT_G_RATE,
3374 .name = "rate_iops_min",
3375 .lname = "I/O min rate IOPS",
3376 .type = FIO_OPT_INT,
3377 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
3378 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
3379 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
3380 .help = "Job must meet this rate or it will be shut down",
3381 .parent = "rate_iops",
3383 .category = FIO_OPT_C_IO,
3384 .group = FIO_OPT_G_RATE,
3387 .name = "rate_process",
3388 .lname = "Rate Process",
3389 .type = FIO_OPT_STR,
3390 .off1 = offsetof(struct thread_options, rate_process),
3391 .help = "What process controls how rated IO is managed",
3393 .category = FIO_OPT_C_IO,
3394 .group = FIO_OPT_G_RATE,
3397 .oval = RATE_PROCESS_LINEAR,
3398 .help = "Linear rate of IO",
3402 .oval = RATE_PROCESS_POISSON,
3403 .help = "Rate follows Poisson process",
3409 .name = "rate_cycle",
3410 .alias = "ratecycle",
3411 .lname = "I/O rate cycle",
3412 .type = FIO_OPT_INT,
3413 .off1 = offsetof(struct thread_options, ratecycle),
3414 .help = "Window average for rate limits (msec)",
3418 .category = FIO_OPT_C_IO,
3419 .group = FIO_OPT_G_RATE,
3422 .name = "max_latency",
3423 .lname = "Max Latency",
3424 .type = FIO_OPT_INT,
3425 .off1 = offsetof(struct thread_options, max_latency),
3426 .help = "Maximum tolerated IO latency (usec)",
3428 .category = FIO_OPT_C_IO,
3429 .group = FIO_OPT_G_LATPROF,
3432 .name = "latency_target",
3433 .lname = "Latency Target (usec)",
3434 .type = FIO_OPT_STR_VAL_TIME,
3435 .off1 = offsetof(struct thread_options, latency_target),
3436 .help = "Ramp to max queue depth supporting this latency",
3438 .category = FIO_OPT_C_IO,
3439 .group = FIO_OPT_G_LATPROF,
3442 .name = "latency_window",
3443 .lname = "Latency Window (usec)",
3444 .type = FIO_OPT_STR_VAL_TIME,
3445 .off1 = offsetof(struct thread_options, latency_window),
3446 .help = "Time to sustain latency_target",
3448 .category = FIO_OPT_C_IO,
3449 .group = FIO_OPT_G_LATPROF,
3452 .name = "latency_percentile",
3453 .lname = "Latency Percentile",
3454 .type = FIO_OPT_FLOAT_LIST,
3455 .off1 = offsetof(struct thread_options, latency_percentile),
3456 .help = "Percentile of IOs must be below latency_target",
3461 .category = FIO_OPT_C_IO,
3462 .group = FIO_OPT_G_LATPROF,
3465 .name = "invalidate",
3466 .lname = "Cache invalidate",
3467 .type = FIO_OPT_BOOL,
3468 .off1 = offsetof(struct thread_options, invalidate_cache),
3469 .help = "Invalidate buffer/page cache prior to running job",
3471 .category = FIO_OPT_C_IO,
3472 .group = FIO_OPT_G_IO_TYPE,
3476 .lname = "Synchronous I/O",
3477 .type = FIO_OPT_BOOL,
3478 .off1 = offsetof(struct thread_options, sync_io),
3479 .help = "Use O_SYNC for buffered writes",
3481 .parent = "buffered",
3483 .category = FIO_OPT_C_IO,
3484 .group = FIO_OPT_G_IO_TYPE,
3486 #ifdef FIO_HAVE_WRITE_HINT
3488 .name = "write_hint",
3489 .lname = "Write hint",
3490 .type = FIO_OPT_STR,
3491 .off1 = offsetof(struct thread_options, write_hint),
3492 .help = "Set expected write life time",
3493 .category = FIO_OPT_C_ENGINE,
3494 .group = FIO_OPT_G_INVALID,
3497 .oval = RWH_WRITE_LIFE_NONE,
3500 .oval = RWH_WRITE_LIFE_SHORT,
3503 .oval = RWH_WRITE_LIFE_MEDIUM,
3506 .oval = RWH_WRITE_LIFE_LONG,
3508 { .ival = "extreme",
3509 .oval = RWH_WRITE_LIFE_EXTREME,
3515 .name = "create_serialize",
3516 .lname = "Create serialize",
3517 .type = FIO_OPT_BOOL,
3518 .off1 = offsetof(struct thread_options, create_serialize),
3519 .help = "Serialize creation of job files",
3521 .category = FIO_OPT_C_FILE,
3522 .group = FIO_OPT_G_INVALID,
3525 .name = "create_fsync",
3526 .lname = "Create fsync",
3527 .type = FIO_OPT_BOOL,
3528 .off1 = offsetof(struct thread_options, create_fsync),
3529 .help = "fsync file after creation",
3531 .category = FIO_OPT_C_FILE,
3532 .group = FIO_OPT_G_INVALID,
3535 .name = "create_on_open",
3536 .lname = "Create on open",
3537 .type = FIO_OPT_BOOL,
3538 .off1 = offsetof(struct thread_options, create_on_open),
3539 .help = "Create files when they are opened for IO",
3541 .category = FIO_OPT_C_FILE,
3542 .group = FIO_OPT_G_INVALID,
3545 .name = "create_only",
3546 .lname = "Create Only",
3547 .type = FIO_OPT_BOOL,
3548 .off1 = offsetof(struct thread_options, create_only),
3549 .help = "Only perform file creation phase",
3550 .category = FIO_OPT_C_FILE,
3554 .name = "allow_file_create",
3555 .lname = "Allow file create",
3556 .type = FIO_OPT_BOOL,
3557 .off1 = offsetof(struct thread_options, allow_create),
3558 .help = "Permit fio to create files, if they don't exist",
3560 .category = FIO_OPT_C_FILE,
3561 .group = FIO_OPT_G_FILENAME,
3564 .name = "allow_mounted_write",
3565 .lname = "Allow mounted write",
3566 .type = FIO_OPT_BOOL,
3567 .off1 = offsetof(struct thread_options, allow_mounted_write),
3568 .help = "Allow writes to a mounted partition",
3570 .category = FIO_OPT_C_FILE,
3571 .group = FIO_OPT_G_FILENAME,
3575 .lname = "Pre-read files",
3576 .type = FIO_OPT_BOOL,
3577 .off1 = offsetof(struct thread_options, pre_read),
3578 .help = "Pre-read files before starting official testing",
3580 .category = FIO_OPT_C_FILE,
3581 .group = FIO_OPT_G_INVALID,
3583 #ifdef FIO_HAVE_CPU_AFFINITY
3586 .lname = "CPU mask",
3587 .type = FIO_OPT_INT,
3588 .cb = str_cpumask_cb,
3589 .off1 = offsetof(struct thread_options, cpumask),
3590 .help = "CPU affinity mask",
3591 .category = FIO_OPT_C_GENERAL,
3592 .group = FIO_OPT_G_CRED,
3595 .name = "cpus_allowed",
3596 .lname = "CPUs allowed",
3597 .type = FIO_OPT_STR,
3598 .cb = str_cpus_allowed_cb,
3599 .off1 = offsetof(struct thread_options, cpumask),
3600 .help = "Set CPUs allowed",
3601 .category = FIO_OPT_C_GENERAL,
3602 .group = FIO_OPT_G_CRED,
3605 .name = "cpus_allowed_policy",
3606 .lname = "CPUs allowed distribution policy",
3607 .type = FIO_OPT_STR,
3608 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
3609 .help = "Distribution policy for cpus_allowed",
3610 .parent = "cpus_allowed",
3614 .oval = FIO_CPUS_SHARED,
3615 .help = "Mask shared between threads",
3618 .oval = FIO_CPUS_SPLIT,
3619 .help = "Mask split between threads",
3622 .category = FIO_OPT_C_GENERAL,
3623 .group = FIO_OPT_G_CRED,
3628 .lname = "CPU mask",
3629 .type = FIO_OPT_UNSUPPORTED,
3630 .help = "Your platform does not support CPU affinities",
3633 .name = "cpus_allowed",
3634 .lname = "CPUs allowed",
3635 .type = FIO_OPT_UNSUPPORTED,
3636 .help = "Your platform does not support CPU affinities",
3639 .name = "cpus_allowed_policy",
3640 .lname = "CPUs allowed distribution policy",
3641 .type = FIO_OPT_UNSUPPORTED,
3642 .help = "Your platform does not support CPU affinities",
3645 #ifdef CONFIG_LIBNUMA
3647 .name = "numa_cpu_nodes",
3648 .lname = "NUMA CPU Nodes",
3649 .type = FIO_OPT_STR,
3650 .cb = str_numa_cpunodes_cb,
3651 .off1 = offsetof(struct thread_options, numa_cpunodes),
3652 .help = "NUMA CPU nodes bind",
3653 .category = FIO_OPT_C_GENERAL,
3654 .group = FIO_OPT_G_INVALID,
3657 .name = "numa_mem_policy",
3658 .lname = "NUMA Memory Policy",
3659 .type = FIO_OPT_STR,
3660 .cb = str_numa_mpol_cb,
3661 .off1 = offsetof(struct thread_options, numa_memnodes),
3662 .help = "NUMA memory policy setup",
3663 .category = FIO_OPT_C_GENERAL,
3664 .group = FIO_OPT_G_INVALID,
3668 .name = "numa_cpu_nodes",
3669 .lname = "NUMA CPU Nodes",
3670 .type = FIO_OPT_UNSUPPORTED,
3671 .help = "Build fio with libnuma-dev(el) to enable this option",
3674 .name = "numa_mem_policy",
3675 .lname = "NUMA Memory Policy",
3676 .type = FIO_OPT_UNSUPPORTED,
3677 .help = "Build fio with libnuma-dev(el) to enable this option",
3682 .name = "gpu_dev_id",
3683 .lname = "GPU device ID",
3684 .type = FIO_OPT_INT,
3685 .off1 = offsetof(struct thread_options, gpu_dev_id),
3686 .help = "Set GPU device ID for GPUDirect RDMA",
3688 .category = FIO_OPT_C_GENERAL,
3689 .group = FIO_OPT_G_INVALID,
3693 .name = "end_fsync",
3694 .lname = "End fsync",
3695 .type = FIO_OPT_BOOL,
3696 .off1 = offsetof(struct thread_options, end_fsync),
3697 .help = "Include fsync at the end of job",
3699 .category = FIO_OPT_C_FILE,
3700 .group = FIO_OPT_G_INVALID,
3703 .name = "fsync_on_close",
3704 .lname = "Fsync on close",
3705 .type = FIO_OPT_BOOL,
3706 .off1 = offsetof(struct thread_options, fsync_on_close),
3707 .help = "fsync files on close",
3709 .category = FIO_OPT_C_FILE,
3710 .group = FIO_OPT_G_INVALID,
3714 .lname = "Unlink file",
3715 .type = FIO_OPT_BOOL,
3716 .off1 = offsetof(struct thread_options, unlink),
3717 .help = "Unlink created files after job has completed",
3719 .category = FIO_OPT_C_FILE,
3720 .group = FIO_OPT_G_INVALID,
3723 .name = "unlink_each_loop",
3724 .lname = "Unlink file after each loop of a job",
3725 .type = FIO_OPT_BOOL,
3726 .off1 = offsetof(struct thread_options, unlink_each_loop),
3727 .help = "Unlink created files after each loop in a job has completed",
3729 .category = FIO_OPT_C_FILE,
3730 .group = FIO_OPT_G_INVALID,
3734 .lname = "Exit-all on terminate",
3735 .type = FIO_OPT_STR_SET,
3736 .cb = str_exitall_cb,
3737 .help = "Terminate all jobs when one exits",
3738 .category = FIO_OPT_C_GENERAL,
3739 .group = FIO_OPT_G_PROCESS,
3742 .name = "exitall_on_error",
3743 .lname = "Exit-all on terminate in error",
3744 .type = FIO_OPT_STR_SET,
3745 .off1 = offsetof(struct thread_options, exitall_error),
3746 .help = "Terminate all jobs when one exits in error",
3747 .category = FIO_OPT_C_GENERAL,
3748 .group = FIO_OPT_G_PROCESS,
3751 .name = "stonewall",
3752 .lname = "Wait for previous",
3753 .alias = "wait_for_previous",
3754 .type = FIO_OPT_STR_SET,
3755 .off1 = offsetof(struct thread_options, stonewall),
3756 .help = "Insert a hard barrier between this job and previous",
3757 .category = FIO_OPT_C_GENERAL,
3758 .group = FIO_OPT_G_PROCESS,
3761 .name = "new_group",
3762 .lname = "New group",
3763 .type = FIO_OPT_STR_SET,
3764 .off1 = offsetof(struct thread_options, new_group),
3765 .help = "Mark the start of a new group (for reporting)",
3766 .category = FIO_OPT_C_GENERAL,
3767 .group = FIO_OPT_G_PROCESS,
3772 .type = FIO_OPT_STR_SET,
3773 .off1 = offsetof(struct thread_options, use_thread),
3774 .help = "Use threads instead of processes",
3775 #ifdef CONFIG_NO_SHM
3779 .category = FIO_OPT_C_GENERAL,
3780 .group = FIO_OPT_G_PROCESS,
3783 .name = "per_job_logs",
3784 .lname = "Per Job Logs",
3785 .type = FIO_OPT_BOOL,
3786 .off1 = offsetof(struct thread_options, per_job_logs),
3787 .help = "Include job number in generated log files or not",
3789 .category = FIO_OPT_C_LOG,
3790 .group = FIO_OPT_G_INVALID,
3793 .name = "write_bw_log",
3794 .lname = "Write bandwidth log",
3795 .type = FIO_OPT_STR,
3796 .off1 = offsetof(struct thread_options, bw_log_file),
3797 .cb = str_write_bw_log_cb,
3798 .help = "Write log of bandwidth during run",
3799 .category = FIO_OPT_C_LOG,
3800 .group = FIO_OPT_G_INVALID,
3803 .name = "write_lat_log",
3804 .lname = "Write latency log",
3805 .type = FIO_OPT_STR,
3806 .off1 = offsetof(struct thread_options, lat_log_file),
3807 .cb = str_write_lat_log_cb,
3808 .help = "Write log of latency during run",
3809 .category = FIO_OPT_C_LOG,
3810 .group = FIO_OPT_G_INVALID,
3813 .name = "write_iops_log",
3814 .lname = "Write IOPS log",
3815 .type = FIO_OPT_STR,
3816 .off1 = offsetof(struct thread_options, iops_log_file),
3817 .cb = str_write_iops_log_cb,
3818 .help = "Write log of IOPS during run",
3819 .category = FIO_OPT_C_LOG,
3820 .group = FIO_OPT_G_INVALID,
3823 .name = "log_avg_msec",
3824 .lname = "Log averaging (msec)",
3825 .type = FIO_OPT_INT,
3826 .off1 = offsetof(struct thread_options, log_avg_msec),
3827 .help = "Average bw/iops/lat logs over this period of time",
3829 .category = FIO_OPT_C_LOG,
3830 .group = FIO_OPT_G_INVALID,
3833 .name = "log_hist_msec",
3834 .lname = "Log histograms (msec)",
3835 .type = FIO_OPT_INT,
3836 .off1 = offsetof(struct thread_options, log_hist_msec),
3837 .help = "Dump completion latency histograms at frequency of this time value",
3839 .category = FIO_OPT_C_LOG,
3840 .group = FIO_OPT_G_INVALID,
3843 .name = "log_hist_coarseness",
3844 .lname = "Histogram logs coarseness",
3845 .type = FIO_OPT_INT,
3846 .off1 = offsetof(struct thread_options, log_hist_coarseness),
3847 .help = "Integer in range [0,6]. Higher coarseness outputs"
3848 " fewer histogram bins per sample. The number of bins for"
3849 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
3851 .category = FIO_OPT_C_LOG,
3852 .group = FIO_OPT_G_INVALID,
3855 .name = "write_hist_log",
3856 .lname = "Write latency histogram logs",
3857 .type = FIO_OPT_STR,
3858 .off1 = offsetof(struct thread_options, hist_log_file),
3859 .cb = str_write_hist_log_cb,
3860 .help = "Write log of latency histograms during run",
3861 .category = FIO_OPT_C_LOG,
3862 .group = FIO_OPT_G_INVALID,
3865 .name = "log_max_value",
3866 .lname = "Log maximum instead of average",
3867 .type = FIO_OPT_BOOL,
3868 .off1 = offsetof(struct thread_options, log_max),
3869 .help = "Log max sample in a window instead of average",
3871 .category = FIO_OPT_C_LOG,
3872 .group = FIO_OPT_G_INVALID,
3875 .name = "log_offset",
3876 .lname = "Log offset of IO",
3877 .type = FIO_OPT_BOOL,
3878 .off1 = offsetof(struct thread_options, log_offset),
3879 .help = "Include offset of IO for each log entry",
3881 .category = FIO_OPT_C_LOG,
3882 .group = FIO_OPT_G_INVALID,
3886 .name = "log_compression",
3887 .lname = "Log compression",
3888 .type = FIO_OPT_INT,
3889 .off1 = offsetof(struct thread_options, log_gz),
3890 .help = "Log in compressed chunks of this size",
3892 .maxval = 512 * 1024 * 1024ULL,
3893 .category = FIO_OPT_C_LOG,
3894 .group = FIO_OPT_G_INVALID,
3896 #ifdef FIO_HAVE_CPU_AFFINITY
3898 .name = "log_compression_cpus",
3899 .lname = "Log Compression CPUs",
3900 .type = FIO_OPT_STR,
3901 .cb = str_log_cpus_allowed_cb,
3902 .off1 = offsetof(struct thread_options, log_gz_cpumask),
3903 .parent = "log_compression",
3904 .help = "Limit log compression to these CPUs",
3905 .category = FIO_OPT_C_LOG,
3906 .group = FIO_OPT_G_INVALID,
3910 .name = "log_compression_cpus",
3911 .lname = "Log Compression CPUs",
3912 .type = FIO_OPT_UNSUPPORTED,
3913 .help = "Your platform does not support CPU affinities",
3917 .name = "log_store_compressed",
3918 .lname = "Log store compressed",
3919 .type = FIO_OPT_BOOL,
3920 .off1 = offsetof(struct thread_options, log_gz_store),
3921 .help = "Store logs in a compressed format",
3922 .category = FIO_OPT_C_LOG,
3923 .group = FIO_OPT_G_INVALID,
3927 .name = "log_compression",
3928 .lname = "Log compression",
3929 .type = FIO_OPT_UNSUPPORTED,
3930 .help = "Install libz-dev(el) to get compression support",
3933 .name = "log_store_compressed",
3934 .lname = "Log store compressed",
3935 .type = FIO_OPT_UNSUPPORTED,
3936 .help = "Install libz-dev(el) to get compression support",
3940 .name = "log_unix_epoch",
3941 .lname = "Log epoch unix",
3942 .type = FIO_OPT_BOOL,
3943 .off1 = offsetof(struct thread_options, log_unix_epoch),
3944 .help = "Use Unix time in log files",
3945 .category = FIO_OPT_C_LOG,
3946 .group = FIO_OPT_G_INVALID,
3949 .name = "block_error_percentiles",
3950 .lname = "Block error percentiles",
3951 .type = FIO_OPT_BOOL,
3952 .off1 = offsetof(struct thread_options, block_error_hist),
3953 .help = "Record trim block errors and make a histogram",
3955 .category = FIO_OPT_C_LOG,
3956 .group = FIO_OPT_G_INVALID,
3959 .name = "bwavgtime",
3960 .lname = "Bandwidth average time",
3961 .type = FIO_OPT_INT,
3962 .off1 = offsetof(struct thread_options, bw_avg_time),
3963 .help = "Time window over which to calculate bandwidth"
3966 .parent = "write_bw_log",
3969 .category = FIO_OPT_C_LOG,
3970 .group = FIO_OPT_G_INVALID,
3973 .name = "iopsavgtime",
3974 .lname = "IOPS average time",
3975 .type = FIO_OPT_INT,
3976 .off1 = offsetof(struct thread_options, iops_avg_time),
3977 .help = "Time window over which to calculate IOPS (msec)",
3979 .parent = "write_iops_log",
3982 .category = FIO_OPT_C_LOG,
3983 .group = FIO_OPT_G_INVALID,
3986 .name = "group_reporting",
3987 .lname = "Group reporting",
3988 .type = FIO_OPT_STR_SET,
3989 .off1 = offsetof(struct thread_options, group_reporting),
3990 .help = "Do reporting on a per-group basis",
3991 .category = FIO_OPT_C_STAT,
3992 .group = FIO_OPT_G_INVALID,
3997 .type = FIO_OPT_BOOL,
3998 .off1 = offsetof(struct thread_options, stats),
3999 .help = "Enable collection of stats",
4001 .category = FIO_OPT_C_STAT,
4002 .group = FIO_OPT_G_INVALID,
4005 .name = "zero_buffers",
4006 .lname = "Zero I/O buffers",
4007 .type = FIO_OPT_STR_SET,
4008 .off1 = offsetof(struct thread_options, zero_buffers),
4009 .help = "Init IO buffers to all zeroes",
4010 .category = FIO_OPT_C_IO,
4011 .group = FIO_OPT_G_IO_BUF,
4014 .name = "refill_buffers",
4015 .lname = "Refill I/O buffers",
4016 .type = FIO_OPT_STR_SET,
4017 .off1 = offsetof(struct thread_options, refill_buffers),
4018 .help = "Refill IO buffers on every IO submit",
4019 .category = FIO_OPT_C_IO,
4020 .group = FIO_OPT_G_IO_BUF,
4023 .name = "scramble_buffers",
4024 .lname = "Scramble I/O buffers",
4025 .type = FIO_OPT_BOOL,
4026 .off1 = offsetof(struct thread_options, scramble_buffers),
4027 .help = "Slightly scramble buffers on every IO submit",
4029 .category = FIO_OPT_C_IO,
4030 .group = FIO_OPT_G_IO_BUF,
4033 .name = "buffer_pattern",
4034 .lname = "Buffer pattern",
4035 .type = FIO_OPT_STR,
4036 .cb = str_buffer_pattern_cb,
4037 .off1 = offsetof(struct thread_options, buffer_pattern),
4038 .help = "Fill pattern for IO buffers",
4039 .category = FIO_OPT_C_IO,
4040 .group = FIO_OPT_G_IO_BUF,
4043 .name = "buffer_compress_percentage",
4044 .lname = "Buffer compression percentage",
4045 .type = FIO_OPT_INT,
4046 .cb = str_buffer_compress_cb,
4047 .off1 = offsetof(struct thread_options, compress_percentage),
4050 .help = "How compressible the buffer is (approximately)",
4052 .category = FIO_OPT_C_IO,
4053 .group = FIO_OPT_G_IO_BUF,
4056 .name = "buffer_compress_chunk",
4057 .lname = "Buffer compression chunk size",
4058 .type = FIO_OPT_INT,
4059 .off1 = offsetof(struct thread_options, compress_chunk),
4060 .parent = "buffer_compress_percentage",
4062 .help = "Size of compressible region in buffer",
4065 .category = FIO_OPT_C_IO,
4066 .group = FIO_OPT_G_IO_BUF,
4069 .name = "dedupe_percentage",
4070 .lname = "Dedupe percentage",
4071 .type = FIO_OPT_INT,
4072 .cb = str_dedupe_cb,
4073 .off1 = offsetof(struct thread_options, dedupe_percentage),
4076 .help = "Percentage of buffers that are dedupable",
4078 .category = FIO_OPT_C_IO,
4079 .group = FIO_OPT_G_IO_BUF,
4082 .name = "clat_percentiles",
4083 .lname = "Completion latency percentiles",
4084 .type = FIO_OPT_BOOL,
4085 .off1 = offsetof(struct thread_options, clat_percentiles),
4086 .help = "Enable the reporting of completion latency percentiles",
4088 .inverse = "lat_percentiles",
4089 .category = FIO_OPT_C_STAT,
4090 .group = FIO_OPT_G_INVALID,
4093 .name = "lat_percentiles",
4094 .lname = "IO latency percentiles",
4095 .type = FIO_OPT_BOOL,
4096 .off1 = offsetof(struct thread_options, lat_percentiles),
4097 .help = "Enable the reporting of IO latency percentiles",
4099 .inverse = "clat_percentiles",
4100 .category = FIO_OPT_C_STAT,
4101 .group = FIO_OPT_G_INVALID,
4104 .name = "percentile_list",
4105 .lname = "Percentile list",
4106 .type = FIO_OPT_FLOAT_LIST,
4107 .off1 = offsetof(struct thread_options, percentile_list),
4108 .off2 = offsetof(struct thread_options, percentile_precision),
4109 .help = "Specify a custom list of percentiles to report for "
4110 "completion latency and block errors",
4111 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
4112 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4115 .category = FIO_OPT_C_STAT,
4116 .group = FIO_OPT_G_INVALID,
4119 .name = "significant_figures",
4120 .lname = "Significant figures",
4121 .type = FIO_OPT_INT,
4122 .off1 = offsetof(struct thread_options, sig_figs),
4125 .help = "Significant figures for output-format set to normal",
4128 .category = FIO_OPT_C_STAT,
4129 .group = FIO_OPT_G_INVALID,
4132 #ifdef FIO_HAVE_DISK_UTIL
4134 .name = "disk_util",
4135 .lname = "Disk utilization",
4136 .type = FIO_OPT_BOOL,
4137 .off1 = offsetof(struct thread_options, do_disk_util),
4138 .help = "Log disk utilization statistics",
4140 .category = FIO_OPT_C_STAT,
4141 .group = FIO_OPT_G_INVALID,
4145 .name = "disk_util",
4146 .lname = "Disk utilization",
4147 .type = FIO_OPT_UNSUPPORTED,
4148 .help = "Your platform does not support disk utilization",
4152 .name = "gtod_reduce",
4153 .lname = "Reduce gettimeofday() calls",
4154 .type = FIO_OPT_BOOL,
4155 .help = "Greatly reduce number of gettimeofday() calls",
4156 .cb = str_gtod_reduce_cb,
4159 .category = FIO_OPT_C_STAT,
4160 .group = FIO_OPT_G_INVALID,
4163 .name = "disable_lat",
4164 .lname = "Disable all latency stats",
4165 .type = FIO_OPT_BOOL,
4166 .off1 = offsetof(struct thread_options, disable_lat),
4167 .help = "Disable latency numbers",
4168 .parent = "gtod_reduce",
4171 .category = FIO_OPT_C_STAT,
4172 .group = FIO_OPT_G_INVALID,
4175 .name = "disable_clat",
4176 .lname = "Disable completion latency stats",
4177 .type = FIO_OPT_BOOL,
4178 .off1 = offsetof(struct thread_options, disable_clat),
4179 .help = "Disable completion latency numbers",
4180 .parent = "gtod_reduce",
4183 .category = FIO_OPT_C_STAT,
4184 .group = FIO_OPT_G_INVALID,
4187 .name = "disable_slat",
4188 .lname = "Disable submission latency stats",
4189 .type = FIO_OPT_BOOL,
4190 .off1 = offsetof(struct thread_options, disable_slat),
4191 .help = "Disable submission latency numbers",
4192 .parent = "gtod_reduce",
4195 .category = FIO_OPT_C_STAT,
4196 .group = FIO_OPT_G_INVALID,
4199 .name = "disable_bw_measurement",
4200 .alias = "disable_bw",
4201 .lname = "Disable bandwidth stats",
4202 .type = FIO_OPT_BOOL,
4203 .off1 = offsetof(struct thread_options, disable_bw),
4204 .help = "Disable bandwidth logging",
4205 .parent = "gtod_reduce",
4208 .category = FIO_OPT_C_STAT,
4209 .group = FIO_OPT_G_INVALID,
4213 .lname = "Dedicated gettimeofday() CPU",
4214 .type = FIO_OPT_INT,
4215 .off1 = offsetof(struct thread_options, gtod_cpu),
4216 .help = "Set up dedicated gettimeofday() thread on this CPU",
4217 .verify = gtod_cpu_verify,
4218 .category = FIO_OPT_C_GENERAL,
4219 .group = FIO_OPT_G_CLOCK,
4222 .name = "unified_rw_reporting",
4223 .lname = "Unified RW Reporting",
4224 .type = FIO_OPT_BOOL,
4225 .off1 = offsetof(struct thread_options, unified_rw_rep),
4226 .help = "Unify reporting across data direction",
4228 .category = FIO_OPT_C_GENERAL,
4229 .group = FIO_OPT_G_INVALID,
4232 .name = "continue_on_error",
4233 .lname = "Continue on error",
4234 .type = FIO_OPT_STR,
4235 .off1 = offsetof(struct thread_options, continue_on_error),
4236 .help = "Continue on non-fatal errors during IO",
4238 .category = FIO_OPT_C_GENERAL,
4239 .group = FIO_OPT_G_ERR,
4242 .oval = ERROR_TYPE_NONE,
4243 .help = "Exit when an error is encountered",
4246 .oval = ERROR_TYPE_READ,
4247 .help = "Continue on read errors only",
4250 .oval = ERROR_TYPE_WRITE,
4251 .help = "Continue on write errors only",
4254 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
4255 .help = "Continue on any IO errors",
4258 .oval = ERROR_TYPE_VERIFY,
4259 .help = "Continue on verify errors only",
4262 .oval = ERROR_TYPE_ANY,
4263 .help = "Continue on all io and verify errors",
4266 .oval = ERROR_TYPE_NONE,
4267 .help = "Alias for 'none'",
4270 .oval = ERROR_TYPE_ANY,
4271 .help = "Alias for 'all'",
4276 .name = "ignore_error",
4277 .lname = "Ignore Error",
4278 .type = FIO_OPT_STR,
4279 .cb = str_ignore_error_cb,
4280 .off1 = offsetof(struct thread_options, ignore_error_nr),
4281 .help = "Set a specific list of errors to ignore",
4283 .category = FIO_OPT_C_GENERAL,
4284 .group = FIO_OPT_G_ERR,
4287 .name = "error_dump",
4288 .lname = "Error Dump",
4289 .type = FIO_OPT_BOOL,
4290 .off1 = offsetof(struct thread_options, error_dump),
4292 .help = "Dump info on each error",
4293 .category = FIO_OPT_C_GENERAL,
4294 .group = FIO_OPT_G_ERR,
4299 .type = FIO_OPT_STR_STORE,
4300 .off1 = offsetof(struct thread_options, profile),
4301 .help = "Select a specific builtin performance test",
4302 .category = FIO_OPT_C_PROFILE,
4303 .group = FIO_OPT_G_INVALID,
4308 .type = FIO_OPT_STR_STORE,
4309 .off1 = offsetof(struct thread_options, cgroup),
4310 .help = "Add job to cgroup of this name",
4311 .category = FIO_OPT_C_GENERAL,
4312 .group = FIO_OPT_G_CGROUP,
4315 .name = "cgroup_nodelete",
4316 .lname = "Cgroup no-delete",
4317 .type = FIO_OPT_BOOL,
4318 .off1 = offsetof(struct thread_options, cgroup_nodelete),
4319 .help = "Do not delete cgroups after job completion",
4322 .category = FIO_OPT_C_GENERAL,
4323 .group = FIO_OPT_G_CGROUP,
4326 .name = "cgroup_weight",
4327 .lname = "Cgroup weight",
4328 .type = FIO_OPT_INT,
4329 .off1 = offsetof(struct thread_options, cgroup_weight),
4330 .help = "Use given weight for cgroup",
4334 .category = FIO_OPT_C_GENERAL,
4335 .group = FIO_OPT_G_CGROUP,
4340 .type = FIO_OPT_INT,
4341 .off1 = offsetof(struct thread_options, uid),
4342 .help = "Run job with this user ID",
4343 .category = FIO_OPT_C_GENERAL,
4344 .group = FIO_OPT_G_CRED,
4348 .lname = "Group ID",
4349 .type = FIO_OPT_INT,
4350 .off1 = offsetof(struct thread_options, gid),
4351 .help = "Run job with this group ID",
4352 .category = FIO_OPT_C_GENERAL,
4353 .group = FIO_OPT_G_CRED,
4358 .type = FIO_OPT_INT,
4359 .off1 = offsetof(struct thread_options, kb_base),
4365 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
4369 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
4372 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
4373 .category = FIO_OPT_C_GENERAL,
4374 .group = FIO_OPT_G_INVALID,
4377 .name = "unit_base",
4378 .lname = "Unit for quantities of data (Bits or Bytes)",
4379 .type = FIO_OPT_INT,
4380 .off1 = offsetof(struct thread_options, unit_base),
4385 .help = "Auto-detect",
4389 .help = "Normal (byte based)",
4393 .help = "Bit based",
4396 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
4397 .category = FIO_OPT_C_GENERAL,
4398 .group = FIO_OPT_G_INVALID,
4401 .name = "hugepage-size",
4402 .lname = "Hugepage size",
4403 .type = FIO_OPT_INT,
4404 .off1 = offsetof(struct thread_options, hugepage_size),
4405 .help = "When using hugepages, specify size of each page",
4406 .def = __fio_stringify(FIO_HUGE_PAGE),
4407 .interval = 1024 * 1024,
4408 .category = FIO_OPT_C_GENERAL,
4409 .group = FIO_OPT_G_INVALID,
4413 .lname = "I/O flow ID",
4414 .type = FIO_OPT_INT,
4415 .off1 = offsetof(struct thread_options, flow_id),
4416 .help = "The flow index ID to use",
4418 .category = FIO_OPT_C_IO,
4419 .group = FIO_OPT_G_IO_FLOW,
4423 .lname = "I/O flow weight",
4424 .type = FIO_OPT_INT,
4425 .off1 = offsetof(struct thread_options, flow),
4426 .help = "Weight for flow control of this job",
4427 .parent = "flow_id",
4430 .category = FIO_OPT_C_IO,
4431 .group = FIO_OPT_G_IO_FLOW,
4434 .name = "flow_watermark",
4435 .lname = "I/O flow watermark",
4436 .type = FIO_OPT_INT,
4437 .off1 = offsetof(struct thread_options, flow_watermark),
4438 .help = "High watermark for flow control. This option"
4439 " should be set to the same value for all threads"
4440 " with non-zero flow.",
4441 .parent = "flow_id",
4444 .category = FIO_OPT_C_IO,
4445 .group = FIO_OPT_G_IO_FLOW,
4448 .name = "flow_sleep",
4449 .lname = "I/O flow sleep",
4450 .type = FIO_OPT_INT,
4451 .off1 = offsetof(struct thread_options, flow_sleep),
4452 .help = "How many microseconds to sleep after being held"
4453 " back by the flow control mechanism",
4454 .parent = "flow_id",
4457 .category = FIO_OPT_C_IO,
4458 .group = FIO_OPT_G_IO_FLOW,
4461 .name = "steadystate",
4462 .lname = "Steady state threshold",
4464 .type = FIO_OPT_STR,
4465 .off1 = offsetof(struct thread_options, ss_state),
4466 .cb = str_steadystate_cb,
4467 .help = "Define the criterion and limit to judge when a job has reached steady state",
4468 .def = "iops_slope:0.01%",
4471 .oval = FIO_SS_IOPS,
4472 .help = "maximum mean deviation of IOPS measurements",
4474 { .ival = "iops_slope",
4475 .oval = FIO_SS_IOPS_SLOPE,
4476 .help = "slope calculated from IOPS measurements",
4480 .help = "maximum mean deviation of bandwidth measurements",
4484 .oval = FIO_SS_BW_SLOPE,
4485 .help = "slope calculated from bandwidth measurements",
4488 .category = FIO_OPT_C_GENERAL,
4489 .group = FIO_OPT_G_RUNTIME,
4492 .name = "steadystate_duration",
4493 .lname = "Steady state duration",
4495 .parent = "steadystate",
4496 .type = FIO_OPT_STR_VAL_TIME,
4497 .off1 = offsetof(struct thread_options, ss_dur),
4498 .help = "Stop workload upon attaining steady state for specified duration",
4502 .category = FIO_OPT_C_GENERAL,
4503 .group = FIO_OPT_G_RUNTIME,
4506 .name = "steadystate_ramp_time",
4507 .lname = "Steady state ramp time",
4509 .parent = "steadystate",
4510 .type = FIO_OPT_STR_VAL_TIME,
4511 .off1 = offsetof(struct thread_options, ss_ramp_time),
4512 .help = "Delay before initiation of data collection for steady state job termination testing",
4516 .category = FIO_OPT_C_GENERAL,
4517 .group = FIO_OPT_G_RUNTIME,
4524 static void add_to_lopt(struct option *lopt, struct fio_option *o,
4525 const char *name, int val)
4527 lopt->name = (char *) name;
4529 if (o->type == FIO_OPT_STR_SET)
4530 lopt->has_arg = optional_argument;
4532 lopt->has_arg = required_argument;
4535 static void options_to_lopts(struct fio_option *opts,
4536 struct option *long_options,
4537 int i, int option_type)
4539 struct fio_option *o = &opts[0];
4541 add_to_lopt(&long_options[i], o, o->name, option_type);
4544 add_to_lopt(&long_options[i], o, o->alias, option_type);
4549 assert(i < FIO_NR_OPTIONS);
4553 void fio_options_set_ioengine_opts(struct option *long_options,
4554 struct thread_data *td)
4559 while (long_options[i].name) {
4560 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
4561 memset(&long_options[i], 0, sizeof(*long_options));
4568 * Just clear out the prior ioengine options.
4573 options_to_lopts(td->io_ops->options, long_options, i,
4574 FIO_GETOPT_IOENGINE);
4577 void fio_options_dup_and_init(struct option *long_options)
4581 options_init(fio_options);
4584 while (long_options[i].name)
4587 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
4590 struct fio_keyword {
4596 static struct fio_keyword fio_keywords[] = {
4598 .word = "$pagesize",
4599 .desc = "Page size in the system",
4602 .word = "$mb_memory",
4603 .desc = "Megabytes of memory online",
4607 .desc = "Number of CPUs online in the system",
4614 void fio_keywords_exit(void)
4616 struct fio_keyword *kw;
4618 kw = &fio_keywords[0];
4626 void fio_keywords_init(void)
4628 unsigned long long mb_memory;
4632 sprintf(buf, "%lu", (unsigned long) page_size);
4633 fio_keywords[0].replace = strdup(buf);
4635 mb_memory = os_phys_mem() / (1024 * 1024);
4636 sprintf(buf, "%llu", mb_memory);
4637 fio_keywords[1].replace = strdup(buf);
4640 sprintf(buf, "%lu", l);
4641 fio_keywords[2].replace = strdup(buf);
4646 static char *bc_calc(char *str)
4648 char buf[128], *tmp;
4653 * No math, just return string
4655 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
4656 !strchr(str, '/')) || strchr(str, '\''))
4660 * Split option from value, we only need to calculate the value
4662 tmp = strchr(str, '=');
4669 * Prevent buffer overflows; such a case isn't reasonable anyway
4671 if (strlen(str) >= 128 || strlen(tmp) > 100)
4674 sprintf(buf, "which %s > /dev/null", BC_APP);
4676 log_err("fio: bc is needed for performing math\n");
4680 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
4681 f = popen(buf, "r");
4685 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
4692 buf[(tmp - str) + ret - 1] = '\0';
4693 memcpy(buf, str, tmp - str);
4699 * Return a copy of the input string with substrings of the form ${VARNAME}
4700 * substituted with the value of the environment variable VARNAME. The
4701 * substitution always occurs, even if VARNAME is empty or the corresponding
4702 * environment variable undefined.
4704 static char *option_dup_subs(const char *opt)
4706 char out[OPT_LEN_MAX+1];
4707 char in[OPT_LEN_MAX+1];
4710 char *ch1, *ch2, *env;
4711 ssize_t nchr = OPT_LEN_MAX;
4714 if (strlen(opt) + 1 > OPT_LEN_MAX) {
4715 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
4719 in[OPT_LEN_MAX] = '\0';
4720 strncpy(in, opt, OPT_LEN_MAX);
4722 while (*inptr && nchr > 0) {
4723 if (inptr[0] == '$' && inptr[1] == '{') {
4724 ch2 = strchr(inptr, '}');
4725 if (ch2 && inptr+1 < ch2) {
4732 envlen = strlen(env);
4733 if (envlen <= nchr) {
4734 memcpy(outptr, env, envlen);
4744 *outptr++ = *inptr++;
4753 * Look for reserved variable names and replace them with real values
4755 static char *fio_keyword_replace(char *opt)
4761 for (i = 0; fio_keywords[i].word != NULL; i++) {
4762 struct fio_keyword *kw = &fio_keywords[i];
4764 while ((s = strstr(opt, kw->word)) != NULL) {
4765 char *new = malloc(strlen(opt) + 1);
4771 * Copy part of the string before the keyword and
4772 * sprintf() the replacement after it.
4774 memcpy(new, opt, olen);
4775 len = sprintf(new + olen, "%s", kw->replace);
4778 * If there's more in the original string, copy that
4781 opt += strlen(kw->word) + olen;
4783 memcpy(new + olen + len, opt, opt - o_org - 1);
4786 * replace opt and free the old opt
4796 * Check for potential math and invoke bc, if possible
4804 static char **dup_and_sub_options(char **opts, int num_opts)
4807 char **opts_copy = malloc(num_opts * sizeof(*opts));
4808 for (i = 0; i < num_opts; i++) {
4809 opts_copy[i] = option_dup_subs(opts[i]);
4812 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
4817 static void show_closest_option(const char *opt)
4819 int best_option, best_distance;
4828 while (name[i] != '\0' && name[i] != '=')
4833 best_distance = INT_MAX;
4835 while (fio_options[i].name) {
4836 distance = string_distance(name, fio_options[i].name);
4837 if (distance < best_distance) {
4838 best_distance = distance;
4844 if (best_option != -1 && string_distance_ok(name, best_distance) &&
4845 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
4846 log_err("Did you mean %s?\n", fio_options[best_option].name);
4851 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
4853 int i, ret, unknown;
4856 sort_options(opts, fio_options, num_opts);
4857 opts_copy = dup_and_sub_options(opts, num_opts);
4859 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
4860 struct fio_option *o;
4861 int newret = parse_option(opts_copy[i], opts[i], fio_options,
4862 &o, &td->o, &td->opt_list);
4865 fio_option_mark_set(&td->o, o);
4873 opts_copy[i] = NULL;
4880 ret |= ioengine_load(td);
4882 sort_options(opts_copy, td->io_ops->options, num_opts);
4885 for (i = 0; i < num_opts; i++) {
4886 struct fio_option *o = NULL;
4893 newret = parse_option(opts_copy[i], opts[i],
4894 td->io_ops->options, &o,
4895 td->eo, &td->opt_list);
4899 log_err("Bad option <%s>\n", opts[i]);
4900 show_closest_option(opts[i]);
4903 opts_copy[i] = NULL;
4911 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
4915 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
4917 struct fio_option *o;
4919 o = find_option(fio_options, opt);
4921 fio_option_mark_set(&td->o, o);
4927 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
4930 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
4934 void fio_fill_default_options(struct thread_data *td)
4936 td->o.magic = OPT_MAGIC;
4937 fill_default_options(&td->o, fio_options);
4940 int fio_show_option_help(const char *opt)
4942 return show_cmd_help(fio_options, opt);
4946 * dupe FIO_OPT_STR_STORE options
4948 void fio_options_mem_dupe(struct thread_data *td)
4950 options_mem_dupe(fio_options, &td->o);
4952 if (td->eo && td->io_ops) {
4953 void *oldeo = td->eo;
4955 td->eo = malloc(td->io_ops->option_struct_size);
4956 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
4957 options_mem_dupe(td->io_ops->options, td->eo);
4961 unsigned int fio_get_kb_base(void *data)
4963 struct thread_data *td = cb_data_to_td(data);
4964 struct thread_options *o = &td->o;
4965 unsigned int kb_base = 0;
4968 * This is a hack... For private options, *data is not holding
4969 * a pointer to the thread_options, but to private data. This means
4970 * we can't safely dereference it, but magic is first so mem wise
4971 * it is valid. But this also means that if the job first sets
4972 * kb_base and expects that to be honored by private options,
4973 * it will be disappointed. We will return the global default
4976 if (o && o->magic == OPT_MAGIC)
4977 kb_base = o->kb_base;
4984 int add_option(struct fio_option *o)
4986 struct fio_option *__o;
4995 if (opt_index + 1 == FIO_MAX_OPTS) {
4996 log_err("fio: FIO_MAX_OPTS is too small\n");
5000 memcpy(&fio_options[opt_index], o, sizeof(*o));
5001 fio_options[opt_index + 1].name = NULL;
5005 void invalidate_profile_options(const char *prof_name)
5007 struct fio_option *o;
5011 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5012 o->type = FIO_OPT_INVALID;
5013 o->prof_name = NULL;
5019 void add_opt_posval(const char *optname, const char *ival, const char *help)
5021 struct fio_option *o;
5024 o = find_option(fio_options, optname);
5028 for (i = 0; i < PARSE_MAX_VP; i++) {
5029 if (o->posval[i].ival)
5032 o->posval[i].ival = ival;
5033 o->posval[i].help = help;
5038 void del_opt_posval(const char *optname, const char *ival)
5040 struct fio_option *o;
5043 o = find_option(fio_options, optname);
5047 for (i = 0; i < PARSE_MAX_VP; i++) {
5048 if (!o->posval[i].ival)
5050 if (strcmp(o->posval[i].ival, ival))
5053 o->posval[i].ival = NULL;
5054 o->posval[i].help = NULL;
5058 void fio_options_free(struct thread_data *td)
5060 options_free(fio_options, &td->o);
5061 if (td->eo && td->io_ops && td->io_ops->options) {
5062 options_free(td->io_ops->options, td->eo);
5068 struct fio_option *fio_option_find(const char *name)
5070 return find_option(fio_options, name);
5073 static struct fio_option *find_next_opt(struct thread_options *o,
5074 struct fio_option *from,
5077 struct fio_option *opt;
5080 from = &fio_options[0];
5086 if (off1 == from->off1) {
5091 } while (from->name);
5096 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5098 unsigned int opt_off, index, offset;
5100 opt_off = opt - &fio_options[0];
5101 index = opt_off / (8 * sizeof(uint64_t));
5102 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5103 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
5106 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
5108 struct fio_option *opt, *next;
5111 while ((opt = find_next_opt(o, next, off1)) != NULL) {
5112 if (opt_is_set(o, opt))
5121 void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)
5123 unsigned int opt_off, index, offset;
5125 opt_off = opt - &fio_options[0];
5126 index = opt_off / (8 * sizeof(uint64_t));
5127 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5128 o->set_options[index] |= (uint64_t)1 << offset;