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_io_size_cb(void *data, unsigned long long *__val)
1481 struct thread_data *td = cb_data_to_td(data);
1482 unsigned long long v = *__val;
1484 if (parse_is_percent_uncapped(v)) {
1486 td->o.io_size_percent = -1ULL - v;
1487 if (td->o.io_size_percent > 100) {
1488 log_err("fio: io_size values greater than 100%% aren't supported\n");
1491 dprint(FD_PARSE, "SET io_size_percent %d\n",
1492 td->o.io_size_percent);
1499 static int str_write_bw_log_cb(void *data, const char *str)
1501 struct thread_data *td = cb_data_to_td(data);
1504 td->o.bw_log_file = strdup(str);
1506 td->o.write_bw_log = 1;
1510 static int str_write_lat_log_cb(void *data, const char *str)
1512 struct thread_data *td = cb_data_to_td(data);
1515 td->o.lat_log_file = strdup(str);
1517 td->o.write_lat_log = 1;
1521 static int str_write_iops_log_cb(void *data, const char *str)
1523 struct thread_data *td = cb_data_to_td(data);
1526 td->o.iops_log_file = strdup(str);
1528 td->o.write_iops_log = 1;
1532 static int str_write_hist_log_cb(void *data, const char *str)
1534 struct thread_data *td = cb_data_to_td(data);
1537 td->o.hist_log_file = strdup(str);
1539 td->o.write_hist_log = 1;
1544 * str is supposed to be a substring of the strdup'd original string,
1545 * and is valid only if it's a regular file path.
1546 * This function keeps the pointer to the path as needed later.
1548 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1549 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1550 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1552 static int str_ioengine_external_cb(void *data, const char *str)
1554 struct thread_data *td = cb_data_to_td(data);
1559 log_err("fio: null external ioengine path\n");
1563 p = (char *)str; /* str is mutable */
1564 strip_blank_front(&p);
1567 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1568 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1572 td->o.ioengine_so_path = p;
1576 static int rw_verify(const struct fio_option *o, void *data)
1578 struct thread_data *td = cb_data_to_td(data);
1580 if (read_only && (td_write(td) || td_trim(td))) {
1581 log_err("fio: job <%s> has write or trim bit set, but"
1582 " fio is in read-only mode\n", td->o.name);
1589 static int gtod_cpu_verify(const struct fio_option *o, void *data)
1591 #ifndef FIO_HAVE_CPU_AFFINITY
1592 struct thread_data *td = cb_data_to_td(data);
1594 if (td->o.gtod_cpu) {
1595 log_err("fio: platform must support CPU affinity for"
1596 "gettimeofday() offloading\n");
1605 * Map of job/command line options
1607 struct fio_option fio_options[FIO_MAX_OPTS] = {
1609 .name = "description",
1610 .lname = "Description of job",
1611 .type = FIO_OPT_STR_STORE,
1612 .off1 = offsetof(struct thread_options, description),
1613 .help = "Text job description",
1614 .category = FIO_OPT_C_GENERAL,
1615 .group = FIO_OPT_G_DESC,
1619 .lname = "Job name",
1620 .type = FIO_OPT_STR_STORE,
1621 .off1 = offsetof(struct thread_options, name),
1622 .help = "Name of this job",
1623 .category = FIO_OPT_C_GENERAL,
1624 .group = FIO_OPT_G_DESC,
1628 .lname = "Waitee name",
1629 .type = FIO_OPT_STR_STORE,
1630 .off1 = offsetof(struct thread_options, wait_for),
1631 .help = "Name of the job this one wants to wait for before starting",
1632 .category = FIO_OPT_C_GENERAL,
1633 .group = FIO_OPT_G_DESC,
1637 .lname = "Filename(s)",
1638 .type = FIO_OPT_STR_STORE,
1639 .off1 = offsetof(struct thread_options, filename),
1640 .cb = str_filename_cb,
1641 .prio = -1, /* must come after "directory" */
1642 .help = "File(s) to use for the workload",
1643 .category = FIO_OPT_C_FILE,
1644 .group = FIO_OPT_G_FILENAME,
1647 .name = "directory",
1648 .lname = "Directory",
1649 .type = FIO_OPT_STR_STORE,
1650 .off1 = offsetof(struct thread_options, directory),
1651 .cb = str_directory_cb,
1652 .help = "Directory to store files in",
1653 .category = FIO_OPT_C_FILE,
1654 .group = FIO_OPT_G_FILENAME,
1657 .name = "filename_format",
1658 .lname = "Filename Format",
1659 .type = FIO_OPT_STR_STORE,
1660 .off1 = offsetof(struct thread_options, filename_format),
1661 .prio = -1, /* must come after "directory" */
1662 .help = "Override default $jobname.$jobnum.$filenum naming",
1663 .def = "$jobname.$jobnum.$filenum",
1664 .category = FIO_OPT_C_FILE,
1665 .group = FIO_OPT_G_FILENAME,
1668 .name = "unique_filename",
1669 .lname = "Unique Filename",
1670 .type = FIO_OPT_BOOL,
1671 .off1 = offsetof(struct thread_options, unique_filename),
1672 .help = "For network clients, prefix file with source IP",
1674 .category = FIO_OPT_C_FILE,
1675 .group = FIO_OPT_G_FILENAME,
1679 .lname = "Lockfile",
1680 .type = FIO_OPT_STR,
1681 .off1 = offsetof(struct thread_options, file_lock_mode),
1682 .help = "Lock file when doing IO to it",
1684 .parent = "filename",
1687 .category = FIO_OPT_C_FILE,
1688 .group = FIO_OPT_G_FILENAME,
1691 .oval = FILE_LOCK_NONE,
1692 .help = "No file locking",
1694 { .ival = "exclusive",
1695 .oval = FILE_LOCK_EXCLUSIVE,
1696 .help = "Exclusive file lock",
1699 .ival = "readwrite",
1700 .oval = FILE_LOCK_READWRITE,
1701 .help = "Read vs write lock",
1707 .lname = "Open directory",
1708 .type = FIO_OPT_STR_STORE,
1709 .off1 = offsetof(struct thread_options, opendir),
1710 .cb = str_opendir_cb,
1711 .help = "Recursively add files from this directory and down",
1712 .category = FIO_OPT_C_FILE,
1713 .group = FIO_OPT_G_FILENAME,
1717 .lname = "Read/write",
1718 .alias = "readwrite",
1719 .type = FIO_OPT_STR,
1721 .off1 = offsetof(struct thread_options, td_ddir),
1722 .help = "IO direction",
1724 .verify = rw_verify,
1725 .category = FIO_OPT_C_IO,
1726 .group = FIO_OPT_G_IO_BASIC,
1729 .oval = TD_DDIR_READ,
1730 .help = "Sequential read",
1733 .oval = TD_DDIR_WRITE,
1734 .help = "Sequential write",
1737 .oval = TD_DDIR_TRIM,
1738 .help = "Sequential trim",
1740 { .ival = "randread",
1741 .oval = TD_DDIR_RANDREAD,
1742 .help = "Random read",
1744 { .ival = "randwrite",
1745 .oval = TD_DDIR_RANDWRITE,
1746 .help = "Random write",
1748 { .ival = "randtrim",
1749 .oval = TD_DDIR_RANDTRIM,
1750 .help = "Random trim",
1754 .help = "Sequential read and write mix",
1756 { .ival = "readwrite",
1758 .help = "Sequential read and write mix",
1761 .oval = TD_DDIR_RANDRW,
1762 .help = "Random read and write mix"
1764 { .ival = "trimwrite",
1765 .oval = TD_DDIR_TRIMWRITE,
1766 .help = "Trim and write mix, trims preceding writes"
1771 .name = "rw_sequencer",
1772 .lname = "RW Sequencer",
1773 .type = FIO_OPT_STR,
1774 .off1 = offsetof(struct thread_options, rw_seq),
1775 .help = "IO offset generator modifier",
1776 .def = "sequential",
1777 .category = FIO_OPT_C_IO,
1778 .group = FIO_OPT_G_IO_BASIC,
1780 { .ival = "sequential",
1782 .help = "Generate sequential offsets",
1784 { .ival = "identical",
1785 .oval = RW_SEQ_IDENT,
1786 .help = "Generate identical offsets",
1793 .lname = "IO Engine",
1794 .type = FIO_OPT_STR_STORE,
1795 .off1 = offsetof(struct thread_options, ioengine),
1796 .help = "IO engine to use",
1797 .def = FIO_PREFERRED_ENGINE,
1798 .category = FIO_OPT_C_IO,
1799 .group = FIO_OPT_G_IO_BASIC,
1802 .help = "Use read/write",
1805 .help = "Use pread/pwrite",
1808 .help = "Use readv/writev",
1810 #ifdef CONFIG_PWRITEV
1812 .help = "Use preadv/pwritev",
1815 #ifdef FIO_HAVE_PWRITEV2
1816 { .ival = "pvsync2",
1817 .help = "Use preadv2/pwritev2",
1820 #ifdef CONFIG_LIBAIO
1822 .help = "Linux native asynchronous IO",
1825 #ifdef ARCH_HAVE_IOURING
1826 { .ival = "io_uring",
1827 .help = "Fast Linux native aio",
1830 #ifdef CONFIG_POSIXAIO
1831 { .ival = "posixaio",
1832 .help = "POSIX asynchronous IO",
1835 #ifdef CONFIG_SOLARISAIO
1836 { .ival = "solarisaio",
1837 .help = "Solaris native asynchronous IO",
1840 #ifdef CONFIG_WINDOWSAIO
1841 { .ival = "windowsaio",
1842 .help = "Windows native asynchronous IO"
1847 .help = "Rados Block Device asynchronous IO"
1851 .help = "Memory mapped IO"
1853 #ifdef CONFIG_LINUX_SPLICE
1855 .help = "splice/vmsplice based IO",
1857 { .ival = "netsplice",
1858 .help = "splice/vmsplice to/from the network",
1861 #ifdef FIO_HAVE_SGIO
1863 .help = "SCSI generic v3 IO",
1867 .help = "Testing engine (no data transfer)",
1870 .help = "Network IO",
1873 .help = "CPU cycle burner engine",
1877 .help = "RDMA IO engine",
1880 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1881 { .ival = "e4defrag",
1882 .help = "ext4 defrag engine",
1885 #ifdef CONFIG_LINUX_FALLOCATE
1887 .help = "fallocate() file based engine",
1892 .help = "Glusterfs libgfapi(sync) based engine"
1894 { .ival = "gfapi_async",
1895 .help = "Glusterfs libgfapi(async) based engine"
1898 #ifdef CONFIG_LIBHDFS
1899 { .ival = "libhdfs",
1900 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1903 #ifdef CONFIG_PMEMBLK
1904 { .ival = "pmemblk",
1905 .help = "PMDK libpmemblk based IO engine",
1910 { .ival = "ime_psync",
1911 .help = "DDN's IME synchronous IO engine",
1913 { .ival = "ime_psyncv",
1914 .help = "DDN's IME synchronous IO engine using iovecs",
1916 { .ival = "ime_aio",
1917 .help = "DDN's IME asynchronous IO engine",
1920 #ifdef CONFIG_LINUX_DEVDAX
1921 { .ival = "dev-dax",
1922 .help = "DAX Device based IO engine",
1926 .ival = "filecreate",
1927 .help = "File creation engine",
1929 { .ival = "external",
1930 .help = "Load external engine (append name)",
1931 .cb = str_ioengine_external_cb,
1933 #ifdef CONFIG_LIBPMEM
1934 { .ival = "libpmem",
1935 .help = "PMDK libpmem based IO engine",
1940 .help = "HTTP (WebDAV/S3) IO engine",
1944 .help = "Network Block Device (NBD) IO engine"
1950 .lname = "IO Depth",
1951 .type = FIO_OPT_INT,
1952 .off1 = offsetof(struct thread_options, iodepth),
1953 .help = "Number of IO buffers to keep in flight",
1957 .category = FIO_OPT_C_IO,
1958 .group = FIO_OPT_G_IO_BASIC,
1961 .name = "iodepth_batch",
1962 .lname = "IO Depth batch",
1963 .alias = "iodepth_batch_submit",
1964 .type = FIO_OPT_INT,
1965 .off1 = offsetof(struct thread_options, iodepth_batch),
1966 .help = "Number of IO buffers to submit in one go",
1967 .parent = "iodepth",
1971 .category = FIO_OPT_C_IO,
1972 .group = FIO_OPT_G_IO_BASIC,
1975 .name = "iodepth_batch_complete_min",
1976 .lname = "Min IO depth batch complete",
1977 .alias = "iodepth_batch_complete",
1978 .type = FIO_OPT_INT,
1979 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
1980 .help = "Min number of IO buffers to retrieve in one go",
1981 .parent = "iodepth",
1986 .category = FIO_OPT_C_IO,
1987 .group = FIO_OPT_G_IO_BASIC,
1990 .name = "iodepth_batch_complete_max",
1991 .lname = "Max IO depth batch complete",
1992 .type = FIO_OPT_INT,
1993 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
1994 .help = "Max number of IO buffers to retrieve in one go",
1995 .parent = "iodepth",
1999 .category = FIO_OPT_C_IO,
2000 .group = FIO_OPT_G_IO_BASIC,
2003 .name = "iodepth_low",
2004 .lname = "IO Depth batch low",
2005 .type = FIO_OPT_INT,
2006 .off1 = offsetof(struct thread_options, iodepth_low),
2007 .help = "Low water mark for queuing depth",
2008 .parent = "iodepth",
2011 .category = FIO_OPT_C_IO,
2012 .group = FIO_OPT_G_IO_BASIC,
2015 .name = "serialize_overlap",
2016 .lname = "Serialize overlap",
2017 .off1 = offsetof(struct thread_options, serialize_overlap),
2018 .type = FIO_OPT_BOOL,
2019 .help = "Wait for in-flight IOs that collide to complete",
2020 .parent = "iodepth",
2022 .category = FIO_OPT_C_IO,
2023 .group = FIO_OPT_G_IO_BASIC,
2026 .name = "io_submit_mode",
2027 .lname = "IO submit mode",
2028 .type = FIO_OPT_STR,
2029 .off1 = offsetof(struct thread_options, io_submit_mode),
2030 .help = "How IO submissions and completions are done",
2032 .category = FIO_OPT_C_IO,
2033 .group = FIO_OPT_G_IO_BASIC,
2036 .oval = IO_MODE_INLINE,
2037 .help = "Submit and complete IO inline",
2039 { .ival = "offload",
2040 .oval = IO_MODE_OFFLOAD,
2041 .help = "Offload submit and complete to threads",
2048 .type = FIO_OPT_STR_VAL,
2050 .off1 = offsetof(struct thread_options, size),
2051 .help = "Total size of device or files",
2052 .interval = 1024 * 1024,
2053 .category = FIO_OPT_C_IO,
2054 .group = FIO_OPT_G_INVALID,
2058 .alias = "io_limit",
2060 .type = FIO_OPT_STR_VAL,
2061 .cb = str_io_size_cb,
2062 .off1 = offsetof(struct thread_options, io_size),
2063 .help = "Total size of I/O to be performed",
2064 .interval = 1024 * 1024,
2065 .category = FIO_OPT_C_IO,
2066 .group = FIO_OPT_G_INVALID,
2069 .name = "fill_device",
2070 .lname = "Fill device",
2072 .type = FIO_OPT_BOOL,
2073 .off1 = offsetof(struct thread_options, fill_device),
2074 .help = "Write until an ENOSPC error occurs",
2076 .category = FIO_OPT_C_FILE,
2077 .group = FIO_OPT_G_INVALID,
2081 .lname = "File size",
2082 .type = FIO_OPT_STR_VAL,
2083 .off1 = offsetof(struct thread_options, file_size_low),
2084 .off2 = offsetof(struct thread_options, file_size_high),
2086 .help = "Size of individual files",
2087 .interval = 1024 * 1024,
2088 .category = FIO_OPT_C_FILE,
2089 .group = FIO_OPT_G_INVALID,
2092 .name = "file_append",
2093 .lname = "File append",
2094 .type = FIO_OPT_BOOL,
2095 .off1 = offsetof(struct thread_options, file_append),
2096 .help = "IO will start at the end of the file(s)",
2098 .category = FIO_OPT_C_FILE,
2099 .group = FIO_OPT_G_INVALID,
2103 .lname = "IO offset",
2104 .alias = "fileoffset",
2105 .type = FIO_OPT_STR_VAL,
2106 .cb = str_offset_cb,
2107 .off1 = offsetof(struct thread_options, start_offset),
2108 .help = "Start IO from this offset",
2110 .interval = 1024 * 1024,
2111 .category = FIO_OPT_C_IO,
2112 .group = FIO_OPT_G_INVALID,
2115 .name = "offset_align",
2116 .lname = "IO offset alignment",
2117 .type = FIO_OPT_INT,
2118 .off1 = offsetof(struct thread_options, start_offset_align),
2119 .help = "Start IO from this offset alignment",
2122 .category = FIO_OPT_C_IO,
2123 .group = FIO_OPT_G_INVALID,
2126 .name = "offset_increment",
2127 .lname = "IO offset increment",
2128 .type = FIO_OPT_STR_VAL,
2129 .cb = str_offset_increment_cb,
2130 .off1 = offsetof(struct thread_options, offset_increment),
2131 .help = "What is the increment from one offset to the next",
2135 .interval = 1024 * 1024,
2136 .category = FIO_OPT_C_IO,
2137 .group = FIO_OPT_G_INVALID,
2140 .name = "number_ios",
2141 .lname = "Number of IOs to perform",
2142 .type = FIO_OPT_STR_VAL,
2143 .off1 = offsetof(struct thread_options, number_ios),
2144 .help = "Force job completion after this number of IOs",
2146 .category = FIO_OPT_C_IO,
2147 .group = FIO_OPT_G_INVALID,
2151 .lname = "Block size",
2152 .alias = "blocksize",
2153 .type = FIO_OPT_ULL,
2154 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2155 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2156 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2158 .help = "Block size unit",
2163 .category = FIO_OPT_C_IO,
2164 .group = FIO_OPT_G_INVALID,
2168 .lname = "Block size align",
2169 .alias = "blockalign",
2170 .type = FIO_OPT_ULL,
2171 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2172 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2173 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2175 .help = "IO block offset alignment",
2179 .category = FIO_OPT_C_IO,
2180 .group = FIO_OPT_G_INVALID,
2184 .lname = "Block size range",
2185 .alias = "blocksize_range",
2186 .type = FIO_OPT_RANGE,
2187 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2188 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2189 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2190 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2191 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2192 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2194 .help = "Set block size range (in more detail than bs)",
2198 .category = FIO_OPT_C_IO,
2199 .group = FIO_OPT_G_INVALID,
2203 .lname = "Block size split",
2204 .type = FIO_OPT_STR_ULL,
2205 .cb = str_bssplit_cb,
2206 .off1 = offsetof(struct thread_options, bssplit),
2207 .help = "Set a specific mix of block sizes",
2210 .category = FIO_OPT_C_IO,
2211 .group = FIO_OPT_G_INVALID,
2214 .name = "bs_unaligned",
2215 .lname = "Block size unaligned",
2216 .alias = "blocksize_unaligned",
2217 .type = FIO_OPT_STR_SET,
2218 .off1 = offsetof(struct thread_options, bs_unaligned),
2219 .help = "Don't sector align IO buffer sizes",
2222 .category = FIO_OPT_C_IO,
2223 .group = FIO_OPT_G_INVALID,
2226 .name = "bs_is_seq_rand",
2227 .lname = "Block size division is seq/random (not read/write)",
2228 .type = FIO_OPT_BOOL,
2229 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2230 .help = "Consider any blocksize setting to be sequential,random",
2232 .parent = "blocksize",
2233 .category = FIO_OPT_C_IO,
2234 .group = FIO_OPT_G_INVALID,
2237 .name = "randrepeat",
2238 .lname = "Random repeatable",
2239 .type = FIO_OPT_BOOL,
2240 .off1 = offsetof(struct thread_options, rand_repeatable),
2241 .help = "Use repeatable random IO pattern",
2245 .category = FIO_OPT_C_IO,
2246 .group = FIO_OPT_G_RANDOM,
2250 .lname = "The random generator seed",
2251 .type = FIO_OPT_STR_VAL,
2252 .off1 = offsetof(struct thread_options, rand_seed),
2253 .help = "Set the random generator seed value",
2256 .category = FIO_OPT_C_IO,
2257 .group = FIO_OPT_G_RANDOM,
2260 .name = "norandommap",
2261 .lname = "No randommap",
2262 .type = FIO_OPT_STR_SET,
2263 .off1 = offsetof(struct thread_options, norandommap),
2264 .help = "Accept potential duplicate random blocks",
2268 .category = FIO_OPT_C_IO,
2269 .group = FIO_OPT_G_RANDOM,
2272 .name = "softrandommap",
2273 .lname = "Soft randommap",
2274 .type = FIO_OPT_BOOL,
2275 .off1 = offsetof(struct thread_options, softrandommap),
2276 .help = "Set norandommap if randommap allocation fails",
2277 .parent = "norandommap",
2280 .category = FIO_OPT_C_IO,
2281 .group = FIO_OPT_G_RANDOM,
2284 .name = "random_generator",
2285 .lname = "Random Generator",
2286 .type = FIO_OPT_STR,
2287 .off1 = offsetof(struct thread_options, random_generator),
2288 .help = "Type of random number generator to use",
2289 .def = "tausworthe",
2291 { .ival = "tausworthe",
2292 .oval = FIO_RAND_GEN_TAUSWORTHE,
2293 .help = "Strong Tausworthe generator",
2296 .oval = FIO_RAND_GEN_LFSR,
2297 .help = "Variable length LFSR",
2300 .ival = "tausworthe64",
2301 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2302 .help = "64-bit Tausworthe variant",
2305 .category = FIO_OPT_C_IO,
2306 .group = FIO_OPT_G_RANDOM,
2309 .name = "random_distribution",
2310 .lname = "Random Distribution",
2311 .type = FIO_OPT_STR,
2312 .off1 = offsetof(struct thread_options, random_distribution),
2313 .cb = str_random_distribution_cb,
2314 .help = "Random offset distribution generator",
2318 .oval = FIO_RAND_DIST_RANDOM,
2319 .help = "Completely random",
2322 .oval = FIO_RAND_DIST_ZIPF,
2323 .help = "Zipf distribution",
2326 .oval = FIO_RAND_DIST_PARETO,
2327 .help = "Pareto distribution",
2330 .oval = FIO_RAND_DIST_GAUSS,
2331 .help = "Normal (Gaussian) distribution",
2334 .oval = FIO_RAND_DIST_ZONED,
2335 .help = "Zoned random distribution",
2337 { .ival = "zoned_abs",
2338 .oval = FIO_RAND_DIST_ZONED_ABS,
2339 .help = "Zoned absolute random distribution",
2342 .category = FIO_OPT_C_IO,
2343 .group = FIO_OPT_G_RANDOM,
2346 .name = "percentage_random",
2347 .lname = "Percentage Random",
2348 .type = FIO_OPT_INT,
2349 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2350 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2351 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2353 .help = "Percentage of seq/random mix that should be random",
2354 .def = "100,100,100",
2356 .inverse = "percentage_sequential",
2357 .category = FIO_OPT_C_IO,
2358 .group = FIO_OPT_G_RANDOM,
2361 .name = "percentage_sequential",
2362 .lname = "Percentage Sequential",
2363 .type = FIO_OPT_DEPRECATED,
2364 .category = FIO_OPT_C_IO,
2365 .group = FIO_OPT_G_RANDOM,
2368 .name = "allrandrepeat",
2369 .lname = "All Random Repeat",
2370 .type = FIO_OPT_BOOL,
2371 .off1 = offsetof(struct thread_options, allrand_repeatable),
2372 .help = "Use repeatable random numbers for everything",
2374 .category = FIO_OPT_C_IO,
2375 .group = FIO_OPT_G_RANDOM,
2379 .lname = "Number of files",
2380 .alias = "nr_files",
2381 .type = FIO_OPT_INT,
2382 .off1 = offsetof(struct thread_options, nr_files),
2383 .help = "Split job workload between this number of files",
2386 .category = FIO_OPT_C_FILE,
2387 .group = FIO_OPT_G_INVALID,
2390 .name = "openfiles",
2391 .lname = "Number of open files",
2392 .type = FIO_OPT_INT,
2393 .off1 = offsetof(struct thread_options, open_files),
2394 .help = "Number of files to keep open at the same time",
2395 .category = FIO_OPT_C_FILE,
2396 .group = FIO_OPT_G_INVALID,
2399 .name = "file_service_type",
2400 .lname = "File service type",
2401 .type = FIO_OPT_STR,
2403 .off1 = offsetof(struct thread_options, file_service_type),
2404 .help = "How to select which file to service next",
2405 .def = "roundrobin",
2406 .category = FIO_OPT_C_FILE,
2407 .group = FIO_OPT_G_INVALID,
2410 .oval = FIO_FSERVICE_RANDOM,
2411 .help = "Choose a file at random (uniform)",
2414 .oval = FIO_FSERVICE_ZIPF,
2415 .help = "Zipf randomized",
2418 .oval = FIO_FSERVICE_PARETO,
2419 .help = "Pareto randomized",
2422 .oval = FIO_FSERVICE_GAUSS,
2423 .help = "Normal (Gaussian) randomized",
2426 .oval = FIO_FSERVICE_GAUSS,
2427 .help = "Alias for normal",
2429 { .ival = "roundrobin",
2430 .oval = FIO_FSERVICE_RR,
2431 .help = "Round robin select files",
2433 { .ival = "sequential",
2434 .oval = FIO_FSERVICE_SEQ,
2435 .help = "Finish one file before moving to the next",
2438 .parent = "nrfiles",
2442 .name = "fallocate",
2443 .lname = "Fallocate",
2444 .type = FIO_OPT_STR,
2445 .off1 = offsetof(struct thread_options, fallocate_mode),
2446 .help = "Whether pre-allocation is performed when laying out files",
2447 #ifdef FIO_HAVE_DEFAULT_FALLOCATE
2452 .category = FIO_OPT_C_FILE,
2453 .group = FIO_OPT_G_INVALID,
2456 .oval = FIO_FALLOCATE_NONE,
2457 .help = "Do not pre-allocate space",
2460 .oval = FIO_FALLOCATE_NATIVE,
2461 .help = "Use native pre-allocation if possible",
2463 #ifdef CONFIG_POSIX_FALLOCATE
2465 .oval = FIO_FALLOCATE_POSIX,
2466 .help = "Use posix_fallocate()",
2469 #ifdef CONFIG_LINUX_FALLOCATE
2471 .oval = FIO_FALLOCATE_KEEP_SIZE,
2472 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2475 { .ival = "truncate",
2476 .oval = FIO_FALLOCATE_TRUNCATE,
2477 .help = "Truncate file to final size instead of allocating"
2479 /* Compatibility with former boolean values */
2481 .oval = FIO_FALLOCATE_NONE,
2482 .help = "Alias for 'none'",
2484 #ifdef CONFIG_POSIX_FALLOCATE
2486 .oval = FIO_FALLOCATE_POSIX,
2487 .help = "Alias for 'posix'",
2493 .name = "fadvise_hint",
2494 .lname = "Fadvise hint",
2495 .type = FIO_OPT_STR,
2496 .off1 = offsetof(struct thread_options, fadvise_hint),
2500 .help = "Don't issue fadvise/madvise",
2504 .help = "Advise using fio IO pattern",
2507 .oval = F_ADV_RANDOM,
2508 .help = "Advise using FADV_RANDOM",
2510 { .ival = "sequential",
2511 .oval = F_ADV_SEQUENTIAL,
2512 .help = "Advise using FADV_SEQUENTIAL",
2515 .help = "Use fadvise() to advise the kernel on IO pattern",
2517 .category = FIO_OPT_C_FILE,
2518 .group = FIO_OPT_G_INVALID,
2523 .type = FIO_OPT_INT,
2524 .off1 = offsetof(struct thread_options, fsync_blocks),
2525 .help = "Issue fsync for writes every given number of blocks",
2528 .category = FIO_OPT_C_FILE,
2529 .group = FIO_OPT_G_INVALID,
2532 .name = "fdatasync",
2533 .lname = "Fdatasync",
2534 .type = FIO_OPT_INT,
2535 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2536 .help = "Issue fdatasync for writes every given number of blocks",
2539 .category = FIO_OPT_C_FILE,
2540 .group = FIO_OPT_G_INVALID,
2543 .name = "write_barrier",
2544 .lname = "Write barrier",
2545 .type = FIO_OPT_INT,
2546 .off1 = offsetof(struct thread_options, barrier_blocks),
2547 .help = "Make every Nth write a barrier write",
2550 .category = FIO_OPT_C_IO,
2551 .group = FIO_OPT_G_INVALID,
2553 #ifdef CONFIG_SYNC_FILE_RANGE
2555 .name = "sync_file_range",
2556 .lname = "Sync file range",
2558 { .ival = "wait_before",
2559 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2560 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2564 .oval = SYNC_FILE_RANGE_WRITE,
2565 .help = "SYNC_FILE_RANGE_WRITE",
2569 .ival = "wait_after",
2570 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2571 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2575 .type = FIO_OPT_STR_MULTI,
2577 .off1 = offsetof(struct thread_options, sync_file_range),
2578 .help = "Use sync_file_range()",
2579 .category = FIO_OPT_C_FILE,
2580 .group = FIO_OPT_G_INVALID,
2584 .name = "sync_file_range",
2585 .lname = "Sync file range",
2586 .type = FIO_OPT_UNSUPPORTED,
2587 .help = "Your platform does not support sync_file_range",
2592 .lname = "Direct I/O",
2593 .type = FIO_OPT_BOOL,
2594 .off1 = offsetof(struct thread_options, odirect),
2595 .help = "Use O_DIRECT IO (negates buffered)",
2597 .inverse = "buffered",
2598 .category = FIO_OPT_C_IO,
2599 .group = FIO_OPT_G_IO_TYPE,
2603 .lname = "Atomic I/O",
2604 .type = FIO_OPT_BOOL,
2605 .off1 = offsetof(struct thread_options, oatomic),
2606 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2608 .category = FIO_OPT_C_IO,
2609 .group = FIO_OPT_G_IO_TYPE,
2613 .lname = "Buffered I/O",
2614 .type = FIO_OPT_BOOL,
2615 .off1 = offsetof(struct thread_options, odirect),
2617 .help = "Use buffered IO (negates direct)",
2619 .inverse = "direct",
2620 .category = FIO_OPT_C_IO,
2621 .group = FIO_OPT_G_IO_TYPE,
2624 .name = "overwrite",
2625 .lname = "Overwrite",
2626 .type = FIO_OPT_BOOL,
2627 .off1 = offsetof(struct thread_options, overwrite),
2628 .help = "When writing, set whether to overwrite current data",
2630 .category = FIO_OPT_C_FILE,
2631 .group = FIO_OPT_G_INVALID,
2636 .type = FIO_OPT_INT,
2637 .off1 = offsetof(struct thread_options, loops),
2638 .help = "Number of times to run the job",
2641 .category = FIO_OPT_C_GENERAL,
2642 .group = FIO_OPT_G_RUNTIME,
2646 .lname = "Number of jobs",
2647 .type = FIO_OPT_INT,
2648 .off1 = offsetof(struct thread_options, numjobs),
2649 .help = "Duplicate this job this many times",
2652 .category = FIO_OPT_C_GENERAL,
2653 .group = FIO_OPT_G_RUNTIME,
2656 .name = "startdelay",
2657 .lname = "Start delay",
2658 .type = FIO_OPT_STR_VAL_TIME,
2659 .off1 = offsetof(struct thread_options, start_delay),
2660 .off2 = offsetof(struct thread_options, start_delay_high),
2661 .help = "Only start job when this period has passed",
2665 .category = FIO_OPT_C_GENERAL,
2666 .group = FIO_OPT_G_RUNTIME,
2672 .type = FIO_OPT_STR_VAL_TIME,
2673 .off1 = offsetof(struct thread_options, timeout),
2674 .help = "Stop workload when this amount of time has passed",
2678 .category = FIO_OPT_C_GENERAL,
2679 .group = FIO_OPT_G_RUNTIME,
2682 .name = "time_based",
2683 .lname = "Time based",
2684 .type = FIO_OPT_STR_SET,
2685 .off1 = offsetof(struct thread_options, time_based),
2686 .help = "Keep running until runtime/timeout is met",
2687 .category = FIO_OPT_C_GENERAL,
2688 .group = FIO_OPT_G_RUNTIME,
2691 .name = "verify_only",
2692 .lname = "Verify only",
2693 .type = FIO_OPT_STR_SET,
2694 .off1 = offsetof(struct thread_options, verify_only),
2695 .help = "Verifies previously written data is still valid",
2696 .category = FIO_OPT_C_GENERAL,
2697 .group = FIO_OPT_G_RUNTIME,
2700 .name = "ramp_time",
2701 .lname = "Ramp time",
2702 .type = FIO_OPT_STR_VAL_TIME,
2703 .off1 = offsetof(struct thread_options, ramp_time),
2704 .help = "Ramp up time before measuring performance",
2707 .category = FIO_OPT_C_GENERAL,
2708 .group = FIO_OPT_G_RUNTIME,
2711 .name = "clocksource",
2712 .lname = "Clock source",
2713 .type = FIO_OPT_STR,
2714 .cb = fio_clock_source_cb,
2715 .off1 = offsetof(struct thread_options, clocksource),
2716 .help = "What type of timing source to use",
2717 .category = FIO_OPT_C_GENERAL,
2718 .group = FIO_OPT_G_CLOCK,
2720 #ifdef CONFIG_GETTIMEOFDAY
2721 { .ival = "gettimeofday",
2723 .help = "Use gettimeofday(2) for timing",
2726 #ifdef CONFIG_CLOCK_GETTIME
2727 { .ival = "clock_gettime",
2728 .oval = CS_CGETTIME,
2729 .help = "Use clock_gettime(2) for timing",
2732 #ifdef ARCH_HAVE_CPU_CLOCK
2734 .oval = CS_CPUCLOCK,
2735 .help = "Use CPU private clock",
2743 .lname = "I/O Memory",
2744 .type = FIO_OPT_STR,
2746 .off1 = offsetof(struct thread_options, mem_type),
2747 .help = "Backing type for IO buffers",
2749 .category = FIO_OPT_C_IO,
2750 .group = FIO_OPT_G_INVALID,
2754 .help = "Use malloc(3) for IO buffers",
2756 #ifndef CONFIG_NO_SHM
2759 .help = "Use shared memory segments for IO buffers",
2761 #ifdef FIO_HAVE_HUGETLB
2762 { .ival = "shmhuge",
2763 .oval = MEM_SHMHUGE,
2764 .help = "Like shm, but use huge pages",
2770 .help = "Use mmap(2) (file or anon) for IO buffers",
2772 { .ival = "mmapshared",
2773 .oval = MEM_MMAPSHARED,
2774 .help = "Like mmap, but use the shared flag",
2776 #ifdef FIO_HAVE_HUGETLB
2777 { .ival = "mmaphuge",
2778 .oval = MEM_MMAPHUGE,
2779 .help = "Like mmap, but use huge pages",
2783 { .ival = "cudamalloc",
2784 .oval = MEM_CUDA_MALLOC,
2785 .help = "Allocate GPU device memory for GPUDirect RDMA",
2791 .name = "iomem_align",
2792 .alias = "mem_align",
2793 .lname = "I/O memory alignment",
2794 .type = FIO_OPT_INT,
2795 .off1 = offsetof(struct thread_options, mem_align),
2797 .help = "IO memory buffer offset alignment",
2801 .category = FIO_OPT_C_IO,
2802 .group = FIO_OPT_G_INVALID,
2807 .type = FIO_OPT_STR,
2808 .off1 = offsetof(struct thread_options, verify),
2809 .help = "Verify data written",
2811 .category = FIO_OPT_C_IO,
2812 .group = FIO_OPT_G_VERIFY,
2815 .oval = VERIFY_NONE,
2816 .help = "Don't do IO verification",
2820 .help = "Use md5 checksums for verification",
2823 .oval = VERIFY_CRC64,
2824 .help = "Use crc64 checksums for verification",
2827 .oval = VERIFY_CRC32,
2828 .help = "Use crc32 checksums for verification",
2830 { .ival = "crc32c-intel",
2831 .oval = VERIFY_CRC32C,
2832 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2835 .oval = VERIFY_CRC32C,
2836 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2839 .oval = VERIFY_CRC16,
2840 .help = "Use crc16 checksums for verification",
2843 .oval = VERIFY_CRC7,
2844 .help = "Use crc7 checksums for verification",
2847 .oval = VERIFY_SHA1,
2848 .help = "Use sha1 checksums for verification",
2851 .oval = VERIFY_SHA256,
2852 .help = "Use sha256 checksums for verification",
2855 .oval = VERIFY_SHA512,
2856 .help = "Use sha512 checksums for verification",
2858 { .ival = "sha3-224",
2859 .oval = VERIFY_SHA3_224,
2860 .help = "Use sha3-224 checksums for verification",
2862 { .ival = "sha3-256",
2863 .oval = VERIFY_SHA3_256,
2864 .help = "Use sha3-256 checksums for verification",
2866 { .ival = "sha3-384",
2867 .oval = VERIFY_SHA3_384,
2868 .help = "Use sha3-384 checksums for verification",
2870 { .ival = "sha3-512",
2871 .oval = VERIFY_SHA3_512,
2872 .help = "Use sha3-512 checksums for verification",
2875 .oval = VERIFY_XXHASH,
2876 .help = "Use xxhash checksums for verification",
2878 /* Meta information was included into verify_header,
2879 * 'meta' verification is implied by default. */
2881 .oval = VERIFY_HDR_ONLY,
2882 .help = "Use io information for verification. "
2883 "Now is implied by default, thus option is obsolete, "
2886 { .ival = "pattern",
2887 .oval = VERIFY_PATTERN_NO_HDR,
2888 .help = "Verify strict pattern",
2892 .oval = VERIFY_NULL,
2893 .help = "Pretend to verify",
2898 .name = "do_verify",
2899 .lname = "Perform verify step",
2900 .type = FIO_OPT_BOOL,
2901 .off1 = offsetof(struct thread_options, do_verify),
2902 .help = "Run verification stage after write",
2906 .category = FIO_OPT_C_IO,
2907 .group = FIO_OPT_G_VERIFY,
2910 .name = "verifysort",
2911 .lname = "Verify sort",
2912 .type = FIO_OPT_SOFT_DEPRECATED,
2913 .category = FIO_OPT_C_IO,
2914 .group = FIO_OPT_G_VERIFY,
2917 .name = "verifysort_nr",
2918 .lname = "Verify Sort Nr",
2919 .type = FIO_OPT_SOFT_DEPRECATED,
2920 .category = FIO_OPT_C_IO,
2921 .group = FIO_OPT_G_VERIFY,
2924 .name = "verify_interval",
2925 .lname = "Verify interval",
2926 .type = FIO_OPT_INT,
2927 .off1 = offsetof(struct thread_options, verify_interval),
2928 .minval = 2 * sizeof(struct verify_header),
2929 .help = "Store verify buffer header every N bytes",
2932 .interval = 2 * sizeof(struct verify_header),
2933 .category = FIO_OPT_C_IO,
2934 .group = FIO_OPT_G_VERIFY,
2937 .name = "verify_offset",
2938 .lname = "Verify offset",
2939 .type = FIO_OPT_INT,
2940 .help = "Offset verify header location by N bytes",
2941 .off1 = offsetof(struct thread_options, verify_offset),
2942 .minval = sizeof(struct verify_header),
2945 .category = FIO_OPT_C_IO,
2946 .group = FIO_OPT_G_VERIFY,
2949 .name = "verify_pattern",
2950 .lname = "Verify pattern",
2951 .type = FIO_OPT_STR,
2952 .cb = str_verify_pattern_cb,
2953 .off1 = offsetof(struct thread_options, verify_pattern),
2954 .help = "Fill pattern for IO buffers",
2957 .category = FIO_OPT_C_IO,
2958 .group = FIO_OPT_G_VERIFY,
2961 .name = "verify_fatal",
2962 .lname = "Verify fatal",
2963 .type = FIO_OPT_BOOL,
2964 .off1 = offsetof(struct thread_options, verify_fatal),
2966 .help = "Exit on a single verify failure, don't continue",
2969 .category = FIO_OPT_C_IO,
2970 .group = FIO_OPT_G_VERIFY,
2973 .name = "verify_dump",
2974 .lname = "Verify dump",
2975 .type = FIO_OPT_BOOL,
2976 .off1 = offsetof(struct thread_options, verify_dump),
2978 .help = "Dump contents of good and bad blocks on failure",
2981 .category = FIO_OPT_C_IO,
2982 .group = FIO_OPT_G_VERIFY,
2985 .name = "verify_async",
2986 .lname = "Verify asynchronously",
2987 .type = FIO_OPT_INT,
2988 .off1 = offsetof(struct thread_options, verify_async),
2990 .help = "Number of async verifier threads to use",
2993 .category = FIO_OPT_C_IO,
2994 .group = FIO_OPT_G_VERIFY,
2997 .name = "verify_backlog",
2998 .lname = "Verify backlog",
2999 .type = FIO_OPT_STR_VAL,
3000 .off1 = offsetof(struct thread_options, verify_backlog),
3001 .help = "Verify after this number of blocks are written",
3004 .category = FIO_OPT_C_IO,
3005 .group = FIO_OPT_G_VERIFY,
3008 .name = "verify_backlog_batch",
3009 .lname = "Verify backlog batch",
3010 .type = FIO_OPT_INT,
3011 .off1 = offsetof(struct thread_options, verify_batch),
3012 .help = "Verify this number of IO blocks",
3015 .category = FIO_OPT_C_IO,
3016 .group = FIO_OPT_G_VERIFY,
3018 #ifdef FIO_HAVE_CPU_AFFINITY
3020 .name = "verify_async_cpus",
3021 .lname = "Async verify CPUs",
3022 .type = FIO_OPT_STR,
3023 .cb = str_verify_cpus_allowed_cb,
3024 .off1 = offsetof(struct thread_options, verify_cpumask),
3025 .help = "Set CPUs allowed for async verify threads",
3026 .parent = "verify_async",
3028 .category = FIO_OPT_C_IO,
3029 .group = FIO_OPT_G_VERIFY,
3033 .name = "verify_async_cpus",
3034 .lname = "Async verify CPUs",
3035 .type = FIO_OPT_UNSUPPORTED,
3036 .help = "Your platform does not support CPU affinities",
3040 .name = "experimental_verify",
3041 .lname = "Experimental Verify",
3042 .off1 = offsetof(struct thread_options, experimental_verify),
3043 .type = FIO_OPT_BOOL,
3044 .help = "Enable experimental verification",
3046 .category = FIO_OPT_C_IO,
3047 .group = FIO_OPT_G_VERIFY,
3050 .name = "verify_state_load",
3051 .lname = "Load verify state",
3052 .off1 = offsetof(struct thread_options, verify_state),
3053 .type = FIO_OPT_BOOL,
3054 .help = "Load verify termination state",
3056 .category = FIO_OPT_C_IO,
3057 .group = FIO_OPT_G_VERIFY,
3060 .name = "verify_state_save",
3061 .lname = "Save verify state",
3062 .off1 = offsetof(struct thread_options, verify_state_save),
3063 .type = FIO_OPT_BOOL,
3065 .help = "Save verify state on termination",
3067 .category = FIO_OPT_C_IO,
3068 .group = FIO_OPT_G_VERIFY,
3070 #ifdef FIO_HAVE_TRIM
3072 .name = "trim_percentage",
3073 .lname = "Trim percentage",
3074 .type = FIO_OPT_INT,
3075 .off1 = offsetof(struct thread_options, trim_percentage),
3078 .help = "Number of verify blocks to trim (i.e., discard)",
3083 .category = FIO_OPT_C_IO,
3084 .group = FIO_OPT_G_TRIM,
3087 .name = "trim_verify_zero",
3088 .lname = "Verify trim zero",
3089 .type = FIO_OPT_BOOL,
3090 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3091 .off1 = offsetof(struct thread_options, trim_zero),
3092 .parent = "trim_percentage",
3095 .category = FIO_OPT_C_IO,
3096 .group = FIO_OPT_G_TRIM,
3099 .name = "trim_backlog",
3100 .lname = "Trim backlog",
3101 .type = FIO_OPT_STR_VAL,
3102 .off1 = offsetof(struct thread_options, trim_backlog),
3103 .help = "Trim after this number of blocks are written",
3104 .parent = "trim_percentage",
3107 .category = FIO_OPT_C_IO,
3108 .group = FIO_OPT_G_TRIM,
3111 .name = "trim_backlog_batch",
3112 .lname = "Trim backlog batch",
3113 .type = FIO_OPT_INT,
3114 .off1 = offsetof(struct thread_options, trim_batch),
3115 .help = "Trim this number of IO blocks",
3116 .parent = "trim_percentage",
3119 .category = FIO_OPT_C_IO,
3120 .group = FIO_OPT_G_TRIM,
3124 .name = "trim_percentage",
3125 .lname = "Trim percentage",
3126 .type = FIO_OPT_UNSUPPORTED,
3127 .help = "Fio does not support TRIM on your platform",
3130 .name = "trim_verify_zero",
3131 .lname = "Verify trim zero",
3132 .type = FIO_OPT_UNSUPPORTED,
3133 .help = "Fio does not support TRIM on your platform",
3136 .name = "trim_backlog",
3137 .lname = "Trim backlog",
3138 .type = FIO_OPT_UNSUPPORTED,
3139 .help = "Fio does not support TRIM on your platform",
3142 .name = "trim_backlog_batch",
3143 .lname = "Trim backlog batch",
3144 .type = FIO_OPT_UNSUPPORTED,
3145 .help = "Fio does not support TRIM on your platform",
3149 .name = "write_iolog",
3150 .lname = "Write I/O log",
3151 .type = FIO_OPT_STR_STORE,
3152 .off1 = offsetof(struct thread_options, write_iolog_file),
3153 .help = "Store IO pattern to file",
3154 .category = FIO_OPT_C_IO,
3155 .group = FIO_OPT_G_IOLOG,
3158 .name = "read_iolog",
3159 .lname = "Read I/O log",
3160 .type = FIO_OPT_STR_STORE,
3161 .off1 = offsetof(struct thread_options, read_iolog_file),
3162 .help = "Playback IO pattern from file",
3163 .category = FIO_OPT_C_IO,
3164 .group = FIO_OPT_G_IOLOG,
3167 .name = "read_iolog_chunked",
3168 .lname = "Read I/O log in parts",
3169 .type = FIO_OPT_BOOL,
3170 .off1 = offsetof(struct thread_options, read_iolog_chunked),
3172 .parent = "read_iolog",
3173 .help = "Parse IO pattern in chunks",
3174 .category = FIO_OPT_C_IO,
3175 .group = FIO_OPT_G_IOLOG,
3178 .name = "replay_no_stall",
3179 .lname = "Don't stall on replay",
3180 .type = FIO_OPT_BOOL,
3181 .off1 = offsetof(struct thread_options, no_stall),
3183 .parent = "read_iolog",
3185 .help = "Playback IO pattern file as fast as possible without stalls",
3186 .category = FIO_OPT_C_IO,
3187 .group = FIO_OPT_G_IOLOG,
3190 .name = "replay_redirect",
3191 .lname = "Redirect device for replay",
3192 .type = FIO_OPT_STR_STORE,
3193 .off1 = offsetof(struct thread_options, replay_redirect),
3194 .parent = "read_iolog",
3196 .help = "Replay all I/O onto this device, regardless of trace device",
3197 .category = FIO_OPT_C_IO,
3198 .group = FIO_OPT_G_IOLOG,
3201 .name = "replay_scale",
3202 .lname = "Replace offset scale factor",
3203 .type = FIO_OPT_INT,
3204 .off1 = offsetof(struct thread_options, replay_scale),
3205 .parent = "read_iolog",
3207 .help = "Align offsets to this blocksize",
3208 .category = FIO_OPT_C_IO,
3209 .group = FIO_OPT_G_IOLOG,
3212 .name = "replay_align",
3213 .lname = "Replace alignment",
3214 .type = FIO_OPT_INT,
3215 .off1 = offsetof(struct thread_options, replay_align),
3216 .parent = "read_iolog",
3217 .help = "Scale offset down by this factor",
3218 .category = FIO_OPT_C_IO,
3219 .group = FIO_OPT_G_IOLOG,
3223 .name = "replay_time_scale",
3224 .lname = "Replay Time Scale",
3225 .type = FIO_OPT_INT,
3226 .off1 = offsetof(struct thread_options, replay_time_scale),
3229 .parent = "read_iolog",
3231 .help = "Scale time for replay events",
3232 .category = FIO_OPT_C_IO,
3233 .group = FIO_OPT_G_IOLOG,
3236 .name = "replay_skip",
3237 .lname = "Replay Skip",
3238 .type = FIO_OPT_STR,
3239 .cb = str_replay_skip_cb,
3240 .off1 = offsetof(struct thread_options, replay_skip),
3241 .parent = "read_iolog",
3242 .help = "Skip certain IO types (read,write,trim,flush)",
3243 .category = FIO_OPT_C_IO,
3244 .group = FIO_OPT_G_IOLOG,
3247 .name = "merge_blktrace_file",
3248 .lname = "Merged blktrace output filename",
3249 .type = FIO_OPT_STR_STORE,
3250 .off1 = offsetof(struct thread_options, merge_blktrace_file),
3251 .help = "Merged blktrace output filename",
3252 .category = FIO_OPT_C_IO,
3253 .group = FIO_OPT_G_IOLOG,
3256 .name = "merge_blktrace_scalars",
3257 .lname = "Percentage to scale each trace",
3258 .type = FIO_OPT_FLOAT_LIST,
3259 .off1 = offsetof(struct thread_options, merge_blktrace_scalars),
3260 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3261 .help = "Percentage to scale each trace",
3262 .category = FIO_OPT_C_IO,
3263 .group = FIO_OPT_G_IOLOG,
3266 .name = "merge_blktrace_iters",
3267 .lname = "Number of iterations to run per trace",
3268 .type = FIO_OPT_FLOAT_LIST,
3269 .off1 = offsetof(struct thread_options, merge_blktrace_iters),
3270 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3271 .help = "Number of iterations to run per trace",
3272 .category = FIO_OPT_C_IO,
3273 .group = FIO_OPT_G_IOLOG,
3276 .name = "exec_prerun",
3277 .lname = "Pre-execute runnable",
3278 .type = FIO_OPT_STR_STORE,
3279 .off1 = offsetof(struct thread_options, exec_prerun),
3280 .help = "Execute this file prior to running job",
3281 .category = FIO_OPT_C_GENERAL,
3282 .group = FIO_OPT_G_INVALID,
3285 .name = "exec_postrun",
3286 .lname = "Post-execute runnable",
3287 .type = FIO_OPT_STR_STORE,
3288 .off1 = offsetof(struct thread_options, exec_postrun),
3289 .help = "Execute this file after running job",
3290 .category = FIO_OPT_C_GENERAL,
3291 .group = FIO_OPT_G_INVALID,
3293 #ifdef FIO_HAVE_IOSCHED_SWITCH
3295 .name = "ioscheduler",
3296 .lname = "I/O scheduler",
3297 .type = FIO_OPT_STR_STORE,
3298 .off1 = offsetof(struct thread_options, ioscheduler),
3299 .help = "Use this IO scheduler on the backing device",
3300 .category = FIO_OPT_C_FILE,
3301 .group = FIO_OPT_G_INVALID,
3305 .name = "ioscheduler",
3306 .lname = "I/O scheduler",
3307 .type = FIO_OPT_UNSUPPORTED,
3308 .help = "Your platform does not support IO scheduler switching",
3313 .lname = "Zone mode",
3314 .help = "Mode for the zonesize, zonerange and zoneskip parameters",
3315 .type = FIO_OPT_STR,
3316 .off1 = offsetof(struct thread_options, zone_mode),
3318 .category = FIO_OPT_C_IO,
3319 .group = FIO_OPT_G_ZONE,
3322 .oval = ZONE_MODE_NONE,
3323 .help = "no zoning",
3325 { .ival = "strided",
3326 .oval = ZONE_MODE_STRIDED,
3327 .help = "strided mode - random I/O is restricted to a single zone",
3330 .oval = ZONE_MODE_ZBD,
3331 .help = "zoned block device mode - random I/O selects one of multiple zones randomly",
3337 .lname = "Zone size",
3338 .type = FIO_OPT_STR_VAL,
3339 .off1 = offsetof(struct thread_options, zone_size),
3340 .help = "Amount of data to read per zone",
3342 .interval = 1024 * 1024,
3343 .category = FIO_OPT_C_IO,
3344 .group = FIO_OPT_G_ZONE,
3347 .name = "zonecapacity",
3348 .lname = "Zone capacity",
3349 .type = FIO_OPT_STR_VAL,
3350 .off1 = offsetof(struct thread_options, zone_capacity),
3351 .help = "Capacity per zone",
3353 .interval = 1024 * 1024,
3354 .category = FIO_OPT_C_IO,
3355 .group = FIO_OPT_G_ZONE,
3358 .name = "zonerange",
3359 .lname = "Zone range",
3360 .type = FIO_OPT_STR_VAL,
3361 .off1 = offsetof(struct thread_options, zone_range),
3362 .help = "Give size of an IO zone",
3364 .interval = 1024 * 1024,
3365 .category = FIO_OPT_C_IO,
3366 .group = FIO_OPT_G_ZONE,
3370 .lname = "Zone skip",
3371 .type = FIO_OPT_STR_VAL,
3372 .off1 = offsetof(struct thread_options, zone_skip),
3373 .help = "Space between IO zones",
3375 .interval = 1024 * 1024,
3376 .category = FIO_OPT_C_IO,
3377 .group = FIO_OPT_G_ZONE,
3380 .name = "read_beyond_wp",
3381 .lname = "Allow reads beyond the zone write pointer",
3382 .type = FIO_OPT_BOOL,
3383 .off1 = offsetof(struct thread_options, read_beyond_wp),
3384 .help = "Allow reads beyond the zone write pointer",
3386 .category = FIO_OPT_C_IO,
3387 .group = FIO_OPT_G_INVALID,
3390 .name = "max_open_zones",
3391 .lname = "Per device/file maximum number of open zones",
3392 .type = FIO_OPT_INT,
3393 .off1 = offsetof(struct thread_options, max_open_zones),
3394 .maxval = ZBD_MAX_OPEN_ZONES,
3395 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd",
3397 .category = FIO_OPT_C_IO,
3398 .group = FIO_OPT_G_INVALID,
3401 .name = "job_max_open_zones",
3402 .lname = "Job maximum number of open zones",
3403 .type = FIO_OPT_INT,
3404 .off1 = offsetof(struct thread_options, job_max_open_zones),
3405 .maxval = ZBD_MAX_OPEN_ZONES,
3406 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd by one thread/process",
3408 .category = FIO_OPT_C_IO,
3409 .group = FIO_OPT_G_INVALID,
3412 .name = "zone_reset_threshold",
3413 .lname = "Zone reset threshold",
3414 .help = "Zoned block device reset threshold",
3415 .type = FIO_OPT_FLOAT_LIST,
3417 .off1 = offsetof(struct thread_options, zrt),
3420 .category = FIO_OPT_C_IO,
3421 .group = FIO_OPT_G_ZONE,
3424 .name = "zone_reset_frequency",
3425 .lname = "Zone reset frequency",
3426 .help = "Zoned block device zone reset frequency in HZ",
3427 .type = FIO_OPT_FLOAT_LIST,
3429 .off1 = offsetof(struct thread_options, zrf),
3432 .category = FIO_OPT_C_IO,
3433 .group = FIO_OPT_G_ZONE,
3437 .lname = "Lock memory",
3438 .type = FIO_OPT_STR_VAL,
3439 .off1 = offsetof(struct thread_options, lockmem),
3440 .help = "Lock down this amount of memory (per worker)",
3442 .interval = 1024 * 1024,
3443 .category = FIO_OPT_C_GENERAL,
3444 .group = FIO_OPT_G_INVALID,
3447 .name = "rwmixread",
3448 .lname = "Read/write mix read",
3449 .type = FIO_OPT_INT,
3450 .cb = str_rwmix_read_cb,
3451 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3453 .help = "Percentage of mixed workload that is reads",
3456 .inverse = "rwmixwrite",
3457 .category = FIO_OPT_C_IO,
3458 .group = FIO_OPT_G_RWMIX,
3461 .name = "rwmixwrite",
3462 .lname = "Read/write mix write",
3463 .type = FIO_OPT_INT,
3464 .cb = str_rwmix_write_cb,
3465 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3467 .help = "Percentage of mixed workload that is writes",
3470 .inverse = "rwmixread",
3471 .category = FIO_OPT_C_IO,
3472 .group = FIO_OPT_G_RWMIX,
3475 .name = "rwmixcycle",
3476 .lname = "Read/write mix cycle",
3477 .type = FIO_OPT_DEPRECATED,
3478 .category = FIO_OPT_C_IO,
3479 .group = FIO_OPT_G_RWMIX,
3484 .type = FIO_OPT_INT,
3485 .off1 = offsetof(struct thread_options, nice),
3486 .help = "Set job CPU nice value",
3491 .category = FIO_OPT_C_GENERAL,
3492 .group = FIO_OPT_G_CRED,
3494 #ifdef FIO_HAVE_IOPRIO
3497 .lname = "I/O nice priority",
3498 .type = FIO_OPT_INT,
3499 .off1 = offsetof(struct thread_options, ioprio),
3500 .help = "Set job IO priority value",
3501 .minval = IOPRIO_MIN_PRIO,
3502 .maxval = IOPRIO_MAX_PRIO,
3504 .category = FIO_OPT_C_GENERAL,
3505 .group = FIO_OPT_G_CRED,
3510 .lname = "I/O nice priority",
3511 .type = FIO_OPT_UNSUPPORTED,
3512 .help = "Your platform does not support IO priorities",
3515 #ifdef FIO_HAVE_IOPRIO_CLASS
3516 #ifndef FIO_HAVE_IOPRIO
3517 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3520 .name = "prioclass",
3521 .lname = "I/O nice priority class",
3522 .type = FIO_OPT_INT,
3523 .off1 = offsetof(struct thread_options, ioprio_class),
3524 .help = "Set job IO priority class",
3525 .minval = IOPRIO_MIN_PRIO_CLASS,
3526 .maxval = IOPRIO_MAX_PRIO_CLASS,
3528 .category = FIO_OPT_C_GENERAL,
3529 .group = FIO_OPT_G_CRED,
3533 .name = "prioclass",
3534 .lname = "I/O nice priority class",
3535 .type = FIO_OPT_UNSUPPORTED,
3536 .help = "Your platform does not support IO priority classes",
3540 .name = "thinktime",
3541 .lname = "Thinktime",
3542 .type = FIO_OPT_INT,
3543 .off1 = offsetof(struct thread_options, thinktime),
3544 .help = "Idle time between IO buffers (usec)",
3547 .category = FIO_OPT_C_IO,
3548 .group = FIO_OPT_G_THINKTIME,
3551 .name = "thinktime_spin",
3552 .lname = "Thinktime spin",
3553 .type = FIO_OPT_INT,
3554 .off1 = offsetof(struct thread_options, thinktime_spin),
3555 .help = "Start think time by spinning this amount (usec)",
3558 .parent = "thinktime",
3560 .category = FIO_OPT_C_IO,
3561 .group = FIO_OPT_G_THINKTIME,
3564 .name = "thinktime_blocks",
3565 .lname = "Thinktime blocks",
3566 .type = FIO_OPT_INT,
3567 .off1 = offsetof(struct thread_options, thinktime_blocks),
3568 .help = "IO buffer period between 'thinktime'",
3570 .parent = "thinktime",
3572 .category = FIO_OPT_C_IO,
3573 .group = FIO_OPT_G_THINKTIME,
3577 .lname = "I/O rate",
3578 .type = FIO_OPT_ULL,
3579 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3580 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3581 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
3582 .help = "Set bandwidth rate",
3583 .category = FIO_OPT_C_IO,
3584 .group = FIO_OPT_G_RATE,
3589 .lname = "I/O min rate",
3590 .type = FIO_OPT_ULL,
3591 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
3592 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
3593 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
3594 .help = "Job must meet this rate or it will be shutdown",
3597 .category = FIO_OPT_C_IO,
3598 .group = FIO_OPT_G_RATE,
3601 .name = "rate_iops",
3602 .lname = "I/O rate IOPS",
3603 .type = FIO_OPT_INT,
3604 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
3605 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
3606 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
3607 .help = "Limit IO used to this number of IO operations/sec",
3609 .category = FIO_OPT_C_IO,
3610 .group = FIO_OPT_G_RATE,
3613 .name = "rate_iops_min",
3614 .lname = "I/O min rate IOPS",
3615 .type = FIO_OPT_INT,
3616 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
3617 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
3618 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
3619 .help = "Job must meet this rate or it will be shut down",
3620 .parent = "rate_iops",
3622 .category = FIO_OPT_C_IO,
3623 .group = FIO_OPT_G_RATE,
3626 .name = "rate_process",
3627 .lname = "Rate Process",
3628 .type = FIO_OPT_STR,
3629 .off1 = offsetof(struct thread_options, rate_process),
3630 .help = "What process controls how rated IO is managed",
3632 .category = FIO_OPT_C_IO,
3633 .group = FIO_OPT_G_RATE,
3636 .oval = RATE_PROCESS_LINEAR,
3637 .help = "Linear rate of IO",
3641 .oval = RATE_PROCESS_POISSON,
3642 .help = "Rate follows Poisson process",
3648 .name = "rate_cycle",
3649 .alias = "ratecycle",
3650 .lname = "I/O rate cycle",
3651 .type = FIO_OPT_INT,
3652 .off1 = offsetof(struct thread_options, ratecycle),
3653 .help = "Window average for rate limits (msec)",
3657 .category = FIO_OPT_C_IO,
3658 .group = FIO_OPT_G_RATE,
3661 .name = "rate_ignore_thinktime",
3662 .lname = "Rate ignore thinktime",
3663 .type = FIO_OPT_BOOL,
3664 .off1 = offsetof(struct thread_options, rate_ign_think),
3665 .help = "Rated IO ignores thinktime settings",
3667 .category = FIO_OPT_C_IO,
3668 .group = FIO_OPT_G_RATE,
3671 .name = "max_latency",
3672 .lname = "Max Latency (usec)",
3673 .type = FIO_OPT_STR_VAL_TIME,
3674 .off1 = offsetof(struct thread_options, max_latency),
3675 .help = "Maximum tolerated IO latency (usec)",
3677 .category = FIO_OPT_C_IO,
3678 .group = FIO_OPT_G_LATPROF,
3681 .name = "latency_target",
3682 .lname = "Latency Target (usec)",
3683 .type = FIO_OPT_STR_VAL_TIME,
3684 .off1 = offsetof(struct thread_options, latency_target),
3685 .help = "Ramp to max queue depth supporting this latency",
3687 .category = FIO_OPT_C_IO,
3688 .group = FIO_OPT_G_LATPROF,
3691 .name = "latency_window",
3692 .lname = "Latency Window (usec)",
3693 .type = FIO_OPT_STR_VAL_TIME,
3694 .off1 = offsetof(struct thread_options, latency_window),
3695 .help = "Time to sustain latency_target",
3697 .category = FIO_OPT_C_IO,
3698 .group = FIO_OPT_G_LATPROF,
3701 .name = "latency_percentile",
3702 .lname = "Latency Percentile",
3703 .type = FIO_OPT_FLOAT_LIST,
3704 .off1 = offsetof(struct thread_options, latency_percentile),
3705 .help = "Percentile of IOs must be below latency_target",
3710 .category = FIO_OPT_C_IO,
3711 .group = FIO_OPT_G_LATPROF,
3714 .name = "latency_run",
3715 .lname = "Latency Run",
3716 .type = FIO_OPT_BOOL,
3717 .off1 = offsetof(struct thread_options, latency_run),
3718 .help = "Keep adjusting queue depth to match latency_target",
3720 .category = FIO_OPT_C_IO,
3721 .group = FIO_OPT_G_LATPROF,
3724 .name = "invalidate",
3725 .lname = "Cache invalidate",
3726 .type = FIO_OPT_BOOL,
3727 .off1 = offsetof(struct thread_options, invalidate_cache),
3728 .help = "Invalidate buffer/page cache prior to running job",
3730 .category = FIO_OPT_C_IO,
3731 .group = FIO_OPT_G_IO_TYPE,
3735 .lname = "Synchronous I/O",
3736 .type = FIO_OPT_STR,
3737 .off1 = offsetof(struct thread_options, sync_io),
3738 .help = "Use synchronous write IO",
3741 .category = FIO_OPT_C_IO,
3742 .group = FIO_OPT_G_IO_TYPE,
3763 #ifdef FIO_HAVE_WRITE_HINT
3765 .name = "write_hint",
3766 .lname = "Write hint",
3767 .type = FIO_OPT_STR,
3768 .off1 = offsetof(struct thread_options, write_hint),
3769 .help = "Set expected write life time",
3770 .category = FIO_OPT_C_ENGINE,
3771 .group = FIO_OPT_G_INVALID,
3774 .oval = RWH_WRITE_LIFE_NONE,
3777 .oval = RWH_WRITE_LIFE_SHORT,
3780 .oval = RWH_WRITE_LIFE_MEDIUM,
3783 .oval = RWH_WRITE_LIFE_LONG,
3785 { .ival = "extreme",
3786 .oval = RWH_WRITE_LIFE_EXTREME,
3792 .name = "create_serialize",
3793 .lname = "Create serialize",
3794 .type = FIO_OPT_BOOL,
3795 .off1 = offsetof(struct thread_options, create_serialize),
3796 .help = "Serialize creation of job files",
3798 .category = FIO_OPT_C_FILE,
3799 .group = FIO_OPT_G_INVALID,
3802 .name = "create_fsync",
3803 .lname = "Create fsync",
3804 .type = FIO_OPT_BOOL,
3805 .off1 = offsetof(struct thread_options, create_fsync),
3806 .help = "fsync file after creation",
3808 .category = FIO_OPT_C_FILE,
3809 .group = FIO_OPT_G_INVALID,
3812 .name = "create_on_open",
3813 .lname = "Create on open",
3814 .type = FIO_OPT_BOOL,
3815 .off1 = offsetof(struct thread_options, create_on_open),
3816 .help = "Create files when they are opened for IO",
3818 .category = FIO_OPT_C_FILE,
3819 .group = FIO_OPT_G_INVALID,
3822 .name = "create_only",
3823 .lname = "Create Only",
3824 .type = FIO_OPT_BOOL,
3825 .off1 = offsetof(struct thread_options, create_only),
3826 .help = "Only perform file creation phase",
3827 .category = FIO_OPT_C_FILE,
3831 .name = "allow_file_create",
3832 .lname = "Allow file create",
3833 .type = FIO_OPT_BOOL,
3834 .off1 = offsetof(struct thread_options, allow_create),
3835 .help = "Permit fio to create files, if they don't exist",
3837 .category = FIO_OPT_C_FILE,
3838 .group = FIO_OPT_G_FILENAME,
3841 .name = "allow_mounted_write",
3842 .lname = "Allow mounted write",
3843 .type = FIO_OPT_BOOL,
3844 .off1 = offsetof(struct thread_options, allow_mounted_write),
3845 .help = "Allow writes to a mounted partition",
3847 .category = FIO_OPT_C_FILE,
3848 .group = FIO_OPT_G_FILENAME,
3852 .lname = "Pre-read files",
3853 .type = FIO_OPT_BOOL,
3854 .off1 = offsetof(struct thread_options, pre_read),
3855 .help = "Pre-read files before starting official testing",
3857 .category = FIO_OPT_C_FILE,
3858 .group = FIO_OPT_G_INVALID,
3860 #ifdef FIO_HAVE_CPU_AFFINITY
3863 .lname = "CPU mask",
3864 .type = FIO_OPT_INT,
3865 .cb = str_cpumask_cb,
3866 .off1 = offsetof(struct thread_options, cpumask),
3867 .help = "CPU affinity mask",
3868 .category = FIO_OPT_C_GENERAL,
3869 .group = FIO_OPT_G_CRED,
3872 .name = "cpus_allowed",
3873 .lname = "CPUs allowed",
3874 .type = FIO_OPT_STR,
3875 .cb = str_cpus_allowed_cb,
3876 .off1 = offsetof(struct thread_options, cpumask),
3877 .help = "Set CPUs allowed",
3878 .category = FIO_OPT_C_GENERAL,
3879 .group = FIO_OPT_G_CRED,
3882 .name = "cpus_allowed_policy",
3883 .lname = "CPUs allowed distribution policy",
3884 .type = FIO_OPT_STR,
3885 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
3886 .help = "Distribution policy for cpus_allowed",
3887 .parent = "cpus_allowed",
3891 .oval = FIO_CPUS_SHARED,
3892 .help = "Mask shared between threads",
3895 .oval = FIO_CPUS_SPLIT,
3896 .help = "Mask split between threads",
3899 .category = FIO_OPT_C_GENERAL,
3900 .group = FIO_OPT_G_CRED,
3905 .lname = "CPU mask",
3906 .type = FIO_OPT_UNSUPPORTED,
3907 .help = "Your platform does not support CPU affinities",
3910 .name = "cpus_allowed",
3911 .lname = "CPUs allowed",
3912 .type = FIO_OPT_UNSUPPORTED,
3913 .help = "Your platform does not support CPU affinities",
3916 .name = "cpus_allowed_policy",
3917 .lname = "CPUs allowed distribution policy",
3918 .type = FIO_OPT_UNSUPPORTED,
3919 .help = "Your platform does not support CPU affinities",
3922 #ifdef CONFIG_LIBNUMA
3924 .name = "numa_cpu_nodes",
3925 .lname = "NUMA CPU Nodes",
3926 .type = FIO_OPT_STR,
3927 .cb = str_numa_cpunodes_cb,
3928 .off1 = offsetof(struct thread_options, numa_cpunodes),
3929 .help = "NUMA CPU nodes bind",
3930 .category = FIO_OPT_C_GENERAL,
3931 .group = FIO_OPT_G_INVALID,
3934 .name = "numa_mem_policy",
3935 .lname = "NUMA Memory Policy",
3936 .type = FIO_OPT_STR,
3937 .cb = str_numa_mpol_cb,
3938 .off1 = offsetof(struct thread_options, numa_memnodes),
3939 .help = "NUMA memory policy setup",
3940 .category = FIO_OPT_C_GENERAL,
3941 .group = FIO_OPT_G_INVALID,
3945 .name = "numa_cpu_nodes",
3946 .lname = "NUMA CPU Nodes",
3947 .type = FIO_OPT_UNSUPPORTED,
3948 .help = "Build fio with libnuma-dev(el) to enable this option",
3951 .name = "numa_mem_policy",
3952 .lname = "NUMA Memory Policy",
3953 .type = FIO_OPT_UNSUPPORTED,
3954 .help = "Build fio with libnuma-dev(el) to enable this option",
3959 .name = "gpu_dev_id",
3960 .lname = "GPU device ID",
3961 .type = FIO_OPT_INT,
3962 .off1 = offsetof(struct thread_options, gpu_dev_id),
3963 .help = "Set GPU device ID for GPUDirect RDMA",
3965 .category = FIO_OPT_C_GENERAL,
3966 .group = FIO_OPT_G_INVALID,
3970 .name = "end_fsync",
3971 .lname = "End fsync",
3972 .type = FIO_OPT_BOOL,
3973 .off1 = offsetof(struct thread_options, end_fsync),
3974 .help = "Include fsync at the end of job",
3976 .category = FIO_OPT_C_FILE,
3977 .group = FIO_OPT_G_INVALID,
3980 .name = "fsync_on_close",
3981 .lname = "Fsync on close",
3982 .type = FIO_OPT_BOOL,
3983 .off1 = offsetof(struct thread_options, fsync_on_close),
3984 .help = "fsync files on close",
3986 .category = FIO_OPT_C_FILE,
3987 .group = FIO_OPT_G_INVALID,
3991 .lname = "Unlink file",
3992 .type = FIO_OPT_BOOL,
3993 .off1 = offsetof(struct thread_options, unlink),
3994 .help = "Unlink created files after job has completed",
3996 .category = FIO_OPT_C_FILE,
3997 .group = FIO_OPT_G_INVALID,
4000 .name = "unlink_each_loop",
4001 .lname = "Unlink file after each loop of a job",
4002 .type = FIO_OPT_BOOL,
4003 .off1 = offsetof(struct thread_options, unlink_each_loop),
4004 .help = "Unlink created files after each loop in a job has completed",
4006 .category = FIO_OPT_C_FILE,
4007 .group = FIO_OPT_G_INVALID,
4011 .lname = "Exit-all on terminate",
4012 .type = FIO_OPT_STR_SET,
4013 .cb = str_exitall_cb,
4014 .help = "Terminate all jobs when one exits",
4015 .category = FIO_OPT_C_GENERAL,
4016 .group = FIO_OPT_G_PROCESS,
4019 .name = "exit_what",
4020 .lname = "What jobs to quit on terminate",
4021 .type = FIO_OPT_STR,
4022 .off1 = offsetof(struct thread_options, exit_what),
4023 .help = "Fine-grained control for exitall",
4025 .category = FIO_OPT_C_GENERAL,
4026 .group = FIO_OPT_G_PROCESS,
4029 .oval = TERMINATE_GROUP,
4030 .help = "exit_all=1 default behaviour",
4032 { .ival = "stonewall",
4033 .oval = TERMINATE_STONEWALL,
4034 .help = "quit all currently running jobs; continue with next stonewall",
4037 .oval = TERMINATE_ALL,
4038 .help = "Quit everything",
4043 .name = "exitall_on_error",
4044 .lname = "Exit-all on terminate in error",
4045 .type = FIO_OPT_STR_SET,
4046 .off1 = offsetof(struct thread_options, exitall_error),
4047 .help = "Terminate all jobs when one exits in error",
4048 .category = FIO_OPT_C_GENERAL,
4049 .group = FIO_OPT_G_PROCESS,
4052 .name = "stonewall",
4053 .lname = "Wait for previous",
4054 .alias = "wait_for_previous",
4055 .type = FIO_OPT_STR_SET,
4056 .off1 = offsetof(struct thread_options, stonewall),
4057 .help = "Insert a hard barrier between this job and previous",
4058 .category = FIO_OPT_C_GENERAL,
4059 .group = FIO_OPT_G_PROCESS,
4062 .name = "new_group",
4063 .lname = "New group",
4064 .type = FIO_OPT_STR_SET,
4065 .off1 = offsetof(struct thread_options, new_group),
4066 .help = "Mark the start of a new group (for reporting)",
4067 .category = FIO_OPT_C_GENERAL,
4068 .group = FIO_OPT_G_PROCESS,
4073 .type = FIO_OPT_STR_SET,
4074 .off1 = offsetof(struct thread_options, use_thread),
4075 .help = "Use threads instead of processes",
4076 #ifdef CONFIG_NO_SHM
4080 .category = FIO_OPT_C_GENERAL,
4081 .group = FIO_OPT_G_PROCESS,
4084 .name = "per_job_logs",
4085 .lname = "Per Job Logs",
4086 .type = FIO_OPT_BOOL,
4087 .off1 = offsetof(struct thread_options, per_job_logs),
4088 .help = "Include job number in generated log files or not",
4090 .category = FIO_OPT_C_LOG,
4091 .group = FIO_OPT_G_INVALID,
4094 .name = "write_bw_log",
4095 .lname = "Write bandwidth log",
4096 .type = FIO_OPT_STR,
4097 .off1 = offsetof(struct thread_options, bw_log_file),
4098 .cb = str_write_bw_log_cb,
4099 .help = "Write log of bandwidth during run",
4100 .category = FIO_OPT_C_LOG,
4101 .group = FIO_OPT_G_INVALID,
4104 .name = "write_lat_log",
4105 .lname = "Write latency log",
4106 .type = FIO_OPT_STR,
4107 .off1 = offsetof(struct thread_options, lat_log_file),
4108 .cb = str_write_lat_log_cb,
4109 .help = "Write log of latency during run",
4110 .category = FIO_OPT_C_LOG,
4111 .group = FIO_OPT_G_INVALID,
4114 .name = "write_iops_log",
4115 .lname = "Write IOPS log",
4116 .type = FIO_OPT_STR,
4117 .off1 = offsetof(struct thread_options, iops_log_file),
4118 .cb = str_write_iops_log_cb,
4119 .help = "Write log of IOPS during run",
4120 .category = FIO_OPT_C_LOG,
4121 .group = FIO_OPT_G_INVALID,
4124 .name = "log_avg_msec",
4125 .lname = "Log averaging (msec)",
4126 .type = FIO_OPT_INT,
4127 .off1 = offsetof(struct thread_options, log_avg_msec),
4128 .help = "Average bw/iops/lat logs over this period of time",
4130 .category = FIO_OPT_C_LOG,
4131 .group = FIO_OPT_G_INVALID,
4134 .name = "log_hist_msec",
4135 .lname = "Log histograms (msec)",
4136 .type = FIO_OPT_INT,
4137 .off1 = offsetof(struct thread_options, log_hist_msec),
4138 .help = "Dump completion latency histograms at frequency of this time value",
4140 .category = FIO_OPT_C_LOG,
4141 .group = FIO_OPT_G_INVALID,
4144 .name = "log_hist_coarseness",
4145 .lname = "Histogram logs coarseness",
4146 .type = FIO_OPT_INT,
4147 .off1 = offsetof(struct thread_options, log_hist_coarseness),
4148 .help = "Integer in range [0,6]. Higher coarseness outputs"
4149 " fewer histogram bins per sample. The number of bins for"
4150 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
4152 .category = FIO_OPT_C_LOG,
4153 .group = FIO_OPT_G_INVALID,
4156 .name = "write_hist_log",
4157 .lname = "Write latency histogram logs",
4158 .type = FIO_OPT_STR,
4159 .off1 = offsetof(struct thread_options, hist_log_file),
4160 .cb = str_write_hist_log_cb,
4161 .help = "Write log of latency histograms during run",
4162 .category = FIO_OPT_C_LOG,
4163 .group = FIO_OPT_G_INVALID,
4166 .name = "log_max_value",
4167 .lname = "Log maximum instead of average",
4168 .type = FIO_OPT_BOOL,
4169 .off1 = offsetof(struct thread_options, log_max),
4170 .help = "Log max sample in a window instead of average",
4172 .category = FIO_OPT_C_LOG,
4173 .group = FIO_OPT_G_INVALID,
4176 .name = "log_offset",
4177 .lname = "Log offset of IO",
4178 .type = FIO_OPT_BOOL,
4179 .off1 = offsetof(struct thread_options, log_offset),
4180 .help = "Include offset of IO for each log entry",
4182 .category = FIO_OPT_C_LOG,
4183 .group = FIO_OPT_G_INVALID,
4187 .name = "log_compression",
4188 .lname = "Log compression",
4189 .type = FIO_OPT_INT,
4190 .off1 = offsetof(struct thread_options, log_gz),
4191 .help = "Log in compressed chunks of this size",
4193 .maxval = 512 * 1024 * 1024ULL,
4194 .category = FIO_OPT_C_LOG,
4195 .group = FIO_OPT_G_INVALID,
4197 #ifdef FIO_HAVE_CPU_AFFINITY
4199 .name = "log_compression_cpus",
4200 .lname = "Log Compression CPUs",
4201 .type = FIO_OPT_STR,
4202 .cb = str_log_cpus_allowed_cb,
4203 .off1 = offsetof(struct thread_options, log_gz_cpumask),
4204 .parent = "log_compression",
4205 .help = "Limit log compression to these CPUs",
4206 .category = FIO_OPT_C_LOG,
4207 .group = FIO_OPT_G_INVALID,
4211 .name = "log_compression_cpus",
4212 .lname = "Log Compression CPUs",
4213 .type = FIO_OPT_UNSUPPORTED,
4214 .help = "Your platform does not support CPU affinities",
4218 .name = "log_store_compressed",
4219 .lname = "Log store compressed",
4220 .type = FIO_OPT_BOOL,
4221 .off1 = offsetof(struct thread_options, log_gz_store),
4222 .help = "Store logs in a compressed format",
4223 .category = FIO_OPT_C_LOG,
4224 .group = FIO_OPT_G_INVALID,
4228 .name = "log_compression",
4229 .lname = "Log compression",
4230 .type = FIO_OPT_UNSUPPORTED,
4231 .help = "Install libz-dev(el) to get compression support",
4234 .name = "log_store_compressed",
4235 .lname = "Log store compressed",
4236 .type = FIO_OPT_UNSUPPORTED,
4237 .help = "Install libz-dev(el) to get compression support",
4241 .name = "log_unix_epoch",
4242 .lname = "Log epoch unix",
4243 .type = FIO_OPT_BOOL,
4244 .off1 = offsetof(struct thread_options, log_unix_epoch),
4245 .help = "Use Unix time in log files",
4246 .category = FIO_OPT_C_LOG,
4247 .group = FIO_OPT_G_INVALID,
4250 .name = "block_error_percentiles",
4251 .lname = "Block error percentiles",
4252 .type = FIO_OPT_BOOL,
4253 .off1 = offsetof(struct thread_options, block_error_hist),
4254 .help = "Record trim block errors and make a histogram",
4256 .category = FIO_OPT_C_LOG,
4257 .group = FIO_OPT_G_INVALID,
4260 .name = "bwavgtime",
4261 .lname = "Bandwidth average time",
4262 .type = FIO_OPT_INT,
4263 .off1 = offsetof(struct thread_options, bw_avg_time),
4264 .help = "Time window over which to calculate bandwidth"
4267 .parent = "write_bw_log",
4270 .category = FIO_OPT_C_LOG,
4271 .group = FIO_OPT_G_INVALID,
4274 .name = "iopsavgtime",
4275 .lname = "IOPS average time",
4276 .type = FIO_OPT_INT,
4277 .off1 = offsetof(struct thread_options, iops_avg_time),
4278 .help = "Time window over which to calculate IOPS (msec)",
4280 .parent = "write_iops_log",
4283 .category = FIO_OPT_C_LOG,
4284 .group = FIO_OPT_G_INVALID,
4287 .name = "group_reporting",
4288 .lname = "Group reporting",
4289 .type = FIO_OPT_STR_SET,
4290 .off1 = offsetof(struct thread_options, group_reporting),
4291 .help = "Do reporting on a per-group basis",
4292 .category = FIO_OPT_C_STAT,
4293 .group = FIO_OPT_G_INVALID,
4298 .type = FIO_OPT_BOOL,
4299 .off1 = offsetof(struct thread_options, stats),
4300 .help = "Enable collection of stats",
4302 .category = FIO_OPT_C_STAT,
4303 .group = FIO_OPT_G_INVALID,
4306 .name = "zero_buffers",
4307 .lname = "Zero I/O buffers",
4308 .type = FIO_OPT_STR_SET,
4309 .off1 = offsetof(struct thread_options, zero_buffers),
4310 .help = "Init IO buffers to all zeroes",
4311 .category = FIO_OPT_C_IO,
4312 .group = FIO_OPT_G_IO_BUF,
4315 .name = "refill_buffers",
4316 .lname = "Refill I/O buffers",
4317 .type = FIO_OPT_STR_SET,
4318 .off1 = offsetof(struct thread_options, refill_buffers),
4319 .help = "Refill IO buffers on every IO submit",
4320 .category = FIO_OPT_C_IO,
4321 .group = FIO_OPT_G_IO_BUF,
4324 .name = "scramble_buffers",
4325 .lname = "Scramble I/O buffers",
4326 .type = FIO_OPT_BOOL,
4327 .off1 = offsetof(struct thread_options, scramble_buffers),
4328 .help = "Slightly scramble buffers on every IO submit",
4330 .category = FIO_OPT_C_IO,
4331 .group = FIO_OPT_G_IO_BUF,
4334 .name = "buffer_pattern",
4335 .lname = "Buffer pattern",
4336 .type = FIO_OPT_STR,
4337 .cb = str_buffer_pattern_cb,
4338 .off1 = offsetof(struct thread_options, buffer_pattern),
4339 .help = "Fill pattern for IO buffers",
4340 .category = FIO_OPT_C_IO,
4341 .group = FIO_OPT_G_IO_BUF,
4344 .name = "buffer_compress_percentage",
4345 .lname = "Buffer compression percentage",
4346 .type = FIO_OPT_INT,
4347 .cb = str_buffer_compress_cb,
4348 .off1 = offsetof(struct thread_options, compress_percentage),
4351 .help = "How compressible the buffer is (approximately)",
4353 .category = FIO_OPT_C_IO,
4354 .group = FIO_OPT_G_IO_BUF,
4357 .name = "buffer_compress_chunk",
4358 .lname = "Buffer compression chunk size",
4359 .type = FIO_OPT_INT,
4360 .off1 = offsetof(struct thread_options, compress_chunk),
4361 .parent = "buffer_compress_percentage",
4363 .help = "Size of compressible region in buffer",
4366 .category = FIO_OPT_C_IO,
4367 .group = FIO_OPT_G_IO_BUF,
4370 .name = "dedupe_percentage",
4371 .lname = "Dedupe percentage",
4372 .type = FIO_OPT_INT,
4373 .cb = str_dedupe_cb,
4374 .off1 = offsetof(struct thread_options, dedupe_percentage),
4377 .help = "Percentage of buffers that are dedupable",
4379 .category = FIO_OPT_C_IO,
4380 .group = FIO_OPT_G_IO_BUF,
4383 .name = "clat_percentiles",
4384 .lname = "Completion latency percentiles",
4385 .type = FIO_OPT_BOOL,
4386 .off1 = offsetof(struct thread_options, clat_percentiles),
4387 .help = "Enable the reporting of completion latency percentiles",
4389 .category = FIO_OPT_C_STAT,
4390 .group = FIO_OPT_G_INVALID,
4393 .name = "lat_percentiles",
4394 .lname = "IO latency percentiles",
4395 .type = FIO_OPT_BOOL,
4396 .off1 = offsetof(struct thread_options, lat_percentiles),
4397 .help = "Enable the reporting of IO latency percentiles",
4399 .category = FIO_OPT_C_STAT,
4400 .group = FIO_OPT_G_INVALID,
4403 .name = "slat_percentiles",
4404 .lname = "Submission latency percentiles",
4405 .type = FIO_OPT_BOOL,
4406 .off1 = offsetof(struct thread_options, slat_percentiles),
4407 .help = "Enable the reporting of submission latency percentiles",
4409 .category = FIO_OPT_C_STAT,
4410 .group = FIO_OPT_G_INVALID,
4413 .name = "percentile_list",
4414 .lname = "Percentile list",
4415 .type = FIO_OPT_FLOAT_LIST,
4416 .off1 = offsetof(struct thread_options, percentile_list),
4417 .off2 = offsetof(struct thread_options, percentile_precision),
4418 .help = "Specify a custom list of percentiles to report for "
4419 "completion latency and block errors",
4420 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
4421 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4424 .category = FIO_OPT_C_STAT,
4425 .group = FIO_OPT_G_INVALID,
4428 .name = "significant_figures",
4429 .lname = "Significant figures",
4430 .type = FIO_OPT_INT,
4431 .off1 = offsetof(struct thread_options, sig_figs),
4434 .help = "Significant figures for output-format set to normal",
4437 .category = FIO_OPT_C_STAT,
4438 .group = FIO_OPT_G_INVALID,
4441 #ifdef FIO_HAVE_DISK_UTIL
4443 .name = "disk_util",
4444 .lname = "Disk utilization",
4445 .type = FIO_OPT_BOOL,
4446 .off1 = offsetof(struct thread_options, do_disk_util),
4447 .help = "Log disk utilization statistics",
4449 .category = FIO_OPT_C_STAT,
4450 .group = FIO_OPT_G_INVALID,
4454 .name = "disk_util",
4455 .lname = "Disk utilization",
4456 .type = FIO_OPT_UNSUPPORTED,
4457 .help = "Your platform does not support disk utilization",
4461 .name = "gtod_reduce",
4462 .lname = "Reduce gettimeofday() calls",
4463 .type = FIO_OPT_BOOL,
4464 .help = "Greatly reduce number of gettimeofday() calls",
4465 .cb = str_gtod_reduce_cb,
4468 .category = FIO_OPT_C_STAT,
4469 .group = FIO_OPT_G_INVALID,
4472 .name = "disable_lat",
4473 .lname = "Disable all latency stats",
4474 .type = FIO_OPT_BOOL,
4475 .off1 = offsetof(struct thread_options, disable_lat),
4476 .help = "Disable latency numbers",
4477 .parent = "gtod_reduce",
4480 .category = FIO_OPT_C_STAT,
4481 .group = FIO_OPT_G_INVALID,
4484 .name = "disable_clat",
4485 .lname = "Disable completion latency stats",
4486 .type = FIO_OPT_BOOL,
4487 .off1 = offsetof(struct thread_options, disable_clat),
4488 .help = "Disable completion latency numbers",
4489 .parent = "gtod_reduce",
4492 .category = FIO_OPT_C_STAT,
4493 .group = FIO_OPT_G_INVALID,
4496 .name = "disable_slat",
4497 .lname = "Disable submission latency stats",
4498 .type = FIO_OPT_BOOL,
4499 .off1 = offsetof(struct thread_options, disable_slat),
4500 .help = "Disable submission latency numbers",
4501 .parent = "gtod_reduce",
4504 .category = FIO_OPT_C_STAT,
4505 .group = FIO_OPT_G_INVALID,
4508 .name = "disable_bw_measurement",
4509 .alias = "disable_bw",
4510 .lname = "Disable bandwidth stats",
4511 .type = FIO_OPT_BOOL,
4512 .off1 = offsetof(struct thread_options, disable_bw),
4513 .help = "Disable bandwidth logging",
4514 .parent = "gtod_reduce",
4517 .category = FIO_OPT_C_STAT,
4518 .group = FIO_OPT_G_INVALID,
4522 .lname = "Dedicated gettimeofday() CPU",
4523 .type = FIO_OPT_INT,
4524 .off1 = offsetof(struct thread_options, gtod_cpu),
4525 .help = "Set up dedicated gettimeofday() thread on this CPU",
4526 .verify = gtod_cpu_verify,
4527 .category = FIO_OPT_C_GENERAL,
4528 .group = FIO_OPT_G_CLOCK,
4531 .name = "unified_rw_reporting",
4532 .lname = "Unified RW Reporting",
4533 .type = FIO_OPT_BOOL,
4534 .off1 = offsetof(struct thread_options, unified_rw_rep),
4535 .help = "Unify reporting across data direction",
4537 .category = FIO_OPT_C_GENERAL,
4538 .group = FIO_OPT_G_INVALID,
4541 .name = "continue_on_error",
4542 .lname = "Continue on error",
4543 .type = FIO_OPT_STR,
4544 .off1 = offsetof(struct thread_options, continue_on_error),
4545 .help = "Continue on non-fatal errors during IO",
4547 .category = FIO_OPT_C_GENERAL,
4548 .group = FIO_OPT_G_ERR,
4551 .oval = ERROR_TYPE_NONE,
4552 .help = "Exit when an error is encountered",
4555 .oval = ERROR_TYPE_READ,
4556 .help = "Continue on read errors only",
4559 .oval = ERROR_TYPE_WRITE,
4560 .help = "Continue on write errors only",
4563 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
4564 .help = "Continue on any IO errors",
4567 .oval = ERROR_TYPE_VERIFY,
4568 .help = "Continue on verify errors only",
4571 .oval = ERROR_TYPE_ANY,
4572 .help = "Continue on all io and verify errors",
4575 .oval = ERROR_TYPE_NONE,
4576 .help = "Alias for 'none'",
4579 .oval = ERROR_TYPE_ANY,
4580 .help = "Alias for 'all'",
4585 .name = "ignore_error",
4586 .lname = "Ignore Error",
4587 .type = FIO_OPT_STR,
4588 .cb = str_ignore_error_cb,
4589 .off1 = offsetof(struct thread_options, ignore_error_nr),
4590 .help = "Set a specific list of errors to ignore",
4592 .category = FIO_OPT_C_GENERAL,
4593 .group = FIO_OPT_G_ERR,
4596 .name = "error_dump",
4597 .lname = "Error Dump",
4598 .type = FIO_OPT_BOOL,
4599 .off1 = offsetof(struct thread_options, error_dump),
4601 .help = "Dump info on each error",
4602 .category = FIO_OPT_C_GENERAL,
4603 .group = FIO_OPT_G_ERR,
4608 .type = FIO_OPT_STR_STORE,
4609 .off1 = offsetof(struct thread_options, profile),
4610 .help = "Select a specific builtin performance test",
4611 .category = FIO_OPT_C_PROFILE,
4612 .group = FIO_OPT_G_INVALID,
4617 .type = FIO_OPT_STR_STORE,
4618 .off1 = offsetof(struct thread_options, cgroup),
4619 .help = "Add job to cgroup of this name",
4620 .category = FIO_OPT_C_GENERAL,
4621 .group = FIO_OPT_G_CGROUP,
4624 .name = "cgroup_nodelete",
4625 .lname = "Cgroup no-delete",
4626 .type = FIO_OPT_BOOL,
4627 .off1 = offsetof(struct thread_options, cgroup_nodelete),
4628 .help = "Do not delete cgroups after job completion",
4631 .category = FIO_OPT_C_GENERAL,
4632 .group = FIO_OPT_G_CGROUP,
4635 .name = "cgroup_weight",
4636 .lname = "Cgroup weight",
4637 .type = FIO_OPT_INT,
4638 .off1 = offsetof(struct thread_options, cgroup_weight),
4639 .help = "Use given weight for cgroup",
4643 .category = FIO_OPT_C_GENERAL,
4644 .group = FIO_OPT_G_CGROUP,
4649 .type = FIO_OPT_INT,
4650 .off1 = offsetof(struct thread_options, uid),
4651 .help = "Run job with this user ID",
4652 .category = FIO_OPT_C_GENERAL,
4653 .group = FIO_OPT_G_CRED,
4657 .lname = "Group ID",
4658 .type = FIO_OPT_INT,
4659 .off1 = offsetof(struct thread_options, gid),
4660 .help = "Run job with this group ID",
4661 .category = FIO_OPT_C_GENERAL,
4662 .group = FIO_OPT_G_CRED,
4667 .type = FIO_OPT_STR,
4668 .off1 = offsetof(struct thread_options, kb_base),
4674 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
4678 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
4681 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
4682 .category = FIO_OPT_C_GENERAL,
4683 .group = FIO_OPT_G_INVALID,
4686 .name = "unit_base",
4687 .lname = "Unit for quantities of data (Bits or Bytes)",
4688 .type = FIO_OPT_STR,
4689 .off1 = offsetof(struct thread_options, unit_base),
4694 .help = "Auto-detect",
4697 .oval = N2S_BYTEPERSEC,
4698 .help = "Normal (byte based)",
4701 .oval = N2S_BITPERSEC,
4702 .help = "Bit based",
4705 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
4706 .category = FIO_OPT_C_GENERAL,
4707 .group = FIO_OPT_G_INVALID,
4710 .name = "hugepage-size",
4711 .lname = "Hugepage size",
4712 .type = FIO_OPT_INT,
4713 .off1 = offsetof(struct thread_options, hugepage_size),
4714 .help = "When using hugepages, specify size of each page",
4715 .def = __fio_stringify(FIO_HUGE_PAGE),
4716 .interval = 1024 * 1024,
4717 .category = FIO_OPT_C_GENERAL,
4718 .group = FIO_OPT_G_INVALID,
4722 .lname = "I/O flow ID",
4723 .type = FIO_OPT_INT,
4724 .off1 = offsetof(struct thread_options, flow_id),
4725 .help = "The flow index ID to use",
4727 .category = FIO_OPT_C_IO,
4728 .group = FIO_OPT_G_IO_FLOW,
4732 .lname = "I/O flow weight",
4733 .type = FIO_OPT_INT,
4734 .off1 = offsetof(struct thread_options, flow),
4735 .help = "Weight for flow control of this job",
4736 .parent = "flow_id",
4739 .maxval = FLOW_MAX_WEIGHT,
4740 .category = FIO_OPT_C_IO,
4741 .group = FIO_OPT_G_IO_FLOW,
4744 .name = "flow_watermark",
4745 .lname = "I/O flow watermark",
4746 .type = FIO_OPT_SOFT_DEPRECATED,
4747 .category = FIO_OPT_C_IO,
4748 .group = FIO_OPT_G_IO_FLOW,
4751 .name = "flow_sleep",
4752 .lname = "I/O flow sleep",
4753 .type = FIO_OPT_INT,
4754 .off1 = offsetof(struct thread_options, flow_sleep),
4755 .help = "How many microseconds to sleep after being held"
4756 " back by the flow control mechanism",
4757 .parent = "flow_id",
4760 .category = FIO_OPT_C_IO,
4761 .group = FIO_OPT_G_IO_FLOW,
4764 .name = "steadystate",
4765 .lname = "Steady state threshold",
4767 .type = FIO_OPT_STR,
4768 .off1 = offsetof(struct thread_options, ss_state),
4769 .cb = str_steadystate_cb,
4770 .help = "Define the criterion and limit to judge when a job has reached steady state",
4771 .def = "iops_slope:0.01%",
4774 .oval = FIO_SS_IOPS,
4775 .help = "maximum mean deviation of IOPS measurements",
4777 { .ival = "iops_slope",
4778 .oval = FIO_SS_IOPS_SLOPE,
4779 .help = "slope calculated from IOPS measurements",
4783 .help = "maximum mean deviation of bandwidth measurements",
4787 .oval = FIO_SS_BW_SLOPE,
4788 .help = "slope calculated from bandwidth measurements",
4791 .category = FIO_OPT_C_GENERAL,
4792 .group = FIO_OPT_G_RUNTIME,
4795 .name = "steadystate_duration",
4796 .lname = "Steady state duration",
4798 .parent = "steadystate",
4799 .type = FIO_OPT_STR_VAL_TIME,
4800 .off1 = offsetof(struct thread_options, ss_dur),
4801 .help = "Stop workload upon attaining steady state for specified duration",
4805 .category = FIO_OPT_C_GENERAL,
4806 .group = FIO_OPT_G_RUNTIME,
4809 .name = "steadystate_ramp_time",
4810 .lname = "Steady state ramp time",
4812 .parent = "steadystate",
4813 .type = FIO_OPT_STR_VAL_TIME,
4814 .off1 = offsetof(struct thread_options, ss_ramp_time),
4815 .help = "Delay before initiation of data collection for steady state job termination testing",
4819 .category = FIO_OPT_C_GENERAL,
4820 .group = FIO_OPT_G_RUNTIME,
4827 static void add_to_lopt(struct option *lopt, struct fio_option *o,
4828 const char *name, int val)
4830 lopt->name = (char *) name;
4832 if (o->type == FIO_OPT_STR_SET)
4833 lopt->has_arg = optional_argument;
4835 lopt->has_arg = required_argument;
4838 static void options_to_lopts(struct fio_option *opts,
4839 struct option *long_options,
4840 int i, int option_type)
4842 struct fio_option *o = &opts[0];
4844 add_to_lopt(&long_options[i], o, o->name, option_type);
4847 add_to_lopt(&long_options[i], o, o->alias, option_type);
4852 assert(i < FIO_NR_OPTIONS);
4856 void fio_options_set_ioengine_opts(struct option *long_options,
4857 struct thread_data *td)
4862 while (long_options[i].name) {
4863 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
4864 memset(&long_options[i], 0, sizeof(*long_options));
4871 * Just clear out the prior ioengine options.
4876 options_to_lopts(td->io_ops->options, long_options, i,
4877 FIO_GETOPT_IOENGINE);
4880 void fio_options_dup_and_init(struct option *long_options)
4884 options_init(fio_options);
4887 while (long_options[i].name)
4890 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
4893 struct fio_keyword {
4899 static struct fio_keyword fio_keywords[] = {
4901 .word = "$pagesize",
4902 .desc = "Page size in the system",
4905 .word = "$mb_memory",
4906 .desc = "Megabytes of memory online",
4910 .desc = "Number of CPUs online in the system",
4917 void fio_keywords_exit(void)
4919 struct fio_keyword *kw;
4921 kw = &fio_keywords[0];
4929 void fio_keywords_init(void)
4931 unsigned long long mb_memory;
4935 sprintf(buf, "%lu", (unsigned long) page_size);
4936 fio_keywords[0].replace = strdup(buf);
4938 mb_memory = os_phys_mem() / (1024 * 1024);
4939 sprintf(buf, "%llu", mb_memory);
4940 fio_keywords[1].replace = strdup(buf);
4943 sprintf(buf, "%lu", l);
4944 fio_keywords[2].replace = strdup(buf);
4949 static char *bc_calc(char *str)
4951 char buf[128], *tmp;
4956 * No math, just return string
4958 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
4959 !strchr(str, '/')) || strchr(str, '\''))
4963 * Split option from value, we only need to calculate the value
4965 tmp = strchr(str, '=');
4972 * Prevent buffer overflows; such a case isn't reasonable anyway
4974 if (strlen(str) >= 128 || strlen(tmp) > 100)
4977 sprintf(buf, "which %s > /dev/null", BC_APP);
4979 log_err("fio: bc is needed for performing math\n");
4983 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
4984 f = popen(buf, "r");
4988 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
4995 buf[(tmp - str) + ret - 1] = '\0';
4996 memcpy(buf, str, tmp - str);
5002 * Return a copy of the input string with substrings of the form ${VARNAME}
5003 * substituted with the value of the environment variable VARNAME. The
5004 * substitution always occurs, even if VARNAME is empty or the corresponding
5005 * environment variable undefined.
5007 char *fio_option_dup_subs(const char *opt)
5009 char out[OPT_LEN_MAX+1];
5010 char in[OPT_LEN_MAX+1];
5013 char *ch1, *ch2, *env;
5014 ssize_t nchr = OPT_LEN_MAX;
5017 if (strlen(opt) + 1 > OPT_LEN_MAX) {
5018 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
5022 snprintf(in, sizeof(in), "%s", opt);
5024 while (*inptr && nchr > 0) {
5025 if (inptr[0] == '$' && inptr[1] == '{') {
5026 ch2 = strchr(inptr, '}');
5027 if (ch2 && inptr+1 < ch2) {
5034 envlen = strlen(env);
5035 if (envlen <= nchr) {
5036 memcpy(outptr, env, envlen);
5046 *outptr++ = *inptr++;
5055 * Look for reserved variable names and replace them with real values
5057 static char *fio_keyword_replace(char *opt)
5063 for (i = 0; fio_keywords[i].word != NULL; i++) {
5064 struct fio_keyword *kw = &fio_keywords[i];
5066 while ((s = strstr(opt, kw->word)) != NULL) {
5067 char *new = malloc(strlen(opt) + 1);
5073 * Copy part of the string before the keyword and
5074 * sprintf() the replacement after it.
5076 memcpy(new, opt, olen);
5077 len = sprintf(new + olen, "%s", kw->replace);
5080 * If there's more in the original string, copy that
5083 opt += strlen(kw->word) + olen;
5085 memcpy(new + olen + len, opt, opt - o_org - 1);
5088 * replace opt and free the old opt
5098 * Check for potential math and invoke bc, if possible
5106 static char **dup_and_sub_options(char **opts, int num_opts)
5109 char **opts_copy = malloc(num_opts * sizeof(*opts));
5110 for (i = 0; i < num_opts; i++) {
5111 opts_copy[i] = fio_option_dup_subs(opts[i]);
5114 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
5119 static void show_closest_option(const char *opt)
5121 int best_option, best_distance;
5130 while (name[i] != '\0' && name[i] != '=')
5135 best_distance = INT_MAX;
5137 while (fio_options[i].name) {
5138 distance = string_distance(name, fio_options[i].name);
5139 if (distance < best_distance) {
5140 best_distance = distance;
5146 if (best_option != -1 && string_distance_ok(name, best_distance) &&
5147 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
5148 log_err("Did you mean %s?\n", fio_options[best_option].name);
5153 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
5155 int i, ret, unknown;
5158 sort_options(opts, fio_options, num_opts);
5159 opts_copy = dup_and_sub_options(opts, num_opts);
5161 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
5162 const struct fio_option *o;
5163 int newret = parse_option(opts_copy[i], opts[i], fio_options,
5164 &o, &td->o, &td->opt_list);
5167 fio_option_mark_set(&td->o, o);
5175 opts_copy[i] = NULL;
5182 ret |= ioengine_load(td);
5184 sort_options(opts_copy, td->io_ops->options, num_opts);
5187 for (i = 0; i < num_opts; i++) {
5188 const struct fio_option *o = NULL;
5195 newret = parse_option(opts_copy[i], opts[i],
5196 td->io_ops->options, &o,
5197 td->eo, &td->opt_list);
5201 log_err("Bad option <%s>\n", opts[i]);
5202 show_closest_option(opts[i]);
5205 opts_copy[i] = NULL;
5213 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
5217 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
5219 const struct fio_option *o;
5221 o = find_option_c(fio_options, opt);
5223 fio_option_mark_set(&td->o, o);
5229 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
5232 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
5236 void fio_fill_default_options(struct thread_data *td)
5238 td->o.magic = OPT_MAGIC;
5239 fill_default_options(&td->o, fio_options);
5242 int fio_show_option_help(const char *opt)
5244 return show_cmd_help(fio_options, opt);
5248 * dupe FIO_OPT_STR_STORE options
5250 void fio_options_mem_dupe(struct thread_data *td)
5252 options_mem_dupe(fio_options, &td->o);
5254 if (td->eo && td->io_ops) {
5255 void *oldeo = td->eo;
5257 td->eo = malloc(td->io_ops->option_struct_size);
5258 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
5259 options_mem_dupe(td->io_ops->options, td->eo);
5263 unsigned int fio_get_kb_base(void *data)
5265 struct thread_data *td = cb_data_to_td(data);
5266 struct thread_options *o = &td->o;
5267 unsigned int kb_base = 0;
5270 * This is a hack... For private options, *data is not holding
5271 * a pointer to the thread_options, but to private data. This means
5272 * we can't safely dereference it, but magic is first so mem wise
5273 * it is valid. But this also means that if the job first sets
5274 * kb_base and expects that to be honored by private options,
5275 * it will be disappointed. We will return the global default
5278 if (o && o->magic == OPT_MAGIC)
5279 kb_base = o->kb_base;
5286 int add_option(const struct fio_option *o)
5288 struct fio_option *__o;
5297 if (opt_index + 1 == FIO_MAX_OPTS) {
5298 log_err("fio: FIO_MAX_OPTS is too small\n");
5302 memcpy(&fio_options[opt_index], o, sizeof(*o));
5303 fio_options[opt_index + 1].name = NULL;
5307 void invalidate_profile_options(const char *prof_name)
5309 struct fio_option *o;
5313 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5314 o->type = FIO_OPT_INVALID;
5315 o->prof_name = NULL;
5321 void add_opt_posval(const char *optname, const char *ival, const char *help)
5323 struct fio_option *o;
5326 o = find_option(fio_options, optname);
5330 for (i = 0; i < PARSE_MAX_VP; i++) {
5331 if (o->posval[i].ival)
5334 o->posval[i].ival = ival;
5335 o->posval[i].help = help;
5340 void del_opt_posval(const char *optname, const char *ival)
5342 struct fio_option *o;
5345 o = find_option(fio_options, optname);
5349 for (i = 0; i < PARSE_MAX_VP; i++) {
5350 if (!o->posval[i].ival)
5352 if (strcmp(o->posval[i].ival, ival))
5355 o->posval[i].ival = NULL;
5356 o->posval[i].help = NULL;
5360 void fio_options_free(struct thread_data *td)
5362 options_free(fio_options, &td->o);
5363 if (td->eo && td->io_ops && td->io_ops->options) {
5364 options_free(td->io_ops->options, td->eo);
5370 struct fio_option *fio_option_find(const char *name)
5372 return find_option(fio_options, name);
5375 static struct fio_option *find_next_opt(struct fio_option *from,
5378 struct fio_option *opt;
5381 from = &fio_options[0];
5387 if (off1 == from->off1) {
5392 } while (from->name);
5397 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5399 unsigned int opt_off, index, offset;
5401 opt_off = opt - &fio_options[0];
5402 index = opt_off / (8 * sizeof(uint64_t));
5403 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5404 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
5407 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
5409 struct fio_option *opt, *next;
5412 while ((opt = find_next_opt(next, off1)) != NULL) {
5413 if (opt_is_set(o, opt))
5422 void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt)
5424 unsigned int opt_off, index, offset;
5426 opt_off = opt - &fio_options[0];
5427 index = opt_off / (8 * sizeof(uint64_t));
5428 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5429 o->set_options[index] |= (uint64_t)1 << offset;