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_iodepth_mode_cb(void *data, const char *input)
486 struct thread_data *td = cb_data_to_td(data);
487 struct thread_options *o = &td->o;
491 if (o->iodepth_mode == IOD_NONE)
497 p = str = strdup(input);
499 strip_blank_front(&str);
500 strip_blank_end(str);
508 /* format is now 'low-min/step' */
509 ret = sscanf(n, "%u-%u/%u,%u/%u", &o->lat_step_low, &o->lat_step_high,
510 &o->lat_step_inc, &o->lat_step_ramp,
514 o->lat_step_ramp *= 1000;
515 o->lat_step_run *= 1000;
516 } else if (ret == 3) {
517 o->lat_step_ramp = IOD_STEPPED_DEF_RAMP;
518 o->lat_step_run = IOD_STEPPED_DEF_RUN;
524 log_err("fio: failed parsing <%s>\n", input);
529 static int str_exitall_cb(void)
531 exitall_on_terminate = true;
535 #ifdef FIO_HAVE_CPU_AFFINITY
536 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
538 unsigned int i, index, cpus_in_mask;
539 const long max_cpu = cpus_online();
541 cpus_in_mask = fio_cpu_count(mask);
542 cpu_index = cpu_index % cpus_in_mask;
545 for (i = 0; i < max_cpu; i++) {
546 if (!fio_cpu_isset(mask, i))
549 if (cpu_index != index)
550 fio_cpu_clear(mask, i);
555 return fio_cpu_count(mask);
558 static int str_cpumask_cb(void *data, unsigned long long *val)
560 struct thread_data *td = cb_data_to_td(data);
568 ret = fio_cpuset_init(&td->o.cpumask);
570 log_err("fio: cpuset_init failed\n");
571 td_verror(td, ret, "fio_cpuset_init");
575 max_cpu = cpus_online();
577 for (i = 0; i < sizeof(int) * 8; i++) {
578 if ((1 << i) & *val) {
580 log_err("fio: CPU %d too large (max=%ld)\n", i,
584 dprint(FD_PARSE, "set cpu allowed %d\n", i);
585 fio_cpu_set(&td->o.cpumask, i);
592 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
599 ret = fio_cpuset_init(mask);
601 log_err("fio: cpuset_init failed\n");
602 td_verror(td, ret, "fio_cpuset_init");
606 p = str = strdup(input);
608 strip_blank_front(&str);
609 strip_blank_end(str);
611 max_cpu = cpus_online();
613 while ((cpu = strsep(&str, ",")) != NULL) {
622 while ((cpu2 = strsep(&str2, "-")) != NULL) {
632 while (icpu <= icpu2) {
633 if (icpu >= FIO_MAX_CPUS) {
634 log_err("fio: your OS only supports up to"
635 " %d CPUs\n", (int) FIO_MAX_CPUS);
639 if (icpu >= max_cpu) {
640 log_err("fio: CPU %d too large (max=%ld)\n",
646 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
647 fio_cpu_set(mask, icpu);
658 static int str_cpus_allowed_cb(void *data, const char *input)
660 struct thread_data *td = cb_data_to_td(data);
665 return set_cpus_allowed(td, &td->o.cpumask, input);
668 static int str_verify_cpus_allowed_cb(void *data, const char *input)
670 struct thread_data *td = cb_data_to_td(data);
675 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
679 static int str_log_cpus_allowed_cb(void *data, const char *input)
681 struct thread_data *td = cb_data_to_td(data);
686 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
688 #endif /* CONFIG_ZLIB */
690 #endif /* FIO_HAVE_CPU_AFFINITY */
692 #ifdef CONFIG_LIBNUMA
693 static int str_numa_cpunodes_cb(void *data, char *input)
695 struct thread_data *td = cb_data_to_td(data);
696 struct bitmask *verify_bitmask;
701 /* numa_parse_nodestring() parses a character string list
702 * of nodes into a bit mask. The bit mask is allocated by
703 * numa_allocate_nodemask(), so it should be freed by
704 * numa_free_nodemask().
706 verify_bitmask = numa_parse_nodestring(input);
707 if (verify_bitmask == NULL) {
708 log_err("fio: numa_parse_nodestring failed\n");
709 td_verror(td, 1, "str_numa_cpunodes_cb");
712 numa_free_nodemask(verify_bitmask);
714 td->o.numa_cpunodes = strdup(input);
718 static int str_numa_mpol_cb(void *data, char *input)
720 struct thread_data *td = cb_data_to_td(data);
721 const char * const policy_types[] =
722 { "default", "prefer", "bind", "interleave", "local", NULL };
725 struct bitmask *verify_bitmask;
730 nodelist = strchr(input, ':');
732 /* NUL-terminate mode */
736 for (i = 0; i <= MPOL_LOCAL; i++) {
737 if (!strcmp(input, policy_types[i])) {
738 td->o.numa_mem_mode = i;
742 if (i > MPOL_LOCAL) {
743 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
747 switch (td->o.numa_mem_mode) {
750 * Insist on a nodelist of one node only
753 char *rest = nodelist;
754 while (isdigit(*rest))
757 log_err("fio: one node only for \'prefer\'\n");
761 log_err("fio: one node is needed for \'prefer\'\n");
765 case MPOL_INTERLEAVE:
767 * Default to online nodes with memory if no nodelist
770 nodelist = strdup("all");
775 * Don't allow a nodelist
778 log_err("fio: NO nodelist for \'local\'\n");
784 * Insist on a nodelist
787 log_err("fio: a nodelist is needed for \'bind\'\n");
794 /* numa_parse_nodestring() parses a character string list
795 * of nodes into a bit mask. The bit mask is allocated by
796 * numa_allocate_nodemask(), so it should be freed by
797 * numa_free_nodemask().
799 switch (td->o.numa_mem_mode) {
801 td->o.numa_mem_prefer_node = atoi(nodelist);
803 case MPOL_INTERLEAVE:
805 verify_bitmask = numa_parse_nodestring(nodelist);
806 if (verify_bitmask == NULL) {
807 log_err("fio: numa_parse_nodestring failed\n");
808 td_verror(td, 1, "str_numa_memnodes_cb");
811 td->o.numa_memnodes = strdup(nodelist);
812 numa_free_nodemask(verify_bitmask);
827 static int str_fst_cb(void *data, const char *str)
829 struct thread_data *td = cb_data_to_td(data);
834 td->file_service_nr = 1;
836 switch (td->o.file_service_type) {
837 case FIO_FSERVICE_RANDOM:
838 case FIO_FSERVICE_RR:
839 case FIO_FSERVICE_SEQ:
840 nr = get_opt_postfix(str);
842 td->file_service_nr = atoi(nr);
847 case FIO_FSERVICE_ZIPF:
850 case FIO_FSERVICE_PARETO:
851 val = FIO_DEF_PARETO;
853 case FIO_FSERVICE_GAUSS:
857 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
864 nr = get_opt_postfix(str);
865 if (nr && !str_to_float(nr, &val, 0)) {
866 log_err("fio: file service type random postfix parsing failed\n");
873 switch (td->o.file_service_type) {
874 case FIO_FSERVICE_ZIPF:
876 log_err("fio: zipf theta must be different than 1.0\n");
881 td->zipf_theta = val;
883 case FIO_FSERVICE_PARETO:
884 if (val <= 0.00 || val >= 1.00) {
885 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
892 case FIO_FSERVICE_GAUSS:
893 if (val < 0.00 || val >= 100.00) {
894 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
906 #ifdef CONFIG_SYNC_FILE_RANGE
907 static int str_sfr_cb(void *data, const char *str)
909 struct thread_data *td = cb_data_to_td(data);
910 char *nr = get_opt_postfix(str);
912 td->sync_file_range_nr = 1;
914 td->sync_file_range_nr = atoi(nr);
922 static int zone_split_ddir(struct thread_options *o, enum fio_ddir ddir,
923 char *str, bool absolute)
925 unsigned int i, perc, perc_missing, sperc, sperc_missing;
928 memset(&split, 0, sizeof(split));
930 if (split_parse_ddir(o, &split, str, absolute, ZONESPLIT_MAX))
935 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
936 o->zone_split_nr[ddir] = split.nr;
937 for (i = 0; i < split.nr; i++) {
938 o->zone_split[ddir][i].access_perc = split.val1[i];
940 o->zone_split[ddir][i].size = split.val2[i];
942 o->zone_split[ddir][i].size_perc = split.val2[i];
946 * Now check if the percentages add up, and how much is missing
948 perc = perc_missing = 0;
949 sperc = sperc_missing = 0;
950 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
951 struct zone_split *zsp = &o->zone_split[ddir][i];
953 if (zsp->access_perc == (uint8_t) -1U)
956 perc += zsp->access_perc;
959 if (zsp->size_perc == (uint8_t) -1U)
962 sperc += zsp->size_perc;
966 if (perc > 100 || sperc > 100) {
967 log_err("fio: zone_split percentages add to more than 100%%\n");
968 free(o->zone_split[ddir]);
969 o->zone_split[ddir] = NULL;
973 log_err("fio: access percentage don't add up to 100 for zoned "
974 "random distribution (got=%u)\n", perc);
975 free(o->zone_split[ddir]);
976 o->zone_split[ddir] = NULL;
981 * If values didn't have a percentage set, divide the remains between
985 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
987 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
988 struct zone_split *zsp = &o->zone_split[ddir][i];
990 if (zsp->access_perc == (uint8_t) -1U)
991 zsp->access_perc = (100 - perc) / perc_missing;
995 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
997 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
998 struct zone_split *zsp = &o->zone_split[ddir][i];
1000 if (zsp->size_perc == (uint8_t) -1U)
1001 zsp->size_perc = (100 - sperc) / sperc_missing;
1008 static int parse_zoned_distribution(struct thread_data *td, const char *input,
1011 const char *pre = absolute ? "zoned_abs:" : "zoned:";
1015 p = str = strdup(input);
1017 strip_blank_front(&str);
1018 strip_blank_end(str);
1020 /* We expect it to start like that, bail if not */
1021 if (strncmp(str, pre, strlen(pre))) {
1022 log_err("fio: mismatch in zoned input <%s>\n", str);
1028 ret = str_split_parse(td, str, zone_split_ddir, absolute);
1032 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1035 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
1037 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
1038 struct zone_split *zsp = &td->o.zone_split[i][j];
1041 dprint(FD_PARSE, "\t%d: %u/%llu\n", j,
1043 (unsigned long long) zsp->size);
1045 dprint(FD_PARSE, "\t%d: %u/%u\n", j,
1052 if (parse_dryrun()) {
1053 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1054 free(td->o.zone_split[i]);
1055 td->o.zone_split[i] = NULL;
1056 td->o.zone_split_nr[i] = 0;
1063 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1064 td->o.zone_split_nr[i] = 0;
1070 static int str_random_distribution_cb(void *data, const char *str)
1072 struct thread_data *td = cb_data_to_td(data);
1076 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1078 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1079 val = FIO_DEF_PARETO;
1080 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1082 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1083 return parse_zoned_distribution(td, str, false);
1084 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED_ABS)
1085 return parse_zoned_distribution(td, str, true);
1089 nr = get_opt_postfix(str);
1090 if (nr && !str_to_float(nr, &val, 0)) {
1091 log_err("fio: random postfix parsing failed\n");
1098 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1100 log_err("fio: zipf theta must different than 1.0\n");
1105 td->o.zipf_theta.u.f = val;
1106 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1107 if (val <= 0.00 || val >= 1.00) {
1108 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1113 td->o.pareto_h.u.f = val;
1115 if (val < 0.00 || val >= 100.0) {
1116 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1121 td->o.gauss_dev.u.f = val;
1127 static int str_steadystate_cb(void *data, const char *str)
1129 struct thread_data *td = cb_data_to_td(data);
1135 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1136 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
1137 /* should be impossible to get here */
1138 log_err("fio: unknown steady state criterion\n");
1142 nr = get_opt_postfix(str);
1144 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1149 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1150 pct = strstr(nr, "%");
1153 strip_blank_end(nr);
1154 if (!str_to_float(nr, &val, 0)) {
1155 log_err("fio: could not parse steadystate threshold percentage\n");
1160 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1165 td->o.ss_state |= FIO_SS_PCT;
1166 td->o.ss_limit.u.f = val;
1167 } else if (td->o.ss_state & FIO_SS_IOPS) {
1168 if (!str_to_float(nr, &val, 0)) {
1169 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1174 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1179 td->o.ss_limit.u.f = val;
1180 } else { /* bandwidth criterion */
1181 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1182 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1187 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1192 td->o.ss_limit.u.f = (double) ll;
1195 td->ss.state = td->o.ss_state;
1200 * Return next name in the string. Files are separated with ':'. If the ':'
1201 * is escaped with a '\', then that ':' is part of the filename and does not
1202 * indicate a new file.
1204 char *get_next_str(char **ptr)
1209 if (!str || !strlen(str))
1215 * No colon, we are done
1217 p = strchr(str, ':');
1224 * We got a colon, but it's the first character. Skip and
1232 if (*(p - 1) != '\\') {
1238 memmove(p - 1, p, strlen(p) + 1);
1246 int get_max_str_idx(char *input)
1248 unsigned int cur_idx;
1251 p = str = strdup(input);
1252 for (cur_idx = 0; ; cur_idx++)
1253 if (get_next_str(&str) == NULL)
1261 * Returns the directory at the index, indexes > entires will be
1262 * assigned via modulo division of the index
1264 int set_name_idx(char *target, size_t tlen, char *input, int index,
1265 bool unique_filename)
1267 unsigned int cur_idx;
1269 char *fname, *str, *p;
1271 p = str = strdup(input);
1273 index %= get_max_str_idx(input);
1274 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1275 fname = get_next_str(&str);
1277 if (client_sockaddr_str[0] && unique_filename) {
1278 len = snprintf(target, tlen, "%s/%s.", fname,
1279 client_sockaddr_str);
1281 len = snprintf(target, tlen, "%s/", fname);
1283 target[tlen - 1] = '\0';
1289 char* get_name_by_idx(char *input, int index)
1291 unsigned int cur_idx;
1292 char *fname, *str, *p;
1294 p = str = strdup(input);
1296 index %= get_max_str_idx(input);
1297 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1298 fname = get_next_str(&str);
1300 fname = strdup(fname);
1306 static int str_filename_cb(void *data, const char *input)
1308 struct thread_data *td = cb_data_to_td(data);
1309 char *fname, *str, *p;
1311 p = str = strdup(input);
1313 strip_blank_front(&str);
1314 strip_blank_end(str);
1317 * Ignore what we may already have from nrfiles option.
1319 if (!td->files_index)
1322 while ((fname = get_next_str(&str)) != NULL) {
1325 add_file(td, fname, 0, 1);
1332 static int str_directory_cb(void *data, const char fio_unused *unused)
1334 struct thread_data *td = cb_data_to_td(data);
1336 char *dirname, *str, *p;
1342 p = str = strdup(td->o.directory);
1343 while ((dirname = get_next_str(&str)) != NULL) {
1344 if (lstat(dirname, &sb) < 0) {
1347 log_err("fio: %s is not a directory\n", dirname);
1348 td_verror(td, ret, "lstat");
1351 if (!S_ISDIR(sb.st_mode)) {
1352 log_err("fio: %s is not a directory\n", dirname);
1363 static int str_opendir_cb(void *data, const char fio_unused *str)
1365 struct thread_data *td = cb_data_to_td(data);
1370 if (!td->files_index)
1373 return add_dir_files(td, td->o.opendir);
1376 static int str_buffer_pattern_cb(void *data, const char *input)
1378 struct thread_data *td = cb_data_to_td(data);
1381 /* FIXME: for now buffer pattern does not support formats */
1382 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
1383 MAX_PATTERN_SIZE, NULL, 0, NULL, NULL);
1388 td->o.buffer_pattern_bytes = ret;
1391 * If this job is doing any reading or has compression set,
1392 * ensure that we refill buffers for writes or we could be
1393 * invalidating the pattern through reads.
1395 if (!td->o.compress_percentage && !td_read(td))
1396 td->o.refill_buffers = 0;
1398 td->o.refill_buffers = 1;
1400 td->o.scramble_buffers = 0;
1401 td->o.zero_buffers = 0;
1406 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1408 struct thread_data *td = cb_data_to_td(data);
1410 td->flags |= TD_F_COMPRESS;
1411 td->o.compress_percentage = *il;
1415 static int str_dedupe_cb(void *data, unsigned long long *il)
1417 struct thread_data *td = cb_data_to_td(data);
1419 td->flags |= TD_F_COMPRESS;
1420 td->o.dedupe_percentage = *il;
1421 td->o.refill_buffers = 1;
1425 static int str_verify_pattern_cb(void *data, const char *input)
1427 struct thread_data *td = cb_data_to_td(data);
1430 td->o.verify_fmt_sz = ARRAY_SIZE(td->o.verify_fmt);
1431 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
1432 MAX_PATTERN_SIZE, fmt_desc, sizeof(fmt_desc),
1433 td->o.verify_fmt, &td->o.verify_fmt_sz);
1438 td->o.verify_pattern_bytes = ret;
1440 * VERIFY_* could already be set
1442 if (!fio_option_is_set(&td->o, verify))
1443 td->o.verify = VERIFY_PATTERN;
1448 static int str_gtod_reduce_cb(void *data, int *il)
1450 struct thread_data *td = cb_data_to_td(data);
1453 td->o.disable_lat = !!val;
1454 td->o.disable_clat = !!val;
1455 td->o.disable_slat = !!val;
1456 td->o.disable_bw = !!val;
1457 td->o.clat_percentiles = !val;
1459 td->ts_cache_mask = 63;
1464 static int str_offset_cb(void *data, unsigned long long *__val)
1466 struct thread_data *td = cb_data_to_td(data);
1467 unsigned long long v = *__val;
1469 if (parse_is_percent(v)) {
1470 td->o.start_offset = 0;
1471 td->o.start_offset_percent = -1ULL - v;
1472 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1473 td->o.start_offset_percent);
1475 td->o.start_offset = v;
1480 static int str_size_cb(void *data, unsigned long long *__val)
1482 struct thread_data *td = cb_data_to_td(data);
1483 unsigned long long v = *__val;
1485 if (parse_is_percent(v)) {
1487 td->o.size_percent = -1ULL - v;
1488 dprint(FD_PARSE, "SET size_percent %d\n",
1489 td->o.size_percent);
1496 static int str_write_bw_log_cb(void *data, const char *str)
1498 struct thread_data *td = cb_data_to_td(data);
1501 td->o.bw_log_file = strdup(str);
1503 td->o.write_bw_log = 1;
1507 static int str_write_lat_log_cb(void *data, const char *str)
1509 struct thread_data *td = cb_data_to_td(data);
1512 td->o.lat_log_file = strdup(str);
1514 td->o.write_lat_log = 1;
1518 static int str_write_iops_log_cb(void *data, const char *str)
1520 struct thread_data *td = cb_data_to_td(data);
1523 td->o.iops_log_file = strdup(str);
1525 td->o.write_iops_log = 1;
1529 static int str_write_hist_log_cb(void *data, const char *str)
1531 struct thread_data *td = cb_data_to_td(data);
1534 td->o.hist_log_file = strdup(str);
1536 td->o.write_hist_log = 1;
1541 * str is supposed to be a substring of the strdup'd original string,
1542 * and is valid only if it's a regular file path.
1543 * This function keeps the pointer to the path as needed later.
1545 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1546 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1547 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1549 static int str_ioengine_external_cb(void *data, const char *str)
1551 struct thread_data *td = cb_data_to_td(data);
1556 log_err("fio: null external ioengine path\n");
1560 p = (char *)str; /* str is mutable */
1561 strip_blank_front(&p);
1564 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1565 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1569 td->o.ioengine_so_path = p;
1573 static int rw_verify(const struct fio_option *o, void *data)
1575 struct thread_data *td = cb_data_to_td(data);
1577 if (read_only && (td_write(td) || td_trim(td))) {
1578 log_err("fio: job <%s> has write or trim bit set, but"
1579 " fio is in read-only mode\n", td->o.name);
1586 static int gtod_cpu_verify(const struct fio_option *o, void *data)
1588 #ifndef FIO_HAVE_CPU_AFFINITY
1589 struct thread_data *td = cb_data_to_td(data);
1591 if (td->o.gtod_cpu) {
1592 log_err("fio: platform must support CPU affinity for"
1593 "gettimeofday() offloading\n");
1602 * Map of job/command line options
1604 struct fio_option fio_options[FIO_MAX_OPTS] = {
1606 .name = "description",
1607 .lname = "Description of job",
1608 .type = FIO_OPT_STR_STORE,
1609 .off1 = offsetof(struct thread_options, description),
1610 .help = "Text job description",
1611 .category = FIO_OPT_C_GENERAL,
1612 .group = FIO_OPT_G_DESC,
1616 .lname = "Job name",
1617 .type = FIO_OPT_STR_STORE,
1618 .off1 = offsetof(struct thread_options, name),
1619 .help = "Name of this job",
1620 .category = FIO_OPT_C_GENERAL,
1621 .group = FIO_OPT_G_DESC,
1625 .lname = "Waitee name",
1626 .type = FIO_OPT_STR_STORE,
1627 .off1 = offsetof(struct thread_options, wait_for),
1628 .help = "Name of the job this one wants to wait for before starting",
1629 .category = FIO_OPT_C_GENERAL,
1630 .group = FIO_OPT_G_DESC,
1634 .lname = "Filename(s)",
1635 .type = FIO_OPT_STR_STORE,
1636 .off1 = offsetof(struct thread_options, filename),
1637 .cb = str_filename_cb,
1638 .prio = -1, /* must come after "directory" */
1639 .help = "File(s) to use for the workload",
1640 .category = FIO_OPT_C_FILE,
1641 .group = FIO_OPT_G_FILENAME,
1644 .name = "directory",
1645 .lname = "Directory",
1646 .type = FIO_OPT_STR_STORE,
1647 .off1 = offsetof(struct thread_options, directory),
1648 .cb = str_directory_cb,
1649 .help = "Directory to store files in",
1650 .category = FIO_OPT_C_FILE,
1651 .group = FIO_OPT_G_FILENAME,
1654 .name = "filename_format",
1655 .lname = "Filename Format",
1656 .type = FIO_OPT_STR_STORE,
1657 .off1 = offsetof(struct thread_options, filename_format),
1658 .prio = -1, /* must come after "directory" */
1659 .help = "Override default $jobname.$jobnum.$filenum naming",
1660 .def = "$jobname.$jobnum.$filenum",
1661 .category = FIO_OPT_C_FILE,
1662 .group = FIO_OPT_G_FILENAME,
1665 .name = "unique_filename",
1666 .lname = "Unique Filename",
1667 .type = FIO_OPT_BOOL,
1668 .off1 = offsetof(struct thread_options, unique_filename),
1669 .help = "For network clients, prefix file with source IP",
1671 .category = FIO_OPT_C_FILE,
1672 .group = FIO_OPT_G_FILENAME,
1676 .lname = "Lockfile",
1677 .type = FIO_OPT_STR,
1678 .off1 = offsetof(struct thread_options, file_lock_mode),
1679 .help = "Lock file when doing IO to it",
1681 .parent = "filename",
1684 .category = FIO_OPT_C_FILE,
1685 .group = FIO_OPT_G_FILENAME,
1688 .oval = FILE_LOCK_NONE,
1689 .help = "No file locking",
1691 { .ival = "exclusive",
1692 .oval = FILE_LOCK_EXCLUSIVE,
1693 .help = "Exclusive file lock",
1696 .ival = "readwrite",
1697 .oval = FILE_LOCK_READWRITE,
1698 .help = "Read vs write lock",
1704 .lname = "Open directory",
1705 .type = FIO_OPT_STR_STORE,
1706 .off1 = offsetof(struct thread_options, opendir),
1707 .cb = str_opendir_cb,
1708 .help = "Recursively add files from this directory and down",
1709 .category = FIO_OPT_C_FILE,
1710 .group = FIO_OPT_G_FILENAME,
1714 .lname = "Read/write",
1715 .alias = "readwrite",
1716 .type = FIO_OPT_STR,
1718 .off1 = offsetof(struct thread_options, td_ddir),
1719 .help = "IO direction",
1721 .verify = rw_verify,
1722 .category = FIO_OPT_C_IO,
1723 .group = FIO_OPT_G_IO_BASIC,
1726 .oval = TD_DDIR_READ,
1727 .help = "Sequential read",
1730 .oval = TD_DDIR_WRITE,
1731 .help = "Sequential write",
1734 .oval = TD_DDIR_TRIM,
1735 .help = "Sequential trim",
1737 { .ival = "randread",
1738 .oval = TD_DDIR_RANDREAD,
1739 .help = "Random read",
1741 { .ival = "randwrite",
1742 .oval = TD_DDIR_RANDWRITE,
1743 .help = "Random write",
1745 { .ival = "randtrim",
1746 .oval = TD_DDIR_RANDTRIM,
1747 .help = "Random trim",
1751 .help = "Sequential read and write mix",
1753 { .ival = "readwrite",
1755 .help = "Sequential read and write mix",
1758 .oval = TD_DDIR_RANDRW,
1759 .help = "Random read and write mix"
1761 { .ival = "trimwrite",
1762 .oval = TD_DDIR_TRIMWRITE,
1763 .help = "Trim and write mix, trims preceding writes"
1768 .name = "rw_sequencer",
1769 .lname = "RW Sequencer",
1770 .type = FIO_OPT_STR,
1771 .off1 = offsetof(struct thread_options, rw_seq),
1772 .help = "IO offset generator modifier",
1773 .def = "sequential",
1774 .category = FIO_OPT_C_IO,
1775 .group = FIO_OPT_G_IO_BASIC,
1777 { .ival = "sequential",
1779 .help = "Generate sequential offsets",
1781 { .ival = "identical",
1782 .oval = RW_SEQ_IDENT,
1783 .help = "Generate identical offsets",
1790 .lname = "IO Engine",
1791 .type = FIO_OPT_STR_STORE,
1792 .off1 = offsetof(struct thread_options, ioengine),
1793 .help = "IO engine to use",
1794 .def = FIO_PREFERRED_ENGINE,
1795 .category = FIO_OPT_C_IO,
1796 .group = FIO_OPT_G_IO_BASIC,
1799 .help = "Use read/write",
1802 .help = "Use pread/pwrite",
1805 .help = "Use readv/writev",
1807 #ifdef CONFIG_PWRITEV
1809 .help = "Use preadv/pwritev",
1812 #ifdef FIO_HAVE_PWRITEV2
1813 { .ival = "pvsync2",
1814 .help = "Use preadv2/pwritev2",
1817 #ifdef CONFIG_LIBAIO
1819 .help = "Linux native asynchronous IO",
1822 #ifdef CONFIG_POSIXAIO
1823 { .ival = "posixaio",
1824 .help = "POSIX asynchronous IO",
1827 #ifdef CONFIG_SOLARISAIO
1828 { .ival = "solarisaio",
1829 .help = "Solaris native asynchronous IO",
1832 #ifdef CONFIG_WINDOWSAIO
1833 { .ival = "windowsaio",
1834 .help = "Windows native asynchronous IO"
1839 .help = "Rados Block Device asynchronous IO"
1843 .help = "Memory mapped IO"
1845 #ifdef CONFIG_LINUX_SPLICE
1847 .help = "splice/vmsplice based IO",
1849 { .ival = "netsplice",
1850 .help = "splice/vmsplice to/from the network",
1853 #ifdef FIO_HAVE_SGIO
1855 .help = "SCSI generic v3 IO",
1859 .help = "Testing engine (no data transfer)",
1862 .help = "Network IO",
1865 .help = "CPU cycle burner engine",
1869 .help = "GUASI IO engine",
1874 .help = "RDMA IO engine",
1877 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1878 { .ival = "e4defrag",
1879 .help = "ext4 defrag engine",
1882 #ifdef CONFIG_LINUX_FALLOCATE
1884 .help = "fallocate() file based engine",
1889 .help = "Glusterfs libgfapi(sync) based engine"
1891 { .ival = "gfapi_async",
1892 .help = "Glusterfs libgfapi(async) based engine"
1895 #ifdef CONFIG_LIBHDFS
1896 { .ival = "libhdfs",
1897 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1900 #ifdef CONFIG_PMEMBLK
1901 { .ival = "pmemblk",
1902 .help = "PMDK libpmemblk based IO engine",
1907 { .ival = "ime_psync",
1908 .help = "DDN's IME synchronous IO engine",
1910 { .ival = "ime_psyncv",
1911 .help = "DDN's IME synchronous IO engine using iovecs",
1913 { .ival = "ime_aio",
1914 .help = "DDN's IME asynchronous IO engine",
1917 #ifdef CONFIG_LINUX_DEVDAX
1918 { .ival = "dev-dax",
1919 .help = "DAX Device based IO engine",
1923 .ival = "filecreate",
1924 .help = "File creation engine",
1926 { .ival = "external",
1927 .help = "Load external engine (append name)",
1928 .cb = str_ioengine_external_cb,
1930 #ifdef CONFIG_LIBPMEM
1931 { .ival = "libpmem",
1932 .help = "PMDK libpmem based IO engine",
1937 .help = "HTTP (WebDAV/S3) IO engine",
1944 .lname = "IO Depth",
1945 .type = FIO_OPT_INT,
1946 .off1 = offsetof(struct thread_options, iodepth),
1947 .help = "Number of IO buffers to keep in flight",
1951 .category = FIO_OPT_C_IO,
1952 .group = FIO_OPT_G_IO_BASIC,
1955 .name = "iodepth_batch",
1956 .lname = "IO Depth batch",
1957 .alias = "iodepth_batch_submit",
1958 .type = FIO_OPT_INT,
1959 .off1 = offsetof(struct thread_options, iodepth_batch),
1960 .help = "Number of IO buffers to submit in one go",
1961 .parent = "iodepth",
1965 .category = FIO_OPT_C_IO,
1966 .group = FIO_OPT_G_IO_BASIC,
1969 .name = "iodepth_batch_complete_min",
1970 .lname = "Min IO depth batch complete",
1971 .alias = "iodepth_batch_complete",
1972 .type = FIO_OPT_INT,
1973 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
1974 .help = "Min number of IO buffers to retrieve in one go",
1975 .parent = "iodepth",
1980 .category = FIO_OPT_C_IO,
1981 .group = FIO_OPT_G_IO_BASIC,
1984 .name = "iodepth_batch_complete_max",
1985 .lname = "Max IO depth batch complete",
1986 .type = FIO_OPT_INT,
1987 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
1988 .help = "Max number of IO buffers to retrieve in one go",
1989 .parent = "iodepth",
1993 .category = FIO_OPT_C_IO,
1994 .group = FIO_OPT_G_IO_BASIC,
1997 .name = "iodepth_low",
1998 .lname = "IO Depth batch low",
1999 .type = FIO_OPT_INT,
2000 .off1 = offsetof(struct thread_options, iodepth_low),
2001 .help = "Low water mark for queuing depth",
2002 .parent = "iodepth",
2005 .category = FIO_OPT_C_IO,
2006 .group = FIO_OPT_G_IO_BASIC,
2009 .name = "iodepth_mode",
2010 .lname = "IO Depth Mode",
2011 .type = FIO_OPT_STR,
2012 .off1 = offsetof(struct thread_options, iodepth_mode),
2013 .cb = str_iodepth_mode_cb,
2014 .help = "How to vary the queue depth",
2015 .parent = "iodepth",
2018 .category = FIO_OPT_C_IO,
2019 .group = FIO_OPT_G_IO_BASIC,
2023 .help = "No depth modification",
2025 { .ival = "stepped",
2026 .oval = IOD_STEPPED,
2027 .help = "Stepped IO depth:hi-lo/inc,ramp/run",
2033 .name = "serialize_overlap",
2034 .lname = "Serialize overlap",
2035 .off1 = offsetof(struct thread_options, serialize_overlap),
2036 .type = FIO_OPT_BOOL,
2037 .help = "Wait for in-flight IOs that collide to complete",
2038 .parent = "iodepth",
2040 .category = FIO_OPT_C_IO,
2041 .group = FIO_OPT_G_IO_BASIC,
2044 .name = "io_submit_mode",
2045 .lname = "IO submit mode",
2046 .type = FIO_OPT_STR,
2047 .off1 = offsetof(struct thread_options, io_submit_mode),
2048 .help = "How IO submissions and completions are done",
2050 .category = FIO_OPT_C_IO,
2051 .group = FIO_OPT_G_IO_BASIC,
2054 .oval = IO_MODE_INLINE,
2055 .help = "Submit and complete IO inline",
2057 { .ival = "offload",
2058 .oval = IO_MODE_OFFLOAD,
2059 .help = "Offload submit and complete to threads",
2066 .type = FIO_OPT_STR_VAL,
2068 .off1 = offsetof(struct thread_options, size),
2069 .help = "Total size of device or files",
2070 .interval = 1024 * 1024,
2071 .category = FIO_OPT_C_IO,
2072 .group = FIO_OPT_G_INVALID,
2076 .alias = "io_limit",
2078 .type = FIO_OPT_STR_VAL,
2079 .off1 = offsetof(struct thread_options, io_size),
2080 .help = "Total size of I/O to be performed",
2081 .interval = 1024 * 1024,
2082 .category = FIO_OPT_C_IO,
2083 .group = FIO_OPT_G_INVALID,
2086 .name = "fill_device",
2087 .lname = "Fill device",
2089 .type = FIO_OPT_BOOL,
2090 .off1 = offsetof(struct thread_options, fill_device),
2091 .help = "Write until an ENOSPC error occurs",
2093 .category = FIO_OPT_C_FILE,
2094 .group = FIO_OPT_G_INVALID,
2098 .lname = "File size",
2099 .type = FIO_OPT_STR_VAL,
2100 .off1 = offsetof(struct thread_options, file_size_low),
2101 .off2 = offsetof(struct thread_options, file_size_high),
2103 .help = "Size of individual files",
2104 .interval = 1024 * 1024,
2105 .category = FIO_OPT_C_FILE,
2106 .group = FIO_OPT_G_INVALID,
2109 .name = "file_append",
2110 .lname = "File append",
2111 .type = FIO_OPT_BOOL,
2112 .off1 = offsetof(struct thread_options, file_append),
2113 .help = "IO will start at the end of the file(s)",
2115 .category = FIO_OPT_C_FILE,
2116 .group = FIO_OPT_G_INVALID,
2120 .lname = "IO offset",
2121 .alias = "fileoffset",
2122 .type = FIO_OPT_STR_VAL,
2123 .cb = str_offset_cb,
2124 .off1 = offsetof(struct thread_options, start_offset),
2125 .help = "Start IO from this offset",
2127 .interval = 1024 * 1024,
2128 .category = FIO_OPT_C_IO,
2129 .group = FIO_OPT_G_INVALID,
2132 .name = "offset_align",
2133 .lname = "IO offset alignment",
2134 .type = FIO_OPT_INT,
2135 .off1 = offsetof(struct thread_options, start_offset_align),
2136 .help = "Start IO from this offset alignment",
2139 .category = FIO_OPT_C_IO,
2140 .group = FIO_OPT_G_INVALID,
2143 .name = "offset_increment",
2144 .lname = "IO offset increment",
2145 .type = FIO_OPT_STR_VAL,
2146 .off1 = offsetof(struct thread_options, offset_increment),
2147 .help = "What is the increment from one offset to the next",
2151 .interval = 1024 * 1024,
2152 .category = FIO_OPT_C_IO,
2153 .group = FIO_OPT_G_INVALID,
2156 .name = "number_ios",
2157 .lname = "Number of IOs to perform",
2158 .type = FIO_OPT_STR_VAL,
2159 .off1 = offsetof(struct thread_options, number_ios),
2160 .help = "Force job completion after this number of IOs",
2162 .category = FIO_OPT_C_IO,
2163 .group = FIO_OPT_G_INVALID,
2167 .lname = "Block size",
2168 .alias = "blocksize",
2169 .type = FIO_OPT_ULL,
2170 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2171 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2172 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2174 .help = "Block size unit",
2179 .category = FIO_OPT_C_IO,
2180 .group = FIO_OPT_G_INVALID,
2184 .lname = "Block size align",
2185 .alias = "blockalign",
2186 .type = FIO_OPT_ULL,
2187 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2188 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2189 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2191 .help = "IO block offset alignment",
2195 .category = FIO_OPT_C_IO,
2196 .group = FIO_OPT_G_INVALID,
2200 .lname = "Block size range",
2201 .alias = "blocksize_range",
2202 .type = FIO_OPT_RANGE,
2203 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2204 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2205 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2206 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2207 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2208 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2210 .help = "Set block size range (in more detail than bs)",
2214 .category = FIO_OPT_C_IO,
2215 .group = FIO_OPT_G_INVALID,
2219 .lname = "Block size split",
2220 .type = FIO_OPT_STR_ULL,
2221 .cb = str_bssplit_cb,
2222 .off1 = offsetof(struct thread_options, bssplit),
2223 .help = "Set a specific mix of block sizes",
2226 .category = FIO_OPT_C_IO,
2227 .group = FIO_OPT_G_INVALID,
2230 .name = "bs_unaligned",
2231 .lname = "Block size unaligned",
2232 .alias = "blocksize_unaligned",
2233 .type = FIO_OPT_STR_SET,
2234 .off1 = offsetof(struct thread_options, bs_unaligned),
2235 .help = "Don't sector align IO buffer sizes",
2238 .category = FIO_OPT_C_IO,
2239 .group = FIO_OPT_G_INVALID,
2242 .name = "bs_is_seq_rand",
2243 .lname = "Block size division is seq/random (not read/write)",
2244 .type = FIO_OPT_BOOL,
2245 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2246 .help = "Consider any blocksize setting to be sequential,random",
2248 .parent = "blocksize",
2249 .category = FIO_OPT_C_IO,
2250 .group = FIO_OPT_G_INVALID,
2253 .name = "randrepeat",
2254 .lname = "Random repeatable",
2255 .type = FIO_OPT_BOOL,
2256 .off1 = offsetof(struct thread_options, rand_repeatable),
2257 .help = "Use repeatable random IO pattern",
2261 .category = FIO_OPT_C_IO,
2262 .group = FIO_OPT_G_RANDOM,
2266 .lname = "The random generator seed",
2267 .type = FIO_OPT_STR_VAL,
2268 .off1 = offsetof(struct thread_options, rand_seed),
2269 .help = "Set the random generator seed value",
2272 .category = FIO_OPT_C_IO,
2273 .group = FIO_OPT_G_RANDOM,
2276 .name = "norandommap",
2277 .lname = "No randommap",
2278 .type = FIO_OPT_STR_SET,
2279 .off1 = offsetof(struct thread_options, norandommap),
2280 .help = "Accept potential duplicate random blocks",
2284 .category = FIO_OPT_C_IO,
2285 .group = FIO_OPT_G_RANDOM,
2288 .name = "softrandommap",
2289 .lname = "Soft randommap",
2290 .type = FIO_OPT_BOOL,
2291 .off1 = offsetof(struct thread_options, softrandommap),
2292 .help = "Set norandommap if randommap allocation fails",
2293 .parent = "norandommap",
2296 .category = FIO_OPT_C_IO,
2297 .group = FIO_OPT_G_RANDOM,
2300 .name = "random_generator",
2301 .lname = "Random Generator",
2302 .type = FIO_OPT_STR,
2303 .off1 = offsetof(struct thread_options, random_generator),
2304 .help = "Type of random number generator to use",
2305 .def = "tausworthe",
2307 { .ival = "tausworthe",
2308 .oval = FIO_RAND_GEN_TAUSWORTHE,
2309 .help = "Strong Tausworthe generator",
2312 .oval = FIO_RAND_GEN_LFSR,
2313 .help = "Variable length LFSR",
2316 .ival = "tausworthe64",
2317 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2318 .help = "64-bit Tausworthe variant",
2321 .category = FIO_OPT_C_IO,
2322 .group = FIO_OPT_G_RANDOM,
2325 .name = "random_distribution",
2326 .lname = "Random Distribution",
2327 .type = FIO_OPT_STR,
2328 .off1 = offsetof(struct thread_options, random_distribution),
2329 .cb = str_random_distribution_cb,
2330 .help = "Random offset distribution generator",
2334 .oval = FIO_RAND_DIST_RANDOM,
2335 .help = "Completely random",
2338 .oval = FIO_RAND_DIST_ZIPF,
2339 .help = "Zipf distribution",
2342 .oval = FIO_RAND_DIST_PARETO,
2343 .help = "Pareto distribution",
2346 .oval = FIO_RAND_DIST_GAUSS,
2347 .help = "Normal (Gaussian) distribution",
2350 .oval = FIO_RAND_DIST_ZONED,
2351 .help = "Zoned random distribution",
2353 { .ival = "zoned_abs",
2354 .oval = FIO_RAND_DIST_ZONED_ABS,
2355 .help = "Zoned absolute random distribution",
2358 .category = FIO_OPT_C_IO,
2359 .group = FIO_OPT_G_RANDOM,
2362 .name = "percentage_random",
2363 .lname = "Percentage Random",
2364 .type = FIO_OPT_INT,
2365 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2366 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2367 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2369 .help = "Percentage of seq/random mix that should be random",
2370 .def = "100,100,100",
2372 .inverse = "percentage_sequential",
2373 .category = FIO_OPT_C_IO,
2374 .group = FIO_OPT_G_RANDOM,
2377 .name = "percentage_sequential",
2378 .lname = "Percentage Sequential",
2379 .type = FIO_OPT_DEPRECATED,
2380 .category = FIO_OPT_C_IO,
2381 .group = FIO_OPT_G_RANDOM,
2384 .name = "allrandrepeat",
2385 .lname = "All Random Repeat",
2386 .type = FIO_OPT_BOOL,
2387 .off1 = offsetof(struct thread_options, allrand_repeatable),
2388 .help = "Use repeatable random numbers for everything",
2390 .category = FIO_OPT_C_IO,
2391 .group = FIO_OPT_G_RANDOM,
2395 .lname = "Number of files",
2396 .alias = "nr_files",
2397 .type = FIO_OPT_INT,
2398 .off1 = offsetof(struct thread_options, nr_files),
2399 .help = "Split job workload between this number of files",
2402 .category = FIO_OPT_C_FILE,
2403 .group = FIO_OPT_G_INVALID,
2406 .name = "openfiles",
2407 .lname = "Number of open files",
2408 .type = FIO_OPT_INT,
2409 .off1 = offsetof(struct thread_options, open_files),
2410 .help = "Number of files to keep open at the same time",
2411 .category = FIO_OPT_C_FILE,
2412 .group = FIO_OPT_G_INVALID,
2415 .name = "file_service_type",
2416 .lname = "File service type",
2417 .type = FIO_OPT_STR,
2419 .off1 = offsetof(struct thread_options, file_service_type),
2420 .help = "How to select which file to service next",
2421 .def = "roundrobin",
2422 .category = FIO_OPT_C_FILE,
2423 .group = FIO_OPT_G_INVALID,
2426 .oval = FIO_FSERVICE_RANDOM,
2427 .help = "Choose a file at random (uniform)",
2430 .oval = FIO_FSERVICE_ZIPF,
2431 .help = "Zipf randomized",
2434 .oval = FIO_FSERVICE_PARETO,
2435 .help = "Pareto randomized",
2438 .oval = FIO_FSERVICE_GAUSS,
2439 .help = "Normal (Gaussian) randomized",
2442 .oval = FIO_FSERVICE_GAUSS,
2443 .help = "Alias for normal",
2445 { .ival = "roundrobin",
2446 .oval = FIO_FSERVICE_RR,
2447 .help = "Round robin select files",
2449 { .ival = "sequential",
2450 .oval = FIO_FSERVICE_SEQ,
2451 .help = "Finish one file before moving to the next",
2454 .parent = "nrfiles",
2457 #ifdef FIO_HAVE_ANY_FALLOCATE
2459 .name = "fallocate",
2460 .lname = "Fallocate",
2461 .type = FIO_OPT_STR,
2462 .off1 = offsetof(struct thread_options, fallocate_mode),
2463 .help = "Whether pre-allocation is performed when laying out files",
2465 .category = FIO_OPT_C_FILE,
2466 .group = FIO_OPT_G_INVALID,
2469 .oval = FIO_FALLOCATE_NONE,
2470 .help = "Do not pre-allocate space",
2473 .oval = FIO_FALLOCATE_NATIVE,
2474 .help = "Use native pre-allocation if possible",
2476 #ifdef CONFIG_POSIX_FALLOCATE
2478 .oval = FIO_FALLOCATE_POSIX,
2479 .help = "Use posix_fallocate()",
2482 #ifdef CONFIG_LINUX_FALLOCATE
2484 .oval = FIO_FALLOCATE_KEEP_SIZE,
2485 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2488 /* Compatibility with former boolean values */
2490 .oval = FIO_FALLOCATE_NONE,
2491 .help = "Alias for 'none'",
2493 #ifdef CONFIG_POSIX_FALLOCATE
2495 .oval = FIO_FALLOCATE_POSIX,
2496 .help = "Alias for 'posix'",
2501 #else /* FIO_HAVE_ANY_FALLOCATE */
2503 .name = "fallocate",
2504 .lname = "Fallocate",
2505 .type = FIO_OPT_UNSUPPORTED,
2506 .help = "Your platform does not support fallocate",
2508 #endif /* FIO_HAVE_ANY_FALLOCATE */
2510 .name = "fadvise_hint",
2511 .lname = "Fadvise hint",
2512 .type = FIO_OPT_STR,
2513 .off1 = offsetof(struct thread_options, fadvise_hint),
2517 .help = "Don't issue fadvise/madvise",
2521 .help = "Advise using fio IO pattern",
2524 .oval = F_ADV_RANDOM,
2525 .help = "Advise using FADV_RANDOM",
2527 { .ival = "sequential",
2528 .oval = F_ADV_SEQUENTIAL,
2529 .help = "Advise using FADV_SEQUENTIAL",
2532 .help = "Use fadvise() to advise the kernel on IO pattern",
2534 .category = FIO_OPT_C_FILE,
2535 .group = FIO_OPT_G_INVALID,
2540 .type = FIO_OPT_INT,
2541 .off1 = offsetof(struct thread_options, fsync_blocks),
2542 .help = "Issue fsync for writes every given number of blocks",
2545 .category = FIO_OPT_C_FILE,
2546 .group = FIO_OPT_G_INVALID,
2549 .name = "fdatasync",
2550 .lname = "Fdatasync",
2551 .type = FIO_OPT_INT,
2552 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2553 .help = "Issue fdatasync for writes every given number of blocks",
2556 .category = FIO_OPT_C_FILE,
2557 .group = FIO_OPT_G_INVALID,
2560 .name = "write_barrier",
2561 .lname = "Write barrier",
2562 .type = FIO_OPT_INT,
2563 .off1 = offsetof(struct thread_options, barrier_blocks),
2564 .help = "Make every Nth write a barrier write",
2567 .category = FIO_OPT_C_IO,
2568 .group = FIO_OPT_G_INVALID,
2570 #ifdef CONFIG_SYNC_FILE_RANGE
2572 .name = "sync_file_range",
2573 .lname = "Sync file range",
2575 { .ival = "wait_before",
2576 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2577 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2581 .oval = SYNC_FILE_RANGE_WRITE,
2582 .help = "SYNC_FILE_RANGE_WRITE",
2586 .ival = "wait_after",
2587 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2588 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2592 .type = FIO_OPT_STR_MULTI,
2594 .off1 = offsetof(struct thread_options, sync_file_range),
2595 .help = "Use sync_file_range()",
2596 .category = FIO_OPT_C_FILE,
2597 .group = FIO_OPT_G_INVALID,
2601 .name = "sync_file_range",
2602 .lname = "Sync file range",
2603 .type = FIO_OPT_UNSUPPORTED,
2604 .help = "Your platform does not support sync_file_range",
2609 .lname = "Direct I/O",
2610 .type = FIO_OPT_BOOL,
2611 .off1 = offsetof(struct thread_options, odirect),
2612 .help = "Use O_DIRECT IO (negates buffered)",
2614 .inverse = "buffered",
2615 .category = FIO_OPT_C_IO,
2616 .group = FIO_OPT_G_IO_TYPE,
2620 .lname = "Atomic I/O",
2621 .type = FIO_OPT_BOOL,
2622 .off1 = offsetof(struct thread_options, oatomic),
2623 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2625 .category = FIO_OPT_C_IO,
2626 .group = FIO_OPT_G_IO_TYPE,
2630 .lname = "Buffered I/O",
2631 .type = FIO_OPT_BOOL,
2632 .off1 = offsetof(struct thread_options, odirect),
2634 .help = "Use buffered IO (negates direct)",
2636 .inverse = "direct",
2637 .category = FIO_OPT_C_IO,
2638 .group = FIO_OPT_G_IO_TYPE,
2641 .name = "overwrite",
2642 .lname = "Overwrite",
2643 .type = FIO_OPT_BOOL,
2644 .off1 = offsetof(struct thread_options, overwrite),
2645 .help = "When writing, set whether to overwrite current data",
2647 .category = FIO_OPT_C_FILE,
2648 .group = FIO_OPT_G_INVALID,
2653 .type = FIO_OPT_INT,
2654 .off1 = offsetof(struct thread_options, loops),
2655 .help = "Number of times to run the job",
2658 .category = FIO_OPT_C_GENERAL,
2659 .group = FIO_OPT_G_RUNTIME,
2663 .lname = "Number of jobs",
2664 .type = FIO_OPT_INT,
2665 .off1 = offsetof(struct thread_options, numjobs),
2666 .help = "Duplicate this job this many times",
2669 .category = FIO_OPT_C_GENERAL,
2670 .group = FIO_OPT_G_RUNTIME,
2673 .name = "startdelay",
2674 .lname = "Start delay",
2675 .type = FIO_OPT_STR_VAL_TIME,
2676 .off1 = offsetof(struct thread_options, start_delay),
2677 .off2 = offsetof(struct thread_options, start_delay_high),
2678 .help = "Only start job when this period has passed",
2682 .category = FIO_OPT_C_GENERAL,
2683 .group = FIO_OPT_G_RUNTIME,
2689 .type = FIO_OPT_STR_VAL_TIME,
2690 .off1 = offsetof(struct thread_options, timeout),
2691 .help = "Stop workload when this amount of time has passed",
2695 .category = FIO_OPT_C_GENERAL,
2696 .group = FIO_OPT_G_RUNTIME,
2699 .name = "time_based",
2700 .lname = "Time based",
2701 .type = FIO_OPT_STR_SET,
2702 .off1 = offsetof(struct thread_options, time_based),
2703 .help = "Keep running until runtime/timeout is met",
2704 .category = FIO_OPT_C_GENERAL,
2705 .group = FIO_OPT_G_RUNTIME,
2708 .name = "verify_only",
2709 .lname = "Verify only",
2710 .type = FIO_OPT_STR_SET,
2711 .off1 = offsetof(struct thread_options, verify_only),
2712 .help = "Verifies previously written data is still valid",
2713 .category = FIO_OPT_C_GENERAL,
2714 .group = FIO_OPT_G_RUNTIME,
2717 .name = "ramp_time",
2718 .lname = "Ramp time",
2719 .type = FIO_OPT_STR_VAL_TIME,
2720 .off1 = offsetof(struct thread_options, ramp_time),
2721 .help = "Ramp up time before measuring performance",
2724 .category = FIO_OPT_C_GENERAL,
2725 .group = FIO_OPT_G_RUNTIME,
2728 .name = "clocksource",
2729 .lname = "Clock source",
2730 .type = FIO_OPT_STR,
2731 .cb = fio_clock_source_cb,
2732 .off1 = offsetof(struct thread_options, clocksource),
2733 .help = "What type of timing source to use",
2734 .category = FIO_OPT_C_GENERAL,
2735 .group = FIO_OPT_G_CLOCK,
2737 #ifdef CONFIG_GETTIMEOFDAY
2738 { .ival = "gettimeofday",
2740 .help = "Use gettimeofday(2) for timing",
2743 #ifdef CONFIG_CLOCK_GETTIME
2744 { .ival = "clock_gettime",
2745 .oval = CS_CGETTIME,
2746 .help = "Use clock_gettime(2) for timing",
2749 #ifdef ARCH_HAVE_CPU_CLOCK
2751 .oval = CS_CPUCLOCK,
2752 .help = "Use CPU private clock",
2760 .lname = "I/O Memory",
2761 .type = FIO_OPT_STR,
2763 .off1 = offsetof(struct thread_options, mem_type),
2764 .help = "Backing type for IO buffers",
2766 .category = FIO_OPT_C_IO,
2767 .group = FIO_OPT_G_INVALID,
2771 .help = "Use malloc(3) for IO buffers",
2773 #ifndef CONFIG_NO_SHM
2776 .help = "Use shared memory segments for IO buffers",
2778 #ifdef FIO_HAVE_HUGETLB
2779 { .ival = "shmhuge",
2780 .oval = MEM_SHMHUGE,
2781 .help = "Like shm, but use huge pages",
2787 .help = "Use mmap(2) (file or anon) for IO buffers",
2789 { .ival = "mmapshared",
2790 .oval = MEM_MMAPSHARED,
2791 .help = "Like mmap, but use the shared flag",
2793 #ifdef FIO_HAVE_HUGETLB
2794 { .ival = "mmaphuge",
2795 .oval = MEM_MMAPHUGE,
2796 .help = "Like mmap, but use huge pages",
2800 { .ival = "cudamalloc",
2801 .oval = MEM_CUDA_MALLOC,
2802 .help = "Allocate GPU device memory for GPUDirect RDMA",
2808 .name = "iomem_align",
2809 .alias = "mem_align",
2810 .lname = "I/O memory alignment",
2811 .type = FIO_OPT_INT,
2812 .off1 = offsetof(struct thread_options, mem_align),
2814 .help = "IO memory buffer offset alignment",
2818 .category = FIO_OPT_C_IO,
2819 .group = FIO_OPT_G_INVALID,
2824 .type = FIO_OPT_STR,
2825 .off1 = offsetof(struct thread_options, verify),
2826 .help = "Verify data written",
2828 .category = FIO_OPT_C_IO,
2829 .group = FIO_OPT_G_VERIFY,
2832 .oval = VERIFY_NONE,
2833 .help = "Don't do IO verification",
2837 .help = "Use md5 checksums for verification",
2840 .oval = VERIFY_CRC64,
2841 .help = "Use crc64 checksums for verification",
2844 .oval = VERIFY_CRC32,
2845 .help = "Use crc32 checksums for verification",
2847 { .ival = "crc32c-intel",
2848 .oval = VERIFY_CRC32C,
2849 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2852 .oval = VERIFY_CRC32C,
2853 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2856 .oval = VERIFY_CRC16,
2857 .help = "Use crc16 checksums for verification",
2860 .oval = VERIFY_CRC7,
2861 .help = "Use crc7 checksums for verification",
2864 .oval = VERIFY_SHA1,
2865 .help = "Use sha1 checksums for verification",
2868 .oval = VERIFY_SHA256,
2869 .help = "Use sha256 checksums for verification",
2872 .oval = VERIFY_SHA512,
2873 .help = "Use sha512 checksums for verification",
2875 { .ival = "sha3-224",
2876 .oval = VERIFY_SHA3_224,
2877 .help = "Use sha3-224 checksums for verification",
2879 { .ival = "sha3-256",
2880 .oval = VERIFY_SHA3_256,
2881 .help = "Use sha3-256 checksums for verification",
2883 { .ival = "sha3-384",
2884 .oval = VERIFY_SHA3_384,
2885 .help = "Use sha3-384 checksums for verification",
2887 { .ival = "sha3-512",
2888 .oval = VERIFY_SHA3_512,
2889 .help = "Use sha3-512 checksums for verification",
2892 .oval = VERIFY_XXHASH,
2893 .help = "Use xxhash checksums for verification",
2895 /* Meta information was included into verify_header,
2896 * 'meta' verification is implied by default. */
2898 .oval = VERIFY_HDR_ONLY,
2899 .help = "Use io information for verification. "
2900 "Now is implied by default, thus option is obsolete, "
2903 { .ival = "pattern",
2904 .oval = VERIFY_PATTERN_NO_HDR,
2905 .help = "Verify strict pattern",
2909 .oval = VERIFY_NULL,
2910 .help = "Pretend to verify",
2915 .name = "do_verify",
2916 .lname = "Perform verify step",
2917 .type = FIO_OPT_BOOL,
2918 .off1 = offsetof(struct thread_options, do_verify),
2919 .help = "Run verification stage after write",
2923 .category = FIO_OPT_C_IO,
2924 .group = FIO_OPT_G_VERIFY,
2927 .name = "verifysort",
2928 .lname = "Verify sort",
2929 .type = FIO_OPT_SOFT_DEPRECATED,
2930 .category = FIO_OPT_C_IO,
2931 .group = FIO_OPT_G_VERIFY,
2934 .name = "verifysort_nr",
2935 .lname = "Verify Sort Nr",
2936 .type = FIO_OPT_SOFT_DEPRECATED,
2937 .category = FIO_OPT_C_IO,
2938 .group = FIO_OPT_G_VERIFY,
2941 .name = "verify_interval",
2942 .lname = "Verify interval",
2943 .type = FIO_OPT_INT,
2944 .off1 = offsetof(struct thread_options, verify_interval),
2945 .minval = 2 * sizeof(struct verify_header),
2946 .help = "Store verify buffer header every N bytes",
2949 .interval = 2 * sizeof(struct verify_header),
2950 .category = FIO_OPT_C_IO,
2951 .group = FIO_OPT_G_VERIFY,
2954 .name = "verify_offset",
2955 .lname = "Verify offset",
2956 .type = FIO_OPT_INT,
2957 .help = "Offset verify header location by N bytes",
2958 .off1 = offsetof(struct thread_options, verify_offset),
2959 .minval = sizeof(struct verify_header),
2962 .category = FIO_OPT_C_IO,
2963 .group = FIO_OPT_G_VERIFY,
2966 .name = "verify_pattern",
2967 .lname = "Verify pattern",
2968 .type = FIO_OPT_STR,
2969 .cb = str_verify_pattern_cb,
2970 .off1 = offsetof(struct thread_options, verify_pattern),
2971 .help = "Fill pattern for IO buffers",
2974 .category = FIO_OPT_C_IO,
2975 .group = FIO_OPT_G_VERIFY,
2978 .name = "verify_fatal",
2979 .lname = "Verify fatal",
2980 .type = FIO_OPT_BOOL,
2981 .off1 = offsetof(struct thread_options, verify_fatal),
2983 .help = "Exit on a single verify failure, don't continue",
2986 .category = FIO_OPT_C_IO,
2987 .group = FIO_OPT_G_VERIFY,
2990 .name = "verify_dump",
2991 .lname = "Verify dump",
2992 .type = FIO_OPT_BOOL,
2993 .off1 = offsetof(struct thread_options, verify_dump),
2995 .help = "Dump contents of good and bad blocks on failure",
2998 .category = FIO_OPT_C_IO,
2999 .group = FIO_OPT_G_VERIFY,
3002 .name = "verify_async",
3003 .lname = "Verify asynchronously",
3004 .type = FIO_OPT_INT,
3005 .off1 = offsetof(struct thread_options, verify_async),
3007 .help = "Number of async verifier threads to use",
3010 .category = FIO_OPT_C_IO,
3011 .group = FIO_OPT_G_VERIFY,
3014 .name = "verify_backlog",
3015 .lname = "Verify backlog",
3016 .type = FIO_OPT_STR_VAL,
3017 .off1 = offsetof(struct thread_options, verify_backlog),
3018 .help = "Verify after this number of blocks are written",
3021 .category = FIO_OPT_C_IO,
3022 .group = FIO_OPT_G_VERIFY,
3025 .name = "verify_backlog_batch",
3026 .lname = "Verify backlog batch",
3027 .type = FIO_OPT_INT,
3028 .off1 = offsetof(struct thread_options, verify_batch),
3029 .help = "Verify this number of IO blocks",
3032 .category = FIO_OPT_C_IO,
3033 .group = FIO_OPT_G_VERIFY,
3035 #ifdef FIO_HAVE_CPU_AFFINITY
3037 .name = "verify_async_cpus",
3038 .lname = "Async verify CPUs",
3039 .type = FIO_OPT_STR,
3040 .cb = str_verify_cpus_allowed_cb,
3041 .off1 = offsetof(struct thread_options, verify_cpumask),
3042 .help = "Set CPUs allowed for async verify threads",
3043 .parent = "verify_async",
3045 .category = FIO_OPT_C_IO,
3046 .group = FIO_OPT_G_VERIFY,
3050 .name = "verify_async_cpus",
3051 .lname = "Async verify CPUs",
3052 .type = FIO_OPT_UNSUPPORTED,
3053 .help = "Your platform does not support CPU affinities",
3057 .name = "experimental_verify",
3058 .lname = "Experimental Verify",
3059 .off1 = offsetof(struct thread_options, experimental_verify),
3060 .type = FIO_OPT_BOOL,
3061 .help = "Enable experimental verification",
3063 .category = FIO_OPT_C_IO,
3064 .group = FIO_OPT_G_VERIFY,
3067 .name = "verify_state_load",
3068 .lname = "Load verify state",
3069 .off1 = offsetof(struct thread_options, verify_state),
3070 .type = FIO_OPT_BOOL,
3071 .help = "Load verify termination state",
3073 .category = FIO_OPT_C_IO,
3074 .group = FIO_OPT_G_VERIFY,
3077 .name = "verify_state_save",
3078 .lname = "Save verify state",
3079 .off1 = offsetof(struct thread_options, verify_state_save),
3080 .type = FIO_OPT_BOOL,
3082 .help = "Save verify state on termination",
3084 .category = FIO_OPT_C_IO,
3085 .group = FIO_OPT_G_VERIFY,
3087 #ifdef FIO_HAVE_TRIM
3089 .name = "trim_percentage",
3090 .lname = "Trim percentage",
3091 .type = FIO_OPT_INT,
3092 .off1 = offsetof(struct thread_options, trim_percentage),
3095 .help = "Number of verify blocks to trim (i.e., discard)",
3100 .category = FIO_OPT_C_IO,
3101 .group = FIO_OPT_G_TRIM,
3104 .name = "trim_verify_zero",
3105 .lname = "Verify trim zero",
3106 .type = FIO_OPT_BOOL,
3107 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3108 .off1 = offsetof(struct thread_options, trim_zero),
3109 .parent = "trim_percentage",
3112 .category = FIO_OPT_C_IO,
3113 .group = FIO_OPT_G_TRIM,
3116 .name = "trim_backlog",
3117 .lname = "Trim backlog",
3118 .type = FIO_OPT_STR_VAL,
3119 .off1 = offsetof(struct thread_options, trim_backlog),
3120 .help = "Trim after this number of blocks are written",
3121 .parent = "trim_percentage",
3124 .category = FIO_OPT_C_IO,
3125 .group = FIO_OPT_G_TRIM,
3128 .name = "trim_backlog_batch",
3129 .lname = "Trim backlog batch",
3130 .type = FIO_OPT_INT,
3131 .off1 = offsetof(struct thread_options, trim_batch),
3132 .help = "Trim this number of IO blocks",
3133 .parent = "trim_percentage",
3136 .category = FIO_OPT_C_IO,
3137 .group = FIO_OPT_G_TRIM,
3141 .name = "trim_percentage",
3142 .lname = "Trim percentage",
3143 .type = FIO_OPT_UNSUPPORTED,
3144 .help = "Fio does not support TRIM on your platform",
3147 .name = "trim_verify_zero",
3148 .lname = "Verify trim zero",
3149 .type = FIO_OPT_UNSUPPORTED,
3150 .help = "Fio does not support TRIM on your platform",
3153 .name = "trim_backlog",
3154 .lname = "Trim backlog",
3155 .type = FIO_OPT_UNSUPPORTED,
3156 .help = "Fio does not support TRIM on your platform",
3159 .name = "trim_backlog_batch",
3160 .lname = "Trim backlog batch",
3161 .type = FIO_OPT_UNSUPPORTED,
3162 .help = "Fio does not support TRIM on your platform",
3166 .name = "write_iolog",
3167 .lname = "Write I/O log",
3168 .type = FIO_OPT_STR_STORE,
3169 .off1 = offsetof(struct thread_options, write_iolog_file),
3170 .help = "Store IO pattern to file",
3171 .category = FIO_OPT_C_IO,
3172 .group = FIO_OPT_G_IOLOG,
3175 .name = "read_iolog",
3176 .lname = "Read I/O log",
3177 .type = FIO_OPT_STR_STORE,
3178 .off1 = offsetof(struct thread_options, read_iolog_file),
3179 .help = "Playback IO pattern from file",
3180 .category = FIO_OPT_C_IO,
3181 .group = FIO_OPT_G_IOLOG,
3184 .name = "read_iolog_chunked",
3185 .lname = "Read I/O log in parts",
3186 .type = FIO_OPT_BOOL,
3187 .off1 = offsetof(struct thread_options, read_iolog_chunked),
3189 .parent = "read_iolog",
3190 .help = "Parse IO pattern in chunks",
3191 .category = FIO_OPT_C_IO,
3192 .group = FIO_OPT_G_IOLOG,
3195 .name = "replay_no_stall",
3196 .lname = "Don't stall on replay",
3197 .type = FIO_OPT_BOOL,
3198 .off1 = offsetof(struct thread_options, no_stall),
3200 .parent = "read_iolog",
3202 .help = "Playback IO pattern file as fast as possible without stalls",
3203 .category = FIO_OPT_C_IO,
3204 .group = FIO_OPT_G_IOLOG,
3207 .name = "replay_redirect",
3208 .lname = "Redirect device for replay",
3209 .type = FIO_OPT_STR_STORE,
3210 .off1 = offsetof(struct thread_options, replay_redirect),
3211 .parent = "read_iolog",
3213 .help = "Replay all I/O onto this device, regardless of trace device",
3214 .category = FIO_OPT_C_IO,
3215 .group = FIO_OPT_G_IOLOG,
3218 .name = "replay_scale",
3219 .lname = "Replace offset scale factor",
3220 .type = FIO_OPT_INT,
3221 .off1 = offsetof(struct thread_options, replay_scale),
3222 .parent = "read_iolog",
3224 .help = "Align offsets to this blocksize",
3225 .category = FIO_OPT_C_IO,
3226 .group = FIO_OPT_G_IOLOG,
3229 .name = "replay_align",
3230 .lname = "Replace alignment",
3231 .type = FIO_OPT_INT,
3232 .off1 = offsetof(struct thread_options, replay_align),
3233 .parent = "read_iolog",
3234 .help = "Scale offset down by this factor",
3235 .category = FIO_OPT_C_IO,
3236 .group = FIO_OPT_G_IOLOG,
3240 .name = "replay_time_scale",
3241 .lname = "Replay Time Scale",
3242 .type = FIO_OPT_INT,
3243 .off1 = offsetof(struct thread_options, replay_time_scale),
3246 .parent = "read_iolog",
3248 .help = "Scale time for replay events",
3249 .category = FIO_OPT_C_IO,
3250 .group = FIO_OPT_G_IOLOG,
3253 .name = "replay_skip",
3254 .lname = "Replay Skip",
3255 .type = FIO_OPT_STR,
3256 .cb = str_replay_skip_cb,
3257 .off1 = offsetof(struct thread_options, replay_skip),
3258 .parent = "read_iolog",
3259 .help = "Skip certain IO types (read,write,trim,flush)",
3260 .category = FIO_OPT_C_IO,
3261 .group = FIO_OPT_G_IOLOG,
3264 .name = "merge_blktrace_file",
3265 .lname = "Merged blktrace output filename",
3266 .type = FIO_OPT_STR_STORE,
3267 .off1 = offsetof(struct thread_options, merge_blktrace_file),
3268 .help = "Merged blktrace output filename",
3269 .category = FIO_OPT_C_IO,
3270 .group = FIO_OPT_G_IOLOG,
3273 .name = "merge_blktrace_scalars",
3274 .lname = "Percentage to scale each trace",
3275 .type = FIO_OPT_FLOAT_LIST,
3276 .off1 = offsetof(struct thread_options, merge_blktrace_scalars),
3277 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3278 .help = "Percentage to scale each trace",
3279 .category = FIO_OPT_C_IO,
3280 .group = FIO_OPT_G_IOLOG,
3283 .name = "merge_blktrace_iters",
3284 .lname = "Number of iterations to run per trace",
3285 .type = FIO_OPT_FLOAT_LIST,
3286 .off1 = offsetof(struct thread_options, merge_blktrace_iters),
3287 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3288 .help = "Number of iterations to run per trace",
3289 .category = FIO_OPT_C_IO,
3290 .group = FIO_OPT_G_IOLOG,
3293 .name = "exec_prerun",
3294 .lname = "Pre-execute runnable",
3295 .type = FIO_OPT_STR_STORE,
3296 .off1 = offsetof(struct thread_options, exec_prerun),
3297 .help = "Execute this file prior to running job",
3298 .category = FIO_OPT_C_GENERAL,
3299 .group = FIO_OPT_G_INVALID,
3302 .name = "exec_postrun",
3303 .lname = "Post-execute runnable",
3304 .type = FIO_OPT_STR_STORE,
3305 .off1 = offsetof(struct thread_options, exec_postrun),
3306 .help = "Execute this file after running job",
3307 .category = FIO_OPT_C_GENERAL,
3308 .group = FIO_OPT_G_INVALID,
3310 #ifdef FIO_HAVE_IOSCHED_SWITCH
3312 .name = "ioscheduler",
3313 .lname = "I/O scheduler",
3314 .type = FIO_OPT_STR_STORE,
3315 .off1 = offsetof(struct thread_options, ioscheduler),
3316 .help = "Use this IO scheduler on the backing device",
3317 .category = FIO_OPT_C_FILE,
3318 .group = FIO_OPT_G_INVALID,
3322 .name = "ioscheduler",
3323 .lname = "I/O scheduler",
3324 .type = FIO_OPT_UNSUPPORTED,
3325 .help = "Your platform does not support IO scheduler switching",
3330 .lname = "Zone mode",
3331 .help = "Mode for the zonesize, zonerange and zoneskip parameters",
3332 .type = FIO_OPT_STR,
3333 .off1 = offsetof(struct thread_options, zone_mode),
3335 .category = FIO_OPT_C_IO,
3336 .group = FIO_OPT_G_ZONE,
3339 .oval = ZONE_MODE_NONE,
3340 .help = "no zoning",
3342 { .ival = "strided",
3343 .oval = ZONE_MODE_STRIDED,
3344 .help = "strided mode - random I/O is restricted to a single zone",
3347 .oval = ZONE_MODE_ZBD,
3348 .help = "zoned block device mode - random I/O selects one of multiple zones randomly",
3354 .lname = "Zone size",
3355 .type = FIO_OPT_STR_VAL,
3356 .off1 = offsetof(struct thread_options, zone_size),
3357 .help = "Amount of data to read per zone",
3359 .interval = 1024 * 1024,
3360 .category = FIO_OPT_C_IO,
3361 .group = FIO_OPT_G_ZONE,
3364 .name = "zonerange",
3365 .lname = "Zone range",
3366 .type = FIO_OPT_STR_VAL,
3367 .off1 = offsetof(struct thread_options, zone_range),
3368 .help = "Give size of an IO zone",
3370 .interval = 1024 * 1024,
3371 .category = FIO_OPT_C_IO,
3372 .group = FIO_OPT_G_ZONE,
3376 .lname = "Zone skip",
3377 .type = FIO_OPT_STR_VAL,
3378 .off1 = offsetof(struct thread_options, zone_skip),
3379 .help = "Space between IO zones",
3381 .interval = 1024 * 1024,
3382 .category = FIO_OPT_C_IO,
3383 .group = FIO_OPT_G_ZONE,
3386 .name = "read_beyond_wp",
3387 .lname = "Allow reads beyond the zone write pointer",
3388 .type = FIO_OPT_BOOL,
3389 .off1 = offsetof(struct thread_options, read_beyond_wp),
3390 .help = "Allow reads beyond the zone write pointer",
3392 .category = FIO_OPT_C_IO,
3393 .group = FIO_OPT_G_INVALID,
3396 .name = "max_open_zones",
3397 .lname = "Maximum number of open zones",
3398 .type = FIO_OPT_INT,
3399 .off1 = offsetof(struct thread_options, max_open_zones),
3400 .maxval = FIO_MAX_OPEN_ZBD_ZONES,
3401 .help = "Limit random writes to SMR drives to the specified"
3402 " number of sequential zones",
3404 .category = FIO_OPT_C_IO,
3405 .group = FIO_OPT_G_INVALID,
3408 .name = "zone_reset_threshold",
3409 .lname = "Zone reset threshold",
3410 .help = "Zoned block device reset threshold",
3411 .type = FIO_OPT_FLOAT_LIST,
3413 .off1 = offsetof(struct thread_options, zrt),
3416 .category = FIO_OPT_C_IO,
3417 .group = FIO_OPT_G_ZONE,
3420 .name = "zone_reset_frequency",
3421 .lname = "Zone reset frequency",
3422 .help = "Zoned block device zone reset frequency in HZ",
3423 .type = FIO_OPT_FLOAT_LIST,
3425 .off1 = offsetof(struct thread_options, zrf),
3428 .category = FIO_OPT_C_IO,
3429 .group = FIO_OPT_G_ZONE,
3433 .lname = "Lock memory",
3434 .type = FIO_OPT_STR_VAL,
3435 .off1 = offsetof(struct thread_options, lockmem),
3436 .help = "Lock down this amount of memory (per worker)",
3438 .interval = 1024 * 1024,
3439 .category = FIO_OPT_C_GENERAL,
3440 .group = FIO_OPT_G_INVALID,
3443 .name = "rwmixread",
3444 .lname = "Read/write mix read",
3445 .type = FIO_OPT_INT,
3446 .cb = str_rwmix_read_cb,
3447 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3449 .help = "Percentage of mixed workload that is reads",
3452 .inverse = "rwmixwrite",
3453 .category = FIO_OPT_C_IO,
3454 .group = FIO_OPT_G_RWMIX,
3457 .name = "rwmixwrite",
3458 .lname = "Read/write mix write",
3459 .type = FIO_OPT_INT,
3460 .cb = str_rwmix_write_cb,
3461 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3463 .help = "Percentage of mixed workload that is writes",
3466 .inverse = "rwmixread",
3467 .category = FIO_OPT_C_IO,
3468 .group = FIO_OPT_G_RWMIX,
3471 .name = "rwmixcycle",
3472 .lname = "Read/write mix cycle",
3473 .type = FIO_OPT_DEPRECATED,
3474 .category = FIO_OPT_C_IO,
3475 .group = FIO_OPT_G_RWMIX,
3480 .type = FIO_OPT_INT,
3481 .off1 = offsetof(struct thread_options, nice),
3482 .help = "Set job CPU nice value",
3487 .category = FIO_OPT_C_GENERAL,
3488 .group = FIO_OPT_G_CRED,
3490 #ifdef FIO_HAVE_IOPRIO
3493 .lname = "I/O nice priority",
3494 .type = FIO_OPT_INT,
3495 .off1 = offsetof(struct thread_options, ioprio),
3496 .help = "Set job IO priority value",
3497 .minval = IOPRIO_MIN_PRIO,
3498 .maxval = IOPRIO_MAX_PRIO,
3500 .category = FIO_OPT_C_GENERAL,
3501 .group = FIO_OPT_G_CRED,
3506 .lname = "I/O nice priority",
3507 .type = FIO_OPT_UNSUPPORTED,
3508 .help = "Your platform does not support IO priorities",
3511 #ifdef FIO_HAVE_IOPRIO_CLASS
3512 #ifndef FIO_HAVE_IOPRIO
3513 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3516 .name = "prioclass",
3517 .lname = "I/O nice priority class",
3518 .type = FIO_OPT_INT,
3519 .off1 = offsetof(struct thread_options, ioprio_class),
3520 .help = "Set job IO priority class",
3521 .minval = IOPRIO_MIN_PRIO_CLASS,
3522 .maxval = IOPRIO_MAX_PRIO_CLASS,
3524 .category = FIO_OPT_C_GENERAL,
3525 .group = FIO_OPT_G_CRED,
3529 .name = "prioclass",
3530 .lname = "I/O nice priority class",
3531 .type = FIO_OPT_UNSUPPORTED,
3532 .help = "Your platform does not support IO priority classes",
3536 .name = "thinktime",
3537 .lname = "Thinktime",
3538 .type = FIO_OPT_INT,
3539 .off1 = offsetof(struct thread_options, thinktime),
3540 .help = "Idle time between IO buffers (usec)",
3543 .category = FIO_OPT_C_IO,
3544 .group = FIO_OPT_G_THINKTIME,
3547 .name = "thinktime_spin",
3548 .lname = "Thinktime spin",
3549 .type = FIO_OPT_INT,
3550 .off1 = offsetof(struct thread_options, thinktime_spin),
3551 .help = "Start think time by spinning this amount (usec)",
3554 .parent = "thinktime",
3556 .category = FIO_OPT_C_IO,
3557 .group = FIO_OPT_G_THINKTIME,
3560 .name = "thinktime_blocks",
3561 .lname = "Thinktime blocks",
3562 .type = FIO_OPT_INT,
3563 .off1 = offsetof(struct thread_options, thinktime_blocks),
3564 .help = "IO buffer period between 'thinktime'",
3566 .parent = "thinktime",
3568 .category = FIO_OPT_C_IO,
3569 .group = FIO_OPT_G_THINKTIME,
3573 .lname = "I/O rate",
3574 .type = FIO_OPT_INT,
3575 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3576 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3577 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
3578 .help = "Set bandwidth rate",
3579 .category = FIO_OPT_C_IO,
3580 .group = FIO_OPT_G_RATE,
3585 .lname = "I/O min rate",
3586 .type = FIO_OPT_INT,
3587 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
3588 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
3589 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
3590 .help = "Job must meet this rate or it will be shutdown",
3593 .category = FIO_OPT_C_IO,
3594 .group = FIO_OPT_G_RATE,
3597 .name = "rate_iops",
3598 .lname = "I/O rate IOPS",
3599 .type = FIO_OPT_INT,
3600 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
3601 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
3602 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
3603 .help = "Limit IO used to this number of IO operations/sec",
3605 .category = FIO_OPT_C_IO,
3606 .group = FIO_OPT_G_RATE,
3609 .name = "rate_iops_min",
3610 .lname = "I/O min rate IOPS",
3611 .type = FIO_OPT_INT,
3612 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
3613 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
3614 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
3615 .help = "Job must meet this rate or it will be shut down",
3616 .parent = "rate_iops",
3618 .category = FIO_OPT_C_IO,
3619 .group = FIO_OPT_G_RATE,
3622 .name = "rate_process",
3623 .lname = "Rate Process",
3624 .type = FIO_OPT_STR,
3625 .off1 = offsetof(struct thread_options, rate_process),
3626 .help = "What process controls how rated IO is managed",
3628 .category = FIO_OPT_C_IO,
3629 .group = FIO_OPT_G_RATE,
3632 .oval = RATE_PROCESS_LINEAR,
3633 .help = "Linear rate of IO",
3637 .oval = RATE_PROCESS_POISSON,
3638 .help = "Rate follows Poisson process",
3644 .name = "rate_cycle",
3645 .alias = "ratecycle",
3646 .lname = "I/O rate cycle",
3647 .type = FIO_OPT_INT,
3648 .off1 = offsetof(struct thread_options, ratecycle),
3649 .help = "Window average for rate limits (msec)",
3653 .category = FIO_OPT_C_IO,
3654 .group = FIO_OPT_G_RATE,
3657 .name = "rate_ignore_thinktime",
3658 .lname = "Rate ignore thinktime",
3659 .type = FIO_OPT_BOOL,
3660 .off1 = offsetof(struct thread_options, rate_ign_think),
3661 .help = "Rated IO ignores thinktime settings",
3663 .category = FIO_OPT_C_IO,
3664 .group = FIO_OPT_G_RATE,
3667 .name = "max_latency",
3668 .lname = "Max Latency (usec)",
3669 .type = FIO_OPT_STR_VAL_TIME,
3670 .off1 = offsetof(struct thread_options, max_latency),
3671 .help = "Maximum tolerated IO latency (usec)",
3673 .category = FIO_OPT_C_IO,
3674 .group = FIO_OPT_G_LATPROF,
3677 .name = "latency_target",
3678 .lname = "Latency Target (usec)",
3679 .type = FIO_OPT_STR_VAL_TIME,
3680 .off1 = offsetof(struct thread_options, latency_target),
3681 .help = "Ramp to max queue depth supporting this latency",
3683 .category = FIO_OPT_C_IO,
3684 .group = FIO_OPT_G_LATPROF,
3687 .name = "latency_window",
3688 .lname = "Latency Window (usec)",
3689 .type = FIO_OPT_STR_VAL_TIME,
3690 .off1 = offsetof(struct thread_options, latency_window),
3691 .help = "Time to sustain latency_target",
3693 .category = FIO_OPT_C_IO,
3694 .group = FIO_OPT_G_LATPROF,
3697 .name = "latency_percentile",
3698 .lname = "Latency Percentile",
3699 .type = FIO_OPT_FLOAT_LIST,
3700 .off1 = offsetof(struct thread_options, latency_percentile),
3701 .help = "Percentile of IOs must be below latency_target",
3706 .category = FIO_OPT_C_IO,
3707 .group = FIO_OPT_G_LATPROF,
3710 .name = "invalidate",
3711 .lname = "Cache invalidate",
3712 .type = FIO_OPT_BOOL,
3713 .off1 = offsetof(struct thread_options, invalidate_cache),
3714 .help = "Invalidate buffer/page cache prior to running job",
3716 .category = FIO_OPT_C_IO,
3717 .group = FIO_OPT_G_IO_TYPE,
3721 .lname = "Synchronous I/O",
3722 .type = FIO_OPT_BOOL,
3723 .off1 = offsetof(struct thread_options, sync_io),
3724 .help = "Use O_SYNC for buffered writes",
3726 .parent = "buffered",
3728 .category = FIO_OPT_C_IO,
3729 .group = FIO_OPT_G_IO_TYPE,
3731 #ifdef FIO_HAVE_WRITE_HINT
3733 .name = "write_hint",
3734 .lname = "Write hint",
3735 .type = FIO_OPT_STR,
3736 .off1 = offsetof(struct thread_options, write_hint),
3737 .help = "Set expected write life time",
3738 .category = FIO_OPT_C_ENGINE,
3739 .group = FIO_OPT_G_INVALID,
3742 .oval = RWH_WRITE_LIFE_NONE,
3745 .oval = RWH_WRITE_LIFE_SHORT,
3748 .oval = RWH_WRITE_LIFE_MEDIUM,
3751 .oval = RWH_WRITE_LIFE_LONG,
3753 { .ival = "extreme",
3754 .oval = RWH_WRITE_LIFE_EXTREME,
3760 .name = "create_serialize",
3761 .lname = "Create serialize",
3762 .type = FIO_OPT_BOOL,
3763 .off1 = offsetof(struct thread_options, create_serialize),
3764 .help = "Serialize creation of job files",
3766 .category = FIO_OPT_C_FILE,
3767 .group = FIO_OPT_G_INVALID,
3770 .name = "create_fsync",
3771 .lname = "Create fsync",
3772 .type = FIO_OPT_BOOL,
3773 .off1 = offsetof(struct thread_options, create_fsync),
3774 .help = "fsync file after creation",
3776 .category = FIO_OPT_C_FILE,
3777 .group = FIO_OPT_G_INVALID,
3780 .name = "create_on_open",
3781 .lname = "Create on open",
3782 .type = FIO_OPT_BOOL,
3783 .off1 = offsetof(struct thread_options, create_on_open),
3784 .help = "Create files when they are opened for IO",
3786 .category = FIO_OPT_C_FILE,
3787 .group = FIO_OPT_G_INVALID,
3790 .name = "create_only",
3791 .lname = "Create Only",
3792 .type = FIO_OPT_BOOL,
3793 .off1 = offsetof(struct thread_options, create_only),
3794 .help = "Only perform file creation phase",
3795 .category = FIO_OPT_C_FILE,
3799 .name = "allow_file_create",
3800 .lname = "Allow file create",
3801 .type = FIO_OPT_BOOL,
3802 .off1 = offsetof(struct thread_options, allow_create),
3803 .help = "Permit fio to create files, if they don't exist",
3805 .category = FIO_OPT_C_FILE,
3806 .group = FIO_OPT_G_FILENAME,
3809 .name = "allow_mounted_write",
3810 .lname = "Allow mounted write",
3811 .type = FIO_OPT_BOOL,
3812 .off1 = offsetof(struct thread_options, allow_mounted_write),
3813 .help = "Allow writes to a mounted partition",
3815 .category = FIO_OPT_C_FILE,
3816 .group = FIO_OPT_G_FILENAME,
3820 .lname = "Pre-read files",
3821 .type = FIO_OPT_BOOL,
3822 .off1 = offsetof(struct thread_options, pre_read),
3823 .help = "Pre-read files before starting official testing",
3825 .category = FIO_OPT_C_FILE,
3826 .group = FIO_OPT_G_INVALID,
3828 #ifdef FIO_HAVE_CPU_AFFINITY
3831 .lname = "CPU mask",
3832 .type = FIO_OPT_INT,
3833 .cb = str_cpumask_cb,
3834 .off1 = offsetof(struct thread_options, cpumask),
3835 .help = "CPU affinity mask",
3836 .category = FIO_OPT_C_GENERAL,
3837 .group = FIO_OPT_G_CRED,
3840 .name = "cpus_allowed",
3841 .lname = "CPUs allowed",
3842 .type = FIO_OPT_STR,
3843 .cb = str_cpus_allowed_cb,
3844 .off1 = offsetof(struct thread_options, cpumask),
3845 .help = "Set CPUs allowed",
3846 .category = FIO_OPT_C_GENERAL,
3847 .group = FIO_OPT_G_CRED,
3850 .name = "cpus_allowed_policy",
3851 .lname = "CPUs allowed distribution policy",
3852 .type = FIO_OPT_STR,
3853 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
3854 .help = "Distribution policy for cpus_allowed",
3855 .parent = "cpus_allowed",
3859 .oval = FIO_CPUS_SHARED,
3860 .help = "Mask shared between threads",
3863 .oval = FIO_CPUS_SPLIT,
3864 .help = "Mask split between threads",
3867 .category = FIO_OPT_C_GENERAL,
3868 .group = FIO_OPT_G_CRED,
3873 .lname = "CPU mask",
3874 .type = FIO_OPT_UNSUPPORTED,
3875 .help = "Your platform does not support CPU affinities",
3878 .name = "cpus_allowed",
3879 .lname = "CPUs allowed",
3880 .type = FIO_OPT_UNSUPPORTED,
3881 .help = "Your platform does not support CPU affinities",
3884 .name = "cpus_allowed_policy",
3885 .lname = "CPUs allowed distribution policy",
3886 .type = FIO_OPT_UNSUPPORTED,
3887 .help = "Your platform does not support CPU affinities",
3890 #ifdef CONFIG_LIBNUMA
3892 .name = "numa_cpu_nodes",
3893 .lname = "NUMA CPU Nodes",
3894 .type = FIO_OPT_STR,
3895 .cb = str_numa_cpunodes_cb,
3896 .off1 = offsetof(struct thread_options, numa_cpunodes),
3897 .help = "NUMA CPU nodes bind",
3898 .category = FIO_OPT_C_GENERAL,
3899 .group = FIO_OPT_G_INVALID,
3902 .name = "numa_mem_policy",
3903 .lname = "NUMA Memory Policy",
3904 .type = FIO_OPT_STR,
3905 .cb = str_numa_mpol_cb,
3906 .off1 = offsetof(struct thread_options, numa_memnodes),
3907 .help = "NUMA memory policy setup",
3908 .category = FIO_OPT_C_GENERAL,
3909 .group = FIO_OPT_G_INVALID,
3913 .name = "numa_cpu_nodes",
3914 .lname = "NUMA CPU Nodes",
3915 .type = FIO_OPT_UNSUPPORTED,
3916 .help = "Build fio with libnuma-dev(el) to enable this option",
3919 .name = "numa_mem_policy",
3920 .lname = "NUMA Memory Policy",
3921 .type = FIO_OPT_UNSUPPORTED,
3922 .help = "Build fio with libnuma-dev(el) to enable this option",
3927 .name = "gpu_dev_id",
3928 .lname = "GPU device ID",
3929 .type = FIO_OPT_INT,
3930 .off1 = offsetof(struct thread_options, gpu_dev_id),
3931 .help = "Set GPU device ID for GPUDirect RDMA",
3933 .category = FIO_OPT_C_GENERAL,
3934 .group = FIO_OPT_G_INVALID,
3938 .name = "end_fsync",
3939 .lname = "End fsync",
3940 .type = FIO_OPT_BOOL,
3941 .off1 = offsetof(struct thread_options, end_fsync),
3942 .help = "Include fsync at the end of job",
3944 .category = FIO_OPT_C_FILE,
3945 .group = FIO_OPT_G_INVALID,
3948 .name = "fsync_on_close",
3949 .lname = "Fsync on close",
3950 .type = FIO_OPT_BOOL,
3951 .off1 = offsetof(struct thread_options, fsync_on_close),
3952 .help = "fsync files on close",
3954 .category = FIO_OPT_C_FILE,
3955 .group = FIO_OPT_G_INVALID,
3959 .lname = "Unlink file",
3960 .type = FIO_OPT_BOOL,
3961 .off1 = offsetof(struct thread_options, unlink),
3962 .help = "Unlink created files after job has completed",
3964 .category = FIO_OPT_C_FILE,
3965 .group = FIO_OPT_G_INVALID,
3968 .name = "unlink_each_loop",
3969 .lname = "Unlink file after each loop of a job",
3970 .type = FIO_OPT_BOOL,
3971 .off1 = offsetof(struct thread_options, unlink_each_loop),
3972 .help = "Unlink created files after each loop in a job has completed",
3974 .category = FIO_OPT_C_FILE,
3975 .group = FIO_OPT_G_INVALID,
3979 .lname = "Exit-all on terminate",
3980 .type = FIO_OPT_STR_SET,
3981 .cb = str_exitall_cb,
3982 .help = "Terminate all jobs when one exits",
3983 .category = FIO_OPT_C_GENERAL,
3984 .group = FIO_OPT_G_PROCESS,
3987 .name = "exitall_on_error",
3988 .lname = "Exit-all on terminate in error",
3989 .type = FIO_OPT_STR_SET,
3990 .off1 = offsetof(struct thread_options, exitall_error),
3991 .help = "Terminate all jobs when one exits in error",
3992 .category = FIO_OPT_C_GENERAL,
3993 .group = FIO_OPT_G_PROCESS,
3996 .name = "stonewall",
3997 .lname = "Wait for previous",
3998 .alias = "wait_for_previous",
3999 .type = FIO_OPT_STR_SET,
4000 .off1 = offsetof(struct thread_options, stonewall),
4001 .help = "Insert a hard barrier between this job and previous",
4002 .category = FIO_OPT_C_GENERAL,
4003 .group = FIO_OPT_G_PROCESS,
4006 .name = "new_group",
4007 .lname = "New group",
4008 .type = FIO_OPT_STR_SET,
4009 .off1 = offsetof(struct thread_options, new_group),
4010 .help = "Mark the start of a new group (for reporting)",
4011 .category = FIO_OPT_C_GENERAL,
4012 .group = FIO_OPT_G_PROCESS,
4017 .type = FIO_OPT_STR_SET,
4018 .off1 = offsetof(struct thread_options, use_thread),
4019 .help = "Use threads instead of processes",
4020 #ifdef CONFIG_NO_SHM
4024 .category = FIO_OPT_C_GENERAL,
4025 .group = FIO_OPT_G_PROCESS,
4028 .name = "per_job_logs",
4029 .lname = "Per Job Logs",
4030 .type = FIO_OPT_BOOL,
4031 .off1 = offsetof(struct thread_options, per_job_logs),
4032 .help = "Include job number in generated log files or not",
4034 .category = FIO_OPT_C_LOG,
4035 .group = FIO_OPT_G_INVALID,
4038 .name = "write_bw_log",
4039 .lname = "Write bandwidth log",
4040 .type = FIO_OPT_STR,
4041 .off1 = offsetof(struct thread_options, bw_log_file),
4042 .cb = str_write_bw_log_cb,
4043 .help = "Write log of bandwidth during run",
4044 .category = FIO_OPT_C_LOG,
4045 .group = FIO_OPT_G_INVALID,
4048 .name = "write_lat_log",
4049 .lname = "Write latency log",
4050 .type = FIO_OPT_STR,
4051 .off1 = offsetof(struct thread_options, lat_log_file),
4052 .cb = str_write_lat_log_cb,
4053 .help = "Write log of latency during run",
4054 .category = FIO_OPT_C_LOG,
4055 .group = FIO_OPT_G_INVALID,
4058 .name = "write_iops_log",
4059 .lname = "Write IOPS log",
4060 .type = FIO_OPT_STR,
4061 .off1 = offsetof(struct thread_options, iops_log_file),
4062 .cb = str_write_iops_log_cb,
4063 .help = "Write log of IOPS during run",
4064 .category = FIO_OPT_C_LOG,
4065 .group = FIO_OPT_G_INVALID,
4068 .name = "log_avg_msec",
4069 .lname = "Log averaging (msec)",
4070 .type = FIO_OPT_INT,
4071 .off1 = offsetof(struct thread_options, log_avg_msec),
4072 .help = "Average bw/iops/lat logs over this period of time",
4074 .category = FIO_OPT_C_LOG,
4075 .group = FIO_OPT_G_INVALID,
4078 .name = "log_hist_msec",
4079 .lname = "Log histograms (msec)",
4080 .type = FIO_OPT_INT,
4081 .off1 = offsetof(struct thread_options, log_hist_msec),
4082 .help = "Dump completion latency histograms at frequency of this time value",
4084 .category = FIO_OPT_C_LOG,
4085 .group = FIO_OPT_G_INVALID,
4088 .name = "log_hist_coarseness",
4089 .lname = "Histogram logs coarseness",
4090 .type = FIO_OPT_INT,
4091 .off1 = offsetof(struct thread_options, log_hist_coarseness),
4092 .help = "Integer in range [0,6]. Higher coarseness outputs"
4093 " fewer histogram bins per sample. The number of bins for"
4094 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
4096 .category = FIO_OPT_C_LOG,
4097 .group = FIO_OPT_G_INVALID,
4100 .name = "write_hist_log",
4101 .lname = "Write latency histogram logs",
4102 .type = FIO_OPT_STR,
4103 .off1 = offsetof(struct thread_options, hist_log_file),
4104 .cb = str_write_hist_log_cb,
4105 .help = "Write log of latency histograms during run",
4106 .category = FIO_OPT_C_LOG,
4107 .group = FIO_OPT_G_INVALID,
4110 .name = "log_max_value",
4111 .lname = "Log maximum instead of average",
4112 .type = FIO_OPT_BOOL,
4113 .off1 = offsetof(struct thread_options, log_max),
4114 .help = "Log max sample in a window instead of average",
4116 .category = FIO_OPT_C_LOG,
4117 .group = FIO_OPT_G_INVALID,
4120 .name = "log_offset",
4121 .lname = "Log offset of IO",
4122 .type = FIO_OPT_BOOL,
4123 .off1 = offsetof(struct thread_options, log_offset),
4124 .help = "Include offset of IO for each log entry",
4126 .category = FIO_OPT_C_LOG,
4127 .group = FIO_OPT_G_INVALID,
4131 .name = "log_compression",
4132 .lname = "Log compression",
4133 .type = FIO_OPT_INT,
4134 .off1 = offsetof(struct thread_options, log_gz),
4135 .help = "Log in compressed chunks of this size",
4137 .maxval = 512 * 1024 * 1024ULL,
4138 .category = FIO_OPT_C_LOG,
4139 .group = FIO_OPT_G_INVALID,
4141 #ifdef FIO_HAVE_CPU_AFFINITY
4143 .name = "log_compression_cpus",
4144 .lname = "Log Compression CPUs",
4145 .type = FIO_OPT_STR,
4146 .cb = str_log_cpus_allowed_cb,
4147 .off1 = offsetof(struct thread_options, log_gz_cpumask),
4148 .parent = "log_compression",
4149 .help = "Limit log compression to these CPUs",
4150 .category = FIO_OPT_C_LOG,
4151 .group = FIO_OPT_G_INVALID,
4155 .name = "log_compression_cpus",
4156 .lname = "Log Compression CPUs",
4157 .type = FIO_OPT_UNSUPPORTED,
4158 .help = "Your platform does not support CPU affinities",
4162 .name = "log_store_compressed",
4163 .lname = "Log store compressed",
4164 .type = FIO_OPT_BOOL,
4165 .off1 = offsetof(struct thread_options, log_gz_store),
4166 .help = "Store logs in a compressed format",
4167 .category = FIO_OPT_C_LOG,
4168 .group = FIO_OPT_G_INVALID,
4172 .name = "log_compression",
4173 .lname = "Log compression",
4174 .type = FIO_OPT_UNSUPPORTED,
4175 .help = "Install libz-dev(el) to get compression support",
4178 .name = "log_store_compressed",
4179 .lname = "Log store compressed",
4180 .type = FIO_OPT_UNSUPPORTED,
4181 .help = "Install libz-dev(el) to get compression support",
4185 .name = "log_unix_epoch",
4186 .lname = "Log epoch unix",
4187 .type = FIO_OPT_BOOL,
4188 .off1 = offsetof(struct thread_options, log_unix_epoch),
4189 .help = "Use Unix time in log files",
4190 .category = FIO_OPT_C_LOG,
4191 .group = FIO_OPT_G_INVALID,
4194 .name = "block_error_percentiles",
4195 .lname = "Block error percentiles",
4196 .type = FIO_OPT_BOOL,
4197 .off1 = offsetof(struct thread_options, block_error_hist),
4198 .help = "Record trim block errors and make a histogram",
4200 .category = FIO_OPT_C_LOG,
4201 .group = FIO_OPT_G_INVALID,
4204 .name = "bwavgtime",
4205 .lname = "Bandwidth average time",
4206 .type = FIO_OPT_INT,
4207 .off1 = offsetof(struct thread_options, bw_avg_time),
4208 .help = "Time window over which to calculate bandwidth"
4211 .parent = "write_bw_log",
4214 .category = FIO_OPT_C_LOG,
4215 .group = FIO_OPT_G_INVALID,
4218 .name = "iopsavgtime",
4219 .lname = "IOPS average time",
4220 .type = FIO_OPT_INT,
4221 .off1 = offsetof(struct thread_options, iops_avg_time),
4222 .help = "Time window over which to calculate IOPS (msec)",
4224 .parent = "write_iops_log",
4227 .category = FIO_OPT_C_LOG,
4228 .group = FIO_OPT_G_INVALID,
4231 .name = "group_reporting",
4232 .lname = "Group reporting",
4233 .type = FIO_OPT_STR_SET,
4234 .off1 = offsetof(struct thread_options, group_reporting),
4235 .help = "Do reporting on a per-group basis",
4236 .category = FIO_OPT_C_STAT,
4237 .group = FIO_OPT_G_INVALID,
4242 .type = FIO_OPT_BOOL,
4243 .off1 = offsetof(struct thread_options, stats),
4244 .help = "Enable collection of stats",
4246 .category = FIO_OPT_C_STAT,
4247 .group = FIO_OPT_G_INVALID,
4250 .name = "zero_buffers",
4251 .lname = "Zero I/O buffers",
4252 .type = FIO_OPT_STR_SET,
4253 .off1 = offsetof(struct thread_options, zero_buffers),
4254 .help = "Init IO buffers to all zeroes",
4255 .category = FIO_OPT_C_IO,
4256 .group = FIO_OPT_G_IO_BUF,
4259 .name = "refill_buffers",
4260 .lname = "Refill I/O buffers",
4261 .type = FIO_OPT_STR_SET,
4262 .off1 = offsetof(struct thread_options, refill_buffers),
4263 .help = "Refill IO buffers on every IO submit",
4264 .category = FIO_OPT_C_IO,
4265 .group = FIO_OPT_G_IO_BUF,
4268 .name = "scramble_buffers",
4269 .lname = "Scramble I/O buffers",
4270 .type = FIO_OPT_BOOL,
4271 .off1 = offsetof(struct thread_options, scramble_buffers),
4272 .help = "Slightly scramble buffers on every IO submit",
4274 .category = FIO_OPT_C_IO,
4275 .group = FIO_OPT_G_IO_BUF,
4278 .name = "buffer_pattern",
4279 .lname = "Buffer pattern",
4280 .type = FIO_OPT_STR,
4281 .cb = str_buffer_pattern_cb,
4282 .off1 = offsetof(struct thread_options, buffer_pattern),
4283 .help = "Fill pattern for IO buffers",
4284 .category = FIO_OPT_C_IO,
4285 .group = FIO_OPT_G_IO_BUF,
4288 .name = "buffer_compress_percentage",
4289 .lname = "Buffer compression percentage",
4290 .type = FIO_OPT_INT,
4291 .cb = str_buffer_compress_cb,
4292 .off1 = offsetof(struct thread_options, compress_percentage),
4295 .help = "How compressible the buffer is (approximately)",
4297 .category = FIO_OPT_C_IO,
4298 .group = FIO_OPT_G_IO_BUF,
4301 .name = "buffer_compress_chunk",
4302 .lname = "Buffer compression chunk size",
4303 .type = FIO_OPT_INT,
4304 .off1 = offsetof(struct thread_options, compress_chunk),
4305 .parent = "buffer_compress_percentage",
4307 .help = "Size of compressible region in buffer",
4310 .category = FIO_OPT_C_IO,
4311 .group = FIO_OPT_G_IO_BUF,
4314 .name = "dedupe_percentage",
4315 .lname = "Dedupe percentage",
4316 .type = FIO_OPT_INT,
4317 .cb = str_dedupe_cb,
4318 .off1 = offsetof(struct thread_options, dedupe_percentage),
4321 .help = "Percentage of buffers that are dedupable",
4323 .category = FIO_OPT_C_IO,
4324 .group = FIO_OPT_G_IO_BUF,
4327 .name = "clat_percentiles",
4328 .lname = "Completion latency percentiles",
4329 .type = FIO_OPT_BOOL,
4330 .off1 = offsetof(struct thread_options, clat_percentiles),
4331 .help = "Enable the reporting of completion latency percentiles",
4333 .inverse = "lat_percentiles",
4334 .category = FIO_OPT_C_STAT,
4335 .group = FIO_OPT_G_INVALID,
4338 .name = "lat_percentiles",
4339 .lname = "IO latency percentiles",
4340 .type = FIO_OPT_BOOL,
4341 .off1 = offsetof(struct thread_options, lat_percentiles),
4342 .help = "Enable the reporting of IO latency percentiles",
4344 .inverse = "clat_percentiles",
4345 .category = FIO_OPT_C_STAT,
4346 .group = FIO_OPT_G_INVALID,
4349 .name = "percentile_list",
4350 .lname = "Percentile list",
4351 .type = FIO_OPT_FLOAT_LIST,
4352 .off1 = offsetof(struct thread_options, percentile_list),
4353 .off2 = offsetof(struct thread_options, percentile_precision),
4354 .help = "Specify a custom list of percentiles to report for "
4355 "completion latency and block errors",
4356 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
4357 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4360 .category = FIO_OPT_C_STAT,
4361 .group = FIO_OPT_G_INVALID,
4364 .name = "significant_figures",
4365 .lname = "Significant figures",
4366 .type = FIO_OPT_INT,
4367 .off1 = offsetof(struct thread_options, sig_figs),
4370 .help = "Significant figures for output-format set to normal",
4373 .category = FIO_OPT_C_STAT,
4374 .group = FIO_OPT_G_INVALID,
4377 #ifdef FIO_HAVE_DISK_UTIL
4379 .name = "disk_util",
4380 .lname = "Disk utilization",
4381 .type = FIO_OPT_BOOL,
4382 .off1 = offsetof(struct thread_options, do_disk_util),
4383 .help = "Log disk utilization statistics",
4385 .category = FIO_OPT_C_STAT,
4386 .group = FIO_OPT_G_INVALID,
4390 .name = "disk_util",
4391 .lname = "Disk utilization",
4392 .type = FIO_OPT_UNSUPPORTED,
4393 .help = "Your platform does not support disk utilization",
4397 .name = "gtod_reduce",
4398 .lname = "Reduce gettimeofday() calls",
4399 .type = FIO_OPT_BOOL,
4400 .help = "Greatly reduce number of gettimeofday() calls",
4401 .cb = str_gtod_reduce_cb,
4404 .category = FIO_OPT_C_STAT,
4405 .group = FIO_OPT_G_INVALID,
4408 .name = "disable_lat",
4409 .lname = "Disable all latency stats",
4410 .type = FIO_OPT_BOOL,
4411 .off1 = offsetof(struct thread_options, disable_lat),
4412 .help = "Disable latency numbers",
4413 .parent = "gtod_reduce",
4416 .category = FIO_OPT_C_STAT,
4417 .group = FIO_OPT_G_INVALID,
4420 .name = "disable_clat",
4421 .lname = "Disable completion latency stats",
4422 .type = FIO_OPT_BOOL,
4423 .off1 = offsetof(struct thread_options, disable_clat),
4424 .help = "Disable completion latency numbers",
4425 .parent = "gtod_reduce",
4428 .category = FIO_OPT_C_STAT,
4429 .group = FIO_OPT_G_INVALID,
4432 .name = "disable_slat",
4433 .lname = "Disable submission latency stats",
4434 .type = FIO_OPT_BOOL,
4435 .off1 = offsetof(struct thread_options, disable_slat),
4436 .help = "Disable submission latency numbers",
4437 .parent = "gtod_reduce",
4440 .category = FIO_OPT_C_STAT,
4441 .group = FIO_OPT_G_INVALID,
4444 .name = "disable_bw_measurement",
4445 .alias = "disable_bw",
4446 .lname = "Disable bandwidth stats",
4447 .type = FIO_OPT_BOOL,
4448 .off1 = offsetof(struct thread_options, disable_bw),
4449 .help = "Disable bandwidth logging",
4450 .parent = "gtod_reduce",
4453 .category = FIO_OPT_C_STAT,
4454 .group = FIO_OPT_G_INVALID,
4458 .lname = "Dedicated gettimeofday() CPU",
4459 .type = FIO_OPT_INT,
4460 .off1 = offsetof(struct thread_options, gtod_cpu),
4461 .help = "Set up dedicated gettimeofday() thread on this CPU",
4462 .verify = gtod_cpu_verify,
4463 .category = FIO_OPT_C_GENERAL,
4464 .group = FIO_OPT_G_CLOCK,
4467 .name = "unified_rw_reporting",
4468 .lname = "Unified RW Reporting",
4469 .type = FIO_OPT_BOOL,
4470 .off1 = offsetof(struct thread_options, unified_rw_rep),
4471 .help = "Unify reporting across data direction",
4473 .category = FIO_OPT_C_GENERAL,
4474 .group = FIO_OPT_G_INVALID,
4477 .name = "continue_on_error",
4478 .lname = "Continue on error",
4479 .type = FIO_OPT_STR,
4480 .off1 = offsetof(struct thread_options, continue_on_error),
4481 .help = "Continue on non-fatal errors during IO",
4483 .category = FIO_OPT_C_GENERAL,
4484 .group = FIO_OPT_G_ERR,
4487 .oval = ERROR_TYPE_NONE,
4488 .help = "Exit when an error is encountered",
4491 .oval = ERROR_TYPE_READ,
4492 .help = "Continue on read errors only",
4495 .oval = ERROR_TYPE_WRITE,
4496 .help = "Continue on write errors only",
4499 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
4500 .help = "Continue on any IO errors",
4503 .oval = ERROR_TYPE_VERIFY,
4504 .help = "Continue on verify errors only",
4507 .oval = ERROR_TYPE_ANY,
4508 .help = "Continue on all io and verify errors",
4511 .oval = ERROR_TYPE_NONE,
4512 .help = "Alias for 'none'",
4515 .oval = ERROR_TYPE_ANY,
4516 .help = "Alias for 'all'",
4521 .name = "ignore_error",
4522 .lname = "Ignore Error",
4523 .type = FIO_OPT_STR,
4524 .cb = str_ignore_error_cb,
4525 .off1 = offsetof(struct thread_options, ignore_error_nr),
4526 .help = "Set a specific list of errors to ignore",
4528 .category = FIO_OPT_C_GENERAL,
4529 .group = FIO_OPT_G_ERR,
4532 .name = "error_dump",
4533 .lname = "Error Dump",
4534 .type = FIO_OPT_BOOL,
4535 .off1 = offsetof(struct thread_options, error_dump),
4537 .help = "Dump info on each error",
4538 .category = FIO_OPT_C_GENERAL,
4539 .group = FIO_OPT_G_ERR,
4544 .type = FIO_OPT_STR_STORE,
4545 .off1 = offsetof(struct thread_options, profile),
4546 .help = "Select a specific builtin performance test",
4547 .category = FIO_OPT_C_PROFILE,
4548 .group = FIO_OPT_G_INVALID,
4553 .type = FIO_OPT_STR_STORE,
4554 .off1 = offsetof(struct thread_options, cgroup),
4555 .help = "Add job to cgroup of this name",
4556 .category = FIO_OPT_C_GENERAL,
4557 .group = FIO_OPT_G_CGROUP,
4560 .name = "cgroup_nodelete",
4561 .lname = "Cgroup no-delete",
4562 .type = FIO_OPT_BOOL,
4563 .off1 = offsetof(struct thread_options, cgroup_nodelete),
4564 .help = "Do not delete cgroups after job completion",
4567 .category = FIO_OPT_C_GENERAL,
4568 .group = FIO_OPT_G_CGROUP,
4571 .name = "cgroup_weight",
4572 .lname = "Cgroup weight",
4573 .type = FIO_OPT_INT,
4574 .off1 = offsetof(struct thread_options, cgroup_weight),
4575 .help = "Use given weight for cgroup",
4579 .category = FIO_OPT_C_GENERAL,
4580 .group = FIO_OPT_G_CGROUP,
4585 .type = FIO_OPT_INT,
4586 .off1 = offsetof(struct thread_options, uid),
4587 .help = "Run job with this user ID",
4588 .category = FIO_OPT_C_GENERAL,
4589 .group = FIO_OPT_G_CRED,
4593 .lname = "Group ID",
4594 .type = FIO_OPT_INT,
4595 .off1 = offsetof(struct thread_options, gid),
4596 .help = "Run job with this group ID",
4597 .category = FIO_OPT_C_GENERAL,
4598 .group = FIO_OPT_G_CRED,
4603 .type = FIO_OPT_INT,
4604 .off1 = offsetof(struct thread_options, kb_base),
4610 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
4614 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
4617 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
4618 .category = FIO_OPT_C_GENERAL,
4619 .group = FIO_OPT_G_INVALID,
4622 .name = "unit_base",
4623 .lname = "Unit for quantities of data (Bits or Bytes)",
4624 .type = FIO_OPT_INT,
4625 .off1 = offsetof(struct thread_options, unit_base),
4630 .help = "Auto-detect",
4633 .oval = N2S_BYTEPERSEC,
4634 .help = "Normal (byte based)",
4637 .oval = N2S_BITPERSEC,
4638 .help = "Bit based",
4641 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
4642 .category = FIO_OPT_C_GENERAL,
4643 .group = FIO_OPT_G_INVALID,
4646 .name = "hugepage-size",
4647 .lname = "Hugepage size",
4648 .type = FIO_OPT_INT,
4649 .off1 = offsetof(struct thread_options, hugepage_size),
4650 .help = "When using hugepages, specify size of each page",
4651 .def = __fio_stringify(FIO_HUGE_PAGE),
4652 .interval = 1024 * 1024,
4653 .category = FIO_OPT_C_GENERAL,
4654 .group = FIO_OPT_G_INVALID,
4658 .lname = "I/O flow ID",
4659 .type = FIO_OPT_INT,
4660 .off1 = offsetof(struct thread_options, flow_id),
4661 .help = "The flow index ID to use",
4663 .category = FIO_OPT_C_IO,
4664 .group = FIO_OPT_G_IO_FLOW,
4668 .lname = "I/O flow weight",
4669 .type = FIO_OPT_INT,
4670 .off1 = offsetof(struct thread_options, flow),
4671 .help = "Weight for flow control of this job",
4672 .parent = "flow_id",
4675 .category = FIO_OPT_C_IO,
4676 .group = FIO_OPT_G_IO_FLOW,
4679 .name = "flow_watermark",
4680 .lname = "I/O flow watermark",
4681 .type = FIO_OPT_INT,
4682 .off1 = offsetof(struct thread_options, flow_watermark),
4683 .help = "High watermark for flow control. This option"
4684 " should be set to the same value for all threads"
4685 " with non-zero flow.",
4686 .parent = "flow_id",
4689 .category = FIO_OPT_C_IO,
4690 .group = FIO_OPT_G_IO_FLOW,
4693 .name = "flow_sleep",
4694 .lname = "I/O flow sleep",
4695 .type = FIO_OPT_INT,
4696 .off1 = offsetof(struct thread_options, flow_sleep),
4697 .help = "How many microseconds to sleep after being held"
4698 " back by the flow control mechanism",
4699 .parent = "flow_id",
4702 .category = FIO_OPT_C_IO,
4703 .group = FIO_OPT_G_IO_FLOW,
4706 .name = "steadystate",
4707 .lname = "Steady state threshold",
4709 .type = FIO_OPT_STR,
4710 .off1 = offsetof(struct thread_options, ss_state),
4711 .cb = str_steadystate_cb,
4712 .help = "Define the criterion and limit to judge when a job has reached steady state",
4713 .def = "iops_slope:0.01%",
4716 .oval = FIO_SS_IOPS,
4717 .help = "maximum mean deviation of IOPS measurements",
4719 { .ival = "iops_slope",
4720 .oval = FIO_SS_IOPS_SLOPE,
4721 .help = "slope calculated from IOPS measurements",
4725 .help = "maximum mean deviation of bandwidth measurements",
4729 .oval = FIO_SS_BW_SLOPE,
4730 .help = "slope calculated from bandwidth measurements",
4733 .category = FIO_OPT_C_GENERAL,
4734 .group = FIO_OPT_G_RUNTIME,
4737 .name = "steadystate_duration",
4738 .lname = "Steady state duration",
4740 .parent = "steadystate",
4741 .type = FIO_OPT_STR_VAL_TIME,
4742 .off1 = offsetof(struct thread_options, ss_dur),
4743 .help = "Stop workload upon attaining steady state for specified duration",
4747 .category = FIO_OPT_C_GENERAL,
4748 .group = FIO_OPT_G_RUNTIME,
4751 .name = "steadystate_ramp_time",
4752 .lname = "Steady state ramp time",
4754 .parent = "steadystate",
4755 .type = FIO_OPT_STR_VAL_TIME,
4756 .off1 = offsetof(struct thread_options, ss_ramp_time),
4757 .help = "Delay before initiation of data collection for steady state job termination testing",
4761 .category = FIO_OPT_C_GENERAL,
4762 .group = FIO_OPT_G_RUNTIME,
4769 static void add_to_lopt(struct option *lopt, struct fio_option *o,
4770 const char *name, int val)
4772 lopt->name = (char *) name;
4774 if (o->type == FIO_OPT_STR_SET)
4775 lopt->has_arg = optional_argument;
4777 lopt->has_arg = required_argument;
4780 static void options_to_lopts(struct fio_option *opts,
4781 struct option *long_options,
4782 int i, int option_type)
4784 struct fio_option *o = &opts[0];
4786 add_to_lopt(&long_options[i], o, o->name, option_type);
4789 add_to_lopt(&long_options[i], o, o->alias, option_type);
4794 assert(i < FIO_NR_OPTIONS);
4798 void fio_options_set_ioengine_opts(struct option *long_options,
4799 struct thread_data *td)
4804 while (long_options[i].name) {
4805 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
4806 memset(&long_options[i], 0, sizeof(*long_options));
4813 * Just clear out the prior ioengine options.
4818 options_to_lopts(td->io_ops->options, long_options, i,
4819 FIO_GETOPT_IOENGINE);
4822 void fio_options_dup_and_init(struct option *long_options)
4826 options_init(fio_options);
4829 while (long_options[i].name)
4832 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
4835 struct fio_keyword {
4841 static struct fio_keyword fio_keywords[] = {
4843 .word = "$pagesize",
4844 .desc = "Page size in the system",
4847 .word = "$mb_memory",
4848 .desc = "Megabytes of memory online",
4852 .desc = "Number of CPUs online in the system",
4859 void fio_keywords_exit(void)
4861 struct fio_keyword *kw;
4863 kw = &fio_keywords[0];
4871 void fio_keywords_init(void)
4873 unsigned long long mb_memory;
4877 sprintf(buf, "%lu", (unsigned long) page_size);
4878 fio_keywords[0].replace = strdup(buf);
4880 mb_memory = os_phys_mem() / (1024 * 1024);
4881 sprintf(buf, "%llu", mb_memory);
4882 fio_keywords[1].replace = strdup(buf);
4885 sprintf(buf, "%lu", l);
4886 fio_keywords[2].replace = strdup(buf);
4891 static char *bc_calc(char *str)
4893 char buf[128], *tmp;
4898 * No math, just return string
4900 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
4901 !strchr(str, '/')) || strchr(str, '\''))
4905 * Split option from value, we only need to calculate the value
4907 tmp = strchr(str, '=');
4914 * Prevent buffer overflows; such a case isn't reasonable anyway
4916 if (strlen(str) >= 128 || strlen(tmp) > 100)
4919 sprintf(buf, "which %s > /dev/null", BC_APP);
4921 log_err("fio: bc is needed for performing math\n");
4925 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
4926 f = popen(buf, "r");
4930 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
4937 buf[(tmp - str) + ret - 1] = '\0';
4938 memcpy(buf, str, tmp - str);
4944 * Return a copy of the input string with substrings of the form ${VARNAME}
4945 * substituted with the value of the environment variable VARNAME. The
4946 * substitution always occurs, even if VARNAME is empty or the corresponding
4947 * environment variable undefined.
4949 char *fio_option_dup_subs(const char *opt)
4951 char out[OPT_LEN_MAX+1];
4952 char in[OPT_LEN_MAX+1];
4955 char *ch1, *ch2, *env;
4956 ssize_t nchr = OPT_LEN_MAX;
4959 if (strlen(opt) + 1 > OPT_LEN_MAX) {
4960 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
4964 in[OPT_LEN_MAX] = '\0';
4965 strncpy(in, opt, OPT_LEN_MAX);
4967 while (*inptr && nchr > 0) {
4968 if (inptr[0] == '$' && inptr[1] == '{') {
4969 ch2 = strchr(inptr, '}');
4970 if (ch2 && inptr+1 < ch2) {
4977 envlen = strlen(env);
4978 if (envlen <= nchr) {
4979 memcpy(outptr, env, envlen);
4989 *outptr++ = *inptr++;
4998 * Look for reserved variable names and replace them with real values
5000 static char *fio_keyword_replace(char *opt)
5006 for (i = 0; fio_keywords[i].word != NULL; i++) {
5007 struct fio_keyword *kw = &fio_keywords[i];
5009 while ((s = strstr(opt, kw->word)) != NULL) {
5010 char *new = malloc(strlen(opt) + 1);
5016 * Copy part of the string before the keyword and
5017 * sprintf() the replacement after it.
5019 memcpy(new, opt, olen);
5020 len = sprintf(new + olen, "%s", kw->replace);
5023 * If there's more in the original string, copy that
5026 opt += strlen(kw->word) + olen;
5028 memcpy(new + olen + len, opt, opt - o_org - 1);
5031 * replace opt and free the old opt
5041 * Check for potential math and invoke bc, if possible
5049 static char **dup_and_sub_options(char **opts, int num_opts)
5052 char **opts_copy = malloc(num_opts * sizeof(*opts));
5053 for (i = 0; i < num_opts; i++) {
5054 opts_copy[i] = fio_option_dup_subs(opts[i]);
5057 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
5062 static void show_closest_option(const char *opt)
5064 int best_option, best_distance;
5073 while (name[i] != '\0' && name[i] != '=')
5078 best_distance = INT_MAX;
5080 while (fio_options[i].name) {
5081 distance = string_distance(name, fio_options[i].name);
5082 if (distance < best_distance) {
5083 best_distance = distance;
5089 if (best_option != -1 && string_distance_ok(name, best_distance) &&
5090 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
5091 log_err("Did you mean %s?\n", fio_options[best_option].name);
5096 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
5098 int i, ret, unknown;
5101 sort_options(opts, fio_options, num_opts);
5102 opts_copy = dup_and_sub_options(opts, num_opts);
5104 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
5105 const struct fio_option *o;
5106 int newret = parse_option(opts_copy[i], opts[i], fio_options,
5107 &o, &td->o, &td->opt_list);
5110 fio_option_mark_set(&td->o, o);
5118 opts_copy[i] = NULL;
5125 ret |= ioengine_load(td);
5127 sort_options(opts_copy, td->io_ops->options, num_opts);
5130 for (i = 0; i < num_opts; i++) {
5131 const struct fio_option *o = NULL;
5138 newret = parse_option(opts_copy[i], opts[i],
5139 td->io_ops->options, &o,
5140 td->eo, &td->opt_list);
5144 log_err("Bad option <%s>\n", opts[i]);
5145 show_closest_option(opts[i]);
5148 opts_copy[i] = NULL;
5156 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
5160 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
5162 const struct fio_option *o;
5164 o = find_option_c(fio_options, opt);
5166 fio_option_mark_set(&td->o, o);
5172 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
5175 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
5179 void fio_fill_default_options(struct thread_data *td)
5181 td->o.magic = OPT_MAGIC;
5182 fill_default_options(&td->o, fio_options);
5185 int fio_show_option_help(const char *opt)
5187 return show_cmd_help(fio_options, opt);
5191 * dupe FIO_OPT_STR_STORE options
5193 void fio_options_mem_dupe(struct thread_data *td)
5195 options_mem_dupe(fio_options, &td->o);
5197 if (td->eo && td->io_ops) {
5198 void *oldeo = td->eo;
5200 td->eo = malloc(td->io_ops->option_struct_size);
5201 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
5202 options_mem_dupe(td->io_ops->options, td->eo);
5206 unsigned int fio_get_kb_base(void *data)
5208 struct thread_data *td = cb_data_to_td(data);
5209 struct thread_options *o = &td->o;
5210 unsigned int kb_base = 0;
5213 * This is a hack... For private options, *data is not holding
5214 * a pointer to the thread_options, but to private data. This means
5215 * we can't safely dereference it, but magic is first so mem wise
5216 * it is valid. But this also means that if the job first sets
5217 * kb_base and expects that to be honored by private options,
5218 * it will be disappointed. We will return the global default
5221 if (o && o->magic == OPT_MAGIC)
5222 kb_base = o->kb_base;
5229 int add_option(const struct fio_option *o)
5231 struct fio_option *__o;
5240 if (opt_index + 1 == FIO_MAX_OPTS) {
5241 log_err("fio: FIO_MAX_OPTS is too small\n");
5245 memcpy(&fio_options[opt_index], o, sizeof(*o));
5246 fio_options[opt_index + 1].name = NULL;
5250 void invalidate_profile_options(const char *prof_name)
5252 struct fio_option *o;
5256 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5257 o->type = FIO_OPT_INVALID;
5258 o->prof_name = NULL;
5264 void add_opt_posval(const char *optname, const char *ival, const char *help)
5266 struct fio_option *o;
5269 o = find_option(fio_options, optname);
5273 for (i = 0; i < PARSE_MAX_VP; i++) {
5274 if (o->posval[i].ival)
5277 o->posval[i].ival = ival;
5278 o->posval[i].help = help;
5283 void del_opt_posval(const char *optname, const char *ival)
5285 struct fio_option *o;
5288 o = find_option(fio_options, optname);
5292 for (i = 0; i < PARSE_MAX_VP; i++) {
5293 if (!o->posval[i].ival)
5295 if (strcmp(o->posval[i].ival, ival))
5298 o->posval[i].ival = NULL;
5299 o->posval[i].help = NULL;
5303 void fio_options_free(struct thread_data *td)
5305 options_free(fio_options, &td->o);
5306 if (td->eo && td->io_ops && td->io_ops->options) {
5307 options_free(td->io_ops->options, td->eo);
5313 struct fio_option *fio_option_find(const char *name)
5315 return find_option(fio_options, name);
5318 static struct fio_option *find_next_opt(struct fio_option *from,
5321 struct fio_option *opt;
5324 from = &fio_options[0];
5330 if (off1 == from->off1) {
5335 } while (from->name);
5340 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5342 unsigned int opt_off, index, offset;
5344 opt_off = opt - &fio_options[0];
5345 index = opt_off / (8 * sizeof(uint64_t));
5346 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5347 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
5350 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
5352 struct fio_option *opt, *next;
5355 while ((opt = find_next_opt(next, off1)) != NULL) {
5356 if (opt_is_set(o, opt))
5365 void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt)
5367 unsigned int opt_off, index, offset;
5369 opt_off = opt - &fio_options[0];
5370 index = opt_off / (8 * sizeof(uint64_t));
5371 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5372 o->set_options[index] |= (uint64_t)1 << offset;