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;
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
324 matches = sscanf(str, "%m[^/]/%u/%u/%u", &bs_str, &perc, &class, &level);
326 log_err("fio: invalid cmdprio_bssplit format\n");
330 if (str_to_decimal(bs_str, &bs_val, 1, o, 0, 0)) {
331 log_err("fio: split conversion failed\n");
338 entry->perc = min(perc, 100u);
341 case 1: /* bs/ case */
342 case 2: /* bs/perc case */
344 case 4: /* bs/perc/class/level case */
345 class = min(class, (unsigned int) IOPRIO_MAX_PRIO_CLASS);
346 level = min(level, (unsigned int) IOPRIO_MAX_PRIO);
347 entry->prio = ioprio_value(class, level);
350 log_err("fio: invalid cmdprio_bssplit format\n");
358 * Returns a negative integer if the first argument should be before the second
359 * argument in the sorted list. A positive integer if the first argument should
360 * be after the second argument in the sorted list. A zero if they are equal.
362 static int fio_split_prio_cmp(const void *p1, const void *p2)
364 const struct split_prio *tmp1 = p1;
365 const struct split_prio *tmp2 = p2;
367 if (tmp1->bs > tmp2->bs)
369 if (tmp1->bs < tmp2->bs)
374 int split_parse_prio_ddir(struct thread_options *o, struct split_prio **entries,
375 int *nr_entries, char *str)
377 struct split_prio *tmp_entries;
378 unsigned int nr_bssplits;
379 char *str_cpy, *p, *fname;
381 /* strsep modifies the string, dup it so that we can use strsep twice */
382 p = str_cpy = strdup(str);
387 while ((fname = strsep(&str_cpy, ":")) != NULL) {
394 if (nr_bssplits > BSSPLIT_MAX) {
395 log_err("fio: too many cmdprio_bssplit entries\n");
399 tmp_entries = calloc(nr_bssplits, sizeof(*tmp_entries));
404 while ((fname = strsep(&str, ":")) != NULL) {
405 struct split_prio *entry;
410 entry = &tmp_entries[nr_bssplits];
412 if (parse_cmdprio_bssplit_entry(o, entry, fname)) {
413 log_err("fio: failed to parse cmdprio_bssplit entry\n");
418 /* skip zero perc entries, they provide no useful information */
423 qsort(tmp_entries, nr_bssplits, sizeof(*tmp_entries),
426 *entries = tmp_entries;
427 *nr_entries = nr_bssplits;
432 static int str2error(char *str)
434 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
435 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
436 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
437 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
438 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
439 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
440 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
441 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
442 int i = 0, num = sizeof(err) / sizeof(char *);
445 if (!strcmp(err[i], str))
452 static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
459 if (etype >= ERROR_TYPE_CNT) {
460 log_err("Illegal error type\n");
464 td->o.ignore_error_nr[etype] = 4;
465 error = calloc(4, sizeof(int));
468 while ((fname = strsep(&str, ":")) != NULL) {
474 * grow struct buffer, if needed
476 if (i == td->o.ignore_error_nr[etype]) {
477 td->o.ignore_error_nr[etype] <<= 1;
478 error = realloc(error, td->o.ignore_error_nr[etype]
481 if (fname[0] == 'E') {
482 error[i] = str2error(fname);
484 error[i] = atoi(fname);
486 error[i] = -error[i];
489 log_err("Unknown error %s, please use number value\n",
491 td->o.ignore_error_nr[etype] = 0;
498 td->o.continue_on_error |= 1 << etype;
499 td->o.ignore_error_nr[etype] = i;
500 td->o.ignore_error[etype] = error;
502 td->o.ignore_error_nr[etype] = 0;
510 static int str_replay_skip_cb(void *data, const char *input)
512 struct thread_data *td = cb_data_to_td(data);
519 p = str = strdup(input);
521 strip_blank_front(&str);
522 strip_blank_end(str);
528 if (!strcmp(p, "read"))
529 td->o.replay_skip |= 1u << DDIR_READ;
530 else if (!strcmp(p, "write"))
531 td->o.replay_skip |= 1u << DDIR_WRITE;
532 else if (!strcmp(p, "trim"))
533 td->o.replay_skip |= 1u << DDIR_TRIM;
534 else if (!strcmp(p, "sync"))
535 td->o.replay_skip |= 1u << DDIR_SYNC;
537 log_err("Unknown skip type: %s\n", p);
547 static int str_ignore_error_cb(void *data, const char *input)
549 struct thread_data *td = cb_data_to_td(data);
552 enum error_type_bit type = 0;
557 p = str = strdup(input);
559 strip_blank_front(&str);
560 strip_blank_end(str);
566 ret = ignore_error_type(td, type, p);
576 static int str_rw_cb(void *data, const char *str)
578 struct thread_data *td = cb_data_to_td(data);
579 struct thread_options *o = &td->o;
588 nr = get_opt_postfix(str);
593 o->ddir_seq_nr = atoi(nr);
597 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
598 log_err("fio: rw postfix parsing failed\n");
603 o->ddir_seq_add = val;
610 static int str_mem_cb(void *data, const char *mem)
612 struct thread_data *td = cb_data_to_td(data);
614 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
615 td->o.mem_type == MEM_MMAPSHARED)
616 td->o.mmapfile = get_opt_postfix(mem);
621 static int fio_clock_source_cb(void *data, const char *str)
623 struct thread_data *td = cb_data_to_td(data);
625 fio_clock_source = td->o.clocksource;
626 fio_clock_source_set = 1;
631 static int str_rwmix_read_cb(void *data, unsigned long long *val)
633 struct thread_data *td = cb_data_to_td(data);
635 td->o.rwmix[DDIR_READ] = *val;
636 td->o.rwmix[DDIR_WRITE] = 100 - *val;
640 static int str_rwmix_write_cb(void *data, unsigned long long *val)
642 struct thread_data *td = cb_data_to_td(data);
644 td->o.rwmix[DDIR_WRITE] = *val;
645 td->o.rwmix[DDIR_READ] = 100 - *val;
649 static int str_exitall_cb(void)
651 exitall_on_terminate = true;
655 #ifdef FIO_HAVE_CPU_AFFINITY
656 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
658 unsigned int i, index, cpus_in_mask;
659 const long max_cpu = cpus_configured();
661 cpus_in_mask = fio_cpu_count(mask);
665 cpu_index = cpu_index % cpus_in_mask;
668 for (i = 0; i < max_cpu; i++) {
669 if (!fio_cpu_isset(mask, i))
672 if (cpu_index != index)
673 fio_cpu_clear(mask, i);
678 return fio_cpu_count(mask);
681 static int str_cpumask_cb(void *data, unsigned long long *val)
683 struct thread_data *td = cb_data_to_td(data);
691 ret = fio_cpuset_init(&td->o.cpumask);
693 log_err("fio: cpuset_init failed\n");
694 td_verror(td, ret, "fio_cpuset_init");
698 max_cpu = cpus_configured();
700 for (i = 0; i < sizeof(int) * 8; i++) {
701 if ((1 << i) & *val) {
703 log_err("fio: CPU %d too large (max=%ld)\n", i,
707 dprint(FD_PARSE, "set cpu allowed %d\n", i);
708 fio_cpu_set(&td->o.cpumask, i);
715 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
722 ret = fio_cpuset_init(mask);
724 log_err("fio: cpuset_init failed\n");
725 td_verror(td, ret, "fio_cpuset_init");
729 p = str = strdup(input);
731 strip_blank_front(&str);
732 strip_blank_end(str);
734 max_cpu = cpus_configured();
736 while ((cpu = strsep(&str, ",")) != NULL) {
745 while ((cpu2 = strsep(&str2, "-")) != NULL) {
755 while (icpu <= icpu2) {
756 if (icpu >= FIO_MAX_CPUS) {
757 log_err("fio: your OS only supports up to"
758 " %d CPUs\n", (int) FIO_MAX_CPUS);
762 if (icpu >= max_cpu) {
763 log_err("fio: CPU %d too large (max=%ld)\n",
769 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
770 fio_cpu_set(mask, icpu);
781 static int str_cpus_allowed_cb(void *data, const char *input)
783 struct thread_data *td = cb_data_to_td(data);
788 return set_cpus_allowed(td, &td->o.cpumask, input);
791 static int str_verify_cpus_allowed_cb(void *data, const char *input)
793 struct thread_data *td = cb_data_to_td(data);
798 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
802 static int str_log_cpus_allowed_cb(void *data, const char *input)
804 struct thread_data *td = cb_data_to_td(data);
809 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
811 #endif /* CONFIG_ZLIB */
813 #endif /* FIO_HAVE_CPU_AFFINITY */
815 #ifdef CONFIG_LIBNUMA
816 static int str_numa_cpunodes_cb(void *data, char *input)
818 struct thread_data *td = cb_data_to_td(data);
819 struct bitmask *verify_bitmask;
824 /* numa_parse_nodestring() parses a character string list
825 * of nodes into a bit mask. The bit mask is allocated by
826 * numa_allocate_nodemask(), so it should be freed by
827 * numa_free_nodemask().
829 verify_bitmask = numa_parse_nodestring(input);
830 if (verify_bitmask == NULL) {
831 log_err("fio: numa_parse_nodestring failed\n");
832 td_verror(td, 1, "str_numa_cpunodes_cb");
835 numa_free_nodemask(verify_bitmask);
837 td->o.numa_cpunodes = strdup(input);
841 static int str_numa_mpol_cb(void *data, char *input)
843 struct thread_data *td = cb_data_to_td(data);
844 const char * const policy_types[] =
845 { "default", "prefer", "bind", "interleave", "local", NULL };
848 struct bitmask *verify_bitmask;
853 nodelist = strchr(input, ':');
855 /* NUL-terminate mode */
859 for (i = 0; i <= MPOL_LOCAL; i++) {
860 if (!strcmp(input, policy_types[i])) {
861 td->o.numa_mem_mode = i;
865 if (i > MPOL_LOCAL) {
866 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
870 switch (td->o.numa_mem_mode) {
873 * Insist on a nodelist of one node only
876 char *rest = nodelist;
877 while (isdigit(*rest))
880 log_err("fio: one node only for \'prefer\'\n");
884 log_err("fio: one node is needed for \'prefer\'\n");
888 case MPOL_INTERLEAVE:
890 * Default to online nodes with memory if no nodelist
893 nodelist = strdup("all");
898 * Don't allow a nodelist
901 log_err("fio: NO nodelist for \'local\'\n");
907 * Insist on a nodelist
910 log_err("fio: a nodelist is needed for \'bind\'\n");
917 /* numa_parse_nodestring() parses a character string list
918 * of nodes into a bit mask. The bit mask is allocated by
919 * numa_allocate_nodemask(), so it should be freed by
920 * numa_free_nodemask().
922 switch (td->o.numa_mem_mode) {
924 td->o.numa_mem_prefer_node = atoi(nodelist);
926 case MPOL_INTERLEAVE:
928 verify_bitmask = numa_parse_nodestring(nodelist);
929 if (verify_bitmask == NULL) {
930 log_err("fio: numa_parse_nodestring failed\n");
931 td_verror(td, 1, "str_numa_memnodes_cb");
934 td->o.numa_memnodes = strdup(nodelist);
935 numa_free_nodemask(verify_bitmask);
950 static int str_fst_cb(void *data, const char *str)
952 struct thread_data *td = cb_data_to_td(data);
958 td->file_service_nr = 1;
960 switch (td->o.file_service_type) {
961 case FIO_FSERVICE_RANDOM:
962 case FIO_FSERVICE_RR:
963 case FIO_FSERVICE_SEQ:
964 nr = get_opt_postfix(str);
966 td->file_service_nr = atoi(nr);
971 case FIO_FSERVICE_ZIPF:
974 case FIO_FSERVICE_PARETO:
975 val = FIO_DEF_PARETO;
977 case FIO_FSERVICE_GAUSS:
981 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
988 nr = get_opt_postfix(str);
989 if (nr && !split_parse_distr(nr, &val, ¢er)) {
990 log_err("fio: file service type random postfix parsing failed\n");
997 if (center != -1 && (center < 0.00 || center > 1.00)) {
998 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
1001 td->random_center = center;
1003 switch (td->o.file_service_type) {
1004 case FIO_FSERVICE_ZIPF:
1006 log_err("fio: zipf theta must be different than 1.0\n");
1011 td->zipf_theta = val;
1013 case FIO_FSERVICE_PARETO:
1014 if (val <= 0.00 || val >= 1.00) {
1015 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1022 case FIO_FSERVICE_GAUSS:
1023 if (val < 0.00 || val >= 100.00) {
1024 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1029 td->gauss_dev = val;
1036 #ifdef CONFIG_SYNC_FILE_RANGE
1037 static int str_sfr_cb(void *data, const char *str)
1039 struct thread_data *td = cb_data_to_td(data);
1040 char *nr = get_opt_postfix(str);
1042 td->sync_file_range_nr = 1;
1044 td->sync_file_range_nr = atoi(nr);
1052 static int zone_split_ddir(struct thread_options *o, void *eo,
1053 enum fio_ddir ddir, char *str, bool absolute)
1055 unsigned int i, perc, perc_missing, sperc, sperc_missing;
1058 memset(&split, 0, sizeof(split));
1060 if (split_parse_ddir(o, &split, str, absolute, ZONESPLIT_MAX))
1065 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
1066 o->zone_split_nr[ddir] = split.nr;
1067 for (i = 0; i < split.nr; i++) {
1068 o->zone_split[ddir][i].access_perc = split.val1[i];
1070 o->zone_split[ddir][i].size = split.val2[i];
1072 o->zone_split[ddir][i].size_perc = split.val2[i];
1076 * Now check if the percentages add up, and how much is missing
1078 perc = perc_missing = 0;
1079 sperc = sperc_missing = 0;
1080 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1081 struct zone_split *zsp = &o->zone_split[ddir][i];
1083 if (zsp->access_perc == (uint8_t) -1U)
1086 perc += zsp->access_perc;
1089 if (zsp->size_perc == (uint8_t) -1U)
1092 sperc += zsp->size_perc;
1096 if (perc > 100 || sperc > 100) {
1097 log_err("fio: zone_split percentages add to more than 100%%\n");
1098 free(o->zone_split[ddir]);
1099 o->zone_split[ddir] = NULL;
1103 log_err("fio: access percentage don't add up to 100 for zoned "
1104 "random distribution (got=%u)\n", perc);
1105 free(o->zone_split[ddir]);
1106 o->zone_split[ddir] = NULL;
1111 * If values didn't have a percentage set, divide the remains between
1115 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
1117 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1118 struct zone_split *zsp = &o->zone_split[ddir][i];
1120 if (zsp->access_perc == (uint8_t) -1U)
1121 zsp->access_perc = (100 - perc) / perc_missing;
1124 if (sperc_missing) {
1125 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
1127 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1128 struct zone_split *zsp = &o->zone_split[ddir][i];
1130 if (zsp->size_perc == (uint8_t) -1U)
1131 zsp->size_perc = (100 - sperc) / sperc_missing;
1138 static int parse_zoned_distribution(struct thread_data *td, const char *input,
1141 const char *pre = absolute ? "zoned_abs:" : "zoned:";
1145 p = str = strdup(input);
1147 strip_blank_front(&str);
1148 strip_blank_end(str);
1150 /* We expect it to start like that, bail if not */
1151 if (strncmp(str, pre, strlen(pre))) {
1152 log_err("fio: mismatch in zoned input <%s>\n", str);
1158 ret = str_split_parse(td, str, zone_split_ddir, NULL, absolute);
1162 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1165 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
1167 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
1168 struct zone_split *zsp = &td->o.zone_split[i][j];
1171 dprint(FD_PARSE, "\t%d: %u/%llu\n", j,
1173 (unsigned long long) zsp->size);
1175 dprint(FD_PARSE, "\t%d: %u/%u\n", j,
1182 if (parse_dryrun()) {
1183 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1184 free(td->o.zone_split[i]);
1185 td->o.zone_split[i] = NULL;
1186 td->o.zone_split_nr[i] = 0;
1193 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1194 td->o.zone_split_nr[i] = 0;
1200 static int str_random_distribution_cb(void *data, const char *str)
1202 struct thread_data *td = cb_data_to_td(data);
1207 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1209 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1210 val = FIO_DEF_PARETO;
1211 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1213 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1214 return parse_zoned_distribution(td, str, false);
1215 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED_ABS)
1216 return parse_zoned_distribution(td, str, true);
1220 nr = get_opt_postfix(str);
1221 if (nr && !split_parse_distr(nr, &val, ¢er)) {
1222 log_err("fio: random postfix parsing failed\n");
1229 if (center != -1 && (center < 0.00 || center > 1.00)) {
1230 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
1233 td->o.random_center.u.f = center;
1235 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1237 log_err("fio: zipf theta must different than 1.0\n");
1242 td->o.zipf_theta.u.f = val;
1243 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1244 if (val <= 0.00 || val >= 1.00) {
1245 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1250 td->o.pareto_h.u.f = val;
1252 if (val < 0.00 || val >= 100.0) {
1253 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1258 td->o.gauss_dev.u.f = val;
1264 static int str_steadystate_cb(void *data, const char *str)
1266 struct thread_data *td = cb_data_to_td(data);
1272 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1273 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
1274 /* should be impossible to get here */
1275 log_err("fio: unknown steady state criterion\n");
1279 nr = get_opt_postfix(str);
1281 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1286 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1287 pct = strstr(nr, "%");
1290 strip_blank_end(nr);
1291 if (!str_to_float(nr, &val, 0)) {
1292 log_err("fio: could not parse steadystate threshold percentage\n");
1297 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1302 td->o.ss_state |= FIO_SS_PCT;
1303 td->o.ss_limit.u.f = val;
1304 } else if (td->o.ss_state & FIO_SS_IOPS) {
1305 if (!str_to_float(nr, &val, 0)) {
1306 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1311 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1316 td->o.ss_limit.u.f = val;
1317 } else { /* bandwidth criterion */
1318 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1319 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1324 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1329 td->o.ss_limit.u.f = (double) ll;
1332 td->ss.state = td->o.ss_state;
1337 * Return next name in the string. Files are separated with ':'. If the ':'
1338 * is escaped with a '\', then that ':' is part of the filename and does not
1339 * indicate a new file.
1341 char *get_next_str(char **ptr)
1346 if (!str || !strlen(str))
1352 * No colon, we are done
1354 p = strchr(str, ':');
1361 * We got a colon, but it's the first character. Skip and
1369 if (*(p - 1) != '\\') {
1375 memmove(p - 1, p, strlen(p) + 1);
1383 int get_max_str_idx(char *input)
1385 unsigned int cur_idx;
1388 p = str = strdup(input);
1389 for (cur_idx = 0; ; cur_idx++)
1390 if (get_next_str(&str) == NULL)
1398 * Returns the directory at the index, indexes > entries will be
1399 * assigned via modulo division of the index
1401 int set_name_idx(char *target, size_t tlen, char *input, int index,
1402 bool unique_filename)
1404 unsigned int cur_idx;
1406 char *fname, *str, *p;
1408 p = str = strdup(input);
1410 index %= get_max_str_idx(input);
1411 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1412 fname = get_next_str(&str);
1414 if (client_sockaddr_str[0] && unique_filename) {
1415 len = snprintf(target, tlen, "%s/%s.", fname,
1416 client_sockaddr_str);
1418 len = snprintf(target, tlen, "%s%c", fname,
1419 FIO_OS_PATH_SEPARATOR);
1421 target[tlen - 1] = '\0';
1427 char* get_name_by_idx(char *input, int index)
1429 unsigned int cur_idx;
1430 char *fname, *str, *p;
1432 p = str = strdup(input);
1434 index %= get_max_str_idx(input);
1435 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1436 fname = get_next_str(&str);
1438 fname = strdup(fname);
1444 static int str_filename_cb(void *data, const char *input)
1446 struct thread_data *td = cb_data_to_td(data);
1447 char *fname, *str, *p;
1449 p = str = strdup(input);
1451 strip_blank_front(&str);
1452 strip_blank_end(str);
1455 * Ignore what we may already have from nrfiles option.
1457 if (!td->files_index)
1460 while ((fname = get_next_str(&str)) != NULL) {
1463 add_file(td, fname, 0, 1);
1470 static int str_directory_cb(void *data, const char fio_unused *unused)
1472 struct thread_data *td = cb_data_to_td(data);
1474 char *dirname, *str, *p;
1480 p = str = strdup(td->o.directory);
1481 while ((dirname = get_next_str(&str)) != NULL) {
1482 if (lstat(dirname, &sb) < 0) {
1485 log_err("fio: %s is not a directory\n", dirname);
1486 td_verror(td, ret, "lstat");
1489 if (!S_ISDIR(sb.st_mode)) {
1490 log_err("fio: %s is not a directory\n", dirname);
1501 static int str_opendir_cb(void *data, const char fio_unused *str)
1503 struct thread_data *td = cb_data_to_td(data);
1508 if (!td->files_index)
1511 return add_dir_files(td, td->o.opendir);
1514 static int str_buffer_pattern_cb(void *data, const char *input)
1516 struct thread_data *td = cb_data_to_td(data);
1519 /* FIXME: for now buffer pattern does not support formats */
1520 ret = parse_and_fill_pattern_alloc(input, strlen(input),
1521 &td->o.buffer_pattern, NULL, NULL, NULL);
1526 td->o.buffer_pattern_bytes = ret;
1529 * If this job is doing any reading or has compression set,
1530 * ensure that we refill buffers for writes or we could be
1531 * invalidating the pattern through reads.
1533 if (!td->o.compress_percentage && !td_read(td))
1534 td->o.refill_buffers = 0;
1536 td->o.refill_buffers = 1;
1538 td->o.scramble_buffers = 0;
1539 td->o.zero_buffers = 0;
1544 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1546 struct thread_data *td = cb_data_to_td(data);
1548 td->flags |= TD_F_COMPRESS;
1549 td->o.compress_percentage = *il;
1553 static int str_dedupe_cb(void *data, unsigned long long *il)
1555 struct thread_data *td = cb_data_to_td(data);
1557 td->flags |= TD_F_COMPRESS;
1558 td->o.dedupe_percentage = *il;
1559 td->o.refill_buffers = 1;
1563 static int str_verify_pattern_cb(void *data, const char *input)
1565 struct thread_data *td = cb_data_to_td(data);
1568 td->o.verify_fmt_sz = FIO_ARRAY_SIZE(td->o.verify_fmt);
1569 ret = parse_and_fill_pattern_alloc(input, strlen(input),
1570 &td->o.verify_pattern, fmt_desc, td->o.verify_fmt,
1571 &td->o.verify_fmt_sz);
1576 td->o.verify_pattern_bytes = ret;
1578 * VERIFY_* could already be set
1580 if (!fio_option_is_set(&td->o, verify))
1581 td->o.verify = VERIFY_PATTERN;
1586 static int str_gtod_reduce_cb(void *data, int *il)
1588 struct thread_data *td = cb_data_to_td(data);
1592 * Only modify options if gtod_reduce==1
1593 * Otherwise leave settings alone.
1596 td->o.disable_lat = 1;
1597 td->o.disable_clat = 1;
1598 td->o.disable_slat = 1;
1599 td->o.disable_bw = 1;
1600 td->o.clat_percentiles = 0;
1601 td->o.lat_percentiles = 0;
1602 td->o.slat_percentiles = 0;
1603 td->ts_cache_mask = 63;
1609 static int str_offset_cb(void *data, unsigned long long *__val)
1611 struct thread_data *td = cb_data_to_td(data);
1612 unsigned long long v = *__val;
1614 if (parse_is_percent(v)) {
1615 td->o.start_offset = 0;
1616 td->o.start_offset_percent = -1ULL - v;
1617 td->o.start_offset_nz = 0;
1618 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1619 td->o.start_offset_percent);
1620 } else if (parse_is_zone(v)) {
1621 td->o.start_offset = 0;
1622 td->o.start_offset_percent = 0;
1623 td->o.start_offset_nz = v - ZONE_BASE_VAL;
1625 td->o.start_offset = v;
1630 static int str_offset_increment_cb(void *data, unsigned long long *__val)
1632 struct thread_data *td = cb_data_to_td(data);
1633 unsigned long long v = *__val;
1635 if (parse_is_percent(v)) {
1636 td->o.offset_increment = 0;
1637 td->o.offset_increment_percent = -1ULL - v;
1638 td->o.offset_increment_nz = 0;
1639 dprint(FD_PARSE, "SET offset_increment_percent %d\n",
1640 td->o.offset_increment_percent);
1641 } else if (parse_is_zone(v)) {
1642 td->o.offset_increment = 0;
1643 td->o.offset_increment_percent = 0;
1644 td->o.offset_increment_nz = v - ZONE_BASE_VAL;
1646 td->o.offset_increment = v;
1651 static int str_size_cb(void *data, unsigned long long *__val)
1653 struct thread_data *td = cb_data_to_td(data);
1654 unsigned long long v = *__val;
1656 if (parse_is_percent(v)) {
1658 td->o.size_percent = -1ULL - v;
1659 dprint(FD_PARSE, "SET size_percent %d\n",
1660 td->o.size_percent);
1661 } else if (parse_is_zone(v)) {
1663 td->o.size_percent = 0;
1664 td->o.size_nz = v - ZONE_BASE_VAL;
1671 static int str_io_size_cb(void *data, unsigned long long *__val)
1673 struct thread_data *td = cb_data_to_td(data);
1674 unsigned long long v = *__val;
1676 if (parse_is_percent_uncapped(v)) {
1678 td->o.io_size_percent = -1ULL - v;
1679 if (td->o.io_size_percent > 100) {
1680 log_err("fio: io_size values greater than 100%% aren't supported\n");
1683 dprint(FD_PARSE, "SET io_size_percent %d\n",
1684 td->o.io_size_percent);
1685 } else if (parse_is_zone(v)) {
1687 td->o.io_size_percent = 0;
1688 td->o.io_size_nz = v - ZONE_BASE_VAL;
1695 static int str_zoneskip_cb(void *data, unsigned long long *__val)
1697 struct thread_data *td = cb_data_to_td(data);
1698 unsigned long long v = *__val;
1700 if (parse_is_zone(v)) {
1701 td->o.zone_skip = 0;
1702 td->o.zone_skip_nz = v - ZONE_BASE_VAL;
1704 td->o.zone_skip = v;
1709 static int str_write_bw_log_cb(void *data, const char *str)
1711 struct thread_data *td = cb_data_to_td(data);
1714 td->o.bw_log_file = strdup(str);
1716 td->o.write_bw_log = 1;
1720 static int str_write_lat_log_cb(void *data, const char *str)
1722 struct thread_data *td = cb_data_to_td(data);
1725 td->o.lat_log_file = strdup(str);
1727 td->o.write_lat_log = 1;
1731 static int str_write_iops_log_cb(void *data, const char *str)
1733 struct thread_data *td = cb_data_to_td(data);
1736 td->o.iops_log_file = strdup(str);
1738 td->o.write_iops_log = 1;
1742 static int str_write_hist_log_cb(void *data, const char *str)
1744 struct thread_data *td = cb_data_to_td(data);
1747 td->o.hist_log_file = strdup(str);
1749 td->o.write_hist_log = 1;
1754 * str is supposed to be a substring of the strdup'd original string,
1755 * and is valid only if it's a regular file path.
1756 * This function keeps the pointer to the path as needed later.
1758 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1759 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1760 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1762 static int str_ioengine_external_cb(void *data, const char *str)
1764 struct thread_data *td = cb_data_to_td(data);
1769 log_err("fio: null external ioengine path\n");
1773 p = (char *)str; /* str is mutable */
1774 strip_blank_front(&p);
1777 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1778 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1782 td->o.ioengine_so_path = p;
1786 static int rw_verify(const struct fio_option *o, void *data)
1788 struct thread_data *td = cb_data_to_td(data);
1790 if (read_only && (td_write(td) || td_trim(td))) {
1791 log_err("fio: job <%s> has write or trim bit set, but"
1792 " fio is in read-only mode\n", td->o.name);
1799 static int gtod_cpu_verify(const struct fio_option *o, void *data)
1801 #ifndef FIO_HAVE_CPU_AFFINITY
1802 struct thread_data *td = cb_data_to_td(data);
1804 if (td->o.gtod_cpu) {
1805 log_err("fio: platform must support CPU affinity for"
1806 "gettimeofday() offloading\n");
1815 * Map of job/command line options
1817 struct fio_option fio_options[FIO_MAX_OPTS] = {
1819 .name = "description",
1820 .lname = "Description of job",
1821 .type = FIO_OPT_STR_STORE,
1822 .off1 = offsetof(struct thread_options, description),
1823 .help = "Text job description",
1824 .category = FIO_OPT_C_GENERAL,
1825 .group = FIO_OPT_G_DESC,
1829 .lname = "Job name",
1830 .type = FIO_OPT_STR_STORE,
1831 .off1 = offsetof(struct thread_options, name),
1832 .help = "Name of this job",
1833 .category = FIO_OPT_C_GENERAL,
1834 .group = FIO_OPT_G_DESC,
1838 .lname = "Waitee name",
1839 .type = FIO_OPT_STR_STORE,
1840 .off1 = offsetof(struct thread_options, wait_for),
1841 .help = "Name of the job this one wants to wait for before starting",
1842 .category = FIO_OPT_C_GENERAL,
1843 .group = FIO_OPT_G_DESC,
1847 .lname = "Filename(s)",
1848 .type = FIO_OPT_STR_STORE,
1849 .off1 = offsetof(struct thread_options, filename),
1851 .cb = str_filename_cb,
1852 .prio = -1, /* must come after "directory" */
1853 .help = "File(s) to use for the workload",
1854 .category = FIO_OPT_C_FILE,
1855 .group = FIO_OPT_G_FILENAME,
1858 .name = "directory",
1859 .lname = "Directory",
1860 .type = FIO_OPT_STR_STORE,
1861 .off1 = offsetof(struct thread_options, directory),
1862 .cb = str_directory_cb,
1863 .help = "Directory to store files in",
1864 .category = FIO_OPT_C_FILE,
1865 .group = FIO_OPT_G_FILENAME,
1868 .name = "filename_format",
1869 .lname = "Filename Format",
1870 .type = FIO_OPT_STR_STORE,
1871 .off1 = offsetof(struct thread_options, filename_format),
1872 .prio = -1, /* must come after "directory" */
1873 .help = "Override default $jobname.$jobnum.$filenum naming",
1874 .def = "$jobname.$jobnum.$filenum",
1875 .category = FIO_OPT_C_FILE,
1876 .group = FIO_OPT_G_FILENAME,
1879 .name = "unique_filename",
1880 .lname = "Unique Filename",
1881 .type = FIO_OPT_BOOL,
1882 .off1 = offsetof(struct thread_options, unique_filename),
1883 .help = "For network clients, prefix file with source IP",
1885 .category = FIO_OPT_C_FILE,
1886 .group = FIO_OPT_G_FILENAME,
1890 .lname = "Lockfile",
1891 .type = FIO_OPT_STR,
1892 .off1 = offsetof(struct thread_options, file_lock_mode),
1893 .help = "Lock file when doing IO to it",
1895 .parent = "filename",
1898 .category = FIO_OPT_C_FILE,
1899 .group = FIO_OPT_G_FILENAME,
1902 .oval = FILE_LOCK_NONE,
1903 .help = "No file locking",
1905 { .ival = "exclusive",
1906 .oval = FILE_LOCK_EXCLUSIVE,
1907 .help = "Exclusive file lock",
1910 .ival = "readwrite",
1911 .oval = FILE_LOCK_READWRITE,
1912 .help = "Read vs write lock",
1918 .lname = "Open directory",
1919 .type = FIO_OPT_STR_STORE,
1920 .off1 = offsetof(struct thread_options, opendir),
1921 .cb = str_opendir_cb,
1922 .help = "Recursively add files from this directory and down",
1923 .category = FIO_OPT_C_FILE,
1924 .group = FIO_OPT_G_FILENAME,
1928 .lname = "Read/write",
1929 .alias = "readwrite",
1930 .type = FIO_OPT_STR,
1932 .off1 = offsetof(struct thread_options, td_ddir),
1933 .help = "IO direction",
1935 .verify = rw_verify,
1936 .category = FIO_OPT_C_IO,
1937 .group = FIO_OPT_G_IO_BASIC,
1940 .oval = TD_DDIR_READ,
1941 .help = "Sequential read",
1944 .oval = TD_DDIR_WRITE,
1945 .help = "Sequential write",
1948 .oval = TD_DDIR_TRIM,
1949 .help = "Sequential trim",
1951 { .ival = "randread",
1952 .oval = TD_DDIR_RANDREAD,
1953 .help = "Random read",
1955 { .ival = "randwrite",
1956 .oval = TD_DDIR_RANDWRITE,
1957 .help = "Random write",
1959 { .ival = "randtrim",
1960 .oval = TD_DDIR_RANDTRIM,
1961 .help = "Random trim",
1965 .help = "Sequential read and write mix",
1967 { .ival = "readwrite",
1969 .help = "Sequential read and write mix",
1972 .oval = TD_DDIR_RANDRW,
1973 .help = "Random read and write mix"
1975 { .ival = "trimwrite",
1976 .oval = TD_DDIR_TRIMWRITE,
1977 .help = "Trim and write mix, trims preceding writes"
1979 { .ival = "randtrimwrite",
1980 .oval = TD_DDIR_RANDTRIMWRITE,
1981 .help = "Randomly trim and write mix, trims preceding writes"
1986 .name = "rw_sequencer",
1987 .lname = "RW Sequencer",
1988 .type = FIO_OPT_STR,
1989 .off1 = offsetof(struct thread_options, rw_seq),
1990 .help = "IO offset generator modifier",
1991 .def = "sequential",
1992 .category = FIO_OPT_C_IO,
1993 .group = FIO_OPT_G_IO_BASIC,
1995 { .ival = "sequential",
1997 .help = "Generate sequential offsets",
1999 { .ival = "identical",
2000 .oval = RW_SEQ_IDENT,
2001 .help = "Generate identical offsets",
2008 .lname = "IO Engine",
2009 .type = FIO_OPT_STR_STORE,
2010 .off1 = offsetof(struct thread_options, ioengine),
2011 .help = "IO engine to use",
2012 .def = FIO_PREFERRED_ENGINE,
2013 .category = FIO_OPT_C_IO,
2014 .group = FIO_OPT_G_IO_BASIC,
2017 .help = "Use read/write",
2020 .help = "Use pread/pwrite",
2023 .help = "Use readv/writev",
2025 #ifdef CONFIG_PWRITEV
2027 .help = "Use preadv/pwritev",
2030 #ifdef FIO_HAVE_PWRITEV2
2031 { .ival = "pvsync2",
2032 .help = "Use preadv2/pwritev2",
2035 #ifdef CONFIG_LIBAIO
2037 .help = "Linux native asynchronous IO",
2040 #ifdef ARCH_HAVE_IOURING
2041 { .ival = "io_uring",
2042 .help = "Fast Linux native aio",
2045 #ifdef CONFIG_POSIXAIO
2046 { .ival = "posixaio",
2047 .help = "POSIX asynchronous IO",
2050 #ifdef CONFIG_SOLARISAIO
2051 { .ival = "solarisaio",
2052 .help = "Solaris native asynchronous IO",
2055 #ifdef CONFIG_WINDOWSAIO
2056 { .ival = "windowsaio",
2057 .help = "Windows native asynchronous IO"
2062 .help = "Rados Block Device asynchronous IO"
2066 .help = "Memory mapped IO"
2068 #ifdef CONFIG_LINUX_SPLICE
2070 .help = "splice/vmsplice based IO",
2072 { .ival = "netsplice",
2073 .help = "splice/vmsplice to/from the network",
2076 #ifdef FIO_HAVE_SGIO
2078 .help = "SCSI generic v3 IO",
2082 .help = "Testing engine (no data transfer)",
2085 .help = "Network IO",
2088 .help = "CPU cycle burner engine",
2092 .help = "RDMA IO engine",
2095 #ifdef CONFIG_LIBRPMA_APM
2096 { .ival = "librpma_apm",
2097 .help = "librpma IO engine in APM mode",
2100 #ifdef CONFIG_LIBRPMA_GPSPM
2101 { .ival = "librpma_gpspm",
2102 .help = "librpma IO engine in GPSPM mode",
2105 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
2106 { .ival = "e4defrag",
2107 .help = "ext4 defrag engine",
2110 #ifdef CONFIG_LINUX_FALLOCATE
2112 .help = "fallocate() file based engine",
2117 .help = "Glusterfs libgfapi(sync) based engine"
2119 { .ival = "gfapi_async",
2120 .help = "Glusterfs libgfapi(async) based engine"
2123 #ifdef CONFIG_LIBHDFS
2124 { .ival = "libhdfs",
2125 .help = "Hadoop Distributed Filesystem (HDFS) engine"
2129 { .ival = "ime_psync",
2130 .help = "DDN's IME synchronous IO engine",
2132 { .ival = "ime_psyncv",
2133 .help = "DDN's IME synchronous IO engine using iovecs",
2135 { .ival = "ime_aio",
2136 .help = "DDN's IME asynchronous IO engine",
2139 #ifdef CONFIG_LINUX_DEVDAX
2140 { .ival = "dev-dax",
2141 .help = "DAX Device based IO engine",
2145 .ival = "filecreate",
2146 .help = "File creation engine",
2148 { .ival = "external",
2149 .help = "Load external engine (append name)",
2150 .cb = str_ioengine_external_cb,
2152 #ifdef CONFIG_LIBPMEM
2153 { .ival = "libpmem",
2154 .help = "PMDK libpmem based IO engine",
2159 .help = "HTTP (WebDAV/S3) IO engine",
2163 .help = "Network Block Device (NBD) IO engine"
2167 .help = "DAOS File System (dfs) IO engine",
2170 #ifdef CONFIG_LIBNFS
2172 .help = "NFS IO engine",
2175 #ifdef CONFIG_LIBXNVME
2177 .help = "XNVME IO engine",
2184 .lname = "IO Depth",
2185 .type = FIO_OPT_INT,
2186 .off1 = offsetof(struct thread_options, iodepth),
2187 .help = "Number of IO buffers to keep in flight",
2191 .category = FIO_OPT_C_IO,
2192 .group = FIO_OPT_G_IO_BASIC,
2195 .name = "iodepth_batch",
2196 .lname = "IO Depth batch",
2197 .alias = "iodepth_batch_submit",
2198 .type = FIO_OPT_INT,
2199 .off1 = offsetof(struct thread_options, iodepth_batch),
2200 .help = "Number of IO buffers to submit in one go",
2201 .parent = "iodepth",
2205 .category = FIO_OPT_C_IO,
2206 .group = FIO_OPT_G_IO_BASIC,
2209 .name = "iodepth_batch_complete_min",
2210 .lname = "Min IO depth batch complete",
2211 .alias = "iodepth_batch_complete",
2212 .type = FIO_OPT_INT,
2213 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
2214 .help = "Min number of IO buffers to retrieve in one go",
2215 .parent = "iodepth",
2220 .category = FIO_OPT_C_IO,
2221 .group = FIO_OPT_G_IO_BASIC,
2224 .name = "iodepth_batch_complete_max",
2225 .lname = "Max IO depth batch complete",
2226 .type = FIO_OPT_INT,
2227 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
2228 .help = "Max number of IO buffers to retrieve in one go",
2229 .parent = "iodepth",
2233 .category = FIO_OPT_C_IO,
2234 .group = FIO_OPT_G_IO_BASIC,
2237 .name = "iodepth_low",
2238 .lname = "IO Depth batch low",
2239 .type = FIO_OPT_INT,
2240 .off1 = offsetof(struct thread_options, iodepth_low),
2241 .help = "Low water mark for queuing depth",
2242 .parent = "iodepth",
2245 .category = FIO_OPT_C_IO,
2246 .group = FIO_OPT_G_IO_BASIC,
2249 .name = "serialize_overlap",
2250 .lname = "Serialize overlap",
2251 .off1 = offsetof(struct thread_options, serialize_overlap),
2252 .type = FIO_OPT_BOOL,
2253 .help = "Wait for in-flight IOs that collide to complete",
2254 .parent = "iodepth",
2256 .category = FIO_OPT_C_IO,
2257 .group = FIO_OPT_G_IO_BASIC,
2260 .name = "io_submit_mode",
2261 .lname = "IO submit mode",
2262 .type = FIO_OPT_STR,
2263 .off1 = offsetof(struct thread_options, io_submit_mode),
2264 .help = "How IO submissions and completions are done",
2266 .category = FIO_OPT_C_IO,
2267 .group = FIO_OPT_G_IO_BASIC,
2270 .oval = IO_MODE_INLINE,
2271 .help = "Submit and complete IO inline",
2273 { .ival = "offload",
2274 .oval = IO_MODE_OFFLOAD,
2275 .help = "Offload submit and complete to threads",
2282 .type = FIO_OPT_STR_VAL_ZONE,
2284 .off1 = offsetof(struct thread_options, size),
2285 .help = "Total size of device or files",
2286 .category = FIO_OPT_C_IO,
2287 .group = FIO_OPT_G_INVALID,
2291 .alias = "io_limit",
2293 .type = FIO_OPT_STR_VAL_ZONE,
2294 .cb = str_io_size_cb,
2295 .off1 = offsetof(struct thread_options, io_size),
2296 .help = "Total size of I/O to be performed",
2297 .category = FIO_OPT_C_IO,
2298 .group = FIO_OPT_G_INVALID,
2301 .name = "fill_device",
2302 .lname = "Fill device",
2304 .type = FIO_OPT_BOOL,
2305 .off1 = offsetof(struct thread_options, fill_device),
2306 .help = "Write until an ENOSPC error occurs",
2308 .category = FIO_OPT_C_FILE,
2309 .group = FIO_OPT_G_INVALID,
2313 .lname = "File size",
2314 .type = FIO_OPT_STR_VAL,
2315 .off1 = offsetof(struct thread_options, file_size_low),
2316 .off2 = offsetof(struct thread_options, file_size_high),
2318 .help = "Size of individual files",
2319 .interval = 1024 * 1024,
2320 .category = FIO_OPT_C_FILE,
2321 .group = FIO_OPT_G_INVALID,
2324 .name = "file_append",
2325 .lname = "File append",
2326 .type = FIO_OPT_BOOL,
2327 .off1 = offsetof(struct thread_options, file_append),
2328 .help = "IO will start at the end of the file(s)",
2330 .category = FIO_OPT_C_FILE,
2331 .group = FIO_OPT_G_INVALID,
2335 .lname = "IO offset",
2336 .alias = "fileoffset",
2337 .type = FIO_OPT_STR_VAL_ZONE,
2338 .cb = str_offset_cb,
2339 .off1 = offsetof(struct thread_options, start_offset),
2340 .help = "Start IO from this offset",
2342 .category = FIO_OPT_C_IO,
2343 .group = FIO_OPT_G_INVALID,
2346 .name = "offset_align",
2347 .lname = "IO offset alignment",
2348 .type = FIO_OPT_INT,
2349 .off1 = offsetof(struct thread_options, start_offset_align),
2350 .help = "Start IO from this offset alignment",
2353 .category = FIO_OPT_C_IO,
2354 .group = FIO_OPT_G_INVALID,
2357 .name = "offset_increment",
2358 .lname = "IO offset increment",
2359 .type = FIO_OPT_STR_VAL_ZONE,
2360 .cb = str_offset_increment_cb,
2361 .off1 = offsetof(struct thread_options, offset_increment),
2362 .help = "What is the increment from one offset to the next",
2366 .category = FIO_OPT_C_IO,
2367 .group = FIO_OPT_G_INVALID,
2370 .name = "number_ios",
2371 .lname = "Number of IOs to perform",
2372 .type = FIO_OPT_STR_VAL,
2373 .off1 = offsetof(struct thread_options, number_ios),
2374 .help = "Force job completion after this number of IOs",
2376 .category = FIO_OPT_C_IO,
2377 .group = FIO_OPT_G_INVALID,
2381 .lname = "Block size",
2382 .alias = "blocksize",
2383 .type = FIO_OPT_ULL,
2384 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2385 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2386 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2388 .help = "Block size unit",
2393 .category = FIO_OPT_C_IO,
2394 .group = FIO_OPT_G_INVALID,
2398 .lname = "Block size align",
2399 .alias = "blockalign",
2400 .type = FIO_OPT_ULL,
2401 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2402 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2403 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2405 .help = "IO block offset alignment",
2409 .category = FIO_OPT_C_IO,
2410 .group = FIO_OPT_G_INVALID,
2414 .lname = "Block size range",
2415 .alias = "blocksize_range",
2416 .type = FIO_OPT_RANGE,
2417 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2418 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2419 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2420 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2421 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2422 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2424 .help = "Set block size range (in more detail than bs)",
2428 .category = FIO_OPT_C_IO,
2429 .group = FIO_OPT_G_INVALID,
2433 .lname = "Block size split",
2434 .type = FIO_OPT_STR_ULL,
2435 .cb = str_bssplit_cb,
2436 .off1 = offsetof(struct thread_options, bssplit),
2437 .help = "Set a specific mix of block sizes",
2440 .category = FIO_OPT_C_IO,
2441 .group = FIO_OPT_G_INVALID,
2444 .name = "bs_unaligned",
2445 .lname = "Block size unaligned",
2446 .alias = "blocksize_unaligned",
2447 .type = FIO_OPT_STR_SET,
2448 .off1 = offsetof(struct thread_options, bs_unaligned),
2449 .help = "Don't sector align IO buffer sizes",
2452 .category = FIO_OPT_C_IO,
2453 .group = FIO_OPT_G_INVALID,
2456 .name = "bs_is_seq_rand",
2457 .lname = "Block size division is seq/random (not read/write)",
2458 .type = FIO_OPT_BOOL,
2459 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2460 .help = "Consider any blocksize setting to be sequential,random",
2462 .parent = "blocksize",
2463 .category = FIO_OPT_C_IO,
2464 .group = FIO_OPT_G_INVALID,
2467 .name = "randrepeat",
2468 .alias = "allrandrepeat",
2469 .lname = "Random repeatable",
2470 .type = FIO_OPT_BOOL,
2471 .off1 = offsetof(struct thread_options, rand_repeatable),
2472 .help = "Use repeatable random IO pattern",
2476 .category = FIO_OPT_C_IO,
2477 .group = FIO_OPT_G_RANDOM,
2481 .lname = "The random generator seed",
2482 .type = FIO_OPT_STR_VAL,
2483 .off1 = offsetof(struct thread_options, rand_seed),
2484 .help = "Set the random generator seed value",
2487 .category = FIO_OPT_C_IO,
2488 .group = FIO_OPT_G_RANDOM,
2491 .name = "norandommap",
2492 .lname = "No randommap",
2493 .type = FIO_OPT_STR_SET,
2494 .off1 = offsetof(struct thread_options, norandommap),
2495 .help = "Accept potential duplicate random blocks",
2499 .category = FIO_OPT_C_IO,
2500 .group = FIO_OPT_G_RANDOM,
2503 .name = "softrandommap",
2504 .lname = "Soft randommap",
2505 .type = FIO_OPT_BOOL,
2506 .off1 = offsetof(struct thread_options, softrandommap),
2507 .help = "Set norandommap if randommap allocation fails",
2508 .parent = "norandommap",
2511 .category = FIO_OPT_C_IO,
2512 .group = FIO_OPT_G_RANDOM,
2515 .name = "random_generator",
2516 .lname = "Random Generator",
2517 .type = FIO_OPT_STR,
2518 .off1 = offsetof(struct thread_options, random_generator),
2519 .help = "Type of random number generator to use",
2520 .def = "tausworthe",
2522 { .ival = "tausworthe",
2523 .oval = FIO_RAND_GEN_TAUSWORTHE,
2524 .help = "Strong Tausworthe generator",
2527 .oval = FIO_RAND_GEN_LFSR,
2528 .help = "Variable length LFSR",
2531 .ival = "tausworthe64",
2532 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2533 .help = "64-bit Tausworthe variant",
2536 .category = FIO_OPT_C_IO,
2537 .group = FIO_OPT_G_RANDOM,
2540 .name = "random_distribution",
2541 .lname = "Random Distribution",
2542 .type = FIO_OPT_STR,
2543 .off1 = offsetof(struct thread_options, random_distribution),
2544 .cb = str_random_distribution_cb,
2545 .help = "Random offset distribution generator",
2549 .oval = FIO_RAND_DIST_RANDOM,
2550 .help = "Completely random",
2553 .oval = FIO_RAND_DIST_ZIPF,
2554 .help = "Zipf distribution",
2557 .oval = FIO_RAND_DIST_PARETO,
2558 .help = "Pareto distribution",
2561 .oval = FIO_RAND_DIST_GAUSS,
2562 .help = "Normal (Gaussian) distribution",
2565 .oval = FIO_RAND_DIST_ZONED,
2566 .help = "Zoned random distribution",
2568 { .ival = "zoned_abs",
2569 .oval = FIO_RAND_DIST_ZONED_ABS,
2570 .help = "Zoned absolute random distribution",
2573 .category = FIO_OPT_C_IO,
2574 .group = FIO_OPT_G_RANDOM,
2577 .name = "percentage_random",
2578 .lname = "Percentage Random",
2579 .type = FIO_OPT_INT,
2580 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2581 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2582 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2584 .help = "Percentage of seq/random mix that should be random",
2585 .def = "100,100,100",
2587 .inverse = "percentage_sequential",
2588 .category = FIO_OPT_C_IO,
2589 .group = FIO_OPT_G_RANDOM,
2592 .name = "percentage_sequential",
2593 .lname = "Percentage Sequential",
2594 .type = FIO_OPT_DEPRECATED,
2595 .category = FIO_OPT_C_IO,
2596 .group = FIO_OPT_G_RANDOM,
2600 .lname = "Number of files",
2601 .alias = "nr_files",
2602 .type = FIO_OPT_INT,
2603 .off1 = offsetof(struct thread_options, nr_files),
2604 .help = "Split job workload between this number of files",
2607 .category = FIO_OPT_C_FILE,
2608 .group = FIO_OPT_G_INVALID,
2611 .name = "openfiles",
2612 .lname = "Number of open files",
2613 .type = FIO_OPT_INT,
2614 .off1 = offsetof(struct thread_options, open_files),
2615 .help = "Number of files to keep open at the same time",
2616 .category = FIO_OPT_C_FILE,
2617 .group = FIO_OPT_G_INVALID,
2620 .name = "file_service_type",
2621 .lname = "File service type",
2622 .type = FIO_OPT_STR,
2624 .off1 = offsetof(struct thread_options, file_service_type),
2625 .help = "How to select which file to service next",
2626 .def = "roundrobin",
2627 .category = FIO_OPT_C_FILE,
2628 .group = FIO_OPT_G_INVALID,
2631 .oval = FIO_FSERVICE_RANDOM,
2632 .help = "Choose a file at random (uniform)",
2635 .oval = FIO_FSERVICE_ZIPF,
2636 .help = "Zipf randomized",
2639 .oval = FIO_FSERVICE_PARETO,
2640 .help = "Pareto randomized",
2643 .oval = FIO_FSERVICE_GAUSS,
2644 .help = "Normal (Gaussian) randomized",
2647 .oval = FIO_FSERVICE_GAUSS,
2648 .help = "Alias for normal",
2650 { .ival = "roundrobin",
2651 .oval = FIO_FSERVICE_RR,
2652 .help = "Round robin select files",
2654 { .ival = "sequential",
2655 .oval = FIO_FSERVICE_SEQ,
2656 .help = "Finish one file before moving to the next",
2659 .parent = "nrfiles",
2663 .name = "fallocate",
2664 .lname = "Fallocate",
2665 .type = FIO_OPT_STR,
2666 .off1 = offsetof(struct thread_options, fallocate_mode),
2667 .help = "Whether pre-allocation is performed when laying out files",
2668 #ifdef FIO_HAVE_DEFAULT_FALLOCATE
2673 .category = FIO_OPT_C_FILE,
2674 .group = FIO_OPT_G_INVALID,
2677 .oval = FIO_FALLOCATE_NONE,
2678 .help = "Do not pre-allocate space",
2681 .oval = FIO_FALLOCATE_NATIVE,
2682 .help = "Use native pre-allocation if possible",
2684 #ifdef CONFIG_POSIX_FALLOCATE
2686 .oval = FIO_FALLOCATE_POSIX,
2687 .help = "Use posix_fallocate()",
2690 #ifdef CONFIG_LINUX_FALLOCATE
2692 .oval = FIO_FALLOCATE_KEEP_SIZE,
2693 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2696 { .ival = "truncate",
2697 .oval = FIO_FALLOCATE_TRUNCATE,
2698 .help = "Truncate file to final size instead of allocating"
2700 /* Compatibility with former boolean values */
2702 .oval = FIO_FALLOCATE_NONE,
2703 .help = "Alias for 'none'",
2705 #ifdef CONFIG_POSIX_FALLOCATE
2707 .oval = FIO_FALLOCATE_POSIX,
2708 .help = "Alias for 'posix'",
2714 .name = "fadvise_hint",
2715 .lname = "Fadvise hint",
2716 .type = FIO_OPT_STR,
2717 .off1 = offsetof(struct thread_options, fadvise_hint),
2721 .help = "Don't issue fadvise/madvise",
2725 .help = "Advise using fio IO pattern",
2728 .oval = F_ADV_RANDOM,
2729 .help = "Advise using FADV_RANDOM",
2731 { .ival = "sequential",
2732 .oval = F_ADV_SEQUENTIAL,
2733 .help = "Advise using FADV_SEQUENTIAL",
2735 #ifdef POSIX_FADV_NOREUSE
2736 { .ival = "noreuse",
2737 .oval = F_ADV_NOREUSE,
2738 .help = "Advise using FADV_NOREUSE",
2742 .help = "Use fadvise() to advise the kernel on IO pattern",
2744 .category = FIO_OPT_C_FILE,
2745 .group = FIO_OPT_G_INVALID,
2750 .type = FIO_OPT_INT,
2751 .off1 = offsetof(struct thread_options, fsync_blocks),
2752 .help = "Issue fsync for writes every given number of blocks",
2755 .category = FIO_OPT_C_FILE,
2756 .group = FIO_OPT_G_INVALID,
2759 .name = "fdatasync",
2760 .lname = "Fdatasync",
2761 .type = FIO_OPT_INT,
2762 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2763 .help = "Issue fdatasync for writes every given number of blocks",
2766 .category = FIO_OPT_C_FILE,
2767 .group = FIO_OPT_G_INVALID,
2770 .name = "write_barrier",
2771 .lname = "Write barrier",
2772 .type = FIO_OPT_INT,
2773 .off1 = offsetof(struct thread_options, barrier_blocks),
2774 .help = "Make every Nth write a barrier write",
2777 .category = FIO_OPT_C_IO,
2778 .group = FIO_OPT_G_INVALID,
2780 #ifdef CONFIG_SYNC_FILE_RANGE
2782 .name = "sync_file_range",
2783 .lname = "Sync file range",
2785 { .ival = "wait_before",
2786 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2787 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2791 .oval = SYNC_FILE_RANGE_WRITE,
2792 .help = "SYNC_FILE_RANGE_WRITE",
2796 .ival = "wait_after",
2797 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2798 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2802 .type = FIO_OPT_STR_MULTI,
2804 .off1 = offsetof(struct thread_options, sync_file_range),
2805 .help = "Use sync_file_range()",
2806 .category = FIO_OPT_C_FILE,
2807 .group = FIO_OPT_G_INVALID,
2811 .name = "sync_file_range",
2812 .lname = "Sync file range",
2813 .type = FIO_OPT_UNSUPPORTED,
2814 .help = "Your platform does not support sync_file_range",
2819 .lname = "Direct I/O",
2820 .type = FIO_OPT_BOOL,
2821 .off1 = offsetof(struct thread_options, odirect),
2822 .help = "Use O_DIRECT IO (negates buffered)",
2824 .inverse = "buffered",
2825 .category = FIO_OPT_C_IO,
2826 .group = FIO_OPT_G_IO_TYPE,
2830 .lname = "Atomic I/O",
2831 .type = FIO_OPT_BOOL,
2832 .off1 = offsetof(struct thread_options, oatomic),
2833 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2835 .category = FIO_OPT_C_IO,
2836 .group = FIO_OPT_G_IO_TYPE,
2840 .lname = "Buffered I/O",
2841 .type = FIO_OPT_BOOL,
2842 .off1 = offsetof(struct thread_options, odirect),
2844 .help = "Use buffered IO (negates direct)",
2846 .inverse = "direct",
2847 .category = FIO_OPT_C_IO,
2848 .group = FIO_OPT_G_IO_TYPE,
2851 .name = "overwrite",
2852 .lname = "Overwrite",
2853 .type = FIO_OPT_BOOL,
2854 .off1 = offsetof(struct thread_options, overwrite),
2855 .help = "When writing, set whether to overwrite current data",
2857 .category = FIO_OPT_C_FILE,
2858 .group = FIO_OPT_G_INVALID,
2863 .type = FIO_OPT_INT,
2864 .off1 = offsetof(struct thread_options, loops),
2865 .help = "Number of times to run the job",
2868 .category = FIO_OPT_C_GENERAL,
2869 .group = FIO_OPT_G_RUNTIME,
2873 .lname = "Number of jobs",
2874 .type = FIO_OPT_INT,
2875 .off1 = offsetof(struct thread_options, numjobs),
2876 .help = "Duplicate this job this many times",
2879 .category = FIO_OPT_C_GENERAL,
2880 .group = FIO_OPT_G_RUNTIME,
2883 .name = "startdelay",
2884 .lname = "Start delay",
2885 .type = FIO_OPT_STR_VAL_TIME,
2886 .off1 = offsetof(struct thread_options, start_delay),
2887 .off2 = offsetof(struct thread_options, start_delay_high),
2888 .help = "Only start job when this period has passed",
2892 .category = FIO_OPT_C_GENERAL,
2893 .group = FIO_OPT_G_RUNTIME,
2899 .type = FIO_OPT_STR_VAL_TIME,
2900 .off1 = offsetof(struct thread_options, timeout),
2901 .help = "Stop workload when this amount of time has passed",
2905 .category = FIO_OPT_C_GENERAL,
2906 .group = FIO_OPT_G_RUNTIME,
2909 .name = "time_based",
2910 .lname = "Time based",
2911 .type = FIO_OPT_STR_SET,
2912 .off1 = offsetof(struct thread_options, time_based),
2913 .help = "Keep running until runtime/timeout is met",
2914 .category = FIO_OPT_C_GENERAL,
2915 .group = FIO_OPT_G_RUNTIME,
2918 .name = "verify_only",
2919 .lname = "Verify only",
2920 .type = FIO_OPT_STR_SET,
2921 .off1 = offsetof(struct thread_options, verify_only),
2922 .help = "Verifies previously written data is still valid",
2923 .category = FIO_OPT_C_GENERAL,
2924 .group = FIO_OPT_G_RUNTIME,
2927 .name = "ramp_time",
2928 .lname = "Ramp time",
2929 .type = FIO_OPT_STR_VAL_TIME,
2930 .off1 = offsetof(struct thread_options, ramp_time),
2931 .help = "Ramp up time before measuring performance",
2934 .category = FIO_OPT_C_GENERAL,
2935 .group = FIO_OPT_G_RUNTIME,
2938 .name = "clocksource",
2939 .lname = "Clock source",
2940 .type = FIO_OPT_STR,
2941 .cb = fio_clock_source_cb,
2942 .off1 = offsetof(struct thread_options, clocksource),
2943 .help = "What type of timing source to use",
2944 .category = FIO_OPT_C_GENERAL,
2945 .group = FIO_OPT_G_CLOCK,
2947 #ifdef CONFIG_GETTIMEOFDAY
2948 { .ival = "gettimeofday",
2950 .help = "Use gettimeofday(2) for timing",
2953 #ifdef CONFIG_CLOCK_GETTIME
2954 { .ival = "clock_gettime",
2955 .oval = CS_CGETTIME,
2956 .help = "Use clock_gettime(2) for timing",
2959 #ifdef ARCH_HAVE_CPU_CLOCK
2961 .oval = CS_CPUCLOCK,
2962 .help = "Use CPU private clock",
2970 .lname = "I/O Memory",
2971 .type = FIO_OPT_STR,
2973 .off1 = offsetof(struct thread_options, mem_type),
2974 .help = "Backing type for IO buffers",
2976 .category = FIO_OPT_C_IO,
2977 .group = FIO_OPT_G_INVALID,
2981 .help = "Use malloc(3) for IO buffers",
2983 #ifndef CONFIG_NO_SHM
2986 .help = "Use shared memory segments for IO buffers",
2988 #ifdef FIO_HAVE_HUGETLB
2989 { .ival = "shmhuge",
2990 .oval = MEM_SHMHUGE,
2991 .help = "Like shm, but use huge pages",
2997 .help = "Use mmap(2) (file or anon) for IO buffers",
2999 { .ival = "mmapshared",
3000 .oval = MEM_MMAPSHARED,
3001 .help = "Like mmap, but use the shared flag",
3003 #ifdef FIO_HAVE_HUGETLB
3004 { .ival = "mmaphuge",
3005 .oval = MEM_MMAPHUGE,
3006 .help = "Like mmap, but use huge pages",
3010 { .ival = "cudamalloc",
3011 .oval = MEM_CUDA_MALLOC,
3012 .help = "Allocate GPU device memory for GPUDirect RDMA",
3018 .name = "iomem_align",
3019 .alias = "mem_align",
3020 .lname = "I/O memory alignment",
3021 .type = FIO_OPT_INT,
3022 .off1 = offsetof(struct thread_options, mem_align),
3024 .help = "IO memory buffer offset alignment",
3028 .category = FIO_OPT_C_IO,
3029 .group = FIO_OPT_G_INVALID,
3034 .type = FIO_OPT_STR,
3035 .off1 = offsetof(struct thread_options, verify),
3036 .help = "Verify data written",
3038 .category = FIO_OPT_C_IO,
3039 .group = FIO_OPT_G_VERIFY,
3042 .oval = VERIFY_NONE,
3043 .help = "Don't do IO verification",
3047 .help = "Use md5 checksums for verification",
3050 .oval = VERIFY_CRC64,
3051 .help = "Use crc64 checksums for verification",
3054 .oval = VERIFY_CRC32,
3055 .help = "Use crc32 checksums for verification",
3057 { .ival = "crc32c-intel",
3058 .oval = VERIFY_CRC32C,
3059 .help = "Use crc32c checksums for verification (hw assisted, if available)",
3062 .oval = VERIFY_CRC32C,
3063 .help = "Use crc32c checksums for verification (hw assisted, if available)",
3066 .oval = VERIFY_CRC16,
3067 .help = "Use crc16 checksums for verification",
3070 .oval = VERIFY_CRC7,
3071 .help = "Use crc7 checksums for verification",
3074 .oval = VERIFY_SHA1,
3075 .help = "Use sha1 checksums for verification",
3078 .oval = VERIFY_SHA256,
3079 .help = "Use sha256 checksums for verification",
3082 .oval = VERIFY_SHA512,
3083 .help = "Use sha512 checksums for verification",
3085 { .ival = "sha3-224",
3086 .oval = VERIFY_SHA3_224,
3087 .help = "Use sha3-224 checksums for verification",
3089 { .ival = "sha3-256",
3090 .oval = VERIFY_SHA3_256,
3091 .help = "Use sha3-256 checksums for verification",
3093 { .ival = "sha3-384",
3094 .oval = VERIFY_SHA3_384,
3095 .help = "Use sha3-384 checksums for verification",
3097 { .ival = "sha3-512",
3098 .oval = VERIFY_SHA3_512,
3099 .help = "Use sha3-512 checksums for verification",
3102 .oval = VERIFY_XXHASH,
3103 .help = "Use xxhash checksums for verification",
3105 /* Meta information was included into verify_header,
3106 * 'meta' verification is implied by default. */
3108 .oval = VERIFY_HDR_ONLY,
3109 .help = "Use io information for verification. "
3110 "Now is implied by default, thus option is obsolete, "
3113 { .ival = "pattern",
3114 .oval = VERIFY_PATTERN_NO_HDR,
3115 .help = "Verify strict pattern",
3119 .oval = VERIFY_NULL,
3120 .help = "Pretend to verify",
3125 .name = "do_verify",
3126 .lname = "Perform verify step",
3127 .type = FIO_OPT_BOOL,
3128 .off1 = offsetof(struct thread_options, do_verify),
3129 .help = "Run verification stage after write",
3133 .category = FIO_OPT_C_IO,
3134 .group = FIO_OPT_G_VERIFY,
3137 .name = "verifysort",
3138 .lname = "Verify sort",
3139 .type = FIO_OPT_SOFT_DEPRECATED,
3140 .category = FIO_OPT_C_IO,
3141 .group = FIO_OPT_G_VERIFY,
3144 .name = "verifysort_nr",
3145 .lname = "Verify Sort Nr",
3146 .type = FIO_OPT_SOFT_DEPRECATED,
3147 .category = FIO_OPT_C_IO,
3148 .group = FIO_OPT_G_VERIFY,
3151 .name = "verify_interval",
3152 .lname = "Verify interval",
3153 .type = FIO_OPT_INT,
3154 .off1 = offsetof(struct thread_options, verify_interval),
3155 .minval = 2 * sizeof(struct verify_header),
3156 .help = "Store verify buffer header every N bytes",
3159 .interval = 2 * sizeof(struct verify_header),
3160 .category = FIO_OPT_C_IO,
3161 .group = FIO_OPT_G_VERIFY,
3164 .name = "verify_offset",
3165 .lname = "Verify offset",
3166 .type = FIO_OPT_INT,
3167 .help = "Offset verify header location by N bytes",
3168 .off1 = offsetof(struct thread_options, verify_offset),
3169 .minval = sizeof(struct verify_header),
3172 .category = FIO_OPT_C_IO,
3173 .group = FIO_OPT_G_VERIFY,
3176 .name = "verify_pattern",
3177 .lname = "Verify pattern",
3178 .type = FIO_OPT_STR,
3179 .cb = str_verify_pattern_cb,
3180 .off1 = offsetof(struct thread_options, verify_pattern),
3181 .help = "Fill pattern for IO buffers",
3184 .category = FIO_OPT_C_IO,
3185 .group = FIO_OPT_G_VERIFY,
3188 .name = "verify_fatal",
3189 .lname = "Verify fatal",
3190 .type = FIO_OPT_BOOL,
3191 .off1 = offsetof(struct thread_options, verify_fatal),
3193 .help = "Exit on a single verify failure, don't continue",
3196 .category = FIO_OPT_C_IO,
3197 .group = FIO_OPT_G_VERIFY,
3200 .name = "verify_dump",
3201 .lname = "Verify dump",
3202 .type = FIO_OPT_BOOL,
3203 .off1 = offsetof(struct thread_options, verify_dump),
3205 .help = "Dump contents of good and bad blocks on failure",
3208 .category = FIO_OPT_C_IO,
3209 .group = FIO_OPT_G_VERIFY,
3212 .name = "verify_async",
3213 .lname = "Verify asynchronously",
3214 .type = FIO_OPT_INT,
3215 .off1 = offsetof(struct thread_options, verify_async),
3217 .help = "Number of async verifier threads to use",
3220 .category = FIO_OPT_C_IO,
3221 .group = FIO_OPT_G_VERIFY,
3224 .name = "verify_backlog",
3225 .lname = "Verify backlog",
3226 .type = FIO_OPT_STR_VAL,
3227 .off1 = offsetof(struct thread_options, verify_backlog),
3228 .help = "Verify after this number of blocks are written",
3231 .category = FIO_OPT_C_IO,
3232 .group = FIO_OPT_G_VERIFY,
3235 .name = "verify_backlog_batch",
3236 .lname = "Verify backlog batch",
3237 .type = FIO_OPT_INT,
3238 .off1 = offsetof(struct thread_options, verify_batch),
3239 .help = "Verify this number of IO blocks",
3242 .category = FIO_OPT_C_IO,
3243 .group = FIO_OPT_G_VERIFY,
3245 #ifdef FIO_HAVE_CPU_AFFINITY
3247 .name = "verify_async_cpus",
3248 .lname = "Async verify CPUs",
3249 .type = FIO_OPT_STR,
3250 .cb = str_verify_cpus_allowed_cb,
3251 .off1 = offsetof(struct thread_options, verify_cpumask),
3252 .help = "Set CPUs allowed for async verify threads",
3253 .parent = "verify_async",
3255 .category = FIO_OPT_C_IO,
3256 .group = FIO_OPT_G_VERIFY,
3260 .name = "verify_async_cpus",
3261 .lname = "Async verify CPUs",
3262 .type = FIO_OPT_UNSUPPORTED,
3263 .help = "Your platform does not support CPU affinities",
3267 .name = "experimental_verify",
3268 .lname = "Experimental Verify",
3269 .off1 = offsetof(struct thread_options, experimental_verify),
3270 .type = FIO_OPT_BOOL,
3271 .help = "Enable experimental verification",
3273 .category = FIO_OPT_C_IO,
3274 .group = FIO_OPT_G_VERIFY,
3277 .name = "verify_state_load",
3278 .lname = "Load verify state",
3279 .off1 = offsetof(struct thread_options, verify_state),
3280 .type = FIO_OPT_BOOL,
3281 .help = "Load verify termination state",
3283 .category = FIO_OPT_C_IO,
3284 .group = FIO_OPT_G_VERIFY,
3287 .name = "verify_state_save",
3288 .lname = "Save verify state",
3289 .off1 = offsetof(struct thread_options, verify_state_save),
3290 .type = FIO_OPT_BOOL,
3292 .help = "Save verify state on termination",
3294 .category = FIO_OPT_C_IO,
3295 .group = FIO_OPT_G_VERIFY,
3297 #ifdef FIO_HAVE_TRIM
3299 .name = "trim_percentage",
3300 .lname = "Trim percentage",
3301 .type = FIO_OPT_INT,
3302 .off1 = offsetof(struct thread_options, trim_percentage),
3305 .help = "Number of verify blocks to trim (i.e., discard)",
3310 .category = FIO_OPT_C_IO,
3311 .group = FIO_OPT_G_TRIM,
3314 .name = "trim_verify_zero",
3315 .lname = "Verify trim zero",
3316 .type = FIO_OPT_BOOL,
3317 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3318 .off1 = offsetof(struct thread_options, trim_zero),
3319 .parent = "trim_percentage",
3322 .category = FIO_OPT_C_IO,
3323 .group = FIO_OPT_G_TRIM,
3326 .name = "trim_backlog",
3327 .lname = "Trim backlog",
3328 .type = FIO_OPT_STR_VAL,
3329 .off1 = offsetof(struct thread_options, trim_backlog),
3330 .help = "Trim after this number of blocks are written",
3331 .parent = "trim_percentage",
3334 .category = FIO_OPT_C_IO,
3335 .group = FIO_OPT_G_TRIM,
3338 .name = "trim_backlog_batch",
3339 .lname = "Trim backlog batch",
3340 .type = FIO_OPT_INT,
3341 .off1 = offsetof(struct thread_options, trim_batch),
3342 .help = "Trim this number of IO blocks",
3343 .parent = "trim_percentage",
3346 .category = FIO_OPT_C_IO,
3347 .group = FIO_OPT_G_TRIM,
3351 .name = "trim_percentage",
3352 .lname = "Trim percentage",
3353 .type = FIO_OPT_UNSUPPORTED,
3354 .help = "Fio does not support TRIM on your platform",
3357 .name = "trim_verify_zero",
3358 .lname = "Verify trim zero",
3359 .type = FIO_OPT_UNSUPPORTED,
3360 .help = "Fio does not support TRIM on your platform",
3363 .name = "trim_backlog",
3364 .lname = "Trim backlog",
3365 .type = FIO_OPT_UNSUPPORTED,
3366 .help = "Fio does not support TRIM on your platform",
3369 .name = "trim_backlog_batch",
3370 .lname = "Trim backlog batch",
3371 .type = FIO_OPT_UNSUPPORTED,
3372 .help = "Fio does not support TRIM on your platform",
3376 .name = "write_iolog",
3377 .lname = "Write I/O log",
3378 .type = FIO_OPT_STR_STORE,
3379 .off1 = offsetof(struct thread_options, write_iolog_file),
3380 .help = "Store IO pattern to file",
3381 .category = FIO_OPT_C_IO,
3382 .group = FIO_OPT_G_IOLOG,
3385 .name = "read_iolog",
3386 .lname = "Read I/O log",
3387 .type = FIO_OPT_STR_STORE,
3388 .off1 = offsetof(struct thread_options, read_iolog_file),
3389 .help = "Playback IO pattern from file",
3390 .category = FIO_OPT_C_IO,
3391 .group = FIO_OPT_G_IOLOG,
3394 .name = "read_iolog_chunked",
3395 .lname = "Read I/O log in parts",
3396 .type = FIO_OPT_BOOL,
3397 .off1 = offsetof(struct thread_options, read_iolog_chunked),
3399 .parent = "read_iolog",
3400 .help = "Parse IO pattern in chunks",
3401 .category = FIO_OPT_C_IO,
3402 .group = FIO_OPT_G_IOLOG,
3405 .name = "replay_no_stall",
3406 .lname = "Don't stall on replay",
3407 .type = FIO_OPT_BOOL,
3408 .off1 = offsetof(struct thread_options, no_stall),
3410 .parent = "read_iolog",
3412 .help = "Playback IO pattern file as fast as possible without stalls",
3413 .category = FIO_OPT_C_IO,
3414 .group = FIO_OPT_G_IOLOG,
3417 .name = "replay_redirect",
3418 .lname = "Redirect device for replay",
3419 .type = FIO_OPT_STR_STORE,
3420 .off1 = offsetof(struct thread_options, replay_redirect),
3421 .parent = "read_iolog",
3423 .help = "Replay all I/O onto this device, regardless of trace device",
3424 .category = FIO_OPT_C_IO,
3425 .group = FIO_OPT_G_IOLOG,
3428 .name = "replay_scale",
3429 .lname = "Replace offset scale factor",
3430 .type = FIO_OPT_INT,
3431 .off1 = offsetof(struct thread_options, replay_scale),
3432 .parent = "read_iolog",
3434 .help = "Align offsets to this blocksize",
3435 .category = FIO_OPT_C_IO,
3436 .group = FIO_OPT_G_IOLOG,
3439 .name = "replay_align",
3440 .lname = "Replace alignment",
3441 .type = FIO_OPT_INT,
3442 .off1 = offsetof(struct thread_options, replay_align),
3443 .parent = "read_iolog",
3444 .help = "Scale offset down by this factor",
3445 .category = FIO_OPT_C_IO,
3446 .group = FIO_OPT_G_IOLOG,
3450 .name = "replay_time_scale",
3451 .lname = "Replay Time Scale",
3452 .type = FIO_OPT_INT,
3453 .off1 = offsetof(struct thread_options, replay_time_scale),
3456 .parent = "read_iolog",
3458 .help = "Scale time for replay events",
3459 .category = FIO_OPT_C_IO,
3460 .group = FIO_OPT_G_IOLOG,
3463 .name = "replay_skip",
3464 .lname = "Replay Skip",
3465 .type = FIO_OPT_STR,
3466 .cb = str_replay_skip_cb,
3467 .off1 = offsetof(struct thread_options, replay_skip),
3468 .parent = "read_iolog",
3469 .help = "Skip certain IO types (read,write,trim,flush)",
3470 .category = FIO_OPT_C_IO,
3471 .group = FIO_OPT_G_IOLOG,
3474 .name = "merge_blktrace_file",
3475 .lname = "Merged blktrace output filename",
3476 .type = FIO_OPT_STR_STORE,
3477 .off1 = offsetof(struct thread_options, merge_blktrace_file),
3478 .help = "Merged blktrace output filename",
3479 .category = FIO_OPT_C_IO,
3480 .group = FIO_OPT_G_IOLOG,
3483 .name = "merge_blktrace_scalars",
3484 .lname = "Percentage to scale each trace",
3485 .type = FIO_OPT_FLOAT_LIST,
3486 .off1 = offsetof(struct thread_options, merge_blktrace_scalars),
3487 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3488 .help = "Percentage to scale each trace",
3489 .category = FIO_OPT_C_IO,
3490 .group = FIO_OPT_G_IOLOG,
3493 .name = "merge_blktrace_iters",
3494 .lname = "Number of iterations to run per trace",
3495 .type = FIO_OPT_FLOAT_LIST,
3496 .off1 = offsetof(struct thread_options, merge_blktrace_iters),
3497 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3498 .help = "Number of iterations to run per trace",
3499 .category = FIO_OPT_C_IO,
3500 .group = FIO_OPT_G_IOLOG,
3503 .name = "exec_prerun",
3504 .lname = "Pre-execute runnable",
3505 .type = FIO_OPT_STR_STORE,
3506 .off1 = offsetof(struct thread_options, exec_prerun),
3507 .help = "Execute this file prior to running job",
3508 .category = FIO_OPT_C_GENERAL,
3509 .group = FIO_OPT_G_INVALID,
3512 .name = "exec_postrun",
3513 .lname = "Post-execute runnable",
3514 .type = FIO_OPT_STR_STORE,
3515 .off1 = offsetof(struct thread_options, exec_postrun),
3516 .help = "Execute this file after running job",
3517 .category = FIO_OPT_C_GENERAL,
3518 .group = FIO_OPT_G_INVALID,
3520 #ifdef FIO_HAVE_IOSCHED_SWITCH
3522 .name = "ioscheduler",
3523 .lname = "I/O scheduler",
3524 .type = FIO_OPT_STR_STORE,
3525 .off1 = offsetof(struct thread_options, ioscheduler),
3526 .help = "Use this IO scheduler on the backing device",
3527 .category = FIO_OPT_C_FILE,
3528 .group = FIO_OPT_G_INVALID,
3532 .name = "ioscheduler",
3533 .lname = "I/O scheduler",
3534 .type = FIO_OPT_UNSUPPORTED,
3535 .help = "Your platform does not support IO scheduler switching",
3540 .lname = "Zone mode",
3541 .help = "Mode for the zonesize, zonerange and zoneskip parameters",
3542 .type = FIO_OPT_STR,
3543 .off1 = offsetof(struct thread_options, zone_mode),
3545 .category = FIO_OPT_C_IO,
3546 .group = FIO_OPT_G_ZONE,
3549 .oval = ZONE_MODE_NONE,
3550 .help = "no zoning",
3552 { .ival = "strided",
3553 .oval = ZONE_MODE_STRIDED,
3554 .help = "strided mode - random I/O is restricted to a single zone",
3557 .oval = ZONE_MODE_ZBD,
3558 .help = "zoned block device mode - random I/O selects one of multiple zones randomly",
3564 .lname = "Zone size",
3565 .type = FIO_OPT_STR_VAL,
3566 .off1 = offsetof(struct thread_options, zone_size),
3567 .help = "Amount of data to read per zone",
3569 .interval = 1024 * 1024,
3570 .category = FIO_OPT_C_IO,
3571 .group = FIO_OPT_G_ZONE,
3574 .name = "zonecapacity",
3575 .lname = "Zone capacity",
3576 .type = FIO_OPT_STR_VAL,
3577 .off1 = offsetof(struct thread_options, zone_capacity),
3578 .help = "Capacity per zone",
3580 .interval = 1024 * 1024,
3581 .category = FIO_OPT_C_IO,
3582 .group = FIO_OPT_G_ZONE,
3585 .name = "zonerange",
3586 .lname = "Zone range",
3587 .type = FIO_OPT_STR_VAL,
3588 .off1 = offsetof(struct thread_options, zone_range),
3589 .help = "Give size of an IO zone",
3591 .interval = 1024 * 1024,
3592 .category = FIO_OPT_C_IO,
3593 .group = FIO_OPT_G_ZONE,
3597 .lname = "Zone skip",
3598 .type = FIO_OPT_STR_VAL_ZONE,
3599 .cb = str_zoneskip_cb,
3600 .off1 = offsetof(struct thread_options, zone_skip),
3601 .help = "Space between IO zones",
3603 .category = FIO_OPT_C_IO,
3604 .group = FIO_OPT_G_ZONE,
3607 .name = "read_beyond_wp",
3608 .lname = "Allow reads beyond the zone write pointer",
3609 .type = FIO_OPT_BOOL,
3610 .off1 = offsetof(struct thread_options, read_beyond_wp),
3611 .help = "Allow reads beyond the zone write pointer",
3613 .category = FIO_OPT_C_IO,
3614 .group = FIO_OPT_G_INVALID,
3617 .name = "max_open_zones",
3618 .lname = "Per device/file maximum number of open zones",
3619 .type = FIO_OPT_INT,
3620 .off1 = offsetof(struct thread_options, max_open_zones),
3621 .maxval = ZBD_MAX_OPEN_ZONES,
3622 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd",
3624 .category = FIO_OPT_C_IO,
3625 .group = FIO_OPT_G_INVALID,
3628 .name = "job_max_open_zones",
3629 .lname = "Job maximum number of open zones",
3630 .type = FIO_OPT_INT,
3631 .off1 = offsetof(struct thread_options, job_max_open_zones),
3632 .maxval = ZBD_MAX_OPEN_ZONES,
3633 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd by one thread/process",
3635 .category = FIO_OPT_C_IO,
3636 .group = FIO_OPT_G_INVALID,
3639 .name = "ignore_zone_limits",
3640 .lname = "Ignore zone resource limits",
3641 .type = FIO_OPT_BOOL,
3642 .off1 = offsetof(struct thread_options, ignore_zone_limits),
3644 .help = "Ignore the zone resource limits (max open/active zones) reported by the device",
3645 .category = FIO_OPT_C_IO,
3646 .group = FIO_OPT_G_INVALID,
3649 .name = "zone_reset_threshold",
3650 .lname = "Zone reset threshold",
3651 .help = "Zoned block device reset threshold",
3652 .type = FIO_OPT_FLOAT_LIST,
3654 .off1 = offsetof(struct thread_options, zrt),
3657 .category = FIO_OPT_C_IO,
3658 .group = FIO_OPT_G_ZONE,
3661 .name = "zone_reset_frequency",
3662 .lname = "Zone reset frequency",
3663 .help = "Zoned block device zone reset frequency in HZ",
3664 .type = FIO_OPT_FLOAT_LIST,
3666 .off1 = offsetof(struct thread_options, zrf),
3669 .category = FIO_OPT_C_IO,
3670 .group = FIO_OPT_G_ZONE,
3674 .lname = "Flexible data placement",
3675 .type = FIO_OPT_BOOL,
3676 .off1 = offsetof(struct thread_options, fdp),
3677 .help = "Use Data placement directive (FDP)",
3679 .category = FIO_OPT_C_IO,
3680 .group = FIO_OPT_G_INVALID,
3684 .lname = "FDP Placement ID indicies",
3685 .type = FIO_OPT_STR,
3686 .cb = str_fdp_pli_cb,
3687 .off1 = offsetof(struct thread_options, fdp_plis),
3688 .help = "Sets which placement ids to use (defaults to all)",
3690 .category = FIO_OPT_C_IO,
3691 .group = FIO_OPT_G_INVALID,
3695 .lname = "Lock memory",
3696 .type = FIO_OPT_STR_VAL,
3697 .off1 = offsetof(struct thread_options, lockmem),
3698 .help = "Lock down this amount of memory (per worker)",
3700 .interval = 1024 * 1024,
3701 .category = FIO_OPT_C_GENERAL,
3702 .group = FIO_OPT_G_INVALID,
3705 .name = "rwmixread",
3706 .lname = "Read/write mix read",
3707 .type = FIO_OPT_INT,
3708 .cb = str_rwmix_read_cb,
3709 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3711 .help = "Percentage of mixed workload that is reads",
3714 .inverse = "rwmixwrite",
3715 .category = FIO_OPT_C_IO,
3716 .group = FIO_OPT_G_RWMIX,
3719 .name = "rwmixwrite",
3720 .lname = "Read/write mix write",
3721 .type = FIO_OPT_INT,
3722 .cb = str_rwmix_write_cb,
3723 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3725 .help = "Percentage of mixed workload that is writes",
3728 .inverse = "rwmixread",
3729 .category = FIO_OPT_C_IO,
3730 .group = FIO_OPT_G_RWMIX,
3733 .name = "rwmixcycle",
3734 .lname = "Read/write mix cycle",
3735 .type = FIO_OPT_DEPRECATED,
3736 .category = FIO_OPT_C_IO,
3737 .group = FIO_OPT_G_RWMIX,
3742 .type = FIO_OPT_INT,
3743 .off1 = offsetof(struct thread_options, nice),
3744 .help = "Set job CPU nice value",
3749 .category = FIO_OPT_C_GENERAL,
3750 .group = FIO_OPT_G_CRED,
3752 #ifdef FIO_HAVE_IOPRIO
3755 .lname = "I/O nice priority",
3756 .type = FIO_OPT_INT,
3757 .off1 = offsetof(struct thread_options, ioprio),
3758 .help = "Set job IO priority value",
3759 .minval = IOPRIO_MIN_PRIO,
3760 .maxval = IOPRIO_MAX_PRIO,
3762 .category = FIO_OPT_C_GENERAL,
3763 .group = FIO_OPT_G_CRED,
3768 .lname = "I/O nice priority",
3769 .type = FIO_OPT_UNSUPPORTED,
3770 .help = "Your platform does not support IO priorities",
3773 #ifdef FIO_HAVE_IOPRIO_CLASS
3774 #ifndef FIO_HAVE_IOPRIO
3775 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3778 .name = "prioclass",
3779 .lname = "I/O nice priority class",
3780 .type = FIO_OPT_INT,
3781 .off1 = offsetof(struct thread_options, ioprio_class),
3782 .help = "Set job IO priority class",
3783 .minval = IOPRIO_MIN_PRIO_CLASS,
3784 .maxval = IOPRIO_MAX_PRIO_CLASS,
3786 .category = FIO_OPT_C_GENERAL,
3787 .group = FIO_OPT_G_CRED,
3791 .name = "prioclass",
3792 .lname = "I/O nice priority class",
3793 .type = FIO_OPT_UNSUPPORTED,
3794 .help = "Your platform does not support IO priority classes",
3798 .name = "thinktime",
3799 .lname = "Thinktime",
3800 .type = FIO_OPT_INT,
3801 .off1 = offsetof(struct thread_options, thinktime),
3802 .help = "Idle time between IO buffers (usec)",
3805 .category = FIO_OPT_C_IO,
3806 .group = FIO_OPT_G_THINKTIME,
3809 .name = "thinktime_spin",
3810 .lname = "Thinktime spin",
3811 .type = FIO_OPT_INT,
3812 .off1 = offsetof(struct thread_options, thinktime_spin),
3813 .help = "Start think time by spinning this amount (usec)",
3816 .parent = "thinktime",
3818 .category = FIO_OPT_C_IO,
3819 .group = FIO_OPT_G_THINKTIME,
3822 .name = "thinktime_blocks",
3823 .lname = "Thinktime blocks",
3824 .type = FIO_OPT_INT,
3825 .off1 = offsetof(struct thread_options, thinktime_blocks),
3826 .help = "IO buffer period between 'thinktime'",
3828 .parent = "thinktime",
3830 .category = FIO_OPT_C_IO,
3831 .group = FIO_OPT_G_THINKTIME,
3834 .name = "thinktime_blocks_type",
3835 .lname = "Thinktime blocks type",
3836 .type = FIO_OPT_STR,
3837 .off1 = offsetof(struct thread_options, thinktime_blocks_type),
3838 .help = "How thinktime_blocks takes effect",
3840 .category = FIO_OPT_C_IO,
3841 .group = FIO_OPT_G_THINKTIME,
3843 { .ival = "complete",
3844 .oval = THINKTIME_BLOCKS_TYPE_COMPLETE,
3845 .help = "thinktime_blocks takes effect at the completion side",
3849 .oval = THINKTIME_BLOCKS_TYPE_ISSUE,
3850 .help = "thinktime_blocks takes effect at the issue side",
3853 .parent = "thinktime",
3856 .name = "thinktime_iotime",
3857 .lname = "Thinktime interval",
3858 .type = FIO_OPT_INT,
3859 .off1 = offsetof(struct thread_options, thinktime_iotime),
3860 .help = "IO time interval between 'thinktime'",
3862 .parent = "thinktime",
3866 .category = FIO_OPT_C_IO,
3867 .group = FIO_OPT_G_THINKTIME,
3871 .lname = "I/O rate",
3872 .type = FIO_OPT_ULL,
3873 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3874 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3875 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
3876 .help = "Set bandwidth rate",
3877 .category = FIO_OPT_C_IO,
3878 .group = FIO_OPT_G_RATE,
3883 .lname = "I/O min rate",
3884 .type = FIO_OPT_ULL,
3885 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
3886 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
3887 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
3888 .help = "Job must meet this rate or it will be shutdown",
3891 .category = FIO_OPT_C_IO,
3892 .group = FIO_OPT_G_RATE,
3895 .name = "rate_iops",
3896 .lname = "I/O rate IOPS",
3897 .type = FIO_OPT_INT,
3898 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
3899 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
3900 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
3901 .help = "Limit IO used to this number of IO operations/sec",
3903 .category = FIO_OPT_C_IO,
3904 .group = FIO_OPT_G_RATE,
3907 .name = "rate_iops_min",
3908 .lname = "I/O min rate IOPS",
3909 .type = FIO_OPT_INT,
3910 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
3911 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
3912 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
3913 .help = "Job must meet this rate or it will be shut down",
3914 .parent = "rate_iops",
3916 .category = FIO_OPT_C_IO,
3917 .group = FIO_OPT_G_RATE,
3920 .name = "rate_process",
3921 .lname = "Rate Process",
3922 .type = FIO_OPT_STR,
3923 .off1 = offsetof(struct thread_options, rate_process),
3924 .help = "What process controls how rated IO is managed",
3926 .category = FIO_OPT_C_IO,
3927 .group = FIO_OPT_G_RATE,
3930 .oval = RATE_PROCESS_LINEAR,
3931 .help = "Linear rate of IO",
3935 .oval = RATE_PROCESS_POISSON,
3936 .help = "Rate follows Poisson process",
3942 .name = "rate_cycle",
3943 .alias = "ratecycle",
3944 .lname = "I/O rate cycle",
3945 .type = FIO_OPT_INT,
3946 .off1 = offsetof(struct thread_options, ratecycle),
3947 .help = "Window average for rate limits (msec)",
3951 .category = FIO_OPT_C_IO,
3952 .group = FIO_OPT_G_RATE,
3955 .name = "rate_ignore_thinktime",
3956 .lname = "Rate ignore thinktime",
3957 .type = FIO_OPT_BOOL,
3958 .off1 = offsetof(struct thread_options, rate_ign_think),
3959 .help = "Rated IO ignores thinktime settings",
3961 .category = FIO_OPT_C_IO,
3962 .group = FIO_OPT_G_RATE,
3965 .name = "max_latency",
3966 .lname = "Max Latency (usec)",
3967 .type = FIO_OPT_ULL,
3968 .off1 = offsetof(struct thread_options, max_latency[DDIR_READ]),
3969 .off2 = offsetof(struct thread_options, max_latency[DDIR_WRITE]),
3970 .off3 = offsetof(struct thread_options, max_latency[DDIR_TRIM]),
3971 .help = "Maximum tolerated IO latency (usec)",
3973 .category = FIO_OPT_C_IO,
3974 .group = FIO_OPT_G_LATPROF,
3977 .name = "latency_target",
3978 .lname = "Latency Target (usec)",
3979 .type = FIO_OPT_STR_VAL_TIME,
3980 .off1 = offsetof(struct thread_options, latency_target),
3981 .help = "Ramp to max queue depth supporting this latency",
3983 .category = FIO_OPT_C_IO,
3984 .group = FIO_OPT_G_LATPROF,
3987 .name = "latency_window",
3988 .lname = "Latency Window (usec)",
3989 .type = FIO_OPT_STR_VAL_TIME,
3990 .off1 = offsetof(struct thread_options, latency_window),
3991 .help = "Time to sustain latency_target",
3993 .category = FIO_OPT_C_IO,
3994 .group = FIO_OPT_G_LATPROF,
3997 .name = "latency_percentile",
3998 .lname = "Latency Percentile",
3999 .type = FIO_OPT_FLOAT_LIST,
4000 .off1 = offsetof(struct thread_options, latency_percentile),
4001 .help = "Percentile of IOs must be below latency_target",
4006 .category = FIO_OPT_C_IO,
4007 .group = FIO_OPT_G_LATPROF,
4010 .name = "latency_run",
4011 .lname = "Latency Run",
4012 .type = FIO_OPT_BOOL,
4013 .off1 = offsetof(struct thread_options, latency_run),
4014 .help = "Keep adjusting queue depth to match latency_target",
4016 .category = FIO_OPT_C_IO,
4017 .group = FIO_OPT_G_LATPROF,
4020 .name = "invalidate",
4021 .lname = "Cache invalidate",
4022 .type = FIO_OPT_BOOL,
4023 .off1 = offsetof(struct thread_options, invalidate_cache),
4024 .help = "Invalidate buffer/page cache prior to running job",
4026 .category = FIO_OPT_C_IO,
4027 .group = FIO_OPT_G_IO_TYPE,
4031 .lname = "Synchronous I/O",
4032 .type = FIO_OPT_STR,
4033 .off1 = offsetof(struct thread_options, sync_io),
4034 .help = "Use synchronous write IO",
4037 .category = FIO_OPT_C_IO,
4038 .group = FIO_OPT_G_IO_TYPE,
4059 #ifdef FIO_HAVE_WRITE_HINT
4061 .name = "write_hint",
4062 .lname = "Write hint",
4063 .type = FIO_OPT_STR,
4064 .off1 = offsetof(struct thread_options, write_hint),
4065 .help = "Set expected write life time",
4066 .category = FIO_OPT_C_ENGINE,
4067 .group = FIO_OPT_G_INVALID,
4070 .oval = RWH_WRITE_LIFE_NONE,
4073 .oval = RWH_WRITE_LIFE_SHORT,
4076 .oval = RWH_WRITE_LIFE_MEDIUM,
4079 .oval = RWH_WRITE_LIFE_LONG,
4081 { .ival = "extreme",
4082 .oval = RWH_WRITE_LIFE_EXTREME,
4088 .name = "create_serialize",
4089 .lname = "Create serialize",
4090 .type = FIO_OPT_BOOL,
4091 .off1 = offsetof(struct thread_options, create_serialize),
4092 .help = "Serialize creation of job files",
4094 .category = FIO_OPT_C_FILE,
4095 .group = FIO_OPT_G_INVALID,
4098 .name = "create_fsync",
4099 .lname = "Create fsync",
4100 .type = FIO_OPT_BOOL,
4101 .off1 = offsetof(struct thread_options, create_fsync),
4102 .help = "fsync file after creation",
4104 .category = FIO_OPT_C_FILE,
4105 .group = FIO_OPT_G_INVALID,
4108 .name = "create_on_open",
4109 .lname = "Create on open",
4110 .type = FIO_OPT_BOOL,
4111 .off1 = offsetof(struct thread_options, create_on_open),
4112 .help = "Create files when they are opened for IO",
4114 .category = FIO_OPT_C_FILE,
4115 .group = FIO_OPT_G_INVALID,
4118 .name = "create_only",
4119 .lname = "Create Only",
4120 .type = FIO_OPT_BOOL,
4121 .off1 = offsetof(struct thread_options, create_only),
4122 .help = "Only perform file creation phase",
4123 .category = FIO_OPT_C_FILE,
4127 .name = "allow_file_create",
4128 .lname = "Allow file create",
4129 .type = FIO_OPT_BOOL,
4130 .off1 = offsetof(struct thread_options, allow_create),
4131 .help = "Permit fio to create files, if they don't exist",
4133 .category = FIO_OPT_C_FILE,
4134 .group = FIO_OPT_G_FILENAME,
4137 .name = "allow_mounted_write",
4138 .lname = "Allow mounted write",
4139 .type = FIO_OPT_BOOL,
4140 .off1 = offsetof(struct thread_options, allow_mounted_write),
4141 .help = "Allow writes to a mounted partition",
4143 .category = FIO_OPT_C_FILE,
4144 .group = FIO_OPT_G_FILENAME,
4148 .lname = "Pre-read files",
4149 .type = FIO_OPT_BOOL,
4150 .off1 = offsetof(struct thread_options, pre_read),
4151 .help = "Pre-read files before starting official testing",
4153 .category = FIO_OPT_C_FILE,
4154 .group = FIO_OPT_G_INVALID,
4156 #ifdef FIO_HAVE_CPU_AFFINITY
4159 .lname = "CPU mask",
4160 .type = FIO_OPT_INT,
4161 .cb = str_cpumask_cb,
4162 .off1 = offsetof(struct thread_options, cpumask),
4163 .help = "CPU affinity mask",
4164 .category = FIO_OPT_C_GENERAL,
4165 .group = FIO_OPT_G_CRED,
4168 .name = "cpus_allowed",
4169 .lname = "CPUs allowed",
4170 .type = FIO_OPT_STR,
4171 .cb = str_cpus_allowed_cb,
4172 .off1 = offsetof(struct thread_options, cpumask),
4173 .help = "Set CPUs allowed",
4174 .category = FIO_OPT_C_GENERAL,
4175 .group = FIO_OPT_G_CRED,
4178 .name = "cpus_allowed_policy",
4179 .lname = "CPUs allowed distribution policy",
4180 .type = FIO_OPT_STR,
4181 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
4182 .help = "Distribution policy for cpus_allowed",
4183 .parent = "cpus_allowed",
4187 .oval = FIO_CPUS_SHARED,
4188 .help = "Mask shared between threads",
4191 .oval = FIO_CPUS_SPLIT,
4192 .help = "Mask split between threads",
4195 .category = FIO_OPT_C_GENERAL,
4196 .group = FIO_OPT_G_CRED,
4201 .lname = "CPU mask",
4202 .type = FIO_OPT_UNSUPPORTED,
4203 .help = "Your platform does not support CPU affinities",
4206 .name = "cpus_allowed",
4207 .lname = "CPUs allowed",
4208 .type = FIO_OPT_UNSUPPORTED,
4209 .help = "Your platform does not support CPU affinities",
4212 .name = "cpus_allowed_policy",
4213 .lname = "CPUs allowed distribution policy",
4214 .type = FIO_OPT_UNSUPPORTED,
4215 .help = "Your platform does not support CPU affinities",
4218 #ifdef CONFIG_LIBNUMA
4220 .name = "numa_cpu_nodes",
4221 .lname = "NUMA CPU Nodes",
4222 .type = FIO_OPT_STR,
4223 .cb = str_numa_cpunodes_cb,
4224 .off1 = offsetof(struct thread_options, numa_cpunodes),
4225 .help = "NUMA CPU nodes bind",
4226 .category = FIO_OPT_C_GENERAL,
4227 .group = FIO_OPT_G_INVALID,
4230 .name = "numa_mem_policy",
4231 .lname = "NUMA Memory Policy",
4232 .type = FIO_OPT_STR,
4233 .cb = str_numa_mpol_cb,
4234 .off1 = offsetof(struct thread_options, numa_memnodes),
4235 .help = "NUMA memory policy setup",
4236 .category = FIO_OPT_C_GENERAL,
4237 .group = FIO_OPT_G_INVALID,
4241 .name = "numa_cpu_nodes",
4242 .lname = "NUMA CPU Nodes",
4243 .type = FIO_OPT_UNSUPPORTED,
4244 .help = "Build fio with libnuma-dev(el) to enable this option",
4247 .name = "numa_mem_policy",
4248 .lname = "NUMA Memory Policy",
4249 .type = FIO_OPT_UNSUPPORTED,
4250 .help = "Build fio with libnuma-dev(el) to enable this option",
4255 .name = "gpu_dev_id",
4256 .lname = "GPU device ID",
4257 .type = FIO_OPT_INT,
4258 .off1 = offsetof(struct thread_options, gpu_dev_id),
4259 .help = "Set GPU device ID for GPUDirect RDMA",
4261 .category = FIO_OPT_C_GENERAL,
4262 .group = FIO_OPT_G_INVALID,
4266 .name = "end_fsync",
4267 .lname = "End fsync",
4268 .type = FIO_OPT_BOOL,
4269 .off1 = offsetof(struct thread_options, end_fsync),
4270 .help = "Include fsync at the end of job",
4272 .category = FIO_OPT_C_FILE,
4273 .group = FIO_OPT_G_INVALID,
4276 .name = "fsync_on_close",
4277 .lname = "Fsync on close",
4278 .type = FIO_OPT_BOOL,
4279 .off1 = offsetof(struct thread_options, fsync_on_close),
4280 .help = "fsync files on close",
4282 .category = FIO_OPT_C_FILE,
4283 .group = FIO_OPT_G_INVALID,
4287 .lname = "Unlink file",
4288 .type = FIO_OPT_BOOL,
4289 .off1 = offsetof(struct thread_options, unlink),
4290 .help = "Unlink created files after job has completed",
4292 .category = FIO_OPT_C_FILE,
4293 .group = FIO_OPT_G_INVALID,
4296 .name = "unlink_each_loop",
4297 .lname = "Unlink file after each loop of a job",
4298 .type = FIO_OPT_BOOL,
4299 .off1 = offsetof(struct thread_options, unlink_each_loop),
4300 .help = "Unlink created files after each loop in a job has completed",
4302 .category = FIO_OPT_C_FILE,
4303 .group = FIO_OPT_G_INVALID,
4307 .lname = "Exit-all on terminate",
4308 .type = FIO_OPT_STR_SET,
4309 .cb = str_exitall_cb,
4310 .help = "Terminate all jobs when one exits",
4311 .category = FIO_OPT_C_GENERAL,
4312 .group = FIO_OPT_G_PROCESS,
4315 .name = "exit_what",
4316 .lname = "What jobs to quit on terminate",
4317 .type = FIO_OPT_STR,
4318 .off1 = offsetof(struct thread_options, exit_what),
4319 .help = "Fine-grained control for exitall",
4321 .category = FIO_OPT_C_GENERAL,
4322 .group = FIO_OPT_G_PROCESS,
4325 .oval = TERMINATE_GROUP,
4326 .help = "exit_all=1 default behaviour",
4328 { .ival = "stonewall",
4329 .oval = TERMINATE_STONEWALL,
4330 .help = "quit all currently running jobs; continue with next stonewall",
4333 .oval = TERMINATE_ALL,
4334 .help = "Quit everything",
4339 .name = "exitall_on_error",
4340 .lname = "Exit-all on terminate in error",
4341 .type = FIO_OPT_STR_SET,
4342 .off1 = offsetof(struct thread_options, exitall_error),
4343 .help = "Terminate all jobs when one exits in error",
4344 .category = FIO_OPT_C_GENERAL,
4345 .group = FIO_OPT_G_PROCESS,
4348 .name = "stonewall",
4349 .lname = "Wait for previous",
4350 .alias = "wait_for_previous",
4351 .type = FIO_OPT_STR_SET,
4352 .off1 = offsetof(struct thread_options, stonewall),
4353 .help = "Insert a hard barrier between this job and previous",
4354 .category = FIO_OPT_C_GENERAL,
4355 .group = FIO_OPT_G_PROCESS,
4358 .name = "new_group",
4359 .lname = "New group",
4360 .type = FIO_OPT_STR_SET,
4361 .off1 = offsetof(struct thread_options, new_group),
4362 .help = "Mark the start of a new group (for reporting)",
4363 .category = FIO_OPT_C_GENERAL,
4364 .group = FIO_OPT_G_PROCESS,
4369 .type = FIO_OPT_STR_SET,
4370 .off1 = offsetof(struct thread_options, use_thread),
4371 .help = "Use threads instead of processes",
4372 #ifdef CONFIG_NO_SHM
4376 .category = FIO_OPT_C_GENERAL,
4377 .group = FIO_OPT_G_PROCESS,
4380 .name = "per_job_logs",
4381 .lname = "Per Job Logs",
4382 .type = FIO_OPT_BOOL,
4383 .off1 = offsetof(struct thread_options, per_job_logs),
4384 .help = "Include job number in generated log files or not",
4386 .category = FIO_OPT_C_LOG,
4387 .group = FIO_OPT_G_INVALID,
4390 .name = "write_bw_log",
4391 .lname = "Write bandwidth log",
4392 .type = FIO_OPT_STR,
4393 .off1 = offsetof(struct thread_options, bw_log_file),
4394 .cb = str_write_bw_log_cb,
4395 .help = "Write log of bandwidth during run",
4396 .category = FIO_OPT_C_LOG,
4397 .group = FIO_OPT_G_INVALID,
4400 .name = "write_lat_log",
4401 .lname = "Write latency log",
4402 .type = FIO_OPT_STR,
4403 .off1 = offsetof(struct thread_options, lat_log_file),
4404 .cb = str_write_lat_log_cb,
4405 .help = "Write log of latency during run",
4406 .category = FIO_OPT_C_LOG,
4407 .group = FIO_OPT_G_INVALID,
4410 .name = "write_iops_log",
4411 .lname = "Write IOPS log",
4412 .type = FIO_OPT_STR,
4413 .off1 = offsetof(struct thread_options, iops_log_file),
4414 .cb = str_write_iops_log_cb,
4415 .help = "Write log of IOPS during run",
4416 .category = FIO_OPT_C_LOG,
4417 .group = FIO_OPT_G_INVALID,
4420 .name = "log_entries",
4421 .lname = "Log entries",
4422 .type = FIO_OPT_INT,
4423 .off1 = offsetof(struct thread_options, log_entries),
4424 .help = "Initial number of entries in a job IO log",
4425 .def = __fio_stringify(DEF_LOG_ENTRIES),
4426 .minval = DEF_LOG_ENTRIES,
4427 .maxval = MAX_LOG_ENTRIES,
4428 .category = FIO_OPT_C_LOG,
4429 .group = FIO_OPT_G_INVALID,
4432 .name = "log_avg_msec",
4433 .lname = "Log averaging (msec)",
4434 .type = FIO_OPT_INT,
4435 .off1 = offsetof(struct thread_options, log_avg_msec),
4436 .help = "Average bw/iops/lat logs over this period of time",
4438 .category = FIO_OPT_C_LOG,
4439 .group = FIO_OPT_G_INVALID,
4442 .name = "log_hist_msec",
4443 .lname = "Log histograms (msec)",
4444 .type = FIO_OPT_INT,
4445 .off1 = offsetof(struct thread_options, log_hist_msec),
4446 .help = "Dump completion latency histograms at frequency of this time value",
4448 .category = FIO_OPT_C_LOG,
4449 .group = FIO_OPT_G_INVALID,
4452 .name = "log_hist_coarseness",
4453 .lname = "Histogram logs coarseness",
4454 .type = FIO_OPT_INT,
4455 .off1 = offsetof(struct thread_options, log_hist_coarseness),
4456 .help = "Integer in range [0,6]. Higher coarseness outputs"
4457 " fewer histogram bins per sample. The number of bins for"
4458 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
4460 .category = FIO_OPT_C_LOG,
4461 .group = FIO_OPT_G_INVALID,
4464 .name = "write_hist_log",
4465 .lname = "Write latency histogram logs",
4466 .type = FIO_OPT_STR,
4467 .off1 = offsetof(struct thread_options, hist_log_file),
4468 .cb = str_write_hist_log_cb,
4469 .help = "Write log of latency histograms during run",
4470 .category = FIO_OPT_C_LOG,
4471 .group = FIO_OPT_G_INVALID,
4474 .name = "log_max_value",
4475 .lname = "Log maximum instead of average",
4476 .type = FIO_OPT_BOOL,
4477 .off1 = offsetof(struct thread_options, log_max),
4478 .help = "Log max sample in a window instead of average",
4480 .category = FIO_OPT_C_LOG,
4481 .group = FIO_OPT_G_INVALID,
4484 .name = "log_offset",
4485 .lname = "Log offset of IO",
4486 .type = FIO_OPT_BOOL,
4487 .off1 = offsetof(struct thread_options, log_offset),
4488 .help = "Include offset of IO for each log entry",
4490 .category = FIO_OPT_C_LOG,
4491 .group = FIO_OPT_G_INVALID,
4495 .lname = "Log priority of IO",
4496 .type = FIO_OPT_BOOL,
4497 .off1 = offsetof(struct thread_options, log_prio),
4498 .help = "Include priority value of IO for each log entry",
4500 .category = FIO_OPT_C_LOG,
4501 .group = FIO_OPT_G_INVALID,
4505 .name = "log_compression",
4506 .lname = "Log compression",
4507 .type = FIO_OPT_INT,
4508 .off1 = offsetof(struct thread_options, log_gz),
4509 .help = "Log in compressed chunks of this size",
4511 .maxval = 512 * 1024 * 1024ULL,
4512 .category = FIO_OPT_C_LOG,
4513 .group = FIO_OPT_G_INVALID,
4515 #ifdef FIO_HAVE_CPU_AFFINITY
4517 .name = "log_compression_cpus",
4518 .lname = "Log Compression CPUs",
4519 .type = FIO_OPT_STR,
4520 .cb = str_log_cpus_allowed_cb,
4521 .off1 = offsetof(struct thread_options, log_gz_cpumask),
4522 .parent = "log_compression",
4523 .help = "Limit log compression to these CPUs",
4524 .category = FIO_OPT_C_LOG,
4525 .group = FIO_OPT_G_INVALID,
4529 .name = "log_compression_cpus",
4530 .lname = "Log Compression CPUs",
4531 .type = FIO_OPT_UNSUPPORTED,
4532 .help = "Your platform does not support CPU affinities",
4536 .name = "log_store_compressed",
4537 .lname = "Log store compressed",
4538 .type = FIO_OPT_BOOL,
4539 .off1 = offsetof(struct thread_options, log_gz_store),
4540 .help = "Store logs in a compressed format",
4541 .category = FIO_OPT_C_LOG,
4542 .group = FIO_OPT_G_INVALID,
4546 .name = "log_compression",
4547 .lname = "Log compression",
4548 .type = FIO_OPT_UNSUPPORTED,
4549 .help = "Install libz-dev(el) to get compression support",
4552 .name = "log_store_compressed",
4553 .lname = "Log store compressed",
4554 .type = FIO_OPT_UNSUPPORTED,
4555 .help = "Install libz-dev(el) to get compression support",
4559 .name = "log_unix_epoch",
4560 .lname = "Log epoch unix",
4561 .type = FIO_OPT_BOOL,
4562 .off1 = offsetof(struct thread_options, log_unix_epoch),
4563 .help = "Use Unix time in log files",
4564 .category = FIO_OPT_C_LOG,
4565 .group = FIO_OPT_G_INVALID,
4568 .name = "log_alternate_epoch",
4569 .lname = "Log epoch alternate",
4570 .type = FIO_OPT_BOOL,
4571 .off1 = offsetof(struct thread_options, log_alternate_epoch),
4572 .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.",
4573 .category = FIO_OPT_C_LOG,
4574 .group = FIO_OPT_G_INVALID,
4577 .name = "log_alternate_epoch_clock_id",
4578 .lname = "Log alternate epoch clock_id",
4579 .type = FIO_OPT_INT,
4580 .off1 = offsetof(struct thread_options, log_alternate_epoch_clock_id),
4581 .help = "If log_alternate_epoch or log_unix_epoch is true, this option specifies the clock_id from clock_gettime whose epoch should be used. If neither of those is true, this option has no effect. Default value is 0, or CLOCK_REALTIME",
4582 .category = FIO_OPT_C_LOG,
4583 .group = FIO_OPT_G_INVALID,
4586 .name = "block_error_percentiles",
4587 .lname = "Block error percentiles",
4588 .type = FIO_OPT_BOOL,
4589 .off1 = offsetof(struct thread_options, block_error_hist),
4590 .help = "Record trim block errors and make a histogram",
4592 .category = FIO_OPT_C_LOG,
4593 .group = FIO_OPT_G_INVALID,
4596 .name = "bwavgtime",
4597 .lname = "Bandwidth average time",
4598 .type = FIO_OPT_INT,
4599 .off1 = offsetof(struct thread_options, bw_avg_time),
4600 .help = "Time window over which to calculate bandwidth"
4603 .parent = "write_bw_log",
4606 .category = FIO_OPT_C_LOG,
4607 .group = FIO_OPT_G_INVALID,
4610 .name = "iopsavgtime",
4611 .lname = "IOPS average time",
4612 .type = FIO_OPT_INT,
4613 .off1 = offsetof(struct thread_options, iops_avg_time),
4614 .help = "Time window over which to calculate IOPS (msec)",
4616 .parent = "write_iops_log",
4619 .category = FIO_OPT_C_LOG,
4620 .group = FIO_OPT_G_INVALID,
4623 .name = "group_reporting",
4624 .lname = "Group reporting",
4625 .type = FIO_OPT_STR_SET,
4626 .off1 = offsetof(struct thread_options, group_reporting),
4627 .help = "Do reporting on a per-group basis",
4628 .category = FIO_OPT_C_STAT,
4629 .group = FIO_OPT_G_INVALID,
4634 .type = FIO_OPT_BOOL,
4635 .off1 = offsetof(struct thread_options, stats),
4636 .help = "Enable collection of stats",
4638 .category = FIO_OPT_C_STAT,
4639 .group = FIO_OPT_G_INVALID,
4642 .name = "zero_buffers",
4643 .lname = "Zero I/O buffers",
4644 .type = FIO_OPT_STR_SET,
4645 .off1 = offsetof(struct thread_options, zero_buffers),
4646 .help = "Init IO buffers to all zeroes",
4647 .category = FIO_OPT_C_IO,
4648 .group = FIO_OPT_G_IO_BUF,
4651 .name = "refill_buffers",
4652 .lname = "Refill I/O buffers",
4653 .type = FIO_OPT_STR_SET,
4654 .off1 = offsetof(struct thread_options, refill_buffers),
4655 .help = "Refill IO buffers on every IO submit",
4656 .category = FIO_OPT_C_IO,
4657 .group = FIO_OPT_G_IO_BUF,
4660 .name = "scramble_buffers",
4661 .lname = "Scramble I/O buffers",
4662 .type = FIO_OPT_BOOL,
4663 .off1 = offsetof(struct thread_options, scramble_buffers),
4664 .help = "Slightly scramble buffers on every IO submit",
4666 .category = FIO_OPT_C_IO,
4667 .group = FIO_OPT_G_IO_BUF,
4670 .name = "buffer_pattern",
4671 .lname = "Buffer pattern",
4672 .type = FIO_OPT_STR,
4673 .cb = str_buffer_pattern_cb,
4674 .off1 = offsetof(struct thread_options, buffer_pattern),
4675 .help = "Fill pattern for IO buffers",
4676 .category = FIO_OPT_C_IO,
4677 .group = FIO_OPT_G_IO_BUF,
4680 .name = "buffer_compress_percentage",
4681 .lname = "Buffer compression percentage",
4682 .type = FIO_OPT_INT,
4683 .cb = str_buffer_compress_cb,
4684 .off1 = offsetof(struct thread_options, compress_percentage),
4687 .help = "How compressible the buffer is (approximately)",
4689 .category = FIO_OPT_C_IO,
4690 .group = FIO_OPT_G_IO_BUF,
4693 .name = "buffer_compress_chunk",
4694 .lname = "Buffer compression chunk size",
4695 .type = FIO_OPT_INT,
4696 .off1 = offsetof(struct thread_options, compress_chunk),
4697 .parent = "buffer_compress_percentage",
4699 .help = "Size of compressible region in buffer",
4702 .category = FIO_OPT_C_IO,
4703 .group = FIO_OPT_G_IO_BUF,
4706 .name = "dedupe_percentage",
4707 .lname = "Dedupe percentage",
4708 .type = FIO_OPT_INT,
4709 .cb = str_dedupe_cb,
4710 .off1 = offsetof(struct thread_options, dedupe_percentage),
4713 .help = "Percentage of buffers that are dedupable",
4715 .category = FIO_OPT_C_IO,
4716 .group = FIO_OPT_G_IO_BUF,
4719 .name = "dedupe_global",
4720 .lname = "Global deduplication",
4721 .type = FIO_OPT_BOOL,
4722 .off1 = offsetof(struct thread_options, dedupe_global),
4723 .help = "Share deduplication buffers across jobs",
4725 .category = FIO_OPT_C_IO,
4726 .group = FIO_OPT_G_IO_BUF,
4729 .name = "dedupe_mode",
4730 .lname = "Dedupe mode",
4731 .help = "Mode for the deduplication buffer generation",
4732 .type = FIO_OPT_STR,
4733 .off1 = offsetof(struct thread_options, dedupe_mode),
4734 .parent = "dedupe_percentage",
4736 .category = FIO_OPT_C_IO,
4737 .group = FIO_OPT_G_IO_BUF,
4740 .oval = DEDUPE_MODE_REPEAT,
4741 .help = "repeat previous page",
4743 { .ival = "working_set",
4744 .oval = DEDUPE_MODE_WORKING_SET,
4745 .help = "choose a page randomly from limited working set defined in dedupe_working_set_percentage",
4750 .name = "dedupe_working_set_percentage",
4751 .lname = "Dedupe working set percentage",
4752 .help = "Dedupe working set size in percentages from file or device size used to generate dedupe patterns from",
4753 .type = FIO_OPT_INT,
4754 .off1 = offsetof(struct thread_options, dedupe_working_set_percentage),
4755 .parent = "dedupe_percentage",
4759 .category = FIO_OPT_C_IO,
4760 .group = FIO_OPT_G_IO_BUF,
4763 .name = "clat_percentiles",
4764 .lname = "Completion latency percentiles",
4765 .type = FIO_OPT_BOOL,
4766 .off1 = offsetof(struct thread_options, clat_percentiles),
4767 .help = "Enable the reporting of completion latency percentiles",
4769 .category = FIO_OPT_C_STAT,
4770 .group = FIO_OPT_G_INVALID,
4773 .name = "lat_percentiles",
4774 .lname = "IO latency percentiles",
4775 .type = FIO_OPT_BOOL,
4776 .off1 = offsetof(struct thread_options, lat_percentiles),
4777 .help = "Enable the reporting of IO latency percentiles",
4779 .category = FIO_OPT_C_STAT,
4780 .group = FIO_OPT_G_INVALID,
4783 .name = "slat_percentiles",
4784 .lname = "Submission latency percentiles",
4785 .type = FIO_OPT_BOOL,
4786 .off1 = offsetof(struct thread_options, slat_percentiles),
4787 .help = "Enable the reporting of submission latency percentiles",
4789 .category = FIO_OPT_C_STAT,
4790 .group = FIO_OPT_G_INVALID,
4793 .name = "percentile_list",
4794 .lname = "Percentile list",
4795 .type = FIO_OPT_FLOAT_LIST,
4796 .off1 = offsetof(struct thread_options, percentile_list),
4797 .off2 = offsetof(struct thread_options, percentile_precision),
4798 .help = "Specify a custom list of percentiles to report for "
4799 "completion latency and block errors",
4800 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
4801 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4804 .category = FIO_OPT_C_STAT,
4805 .group = FIO_OPT_G_INVALID,
4808 .name = "significant_figures",
4809 .lname = "Significant figures",
4810 .type = FIO_OPT_INT,
4811 .off1 = offsetof(struct thread_options, sig_figs),
4814 .help = "Significant figures for output-format set to normal",
4817 .category = FIO_OPT_C_STAT,
4818 .group = FIO_OPT_G_INVALID,
4821 #ifdef FIO_HAVE_DISK_UTIL
4823 .name = "disk_util",
4824 .lname = "Disk utilization",
4825 .type = FIO_OPT_BOOL,
4826 .off1 = offsetof(struct thread_options, do_disk_util),
4827 .help = "Log disk utilization statistics",
4829 .category = FIO_OPT_C_STAT,
4830 .group = FIO_OPT_G_INVALID,
4834 .name = "disk_util",
4835 .lname = "Disk utilization",
4836 .type = FIO_OPT_UNSUPPORTED,
4837 .help = "Your platform does not support disk utilization",
4841 .name = "gtod_reduce",
4842 .lname = "Reduce gettimeofday() calls",
4843 .type = FIO_OPT_BOOL,
4844 .help = "Greatly reduce number of gettimeofday() calls",
4845 .cb = str_gtod_reduce_cb,
4848 .category = FIO_OPT_C_STAT,
4849 .group = FIO_OPT_G_INVALID,
4852 .name = "disable_lat",
4853 .lname = "Disable all latency stats",
4854 .type = FIO_OPT_BOOL,
4855 .off1 = offsetof(struct thread_options, disable_lat),
4856 .help = "Disable latency numbers",
4857 .parent = "gtod_reduce",
4860 .category = FIO_OPT_C_STAT,
4861 .group = FIO_OPT_G_INVALID,
4864 .name = "disable_clat",
4865 .lname = "Disable completion latency stats",
4866 .type = FIO_OPT_BOOL,
4867 .off1 = offsetof(struct thread_options, disable_clat),
4868 .help = "Disable completion latency numbers",
4869 .parent = "gtod_reduce",
4872 .category = FIO_OPT_C_STAT,
4873 .group = FIO_OPT_G_INVALID,
4876 .name = "disable_slat",
4877 .lname = "Disable submission latency stats",
4878 .type = FIO_OPT_BOOL,
4879 .off1 = offsetof(struct thread_options, disable_slat),
4880 .help = "Disable submission latency numbers",
4881 .parent = "gtod_reduce",
4884 .category = FIO_OPT_C_STAT,
4885 .group = FIO_OPT_G_INVALID,
4888 .name = "disable_bw_measurement",
4889 .alias = "disable_bw",
4890 .lname = "Disable bandwidth stats",
4891 .type = FIO_OPT_BOOL,
4892 .off1 = offsetof(struct thread_options, disable_bw),
4893 .help = "Disable bandwidth logging",
4894 .parent = "gtod_reduce",
4897 .category = FIO_OPT_C_STAT,
4898 .group = FIO_OPT_G_INVALID,
4902 .lname = "Dedicated gettimeofday() CPU",
4903 .type = FIO_OPT_INT,
4904 .off1 = offsetof(struct thread_options, gtod_cpu),
4905 .help = "Set up dedicated gettimeofday() thread on this CPU",
4906 .verify = gtod_cpu_verify,
4907 .category = FIO_OPT_C_GENERAL,
4908 .group = FIO_OPT_G_CLOCK,
4911 .name = "unified_rw_reporting",
4912 .lname = "Unified RW Reporting",
4913 .type = FIO_OPT_STR,
4914 .off1 = offsetof(struct thread_options, unified_rw_rep),
4915 .help = "Unify reporting across data direction",
4917 .category = FIO_OPT_C_GENERAL,
4918 .group = FIO_OPT_G_INVALID,
4921 .oval = UNIFIED_SPLIT,
4922 .help = "Normal statistics reporting",
4925 .oval = UNIFIED_MIXED,
4926 .help = "Statistics are summed per data direction and reported together",
4929 .oval = UNIFIED_BOTH,
4930 .help = "Statistics are reported normally, followed by the mixed statistics"
4932 /* Compatibility with former boolean values */
4934 .oval = UNIFIED_SPLIT,
4935 .help = "Alias for 'none'",
4938 .oval = UNIFIED_MIXED,
4939 .help = "Alias for 'mixed'",
4942 .oval = UNIFIED_BOTH,
4943 .help = "Alias for 'both'",
4948 .name = "continue_on_error",
4949 .lname = "Continue on error",
4950 .type = FIO_OPT_STR,
4951 .off1 = offsetof(struct thread_options, continue_on_error),
4952 .help = "Continue on non-fatal errors during IO",
4954 .category = FIO_OPT_C_GENERAL,
4955 .group = FIO_OPT_G_ERR,
4958 .oval = ERROR_TYPE_NONE,
4959 .help = "Exit when an error is encountered",
4962 .oval = ERROR_TYPE_READ,
4963 .help = "Continue on read errors only",
4966 .oval = ERROR_TYPE_WRITE,
4967 .help = "Continue on write errors only",
4970 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
4971 .help = "Continue on any IO errors",
4974 .oval = ERROR_TYPE_VERIFY,
4975 .help = "Continue on verify errors only",
4978 .oval = ERROR_TYPE_ANY,
4979 .help = "Continue on all io and verify errors",
4982 .oval = ERROR_TYPE_NONE,
4983 .help = "Alias for 'none'",
4986 .oval = ERROR_TYPE_ANY,
4987 .help = "Alias for 'all'",
4992 .name = "ignore_error",
4993 .lname = "Ignore Error",
4994 .type = FIO_OPT_STR,
4995 .cb = str_ignore_error_cb,
4996 .off1 = offsetof(struct thread_options, ignore_error_nr),
4997 .help = "Set a specific list of errors to ignore",
4999 .category = FIO_OPT_C_GENERAL,
5000 .group = FIO_OPT_G_ERR,
5003 .name = "error_dump",
5004 .lname = "Error Dump",
5005 .type = FIO_OPT_BOOL,
5006 .off1 = offsetof(struct thread_options, error_dump),
5008 .help = "Dump info on each error",
5009 .category = FIO_OPT_C_GENERAL,
5010 .group = FIO_OPT_G_ERR,
5015 .type = FIO_OPT_STR_STORE,
5016 .off1 = offsetof(struct thread_options, profile),
5017 .help = "Select a specific builtin performance test",
5018 .category = FIO_OPT_C_PROFILE,
5019 .group = FIO_OPT_G_INVALID,
5024 .type = FIO_OPT_STR_STORE,
5025 .off1 = offsetof(struct thread_options, cgroup),
5026 .help = "Add job to cgroup of this name",
5027 .category = FIO_OPT_C_GENERAL,
5028 .group = FIO_OPT_G_CGROUP,
5031 .name = "cgroup_nodelete",
5032 .lname = "Cgroup no-delete",
5033 .type = FIO_OPT_BOOL,
5034 .off1 = offsetof(struct thread_options, cgroup_nodelete),
5035 .help = "Do not delete cgroups after job completion",
5038 .category = FIO_OPT_C_GENERAL,
5039 .group = FIO_OPT_G_CGROUP,
5042 .name = "cgroup_weight",
5043 .lname = "Cgroup weight",
5044 .type = FIO_OPT_INT,
5045 .off1 = offsetof(struct thread_options, cgroup_weight),
5046 .help = "Use given weight for cgroup",
5050 .category = FIO_OPT_C_GENERAL,
5051 .group = FIO_OPT_G_CGROUP,
5056 .type = FIO_OPT_INT,
5057 .off1 = offsetof(struct thread_options, uid),
5058 .help = "Run job with this user ID",
5059 .category = FIO_OPT_C_GENERAL,
5060 .group = FIO_OPT_G_CRED,
5064 .lname = "Group ID",
5065 .type = FIO_OPT_INT,
5066 .off1 = offsetof(struct thread_options, gid),
5067 .help = "Run job with this group ID",
5068 .category = FIO_OPT_C_GENERAL,
5069 .group = FIO_OPT_G_CRED,
5074 .type = FIO_OPT_STR,
5075 .off1 = offsetof(struct thread_options, kb_base),
5081 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
5085 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
5088 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
5089 .category = FIO_OPT_C_GENERAL,
5090 .group = FIO_OPT_G_INVALID,
5093 .name = "unit_base",
5094 .lname = "Unit for quantities of data (Bits or Bytes)",
5095 .type = FIO_OPT_STR,
5096 .off1 = offsetof(struct thread_options, unit_base),
5101 .help = "Auto-detect",
5104 .oval = N2S_BYTEPERSEC,
5105 .help = "Normal (byte based)",
5108 .oval = N2S_BITPERSEC,
5109 .help = "Bit based",
5112 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
5113 .category = FIO_OPT_C_GENERAL,
5114 .group = FIO_OPT_G_INVALID,
5117 .name = "hugepage-size",
5118 .lname = "Hugepage size",
5119 .type = FIO_OPT_INT,
5120 .off1 = offsetof(struct thread_options, hugepage_size),
5121 .help = "When using hugepages, specify size of each page",
5122 .def = __fio_stringify(FIO_HUGE_PAGE),
5123 .interval = 1024 * 1024,
5124 .category = FIO_OPT_C_GENERAL,
5125 .group = FIO_OPT_G_INVALID,
5129 .lname = "I/O flow ID",
5130 .type = FIO_OPT_INT,
5131 .off1 = offsetof(struct thread_options, flow_id),
5132 .help = "The flow index ID to use",
5134 .category = FIO_OPT_C_IO,
5135 .group = FIO_OPT_G_IO_FLOW,
5139 .lname = "I/O flow weight",
5140 .type = FIO_OPT_INT,
5141 .off1 = offsetof(struct thread_options, flow),
5142 .help = "Weight for flow control of this job",
5143 .parent = "flow_id",
5146 .maxval = FLOW_MAX_WEIGHT,
5147 .category = FIO_OPT_C_IO,
5148 .group = FIO_OPT_G_IO_FLOW,
5151 .name = "flow_watermark",
5152 .lname = "I/O flow watermark",
5153 .type = FIO_OPT_SOFT_DEPRECATED,
5154 .category = FIO_OPT_C_IO,
5155 .group = FIO_OPT_G_IO_FLOW,
5158 .name = "flow_sleep",
5159 .lname = "I/O flow sleep",
5160 .type = FIO_OPT_INT,
5161 .off1 = offsetof(struct thread_options, flow_sleep),
5162 .help = "How many microseconds to sleep after being held"
5163 " back by the flow control mechanism",
5164 .parent = "flow_id",
5167 .category = FIO_OPT_C_IO,
5168 .group = FIO_OPT_G_IO_FLOW,
5171 .name = "steadystate",
5172 .lname = "Steady state threshold",
5174 .type = FIO_OPT_STR,
5175 .off1 = offsetof(struct thread_options, ss_state),
5176 .cb = str_steadystate_cb,
5177 .help = "Define the criterion and limit to judge when a job has reached steady state",
5178 .def = "iops_slope:0.01%",
5181 .oval = FIO_SS_IOPS,
5182 .help = "maximum mean deviation of IOPS measurements",
5184 { .ival = "iops_slope",
5185 .oval = FIO_SS_IOPS_SLOPE,
5186 .help = "slope calculated from IOPS measurements",
5190 .help = "maximum mean deviation of bandwidth measurements",
5194 .oval = FIO_SS_BW_SLOPE,
5195 .help = "slope calculated from bandwidth measurements",
5198 .category = FIO_OPT_C_GENERAL,
5199 .group = FIO_OPT_G_RUNTIME,
5202 .name = "steadystate_duration",
5203 .lname = "Steady state duration",
5205 .parent = "steadystate",
5206 .type = FIO_OPT_STR_VAL_TIME,
5207 .off1 = offsetof(struct thread_options, ss_dur),
5208 .help = "Stop workload upon attaining steady state for specified duration",
5212 .category = FIO_OPT_C_GENERAL,
5213 .group = FIO_OPT_G_RUNTIME,
5216 .name = "steadystate_ramp_time",
5217 .lname = "Steady state ramp time",
5219 .parent = "steadystate",
5220 .type = FIO_OPT_STR_VAL_TIME,
5221 .off1 = offsetof(struct thread_options, ss_ramp_time),
5222 .help = "Delay before initiation of data collection for steady state job termination testing",
5226 .category = FIO_OPT_C_GENERAL,
5227 .group = FIO_OPT_G_RUNTIME,
5230 .name = "steadystate_check_interval",
5231 .lname = "Steady state check interval",
5232 .alias = "ss_interval",
5233 .parent = "steadystate",
5234 .type = FIO_OPT_STR_VAL_TIME,
5235 .off1 = offsetof(struct thread_options, ss_check_interval),
5236 .help = "Polling interval for the steady state check (too low means steadystate will not converge)",
5240 .category = FIO_OPT_C_GENERAL,
5241 .group = FIO_OPT_G_RUNTIME,
5248 static void add_to_lopt(struct option *lopt, struct fio_option *o,
5249 const char *name, int val)
5251 lopt->name = (char *) name;
5253 if (o->type == FIO_OPT_STR_SET)
5254 lopt->has_arg = optional_argument;
5256 lopt->has_arg = required_argument;
5259 static void options_to_lopts(struct fio_option *opts,
5260 struct option *long_options,
5261 int i, int option_type)
5263 struct fio_option *o = &opts[0];
5265 add_to_lopt(&long_options[i], o, o->name, option_type);
5268 add_to_lopt(&long_options[i], o, o->alias, option_type);
5273 assert(i < FIO_NR_OPTIONS);
5277 void fio_options_set_ioengine_opts(struct option *long_options,
5278 struct thread_data *td)
5283 while (long_options[i].name) {
5284 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
5285 memset(&long_options[i], 0, sizeof(*long_options));
5292 * Just clear out the prior ioengine options.
5297 options_to_lopts(td->io_ops->options, long_options, i,
5298 FIO_GETOPT_IOENGINE);
5301 void fio_options_dup_and_init(struct option *long_options)
5305 options_init(fio_options);
5308 while (long_options[i].name)
5311 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
5314 struct fio_keyword {
5320 static struct fio_keyword fio_keywords[] = {
5322 .word = "$pagesize",
5323 .desc = "Page size in the system",
5326 .word = "$mb_memory",
5327 .desc = "Megabytes of memory online",
5331 .desc = "Number of CPUs online in the system",
5338 void fio_keywords_exit(void)
5340 struct fio_keyword *kw;
5342 kw = &fio_keywords[0];
5350 void fio_keywords_init(void)
5352 unsigned long long mb_memory;
5356 sprintf(buf, "%lu", (unsigned long) page_size);
5357 fio_keywords[0].replace = strdup(buf);
5359 mb_memory = os_phys_mem() / (1024 * 1024);
5360 sprintf(buf, "%llu", mb_memory);
5361 fio_keywords[1].replace = strdup(buf);
5363 l = cpus_configured();
5364 sprintf(buf, "%lu", l);
5365 fio_keywords[2].replace = strdup(buf);
5370 static char *bc_calc(char *str)
5372 char buf[128], *tmp;
5377 * No math, just return string
5379 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
5380 !strchr(str, '/')) || strchr(str, '\''))
5384 * Split option from value, we only need to calculate the value
5386 tmp = strchr(str, '=');
5393 * Prevent buffer overflows; such a case isn't reasonable anyway
5395 if (strlen(str) >= 128 || strlen(tmp) > 100)
5398 sprintf(buf, "which %s > /dev/null", BC_APP);
5400 log_err("fio: bc is needed for performing math\n");
5404 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
5405 f = popen(buf, "r");
5409 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
5416 buf[(tmp - str) + ret - 1] = '\0';
5417 memcpy(buf, str, tmp - str);
5423 * Return a copy of the input string with substrings of the form ${VARNAME}
5424 * substituted with the value of the environment variable VARNAME. The
5425 * substitution always occurs, even if VARNAME is empty or the corresponding
5426 * environment variable undefined.
5428 char *fio_option_dup_subs(const char *opt)
5430 char out[OPT_LEN_MAX+1];
5431 char in[OPT_LEN_MAX+1];
5434 char *ch1, *ch2, *env;
5435 ssize_t nchr = OPT_LEN_MAX;
5438 if (strlen(opt) + 1 > OPT_LEN_MAX) {
5439 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
5443 snprintf(in, sizeof(in), "%s", opt);
5445 while (*inptr && nchr > 0) {
5446 if (inptr[0] == '$' && inptr[1] == '{') {
5447 ch2 = strchr(inptr, '}');
5448 if (ch2 && inptr+1 < ch2) {
5455 envlen = strlen(env);
5456 if (envlen <= nchr) {
5457 memcpy(outptr, env, envlen);
5467 *outptr++ = *inptr++;
5476 * Look for reserved variable names and replace them with real values
5478 static char *fio_keyword_replace(char *opt)
5484 for (i = 0; fio_keywords[i].word != NULL; i++) {
5485 struct fio_keyword *kw = &fio_keywords[i];
5487 while ((s = strstr(opt, kw->word)) != NULL) {
5488 char *new = calloc(strlen(opt) + 1, 1);
5494 * Copy part of the string before the keyword and
5495 * sprintf() the replacement after it.
5497 memcpy(new, opt, olen);
5498 len = sprintf(new + olen, "%s", kw->replace);
5501 * If there's more in the original string, copy that
5504 opt += olen + strlen(kw->word);
5505 /* keeps final zero thanks to calloc */
5507 memcpy(new + olen + len, opt, strlen(opt));
5510 * replace opt and free the old opt
5520 * Check for potential math and invoke bc, if possible
5528 static char **dup_and_sub_options(char **opts, int num_opts)
5531 char **opts_copy = malloc(num_opts * sizeof(*opts));
5532 for (i = 0; i < num_opts; i++) {
5533 opts_copy[i] = fio_option_dup_subs(opts[i]);
5536 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
5541 static void show_closest_option(const char *opt)
5543 int best_option, best_distance;
5552 while (name[i] != '\0' && name[i] != '=')
5557 best_distance = INT_MAX;
5559 while (fio_options[i].name) {
5560 distance = string_distance(name, fio_options[i].name);
5561 if (distance < best_distance) {
5562 best_distance = distance;
5568 if (best_option != -1 && string_distance_ok(name, best_distance) &&
5569 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
5570 log_err("Did you mean %s?\n", fio_options[best_option].name);
5575 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
5577 int i, ret, unknown;
5580 sort_options(opts, fio_options, num_opts);
5581 opts_copy = dup_and_sub_options(opts, num_opts);
5583 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
5584 const struct fio_option *o;
5585 int newret = parse_option(opts_copy[i], opts[i], fio_options,
5586 &o, &td->o, &td->opt_list);
5589 fio_option_mark_set(&td->o, o);
5597 opts_copy[i] = NULL;
5604 ret |= ioengine_load(td);
5606 sort_options(opts_copy, td->io_ops->options, num_opts);
5609 for (i = 0; i < num_opts; i++) {
5610 const struct fio_option *o = NULL;
5617 newret = parse_option(opts_copy[i], opts[i],
5618 td->io_ops->options, &o,
5619 td->eo, &td->opt_list);
5623 log_err("Bad option <%s>\n", opts[i]);
5624 show_closest_option(opts[i]);
5627 opts_copy[i] = NULL;
5635 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
5639 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
5641 const struct fio_option *o;
5643 o = find_option_c(fio_options, opt);
5645 fio_option_mark_set(&td->o, o);
5651 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
5654 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
5658 void fio_fill_default_options(struct thread_data *td)
5660 td->o.magic = OPT_MAGIC;
5661 fill_default_options(&td->o, fio_options);
5664 int fio_show_option_help(const char *opt)
5666 return show_cmd_help(fio_options, opt);
5670 * dupe FIO_OPT_STR_STORE options
5672 void fio_options_mem_dupe(struct thread_data *td)
5674 options_mem_dupe(fio_options, &td->o);
5676 if (td->eo && td->io_ops) {
5677 void *oldeo = td->eo;
5679 td->eo = malloc(td->io_ops->option_struct_size);
5680 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
5681 options_mem_dupe(td->io_ops->options, td->eo);
5685 unsigned int fio_get_kb_base(void *data)
5687 struct thread_data *td = cb_data_to_td(data);
5688 struct thread_options *o = &td->o;
5689 unsigned int kb_base = 0;
5692 * This is a hack... For private options, *data is not holding
5693 * a pointer to the thread_options, but to private data. This means
5694 * we can't safely dereference it, but magic is first so mem wise
5695 * it is valid. But this also means that if the job first sets
5696 * kb_base and expects that to be honored by private options,
5697 * it will be disappointed. We will return the global default
5700 if (o && o->magic == OPT_MAGIC)
5701 kb_base = o->kb_base;
5708 int add_option(const struct fio_option *o)
5710 struct fio_option *__o;
5719 if (opt_index + 1 == FIO_MAX_OPTS) {
5720 log_err("fio: FIO_MAX_OPTS is too small\n");
5724 memcpy(&fio_options[opt_index], o, sizeof(*o));
5725 fio_options[opt_index + 1].name = NULL;
5729 void invalidate_profile_options(const char *prof_name)
5731 struct fio_option *o;
5735 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5736 o->type = FIO_OPT_INVALID;
5737 o->prof_name = NULL;
5743 void add_opt_posval(const char *optname, const char *ival, const char *help)
5745 struct fio_option *o;
5748 o = find_option(fio_options, optname);
5752 for (i = 0; i < PARSE_MAX_VP; i++) {
5753 if (o->posval[i].ival)
5756 o->posval[i].ival = ival;
5757 o->posval[i].help = help;
5762 void del_opt_posval(const char *optname, const char *ival)
5764 struct fio_option *o;
5767 o = find_option(fio_options, optname);
5771 for (i = 0; i < PARSE_MAX_VP; i++) {
5772 if (!o->posval[i].ival)
5774 if (strcmp(o->posval[i].ival, ival))
5777 o->posval[i].ival = NULL;
5778 o->posval[i].help = NULL;
5782 void fio_options_free(struct thread_data *td)
5784 options_free(fio_options, &td->o);
5785 if (td->eo && td->io_ops && td->io_ops->options) {
5786 options_free(td->io_ops->options, td->eo);
5792 void fio_dump_options_free(struct thread_data *td)
5794 while (!flist_empty(&td->opt_list)) {
5795 struct print_option *p;
5797 p = flist_first_entry(&td->opt_list, struct print_option, list);
5798 flist_del_init(&p->list);
5805 struct fio_option *fio_option_find(const char *name)
5807 return find_option(fio_options, name);
5810 static struct fio_option *find_next_opt(struct fio_option *from,
5813 struct fio_option *opt;
5816 from = &fio_options[0];
5822 if (off1 == from->off1) {
5827 } while (from->name);
5832 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5834 unsigned int opt_off, index, offset;
5836 opt_off = opt - &fio_options[0];
5837 index = opt_off / (8 * sizeof(uint64_t));
5838 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5839 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
5842 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
5844 struct fio_option *opt, *next;
5847 while ((opt = find_next_opt(next, off1)) != NULL) {
5848 if (opt_is_set(o, opt))
5857 void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt)
5859 unsigned int opt_off, index, offset;
5861 opt_off = opt - &fio_options[0];
5862 index = opt_off / (8 * sizeof(uint64_t));
5863 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5864 o->set_options[index] |= (uint64_t)1 << offset;