8 #include <netinet/in.h>
13 #include "lib/pattern.h"
18 char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
20 #define cb_data_to_td(data) container_of(data, struct thread_data, o)
22 static const struct pattern_fmt_desc fmt_desc[] = {
25 .len = FIELD_SIZE(struct io_u *, offset),
26 .paste = paste_blockoff
32 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
34 static char *get_opt_postfix(const char *str)
36 char *p = strstr(str, ":");
42 strip_blank_front(&p);
47 static int bs_cmp(const void *p1, const void *p2)
49 const struct bssplit *bsp1 = p1;
50 const struct bssplit *bsp2 = p2;
52 return (int) bsp1->perc - (int) bsp2->perc;
57 unsigned long long val1[ZONESPLIT_MAX];
58 unsigned long long val2[ZONESPLIT_MAX];
61 static int split_parse_ddir(struct thread_options *o, struct split *split,
62 char *str, bool absolute, unsigned int max_splits)
64 unsigned long long perc;
72 while ((fname = strsep(&str, ":")) != NULL) {
78 perc_str = strstr(fname, "/");
83 if (str_to_decimal(perc_str, &val, 1, o, 0, 0)) {
84 log_err("fio: split conversion failed\n");
89 perc = atoi(perc_str);
102 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
103 log_err("fio: split conversion failed\n");
107 split->val1[i] = val;
108 split->val2[i] = perc;
110 if (i == max_splits) {
111 log_err("fio: hit max of %d split entries\n", i);
120 static int bssplit_ddir(struct thread_options *o, enum fio_ddir ddir, char *str,
123 unsigned int i, perc, perc_missing;
124 unsigned long long max_bs, min_bs;
127 memset(&split, 0, sizeof(split));
129 if (split_parse_ddir(o, &split, str, data, BSSPLIT_MAX))
136 o->bssplit[ddir] = malloc(split.nr * sizeof(struct bssplit));
137 o->bssplit_nr[ddir] = split.nr;
138 for (i = 0; i < split.nr; i++) {
139 if (split.val1[i] > max_bs)
140 max_bs = split.val1[i];
141 if (split.val1[i] < min_bs)
142 min_bs = split.val1[i];
144 o->bssplit[ddir][i].bs = split.val1[i];
145 o->bssplit[ddir][i].perc =split.val2[i];
149 * Now check if the percentages add up, and how much is missing
151 perc = perc_missing = 0;
152 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
153 struct bssplit *bsp = &o->bssplit[ddir][i];
155 if (bsp->perc == -1U)
161 if (perc > 100 && perc_missing > 1) {
162 log_err("fio: bssplit percentages add to more than 100%%\n");
163 free(o->bssplit[ddir]);
164 o->bssplit[ddir] = NULL;
169 * If values didn't have a percentage set, divide the remains between
173 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
175 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
176 struct bssplit *bsp = &o->bssplit[ddir][i];
178 if (bsp->perc == -1U)
179 bsp->perc = (100 - perc) / perc_missing;
183 o->min_bs[ddir] = min_bs;
184 o->max_bs[ddir] = max_bs;
187 * now sort based on percentages, for ease of lookup
189 qsort(o->bssplit[ddir], o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
193 typedef int (split_parse_fn)(struct thread_options *, enum fio_ddir, char *, bool);
195 static int str_split_parse(struct thread_data *td, char *str,
196 split_parse_fn *fn, bool data)
201 odir = strchr(str, ',');
203 ddir = strchr(odir + 1, ',');
205 ret = fn(&td->o, DDIR_TRIM, ddir + 1, data);
211 op = strdup(odir + 1);
212 ret = fn(&td->o, DDIR_TRIM, op, data);
217 ret = fn(&td->o, DDIR_WRITE, odir + 1, data);
220 ret = fn(&td->o, DDIR_READ, str, data);
226 ret = fn(&td->o, DDIR_WRITE, op, data);
231 ret = fn(&td->o, DDIR_TRIM, op, data);
235 ret = fn(&td->o, DDIR_READ, str, data);
241 static int str_bssplit_cb(void *data, const char *input)
243 struct thread_data *td = cb_data_to_td(data);
247 p = str = strdup(input);
249 strip_blank_front(&str);
250 strip_blank_end(str);
252 ret = str_split_parse(td, str, bssplit_ddir, false);
254 if (parse_dryrun()) {
257 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
258 free(td->o.bssplit[i]);
259 td->o.bssplit[i] = NULL;
260 td->o.bssplit_nr[i] = 0;
268 static int str2error(char *str)
270 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
271 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
272 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
273 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
274 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
275 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
276 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
277 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
278 int i = 0, num = sizeof(err) / sizeof(char *);
281 if (!strcmp(err[i], str))
288 static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
295 if (etype >= ERROR_TYPE_CNT) {
296 log_err("Illegal error type\n");
300 td->o.ignore_error_nr[etype] = 4;
301 error = calloc(4, sizeof(int));
304 while ((fname = strsep(&str, ":")) != NULL) {
310 * grow struct buffer, if needed
312 if (i == td->o.ignore_error_nr[etype]) {
313 td->o.ignore_error_nr[etype] <<= 1;
314 error = realloc(error, td->o.ignore_error_nr[etype]
317 if (fname[0] == 'E') {
318 error[i] = str2error(fname);
320 error[i] = atoi(fname);
322 error[i] = -error[i];
325 log_err("Unknown error %s, please use number value\n",
327 td->o.ignore_error_nr[etype] = 0;
334 td->o.continue_on_error |= 1 << etype;
335 td->o.ignore_error_nr[etype] = i;
336 td->o.ignore_error[etype] = error;
338 td->o.ignore_error_nr[etype] = 0;
346 static int str_replay_skip_cb(void *data, const char *input)
348 struct thread_data *td = cb_data_to_td(data);
355 p = str = strdup(input);
357 strip_blank_front(&str);
358 strip_blank_end(str);
364 if (!strcmp(p, "read"))
365 td->o.replay_skip |= 1u << DDIR_READ;
366 else if (!strcmp(p, "write"))
367 td->o.replay_skip |= 1u << DDIR_WRITE;
368 else if (!strcmp(p, "trim"))
369 td->o.replay_skip |= 1u << DDIR_TRIM;
370 else if (!strcmp(p, "sync"))
371 td->o.replay_skip |= 1u << DDIR_SYNC;
373 log_err("Unknown skip type: %s\n", p);
383 static int str_ignore_error_cb(void *data, const char *input)
385 struct thread_data *td = cb_data_to_td(data);
388 enum error_type_bit type = 0;
393 p = str = strdup(input);
395 strip_blank_front(&str);
396 strip_blank_end(str);
402 ret = ignore_error_type(td, type, p);
412 static int str_rw_cb(void *data, const char *str)
414 struct thread_data *td = cb_data_to_td(data);
415 struct thread_options *o = &td->o;
424 nr = get_opt_postfix(str);
429 o->ddir_seq_nr = atoi(nr);
433 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
434 log_err("fio: rw postfix parsing failed\n");
439 o->ddir_seq_add = val;
446 static int str_mem_cb(void *data, const char *mem)
448 struct thread_data *td = cb_data_to_td(data);
450 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
451 td->o.mem_type == MEM_MMAPSHARED)
452 td->o.mmapfile = get_opt_postfix(mem);
457 static int fio_clock_source_cb(void *data, const char *str)
459 struct thread_data *td = cb_data_to_td(data);
461 fio_clock_source = td->o.clocksource;
462 fio_clock_source_set = 1;
467 static int str_rwmix_read_cb(void *data, unsigned long long *val)
469 struct thread_data *td = cb_data_to_td(data);
471 td->o.rwmix[DDIR_READ] = *val;
472 td->o.rwmix[DDIR_WRITE] = 100 - *val;
476 static int str_rwmix_write_cb(void *data, unsigned long long *val)
478 struct thread_data *td = cb_data_to_td(data);
480 td->o.rwmix[DDIR_WRITE] = *val;
481 td->o.rwmix[DDIR_READ] = 100 - *val;
485 static int str_exitall_cb(void)
487 exitall_on_terminate = true;
491 #ifdef FIO_HAVE_CPU_AFFINITY
492 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
494 unsigned int i, index, cpus_in_mask;
495 const long max_cpu = cpus_online();
497 cpus_in_mask = fio_cpu_count(mask);
501 cpu_index = cpu_index % cpus_in_mask;
504 for (i = 0; i < max_cpu; i++) {
505 if (!fio_cpu_isset(mask, i))
508 if (cpu_index != index)
509 fio_cpu_clear(mask, i);
514 return fio_cpu_count(mask);
517 static int str_cpumask_cb(void *data, unsigned long long *val)
519 struct thread_data *td = cb_data_to_td(data);
527 ret = fio_cpuset_init(&td->o.cpumask);
529 log_err("fio: cpuset_init failed\n");
530 td_verror(td, ret, "fio_cpuset_init");
534 max_cpu = cpus_online();
536 for (i = 0; i < sizeof(int) * 8; i++) {
537 if ((1 << i) & *val) {
539 log_err("fio: CPU %d too large (max=%ld)\n", i,
543 dprint(FD_PARSE, "set cpu allowed %d\n", i);
544 fio_cpu_set(&td->o.cpumask, i);
551 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
558 ret = fio_cpuset_init(mask);
560 log_err("fio: cpuset_init failed\n");
561 td_verror(td, ret, "fio_cpuset_init");
565 p = str = strdup(input);
567 strip_blank_front(&str);
568 strip_blank_end(str);
570 max_cpu = cpus_online();
572 while ((cpu = strsep(&str, ",")) != NULL) {
581 while ((cpu2 = strsep(&str2, "-")) != NULL) {
591 while (icpu <= icpu2) {
592 if (icpu >= FIO_MAX_CPUS) {
593 log_err("fio: your OS only supports up to"
594 " %d CPUs\n", (int) FIO_MAX_CPUS);
598 if (icpu >= max_cpu) {
599 log_err("fio: CPU %d too large (max=%ld)\n",
605 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
606 fio_cpu_set(mask, icpu);
617 static int str_cpus_allowed_cb(void *data, const char *input)
619 struct thread_data *td = cb_data_to_td(data);
624 return set_cpus_allowed(td, &td->o.cpumask, input);
627 static int str_verify_cpus_allowed_cb(void *data, const char *input)
629 struct thread_data *td = cb_data_to_td(data);
634 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
638 static int str_log_cpus_allowed_cb(void *data, const char *input)
640 struct thread_data *td = cb_data_to_td(data);
645 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
647 #endif /* CONFIG_ZLIB */
649 #endif /* FIO_HAVE_CPU_AFFINITY */
651 #ifdef CONFIG_LIBNUMA
652 static int str_numa_cpunodes_cb(void *data, char *input)
654 struct thread_data *td = cb_data_to_td(data);
655 struct bitmask *verify_bitmask;
660 /* numa_parse_nodestring() parses a character string list
661 * of nodes into a bit mask. The bit mask is allocated by
662 * numa_allocate_nodemask(), so it should be freed by
663 * numa_free_nodemask().
665 verify_bitmask = numa_parse_nodestring(input);
666 if (verify_bitmask == NULL) {
667 log_err("fio: numa_parse_nodestring failed\n");
668 td_verror(td, 1, "str_numa_cpunodes_cb");
671 numa_free_nodemask(verify_bitmask);
673 td->o.numa_cpunodes = strdup(input);
677 static int str_numa_mpol_cb(void *data, char *input)
679 struct thread_data *td = cb_data_to_td(data);
680 const char * const policy_types[] =
681 { "default", "prefer", "bind", "interleave", "local", NULL };
684 struct bitmask *verify_bitmask;
689 nodelist = strchr(input, ':');
691 /* NUL-terminate mode */
695 for (i = 0; i <= MPOL_LOCAL; i++) {
696 if (!strcmp(input, policy_types[i])) {
697 td->o.numa_mem_mode = i;
701 if (i > MPOL_LOCAL) {
702 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
706 switch (td->o.numa_mem_mode) {
709 * Insist on a nodelist of one node only
712 char *rest = nodelist;
713 while (isdigit(*rest))
716 log_err("fio: one node only for \'prefer\'\n");
720 log_err("fio: one node is needed for \'prefer\'\n");
724 case MPOL_INTERLEAVE:
726 * Default to online nodes with memory if no nodelist
729 nodelist = strdup("all");
734 * Don't allow a nodelist
737 log_err("fio: NO nodelist for \'local\'\n");
743 * Insist on a nodelist
746 log_err("fio: a nodelist is needed for \'bind\'\n");
753 /* numa_parse_nodestring() parses a character string list
754 * of nodes into a bit mask. The bit mask is allocated by
755 * numa_allocate_nodemask(), so it should be freed by
756 * numa_free_nodemask().
758 switch (td->o.numa_mem_mode) {
760 td->o.numa_mem_prefer_node = atoi(nodelist);
762 case MPOL_INTERLEAVE:
764 verify_bitmask = numa_parse_nodestring(nodelist);
765 if (verify_bitmask == NULL) {
766 log_err("fio: numa_parse_nodestring failed\n");
767 td_verror(td, 1, "str_numa_memnodes_cb");
770 td->o.numa_memnodes = strdup(nodelist);
771 numa_free_nodemask(verify_bitmask);
786 static int str_fst_cb(void *data, const char *str)
788 struct thread_data *td = cb_data_to_td(data);
793 td->file_service_nr = 1;
795 switch (td->o.file_service_type) {
796 case FIO_FSERVICE_RANDOM:
797 case FIO_FSERVICE_RR:
798 case FIO_FSERVICE_SEQ:
799 nr = get_opt_postfix(str);
801 td->file_service_nr = atoi(nr);
806 case FIO_FSERVICE_ZIPF:
809 case FIO_FSERVICE_PARETO:
810 val = FIO_DEF_PARETO;
812 case FIO_FSERVICE_GAUSS:
816 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
823 nr = get_opt_postfix(str);
824 if (nr && !str_to_float(nr, &val, 0)) {
825 log_err("fio: file service type random postfix parsing failed\n");
832 switch (td->o.file_service_type) {
833 case FIO_FSERVICE_ZIPF:
835 log_err("fio: zipf theta must be different than 1.0\n");
840 td->zipf_theta = val;
842 case FIO_FSERVICE_PARETO:
843 if (val <= 0.00 || val >= 1.00) {
844 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
851 case FIO_FSERVICE_GAUSS:
852 if (val < 0.00 || val >= 100.00) {
853 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
865 #ifdef CONFIG_SYNC_FILE_RANGE
866 static int str_sfr_cb(void *data, const char *str)
868 struct thread_data *td = cb_data_to_td(data);
869 char *nr = get_opt_postfix(str);
871 td->sync_file_range_nr = 1;
873 td->sync_file_range_nr = atoi(nr);
881 static int zone_split_ddir(struct thread_options *o, enum fio_ddir ddir,
882 char *str, bool absolute)
884 unsigned int i, perc, perc_missing, sperc, sperc_missing;
887 memset(&split, 0, sizeof(split));
889 if (split_parse_ddir(o, &split, str, absolute, ZONESPLIT_MAX))
894 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
895 o->zone_split_nr[ddir] = split.nr;
896 for (i = 0; i < split.nr; i++) {
897 o->zone_split[ddir][i].access_perc = split.val1[i];
899 o->zone_split[ddir][i].size = split.val2[i];
901 o->zone_split[ddir][i].size_perc = split.val2[i];
905 * Now check if the percentages add up, and how much is missing
907 perc = perc_missing = 0;
908 sperc = sperc_missing = 0;
909 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
910 struct zone_split *zsp = &o->zone_split[ddir][i];
912 if (zsp->access_perc == (uint8_t) -1U)
915 perc += zsp->access_perc;
918 if (zsp->size_perc == (uint8_t) -1U)
921 sperc += zsp->size_perc;
925 if (perc > 100 || sperc > 100) {
926 log_err("fio: zone_split percentages add to more than 100%%\n");
927 free(o->zone_split[ddir]);
928 o->zone_split[ddir] = NULL;
932 log_err("fio: access percentage don't add up to 100 for zoned "
933 "random distribution (got=%u)\n", perc);
934 free(o->zone_split[ddir]);
935 o->zone_split[ddir] = NULL;
940 * If values didn't have a percentage set, divide the remains between
944 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
946 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
947 struct zone_split *zsp = &o->zone_split[ddir][i];
949 if (zsp->access_perc == (uint8_t) -1U)
950 zsp->access_perc = (100 - perc) / perc_missing;
954 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
956 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
957 struct zone_split *zsp = &o->zone_split[ddir][i];
959 if (zsp->size_perc == (uint8_t) -1U)
960 zsp->size_perc = (100 - sperc) / sperc_missing;
967 static int parse_zoned_distribution(struct thread_data *td, const char *input,
970 const char *pre = absolute ? "zoned_abs:" : "zoned:";
974 p = str = strdup(input);
976 strip_blank_front(&str);
977 strip_blank_end(str);
979 /* We expect it to start like that, bail if not */
980 if (strncmp(str, pre, strlen(pre))) {
981 log_err("fio: mismatch in zoned input <%s>\n", str);
987 ret = str_split_parse(td, str, zone_split_ddir, absolute);
991 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
994 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
996 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
997 struct zone_split *zsp = &td->o.zone_split[i][j];
1000 dprint(FD_PARSE, "\t%d: %u/%llu\n", j,
1002 (unsigned long long) zsp->size);
1004 dprint(FD_PARSE, "\t%d: %u/%u\n", j,
1011 if (parse_dryrun()) {
1012 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1013 free(td->o.zone_split[i]);
1014 td->o.zone_split[i] = NULL;
1015 td->o.zone_split_nr[i] = 0;
1022 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1023 td->o.zone_split_nr[i] = 0;
1029 static int str_random_distribution_cb(void *data, const char *str)
1031 struct thread_data *td = cb_data_to_td(data);
1035 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1037 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1038 val = FIO_DEF_PARETO;
1039 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1041 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1042 return parse_zoned_distribution(td, str, false);
1043 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED_ABS)
1044 return parse_zoned_distribution(td, str, true);
1048 nr = get_opt_postfix(str);
1049 if (nr && !str_to_float(nr, &val, 0)) {
1050 log_err("fio: random postfix parsing failed\n");
1057 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1059 log_err("fio: zipf theta must different than 1.0\n");
1064 td->o.zipf_theta.u.f = val;
1065 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1066 if (val <= 0.00 || val >= 1.00) {
1067 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1072 td->o.pareto_h.u.f = val;
1074 if (val < 0.00 || val >= 100.0) {
1075 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1080 td->o.gauss_dev.u.f = val;
1086 static int str_steadystate_cb(void *data, const char *str)
1088 struct thread_data *td = cb_data_to_td(data);
1094 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1095 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
1096 /* should be impossible to get here */
1097 log_err("fio: unknown steady state criterion\n");
1101 nr = get_opt_postfix(str);
1103 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1108 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1109 pct = strstr(nr, "%");
1112 strip_blank_end(nr);
1113 if (!str_to_float(nr, &val, 0)) {
1114 log_err("fio: could not parse steadystate threshold percentage\n");
1119 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1124 td->o.ss_state |= FIO_SS_PCT;
1125 td->o.ss_limit.u.f = val;
1126 } else if (td->o.ss_state & FIO_SS_IOPS) {
1127 if (!str_to_float(nr, &val, 0)) {
1128 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1133 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1138 td->o.ss_limit.u.f = val;
1139 } else { /* bandwidth criterion */
1140 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1141 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1146 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1151 td->o.ss_limit.u.f = (double) ll;
1154 td->ss.state = td->o.ss_state;
1159 * Return next name in the string. Files are separated with ':'. If the ':'
1160 * is escaped with a '\', then that ':' is part of the filename and does not
1161 * indicate a new file.
1163 char *get_next_str(char **ptr)
1168 if (!str || !strlen(str))
1174 * No colon, we are done
1176 p = strchr(str, ':');
1183 * We got a colon, but it's the first character. Skip and
1191 if (*(p - 1) != '\\') {
1197 memmove(p - 1, p, strlen(p) + 1);
1205 int get_max_str_idx(char *input)
1207 unsigned int cur_idx;
1210 p = str = strdup(input);
1211 for (cur_idx = 0; ; cur_idx++)
1212 if (get_next_str(&str) == NULL)
1220 * Returns the directory at the index, indexes > entires will be
1221 * assigned via modulo division of the index
1223 int set_name_idx(char *target, size_t tlen, char *input, int index,
1224 bool unique_filename)
1226 unsigned int cur_idx;
1228 char *fname, *str, *p;
1230 p = str = strdup(input);
1232 index %= get_max_str_idx(input);
1233 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1234 fname = get_next_str(&str);
1236 if (client_sockaddr_str[0] && unique_filename) {
1237 len = snprintf(target, tlen, "%s/%s.", fname,
1238 client_sockaddr_str);
1240 len = snprintf(target, tlen, "%s%c", fname,
1241 FIO_OS_PATH_SEPARATOR);
1243 target[tlen - 1] = '\0';
1249 char* get_name_by_idx(char *input, int index)
1251 unsigned int cur_idx;
1252 char *fname, *str, *p;
1254 p = str = strdup(input);
1256 index %= get_max_str_idx(input);
1257 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1258 fname = get_next_str(&str);
1260 fname = strdup(fname);
1266 static int str_filename_cb(void *data, const char *input)
1268 struct thread_data *td = cb_data_to_td(data);
1269 char *fname, *str, *p;
1271 p = str = strdup(input);
1273 strip_blank_front(&str);
1274 strip_blank_end(str);
1277 * Ignore what we may already have from nrfiles option.
1279 if (!td->files_index)
1282 while ((fname = get_next_str(&str)) != NULL) {
1285 add_file(td, fname, 0, 1);
1292 static int str_directory_cb(void *data, const char fio_unused *unused)
1294 struct thread_data *td = cb_data_to_td(data);
1296 char *dirname, *str, *p;
1302 p = str = strdup(td->o.directory);
1303 while ((dirname = get_next_str(&str)) != NULL) {
1304 if (lstat(dirname, &sb) < 0) {
1307 log_err("fio: %s is not a directory\n", dirname);
1308 td_verror(td, ret, "lstat");
1311 if (!S_ISDIR(sb.st_mode)) {
1312 log_err("fio: %s is not a directory\n", dirname);
1323 static int str_opendir_cb(void *data, const char fio_unused *str)
1325 struct thread_data *td = cb_data_to_td(data);
1330 if (!td->files_index)
1333 return add_dir_files(td, td->o.opendir);
1336 static int str_buffer_pattern_cb(void *data, const char *input)
1338 struct thread_data *td = cb_data_to_td(data);
1341 /* FIXME: for now buffer pattern does not support formats */
1342 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
1343 MAX_PATTERN_SIZE, NULL, NULL, NULL);
1348 td->o.buffer_pattern_bytes = ret;
1351 * If this job is doing any reading or has compression set,
1352 * ensure that we refill buffers for writes or we could be
1353 * invalidating the pattern through reads.
1355 if (!td->o.compress_percentage && !td_read(td))
1356 td->o.refill_buffers = 0;
1358 td->o.refill_buffers = 1;
1360 td->o.scramble_buffers = 0;
1361 td->o.zero_buffers = 0;
1366 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1368 struct thread_data *td = cb_data_to_td(data);
1370 td->flags |= TD_F_COMPRESS;
1371 td->o.compress_percentage = *il;
1375 static int str_dedupe_cb(void *data, unsigned long long *il)
1377 struct thread_data *td = cb_data_to_td(data);
1379 td->flags |= TD_F_COMPRESS;
1380 td->o.dedupe_percentage = *il;
1381 td->o.refill_buffers = 1;
1385 static int str_verify_pattern_cb(void *data, const char *input)
1387 struct thread_data *td = cb_data_to_td(data);
1390 td->o.verify_fmt_sz = ARRAY_SIZE(td->o.verify_fmt);
1391 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
1392 MAX_PATTERN_SIZE, fmt_desc,
1393 td->o.verify_fmt, &td->o.verify_fmt_sz);
1398 td->o.verify_pattern_bytes = ret;
1400 * VERIFY_* could already be set
1402 if (!fio_option_is_set(&td->o, verify))
1403 td->o.verify = VERIFY_PATTERN;
1408 static int str_gtod_reduce_cb(void *data, int *il)
1410 struct thread_data *td = cb_data_to_td(data);
1414 * Only modfiy options if gtod_reduce==1
1415 * Otherwise leave settings alone.
1418 td->o.disable_lat = 1;
1419 td->o.disable_clat = 1;
1420 td->o.disable_slat = 1;
1421 td->o.disable_bw = 1;
1422 td->o.clat_percentiles = 0;
1423 td->o.lat_percentiles = 0;
1424 td->o.slat_percentiles = 0;
1425 td->ts_cache_mask = 63;
1431 static int str_offset_cb(void *data, unsigned long long *__val)
1433 struct thread_data *td = cb_data_to_td(data);
1434 unsigned long long v = *__val;
1436 if (parse_is_percent(v)) {
1437 td->o.start_offset = 0;
1438 td->o.start_offset_percent = -1ULL - v;
1439 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1440 td->o.start_offset_percent);
1442 td->o.start_offset = v;
1447 static int str_offset_increment_cb(void *data, unsigned long long *__val)
1449 struct thread_data *td = cb_data_to_td(data);
1450 unsigned long long v = *__val;
1452 if (parse_is_percent(v)) {
1453 td->o.offset_increment = 0;
1454 td->o.offset_increment_percent = -1ULL - v;
1455 dprint(FD_PARSE, "SET offset_increment_percent %d\n",
1456 td->o.offset_increment_percent);
1458 td->o.offset_increment = v;
1463 static int str_size_cb(void *data, unsigned long long *__val)
1465 struct thread_data *td = cb_data_to_td(data);
1466 unsigned long long v = *__val;
1468 if (parse_is_percent(v)) {
1470 td->o.size_percent = -1ULL - v;
1471 dprint(FD_PARSE, "SET size_percent %d\n",
1472 td->o.size_percent);
1479 static int str_write_bw_log_cb(void *data, const char *str)
1481 struct thread_data *td = cb_data_to_td(data);
1484 td->o.bw_log_file = strdup(str);
1486 td->o.write_bw_log = 1;
1490 static int str_write_lat_log_cb(void *data, const char *str)
1492 struct thread_data *td = cb_data_to_td(data);
1495 td->o.lat_log_file = strdup(str);
1497 td->o.write_lat_log = 1;
1501 static int str_write_iops_log_cb(void *data, const char *str)
1503 struct thread_data *td = cb_data_to_td(data);
1506 td->o.iops_log_file = strdup(str);
1508 td->o.write_iops_log = 1;
1512 static int str_write_hist_log_cb(void *data, const char *str)
1514 struct thread_data *td = cb_data_to_td(data);
1517 td->o.hist_log_file = strdup(str);
1519 td->o.write_hist_log = 1;
1524 * str is supposed to be a substring of the strdup'd original string,
1525 * and is valid only if it's a regular file path.
1526 * This function keeps the pointer to the path as needed later.
1528 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1529 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1530 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1532 static int str_ioengine_external_cb(void *data, const char *str)
1534 struct thread_data *td = cb_data_to_td(data);
1539 log_err("fio: null external ioengine path\n");
1543 p = (char *)str; /* str is mutable */
1544 strip_blank_front(&p);
1547 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1548 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1552 td->o.ioengine_so_path = p;
1556 static int rw_verify(const struct fio_option *o, void *data)
1558 struct thread_data *td = cb_data_to_td(data);
1560 if (read_only && (td_write(td) || td_trim(td))) {
1561 log_err("fio: job <%s> has write or trim bit set, but"
1562 " fio is in read-only mode\n", td->o.name);
1569 static int gtod_cpu_verify(const struct fio_option *o, void *data)
1571 #ifndef FIO_HAVE_CPU_AFFINITY
1572 struct thread_data *td = cb_data_to_td(data);
1574 if (td->o.gtod_cpu) {
1575 log_err("fio: platform must support CPU affinity for"
1576 "gettimeofday() offloading\n");
1585 * Map of job/command line options
1587 struct fio_option fio_options[FIO_MAX_OPTS] = {
1589 .name = "description",
1590 .lname = "Description of job",
1591 .type = FIO_OPT_STR_STORE,
1592 .off1 = offsetof(struct thread_options, description),
1593 .help = "Text job description",
1594 .category = FIO_OPT_C_GENERAL,
1595 .group = FIO_OPT_G_DESC,
1599 .lname = "Job name",
1600 .type = FIO_OPT_STR_STORE,
1601 .off1 = offsetof(struct thread_options, name),
1602 .help = "Name of this job",
1603 .category = FIO_OPT_C_GENERAL,
1604 .group = FIO_OPT_G_DESC,
1608 .lname = "Waitee name",
1609 .type = FIO_OPT_STR_STORE,
1610 .off1 = offsetof(struct thread_options, wait_for),
1611 .help = "Name of the job this one wants to wait for before starting",
1612 .category = FIO_OPT_C_GENERAL,
1613 .group = FIO_OPT_G_DESC,
1617 .lname = "Filename(s)",
1618 .type = FIO_OPT_STR_STORE,
1619 .off1 = offsetof(struct thread_options, filename),
1620 .cb = str_filename_cb,
1621 .prio = -1, /* must come after "directory" */
1622 .help = "File(s) to use for the workload",
1623 .category = FIO_OPT_C_FILE,
1624 .group = FIO_OPT_G_FILENAME,
1627 .name = "directory",
1628 .lname = "Directory",
1629 .type = FIO_OPT_STR_STORE,
1630 .off1 = offsetof(struct thread_options, directory),
1631 .cb = str_directory_cb,
1632 .help = "Directory to store files in",
1633 .category = FIO_OPT_C_FILE,
1634 .group = FIO_OPT_G_FILENAME,
1637 .name = "filename_format",
1638 .lname = "Filename Format",
1639 .type = FIO_OPT_STR_STORE,
1640 .off1 = offsetof(struct thread_options, filename_format),
1641 .prio = -1, /* must come after "directory" */
1642 .help = "Override default $jobname.$jobnum.$filenum naming",
1643 .def = "$jobname.$jobnum.$filenum",
1644 .category = FIO_OPT_C_FILE,
1645 .group = FIO_OPT_G_FILENAME,
1648 .name = "unique_filename",
1649 .lname = "Unique Filename",
1650 .type = FIO_OPT_BOOL,
1651 .off1 = offsetof(struct thread_options, unique_filename),
1652 .help = "For network clients, prefix file with source IP",
1654 .category = FIO_OPT_C_FILE,
1655 .group = FIO_OPT_G_FILENAME,
1659 .lname = "Lockfile",
1660 .type = FIO_OPT_STR,
1661 .off1 = offsetof(struct thread_options, file_lock_mode),
1662 .help = "Lock file when doing IO to it",
1664 .parent = "filename",
1667 .category = FIO_OPT_C_FILE,
1668 .group = FIO_OPT_G_FILENAME,
1671 .oval = FILE_LOCK_NONE,
1672 .help = "No file locking",
1674 { .ival = "exclusive",
1675 .oval = FILE_LOCK_EXCLUSIVE,
1676 .help = "Exclusive file lock",
1679 .ival = "readwrite",
1680 .oval = FILE_LOCK_READWRITE,
1681 .help = "Read vs write lock",
1687 .lname = "Open directory",
1688 .type = FIO_OPT_STR_STORE,
1689 .off1 = offsetof(struct thread_options, opendir),
1690 .cb = str_opendir_cb,
1691 .help = "Recursively add files from this directory and down",
1692 .category = FIO_OPT_C_FILE,
1693 .group = FIO_OPT_G_FILENAME,
1697 .lname = "Read/write",
1698 .alias = "readwrite",
1699 .type = FIO_OPT_STR,
1701 .off1 = offsetof(struct thread_options, td_ddir),
1702 .help = "IO direction",
1704 .verify = rw_verify,
1705 .category = FIO_OPT_C_IO,
1706 .group = FIO_OPT_G_IO_BASIC,
1709 .oval = TD_DDIR_READ,
1710 .help = "Sequential read",
1713 .oval = TD_DDIR_WRITE,
1714 .help = "Sequential write",
1717 .oval = TD_DDIR_TRIM,
1718 .help = "Sequential trim",
1720 { .ival = "randread",
1721 .oval = TD_DDIR_RANDREAD,
1722 .help = "Random read",
1724 { .ival = "randwrite",
1725 .oval = TD_DDIR_RANDWRITE,
1726 .help = "Random write",
1728 { .ival = "randtrim",
1729 .oval = TD_DDIR_RANDTRIM,
1730 .help = "Random trim",
1734 .help = "Sequential read and write mix",
1736 { .ival = "readwrite",
1738 .help = "Sequential read and write mix",
1741 .oval = TD_DDIR_RANDRW,
1742 .help = "Random read and write mix"
1744 { .ival = "trimwrite",
1745 .oval = TD_DDIR_TRIMWRITE,
1746 .help = "Trim and write mix, trims preceding writes"
1751 .name = "rw_sequencer",
1752 .lname = "RW Sequencer",
1753 .type = FIO_OPT_STR,
1754 .off1 = offsetof(struct thread_options, rw_seq),
1755 .help = "IO offset generator modifier",
1756 .def = "sequential",
1757 .category = FIO_OPT_C_IO,
1758 .group = FIO_OPT_G_IO_BASIC,
1760 { .ival = "sequential",
1762 .help = "Generate sequential offsets",
1764 { .ival = "identical",
1765 .oval = RW_SEQ_IDENT,
1766 .help = "Generate identical offsets",
1773 .lname = "IO Engine",
1774 .type = FIO_OPT_STR_STORE,
1775 .off1 = offsetof(struct thread_options, ioengine),
1776 .help = "IO engine to use",
1777 .def = FIO_PREFERRED_ENGINE,
1778 .category = FIO_OPT_C_IO,
1779 .group = FIO_OPT_G_IO_BASIC,
1782 .help = "Use read/write",
1785 .help = "Use pread/pwrite",
1788 .help = "Use readv/writev",
1790 #ifdef CONFIG_PWRITEV
1792 .help = "Use preadv/pwritev",
1795 #ifdef FIO_HAVE_PWRITEV2
1796 { .ival = "pvsync2",
1797 .help = "Use preadv2/pwritev2",
1800 #ifdef CONFIG_LIBAIO
1802 .help = "Linux native asynchronous IO",
1805 #ifdef ARCH_HAVE_IOURING
1806 { .ival = "io_uring",
1807 .help = "Fast Linux native aio",
1810 #ifdef CONFIG_POSIXAIO
1811 { .ival = "posixaio",
1812 .help = "POSIX asynchronous IO",
1815 #ifdef CONFIG_SOLARISAIO
1816 { .ival = "solarisaio",
1817 .help = "Solaris native asynchronous IO",
1820 #ifdef CONFIG_WINDOWSAIO
1821 { .ival = "windowsaio",
1822 .help = "Windows native asynchronous IO"
1827 .help = "Rados Block Device asynchronous IO"
1831 .help = "Memory mapped IO"
1833 #ifdef CONFIG_LINUX_SPLICE
1835 .help = "splice/vmsplice based IO",
1837 { .ival = "netsplice",
1838 .help = "splice/vmsplice to/from the network",
1841 #ifdef FIO_HAVE_SGIO
1843 .help = "SCSI generic v3 IO",
1847 .help = "Testing engine (no data transfer)",
1850 .help = "Network IO",
1853 .help = "CPU cycle burner engine",
1857 .help = "GUASI IO engine",
1862 .help = "RDMA IO engine",
1865 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1866 { .ival = "e4defrag",
1867 .help = "ext4 defrag engine",
1870 #ifdef CONFIG_LINUX_FALLOCATE
1872 .help = "fallocate() file based engine",
1877 .help = "Glusterfs libgfapi(sync) based engine"
1879 { .ival = "gfapi_async",
1880 .help = "Glusterfs libgfapi(async) based engine"
1883 #ifdef CONFIG_LIBHDFS
1884 { .ival = "libhdfs",
1885 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1888 #ifdef CONFIG_PMEMBLK
1889 { .ival = "pmemblk",
1890 .help = "PMDK libpmemblk based IO engine",
1895 { .ival = "ime_psync",
1896 .help = "DDN's IME synchronous IO engine",
1898 { .ival = "ime_psyncv",
1899 .help = "DDN's IME synchronous IO engine using iovecs",
1901 { .ival = "ime_aio",
1902 .help = "DDN's IME asynchronous IO engine",
1905 #ifdef CONFIG_LINUX_DEVDAX
1906 { .ival = "dev-dax",
1907 .help = "DAX Device based IO engine",
1911 .ival = "filecreate",
1912 .help = "File creation engine",
1914 { .ival = "external",
1915 .help = "Load external engine (append name)",
1916 .cb = str_ioengine_external_cb,
1918 #ifdef CONFIG_LIBPMEM
1919 { .ival = "libpmem",
1920 .help = "PMDK libpmem based IO engine",
1925 .help = "HTTP (WebDAV/S3) IO engine",
1929 .help = "Network Block Device (NBD) IO engine"
1935 .lname = "IO Depth",
1936 .type = FIO_OPT_INT,
1937 .off1 = offsetof(struct thread_options, iodepth),
1938 .help = "Number of IO buffers to keep in flight",
1942 .category = FIO_OPT_C_IO,
1943 .group = FIO_OPT_G_IO_BASIC,
1946 .name = "iodepth_batch",
1947 .lname = "IO Depth batch",
1948 .alias = "iodepth_batch_submit",
1949 .type = FIO_OPT_INT,
1950 .off1 = offsetof(struct thread_options, iodepth_batch),
1951 .help = "Number of IO buffers to submit in one go",
1952 .parent = "iodepth",
1956 .category = FIO_OPT_C_IO,
1957 .group = FIO_OPT_G_IO_BASIC,
1960 .name = "iodepth_batch_complete_min",
1961 .lname = "Min IO depth batch complete",
1962 .alias = "iodepth_batch_complete",
1963 .type = FIO_OPT_INT,
1964 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
1965 .help = "Min number of IO buffers to retrieve in one go",
1966 .parent = "iodepth",
1971 .category = FIO_OPT_C_IO,
1972 .group = FIO_OPT_G_IO_BASIC,
1975 .name = "iodepth_batch_complete_max",
1976 .lname = "Max IO depth batch complete",
1977 .type = FIO_OPT_INT,
1978 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
1979 .help = "Max number of IO buffers to retrieve in one go",
1980 .parent = "iodepth",
1984 .category = FIO_OPT_C_IO,
1985 .group = FIO_OPT_G_IO_BASIC,
1988 .name = "iodepth_low",
1989 .lname = "IO Depth batch low",
1990 .type = FIO_OPT_INT,
1991 .off1 = offsetof(struct thread_options, iodepth_low),
1992 .help = "Low water mark for queuing depth",
1993 .parent = "iodepth",
1996 .category = FIO_OPT_C_IO,
1997 .group = FIO_OPT_G_IO_BASIC,
2000 .name = "serialize_overlap",
2001 .lname = "Serialize overlap",
2002 .off1 = offsetof(struct thread_options, serialize_overlap),
2003 .type = FIO_OPT_BOOL,
2004 .help = "Wait for in-flight IOs that collide to complete",
2005 .parent = "iodepth",
2007 .category = FIO_OPT_C_IO,
2008 .group = FIO_OPT_G_IO_BASIC,
2011 .name = "io_submit_mode",
2012 .lname = "IO submit mode",
2013 .type = FIO_OPT_STR,
2014 .off1 = offsetof(struct thread_options, io_submit_mode),
2015 .help = "How IO submissions and completions are done",
2017 .category = FIO_OPT_C_IO,
2018 .group = FIO_OPT_G_IO_BASIC,
2021 .oval = IO_MODE_INLINE,
2022 .help = "Submit and complete IO inline",
2024 { .ival = "offload",
2025 .oval = IO_MODE_OFFLOAD,
2026 .help = "Offload submit and complete to threads",
2033 .type = FIO_OPT_STR_VAL,
2035 .off1 = offsetof(struct thread_options, size),
2036 .help = "Total size of device or files",
2037 .interval = 1024 * 1024,
2038 .category = FIO_OPT_C_IO,
2039 .group = FIO_OPT_G_INVALID,
2043 .alias = "io_limit",
2045 .type = FIO_OPT_STR_VAL,
2046 .off1 = offsetof(struct thread_options, io_size),
2047 .help = "Total size of I/O to be performed",
2048 .interval = 1024 * 1024,
2049 .category = FIO_OPT_C_IO,
2050 .group = FIO_OPT_G_INVALID,
2053 .name = "fill_device",
2054 .lname = "Fill device",
2056 .type = FIO_OPT_BOOL,
2057 .off1 = offsetof(struct thread_options, fill_device),
2058 .help = "Write until an ENOSPC error occurs",
2060 .category = FIO_OPT_C_FILE,
2061 .group = FIO_OPT_G_INVALID,
2065 .lname = "File size",
2066 .type = FIO_OPT_STR_VAL,
2067 .off1 = offsetof(struct thread_options, file_size_low),
2068 .off2 = offsetof(struct thread_options, file_size_high),
2070 .help = "Size of individual files",
2071 .interval = 1024 * 1024,
2072 .category = FIO_OPT_C_FILE,
2073 .group = FIO_OPT_G_INVALID,
2076 .name = "file_append",
2077 .lname = "File append",
2078 .type = FIO_OPT_BOOL,
2079 .off1 = offsetof(struct thread_options, file_append),
2080 .help = "IO will start at the end of the file(s)",
2082 .category = FIO_OPT_C_FILE,
2083 .group = FIO_OPT_G_INVALID,
2087 .lname = "IO offset",
2088 .alias = "fileoffset",
2089 .type = FIO_OPT_STR_VAL,
2090 .cb = str_offset_cb,
2091 .off1 = offsetof(struct thread_options, start_offset),
2092 .help = "Start IO from this offset",
2094 .interval = 1024 * 1024,
2095 .category = FIO_OPT_C_IO,
2096 .group = FIO_OPT_G_INVALID,
2099 .name = "offset_align",
2100 .lname = "IO offset alignment",
2101 .type = FIO_OPT_INT,
2102 .off1 = offsetof(struct thread_options, start_offset_align),
2103 .help = "Start IO from this offset alignment",
2106 .category = FIO_OPT_C_IO,
2107 .group = FIO_OPT_G_INVALID,
2110 .name = "offset_increment",
2111 .lname = "IO offset increment",
2112 .type = FIO_OPT_STR_VAL,
2113 .cb = str_offset_increment_cb,
2114 .off1 = offsetof(struct thread_options, offset_increment),
2115 .help = "What is the increment from one offset to the next",
2119 .interval = 1024 * 1024,
2120 .category = FIO_OPT_C_IO,
2121 .group = FIO_OPT_G_INVALID,
2124 .name = "number_ios",
2125 .lname = "Number of IOs to perform",
2126 .type = FIO_OPT_STR_VAL,
2127 .off1 = offsetof(struct thread_options, number_ios),
2128 .help = "Force job completion after this number of IOs",
2130 .category = FIO_OPT_C_IO,
2131 .group = FIO_OPT_G_INVALID,
2135 .lname = "Block size",
2136 .alias = "blocksize",
2137 .type = FIO_OPT_ULL,
2138 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2139 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2140 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2142 .help = "Block size unit",
2147 .category = FIO_OPT_C_IO,
2148 .group = FIO_OPT_G_INVALID,
2152 .lname = "Block size align",
2153 .alias = "blockalign",
2154 .type = FIO_OPT_ULL,
2155 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2156 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2157 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2159 .help = "IO block offset alignment",
2163 .category = FIO_OPT_C_IO,
2164 .group = FIO_OPT_G_INVALID,
2168 .lname = "Block size range",
2169 .alias = "blocksize_range",
2170 .type = FIO_OPT_RANGE,
2171 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2172 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2173 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2174 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2175 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2176 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2178 .help = "Set block size range (in more detail than bs)",
2182 .category = FIO_OPT_C_IO,
2183 .group = FIO_OPT_G_INVALID,
2187 .lname = "Block size split",
2188 .type = FIO_OPT_STR_ULL,
2189 .cb = str_bssplit_cb,
2190 .off1 = offsetof(struct thread_options, bssplit),
2191 .help = "Set a specific mix of block sizes",
2194 .category = FIO_OPT_C_IO,
2195 .group = FIO_OPT_G_INVALID,
2198 .name = "bs_unaligned",
2199 .lname = "Block size unaligned",
2200 .alias = "blocksize_unaligned",
2201 .type = FIO_OPT_STR_SET,
2202 .off1 = offsetof(struct thread_options, bs_unaligned),
2203 .help = "Don't sector align IO buffer sizes",
2206 .category = FIO_OPT_C_IO,
2207 .group = FIO_OPT_G_INVALID,
2210 .name = "bs_is_seq_rand",
2211 .lname = "Block size division is seq/random (not read/write)",
2212 .type = FIO_OPT_BOOL,
2213 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2214 .help = "Consider any blocksize setting to be sequential,random",
2216 .parent = "blocksize",
2217 .category = FIO_OPT_C_IO,
2218 .group = FIO_OPT_G_INVALID,
2221 .name = "randrepeat",
2222 .lname = "Random repeatable",
2223 .type = FIO_OPT_BOOL,
2224 .off1 = offsetof(struct thread_options, rand_repeatable),
2225 .help = "Use repeatable random IO pattern",
2229 .category = FIO_OPT_C_IO,
2230 .group = FIO_OPT_G_RANDOM,
2234 .lname = "The random generator seed",
2235 .type = FIO_OPT_STR_VAL,
2236 .off1 = offsetof(struct thread_options, rand_seed),
2237 .help = "Set the random generator seed value",
2240 .category = FIO_OPT_C_IO,
2241 .group = FIO_OPT_G_RANDOM,
2244 .name = "norandommap",
2245 .lname = "No randommap",
2246 .type = FIO_OPT_STR_SET,
2247 .off1 = offsetof(struct thread_options, norandommap),
2248 .help = "Accept potential duplicate random blocks",
2252 .category = FIO_OPT_C_IO,
2253 .group = FIO_OPT_G_RANDOM,
2256 .name = "softrandommap",
2257 .lname = "Soft randommap",
2258 .type = FIO_OPT_BOOL,
2259 .off1 = offsetof(struct thread_options, softrandommap),
2260 .help = "Set norandommap if randommap allocation fails",
2261 .parent = "norandommap",
2264 .category = FIO_OPT_C_IO,
2265 .group = FIO_OPT_G_RANDOM,
2268 .name = "random_generator",
2269 .lname = "Random Generator",
2270 .type = FIO_OPT_STR,
2271 .off1 = offsetof(struct thread_options, random_generator),
2272 .help = "Type of random number generator to use",
2273 .def = "tausworthe",
2275 { .ival = "tausworthe",
2276 .oval = FIO_RAND_GEN_TAUSWORTHE,
2277 .help = "Strong Tausworthe generator",
2280 .oval = FIO_RAND_GEN_LFSR,
2281 .help = "Variable length LFSR",
2284 .ival = "tausworthe64",
2285 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2286 .help = "64-bit Tausworthe variant",
2289 .category = FIO_OPT_C_IO,
2290 .group = FIO_OPT_G_RANDOM,
2293 .name = "random_distribution",
2294 .lname = "Random Distribution",
2295 .type = FIO_OPT_STR,
2296 .off1 = offsetof(struct thread_options, random_distribution),
2297 .cb = str_random_distribution_cb,
2298 .help = "Random offset distribution generator",
2302 .oval = FIO_RAND_DIST_RANDOM,
2303 .help = "Completely random",
2306 .oval = FIO_RAND_DIST_ZIPF,
2307 .help = "Zipf distribution",
2310 .oval = FIO_RAND_DIST_PARETO,
2311 .help = "Pareto distribution",
2314 .oval = FIO_RAND_DIST_GAUSS,
2315 .help = "Normal (Gaussian) distribution",
2318 .oval = FIO_RAND_DIST_ZONED,
2319 .help = "Zoned random distribution",
2321 { .ival = "zoned_abs",
2322 .oval = FIO_RAND_DIST_ZONED_ABS,
2323 .help = "Zoned absolute random distribution",
2326 .category = FIO_OPT_C_IO,
2327 .group = FIO_OPT_G_RANDOM,
2330 .name = "percentage_random",
2331 .lname = "Percentage Random",
2332 .type = FIO_OPT_INT,
2333 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2334 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2335 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2337 .help = "Percentage of seq/random mix that should be random",
2338 .def = "100,100,100",
2340 .inverse = "percentage_sequential",
2341 .category = FIO_OPT_C_IO,
2342 .group = FIO_OPT_G_RANDOM,
2345 .name = "percentage_sequential",
2346 .lname = "Percentage Sequential",
2347 .type = FIO_OPT_DEPRECATED,
2348 .category = FIO_OPT_C_IO,
2349 .group = FIO_OPT_G_RANDOM,
2352 .name = "allrandrepeat",
2353 .lname = "All Random Repeat",
2354 .type = FIO_OPT_BOOL,
2355 .off1 = offsetof(struct thread_options, allrand_repeatable),
2356 .help = "Use repeatable random numbers for everything",
2358 .category = FIO_OPT_C_IO,
2359 .group = FIO_OPT_G_RANDOM,
2363 .lname = "Number of files",
2364 .alias = "nr_files",
2365 .type = FIO_OPT_INT,
2366 .off1 = offsetof(struct thread_options, nr_files),
2367 .help = "Split job workload between this number of files",
2370 .category = FIO_OPT_C_FILE,
2371 .group = FIO_OPT_G_INVALID,
2374 .name = "openfiles",
2375 .lname = "Number of open files",
2376 .type = FIO_OPT_INT,
2377 .off1 = offsetof(struct thread_options, open_files),
2378 .help = "Number of files to keep open at the same time",
2379 .category = FIO_OPT_C_FILE,
2380 .group = FIO_OPT_G_INVALID,
2383 .name = "file_service_type",
2384 .lname = "File service type",
2385 .type = FIO_OPT_STR,
2387 .off1 = offsetof(struct thread_options, file_service_type),
2388 .help = "How to select which file to service next",
2389 .def = "roundrobin",
2390 .category = FIO_OPT_C_FILE,
2391 .group = FIO_OPT_G_INVALID,
2394 .oval = FIO_FSERVICE_RANDOM,
2395 .help = "Choose a file at random (uniform)",
2398 .oval = FIO_FSERVICE_ZIPF,
2399 .help = "Zipf randomized",
2402 .oval = FIO_FSERVICE_PARETO,
2403 .help = "Pareto randomized",
2406 .oval = FIO_FSERVICE_GAUSS,
2407 .help = "Normal (Gaussian) randomized",
2410 .oval = FIO_FSERVICE_GAUSS,
2411 .help = "Alias for normal",
2413 { .ival = "roundrobin",
2414 .oval = FIO_FSERVICE_RR,
2415 .help = "Round robin select files",
2417 { .ival = "sequential",
2418 .oval = FIO_FSERVICE_SEQ,
2419 .help = "Finish one file before moving to the next",
2422 .parent = "nrfiles",
2426 .name = "fallocate",
2427 .lname = "Fallocate",
2428 .type = FIO_OPT_STR,
2429 .off1 = offsetof(struct thread_options, fallocate_mode),
2430 .help = "Whether pre-allocation is performed when laying out files",
2431 #ifdef FIO_HAVE_DEFAULT_FALLOCATE
2436 .category = FIO_OPT_C_FILE,
2437 .group = FIO_OPT_G_INVALID,
2440 .oval = FIO_FALLOCATE_NONE,
2441 .help = "Do not pre-allocate space",
2444 .oval = FIO_FALLOCATE_NATIVE,
2445 .help = "Use native pre-allocation if possible",
2447 #ifdef CONFIG_POSIX_FALLOCATE
2449 .oval = FIO_FALLOCATE_POSIX,
2450 .help = "Use posix_fallocate()",
2453 #ifdef CONFIG_LINUX_FALLOCATE
2455 .oval = FIO_FALLOCATE_KEEP_SIZE,
2456 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2459 { .ival = "truncate",
2460 .oval = FIO_FALLOCATE_TRUNCATE,
2461 .help = "Truncate file to final size instead of allocating"
2463 /* Compatibility with former boolean values */
2465 .oval = FIO_FALLOCATE_NONE,
2466 .help = "Alias for 'none'",
2468 #ifdef CONFIG_POSIX_FALLOCATE
2470 .oval = FIO_FALLOCATE_POSIX,
2471 .help = "Alias for 'posix'",
2477 .name = "fadvise_hint",
2478 .lname = "Fadvise hint",
2479 .type = FIO_OPT_STR,
2480 .off1 = offsetof(struct thread_options, fadvise_hint),
2484 .help = "Don't issue fadvise/madvise",
2488 .help = "Advise using fio IO pattern",
2491 .oval = F_ADV_RANDOM,
2492 .help = "Advise using FADV_RANDOM",
2494 { .ival = "sequential",
2495 .oval = F_ADV_SEQUENTIAL,
2496 .help = "Advise using FADV_SEQUENTIAL",
2499 .help = "Use fadvise() to advise the kernel on IO pattern",
2501 .category = FIO_OPT_C_FILE,
2502 .group = FIO_OPT_G_INVALID,
2507 .type = FIO_OPT_INT,
2508 .off1 = offsetof(struct thread_options, fsync_blocks),
2509 .help = "Issue fsync for writes every given number of blocks",
2512 .category = FIO_OPT_C_FILE,
2513 .group = FIO_OPT_G_INVALID,
2516 .name = "fdatasync",
2517 .lname = "Fdatasync",
2518 .type = FIO_OPT_INT,
2519 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2520 .help = "Issue fdatasync for writes every given number of blocks",
2523 .category = FIO_OPT_C_FILE,
2524 .group = FIO_OPT_G_INVALID,
2527 .name = "write_barrier",
2528 .lname = "Write barrier",
2529 .type = FIO_OPT_INT,
2530 .off1 = offsetof(struct thread_options, barrier_blocks),
2531 .help = "Make every Nth write a barrier write",
2534 .category = FIO_OPT_C_IO,
2535 .group = FIO_OPT_G_INVALID,
2537 #ifdef CONFIG_SYNC_FILE_RANGE
2539 .name = "sync_file_range",
2540 .lname = "Sync file range",
2542 { .ival = "wait_before",
2543 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2544 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2548 .oval = SYNC_FILE_RANGE_WRITE,
2549 .help = "SYNC_FILE_RANGE_WRITE",
2553 .ival = "wait_after",
2554 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2555 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2559 .type = FIO_OPT_STR_MULTI,
2561 .off1 = offsetof(struct thread_options, sync_file_range),
2562 .help = "Use sync_file_range()",
2563 .category = FIO_OPT_C_FILE,
2564 .group = FIO_OPT_G_INVALID,
2568 .name = "sync_file_range",
2569 .lname = "Sync file range",
2570 .type = FIO_OPT_UNSUPPORTED,
2571 .help = "Your platform does not support sync_file_range",
2576 .lname = "Direct I/O",
2577 .type = FIO_OPT_BOOL,
2578 .off1 = offsetof(struct thread_options, odirect),
2579 .help = "Use O_DIRECT IO (negates buffered)",
2581 .inverse = "buffered",
2582 .category = FIO_OPT_C_IO,
2583 .group = FIO_OPT_G_IO_TYPE,
2587 .lname = "Atomic I/O",
2588 .type = FIO_OPT_BOOL,
2589 .off1 = offsetof(struct thread_options, oatomic),
2590 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2592 .category = FIO_OPT_C_IO,
2593 .group = FIO_OPT_G_IO_TYPE,
2597 .lname = "Buffered I/O",
2598 .type = FIO_OPT_BOOL,
2599 .off1 = offsetof(struct thread_options, odirect),
2601 .help = "Use buffered IO (negates direct)",
2603 .inverse = "direct",
2604 .category = FIO_OPT_C_IO,
2605 .group = FIO_OPT_G_IO_TYPE,
2608 .name = "overwrite",
2609 .lname = "Overwrite",
2610 .type = FIO_OPT_BOOL,
2611 .off1 = offsetof(struct thread_options, overwrite),
2612 .help = "When writing, set whether to overwrite current data",
2614 .category = FIO_OPT_C_FILE,
2615 .group = FIO_OPT_G_INVALID,
2620 .type = FIO_OPT_INT,
2621 .off1 = offsetof(struct thread_options, loops),
2622 .help = "Number of times to run the job",
2625 .category = FIO_OPT_C_GENERAL,
2626 .group = FIO_OPT_G_RUNTIME,
2630 .lname = "Number of jobs",
2631 .type = FIO_OPT_INT,
2632 .off1 = offsetof(struct thread_options, numjobs),
2633 .help = "Duplicate this job this many times",
2636 .category = FIO_OPT_C_GENERAL,
2637 .group = FIO_OPT_G_RUNTIME,
2640 .name = "startdelay",
2641 .lname = "Start delay",
2642 .type = FIO_OPT_STR_VAL_TIME,
2643 .off1 = offsetof(struct thread_options, start_delay),
2644 .off2 = offsetof(struct thread_options, start_delay_high),
2645 .help = "Only start job when this period has passed",
2649 .category = FIO_OPT_C_GENERAL,
2650 .group = FIO_OPT_G_RUNTIME,
2656 .type = FIO_OPT_STR_VAL_TIME,
2657 .off1 = offsetof(struct thread_options, timeout),
2658 .help = "Stop workload when this amount of time has passed",
2662 .category = FIO_OPT_C_GENERAL,
2663 .group = FIO_OPT_G_RUNTIME,
2666 .name = "time_based",
2667 .lname = "Time based",
2668 .type = FIO_OPT_STR_SET,
2669 .off1 = offsetof(struct thread_options, time_based),
2670 .help = "Keep running until runtime/timeout is met",
2671 .category = FIO_OPT_C_GENERAL,
2672 .group = FIO_OPT_G_RUNTIME,
2675 .name = "verify_only",
2676 .lname = "Verify only",
2677 .type = FIO_OPT_STR_SET,
2678 .off1 = offsetof(struct thread_options, verify_only),
2679 .help = "Verifies previously written data is still valid",
2680 .category = FIO_OPT_C_GENERAL,
2681 .group = FIO_OPT_G_RUNTIME,
2684 .name = "ramp_time",
2685 .lname = "Ramp time",
2686 .type = FIO_OPT_STR_VAL_TIME,
2687 .off1 = offsetof(struct thread_options, ramp_time),
2688 .help = "Ramp up time before measuring performance",
2691 .category = FIO_OPT_C_GENERAL,
2692 .group = FIO_OPT_G_RUNTIME,
2695 .name = "clocksource",
2696 .lname = "Clock source",
2697 .type = FIO_OPT_STR,
2698 .cb = fio_clock_source_cb,
2699 .off1 = offsetof(struct thread_options, clocksource),
2700 .help = "What type of timing source to use",
2701 .category = FIO_OPT_C_GENERAL,
2702 .group = FIO_OPT_G_CLOCK,
2704 #ifdef CONFIG_GETTIMEOFDAY
2705 { .ival = "gettimeofday",
2707 .help = "Use gettimeofday(2) for timing",
2710 #ifdef CONFIG_CLOCK_GETTIME
2711 { .ival = "clock_gettime",
2712 .oval = CS_CGETTIME,
2713 .help = "Use clock_gettime(2) for timing",
2716 #ifdef ARCH_HAVE_CPU_CLOCK
2718 .oval = CS_CPUCLOCK,
2719 .help = "Use CPU private clock",
2727 .lname = "I/O Memory",
2728 .type = FIO_OPT_STR,
2730 .off1 = offsetof(struct thread_options, mem_type),
2731 .help = "Backing type for IO buffers",
2733 .category = FIO_OPT_C_IO,
2734 .group = FIO_OPT_G_INVALID,
2738 .help = "Use malloc(3) for IO buffers",
2740 #ifndef CONFIG_NO_SHM
2743 .help = "Use shared memory segments for IO buffers",
2745 #ifdef FIO_HAVE_HUGETLB
2746 { .ival = "shmhuge",
2747 .oval = MEM_SHMHUGE,
2748 .help = "Like shm, but use huge pages",
2754 .help = "Use mmap(2) (file or anon) for IO buffers",
2756 { .ival = "mmapshared",
2757 .oval = MEM_MMAPSHARED,
2758 .help = "Like mmap, but use the shared flag",
2760 #ifdef FIO_HAVE_HUGETLB
2761 { .ival = "mmaphuge",
2762 .oval = MEM_MMAPHUGE,
2763 .help = "Like mmap, but use huge pages",
2767 { .ival = "cudamalloc",
2768 .oval = MEM_CUDA_MALLOC,
2769 .help = "Allocate GPU device memory for GPUDirect RDMA",
2775 .name = "iomem_align",
2776 .alias = "mem_align",
2777 .lname = "I/O memory alignment",
2778 .type = FIO_OPT_INT,
2779 .off1 = offsetof(struct thread_options, mem_align),
2781 .help = "IO memory buffer offset alignment",
2785 .category = FIO_OPT_C_IO,
2786 .group = FIO_OPT_G_INVALID,
2791 .type = FIO_OPT_STR,
2792 .off1 = offsetof(struct thread_options, verify),
2793 .help = "Verify data written",
2795 .category = FIO_OPT_C_IO,
2796 .group = FIO_OPT_G_VERIFY,
2799 .oval = VERIFY_NONE,
2800 .help = "Don't do IO verification",
2804 .help = "Use md5 checksums for verification",
2807 .oval = VERIFY_CRC64,
2808 .help = "Use crc64 checksums for verification",
2811 .oval = VERIFY_CRC32,
2812 .help = "Use crc32 checksums for verification",
2814 { .ival = "crc32c-intel",
2815 .oval = VERIFY_CRC32C,
2816 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2819 .oval = VERIFY_CRC32C,
2820 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2823 .oval = VERIFY_CRC16,
2824 .help = "Use crc16 checksums for verification",
2827 .oval = VERIFY_CRC7,
2828 .help = "Use crc7 checksums for verification",
2831 .oval = VERIFY_SHA1,
2832 .help = "Use sha1 checksums for verification",
2835 .oval = VERIFY_SHA256,
2836 .help = "Use sha256 checksums for verification",
2839 .oval = VERIFY_SHA512,
2840 .help = "Use sha512 checksums for verification",
2842 { .ival = "sha3-224",
2843 .oval = VERIFY_SHA3_224,
2844 .help = "Use sha3-224 checksums for verification",
2846 { .ival = "sha3-256",
2847 .oval = VERIFY_SHA3_256,
2848 .help = "Use sha3-256 checksums for verification",
2850 { .ival = "sha3-384",
2851 .oval = VERIFY_SHA3_384,
2852 .help = "Use sha3-384 checksums for verification",
2854 { .ival = "sha3-512",
2855 .oval = VERIFY_SHA3_512,
2856 .help = "Use sha3-512 checksums for verification",
2859 .oval = VERIFY_XXHASH,
2860 .help = "Use xxhash checksums for verification",
2862 /* Meta information was included into verify_header,
2863 * 'meta' verification is implied by default. */
2865 .oval = VERIFY_HDR_ONLY,
2866 .help = "Use io information for verification. "
2867 "Now is implied by default, thus option is obsolete, "
2870 { .ival = "pattern",
2871 .oval = VERIFY_PATTERN_NO_HDR,
2872 .help = "Verify strict pattern",
2876 .oval = VERIFY_NULL,
2877 .help = "Pretend to verify",
2882 .name = "do_verify",
2883 .lname = "Perform verify step",
2884 .type = FIO_OPT_BOOL,
2885 .off1 = offsetof(struct thread_options, do_verify),
2886 .help = "Run verification stage after write",
2890 .category = FIO_OPT_C_IO,
2891 .group = FIO_OPT_G_VERIFY,
2894 .name = "verifysort",
2895 .lname = "Verify sort",
2896 .type = FIO_OPT_SOFT_DEPRECATED,
2897 .category = FIO_OPT_C_IO,
2898 .group = FIO_OPT_G_VERIFY,
2901 .name = "verifysort_nr",
2902 .lname = "Verify Sort Nr",
2903 .type = FIO_OPT_SOFT_DEPRECATED,
2904 .category = FIO_OPT_C_IO,
2905 .group = FIO_OPT_G_VERIFY,
2908 .name = "verify_interval",
2909 .lname = "Verify interval",
2910 .type = FIO_OPT_INT,
2911 .off1 = offsetof(struct thread_options, verify_interval),
2912 .minval = 2 * sizeof(struct verify_header),
2913 .help = "Store verify buffer header every N bytes",
2916 .interval = 2 * sizeof(struct verify_header),
2917 .category = FIO_OPT_C_IO,
2918 .group = FIO_OPT_G_VERIFY,
2921 .name = "verify_offset",
2922 .lname = "Verify offset",
2923 .type = FIO_OPT_INT,
2924 .help = "Offset verify header location by N bytes",
2925 .off1 = offsetof(struct thread_options, verify_offset),
2926 .minval = sizeof(struct verify_header),
2929 .category = FIO_OPT_C_IO,
2930 .group = FIO_OPT_G_VERIFY,
2933 .name = "verify_pattern",
2934 .lname = "Verify pattern",
2935 .type = FIO_OPT_STR,
2936 .cb = str_verify_pattern_cb,
2937 .off1 = offsetof(struct thread_options, verify_pattern),
2938 .help = "Fill pattern for IO buffers",
2941 .category = FIO_OPT_C_IO,
2942 .group = FIO_OPT_G_VERIFY,
2945 .name = "verify_fatal",
2946 .lname = "Verify fatal",
2947 .type = FIO_OPT_BOOL,
2948 .off1 = offsetof(struct thread_options, verify_fatal),
2950 .help = "Exit on a single verify failure, don't continue",
2953 .category = FIO_OPT_C_IO,
2954 .group = FIO_OPT_G_VERIFY,
2957 .name = "verify_dump",
2958 .lname = "Verify dump",
2959 .type = FIO_OPT_BOOL,
2960 .off1 = offsetof(struct thread_options, verify_dump),
2962 .help = "Dump contents of good and bad blocks on failure",
2965 .category = FIO_OPT_C_IO,
2966 .group = FIO_OPT_G_VERIFY,
2969 .name = "verify_async",
2970 .lname = "Verify asynchronously",
2971 .type = FIO_OPT_INT,
2972 .off1 = offsetof(struct thread_options, verify_async),
2974 .help = "Number of async verifier threads to use",
2977 .category = FIO_OPT_C_IO,
2978 .group = FIO_OPT_G_VERIFY,
2981 .name = "verify_backlog",
2982 .lname = "Verify backlog",
2983 .type = FIO_OPT_STR_VAL,
2984 .off1 = offsetof(struct thread_options, verify_backlog),
2985 .help = "Verify after this number of blocks are written",
2988 .category = FIO_OPT_C_IO,
2989 .group = FIO_OPT_G_VERIFY,
2992 .name = "verify_backlog_batch",
2993 .lname = "Verify backlog batch",
2994 .type = FIO_OPT_INT,
2995 .off1 = offsetof(struct thread_options, verify_batch),
2996 .help = "Verify this number of IO blocks",
2999 .category = FIO_OPT_C_IO,
3000 .group = FIO_OPT_G_VERIFY,
3002 #ifdef FIO_HAVE_CPU_AFFINITY
3004 .name = "verify_async_cpus",
3005 .lname = "Async verify CPUs",
3006 .type = FIO_OPT_STR,
3007 .cb = str_verify_cpus_allowed_cb,
3008 .off1 = offsetof(struct thread_options, verify_cpumask),
3009 .help = "Set CPUs allowed for async verify threads",
3010 .parent = "verify_async",
3012 .category = FIO_OPT_C_IO,
3013 .group = FIO_OPT_G_VERIFY,
3017 .name = "verify_async_cpus",
3018 .lname = "Async verify CPUs",
3019 .type = FIO_OPT_UNSUPPORTED,
3020 .help = "Your platform does not support CPU affinities",
3024 .name = "experimental_verify",
3025 .lname = "Experimental Verify",
3026 .off1 = offsetof(struct thread_options, experimental_verify),
3027 .type = FIO_OPT_BOOL,
3028 .help = "Enable experimental verification",
3030 .category = FIO_OPT_C_IO,
3031 .group = FIO_OPT_G_VERIFY,
3034 .name = "verify_state_load",
3035 .lname = "Load verify state",
3036 .off1 = offsetof(struct thread_options, verify_state),
3037 .type = FIO_OPT_BOOL,
3038 .help = "Load verify termination state",
3040 .category = FIO_OPT_C_IO,
3041 .group = FIO_OPT_G_VERIFY,
3044 .name = "verify_state_save",
3045 .lname = "Save verify state",
3046 .off1 = offsetof(struct thread_options, verify_state_save),
3047 .type = FIO_OPT_BOOL,
3049 .help = "Save verify state on termination",
3051 .category = FIO_OPT_C_IO,
3052 .group = FIO_OPT_G_VERIFY,
3054 #ifdef FIO_HAVE_TRIM
3056 .name = "trim_percentage",
3057 .lname = "Trim percentage",
3058 .type = FIO_OPT_INT,
3059 .off1 = offsetof(struct thread_options, trim_percentage),
3062 .help = "Number of verify blocks to trim (i.e., discard)",
3067 .category = FIO_OPT_C_IO,
3068 .group = FIO_OPT_G_TRIM,
3071 .name = "trim_verify_zero",
3072 .lname = "Verify trim zero",
3073 .type = FIO_OPT_BOOL,
3074 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3075 .off1 = offsetof(struct thread_options, trim_zero),
3076 .parent = "trim_percentage",
3079 .category = FIO_OPT_C_IO,
3080 .group = FIO_OPT_G_TRIM,
3083 .name = "trim_backlog",
3084 .lname = "Trim backlog",
3085 .type = FIO_OPT_STR_VAL,
3086 .off1 = offsetof(struct thread_options, trim_backlog),
3087 .help = "Trim after this number of blocks are written",
3088 .parent = "trim_percentage",
3091 .category = FIO_OPT_C_IO,
3092 .group = FIO_OPT_G_TRIM,
3095 .name = "trim_backlog_batch",
3096 .lname = "Trim backlog batch",
3097 .type = FIO_OPT_INT,
3098 .off1 = offsetof(struct thread_options, trim_batch),
3099 .help = "Trim this number of IO blocks",
3100 .parent = "trim_percentage",
3103 .category = FIO_OPT_C_IO,
3104 .group = FIO_OPT_G_TRIM,
3108 .name = "trim_percentage",
3109 .lname = "Trim percentage",
3110 .type = FIO_OPT_UNSUPPORTED,
3111 .help = "Fio does not support TRIM on your platform",
3114 .name = "trim_verify_zero",
3115 .lname = "Verify trim zero",
3116 .type = FIO_OPT_UNSUPPORTED,
3117 .help = "Fio does not support TRIM on your platform",
3120 .name = "trim_backlog",
3121 .lname = "Trim backlog",
3122 .type = FIO_OPT_UNSUPPORTED,
3123 .help = "Fio does not support TRIM on your platform",
3126 .name = "trim_backlog_batch",
3127 .lname = "Trim backlog batch",
3128 .type = FIO_OPT_UNSUPPORTED,
3129 .help = "Fio does not support TRIM on your platform",
3133 .name = "write_iolog",
3134 .lname = "Write I/O log",
3135 .type = FIO_OPT_STR_STORE,
3136 .off1 = offsetof(struct thread_options, write_iolog_file),
3137 .help = "Store IO pattern to file",
3138 .category = FIO_OPT_C_IO,
3139 .group = FIO_OPT_G_IOLOG,
3142 .name = "read_iolog",
3143 .lname = "Read I/O log",
3144 .type = FIO_OPT_STR_STORE,
3145 .off1 = offsetof(struct thread_options, read_iolog_file),
3146 .help = "Playback IO pattern from file",
3147 .category = FIO_OPT_C_IO,
3148 .group = FIO_OPT_G_IOLOG,
3151 .name = "read_iolog_chunked",
3152 .lname = "Read I/O log in parts",
3153 .type = FIO_OPT_BOOL,
3154 .off1 = offsetof(struct thread_options, read_iolog_chunked),
3156 .parent = "read_iolog",
3157 .help = "Parse IO pattern in chunks",
3158 .category = FIO_OPT_C_IO,
3159 .group = FIO_OPT_G_IOLOG,
3162 .name = "replay_no_stall",
3163 .lname = "Don't stall on replay",
3164 .type = FIO_OPT_BOOL,
3165 .off1 = offsetof(struct thread_options, no_stall),
3167 .parent = "read_iolog",
3169 .help = "Playback IO pattern file as fast as possible without stalls",
3170 .category = FIO_OPT_C_IO,
3171 .group = FIO_OPT_G_IOLOG,
3174 .name = "replay_redirect",
3175 .lname = "Redirect device for replay",
3176 .type = FIO_OPT_STR_STORE,
3177 .off1 = offsetof(struct thread_options, replay_redirect),
3178 .parent = "read_iolog",
3180 .help = "Replay all I/O onto this device, regardless of trace device",
3181 .category = FIO_OPT_C_IO,
3182 .group = FIO_OPT_G_IOLOG,
3185 .name = "replay_scale",
3186 .lname = "Replace offset scale factor",
3187 .type = FIO_OPT_INT,
3188 .off1 = offsetof(struct thread_options, replay_scale),
3189 .parent = "read_iolog",
3191 .help = "Align offsets to this blocksize",
3192 .category = FIO_OPT_C_IO,
3193 .group = FIO_OPT_G_IOLOG,
3196 .name = "replay_align",
3197 .lname = "Replace alignment",
3198 .type = FIO_OPT_INT,
3199 .off1 = offsetof(struct thread_options, replay_align),
3200 .parent = "read_iolog",
3201 .help = "Scale offset down by this factor",
3202 .category = FIO_OPT_C_IO,
3203 .group = FIO_OPT_G_IOLOG,
3207 .name = "replay_time_scale",
3208 .lname = "Replay Time Scale",
3209 .type = FIO_OPT_INT,
3210 .off1 = offsetof(struct thread_options, replay_time_scale),
3213 .parent = "read_iolog",
3215 .help = "Scale time for replay events",
3216 .category = FIO_OPT_C_IO,
3217 .group = FIO_OPT_G_IOLOG,
3220 .name = "replay_skip",
3221 .lname = "Replay Skip",
3222 .type = FIO_OPT_STR,
3223 .cb = str_replay_skip_cb,
3224 .off1 = offsetof(struct thread_options, replay_skip),
3225 .parent = "read_iolog",
3226 .help = "Skip certain IO types (read,write,trim,flush)",
3227 .category = FIO_OPT_C_IO,
3228 .group = FIO_OPT_G_IOLOG,
3231 .name = "merge_blktrace_file",
3232 .lname = "Merged blktrace output filename",
3233 .type = FIO_OPT_STR_STORE,
3234 .off1 = offsetof(struct thread_options, merge_blktrace_file),
3235 .help = "Merged blktrace output filename",
3236 .category = FIO_OPT_C_IO,
3237 .group = FIO_OPT_G_IOLOG,
3240 .name = "merge_blktrace_scalars",
3241 .lname = "Percentage to scale each trace",
3242 .type = FIO_OPT_FLOAT_LIST,
3243 .off1 = offsetof(struct thread_options, merge_blktrace_scalars),
3244 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3245 .help = "Percentage to scale each trace",
3246 .category = FIO_OPT_C_IO,
3247 .group = FIO_OPT_G_IOLOG,
3250 .name = "merge_blktrace_iters",
3251 .lname = "Number of iterations to run per trace",
3252 .type = FIO_OPT_FLOAT_LIST,
3253 .off1 = offsetof(struct thread_options, merge_blktrace_iters),
3254 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3255 .help = "Number of iterations to run per trace",
3256 .category = FIO_OPT_C_IO,
3257 .group = FIO_OPT_G_IOLOG,
3260 .name = "exec_prerun",
3261 .lname = "Pre-execute runnable",
3262 .type = FIO_OPT_STR_STORE,
3263 .off1 = offsetof(struct thread_options, exec_prerun),
3264 .help = "Execute this file prior to running job",
3265 .category = FIO_OPT_C_GENERAL,
3266 .group = FIO_OPT_G_INVALID,
3269 .name = "exec_postrun",
3270 .lname = "Post-execute runnable",
3271 .type = FIO_OPT_STR_STORE,
3272 .off1 = offsetof(struct thread_options, exec_postrun),
3273 .help = "Execute this file after running job",
3274 .category = FIO_OPT_C_GENERAL,
3275 .group = FIO_OPT_G_INVALID,
3277 #ifdef FIO_HAVE_IOSCHED_SWITCH
3279 .name = "ioscheduler",
3280 .lname = "I/O scheduler",
3281 .type = FIO_OPT_STR_STORE,
3282 .off1 = offsetof(struct thread_options, ioscheduler),
3283 .help = "Use this IO scheduler on the backing device",
3284 .category = FIO_OPT_C_FILE,
3285 .group = FIO_OPT_G_INVALID,
3289 .name = "ioscheduler",
3290 .lname = "I/O scheduler",
3291 .type = FIO_OPT_UNSUPPORTED,
3292 .help = "Your platform does not support IO scheduler switching",
3297 .lname = "Zone mode",
3298 .help = "Mode for the zonesize, zonerange and zoneskip parameters",
3299 .type = FIO_OPT_STR,
3300 .off1 = offsetof(struct thread_options, zone_mode),
3302 .category = FIO_OPT_C_IO,
3303 .group = FIO_OPT_G_ZONE,
3306 .oval = ZONE_MODE_NONE,
3307 .help = "no zoning",
3309 { .ival = "strided",
3310 .oval = ZONE_MODE_STRIDED,
3311 .help = "strided mode - random I/O is restricted to a single zone",
3314 .oval = ZONE_MODE_ZBD,
3315 .help = "zoned block device mode - random I/O selects one of multiple zones randomly",
3321 .lname = "Zone size",
3322 .type = FIO_OPT_STR_VAL,
3323 .off1 = offsetof(struct thread_options, zone_size),
3324 .help = "Amount of data to read per zone",
3326 .interval = 1024 * 1024,
3327 .category = FIO_OPT_C_IO,
3328 .group = FIO_OPT_G_ZONE,
3331 .name = "zonecapacity",
3332 .lname = "Zone capacity",
3333 .type = FIO_OPT_STR_VAL,
3334 .off1 = offsetof(struct thread_options, zone_capacity),
3335 .help = "Capacity per zone",
3337 .interval = 1024 * 1024,
3338 .category = FIO_OPT_C_IO,
3339 .group = FIO_OPT_G_ZONE,
3342 .name = "zonerange",
3343 .lname = "Zone range",
3344 .type = FIO_OPT_STR_VAL,
3345 .off1 = offsetof(struct thread_options, zone_range),
3346 .help = "Give size of an IO zone",
3348 .interval = 1024 * 1024,
3349 .category = FIO_OPT_C_IO,
3350 .group = FIO_OPT_G_ZONE,
3354 .lname = "Zone skip",
3355 .type = FIO_OPT_STR_VAL,
3356 .off1 = offsetof(struct thread_options, zone_skip),
3357 .help = "Space between IO zones",
3359 .interval = 1024 * 1024,
3360 .category = FIO_OPT_C_IO,
3361 .group = FIO_OPT_G_ZONE,
3364 .name = "read_beyond_wp",
3365 .lname = "Allow reads beyond the zone write pointer",
3366 .type = FIO_OPT_BOOL,
3367 .off1 = offsetof(struct thread_options, read_beyond_wp),
3368 .help = "Allow reads beyond the zone write pointer",
3370 .category = FIO_OPT_C_IO,
3371 .group = FIO_OPT_G_INVALID,
3374 .name = "max_open_zones",
3375 .lname = "Per device/file maximum number of open zones",
3376 .type = FIO_OPT_INT,
3377 .off1 = offsetof(struct thread_options, max_open_zones),
3378 .maxval = ZBD_MAX_OPEN_ZONES,
3379 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd",
3381 .category = FIO_OPT_C_IO,
3382 .group = FIO_OPT_G_INVALID,
3385 .name = "job_max_open_zones",
3386 .lname = "Job maximum number of open zones",
3387 .type = FIO_OPT_INT,
3388 .off1 = offsetof(struct thread_options, job_max_open_zones),
3389 .maxval = ZBD_MAX_OPEN_ZONES,
3390 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd by one thread/process",
3392 .category = FIO_OPT_C_IO,
3393 .group = FIO_OPT_G_INVALID,
3396 .name = "zone_reset_threshold",
3397 .lname = "Zone reset threshold",
3398 .help = "Zoned block device reset threshold",
3399 .type = FIO_OPT_FLOAT_LIST,
3401 .off1 = offsetof(struct thread_options, zrt),
3404 .category = FIO_OPT_C_IO,
3405 .group = FIO_OPT_G_ZONE,
3408 .name = "zone_reset_frequency",
3409 .lname = "Zone reset frequency",
3410 .help = "Zoned block device zone reset frequency in HZ",
3411 .type = FIO_OPT_FLOAT_LIST,
3413 .off1 = offsetof(struct thread_options, zrf),
3416 .category = FIO_OPT_C_IO,
3417 .group = FIO_OPT_G_ZONE,
3421 .lname = "Lock memory",
3422 .type = FIO_OPT_STR_VAL,
3423 .off1 = offsetof(struct thread_options, lockmem),
3424 .help = "Lock down this amount of memory (per worker)",
3426 .interval = 1024 * 1024,
3427 .category = FIO_OPT_C_GENERAL,
3428 .group = FIO_OPT_G_INVALID,
3431 .name = "rwmixread",
3432 .lname = "Read/write mix read",
3433 .type = FIO_OPT_INT,
3434 .cb = str_rwmix_read_cb,
3435 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3437 .help = "Percentage of mixed workload that is reads",
3440 .inverse = "rwmixwrite",
3441 .category = FIO_OPT_C_IO,
3442 .group = FIO_OPT_G_RWMIX,
3445 .name = "rwmixwrite",
3446 .lname = "Read/write mix write",
3447 .type = FIO_OPT_INT,
3448 .cb = str_rwmix_write_cb,
3449 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3451 .help = "Percentage of mixed workload that is writes",
3454 .inverse = "rwmixread",
3455 .category = FIO_OPT_C_IO,
3456 .group = FIO_OPT_G_RWMIX,
3459 .name = "rwmixcycle",
3460 .lname = "Read/write mix cycle",
3461 .type = FIO_OPT_DEPRECATED,
3462 .category = FIO_OPT_C_IO,
3463 .group = FIO_OPT_G_RWMIX,
3468 .type = FIO_OPT_INT,
3469 .off1 = offsetof(struct thread_options, nice),
3470 .help = "Set job CPU nice value",
3475 .category = FIO_OPT_C_GENERAL,
3476 .group = FIO_OPT_G_CRED,
3478 #ifdef FIO_HAVE_IOPRIO
3481 .lname = "I/O nice priority",
3482 .type = FIO_OPT_INT,
3483 .off1 = offsetof(struct thread_options, ioprio),
3484 .help = "Set job IO priority value",
3485 .minval = IOPRIO_MIN_PRIO,
3486 .maxval = IOPRIO_MAX_PRIO,
3488 .category = FIO_OPT_C_GENERAL,
3489 .group = FIO_OPT_G_CRED,
3494 .lname = "I/O nice priority",
3495 .type = FIO_OPT_UNSUPPORTED,
3496 .help = "Your platform does not support IO priorities",
3499 #ifdef FIO_HAVE_IOPRIO_CLASS
3500 #ifndef FIO_HAVE_IOPRIO
3501 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3504 .name = "prioclass",
3505 .lname = "I/O nice priority class",
3506 .type = FIO_OPT_INT,
3507 .off1 = offsetof(struct thread_options, ioprio_class),
3508 .help = "Set job IO priority class",
3509 .minval = IOPRIO_MIN_PRIO_CLASS,
3510 .maxval = IOPRIO_MAX_PRIO_CLASS,
3512 .category = FIO_OPT_C_GENERAL,
3513 .group = FIO_OPT_G_CRED,
3517 .name = "prioclass",
3518 .lname = "I/O nice priority class",
3519 .type = FIO_OPT_UNSUPPORTED,
3520 .help = "Your platform does not support IO priority classes",
3524 .name = "thinktime",
3525 .lname = "Thinktime",
3526 .type = FIO_OPT_INT,
3527 .off1 = offsetof(struct thread_options, thinktime),
3528 .help = "Idle time between IO buffers (usec)",
3531 .category = FIO_OPT_C_IO,
3532 .group = FIO_OPT_G_THINKTIME,
3535 .name = "thinktime_spin",
3536 .lname = "Thinktime spin",
3537 .type = FIO_OPT_INT,
3538 .off1 = offsetof(struct thread_options, thinktime_spin),
3539 .help = "Start think time by spinning this amount (usec)",
3542 .parent = "thinktime",
3544 .category = FIO_OPT_C_IO,
3545 .group = FIO_OPT_G_THINKTIME,
3548 .name = "thinktime_blocks",
3549 .lname = "Thinktime blocks",
3550 .type = FIO_OPT_INT,
3551 .off1 = offsetof(struct thread_options, thinktime_blocks),
3552 .help = "IO buffer period between 'thinktime'",
3554 .parent = "thinktime",
3556 .category = FIO_OPT_C_IO,
3557 .group = FIO_OPT_G_THINKTIME,
3561 .lname = "I/O rate",
3562 .type = FIO_OPT_ULL,
3563 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3564 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3565 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
3566 .help = "Set bandwidth rate",
3567 .category = FIO_OPT_C_IO,
3568 .group = FIO_OPT_G_RATE,
3573 .lname = "I/O min rate",
3574 .type = FIO_OPT_ULL,
3575 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
3576 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
3577 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
3578 .help = "Job must meet this rate or it will be shutdown",
3581 .category = FIO_OPT_C_IO,
3582 .group = FIO_OPT_G_RATE,
3585 .name = "rate_iops",
3586 .lname = "I/O rate IOPS",
3587 .type = FIO_OPT_INT,
3588 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
3589 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
3590 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
3591 .help = "Limit IO used to this number of IO operations/sec",
3593 .category = FIO_OPT_C_IO,
3594 .group = FIO_OPT_G_RATE,
3597 .name = "rate_iops_min",
3598 .lname = "I/O min rate IOPS",
3599 .type = FIO_OPT_INT,
3600 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
3601 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
3602 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
3603 .help = "Job must meet this rate or it will be shut down",
3604 .parent = "rate_iops",
3606 .category = FIO_OPT_C_IO,
3607 .group = FIO_OPT_G_RATE,
3610 .name = "rate_process",
3611 .lname = "Rate Process",
3612 .type = FIO_OPT_STR,
3613 .off1 = offsetof(struct thread_options, rate_process),
3614 .help = "What process controls how rated IO is managed",
3616 .category = FIO_OPT_C_IO,
3617 .group = FIO_OPT_G_RATE,
3620 .oval = RATE_PROCESS_LINEAR,
3621 .help = "Linear rate of IO",
3625 .oval = RATE_PROCESS_POISSON,
3626 .help = "Rate follows Poisson process",
3632 .name = "rate_cycle",
3633 .alias = "ratecycle",
3634 .lname = "I/O rate cycle",
3635 .type = FIO_OPT_INT,
3636 .off1 = offsetof(struct thread_options, ratecycle),
3637 .help = "Window average for rate limits (msec)",
3641 .category = FIO_OPT_C_IO,
3642 .group = FIO_OPT_G_RATE,
3645 .name = "rate_ignore_thinktime",
3646 .lname = "Rate ignore thinktime",
3647 .type = FIO_OPT_BOOL,
3648 .off1 = offsetof(struct thread_options, rate_ign_think),
3649 .help = "Rated IO ignores thinktime settings",
3651 .category = FIO_OPT_C_IO,
3652 .group = FIO_OPT_G_RATE,
3655 .name = "max_latency",
3656 .lname = "Max Latency (usec)",
3657 .type = FIO_OPT_STR_VAL_TIME,
3658 .off1 = offsetof(struct thread_options, max_latency),
3659 .help = "Maximum tolerated IO latency (usec)",
3661 .category = FIO_OPT_C_IO,
3662 .group = FIO_OPT_G_LATPROF,
3665 .name = "latency_target",
3666 .lname = "Latency Target (usec)",
3667 .type = FIO_OPT_STR_VAL_TIME,
3668 .off1 = offsetof(struct thread_options, latency_target),
3669 .help = "Ramp to max queue depth supporting this latency",
3671 .category = FIO_OPT_C_IO,
3672 .group = FIO_OPT_G_LATPROF,
3675 .name = "latency_window",
3676 .lname = "Latency Window (usec)",
3677 .type = FIO_OPT_STR_VAL_TIME,
3678 .off1 = offsetof(struct thread_options, latency_window),
3679 .help = "Time to sustain latency_target",
3681 .category = FIO_OPT_C_IO,
3682 .group = FIO_OPT_G_LATPROF,
3685 .name = "latency_percentile",
3686 .lname = "Latency Percentile",
3687 .type = FIO_OPT_FLOAT_LIST,
3688 .off1 = offsetof(struct thread_options, latency_percentile),
3689 .help = "Percentile of IOs must be below latency_target",
3694 .category = FIO_OPT_C_IO,
3695 .group = FIO_OPT_G_LATPROF,
3698 .name = "latency_run",
3699 .lname = "Latency Run",
3700 .type = FIO_OPT_BOOL,
3701 .off1 = offsetof(struct thread_options, latency_run),
3702 .help = "Keep adjusting queue depth to match latency_target",
3704 .category = FIO_OPT_C_IO,
3705 .group = FIO_OPT_G_LATPROF,
3708 .name = "invalidate",
3709 .lname = "Cache invalidate",
3710 .type = FIO_OPT_BOOL,
3711 .off1 = offsetof(struct thread_options, invalidate_cache),
3712 .help = "Invalidate buffer/page cache prior to running job",
3714 .category = FIO_OPT_C_IO,
3715 .group = FIO_OPT_G_IO_TYPE,
3719 .lname = "Synchronous I/O",
3720 .type = FIO_OPT_BOOL,
3721 .off1 = offsetof(struct thread_options, sync_io),
3722 .help = "Use O_SYNC for buffered writes",
3724 .parent = "buffered",
3726 .category = FIO_OPT_C_IO,
3727 .group = FIO_OPT_G_IO_TYPE,
3729 #ifdef FIO_HAVE_WRITE_HINT
3731 .name = "write_hint",
3732 .lname = "Write hint",
3733 .type = FIO_OPT_STR,
3734 .off1 = offsetof(struct thread_options, write_hint),
3735 .help = "Set expected write life time",
3736 .category = FIO_OPT_C_ENGINE,
3737 .group = FIO_OPT_G_INVALID,
3740 .oval = RWH_WRITE_LIFE_NONE,
3743 .oval = RWH_WRITE_LIFE_SHORT,
3746 .oval = RWH_WRITE_LIFE_MEDIUM,
3749 .oval = RWH_WRITE_LIFE_LONG,
3751 { .ival = "extreme",
3752 .oval = RWH_WRITE_LIFE_EXTREME,
3758 .name = "create_serialize",
3759 .lname = "Create serialize",
3760 .type = FIO_OPT_BOOL,
3761 .off1 = offsetof(struct thread_options, create_serialize),
3762 .help = "Serialize creation of job files",
3764 .category = FIO_OPT_C_FILE,
3765 .group = FIO_OPT_G_INVALID,
3768 .name = "create_fsync",
3769 .lname = "Create fsync",
3770 .type = FIO_OPT_BOOL,
3771 .off1 = offsetof(struct thread_options, create_fsync),
3772 .help = "fsync file after creation",
3774 .category = FIO_OPT_C_FILE,
3775 .group = FIO_OPT_G_INVALID,
3778 .name = "create_on_open",
3779 .lname = "Create on open",
3780 .type = FIO_OPT_BOOL,
3781 .off1 = offsetof(struct thread_options, create_on_open),
3782 .help = "Create files when they are opened for IO",
3784 .category = FIO_OPT_C_FILE,
3785 .group = FIO_OPT_G_INVALID,
3788 .name = "create_only",
3789 .lname = "Create Only",
3790 .type = FIO_OPT_BOOL,
3791 .off1 = offsetof(struct thread_options, create_only),
3792 .help = "Only perform file creation phase",
3793 .category = FIO_OPT_C_FILE,
3797 .name = "allow_file_create",
3798 .lname = "Allow file create",
3799 .type = FIO_OPT_BOOL,
3800 .off1 = offsetof(struct thread_options, allow_create),
3801 .help = "Permit fio to create files, if they don't exist",
3803 .category = FIO_OPT_C_FILE,
3804 .group = FIO_OPT_G_FILENAME,
3807 .name = "allow_mounted_write",
3808 .lname = "Allow mounted write",
3809 .type = FIO_OPT_BOOL,
3810 .off1 = offsetof(struct thread_options, allow_mounted_write),
3811 .help = "Allow writes to a mounted partition",
3813 .category = FIO_OPT_C_FILE,
3814 .group = FIO_OPT_G_FILENAME,
3818 .lname = "Pre-read files",
3819 .type = FIO_OPT_BOOL,
3820 .off1 = offsetof(struct thread_options, pre_read),
3821 .help = "Pre-read files before starting official testing",
3823 .category = FIO_OPT_C_FILE,
3824 .group = FIO_OPT_G_INVALID,
3826 #ifdef FIO_HAVE_CPU_AFFINITY
3829 .lname = "CPU mask",
3830 .type = FIO_OPT_INT,
3831 .cb = str_cpumask_cb,
3832 .off1 = offsetof(struct thread_options, cpumask),
3833 .help = "CPU affinity mask",
3834 .category = FIO_OPT_C_GENERAL,
3835 .group = FIO_OPT_G_CRED,
3838 .name = "cpus_allowed",
3839 .lname = "CPUs allowed",
3840 .type = FIO_OPT_STR,
3841 .cb = str_cpus_allowed_cb,
3842 .off1 = offsetof(struct thread_options, cpumask),
3843 .help = "Set CPUs allowed",
3844 .category = FIO_OPT_C_GENERAL,
3845 .group = FIO_OPT_G_CRED,
3848 .name = "cpus_allowed_policy",
3849 .lname = "CPUs allowed distribution policy",
3850 .type = FIO_OPT_STR,
3851 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
3852 .help = "Distribution policy for cpus_allowed",
3853 .parent = "cpus_allowed",
3857 .oval = FIO_CPUS_SHARED,
3858 .help = "Mask shared between threads",
3861 .oval = FIO_CPUS_SPLIT,
3862 .help = "Mask split between threads",
3865 .category = FIO_OPT_C_GENERAL,
3866 .group = FIO_OPT_G_CRED,
3871 .lname = "CPU mask",
3872 .type = FIO_OPT_UNSUPPORTED,
3873 .help = "Your platform does not support CPU affinities",
3876 .name = "cpus_allowed",
3877 .lname = "CPUs allowed",
3878 .type = FIO_OPT_UNSUPPORTED,
3879 .help = "Your platform does not support CPU affinities",
3882 .name = "cpus_allowed_policy",
3883 .lname = "CPUs allowed distribution policy",
3884 .type = FIO_OPT_UNSUPPORTED,
3885 .help = "Your platform does not support CPU affinities",
3888 #ifdef CONFIG_LIBNUMA
3890 .name = "numa_cpu_nodes",
3891 .lname = "NUMA CPU Nodes",
3892 .type = FIO_OPT_STR,
3893 .cb = str_numa_cpunodes_cb,
3894 .off1 = offsetof(struct thread_options, numa_cpunodes),
3895 .help = "NUMA CPU nodes bind",
3896 .category = FIO_OPT_C_GENERAL,
3897 .group = FIO_OPT_G_INVALID,
3900 .name = "numa_mem_policy",
3901 .lname = "NUMA Memory Policy",
3902 .type = FIO_OPT_STR,
3903 .cb = str_numa_mpol_cb,
3904 .off1 = offsetof(struct thread_options, numa_memnodes),
3905 .help = "NUMA memory policy setup",
3906 .category = FIO_OPT_C_GENERAL,
3907 .group = FIO_OPT_G_INVALID,
3911 .name = "numa_cpu_nodes",
3912 .lname = "NUMA CPU Nodes",
3913 .type = FIO_OPT_UNSUPPORTED,
3914 .help = "Build fio with libnuma-dev(el) to enable this option",
3917 .name = "numa_mem_policy",
3918 .lname = "NUMA Memory Policy",
3919 .type = FIO_OPT_UNSUPPORTED,
3920 .help = "Build fio with libnuma-dev(el) to enable this option",
3925 .name = "gpu_dev_id",
3926 .lname = "GPU device ID",
3927 .type = FIO_OPT_INT,
3928 .off1 = offsetof(struct thread_options, gpu_dev_id),
3929 .help = "Set GPU device ID for GPUDirect RDMA",
3931 .category = FIO_OPT_C_GENERAL,
3932 .group = FIO_OPT_G_INVALID,
3936 .name = "end_fsync",
3937 .lname = "End fsync",
3938 .type = FIO_OPT_BOOL,
3939 .off1 = offsetof(struct thread_options, end_fsync),
3940 .help = "Include fsync at the end of job",
3942 .category = FIO_OPT_C_FILE,
3943 .group = FIO_OPT_G_INVALID,
3946 .name = "fsync_on_close",
3947 .lname = "Fsync on close",
3948 .type = FIO_OPT_BOOL,
3949 .off1 = offsetof(struct thread_options, fsync_on_close),
3950 .help = "fsync files on close",
3952 .category = FIO_OPT_C_FILE,
3953 .group = FIO_OPT_G_INVALID,
3957 .lname = "Unlink file",
3958 .type = FIO_OPT_BOOL,
3959 .off1 = offsetof(struct thread_options, unlink),
3960 .help = "Unlink created files after job has completed",
3962 .category = FIO_OPT_C_FILE,
3963 .group = FIO_OPT_G_INVALID,
3966 .name = "unlink_each_loop",
3967 .lname = "Unlink file after each loop of a job",
3968 .type = FIO_OPT_BOOL,
3969 .off1 = offsetof(struct thread_options, unlink_each_loop),
3970 .help = "Unlink created files after each loop in a job has completed",
3972 .category = FIO_OPT_C_FILE,
3973 .group = FIO_OPT_G_INVALID,
3977 .lname = "Exit-all on terminate",
3978 .type = FIO_OPT_STR_SET,
3979 .cb = str_exitall_cb,
3980 .help = "Terminate all jobs when one exits",
3981 .category = FIO_OPT_C_GENERAL,
3982 .group = FIO_OPT_G_PROCESS,
3985 .name = "exit_what",
3986 .lname = "What jobs to quit on terminate",
3987 .type = FIO_OPT_STR,
3988 .off1 = offsetof(struct thread_options, exit_what),
3989 .help = "Fine-grained control for exitall",
3991 .category = FIO_OPT_C_GENERAL,
3992 .group = FIO_OPT_G_PROCESS,
3995 .oval = TERMINATE_GROUP,
3996 .help = "exit_all=1 default behaviour",
3998 { .ival = "stonewall",
3999 .oval = TERMINATE_STONEWALL,
4000 .help = "quit all currently running jobs; continue with next stonewall",
4003 .oval = TERMINATE_ALL,
4004 .help = "Quit everything",
4009 .name = "exitall_on_error",
4010 .lname = "Exit-all on terminate in error",
4011 .type = FIO_OPT_STR_SET,
4012 .off1 = offsetof(struct thread_options, exitall_error),
4013 .help = "Terminate all jobs when one exits in error",
4014 .category = FIO_OPT_C_GENERAL,
4015 .group = FIO_OPT_G_PROCESS,
4018 .name = "stonewall",
4019 .lname = "Wait for previous",
4020 .alias = "wait_for_previous",
4021 .type = FIO_OPT_STR_SET,
4022 .off1 = offsetof(struct thread_options, stonewall),
4023 .help = "Insert a hard barrier between this job and previous",
4024 .category = FIO_OPT_C_GENERAL,
4025 .group = FIO_OPT_G_PROCESS,
4028 .name = "new_group",
4029 .lname = "New group",
4030 .type = FIO_OPT_STR_SET,
4031 .off1 = offsetof(struct thread_options, new_group),
4032 .help = "Mark the start of a new group (for reporting)",
4033 .category = FIO_OPT_C_GENERAL,
4034 .group = FIO_OPT_G_PROCESS,
4039 .type = FIO_OPT_STR_SET,
4040 .off1 = offsetof(struct thread_options, use_thread),
4041 .help = "Use threads instead of processes",
4042 #ifdef CONFIG_NO_SHM
4046 .category = FIO_OPT_C_GENERAL,
4047 .group = FIO_OPT_G_PROCESS,
4050 .name = "per_job_logs",
4051 .lname = "Per Job Logs",
4052 .type = FIO_OPT_BOOL,
4053 .off1 = offsetof(struct thread_options, per_job_logs),
4054 .help = "Include job number in generated log files or not",
4056 .category = FIO_OPT_C_LOG,
4057 .group = FIO_OPT_G_INVALID,
4060 .name = "write_bw_log",
4061 .lname = "Write bandwidth log",
4062 .type = FIO_OPT_STR,
4063 .off1 = offsetof(struct thread_options, bw_log_file),
4064 .cb = str_write_bw_log_cb,
4065 .help = "Write log of bandwidth during run",
4066 .category = FIO_OPT_C_LOG,
4067 .group = FIO_OPT_G_INVALID,
4070 .name = "write_lat_log",
4071 .lname = "Write latency log",
4072 .type = FIO_OPT_STR,
4073 .off1 = offsetof(struct thread_options, lat_log_file),
4074 .cb = str_write_lat_log_cb,
4075 .help = "Write log of latency during run",
4076 .category = FIO_OPT_C_LOG,
4077 .group = FIO_OPT_G_INVALID,
4080 .name = "write_iops_log",
4081 .lname = "Write IOPS log",
4082 .type = FIO_OPT_STR,
4083 .off1 = offsetof(struct thread_options, iops_log_file),
4084 .cb = str_write_iops_log_cb,
4085 .help = "Write log of IOPS during run",
4086 .category = FIO_OPT_C_LOG,
4087 .group = FIO_OPT_G_INVALID,
4090 .name = "log_avg_msec",
4091 .lname = "Log averaging (msec)",
4092 .type = FIO_OPT_INT,
4093 .off1 = offsetof(struct thread_options, log_avg_msec),
4094 .help = "Average bw/iops/lat logs over this period of time",
4096 .category = FIO_OPT_C_LOG,
4097 .group = FIO_OPT_G_INVALID,
4100 .name = "log_hist_msec",
4101 .lname = "Log histograms (msec)",
4102 .type = FIO_OPT_INT,
4103 .off1 = offsetof(struct thread_options, log_hist_msec),
4104 .help = "Dump completion latency histograms at frequency of this time value",
4106 .category = FIO_OPT_C_LOG,
4107 .group = FIO_OPT_G_INVALID,
4110 .name = "log_hist_coarseness",
4111 .lname = "Histogram logs coarseness",
4112 .type = FIO_OPT_INT,
4113 .off1 = offsetof(struct thread_options, log_hist_coarseness),
4114 .help = "Integer in range [0,6]. Higher coarseness outputs"
4115 " fewer histogram bins per sample. The number of bins for"
4116 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
4118 .category = FIO_OPT_C_LOG,
4119 .group = FIO_OPT_G_INVALID,
4122 .name = "write_hist_log",
4123 .lname = "Write latency histogram logs",
4124 .type = FIO_OPT_STR,
4125 .off1 = offsetof(struct thread_options, hist_log_file),
4126 .cb = str_write_hist_log_cb,
4127 .help = "Write log of latency histograms during run",
4128 .category = FIO_OPT_C_LOG,
4129 .group = FIO_OPT_G_INVALID,
4132 .name = "log_max_value",
4133 .lname = "Log maximum instead of average",
4134 .type = FIO_OPT_BOOL,
4135 .off1 = offsetof(struct thread_options, log_max),
4136 .help = "Log max sample in a window instead of average",
4138 .category = FIO_OPT_C_LOG,
4139 .group = FIO_OPT_G_INVALID,
4142 .name = "log_offset",
4143 .lname = "Log offset of IO",
4144 .type = FIO_OPT_BOOL,
4145 .off1 = offsetof(struct thread_options, log_offset),
4146 .help = "Include offset of IO for each log entry",
4148 .category = FIO_OPT_C_LOG,
4149 .group = FIO_OPT_G_INVALID,
4153 .name = "log_compression",
4154 .lname = "Log compression",
4155 .type = FIO_OPT_INT,
4156 .off1 = offsetof(struct thread_options, log_gz),
4157 .help = "Log in compressed chunks of this size",
4159 .maxval = 512 * 1024 * 1024ULL,
4160 .category = FIO_OPT_C_LOG,
4161 .group = FIO_OPT_G_INVALID,
4163 #ifdef FIO_HAVE_CPU_AFFINITY
4165 .name = "log_compression_cpus",
4166 .lname = "Log Compression CPUs",
4167 .type = FIO_OPT_STR,
4168 .cb = str_log_cpus_allowed_cb,
4169 .off1 = offsetof(struct thread_options, log_gz_cpumask),
4170 .parent = "log_compression",
4171 .help = "Limit log compression to these CPUs",
4172 .category = FIO_OPT_C_LOG,
4173 .group = FIO_OPT_G_INVALID,
4177 .name = "log_compression_cpus",
4178 .lname = "Log Compression CPUs",
4179 .type = FIO_OPT_UNSUPPORTED,
4180 .help = "Your platform does not support CPU affinities",
4184 .name = "log_store_compressed",
4185 .lname = "Log store compressed",
4186 .type = FIO_OPT_BOOL,
4187 .off1 = offsetof(struct thread_options, log_gz_store),
4188 .help = "Store logs in a compressed format",
4189 .category = FIO_OPT_C_LOG,
4190 .group = FIO_OPT_G_INVALID,
4194 .name = "log_compression",
4195 .lname = "Log compression",
4196 .type = FIO_OPT_UNSUPPORTED,
4197 .help = "Install libz-dev(el) to get compression support",
4200 .name = "log_store_compressed",
4201 .lname = "Log store compressed",
4202 .type = FIO_OPT_UNSUPPORTED,
4203 .help = "Install libz-dev(el) to get compression support",
4207 .name = "log_unix_epoch",
4208 .lname = "Log epoch unix",
4209 .type = FIO_OPT_BOOL,
4210 .off1 = offsetof(struct thread_options, log_unix_epoch),
4211 .help = "Use Unix time in log files",
4212 .category = FIO_OPT_C_LOG,
4213 .group = FIO_OPT_G_INVALID,
4216 .name = "block_error_percentiles",
4217 .lname = "Block error percentiles",
4218 .type = FIO_OPT_BOOL,
4219 .off1 = offsetof(struct thread_options, block_error_hist),
4220 .help = "Record trim block errors and make a histogram",
4222 .category = FIO_OPT_C_LOG,
4223 .group = FIO_OPT_G_INVALID,
4226 .name = "bwavgtime",
4227 .lname = "Bandwidth average time",
4228 .type = FIO_OPT_INT,
4229 .off1 = offsetof(struct thread_options, bw_avg_time),
4230 .help = "Time window over which to calculate bandwidth"
4233 .parent = "write_bw_log",
4236 .category = FIO_OPT_C_LOG,
4237 .group = FIO_OPT_G_INVALID,
4240 .name = "iopsavgtime",
4241 .lname = "IOPS average time",
4242 .type = FIO_OPT_INT,
4243 .off1 = offsetof(struct thread_options, iops_avg_time),
4244 .help = "Time window over which to calculate IOPS (msec)",
4246 .parent = "write_iops_log",
4249 .category = FIO_OPT_C_LOG,
4250 .group = FIO_OPT_G_INVALID,
4253 .name = "group_reporting",
4254 .lname = "Group reporting",
4255 .type = FIO_OPT_STR_SET,
4256 .off1 = offsetof(struct thread_options, group_reporting),
4257 .help = "Do reporting on a per-group basis",
4258 .category = FIO_OPT_C_STAT,
4259 .group = FIO_OPT_G_INVALID,
4264 .type = FIO_OPT_BOOL,
4265 .off1 = offsetof(struct thread_options, stats),
4266 .help = "Enable collection of stats",
4268 .category = FIO_OPT_C_STAT,
4269 .group = FIO_OPT_G_INVALID,
4272 .name = "zero_buffers",
4273 .lname = "Zero I/O buffers",
4274 .type = FIO_OPT_STR_SET,
4275 .off1 = offsetof(struct thread_options, zero_buffers),
4276 .help = "Init IO buffers to all zeroes",
4277 .category = FIO_OPT_C_IO,
4278 .group = FIO_OPT_G_IO_BUF,
4281 .name = "refill_buffers",
4282 .lname = "Refill I/O buffers",
4283 .type = FIO_OPT_STR_SET,
4284 .off1 = offsetof(struct thread_options, refill_buffers),
4285 .help = "Refill IO buffers on every IO submit",
4286 .category = FIO_OPT_C_IO,
4287 .group = FIO_OPT_G_IO_BUF,
4290 .name = "scramble_buffers",
4291 .lname = "Scramble I/O buffers",
4292 .type = FIO_OPT_BOOL,
4293 .off1 = offsetof(struct thread_options, scramble_buffers),
4294 .help = "Slightly scramble buffers on every IO submit",
4296 .category = FIO_OPT_C_IO,
4297 .group = FIO_OPT_G_IO_BUF,
4300 .name = "buffer_pattern",
4301 .lname = "Buffer pattern",
4302 .type = FIO_OPT_STR,
4303 .cb = str_buffer_pattern_cb,
4304 .off1 = offsetof(struct thread_options, buffer_pattern),
4305 .help = "Fill pattern for IO buffers",
4306 .category = FIO_OPT_C_IO,
4307 .group = FIO_OPT_G_IO_BUF,
4310 .name = "buffer_compress_percentage",
4311 .lname = "Buffer compression percentage",
4312 .type = FIO_OPT_INT,
4313 .cb = str_buffer_compress_cb,
4314 .off1 = offsetof(struct thread_options, compress_percentage),
4317 .help = "How compressible the buffer is (approximately)",
4319 .category = FIO_OPT_C_IO,
4320 .group = FIO_OPT_G_IO_BUF,
4323 .name = "buffer_compress_chunk",
4324 .lname = "Buffer compression chunk size",
4325 .type = FIO_OPT_INT,
4326 .off1 = offsetof(struct thread_options, compress_chunk),
4327 .parent = "buffer_compress_percentage",
4329 .help = "Size of compressible region in buffer",
4332 .category = FIO_OPT_C_IO,
4333 .group = FIO_OPT_G_IO_BUF,
4336 .name = "dedupe_percentage",
4337 .lname = "Dedupe percentage",
4338 .type = FIO_OPT_INT,
4339 .cb = str_dedupe_cb,
4340 .off1 = offsetof(struct thread_options, dedupe_percentage),
4343 .help = "Percentage of buffers that are dedupable",
4345 .category = FIO_OPT_C_IO,
4346 .group = FIO_OPT_G_IO_BUF,
4349 .name = "clat_percentiles",
4350 .lname = "Completion latency percentiles",
4351 .type = FIO_OPT_BOOL,
4352 .off1 = offsetof(struct thread_options, clat_percentiles),
4353 .help = "Enable the reporting of completion latency percentiles",
4355 .category = FIO_OPT_C_STAT,
4356 .group = FIO_OPT_G_INVALID,
4359 .name = "lat_percentiles",
4360 .lname = "IO latency percentiles",
4361 .type = FIO_OPT_BOOL,
4362 .off1 = offsetof(struct thread_options, lat_percentiles),
4363 .help = "Enable the reporting of IO latency percentiles",
4365 .category = FIO_OPT_C_STAT,
4366 .group = FIO_OPT_G_INVALID,
4369 .name = "slat_percentiles",
4370 .lname = "Submission latency percentiles",
4371 .type = FIO_OPT_BOOL,
4372 .off1 = offsetof(struct thread_options, slat_percentiles),
4373 .help = "Enable the reporting of submission latency percentiles",
4375 .category = FIO_OPT_C_STAT,
4376 .group = FIO_OPT_G_INVALID,
4379 .name = "percentile_list",
4380 .lname = "Percentile list",
4381 .type = FIO_OPT_FLOAT_LIST,
4382 .off1 = offsetof(struct thread_options, percentile_list),
4383 .off2 = offsetof(struct thread_options, percentile_precision),
4384 .help = "Specify a custom list of percentiles to report for "
4385 "completion latency and block errors",
4386 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
4387 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4390 .category = FIO_OPT_C_STAT,
4391 .group = FIO_OPT_G_INVALID,
4394 .name = "significant_figures",
4395 .lname = "Significant figures",
4396 .type = FIO_OPT_INT,
4397 .off1 = offsetof(struct thread_options, sig_figs),
4400 .help = "Significant figures for output-format set to normal",
4403 .category = FIO_OPT_C_STAT,
4404 .group = FIO_OPT_G_INVALID,
4407 #ifdef FIO_HAVE_DISK_UTIL
4409 .name = "disk_util",
4410 .lname = "Disk utilization",
4411 .type = FIO_OPT_BOOL,
4412 .off1 = offsetof(struct thread_options, do_disk_util),
4413 .help = "Log disk utilization statistics",
4415 .category = FIO_OPT_C_STAT,
4416 .group = FIO_OPT_G_INVALID,
4420 .name = "disk_util",
4421 .lname = "Disk utilization",
4422 .type = FIO_OPT_UNSUPPORTED,
4423 .help = "Your platform does not support disk utilization",
4427 .name = "gtod_reduce",
4428 .lname = "Reduce gettimeofday() calls",
4429 .type = FIO_OPT_BOOL,
4430 .help = "Greatly reduce number of gettimeofday() calls",
4431 .cb = str_gtod_reduce_cb,
4434 .category = FIO_OPT_C_STAT,
4435 .group = FIO_OPT_G_INVALID,
4438 .name = "disable_lat",
4439 .lname = "Disable all latency stats",
4440 .type = FIO_OPT_BOOL,
4441 .off1 = offsetof(struct thread_options, disable_lat),
4442 .help = "Disable latency numbers",
4443 .parent = "gtod_reduce",
4446 .category = FIO_OPT_C_STAT,
4447 .group = FIO_OPT_G_INVALID,
4450 .name = "disable_clat",
4451 .lname = "Disable completion latency stats",
4452 .type = FIO_OPT_BOOL,
4453 .off1 = offsetof(struct thread_options, disable_clat),
4454 .help = "Disable completion latency numbers",
4455 .parent = "gtod_reduce",
4458 .category = FIO_OPT_C_STAT,
4459 .group = FIO_OPT_G_INVALID,
4462 .name = "disable_slat",
4463 .lname = "Disable submission latency stats",
4464 .type = FIO_OPT_BOOL,
4465 .off1 = offsetof(struct thread_options, disable_slat),
4466 .help = "Disable submission latency numbers",
4467 .parent = "gtod_reduce",
4470 .category = FIO_OPT_C_STAT,
4471 .group = FIO_OPT_G_INVALID,
4474 .name = "disable_bw_measurement",
4475 .alias = "disable_bw",
4476 .lname = "Disable bandwidth stats",
4477 .type = FIO_OPT_BOOL,
4478 .off1 = offsetof(struct thread_options, disable_bw),
4479 .help = "Disable bandwidth logging",
4480 .parent = "gtod_reduce",
4483 .category = FIO_OPT_C_STAT,
4484 .group = FIO_OPT_G_INVALID,
4488 .lname = "Dedicated gettimeofday() CPU",
4489 .type = FIO_OPT_INT,
4490 .off1 = offsetof(struct thread_options, gtod_cpu),
4491 .help = "Set up dedicated gettimeofday() thread on this CPU",
4492 .verify = gtod_cpu_verify,
4493 .category = FIO_OPT_C_GENERAL,
4494 .group = FIO_OPT_G_CLOCK,
4497 .name = "unified_rw_reporting",
4498 .lname = "Unified RW Reporting",
4499 .type = FIO_OPT_BOOL,
4500 .off1 = offsetof(struct thread_options, unified_rw_rep),
4501 .help = "Unify reporting across data direction",
4503 .category = FIO_OPT_C_GENERAL,
4504 .group = FIO_OPT_G_INVALID,
4507 .name = "continue_on_error",
4508 .lname = "Continue on error",
4509 .type = FIO_OPT_STR,
4510 .off1 = offsetof(struct thread_options, continue_on_error),
4511 .help = "Continue on non-fatal errors during IO",
4513 .category = FIO_OPT_C_GENERAL,
4514 .group = FIO_OPT_G_ERR,
4517 .oval = ERROR_TYPE_NONE,
4518 .help = "Exit when an error is encountered",
4521 .oval = ERROR_TYPE_READ,
4522 .help = "Continue on read errors only",
4525 .oval = ERROR_TYPE_WRITE,
4526 .help = "Continue on write errors only",
4529 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
4530 .help = "Continue on any IO errors",
4533 .oval = ERROR_TYPE_VERIFY,
4534 .help = "Continue on verify errors only",
4537 .oval = ERROR_TYPE_ANY,
4538 .help = "Continue on all io and verify errors",
4541 .oval = ERROR_TYPE_NONE,
4542 .help = "Alias for 'none'",
4545 .oval = ERROR_TYPE_ANY,
4546 .help = "Alias for 'all'",
4551 .name = "ignore_error",
4552 .lname = "Ignore Error",
4553 .type = FIO_OPT_STR,
4554 .cb = str_ignore_error_cb,
4555 .off1 = offsetof(struct thread_options, ignore_error_nr),
4556 .help = "Set a specific list of errors to ignore",
4558 .category = FIO_OPT_C_GENERAL,
4559 .group = FIO_OPT_G_ERR,
4562 .name = "error_dump",
4563 .lname = "Error Dump",
4564 .type = FIO_OPT_BOOL,
4565 .off1 = offsetof(struct thread_options, error_dump),
4567 .help = "Dump info on each error",
4568 .category = FIO_OPT_C_GENERAL,
4569 .group = FIO_OPT_G_ERR,
4574 .type = FIO_OPT_STR_STORE,
4575 .off1 = offsetof(struct thread_options, profile),
4576 .help = "Select a specific builtin performance test",
4577 .category = FIO_OPT_C_PROFILE,
4578 .group = FIO_OPT_G_INVALID,
4583 .type = FIO_OPT_STR_STORE,
4584 .off1 = offsetof(struct thread_options, cgroup),
4585 .help = "Add job to cgroup of this name",
4586 .category = FIO_OPT_C_GENERAL,
4587 .group = FIO_OPT_G_CGROUP,
4590 .name = "cgroup_nodelete",
4591 .lname = "Cgroup no-delete",
4592 .type = FIO_OPT_BOOL,
4593 .off1 = offsetof(struct thread_options, cgroup_nodelete),
4594 .help = "Do not delete cgroups after job completion",
4597 .category = FIO_OPT_C_GENERAL,
4598 .group = FIO_OPT_G_CGROUP,
4601 .name = "cgroup_weight",
4602 .lname = "Cgroup weight",
4603 .type = FIO_OPT_INT,
4604 .off1 = offsetof(struct thread_options, cgroup_weight),
4605 .help = "Use given weight for cgroup",
4609 .category = FIO_OPT_C_GENERAL,
4610 .group = FIO_OPT_G_CGROUP,
4615 .type = FIO_OPT_INT,
4616 .off1 = offsetof(struct thread_options, uid),
4617 .help = "Run job with this user ID",
4618 .category = FIO_OPT_C_GENERAL,
4619 .group = FIO_OPT_G_CRED,
4623 .lname = "Group ID",
4624 .type = FIO_OPT_INT,
4625 .off1 = offsetof(struct thread_options, gid),
4626 .help = "Run job with this group ID",
4627 .category = FIO_OPT_C_GENERAL,
4628 .group = FIO_OPT_G_CRED,
4633 .type = FIO_OPT_STR,
4634 .off1 = offsetof(struct thread_options, kb_base),
4640 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
4644 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
4647 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
4648 .category = FIO_OPT_C_GENERAL,
4649 .group = FIO_OPT_G_INVALID,
4652 .name = "unit_base",
4653 .lname = "Unit for quantities of data (Bits or Bytes)",
4654 .type = FIO_OPT_STR,
4655 .off1 = offsetof(struct thread_options, unit_base),
4660 .help = "Auto-detect",
4663 .oval = N2S_BYTEPERSEC,
4664 .help = "Normal (byte based)",
4667 .oval = N2S_BITPERSEC,
4668 .help = "Bit based",
4671 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
4672 .category = FIO_OPT_C_GENERAL,
4673 .group = FIO_OPT_G_INVALID,
4676 .name = "hugepage-size",
4677 .lname = "Hugepage size",
4678 .type = FIO_OPT_INT,
4679 .off1 = offsetof(struct thread_options, hugepage_size),
4680 .help = "When using hugepages, specify size of each page",
4681 .def = __fio_stringify(FIO_HUGE_PAGE),
4682 .interval = 1024 * 1024,
4683 .category = FIO_OPT_C_GENERAL,
4684 .group = FIO_OPT_G_INVALID,
4688 .lname = "I/O flow ID",
4689 .type = FIO_OPT_INT,
4690 .off1 = offsetof(struct thread_options, flow_id),
4691 .help = "The flow index ID to use",
4693 .category = FIO_OPT_C_IO,
4694 .group = FIO_OPT_G_IO_FLOW,
4698 .lname = "I/O flow weight",
4699 .type = FIO_OPT_INT,
4700 .off1 = offsetof(struct thread_options, flow),
4701 .help = "Weight for flow control of this job",
4702 .parent = "flow_id",
4705 .category = FIO_OPT_C_IO,
4706 .group = FIO_OPT_G_IO_FLOW,
4709 .name = "flow_watermark",
4710 .lname = "I/O flow watermark",
4711 .type = FIO_OPT_INT,
4712 .off1 = offsetof(struct thread_options, flow_watermark),
4713 .help = "High watermark for flow control. This option"
4714 " should be set to the same value for all threads"
4715 " with non-zero flow.",
4716 .parent = "flow_id",
4719 .category = FIO_OPT_C_IO,
4720 .group = FIO_OPT_G_IO_FLOW,
4723 .name = "flow_sleep",
4724 .lname = "I/O flow sleep",
4725 .type = FIO_OPT_INT,
4726 .off1 = offsetof(struct thread_options, flow_sleep),
4727 .help = "How many microseconds to sleep after being held"
4728 " back by the flow control mechanism",
4729 .parent = "flow_id",
4732 .category = FIO_OPT_C_IO,
4733 .group = FIO_OPT_G_IO_FLOW,
4736 .name = "steadystate",
4737 .lname = "Steady state threshold",
4739 .type = FIO_OPT_STR,
4740 .off1 = offsetof(struct thread_options, ss_state),
4741 .cb = str_steadystate_cb,
4742 .help = "Define the criterion and limit to judge when a job has reached steady state",
4743 .def = "iops_slope:0.01%",
4746 .oval = FIO_SS_IOPS,
4747 .help = "maximum mean deviation of IOPS measurements",
4749 { .ival = "iops_slope",
4750 .oval = FIO_SS_IOPS_SLOPE,
4751 .help = "slope calculated from IOPS measurements",
4755 .help = "maximum mean deviation of bandwidth measurements",
4759 .oval = FIO_SS_BW_SLOPE,
4760 .help = "slope calculated from bandwidth measurements",
4763 .category = FIO_OPT_C_GENERAL,
4764 .group = FIO_OPT_G_RUNTIME,
4767 .name = "steadystate_duration",
4768 .lname = "Steady state duration",
4770 .parent = "steadystate",
4771 .type = FIO_OPT_STR_VAL_TIME,
4772 .off1 = offsetof(struct thread_options, ss_dur),
4773 .help = "Stop workload upon attaining steady state for specified duration",
4777 .category = FIO_OPT_C_GENERAL,
4778 .group = FIO_OPT_G_RUNTIME,
4781 .name = "steadystate_ramp_time",
4782 .lname = "Steady state ramp time",
4784 .parent = "steadystate",
4785 .type = FIO_OPT_STR_VAL_TIME,
4786 .off1 = offsetof(struct thread_options, ss_ramp_time),
4787 .help = "Delay before initiation of data collection for steady state job termination testing",
4791 .category = FIO_OPT_C_GENERAL,
4792 .group = FIO_OPT_G_RUNTIME,
4799 static void add_to_lopt(struct option *lopt, struct fio_option *o,
4800 const char *name, int val)
4802 lopt->name = (char *) name;
4804 if (o->type == FIO_OPT_STR_SET)
4805 lopt->has_arg = optional_argument;
4807 lopt->has_arg = required_argument;
4810 static void options_to_lopts(struct fio_option *opts,
4811 struct option *long_options,
4812 int i, int option_type)
4814 struct fio_option *o = &opts[0];
4816 add_to_lopt(&long_options[i], o, o->name, option_type);
4819 add_to_lopt(&long_options[i], o, o->alias, option_type);
4824 assert(i < FIO_NR_OPTIONS);
4828 void fio_options_set_ioengine_opts(struct option *long_options,
4829 struct thread_data *td)
4834 while (long_options[i].name) {
4835 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
4836 memset(&long_options[i], 0, sizeof(*long_options));
4843 * Just clear out the prior ioengine options.
4848 options_to_lopts(td->io_ops->options, long_options, i,
4849 FIO_GETOPT_IOENGINE);
4852 void fio_options_dup_and_init(struct option *long_options)
4856 options_init(fio_options);
4859 while (long_options[i].name)
4862 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
4865 struct fio_keyword {
4871 static struct fio_keyword fio_keywords[] = {
4873 .word = "$pagesize",
4874 .desc = "Page size in the system",
4877 .word = "$mb_memory",
4878 .desc = "Megabytes of memory online",
4882 .desc = "Number of CPUs online in the system",
4889 void fio_keywords_exit(void)
4891 struct fio_keyword *kw;
4893 kw = &fio_keywords[0];
4901 void fio_keywords_init(void)
4903 unsigned long long mb_memory;
4907 sprintf(buf, "%lu", (unsigned long) page_size);
4908 fio_keywords[0].replace = strdup(buf);
4910 mb_memory = os_phys_mem() / (1024 * 1024);
4911 sprintf(buf, "%llu", mb_memory);
4912 fio_keywords[1].replace = strdup(buf);
4915 sprintf(buf, "%lu", l);
4916 fio_keywords[2].replace = strdup(buf);
4921 static char *bc_calc(char *str)
4923 char buf[128], *tmp;
4928 * No math, just return string
4930 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
4931 !strchr(str, '/')) || strchr(str, '\''))
4935 * Split option from value, we only need to calculate the value
4937 tmp = strchr(str, '=');
4944 * Prevent buffer overflows; such a case isn't reasonable anyway
4946 if (strlen(str) >= 128 || strlen(tmp) > 100)
4949 sprintf(buf, "which %s > /dev/null", BC_APP);
4951 log_err("fio: bc is needed for performing math\n");
4955 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
4956 f = popen(buf, "r");
4960 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
4967 buf[(tmp - str) + ret - 1] = '\0';
4968 memcpy(buf, str, tmp - str);
4974 * Return a copy of the input string with substrings of the form ${VARNAME}
4975 * substituted with the value of the environment variable VARNAME. The
4976 * substitution always occurs, even if VARNAME is empty or the corresponding
4977 * environment variable undefined.
4979 char *fio_option_dup_subs(const char *opt)
4981 char out[OPT_LEN_MAX+1];
4982 char in[OPT_LEN_MAX+1];
4985 char *ch1, *ch2, *env;
4986 ssize_t nchr = OPT_LEN_MAX;
4989 if (strlen(opt) + 1 > OPT_LEN_MAX) {
4990 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
4994 snprintf(in, sizeof(in), "%s", opt);
4996 while (*inptr && nchr > 0) {
4997 if (inptr[0] == '$' && inptr[1] == '{') {
4998 ch2 = strchr(inptr, '}');
4999 if (ch2 && inptr+1 < ch2) {
5006 envlen = strlen(env);
5007 if (envlen <= nchr) {
5008 memcpy(outptr, env, envlen);
5018 *outptr++ = *inptr++;
5027 * Look for reserved variable names and replace them with real values
5029 static char *fio_keyword_replace(char *opt)
5035 for (i = 0; fio_keywords[i].word != NULL; i++) {
5036 struct fio_keyword *kw = &fio_keywords[i];
5038 while ((s = strstr(opt, kw->word)) != NULL) {
5039 char *new = malloc(strlen(opt) + 1);
5045 * Copy part of the string before the keyword and
5046 * sprintf() the replacement after it.
5048 memcpy(new, opt, olen);
5049 len = sprintf(new + olen, "%s", kw->replace);
5052 * If there's more in the original string, copy that
5055 opt += strlen(kw->word) + olen;
5057 memcpy(new + olen + len, opt, opt - o_org - 1);
5060 * replace opt and free the old opt
5070 * Check for potential math and invoke bc, if possible
5078 static char **dup_and_sub_options(char **opts, int num_opts)
5081 char **opts_copy = malloc(num_opts * sizeof(*opts));
5082 for (i = 0; i < num_opts; i++) {
5083 opts_copy[i] = fio_option_dup_subs(opts[i]);
5086 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
5091 static void show_closest_option(const char *opt)
5093 int best_option, best_distance;
5102 while (name[i] != '\0' && name[i] != '=')
5107 best_distance = INT_MAX;
5109 while (fio_options[i].name) {
5110 distance = string_distance(name, fio_options[i].name);
5111 if (distance < best_distance) {
5112 best_distance = distance;
5118 if (best_option != -1 && string_distance_ok(name, best_distance) &&
5119 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
5120 log_err("Did you mean %s?\n", fio_options[best_option].name);
5125 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
5127 int i, ret, unknown;
5130 sort_options(opts, fio_options, num_opts);
5131 opts_copy = dup_and_sub_options(opts, num_opts);
5133 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
5134 const struct fio_option *o;
5135 int newret = parse_option(opts_copy[i], opts[i], fio_options,
5136 &o, &td->o, &td->opt_list);
5139 fio_option_mark_set(&td->o, o);
5147 opts_copy[i] = NULL;
5154 ret |= ioengine_load(td);
5156 sort_options(opts_copy, td->io_ops->options, num_opts);
5159 for (i = 0; i < num_opts; i++) {
5160 const struct fio_option *o = NULL;
5167 newret = parse_option(opts_copy[i], opts[i],
5168 td->io_ops->options, &o,
5169 td->eo, &td->opt_list);
5173 log_err("Bad option <%s>\n", opts[i]);
5174 show_closest_option(opts[i]);
5177 opts_copy[i] = NULL;
5185 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
5189 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
5191 const struct fio_option *o;
5193 o = find_option_c(fio_options, opt);
5195 fio_option_mark_set(&td->o, o);
5201 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
5204 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
5208 void fio_fill_default_options(struct thread_data *td)
5210 td->o.magic = OPT_MAGIC;
5211 fill_default_options(&td->o, fio_options);
5214 int fio_show_option_help(const char *opt)
5216 return show_cmd_help(fio_options, opt);
5220 * dupe FIO_OPT_STR_STORE options
5222 void fio_options_mem_dupe(struct thread_data *td)
5224 options_mem_dupe(fio_options, &td->o);
5226 if (td->eo && td->io_ops) {
5227 void *oldeo = td->eo;
5229 td->eo = malloc(td->io_ops->option_struct_size);
5230 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
5231 options_mem_dupe(td->io_ops->options, td->eo);
5235 unsigned int fio_get_kb_base(void *data)
5237 struct thread_data *td = cb_data_to_td(data);
5238 struct thread_options *o = &td->o;
5239 unsigned int kb_base = 0;
5242 * This is a hack... For private options, *data is not holding
5243 * a pointer to the thread_options, but to private data. This means
5244 * we can't safely dereference it, but magic is first so mem wise
5245 * it is valid. But this also means that if the job first sets
5246 * kb_base and expects that to be honored by private options,
5247 * it will be disappointed. We will return the global default
5250 if (o && o->magic == OPT_MAGIC)
5251 kb_base = o->kb_base;
5258 int add_option(const struct fio_option *o)
5260 struct fio_option *__o;
5269 if (opt_index + 1 == FIO_MAX_OPTS) {
5270 log_err("fio: FIO_MAX_OPTS is too small\n");
5274 memcpy(&fio_options[opt_index], o, sizeof(*o));
5275 fio_options[opt_index + 1].name = NULL;
5279 void invalidate_profile_options(const char *prof_name)
5281 struct fio_option *o;
5285 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5286 o->type = FIO_OPT_INVALID;
5287 o->prof_name = NULL;
5293 void add_opt_posval(const char *optname, const char *ival, const char *help)
5295 struct fio_option *o;
5298 o = find_option(fio_options, optname);
5302 for (i = 0; i < PARSE_MAX_VP; i++) {
5303 if (o->posval[i].ival)
5306 o->posval[i].ival = ival;
5307 o->posval[i].help = help;
5312 void del_opt_posval(const char *optname, const char *ival)
5314 struct fio_option *o;
5317 o = find_option(fio_options, optname);
5321 for (i = 0; i < PARSE_MAX_VP; i++) {
5322 if (!o->posval[i].ival)
5324 if (strcmp(o->posval[i].ival, ival))
5327 o->posval[i].ival = NULL;
5328 o->posval[i].help = NULL;
5332 void fio_options_free(struct thread_data *td)
5334 options_free(fio_options, &td->o);
5335 if (td->eo && td->io_ops && td->io_ops->options) {
5336 options_free(td->io_ops->options, td->eo);
5342 struct fio_option *fio_option_find(const char *name)
5344 return find_option(fio_options, name);
5347 static struct fio_option *find_next_opt(struct fio_option *from,
5350 struct fio_option *opt;
5353 from = &fio_options[0];
5359 if (off1 == from->off1) {
5364 } while (from->name);
5369 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5371 unsigned int opt_off, index, offset;
5373 opt_off = opt - &fio_options[0];
5374 index = opt_off / (8 * sizeof(uint64_t));
5375 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5376 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
5379 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
5381 struct fio_option *opt, *next;
5384 while ((opt = find_next_opt(next, off1)) != NULL) {
5385 if (opt_is_set(o, opt))
5394 void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt)
5396 unsigned int opt_off, index, offset;
5398 opt_off = opt - &fio_options[0];
5399 index = opt_off / (8 * sizeof(uint64_t));
5400 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5401 o->set_options[index] |= (uint64_t)1 << offset;