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 struct pattern_fmt_desc fmt_desc[] = {
25 .len = FIELD_SIZE(struct io_u *, offset),
26 .paste = paste_blockoff
31 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
33 static char *get_opt_postfix(const char *str)
35 char *p = strstr(str, ":");
41 strip_blank_front(&p);
46 static int bs_cmp(const void *p1, const void *p2)
48 const struct bssplit *bsp1 = p1;
49 const struct bssplit *bsp2 = p2;
51 return (int) bsp1->perc - (int) bsp2->perc;
56 unsigned long long val1[ZONESPLIT_MAX];
57 unsigned long long val2[ZONESPLIT_MAX];
60 static int split_parse_ddir(struct thread_options *o, struct split *split,
61 char *str, bool absolute, unsigned int max_splits)
63 unsigned long long perc;
71 while ((fname = strsep(&str, ":")) != NULL) {
77 perc_str = strstr(fname, "/");
82 if (str_to_decimal(perc_str, &val, 1, o, 0, 0)) {
83 log_err("fio: split conversion failed\n");
88 perc = atoi(perc_str);
101 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
102 log_err("fio: split conversion failed\n");
106 split->val1[i] = val;
107 split->val2[i] = perc;
109 if (i == max_splits) {
110 log_err("fio: hit max of %d split entries\n", i);
119 static int bssplit_ddir(struct thread_options *o, enum fio_ddir ddir, char *str,
122 unsigned int i, perc, perc_missing;
123 unsigned long long max_bs, min_bs;
126 memset(&split, 0, sizeof(split));
128 if (split_parse_ddir(o, &split, str, data, BSSPLIT_MAX))
135 o->bssplit[ddir] = malloc(split.nr * sizeof(struct bssplit));
136 o->bssplit_nr[ddir] = split.nr;
137 for (i = 0; i < split.nr; i++) {
138 if (split.val1[i] > max_bs)
139 max_bs = split.val1[i];
140 if (split.val1[i] < min_bs)
141 min_bs = split.val1[i];
143 o->bssplit[ddir][i].bs = split.val1[i];
144 o->bssplit[ddir][i].perc =split.val2[i];
148 * Now check if the percentages add up, and how much is missing
150 perc = perc_missing = 0;
151 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
152 struct bssplit *bsp = &o->bssplit[ddir][i];
154 if (bsp->perc == -1U)
160 if (perc > 100 && perc_missing > 1) {
161 log_err("fio: bssplit percentages add to more than 100%%\n");
162 free(o->bssplit[ddir]);
163 o->bssplit[ddir] = NULL;
168 * If values didn't have a percentage set, divide the remains between
172 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
174 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
175 struct bssplit *bsp = &o->bssplit[ddir][i];
177 if (bsp->perc == -1U)
178 bsp->perc = (100 - perc) / perc_missing;
182 o->min_bs[ddir] = min_bs;
183 o->max_bs[ddir] = max_bs;
186 * now sort based on percentages, for ease of lookup
188 qsort(o->bssplit[ddir], o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
192 typedef int (split_parse_fn)(struct thread_options *, enum fio_ddir, char *, bool);
194 static int str_split_parse(struct thread_data *td, char *str,
195 split_parse_fn *fn, bool data)
200 odir = strchr(str, ',');
202 ddir = strchr(odir + 1, ',');
204 ret = fn(&td->o, DDIR_TRIM, ddir + 1, data);
210 op = strdup(odir + 1);
211 ret = fn(&td->o, DDIR_TRIM, op, data);
216 ret = fn(&td->o, DDIR_WRITE, odir + 1, data);
219 ret = fn(&td->o, DDIR_READ, str, data);
225 ret = fn(&td->o, DDIR_WRITE, op, data);
230 ret = fn(&td->o, DDIR_TRIM, op, data);
234 ret = fn(&td->o, DDIR_READ, str, data);
240 static int str_bssplit_cb(void *data, const char *input)
242 struct thread_data *td = cb_data_to_td(data);
246 p = str = strdup(input);
248 strip_blank_front(&str);
249 strip_blank_end(str);
251 ret = str_split_parse(td, str, bssplit_ddir, false);
253 if (parse_dryrun()) {
256 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
257 free(td->o.bssplit[i]);
258 td->o.bssplit[i] = NULL;
259 td->o.bssplit_nr[i] = 0;
267 static int str2error(char *str)
269 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
270 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
271 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
272 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
273 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
274 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
275 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
276 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
277 int i = 0, num = sizeof(err) / sizeof(char *);
280 if (!strcmp(err[i], str))
287 static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
294 if (etype >= ERROR_TYPE_CNT) {
295 log_err("Illegal error type\n");
299 td->o.ignore_error_nr[etype] = 4;
300 error = calloc(4, sizeof(int));
303 while ((fname = strsep(&str, ":")) != NULL) {
309 * grow struct buffer, if needed
311 if (i == td->o.ignore_error_nr[etype]) {
312 td->o.ignore_error_nr[etype] <<= 1;
313 error = realloc(error, td->o.ignore_error_nr[etype]
316 if (fname[0] == 'E') {
317 error[i] = str2error(fname);
319 error[i] = atoi(fname);
321 error[i] = -error[i];
324 log_err("Unknown error %s, please use number value\n",
326 td->o.ignore_error_nr[etype] = 0;
333 td->o.continue_on_error |= 1 << etype;
334 td->o.ignore_error_nr[etype] = i;
335 td->o.ignore_error[etype] = error;
337 td->o.ignore_error_nr[etype] = 0;
345 static int str_replay_skip_cb(void *data, const char *input)
347 struct thread_data *td = cb_data_to_td(data);
354 p = str = strdup(input);
356 strip_blank_front(&str);
357 strip_blank_end(str);
363 if (!strcmp(p, "read"))
364 td->o.replay_skip |= 1u << DDIR_READ;
365 else if (!strcmp(p, "write"))
366 td->o.replay_skip |= 1u << DDIR_WRITE;
367 else if (!strcmp(p, "trim"))
368 td->o.replay_skip |= 1u << DDIR_TRIM;
369 else if (!strcmp(p, "sync"))
370 td->o.replay_skip |= 1u << DDIR_SYNC;
372 log_err("Unknown skip type: %s\n", p);
382 static int str_ignore_error_cb(void *data, const char *input)
384 struct thread_data *td = cb_data_to_td(data);
387 enum error_type_bit type = 0;
392 p = str = strdup(input);
394 strip_blank_front(&str);
395 strip_blank_end(str);
401 ret = ignore_error_type(td, type, p);
411 static int str_rw_cb(void *data, const char *str)
413 struct thread_data *td = cb_data_to_td(data);
414 struct thread_options *o = &td->o;
423 nr = get_opt_postfix(str);
428 o->ddir_seq_nr = atoi(nr);
432 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
433 log_err("fio: rw postfix parsing failed\n");
438 o->ddir_seq_add = val;
445 static int str_mem_cb(void *data, const char *mem)
447 struct thread_data *td = cb_data_to_td(data);
449 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
450 td->o.mem_type == MEM_MMAPSHARED)
451 td->o.mmapfile = get_opt_postfix(mem);
456 static int fio_clock_source_cb(void *data, const char *str)
458 struct thread_data *td = cb_data_to_td(data);
460 fio_clock_source = td->o.clocksource;
461 fio_clock_source_set = 1;
466 static int str_rwmix_read_cb(void *data, unsigned long long *val)
468 struct thread_data *td = cb_data_to_td(data);
470 td->o.rwmix[DDIR_READ] = *val;
471 td->o.rwmix[DDIR_WRITE] = 100 - *val;
475 static int str_rwmix_write_cb(void *data, unsigned long long *val)
477 struct thread_data *td = cb_data_to_td(data);
479 td->o.rwmix[DDIR_WRITE] = *val;
480 td->o.rwmix[DDIR_READ] = 100 - *val;
484 static int str_exitall_cb(void)
486 exitall_on_terminate = true;
490 #ifdef FIO_HAVE_CPU_AFFINITY
491 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
493 unsigned int i, index, cpus_in_mask;
494 const long max_cpu = cpus_online();
496 cpus_in_mask = fio_cpu_count(mask);
500 cpu_index = cpu_index % cpus_in_mask;
503 for (i = 0; i < max_cpu; i++) {
504 if (!fio_cpu_isset(mask, i))
507 if (cpu_index != index)
508 fio_cpu_clear(mask, i);
513 return fio_cpu_count(mask);
516 static int str_cpumask_cb(void *data, unsigned long long *val)
518 struct thread_data *td = cb_data_to_td(data);
526 ret = fio_cpuset_init(&td->o.cpumask);
528 log_err("fio: cpuset_init failed\n");
529 td_verror(td, ret, "fio_cpuset_init");
533 max_cpu = cpus_online();
535 for (i = 0; i < sizeof(int) * 8; i++) {
536 if ((1 << i) & *val) {
538 log_err("fio: CPU %d too large (max=%ld)\n", i,
542 dprint(FD_PARSE, "set cpu allowed %d\n", i);
543 fio_cpu_set(&td->o.cpumask, i);
550 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
557 ret = fio_cpuset_init(mask);
559 log_err("fio: cpuset_init failed\n");
560 td_verror(td, ret, "fio_cpuset_init");
564 p = str = strdup(input);
566 strip_blank_front(&str);
567 strip_blank_end(str);
569 max_cpu = cpus_online();
571 while ((cpu = strsep(&str, ",")) != NULL) {
580 while ((cpu2 = strsep(&str2, "-")) != NULL) {
590 while (icpu <= icpu2) {
591 if (icpu >= FIO_MAX_CPUS) {
592 log_err("fio: your OS only supports up to"
593 " %d CPUs\n", (int) FIO_MAX_CPUS);
597 if (icpu >= max_cpu) {
598 log_err("fio: CPU %d too large (max=%ld)\n",
604 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
605 fio_cpu_set(mask, icpu);
616 static int str_cpus_allowed_cb(void *data, const char *input)
618 struct thread_data *td = cb_data_to_td(data);
623 return set_cpus_allowed(td, &td->o.cpumask, input);
626 static int str_verify_cpus_allowed_cb(void *data, const char *input)
628 struct thread_data *td = cb_data_to_td(data);
633 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
637 static int str_log_cpus_allowed_cb(void *data, const char *input)
639 struct thread_data *td = cb_data_to_td(data);
644 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
646 #endif /* CONFIG_ZLIB */
648 #endif /* FIO_HAVE_CPU_AFFINITY */
650 #ifdef CONFIG_LIBNUMA
651 static int str_numa_cpunodes_cb(void *data, char *input)
653 struct thread_data *td = cb_data_to_td(data);
654 struct bitmask *verify_bitmask;
659 /* numa_parse_nodestring() parses a character string list
660 * of nodes into a bit mask. The bit mask is allocated by
661 * numa_allocate_nodemask(), so it should be freed by
662 * numa_free_nodemask().
664 verify_bitmask = numa_parse_nodestring(input);
665 if (verify_bitmask == NULL) {
666 log_err("fio: numa_parse_nodestring failed\n");
667 td_verror(td, 1, "str_numa_cpunodes_cb");
670 numa_free_nodemask(verify_bitmask);
672 td->o.numa_cpunodes = strdup(input);
676 static int str_numa_mpol_cb(void *data, char *input)
678 struct thread_data *td = cb_data_to_td(data);
679 const char * const policy_types[] =
680 { "default", "prefer", "bind", "interleave", "local", NULL };
683 struct bitmask *verify_bitmask;
688 nodelist = strchr(input, ':');
690 /* NUL-terminate mode */
694 for (i = 0; i <= MPOL_LOCAL; i++) {
695 if (!strcmp(input, policy_types[i])) {
696 td->o.numa_mem_mode = i;
700 if (i > MPOL_LOCAL) {
701 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
705 switch (td->o.numa_mem_mode) {
708 * Insist on a nodelist of one node only
711 char *rest = nodelist;
712 while (isdigit(*rest))
715 log_err("fio: one node only for \'prefer\'\n");
719 log_err("fio: one node is needed for \'prefer\'\n");
723 case MPOL_INTERLEAVE:
725 * Default to online nodes with memory if no nodelist
728 nodelist = strdup("all");
733 * Don't allow a nodelist
736 log_err("fio: NO nodelist for \'local\'\n");
742 * Insist on a nodelist
745 log_err("fio: a nodelist is needed for \'bind\'\n");
752 /* numa_parse_nodestring() parses a character string list
753 * of nodes into a bit mask. The bit mask is allocated by
754 * numa_allocate_nodemask(), so it should be freed by
755 * numa_free_nodemask().
757 switch (td->o.numa_mem_mode) {
759 td->o.numa_mem_prefer_node = atoi(nodelist);
761 case MPOL_INTERLEAVE:
763 verify_bitmask = numa_parse_nodestring(nodelist);
764 if (verify_bitmask == NULL) {
765 log_err("fio: numa_parse_nodestring failed\n");
766 td_verror(td, 1, "str_numa_memnodes_cb");
769 td->o.numa_memnodes = strdup(nodelist);
770 numa_free_nodemask(verify_bitmask);
785 static int str_fst_cb(void *data, const char *str)
787 struct thread_data *td = cb_data_to_td(data);
792 td->file_service_nr = 1;
794 switch (td->o.file_service_type) {
795 case FIO_FSERVICE_RANDOM:
796 case FIO_FSERVICE_RR:
797 case FIO_FSERVICE_SEQ:
798 nr = get_opt_postfix(str);
800 td->file_service_nr = atoi(nr);
805 case FIO_FSERVICE_ZIPF:
808 case FIO_FSERVICE_PARETO:
809 val = FIO_DEF_PARETO;
811 case FIO_FSERVICE_GAUSS:
815 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
822 nr = get_opt_postfix(str);
823 if (nr && !str_to_float(nr, &val, 0)) {
824 log_err("fio: file service type random postfix parsing failed\n");
831 switch (td->o.file_service_type) {
832 case FIO_FSERVICE_ZIPF:
834 log_err("fio: zipf theta must be different than 1.0\n");
839 td->zipf_theta = val;
841 case FIO_FSERVICE_PARETO:
842 if (val <= 0.00 || val >= 1.00) {
843 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
850 case FIO_FSERVICE_GAUSS:
851 if (val < 0.00 || val >= 100.00) {
852 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
864 #ifdef CONFIG_SYNC_FILE_RANGE
865 static int str_sfr_cb(void *data, const char *str)
867 struct thread_data *td = cb_data_to_td(data);
868 char *nr = get_opt_postfix(str);
870 td->sync_file_range_nr = 1;
872 td->sync_file_range_nr = atoi(nr);
880 static int zone_split_ddir(struct thread_options *o, enum fio_ddir ddir,
881 char *str, bool absolute)
883 unsigned int i, perc, perc_missing, sperc, sperc_missing;
886 memset(&split, 0, sizeof(split));
888 if (split_parse_ddir(o, &split, str, absolute, ZONESPLIT_MAX))
893 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
894 o->zone_split_nr[ddir] = split.nr;
895 for (i = 0; i < split.nr; i++) {
896 o->zone_split[ddir][i].access_perc = split.val1[i];
898 o->zone_split[ddir][i].size = split.val2[i];
900 o->zone_split[ddir][i].size_perc = split.val2[i];
904 * Now check if the percentages add up, and how much is missing
906 perc = perc_missing = 0;
907 sperc = sperc_missing = 0;
908 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
909 struct zone_split *zsp = &o->zone_split[ddir][i];
911 if (zsp->access_perc == (uint8_t) -1U)
914 perc += zsp->access_perc;
917 if (zsp->size_perc == (uint8_t) -1U)
920 sperc += zsp->size_perc;
924 if (perc > 100 || sperc > 100) {
925 log_err("fio: zone_split percentages add to more than 100%%\n");
926 free(o->zone_split[ddir]);
927 o->zone_split[ddir] = NULL;
931 log_err("fio: access percentage don't add up to 100 for zoned "
932 "random distribution (got=%u)\n", perc);
933 free(o->zone_split[ddir]);
934 o->zone_split[ddir] = NULL;
939 * If values didn't have a percentage set, divide the remains between
943 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
945 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
946 struct zone_split *zsp = &o->zone_split[ddir][i];
948 if (zsp->access_perc == (uint8_t) -1U)
949 zsp->access_perc = (100 - perc) / perc_missing;
953 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
955 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
956 struct zone_split *zsp = &o->zone_split[ddir][i];
958 if (zsp->size_perc == (uint8_t) -1U)
959 zsp->size_perc = (100 - sperc) / sperc_missing;
966 static int parse_zoned_distribution(struct thread_data *td, const char *input,
969 const char *pre = absolute ? "zoned_abs:" : "zoned:";
973 p = str = strdup(input);
975 strip_blank_front(&str);
976 strip_blank_end(str);
978 /* We expect it to start like that, bail if not */
979 if (strncmp(str, pre, strlen(pre))) {
980 log_err("fio: mismatch in zoned input <%s>\n", str);
986 ret = str_split_parse(td, str, zone_split_ddir, absolute);
990 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
993 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
995 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
996 struct zone_split *zsp = &td->o.zone_split[i][j];
999 dprint(FD_PARSE, "\t%d: %u/%llu\n", j,
1001 (unsigned long long) zsp->size);
1003 dprint(FD_PARSE, "\t%d: %u/%u\n", j,
1010 if (parse_dryrun()) {
1011 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1012 free(td->o.zone_split[i]);
1013 td->o.zone_split[i] = NULL;
1014 td->o.zone_split_nr[i] = 0;
1021 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1022 td->o.zone_split_nr[i] = 0;
1028 static int str_random_distribution_cb(void *data, const char *str)
1030 struct thread_data *td = cb_data_to_td(data);
1034 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1036 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1037 val = FIO_DEF_PARETO;
1038 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1040 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1041 return parse_zoned_distribution(td, str, false);
1042 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED_ABS)
1043 return parse_zoned_distribution(td, str, true);
1047 nr = get_opt_postfix(str);
1048 if (nr && !str_to_float(nr, &val, 0)) {
1049 log_err("fio: random postfix parsing failed\n");
1056 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1058 log_err("fio: zipf theta must different than 1.0\n");
1063 td->o.zipf_theta.u.f = val;
1064 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1065 if (val <= 0.00 || val >= 1.00) {
1066 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1071 td->o.pareto_h.u.f = val;
1073 if (val < 0.00 || val >= 100.0) {
1074 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1079 td->o.gauss_dev.u.f = val;
1085 static int str_steadystate_cb(void *data, const char *str)
1087 struct thread_data *td = cb_data_to_td(data);
1093 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1094 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
1095 /* should be impossible to get here */
1096 log_err("fio: unknown steady state criterion\n");
1100 nr = get_opt_postfix(str);
1102 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1107 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1108 pct = strstr(nr, "%");
1111 strip_blank_end(nr);
1112 if (!str_to_float(nr, &val, 0)) {
1113 log_err("fio: could not parse steadystate threshold percentage\n");
1118 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1123 td->o.ss_state |= FIO_SS_PCT;
1124 td->o.ss_limit.u.f = val;
1125 } else if (td->o.ss_state & FIO_SS_IOPS) {
1126 if (!str_to_float(nr, &val, 0)) {
1127 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1132 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1137 td->o.ss_limit.u.f = val;
1138 } else { /* bandwidth criterion */
1139 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1140 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1145 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1150 td->o.ss_limit.u.f = (double) ll;
1153 td->ss.state = td->o.ss_state;
1158 * Return next name in the string. Files are separated with ':'. If the ':'
1159 * is escaped with a '\', then that ':' is part of the filename and does not
1160 * indicate a new file.
1162 char *get_next_str(char **ptr)
1167 if (!str || !strlen(str))
1173 * No colon, we are done
1175 p = strchr(str, ':');
1182 * We got a colon, but it's the first character. Skip and
1190 if (*(p - 1) != '\\') {
1196 memmove(p - 1, p, strlen(p) + 1);
1204 int get_max_str_idx(char *input)
1206 unsigned int cur_idx;
1209 p = str = strdup(input);
1210 for (cur_idx = 0; ; cur_idx++)
1211 if (get_next_str(&str) == NULL)
1219 * Returns the directory at the index, indexes > entires will be
1220 * assigned via modulo division of the index
1222 int set_name_idx(char *target, size_t tlen, char *input, int index,
1223 bool unique_filename)
1225 unsigned int cur_idx;
1227 char *fname, *str, *p;
1229 p = str = strdup(input);
1231 index %= get_max_str_idx(input);
1232 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1233 fname = get_next_str(&str);
1235 if (client_sockaddr_str[0] && unique_filename) {
1236 len = snprintf(target, tlen, "%s/%s.", fname,
1237 client_sockaddr_str);
1239 len = snprintf(target, tlen, "%s%c", fname,
1240 FIO_OS_PATH_SEPARATOR);
1242 target[tlen - 1] = '\0';
1248 char* get_name_by_idx(char *input, int index)
1250 unsigned int cur_idx;
1251 char *fname, *str, *p;
1253 p = str = strdup(input);
1255 index %= get_max_str_idx(input);
1256 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1257 fname = get_next_str(&str);
1259 fname = strdup(fname);
1265 static int str_filename_cb(void *data, const char *input)
1267 struct thread_data *td = cb_data_to_td(data);
1268 char *fname, *str, *p;
1270 p = str = strdup(input);
1272 strip_blank_front(&str);
1273 strip_blank_end(str);
1276 * Ignore what we may already have from nrfiles option.
1278 if (!td->files_index)
1281 while ((fname = get_next_str(&str)) != NULL) {
1284 add_file(td, fname, 0, 1);
1291 static int str_directory_cb(void *data, const char fio_unused *unused)
1293 struct thread_data *td = cb_data_to_td(data);
1295 char *dirname, *str, *p;
1301 p = str = strdup(td->o.directory);
1302 while ((dirname = get_next_str(&str)) != NULL) {
1303 if (lstat(dirname, &sb) < 0) {
1306 log_err("fio: %s is not a directory\n", dirname);
1307 td_verror(td, ret, "lstat");
1310 if (!S_ISDIR(sb.st_mode)) {
1311 log_err("fio: %s is not a directory\n", dirname);
1322 static int str_opendir_cb(void *data, const char fio_unused *str)
1324 struct thread_data *td = cb_data_to_td(data);
1329 if (!td->files_index)
1332 return add_dir_files(td, td->o.opendir);
1335 static int str_buffer_pattern_cb(void *data, const char *input)
1337 struct thread_data *td = cb_data_to_td(data);
1340 /* FIXME: for now buffer pattern does not support formats */
1341 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
1342 MAX_PATTERN_SIZE, NULL, 0, NULL, NULL);
1347 td->o.buffer_pattern_bytes = ret;
1350 * If this job is doing any reading or has compression set,
1351 * ensure that we refill buffers for writes or we could be
1352 * invalidating the pattern through reads.
1354 if (!td->o.compress_percentage && !td_read(td))
1355 td->o.refill_buffers = 0;
1357 td->o.refill_buffers = 1;
1359 td->o.scramble_buffers = 0;
1360 td->o.zero_buffers = 0;
1365 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1367 struct thread_data *td = cb_data_to_td(data);
1369 td->flags |= TD_F_COMPRESS;
1370 td->o.compress_percentage = *il;
1374 static int str_dedupe_cb(void *data, unsigned long long *il)
1376 struct thread_data *td = cb_data_to_td(data);
1378 td->flags |= TD_F_COMPRESS;
1379 td->o.dedupe_percentage = *il;
1380 td->o.refill_buffers = 1;
1384 static int str_verify_pattern_cb(void *data, const char *input)
1386 struct thread_data *td = cb_data_to_td(data);
1389 td->o.verify_fmt_sz = ARRAY_SIZE(td->o.verify_fmt);
1390 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
1391 MAX_PATTERN_SIZE, fmt_desc, sizeof(fmt_desc),
1392 td->o.verify_fmt, &td->o.verify_fmt_sz);
1397 td->o.verify_pattern_bytes = ret;
1399 * VERIFY_* could already be set
1401 if (!fio_option_is_set(&td->o, verify))
1402 td->o.verify = VERIFY_PATTERN;
1407 static int str_gtod_reduce_cb(void *data, int *il)
1409 struct thread_data *td = cb_data_to_td(data);
1413 * Only modfiy options if gtod_reduce==1
1414 * Otherwise leave settings alone.
1417 td->o.disable_lat = 1;
1418 td->o.disable_clat = 1;
1419 td->o.disable_slat = 1;
1420 td->o.disable_bw = 1;
1421 td->o.clat_percentiles = 0;
1422 td->o.lat_percentiles = 0;
1423 td->o.slat_percentiles = 0;
1424 td->ts_cache_mask = 63;
1430 static int str_offset_cb(void *data, unsigned long long *__val)
1432 struct thread_data *td = cb_data_to_td(data);
1433 unsigned long long v = *__val;
1435 if (parse_is_percent(v)) {
1436 td->o.start_offset = 0;
1437 td->o.start_offset_percent = -1ULL - v;
1438 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1439 td->o.start_offset_percent);
1441 td->o.start_offset = v;
1446 static int str_offset_increment_cb(void *data, unsigned long long *__val)
1448 struct thread_data *td = cb_data_to_td(data);
1449 unsigned long long v = *__val;
1451 if (parse_is_percent(v)) {
1452 td->o.offset_increment = 0;
1453 td->o.offset_increment_percent = -1ULL - v;
1454 dprint(FD_PARSE, "SET offset_increment_percent %d\n",
1455 td->o.offset_increment_percent);
1457 td->o.offset_increment = v;
1462 static int str_size_cb(void *data, unsigned long long *__val)
1464 struct thread_data *td = cb_data_to_td(data);
1465 unsigned long long v = *__val;
1467 if (parse_is_percent(v)) {
1469 td->o.size_percent = -1ULL - v;
1470 dprint(FD_PARSE, "SET size_percent %d\n",
1471 td->o.size_percent);
1478 static int str_write_bw_log_cb(void *data, const char *str)
1480 struct thread_data *td = cb_data_to_td(data);
1483 td->o.bw_log_file = strdup(str);
1485 td->o.write_bw_log = 1;
1489 static int str_write_lat_log_cb(void *data, const char *str)
1491 struct thread_data *td = cb_data_to_td(data);
1494 td->o.lat_log_file = strdup(str);
1496 td->o.write_lat_log = 1;
1500 static int str_write_iops_log_cb(void *data, const char *str)
1502 struct thread_data *td = cb_data_to_td(data);
1505 td->o.iops_log_file = strdup(str);
1507 td->o.write_iops_log = 1;
1511 static int str_write_hist_log_cb(void *data, const char *str)
1513 struct thread_data *td = cb_data_to_td(data);
1516 td->o.hist_log_file = strdup(str);
1518 td->o.write_hist_log = 1;
1523 * str is supposed to be a substring of the strdup'd original string,
1524 * and is valid only if it's a regular file path.
1525 * This function keeps the pointer to the path as needed later.
1527 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1528 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1529 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1531 static int str_ioengine_external_cb(void *data, const char *str)
1533 struct thread_data *td = cb_data_to_td(data);
1538 log_err("fio: null external ioengine path\n");
1542 p = (char *)str; /* str is mutable */
1543 strip_blank_front(&p);
1546 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1547 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1551 td->o.ioengine_so_path = p;
1555 static int rw_verify(const struct fio_option *o, void *data)
1557 struct thread_data *td = cb_data_to_td(data);
1559 if (read_only && (td_write(td) || td_trim(td))) {
1560 log_err("fio: job <%s> has write or trim bit set, but"
1561 " fio is in read-only mode\n", td->o.name);
1568 static int gtod_cpu_verify(const struct fio_option *o, void *data)
1570 #ifndef FIO_HAVE_CPU_AFFINITY
1571 struct thread_data *td = cb_data_to_td(data);
1573 if (td->o.gtod_cpu) {
1574 log_err("fio: platform must support CPU affinity for"
1575 "gettimeofday() offloading\n");
1584 * Map of job/command line options
1586 struct fio_option fio_options[FIO_MAX_OPTS] = {
1588 .name = "description",
1589 .lname = "Description of job",
1590 .type = FIO_OPT_STR_STORE,
1591 .off1 = offsetof(struct thread_options, description),
1592 .help = "Text job description",
1593 .category = FIO_OPT_C_GENERAL,
1594 .group = FIO_OPT_G_DESC,
1598 .lname = "Job name",
1599 .type = FIO_OPT_STR_STORE,
1600 .off1 = offsetof(struct thread_options, name),
1601 .help = "Name of this job",
1602 .category = FIO_OPT_C_GENERAL,
1603 .group = FIO_OPT_G_DESC,
1607 .lname = "Waitee name",
1608 .type = FIO_OPT_STR_STORE,
1609 .off1 = offsetof(struct thread_options, wait_for),
1610 .help = "Name of the job this one wants to wait for before starting",
1611 .category = FIO_OPT_C_GENERAL,
1612 .group = FIO_OPT_G_DESC,
1616 .lname = "Filename(s)",
1617 .type = FIO_OPT_STR_STORE,
1618 .off1 = offsetof(struct thread_options, filename),
1619 .cb = str_filename_cb,
1620 .prio = -1, /* must come after "directory" */
1621 .help = "File(s) to use for the workload",
1622 .category = FIO_OPT_C_FILE,
1623 .group = FIO_OPT_G_FILENAME,
1626 .name = "directory",
1627 .lname = "Directory",
1628 .type = FIO_OPT_STR_STORE,
1629 .off1 = offsetof(struct thread_options, directory),
1630 .cb = str_directory_cb,
1631 .help = "Directory to store files in",
1632 .category = FIO_OPT_C_FILE,
1633 .group = FIO_OPT_G_FILENAME,
1636 .name = "filename_format",
1637 .lname = "Filename Format",
1638 .type = FIO_OPT_STR_STORE,
1639 .off1 = offsetof(struct thread_options, filename_format),
1640 .prio = -1, /* must come after "directory" */
1641 .help = "Override default $jobname.$jobnum.$filenum naming",
1642 .def = "$jobname.$jobnum.$filenum",
1643 .category = FIO_OPT_C_FILE,
1644 .group = FIO_OPT_G_FILENAME,
1647 .name = "unique_filename",
1648 .lname = "Unique Filename",
1649 .type = FIO_OPT_BOOL,
1650 .off1 = offsetof(struct thread_options, unique_filename),
1651 .help = "For network clients, prefix file with source IP",
1653 .category = FIO_OPT_C_FILE,
1654 .group = FIO_OPT_G_FILENAME,
1658 .lname = "Lockfile",
1659 .type = FIO_OPT_STR,
1660 .off1 = offsetof(struct thread_options, file_lock_mode),
1661 .help = "Lock file when doing IO to it",
1663 .parent = "filename",
1666 .category = FIO_OPT_C_FILE,
1667 .group = FIO_OPT_G_FILENAME,
1670 .oval = FILE_LOCK_NONE,
1671 .help = "No file locking",
1673 { .ival = "exclusive",
1674 .oval = FILE_LOCK_EXCLUSIVE,
1675 .help = "Exclusive file lock",
1678 .ival = "readwrite",
1679 .oval = FILE_LOCK_READWRITE,
1680 .help = "Read vs write lock",
1686 .lname = "Open directory",
1687 .type = FIO_OPT_STR_STORE,
1688 .off1 = offsetof(struct thread_options, opendir),
1689 .cb = str_opendir_cb,
1690 .help = "Recursively add files from this directory and down",
1691 .category = FIO_OPT_C_FILE,
1692 .group = FIO_OPT_G_FILENAME,
1696 .lname = "Read/write",
1697 .alias = "readwrite",
1698 .type = FIO_OPT_STR,
1700 .off1 = offsetof(struct thread_options, td_ddir),
1701 .help = "IO direction",
1703 .verify = rw_verify,
1704 .category = FIO_OPT_C_IO,
1705 .group = FIO_OPT_G_IO_BASIC,
1708 .oval = TD_DDIR_READ,
1709 .help = "Sequential read",
1712 .oval = TD_DDIR_WRITE,
1713 .help = "Sequential write",
1716 .oval = TD_DDIR_TRIM,
1717 .help = "Sequential trim",
1719 { .ival = "randread",
1720 .oval = TD_DDIR_RANDREAD,
1721 .help = "Random read",
1723 { .ival = "randwrite",
1724 .oval = TD_DDIR_RANDWRITE,
1725 .help = "Random write",
1727 { .ival = "randtrim",
1728 .oval = TD_DDIR_RANDTRIM,
1729 .help = "Random trim",
1733 .help = "Sequential read and write mix",
1735 { .ival = "readwrite",
1737 .help = "Sequential read and write mix",
1740 .oval = TD_DDIR_RANDRW,
1741 .help = "Random read and write mix"
1743 { .ival = "trimwrite",
1744 .oval = TD_DDIR_TRIMWRITE,
1745 .help = "Trim and write mix, trims preceding writes"
1750 .name = "rw_sequencer",
1751 .lname = "RW Sequencer",
1752 .type = FIO_OPT_STR,
1753 .off1 = offsetof(struct thread_options, rw_seq),
1754 .help = "IO offset generator modifier",
1755 .def = "sequential",
1756 .category = FIO_OPT_C_IO,
1757 .group = FIO_OPT_G_IO_BASIC,
1759 { .ival = "sequential",
1761 .help = "Generate sequential offsets",
1763 { .ival = "identical",
1764 .oval = RW_SEQ_IDENT,
1765 .help = "Generate identical offsets",
1772 .lname = "IO Engine",
1773 .type = FIO_OPT_STR_STORE,
1774 .off1 = offsetof(struct thread_options, ioengine),
1775 .help = "IO engine to use",
1776 .def = FIO_PREFERRED_ENGINE,
1777 .category = FIO_OPT_C_IO,
1778 .group = FIO_OPT_G_IO_BASIC,
1781 .help = "Use read/write",
1784 .help = "Use pread/pwrite",
1787 .help = "Use readv/writev",
1789 #ifdef CONFIG_PWRITEV
1791 .help = "Use preadv/pwritev",
1794 #ifdef FIO_HAVE_PWRITEV2
1795 { .ival = "pvsync2",
1796 .help = "Use preadv2/pwritev2",
1799 #ifdef CONFIG_LIBAIO
1801 .help = "Linux native asynchronous IO",
1804 #ifdef ARCH_HAVE_IOURING
1805 { .ival = "io_uring",
1806 .help = "Fast Linux native aio",
1809 #ifdef CONFIG_POSIXAIO
1810 { .ival = "posixaio",
1811 .help = "POSIX asynchronous IO",
1814 #ifdef CONFIG_SOLARISAIO
1815 { .ival = "solarisaio",
1816 .help = "Solaris native asynchronous IO",
1819 #ifdef CONFIG_WINDOWSAIO
1820 { .ival = "windowsaio",
1821 .help = "Windows native asynchronous IO"
1826 .help = "Rados Block Device asynchronous IO"
1830 .help = "Memory mapped IO"
1832 #ifdef CONFIG_LINUX_SPLICE
1834 .help = "splice/vmsplice based IO",
1836 { .ival = "netsplice",
1837 .help = "splice/vmsplice to/from the network",
1840 #ifdef FIO_HAVE_SGIO
1842 .help = "SCSI generic v3 IO",
1846 .help = "Testing engine (no data transfer)",
1849 .help = "Network IO",
1852 .help = "CPU cycle burner engine",
1856 .help = "GUASI IO engine",
1861 .help = "RDMA IO engine",
1864 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1865 { .ival = "e4defrag",
1866 .help = "ext4 defrag engine",
1869 #ifdef CONFIG_LINUX_FALLOCATE
1871 .help = "fallocate() file based engine",
1876 .help = "Glusterfs libgfapi(sync) based engine"
1878 { .ival = "gfapi_async",
1879 .help = "Glusterfs libgfapi(async) based engine"
1882 #ifdef CONFIG_LIBHDFS
1883 { .ival = "libhdfs",
1884 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1887 #ifdef CONFIG_PMEMBLK
1888 { .ival = "pmemblk",
1889 .help = "PMDK libpmemblk based IO engine",
1894 { .ival = "ime_psync",
1895 .help = "DDN's IME synchronous IO engine",
1897 { .ival = "ime_psyncv",
1898 .help = "DDN's IME synchronous IO engine using iovecs",
1900 { .ival = "ime_aio",
1901 .help = "DDN's IME asynchronous IO engine",
1904 #ifdef CONFIG_LINUX_DEVDAX
1905 { .ival = "dev-dax",
1906 .help = "DAX Device based IO engine",
1910 .ival = "filecreate",
1911 .help = "File creation engine",
1913 { .ival = "external",
1914 .help = "Load external engine (append name)",
1915 .cb = str_ioengine_external_cb,
1917 #ifdef CONFIG_LIBPMEM
1918 { .ival = "libpmem",
1919 .help = "PMDK libpmem based IO engine",
1924 .help = "HTTP (WebDAV/S3) IO engine",
1928 .help = "Network Block Device (NBD) IO engine"
1934 .lname = "IO Depth",
1935 .type = FIO_OPT_INT,
1936 .off1 = offsetof(struct thread_options, iodepth),
1937 .help = "Number of IO buffers to keep in flight",
1941 .category = FIO_OPT_C_IO,
1942 .group = FIO_OPT_G_IO_BASIC,
1945 .name = "iodepth_batch",
1946 .lname = "IO Depth batch",
1947 .alias = "iodepth_batch_submit",
1948 .type = FIO_OPT_INT,
1949 .off1 = offsetof(struct thread_options, iodepth_batch),
1950 .help = "Number of IO buffers to submit in one go",
1951 .parent = "iodepth",
1955 .category = FIO_OPT_C_IO,
1956 .group = FIO_OPT_G_IO_BASIC,
1959 .name = "iodepth_batch_complete_min",
1960 .lname = "Min IO depth batch complete",
1961 .alias = "iodepth_batch_complete",
1962 .type = FIO_OPT_INT,
1963 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
1964 .help = "Min number of IO buffers to retrieve in one go",
1965 .parent = "iodepth",
1970 .category = FIO_OPT_C_IO,
1971 .group = FIO_OPT_G_IO_BASIC,
1974 .name = "iodepth_batch_complete_max",
1975 .lname = "Max IO depth batch complete",
1976 .type = FIO_OPT_INT,
1977 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
1978 .help = "Max number of IO buffers to retrieve in one go",
1979 .parent = "iodepth",
1983 .category = FIO_OPT_C_IO,
1984 .group = FIO_OPT_G_IO_BASIC,
1987 .name = "iodepth_low",
1988 .lname = "IO Depth batch low",
1989 .type = FIO_OPT_INT,
1990 .off1 = offsetof(struct thread_options, iodepth_low),
1991 .help = "Low water mark for queuing depth",
1992 .parent = "iodepth",
1995 .category = FIO_OPT_C_IO,
1996 .group = FIO_OPT_G_IO_BASIC,
1999 .name = "serialize_overlap",
2000 .lname = "Serialize overlap",
2001 .off1 = offsetof(struct thread_options, serialize_overlap),
2002 .type = FIO_OPT_BOOL,
2003 .help = "Wait for in-flight IOs that collide to complete",
2004 .parent = "iodepth",
2006 .category = FIO_OPT_C_IO,
2007 .group = FIO_OPT_G_IO_BASIC,
2010 .name = "io_submit_mode",
2011 .lname = "IO submit mode",
2012 .type = FIO_OPT_STR,
2013 .off1 = offsetof(struct thread_options, io_submit_mode),
2014 .help = "How IO submissions and completions are done",
2016 .category = FIO_OPT_C_IO,
2017 .group = FIO_OPT_G_IO_BASIC,
2020 .oval = IO_MODE_INLINE,
2021 .help = "Submit and complete IO inline",
2023 { .ival = "offload",
2024 .oval = IO_MODE_OFFLOAD,
2025 .help = "Offload submit and complete to threads",
2032 .type = FIO_OPT_STR_VAL,
2034 .off1 = offsetof(struct thread_options, size),
2035 .help = "Total size of device or files",
2036 .interval = 1024 * 1024,
2037 .category = FIO_OPT_C_IO,
2038 .group = FIO_OPT_G_INVALID,
2042 .alias = "io_limit",
2044 .type = FIO_OPT_STR_VAL,
2045 .off1 = offsetof(struct thread_options, io_size),
2046 .help = "Total size of I/O to be performed",
2047 .interval = 1024 * 1024,
2048 .category = FIO_OPT_C_IO,
2049 .group = FIO_OPT_G_INVALID,
2052 .name = "fill_device",
2053 .lname = "Fill device",
2055 .type = FIO_OPT_BOOL,
2056 .off1 = offsetof(struct thread_options, fill_device),
2057 .help = "Write until an ENOSPC error occurs",
2059 .category = FIO_OPT_C_FILE,
2060 .group = FIO_OPT_G_INVALID,
2064 .lname = "File size",
2065 .type = FIO_OPT_STR_VAL,
2066 .off1 = offsetof(struct thread_options, file_size_low),
2067 .off2 = offsetof(struct thread_options, file_size_high),
2069 .help = "Size of individual files",
2070 .interval = 1024 * 1024,
2071 .category = FIO_OPT_C_FILE,
2072 .group = FIO_OPT_G_INVALID,
2075 .name = "file_append",
2076 .lname = "File append",
2077 .type = FIO_OPT_BOOL,
2078 .off1 = offsetof(struct thread_options, file_append),
2079 .help = "IO will start at the end of the file(s)",
2081 .category = FIO_OPT_C_FILE,
2082 .group = FIO_OPT_G_INVALID,
2086 .lname = "IO offset",
2087 .alias = "fileoffset",
2088 .type = FIO_OPT_STR_VAL,
2089 .cb = str_offset_cb,
2090 .off1 = offsetof(struct thread_options, start_offset),
2091 .help = "Start IO from this offset",
2093 .interval = 1024 * 1024,
2094 .category = FIO_OPT_C_IO,
2095 .group = FIO_OPT_G_INVALID,
2098 .name = "offset_align",
2099 .lname = "IO offset alignment",
2100 .type = FIO_OPT_INT,
2101 .off1 = offsetof(struct thread_options, start_offset_align),
2102 .help = "Start IO from this offset alignment",
2105 .category = FIO_OPT_C_IO,
2106 .group = FIO_OPT_G_INVALID,
2109 .name = "offset_increment",
2110 .lname = "IO offset increment",
2111 .type = FIO_OPT_STR_VAL,
2112 .cb = str_offset_increment_cb,
2113 .off1 = offsetof(struct thread_options, offset_increment),
2114 .help = "What is the increment from one offset to the next",
2118 .interval = 1024 * 1024,
2119 .category = FIO_OPT_C_IO,
2120 .group = FIO_OPT_G_INVALID,
2123 .name = "number_ios",
2124 .lname = "Number of IOs to perform",
2125 .type = FIO_OPT_STR_VAL,
2126 .off1 = offsetof(struct thread_options, number_ios),
2127 .help = "Force job completion after this number of IOs",
2129 .category = FIO_OPT_C_IO,
2130 .group = FIO_OPT_G_INVALID,
2134 .lname = "Block size",
2135 .alias = "blocksize",
2136 .type = FIO_OPT_ULL,
2137 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2138 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2139 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2141 .help = "Block size unit",
2146 .category = FIO_OPT_C_IO,
2147 .group = FIO_OPT_G_INVALID,
2151 .lname = "Block size align",
2152 .alias = "blockalign",
2153 .type = FIO_OPT_ULL,
2154 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2155 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2156 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2158 .help = "IO block offset alignment",
2162 .category = FIO_OPT_C_IO,
2163 .group = FIO_OPT_G_INVALID,
2167 .lname = "Block size range",
2168 .alias = "blocksize_range",
2169 .type = FIO_OPT_RANGE,
2170 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2171 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2172 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2173 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2174 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2175 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2177 .help = "Set block size range (in more detail than bs)",
2181 .category = FIO_OPT_C_IO,
2182 .group = FIO_OPT_G_INVALID,
2186 .lname = "Block size split",
2187 .type = FIO_OPT_STR_ULL,
2188 .cb = str_bssplit_cb,
2189 .off1 = offsetof(struct thread_options, bssplit),
2190 .help = "Set a specific mix of block sizes",
2193 .category = FIO_OPT_C_IO,
2194 .group = FIO_OPT_G_INVALID,
2197 .name = "bs_unaligned",
2198 .lname = "Block size unaligned",
2199 .alias = "blocksize_unaligned",
2200 .type = FIO_OPT_STR_SET,
2201 .off1 = offsetof(struct thread_options, bs_unaligned),
2202 .help = "Don't sector align IO buffer sizes",
2205 .category = FIO_OPT_C_IO,
2206 .group = FIO_OPT_G_INVALID,
2209 .name = "bs_is_seq_rand",
2210 .lname = "Block size division is seq/random (not read/write)",
2211 .type = FIO_OPT_BOOL,
2212 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2213 .help = "Consider any blocksize setting to be sequential,random",
2215 .parent = "blocksize",
2216 .category = FIO_OPT_C_IO,
2217 .group = FIO_OPT_G_INVALID,
2220 .name = "randrepeat",
2221 .lname = "Random repeatable",
2222 .type = FIO_OPT_BOOL,
2223 .off1 = offsetof(struct thread_options, rand_repeatable),
2224 .help = "Use repeatable random IO pattern",
2228 .category = FIO_OPT_C_IO,
2229 .group = FIO_OPT_G_RANDOM,
2233 .lname = "The random generator seed",
2234 .type = FIO_OPT_STR_VAL,
2235 .off1 = offsetof(struct thread_options, rand_seed),
2236 .help = "Set the random generator seed value",
2239 .category = FIO_OPT_C_IO,
2240 .group = FIO_OPT_G_RANDOM,
2243 .name = "norandommap",
2244 .lname = "No randommap",
2245 .type = FIO_OPT_STR_SET,
2246 .off1 = offsetof(struct thread_options, norandommap),
2247 .help = "Accept potential duplicate random blocks",
2251 .category = FIO_OPT_C_IO,
2252 .group = FIO_OPT_G_RANDOM,
2255 .name = "softrandommap",
2256 .lname = "Soft randommap",
2257 .type = FIO_OPT_BOOL,
2258 .off1 = offsetof(struct thread_options, softrandommap),
2259 .help = "Set norandommap if randommap allocation fails",
2260 .parent = "norandommap",
2263 .category = FIO_OPT_C_IO,
2264 .group = FIO_OPT_G_RANDOM,
2267 .name = "random_generator",
2268 .lname = "Random Generator",
2269 .type = FIO_OPT_STR,
2270 .off1 = offsetof(struct thread_options, random_generator),
2271 .help = "Type of random number generator to use",
2272 .def = "tausworthe",
2274 { .ival = "tausworthe",
2275 .oval = FIO_RAND_GEN_TAUSWORTHE,
2276 .help = "Strong Tausworthe generator",
2279 .oval = FIO_RAND_GEN_LFSR,
2280 .help = "Variable length LFSR",
2283 .ival = "tausworthe64",
2284 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2285 .help = "64-bit Tausworthe variant",
2288 .category = FIO_OPT_C_IO,
2289 .group = FIO_OPT_G_RANDOM,
2292 .name = "random_distribution",
2293 .lname = "Random Distribution",
2294 .type = FIO_OPT_STR,
2295 .off1 = offsetof(struct thread_options, random_distribution),
2296 .cb = str_random_distribution_cb,
2297 .help = "Random offset distribution generator",
2301 .oval = FIO_RAND_DIST_RANDOM,
2302 .help = "Completely random",
2305 .oval = FIO_RAND_DIST_ZIPF,
2306 .help = "Zipf distribution",
2309 .oval = FIO_RAND_DIST_PARETO,
2310 .help = "Pareto distribution",
2313 .oval = FIO_RAND_DIST_GAUSS,
2314 .help = "Normal (Gaussian) distribution",
2317 .oval = FIO_RAND_DIST_ZONED,
2318 .help = "Zoned random distribution",
2320 { .ival = "zoned_abs",
2321 .oval = FIO_RAND_DIST_ZONED_ABS,
2322 .help = "Zoned absolute random distribution",
2325 .category = FIO_OPT_C_IO,
2326 .group = FIO_OPT_G_RANDOM,
2329 .name = "percentage_random",
2330 .lname = "Percentage Random",
2331 .type = FIO_OPT_INT,
2332 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2333 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2334 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2336 .help = "Percentage of seq/random mix that should be random",
2337 .def = "100,100,100",
2339 .inverse = "percentage_sequential",
2340 .category = FIO_OPT_C_IO,
2341 .group = FIO_OPT_G_RANDOM,
2344 .name = "percentage_sequential",
2345 .lname = "Percentage Sequential",
2346 .type = FIO_OPT_DEPRECATED,
2347 .category = FIO_OPT_C_IO,
2348 .group = FIO_OPT_G_RANDOM,
2351 .name = "allrandrepeat",
2352 .lname = "All Random Repeat",
2353 .type = FIO_OPT_BOOL,
2354 .off1 = offsetof(struct thread_options, allrand_repeatable),
2355 .help = "Use repeatable random numbers for everything",
2357 .category = FIO_OPT_C_IO,
2358 .group = FIO_OPT_G_RANDOM,
2362 .lname = "Number of files",
2363 .alias = "nr_files",
2364 .type = FIO_OPT_INT,
2365 .off1 = offsetof(struct thread_options, nr_files),
2366 .help = "Split job workload between this number of files",
2369 .category = FIO_OPT_C_FILE,
2370 .group = FIO_OPT_G_INVALID,
2373 .name = "openfiles",
2374 .lname = "Number of open files",
2375 .type = FIO_OPT_INT,
2376 .off1 = offsetof(struct thread_options, open_files),
2377 .help = "Number of files to keep open at the same time",
2378 .category = FIO_OPT_C_FILE,
2379 .group = FIO_OPT_G_INVALID,
2382 .name = "file_service_type",
2383 .lname = "File service type",
2384 .type = FIO_OPT_STR,
2386 .off1 = offsetof(struct thread_options, file_service_type),
2387 .help = "How to select which file to service next",
2388 .def = "roundrobin",
2389 .category = FIO_OPT_C_FILE,
2390 .group = FIO_OPT_G_INVALID,
2393 .oval = FIO_FSERVICE_RANDOM,
2394 .help = "Choose a file at random (uniform)",
2397 .oval = FIO_FSERVICE_ZIPF,
2398 .help = "Zipf randomized",
2401 .oval = FIO_FSERVICE_PARETO,
2402 .help = "Pareto randomized",
2405 .oval = FIO_FSERVICE_GAUSS,
2406 .help = "Normal (Gaussian) randomized",
2409 .oval = FIO_FSERVICE_GAUSS,
2410 .help = "Alias for normal",
2412 { .ival = "roundrobin",
2413 .oval = FIO_FSERVICE_RR,
2414 .help = "Round robin select files",
2416 { .ival = "sequential",
2417 .oval = FIO_FSERVICE_SEQ,
2418 .help = "Finish one file before moving to the next",
2421 .parent = "nrfiles",
2425 .name = "fallocate",
2426 .lname = "Fallocate",
2427 .type = FIO_OPT_STR,
2428 .off1 = offsetof(struct thread_options, fallocate_mode),
2429 .help = "Whether pre-allocation is performed when laying out files",
2430 #ifdef FIO_HAVE_DEFAULT_FALLOCATE
2435 .category = FIO_OPT_C_FILE,
2436 .group = FIO_OPT_G_INVALID,
2439 .oval = FIO_FALLOCATE_NONE,
2440 .help = "Do not pre-allocate space",
2443 .oval = FIO_FALLOCATE_NATIVE,
2444 .help = "Use native pre-allocation if possible",
2446 #ifdef CONFIG_POSIX_FALLOCATE
2448 .oval = FIO_FALLOCATE_POSIX,
2449 .help = "Use posix_fallocate()",
2452 #ifdef CONFIG_LINUX_FALLOCATE
2454 .oval = FIO_FALLOCATE_KEEP_SIZE,
2455 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2458 { .ival = "truncate",
2459 .oval = FIO_FALLOCATE_TRUNCATE,
2460 .help = "Truncate file to final size instead of allocating"
2462 /* Compatibility with former boolean values */
2464 .oval = FIO_FALLOCATE_NONE,
2465 .help = "Alias for 'none'",
2467 #ifdef CONFIG_POSIX_FALLOCATE
2469 .oval = FIO_FALLOCATE_POSIX,
2470 .help = "Alias for 'posix'",
2476 .name = "fadvise_hint",
2477 .lname = "Fadvise hint",
2478 .type = FIO_OPT_STR,
2479 .off1 = offsetof(struct thread_options, fadvise_hint),
2483 .help = "Don't issue fadvise/madvise",
2487 .help = "Advise using fio IO pattern",
2490 .oval = F_ADV_RANDOM,
2491 .help = "Advise using FADV_RANDOM",
2493 { .ival = "sequential",
2494 .oval = F_ADV_SEQUENTIAL,
2495 .help = "Advise using FADV_SEQUENTIAL",
2498 .help = "Use fadvise() to advise the kernel on IO pattern",
2500 .category = FIO_OPT_C_FILE,
2501 .group = FIO_OPT_G_INVALID,
2506 .type = FIO_OPT_INT,
2507 .off1 = offsetof(struct thread_options, fsync_blocks),
2508 .help = "Issue fsync for writes every given number of blocks",
2511 .category = FIO_OPT_C_FILE,
2512 .group = FIO_OPT_G_INVALID,
2515 .name = "fdatasync",
2516 .lname = "Fdatasync",
2517 .type = FIO_OPT_INT,
2518 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2519 .help = "Issue fdatasync for writes every given number of blocks",
2522 .category = FIO_OPT_C_FILE,
2523 .group = FIO_OPT_G_INVALID,
2526 .name = "write_barrier",
2527 .lname = "Write barrier",
2528 .type = FIO_OPT_INT,
2529 .off1 = offsetof(struct thread_options, barrier_blocks),
2530 .help = "Make every Nth write a barrier write",
2533 .category = FIO_OPT_C_IO,
2534 .group = FIO_OPT_G_INVALID,
2536 #ifdef CONFIG_SYNC_FILE_RANGE
2538 .name = "sync_file_range",
2539 .lname = "Sync file range",
2541 { .ival = "wait_before",
2542 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2543 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2547 .oval = SYNC_FILE_RANGE_WRITE,
2548 .help = "SYNC_FILE_RANGE_WRITE",
2552 .ival = "wait_after",
2553 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2554 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2558 .type = FIO_OPT_STR_MULTI,
2560 .off1 = offsetof(struct thread_options, sync_file_range),
2561 .help = "Use sync_file_range()",
2562 .category = FIO_OPT_C_FILE,
2563 .group = FIO_OPT_G_INVALID,
2567 .name = "sync_file_range",
2568 .lname = "Sync file range",
2569 .type = FIO_OPT_UNSUPPORTED,
2570 .help = "Your platform does not support sync_file_range",
2575 .lname = "Direct I/O",
2576 .type = FIO_OPT_BOOL,
2577 .off1 = offsetof(struct thread_options, odirect),
2578 .help = "Use O_DIRECT IO (negates buffered)",
2580 .inverse = "buffered",
2581 .category = FIO_OPT_C_IO,
2582 .group = FIO_OPT_G_IO_TYPE,
2586 .lname = "Atomic I/O",
2587 .type = FIO_OPT_BOOL,
2588 .off1 = offsetof(struct thread_options, oatomic),
2589 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2591 .category = FIO_OPT_C_IO,
2592 .group = FIO_OPT_G_IO_TYPE,
2596 .lname = "Buffered I/O",
2597 .type = FIO_OPT_BOOL,
2598 .off1 = offsetof(struct thread_options, odirect),
2600 .help = "Use buffered IO (negates direct)",
2602 .inverse = "direct",
2603 .category = FIO_OPT_C_IO,
2604 .group = FIO_OPT_G_IO_TYPE,
2607 .name = "overwrite",
2608 .lname = "Overwrite",
2609 .type = FIO_OPT_BOOL,
2610 .off1 = offsetof(struct thread_options, overwrite),
2611 .help = "When writing, set whether to overwrite current data",
2613 .category = FIO_OPT_C_FILE,
2614 .group = FIO_OPT_G_INVALID,
2619 .type = FIO_OPT_INT,
2620 .off1 = offsetof(struct thread_options, loops),
2621 .help = "Number of times to run the job",
2624 .category = FIO_OPT_C_GENERAL,
2625 .group = FIO_OPT_G_RUNTIME,
2629 .lname = "Number of jobs",
2630 .type = FIO_OPT_INT,
2631 .off1 = offsetof(struct thread_options, numjobs),
2632 .help = "Duplicate this job this many times",
2635 .category = FIO_OPT_C_GENERAL,
2636 .group = FIO_OPT_G_RUNTIME,
2639 .name = "startdelay",
2640 .lname = "Start delay",
2641 .type = FIO_OPT_STR_VAL_TIME,
2642 .off1 = offsetof(struct thread_options, start_delay),
2643 .off2 = offsetof(struct thread_options, start_delay_high),
2644 .help = "Only start job when this period has passed",
2648 .category = FIO_OPT_C_GENERAL,
2649 .group = FIO_OPT_G_RUNTIME,
2655 .type = FIO_OPT_STR_VAL_TIME,
2656 .off1 = offsetof(struct thread_options, timeout),
2657 .help = "Stop workload when this amount of time has passed",
2661 .category = FIO_OPT_C_GENERAL,
2662 .group = FIO_OPT_G_RUNTIME,
2665 .name = "time_based",
2666 .lname = "Time based",
2667 .type = FIO_OPT_STR_SET,
2668 .off1 = offsetof(struct thread_options, time_based),
2669 .help = "Keep running until runtime/timeout is met",
2670 .category = FIO_OPT_C_GENERAL,
2671 .group = FIO_OPT_G_RUNTIME,
2674 .name = "verify_only",
2675 .lname = "Verify only",
2676 .type = FIO_OPT_STR_SET,
2677 .off1 = offsetof(struct thread_options, verify_only),
2678 .help = "Verifies previously written data is still valid",
2679 .category = FIO_OPT_C_GENERAL,
2680 .group = FIO_OPT_G_RUNTIME,
2683 .name = "ramp_time",
2684 .lname = "Ramp time",
2685 .type = FIO_OPT_STR_VAL_TIME,
2686 .off1 = offsetof(struct thread_options, ramp_time),
2687 .help = "Ramp up time before measuring performance",
2690 .category = FIO_OPT_C_GENERAL,
2691 .group = FIO_OPT_G_RUNTIME,
2694 .name = "clocksource",
2695 .lname = "Clock source",
2696 .type = FIO_OPT_STR,
2697 .cb = fio_clock_source_cb,
2698 .off1 = offsetof(struct thread_options, clocksource),
2699 .help = "What type of timing source to use",
2700 .category = FIO_OPT_C_GENERAL,
2701 .group = FIO_OPT_G_CLOCK,
2703 #ifdef CONFIG_GETTIMEOFDAY
2704 { .ival = "gettimeofday",
2706 .help = "Use gettimeofday(2) for timing",
2709 #ifdef CONFIG_CLOCK_GETTIME
2710 { .ival = "clock_gettime",
2711 .oval = CS_CGETTIME,
2712 .help = "Use clock_gettime(2) for timing",
2715 #ifdef ARCH_HAVE_CPU_CLOCK
2717 .oval = CS_CPUCLOCK,
2718 .help = "Use CPU private clock",
2726 .lname = "I/O Memory",
2727 .type = FIO_OPT_STR,
2729 .off1 = offsetof(struct thread_options, mem_type),
2730 .help = "Backing type for IO buffers",
2732 .category = FIO_OPT_C_IO,
2733 .group = FIO_OPT_G_INVALID,
2737 .help = "Use malloc(3) for IO buffers",
2739 #ifndef CONFIG_NO_SHM
2742 .help = "Use shared memory segments for IO buffers",
2744 #ifdef FIO_HAVE_HUGETLB
2745 { .ival = "shmhuge",
2746 .oval = MEM_SHMHUGE,
2747 .help = "Like shm, but use huge pages",
2753 .help = "Use mmap(2) (file or anon) for IO buffers",
2755 { .ival = "mmapshared",
2756 .oval = MEM_MMAPSHARED,
2757 .help = "Like mmap, but use the shared flag",
2759 #ifdef FIO_HAVE_HUGETLB
2760 { .ival = "mmaphuge",
2761 .oval = MEM_MMAPHUGE,
2762 .help = "Like mmap, but use huge pages",
2766 { .ival = "cudamalloc",
2767 .oval = MEM_CUDA_MALLOC,
2768 .help = "Allocate GPU device memory for GPUDirect RDMA",
2774 .name = "iomem_align",
2775 .alias = "mem_align",
2776 .lname = "I/O memory alignment",
2777 .type = FIO_OPT_INT,
2778 .off1 = offsetof(struct thread_options, mem_align),
2780 .help = "IO memory buffer offset alignment",
2784 .category = FIO_OPT_C_IO,
2785 .group = FIO_OPT_G_INVALID,
2790 .type = FIO_OPT_STR,
2791 .off1 = offsetof(struct thread_options, verify),
2792 .help = "Verify data written",
2794 .category = FIO_OPT_C_IO,
2795 .group = FIO_OPT_G_VERIFY,
2798 .oval = VERIFY_NONE,
2799 .help = "Don't do IO verification",
2803 .help = "Use md5 checksums for verification",
2806 .oval = VERIFY_CRC64,
2807 .help = "Use crc64 checksums for verification",
2810 .oval = VERIFY_CRC32,
2811 .help = "Use crc32 checksums for verification",
2813 { .ival = "crc32c-intel",
2814 .oval = VERIFY_CRC32C,
2815 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2818 .oval = VERIFY_CRC32C,
2819 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2822 .oval = VERIFY_CRC16,
2823 .help = "Use crc16 checksums for verification",
2826 .oval = VERIFY_CRC7,
2827 .help = "Use crc7 checksums for verification",
2830 .oval = VERIFY_SHA1,
2831 .help = "Use sha1 checksums for verification",
2834 .oval = VERIFY_SHA256,
2835 .help = "Use sha256 checksums for verification",
2838 .oval = VERIFY_SHA512,
2839 .help = "Use sha512 checksums for verification",
2841 { .ival = "sha3-224",
2842 .oval = VERIFY_SHA3_224,
2843 .help = "Use sha3-224 checksums for verification",
2845 { .ival = "sha3-256",
2846 .oval = VERIFY_SHA3_256,
2847 .help = "Use sha3-256 checksums for verification",
2849 { .ival = "sha3-384",
2850 .oval = VERIFY_SHA3_384,
2851 .help = "Use sha3-384 checksums for verification",
2853 { .ival = "sha3-512",
2854 .oval = VERIFY_SHA3_512,
2855 .help = "Use sha3-512 checksums for verification",
2858 .oval = VERIFY_XXHASH,
2859 .help = "Use xxhash checksums for verification",
2861 /* Meta information was included into verify_header,
2862 * 'meta' verification is implied by default. */
2864 .oval = VERIFY_HDR_ONLY,
2865 .help = "Use io information for verification. "
2866 "Now is implied by default, thus option is obsolete, "
2869 { .ival = "pattern",
2870 .oval = VERIFY_PATTERN_NO_HDR,
2871 .help = "Verify strict pattern",
2875 .oval = VERIFY_NULL,
2876 .help = "Pretend to verify",
2881 .name = "do_verify",
2882 .lname = "Perform verify step",
2883 .type = FIO_OPT_BOOL,
2884 .off1 = offsetof(struct thread_options, do_verify),
2885 .help = "Run verification stage after write",
2889 .category = FIO_OPT_C_IO,
2890 .group = FIO_OPT_G_VERIFY,
2893 .name = "verifysort",
2894 .lname = "Verify sort",
2895 .type = FIO_OPT_SOFT_DEPRECATED,
2896 .category = FIO_OPT_C_IO,
2897 .group = FIO_OPT_G_VERIFY,
2900 .name = "verifysort_nr",
2901 .lname = "Verify Sort Nr",
2902 .type = FIO_OPT_SOFT_DEPRECATED,
2903 .category = FIO_OPT_C_IO,
2904 .group = FIO_OPT_G_VERIFY,
2907 .name = "verify_interval",
2908 .lname = "Verify interval",
2909 .type = FIO_OPT_INT,
2910 .off1 = offsetof(struct thread_options, verify_interval),
2911 .minval = 2 * sizeof(struct verify_header),
2912 .help = "Store verify buffer header every N bytes",
2915 .interval = 2 * sizeof(struct verify_header),
2916 .category = FIO_OPT_C_IO,
2917 .group = FIO_OPT_G_VERIFY,
2920 .name = "verify_offset",
2921 .lname = "Verify offset",
2922 .type = FIO_OPT_INT,
2923 .help = "Offset verify header location by N bytes",
2924 .off1 = offsetof(struct thread_options, verify_offset),
2925 .minval = sizeof(struct verify_header),
2928 .category = FIO_OPT_C_IO,
2929 .group = FIO_OPT_G_VERIFY,
2932 .name = "verify_pattern",
2933 .lname = "Verify pattern",
2934 .type = FIO_OPT_STR,
2935 .cb = str_verify_pattern_cb,
2936 .off1 = offsetof(struct thread_options, verify_pattern),
2937 .help = "Fill pattern for IO buffers",
2940 .category = FIO_OPT_C_IO,
2941 .group = FIO_OPT_G_VERIFY,
2944 .name = "verify_fatal",
2945 .lname = "Verify fatal",
2946 .type = FIO_OPT_BOOL,
2947 .off1 = offsetof(struct thread_options, verify_fatal),
2949 .help = "Exit on a single verify failure, don't continue",
2952 .category = FIO_OPT_C_IO,
2953 .group = FIO_OPT_G_VERIFY,
2956 .name = "verify_dump",
2957 .lname = "Verify dump",
2958 .type = FIO_OPT_BOOL,
2959 .off1 = offsetof(struct thread_options, verify_dump),
2961 .help = "Dump contents of good and bad blocks on failure",
2964 .category = FIO_OPT_C_IO,
2965 .group = FIO_OPT_G_VERIFY,
2968 .name = "verify_async",
2969 .lname = "Verify asynchronously",
2970 .type = FIO_OPT_INT,
2971 .off1 = offsetof(struct thread_options, verify_async),
2973 .help = "Number of async verifier threads to use",
2976 .category = FIO_OPT_C_IO,
2977 .group = FIO_OPT_G_VERIFY,
2980 .name = "verify_backlog",
2981 .lname = "Verify backlog",
2982 .type = FIO_OPT_STR_VAL,
2983 .off1 = offsetof(struct thread_options, verify_backlog),
2984 .help = "Verify after this number of blocks are written",
2987 .category = FIO_OPT_C_IO,
2988 .group = FIO_OPT_G_VERIFY,
2991 .name = "verify_backlog_batch",
2992 .lname = "Verify backlog batch",
2993 .type = FIO_OPT_INT,
2994 .off1 = offsetof(struct thread_options, verify_batch),
2995 .help = "Verify this number of IO blocks",
2998 .category = FIO_OPT_C_IO,
2999 .group = FIO_OPT_G_VERIFY,
3001 #ifdef FIO_HAVE_CPU_AFFINITY
3003 .name = "verify_async_cpus",
3004 .lname = "Async verify CPUs",
3005 .type = FIO_OPT_STR,
3006 .cb = str_verify_cpus_allowed_cb,
3007 .off1 = offsetof(struct thread_options, verify_cpumask),
3008 .help = "Set CPUs allowed for async verify threads",
3009 .parent = "verify_async",
3011 .category = FIO_OPT_C_IO,
3012 .group = FIO_OPT_G_VERIFY,
3016 .name = "verify_async_cpus",
3017 .lname = "Async verify CPUs",
3018 .type = FIO_OPT_UNSUPPORTED,
3019 .help = "Your platform does not support CPU affinities",
3023 .name = "experimental_verify",
3024 .lname = "Experimental Verify",
3025 .off1 = offsetof(struct thread_options, experimental_verify),
3026 .type = FIO_OPT_BOOL,
3027 .help = "Enable experimental verification",
3029 .category = FIO_OPT_C_IO,
3030 .group = FIO_OPT_G_VERIFY,
3033 .name = "verify_state_load",
3034 .lname = "Load verify state",
3035 .off1 = offsetof(struct thread_options, verify_state),
3036 .type = FIO_OPT_BOOL,
3037 .help = "Load verify termination state",
3039 .category = FIO_OPT_C_IO,
3040 .group = FIO_OPT_G_VERIFY,
3043 .name = "verify_state_save",
3044 .lname = "Save verify state",
3045 .off1 = offsetof(struct thread_options, verify_state_save),
3046 .type = FIO_OPT_BOOL,
3048 .help = "Save verify state on termination",
3050 .category = FIO_OPT_C_IO,
3051 .group = FIO_OPT_G_VERIFY,
3053 #ifdef FIO_HAVE_TRIM
3055 .name = "trim_percentage",
3056 .lname = "Trim percentage",
3057 .type = FIO_OPT_INT,
3058 .off1 = offsetof(struct thread_options, trim_percentage),
3061 .help = "Number of verify blocks to trim (i.e., discard)",
3066 .category = FIO_OPT_C_IO,
3067 .group = FIO_OPT_G_TRIM,
3070 .name = "trim_verify_zero",
3071 .lname = "Verify trim zero",
3072 .type = FIO_OPT_BOOL,
3073 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3074 .off1 = offsetof(struct thread_options, trim_zero),
3075 .parent = "trim_percentage",
3078 .category = FIO_OPT_C_IO,
3079 .group = FIO_OPT_G_TRIM,
3082 .name = "trim_backlog",
3083 .lname = "Trim backlog",
3084 .type = FIO_OPT_STR_VAL,
3085 .off1 = offsetof(struct thread_options, trim_backlog),
3086 .help = "Trim after this number of blocks are written",
3087 .parent = "trim_percentage",
3090 .category = FIO_OPT_C_IO,
3091 .group = FIO_OPT_G_TRIM,
3094 .name = "trim_backlog_batch",
3095 .lname = "Trim backlog batch",
3096 .type = FIO_OPT_INT,
3097 .off1 = offsetof(struct thread_options, trim_batch),
3098 .help = "Trim this number of IO blocks",
3099 .parent = "trim_percentage",
3102 .category = FIO_OPT_C_IO,
3103 .group = FIO_OPT_G_TRIM,
3107 .name = "trim_percentage",
3108 .lname = "Trim percentage",
3109 .type = FIO_OPT_UNSUPPORTED,
3110 .help = "Fio does not support TRIM on your platform",
3113 .name = "trim_verify_zero",
3114 .lname = "Verify trim zero",
3115 .type = FIO_OPT_UNSUPPORTED,
3116 .help = "Fio does not support TRIM on your platform",
3119 .name = "trim_backlog",
3120 .lname = "Trim backlog",
3121 .type = FIO_OPT_UNSUPPORTED,
3122 .help = "Fio does not support TRIM on your platform",
3125 .name = "trim_backlog_batch",
3126 .lname = "Trim backlog batch",
3127 .type = FIO_OPT_UNSUPPORTED,
3128 .help = "Fio does not support TRIM on your platform",
3132 .name = "write_iolog",
3133 .lname = "Write I/O log",
3134 .type = FIO_OPT_STR_STORE,
3135 .off1 = offsetof(struct thread_options, write_iolog_file),
3136 .help = "Store IO pattern to file",
3137 .category = FIO_OPT_C_IO,
3138 .group = FIO_OPT_G_IOLOG,
3141 .name = "read_iolog",
3142 .lname = "Read I/O log",
3143 .type = FIO_OPT_STR_STORE,
3144 .off1 = offsetof(struct thread_options, read_iolog_file),
3145 .help = "Playback IO pattern from file",
3146 .category = FIO_OPT_C_IO,
3147 .group = FIO_OPT_G_IOLOG,
3150 .name = "read_iolog_chunked",
3151 .lname = "Read I/O log in parts",
3152 .type = FIO_OPT_BOOL,
3153 .off1 = offsetof(struct thread_options, read_iolog_chunked),
3155 .parent = "read_iolog",
3156 .help = "Parse IO pattern in chunks",
3157 .category = FIO_OPT_C_IO,
3158 .group = FIO_OPT_G_IOLOG,
3161 .name = "replay_no_stall",
3162 .lname = "Don't stall on replay",
3163 .type = FIO_OPT_BOOL,
3164 .off1 = offsetof(struct thread_options, no_stall),
3166 .parent = "read_iolog",
3168 .help = "Playback IO pattern file as fast as possible without stalls",
3169 .category = FIO_OPT_C_IO,
3170 .group = FIO_OPT_G_IOLOG,
3173 .name = "replay_redirect",
3174 .lname = "Redirect device for replay",
3175 .type = FIO_OPT_STR_STORE,
3176 .off1 = offsetof(struct thread_options, replay_redirect),
3177 .parent = "read_iolog",
3179 .help = "Replay all I/O onto this device, regardless of trace device",
3180 .category = FIO_OPT_C_IO,
3181 .group = FIO_OPT_G_IOLOG,
3184 .name = "replay_scale",
3185 .lname = "Replace offset scale factor",
3186 .type = FIO_OPT_INT,
3187 .off1 = offsetof(struct thread_options, replay_scale),
3188 .parent = "read_iolog",
3190 .help = "Align offsets to this blocksize",
3191 .category = FIO_OPT_C_IO,
3192 .group = FIO_OPT_G_IOLOG,
3195 .name = "replay_align",
3196 .lname = "Replace alignment",
3197 .type = FIO_OPT_INT,
3198 .off1 = offsetof(struct thread_options, replay_align),
3199 .parent = "read_iolog",
3200 .help = "Scale offset down by this factor",
3201 .category = FIO_OPT_C_IO,
3202 .group = FIO_OPT_G_IOLOG,
3206 .name = "replay_time_scale",
3207 .lname = "Replay Time Scale",
3208 .type = FIO_OPT_INT,
3209 .off1 = offsetof(struct thread_options, replay_time_scale),
3212 .parent = "read_iolog",
3214 .help = "Scale time for replay events",
3215 .category = FIO_OPT_C_IO,
3216 .group = FIO_OPT_G_IOLOG,
3219 .name = "replay_skip",
3220 .lname = "Replay Skip",
3221 .type = FIO_OPT_STR,
3222 .cb = str_replay_skip_cb,
3223 .off1 = offsetof(struct thread_options, replay_skip),
3224 .parent = "read_iolog",
3225 .help = "Skip certain IO types (read,write,trim,flush)",
3226 .category = FIO_OPT_C_IO,
3227 .group = FIO_OPT_G_IOLOG,
3230 .name = "merge_blktrace_file",
3231 .lname = "Merged blktrace output filename",
3232 .type = FIO_OPT_STR_STORE,
3233 .off1 = offsetof(struct thread_options, merge_blktrace_file),
3234 .help = "Merged blktrace output filename",
3235 .category = FIO_OPT_C_IO,
3236 .group = FIO_OPT_G_IOLOG,
3239 .name = "merge_blktrace_scalars",
3240 .lname = "Percentage to scale each trace",
3241 .type = FIO_OPT_FLOAT_LIST,
3242 .off1 = offsetof(struct thread_options, merge_blktrace_scalars),
3243 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3244 .help = "Percentage to scale each trace",
3245 .category = FIO_OPT_C_IO,
3246 .group = FIO_OPT_G_IOLOG,
3249 .name = "merge_blktrace_iters",
3250 .lname = "Number of iterations to run per trace",
3251 .type = FIO_OPT_FLOAT_LIST,
3252 .off1 = offsetof(struct thread_options, merge_blktrace_iters),
3253 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3254 .help = "Number of iterations to run per trace",
3255 .category = FIO_OPT_C_IO,
3256 .group = FIO_OPT_G_IOLOG,
3259 .name = "exec_prerun",
3260 .lname = "Pre-execute runnable",
3261 .type = FIO_OPT_STR_STORE,
3262 .off1 = offsetof(struct thread_options, exec_prerun),
3263 .help = "Execute this file prior to running job",
3264 .category = FIO_OPT_C_GENERAL,
3265 .group = FIO_OPT_G_INVALID,
3268 .name = "exec_postrun",
3269 .lname = "Post-execute runnable",
3270 .type = FIO_OPT_STR_STORE,
3271 .off1 = offsetof(struct thread_options, exec_postrun),
3272 .help = "Execute this file after running job",
3273 .category = FIO_OPT_C_GENERAL,
3274 .group = FIO_OPT_G_INVALID,
3276 #ifdef FIO_HAVE_IOSCHED_SWITCH
3278 .name = "ioscheduler",
3279 .lname = "I/O scheduler",
3280 .type = FIO_OPT_STR_STORE,
3281 .off1 = offsetof(struct thread_options, ioscheduler),
3282 .help = "Use this IO scheduler on the backing device",
3283 .category = FIO_OPT_C_FILE,
3284 .group = FIO_OPT_G_INVALID,
3288 .name = "ioscheduler",
3289 .lname = "I/O scheduler",
3290 .type = FIO_OPT_UNSUPPORTED,
3291 .help = "Your platform does not support IO scheduler switching",
3296 .lname = "Zone mode",
3297 .help = "Mode for the zonesize, zonerange and zoneskip parameters",
3298 .type = FIO_OPT_STR,
3299 .off1 = offsetof(struct thread_options, zone_mode),
3301 .category = FIO_OPT_C_IO,
3302 .group = FIO_OPT_G_ZONE,
3305 .oval = ZONE_MODE_NONE,
3306 .help = "no zoning",
3308 { .ival = "strided",
3309 .oval = ZONE_MODE_STRIDED,
3310 .help = "strided mode - random I/O is restricted to a single zone",
3313 .oval = ZONE_MODE_ZBD,
3314 .help = "zoned block device mode - random I/O selects one of multiple zones randomly",
3320 .lname = "Zone size",
3321 .type = FIO_OPT_STR_VAL,
3322 .off1 = offsetof(struct thread_options, zone_size),
3323 .help = "Amount of data to read per zone",
3325 .interval = 1024 * 1024,
3326 .category = FIO_OPT_C_IO,
3327 .group = FIO_OPT_G_ZONE,
3330 .name = "zonerange",
3331 .lname = "Zone range",
3332 .type = FIO_OPT_STR_VAL,
3333 .off1 = offsetof(struct thread_options, zone_range),
3334 .help = "Give size of an IO zone",
3336 .interval = 1024 * 1024,
3337 .category = FIO_OPT_C_IO,
3338 .group = FIO_OPT_G_ZONE,
3342 .lname = "Zone skip",
3343 .type = FIO_OPT_STR_VAL,
3344 .off1 = offsetof(struct thread_options, zone_skip),
3345 .help = "Space between IO zones",
3347 .interval = 1024 * 1024,
3348 .category = FIO_OPT_C_IO,
3349 .group = FIO_OPT_G_ZONE,
3352 .name = "read_beyond_wp",
3353 .lname = "Allow reads beyond the zone write pointer",
3354 .type = FIO_OPT_BOOL,
3355 .off1 = offsetof(struct thread_options, read_beyond_wp),
3356 .help = "Allow reads beyond the zone write pointer",
3358 .category = FIO_OPT_C_IO,
3359 .group = FIO_OPT_G_INVALID,
3362 .name = "max_open_zones",
3363 .lname = "Maximum number of open zones",
3364 .type = FIO_OPT_INT,
3365 .off1 = offsetof(struct thread_options, max_open_zones),
3366 .maxval = ZBD_MAX_OPEN_ZONES,
3367 .help = "Limit random writes to SMR drives to the specified"
3368 " number of sequential zones",
3370 .category = FIO_OPT_C_IO,
3371 .group = FIO_OPT_G_INVALID,
3374 .name = "zone_reset_threshold",
3375 .lname = "Zone reset threshold",
3376 .help = "Zoned block device reset threshold",
3377 .type = FIO_OPT_FLOAT_LIST,
3379 .off1 = offsetof(struct thread_options, zrt),
3382 .category = FIO_OPT_C_IO,
3383 .group = FIO_OPT_G_ZONE,
3386 .name = "zone_reset_frequency",
3387 .lname = "Zone reset frequency",
3388 .help = "Zoned block device zone reset frequency in HZ",
3389 .type = FIO_OPT_FLOAT_LIST,
3391 .off1 = offsetof(struct thread_options, zrf),
3394 .category = FIO_OPT_C_IO,
3395 .group = FIO_OPT_G_ZONE,
3399 .lname = "Lock memory",
3400 .type = FIO_OPT_STR_VAL,
3401 .off1 = offsetof(struct thread_options, lockmem),
3402 .help = "Lock down this amount of memory (per worker)",
3404 .interval = 1024 * 1024,
3405 .category = FIO_OPT_C_GENERAL,
3406 .group = FIO_OPT_G_INVALID,
3409 .name = "rwmixread",
3410 .lname = "Read/write mix read",
3411 .type = FIO_OPT_INT,
3412 .cb = str_rwmix_read_cb,
3413 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3415 .help = "Percentage of mixed workload that is reads",
3418 .inverse = "rwmixwrite",
3419 .category = FIO_OPT_C_IO,
3420 .group = FIO_OPT_G_RWMIX,
3423 .name = "rwmixwrite",
3424 .lname = "Read/write mix write",
3425 .type = FIO_OPT_INT,
3426 .cb = str_rwmix_write_cb,
3427 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3429 .help = "Percentage of mixed workload that is writes",
3432 .inverse = "rwmixread",
3433 .category = FIO_OPT_C_IO,
3434 .group = FIO_OPT_G_RWMIX,
3437 .name = "rwmixcycle",
3438 .lname = "Read/write mix cycle",
3439 .type = FIO_OPT_DEPRECATED,
3440 .category = FIO_OPT_C_IO,
3441 .group = FIO_OPT_G_RWMIX,
3446 .type = FIO_OPT_INT,
3447 .off1 = offsetof(struct thread_options, nice),
3448 .help = "Set job CPU nice value",
3453 .category = FIO_OPT_C_GENERAL,
3454 .group = FIO_OPT_G_CRED,
3456 #ifdef FIO_HAVE_IOPRIO
3459 .lname = "I/O nice priority",
3460 .type = FIO_OPT_INT,
3461 .off1 = offsetof(struct thread_options, ioprio),
3462 .help = "Set job IO priority value",
3463 .minval = IOPRIO_MIN_PRIO,
3464 .maxval = IOPRIO_MAX_PRIO,
3466 .category = FIO_OPT_C_GENERAL,
3467 .group = FIO_OPT_G_CRED,
3472 .lname = "I/O nice priority",
3473 .type = FIO_OPT_UNSUPPORTED,
3474 .help = "Your platform does not support IO priorities",
3477 #ifdef FIO_HAVE_IOPRIO_CLASS
3478 #ifndef FIO_HAVE_IOPRIO
3479 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3482 .name = "prioclass",
3483 .lname = "I/O nice priority class",
3484 .type = FIO_OPT_INT,
3485 .off1 = offsetof(struct thread_options, ioprio_class),
3486 .help = "Set job IO priority class",
3487 .minval = IOPRIO_MIN_PRIO_CLASS,
3488 .maxval = IOPRIO_MAX_PRIO_CLASS,
3490 .category = FIO_OPT_C_GENERAL,
3491 .group = FIO_OPT_G_CRED,
3495 .name = "prioclass",
3496 .lname = "I/O nice priority class",
3497 .type = FIO_OPT_UNSUPPORTED,
3498 .help = "Your platform does not support IO priority classes",
3502 .name = "thinktime",
3503 .lname = "Thinktime",
3504 .type = FIO_OPT_INT,
3505 .off1 = offsetof(struct thread_options, thinktime),
3506 .help = "Idle time between IO buffers (usec)",
3509 .category = FIO_OPT_C_IO,
3510 .group = FIO_OPT_G_THINKTIME,
3513 .name = "thinktime_spin",
3514 .lname = "Thinktime spin",
3515 .type = FIO_OPT_INT,
3516 .off1 = offsetof(struct thread_options, thinktime_spin),
3517 .help = "Start think time by spinning this amount (usec)",
3520 .parent = "thinktime",
3522 .category = FIO_OPT_C_IO,
3523 .group = FIO_OPT_G_THINKTIME,
3526 .name = "thinktime_blocks",
3527 .lname = "Thinktime blocks",
3528 .type = FIO_OPT_INT,
3529 .off1 = offsetof(struct thread_options, thinktime_blocks),
3530 .help = "IO buffer period between 'thinktime'",
3532 .parent = "thinktime",
3534 .category = FIO_OPT_C_IO,
3535 .group = FIO_OPT_G_THINKTIME,
3539 .lname = "I/O rate",
3540 .type = FIO_OPT_INT,
3541 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3542 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3543 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
3544 .help = "Set bandwidth rate",
3545 .category = FIO_OPT_C_IO,
3546 .group = FIO_OPT_G_RATE,
3551 .lname = "I/O min rate",
3552 .type = FIO_OPT_INT,
3553 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
3554 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
3555 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
3556 .help = "Job must meet this rate or it will be shutdown",
3559 .category = FIO_OPT_C_IO,
3560 .group = FIO_OPT_G_RATE,
3563 .name = "rate_iops",
3564 .lname = "I/O rate IOPS",
3565 .type = FIO_OPT_INT,
3566 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
3567 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
3568 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
3569 .help = "Limit IO used to this number of IO operations/sec",
3571 .category = FIO_OPT_C_IO,
3572 .group = FIO_OPT_G_RATE,
3575 .name = "rate_iops_min",
3576 .lname = "I/O min rate IOPS",
3577 .type = FIO_OPT_INT,
3578 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
3579 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
3580 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
3581 .help = "Job must meet this rate or it will be shut down",
3582 .parent = "rate_iops",
3584 .category = FIO_OPT_C_IO,
3585 .group = FIO_OPT_G_RATE,
3588 .name = "rate_process",
3589 .lname = "Rate Process",
3590 .type = FIO_OPT_STR,
3591 .off1 = offsetof(struct thread_options, rate_process),
3592 .help = "What process controls how rated IO is managed",
3594 .category = FIO_OPT_C_IO,
3595 .group = FIO_OPT_G_RATE,
3598 .oval = RATE_PROCESS_LINEAR,
3599 .help = "Linear rate of IO",
3603 .oval = RATE_PROCESS_POISSON,
3604 .help = "Rate follows Poisson process",
3610 .name = "rate_cycle",
3611 .alias = "ratecycle",
3612 .lname = "I/O rate cycle",
3613 .type = FIO_OPT_INT,
3614 .off1 = offsetof(struct thread_options, ratecycle),
3615 .help = "Window average for rate limits (msec)",
3619 .category = FIO_OPT_C_IO,
3620 .group = FIO_OPT_G_RATE,
3623 .name = "rate_ignore_thinktime",
3624 .lname = "Rate ignore thinktime",
3625 .type = FIO_OPT_BOOL,
3626 .off1 = offsetof(struct thread_options, rate_ign_think),
3627 .help = "Rated IO ignores thinktime settings",
3629 .category = FIO_OPT_C_IO,
3630 .group = FIO_OPT_G_RATE,
3633 .name = "max_latency",
3634 .lname = "Max Latency (usec)",
3635 .type = FIO_OPT_STR_VAL_TIME,
3636 .off1 = offsetof(struct thread_options, max_latency),
3637 .help = "Maximum tolerated IO latency (usec)",
3639 .category = FIO_OPT_C_IO,
3640 .group = FIO_OPT_G_LATPROF,
3643 .name = "latency_target",
3644 .lname = "Latency Target (usec)",
3645 .type = FIO_OPT_STR_VAL_TIME,
3646 .off1 = offsetof(struct thread_options, latency_target),
3647 .help = "Ramp to max queue depth supporting this latency",
3649 .category = FIO_OPT_C_IO,
3650 .group = FIO_OPT_G_LATPROF,
3653 .name = "latency_window",
3654 .lname = "Latency Window (usec)",
3655 .type = FIO_OPT_STR_VAL_TIME,
3656 .off1 = offsetof(struct thread_options, latency_window),
3657 .help = "Time to sustain latency_target",
3659 .category = FIO_OPT_C_IO,
3660 .group = FIO_OPT_G_LATPROF,
3663 .name = "latency_percentile",
3664 .lname = "Latency Percentile",
3665 .type = FIO_OPT_FLOAT_LIST,
3666 .off1 = offsetof(struct thread_options, latency_percentile),
3667 .help = "Percentile of IOs must be below latency_target",
3672 .category = FIO_OPT_C_IO,
3673 .group = FIO_OPT_G_LATPROF,
3676 .name = "invalidate",
3677 .lname = "Cache invalidate",
3678 .type = FIO_OPT_BOOL,
3679 .off1 = offsetof(struct thread_options, invalidate_cache),
3680 .help = "Invalidate buffer/page cache prior to running job",
3682 .category = FIO_OPT_C_IO,
3683 .group = FIO_OPT_G_IO_TYPE,
3687 .lname = "Synchronous I/O",
3688 .type = FIO_OPT_BOOL,
3689 .off1 = offsetof(struct thread_options, sync_io),
3690 .help = "Use O_SYNC for buffered writes",
3692 .parent = "buffered",
3694 .category = FIO_OPT_C_IO,
3695 .group = FIO_OPT_G_IO_TYPE,
3697 #ifdef FIO_HAVE_WRITE_HINT
3699 .name = "write_hint",
3700 .lname = "Write hint",
3701 .type = FIO_OPT_STR,
3702 .off1 = offsetof(struct thread_options, write_hint),
3703 .help = "Set expected write life time",
3704 .category = FIO_OPT_C_ENGINE,
3705 .group = FIO_OPT_G_INVALID,
3708 .oval = RWH_WRITE_LIFE_NONE,
3711 .oval = RWH_WRITE_LIFE_SHORT,
3714 .oval = RWH_WRITE_LIFE_MEDIUM,
3717 .oval = RWH_WRITE_LIFE_LONG,
3719 { .ival = "extreme",
3720 .oval = RWH_WRITE_LIFE_EXTREME,
3726 .name = "create_serialize",
3727 .lname = "Create serialize",
3728 .type = FIO_OPT_BOOL,
3729 .off1 = offsetof(struct thread_options, create_serialize),
3730 .help = "Serialize creation of job files",
3732 .category = FIO_OPT_C_FILE,
3733 .group = FIO_OPT_G_INVALID,
3736 .name = "create_fsync",
3737 .lname = "Create fsync",
3738 .type = FIO_OPT_BOOL,
3739 .off1 = offsetof(struct thread_options, create_fsync),
3740 .help = "fsync file after creation",
3742 .category = FIO_OPT_C_FILE,
3743 .group = FIO_OPT_G_INVALID,
3746 .name = "create_on_open",
3747 .lname = "Create on open",
3748 .type = FIO_OPT_BOOL,
3749 .off1 = offsetof(struct thread_options, create_on_open),
3750 .help = "Create files when they are opened for IO",
3752 .category = FIO_OPT_C_FILE,
3753 .group = FIO_OPT_G_INVALID,
3756 .name = "create_only",
3757 .lname = "Create Only",
3758 .type = FIO_OPT_BOOL,
3759 .off1 = offsetof(struct thread_options, create_only),
3760 .help = "Only perform file creation phase",
3761 .category = FIO_OPT_C_FILE,
3765 .name = "allow_file_create",
3766 .lname = "Allow file create",
3767 .type = FIO_OPT_BOOL,
3768 .off1 = offsetof(struct thread_options, allow_create),
3769 .help = "Permit fio to create files, if they don't exist",
3771 .category = FIO_OPT_C_FILE,
3772 .group = FIO_OPT_G_FILENAME,
3775 .name = "allow_mounted_write",
3776 .lname = "Allow mounted write",
3777 .type = FIO_OPT_BOOL,
3778 .off1 = offsetof(struct thread_options, allow_mounted_write),
3779 .help = "Allow writes to a mounted partition",
3781 .category = FIO_OPT_C_FILE,
3782 .group = FIO_OPT_G_FILENAME,
3786 .lname = "Pre-read files",
3787 .type = FIO_OPT_BOOL,
3788 .off1 = offsetof(struct thread_options, pre_read),
3789 .help = "Pre-read files before starting official testing",
3791 .category = FIO_OPT_C_FILE,
3792 .group = FIO_OPT_G_INVALID,
3794 #ifdef FIO_HAVE_CPU_AFFINITY
3797 .lname = "CPU mask",
3798 .type = FIO_OPT_INT,
3799 .cb = str_cpumask_cb,
3800 .off1 = offsetof(struct thread_options, cpumask),
3801 .help = "CPU affinity mask",
3802 .category = FIO_OPT_C_GENERAL,
3803 .group = FIO_OPT_G_CRED,
3806 .name = "cpus_allowed",
3807 .lname = "CPUs allowed",
3808 .type = FIO_OPT_STR,
3809 .cb = str_cpus_allowed_cb,
3810 .off1 = offsetof(struct thread_options, cpumask),
3811 .help = "Set CPUs allowed",
3812 .category = FIO_OPT_C_GENERAL,
3813 .group = FIO_OPT_G_CRED,
3816 .name = "cpus_allowed_policy",
3817 .lname = "CPUs allowed distribution policy",
3818 .type = FIO_OPT_STR,
3819 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
3820 .help = "Distribution policy for cpus_allowed",
3821 .parent = "cpus_allowed",
3825 .oval = FIO_CPUS_SHARED,
3826 .help = "Mask shared between threads",
3829 .oval = FIO_CPUS_SPLIT,
3830 .help = "Mask split between threads",
3833 .category = FIO_OPT_C_GENERAL,
3834 .group = FIO_OPT_G_CRED,
3839 .lname = "CPU mask",
3840 .type = FIO_OPT_UNSUPPORTED,
3841 .help = "Your platform does not support CPU affinities",
3844 .name = "cpus_allowed",
3845 .lname = "CPUs allowed",
3846 .type = FIO_OPT_UNSUPPORTED,
3847 .help = "Your platform does not support CPU affinities",
3850 .name = "cpus_allowed_policy",
3851 .lname = "CPUs allowed distribution policy",
3852 .type = FIO_OPT_UNSUPPORTED,
3853 .help = "Your platform does not support CPU affinities",
3856 #ifdef CONFIG_LIBNUMA
3858 .name = "numa_cpu_nodes",
3859 .lname = "NUMA CPU Nodes",
3860 .type = FIO_OPT_STR,
3861 .cb = str_numa_cpunodes_cb,
3862 .off1 = offsetof(struct thread_options, numa_cpunodes),
3863 .help = "NUMA CPU nodes bind",
3864 .category = FIO_OPT_C_GENERAL,
3865 .group = FIO_OPT_G_INVALID,
3868 .name = "numa_mem_policy",
3869 .lname = "NUMA Memory Policy",
3870 .type = FIO_OPT_STR,
3871 .cb = str_numa_mpol_cb,
3872 .off1 = offsetof(struct thread_options, numa_memnodes),
3873 .help = "NUMA memory policy setup",
3874 .category = FIO_OPT_C_GENERAL,
3875 .group = FIO_OPT_G_INVALID,
3879 .name = "numa_cpu_nodes",
3880 .lname = "NUMA CPU Nodes",
3881 .type = FIO_OPT_UNSUPPORTED,
3882 .help = "Build fio with libnuma-dev(el) to enable this option",
3885 .name = "numa_mem_policy",
3886 .lname = "NUMA Memory Policy",
3887 .type = FIO_OPT_UNSUPPORTED,
3888 .help = "Build fio with libnuma-dev(el) to enable this option",
3893 .name = "gpu_dev_id",
3894 .lname = "GPU device ID",
3895 .type = FIO_OPT_INT,
3896 .off1 = offsetof(struct thread_options, gpu_dev_id),
3897 .help = "Set GPU device ID for GPUDirect RDMA",
3899 .category = FIO_OPT_C_GENERAL,
3900 .group = FIO_OPT_G_INVALID,
3904 .name = "end_fsync",
3905 .lname = "End fsync",
3906 .type = FIO_OPT_BOOL,
3907 .off1 = offsetof(struct thread_options, end_fsync),
3908 .help = "Include fsync at the end of job",
3910 .category = FIO_OPT_C_FILE,
3911 .group = FIO_OPT_G_INVALID,
3914 .name = "fsync_on_close",
3915 .lname = "Fsync on close",
3916 .type = FIO_OPT_BOOL,
3917 .off1 = offsetof(struct thread_options, fsync_on_close),
3918 .help = "fsync files on close",
3920 .category = FIO_OPT_C_FILE,
3921 .group = FIO_OPT_G_INVALID,
3925 .lname = "Unlink file",
3926 .type = FIO_OPT_BOOL,
3927 .off1 = offsetof(struct thread_options, unlink),
3928 .help = "Unlink created files after job has completed",
3930 .category = FIO_OPT_C_FILE,
3931 .group = FIO_OPT_G_INVALID,
3934 .name = "unlink_each_loop",
3935 .lname = "Unlink file after each loop of a job",
3936 .type = FIO_OPT_BOOL,
3937 .off1 = offsetof(struct thread_options, unlink_each_loop),
3938 .help = "Unlink created files after each loop in a job has completed",
3940 .category = FIO_OPT_C_FILE,
3941 .group = FIO_OPT_G_INVALID,
3945 .lname = "Exit-all on terminate",
3946 .type = FIO_OPT_STR_SET,
3947 .cb = str_exitall_cb,
3948 .help = "Terminate all jobs when one exits",
3949 .category = FIO_OPT_C_GENERAL,
3950 .group = FIO_OPT_G_PROCESS,
3953 .name = "exit_what",
3954 .lname = "What jobs to quit on terminate",
3955 .type = FIO_OPT_STR,
3956 .off1 = offsetof(struct thread_options, exit_what),
3957 .help = "Fine-grained control for exitall",
3959 .category = FIO_OPT_C_GENERAL,
3960 .group = FIO_OPT_G_PROCESS,
3963 .oval = TERMINATE_GROUP,
3964 .help = "exit_all=1 default behaviour",
3966 { .ival = "stonewall",
3967 .oval = TERMINATE_STONEWALL,
3968 .help = "quit all currently running jobs; continue with next stonewall",
3971 .oval = TERMINATE_ALL,
3972 .help = "Quit everything",
3977 .name = "exitall_on_error",
3978 .lname = "Exit-all on terminate in error",
3979 .type = FIO_OPT_STR_SET,
3980 .off1 = offsetof(struct thread_options, exitall_error),
3981 .help = "Terminate all jobs when one exits in error",
3982 .category = FIO_OPT_C_GENERAL,
3983 .group = FIO_OPT_G_PROCESS,
3986 .name = "stonewall",
3987 .lname = "Wait for previous",
3988 .alias = "wait_for_previous",
3989 .type = FIO_OPT_STR_SET,
3990 .off1 = offsetof(struct thread_options, stonewall),
3991 .help = "Insert a hard barrier between this job and previous",
3992 .category = FIO_OPT_C_GENERAL,
3993 .group = FIO_OPT_G_PROCESS,
3996 .name = "new_group",
3997 .lname = "New group",
3998 .type = FIO_OPT_STR_SET,
3999 .off1 = offsetof(struct thread_options, new_group),
4000 .help = "Mark the start of a new group (for reporting)",
4001 .category = FIO_OPT_C_GENERAL,
4002 .group = FIO_OPT_G_PROCESS,
4007 .type = FIO_OPT_STR_SET,
4008 .off1 = offsetof(struct thread_options, use_thread),
4009 .help = "Use threads instead of processes",
4010 #ifdef CONFIG_NO_SHM
4014 .category = FIO_OPT_C_GENERAL,
4015 .group = FIO_OPT_G_PROCESS,
4018 .name = "per_job_logs",
4019 .lname = "Per Job Logs",
4020 .type = FIO_OPT_BOOL,
4021 .off1 = offsetof(struct thread_options, per_job_logs),
4022 .help = "Include job number in generated log files or not",
4024 .category = FIO_OPT_C_LOG,
4025 .group = FIO_OPT_G_INVALID,
4028 .name = "write_bw_log",
4029 .lname = "Write bandwidth log",
4030 .type = FIO_OPT_STR,
4031 .off1 = offsetof(struct thread_options, bw_log_file),
4032 .cb = str_write_bw_log_cb,
4033 .help = "Write log of bandwidth during run",
4034 .category = FIO_OPT_C_LOG,
4035 .group = FIO_OPT_G_INVALID,
4038 .name = "write_lat_log",
4039 .lname = "Write latency log",
4040 .type = FIO_OPT_STR,
4041 .off1 = offsetof(struct thread_options, lat_log_file),
4042 .cb = str_write_lat_log_cb,
4043 .help = "Write log of latency during run",
4044 .category = FIO_OPT_C_LOG,
4045 .group = FIO_OPT_G_INVALID,
4048 .name = "write_iops_log",
4049 .lname = "Write IOPS log",
4050 .type = FIO_OPT_STR,
4051 .off1 = offsetof(struct thread_options, iops_log_file),
4052 .cb = str_write_iops_log_cb,
4053 .help = "Write log of IOPS during run",
4054 .category = FIO_OPT_C_LOG,
4055 .group = FIO_OPT_G_INVALID,
4058 .name = "log_avg_msec",
4059 .lname = "Log averaging (msec)",
4060 .type = FIO_OPT_INT,
4061 .off1 = offsetof(struct thread_options, log_avg_msec),
4062 .help = "Average bw/iops/lat logs over this period of time",
4064 .category = FIO_OPT_C_LOG,
4065 .group = FIO_OPT_G_INVALID,
4068 .name = "log_hist_msec",
4069 .lname = "Log histograms (msec)",
4070 .type = FIO_OPT_INT,
4071 .off1 = offsetof(struct thread_options, log_hist_msec),
4072 .help = "Dump completion latency histograms at frequency of this time value",
4074 .category = FIO_OPT_C_LOG,
4075 .group = FIO_OPT_G_INVALID,
4078 .name = "log_hist_coarseness",
4079 .lname = "Histogram logs coarseness",
4080 .type = FIO_OPT_INT,
4081 .off1 = offsetof(struct thread_options, log_hist_coarseness),
4082 .help = "Integer in range [0,6]. Higher coarseness outputs"
4083 " fewer histogram bins per sample. The number of bins for"
4084 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
4086 .category = FIO_OPT_C_LOG,
4087 .group = FIO_OPT_G_INVALID,
4090 .name = "write_hist_log",
4091 .lname = "Write latency histogram logs",
4092 .type = FIO_OPT_STR,
4093 .off1 = offsetof(struct thread_options, hist_log_file),
4094 .cb = str_write_hist_log_cb,
4095 .help = "Write log of latency histograms during run",
4096 .category = FIO_OPT_C_LOG,
4097 .group = FIO_OPT_G_INVALID,
4100 .name = "log_max_value",
4101 .lname = "Log maximum instead of average",
4102 .type = FIO_OPT_BOOL,
4103 .off1 = offsetof(struct thread_options, log_max),
4104 .help = "Log max sample in a window instead of average",
4106 .category = FIO_OPT_C_LOG,
4107 .group = FIO_OPT_G_INVALID,
4110 .name = "log_offset",
4111 .lname = "Log offset of IO",
4112 .type = FIO_OPT_BOOL,
4113 .off1 = offsetof(struct thread_options, log_offset),
4114 .help = "Include offset of IO for each log entry",
4116 .category = FIO_OPT_C_LOG,
4117 .group = FIO_OPT_G_INVALID,
4121 .name = "log_compression",
4122 .lname = "Log compression",
4123 .type = FIO_OPT_INT,
4124 .off1 = offsetof(struct thread_options, log_gz),
4125 .help = "Log in compressed chunks of this size",
4127 .maxval = 512 * 1024 * 1024ULL,
4128 .category = FIO_OPT_C_LOG,
4129 .group = FIO_OPT_G_INVALID,
4131 #ifdef FIO_HAVE_CPU_AFFINITY
4133 .name = "log_compression_cpus",
4134 .lname = "Log Compression CPUs",
4135 .type = FIO_OPT_STR,
4136 .cb = str_log_cpus_allowed_cb,
4137 .off1 = offsetof(struct thread_options, log_gz_cpumask),
4138 .parent = "log_compression",
4139 .help = "Limit log compression to these CPUs",
4140 .category = FIO_OPT_C_LOG,
4141 .group = FIO_OPT_G_INVALID,
4145 .name = "log_compression_cpus",
4146 .lname = "Log Compression CPUs",
4147 .type = FIO_OPT_UNSUPPORTED,
4148 .help = "Your platform does not support CPU affinities",
4152 .name = "log_store_compressed",
4153 .lname = "Log store compressed",
4154 .type = FIO_OPT_BOOL,
4155 .off1 = offsetof(struct thread_options, log_gz_store),
4156 .help = "Store logs in a compressed format",
4157 .category = FIO_OPT_C_LOG,
4158 .group = FIO_OPT_G_INVALID,
4162 .name = "log_compression",
4163 .lname = "Log compression",
4164 .type = FIO_OPT_UNSUPPORTED,
4165 .help = "Install libz-dev(el) to get compression support",
4168 .name = "log_store_compressed",
4169 .lname = "Log store compressed",
4170 .type = FIO_OPT_UNSUPPORTED,
4171 .help = "Install libz-dev(el) to get compression support",
4175 .name = "log_unix_epoch",
4176 .lname = "Log epoch unix",
4177 .type = FIO_OPT_BOOL,
4178 .off1 = offsetof(struct thread_options, log_unix_epoch),
4179 .help = "Use Unix time in log files",
4180 .category = FIO_OPT_C_LOG,
4181 .group = FIO_OPT_G_INVALID,
4184 .name = "block_error_percentiles",
4185 .lname = "Block error percentiles",
4186 .type = FIO_OPT_BOOL,
4187 .off1 = offsetof(struct thread_options, block_error_hist),
4188 .help = "Record trim block errors and make a histogram",
4190 .category = FIO_OPT_C_LOG,
4191 .group = FIO_OPT_G_INVALID,
4194 .name = "bwavgtime",
4195 .lname = "Bandwidth average time",
4196 .type = FIO_OPT_INT,
4197 .off1 = offsetof(struct thread_options, bw_avg_time),
4198 .help = "Time window over which to calculate bandwidth"
4201 .parent = "write_bw_log",
4204 .category = FIO_OPT_C_LOG,
4205 .group = FIO_OPT_G_INVALID,
4208 .name = "iopsavgtime",
4209 .lname = "IOPS average time",
4210 .type = FIO_OPT_INT,
4211 .off1 = offsetof(struct thread_options, iops_avg_time),
4212 .help = "Time window over which to calculate IOPS (msec)",
4214 .parent = "write_iops_log",
4217 .category = FIO_OPT_C_LOG,
4218 .group = FIO_OPT_G_INVALID,
4221 .name = "group_reporting",
4222 .lname = "Group reporting",
4223 .type = FIO_OPT_STR_SET,
4224 .off1 = offsetof(struct thread_options, group_reporting),
4225 .help = "Do reporting on a per-group basis",
4226 .category = FIO_OPT_C_STAT,
4227 .group = FIO_OPT_G_INVALID,
4232 .type = FIO_OPT_BOOL,
4233 .off1 = offsetof(struct thread_options, stats),
4234 .help = "Enable collection of stats",
4236 .category = FIO_OPT_C_STAT,
4237 .group = FIO_OPT_G_INVALID,
4240 .name = "zero_buffers",
4241 .lname = "Zero I/O buffers",
4242 .type = FIO_OPT_STR_SET,
4243 .off1 = offsetof(struct thread_options, zero_buffers),
4244 .help = "Init IO buffers to all zeroes",
4245 .category = FIO_OPT_C_IO,
4246 .group = FIO_OPT_G_IO_BUF,
4249 .name = "refill_buffers",
4250 .lname = "Refill I/O buffers",
4251 .type = FIO_OPT_STR_SET,
4252 .off1 = offsetof(struct thread_options, refill_buffers),
4253 .help = "Refill IO buffers on every IO submit",
4254 .category = FIO_OPT_C_IO,
4255 .group = FIO_OPT_G_IO_BUF,
4258 .name = "scramble_buffers",
4259 .lname = "Scramble I/O buffers",
4260 .type = FIO_OPT_BOOL,
4261 .off1 = offsetof(struct thread_options, scramble_buffers),
4262 .help = "Slightly scramble buffers on every IO submit",
4264 .category = FIO_OPT_C_IO,
4265 .group = FIO_OPT_G_IO_BUF,
4268 .name = "buffer_pattern",
4269 .lname = "Buffer pattern",
4270 .type = FIO_OPT_STR,
4271 .cb = str_buffer_pattern_cb,
4272 .off1 = offsetof(struct thread_options, buffer_pattern),
4273 .help = "Fill pattern for IO buffers",
4274 .category = FIO_OPT_C_IO,
4275 .group = FIO_OPT_G_IO_BUF,
4278 .name = "buffer_compress_percentage",
4279 .lname = "Buffer compression percentage",
4280 .type = FIO_OPT_INT,
4281 .cb = str_buffer_compress_cb,
4282 .off1 = offsetof(struct thread_options, compress_percentage),
4285 .help = "How compressible the buffer is (approximately)",
4287 .category = FIO_OPT_C_IO,
4288 .group = FIO_OPT_G_IO_BUF,
4291 .name = "buffer_compress_chunk",
4292 .lname = "Buffer compression chunk size",
4293 .type = FIO_OPT_INT,
4294 .off1 = offsetof(struct thread_options, compress_chunk),
4295 .parent = "buffer_compress_percentage",
4297 .help = "Size of compressible region in buffer",
4300 .category = FIO_OPT_C_IO,
4301 .group = FIO_OPT_G_IO_BUF,
4304 .name = "dedupe_percentage",
4305 .lname = "Dedupe percentage",
4306 .type = FIO_OPT_INT,
4307 .cb = str_dedupe_cb,
4308 .off1 = offsetof(struct thread_options, dedupe_percentage),
4311 .help = "Percentage of buffers that are dedupable",
4313 .category = FIO_OPT_C_IO,
4314 .group = FIO_OPT_G_IO_BUF,
4317 .name = "clat_percentiles",
4318 .lname = "Completion latency percentiles",
4319 .type = FIO_OPT_BOOL,
4320 .off1 = offsetof(struct thread_options, clat_percentiles),
4321 .help = "Enable the reporting of completion latency percentiles",
4323 .category = FIO_OPT_C_STAT,
4324 .group = FIO_OPT_G_INVALID,
4327 .name = "lat_percentiles",
4328 .lname = "IO latency percentiles",
4329 .type = FIO_OPT_BOOL,
4330 .off1 = offsetof(struct thread_options, lat_percentiles),
4331 .help = "Enable the reporting of IO latency percentiles",
4333 .category = FIO_OPT_C_STAT,
4334 .group = FIO_OPT_G_INVALID,
4337 .name = "slat_percentiles",
4338 .lname = "Submission latency percentiles",
4339 .type = FIO_OPT_BOOL,
4340 .off1 = offsetof(struct thread_options, slat_percentiles),
4341 .help = "Enable the reporting of submission latency percentiles",
4343 .category = FIO_OPT_C_STAT,
4344 .group = FIO_OPT_G_INVALID,
4347 .name = "percentile_list",
4348 .lname = "Percentile list",
4349 .type = FIO_OPT_FLOAT_LIST,
4350 .off1 = offsetof(struct thread_options, percentile_list),
4351 .off2 = offsetof(struct thread_options, percentile_precision),
4352 .help = "Specify a custom list of percentiles to report for "
4353 "completion latency and block errors",
4354 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
4355 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4358 .category = FIO_OPT_C_STAT,
4359 .group = FIO_OPT_G_INVALID,
4362 .name = "significant_figures",
4363 .lname = "Significant figures",
4364 .type = FIO_OPT_INT,
4365 .off1 = offsetof(struct thread_options, sig_figs),
4368 .help = "Significant figures for output-format set to normal",
4371 .category = FIO_OPT_C_STAT,
4372 .group = FIO_OPT_G_INVALID,
4375 #ifdef FIO_HAVE_DISK_UTIL
4377 .name = "disk_util",
4378 .lname = "Disk utilization",
4379 .type = FIO_OPT_BOOL,
4380 .off1 = offsetof(struct thread_options, do_disk_util),
4381 .help = "Log disk utilization statistics",
4383 .category = FIO_OPT_C_STAT,
4384 .group = FIO_OPT_G_INVALID,
4388 .name = "disk_util",
4389 .lname = "Disk utilization",
4390 .type = FIO_OPT_UNSUPPORTED,
4391 .help = "Your platform does not support disk utilization",
4395 .name = "gtod_reduce",
4396 .lname = "Reduce gettimeofday() calls",
4397 .type = FIO_OPT_BOOL,
4398 .help = "Greatly reduce number of gettimeofday() calls",
4399 .cb = str_gtod_reduce_cb,
4402 .category = FIO_OPT_C_STAT,
4403 .group = FIO_OPT_G_INVALID,
4406 .name = "disable_lat",
4407 .lname = "Disable all latency stats",
4408 .type = FIO_OPT_BOOL,
4409 .off1 = offsetof(struct thread_options, disable_lat),
4410 .help = "Disable latency numbers",
4411 .parent = "gtod_reduce",
4414 .category = FIO_OPT_C_STAT,
4415 .group = FIO_OPT_G_INVALID,
4418 .name = "disable_clat",
4419 .lname = "Disable completion latency stats",
4420 .type = FIO_OPT_BOOL,
4421 .off1 = offsetof(struct thread_options, disable_clat),
4422 .help = "Disable completion latency numbers",
4423 .parent = "gtod_reduce",
4426 .category = FIO_OPT_C_STAT,
4427 .group = FIO_OPT_G_INVALID,
4430 .name = "disable_slat",
4431 .lname = "Disable submission latency stats",
4432 .type = FIO_OPT_BOOL,
4433 .off1 = offsetof(struct thread_options, disable_slat),
4434 .help = "Disable submission latency numbers",
4435 .parent = "gtod_reduce",
4438 .category = FIO_OPT_C_STAT,
4439 .group = FIO_OPT_G_INVALID,
4442 .name = "disable_bw_measurement",
4443 .alias = "disable_bw",
4444 .lname = "Disable bandwidth stats",
4445 .type = FIO_OPT_BOOL,
4446 .off1 = offsetof(struct thread_options, disable_bw),
4447 .help = "Disable bandwidth logging",
4448 .parent = "gtod_reduce",
4451 .category = FIO_OPT_C_STAT,
4452 .group = FIO_OPT_G_INVALID,
4456 .lname = "Dedicated gettimeofday() CPU",
4457 .type = FIO_OPT_INT,
4458 .off1 = offsetof(struct thread_options, gtod_cpu),
4459 .help = "Set up dedicated gettimeofday() thread on this CPU",
4460 .verify = gtod_cpu_verify,
4461 .category = FIO_OPT_C_GENERAL,
4462 .group = FIO_OPT_G_CLOCK,
4465 .name = "unified_rw_reporting",
4466 .lname = "Unified RW Reporting",
4467 .type = FIO_OPT_BOOL,
4468 .off1 = offsetof(struct thread_options, unified_rw_rep),
4469 .help = "Unify reporting across data direction",
4471 .category = FIO_OPT_C_GENERAL,
4472 .group = FIO_OPT_G_INVALID,
4475 .name = "continue_on_error",
4476 .lname = "Continue on error",
4477 .type = FIO_OPT_STR,
4478 .off1 = offsetof(struct thread_options, continue_on_error),
4479 .help = "Continue on non-fatal errors during IO",
4481 .category = FIO_OPT_C_GENERAL,
4482 .group = FIO_OPT_G_ERR,
4485 .oval = ERROR_TYPE_NONE,
4486 .help = "Exit when an error is encountered",
4489 .oval = ERROR_TYPE_READ,
4490 .help = "Continue on read errors only",
4493 .oval = ERROR_TYPE_WRITE,
4494 .help = "Continue on write errors only",
4497 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
4498 .help = "Continue on any IO errors",
4501 .oval = ERROR_TYPE_VERIFY,
4502 .help = "Continue on verify errors only",
4505 .oval = ERROR_TYPE_ANY,
4506 .help = "Continue on all io and verify errors",
4509 .oval = ERROR_TYPE_NONE,
4510 .help = "Alias for 'none'",
4513 .oval = ERROR_TYPE_ANY,
4514 .help = "Alias for 'all'",
4519 .name = "ignore_error",
4520 .lname = "Ignore Error",
4521 .type = FIO_OPT_STR,
4522 .cb = str_ignore_error_cb,
4523 .off1 = offsetof(struct thread_options, ignore_error_nr),
4524 .help = "Set a specific list of errors to ignore",
4526 .category = FIO_OPT_C_GENERAL,
4527 .group = FIO_OPT_G_ERR,
4530 .name = "error_dump",
4531 .lname = "Error Dump",
4532 .type = FIO_OPT_BOOL,
4533 .off1 = offsetof(struct thread_options, error_dump),
4535 .help = "Dump info on each error",
4536 .category = FIO_OPT_C_GENERAL,
4537 .group = FIO_OPT_G_ERR,
4542 .type = FIO_OPT_STR_STORE,
4543 .off1 = offsetof(struct thread_options, profile),
4544 .help = "Select a specific builtin performance test",
4545 .category = FIO_OPT_C_PROFILE,
4546 .group = FIO_OPT_G_INVALID,
4551 .type = FIO_OPT_STR_STORE,
4552 .off1 = offsetof(struct thread_options, cgroup),
4553 .help = "Add job to cgroup of this name",
4554 .category = FIO_OPT_C_GENERAL,
4555 .group = FIO_OPT_G_CGROUP,
4558 .name = "cgroup_nodelete",
4559 .lname = "Cgroup no-delete",
4560 .type = FIO_OPT_BOOL,
4561 .off1 = offsetof(struct thread_options, cgroup_nodelete),
4562 .help = "Do not delete cgroups after job completion",
4565 .category = FIO_OPT_C_GENERAL,
4566 .group = FIO_OPT_G_CGROUP,
4569 .name = "cgroup_weight",
4570 .lname = "Cgroup weight",
4571 .type = FIO_OPT_INT,
4572 .off1 = offsetof(struct thread_options, cgroup_weight),
4573 .help = "Use given weight for cgroup",
4577 .category = FIO_OPT_C_GENERAL,
4578 .group = FIO_OPT_G_CGROUP,
4583 .type = FIO_OPT_INT,
4584 .off1 = offsetof(struct thread_options, uid),
4585 .help = "Run job with this user ID",
4586 .category = FIO_OPT_C_GENERAL,
4587 .group = FIO_OPT_G_CRED,
4591 .lname = "Group ID",
4592 .type = FIO_OPT_INT,
4593 .off1 = offsetof(struct thread_options, gid),
4594 .help = "Run job with this group ID",
4595 .category = FIO_OPT_C_GENERAL,
4596 .group = FIO_OPT_G_CRED,
4601 .type = FIO_OPT_STR,
4602 .off1 = offsetof(struct thread_options, kb_base),
4608 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
4612 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
4615 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
4616 .category = FIO_OPT_C_GENERAL,
4617 .group = FIO_OPT_G_INVALID,
4620 .name = "unit_base",
4621 .lname = "Unit for quantities of data (Bits or Bytes)",
4622 .type = FIO_OPT_STR,
4623 .off1 = offsetof(struct thread_options, unit_base),
4628 .help = "Auto-detect",
4631 .oval = N2S_BYTEPERSEC,
4632 .help = "Normal (byte based)",
4635 .oval = N2S_BITPERSEC,
4636 .help = "Bit based",
4639 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
4640 .category = FIO_OPT_C_GENERAL,
4641 .group = FIO_OPT_G_INVALID,
4644 .name = "hugepage-size",
4645 .lname = "Hugepage size",
4646 .type = FIO_OPT_INT,
4647 .off1 = offsetof(struct thread_options, hugepage_size),
4648 .help = "When using hugepages, specify size of each page",
4649 .def = __fio_stringify(FIO_HUGE_PAGE),
4650 .interval = 1024 * 1024,
4651 .category = FIO_OPT_C_GENERAL,
4652 .group = FIO_OPT_G_INVALID,
4656 .lname = "I/O flow ID",
4657 .type = FIO_OPT_INT,
4658 .off1 = offsetof(struct thread_options, flow_id),
4659 .help = "The flow index ID to use",
4661 .category = FIO_OPT_C_IO,
4662 .group = FIO_OPT_G_IO_FLOW,
4666 .lname = "I/O flow weight",
4667 .type = FIO_OPT_INT,
4668 .off1 = offsetof(struct thread_options, flow),
4669 .help = "Weight for flow control of this job",
4670 .parent = "flow_id",
4673 .category = FIO_OPT_C_IO,
4674 .group = FIO_OPT_G_IO_FLOW,
4677 .name = "flow_watermark",
4678 .lname = "I/O flow watermark",
4679 .type = FIO_OPT_INT,
4680 .off1 = offsetof(struct thread_options, flow_watermark),
4681 .help = "High watermark for flow control. This option"
4682 " should be set to the same value for all threads"
4683 " with non-zero flow.",
4684 .parent = "flow_id",
4687 .category = FIO_OPT_C_IO,
4688 .group = FIO_OPT_G_IO_FLOW,
4691 .name = "flow_sleep",
4692 .lname = "I/O flow sleep",
4693 .type = FIO_OPT_INT,
4694 .off1 = offsetof(struct thread_options, flow_sleep),
4695 .help = "How many microseconds to sleep after being held"
4696 " back by the flow control mechanism",
4697 .parent = "flow_id",
4700 .category = FIO_OPT_C_IO,
4701 .group = FIO_OPT_G_IO_FLOW,
4704 .name = "steadystate",
4705 .lname = "Steady state threshold",
4707 .type = FIO_OPT_STR,
4708 .off1 = offsetof(struct thread_options, ss_state),
4709 .cb = str_steadystate_cb,
4710 .help = "Define the criterion and limit to judge when a job has reached steady state",
4711 .def = "iops_slope:0.01%",
4714 .oval = FIO_SS_IOPS,
4715 .help = "maximum mean deviation of IOPS measurements",
4717 { .ival = "iops_slope",
4718 .oval = FIO_SS_IOPS_SLOPE,
4719 .help = "slope calculated from IOPS measurements",
4723 .help = "maximum mean deviation of bandwidth measurements",
4727 .oval = FIO_SS_BW_SLOPE,
4728 .help = "slope calculated from bandwidth measurements",
4731 .category = FIO_OPT_C_GENERAL,
4732 .group = FIO_OPT_G_RUNTIME,
4735 .name = "steadystate_duration",
4736 .lname = "Steady state duration",
4738 .parent = "steadystate",
4739 .type = FIO_OPT_STR_VAL_TIME,
4740 .off1 = offsetof(struct thread_options, ss_dur),
4741 .help = "Stop workload upon attaining steady state for specified duration",
4745 .category = FIO_OPT_C_GENERAL,
4746 .group = FIO_OPT_G_RUNTIME,
4749 .name = "steadystate_ramp_time",
4750 .lname = "Steady state ramp time",
4752 .parent = "steadystate",
4753 .type = FIO_OPT_STR_VAL_TIME,
4754 .off1 = offsetof(struct thread_options, ss_ramp_time),
4755 .help = "Delay before initiation of data collection for steady state job termination testing",
4759 .category = FIO_OPT_C_GENERAL,
4760 .group = FIO_OPT_G_RUNTIME,
4767 static void add_to_lopt(struct option *lopt, struct fio_option *o,
4768 const char *name, int val)
4770 lopt->name = (char *) name;
4772 if (o->type == FIO_OPT_STR_SET)
4773 lopt->has_arg = optional_argument;
4775 lopt->has_arg = required_argument;
4778 static void options_to_lopts(struct fio_option *opts,
4779 struct option *long_options,
4780 int i, int option_type)
4782 struct fio_option *o = &opts[0];
4784 add_to_lopt(&long_options[i], o, o->name, option_type);
4787 add_to_lopt(&long_options[i], o, o->alias, option_type);
4792 assert(i < FIO_NR_OPTIONS);
4796 void fio_options_set_ioengine_opts(struct option *long_options,
4797 struct thread_data *td)
4802 while (long_options[i].name) {
4803 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
4804 memset(&long_options[i], 0, sizeof(*long_options));
4811 * Just clear out the prior ioengine options.
4816 options_to_lopts(td->io_ops->options, long_options, i,
4817 FIO_GETOPT_IOENGINE);
4820 void fio_options_dup_and_init(struct option *long_options)
4824 options_init(fio_options);
4827 while (long_options[i].name)
4830 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
4833 struct fio_keyword {
4839 static struct fio_keyword fio_keywords[] = {
4841 .word = "$pagesize",
4842 .desc = "Page size in the system",
4845 .word = "$mb_memory",
4846 .desc = "Megabytes of memory online",
4850 .desc = "Number of CPUs online in the system",
4857 void fio_keywords_exit(void)
4859 struct fio_keyword *kw;
4861 kw = &fio_keywords[0];
4869 void fio_keywords_init(void)
4871 unsigned long long mb_memory;
4875 sprintf(buf, "%lu", (unsigned long) page_size);
4876 fio_keywords[0].replace = strdup(buf);
4878 mb_memory = os_phys_mem() / (1024 * 1024);
4879 sprintf(buf, "%llu", mb_memory);
4880 fio_keywords[1].replace = strdup(buf);
4883 sprintf(buf, "%lu", l);
4884 fio_keywords[2].replace = strdup(buf);
4889 static char *bc_calc(char *str)
4891 char buf[128], *tmp;
4896 * No math, just return string
4898 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
4899 !strchr(str, '/')) || strchr(str, '\''))
4903 * Split option from value, we only need to calculate the value
4905 tmp = strchr(str, '=');
4912 * Prevent buffer overflows; such a case isn't reasonable anyway
4914 if (strlen(str) >= 128 || strlen(tmp) > 100)
4917 sprintf(buf, "which %s > /dev/null", BC_APP);
4919 log_err("fio: bc is needed for performing math\n");
4923 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
4924 f = popen(buf, "r");
4928 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
4935 buf[(tmp - str) + ret - 1] = '\0';
4936 memcpy(buf, str, tmp - str);
4942 * Return a copy of the input string with substrings of the form ${VARNAME}
4943 * substituted with the value of the environment variable VARNAME. The
4944 * substitution always occurs, even if VARNAME is empty or the corresponding
4945 * environment variable undefined.
4947 char *fio_option_dup_subs(const char *opt)
4949 char out[OPT_LEN_MAX+1];
4950 char in[OPT_LEN_MAX+1];
4953 char *ch1, *ch2, *env;
4954 ssize_t nchr = OPT_LEN_MAX;
4957 if (strlen(opt) + 1 > OPT_LEN_MAX) {
4958 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
4962 snprintf(in, sizeof(in), "%s", opt);
4964 while (*inptr && nchr > 0) {
4965 if (inptr[0] == '$' && inptr[1] == '{') {
4966 ch2 = strchr(inptr, '}');
4967 if (ch2 && inptr+1 < ch2) {
4974 envlen = strlen(env);
4975 if (envlen <= nchr) {
4976 memcpy(outptr, env, envlen);
4986 *outptr++ = *inptr++;
4995 * Look for reserved variable names and replace them with real values
4997 static char *fio_keyword_replace(char *opt)
5003 for (i = 0; fio_keywords[i].word != NULL; i++) {
5004 struct fio_keyword *kw = &fio_keywords[i];
5006 while ((s = strstr(opt, kw->word)) != NULL) {
5007 char *new = malloc(strlen(opt) + 1);
5013 * Copy part of the string before the keyword and
5014 * sprintf() the replacement after it.
5016 memcpy(new, opt, olen);
5017 len = sprintf(new + olen, "%s", kw->replace);
5020 * If there's more in the original string, copy that
5023 opt += strlen(kw->word) + olen;
5025 memcpy(new + olen + len, opt, opt - o_org - 1);
5028 * replace opt and free the old opt
5038 * Check for potential math and invoke bc, if possible
5046 static char **dup_and_sub_options(char **opts, int num_opts)
5049 char **opts_copy = malloc(num_opts * sizeof(*opts));
5050 for (i = 0; i < num_opts; i++) {
5051 opts_copy[i] = fio_option_dup_subs(opts[i]);
5054 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
5059 static void show_closest_option(const char *opt)
5061 int best_option, best_distance;
5070 while (name[i] != '\0' && name[i] != '=')
5075 best_distance = INT_MAX;
5077 while (fio_options[i].name) {
5078 distance = string_distance(name, fio_options[i].name);
5079 if (distance < best_distance) {
5080 best_distance = distance;
5086 if (best_option != -1 && string_distance_ok(name, best_distance) &&
5087 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
5088 log_err("Did you mean %s?\n", fio_options[best_option].name);
5093 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
5095 int i, ret, unknown;
5098 sort_options(opts, fio_options, num_opts);
5099 opts_copy = dup_and_sub_options(opts, num_opts);
5101 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
5102 const struct fio_option *o;
5103 int newret = parse_option(opts_copy[i], opts[i], fio_options,
5104 &o, &td->o, &td->opt_list);
5107 fio_option_mark_set(&td->o, o);
5115 opts_copy[i] = NULL;
5122 ret |= ioengine_load(td);
5124 sort_options(opts_copy, td->io_ops->options, num_opts);
5127 for (i = 0; i < num_opts; i++) {
5128 const struct fio_option *o = NULL;
5135 newret = parse_option(opts_copy[i], opts[i],
5136 td->io_ops->options, &o,
5137 td->eo, &td->opt_list);
5141 log_err("Bad option <%s>\n", opts[i]);
5142 show_closest_option(opts[i]);
5145 opts_copy[i] = NULL;
5153 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
5157 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
5159 const struct fio_option *o;
5161 o = find_option_c(fio_options, opt);
5163 fio_option_mark_set(&td->o, o);
5169 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
5172 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
5176 void fio_fill_default_options(struct thread_data *td)
5178 td->o.magic = OPT_MAGIC;
5179 fill_default_options(&td->o, fio_options);
5182 int fio_show_option_help(const char *opt)
5184 return show_cmd_help(fio_options, opt);
5188 * dupe FIO_OPT_STR_STORE options
5190 void fio_options_mem_dupe(struct thread_data *td)
5192 options_mem_dupe(fio_options, &td->o);
5194 if (td->eo && td->io_ops) {
5195 void *oldeo = td->eo;
5197 td->eo = malloc(td->io_ops->option_struct_size);
5198 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
5199 options_mem_dupe(td->io_ops->options, td->eo);
5203 unsigned int fio_get_kb_base(void *data)
5205 struct thread_data *td = cb_data_to_td(data);
5206 struct thread_options *o = &td->o;
5207 unsigned int kb_base = 0;
5210 * This is a hack... For private options, *data is not holding
5211 * a pointer to the thread_options, but to private data. This means
5212 * we can't safely dereference it, but magic is first so mem wise
5213 * it is valid. But this also means that if the job first sets
5214 * kb_base and expects that to be honored by private options,
5215 * it will be disappointed. We will return the global default
5218 if (o && o->magic == OPT_MAGIC)
5219 kb_base = o->kb_base;
5226 int add_option(const struct fio_option *o)
5228 struct fio_option *__o;
5237 if (opt_index + 1 == FIO_MAX_OPTS) {
5238 log_err("fio: FIO_MAX_OPTS is too small\n");
5242 memcpy(&fio_options[opt_index], o, sizeof(*o));
5243 fio_options[opt_index + 1].name = NULL;
5247 void invalidate_profile_options(const char *prof_name)
5249 struct fio_option *o;
5253 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5254 o->type = FIO_OPT_INVALID;
5255 o->prof_name = NULL;
5261 void add_opt_posval(const char *optname, const char *ival, const char *help)
5263 struct fio_option *o;
5266 o = find_option(fio_options, optname);
5270 for (i = 0; i < PARSE_MAX_VP; i++) {
5271 if (o->posval[i].ival)
5274 o->posval[i].ival = ival;
5275 o->posval[i].help = help;
5280 void del_opt_posval(const char *optname, const char *ival)
5282 struct fio_option *o;
5285 o = find_option(fio_options, optname);
5289 for (i = 0; i < PARSE_MAX_VP; i++) {
5290 if (!o->posval[i].ival)
5292 if (strcmp(o->posval[i].ival, ival))
5295 o->posval[i].ival = NULL;
5296 o->posval[i].help = NULL;
5300 void fio_options_free(struct thread_data *td)
5302 options_free(fio_options, &td->o);
5303 if (td->eo && td->io_ops && td->io_ops->options) {
5304 options_free(td->io_ops->options, td->eo);
5310 struct fio_option *fio_option_find(const char *name)
5312 return find_option(fio_options, name);
5315 static struct fio_option *find_next_opt(struct fio_option *from,
5318 struct fio_option *opt;
5321 from = &fio_options[0];
5327 if (off1 == from->off1) {
5332 } while (from->name);
5337 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5339 unsigned int opt_off, index, offset;
5341 opt_off = opt - &fio_options[0];
5342 index = opt_off / (8 * sizeof(uint64_t));
5343 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5344 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
5347 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
5349 struct fio_option *opt, *next;
5352 while ((opt = find_next_opt(next, off1)) != NULL) {
5353 if (opt_is_set(o, opt))
5362 void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt)
5364 unsigned int opt_off, index, offset;
5366 opt_off = opt - &fio_options[0];
5367 index = opt_off / (8 * sizeof(uint64_t));
5368 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5369 o->set_options[index] |= (uint64_t)1 << offset;