9 #include <netinet/in.h>
14 #include "lib/pattern.h"
19 char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
21 #define cb_data_to_td(data) container_of(data, struct thread_data, o)
23 static const struct pattern_fmt_desc fmt_desc[] = {
26 .len = FIO_FIELD_SIZE(struct io_u *, offset),
27 .paste = paste_blockoff
33 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
35 static char *get_opt_postfix(const char *str)
37 char *p = strstr(str, ":");
43 strip_blank_front(&p);
48 static bool split_parse_distr(const char *str, double *val, double *center)
62 r = str_to_float(cp, center, 0);
64 r = r && str_to_float(p, val, 0);
69 static int bs_cmp(const void *p1, const void *p2)
71 const struct bssplit *bsp1 = p1;
72 const struct bssplit *bsp2 = p2;
74 return (int) bsp1->perc - (int) bsp2->perc;
77 int split_parse_ddir(struct thread_options *o, struct split *split,
78 char *str, bool absolute, unsigned int max_splits)
80 unsigned long long perc;
88 while ((fname = strsep(&str, ":")) != NULL) {
94 perc_str = strstr(fname, "/");
99 if (str_to_decimal(perc_str, &val, 1, o, 0, 0)) {
100 log_err("fio: split conversion failed\n");
105 perc = atoi(perc_str);
118 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
119 log_err("fio: split conversion failed\n");
123 split->val1[i] = val;
124 split->val2[i] = perc;
126 if (i == max_splits) {
127 log_err("fio: hit max of %d split entries\n", i);
136 static int bssplit_ddir(struct thread_options *o, void *eo,
137 enum fio_ddir ddir, char *str, bool data)
139 unsigned int i, perc, perc_missing;
140 unsigned long long max_bs, min_bs;
143 memset(&split, 0, sizeof(split));
145 if (split_parse_ddir(o, &split, str, data, BSSPLIT_MAX))
152 o->bssplit[ddir] = malloc(split.nr * sizeof(struct bssplit));
153 o->bssplit_nr[ddir] = split.nr;
154 for (i = 0; i < split.nr; i++) {
155 if (split.val1[i] > max_bs)
156 max_bs = split.val1[i];
157 if (split.val1[i] < min_bs)
158 min_bs = split.val1[i];
160 o->bssplit[ddir][i].bs = split.val1[i];
161 o->bssplit[ddir][i].perc =split.val2[i];
165 * Now check if the percentages add up, and how much is missing
167 perc = perc_missing = 0;
168 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
169 struct bssplit *bsp = &o->bssplit[ddir][i];
171 if (bsp->perc == -1U)
177 if (perc > 100 && perc_missing > 1) {
178 log_err("fio: bssplit percentages add to more than 100%%\n");
179 free(o->bssplit[ddir]);
180 o->bssplit[ddir] = NULL;
185 * If values didn't have a percentage set, divide the remains between
189 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
191 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
192 struct bssplit *bsp = &o->bssplit[ddir][i];
194 if (bsp->perc == -1U)
195 bsp->perc = (100 - perc) / perc_missing;
199 o->min_bs[ddir] = min_bs;
200 o->max_bs[ddir] = max_bs;
203 * now sort based on percentages, for ease of lookup
205 qsort(o->bssplit[ddir], o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
209 int str_split_parse(struct thread_data *td, char *str,
210 split_parse_fn *fn, void *eo, bool data)
215 odir = strchr(str, ',');
217 ddir = strchr(odir + 1, ',');
219 ret = fn(&td->o, eo, DDIR_TRIM, ddir + 1, data);
225 op = strdup(odir + 1);
226 ret = fn(&td->o, eo, DDIR_TRIM, op, data);
231 ret = fn(&td->o, eo, DDIR_WRITE, odir + 1, data);
234 ret = fn(&td->o, eo, DDIR_READ, str, data);
240 ret = fn(&td->o, eo, DDIR_WRITE, op, data);
245 ret = fn(&td->o, eo, DDIR_TRIM, op, data);
249 ret = fn(&td->o, eo, DDIR_READ, str, data);
255 static int fio_fdp_cmp(const void *p1, const void *p2)
257 const uint16_t *t1 = p1;
258 const uint16_t *t2 = p2;
263 static int str_fdp_pli_cb(void *data, const char *input)
265 struct thread_data *td = cb_data_to_td(data);
269 p = str = strdup(input);
270 strip_blank_front(&str);
271 strip_blank_end(str);
273 while ((v = strsep(&str, ",")) != NULL && i < FIO_MAX_PLIS)
274 td->o.fdp_plis[i++] = strtoll(v, NULL, 0);
277 qsort(td->o.fdp_plis, i, sizeof(*td->o.fdp_plis), fio_fdp_cmp);
283 static int str_bssplit_cb(void *data, const char *input)
285 struct thread_data *td = cb_data_to_td(data);
289 p = str = strdup(input);
291 strip_blank_front(&str);
292 strip_blank_end(str);
294 ret = str_split_parse(td, str, bssplit_ddir, NULL, false);
296 if (parse_dryrun()) {
299 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
300 free(td->o.bssplit[i]);
301 td->o.bssplit[i] = NULL;
302 td->o.bssplit_nr[i] = 0;
310 static int parse_cmdprio_bssplit_entry(struct thread_options *o,
311 struct split_prio *entry, char *str)
316 unsigned int perc = 0, class, level, hint;
319 * valid entry formats:
320 * bs/ - %s/ - set perc to 0, prio to -1.
321 * bs/perc - %s/%u - set prio to -1.
322 * bs/perc/class/level - %s/%u/%u/%u
323 * bs/perc/class/level/hint - %s/%u/%u/%u/%u
325 matches = sscanf(str, "%m[^/]/%u/%u/%u/%u",
326 &bs_str, &perc, &class, &level, &hint);
328 log_err("fio: invalid cmdprio_bssplit format\n");
332 if (str_to_decimal(bs_str, &bs_val, 1, o, 0, 0)) {
333 log_err("fio: split conversion failed\n");
340 entry->perc = min(perc, 100u);
343 case 1: /* bs/ case */
344 case 2: /* bs/perc case */
346 case 4: /* bs/perc/class/level case */
347 case 5: /* bs/perc/class/level/hint case */
348 class = min(class, (unsigned int) IOPRIO_MAX_PRIO_CLASS);
349 level = min(level, (unsigned int) IOPRIO_MAX_PRIO);
351 hint = min(hint, (unsigned int) IOPRIO_MAX_PRIO_HINT);
354 entry->prio = ioprio_value(class, level, hint);
357 log_err("fio: invalid cmdprio_bssplit format\n");
365 * Returns a negative integer if the first argument should be before the second
366 * argument in the sorted list. A positive integer if the first argument should
367 * be after the second argument in the sorted list. A zero if they are equal.
369 static int fio_split_prio_cmp(const void *p1, const void *p2)
371 const struct split_prio *tmp1 = p1;
372 const struct split_prio *tmp2 = p2;
374 if (tmp1->bs > tmp2->bs)
376 if (tmp1->bs < tmp2->bs)
381 int split_parse_prio_ddir(struct thread_options *o, struct split_prio **entries,
382 int *nr_entries, char *str)
384 struct split_prio *tmp_entries;
385 unsigned int nr_bssplits;
386 char *str_cpy, *p, *fname;
388 /* strsep modifies the string, dup it so that we can use strsep twice */
389 p = str_cpy = strdup(str);
394 while ((fname = strsep(&str_cpy, ":")) != NULL) {
401 if (nr_bssplits > BSSPLIT_MAX) {
402 log_err("fio: too many cmdprio_bssplit entries\n");
406 tmp_entries = calloc(nr_bssplits, sizeof(*tmp_entries));
411 while ((fname = strsep(&str, ":")) != NULL) {
412 struct split_prio *entry;
417 entry = &tmp_entries[nr_bssplits];
419 if (parse_cmdprio_bssplit_entry(o, entry, fname)) {
420 log_err("fio: failed to parse cmdprio_bssplit entry\n");
425 /* skip zero perc entries, they provide no useful information */
430 qsort(tmp_entries, nr_bssplits, sizeof(*tmp_entries),
433 *entries = tmp_entries;
434 *nr_entries = nr_bssplits;
439 static int str2error(char *str)
441 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
442 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
443 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
444 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
445 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
446 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
447 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
448 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
449 int i = 0, num = sizeof(err) / sizeof(char *);
452 if (!strcmp(err[i], str))
459 static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
466 if (etype >= ERROR_TYPE_CNT) {
467 log_err("Illegal error type\n");
471 td->o.ignore_error_nr[etype] = 4;
472 error = calloc(4, sizeof(int));
475 while ((fname = strsep(&str, ":")) != NULL) {
481 * grow struct buffer, if needed
483 if (i == td->o.ignore_error_nr[etype]) {
484 td->o.ignore_error_nr[etype] <<= 1;
485 error = realloc(error, td->o.ignore_error_nr[etype]
488 if (fname[0] == 'E') {
489 error[i] = str2error(fname);
491 error[i] = atoi(fname);
493 error[i] = -error[i];
496 log_err("Unknown error %s, please use number value\n",
498 td->o.ignore_error_nr[etype] = 0;
505 td->o.continue_on_error |= 1 << etype;
506 td->o.ignore_error_nr[etype] = i;
507 td->o.ignore_error[etype] = error;
509 td->o.ignore_error_nr[etype] = 0;
517 static int str_replay_skip_cb(void *data, const char *input)
519 struct thread_data *td = cb_data_to_td(data);
526 p = str = strdup(input);
528 strip_blank_front(&str);
529 strip_blank_end(str);
535 if (!strcmp(p, "read"))
536 td->o.replay_skip |= 1u << DDIR_READ;
537 else if (!strcmp(p, "write"))
538 td->o.replay_skip |= 1u << DDIR_WRITE;
539 else if (!strcmp(p, "trim"))
540 td->o.replay_skip |= 1u << DDIR_TRIM;
541 else if (!strcmp(p, "sync"))
542 td->o.replay_skip |= 1u << DDIR_SYNC;
544 log_err("Unknown skip type: %s\n", p);
554 static int str_ignore_error_cb(void *data, const char *input)
556 struct thread_data *td = cb_data_to_td(data);
559 enum error_type_bit type = 0;
564 p = str = strdup(input);
566 strip_blank_front(&str);
567 strip_blank_end(str);
573 ret = ignore_error_type(td, type, p);
583 static int str_rw_cb(void *data, const char *str)
585 struct thread_data *td = cb_data_to_td(data);
586 struct thread_options *o = &td->o;
595 nr = get_opt_postfix(str);
602 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
603 log_err("fio: randrw postfix parsing failed\n");
607 if ((val <= 0) || (val > UINT_MAX)) {
608 log_err("fio: randrw postfix parsing out of range\n");
612 o->ddir_seq_nr = (unsigned int) val;
616 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
617 log_err("fio: rw postfix parsing failed\n");
622 o->ddir_seq_add = val;
629 static int str_mem_cb(void *data, const char *mem)
631 struct thread_data *td = cb_data_to_td(data);
633 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
634 td->o.mem_type == MEM_MMAPSHARED)
635 td->o.mmapfile = get_opt_postfix(mem);
640 static int fio_clock_source_cb(void *data, const char *str)
642 struct thread_data *td = cb_data_to_td(data);
644 fio_clock_source = td->o.clocksource;
645 fio_clock_source_set = 1;
650 static int str_rwmix_read_cb(void *data, unsigned long long *val)
652 struct thread_data *td = cb_data_to_td(data);
654 td->o.rwmix[DDIR_READ] = *val;
655 td->o.rwmix[DDIR_WRITE] = 100 - *val;
659 static int str_rwmix_write_cb(void *data, unsigned long long *val)
661 struct thread_data *td = cb_data_to_td(data);
663 td->o.rwmix[DDIR_WRITE] = *val;
664 td->o.rwmix[DDIR_READ] = 100 - *val;
668 static int str_exitall_cb(void)
670 exitall_on_terminate = true;
674 #ifdef FIO_HAVE_CPU_AFFINITY
675 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
677 unsigned int i, index, cpus_in_mask;
678 const long max_cpu = cpus_configured();
680 cpus_in_mask = fio_cpu_count(mask);
684 cpu_index = cpu_index % cpus_in_mask;
687 for (i = 0; i < max_cpu; i++) {
688 if (!fio_cpu_isset(mask, i))
691 if (cpu_index != index)
692 fio_cpu_clear(mask, i);
697 return fio_cpu_count(mask);
700 static int str_cpumask_cb(void *data, unsigned long long *val)
702 struct thread_data *td = cb_data_to_td(data);
710 ret = fio_cpuset_init(&td->o.cpumask);
712 log_err("fio: cpuset_init failed\n");
713 td_verror(td, ret, "fio_cpuset_init");
717 max_cpu = cpus_configured();
719 for (i = 0; i < sizeof(int) * 8; i++) {
720 if ((1 << i) & *val) {
722 log_err("fio: CPU %d too large (max=%ld)\n", i,
726 dprint(FD_PARSE, "set cpu allowed %d\n", i);
727 fio_cpu_set(&td->o.cpumask, i);
734 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
741 ret = fio_cpuset_init(mask);
743 log_err("fio: cpuset_init failed\n");
744 td_verror(td, ret, "fio_cpuset_init");
748 p = str = strdup(input);
750 strip_blank_front(&str);
751 strip_blank_end(str);
753 max_cpu = cpus_configured();
755 while ((cpu = strsep(&str, ",")) != NULL) {
764 while ((cpu2 = strsep(&str2, "-")) != NULL) {
774 while (icpu <= icpu2) {
775 if (icpu >= FIO_MAX_CPUS) {
776 log_err("fio: your OS only supports up to"
777 " %d CPUs\n", (int) FIO_MAX_CPUS);
781 if (icpu >= max_cpu) {
782 log_err("fio: CPU %d too large (max=%ld)\n",
788 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
789 fio_cpu_set(mask, icpu);
800 static int str_cpus_allowed_cb(void *data, const char *input)
802 struct thread_data *td = cb_data_to_td(data);
807 return set_cpus_allowed(td, &td->o.cpumask, input);
810 static int str_verify_cpus_allowed_cb(void *data, const char *input)
812 struct thread_data *td = cb_data_to_td(data);
817 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
821 static int str_log_cpus_allowed_cb(void *data, const char *input)
823 struct thread_data *td = cb_data_to_td(data);
828 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
830 #endif /* CONFIG_ZLIB */
832 #endif /* FIO_HAVE_CPU_AFFINITY */
834 #ifdef CONFIG_LIBNUMA
835 static int str_numa_cpunodes_cb(void *data, char *input)
837 struct thread_data *td = cb_data_to_td(data);
838 struct bitmask *verify_bitmask;
843 /* numa_parse_nodestring() parses a character string list
844 * of nodes into a bit mask. The bit mask is allocated by
845 * numa_allocate_nodemask(), so it should be freed by
846 * numa_free_nodemask().
848 verify_bitmask = numa_parse_nodestring(input);
849 if (verify_bitmask == NULL) {
850 log_err("fio: numa_parse_nodestring failed\n");
851 td_verror(td, 1, "str_numa_cpunodes_cb");
854 numa_free_nodemask(verify_bitmask);
856 td->o.numa_cpunodes = strdup(input);
860 static int str_numa_mpol_cb(void *data, char *input)
862 struct thread_data *td = cb_data_to_td(data);
863 const char * const policy_types[] =
864 { "default", "prefer", "bind", "interleave", "local", NULL };
867 struct bitmask *verify_bitmask;
872 nodelist = strchr(input, ':');
874 /* NUL-terminate mode */
878 for (i = 0; i <= MPOL_LOCAL; i++) {
879 if (!strcmp(input, policy_types[i])) {
880 td->o.numa_mem_mode = i;
884 if (i > MPOL_LOCAL) {
885 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
889 switch (td->o.numa_mem_mode) {
892 * Insist on a nodelist of one node only
895 char *rest = nodelist;
896 while (isdigit(*rest))
899 log_err("fio: one node only for \'prefer\'\n");
903 log_err("fio: one node is needed for \'prefer\'\n");
907 case MPOL_INTERLEAVE:
909 * Default to online nodes with memory if no nodelist
912 nodelist = strdup("all");
917 * Don't allow a nodelist
920 log_err("fio: NO nodelist for \'local\'\n");
926 * Insist on a nodelist
929 log_err("fio: a nodelist is needed for \'bind\'\n");
936 /* numa_parse_nodestring() parses a character string list
937 * of nodes into a bit mask. The bit mask is allocated by
938 * numa_allocate_nodemask(), so it should be freed by
939 * numa_free_nodemask().
941 switch (td->o.numa_mem_mode) {
943 td->o.numa_mem_prefer_node = atoi(nodelist);
945 case MPOL_INTERLEAVE:
947 verify_bitmask = numa_parse_nodestring(nodelist);
948 if (verify_bitmask == NULL) {
949 log_err("fio: numa_parse_nodestring failed\n");
950 td_verror(td, 1, "str_numa_memnodes_cb");
953 td->o.numa_memnodes = strdup(nodelist);
954 numa_free_nodemask(verify_bitmask);
969 static int str_fst_cb(void *data, const char *str)
971 struct thread_data *td = cb_data_to_td(data);
977 td->file_service_nr = 1;
979 switch (td->o.file_service_type) {
980 case FIO_FSERVICE_RANDOM:
981 case FIO_FSERVICE_RR:
982 case FIO_FSERVICE_SEQ:
983 nr = get_opt_postfix(str);
985 td->file_service_nr = atoi(nr);
990 case FIO_FSERVICE_ZIPF:
993 case FIO_FSERVICE_PARETO:
994 val = FIO_DEF_PARETO;
996 case FIO_FSERVICE_GAUSS:
1000 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
1007 nr = get_opt_postfix(str);
1008 if (nr && !split_parse_distr(nr, &val, ¢er)) {
1009 log_err("fio: file service type random postfix parsing failed\n");
1016 if (center != -1 && (center < 0.00 || center > 1.00)) {
1017 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
1020 td->random_center = center;
1022 switch (td->o.file_service_type) {
1023 case FIO_FSERVICE_ZIPF:
1025 log_err("fio: zipf theta must be different than 1.0\n");
1030 td->zipf_theta = val;
1032 case FIO_FSERVICE_PARETO:
1033 if (val <= 0.00 || val >= 1.00) {
1034 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1041 case FIO_FSERVICE_GAUSS:
1042 if (val < 0.00 || val >= 100.00) {
1043 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1048 td->gauss_dev = val;
1055 #ifdef CONFIG_SYNC_FILE_RANGE
1056 static int str_sfr_cb(void *data, const char *str)
1058 struct thread_data *td = cb_data_to_td(data);
1059 char *nr = get_opt_postfix(str);
1061 td->sync_file_range_nr = 1;
1063 td->sync_file_range_nr = atoi(nr);
1071 static int zone_split_ddir(struct thread_options *o, void *eo,
1072 enum fio_ddir ddir, char *str, bool absolute)
1074 unsigned int i, perc, perc_missing, sperc, sperc_missing;
1077 memset(&split, 0, sizeof(split));
1079 if (split_parse_ddir(o, &split, str, absolute, ZONESPLIT_MAX))
1084 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
1085 o->zone_split_nr[ddir] = split.nr;
1086 for (i = 0; i < split.nr; i++) {
1087 o->zone_split[ddir][i].access_perc = split.val1[i];
1089 o->zone_split[ddir][i].size = split.val2[i];
1091 o->zone_split[ddir][i].size_perc = split.val2[i];
1095 * Now check if the percentages add up, and how much is missing
1097 perc = perc_missing = 0;
1098 sperc = sperc_missing = 0;
1099 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1100 struct zone_split *zsp = &o->zone_split[ddir][i];
1102 if (zsp->access_perc == (uint8_t) -1U)
1105 perc += zsp->access_perc;
1108 if (zsp->size_perc == (uint8_t) -1U)
1111 sperc += zsp->size_perc;
1115 if (perc > 100 || sperc > 100) {
1116 log_err("fio: zone_split percentages add to more than 100%%\n");
1117 free(o->zone_split[ddir]);
1118 o->zone_split[ddir] = NULL;
1122 log_err("fio: access percentage don't add up to 100 for zoned "
1123 "random distribution (got=%u)\n", perc);
1124 free(o->zone_split[ddir]);
1125 o->zone_split[ddir] = NULL;
1130 * If values didn't have a percentage set, divide the remains between
1134 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
1136 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1137 struct zone_split *zsp = &o->zone_split[ddir][i];
1139 if (zsp->access_perc == (uint8_t) -1U)
1140 zsp->access_perc = (100 - perc) / perc_missing;
1143 if (sperc_missing) {
1144 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
1146 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1147 struct zone_split *zsp = &o->zone_split[ddir][i];
1149 if (zsp->size_perc == (uint8_t) -1U)
1150 zsp->size_perc = (100 - sperc) / sperc_missing;
1157 static int parse_zoned_distribution(struct thread_data *td, const char *input,
1160 const char *pre = absolute ? "zoned_abs:" : "zoned:";
1164 p = str = strdup(input);
1166 strip_blank_front(&str);
1167 strip_blank_end(str);
1169 /* We expect it to start like that, bail if not */
1170 if (strncmp(str, pre, strlen(pre))) {
1171 log_err("fio: mismatch in zoned input <%s>\n", str);
1177 ret = str_split_parse(td, str, zone_split_ddir, NULL, absolute);
1181 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1184 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
1186 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
1187 struct zone_split *zsp = &td->o.zone_split[i][j];
1190 dprint(FD_PARSE, "\t%d: %u/%llu\n", j,
1192 (unsigned long long) zsp->size);
1194 dprint(FD_PARSE, "\t%d: %u/%u\n", j,
1201 if (parse_dryrun()) {
1202 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1203 free(td->o.zone_split[i]);
1204 td->o.zone_split[i] = NULL;
1205 td->o.zone_split_nr[i] = 0;
1212 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1213 td->o.zone_split_nr[i] = 0;
1219 static int str_random_distribution_cb(void *data, const char *str)
1221 struct thread_data *td = cb_data_to_td(data);
1226 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1228 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1229 val = FIO_DEF_PARETO;
1230 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1232 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1233 return parse_zoned_distribution(td, str, false);
1234 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED_ABS)
1235 return parse_zoned_distribution(td, str, true);
1239 nr = get_opt_postfix(str);
1240 if (nr && !split_parse_distr(nr, &val, ¢er)) {
1241 log_err("fio: random postfix parsing failed\n");
1248 if (center != -1 && (center < 0.00 || center > 1.00)) {
1249 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
1252 td->o.random_center.u.f = center;
1254 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1256 log_err("fio: zipf theta must different than 1.0\n");
1261 td->o.zipf_theta.u.f = val;
1262 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1263 if (val <= 0.00 || val >= 1.00) {
1264 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1269 td->o.pareto_h.u.f = val;
1271 if (val < 0.00 || val >= 100.0) {
1272 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1277 td->o.gauss_dev.u.f = val;
1283 static int str_steadystate_cb(void *data, const char *str)
1285 struct thread_data *td = cb_data_to_td(data);
1291 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1292 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
1293 /* should be impossible to get here */
1294 log_err("fio: unknown steady state criterion\n");
1298 nr = get_opt_postfix(str);
1300 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1305 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1306 pct = strstr(nr, "%");
1309 strip_blank_end(nr);
1310 if (!str_to_float(nr, &val, 0)) {
1311 log_err("fio: could not parse steadystate threshold percentage\n");
1316 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1321 td->o.ss_state |= FIO_SS_PCT;
1322 td->o.ss_limit.u.f = val;
1323 } else if (td->o.ss_state & FIO_SS_IOPS) {
1324 if (!str_to_float(nr, &val, 0)) {
1325 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1330 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1335 td->o.ss_limit.u.f = val;
1336 } else { /* bandwidth criterion */
1337 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1338 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1343 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1348 td->o.ss_limit.u.f = (double) ll;
1351 td->ss.state = td->o.ss_state;
1356 * Return next name in the string. Files are separated with ':'. If the ':'
1357 * is escaped with a '\', then that ':' is part of the filename and does not
1358 * indicate a new file.
1360 char *get_next_str(char **ptr)
1365 if (!str || !strlen(str))
1371 * No colon, we are done
1373 p = strchr(str, ':');
1380 * We got a colon, but it's the first character. Skip and
1388 if (*(p - 1) != '\\') {
1394 memmove(p - 1, p, strlen(p) + 1);
1402 int get_max_str_idx(char *input)
1404 unsigned int cur_idx;
1407 p = str = strdup(input);
1408 for (cur_idx = 0; ; cur_idx++)
1409 if (get_next_str(&str) == NULL)
1417 * Returns the directory at the index, indexes > entries will be
1418 * assigned via modulo division of the index
1420 int set_name_idx(char *target, size_t tlen, char *input, int index,
1421 bool unique_filename)
1423 unsigned int cur_idx;
1425 char *fname, *str, *p;
1427 p = str = strdup(input);
1429 index %= get_max_str_idx(input);
1430 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1431 fname = get_next_str(&str);
1433 if (client_sockaddr_str[0] && unique_filename) {
1434 len = snprintf(target, tlen, "%s/%s.", fname,
1435 client_sockaddr_str);
1437 len = snprintf(target, tlen, "%s%c", fname,
1438 FIO_OS_PATH_SEPARATOR);
1440 target[tlen - 1] = '\0';
1446 char* get_name_by_idx(char *input, int index)
1448 unsigned int cur_idx;
1449 char *fname, *str, *p;
1451 p = str = strdup(input);
1453 index %= get_max_str_idx(input);
1454 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1455 fname = get_next_str(&str);
1457 fname = strdup(fname);
1463 static int str_filename_cb(void *data, const char *input)
1465 struct thread_data *td = cb_data_to_td(data);
1466 char *fname, *str, *p;
1468 p = str = strdup(input);
1470 strip_blank_front(&str);
1471 strip_blank_end(str);
1474 * Ignore what we may already have from nrfiles option.
1476 if (!td->files_index)
1479 while ((fname = get_next_str(&str)) != NULL) {
1482 add_file(td, fname, 0, 1);
1489 static int str_directory_cb(void *data, const char fio_unused *unused)
1491 struct thread_data *td = cb_data_to_td(data);
1493 char *dirname, *str, *p;
1499 p = str = strdup(td->o.directory);
1500 while ((dirname = get_next_str(&str)) != NULL) {
1501 if (lstat(dirname, &sb) < 0) {
1504 log_err("fio: %s is not a directory\n", dirname);
1505 td_verror(td, ret, "lstat");
1508 if (!S_ISDIR(sb.st_mode)) {
1509 log_err("fio: %s is not a directory\n", dirname);
1520 static int str_opendir_cb(void *data, const char fio_unused *str)
1522 struct thread_data *td = cb_data_to_td(data);
1527 if (!td->files_index)
1530 return add_dir_files(td, td->o.opendir);
1533 static int str_buffer_pattern_cb(void *data, const char *input)
1535 struct thread_data *td = cb_data_to_td(data);
1538 /* FIXME: for now buffer pattern does not support formats */
1539 ret = parse_and_fill_pattern_alloc(input, strlen(input),
1540 &td->o.buffer_pattern, NULL, NULL, NULL);
1545 td->o.buffer_pattern_bytes = ret;
1548 * If this job is doing any reading or has compression set,
1549 * ensure that we refill buffers for writes or we could be
1550 * invalidating the pattern through reads.
1552 if (!td->o.compress_percentage && !td_read(td))
1553 td->o.refill_buffers = 0;
1555 td->o.refill_buffers = 1;
1557 td->o.scramble_buffers = 0;
1558 td->o.zero_buffers = 0;
1563 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1565 struct thread_data *td = cb_data_to_td(data);
1567 td->flags |= TD_F_COMPRESS;
1568 td->o.compress_percentage = *il;
1572 static int str_dedupe_cb(void *data, unsigned long long *il)
1574 struct thread_data *td = cb_data_to_td(data);
1576 td->flags |= TD_F_COMPRESS;
1577 td->o.dedupe_percentage = *il;
1578 td->o.refill_buffers = 1;
1582 static int str_verify_pattern_cb(void *data, const char *input)
1584 struct thread_data *td = cb_data_to_td(data);
1587 td->o.verify_fmt_sz = FIO_ARRAY_SIZE(td->o.verify_fmt);
1588 ret = parse_and_fill_pattern_alloc(input, strlen(input),
1589 &td->o.verify_pattern, fmt_desc, td->o.verify_fmt,
1590 &td->o.verify_fmt_sz);
1595 td->o.verify_pattern_bytes = ret;
1597 * VERIFY_* could already be set
1599 if (!fio_option_is_set(&td->o, verify))
1600 td->o.verify = VERIFY_PATTERN;
1605 static int str_gtod_reduce_cb(void *data, int *il)
1607 struct thread_data *td = cb_data_to_td(data);
1611 * Only modify options if gtod_reduce==1
1612 * Otherwise leave settings alone.
1615 td->o.disable_lat = 1;
1616 td->o.disable_clat = 1;
1617 td->o.disable_slat = 1;
1618 td->o.disable_bw = 1;
1619 td->o.clat_percentiles = 0;
1620 td->o.lat_percentiles = 0;
1621 td->o.slat_percentiles = 0;
1622 td->ts_cache_mask = 63;
1628 static int str_offset_cb(void *data, unsigned long long *__val)
1630 struct thread_data *td = cb_data_to_td(data);
1631 unsigned long long v = *__val;
1633 if (parse_is_percent(v)) {
1634 td->o.start_offset = 0;
1635 td->o.start_offset_percent = -1ULL - v;
1636 td->o.start_offset_nz = 0;
1637 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1638 td->o.start_offset_percent);
1639 } else if (parse_is_zone(v)) {
1640 td->o.start_offset = 0;
1641 td->o.start_offset_percent = 0;
1642 td->o.start_offset_nz = v - ZONE_BASE_VAL;
1644 td->o.start_offset = v;
1649 static int str_offset_increment_cb(void *data, unsigned long long *__val)
1651 struct thread_data *td = cb_data_to_td(data);
1652 unsigned long long v = *__val;
1654 if (parse_is_percent(v)) {
1655 td->o.offset_increment = 0;
1656 td->o.offset_increment_percent = -1ULL - v;
1657 td->o.offset_increment_nz = 0;
1658 dprint(FD_PARSE, "SET offset_increment_percent %d\n",
1659 td->o.offset_increment_percent);
1660 } else if (parse_is_zone(v)) {
1661 td->o.offset_increment = 0;
1662 td->o.offset_increment_percent = 0;
1663 td->o.offset_increment_nz = v - ZONE_BASE_VAL;
1665 td->o.offset_increment = v;
1670 static int str_size_cb(void *data, unsigned long long *__val)
1672 struct thread_data *td = cb_data_to_td(data);
1673 unsigned long long v = *__val;
1675 if (parse_is_percent(v)) {
1677 td->o.size_percent = -1ULL - v;
1678 dprint(FD_PARSE, "SET size_percent %d\n",
1679 td->o.size_percent);
1680 } else if (parse_is_zone(v)) {
1682 td->o.size_percent = 0;
1683 td->o.size_nz = v - ZONE_BASE_VAL;
1690 static int str_io_size_cb(void *data, unsigned long long *__val)
1692 struct thread_data *td = cb_data_to_td(data);
1693 unsigned long long v = *__val;
1695 if (parse_is_percent_uncapped(v)) {
1697 td->o.io_size_percent = -1ULL - v;
1698 if (td->o.io_size_percent > 100) {
1699 log_err("fio: io_size values greater than 100%% aren't supported\n");
1702 dprint(FD_PARSE, "SET io_size_percent %d\n",
1703 td->o.io_size_percent);
1704 } else if (parse_is_zone(v)) {
1706 td->o.io_size_percent = 0;
1707 td->o.io_size_nz = v - ZONE_BASE_VAL;
1714 static int str_zoneskip_cb(void *data, unsigned long long *__val)
1716 struct thread_data *td = cb_data_to_td(data);
1717 unsigned long long v = *__val;
1719 if (parse_is_zone(v)) {
1720 td->o.zone_skip = 0;
1721 td->o.zone_skip_nz = v - ZONE_BASE_VAL;
1723 td->o.zone_skip = v;
1728 static int str_write_bw_log_cb(void *data, const char *str)
1730 struct thread_data *td = cb_data_to_td(data);
1733 td->o.bw_log_file = strdup(str);
1735 td->o.write_bw_log = 1;
1739 static int str_write_lat_log_cb(void *data, const char *str)
1741 struct thread_data *td = cb_data_to_td(data);
1744 td->o.lat_log_file = strdup(str);
1746 td->o.write_lat_log = 1;
1750 static int str_write_iops_log_cb(void *data, const char *str)
1752 struct thread_data *td = cb_data_to_td(data);
1755 td->o.iops_log_file = strdup(str);
1757 td->o.write_iops_log = 1;
1761 static int str_write_hist_log_cb(void *data, const char *str)
1763 struct thread_data *td = cb_data_to_td(data);
1766 td->o.hist_log_file = strdup(str);
1768 td->o.write_hist_log = 1;
1773 * str is supposed to be a substring of the strdup'd original string,
1774 * and is valid only if it's a regular file path.
1775 * This function keeps the pointer to the path as needed later.
1777 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1778 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1779 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1781 static int str_ioengine_external_cb(void *data, const char *str)
1783 struct thread_data *td = cb_data_to_td(data);
1788 log_err("fio: null external ioengine path\n");
1792 p = (char *)str; /* str is mutable */
1793 strip_blank_front(&p);
1796 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1797 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1801 td->o.ioengine_so_path = p;
1805 static int rw_verify(const struct fio_option *o, void *data)
1807 struct thread_data *td = cb_data_to_td(data);
1809 if (read_only && (td_write(td) || td_trim(td))) {
1810 log_err("fio: job <%s> has write or trim bit set, but"
1811 " fio is in read-only mode\n", td->o.name);
1818 static int gtod_cpu_verify(const struct fio_option *o, void *data)
1820 #ifndef FIO_HAVE_CPU_AFFINITY
1821 struct thread_data *td = cb_data_to_td(data);
1823 if (td->o.gtod_cpu) {
1824 log_err("fio: platform must support CPU affinity for"
1825 "gettimeofday() offloading\n");
1834 * Map of job/command line options
1836 struct fio_option fio_options[FIO_MAX_OPTS] = {
1838 .name = "description",
1839 .lname = "Description of job",
1840 .type = FIO_OPT_STR_STORE,
1841 .off1 = offsetof(struct thread_options, description),
1842 .help = "Text job description",
1843 .category = FIO_OPT_C_GENERAL,
1844 .group = FIO_OPT_G_DESC,
1848 .lname = "Job name",
1849 .type = FIO_OPT_STR_STORE,
1850 .off1 = offsetof(struct thread_options, name),
1851 .help = "Name of this job",
1852 .category = FIO_OPT_C_GENERAL,
1853 .group = FIO_OPT_G_DESC,
1857 .lname = "Waitee name",
1858 .type = FIO_OPT_STR_STORE,
1859 .off1 = offsetof(struct thread_options, wait_for),
1860 .help = "Name of the job this one wants to wait for before starting",
1861 .category = FIO_OPT_C_GENERAL,
1862 .group = FIO_OPT_G_DESC,
1866 .lname = "Filename(s)",
1867 .type = FIO_OPT_STR_STORE,
1868 .off1 = offsetof(struct thread_options, filename),
1870 .cb = str_filename_cb,
1871 .prio = -1, /* must come after "directory" */
1872 .help = "File(s) to use for the workload",
1873 .category = FIO_OPT_C_FILE,
1874 .group = FIO_OPT_G_FILENAME,
1877 .name = "directory",
1878 .lname = "Directory",
1879 .type = FIO_OPT_STR_STORE,
1880 .off1 = offsetof(struct thread_options, directory),
1881 .cb = str_directory_cb,
1882 .help = "Directory to store files in",
1883 .category = FIO_OPT_C_FILE,
1884 .group = FIO_OPT_G_FILENAME,
1887 .name = "filename_format",
1888 .lname = "Filename Format",
1889 .type = FIO_OPT_STR_STORE,
1890 .off1 = offsetof(struct thread_options, filename_format),
1891 .prio = -1, /* must come after "directory" */
1892 .help = "Override default $jobname.$jobnum.$filenum naming",
1893 .def = "$jobname.$jobnum.$filenum",
1894 .category = FIO_OPT_C_FILE,
1895 .group = FIO_OPT_G_FILENAME,
1898 .name = "unique_filename",
1899 .lname = "Unique Filename",
1900 .type = FIO_OPT_BOOL,
1901 .off1 = offsetof(struct thread_options, unique_filename),
1902 .help = "For network clients, prefix file with source IP",
1904 .category = FIO_OPT_C_FILE,
1905 .group = FIO_OPT_G_FILENAME,
1909 .lname = "Lockfile",
1910 .type = FIO_OPT_STR,
1911 .off1 = offsetof(struct thread_options, file_lock_mode),
1912 .help = "Lock file when doing IO to it",
1914 .parent = "filename",
1917 .category = FIO_OPT_C_FILE,
1918 .group = FIO_OPT_G_FILENAME,
1921 .oval = FILE_LOCK_NONE,
1922 .help = "No file locking",
1924 { .ival = "exclusive",
1925 .oval = FILE_LOCK_EXCLUSIVE,
1926 .help = "Exclusive file lock",
1929 .ival = "readwrite",
1930 .oval = FILE_LOCK_READWRITE,
1931 .help = "Read vs write lock",
1937 .lname = "Open directory",
1938 .type = FIO_OPT_STR_STORE,
1939 .off1 = offsetof(struct thread_options, opendir),
1940 .cb = str_opendir_cb,
1941 .help = "Recursively add files from this directory and down",
1942 .category = FIO_OPT_C_FILE,
1943 .group = FIO_OPT_G_FILENAME,
1947 .lname = "Read/write",
1948 .alias = "readwrite",
1949 .type = FIO_OPT_STR,
1951 .off1 = offsetof(struct thread_options, td_ddir),
1952 .help = "IO direction",
1954 .verify = rw_verify,
1955 .category = FIO_OPT_C_IO,
1956 .group = FIO_OPT_G_IO_BASIC,
1959 .oval = TD_DDIR_READ,
1960 .help = "Sequential read",
1963 .oval = TD_DDIR_WRITE,
1964 .help = "Sequential write",
1967 .oval = TD_DDIR_TRIM,
1968 .help = "Sequential trim",
1970 { .ival = "randread",
1971 .oval = TD_DDIR_RANDREAD,
1972 .help = "Random read",
1974 { .ival = "randwrite",
1975 .oval = TD_DDIR_RANDWRITE,
1976 .help = "Random write",
1978 { .ival = "randtrim",
1979 .oval = TD_DDIR_RANDTRIM,
1980 .help = "Random trim",
1984 .help = "Sequential read and write mix",
1986 { .ival = "readwrite",
1988 .help = "Sequential read and write mix",
1991 .oval = TD_DDIR_RANDRW,
1992 .help = "Random read and write mix"
1994 { .ival = "trimwrite",
1995 .oval = TD_DDIR_TRIMWRITE,
1996 .help = "Trim and write mix, trims preceding writes"
1998 { .ival = "randtrimwrite",
1999 .oval = TD_DDIR_RANDTRIMWRITE,
2000 .help = "Randomly trim and write mix, trims preceding writes"
2005 .name = "rw_sequencer",
2006 .lname = "RW Sequencer",
2007 .type = FIO_OPT_STR,
2008 .off1 = offsetof(struct thread_options, rw_seq),
2009 .help = "IO offset generator modifier",
2010 .def = "sequential",
2011 .category = FIO_OPT_C_IO,
2012 .group = FIO_OPT_G_IO_BASIC,
2014 { .ival = "sequential",
2016 .help = "Generate sequential offsets",
2018 { .ival = "identical",
2019 .oval = RW_SEQ_IDENT,
2020 .help = "Generate identical offsets",
2027 .lname = "IO Engine",
2028 .type = FIO_OPT_STR_STORE,
2029 .off1 = offsetof(struct thread_options, ioengine),
2030 .help = "IO engine to use",
2031 .def = FIO_PREFERRED_ENGINE,
2032 .category = FIO_OPT_C_IO,
2033 .group = FIO_OPT_G_IO_BASIC,
2036 .help = "Use read/write",
2039 .help = "Use pread/pwrite",
2042 .help = "Use readv/writev",
2044 #ifdef CONFIG_PWRITEV
2046 .help = "Use preadv/pwritev",
2049 #ifdef FIO_HAVE_PWRITEV2
2050 { .ival = "pvsync2",
2051 .help = "Use preadv2/pwritev2",
2054 #ifdef CONFIG_LIBAIO
2056 .help = "Linux native asynchronous IO",
2059 #ifdef ARCH_HAVE_IOURING
2060 { .ival = "io_uring",
2061 .help = "Fast Linux native aio",
2064 #ifdef CONFIG_POSIXAIO
2065 { .ival = "posixaio",
2066 .help = "POSIX asynchronous IO",
2069 #ifdef CONFIG_SOLARISAIO
2070 { .ival = "solarisaio",
2071 .help = "Solaris native asynchronous IO",
2074 #ifdef CONFIG_WINDOWSAIO
2075 { .ival = "windowsaio",
2076 .help = "Windows native asynchronous IO"
2081 .help = "Rados Block Device asynchronous IO"
2085 .help = "Memory mapped IO"
2087 #ifdef CONFIG_LINUX_SPLICE
2089 .help = "splice/vmsplice based IO",
2091 { .ival = "netsplice",
2092 .help = "splice/vmsplice to/from the network",
2095 #ifdef FIO_HAVE_SGIO
2097 .help = "SCSI generic v3 IO",
2101 .help = "Testing engine (no data transfer)",
2104 .help = "Network IO",
2107 .help = "CPU cycle burner engine",
2111 .help = "RDMA IO engine",
2114 #ifdef CONFIG_LIBRPMA_APM
2115 { .ival = "librpma_apm",
2116 .help = "librpma IO engine in APM mode",
2119 #ifdef CONFIG_LIBRPMA_GPSPM
2120 { .ival = "librpma_gpspm",
2121 .help = "librpma IO engine in GPSPM mode",
2124 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
2125 { .ival = "e4defrag",
2126 .help = "ext4 defrag engine",
2129 #ifdef CONFIG_LINUX_FALLOCATE
2131 .help = "fallocate() file based engine",
2136 .help = "Glusterfs libgfapi(sync) based engine"
2138 { .ival = "gfapi_async",
2139 .help = "Glusterfs libgfapi(async) based engine"
2142 #ifdef CONFIG_LIBHDFS
2143 { .ival = "libhdfs",
2144 .help = "Hadoop Distributed Filesystem (HDFS) engine"
2148 { .ival = "ime_psync",
2149 .help = "DDN's IME synchronous IO engine",
2151 { .ival = "ime_psyncv",
2152 .help = "DDN's IME synchronous IO engine using iovecs",
2154 { .ival = "ime_aio",
2155 .help = "DDN's IME asynchronous IO engine",
2158 #ifdef CONFIG_LINUX_DEVDAX
2159 { .ival = "dev-dax",
2160 .help = "DAX Device based IO engine",
2164 .ival = "filecreate",
2165 .help = "File creation engine",
2167 { .ival = "external",
2168 .help = "Load external engine (append name)",
2169 .cb = str_ioengine_external_cb,
2171 #ifdef CONFIG_LIBPMEM
2172 { .ival = "libpmem",
2173 .help = "PMDK libpmem based IO engine",
2178 .help = "HTTP (WebDAV/S3) IO engine",
2182 .help = "Network Block Device (NBD) IO engine"
2186 .help = "DAOS File System (dfs) IO engine",
2189 #ifdef CONFIG_LIBNFS
2191 .help = "NFS IO engine",
2194 #ifdef CONFIG_LIBXNVME
2196 .help = "XNVME IO engine",
2203 .lname = "IO Depth",
2204 .type = FIO_OPT_INT,
2205 .off1 = offsetof(struct thread_options, iodepth),
2206 .help = "Number of IO buffers to keep in flight",
2210 .category = FIO_OPT_C_IO,
2211 .group = FIO_OPT_G_IO_BASIC,
2214 .name = "iodepth_batch",
2215 .lname = "IO Depth batch",
2216 .alias = "iodepth_batch_submit",
2217 .type = FIO_OPT_INT,
2218 .off1 = offsetof(struct thread_options, iodepth_batch),
2219 .help = "Number of IO buffers to submit in one go",
2220 .parent = "iodepth",
2224 .category = FIO_OPT_C_IO,
2225 .group = FIO_OPT_G_IO_BASIC,
2228 .name = "iodepth_batch_complete_min",
2229 .lname = "Min IO depth batch complete",
2230 .alias = "iodepth_batch_complete",
2231 .type = FIO_OPT_INT,
2232 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
2233 .help = "Min number of IO buffers to retrieve in one go",
2234 .parent = "iodepth",
2239 .category = FIO_OPT_C_IO,
2240 .group = FIO_OPT_G_IO_BASIC,
2243 .name = "iodepth_batch_complete_max",
2244 .lname = "Max IO depth batch complete",
2245 .type = FIO_OPT_INT,
2246 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
2247 .help = "Max number of IO buffers to retrieve in one go",
2248 .parent = "iodepth",
2252 .category = FIO_OPT_C_IO,
2253 .group = FIO_OPT_G_IO_BASIC,
2256 .name = "iodepth_low",
2257 .lname = "IO Depth batch low",
2258 .type = FIO_OPT_INT,
2259 .off1 = offsetof(struct thread_options, iodepth_low),
2260 .help = "Low water mark for queuing depth",
2261 .parent = "iodepth",
2264 .category = FIO_OPT_C_IO,
2265 .group = FIO_OPT_G_IO_BASIC,
2268 .name = "serialize_overlap",
2269 .lname = "Serialize overlap",
2270 .off1 = offsetof(struct thread_options, serialize_overlap),
2271 .type = FIO_OPT_BOOL,
2272 .help = "Wait for in-flight IOs that collide to complete",
2273 .parent = "iodepth",
2275 .category = FIO_OPT_C_IO,
2276 .group = FIO_OPT_G_IO_BASIC,
2279 .name = "io_submit_mode",
2280 .lname = "IO submit mode",
2281 .type = FIO_OPT_STR,
2282 .off1 = offsetof(struct thread_options, io_submit_mode),
2283 .help = "How IO submissions and completions are done",
2285 .category = FIO_OPT_C_IO,
2286 .group = FIO_OPT_G_IO_BASIC,
2289 .oval = IO_MODE_INLINE,
2290 .help = "Submit and complete IO inline",
2292 { .ival = "offload",
2293 .oval = IO_MODE_OFFLOAD,
2294 .help = "Offload submit and complete to threads",
2301 .type = FIO_OPT_STR_VAL_ZONE,
2303 .off1 = offsetof(struct thread_options, size),
2304 .help = "Total size of device or files",
2305 .category = FIO_OPT_C_IO,
2306 .group = FIO_OPT_G_INVALID,
2310 .alias = "io_limit",
2312 .type = FIO_OPT_STR_VAL_ZONE,
2313 .cb = str_io_size_cb,
2314 .off1 = offsetof(struct thread_options, io_size),
2315 .help = "Total size of I/O to be performed",
2316 .category = FIO_OPT_C_IO,
2317 .group = FIO_OPT_G_INVALID,
2320 .name = "fill_device",
2321 .lname = "Fill device",
2323 .type = FIO_OPT_BOOL,
2324 .off1 = offsetof(struct thread_options, fill_device),
2325 .help = "Write until an ENOSPC error occurs",
2327 .category = FIO_OPT_C_FILE,
2328 .group = FIO_OPT_G_INVALID,
2332 .lname = "File size",
2333 .type = FIO_OPT_STR_VAL,
2334 .off1 = offsetof(struct thread_options, file_size_low),
2335 .off2 = offsetof(struct thread_options, file_size_high),
2337 .help = "Size of individual files",
2338 .interval = 1024 * 1024,
2339 .category = FIO_OPT_C_FILE,
2340 .group = FIO_OPT_G_INVALID,
2343 .name = "file_append",
2344 .lname = "File append",
2345 .type = FIO_OPT_BOOL,
2346 .off1 = offsetof(struct thread_options, file_append),
2347 .help = "IO will start at the end of the file(s)",
2349 .category = FIO_OPT_C_FILE,
2350 .group = FIO_OPT_G_INVALID,
2354 .lname = "IO offset",
2355 .alias = "fileoffset",
2356 .type = FIO_OPT_STR_VAL_ZONE,
2357 .cb = str_offset_cb,
2358 .off1 = offsetof(struct thread_options, start_offset),
2359 .help = "Start IO from this offset",
2361 .category = FIO_OPT_C_IO,
2362 .group = FIO_OPT_G_INVALID,
2365 .name = "offset_align",
2366 .lname = "IO offset alignment",
2367 .type = FIO_OPT_INT,
2368 .off1 = offsetof(struct thread_options, start_offset_align),
2369 .help = "Start IO from this offset alignment",
2372 .category = FIO_OPT_C_IO,
2373 .group = FIO_OPT_G_INVALID,
2376 .name = "offset_increment",
2377 .lname = "IO offset increment",
2378 .type = FIO_OPT_STR_VAL_ZONE,
2379 .cb = str_offset_increment_cb,
2380 .off1 = offsetof(struct thread_options, offset_increment),
2381 .help = "What is the increment from one offset to the next",
2385 .category = FIO_OPT_C_IO,
2386 .group = FIO_OPT_G_INVALID,
2389 .name = "number_ios",
2390 .lname = "Number of IOs to perform",
2391 .type = FIO_OPT_STR_VAL,
2392 .off1 = offsetof(struct thread_options, number_ios),
2393 .help = "Force job completion after this number of IOs",
2395 .category = FIO_OPT_C_IO,
2396 .group = FIO_OPT_G_INVALID,
2400 .lname = "Block size",
2401 .alias = "blocksize",
2402 .type = FIO_OPT_ULL,
2403 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2404 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2405 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2407 .help = "Block size unit",
2412 .category = FIO_OPT_C_IO,
2413 .group = FIO_OPT_G_INVALID,
2417 .lname = "Block size align",
2418 .alias = "blockalign",
2419 .type = FIO_OPT_ULL,
2420 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2421 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2422 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2424 .help = "IO block offset alignment",
2428 .category = FIO_OPT_C_IO,
2429 .group = FIO_OPT_G_INVALID,
2433 .lname = "Block size range",
2434 .alias = "blocksize_range",
2435 .type = FIO_OPT_RANGE,
2436 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2437 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2438 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2439 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2440 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2441 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2443 .help = "Set block size range (in more detail than bs)",
2447 .category = FIO_OPT_C_IO,
2448 .group = FIO_OPT_G_INVALID,
2452 .lname = "Block size split",
2453 .type = FIO_OPT_STR_ULL,
2454 .cb = str_bssplit_cb,
2455 .off1 = offsetof(struct thread_options, bssplit),
2456 .help = "Set a specific mix of block sizes",
2459 .category = FIO_OPT_C_IO,
2460 .group = FIO_OPT_G_INVALID,
2463 .name = "bs_unaligned",
2464 .lname = "Block size unaligned",
2465 .alias = "blocksize_unaligned",
2466 .type = FIO_OPT_STR_SET,
2467 .off1 = offsetof(struct thread_options, bs_unaligned),
2468 .help = "Don't sector align IO buffer sizes",
2471 .category = FIO_OPT_C_IO,
2472 .group = FIO_OPT_G_INVALID,
2475 .name = "bs_is_seq_rand",
2476 .lname = "Block size division is seq/random (not read/write)",
2477 .type = FIO_OPT_BOOL,
2478 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2479 .help = "Consider any blocksize setting to be sequential,random",
2481 .parent = "blocksize",
2482 .category = FIO_OPT_C_IO,
2483 .group = FIO_OPT_G_INVALID,
2486 .name = "randrepeat",
2487 .alias = "allrandrepeat",
2488 .lname = "Random repeatable",
2489 .type = FIO_OPT_BOOL,
2490 .off1 = offsetof(struct thread_options, rand_repeatable),
2491 .help = "Use repeatable random IO pattern",
2495 .category = FIO_OPT_C_IO,
2496 .group = FIO_OPT_G_RANDOM,
2500 .lname = "The random generator seed",
2501 .type = FIO_OPT_STR_VAL,
2502 .off1 = offsetof(struct thread_options, rand_seed),
2503 .help = "Set the random generator seed value",
2506 .category = FIO_OPT_C_IO,
2507 .group = FIO_OPT_G_RANDOM,
2510 .name = "norandommap",
2511 .lname = "No randommap",
2512 .type = FIO_OPT_STR_SET,
2513 .off1 = offsetof(struct thread_options, norandommap),
2514 .help = "Accept potential duplicate random blocks",
2518 .category = FIO_OPT_C_IO,
2519 .group = FIO_OPT_G_RANDOM,
2522 .name = "softrandommap",
2523 .lname = "Soft randommap",
2524 .type = FIO_OPT_BOOL,
2525 .off1 = offsetof(struct thread_options, softrandommap),
2526 .help = "Set norandommap if randommap allocation fails",
2527 .parent = "norandommap",
2530 .category = FIO_OPT_C_IO,
2531 .group = FIO_OPT_G_RANDOM,
2534 .name = "random_generator",
2535 .lname = "Random Generator",
2536 .type = FIO_OPT_STR,
2537 .off1 = offsetof(struct thread_options, random_generator),
2538 .help = "Type of random number generator to use",
2539 .def = "tausworthe",
2541 { .ival = "tausworthe",
2542 .oval = FIO_RAND_GEN_TAUSWORTHE,
2543 .help = "Strong Tausworthe generator",
2546 .oval = FIO_RAND_GEN_LFSR,
2547 .help = "Variable length LFSR",
2550 .ival = "tausworthe64",
2551 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2552 .help = "64-bit Tausworthe variant",
2555 .category = FIO_OPT_C_IO,
2556 .group = FIO_OPT_G_RANDOM,
2559 .name = "random_distribution",
2560 .lname = "Random Distribution",
2561 .type = FIO_OPT_STR,
2562 .off1 = offsetof(struct thread_options, random_distribution),
2563 .cb = str_random_distribution_cb,
2564 .help = "Random offset distribution generator",
2568 .oval = FIO_RAND_DIST_RANDOM,
2569 .help = "Completely random",
2572 .oval = FIO_RAND_DIST_ZIPF,
2573 .help = "Zipf distribution",
2576 .oval = FIO_RAND_DIST_PARETO,
2577 .help = "Pareto distribution",
2580 .oval = FIO_RAND_DIST_GAUSS,
2581 .help = "Normal (Gaussian) distribution",
2584 .oval = FIO_RAND_DIST_ZONED,
2585 .help = "Zoned random distribution",
2587 { .ival = "zoned_abs",
2588 .oval = FIO_RAND_DIST_ZONED_ABS,
2589 .help = "Zoned absolute random distribution",
2592 .category = FIO_OPT_C_IO,
2593 .group = FIO_OPT_G_RANDOM,
2596 .name = "percentage_random",
2597 .lname = "Percentage Random",
2598 .type = FIO_OPT_INT,
2599 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2600 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2601 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2603 .help = "Percentage of seq/random mix that should be random",
2604 .def = "100,100,100",
2606 .inverse = "percentage_sequential",
2607 .category = FIO_OPT_C_IO,
2608 .group = FIO_OPT_G_RANDOM,
2611 .name = "percentage_sequential",
2612 .lname = "Percentage Sequential",
2613 .type = FIO_OPT_DEPRECATED,
2614 .category = FIO_OPT_C_IO,
2615 .group = FIO_OPT_G_RANDOM,
2619 .lname = "Number of files",
2620 .alias = "nr_files",
2621 .type = FIO_OPT_INT,
2622 .off1 = offsetof(struct thread_options, nr_files),
2623 .help = "Split job workload between this number of files",
2626 .category = FIO_OPT_C_FILE,
2627 .group = FIO_OPT_G_INVALID,
2630 .name = "openfiles",
2631 .lname = "Number of open files",
2632 .type = FIO_OPT_INT,
2633 .off1 = offsetof(struct thread_options, open_files),
2634 .help = "Number of files to keep open at the same time",
2635 .category = FIO_OPT_C_FILE,
2636 .group = FIO_OPT_G_INVALID,
2639 .name = "file_service_type",
2640 .lname = "File service type",
2641 .type = FIO_OPT_STR,
2643 .off1 = offsetof(struct thread_options, file_service_type),
2644 .help = "How to select which file to service next",
2645 .def = "roundrobin",
2646 .category = FIO_OPT_C_FILE,
2647 .group = FIO_OPT_G_INVALID,
2650 .oval = FIO_FSERVICE_RANDOM,
2651 .help = "Choose a file at random (uniform)",
2654 .oval = FIO_FSERVICE_ZIPF,
2655 .help = "Zipf randomized",
2658 .oval = FIO_FSERVICE_PARETO,
2659 .help = "Pareto randomized",
2662 .oval = FIO_FSERVICE_GAUSS,
2663 .help = "Normal (Gaussian) randomized",
2666 .oval = FIO_FSERVICE_GAUSS,
2667 .help = "Alias for normal",
2669 { .ival = "roundrobin",
2670 .oval = FIO_FSERVICE_RR,
2671 .help = "Round robin select files",
2673 { .ival = "sequential",
2674 .oval = FIO_FSERVICE_SEQ,
2675 .help = "Finish one file before moving to the next",
2678 .parent = "nrfiles",
2682 .name = "fallocate",
2683 .lname = "Fallocate",
2684 .type = FIO_OPT_STR,
2685 .off1 = offsetof(struct thread_options, fallocate_mode),
2686 .help = "Whether pre-allocation is performed when laying out files",
2687 #ifdef FIO_HAVE_DEFAULT_FALLOCATE
2692 .category = FIO_OPT_C_FILE,
2693 .group = FIO_OPT_G_INVALID,
2696 .oval = FIO_FALLOCATE_NONE,
2697 .help = "Do not pre-allocate space",
2700 .oval = FIO_FALLOCATE_NATIVE,
2701 .help = "Use native pre-allocation if possible",
2703 #ifdef CONFIG_POSIX_FALLOCATE
2705 .oval = FIO_FALLOCATE_POSIX,
2706 .help = "Use posix_fallocate()",
2709 #ifdef CONFIG_LINUX_FALLOCATE
2711 .oval = FIO_FALLOCATE_KEEP_SIZE,
2712 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2715 { .ival = "truncate",
2716 .oval = FIO_FALLOCATE_TRUNCATE,
2717 .help = "Truncate file to final size instead of allocating"
2719 /* Compatibility with former boolean values */
2721 .oval = FIO_FALLOCATE_NONE,
2722 .help = "Alias for 'none'",
2724 #ifdef CONFIG_POSIX_FALLOCATE
2726 .oval = FIO_FALLOCATE_POSIX,
2727 .help = "Alias for 'posix'",
2733 .name = "fadvise_hint",
2734 .lname = "Fadvise hint",
2735 .type = FIO_OPT_STR,
2736 .off1 = offsetof(struct thread_options, fadvise_hint),
2740 .help = "Don't issue fadvise/madvise",
2744 .help = "Advise using fio IO pattern",
2747 .oval = F_ADV_RANDOM,
2748 .help = "Advise using FADV_RANDOM",
2750 { .ival = "sequential",
2751 .oval = F_ADV_SEQUENTIAL,
2752 .help = "Advise using FADV_SEQUENTIAL",
2754 #ifdef POSIX_FADV_NOREUSE
2755 { .ival = "noreuse",
2756 .oval = F_ADV_NOREUSE,
2757 .help = "Advise using FADV_NOREUSE",
2761 .help = "Use fadvise() to advise the kernel on IO pattern",
2763 .category = FIO_OPT_C_FILE,
2764 .group = FIO_OPT_G_INVALID,
2769 .type = FIO_OPT_INT,
2770 .off1 = offsetof(struct thread_options, fsync_blocks),
2771 .help = "Issue fsync for writes every given number of blocks",
2774 .category = FIO_OPT_C_FILE,
2775 .group = FIO_OPT_G_INVALID,
2778 .name = "fdatasync",
2779 .lname = "Fdatasync",
2780 .type = FIO_OPT_INT,
2781 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2782 .help = "Issue fdatasync for writes every given number of blocks",
2785 .category = FIO_OPT_C_FILE,
2786 .group = FIO_OPT_G_INVALID,
2789 .name = "write_barrier",
2790 .lname = "Write barrier",
2791 .type = FIO_OPT_INT,
2792 .off1 = offsetof(struct thread_options, barrier_blocks),
2793 .help = "Make every Nth write a barrier write",
2796 .category = FIO_OPT_C_IO,
2797 .group = FIO_OPT_G_INVALID,
2799 #ifdef CONFIG_SYNC_FILE_RANGE
2801 .name = "sync_file_range",
2802 .lname = "Sync file range",
2804 { .ival = "wait_before",
2805 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2806 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2810 .oval = SYNC_FILE_RANGE_WRITE,
2811 .help = "SYNC_FILE_RANGE_WRITE",
2815 .ival = "wait_after",
2816 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2817 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2821 .type = FIO_OPT_STR_MULTI,
2823 .off1 = offsetof(struct thread_options, sync_file_range),
2824 .help = "Use sync_file_range()",
2825 .category = FIO_OPT_C_FILE,
2826 .group = FIO_OPT_G_INVALID,
2830 .name = "sync_file_range",
2831 .lname = "Sync file range",
2832 .type = FIO_OPT_UNSUPPORTED,
2833 .help = "Your platform does not support sync_file_range",
2838 .lname = "Direct I/O",
2839 .type = FIO_OPT_BOOL,
2840 .off1 = offsetof(struct thread_options, odirect),
2841 .help = "Use O_DIRECT IO (negates buffered)",
2843 .inverse = "buffered",
2844 .category = FIO_OPT_C_IO,
2845 .group = FIO_OPT_G_IO_TYPE,
2849 .lname = "Atomic I/O",
2850 .type = FIO_OPT_BOOL,
2851 .off1 = offsetof(struct thread_options, oatomic),
2852 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2854 .category = FIO_OPT_C_IO,
2855 .group = FIO_OPT_G_IO_TYPE,
2859 .lname = "Buffered I/O",
2860 .type = FIO_OPT_BOOL,
2861 .off1 = offsetof(struct thread_options, odirect),
2863 .help = "Use buffered IO (negates direct)",
2865 .inverse = "direct",
2866 .category = FIO_OPT_C_IO,
2867 .group = FIO_OPT_G_IO_TYPE,
2870 .name = "overwrite",
2871 .lname = "Overwrite",
2872 .type = FIO_OPT_BOOL,
2873 .off1 = offsetof(struct thread_options, overwrite),
2874 .help = "When writing, set whether to overwrite current data",
2876 .category = FIO_OPT_C_FILE,
2877 .group = FIO_OPT_G_INVALID,
2882 .type = FIO_OPT_INT,
2883 .off1 = offsetof(struct thread_options, loops),
2884 .help = "Number of times to run the job",
2887 .category = FIO_OPT_C_GENERAL,
2888 .group = FIO_OPT_G_RUNTIME,
2892 .lname = "Number of jobs",
2893 .type = FIO_OPT_INT,
2894 .off1 = offsetof(struct thread_options, numjobs),
2895 .help = "Duplicate this job this many times",
2898 .category = FIO_OPT_C_GENERAL,
2899 .group = FIO_OPT_G_RUNTIME,
2902 .name = "startdelay",
2903 .lname = "Start delay",
2904 .type = FIO_OPT_STR_VAL_TIME,
2905 .off1 = offsetof(struct thread_options, start_delay),
2906 .off2 = offsetof(struct thread_options, start_delay_high),
2907 .help = "Only start job when this period has passed",
2911 .category = FIO_OPT_C_GENERAL,
2912 .group = FIO_OPT_G_RUNTIME,
2918 .type = FIO_OPT_STR_VAL_TIME,
2919 .off1 = offsetof(struct thread_options, timeout),
2920 .help = "Stop workload when this amount of time has passed",
2924 .category = FIO_OPT_C_GENERAL,
2925 .group = FIO_OPT_G_RUNTIME,
2928 .name = "time_based",
2929 .lname = "Time based",
2930 .type = FIO_OPT_STR_SET,
2931 .off1 = offsetof(struct thread_options, time_based),
2932 .help = "Keep running until runtime/timeout is met",
2933 .category = FIO_OPT_C_GENERAL,
2934 .group = FIO_OPT_G_RUNTIME,
2937 .name = "verify_only",
2938 .lname = "Verify only",
2939 .type = FIO_OPT_STR_SET,
2940 .off1 = offsetof(struct thread_options, verify_only),
2941 .help = "Verifies previously written data is still valid",
2942 .category = FIO_OPT_C_GENERAL,
2943 .group = FIO_OPT_G_RUNTIME,
2946 .name = "ramp_time",
2947 .lname = "Ramp time",
2948 .type = FIO_OPT_STR_VAL_TIME,
2949 .off1 = offsetof(struct thread_options, ramp_time),
2950 .help = "Ramp up time before measuring performance",
2953 .category = FIO_OPT_C_GENERAL,
2954 .group = FIO_OPT_G_RUNTIME,
2957 .name = "clocksource",
2958 .lname = "Clock source",
2959 .type = FIO_OPT_STR,
2960 .cb = fio_clock_source_cb,
2961 .off1 = offsetof(struct thread_options, clocksource),
2962 .help = "What type of timing source to use",
2963 .category = FIO_OPT_C_GENERAL,
2964 .group = FIO_OPT_G_CLOCK,
2966 #ifdef CONFIG_GETTIMEOFDAY
2967 { .ival = "gettimeofday",
2969 .help = "Use gettimeofday(2) for timing",
2972 #ifdef CONFIG_CLOCK_GETTIME
2973 { .ival = "clock_gettime",
2974 .oval = CS_CGETTIME,
2975 .help = "Use clock_gettime(2) for timing",
2978 #ifdef ARCH_HAVE_CPU_CLOCK
2980 .oval = CS_CPUCLOCK,
2981 .help = "Use CPU private clock",
2989 .lname = "I/O Memory",
2990 .type = FIO_OPT_STR,
2992 .off1 = offsetof(struct thread_options, mem_type),
2993 .help = "Backing type for IO buffers",
2995 .category = FIO_OPT_C_IO,
2996 .group = FIO_OPT_G_INVALID,
3000 .help = "Use malloc(3) for IO buffers",
3002 #ifndef CONFIG_NO_SHM
3005 .help = "Use shared memory segments for IO buffers",
3007 #ifdef FIO_HAVE_HUGETLB
3008 { .ival = "shmhuge",
3009 .oval = MEM_SHMHUGE,
3010 .help = "Like shm, but use huge pages",
3016 .help = "Use mmap(2) (file or anon) for IO buffers",
3018 { .ival = "mmapshared",
3019 .oval = MEM_MMAPSHARED,
3020 .help = "Like mmap, but use the shared flag",
3022 #ifdef FIO_HAVE_HUGETLB
3023 { .ival = "mmaphuge",
3024 .oval = MEM_MMAPHUGE,
3025 .help = "Like mmap, but use huge pages",
3029 { .ival = "cudamalloc",
3030 .oval = MEM_CUDA_MALLOC,
3031 .help = "Allocate GPU device memory for GPUDirect RDMA",
3037 .name = "iomem_align",
3038 .alias = "mem_align",
3039 .lname = "I/O memory alignment",
3040 .type = FIO_OPT_INT,
3041 .off1 = offsetof(struct thread_options, mem_align),
3043 .help = "IO memory buffer offset alignment",
3047 .category = FIO_OPT_C_IO,
3048 .group = FIO_OPT_G_INVALID,
3053 .type = FIO_OPT_STR,
3054 .off1 = offsetof(struct thread_options, verify),
3055 .help = "Verify data written",
3057 .category = FIO_OPT_C_IO,
3058 .group = FIO_OPT_G_VERIFY,
3061 .oval = VERIFY_NONE,
3062 .help = "Don't do IO verification",
3066 .help = "Use md5 checksums for verification",
3069 .oval = VERIFY_CRC64,
3070 .help = "Use crc64 checksums for verification",
3073 .oval = VERIFY_CRC32,
3074 .help = "Use crc32 checksums for verification",
3076 { .ival = "crc32c-intel",
3077 .oval = VERIFY_CRC32C,
3078 .help = "Use crc32c checksums for verification (hw assisted, if available)",
3081 .oval = VERIFY_CRC32C,
3082 .help = "Use crc32c checksums for verification (hw assisted, if available)",
3085 .oval = VERIFY_CRC16,
3086 .help = "Use crc16 checksums for verification",
3089 .oval = VERIFY_CRC7,
3090 .help = "Use crc7 checksums for verification",
3093 .oval = VERIFY_SHA1,
3094 .help = "Use sha1 checksums for verification",
3097 .oval = VERIFY_SHA256,
3098 .help = "Use sha256 checksums for verification",
3101 .oval = VERIFY_SHA512,
3102 .help = "Use sha512 checksums for verification",
3104 { .ival = "sha3-224",
3105 .oval = VERIFY_SHA3_224,
3106 .help = "Use sha3-224 checksums for verification",
3108 { .ival = "sha3-256",
3109 .oval = VERIFY_SHA3_256,
3110 .help = "Use sha3-256 checksums for verification",
3112 { .ival = "sha3-384",
3113 .oval = VERIFY_SHA3_384,
3114 .help = "Use sha3-384 checksums for verification",
3116 { .ival = "sha3-512",
3117 .oval = VERIFY_SHA3_512,
3118 .help = "Use sha3-512 checksums for verification",
3121 .oval = VERIFY_XXHASH,
3122 .help = "Use xxhash checksums for verification",
3124 /* Meta information was included into verify_header,
3125 * 'meta' verification is implied by default. */
3127 .oval = VERIFY_HDR_ONLY,
3128 .help = "Use io information for verification. "
3129 "Now is implied by default, thus option is obsolete, "
3132 { .ival = "pattern",
3133 .oval = VERIFY_PATTERN_NO_HDR,
3134 .help = "Verify strict pattern",
3138 .oval = VERIFY_NULL,
3139 .help = "Pretend to verify",
3144 .name = "do_verify",
3145 .lname = "Perform verify step",
3146 .type = FIO_OPT_BOOL,
3147 .off1 = offsetof(struct thread_options, do_verify),
3148 .help = "Run verification stage after write",
3152 .category = FIO_OPT_C_IO,
3153 .group = FIO_OPT_G_VERIFY,
3156 .name = "verifysort",
3157 .lname = "Verify sort",
3158 .type = FIO_OPT_SOFT_DEPRECATED,
3159 .category = FIO_OPT_C_IO,
3160 .group = FIO_OPT_G_VERIFY,
3163 .name = "verifysort_nr",
3164 .lname = "Verify Sort Nr",
3165 .type = FIO_OPT_SOFT_DEPRECATED,
3166 .category = FIO_OPT_C_IO,
3167 .group = FIO_OPT_G_VERIFY,
3170 .name = "verify_interval",
3171 .lname = "Verify interval",
3172 .type = FIO_OPT_INT,
3173 .off1 = offsetof(struct thread_options, verify_interval),
3174 .minval = 2 * sizeof(struct verify_header),
3175 .help = "Store verify buffer header every N bytes",
3178 .interval = 2 * sizeof(struct verify_header),
3179 .category = FIO_OPT_C_IO,
3180 .group = FIO_OPT_G_VERIFY,
3183 .name = "verify_offset",
3184 .lname = "Verify offset",
3185 .type = FIO_OPT_INT,
3186 .help = "Offset verify header location by N bytes",
3187 .off1 = offsetof(struct thread_options, verify_offset),
3188 .minval = sizeof(struct verify_header),
3191 .category = FIO_OPT_C_IO,
3192 .group = FIO_OPT_G_VERIFY,
3195 .name = "verify_pattern",
3196 .lname = "Verify pattern",
3197 .type = FIO_OPT_STR,
3198 .cb = str_verify_pattern_cb,
3199 .off1 = offsetof(struct thread_options, verify_pattern),
3200 .help = "Fill pattern for IO buffers",
3203 .category = FIO_OPT_C_IO,
3204 .group = FIO_OPT_G_VERIFY,
3207 .name = "verify_fatal",
3208 .lname = "Verify fatal",
3209 .type = FIO_OPT_BOOL,
3210 .off1 = offsetof(struct thread_options, verify_fatal),
3212 .help = "Exit on a single verify failure, don't continue",
3215 .category = FIO_OPT_C_IO,
3216 .group = FIO_OPT_G_VERIFY,
3219 .name = "verify_dump",
3220 .lname = "Verify dump",
3221 .type = FIO_OPT_BOOL,
3222 .off1 = offsetof(struct thread_options, verify_dump),
3224 .help = "Dump contents of good and bad blocks on failure",
3227 .category = FIO_OPT_C_IO,
3228 .group = FIO_OPT_G_VERIFY,
3231 .name = "verify_async",
3232 .lname = "Verify asynchronously",
3233 .type = FIO_OPT_INT,
3234 .off1 = offsetof(struct thread_options, verify_async),
3236 .help = "Number of async verifier threads to use",
3239 .category = FIO_OPT_C_IO,
3240 .group = FIO_OPT_G_VERIFY,
3243 .name = "verify_backlog",
3244 .lname = "Verify backlog",
3245 .type = FIO_OPT_STR_VAL,
3246 .off1 = offsetof(struct thread_options, verify_backlog),
3247 .help = "Verify after this number of blocks are written",
3250 .category = FIO_OPT_C_IO,
3251 .group = FIO_OPT_G_VERIFY,
3254 .name = "verify_backlog_batch",
3255 .lname = "Verify backlog batch",
3256 .type = FIO_OPT_INT,
3257 .off1 = offsetof(struct thread_options, verify_batch),
3258 .help = "Verify this number of IO blocks",
3261 .category = FIO_OPT_C_IO,
3262 .group = FIO_OPT_G_VERIFY,
3264 #ifdef FIO_HAVE_CPU_AFFINITY
3266 .name = "verify_async_cpus",
3267 .lname = "Async verify CPUs",
3268 .type = FIO_OPT_STR,
3269 .cb = str_verify_cpus_allowed_cb,
3270 .off1 = offsetof(struct thread_options, verify_cpumask),
3271 .help = "Set CPUs allowed for async verify threads",
3272 .parent = "verify_async",
3274 .category = FIO_OPT_C_IO,
3275 .group = FIO_OPT_G_VERIFY,
3279 .name = "verify_async_cpus",
3280 .lname = "Async verify CPUs",
3281 .type = FIO_OPT_UNSUPPORTED,
3282 .help = "Your platform does not support CPU affinities",
3286 .name = "experimental_verify",
3287 .lname = "Experimental Verify",
3288 .off1 = offsetof(struct thread_options, experimental_verify),
3289 .type = FIO_OPT_BOOL,
3290 .help = "Enable experimental verification",
3292 .category = FIO_OPT_C_IO,
3293 .group = FIO_OPT_G_VERIFY,
3296 .name = "verify_state_load",
3297 .lname = "Load verify state",
3298 .off1 = offsetof(struct thread_options, verify_state),
3299 .type = FIO_OPT_BOOL,
3300 .help = "Load verify termination state",
3302 .category = FIO_OPT_C_IO,
3303 .group = FIO_OPT_G_VERIFY,
3306 .name = "verify_state_save",
3307 .lname = "Save verify state",
3308 .off1 = offsetof(struct thread_options, verify_state_save),
3309 .type = FIO_OPT_BOOL,
3311 .help = "Save verify state on termination",
3313 .category = FIO_OPT_C_IO,
3314 .group = FIO_OPT_G_VERIFY,
3316 #ifdef FIO_HAVE_TRIM
3318 .name = "trim_percentage",
3319 .lname = "Trim percentage",
3320 .type = FIO_OPT_INT,
3321 .off1 = offsetof(struct thread_options, trim_percentage),
3324 .help = "Number of verify blocks to trim (i.e., discard)",
3329 .category = FIO_OPT_C_IO,
3330 .group = FIO_OPT_G_TRIM,
3333 .name = "trim_verify_zero",
3334 .lname = "Verify trim zero",
3335 .type = FIO_OPT_BOOL,
3336 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3337 .off1 = offsetof(struct thread_options, trim_zero),
3338 .parent = "trim_percentage",
3341 .category = FIO_OPT_C_IO,
3342 .group = FIO_OPT_G_TRIM,
3345 .name = "trim_backlog",
3346 .lname = "Trim backlog",
3347 .type = FIO_OPT_STR_VAL,
3348 .off1 = offsetof(struct thread_options, trim_backlog),
3349 .help = "Trim after this number of blocks are written",
3350 .parent = "trim_percentage",
3353 .category = FIO_OPT_C_IO,
3354 .group = FIO_OPT_G_TRIM,
3357 .name = "trim_backlog_batch",
3358 .lname = "Trim backlog batch",
3359 .type = FIO_OPT_INT,
3360 .off1 = offsetof(struct thread_options, trim_batch),
3361 .help = "Trim this number of IO blocks",
3362 .parent = "trim_percentage",
3365 .category = FIO_OPT_C_IO,
3366 .group = FIO_OPT_G_TRIM,
3370 .name = "trim_percentage",
3371 .lname = "Trim percentage",
3372 .type = FIO_OPT_UNSUPPORTED,
3373 .help = "Fio does not support TRIM on your platform",
3376 .name = "trim_verify_zero",
3377 .lname = "Verify trim zero",
3378 .type = FIO_OPT_UNSUPPORTED,
3379 .help = "Fio does not support TRIM on your platform",
3382 .name = "trim_backlog",
3383 .lname = "Trim backlog",
3384 .type = FIO_OPT_UNSUPPORTED,
3385 .help = "Fio does not support TRIM on your platform",
3388 .name = "trim_backlog_batch",
3389 .lname = "Trim backlog batch",
3390 .type = FIO_OPT_UNSUPPORTED,
3391 .help = "Fio does not support TRIM on your platform",
3395 .name = "write_iolog",
3396 .lname = "Write I/O log",
3397 .type = FIO_OPT_STR_STORE,
3398 .off1 = offsetof(struct thread_options, write_iolog_file),
3399 .help = "Store IO pattern to file",
3400 .category = FIO_OPT_C_IO,
3401 .group = FIO_OPT_G_IOLOG,
3404 .name = "read_iolog",
3405 .lname = "Read I/O log",
3406 .type = FIO_OPT_STR_STORE,
3407 .off1 = offsetof(struct thread_options, read_iolog_file),
3408 .help = "Playback IO pattern from file",
3409 .category = FIO_OPT_C_IO,
3410 .group = FIO_OPT_G_IOLOG,
3413 .name = "read_iolog_chunked",
3414 .lname = "Read I/O log in parts",
3415 .type = FIO_OPT_BOOL,
3416 .off1 = offsetof(struct thread_options, read_iolog_chunked),
3418 .parent = "read_iolog",
3419 .help = "Parse IO pattern in chunks",
3420 .category = FIO_OPT_C_IO,
3421 .group = FIO_OPT_G_IOLOG,
3424 .name = "replay_no_stall",
3425 .lname = "Don't stall on replay",
3426 .type = FIO_OPT_BOOL,
3427 .off1 = offsetof(struct thread_options, no_stall),
3429 .parent = "read_iolog",
3431 .help = "Playback IO pattern file as fast as possible without stalls",
3432 .category = FIO_OPT_C_IO,
3433 .group = FIO_OPT_G_IOLOG,
3436 .name = "replay_redirect",
3437 .lname = "Redirect device for replay",
3438 .type = FIO_OPT_STR_STORE,
3439 .off1 = offsetof(struct thread_options, replay_redirect),
3440 .parent = "read_iolog",
3442 .help = "Replay all I/O onto this device, regardless of trace device",
3443 .category = FIO_OPT_C_IO,
3444 .group = FIO_OPT_G_IOLOG,
3447 .name = "replay_scale",
3448 .lname = "Replace offset scale factor",
3449 .type = FIO_OPT_INT,
3450 .off1 = offsetof(struct thread_options, replay_scale),
3451 .parent = "read_iolog",
3453 .help = "Align offsets to this blocksize",
3454 .category = FIO_OPT_C_IO,
3455 .group = FIO_OPT_G_IOLOG,
3458 .name = "replay_align",
3459 .lname = "Replace alignment",
3460 .type = FIO_OPT_INT,
3461 .off1 = offsetof(struct thread_options, replay_align),
3462 .parent = "read_iolog",
3463 .help = "Scale offset down by this factor",
3464 .category = FIO_OPT_C_IO,
3465 .group = FIO_OPT_G_IOLOG,
3469 .name = "replay_time_scale",
3470 .lname = "Replay Time Scale",
3471 .type = FIO_OPT_INT,
3472 .off1 = offsetof(struct thread_options, replay_time_scale),
3475 .parent = "read_iolog",
3477 .help = "Scale time for replay events",
3478 .category = FIO_OPT_C_IO,
3479 .group = FIO_OPT_G_IOLOG,
3482 .name = "replay_skip",
3483 .lname = "Replay Skip",
3484 .type = FIO_OPT_STR,
3485 .cb = str_replay_skip_cb,
3486 .off1 = offsetof(struct thread_options, replay_skip),
3487 .parent = "read_iolog",
3488 .help = "Skip certain IO types (read,write,trim,flush)",
3489 .category = FIO_OPT_C_IO,
3490 .group = FIO_OPT_G_IOLOG,
3493 .name = "merge_blktrace_file",
3494 .lname = "Merged blktrace output filename",
3495 .type = FIO_OPT_STR_STORE,
3496 .off1 = offsetof(struct thread_options, merge_blktrace_file),
3497 .help = "Merged blktrace output filename",
3498 .category = FIO_OPT_C_IO,
3499 .group = FIO_OPT_G_IOLOG,
3502 .name = "merge_blktrace_scalars",
3503 .lname = "Percentage to scale each trace",
3504 .type = FIO_OPT_FLOAT_LIST,
3505 .off1 = offsetof(struct thread_options, merge_blktrace_scalars),
3506 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3507 .help = "Percentage to scale each trace",
3508 .category = FIO_OPT_C_IO,
3509 .group = FIO_OPT_G_IOLOG,
3512 .name = "merge_blktrace_iters",
3513 .lname = "Number of iterations to run per trace",
3514 .type = FIO_OPT_FLOAT_LIST,
3515 .off1 = offsetof(struct thread_options, merge_blktrace_iters),
3516 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3517 .help = "Number of iterations to run per trace",
3518 .category = FIO_OPT_C_IO,
3519 .group = FIO_OPT_G_IOLOG,
3522 .name = "exec_prerun",
3523 .lname = "Pre-execute runnable",
3524 .type = FIO_OPT_STR_STORE,
3525 .off1 = offsetof(struct thread_options, exec_prerun),
3526 .help = "Execute this file prior to running job",
3527 .category = FIO_OPT_C_GENERAL,
3528 .group = FIO_OPT_G_INVALID,
3531 .name = "exec_postrun",
3532 .lname = "Post-execute runnable",
3533 .type = FIO_OPT_STR_STORE,
3534 .off1 = offsetof(struct thread_options, exec_postrun),
3535 .help = "Execute this file after running job",
3536 .category = FIO_OPT_C_GENERAL,
3537 .group = FIO_OPT_G_INVALID,
3539 #ifdef FIO_HAVE_IOSCHED_SWITCH
3541 .name = "ioscheduler",
3542 .lname = "I/O scheduler",
3543 .type = FIO_OPT_STR_STORE,
3544 .off1 = offsetof(struct thread_options, ioscheduler),
3545 .help = "Use this IO scheduler on the backing device",
3546 .category = FIO_OPT_C_FILE,
3547 .group = FIO_OPT_G_INVALID,
3551 .name = "ioscheduler",
3552 .lname = "I/O scheduler",
3553 .type = FIO_OPT_UNSUPPORTED,
3554 .help = "Your platform does not support IO scheduler switching",
3559 .lname = "Zone mode",
3560 .help = "Mode for the zonesize, zonerange and zoneskip parameters",
3561 .type = FIO_OPT_STR,
3562 .off1 = offsetof(struct thread_options, zone_mode),
3564 .category = FIO_OPT_C_IO,
3565 .group = FIO_OPT_G_ZONE,
3568 .oval = ZONE_MODE_NONE,
3569 .help = "no zoning",
3571 { .ival = "strided",
3572 .oval = ZONE_MODE_STRIDED,
3573 .help = "strided mode - random I/O is restricted to a single zone",
3576 .oval = ZONE_MODE_ZBD,
3577 .help = "zoned block device mode - random I/O selects one of multiple zones randomly",
3583 .lname = "Zone size",
3584 .type = FIO_OPT_STR_VAL,
3585 .off1 = offsetof(struct thread_options, zone_size),
3586 .help = "Amount of data to read per zone",
3588 .interval = 1024 * 1024,
3589 .category = FIO_OPT_C_IO,
3590 .group = FIO_OPT_G_ZONE,
3593 .name = "zonecapacity",
3594 .lname = "Zone capacity",
3595 .type = FIO_OPT_STR_VAL,
3596 .off1 = offsetof(struct thread_options, zone_capacity),
3597 .help = "Capacity per zone",
3599 .interval = 1024 * 1024,
3600 .category = FIO_OPT_C_IO,
3601 .group = FIO_OPT_G_ZONE,
3604 .name = "zonerange",
3605 .lname = "Zone range",
3606 .type = FIO_OPT_STR_VAL,
3607 .off1 = offsetof(struct thread_options, zone_range),
3608 .help = "Give size of an IO zone",
3610 .interval = 1024 * 1024,
3611 .category = FIO_OPT_C_IO,
3612 .group = FIO_OPT_G_ZONE,
3616 .lname = "Zone skip",
3617 .type = FIO_OPT_STR_VAL_ZONE,
3618 .cb = str_zoneskip_cb,
3619 .off1 = offsetof(struct thread_options, zone_skip),
3620 .help = "Space between IO zones",
3622 .category = FIO_OPT_C_IO,
3623 .group = FIO_OPT_G_ZONE,
3626 .name = "read_beyond_wp",
3627 .lname = "Allow reads beyond the zone write pointer",
3628 .type = FIO_OPT_BOOL,
3629 .off1 = offsetof(struct thread_options, read_beyond_wp),
3630 .help = "Allow reads beyond the zone write pointer",
3632 .category = FIO_OPT_C_IO,
3633 .group = FIO_OPT_G_INVALID,
3636 .name = "max_open_zones",
3637 .lname = "Per device/file maximum number of open zones",
3638 .type = FIO_OPT_INT,
3639 .off1 = offsetof(struct thread_options, max_open_zones),
3640 .maxval = ZBD_MAX_WRITE_ZONES,
3641 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd",
3643 .category = FIO_OPT_C_IO,
3644 .group = FIO_OPT_G_INVALID,
3647 .name = "job_max_open_zones",
3648 .lname = "Job maximum number of open zones",
3649 .type = FIO_OPT_INT,
3650 .off1 = offsetof(struct thread_options, job_max_open_zones),
3651 .maxval = ZBD_MAX_WRITE_ZONES,
3652 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd by one thread/process",
3654 .category = FIO_OPT_C_IO,
3655 .group = FIO_OPT_G_INVALID,
3658 .name = "ignore_zone_limits",
3659 .lname = "Ignore zone resource limits",
3660 .type = FIO_OPT_BOOL,
3661 .off1 = offsetof(struct thread_options, ignore_zone_limits),
3663 .help = "Ignore the zone resource limits (max open/active zones) reported by the device",
3664 .category = FIO_OPT_C_IO,
3665 .group = FIO_OPT_G_INVALID,
3668 .name = "zone_reset_threshold",
3669 .lname = "Zone reset threshold",
3670 .help = "Zoned block device reset threshold",
3671 .type = FIO_OPT_FLOAT_LIST,
3673 .off1 = offsetof(struct thread_options, zrt),
3676 .category = FIO_OPT_C_IO,
3677 .group = FIO_OPT_G_ZONE,
3680 .name = "zone_reset_frequency",
3681 .lname = "Zone reset frequency",
3682 .help = "Zoned block device zone reset frequency in HZ",
3683 .type = FIO_OPT_FLOAT_LIST,
3685 .off1 = offsetof(struct thread_options, zrf),
3688 .category = FIO_OPT_C_IO,
3689 .group = FIO_OPT_G_ZONE,
3693 .lname = "Flexible data placement",
3694 .type = FIO_OPT_BOOL,
3695 .off1 = offsetof(struct thread_options, fdp),
3696 .help = "Use Data placement directive (FDP)",
3698 .category = FIO_OPT_C_IO,
3699 .group = FIO_OPT_G_INVALID,
3702 .name = "fdp_pli_select",
3703 .lname = "FDP Placement ID select",
3704 .type = FIO_OPT_STR,
3705 .off1 = offsetof(struct thread_options, fdp_pli_select),
3706 .help = "Select which FDP placement ID to use next",
3707 .def = "roundrobin",
3708 .category = FIO_OPT_C_IO,
3709 .group = FIO_OPT_G_INVALID,
3712 .oval = FIO_FDP_RANDOM,
3713 .help = "Choose a Placement ID at random (uniform)",
3715 { .ival = "roundrobin",
3717 .help = "Round robin select Placement IDs",
3723 .lname = "FDP Placement ID indicies",
3724 .type = FIO_OPT_STR,
3725 .cb = str_fdp_pli_cb,
3726 .off1 = offsetof(struct thread_options, fdp_plis),
3727 .help = "Sets which placement ids to use (defaults to all)",
3729 .category = FIO_OPT_C_IO,
3730 .group = FIO_OPT_G_INVALID,
3734 .lname = "Lock memory",
3735 .type = FIO_OPT_STR_VAL,
3736 .off1 = offsetof(struct thread_options, lockmem),
3737 .help = "Lock down this amount of memory (per worker)",
3739 .interval = 1024 * 1024,
3740 .category = FIO_OPT_C_GENERAL,
3741 .group = FIO_OPT_G_INVALID,
3744 .name = "rwmixread",
3745 .lname = "Read/write mix read",
3746 .type = FIO_OPT_INT,
3747 .cb = str_rwmix_read_cb,
3748 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3750 .help = "Percentage of mixed workload that is reads",
3753 .inverse = "rwmixwrite",
3754 .category = FIO_OPT_C_IO,
3755 .group = FIO_OPT_G_RWMIX,
3758 .name = "rwmixwrite",
3759 .lname = "Read/write mix write",
3760 .type = FIO_OPT_INT,
3761 .cb = str_rwmix_write_cb,
3762 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3764 .help = "Percentage of mixed workload that is writes",
3767 .inverse = "rwmixread",
3768 .category = FIO_OPT_C_IO,
3769 .group = FIO_OPT_G_RWMIX,
3772 .name = "rwmixcycle",
3773 .lname = "Read/write mix cycle",
3774 .type = FIO_OPT_DEPRECATED,
3775 .category = FIO_OPT_C_IO,
3776 .group = FIO_OPT_G_RWMIX,
3781 .type = FIO_OPT_INT,
3782 .off1 = offsetof(struct thread_options, nice),
3783 .help = "Set job CPU nice value",
3788 .category = FIO_OPT_C_GENERAL,
3789 .group = FIO_OPT_G_CRED,
3791 #ifdef FIO_HAVE_IOPRIO
3794 .lname = "I/O nice priority",
3795 .type = FIO_OPT_INT,
3796 .off1 = offsetof(struct thread_options, ioprio),
3797 .help = "Set job IO priority value",
3798 .minval = IOPRIO_MIN_PRIO,
3799 .maxval = IOPRIO_MAX_PRIO,
3801 .category = FIO_OPT_C_GENERAL,
3802 .group = FIO_OPT_G_CRED,
3807 .lname = "I/O nice priority",
3808 .type = FIO_OPT_UNSUPPORTED,
3809 .help = "Your platform does not support IO priorities",
3812 #ifdef FIO_HAVE_IOPRIO_CLASS
3813 #ifndef FIO_HAVE_IOPRIO
3814 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3817 .name = "prioclass",
3818 .lname = "I/O nice priority class",
3819 .type = FIO_OPT_INT,
3820 .off1 = offsetof(struct thread_options, ioprio_class),
3821 .help = "Set job IO priority class",
3822 .minval = IOPRIO_MIN_PRIO_CLASS,
3823 .maxval = IOPRIO_MAX_PRIO_CLASS,
3825 .category = FIO_OPT_C_GENERAL,
3826 .group = FIO_OPT_G_CRED,
3830 .lname = "I/O nice priority hint",
3831 .type = FIO_OPT_INT,
3832 .off1 = offsetof(struct thread_options, ioprio_hint),
3833 .help = "Set job IO priority hint",
3834 .minval = IOPRIO_MIN_PRIO_HINT,
3835 .maxval = IOPRIO_MAX_PRIO_HINT,
3837 .category = FIO_OPT_C_GENERAL,
3838 .group = FIO_OPT_G_CRED,
3842 .name = "prioclass",
3843 .lname = "I/O nice priority class",
3844 .type = FIO_OPT_UNSUPPORTED,
3845 .help = "Your platform does not support IO priority classes",
3849 .lname = "I/O nice priority hint",
3850 .type = FIO_OPT_UNSUPPORTED,
3851 .help = "Your platform does not support IO priority hints",
3855 .name = "thinktime",
3856 .lname = "Thinktime",
3857 .type = FIO_OPT_INT,
3858 .off1 = offsetof(struct thread_options, thinktime),
3859 .help = "Idle time between IO buffers (usec)",
3862 .category = FIO_OPT_C_IO,
3863 .group = FIO_OPT_G_THINKTIME,
3866 .name = "thinktime_spin",
3867 .lname = "Thinktime spin",
3868 .type = FIO_OPT_INT,
3869 .off1 = offsetof(struct thread_options, thinktime_spin),
3870 .help = "Start think time by spinning this amount (usec)",
3873 .parent = "thinktime",
3875 .category = FIO_OPT_C_IO,
3876 .group = FIO_OPT_G_THINKTIME,
3879 .name = "thinkcycles",
3880 .lname = "Think cycles",
3881 .type = FIO_OPT_INT,
3882 .off1 = offsetof(struct thread_options, thinkcycles),
3883 .help = "Spin for a constant amount of cycles between requests",
3885 .parent = "thinktime",
3887 .category = FIO_OPT_C_IO,
3888 .group = FIO_OPT_G_THINKTIME,
3891 .name = "thinktime_blocks",
3892 .lname = "Thinktime blocks",
3893 .type = FIO_OPT_INT,
3894 .off1 = offsetof(struct thread_options, thinktime_blocks),
3895 .help = "IO buffer period between 'thinktime'",
3897 .parent = "thinktime",
3899 .category = FIO_OPT_C_IO,
3900 .group = FIO_OPT_G_THINKTIME,
3903 .name = "thinktime_blocks_type",
3904 .lname = "Thinktime blocks type",
3905 .type = FIO_OPT_STR,
3906 .off1 = offsetof(struct thread_options, thinktime_blocks_type),
3907 .help = "How thinktime_blocks takes effect",
3909 .category = FIO_OPT_C_IO,
3910 .group = FIO_OPT_G_THINKTIME,
3912 { .ival = "complete",
3913 .oval = THINKTIME_BLOCKS_TYPE_COMPLETE,
3914 .help = "thinktime_blocks takes effect at the completion side",
3918 .oval = THINKTIME_BLOCKS_TYPE_ISSUE,
3919 .help = "thinktime_blocks takes effect at the issue side",
3922 .parent = "thinktime",
3925 .name = "thinktime_iotime",
3926 .lname = "Thinktime interval",
3927 .type = FIO_OPT_INT,
3928 .off1 = offsetof(struct thread_options, thinktime_iotime),
3929 .help = "IO time interval between 'thinktime'",
3931 .parent = "thinktime",
3935 .category = FIO_OPT_C_IO,
3936 .group = FIO_OPT_G_THINKTIME,
3940 .lname = "I/O rate",
3941 .type = FIO_OPT_ULL,
3942 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3943 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3944 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
3945 .help = "Set bandwidth rate",
3946 .category = FIO_OPT_C_IO,
3947 .group = FIO_OPT_G_RATE,
3952 .lname = "I/O min rate",
3953 .type = FIO_OPT_ULL,
3954 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
3955 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
3956 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
3957 .help = "Job must meet this rate or it will be shutdown",
3960 .category = FIO_OPT_C_IO,
3961 .group = FIO_OPT_G_RATE,
3964 .name = "rate_iops",
3965 .lname = "I/O rate IOPS",
3966 .type = FIO_OPT_INT,
3967 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
3968 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
3969 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
3970 .help = "Limit IO used to this number of IO operations/sec",
3972 .category = FIO_OPT_C_IO,
3973 .group = FIO_OPT_G_RATE,
3976 .name = "rate_iops_min",
3977 .lname = "I/O min rate IOPS",
3978 .type = FIO_OPT_INT,
3979 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
3980 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
3981 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
3982 .help = "Job must meet this rate or it will be shut down",
3983 .parent = "rate_iops",
3985 .category = FIO_OPT_C_IO,
3986 .group = FIO_OPT_G_RATE,
3989 .name = "rate_process",
3990 .lname = "Rate Process",
3991 .type = FIO_OPT_STR,
3992 .off1 = offsetof(struct thread_options, rate_process),
3993 .help = "What process controls how rated IO is managed",
3995 .category = FIO_OPT_C_IO,
3996 .group = FIO_OPT_G_RATE,
3999 .oval = RATE_PROCESS_LINEAR,
4000 .help = "Linear rate of IO",
4004 .oval = RATE_PROCESS_POISSON,
4005 .help = "Rate follows Poisson process",
4011 .name = "rate_cycle",
4012 .alias = "ratecycle",
4013 .lname = "I/O rate cycle",
4014 .type = FIO_OPT_INT,
4015 .off1 = offsetof(struct thread_options, ratecycle),
4016 .help = "Window average for rate limits (msec)",
4020 .category = FIO_OPT_C_IO,
4021 .group = FIO_OPT_G_RATE,
4024 .name = "rate_ignore_thinktime",
4025 .lname = "Rate ignore thinktime",
4026 .type = FIO_OPT_BOOL,
4027 .off1 = offsetof(struct thread_options, rate_ign_think),
4028 .help = "Rated IO ignores thinktime settings",
4030 .category = FIO_OPT_C_IO,
4031 .group = FIO_OPT_G_RATE,
4034 .name = "max_latency",
4035 .lname = "Max Latency (usec)",
4036 .type = FIO_OPT_ULL,
4037 .off1 = offsetof(struct thread_options, max_latency[DDIR_READ]),
4038 .off2 = offsetof(struct thread_options, max_latency[DDIR_WRITE]),
4039 .off3 = offsetof(struct thread_options, max_latency[DDIR_TRIM]),
4040 .help = "Maximum tolerated IO latency (usec)",
4042 .category = FIO_OPT_C_IO,
4043 .group = FIO_OPT_G_LATPROF,
4046 .name = "latency_target",
4047 .lname = "Latency Target (usec)",
4048 .type = FIO_OPT_STR_VAL_TIME,
4049 .off1 = offsetof(struct thread_options, latency_target),
4050 .help = "Ramp to max queue depth supporting this latency",
4052 .category = FIO_OPT_C_IO,
4053 .group = FIO_OPT_G_LATPROF,
4056 .name = "latency_window",
4057 .lname = "Latency Window (usec)",
4058 .type = FIO_OPT_STR_VAL_TIME,
4059 .off1 = offsetof(struct thread_options, latency_window),
4060 .help = "Time to sustain latency_target",
4062 .category = FIO_OPT_C_IO,
4063 .group = FIO_OPT_G_LATPROF,
4066 .name = "latency_percentile",
4067 .lname = "Latency Percentile",
4068 .type = FIO_OPT_FLOAT_LIST,
4069 .off1 = offsetof(struct thread_options, latency_percentile),
4070 .help = "Percentile of IOs must be below latency_target",
4075 .category = FIO_OPT_C_IO,
4076 .group = FIO_OPT_G_LATPROF,
4079 .name = "latency_run",
4080 .lname = "Latency Run",
4081 .type = FIO_OPT_BOOL,
4082 .off1 = offsetof(struct thread_options, latency_run),
4083 .help = "Keep adjusting queue depth to match latency_target",
4085 .category = FIO_OPT_C_IO,
4086 .group = FIO_OPT_G_LATPROF,
4089 .name = "invalidate",
4090 .lname = "Cache invalidate",
4091 .type = FIO_OPT_BOOL,
4092 .off1 = offsetof(struct thread_options, invalidate_cache),
4093 .help = "Invalidate buffer/page cache prior to running job",
4095 .category = FIO_OPT_C_IO,
4096 .group = FIO_OPT_G_IO_TYPE,
4100 .lname = "Synchronous I/O",
4101 .type = FIO_OPT_STR,
4102 .off1 = offsetof(struct thread_options, sync_io),
4103 .help = "Use synchronous write IO",
4106 .category = FIO_OPT_C_IO,
4107 .group = FIO_OPT_G_IO_TYPE,
4128 #ifdef FIO_HAVE_WRITE_HINT
4130 .name = "write_hint",
4131 .lname = "Write hint",
4132 .type = FIO_OPT_STR,
4133 .off1 = offsetof(struct thread_options, write_hint),
4134 .help = "Set expected write life time",
4135 .category = FIO_OPT_C_ENGINE,
4136 .group = FIO_OPT_G_INVALID,
4139 .oval = RWH_WRITE_LIFE_NONE,
4142 .oval = RWH_WRITE_LIFE_SHORT,
4145 .oval = RWH_WRITE_LIFE_MEDIUM,
4148 .oval = RWH_WRITE_LIFE_LONG,
4150 { .ival = "extreme",
4151 .oval = RWH_WRITE_LIFE_EXTREME,
4157 .name = "create_serialize",
4158 .lname = "Create serialize",
4159 .type = FIO_OPT_BOOL,
4160 .off1 = offsetof(struct thread_options, create_serialize),
4161 .help = "Serialize creation of job files",
4163 .category = FIO_OPT_C_FILE,
4164 .group = FIO_OPT_G_INVALID,
4167 .name = "create_fsync",
4168 .lname = "Create fsync",
4169 .type = FIO_OPT_BOOL,
4170 .off1 = offsetof(struct thread_options, create_fsync),
4171 .help = "fsync file after creation",
4173 .category = FIO_OPT_C_FILE,
4174 .group = FIO_OPT_G_INVALID,
4177 .name = "create_on_open",
4178 .lname = "Create on open",
4179 .type = FIO_OPT_BOOL,
4180 .off1 = offsetof(struct thread_options, create_on_open),
4181 .help = "Create files when they are opened for IO",
4183 .category = FIO_OPT_C_FILE,
4184 .group = FIO_OPT_G_INVALID,
4187 .name = "create_only",
4188 .lname = "Create Only",
4189 .type = FIO_OPT_BOOL,
4190 .off1 = offsetof(struct thread_options, create_only),
4191 .help = "Only perform file creation phase",
4192 .category = FIO_OPT_C_FILE,
4196 .name = "allow_file_create",
4197 .lname = "Allow file create",
4198 .type = FIO_OPT_BOOL,
4199 .off1 = offsetof(struct thread_options, allow_create),
4200 .help = "Permit fio to create files, if they don't exist",
4202 .category = FIO_OPT_C_FILE,
4203 .group = FIO_OPT_G_FILENAME,
4206 .name = "allow_mounted_write",
4207 .lname = "Allow mounted write",
4208 .type = FIO_OPT_BOOL,
4209 .off1 = offsetof(struct thread_options, allow_mounted_write),
4210 .help = "Allow writes to a mounted partition",
4212 .category = FIO_OPT_C_FILE,
4213 .group = FIO_OPT_G_FILENAME,
4217 .lname = "Pre-read files",
4218 .type = FIO_OPT_BOOL,
4219 .off1 = offsetof(struct thread_options, pre_read),
4220 .help = "Pre-read files before starting official testing",
4222 .category = FIO_OPT_C_FILE,
4223 .group = FIO_OPT_G_INVALID,
4225 #ifdef FIO_HAVE_CPU_AFFINITY
4228 .lname = "CPU mask",
4229 .type = FIO_OPT_INT,
4230 .cb = str_cpumask_cb,
4231 .off1 = offsetof(struct thread_options, cpumask),
4232 .help = "CPU affinity mask",
4233 .category = FIO_OPT_C_GENERAL,
4234 .group = FIO_OPT_G_CRED,
4237 .name = "cpus_allowed",
4238 .lname = "CPUs allowed",
4239 .type = FIO_OPT_STR,
4240 .cb = str_cpus_allowed_cb,
4241 .off1 = offsetof(struct thread_options, cpumask),
4242 .help = "Set CPUs allowed",
4243 .category = FIO_OPT_C_GENERAL,
4244 .group = FIO_OPT_G_CRED,
4247 .name = "cpus_allowed_policy",
4248 .lname = "CPUs allowed distribution policy",
4249 .type = FIO_OPT_STR,
4250 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
4251 .help = "Distribution policy for cpus_allowed",
4252 .parent = "cpus_allowed",
4256 .oval = FIO_CPUS_SHARED,
4257 .help = "Mask shared between threads",
4260 .oval = FIO_CPUS_SPLIT,
4261 .help = "Mask split between threads",
4264 .category = FIO_OPT_C_GENERAL,
4265 .group = FIO_OPT_G_CRED,
4270 .lname = "CPU mask",
4271 .type = FIO_OPT_UNSUPPORTED,
4272 .help = "Your platform does not support CPU affinities",
4275 .name = "cpus_allowed",
4276 .lname = "CPUs allowed",
4277 .type = FIO_OPT_UNSUPPORTED,
4278 .help = "Your platform does not support CPU affinities",
4281 .name = "cpus_allowed_policy",
4282 .lname = "CPUs allowed distribution policy",
4283 .type = FIO_OPT_UNSUPPORTED,
4284 .help = "Your platform does not support CPU affinities",
4287 #ifdef CONFIG_LIBNUMA
4289 .name = "numa_cpu_nodes",
4290 .lname = "NUMA CPU Nodes",
4291 .type = FIO_OPT_STR,
4292 .cb = str_numa_cpunodes_cb,
4293 .off1 = offsetof(struct thread_options, numa_cpunodes),
4294 .help = "NUMA CPU nodes bind",
4295 .category = FIO_OPT_C_GENERAL,
4296 .group = FIO_OPT_G_INVALID,
4299 .name = "numa_mem_policy",
4300 .lname = "NUMA Memory Policy",
4301 .type = FIO_OPT_STR,
4302 .cb = str_numa_mpol_cb,
4303 .off1 = offsetof(struct thread_options, numa_memnodes),
4304 .help = "NUMA memory policy setup",
4305 .category = FIO_OPT_C_GENERAL,
4306 .group = FIO_OPT_G_INVALID,
4310 .name = "numa_cpu_nodes",
4311 .lname = "NUMA CPU Nodes",
4312 .type = FIO_OPT_UNSUPPORTED,
4313 .help = "Build fio with libnuma-dev(el) to enable this option",
4316 .name = "numa_mem_policy",
4317 .lname = "NUMA Memory Policy",
4318 .type = FIO_OPT_UNSUPPORTED,
4319 .help = "Build fio with libnuma-dev(el) to enable this option",
4324 .name = "gpu_dev_id",
4325 .lname = "GPU device ID",
4326 .type = FIO_OPT_INT,
4327 .off1 = offsetof(struct thread_options, gpu_dev_id),
4328 .help = "Set GPU device ID for GPUDirect RDMA",
4330 .category = FIO_OPT_C_GENERAL,
4331 .group = FIO_OPT_G_INVALID,
4335 .name = "end_fsync",
4336 .lname = "End fsync",
4337 .type = FIO_OPT_BOOL,
4338 .off1 = offsetof(struct thread_options, end_fsync),
4339 .help = "Include fsync at the end of job",
4341 .category = FIO_OPT_C_FILE,
4342 .group = FIO_OPT_G_INVALID,
4345 .name = "fsync_on_close",
4346 .lname = "Fsync on close",
4347 .type = FIO_OPT_BOOL,
4348 .off1 = offsetof(struct thread_options, fsync_on_close),
4349 .help = "fsync files on close",
4351 .category = FIO_OPT_C_FILE,
4352 .group = FIO_OPT_G_INVALID,
4356 .lname = "Unlink file",
4357 .type = FIO_OPT_BOOL,
4358 .off1 = offsetof(struct thread_options, unlink),
4359 .help = "Unlink created files after job has completed",
4361 .category = FIO_OPT_C_FILE,
4362 .group = FIO_OPT_G_INVALID,
4365 .name = "unlink_each_loop",
4366 .lname = "Unlink file after each loop of a job",
4367 .type = FIO_OPT_BOOL,
4368 .off1 = offsetof(struct thread_options, unlink_each_loop),
4369 .help = "Unlink created files after each loop in a job has completed",
4371 .category = FIO_OPT_C_FILE,
4372 .group = FIO_OPT_G_INVALID,
4376 .lname = "Exit-all on terminate",
4377 .type = FIO_OPT_STR_SET,
4378 .cb = str_exitall_cb,
4379 .help = "Terminate all jobs when one exits",
4380 .category = FIO_OPT_C_GENERAL,
4381 .group = FIO_OPT_G_PROCESS,
4384 .name = "exit_what",
4385 .lname = "What jobs to quit on terminate",
4386 .type = FIO_OPT_STR,
4387 .off1 = offsetof(struct thread_options, exit_what),
4388 .help = "Fine-grained control for exitall",
4390 .category = FIO_OPT_C_GENERAL,
4391 .group = FIO_OPT_G_PROCESS,
4394 .oval = TERMINATE_GROUP,
4395 .help = "exit_all=1 default behaviour",
4397 { .ival = "stonewall",
4398 .oval = TERMINATE_STONEWALL,
4399 .help = "quit all currently running jobs; continue with next stonewall",
4402 .oval = TERMINATE_ALL,
4403 .help = "Quit everything",
4408 .name = "exitall_on_error",
4409 .lname = "Exit-all on terminate in error",
4410 .type = FIO_OPT_STR_SET,
4411 .off1 = offsetof(struct thread_options, exitall_error),
4412 .help = "Terminate all jobs when one exits in error",
4413 .category = FIO_OPT_C_GENERAL,
4414 .group = FIO_OPT_G_PROCESS,
4417 .name = "stonewall",
4418 .lname = "Wait for previous",
4419 .alias = "wait_for_previous",
4420 .type = FIO_OPT_STR_SET,
4421 .off1 = offsetof(struct thread_options, stonewall),
4422 .help = "Insert a hard barrier between this job and previous",
4423 .category = FIO_OPT_C_GENERAL,
4424 .group = FIO_OPT_G_PROCESS,
4427 .name = "new_group",
4428 .lname = "New group",
4429 .type = FIO_OPT_STR_SET,
4430 .off1 = offsetof(struct thread_options, new_group),
4431 .help = "Mark the start of a new group (for reporting)",
4432 .category = FIO_OPT_C_GENERAL,
4433 .group = FIO_OPT_G_PROCESS,
4438 .type = FIO_OPT_STR_SET,
4439 .off1 = offsetof(struct thread_options, use_thread),
4440 .help = "Use threads instead of processes",
4441 #ifdef CONFIG_NO_SHM
4445 .category = FIO_OPT_C_GENERAL,
4446 .group = FIO_OPT_G_PROCESS,
4449 .name = "per_job_logs",
4450 .lname = "Per Job Logs",
4451 .type = FIO_OPT_BOOL,
4452 .off1 = offsetof(struct thread_options, per_job_logs),
4453 .help = "Include job number in generated log files or not",
4455 .category = FIO_OPT_C_LOG,
4456 .group = FIO_OPT_G_INVALID,
4459 .name = "write_bw_log",
4460 .lname = "Write bandwidth log",
4461 .type = FIO_OPT_STR,
4462 .off1 = offsetof(struct thread_options, bw_log_file),
4463 .cb = str_write_bw_log_cb,
4464 .help = "Write log of bandwidth during run",
4465 .category = FIO_OPT_C_LOG,
4466 .group = FIO_OPT_G_INVALID,
4469 .name = "write_lat_log",
4470 .lname = "Write latency log",
4471 .type = FIO_OPT_STR,
4472 .off1 = offsetof(struct thread_options, lat_log_file),
4473 .cb = str_write_lat_log_cb,
4474 .help = "Write log of latency during run",
4475 .category = FIO_OPT_C_LOG,
4476 .group = FIO_OPT_G_INVALID,
4479 .name = "write_iops_log",
4480 .lname = "Write IOPS log",
4481 .type = FIO_OPT_STR,
4482 .off1 = offsetof(struct thread_options, iops_log_file),
4483 .cb = str_write_iops_log_cb,
4484 .help = "Write log of IOPS during run",
4485 .category = FIO_OPT_C_LOG,
4486 .group = FIO_OPT_G_INVALID,
4489 .name = "log_entries",
4490 .lname = "Log entries",
4491 .type = FIO_OPT_INT,
4492 .off1 = offsetof(struct thread_options, log_entries),
4493 .help = "Initial number of entries in a job IO log",
4494 .def = __fio_stringify(DEF_LOG_ENTRIES),
4495 .minval = DEF_LOG_ENTRIES,
4496 .maxval = MAX_LOG_ENTRIES,
4497 .category = FIO_OPT_C_LOG,
4498 .group = FIO_OPT_G_INVALID,
4501 .name = "log_avg_msec",
4502 .lname = "Log averaging (msec)",
4503 .type = FIO_OPT_INT,
4504 .off1 = offsetof(struct thread_options, log_avg_msec),
4505 .help = "Average bw/iops/lat logs over this period of time",
4507 .category = FIO_OPT_C_LOG,
4508 .group = FIO_OPT_G_INVALID,
4511 .name = "log_hist_msec",
4512 .lname = "Log histograms (msec)",
4513 .type = FIO_OPT_INT,
4514 .off1 = offsetof(struct thread_options, log_hist_msec),
4515 .help = "Dump completion latency histograms at frequency of this time value",
4517 .category = FIO_OPT_C_LOG,
4518 .group = FIO_OPT_G_INVALID,
4521 .name = "log_hist_coarseness",
4522 .lname = "Histogram logs coarseness",
4523 .type = FIO_OPT_INT,
4524 .off1 = offsetof(struct thread_options, log_hist_coarseness),
4525 .help = "Integer in range [0,6]. Higher coarseness outputs"
4526 " fewer histogram bins per sample. The number of bins for"
4527 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
4529 .category = FIO_OPT_C_LOG,
4530 .group = FIO_OPT_G_INVALID,
4533 .name = "write_hist_log",
4534 .lname = "Write latency histogram logs",
4535 .type = FIO_OPT_STR,
4536 .off1 = offsetof(struct thread_options, hist_log_file),
4537 .cb = str_write_hist_log_cb,
4538 .help = "Write log of latency histograms during run",
4539 .category = FIO_OPT_C_LOG,
4540 .group = FIO_OPT_G_INVALID,
4543 .name = "log_window_value",
4544 .alias = "log_max_value",
4545 .lname = "Log maximum, average or both values",
4546 .type = FIO_OPT_STR,
4547 .off1 = offsetof(struct thread_options, log_max),
4548 .help = "Log max, average or both sample in a window",
4550 .category = FIO_OPT_C_LOG,
4551 .group = FIO_OPT_G_INVALID,
4554 .oval = IO_LOG_SAMPLE_AVG,
4555 .help = "Log average value over the window",
4558 .oval = IO_LOG_SAMPLE_MAX,
4559 .help = "Log maximum value in the window",
4562 .oval = IO_LOG_SAMPLE_BOTH,
4563 .help = "Log both average and maximum values over the window"
4565 /* Compatibility with former boolean values */
4567 .oval = IO_LOG_SAMPLE_AVG,
4568 .help = "Alias for 'avg'",
4571 .oval = IO_LOG_SAMPLE_MAX,
4572 .help = "Alias for 'max'",
4577 .name = "log_offset",
4578 .lname = "Log offset of IO",
4579 .type = FIO_OPT_BOOL,
4580 .off1 = offsetof(struct thread_options, log_offset),
4581 .help = "Include offset of IO for each log entry",
4583 .category = FIO_OPT_C_LOG,
4584 .group = FIO_OPT_G_INVALID,
4588 .lname = "Log priority of IO",
4589 .type = FIO_OPT_BOOL,
4590 .off1 = offsetof(struct thread_options, log_prio),
4591 .help = "Include priority value of IO for each log entry",
4593 .category = FIO_OPT_C_LOG,
4594 .group = FIO_OPT_G_INVALID,
4598 .name = "log_compression",
4599 .lname = "Log compression",
4600 .type = FIO_OPT_INT,
4601 .off1 = offsetof(struct thread_options, log_gz),
4602 .help = "Log in compressed chunks of this size",
4604 .maxval = 512 * 1024 * 1024ULL,
4605 .category = FIO_OPT_C_LOG,
4606 .group = FIO_OPT_G_INVALID,
4608 #ifdef FIO_HAVE_CPU_AFFINITY
4610 .name = "log_compression_cpus",
4611 .lname = "Log Compression CPUs",
4612 .type = FIO_OPT_STR,
4613 .cb = str_log_cpus_allowed_cb,
4614 .off1 = offsetof(struct thread_options, log_gz_cpumask),
4615 .parent = "log_compression",
4616 .help = "Limit log compression to these CPUs",
4617 .category = FIO_OPT_C_LOG,
4618 .group = FIO_OPT_G_INVALID,
4622 .name = "log_compression_cpus",
4623 .lname = "Log Compression CPUs",
4624 .type = FIO_OPT_UNSUPPORTED,
4625 .help = "Your platform does not support CPU affinities",
4629 .name = "log_store_compressed",
4630 .lname = "Log store compressed",
4631 .type = FIO_OPT_BOOL,
4632 .off1 = offsetof(struct thread_options, log_gz_store),
4633 .help = "Store logs in a compressed format",
4634 .category = FIO_OPT_C_LOG,
4635 .group = FIO_OPT_G_INVALID,
4639 .name = "log_compression",
4640 .lname = "Log compression",
4641 .type = FIO_OPT_UNSUPPORTED,
4642 .help = "Install libz-dev(el) to get compression support",
4645 .name = "log_store_compressed",
4646 .lname = "Log store compressed",
4647 .type = FIO_OPT_UNSUPPORTED,
4648 .help = "Install libz-dev(el) to get compression support",
4652 .name = "log_alternate_epoch",
4653 .alias = "log_unix_epoch",
4654 .lname = "Log epoch alternate",
4655 .type = FIO_OPT_BOOL,
4656 .off1 = offsetof(struct thread_options, log_alternate_epoch),
4657 .help = "Use alternate epoch time in log files. Uses the same epoch as that is used by clock_gettime with specified log_alternate_epoch_clock_id.",
4658 .category = FIO_OPT_C_LOG,
4659 .group = FIO_OPT_G_INVALID,
4662 .name = "log_alternate_epoch_clock_id",
4663 .lname = "Log alternate epoch clock_id",
4664 .type = FIO_OPT_INT,
4665 .off1 = offsetof(struct thread_options, log_alternate_epoch_clock_id),
4666 .help = "If log_alternate_epoch is true, this option specifies the clock_id from clock_gettime whose epoch should be used. If log_alternate_epoch is false, this option has no effect. Default value is 0, or CLOCK_REALTIME",
4667 .category = FIO_OPT_C_LOG,
4668 .group = FIO_OPT_G_INVALID,
4671 .name = "block_error_percentiles",
4672 .lname = "Block error percentiles",
4673 .type = FIO_OPT_BOOL,
4674 .off1 = offsetof(struct thread_options, block_error_hist),
4675 .help = "Record trim block errors and make a histogram",
4677 .category = FIO_OPT_C_LOG,
4678 .group = FIO_OPT_G_INVALID,
4681 .name = "bwavgtime",
4682 .lname = "Bandwidth average time",
4683 .type = FIO_OPT_INT,
4684 .off1 = offsetof(struct thread_options, bw_avg_time),
4685 .help = "Time window over which to calculate bandwidth"
4688 .parent = "write_bw_log",
4691 .category = FIO_OPT_C_LOG,
4692 .group = FIO_OPT_G_INVALID,
4695 .name = "iopsavgtime",
4696 .lname = "IOPS average time",
4697 .type = FIO_OPT_INT,
4698 .off1 = offsetof(struct thread_options, iops_avg_time),
4699 .help = "Time window over which to calculate IOPS (msec)",
4701 .parent = "write_iops_log",
4704 .category = FIO_OPT_C_LOG,
4705 .group = FIO_OPT_G_INVALID,
4708 .name = "group_reporting",
4709 .lname = "Group reporting",
4710 .type = FIO_OPT_STR_SET,
4711 .off1 = offsetof(struct thread_options, group_reporting),
4712 .help = "Do reporting on a per-group basis",
4713 .category = FIO_OPT_C_STAT,
4714 .group = FIO_OPT_G_INVALID,
4719 .type = FIO_OPT_BOOL,
4720 .off1 = offsetof(struct thread_options, stats),
4721 .help = "Enable collection of stats",
4723 .category = FIO_OPT_C_STAT,
4724 .group = FIO_OPT_G_INVALID,
4727 .name = "zero_buffers",
4728 .lname = "Zero I/O buffers",
4729 .type = FIO_OPT_STR_SET,
4730 .off1 = offsetof(struct thread_options, zero_buffers),
4731 .help = "Init IO buffers to all zeroes",
4732 .category = FIO_OPT_C_IO,
4733 .group = FIO_OPT_G_IO_BUF,
4736 .name = "refill_buffers",
4737 .lname = "Refill I/O buffers",
4738 .type = FIO_OPT_STR_SET,
4739 .off1 = offsetof(struct thread_options, refill_buffers),
4740 .help = "Refill IO buffers on every IO submit",
4741 .category = FIO_OPT_C_IO,
4742 .group = FIO_OPT_G_IO_BUF,
4745 .name = "scramble_buffers",
4746 .lname = "Scramble I/O buffers",
4747 .type = FIO_OPT_BOOL,
4748 .off1 = offsetof(struct thread_options, scramble_buffers),
4749 .help = "Slightly scramble buffers on every IO submit",
4751 .category = FIO_OPT_C_IO,
4752 .group = FIO_OPT_G_IO_BUF,
4755 .name = "buffer_pattern",
4756 .lname = "Buffer pattern",
4757 .type = FIO_OPT_STR,
4758 .cb = str_buffer_pattern_cb,
4759 .off1 = offsetof(struct thread_options, buffer_pattern),
4760 .help = "Fill pattern for IO buffers",
4761 .category = FIO_OPT_C_IO,
4762 .group = FIO_OPT_G_IO_BUF,
4765 .name = "buffer_compress_percentage",
4766 .lname = "Buffer compression percentage",
4767 .type = FIO_OPT_INT,
4768 .cb = str_buffer_compress_cb,
4769 .off1 = offsetof(struct thread_options, compress_percentage),
4772 .help = "How compressible the buffer is (approximately)",
4774 .category = FIO_OPT_C_IO,
4775 .group = FIO_OPT_G_IO_BUF,
4778 .name = "buffer_compress_chunk",
4779 .lname = "Buffer compression chunk size",
4780 .type = FIO_OPT_INT,
4781 .off1 = offsetof(struct thread_options, compress_chunk),
4782 .parent = "buffer_compress_percentage",
4784 .help = "Size of compressible region in buffer",
4787 .category = FIO_OPT_C_IO,
4788 .group = FIO_OPT_G_IO_BUF,
4791 .name = "dedupe_percentage",
4792 .lname = "Dedupe percentage",
4793 .type = FIO_OPT_INT,
4794 .cb = str_dedupe_cb,
4795 .off1 = offsetof(struct thread_options, dedupe_percentage),
4798 .help = "Percentage of buffers that are dedupable",
4800 .category = FIO_OPT_C_IO,
4801 .group = FIO_OPT_G_IO_BUF,
4804 .name = "dedupe_global",
4805 .lname = "Global deduplication",
4806 .type = FIO_OPT_BOOL,
4807 .off1 = offsetof(struct thread_options, dedupe_global),
4808 .help = "Share deduplication buffers across jobs",
4810 .category = FIO_OPT_C_IO,
4811 .group = FIO_OPT_G_IO_BUF,
4814 .name = "dedupe_mode",
4815 .lname = "Dedupe mode",
4816 .help = "Mode for the deduplication buffer generation",
4817 .type = FIO_OPT_STR,
4818 .off1 = offsetof(struct thread_options, dedupe_mode),
4819 .parent = "dedupe_percentage",
4821 .category = FIO_OPT_C_IO,
4822 .group = FIO_OPT_G_IO_BUF,
4825 .oval = DEDUPE_MODE_REPEAT,
4826 .help = "repeat previous page",
4828 { .ival = "working_set",
4829 .oval = DEDUPE_MODE_WORKING_SET,
4830 .help = "choose a page randomly from limited working set defined in dedupe_working_set_percentage",
4835 .name = "dedupe_working_set_percentage",
4836 .lname = "Dedupe working set percentage",
4837 .help = "Dedupe working set size in percentages from file or device size used to generate dedupe patterns from",
4838 .type = FIO_OPT_INT,
4839 .off1 = offsetof(struct thread_options, dedupe_working_set_percentage),
4840 .parent = "dedupe_percentage",
4844 .category = FIO_OPT_C_IO,
4845 .group = FIO_OPT_G_IO_BUF,
4848 .name = "clat_percentiles",
4849 .lname = "Completion latency percentiles",
4850 .type = FIO_OPT_BOOL,
4851 .off1 = offsetof(struct thread_options, clat_percentiles),
4852 .help = "Enable the reporting of completion latency percentiles",
4854 .category = FIO_OPT_C_STAT,
4855 .group = FIO_OPT_G_INVALID,
4858 .name = "lat_percentiles",
4859 .lname = "IO latency percentiles",
4860 .type = FIO_OPT_BOOL,
4861 .off1 = offsetof(struct thread_options, lat_percentiles),
4862 .help = "Enable the reporting of IO latency percentiles",
4864 .category = FIO_OPT_C_STAT,
4865 .group = FIO_OPT_G_INVALID,
4868 .name = "slat_percentiles",
4869 .lname = "Submission latency percentiles",
4870 .type = FIO_OPT_BOOL,
4871 .off1 = offsetof(struct thread_options, slat_percentiles),
4872 .help = "Enable the reporting of submission latency percentiles",
4874 .category = FIO_OPT_C_STAT,
4875 .group = FIO_OPT_G_INVALID,
4878 .name = "percentile_list",
4879 .lname = "Percentile list",
4880 .type = FIO_OPT_FLOAT_LIST,
4881 .off1 = offsetof(struct thread_options, percentile_list),
4882 .off2 = offsetof(struct thread_options, percentile_precision),
4883 .help = "Specify a custom list of percentiles to report for "
4884 "completion latency and block errors",
4885 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
4886 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4889 .category = FIO_OPT_C_STAT,
4890 .group = FIO_OPT_G_INVALID,
4893 .name = "significant_figures",
4894 .lname = "Significant figures",
4895 .type = FIO_OPT_INT,
4896 .off1 = offsetof(struct thread_options, sig_figs),
4899 .help = "Significant figures for output-format set to normal",
4902 .category = FIO_OPT_C_STAT,
4903 .group = FIO_OPT_G_INVALID,
4906 #ifdef FIO_HAVE_DISK_UTIL
4908 .name = "disk_util",
4909 .lname = "Disk utilization",
4910 .type = FIO_OPT_BOOL,
4911 .off1 = offsetof(struct thread_options, do_disk_util),
4912 .help = "Log disk utilization statistics",
4914 .category = FIO_OPT_C_STAT,
4915 .group = FIO_OPT_G_INVALID,
4919 .name = "disk_util",
4920 .lname = "Disk utilization",
4921 .type = FIO_OPT_UNSUPPORTED,
4922 .help = "Your platform does not support disk utilization",
4926 .name = "gtod_reduce",
4927 .lname = "Reduce gettimeofday() calls",
4928 .type = FIO_OPT_BOOL,
4929 .help = "Greatly reduce number of gettimeofday() calls",
4930 .cb = str_gtod_reduce_cb,
4933 .category = FIO_OPT_C_STAT,
4934 .group = FIO_OPT_G_INVALID,
4937 .name = "disable_lat",
4938 .lname = "Disable all latency stats",
4939 .type = FIO_OPT_BOOL,
4940 .off1 = offsetof(struct thread_options, disable_lat),
4941 .help = "Disable latency numbers",
4942 .parent = "gtod_reduce",
4945 .category = FIO_OPT_C_STAT,
4946 .group = FIO_OPT_G_INVALID,
4949 .name = "disable_clat",
4950 .lname = "Disable completion latency stats",
4951 .type = FIO_OPT_BOOL,
4952 .off1 = offsetof(struct thread_options, disable_clat),
4953 .help = "Disable completion latency numbers",
4954 .parent = "gtod_reduce",
4957 .category = FIO_OPT_C_STAT,
4958 .group = FIO_OPT_G_INVALID,
4961 .name = "disable_slat",
4962 .lname = "Disable submission latency stats",
4963 .type = FIO_OPT_BOOL,
4964 .off1 = offsetof(struct thread_options, disable_slat),
4965 .help = "Disable submission latency numbers",
4966 .parent = "gtod_reduce",
4969 .category = FIO_OPT_C_STAT,
4970 .group = FIO_OPT_G_INVALID,
4973 .name = "disable_bw_measurement",
4974 .alias = "disable_bw",
4975 .lname = "Disable bandwidth stats",
4976 .type = FIO_OPT_BOOL,
4977 .off1 = offsetof(struct thread_options, disable_bw),
4978 .help = "Disable bandwidth logging",
4979 .parent = "gtod_reduce",
4982 .category = FIO_OPT_C_STAT,
4983 .group = FIO_OPT_G_INVALID,
4987 .lname = "Dedicated gettimeofday() CPU",
4988 .type = FIO_OPT_INT,
4989 .off1 = offsetof(struct thread_options, gtod_cpu),
4990 .help = "Set up dedicated gettimeofday() thread on this CPU",
4991 .verify = gtod_cpu_verify,
4992 .category = FIO_OPT_C_GENERAL,
4993 .group = FIO_OPT_G_CLOCK,
4996 .name = "job_start_clock_id",
4997 .lname = "Job start clock_id",
4998 .type = FIO_OPT_INT,
4999 .off1 = offsetof(struct thread_options, job_start_clock_id),
5000 .help = "The clock_id passed to the call to clock_gettime used to record job_start in the json output format. Default is 0, or CLOCK_REALTIME",
5001 .verify = gtod_cpu_verify,
5002 .category = FIO_OPT_C_GENERAL,
5003 .group = FIO_OPT_G_CLOCK,
5006 .name = "unified_rw_reporting",
5007 .lname = "Unified RW Reporting",
5008 .type = FIO_OPT_STR,
5009 .off1 = offsetof(struct thread_options, unified_rw_rep),
5010 .help = "Unify reporting across data direction",
5012 .category = FIO_OPT_C_GENERAL,
5013 .group = FIO_OPT_G_INVALID,
5016 .oval = UNIFIED_SPLIT,
5017 .help = "Normal statistics reporting",
5020 .oval = UNIFIED_MIXED,
5021 .help = "Statistics are summed per data direction and reported together",
5024 .oval = UNIFIED_BOTH,
5025 .help = "Statistics are reported normally, followed by the mixed statistics"
5027 /* Compatibility with former boolean values */
5029 .oval = UNIFIED_SPLIT,
5030 .help = "Alias for 'none'",
5033 .oval = UNIFIED_MIXED,
5034 .help = "Alias for 'mixed'",
5037 .oval = UNIFIED_BOTH,
5038 .help = "Alias for 'both'",
5043 .name = "continue_on_error",
5044 .lname = "Continue on error",
5045 .type = FIO_OPT_STR,
5046 .off1 = offsetof(struct thread_options, continue_on_error),
5047 .help = "Continue on non-fatal errors during IO",
5049 .category = FIO_OPT_C_GENERAL,
5050 .group = FIO_OPT_G_ERR,
5053 .oval = ERROR_TYPE_NONE,
5054 .help = "Exit when an error is encountered",
5057 .oval = ERROR_TYPE_READ,
5058 .help = "Continue on read errors only",
5061 .oval = ERROR_TYPE_WRITE,
5062 .help = "Continue on write errors only",
5065 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
5066 .help = "Continue on any IO errors",
5069 .oval = ERROR_TYPE_VERIFY,
5070 .help = "Continue on verify errors only",
5073 .oval = ERROR_TYPE_ANY,
5074 .help = "Continue on all io and verify errors",
5077 .oval = ERROR_TYPE_NONE,
5078 .help = "Alias for 'none'",
5081 .oval = ERROR_TYPE_ANY,
5082 .help = "Alias for 'all'",
5087 .name = "ignore_error",
5088 .lname = "Ignore Error",
5089 .type = FIO_OPT_STR,
5090 .cb = str_ignore_error_cb,
5091 .off1 = offsetof(struct thread_options, ignore_error_nr),
5092 .help = "Set a specific list of errors to ignore",
5094 .category = FIO_OPT_C_GENERAL,
5095 .group = FIO_OPT_G_ERR,
5098 .name = "error_dump",
5099 .lname = "Error Dump",
5100 .type = FIO_OPT_BOOL,
5101 .off1 = offsetof(struct thread_options, error_dump),
5103 .help = "Dump info on each error",
5104 .category = FIO_OPT_C_GENERAL,
5105 .group = FIO_OPT_G_ERR,
5110 .type = FIO_OPT_STR_STORE,
5111 .off1 = offsetof(struct thread_options, profile),
5112 .help = "Select a specific builtin performance test",
5113 .category = FIO_OPT_C_PROFILE,
5114 .group = FIO_OPT_G_INVALID,
5119 .type = FIO_OPT_STR_STORE,
5120 .off1 = offsetof(struct thread_options, cgroup),
5121 .help = "Add job to cgroup of this name",
5122 .category = FIO_OPT_C_GENERAL,
5123 .group = FIO_OPT_G_CGROUP,
5126 .name = "cgroup_nodelete",
5127 .lname = "Cgroup no-delete",
5128 .type = FIO_OPT_BOOL,
5129 .off1 = offsetof(struct thread_options, cgroup_nodelete),
5130 .help = "Do not delete cgroups after job completion",
5133 .category = FIO_OPT_C_GENERAL,
5134 .group = FIO_OPT_G_CGROUP,
5137 .name = "cgroup_weight",
5138 .lname = "Cgroup weight",
5139 .type = FIO_OPT_INT,
5140 .off1 = offsetof(struct thread_options, cgroup_weight),
5141 .help = "Use given weight for cgroup",
5145 .category = FIO_OPT_C_GENERAL,
5146 .group = FIO_OPT_G_CGROUP,
5151 .type = FIO_OPT_INT,
5152 .off1 = offsetof(struct thread_options, uid),
5153 .help = "Run job with this user ID",
5154 .category = FIO_OPT_C_GENERAL,
5155 .group = FIO_OPT_G_CRED,
5159 .lname = "Group ID",
5160 .type = FIO_OPT_INT,
5161 .off1 = offsetof(struct thread_options, gid),
5162 .help = "Run job with this group ID",
5163 .category = FIO_OPT_C_GENERAL,
5164 .group = FIO_OPT_G_CRED,
5169 .type = FIO_OPT_STR,
5170 .off1 = offsetof(struct thread_options, kb_base),
5176 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
5180 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
5183 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
5184 .category = FIO_OPT_C_GENERAL,
5185 .group = FIO_OPT_G_INVALID,
5188 .name = "unit_base",
5189 .lname = "Unit for quantities of data (Bits or Bytes)",
5190 .type = FIO_OPT_STR,
5191 .off1 = offsetof(struct thread_options, unit_base),
5196 .help = "Auto-detect",
5199 .oval = N2S_BYTEPERSEC,
5200 .help = "Normal (byte based)",
5203 .oval = N2S_BITPERSEC,
5204 .help = "Bit based",
5207 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
5208 .category = FIO_OPT_C_GENERAL,
5209 .group = FIO_OPT_G_INVALID,
5212 .name = "hugepage-size",
5213 .lname = "Hugepage size",
5214 .type = FIO_OPT_INT,
5215 .off1 = offsetof(struct thread_options, hugepage_size),
5216 .help = "When using hugepages, specify size of each page",
5217 .def = __fio_stringify(FIO_HUGE_PAGE),
5218 .interval = 1024 * 1024,
5219 .category = FIO_OPT_C_GENERAL,
5220 .group = FIO_OPT_G_INVALID,
5224 .lname = "I/O flow ID",
5225 .type = FIO_OPT_INT,
5226 .off1 = offsetof(struct thread_options, flow_id),
5227 .help = "The flow index ID to use",
5229 .category = FIO_OPT_C_IO,
5230 .group = FIO_OPT_G_IO_FLOW,
5234 .lname = "I/O flow weight",
5235 .type = FIO_OPT_INT,
5236 .off1 = offsetof(struct thread_options, flow),
5237 .help = "Weight for flow control of this job",
5238 .parent = "flow_id",
5241 .maxval = FLOW_MAX_WEIGHT,
5242 .category = FIO_OPT_C_IO,
5243 .group = FIO_OPT_G_IO_FLOW,
5246 .name = "flow_watermark",
5247 .lname = "I/O flow watermark",
5248 .type = FIO_OPT_SOFT_DEPRECATED,
5249 .category = FIO_OPT_C_IO,
5250 .group = FIO_OPT_G_IO_FLOW,
5253 .name = "flow_sleep",
5254 .lname = "I/O flow sleep",
5255 .type = FIO_OPT_INT,
5256 .off1 = offsetof(struct thread_options, flow_sleep),
5257 .help = "How many microseconds to sleep after being held"
5258 " back by the flow control mechanism",
5259 .parent = "flow_id",
5262 .category = FIO_OPT_C_IO,
5263 .group = FIO_OPT_G_IO_FLOW,
5266 .name = "steadystate",
5267 .lname = "Steady state threshold",
5269 .type = FIO_OPT_STR,
5270 .off1 = offsetof(struct thread_options, ss_state),
5271 .cb = str_steadystate_cb,
5272 .help = "Define the criterion and limit to judge when a job has reached steady state",
5273 .def = "iops_slope:0.01%",
5276 .oval = FIO_SS_IOPS,
5277 .help = "maximum mean deviation of IOPS measurements",
5279 { .ival = "iops_slope",
5280 .oval = FIO_SS_IOPS_SLOPE,
5281 .help = "slope calculated from IOPS measurements",
5285 .help = "maximum mean deviation of bandwidth measurements",
5289 .oval = FIO_SS_BW_SLOPE,
5290 .help = "slope calculated from bandwidth measurements",
5293 .category = FIO_OPT_C_GENERAL,
5294 .group = FIO_OPT_G_RUNTIME,
5297 .name = "steadystate_duration",
5298 .lname = "Steady state duration",
5300 .parent = "steadystate",
5301 .type = FIO_OPT_STR_VAL_TIME,
5302 .off1 = offsetof(struct thread_options, ss_dur),
5303 .help = "Stop workload upon attaining steady state for specified duration",
5307 .category = FIO_OPT_C_GENERAL,
5308 .group = FIO_OPT_G_RUNTIME,
5311 .name = "steadystate_ramp_time",
5312 .lname = "Steady state ramp time",
5314 .parent = "steadystate",
5315 .type = FIO_OPT_STR_VAL_TIME,
5316 .off1 = offsetof(struct thread_options, ss_ramp_time),
5317 .help = "Delay before initiation of data collection for steady state job termination testing",
5321 .category = FIO_OPT_C_GENERAL,
5322 .group = FIO_OPT_G_RUNTIME,
5325 .name = "steadystate_check_interval",
5326 .lname = "Steady state check interval",
5327 .alias = "ss_interval",
5328 .parent = "steadystate",
5329 .type = FIO_OPT_STR_VAL_TIME,
5330 .off1 = offsetof(struct thread_options, ss_check_interval),
5331 .help = "Polling interval for the steady state check (too low means steadystate will not converge)",
5335 .category = FIO_OPT_C_GENERAL,
5336 .group = FIO_OPT_G_RUNTIME,
5343 static void add_to_lopt(struct option *lopt, struct fio_option *o,
5344 const char *name, int val)
5346 lopt->name = (char *) name;
5348 if (o->type == FIO_OPT_STR_SET)
5349 lopt->has_arg = optional_argument;
5351 lopt->has_arg = required_argument;
5354 static void options_to_lopts(struct fio_option *opts,
5355 struct option *long_options,
5356 int i, int option_type)
5358 struct fio_option *o = &opts[0];
5360 add_to_lopt(&long_options[i], o, o->name, option_type);
5363 add_to_lopt(&long_options[i], o, o->alias, option_type);
5368 assert(i < FIO_NR_OPTIONS);
5372 void fio_options_set_ioengine_opts(struct option *long_options,
5373 struct thread_data *td)
5378 while (long_options[i].name) {
5379 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
5380 memset(&long_options[i], 0, sizeof(*long_options));
5387 * Just clear out the prior ioengine options.
5392 options_to_lopts(td->io_ops->options, long_options, i,
5393 FIO_GETOPT_IOENGINE);
5396 void fio_options_dup_and_init(struct option *long_options)
5400 options_init(fio_options);
5403 while (long_options[i].name)
5406 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
5409 struct fio_keyword {
5415 static struct fio_keyword fio_keywords[] = {
5417 .word = "$pagesize",
5418 .desc = "Page size in the system",
5421 .word = "$mb_memory",
5422 .desc = "Megabytes of memory online",
5426 .desc = "Number of CPUs online in the system",
5433 void fio_keywords_exit(void)
5435 struct fio_keyword *kw;
5437 kw = &fio_keywords[0];
5445 void fio_keywords_init(void)
5447 unsigned long long mb_memory;
5451 sprintf(buf, "%lu", (unsigned long) page_size);
5452 fio_keywords[0].replace = strdup(buf);
5454 mb_memory = os_phys_mem() / (1024 * 1024);
5455 sprintf(buf, "%llu", mb_memory);
5456 fio_keywords[1].replace = strdup(buf);
5458 l = cpus_configured();
5459 sprintf(buf, "%lu", l);
5460 fio_keywords[2].replace = strdup(buf);
5465 static char *bc_calc(char *str)
5467 char buf[128], *tmp;
5472 * No math, just return string
5474 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
5475 !strchr(str, '/')) || strchr(str, '\''))
5479 * Split option from value, we only need to calculate the value
5481 tmp = strchr(str, '=');
5488 * Prevent buffer overflows; such a case isn't reasonable anyway
5490 if (strlen(str) >= 128 || strlen(tmp) > 100)
5493 sprintf(buf, "which %s > /dev/null", BC_APP);
5495 log_err("fio: bc is needed for performing math\n");
5499 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
5500 f = popen(buf, "r");
5504 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
5511 buf[(tmp - str) + ret - 1] = '\0';
5512 memcpy(buf, str, tmp - str);
5518 * Return a copy of the input string with substrings of the form ${VARNAME}
5519 * substituted with the value of the environment variable VARNAME. The
5520 * substitution always occurs, even if VARNAME is empty or the corresponding
5521 * environment variable undefined.
5523 char *fio_option_dup_subs(const char *opt)
5525 char out[OPT_LEN_MAX+1];
5526 char in[OPT_LEN_MAX+1];
5529 char *ch1, *ch2, *env;
5530 ssize_t nchr = OPT_LEN_MAX;
5533 if (strlen(opt) + 1 > OPT_LEN_MAX) {
5534 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
5538 snprintf(in, sizeof(in), "%s", opt);
5540 while (*inptr && nchr > 0) {
5541 if (inptr[0] == '$' && inptr[1] == '{') {
5542 ch2 = strchr(inptr, '}');
5543 if (ch2 && inptr+1 < ch2) {
5550 envlen = strlen(env);
5551 if (envlen <= nchr) {
5552 memcpy(outptr, env, envlen);
5562 *outptr++ = *inptr++;
5571 * Look for reserved variable names and replace them with real values
5573 static char *fio_keyword_replace(char *opt)
5579 for (i = 0; fio_keywords[i].word != NULL; i++) {
5580 struct fio_keyword *kw = &fio_keywords[i];
5582 while ((s = strstr(opt, kw->word)) != NULL) {
5583 char *new = calloc(strlen(opt) + 1, 1);
5589 * Copy part of the string before the keyword and
5590 * sprintf() the replacement after it.
5592 memcpy(new, opt, olen);
5593 len = sprintf(new + olen, "%s", kw->replace);
5596 * If there's more in the original string, copy that
5599 opt += olen + strlen(kw->word);
5600 /* keeps final zero thanks to calloc */
5602 memcpy(new + olen + len, opt, strlen(opt));
5605 * replace opt and free the old opt
5615 * Check for potential math and invoke bc, if possible
5623 static char **dup_and_sub_options(char **opts, int num_opts)
5626 char **opts_copy = malloc(num_opts * sizeof(*opts));
5627 for (i = 0; i < num_opts; i++) {
5628 opts_copy[i] = fio_option_dup_subs(opts[i]);
5631 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
5636 static void show_closest_option(const char *opt)
5638 int best_option, best_distance;
5647 while (name[i] != '\0' && name[i] != '=')
5652 best_distance = INT_MAX;
5654 while (fio_options[i].name) {
5655 distance = string_distance(name, fio_options[i].name);
5656 if (distance < best_distance) {
5657 best_distance = distance;
5663 if (best_option != -1 && string_distance_ok(name, best_distance) &&
5664 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
5665 log_err("Did you mean %s?\n", fio_options[best_option].name);
5670 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
5672 int i, ret, unknown;
5675 sort_options(opts, fio_options, num_opts);
5676 opts_copy = dup_and_sub_options(opts, num_opts);
5678 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
5679 const struct fio_option *o;
5680 int newret = parse_option(opts_copy[i], opts[i], fio_options,
5681 &o, &td->o, &td->opt_list);
5684 fio_option_mark_set(&td->o, o);
5692 opts_copy[i] = NULL;
5699 ret |= ioengine_load(td);
5701 sort_options(opts_copy, td->io_ops->options, num_opts);
5704 for (i = 0; i < num_opts; i++) {
5705 const struct fio_option *o = NULL;
5712 newret = parse_option(opts_copy[i], opts[i],
5713 td->io_ops->options, &o,
5714 td->eo, &td->opt_list);
5718 log_err("Bad option <%s>\n", opts[i]);
5719 show_closest_option(opts[i]);
5722 opts_copy[i] = NULL;
5730 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
5734 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
5736 const struct fio_option *o;
5738 o = find_option_c(fio_options, opt);
5740 fio_option_mark_set(&td->o, o);
5746 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
5749 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
5753 void fio_fill_default_options(struct thread_data *td)
5755 td->o.magic = OPT_MAGIC;
5756 fill_default_options(&td->o, fio_options);
5759 int fio_show_option_help(const char *opt)
5761 return show_cmd_help(fio_options, opt);
5765 * dupe FIO_OPT_STR_STORE options
5767 void fio_options_mem_dupe(struct thread_data *td)
5769 options_mem_dupe(fio_options, &td->o);
5771 if (td->eo && td->io_ops) {
5772 void *oldeo = td->eo;
5774 td->eo = malloc(td->io_ops->option_struct_size);
5775 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
5776 options_mem_dupe(td->io_ops->options, td->eo);
5780 unsigned int fio_get_kb_base(void *data)
5782 struct thread_data *td = cb_data_to_td(data);
5783 struct thread_options *o = &td->o;
5784 unsigned int kb_base = 0;
5787 * This is a hack... For private options, *data is not holding
5788 * a pointer to the thread_options, but to private data. This means
5789 * we can't safely dereference it, but magic is first so mem wise
5790 * it is valid. But this also means that if the job first sets
5791 * kb_base and expects that to be honored by private options,
5792 * it will be disappointed. We will return the global default
5795 if (o && o->magic == OPT_MAGIC)
5796 kb_base = o->kb_base;
5803 int add_option(const struct fio_option *o)
5805 struct fio_option *__o;
5814 if (opt_index + 1 == FIO_MAX_OPTS) {
5815 log_err("fio: FIO_MAX_OPTS is too small\n");
5819 memcpy(&fio_options[opt_index], o, sizeof(*o));
5820 fio_options[opt_index + 1].name = NULL;
5824 void invalidate_profile_options(const char *prof_name)
5826 struct fio_option *o;
5830 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5831 o->type = FIO_OPT_INVALID;
5832 o->prof_name = NULL;
5838 void add_opt_posval(const char *optname, const char *ival, const char *help)
5840 struct fio_option *o;
5843 o = find_option(fio_options, optname);
5847 for (i = 0; i < PARSE_MAX_VP; i++) {
5848 if (o->posval[i].ival)
5851 o->posval[i].ival = ival;
5852 o->posval[i].help = help;
5857 void del_opt_posval(const char *optname, const char *ival)
5859 struct fio_option *o;
5862 o = find_option(fio_options, optname);
5866 for (i = 0; i < PARSE_MAX_VP; i++) {
5867 if (!o->posval[i].ival)
5869 if (strcmp(o->posval[i].ival, ival))
5872 o->posval[i].ival = NULL;
5873 o->posval[i].help = NULL;
5877 void fio_options_free(struct thread_data *td)
5879 options_free(fio_options, &td->o);
5880 if (td->eo && td->io_ops && td->io_ops->options) {
5881 options_free(td->io_ops->options, td->eo);
5887 void fio_dump_options_free(struct thread_data *td)
5889 while (!flist_empty(&td->opt_list)) {
5890 struct print_option *p;
5892 p = flist_first_entry(&td->opt_list, struct print_option, list);
5893 flist_del_init(&p->list);
5900 struct fio_option *fio_option_find(const char *name)
5902 return find_option(fio_options, name);
5905 static struct fio_option *find_next_opt(struct fio_option *from,
5908 struct fio_option *opt;
5911 from = &fio_options[0];
5917 if (off1 == from->off1) {
5922 } while (from->name);
5927 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5929 unsigned int opt_off, index, offset;
5931 opt_off = opt - &fio_options[0];
5932 index = opt_off / (8 * sizeof(uint64_t));
5933 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5934 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
5937 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
5939 struct fio_option *opt, *next;
5942 while ((opt = find_next_opt(next, off1)) != NULL) {
5943 if (opt_is_set(o, opt))
5952 void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt)
5954 unsigned int opt_off, index, offset;
5956 opt_off = opt - &fio_options[0];
5957 index = opt_off / (8 * sizeof(uint64_t));
5958 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5959 o->set_options[index] |= (uint64_t)1 << offset;