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_DP_IDS) {
274 unsigned long long id = strtoull(v, NULL, 0);
276 log_err("Placement IDs cannot exceed 0xFFFF\n");
280 td->o.dp_ids[i++] = id;
284 qsort(td->o.dp_ids, i, sizeof(*td->o.dp_ids), fio_fdp_cmp);
290 static int str_bssplit_cb(void *data, const char *input)
292 struct thread_data *td = cb_data_to_td(data);
296 p = str = strdup(input);
298 strip_blank_front(&str);
299 strip_blank_end(str);
301 ret = str_split_parse(td, str, bssplit_ddir, NULL, false);
303 if (parse_dryrun()) {
306 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
307 free(td->o.bssplit[i]);
308 td->o.bssplit[i] = NULL;
309 td->o.bssplit_nr[i] = 0;
317 static int parse_cmdprio_bssplit_entry(struct thread_options *o,
318 struct split_prio *entry, char *str)
323 unsigned int perc = 0, class, level, hint;
326 * valid entry formats:
327 * bs/ - %s/ - set perc to 0, prio to -1.
328 * bs/perc - %s/%u - set prio to -1.
329 * bs/perc/class/level - %s/%u/%u/%u
330 * bs/perc/class/level/hint - %s/%u/%u/%u/%u
332 matches = sscanf(str, "%m[^/]/%u/%u/%u/%u",
333 &bs_str, &perc, &class, &level, &hint);
335 log_err("fio: invalid cmdprio_bssplit format\n");
339 if (str_to_decimal(bs_str, &bs_val, 1, o, 0, 0)) {
340 log_err("fio: split conversion failed\n");
347 entry->perc = min(perc, 100u);
350 case 1: /* bs/ case */
351 case 2: /* bs/perc case */
353 case 4: /* bs/perc/class/level case */
354 case 5: /* bs/perc/class/level/hint case */
355 class = min(class, (unsigned int) IOPRIO_MAX_PRIO_CLASS);
356 level = min(level, (unsigned int) IOPRIO_MAX_PRIO);
358 hint = min(hint, (unsigned int) IOPRIO_MAX_PRIO_HINT);
361 entry->prio = ioprio_value(class, level, hint);
364 log_err("fio: invalid cmdprio_bssplit format\n");
372 * Returns a negative integer if the first argument should be before the second
373 * argument in the sorted list. A positive integer if the first argument should
374 * be after the second argument in the sorted list. A zero if they are equal.
376 static int fio_split_prio_cmp(const void *p1, const void *p2)
378 const struct split_prio *tmp1 = p1;
379 const struct split_prio *tmp2 = p2;
381 if (tmp1->bs > tmp2->bs)
383 if (tmp1->bs < tmp2->bs)
388 int split_parse_prio_ddir(struct thread_options *o, struct split_prio **entries,
389 int *nr_entries, char *str)
391 struct split_prio *tmp_entries;
392 unsigned int nr_bssplits;
393 char *str_cpy, *p, *fname;
395 /* strsep modifies the string, dup it so that we can use strsep twice */
396 p = str_cpy = strdup(str);
401 while ((fname = strsep(&str_cpy, ":")) != NULL) {
408 if (nr_bssplits > BSSPLIT_MAX) {
409 log_err("fio: too many cmdprio_bssplit entries\n");
413 tmp_entries = calloc(nr_bssplits, sizeof(*tmp_entries));
418 while ((fname = strsep(&str, ":")) != NULL) {
419 struct split_prio *entry;
424 entry = &tmp_entries[nr_bssplits];
426 if (parse_cmdprio_bssplit_entry(o, entry, fname)) {
427 log_err("fio: failed to parse cmdprio_bssplit entry\n");
432 /* skip zero perc entries, they provide no useful information */
437 qsort(tmp_entries, nr_bssplits, sizeof(*tmp_entries),
440 *entries = tmp_entries;
441 *nr_entries = nr_bssplits;
446 static int str2error(char *str)
448 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
449 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
450 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
451 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
452 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
453 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
454 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
455 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
456 int i = 0, num = sizeof(err) / sizeof(char *);
459 if (!strcmp(err[i], str))
466 static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
473 if (etype >= ERROR_TYPE_CNT) {
474 log_err("Illegal error type\n");
478 td->o.ignore_error_nr[etype] = 4;
479 error = calloc(4, sizeof(int));
482 while ((fname = strsep(&str, ":")) != NULL) {
488 * grow struct buffer, if needed
490 if (i == td->o.ignore_error_nr[etype]) {
491 td->o.ignore_error_nr[etype] <<= 1;
492 error = realloc(error, td->o.ignore_error_nr[etype]
495 if (fname[0] == 'E') {
496 error[i] = str2error(fname);
498 error[i] = atoi(fname);
500 error[i] = -error[i];
503 log_err("Unknown error %s, please use number value\n",
505 td->o.ignore_error_nr[etype] = 0;
512 td->o.continue_on_error |= 1 << etype;
513 td->o.ignore_error_nr[etype] = i;
514 td->o.ignore_error[etype] = error;
516 td->o.ignore_error_nr[etype] = 0;
524 static int str_replay_skip_cb(void *data, const char *input)
526 struct thread_data *td = cb_data_to_td(data);
533 p = str = strdup(input);
535 strip_blank_front(&str);
536 strip_blank_end(str);
542 if (!strcmp(p, "read"))
543 td->o.replay_skip |= 1u << DDIR_READ;
544 else if (!strcmp(p, "write"))
545 td->o.replay_skip |= 1u << DDIR_WRITE;
546 else if (!strcmp(p, "trim"))
547 td->o.replay_skip |= 1u << DDIR_TRIM;
548 else if (!strcmp(p, "sync"))
549 td->o.replay_skip |= 1u << DDIR_SYNC;
551 log_err("Unknown skip type: %s\n", p);
561 static int str_ignore_error_cb(void *data, const char *input)
563 struct thread_data *td = cb_data_to_td(data);
566 enum error_type_bit type = 0;
571 p = str = strdup(input);
573 strip_blank_front(&str);
574 strip_blank_end(str);
580 ret = ignore_error_type(td, type, p);
590 static int str_rw_cb(void *data, const char *str)
592 struct thread_data *td = cb_data_to_td(data);
593 struct thread_options *o = &td->o;
602 nr = get_opt_postfix(str);
609 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
610 log_err("fio: randrw postfix parsing failed\n");
614 if ((val <= 0) || (val > UINT_MAX)) {
615 log_err("fio: randrw postfix parsing out of range\n");
619 o->ddir_seq_nr = (unsigned int) val;
623 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
624 log_err("fio: rw postfix parsing failed\n");
629 o->ddir_seq_add = val;
636 static int str_mem_cb(void *data, const char *mem)
638 struct thread_data *td = cb_data_to_td(data);
640 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
641 td->o.mem_type == MEM_MMAPSHARED)
642 td->o.mmapfile = get_opt_postfix(mem);
647 static int fio_clock_source_cb(void *data, const char *str)
649 struct thread_data *td = cb_data_to_td(data);
651 fio_clock_source = td->o.clocksource;
652 fio_clock_source_set = 1;
657 static int str_rwmix_read_cb(void *data, long long *val)
659 struct thread_data *td = cb_data_to_td(data);
661 td->o.rwmix[DDIR_READ] = *val;
662 td->o.rwmix[DDIR_WRITE] = 100 - *val;
666 static int str_rwmix_write_cb(void *data, long long *val)
668 struct thread_data *td = cb_data_to_td(data);
670 td->o.rwmix[DDIR_WRITE] = *val;
671 td->o.rwmix[DDIR_READ] = 100 - *val;
675 static int str_exitall_cb(void)
677 exitall_on_terminate = true;
681 #ifdef FIO_HAVE_CPU_AFFINITY
682 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
684 unsigned int i, index, cpus_in_mask;
685 const long max_cpu = cpus_configured();
687 cpus_in_mask = fio_cpu_count(mask);
691 cpu_index = cpu_index % cpus_in_mask;
694 for (i = 0; i < max_cpu; i++) {
695 if (!fio_cpu_isset(mask, i))
698 if (cpu_index != index)
699 fio_cpu_clear(mask, i);
704 return fio_cpu_count(mask);
707 static int str_cpumask_cb(void *data, unsigned long long *val)
709 struct thread_data *td = cb_data_to_td(data);
717 ret = fio_cpuset_init(&td->o.cpumask);
719 log_err("fio: cpuset_init failed\n");
720 td_verror(td, ret, "fio_cpuset_init");
724 max_cpu = cpus_configured();
726 for (i = 0; i < sizeof(int) * 8; i++) {
727 if ((1 << i) & *val) {
729 log_err("fio: CPU %d too large (max=%ld)\n", i,
733 dprint(FD_PARSE, "set cpu allowed %d\n", i);
734 fio_cpu_set(&td->o.cpumask, i);
741 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
748 ret = fio_cpuset_init(mask);
750 log_err("fio: cpuset_init failed\n");
751 td_verror(td, ret, "fio_cpuset_init");
755 p = str = strdup(input);
757 strip_blank_front(&str);
758 strip_blank_end(str);
760 max_cpu = cpus_configured();
762 while ((cpu = strsep(&str, ",")) != NULL) {
771 while ((cpu2 = strsep(&str2, "-")) != NULL) {
781 while (icpu <= icpu2) {
782 if (icpu >= FIO_MAX_CPUS) {
783 log_err("fio: your OS only supports up to"
784 " %d CPUs\n", (int) FIO_MAX_CPUS);
788 if (icpu >= max_cpu) {
789 log_err("fio: CPU %d too large (max=%ld)\n",
795 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
796 fio_cpu_set(mask, icpu);
807 static int str_cpus_allowed_cb(void *data, const char *input)
809 struct thread_data *td = cb_data_to_td(data);
814 return set_cpus_allowed(td, &td->o.cpumask, input);
817 static int str_verify_cpus_allowed_cb(void *data, const char *input)
819 struct thread_data *td = cb_data_to_td(data);
824 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
828 static int str_log_cpus_allowed_cb(void *data, const char *input)
830 struct thread_data *td = cb_data_to_td(data);
835 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
837 #endif /* CONFIG_ZLIB */
839 #endif /* FIO_HAVE_CPU_AFFINITY */
841 #ifdef CONFIG_LIBNUMA
842 static int str_numa_cpunodes_cb(void *data, char *input)
844 struct thread_data *td = cb_data_to_td(data);
845 struct bitmask *verify_bitmask;
850 /* numa_parse_nodestring() parses a character string list
851 * of nodes into a bit mask. The bit mask is allocated by
852 * numa_allocate_nodemask(), so it should be freed by
853 * numa_free_nodemask().
855 verify_bitmask = numa_parse_nodestring(input);
856 if (verify_bitmask == NULL) {
857 log_err("fio: numa_parse_nodestring failed\n");
858 td_verror(td, 1, "str_numa_cpunodes_cb");
861 numa_free_nodemask(verify_bitmask);
863 td->o.numa_cpunodes = strdup(input);
867 static int str_numa_mpol_cb(void *data, char *input)
869 struct thread_data *td = cb_data_to_td(data);
870 const char * const policy_types[] =
871 { "default", "prefer", "bind", "interleave", "local", NULL };
874 struct bitmask *verify_bitmask;
879 nodelist = strchr(input, ':');
881 /* NUL-terminate mode */
885 for (i = 0; i <= MPOL_LOCAL; i++) {
886 if (!strcmp(input, policy_types[i])) {
887 td->o.numa_mem_mode = i;
891 if (i > MPOL_LOCAL) {
892 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
896 switch (td->o.numa_mem_mode) {
899 * Insist on a nodelist of one node only
902 char *rest = nodelist;
903 while (isdigit(*rest))
906 log_err("fio: one node only for \'prefer\'\n");
910 log_err("fio: one node is needed for \'prefer\'\n");
914 case MPOL_INTERLEAVE:
916 * Default to online nodes with memory if no nodelist
919 nodelist = strdup("all");
924 * Don't allow a nodelist
927 log_err("fio: NO nodelist for \'local\'\n");
933 * Insist on a nodelist
936 log_err("fio: a nodelist is needed for \'bind\'\n");
943 /* numa_parse_nodestring() parses a character string list
944 * of nodes into a bit mask. The bit mask is allocated by
945 * numa_allocate_nodemask(), so it should be freed by
946 * numa_free_nodemask().
948 switch (td->o.numa_mem_mode) {
950 td->o.numa_mem_prefer_node = atoi(nodelist);
952 case MPOL_INTERLEAVE:
954 verify_bitmask = numa_parse_nodestring(nodelist);
955 if (verify_bitmask == NULL) {
956 log_err("fio: numa_parse_nodestring failed\n");
957 td_verror(td, 1, "str_numa_memnodes_cb");
960 td->o.numa_memnodes = strdup(nodelist);
961 numa_free_nodemask(verify_bitmask);
976 static int str_fst_cb(void *data, const char *str)
978 struct thread_data *td = cb_data_to_td(data);
984 td->file_service_nr = 1;
986 switch (td->o.file_service_type) {
987 case FIO_FSERVICE_RANDOM:
988 case FIO_FSERVICE_RR:
989 case FIO_FSERVICE_SEQ:
990 nr = get_opt_postfix(str);
992 td->file_service_nr = atoi(nr);
997 case FIO_FSERVICE_ZIPF:
1000 case FIO_FSERVICE_PARETO:
1001 val = FIO_DEF_PARETO;
1003 case FIO_FSERVICE_GAUSS:
1007 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
1014 nr = get_opt_postfix(str);
1015 if (nr && !split_parse_distr(nr, &val, ¢er)) {
1016 log_err("fio: file service type random postfix parsing failed\n");
1023 if (center != -1 && (center < 0.00 || center > 1.00)) {
1024 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
1027 td->random_center = center;
1029 switch (td->o.file_service_type) {
1030 case FIO_FSERVICE_ZIPF:
1032 log_err("fio: zipf theta must be different than 1.0\n");
1037 td->zipf_theta = val;
1039 case FIO_FSERVICE_PARETO:
1040 if (val <= 0.00 || val >= 1.00) {
1041 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1048 case FIO_FSERVICE_GAUSS:
1049 if (val < 0.00 || val >= 100.00) {
1050 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1055 td->gauss_dev = val;
1062 #ifdef CONFIG_SYNC_FILE_RANGE
1063 static int str_sfr_cb(void *data, const char *str)
1065 struct thread_data *td = cb_data_to_td(data);
1066 char *nr = get_opt_postfix(str);
1068 td->sync_file_range_nr = 1;
1070 td->sync_file_range_nr = atoi(nr);
1078 static int zone_split_ddir(struct thread_options *o, void *eo,
1079 enum fio_ddir ddir, char *str, bool absolute)
1081 unsigned int i, perc, perc_missing, sperc, sperc_missing;
1084 memset(&split, 0, sizeof(split));
1086 if (split_parse_ddir(o, &split, str, absolute, ZONESPLIT_MAX))
1091 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
1092 o->zone_split_nr[ddir] = split.nr;
1093 for (i = 0; i < split.nr; i++) {
1094 o->zone_split[ddir][i].access_perc = split.val1[i];
1096 o->zone_split[ddir][i].size = split.val2[i];
1098 o->zone_split[ddir][i].size_perc = split.val2[i];
1102 * Now check if the percentages add up, and how much is missing
1104 perc = perc_missing = 0;
1105 sperc = sperc_missing = 0;
1106 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1107 struct zone_split *zsp = &o->zone_split[ddir][i];
1109 if (zsp->access_perc == (uint8_t) -1U)
1112 perc += zsp->access_perc;
1115 if (zsp->size_perc == (uint8_t) -1U)
1118 sperc += zsp->size_perc;
1122 if (perc > 100 || sperc > 100) {
1123 log_err("fio: zone_split percentages add to more than 100%%\n");
1124 free(o->zone_split[ddir]);
1125 o->zone_split[ddir] = NULL;
1129 log_err("fio: access percentage don't add up to 100 for zoned "
1130 "random distribution (got=%u)\n", perc);
1131 free(o->zone_split[ddir]);
1132 o->zone_split[ddir] = NULL;
1137 * If values didn't have a percentage set, divide the remains between
1141 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
1143 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1144 struct zone_split *zsp = &o->zone_split[ddir][i];
1146 if (zsp->access_perc == (uint8_t) -1U)
1147 zsp->access_perc = (100 - perc) / perc_missing;
1150 if (sperc_missing) {
1151 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
1153 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
1154 struct zone_split *zsp = &o->zone_split[ddir][i];
1156 if (zsp->size_perc == (uint8_t) -1U)
1157 zsp->size_perc = (100 - sperc) / sperc_missing;
1164 static int parse_zoned_distribution(struct thread_data *td, const char *input,
1167 const char *pre = absolute ? "zoned_abs:" : "zoned:";
1171 p = str = strdup(input);
1173 strip_blank_front(&str);
1174 strip_blank_end(str);
1176 /* We expect it to start like that, bail if not */
1177 if (strncmp(str, pre, strlen(pre))) {
1178 log_err("fio: mismatch in zoned input <%s>\n", str);
1184 ret = str_split_parse(td, str, zone_split_ddir, NULL, absolute);
1188 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1191 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
1193 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
1194 struct zone_split *zsp = &td->o.zone_split[i][j];
1197 dprint(FD_PARSE, "\t%d: %u/%llu\n", j,
1199 (unsigned long long) zsp->size);
1201 dprint(FD_PARSE, "\t%d: %u/%u\n", j,
1208 if (parse_dryrun()) {
1209 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1210 free(td->o.zone_split[i]);
1211 td->o.zone_split[i] = NULL;
1212 td->o.zone_split_nr[i] = 0;
1219 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1220 td->o.zone_split_nr[i] = 0;
1226 static int str_random_distribution_cb(void *data, const char *str)
1228 struct thread_data *td = cb_data_to_td(data);
1233 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1235 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1236 val = FIO_DEF_PARETO;
1237 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1239 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1240 return parse_zoned_distribution(td, str, false);
1241 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED_ABS)
1242 return parse_zoned_distribution(td, str, true);
1246 nr = get_opt_postfix(str);
1247 if (nr && !split_parse_distr(nr, &val, ¢er)) {
1248 log_err("fio: random postfix parsing failed\n");
1255 if (center != -1 && (center < 0.00 || center > 1.00)) {
1256 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
1259 td->o.random_center.u.f = center;
1261 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1263 log_err("fio: zipf theta must different than 1.0\n");
1268 td->o.zipf_theta.u.f = val;
1269 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1270 if (val <= 0.00 || val >= 1.00) {
1271 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1276 td->o.pareto_h.u.f = val;
1278 if (val < 0.00 || val >= 100.0) {
1279 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1284 td->o.gauss_dev.u.f = val;
1290 static int str_steadystate_cb(void *data, const char *str)
1292 struct thread_data *td = cb_data_to_td(data);
1298 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1299 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
1300 /* should be impossible to get here */
1301 log_err("fio: unknown steady state criterion\n");
1305 nr = get_opt_postfix(str);
1307 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1312 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1313 pct = strstr(nr, "%");
1316 strip_blank_end(nr);
1317 if (!str_to_float(nr, &val, 0)) {
1318 log_err("fio: could not parse steadystate threshold percentage\n");
1323 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1328 td->o.ss_state |= FIO_SS_PCT;
1329 td->o.ss_limit.u.f = val;
1330 } else if (td->o.ss_state & FIO_SS_IOPS) {
1331 if (!str_to_float(nr, &val, 0)) {
1332 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1337 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1342 td->o.ss_limit.u.f = val;
1343 } else { /* bandwidth criterion */
1344 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1345 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1350 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1355 td->o.ss_limit.u.f = (double) ll;
1358 td->ss.state = td->o.ss_state;
1363 * Return next name in the string. Files are separated with ':'. If the ':'
1364 * is escaped with a '\', then that ':' is part of the filename and does not
1365 * indicate a new file.
1367 char *get_next_str(char **ptr)
1372 if (!str || !strlen(str))
1378 * No colon, we are done
1380 p = strchr(str, ':');
1387 * We got a colon, but it's the first character. Skip and
1395 if (*(p - 1) != '\\') {
1401 memmove(p - 1, p, strlen(p) + 1);
1409 int get_max_str_idx(char *input)
1411 unsigned int cur_idx;
1414 p = str = strdup(input);
1415 for (cur_idx = 0; ; cur_idx++)
1416 if (get_next_str(&str) == NULL)
1424 * Returns the directory at the index, indexes > entries will be
1425 * assigned via modulo division of the index
1427 int set_name_idx(char *target, size_t tlen, char *input, int index,
1428 bool unique_filename)
1430 unsigned int cur_idx;
1432 char *fname, *str, *p;
1434 p = str = strdup(input);
1436 index %= get_max_str_idx(input);
1437 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1438 fname = get_next_str(&str);
1440 if (client_sockaddr_str[0] && unique_filename) {
1441 len = snprintf(target, tlen, "%s/%s.", fname,
1442 client_sockaddr_str);
1444 len = snprintf(target, tlen, "%s%c", fname,
1445 FIO_OS_PATH_SEPARATOR);
1447 target[tlen - 1] = '\0';
1453 char* get_name_by_idx(char *input, int index)
1455 unsigned int cur_idx;
1456 char *fname, *str, *p;
1458 p = str = strdup(input);
1460 index %= get_max_str_idx(input);
1461 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1462 fname = get_next_str(&str);
1464 fname = strdup(fname);
1470 static int str_filename_cb(void *data, const char *input)
1472 struct thread_data *td = cb_data_to_td(data);
1473 char *fname, *str, *p;
1475 p = str = strdup(input);
1477 strip_blank_front(&str);
1478 strip_blank_end(str);
1481 * Ignore what we may already have from nrfiles option.
1483 if (!td->files_index)
1486 while ((fname = get_next_str(&str)) != NULL) {
1489 add_file(td, fname, 0, 1);
1496 static int str_directory_cb(void *data, const char fio_unused *unused)
1498 struct thread_data *td = cb_data_to_td(data);
1500 char *dirname, *str, *p;
1506 p = str = strdup(td->o.directory);
1507 while ((dirname = get_next_str(&str)) != NULL) {
1508 if (lstat(dirname, &sb) < 0) {
1511 log_err("fio: %s is not a directory\n", dirname);
1512 td_verror(td, ret, "lstat");
1515 if (!S_ISDIR(sb.st_mode)) {
1516 log_err("fio: %s is not a directory\n", dirname);
1527 static int str_opendir_cb(void *data, const char fio_unused *str)
1529 struct thread_data *td = cb_data_to_td(data);
1534 if (!td->files_index)
1537 return add_dir_files(td, td->o.opendir);
1540 static int str_buffer_pattern_cb(void *data, const char *input)
1542 struct thread_data *td = cb_data_to_td(data);
1545 /* FIXME: for now buffer pattern does not support formats */
1546 ret = parse_and_fill_pattern_alloc(input, strlen(input),
1547 &td->o.buffer_pattern, NULL, NULL, NULL);
1552 td->o.buffer_pattern_bytes = ret;
1555 * If this job is doing any reading or has compression set,
1556 * ensure that we refill buffers for writes or we could be
1557 * invalidating the pattern through reads.
1559 if (!td->o.compress_percentage && !td_read(td))
1560 td->o.refill_buffers = 0;
1562 td->o.refill_buffers = 1;
1564 td->o.scramble_buffers = 0;
1565 td->o.zero_buffers = 0;
1570 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1572 struct thread_data *td = cb_data_to_td(data);
1574 td->flags |= TD_F_COMPRESS;
1575 td->o.compress_percentage = *il;
1579 static int str_dedupe_cb(void *data, unsigned long long *il)
1581 struct thread_data *td = cb_data_to_td(data);
1583 td->flags |= TD_F_COMPRESS;
1584 td->o.dedupe_percentage = *il;
1585 td->o.refill_buffers = 1;
1589 static int str_verify_pattern_cb(void *data, const char *input)
1591 struct thread_data *td = cb_data_to_td(data);
1594 td->o.verify_fmt_sz = FIO_ARRAY_SIZE(td->o.verify_fmt);
1595 ret = parse_and_fill_pattern_alloc(input, strlen(input),
1596 &td->o.verify_pattern, fmt_desc, td->o.verify_fmt,
1597 &td->o.verify_fmt_sz);
1602 td->o.verify_pattern_bytes = ret;
1604 * VERIFY_* could already be set
1606 if (!fio_option_is_set(&td->o, verify))
1607 td->o.verify = VERIFY_PATTERN;
1612 static int str_gtod_reduce_cb(void *data, int *il)
1614 struct thread_data *td = cb_data_to_td(data);
1618 * Only modify options if gtod_reduce==1
1619 * Otherwise leave settings alone.
1622 td->o.disable_lat = 1;
1623 td->o.disable_clat = 1;
1624 td->o.disable_slat = 1;
1625 td->o.disable_bw = 1;
1626 td->o.clat_percentiles = 0;
1627 td->o.lat_percentiles = 0;
1628 td->o.slat_percentiles = 0;
1629 td->ts_cache_mask = 63;
1635 static int str_offset_cb(void *data, long long *__val)
1637 struct thread_data *td = cb_data_to_td(data);
1638 unsigned long long v = *__val;
1640 if (parse_is_percent(v)) {
1641 td->o.start_offset = 0;
1642 td->o.start_offset_percent = -1ULL - v;
1643 td->o.start_offset_nz = 0;
1644 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1645 td->o.start_offset_percent);
1646 } else if (parse_is_zone(v)) {
1647 td->o.start_offset = 0;
1648 td->o.start_offset_percent = 0;
1649 td->o.start_offset_nz = v - ZONE_BASE_VAL;
1651 td->o.start_offset = v;
1656 static int str_offset_increment_cb(void *data, long long *__val)
1658 struct thread_data *td = cb_data_to_td(data);
1659 unsigned long long v = *__val;
1661 if (parse_is_percent(v)) {
1662 td->o.offset_increment = 0;
1663 td->o.offset_increment_percent = -1ULL - v;
1664 td->o.offset_increment_nz = 0;
1665 dprint(FD_PARSE, "SET offset_increment_percent %d\n",
1666 td->o.offset_increment_percent);
1667 } else if (parse_is_zone(v)) {
1668 td->o.offset_increment = 0;
1669 td->o.offset_increment_percent = 0;
1670 td->o.offset_increment_nz = v - ZONE_BASE_VAL;
1672 td->o.offset_increment = v;
1677 static int str_size_cb(void *data, long long *__val)
1679 struct thread_data *td = cb_data_to_td(data);
1680 unsigned long long v = *__val;
1682 if (parse_is_percent(v)) {
1684 td->o.size_percent = -1ULL - v;
1685 dprint(FD_PARSE, "SET size_percent %d\n",
1686 td->o.size_percent);
1687 } else if (parse_is_zone(v)) {
1689 td->o.size_percent = 0;
1690 td->o.size_nz = v - ZONE_BASE_VAL;
1697 static int str_io_size_cb(void *data, unsigned long long *__val)
1699 struct thread_data *td = cb_data_to_td(data);
1700 unsigned long long v = *__val;
1702 if (parse_is_percent_uncapped(v)) {
1704 td->o.io_size_percent = -1ULL - v;
1705 if (td->o.io_size_percent > 100) {
1706 log_err("fio: io_size values greater than 100%% aren't supported\n");
1709 dprint(FD_PARSE, "SET io_size_percent %d\n",
1710 td->o.io_size_percent);
1711 } else if (parse_is_zone(v)) {
1713 td->o.io_size_percent = 0;
1714 td->o.io_size_nz = v - ZONE_BASE_VAL;
1721 static int str_zoneskip_cb(void *data, long long *__val)
1723 struct thread_data *td = cb_data_to_td(data);
1724 unsigned long long v = *__val;
1726 if (parse_is_zone(v)) {
1727 td->o.zone_skip = 0;
1728 td->o.zone_skip_nz = v - ZONE_BASE_VAL;
1730 td->o.zone_skip = v;
1735 static int str_write_bw_log_cb(void *data, const char *str)
1737 struct thread_data *td = cb_data_to_td(data);
1740 td->o.bw_log_file = strdup(str);
1742 td->o.write_bw_log = 1;
1746 static int str_write_lat_log_cb(void *data, const char *str)
1748 struct thread_data *td = cb_data_to_td(data);
1751 td->o.lat_log_file = strdup(str);
1753 td->o.write_lat_log = 1;
1757 static int str_write_iops_log_cb(void *data, const char *str)
1759 struct thread_data *td = cb_data_to_td(data);
1762 td->o.iops_log_file = strdup(str);
1764 td->o.write_iops_log = 1;
1768 static int str_write_hist_log_cb(void *data, const char *str)
1770 struct thread_data *td = cb_data_to_td(data);
1773 td->o.hist_log_file = strdup(str);
1775 td->o.write_hist_log = 1;
1780 * str is supposed to be a substring of the strdup'd original string,
1781 * and is valid only if it's a regular file path.
1782 * This function keeps the pointer to the path as needed later.
1784 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1785 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1786 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1788 static int str_ioengine_external_cb(void *data, const char *str)
1790 struct thread_data *td = cb_data_to_td(data);
1795 log_err("fio: null external ioengine path\n");
1799 p = (char *)str; /* str is mutable */
1800 strip_blank_front(&p);
1803 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1804 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1808 td->o.ioengine_so_path = p;
1812 static int rw_verify(const struct fio_option *o, void *data)
1814 struct thread_data *td = cb_data_to_td(data);
1816 if (read_only && (td_write(td) || td_trim(td))) {
1817 log_err("fio: job <%s> has write or trim bit set, but"
1818 " fio is in read-only mode\n", td->o.name);
1825 static int gtod_cpu_verify(const struct fio_option *o, void *data)
1827 #ifndef FIO_HAVE_CPU_AFFINITY
1828 struct thread_data *td = cb_data_to_td(data);
1830 if (td->o.gtod_cpu) {
1831 log_err("fio: platform must support CPU affinity for"
1832 "gettimeofday() offloading\n");
1841 * Map of job/command line options
1843 struct fio_option fio_options[FIO_MAX_OPTS] = {
1845 .name = "description",
1846 .lname = "Description of job",
1847 .type = FIO_OPT_STR_STORE,
1848 .off1 = offsetof(struct thread_options, description),
1849 .help = "Text job description",
1850 .category = FIO_OPT_C_GENERAL,
1851 .group = FIO_OPT_G_DESC,
1855 .lname = "Job name",
1856 .type = FIO_OPT_STR_STORE,
1857 .off1 = offsetof(struct thread_options, name),
1858 .help = "Name of this job",
1859 .category = FIO_OPT_C_GENERAL,
1860 .group = FIO_OPT_G_DESC,
1864 .lname = "Waitee name",
1865 .type = FIO_OPT_STR_STORE,
1866 .off1 = offsetof(struct thread_options, wait_for),
1867 .help = "Name of the job this one wants to wait for before starting",
1868 .category = FIO_OPT_C_GENERAL,
1869 .group = FIO_OPT_G_DESC,
1873 .lname = "Filename(s)",
1874 .type = FIO_OPT_STR_STORE,
1875 .off1 = offsetof(struct thread_options, filename),
1877 .cb = str_filename_cb,
1878 .prio = -1, /* must come after "directory" */
1879 .help = "File(s) to use for the workload",
1880 .category = FIO_OPT_C_FILE,
1881 .group = FIO_OPT_G_FILENAME,
1884 .name = "directory",
1885 .lname = "Directory",
1886 .type = FIO_OPT_STR_STORE,
1887 .off1 = offsetof(struct thread_options, directory),
1888 .cb = str_directory_cb,
1889 .help = "Directory to store files in",
1890 .category = FIO_OPT_C_FILE,
1891 .group = FIO_OPT_G_FILENAME,
1894 .name = "filename_format",
1895 .lname = "Filename Format",
1896 .type = FIO_OPT_STR_STORE,
1897 .off1 = offsetof(struct thread_options, filename_format),
1898 .prio = -1, /* must come after "directory" */
1899 .help = "Override default $jobname.$jobnum.$filenum naming",
1900 .def = "$jobname.$jobnum.$filenum",
1901 .category = FIO_OPT_C_FILE,
1902 .group = FIO_OPT_G_FILENAME,
1905 .name = "unique_filename",
1906 .lname = "Unique Filename",
1907 .type = FIO_OPT_BOOL,
1908 .off1 = offsetof(struct thread_options, unique_filename),
1909 .help = "For network clients, prefix file with source IP",
1911 .category = FIO_OPT_C_FILE,
1912 .group = FIO_OPT_G_FILENAME,
1916 .lname = "Lockfile",
1917 .type = FIO_OPT_STR,
1918 .off1 = offsetof(struct thread_options, file_lock_mode),
1919 .help = "Lock file when doing IO to it",
1921 .parent = "filename",
1924 .category = FIO_OPT_C_FILE,
1925 .group = FIO_OPT_G_FILENAME,
1928 .oval = FILE_LOCK_NONE,
1929 .help = "No file locking",
1931 { .ival = "exclusive",
1932 .oval = FILE_LOCK_EXCLUSIVE,
1933 .help = "Exclusive file lock",
1936 .ival = "readwrite",
1937 .oval = FILE_LOCK_READWRITE,
1938 .help = "Read vs write lock",
1944 .lname = "Open directory",
1945 .type = FIO_OPT_STR_STORE,
1946 .off1 = offsetof(struct thread_options, opendir),
1947 .cb = str_opendir_cb,
1948 .help = "Recursively add files from this directory and down",
1949 .category = FIO_OPT_C_FILE,
1950 .group = FIO_OPT_G_FILENAME,
1954 .lname = "Read/write",
1955 .alias = "readwrite",
1956 .type = FIO_OPT_STR,
1958 .off1 = offsetof(struct thread_options, td_ddir),
1959 .help = "IO direction",
1961 .verify = rw_verify,
1962 .category = FIO_OPT_C_IO,
1963 .group = FIO_OPT_G_IO_BASIC,
1966 .oval = TD_DDIR_READ,
1967 .help = "Sequential read",
1970 .oval = TD_DDIR_WRITE,
1971 .help = "Sequential write",
1974 .oval = TD_DDIR_TRIM,
1975 .help = "Sequential trim",
1977 { .ival = "randread",
1978 .oval = TD_DDIR_RANDREAD,
1979 .help = "Random read",
1981 { .ival = "randwrite",
1982 .oval = TD_DDIR_RANDWRITE,
1983 .help = "Random write",
1985 { .ival = "randtrim",
1986 .oval = TD_DDIR_RANDTRIM,
1987 .help = "Random trim",
1991 .help = "Sequential read and write mix",
1993 { .ival = "readwrite",
1995 .help = "Sequential read and write mix",
1998 .oval = TD_DDIR_RANDRW,
1999 .help = "Random read and write mix"
2001 { .ival = "trimwrite",
2002 .oval = TD_DDIR_TRIMWRITE,
2003 .help = "Trim and write mix, trims preceding writes"
2005 { .ival = "randtrimwrite",
2006 .oval = TD_DDIR_RANDTRIMWRITE,
2007 .help = "Randomly trim and write mix, trims preceding writes"
2012 .name = "rw_sequencer",
2013 .lname = "RW Sequencer",
2014 .type = FIO_OPT_STR,
2015 .off1 = offsetof(struct thread_options, rw_seq),
2016 .help = "IO offset generator modifier",
2017 .def = "sequential",
2018 .category = FIO_OPT_C_IO,
2019 .group = FIO_OPT_G_IO_BASIC,
2021 { .ival = "sequential",
2023 .help = "Generate sequential offsets",
2025 { .ival = "identical",
2026 .oval = RW_SEQ_IDENT,
2027 .help = "Generate identical offsets",
2034 .lname = "IO Engine",
2035 .type = FIO_OPT_STR_STORE,
2036 .off1 = offsetof(struct thread_options, ioengine),
2037 .help = "IO engine to use",
2038 .def = FIO_PREFERRED_ENGINE,
2039 .category = FIO_OPT_C_IO,
2040 .group = FIO_OPT_G_IO_BASIC,
2043 .help = "Use read/write",
2046 .help = "Use pread/pwrite",
2049 .help = "Use readv/writev",
2051 #ifdef CONFIG_PWRITEV
2053 .help = "Use preadv/pwritev",
2056 #ifdef FIO_HAVE_PWRITEV2
2057 { .ival = "pvsync2",
2058 .help = "Use preadv2/pwritev2",
2061 #ifdef CONFIG_LIBAIO
2063 .help = "Linux native asynchronous IO",
2066 #ifdef ARCH_HAVE_IOURING
2067 { .ival = "io_uring",
2068 .help = "Fast Linux native aio",
2071 #ifdef CONFIG_POSIXAIO
2072 { .ival = "posixaio",
2073 .help = "POSIX asynchronous IO",
2076 #ifdef CONFIG_SOLARISAIO
2077 { .ival = "solarisaio",
2078 .help = "Solaris native asynchronous IO",
2081 #ifdef CONFIG_WINDOWSAIO
2082 { .ival = "windowsaio",
2083 .help = "Windows native asynchronous IO"
2088 .help = "Rados Block Device asynchronous IO"
2092 .help = "Memory mapped IO"
2094 #ifdef CONFIG_LINUX_SPLICE
2096 .help = "splice/vmsplice based IO",
2098 { .ival = "netsplice",
2099 .help = "splice/vmsplice to/from the network",
2102 #ifdef FIO_HAVE_SGIO
2104 .help = "SCSI generic v3 IO",
2108 .help = "Testing engine (no data transfer)",
2111 .help = "Network IO",
2114 .help = "CPU cycle burner engine",
2118 .help = "RDMA IO engine",
2121 #ifdef CONFIG_LIBRPMA_APM
2122 { .ival = "librpma_apm",
2123 .help = "librpma IO engine in APM mode",
2126 #ifdef CONFIG_LIBRPMA_GPSPM
2127 { .ival = "librpma_gpspm",
2128 .help = "librpma IO engine in GPSPM mode",
2131 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
2132 { .ival = "e4defrag",
2133 .help = "ext4 defrag engine",
2136 #ifdef CONFIG_LINUX_FALLOCATE
2138 .help = "fallocate() file based engine",
2143 .help = "Glusterfs libgfapi(sync) based engine"
2145 { .ival = "gfapi_async",
2146 .help = "Glusterfs libgfapi(async) based engine"
2149 #ifdef CONFIG_LIBHDFS
2150 { .ival = "libhdfs",
2151 .help = "Hadoop Distributed Filesystem (HDFS) engine"
2155 { .ival = "ime_psync",
2156 .help = "DDN's IME synchronous IO engine",
2158 { .ival = "ime_psyncv",
2159 .help = "DDN's IME synchronous IO engine using iovecs",
2161 { .ival = "ime_aio",
2162 .help = "DDN's IME asynchronous IO engine",
2165 #ifdef CONFIG_LINUX_DEVDAX
2166 { .ival = "dev-dax",
2167 .help = "DAX Device based IO engine",
2171 .ival = "filecreate",
2172 .help = "File creation engine",
2174 { .ival = "external",
2175 .help = "Load external engine (append name)",
2176 .cb = str_ioengine_external_cb,
2178 #ifdef CONFIG_LIBPMEM
2179 { .ival = "libpmem",
2180 .help = "PMDK libpmem based IO engine",
2185 .help = "HTTP (WebDAV/S3) IO engine",
2189 .help = "Network Block Device (NBD) IO engine"
2193 .help = "DAOS File System (dfs) IO engine",
2196 #ifdef CONFIG_LIBNFS
2198 .help = "NFS IO engine",
2201 #ifdef CONFIG_LIBXNVME
2203 .help = "XNVME IO engine",
2210 .lname = "IO Depth",
2211 .type = FIO_OPT_INT,
2212 .off1 = offsetof(struct thread_options, iodepth),
2213 .help = "Number of IO buffers to keep in flight",
2217 .category = FIO_OPT_C_IO,
2218 .group = FIO_OPT_G_IO_BASIC,
2221 .name = "iodepth_batch",
2222 .lname = "IO Depth batch",
2223 .alias = "iodepth_batch_submit",
2224 .type = FIO_OPT_INT,
2225 .off1 = offsetof(struct thread_options, iodepth_batch),
2226 .help = "Number of IO buffers to submit in one go",
2227 .parent = "iodepth",
2231 .category = FIO_OPT_C_IO,
2232 .group = FIO_OPT_G_IO_BASIC,
2235 .name = "iodepth_batch_complete_min",
2236 .lname = "Min IO depth batch complete",
2237 .alias = "iodepth_batch_complete",
2238 .type = FIO_OPT_INT,
2239 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
2240 .help = "Min number of IO buffers to retrieve in one go",
2241 .parent = "iodepth",
2246 .category = FIO_OPT_C_IO,
2247 .group = FIO_OPT_G_IO_BASIC,
2250 .name = "iodepth_batch_complete_max",
2251 .lname = "Max IO depth batch complete",
2252 .type = FIO_OPT_INT,
2253 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
2254 .help = "Max number of IO buffers to retrieve in one go",
2255 .parent = "iodepth",
2259 .category = FIO_OPT_C_IO,
2260 .group = FIO_OPT_G_IO_BASIC,
2263 .name = "iodepth_low",
2264 .lname = "IO Depth batch low",
2265 .type = FIO_OPT_INT,
2266 .off1 = offsetof(struct thread_options, iodepth_low),
2267 .help = "Low water mark for queuing depth",
2268 .parent = "iodepth",
2271 .category = FIO_OPT_C_IO,
2272 .group = FIO_OPT_G_IO_BASIC,
2275 .name = "serialize_overlap",
2276 .lname = "Serialize overlap",
2277 .off1 = offsetof(struct thread_options, serialize_overlap),
2278 .type = FIO_OPT_BOOL,
2279 .help = "Wait for in-flight IOs that collide to complete",
2280 .parent = "iodepth",
2282 .category = FIO_OPT_C_IO,
2283 .group = FIO_OPT_G_IO_BASIC,
2286 .name = "io_submit_mode",
2287 .lname = "IO submit mode",
2288 .type = FIO_OPT_STR,
2289 .off1 = offsetof(struct thread_options, io_submit_mode),
2290 .help = "How IO submissions and completions are done",
2292 .category = FIO_OPT_C_IO,
2293 .group = FIO_OPT_G_IO_BASIC,
2296 .oval = IO_MODE_INLINE,
2297 .help = "Submit and complete IO inline",
2299 { .ival = "offload",
2300 .oval = IO_MODE_OFFLOAD,
2301 .help = "Offload submit and complete to threads",
2308 .type = FIO_OPT_STR_VAL_ZONE,
2310 .off1 = offsetof(struct thread_options, size),
2311 .help = "Total size of device or files",
2312 .category = FIO_OPT_C_IO,
2313 .group = FIO_OPT_G_INVALID,
2317 .alias = "io_limit",
2319 .type = FIO_OPT_STR_VAL_ZONE,
2320 .cb = str_io_size_cb,
2321 .off1 = offsetof(struct thread_options, io_size),
2322 .help = "Total size of I/O to be performed",
2323 .category = FIO_OPT_C_IO,
2324 .group = FIO_OPT_G_INVALID,
2327 .name = "fill_device",
2328 .lname = "Fill device",
2330 .type = FIO_OPT_BOOL,
2331 .off1 = offsetof(struct thread_options, fill_device),
2332 .help = "Write until an ENOSPC error occurs",
2334 .category = FIO_OPT_C_FILE,
2335 .group = FIO_OPT_G_INVALID,
2339 .lname = "File size",
2340 .type = FIO_OPT_STR_VAL,
2341 .off1 = offsetof(struct thread_options, file_size_low),
2342 .off2 = offsetof(struct thread_options, file_size_high),
2344 .help = "Size of individual files",
2345 .interval = 1024 * 1024,
2346 .category = FIO_OPT_C_FILE,
2347 .group = FIO_OPT_G_INVALID,
2350 .name = "file_append",
2351 .lname = "File append",
2352 .type = FIO_OPT_BOOL,
2353 .off1 = offsetof(struct thread_options, file_append),
2354 .help = "IO will start at the end of the file(s)",
2356 .category = FIO_OPT_C_FILE,
2357 .group = FIO_OPT_G_INVALID,
2361 .lname = "IO offset",
2362 .alias = "fileoffset",
2363 .type = FIO_OPT_STR_VAL_ZONE,
2364 .cb = str_offset_cb,
2365 .off1 = offsetof(struct thread_options, start_offset),
2366 .help = "Start IO from this offset",
2368 .category = FIO_OPT_C_IO,
2369 .group = FIO_OPT_G_INVALID,
2372 .name = "offset_align",
2373 .lname = "IO offset alignment",
2374 .type = FIO_OPT_INT,
2375 .off1 = offsetof(struct thread_options, start_offset_align),
2376 .help = "Start IO from this offset alignment",
2379 .category = FIO_OPT_C_IO,
2380 .group = FIO_OPT_G_INVALID,
2383 .name = "offset_increment",
2384 .lname = "IO offset increment",
2385 .type = FIO_OPT_STR_VAL_ZONE,
2386 .cb = str_offset_increment_cb,
2387 .off1 = offsetof(struct thread_options, offset_increment),
2388 .help = "What is the increment from one offset to the next",
2392 .category = FIO_OPT_C_IO,
2393 .group = FIO_OPT_G_INVALID,
2396 .name = "number_ios",
2397 .lname = "Number of IOs to perform",
2398 .type = FIO_OPT_STR_VAL,
2399 .off1 = offsetof(struct thread_options, number_ios),
2400 .help = "Force job completion after this number of IOs",
2402 .category = FIO_OPT_C_IO,
2403 .group = FIO_OPT_G_INVALID,
2406 .name = "num_range",
2407 .lname = "Number of ranges",
2408 .type = FIO_OPT_INT,
2409 .off1 = offsetof(struct thread_options, num_range),
2410 .maxval = MAX_TRIM_RANGE,
2411 .help = "Number of ranges for trim command",
2413 .category = FIO_OPT_C_IO,
2414 .group = FIO_OPT_G_INVALID,
2418 .lname = "Block size",
2419 .alias = "blocksize",
2420 .type = FIO_OPT_ULL,
2421 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2422 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2423 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2425 .help = "Block size unit",
2430 .category = FIO_OPT_C_IO,
2431 .group = FIO_OPT_G_INVALID,
2435 .lname = "Block size align",
2436 .alias = "blockalign",
2437 .type = FIO_OPT_ULL,
2438 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2439 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2440 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2442 .help = "IO block offset alignment",
2446 .category = FIO_OPT_C_IO,
2447 .group = FIO_OPT_G_INVALID,
2451 .lname = "Block size range",
2452 .alias = "blocksize_range",
2453 .type = FIO_OPT_RANGE,
2454 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2455 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2456 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2457 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2458 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2459 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2461 .help = "Set block size range (in more detail than bs)",
2465 .category = FIO_OPT_C_IO,
2466 .group = FIO_OPT_G_INVALID,
2470 .lname = "Block size split",
2471 .type = FIO_OPT_STR_ULL,
2472 .cb = str_bssplit_cb,
2473 .off1 = offsetof(struct thread_options, bssplit),
2474 .help = "Set a specific mix of block sizes",
2477 .category = FIO_OPT_C_IO,
2478 .group = FIO_OPT_G_INVALID,
2481 .name = "bs_unaligned",
2482 .lname = "Block size unaligned",
2483 .alias = "blocksize_unaligned",
2484 .type = FIO_OPT_STR_SET,
2485 .off1 = offsetof(struct thread_options, bs_unaligned),
2486 .help = "Don't sector align IO buffer sizes",
2489 .category = FIO_OPT_C_IO,
2490 .group = FIO_OPT_G_INVALID,
2493 .name = "bs_is_seq_rand",
2494 .lname = "Block size division is seq/random (not read/write)",
2495 .type = FIO_OPT_BOOL,
2496 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2497 .help = "Consider any blocksize setting to be sequential,random",
2499 .parent = "blocksize",
2500 .category = FIO_OPT_C_IO,
2501 .group = FIO_OPT_G_INVALID,
2504 .name = "randrepeat",
2505 .alias = "allrandrepeat",
2506 .lname = "Random repeatable",
2507 .type = FIO_OPT_BOOL,
2508 .off1 = offsetof(struct thread_options, rand_repeatable),
2509 .help = "Use repeatable random IO pattern",
2513 .category = FIO_OPT_C_IO,
2514 .group = FIO_OPT_G_RANDOM,
2518 .lname = "The random generator seed",
2519 .type = FIO_OPT_STR_VAL,
2520 .off1 = offsetof(struct thread_options, rand_seed),
2521 .help = "Set the random generator seed value",
2524 .category = FIO_OPT_C_IO,
2525 .group = FIO_OPT_G_RANDOM,
2528 .name = "norandommap",
2529 .lname = "No randommap",
2530 .type = FIO_OPT_STR_SET,
2531 .off1 = offsetof(struct thread_options, norandommap),
2532 .help = "Accept potential duplicate random blocks",
2536 .category = FIO_OPT_C_IO,
2537 .group = FIO_OPT_G_RANDOM,
2540 .name = "softrandommap",
2541 .lname = "Soft randommap",
2542 .type = FIO_OPT_BOOL,
2543 .off1 = offsetof(struct thread_options, softrandommap),
2544 .help = "Set norandommap if randommap allocation fails",
2545 .parent = "norandommap",
2548 .category = FIO_OPT_C_IO,
2549 .group = FIO_OPT_G_RANDOM,
2552 .name = "random_generator",
2553 .lname = "Random Generator",
2554 .type = FIO_OPT_STR,
2555 .off1 = offsetof(struct thread_options, random_generator),
2556 .help = "Type of random number generator to use",
2557 .def = "tausworthe",
2559 { .ival = "tausworthe",
2560 .oval = FIO_RAND_GEN_TAUSWORTHE,
2561 .help = "Strong Tausworthe generator",
2564 .oval = FIO_RAND_GEN_LFSR,
2565 .help = "Variable length LFSR",
2568 .ival = "tausworthe64",
2569 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2570 .help = "64-bit Tausworthe variant",
2573 .category = FIO_OPT_C_IO,
2574 .group = FIO_OPT_G_RANDOM,
2577 .name = "random_distribution",
2578 .lname = "Random Distribution",
2579 .type = FIO_OPT_STR,
2580 .off1 = offsetof(struct thread_options, random_distribution),
2581 .cb = str_random_distribution_cb,
2582 .help = "Random offset distribution generator",
2586 .oval = FIO_RAND_DIST_RANDOM,
2587 .help = "Completely random",
2590 .oval = FIO_RAND_DIST_ZIPF,
2591 .help = "Zipf distribution",
2594 .oval = FIO_RAND_DIST_PARETO,
2595 .help = "Pareto distribution",
2598 .oval = FIO_RAND_DIST_GAUSS,
2599 .help = "Normal (Gaussian) distribution",
2602 .oval = FIO_RAND_DIST_ZONED,
2603 .help = "Zoned random distribution",
2605 { .ival = "zoned_abs",
2606 .oval = FIO_RAND_DIST_ZONED_ABS,
2607 .help = "Zoned absolute random distribution",
2610 .category = FIO_OPT_C_IO,
2611 .group = FIO_OPT_G_RANDOM,
2614 .name = "percentage_random",
2615 .lname = "Percentage Random",
2616 .type = FIO_OPT_INT,
2617 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2618 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2619 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2621 .help = "Percentage of seq/random mix that should be random",
2622 .def = "100,100,100",
2624 .inverse = "percentage_sequential",
2625 .category = FIO_OPT_C_IO,
2626 .group = FIO_OPT_G_RANDOM,
2629 .name = "percentage_sequential",
2630 .lname = "Percentage Sequential",
2631 .type = FIO_OPT_DEPRECATED,
2632 .category = FIO_OPT_C_IO,
2633 .group = FIO_OPT_G_RANDOM,
2637 .lname = "Number of files",
2638 .alias = "nr_files",
2639 .type = FIO_OPT_INT,
2640 .off1 = offsetof(struct thread_options, nr_files),
2641 .help = "Split job workload between this number of files",
2644 .category = FIO_OPT_C_FILE,
2645 .group = FIO_OPT_G_INVALID,
2648 .name = "openfiles",
2649 .lname = "Number of open files",
2650 .type = FIO_OPT_INT,
2651 .off1 = offsetof(struct thread_options, open_files),
2652 .help = "Number of files to keep open at the same time",
2653 .category = FIO_OPT_C_FILE,
2654 .group = FIO_OPT_G_INVALID,
2657 .name = "file_service_type",
2658 .lname = "File service type",
2659 .type = FIO_OPT_STR,
2661 .off1 = offsetof(struct thread_options, file_service_type),
2662 .help = "How to select which file to service next",
2663 .def = "roundrobin",
2664 .category = FIO_OPT_C_FILE,
2665 .group = FIO_OPT_G_INVALID,
2668 .oval = FIO_FSERVICE_RANDOM,
2669 .help = "Choose a file at random (uniform)",
2672 .oval = FIO_FSERVICE_ZIPF,
2673 .help = "Zipf randomized",
2676 .oval = FIO_FSERVICE_PARETO,
2677 .help = "Pareto randomized",
2680 .oval = FIO_FSERVICE_GAUSS,
2681 .help = "Normal (Gaussian) randomized",
2684 .oval = FIO_FSERVICE_GAUSS,
2685 .help = "Alias for normal",
2687 { .ival = "roundrobin",
2688 .oval = FIO_FSERVICE_RR,
2689 .help = "Round robin select files",
2691 { .ival = "sequential",
2692 .oval = FIO_FSERVICE_SEQ,
2693 .help = "Finish one file before moving to the next",
2696 .parent = "nrfiles",
2700 .name = "fallocate",
2701 .lname = "Fallocate",
2702 .type = FIO_OPT_STR,
2703 .off1 = offsetof(struct thread_options, fallocate_mode),
2704 .help = "Whether pre-allocation is performed when laying out files",
2705 #ifdef FIO_HAVE_DEFAULT_FALLOCATE
2710 .category = FIO_OPT_C_FILE,
2711 .group = FIO_OPT_G_INVALID,
2714 .oval = FIO_FALLOCATE_NONE,
2715 .help = "Do not pre-allocate space",
2718 .oval = FIO_FALLOCATE_NATIVE,
2719 .help = "Use native pre-allocation if possible",
2721 #ifdef CONFIG_POSIX_FALLOCATE
2723 .oval = FIO_FALLOCATE_POSIX,
2724 .help = "Use posix_fallocate()",
2727 #ifdef CONFIG_LINUX_FALLOCATE
2729 .oval = FIO_FALLOCATE_KEEP_SIZE,
2730 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2733 { .ival = "truncate",
2734 .oval = FIO_FALLOCATE_TRUNCATE,
2735 .help = "Truncate file to final size instead of allocating"
2737 /* Compatibility with former boolean values */
2739 .oval = FIO_FALLOCATE_NONE,
2740 .help = "Alias for 'none'",
2742 #ifdef CONFIG_POSIX_FALLOCATE
2744 .oval = FIO_FALLOCATE_POSIX,
2745 .help = "Alias for 'posix'",
2751 .name = "fadvise_hint",
2752 .lname = "Fadvise hint",
2753 .type = FIO_OPT_STR,
2754 .off1 = offsetof(struct thread_options, fadvise_hint),
2758 .help = "Don't issue fadvise/madvise",
2762 .help = "Advise using fio IO pattern",
2765 .oval = F_ADV_RANDOM,
2766 .help = "Advise using FADV_RANDOM",
2768 { .ival = "sequential",
2769 .oval = F_ADV_SEQUENTIAL,
2770 .help = "Advise using FADV_SEQUENTIAL",
2772 #ifdef POSIX_FADV_NOREUSE
2773 { .ival = "noreuse",
2774 .oval = F_ADV_NOREUSE,
2775 .help = "Advise using FADV_NOREUSE",
2779 .help = "Use fadvise() to advise the kernel on IO pattern",
2781 .category = FIO_OPT_C_FILE,
2782 .group = FIO_OPT_G_INVALID,
2787 .type = FIO_OPT_INT,
2788 .off1 = offsetof(struct thread_options, fsync_blocks),
2789 .help = "Issue fsync for writes every given number of blocks",
2792 .category = FIO_OPT_C_FILE,
2793 .group = FIO_OPT_G_INVALID,
2796 .name = "fdatasync",
2797 .lname = "Fdatasync",
2798 .type = FIO_OPT_INT,
2799 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2800 .help = "Issue fdatasync for writes every given number of blocks",
2803 .category = FIO_OPT_C_FILE,
2804 .group = FIO_OPT_G_INVALID,
2807 .name = "write_barrier",
2808 .lname = "Write barrier",
2809 .type = FIO_OPT_INT,
2810 .off1 = offsetof(struct thread_options, barrier_blocks),
2811 .help = "Make every Nth write a barrier write",
2814 .category = FIO_OPT_C_IO,
2815 .group = FIO_OPT_G_INVALID,
2817 #ifdef CONFIG_SYNC_FILE_RANGE
2819 .name = "sync_file_range",
2820 .lname = "Sync file range",
2822 { .ival = "wait_before",
2823 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2824 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2828 .oval = SYNC_FILE_RANGE_WRITE,
2829 .help = "SYNC_FILE_RANGE_WRITE",
2833 .ival = "wait_after",
2834 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2835 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2839 .type = FIO_OPT_STR_MULTI,
2841 .off1 = offsetof(struct thread_options, sync_file_range),
2842 .help = "Use sync_file_range()",
2843 .category = FIO_OPT_C_FILE,
2844 .group = FIO_OPT_G_INVALID,
2848 .name = "sync_file_range",
2849 .lname = "Sync file range",
2850 .type = FIO_OPT_UNSUPPORTED,
2851 .help = "Your platform does not support sync_file_range",
2856 .lname = "Direct I/O",
2857 .type = FIO_OPT_BOOL,
2858 .off1 = offsetof(struct thread_options, odirect),
2859 .help = "Use O_DIRECT IO (negates buffered)",
2861 .inverse = "buffered",
2862 .category = FIO_OPT_C_IO,
2863 .group = FIO_OPT_G_IO_TYPE,
2867 .lname = "Atomic I/O",
2868 .type = FIO_OPT_BOOL,
2869 .off1 = offsetof(struct thread_options, oatomic),
2870 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2872 .category = FIO_OPT_C_IO,
2873 .group = FIO_OPT_G_IO_TYPE,
2877 .lname = "Buffered I/O",
2878 .type = FIO_OPT_BOOL,
2879 .off1 = offsetof(struct thread_options, odirect),
2881 .help = "Use buffered IO (negates direct)",
2883 .inverse = "direct",
2884 .category = FIO_OPT_C_IO,
2885 .group = FIO_OPT_G_IO_TYPE,
2888 .name = "overwrite",
2889 .lname = "Overwrite",
2890 .type = FIO_OPT_BOOL,
2891 .off1 = offsetof(struct thread_options, overwrite),
2892 .help = "When writing, set whether to overwrite current data",
2894 .category = FIO_OPT_C_FILE,
2895 .group = FIO_OPT_G_INVALID,
2900 .type = FIO_OPT_INT,
2901 .off1 = offsetof(struct thread_options, loops),
2902 .help = "Number of times to run the job",
2905 .category = FIO_OPT_C_GENERAL,
2906 .group = FIO_OPT_G_RUNTIME,
2910 .lname = "Number of jobs",
2911 .type = FIO_OPT_INT,
2912 .off1 = offsetof(struct thread_options, numjobs),
2913 .help = "Duplicate this job this many times",
2916 .category = FIO_OPT_C_GENERAL,
2917 .group = FIO_OPT_G_RUNTIME,
2920 .name = "startdelay",
2921 .lname = "Start delay",
2922 .type = FIO_OPT_STR_VAL_TIME,
2923 .off1 = offsetof(struct thread_options, start_delay),
2924 .off2 = offsetof(struct thread_options, start_delay_high),
2925 .help = "Only start job when this period has passed",
2929 .category = FIO_OPT_C_GENERAL,
2930 .group = FIO_OPT_G_RUNTIME,
2936 .type = FIO_OPT_STR_VAL_TIME,
2937 .off1 = offsetof(struct thread_options, timeout),
2938 .help = "Stop workload when this amount of time has passed",
2942 .category = FIO_OPT_C_GENERAL,
2943 .group = FIO_OPT_G_RUNTIME,
2946 .name = "time_based",
2947 .lname = "Time based",
2948 .type = FIO_OPT_STR_SET,
2949 .off1 = offsetof(struct thread_options, time_based),
2950 .help = "Keep running until runtime/timeout is met",
2951 .category = FIO_OPT_C_GENERAL,
2952 .group = FIO_OPT_G_RUNTIME,
2955 .name = "verify_only",
2956 .lname = "Verify only",
2957 .type = FIO_OPT_STR_SET,
2958 .off1 = offsetof(struct thread_options, verify_only),
2959 .help = "Verifies previously written data is still valid",
2960 .category = FIO_OPT_C_GENERAL,
2961 .group = FIO_OPT_G_RUNTIME,
2964 .name = "ramp_time",
2965 .lname = "Ramp time",
2966 .type = FIO_OPT_STR_VAL_TIME,
2967 .off1 = offsetof(struct thread_options, ramp_time),
2968 .help = "Ramp up time before measuring performance",
2971 .category = FIO_OPT_C_GENERAL,
2972 .group = FIO_OPT_G_RUNTIME,
2975 .name = "clocksource",
2976 .lname = "Clock source",
2977 .type = FIO_OPT_STR,
2978 .cb = fio_clock_source_cb,
2979 .off1 = offsetof(struct thread_options, clocksource),
2980 .help = "What type of timing source to use",
2981 .category = FIO_OPT_C_GENERAL,
2982 .group = FIO_OPT_G_CLOCK,
2984 #ifdef CONFIG_GETTIMEOFDAY
2985 { .ival = "gettimeofday",
2987 .help = "Use gettimeofday(2) for timing",
2990 #ifdef CONFIG_CLOCK_GETTIME
2991 { .ival = "clock_gettime",
2992 .oval = CS_CGETTIME,
2993 .help = "Use clock_gettime(2) for timing",
2996 #ifdef ARCH_HAVE_CPU_CLOCK
2998 .oval = CS_CPUCLOCK,
2999 .help = "Use CPU private clock",
3007 .lname = "I/O Memory",
3008 .type = FIO_OPT_STR,
3010 .off1 = offsetof(struct thread_options, mem_type),
3011 .help = "Backing type for IO buffers",
3013 .category = FIO_OPT_C_IO,
3014 .group = FIO_OPT_G_INVALID,
3018 .help = "Use malloc(3) for IO buffers",
3020 #ifndef CONFIG_NO_SHM
3023 .help = "Use shared memory segments for IO buffers",
3025 #ifdef FIO_HAVE_HUGETLB
3026 { .ival = "shmhuge",
3027 .oval = MEM_SHMHUGE,
3028 .help = "Like shm, but use huge pages",
3034 .help = "Use mmap(2) (file or anon) for IO buffers",
3036 { .ival = "mmapshared",
3037 .oval = MEM_MMAPSHARED,
3038 .help = "Like mmap, but use the shared flag",
3040 #ifdef FIO_HAVE_HUGETLB
3041 { .ival = "mmaphuge",
3042 .oval = MEM_MMAPHUGE,
3043 .help = "Like mmap, but use huge pages",
3047 { .ival = "cudamalloc",
3048 .oval = MEM_CUDA_MALLOC,
3049 .help = "Allocate GPU device memory for GPUDirect RDMA",
3055 .name = "iomem_align",
3056 .alias = "mem_align",
3057 .lname = "I/O memory alignment",
3058 .type = FIO_OPT_INT,
3059 .off1 = offsetof(struct thread_options, mem_align),
3061 .help = "IO memory buffer offset alignment",
3065 .category = FIO_OPT_C_IO,
3066 .group = FIO_OPT_G_INVALID,
3071 .type = FIO_OPT_STR,
3072 .off1 = offsetof(struct thread_options, verify),
3073 .help = "Verify data written",
3075 .category = FIO_OPT_C_IO,
3076 .group = FIO_OPT_G_VERIFY,
3079 .oval = VERIFY_NONE,
3080 .help = "Don't do IO verification",
3084 .help = "Use md5 checksums for verification",
3087 .oval = VERIFY_CRC64,
3088 .help = "Use crc64 checksums for verification",
3091 .oval = VERIFY_CRC32,
3092 .help = "Use crc32 checksums for verification",
3094 { .ival = "crc32c-intel",
3095 .oval = VERIFY_CRC32C,
3096 .help = "Use crc32c checksums for verification (hw assisted, if available)",
3099 .oval = VERIFY_CRC32C,
3100 .help = "Use crc32c checksums for verification (hw assisted, if available)",
3103 .oval = VERIFY_CRC16,
3104 .help = "Use crc16 checksums for verification",
3107 .oval = VERIFY_CRC7,
3108 .help = "Use crc7 checksums for verification",
3111 .oval = VERIFY_SHA1,
3112 .help = "Use sha1 checksums for verification",
3115 .oval = VERIFY_SHA256,
3116 .help = "Use sha256 checksums for verification",
3119 .oval = VERIFY_SHA512,
3120 .help = "Use sha512 checksums for verification",
3122 { .ival = "sha3-224",
3123 .oval = VERIFY_SHA3_224,
3124 .help = "Use sha3-224 checksums for verification",
3126 { .ival = "sha3-256",
3127 .oval = VERIFY_SHA3_256,
3128 .help = "Use sha3-256 checksums for verification",
3130 { .ival = "sha3-384",
3131 .oval = VERIFY_SHA3_384,
3132 .help = "Use sha3-384 checksums for verification",
3134 { .ival = "sha3-512",
3135 .oval = VERIFY_SHA3_512,
3136 .help = "Use sha3-512 checksums for verification",
3139 .oval = VERIFY_XXHASH,
3140 .help = "Use xxhash checksums for verification",
3142 /* Meta information was included into verify_header,
3143 * 'meta' verification is implied by default. */
3145 .oval = VERIFY_HDR_ONLY,
3146 .help = "Use io information for verification. "
3147 "Now is implied by default, thus option is obsolete, "
3150 { .ival = "pattern",
3151 .oval = VERIFY_PATTERN_NO_HDR,
3152 .help = "Verify strict pattern",
3156 .oval = VERIFY_NULL,
3157 .help = "Pretend to verify",
3162 .name = "do_verify",
3163 .lname = "Perform verify step",
3164 .type = FIO_OPT_BOOL,
3165 .off1 = offsetof(struct thread_options, do_verify),
3166 .help = "Run verification stage after write",
3170 .category = FIO_OPT_C_IO,
3171 .group = FIO_OPT_G_VERIFY,
3174 .name = "verifysort",
3175 .lname = "Verify sort",
3176 .type = FIO_OPT_SOFT_DEPRECATED,
3177 .category = FIO_OPT_C_IO,
3178 .group = FIO_OPT_G_VERIFY,
3181 .name = "verifysort_nr",
3182 .lname = "Verify Sort Nr",
3183 .type = FIO_OPT_SOFT_DEPRECATED,
3184 .category = FIO_OPT_C_IO,
3185 .group = FIO_OPT_G_VERIFY,
3188 .name = "verify_interval",
3189 .lname = "Verify interval",
3190 .type = FIO_OPT_INT,
3191 .off1 = offsetof(struct thread_options, verify_interval),
3192 .minval = 2 * sizeof(struct verify_header),
3193 .help = "Store verify buffer header every N bytes",
3196 .interval = 2 * sizeof(struct verify_header),
3197 .category = FIO_OPT_C_IO,
3198 .group = FIO_OPT_G_VERIFY,
3201 .name = "verify_offset",
3202 .lname = "Verify offset",
3203 .type = FIO_OPT_INT,
3204 .help = "Offset verify header location by N bytes",
3205 .off1 = offsetof(struct thread_options, verify_offset),
3206 .minval = sizeof(struct verify_header),
3209 .category = FIO_OPT_C_IO,
3210 .group = FIO_OPT_G_VERIFY,
3213 .name = "verify_pattern",
3214 .lname = "Verify pattern",
3215 .type = FIO_OPT_STR,
3216 .cb = str_verify_pattern_cb,
3217 .off1 = offsetof(struct thread_options, verify_pattern),
3218 .help = "Fill pattern for IO buffers",
3221 .category = FIO_OPT_C_IO,
3222 .group = FIO_OPT_G_VERIFY,
3225 .name = "verify_fatal",
3226 .lname = "Verify fatal",
3227 .type = FIO_OPT_BOOL,
3228 .off1 = offsetof(struct thread_options, verify_fatal),
3230 .help = "Exit on a single verify failure, don't continue",
3233 .category = FIO_OPT_C_IO,
3234 .group = FIO_OPT_G_VERIFY,
3237 .name = "verify_dump",
3238 .lname = "Verify dump",
3239 .type = FIO_OPT_BOOL,
3240 .off1 = offsetof(struct thread_options, verify_dump),
3242 .help = "Dump contents of good and bad blocks on failure",
3245 .category = FIO_OPT_C_IO,
3246 .group = FIO_OPT_G_VERIFY,
3249 .name = "verify_async",
3250 .lname = "Verify asynchronously",
3251 .type = FIO_OPT_INT,
3252 .off1 = offsetof(struct thread_options, verify_async),
3254 .help = "Number of async verifier threads to use",
3257 .category = FIO_OPT_C_IO,
3258 .group = FIO_OPT_G_VERIFY,
3261 .name = "verify_backlog",
3262 .lname = "Verify backlog",
3263 .type = FIO_OPT_STR_VAL,
3264 .off1 = offsetof(struct thread_options, verify_backlog),
3265 .help = "Verify after this number of blocks are written",
3268 .category = FIO_OPT_C_IO,
3269 .group = FIO_OPT_G_VERIFY,
3272 .name = "verify_backlog_batch",
3273 .lname = "Verify backlog batch",
3274 .type = FIO_OPT_INT,
3275 .off1 = offsetof(struct thread_options, verify_batch),
3276 .help = "Verify this number of IO blocks",
3279 .category = FIO_OPT_C_IO,
3280 .group = FIO_OPT_G_VERIFY,
3282 #ifdef FIO_HAVE_CPU_AFFINITY
3284 .name = "verify_async_cpus",
3285 .lname = "Async verify CPUs",
3286 .type = FIO_OPT_STR,
3287 .cb = str_verify_cpus_allowed_cb,
3288 .off1 = offsetof(struct thread_options, verify_cpumask),
3289 .help = "Set CPUs allowed for async verify threads",
3290 .parent = "verify_async",
3292 .category = FIO_OPT_C_IO,
3293 .group = FIO_OPT_G_VERIFY,
3297 .name = "verify_async_cpus",
3298 .lname = "Async verify CPUs",
3299 .type = FIO_OPT_UNSUPPORTED,
3300 .help = "Your platform does not support CPU affinities",
3304 .name = "experimental_verify",
3305 .lname = "Experimental Verify",
3306 .off1 = offsetof(struct thread_options, experimental_verify),
3307 .type = FIO_OPT_BOOL,
3308 .help = "Enable experimental verification",
3310 .category = FIO_OPT_C_IO,
3311 .group = FIO_OPT_G_VERIFY,
3314 .name = "verify_state_load",
3315 .lname = "Load verify state",
3316 .off1 = offsetof(struct thread_options, verify_state),
3317 .type = FIO_OPT_BOOL,
3318 .help = "Load verify termination state",
3320 .category = FIO_OPT_C_IO,
3321 .group = FIO_OPT_G_VERIFY,
3324 .name = "verify_state_save",
3325 .lname = "Save verify state",
3326 .off1 = offsetof(struct thread_options, verify_state_save),
3327 .type = FIO_OPT_BOOL,
3329 .help = "Save verify state on termination",
3331 .category = FIO_OPT_C_IO,
3332 .group = FIO_OPT_G_VERIFY,
3334 #ifdef FIO_HAVE_TRIM
3336 .name = "trim_percentage",
3337 .lname = "Trim percentage",
3338 .type = FIO_OPT_INT,
3339 .off1 = offsetof(struct thread_options, trim_percentage),
3342 .help = "Number of verify blocks to trim (i.e., discard)",
3347 .category = FIO_OPT_C_IO,
3348 .group = FIO_OPT_G_TRIM,
3351 .name = "trim_verify_zero",
3352 .lname = "Verify trim zero",
3353 .type = FIO_OPT_BOOL,
3354 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3355 .off1 = offsetof(struct thread_options, trim_zero),
3356 .parent = "trim_percentage",
3359 .category = FIO_OPT_C_IO,
3360 .group = FIO_OPT_G_TRIM,
3363 .name = "trim_backlog",
3364 .lname = "Trim backlog",
3365 .type = FIO_OPT_STR_VAL,
3366 .off1 = offsetof(struct thread_options, trim_backlog),
3367 .help = "Trim after this number of blocks are written",
3368 .parent = "trim_percentage",
3371 .category = FIO_OPT_C_IO,
3372 .group = FIO_OPT_G_TRIM,
3375 .name = "trim_backlog_batch",
3376 .lname = "Trim backlog batch",
3377 .type = FIO_OPT_INT,
3378 .off1 = offsetof(struct thread_options, trim_batch),
3379 .help = "Trim this number of IO blocks",
3380 .parent = "trim_percentage",
3383 .category = FIO_OPT_C_IO,
3384 .group = FIO_OPT_G_TRIM,
3388 .name = "trim_percentage",
3389 .lname = "Trim percentage",
3390 .type = FIO_OPT_UNSUPPORTED,
3391 .help = "Fio does not support TRIM on your platform",
3394 .name = "trim_verify_zero",
3395 .lname = "Verify trim zero",
3396 .type = FIO_OPT_UNSUPPORTED,
3397 .help = "Fio does not support TRIM on your platform",
3400 .name = "trim_backlog",
3401 .lname = "Trim backlog",
3402 .type = FIO_OPT_UNSUPPORTED,
3403 .help = "Fio does not support TRIM on your platform",
3406 .name = "trim_backlog_batch",
3407 .lname = "Trim backlog batch",
3408 .type = FIO_OPT_UNSUPPORTED,
3409 .help = "Fio does not support TRIM on your platform",
3413 .name = "write_iolog",
3414 .lname = "Write I/O log",
3415 .type = FIO_OPT_STR_STORE,
3416 .off1 = offsetof(struct thread_options, write_iolog_file),
3417 .help = "Store IO pattern to file",
3418 .category = FIO_OPT_C_IO,
3419 .group = FIO_OPT_G_IOLOG,
3422 .name = "read_iolog",
3423 .lname = "Read I/O log",
3424 .type = FIO_OPT_STR_STORE,
3425 .off1 = offsetof(struct thread_options, read_iolog_file),
3426 .help = "Playback IO pattern from file",
3427 .category = FIO_OPT_C_IO,
3428 .group = FIO_OPT_G_IOLOG,
3431 .name = "read_iolog_chunked",
3432 .lname = "Read I/O log in parts",
3433 .type = FIO_OPT_BOOL,
3434 .off1 = offsetof(struct thread_options, read_iolog_chunked),
3436 .parent = "read_iolog",
3437 .help = "Parse IO pattern in chunks",
3438 .category = FIO_OPT_C_IO,
3439 .group = FIO_OPT_G_IOLOG,
3442 .name = "replay_no_stall",
3443 .lname = "Don't stall on replay",
3444 .type = FIO_OPT_BOOL,
3445 .off1 = offsetof(struct thread_options, no_stall),
3447 .parent = "read_iolog",
3449 .help = "Playback IO pattern file as fast as possible without stalls",
3450 .category = FIO_OPT_C_IO,
3451 .group = FIO_OPT_G_IOLOG,
3454 .name = "replay_redirect",
3455 .lname = "Redirect device for replay",
3456 .type = FIO_OPT_STR_STORE,
3457 .off1 = offsetof(struct thread_options, replay_redirect),
3458 .parent = "read_iolog",
3460 .help = "Replay all I/O onto this device, regardless of trace device",
3461 .category = FIO_OPT_C_IO,
3462 .group = FIO_OPT_G_IOLOG,
3465 .name = "replay_scale",
3466 .lname = "Replace offset scale factor",
3467 .type = FIO_OPT_INT,
3468 .off1 = offsetof(struct thread_options, replay_scale),
3469 .parent = "read_iolog",
3471 .help = "Align offsets to this blocksize",
3472 .category = FIO_OPT_C_IO,
3473 .group = FIO_OPT_G_IOLOG,
3476 .name = "replay_align",
3477 .lname = "Replace alignment",
3478 .type = FIO_OPT_INT,
3479 .off1 = offsetof(struct thread_options, replay_align),
3480 .parent = "read_iolog",
3481 .help = "Scale offset down by this factor",
3482 .category = FIO_OPT_C_IO,
3483 .group = FIO_OPT_G_IOLOG,
3487 .name = "replay_time_scale",
3488 .lname = "Replay Time Scale",
3489 .type = FIO_OPT_INT,
3490 .off1 = offsetof(struct thread_options, replay_time_scale),
3493 .parent = "read_iolog",
3495 .help = "Scale time for replay events",
3496 .category = FIO_OPT_C_IO,
3497 .group = FIO_OPT_G_IOLOG,
3500 .name = "replay_skip",
3501 .lname = "Replay Skip",
3502 .type = FIO_OPT_STR,
3503 .cb = str_replay_skip_cb,
3504 .off1 = offsetof(struct thread_options, replay_skip),
3505 .parent = "read_iolog",
3506 .help = "Skip certain IO types (read,write,trim,flush)",
3507 .category = FIO_OPT_C_IO,
3508 .group = FIO_OPT_G_IOLOG,
3511 .name = "merge_blktrace_file",
3512 .lname = "Merged blktrace output filename",
3513 .type = FIO_OPT_STR_STORE,
3514 .off1 = offsetof(struct thread_options, merge_blktrace_file),
3515 .help = "Merged blktrace output filename",
3516 .category = FIO_OPT_C_IO,
3517 .group = FIO_OPT_G_IOLOG,
3520 .name = "merge_blktrace_scalars",
3521 .lname = "Percentage to scale each trace",
3522 .type = FIO_OPT_FLOAT_LIST,
3523 .off1 = offsetof(struct thread_options, merge_blktrace_scalars),
3524 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3525 .help = "Percentage to scale each trace",
3526 .category = FIO_OPT_C_IO,
3527 .group = FIO_OPT_G_IOLOG,
3530 .name = "merge_blktrace_iters",
3531 .lname = "Number of iterations to run per trace",
3532 .type = FIO_OPT_FLOAT_LIST,
3533 .off1 = offsetof(struct thread_options, merge_blktrace_iters),
3534 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3535 .help = "Number of iterations to run per trace",
3536 .category = FIO_OPT_C_IO,
3537 .group = FIO_OPT_G_IOLOG,
3540 .name = "exec_prerun",
3541 .lname = "Pre-execute runnable",
3542 .type = FIO_OPT_STR_STORE,
3543 .off1 = offsetof(struct thread_options, exec_prerun),
3544 .help = "Execute this file prior to running job",
3545 .category = FIO_OPT_C_GENERAL,
3546 .group = FIO_OPT_G_INVALID,
3549 .name = "exec_postrun",
3550 .lname = "Post-execute runnable",
3551 .type = FIO_OPT_STR_STORE,
3552 .off1 = offsetof(struct thread_options, exec_postrun),
3553 .help = "Execute this file after running job",
3554 .category = FIO_OPT_C_GENERAL,
3555 .group = FIO_OPT_G_INVALID,
3557 #ifdef FIO_HAVE_IOSCHED_SWITCH
3559 .name = "ioscheduler",
3560 .lname = "I/O scheduler",
3561 .type = FIO_OPT_STR_STORE,
3562 .off1 = offsetof(struct thread_options, ioscheduler),
3563 .help = "Use this IO scheduler on the backing device",
3564 .category = FIO_OPT_C_FILE,
3565 .group = FIO_OPT_G_INVALID,
3569 .name = "ioscheduler",
3570 .lname = "I/O scheduler",
3571 .type = FIO_OPT_UNSUPPORTED,
3572 .help = "Your platform does not support IO scheduler switching",
3577 .lname = "Zone mode",
3578 .help = "Mode for the zonesize, zonerange and zoneskip parameters",
3579 .type = FIO_OPT_STR,
3580 .off1 = offsetof(struct thread_options, zone_mode),
3582 .category = FIO_OPT_C_IO,
3583 .group = FIO_OPT_G_ZONE,
3586 .oval = ZONE_MODE_NONE,
3587 .help = "no zoning",
3589 { .ival = "strided",
3590 .oval = ZONE_MODE_STRIDED,
3591 .help = "strided mode - random I/O is restricted to a single zone",
3594 .oval = ZONE_MODE_ZBD,
3595 .help = "zoned block device mode - random I/O selects one of multiple zones randomly",
3601 .lname = "Zone size",
3602 .type = FIO_OPT_STR_VAL,
3603 .off1 = offsetof(struct thread_options, zone_size),
3604 .help = "Amount of data to read per zone",
3606 .interval = 1024 * 1024,
3607 .category = FIO_OPT_C_IO,
3608 .group = FIO_OPT_G_ZONE,
3611 .name = "zonecapacity",
3612 .lname = "Zone capacity",
3613 .type = FIO_OPT_STR_VAL,
3614 .off1 = offsetof(struct thread_options, zone_capacity),
3615 .help = "Capacity per zone",
3617 .interval = 1024 * 1024,
3618 .category = FIO_OPT_C_IO,
3619 .group = FIO_OPT_G_ZONE,
3622 .name = "zonerange",
3623 .lname = "Zone range",
3624 .type = FIO_OPT_STR_VAL,
3625 .off1 = offsetof(struct thread_options, zone_range),
3626 .help = "Give size of an IO zone",
3628 .interval = 1024 * 1024,
3629 .category = FIO_OPT_C_IO,
3630 .group = FIO_OPT_G_ZONE,
3634 .lname = "Zone skip",
3635 .type = FIO_OPT_STR_VAL_ZONE,
3636 .cb = str_zoneskip_cb,
3637 .off1 = offsetof(struct thread_options, zone_skip),
3638 .help = "Space between IO zones",
3640 .category = FIO_OPT_C_IO,
3641 .group = FIO_OPT_G_ZONE,
3644 .name = "read_beyond_wp",
3645 .lname = "Allow reads beyond the zone write pointer",
3646 .type = FIO_OPT_BOOL,
3647 .off1 = offsetof(struct thread_options, read_beyond_wp),
3648 .help = "Allow reads beyond the zone write pointer",
3650 .category = FIO_OPT_C_IO,
3651 .group = FIO_OPT_G_INVALID,
3654 .name = "max_open_zones",
3655 .lname = "Per device/file maximum number of open zones",
3656 .type = FIO_OPT_INT,
3657 .off1 = offsetof(struct thread_options, max_open_zones),
3658 .maxval = ZBD_MAX_WRITE_ZONES,
3659 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd",
3661 .category = FIO_OPT_C_IO,
3662 .group = FIO_OPT_G_INVALID,
3665 .name = "job_max_open_zones",
3666 .lname = "Job maximum number of open zones",
3667 .type = FIO_OPT_INT,
3668 .off1 = offsetof(struct thread_options, job_max_open_zones),
3669 .maxval = ZBD_MAX_WRITE_ZONES,
3670 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd by one thread/process",
3672 .category = FIO_OPT_C_IO,
3673 .group = FIO_OPT_G_INVALID,
3676 .name = "ignore_zone_limits",
3677 .lname = "Ignore zone resource limits",
3678 .type = FIO_OPT_BOOL,
3679 .off1 = offsetof(struct thread_options, ignore_zone_limits),
3681 .help = "Ignore the zone resource limits (max open/active zones) reported by the device",
3682 .category = FIO_OPT_C_IO,
3683 .group = FIO_OPT_G_INVALID,
3686 .name = "zone_reset_threshold",
3687 .lname = "Zone reset threshold",
3688 .help = "Zoned block device reset threshold",
3689 .type = FIO_OPT_FLOAT_LIST,
3691 .off1 = offsetof(struct thread_options, zrt),
3694 .category = FIO_OPT_C_IO,
3695 .group = FIO_OPT_G_ZONE,
3698 .name = "zone_reset_frequency",
3699 .lname = "Zone reset frequency",
3700 .help = "Zoned block device zone reset frequency in HZ",
3701 .type = FIO_OPT_FLOAT_LIST,
3703 .off1 = offsetof(struct thread_options, zrf),
3706 .category = FIO_OPT_C_IO,
3707 .group = FIO_OPT_G_ZONE,
3711 .lname = "Flexible data placement",
3712 .type = FIO_OPT_BOOL,
3713 .off1 = offsetof(struct thread_options, fdp),
3714 .help = "Use Data placement directive (FDP)",
3716 .category = FIO_OPT_C_IO,
3717 .group = FIO_OPT_G_INVALID,
3720 .name = "dataplacement",
3721 .alias = "data_placement",
3722 .lname = "Data Placement interface",
3723 .type = FIO_OPT_STR,
3724 .off1 = offsetof(struct thread_options, dp_type),
3725 .help = "Data Placement interface to use",
3727 .category = FIO_OPT_C_IO,
3728 .group = FIO_OPT_G_INVALID,
3731 .oval = FIO_DP_NONE,
3732 .help = "Do not specify a data placement interface",
3736 .help = "Use Flexible Data Placement interface",
3738 { .ival = "streams",
3739 .oval = FIO_DP_STREAMS,
3740 .help = "Use Streams interface",
3745 .name = "plid_select",
3746 .alias = "fdp_pli_select",
3747 .lname = "Data Placement ID selection strategy",
3748 .type = FIO_OPT_STR,
3749 .off1 = offsetof(struct thread_options, dp_id_select),
3750 .help = "Strategy for selecting next Data Placement ID",
3751 .def = "roundrobin",
3752 .category = FIO_OPT_C_IO,
3753 .group = FIO_OPT_G_INVALID,
3756 .oval = FIO_DP_RANDOM,
3757 .help = "Choose a Placement ID at random (uniform)",
3759 { .ival = "roundrobin",
3761 .help = "Round robin select Placement IDs",
3768 .lname = "Stream IDs/Data Placement ID indices",
3769 .type = FIO_OPT_STR,
3770 .cb = str_fdp_pli_cb,
3771 .off1 = offsetof(struct thread_options, dp_ids),
3772 .help = "Sets which Data Placement ids to use (defaults to all for FDP)",
3774 .category = FIO_OPT_C_IO,
3775 .group = FIO_OPT_G_INVALID,
3779 .lname = "Lock memory",
3780 .type = FIO_OPT_STR_VAL,
3781 .off1 = offsetof(struct thread_options, lockmem),
3782 .help = "Lock down this amount of memory (per worker)",
3784 .interval = 1024 * 1024,
3785 .category = FIO_OPT_C_GENERAL,
3786 .group = FIO_OPT_G_INVALID,
3789 .name = "rwmixread",
3790 .lname = "Read/write mix read",
3791 .type = FIO_OPT_INT,
3792 .cb = str_rwmix_read_cb,
3793 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3795 .help = "Percentage of mixed workload that is reads",
3798 .inverse = "rwmixwrite",
3799 .category = FIO_OPT_C_IO,
3800 .group = FIO_OPT_G_RWMIX,
3803 .name = "rwmixwrite",
3804 .lname = "Read/write mix write",
3805 .type = FIO_OPT_INT,
3806 .cb = str_rwmix_write_cb,
3807 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3809 .help = "Percentage of mixed workload that is writes",
3812 .inverse = "rwmixread",
3813 .category = FIO_OPT_C_IO,
3814 .group = FIO_OPT_G_RWMIX,
3817 .name = "rwmixcycle",
3818 .lname = "Read/write mix cycle",
3819 .type = FIO_OPT_DEPRECATED,
3820 .category = FIO_OPT_C_IO,
3821 .group = FIO_OPT_G_RWMIX,
3826 .type = FIO_OPT_INT,
3827 .off1 = offsetof(struct thread_options, nice),
3828 .help = "Set job CPU nice value",
3833 .category = FIO_OPT_C_GENERAL,
3834 .group = FIO_OPT_G_CRED,
3836 #ifdef FIO_HAVE_IOPRIO
3839 .lname = "I/O nice priority",
3840 .type = FIO_OPT_INT,
3841 .off1 = offsetof(struct thread_options, ioprio),
3842 .help = "Set job IO priority value",
3843 .minval = IOPRIO_MIN_PRIO,
3844 .maxval = IOPRIO_MAX_PRIO,
3846 .category = FIO_OPT_C_GENERAL,
3847 .group = FIO_OPT_G_CRED,
3852 .lname = "I/O nice priority",
3853 .type = FIO_OPT_UNSUPPORTED,
3854 .help = "Your platform does not support IO priorities",
3857 #ifdef FIO_HAVE_IOPRIO_CLASS
3858 #ifndef FIO_HAVE_IOPRIO
3859 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3862 .name = "prioclass",
3863 .lname = "I/O nice priority class",
3864 .type = FIO_OPT_INT,
3865 .off1 = offsetof(struct thread_options, ioprio_class),
3866 .help = "Set job IO priority class",
3867 .minval = IOPRIO_MIN_PRIO_CLASS,
3868 .maxval = IOPRIO_MAX_PRIO_CLASS,
3870 .category = FIO_OPT_C_GENERAL,
3871 .group = FIO_OPT_G_CRED,
3875 .lname = "I/O nice priority hint",
3876 .type = FIO_OPT_INT,
3877 .off1 = offsetof(struct thread_options, ioprio_hint),
3878 .help = "Set job IO priority hint",
3879 .minval = IOPRIO_MIN_PRIO_HINT,
3880 .maxval = IOPRIO_MAX_PRIO_HINT,
3882 .category = FIO_OPT_C_GENERAL,
3883 .group = FIO_OPT_G_CRED,
3887 .name = "prioclass",
3888 .lname = "I/O nice priority class",
3889 .type = FIO_OPT_UNSUPPORTED,
3890 .help = "Your platform does not support IO priority classes",
3894 .lname = "I/O nice priority hint",
3895 .type = FIO_OPT_UNSUPPORTED,
3896 .help = "Your platform does not support IO priority hints",
3900 .name = "thinktime",
3901 .lname = "Thinktime",
3902 .type = FIO_OPT_INT,
3903 .off1 = offsetof(struct thread_options, thinktime),
3904 .help = "Idle time between IO buffers (usec)",
3907 .category = FIO_OPT_C_IO,
3908 .group = FIO_OPT_G_THINKTIME,
3911 .name = "thinktime_spin",
3912 .lname = "Thinktime spin",
3913 .type = FIO_OPT_INT,
3914 .off1 = offsetof(struct thread_options, thinktime_spin),
3915 .help = "Start think time by spinning this amount (usec)",
3918 .parent = "thinktime",
3920 .category = FIO_OPT_C_IO,
3921 .group = FIO_OPT_G_THINKTIME,
3924 .name = "thinkcycles",
3925 .lname = "Think cycles",
3926 .type = FIO_OPT_INT,
3927 .off1 = offsetof(struct thread_options, thinkcycles),
3928 .help = "Spin for a constant amount of cycles between requests",
3930 .parent = "thinktime",
3932 .category = FIO_OPT_C_IO,
3933 .group = FIO_OPT_G_THINKTIME,
3936 .name = "thinktime_blocks",
3937 .lname = "Thinktime blocks",
3938 .type = FIO_OPT_INT,
3939 .off1 = offsetof(struct thread_options, thinktime_blocks),
3940 .help = "IO buffer period between 'thinktime'",
3942 .parent = "thinktime",
3944 .category = FIO_OPT_C_IO,
3945 .group = FIO_OPT_G_THINKTIME,
3948 .name = "thinktime_blocks_type",
3949 .lname = "Thinktime blocks type",
3950 .type = FIO_OPT_STR,
3951 .off1 = offsetof(struct thread_options, thinktime_blocks_type),
3952 .help = "How thinktime_blocks takes effect",
3954 .category = FIO_OPT_C_IO,
3955 .group = FIO_OPT_G_THINKTIME,
3957 { .ival = "complete",
3958 .oval = THINKTIME_BLOCKS_TYPE_COMPLETE,
3959 .help = "thinktime_blocks takes effect at the completion side",
3963 .oval = THINKTIME_BLOCKS_TYPE_ISSUE,
3964 .help = "thinktime_blocks takes effect at the issue side",
3967 .parent = "thinktime",
3970 .name = "thinktime_iotime",
3971 .lname = "Thinktime interval",
3972 .type = FIO_OPT_INT,
3973 .off1 = offsetof(struct thread_options, thinktime_iotime),
3974 .help = "IO time interval between 'thinktime'",
3976 .parent = "thinktime",
3980 .category = FIO_OPT_C_IO,
3981 .group = FIO_OPT_G_THINKTIME,
3985 .lname = "I/O rate",
3986 .type = FIO_OPT_ULL,
3987 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3988 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3989 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
3990 .help = "Set bandwidth rate",
3991 .category = FIO_OPT_C_IO,
3992 .group = FIO_OPT_G_RATE,
3997 .lname = "I/O min rate",
3998 .type = FIO_OPT_ULL,
3999 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
4000 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
4001 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
4002 .help = "Job must meet this rate or it will be shutdown",
4005 .category = FIO_OPT_C_IO,
4006 .group = FIO_OPT_G_RATE,
4009 .name = "rate_iops",
4010 .lname = "I/O rate IOPS",
4011 .type = FIO_OPT_INT,
4012 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
4013 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
4014 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
4015 .help = "Limit IO used to this number of IO operations/sec",
4017 .category = FIO_OPT_C_IO,
4018 .group = FIO_OPT_G_RATE,
4021 .name = "rate_iops_min",
4022 .lname = "I/O min rate IOPS",
4023 .type = FIO_OPT_INT,
4024 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
4025 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
4026 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
4027 .help = "Job must meet this rate or it will be shut down",
4028 .parent = "rate_iops",
4030 .category = FIO_OPT_C_IO,
4031 .group = FIO_OPT_G_RATE,
4034 .name = "rate_process",
4035 .lname = "Rate Process",
4036 .type = FIO_OPT_STR,
4037 .off1 = offsetof(struct thread_options, rate_process),
4038 .help = "What process controls how rated IO is managed",
4040 .category = FIO_OPT_C_IO,
4041 .group = FIO_OPT_G_RATE,
4044 .oval = RATE_PROCESS_LINEAR,
4045 .help = "Linear rate of IO",
4049 .oval = RATE_PROCESS_POISSON,
4050 .help = "Rate follows Poisson process",
4056 .name = "rate_cycle",
4057 .alias = "ratecycle",
4058 .lname = "I/O rate cycle",
4059 .type = FIO_OPT_INT,
4060 .off1 = offsetof(struct thread_options, ratecycle),
4061 .help = "Window average for rate limits (msec)",
4065 .category = FIO_OPT_C_IO,
4066 .group = FIO_OPT_G_RATE,
4069 .name = "rate_ignore_thinktime",
4070 .lname = "Rate ignore thinktime",
4071 .type = FIO_OPT_BOOL,
4072 .off1 = offsetof(struct thread_options, rate_ign_think),
4073 .help = "Rated IO ignores thinktime settings",
4075 .category = FIO_OPT_C_IO,
4076 .group = FIO_OPT_G_RATE,
4079 .name = "max_latency",
4080 .lname = "Max Latency (usec)",
4081 .type = FIO_OPT_ULL,
4082 .off1 = offsetof(struct thread_options, max_latency[DDIR_READ]),
4083 .off2 = offsetof(struct thread_options, max_latency[DDIR_WRITE]),
4084 .off3 = offsetof(struct thread_options, max_latency[DDIR_TRIM]),
4085 .help = "Maximum tolerated IO latency (usec)",
4087 .category = FIO_OPT_C_IO,
4088 .group = FIO_OPT_G_LATPROF,
4091 .name = "latency_target",
4092 .lname = "Latency Target (usec)",
4093 .type = FIO_OPT_STR_VAL_TIME,
4094 .off1 = offsetof(struct thread_options, latency_target),
4095 .help = "Ramp to max queue depth supporting this latency",
4097 .category = FIO_OPT_C_IO,
4098 .group = FIO_OPT_G_LATPROF,
4101 .name = "latency_window",
4102 .lname = "Latency Window (usec)",
4103 .type = FIO_OPT_STR_VAL_TIME,
4104 .off1 = offsetof(struct thread_options, latency_window),
4105 .help = "Time to sustain latency_target",
4107 .category = FIO_OPT_C_IO,
4108 .group = FIO_OPT_G_LATPROF,
4111 .name = "latency_percentile",
4112 .lname = "Latency Percentile",
4113 .type = FIO_OPT_FLOAT_LIST,
4114 .off1 = offsetof(struct thread_options, latency_percentile),
4115 .help = "Percentile of IOs must be below latency_target",
4120 .category = FIO_OPT_C_IO,
4121 .group = FIO_OPT_G_LATPROF,
4124 .name = "latency_run",
4125 .lname = "Latency Run",
4126 .type = FIO_OPT_BOOL,
4127 .off1 = offsetof(struct thread_options, latency_run),
4128 .help = "Keep adjusting queue depth to match latency_target",
4130 .category = FIO_OPT_C_IO,
4131 .group = FIO_OPT_G_LATPROF,
4134 .name = "invalidate",
4135 .lname = "Cache invalidate",
4136 .type = FIO_OPT_BOOL,
4137 .off1 = offsetof(struct thread_options, invalidate_cache),
4138 .help = "Invalidate buffer/page cache prior to running job",
4140 .category = FIO_OPT_C_IO,
4141 .group = FIO_OPT_G_IO_TYPE,
4145 .lname = "Synchronous I/O",
4146 .type = FIO_OPT_STR,
4147 .off1 = offsetof(struct thread_options, sync_io),
4148 .help = "Use synchronous write IO",
4151 .category = FIO_OPT_C_IO,
4152 .group = FIO_OPT_G_IO_TYPE,
4173 #ifdef FIO_HAVE_WRITE_HINT
4175 .name = "write_hint",
4176 .lname = "Write hint",
4177 .type = FIO_OPT_STR,
4178 .off1 = offsetof(struct thread_options, write_hint),
4179 .help = "Set expected write life time",
4180 .category = FIO_OPT_C_ENGINE,
4181 .group = FIO_OPT_G_INVALID,
4184 .oval = RWH_WRITE_LIFE_NONE,
4187 .oval = RWH_WRITE_LIFE_SHORT,
4190 .oval = RWH_WRITE_LIFE_MEDIUM,
4193 .oval = RWH_WRITE_LIFE_LONG,
4195 { .ival = "extreme",
4196 .oval = RWH_WRITE_LIFE_EXTREME,
4202 .name = "create_serialize",
4203 .lname = "Create serialize",
4204 .type = FIO_OPT_BOOL,
4205 .off1 = offsetof(struct thread_options, create_serialize),
4206 .help = "Serialize creation of job files",
4208 .category = FIO_OPT_C_FILE,
4209 .group = FIO_OPT_G_INVALID,
4212 .name = "create_fsync",
4213 .lname = "Create fsync",
4214 .type = FIO_OPT_BOOL,
4215 .off1 = offsetof(struct thread_options, create_fsync),
4216 .help = "fsync file after creation",
4218 .category = FIO_OPT_C_FILE,
4219 .group = FIO_OPT_G_INVALID,
4222 .name = "create_on_open",
4223 .lname = "Create on open",
4224 .type = FIO_OPT_BOOL,
4225 .off1 = offsetof(struct thread_options, create_on_open),
4226 .help = "Create files when they are opened for IO",
4228 .category = FIO_OPT_C_FILE,
4229 .group = FIO_OPT_G_INVALID,
4232 .name = "create_only",
4233 .lname = "Create Only",
4234 .type = FIO_OPT_BOOL,
4235 .off1 = offsetof(struct thread_options, create_only),
4236 .help = "Only perform file creation phase",
4237 .category = FIO_OPT_C_FILE,
4241 .name = "allow_file_create",
4242 .lname = "Allow file create",
4243 .type = FIO_OPT_BOOL,
4244 .off1 = offsetof(struct thread_options, allow_create),
4245 .help = "Permit fio to create files, if they don't exist",
4247 .category = FIO_OPT_C_FILE,
4248 .group = FIO_OPT_G_FILENAME,
4251 .name = "allow_mounted_write",
4252 .lname = "Allow mounted write",
4253 .type = FIO_OPT_BOOL,
4254 .off1 = offsetof(struct thread_options, allow_mounted_write),
4255 .help = "Allow writes to a mounted partition",
4257 .category = FIO_OPT_C_FILE,
4258 .group = FIO_OPT_G_FILENAME,
4262 .lname = "Pre-read files",
4263 .type = FIO_OPT_BOOL,
4264 .off1 = offsetof(struct thread_options, pre_read),
4265 .help = "Pre-read files before starting official testing",
4267 .category = FIO_OPT_C_FILE,
4268 .group = FIO_OPT_G_INVALID,
4270 #ifdef FIO_HAVE_CPU_AFFINITY
4273 .lname = "CPU mask",
4274 .type = FIO_OPT_INT,
4275 .cb = str_cpumask_cb,
4276 .off1 = offsetof(struct thread_options, cpumask),
4277 .help = "CPU affinity mask",
4278 .category = FIO_OPT_C_GENERAL,
4279 .group = FIO_OPT_G_CRED,
4282 .name = "cpus_allowed",
4283 .lname = "CPUs allowed",
4284 .type = FIO_OPT_STR,
4285 .cb = str_cpus_allowed_cb,
4286 .off1 = offsetof(struct thread_options, cpumask),
4287 .help = "Set CPUs allowed",
4288 .category = FIO_OPT_C_GENERAL,
4289 .group = FIO_OPT_G_CRED,
4292 .name = "cpus_allowed_policy",
4293 .lname = "CPUs allowed distribution policy",
4294 .type = FIO_OPT_STR,
4295 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
4296 .help = "Distribution policy for cpus_allowed",
4297 .parent = "cpus_allowed",
4301 .oval = FIO_CPUS_SHARED,
4302 .help = "Mask shared between threads",
4305 .oval = FIO_CPUS_SPLIT,
4306 .help = "Mask split between threads",
4309 .category = FIO_OPT_C_GENERAL,
4310 .group = FIO_OPT_G_CRED,
4315 .lname = "CPU mask",
4316 .type = FIO_OPT_UNSUPPORTED,
4317 .help = "Your platform does not support CPU affinities",
4320 .name = "cpus_allowed",
4321 .lname = "CPUs allowed",
4322 .type = FIO_OPT_UNSUPPORTED,
4323 .help = "Your platform does not support CPU affinities",
4326 .name = "cpus_allowed_policy",
4327 .lname = "CPUs allowed distribution policy",
4328 .type = FIO_OPT_UNSUPPORTED,
4329 .help = "Your platform does not support CPU affinities",
4332 #ifdef CONFIG_LIBNUMA
4334 .name = "numa_cpu_nodes",
4335 .lname = "NUMA CPU Nodes",
4336 .type = FIO_OPT_STR,
4337 .cb = str_numa_cpunodes_cb,
4338 .off1 = offsetof(struct thread_options, numa_cpunodes),
4339 .help = "NUMA CPU nodes bind",
4340 .category = FIO_OPT_C_GENERAL,
4341 .group = FIO_OPT_G_INVALID,
4344 .name = "numa_mem_policy",
4345 .lname = "NUMA Memory Policy",
4346 .type = FIO_OPT_STR,
4347 .cb = str_numa_mpol_cb,
4348 .off1 = offsetof(struct thread_options, numa_memnodes),
4349 .help = "NUMA memory policy setup",
4350 .category = FIO_OPT_C_GENERAL,
4351 .group = FIO_OPT_G_INVALID,
4355 .name = "numa_cpu_nodes",
4356 .lname = "NUMA CPU Nodes",
4357 .type = FIO_OPT_UNSUPPORTED,
4358 .help = "Build fio with libnuma-dev(el) to enable this option",
4361 .name = "numa_mem_policy",
4362 .lname = "NUMA Memory Policy",
4363 .type = FIO_OPT_UNSUPPORTED,
4364 .help = "Build fio with libnuma-dev(el) to enable this option",
4369 .name = "gpu_dev_id",
4370 .lname = "GPU device ID",
4371 .type = FIO_OPT_INT,
4372 .off1 = offsetof(struct thread_options, gpu_dev_id),
4373 .help = "Set GPU device ID for GPUDirect RDMA",
4375 .category = FIO_OPT_C_GENERAL,
4376 .group = FIO_OPT_G_INVALID,
4380 .name = "end_fsync",
4381 .lname = "End fsync",
4382 .type = FIO_OPT_BOOL,
4383 .off1 = offsetof(struct thread_options, end_fsync),
4384 .help = "Include fsync at the end of job",
4386 .category = FIO_OPT_C_FILE,
4387 .group = FIO_OPT_G_INVALID,
4390 .name = "fsync_on_close",
4391 .lname = "Fsync on close",
4392 .type = FIO_OPT_BOOL,
4393 .off1 = offsetof(struct thread_options, fsync_on_close),
4394 .help = "fsync files on close",
4396 .category = FIO_OPT_C_FILE,
4397 .group = FIO_OPT_G_INVALID,
4401 .lname = "Unlink file",
4402 .type = FIO_OPT_BOOL,
4403 .off1 = offsetof(struct thread_options, unlink),
4404 .help = "Unlink created files after job has completed",
4406 .category = FIO_OPT_C_FILE,
4407 .group = FIO_OPT_G_INVALID,
4410 .name = "unlink_each_loop",
4411 .lname = "Unlink file after each loop of a job",
4412 .type = FIO_OPT_BOOL,
4413 .off1 = offsetof(struct thread_options, unlink_each_loop),
4414 .help = "Unlink created files after each loop in a job has completed",
4416 .category = FIO_OPT_C_FILE,
4417 .group = FIO_OPT_G_INVALID,
4421 .lname = "Exit-all on terminate",
4422 .type = FIO_OPT_STR_SET,
4423 .cb = str_exitall_cb,
4424 .help = "Terminate all jobs when one exits",
4425 .category = FIO_OPT_C_GENERAL,
4426 .group = FIO_OPT_G_PROCESS,
4429 .name = "exit_what",
4430 .lname = "What jobs to quit on terminate",
4431 .type = FIO_OPT_STR,
4432 .off1 = offsetof(struct thread_options, exit_what),
4433 .help = "Fine-grained control for exitall",
4435 .category = FIO_OPT_C_GENERAL,
4436 .group = FIO_OPT_G_PROCESS,
4439 .oval = TERMINATE_GROUP,
4440 .help = "exit_all=1 default behaviour",
4442 { .ival = "stonewall",
4443 .oval = TERMINATE_STONEWALL,
4444 .help = "quit all currently running jobs; continue with next stonewall",
4447 .oval = TERMINATE_ALL,
4448 .help = "Quit everything",
4453 .name = "exitall_on_error",
4454 .lname = "Exit-all on terminate in error",
4455 .type = FIO_OPT_STR_SET,
4456 .off1 = offsetof(struct thread_options, exitall_error),
4457 .help = "Terminate all jobs when one exits in error",
4458 .category = FIO_OPT_C_GENERAL,
4459 .group = FIO_OPT_G_PROCESS,
4462 .name = "stonewall",
4463 .lname = "Wait for previous",
4464 .alias = "wait_for_previous",
4465 .type = FIO_OPT_STR_SET,
4466 .off1 = offsetof(struct thread_options, stonewall),
4467 .help = "Insert a hard barrier between this job and previous",
4468 .category = FIO_OPT_C_GENERAL,
4469 .group = FIO_OPT_G_PROCESS,
4472 .name = "new_group",
4473 .lname = "New group",
4474 .type = FIO_OPT_STR_SET,
4475 .off1 = offsetof(struct thread_options, new_group),
4476 .help = "Mark the start of a new group (for reporting)",
4477 .category = FIO_OPT_C_GENERAL,
4478 .group = FIO_OPT_G_PROCESS,
4483 .type = FIO_OPT_STR_SET,
4484 .off1 = offsetof(struct thread_options, use_thread),
4485 .help = "Use threads instead of processes",
4486 #ifdef CONFIG_NO_SHM
4490 .category = FIO_OPT_C_GENERAL,
4491 .group = FIO_OPT_G_PROCESS,
4494 .name = "per_job_logs",
4495 .lname = "Per Job Logs",
4496 .type = FIO_OPT_BOOL,
4497 .off1 = offsetof(struct thread_options, per_job_logs),
4498 .help = "Include job number in generated log files or not",
4500 .category = FIO_OPT_C_LOG,
4501 .group = FIO_OPT_G_INVALID,
4504 .name = "write_bw_log",
4505 .lname = "Write bandwidth log",
4506 .type = FIO_OPT_STR,
4507 .off1 = offsetof(struct thread_options, bw_log_file),
4508 .cb = str_write_bw_log_cb,
4509 .help = "Write log of bandwidth during run",
4510 .category = FIO_OPT_C_LOG,
4511 .group = FIO_OPT_G_INVALID,
4514 .name = "write_lat_log",
4515 .lname = "Write latency log",
4516 .type = FIO_OPT_STR,
4517 .off1 = offsetof(struct thread_options, lat_log_file),
4518 .cb = str_write_lat_log_cb,
4519 .help = "Write log of latency during run",
4520 .category = FIO_OPT_C_LOG,
4521 .group = FIO_OPT_G_INVALID,
4524 .name = "write_iops_log",
4525 .lname = "Write IOPS log",
4526 .type = FIO_OPT_STR,
4527 .off1 = offsetof(struct thread_options, iops_log_file),
4528 .cb = str_write_iops_log_cb,
4529 .help = "Write log of IOPS during run",
4530 .category = FIO_OPT_C_LOG,
4531 .group = FIO_OPT_G_INVALID,
4534 .name = "log_entries",
4535 .lname = "Log entries",
4536 .type = FIO_OPT_INT,
4537 .off1 = offsetof(struct thread_options, log_entries),
4538 .help = "Initial number of entries in a job IO log",
4539 .def = __fio_stringify(DEF_LOG_ENTRIES),
4540 .minval = DEF_LOG_ENTRIES,
4541 .maxval = MAX_LOG_ENTRIES,
4542 .category = FIO_OPT_C_LOG,
4543 .group = FIO_OPT_G_INVALID,
4546 .name = "log_avg_msec",
4547 .lname = "Log averaging (msec)",
4548 .type = FIO_OPT_INT,
4549 .off1 = offsetof(struct thread_options, log_avg_msec),
4550 .help = "Average bw/iops/lat logs over this period of time",
4552 .category = FIO_OPT_C_LOG,
4553 .group = FIO_OPT_G_INVALID,
4556 .name = "log_hist_msec",
4557 .lname = "Log histograms (msec)",
4558 .type = FIO_OPT_INT,
4559 .off1 = offsetof(struct thread_options, log_hist_msec),
4560 .help = "Dump completion latency histograms at frequency of this time value",
4562 .category = FIO_OPT_C_LOG,
4563 .group = FIO_OPT_G_INVALID,
4566 .name = "log_hist_coarseness",
4567 .lname = "Histogram logs coarseness",
4568 .type = FIO_OPT_INT,
4569 .off1 = offsetof(struct thread_options, log_hist_coarseness),
4570 .help = "Integer in range [0,6]. Higher coarseness outputs"
4571 " fewer histogram bins per sample. The number of bins for"
4572 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
4574 .category = FIO_OPT_C_LOG,
4575 .group = FIO_OPT_G_INVALID,
4578 .name = "write_hist_log",
4579 .lname = "Write latency histogram logs",
4580 .type = FIO_OPT_STR,
4581 .off1 = offsetof(struct thread_options, hist_log_file),
4582 .cb = str_write_hist_log_cb,
4583 .help = "Write log of latency histograms during run",
4584 .category = FIO_OPT_C_LOG,
4585 .group = FIO_OPT_G_INVALID,
4588 .name = "log_window_value",
4589 .alias = "log_max_value",
4590 .lname = "Log maximum, average or both values",
4591 .type = FIO_OPT_STR,
4592 .off1 = offsetof(struct thread_options, log_max),
4593 .help = "Log max, average or both sample in a window",
4595 .category = FIO_OPT_C_LOG,
4596 .group = FIO_OPT_G_INVALID,
4599 .oval = IO_LOG_SAMPLE_AVG,
4600 .help = "Log average value over the window",
4603 .oval = IO_LOG_SAMPLE_MAX,
4604 .help = "Log maximum value in the window",
4607 .oval = IO_LOG_SAMPLE_BOTH,
4608 .help = "Log both average and maximum values over the window"
4610 /* Compatibility with former boolean values */
4612 .oval = IO_LOG_SAMPLE_AVG,
4613 .help = "Alias for 'avg'",
4616 .oval = IO_LOG_SAMPLE_MAX,
4617 .help = "Alias for 'max'",
4622 .name = "log_offset",
4623 .lname = "Log offset of IO",
4624 .type = FIO_OPT_BOOL,
4625 .off1 = offsetof(struct thread_options, log_offset),
4626 .help = "Include offset of IO for each log entry",
4628 .category = FIO_OPT_C_LOG,
4629 .group = FIO_OPT_G_INVALID,
4633 .lname = "Log priority of IO",
4634 .type = FIO_OPT_BOOL,
4635 .off1 = offsetof(struct thread_options, log_prio),
4636 .help = "Include priority value of IO for each log entry",
4638 .category = FIO_OPT_C_LOG,
4639 .group = FIO_OPT_G_INVALID,
4643 .name = "log_compression",
4644 .lname = "Log compression",
4645 .type = FIO_OPT_INT,
4646 .off1 = offsetof(struct thread_options, log_gz),
4647 .help = "Log in compressed chunks of this size",
4649 .maxval = 512 * 1024 * 1024ULL,
4650 .category = FIO_OPT_C_LOG,
4651 .group = FIO_OPT_G_INVALID,
4653 #ifdef FIO_HAVE_CPU_AFFINITY
4655 .name = "log_compression_cpus",
4656 .lname = "Log Compression CPUs",
4657 .type = FIO_OPT_STR,
4658 .cb = str_log_cpus_allowed_cb,
4659 .off1 = offsetof(struct thread_options, log_gz_cpumask),
4660 .parent = "log_compression",
4661 .help = "Limit log compression to these CPUs",
4662 .category = FIO_OPT_C_LOG,
4663 .group = FIO_OPT_G_INVALID,
4667 .name = "log_compression_cpus",
4668 .lname = "Log Compression CPUs",
4669 .type = FIO_OPT_UNSUPPORTED,
4670 .help = "Your platform does not support CPU affinities",
4674 .name = "log_store_compressed",
4675 .lname = "Log store compressed",
4676 .type = FIO_OPT_BOOL,
4677 .off1 = offsetof(struct thread_options, log_gz_store),
4678 .help = "Store logs in a compressed format",
4679 .category = FIO_OPT_C_LOG,
4680 .group = FIO_OPT_G_INVALID,
4684 .name = "log_compression",
4685 .lname = "Log compression",
4686 .type = FIO_OPT_UNSUPPORTED,
4687 .help = "Install libz-dev(el) to get compression support",
4690 .name = "log_store_compressed",
4691 .lname = "Log store compressed",
4692 .type = FIO_OPT_UNSUPPORTED,
4693 .help = "Install libz-dev(el) to get compression support",
4697 .name = "log_alternate_epoch",
4698 .alias = "log_unix_epoch",
4699 .lname = "Log epoch alternate",
4700 .type = FIO_OPT_BOOL,
4701 .off1 = offsetof(struct thread_options, log_alternate_epoch),
4702 .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.",
4703 .category = FIO_OPT_C_LOG,
4704 .group = FIO_OPT_G_INVALID,
4707 .name = "log_alternate_epoch_clock_id",
4708 .lname = "Log alternate epoch clock_id",
4709 .type = FIO_OPT_INT,
4710 .off1 = offsetof(struct thread_options, log_alternate_epoch_clock_id),
4711 .help = "If log_alternate_epoch is true, this option specifies the clock_id from clock_gettime whose epoch should be used. If log_alternate_epoch is false, this option has no effect. Default value is 0, or CLOCK_REALTIME",
4712 .category = FIO_OPT_C_LOG,
4713 .group = FIO_OPT_G_INVALID,
4716 .name = "block_error_percentiles",
4717 .lname = "Block error percentiles",
4718 .type = FIO_OPT_BOOL,
4719 .off1 = offsetof(struct thread_options, block_error_hist),
4720 .help = "Record trim block errors and make a histogram",
4722 .category = FIO_OPT_C_LOG,
4723 .group = FIO_OPT_G_INVALID,
4726 .name = "bwavgtime",
4727 .lname = "Bandwidth average time",
4728 .type = FIO_OPT_INT,
4729 .off1 = offsetof(struct thread_options, bw_avg_time),
4730 .help = "Time window over which to calculate bandwidth"
4733 .parent = "write_bw_log",
4736 .category = FIO_OPT_C_LOG,
4737 .group = FIO_OPT_G_INVALID,
4740 .name = "iopsavgtime",
4741 .lname = "IOPS average time",
4742 .type = FIO_OPT_INT,
4743 .off1 = offsetof(struct thread_options, iops_avg_time),
4744 .help = "Time window over which to calculate IOPS (msec)",
4746 .parent = "write_iops_log",
4749 .category = FIO_OPT_C_LOG,
4750 .group = FIO_OPT_G_INVALID,
4753 .name = "group_reporting",
4754 .lname = "Group reporting",
4755 .type = FIO_OPT_STR_SET,
4756 .off1 = offsetof(struct thread_options, group_reporting),
4757 .help = "Do reporting on a per-group basis",
4758 .category = FIO_OPT_C_STAT,
4759 .group = FIO_OPT_G_INVALID,
4764 .type = FIO_OPT_BOOL,
4765 .off1 = offsetof(struct thread_options, stats),
4766 .help = "Enable collection of stats",
4768 .category = FIO_OPT_C_STAT,
4769 .group = FIO_OPT_G_INVALID,
4772 .name = "zero_buffers",
4773 .lname = "Zero I/O buffers",
4774 .type = FIO_OPT_STR_SET,
4775 .off1 = offsetof(struct thread_options, zero_buffers),
4776 .help = "Init IO buffers to all zeroes",
4777 .category = FIO_OPT_C_IO,
4778 .group = FIO_OPT_G_IO_BUF,
4781 .name = "refill_buffers",
4782 .lname = "Refill I/O buffers",
4783 .type = FIO_OPT_STR_SET,
4784 .off1 = offsetof(struct thread_options, refill_buffers),
4785 .help = "Refill IO buffers on every IO submit",
4786 .category = FIO_OPT_C_IO,
4787 .group = FIO_OPT_G_IO_BUF,
4790 .name = "scramble_buffers",
4791 .lname = "Scramble I/O buffers",
4792 .type = FIO_OPT_BOOL,
4793 .off1 = offsetof(struct thread_options, scramble_buffers),
4794 .help = "Slightly scramble buffers on every IO submit",
4796 .category = FIO_OPT_C_IO,
4797 .group = FIO_OPT_G_IO_BUF,
4800 .name = "buffer_pattern",
4801 .lname = "Buffer pattern",
4802 .type = FIO_OPT_STR,
4803 .cb = str_buffer_pattern_cb,
4804 .off1 = offsetof(struct thread_options, buffer_pattern),
4805 .help = "Fill pattern for IO buffers",
4806 .category = FIO_OPT_C_IO,
4807 .group = FIO_OPT_G_IO_BUF,
4810 .name = "buffer_compress_percentage",
4811 .lname = "Buffer compression percentage",
4812 .type = FIO_OPT_INT,
4813 .cb = str_buffer_compress_cb,
4814 .off1 = offsetof(struct thread_options, compress_percentage),
4817 .help = "How compressible the buffer is (approximately)",
4819 .category = FIO_OPT_C_IO,
4820 .group = FIO_OPT_G_IO_BUF,
4823 .name = "buffer_compress_chunk",
4824 .lname = "Buffer compression chunk size",
4825 .type = FIO_OPT_INT,
4826 .off1 = offsetof(struct thread_options, compress_chunk),
4827 .parent = "buffer_compress_percentage",
4829 .help = "Size of compressible region in buffer",
4832 .category = FIO_OPT_C_IO,
4833 .group = FIO_OPT_G_IO_BUF,
4836 .name = "dedupe_percentage",
4837 .lname = "Dedupe percentage",
4838 .type = FIO_OPT_INT,
4839 .cb = str_dedupe_cb,
4840 .off1 = offsetof(struct thread_options, dedupe_percentage),
4843 .help = "Percentage of buffers that are dedupable",
4845 .category = FIO_OPT_C_IO,
4846 .group = FIO_OPT_G_IO_BUF,
4849 .name = "dedupe_global",
4850 .lname = "Global deduplication",
4851 .type = FIO_OPT_BOOL,
4852 .off1 = offsetof(struct thread_options, dedupe_global),
4853 .help = "Share deduplication buffers across jobs",
4855 .category = FIO_OPT_C_IO,
4856 .group = FIO_OPT_G_IO_BUF,
4859 .name = "dedupe_mode",
4860 .lname = "Dedupe mode",
4861 .help = "Mode for the deduplication buffer generation",
4862 .type = FIO_OPT_STR,
4863 .off1 = offsetof(struct thread_options, dedupe_mode),
4864 .parent = "dedupe_percentage",
4866 .category = FIO_OPT_C_IO,
4867 .group = FIO_OPT_G_IO_BUF,
4870 .oval = DEDUPE_MODE_REPEAT,
4871 .help = "repeat previous page",
4873 { .ival = "working_set",
4874 .oval = DEDUPE_MODE_WORKING_SET,
4875 .help = "choose a page randomly from limited working set defined in dedupe_working_set_percentage",
4880 .name = "dedupe_working_set_percentage",
4881 .lname = "Dedupe working set percentage",
4882 .help = "Dedupe working set size in percentages from file or device size used to generate dedupe patterns from",
4883 .type = FIO_OPT_INT,
4884 .off1 = offsetof(struct thread_options, dedupe_working_set_percentage),
4885 .parent = "dedupe_percentage",
4889 .category = FIO_OPT_C_IO,
4890 .group = FIO_OPT_G_IO_BUF,
4893 .name = "clat_percentiles",
4894 .lname = "Completion latency percentiles",
4895 .type = FIO_OPT_BOOL,
4896 .off1 = offsetof(struct thread_options, clat_percentiles),
4897 .help = "Enable the reporting of completion latency percentiles",
4899 .category = FIO_OPT_C_STAT,
4900 .group = FIO_OPT_G_INVALID,
4903 .name = "lat_percentiles",
4904 .lname = "IO latency percentiles",
4905 .type = FIO_OPT_BOOL,
4906 .off1 = offsetof(struct thread_options, lat_percentiles),
4907 .help = "Enable the reporting of IO latency percentiles",
4909 .category = FIO_OPT_C_STAT,
4910 .group = FIO_OPT_G_INVALID,
4913 .name = "slat_percentiles",
4914 .lname = "Submission latency percentiles",
4915 .type = FIO_OPT_BOOL,
4916 .off1 = offsetof(struct thread_options, slat_percentiles),
4917 .help = "Enable the reporting of submission latency percentiles",
4919 .category = FIO_OPT_C_STAT,
4920 .group = FIO_OPT_G_INVALID,
4923 .name = "percentile_list",
4924 .lname = "Percentile list",
4925 .type = FIO_OPT_FLOAT_LIST,
4926 .off1 = offsetof(struct thread_options, percentile_list),
4927 .off2 = offsetof(struct thread_options, percentile_precision),
4928 .help = "Specify a custom list of percentiles to report for "
4929 "completion latency and block errors",
4930 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
4931 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4934 .category = FIO_OPT_C_STAT,
4935 .group = FIO_OPT_G_INVALID,
4938 .name = "significant_figures",
4939 .lname = "Significant figures",
4940 .type = FIO_OPT_INT,
4941 .off1 = offsetof(struct thread_options, sig_figs),
4944 .help = "Significant figures for output-format set to normal",
4947 .category = FIO_OPT_C_STAT,
4948 .group = FIO_OPT_G_INVALID,
4951 #ifdef FIO_HAVE_DISK_UTIL
4953 .name = "disk_util",
4954 .lname = "Disk utilization",
4955 .type = FIO_OPT_BOOL,
4956 .off1 = offsetof(struct thread_options, do_disk_util),
4957 .help = "Log disk utilization statistics",
4959 .category = FIO_OPT_C_STAT,
4960 .group = FIO_OPT_G_INVALID,
4964 .name = "disk_util",
4965 .lname = "Disk utilization",
4966 .type = FIO_OPT_UNSUPPORTED,
4967 .help = "Your platform does not support disk utilization",
4971 .name = "gtod_reduce",
4972 .lname = "Reduce gettimeofday() calls",
4973 .type = FIO_OPT_BOOL,
4974 .help = "Greatly reduce number of gettimeofday() calls",
4975 .cb = str_gtod_reduce_cb,
4978 .category = FIO_OPT_C_STAT,
4979 .group = FIO_OPT_G_INVALID,
4982 .name = "disable_lat",
4983 .lname = "Disable all latency stats",
4984 .type = FIO_OPT_BOOL,
4985 .off1 = offsetof(struct thread_options, disable_lat),
4986 .help = "Disable latency numbers",
4987 .parent = "gtod_reduce",
4990 .category = FIO_OPT_C_STAT,
4991 .group = FIO_OPT_G_INVALID,
4994 .name = "disable_clat",
4995 .lname = "Disable completion latency stats",
4996 .type = FIO_OPT_BOOL,
4997 .off1 = offsetof(struct thread_options, disable_clat),
4998 .help = "Disable completion latency numbers",
4999 .parent = "gtod_reduce",
5002 .category = FIO_OPT_C_STAT,
5003 .group = FIO_OPT_G_INVALID,
5006 .name = "disable_slat",
5007 .lname = "Disable submission latency stats",
5008 .type = FIO_OPT_BOOL,
5009 .off1 = offsetof(struct thread_options, disable_slat),
5010 .help = "Disable submission latency numbers",
5011 .parent = "gtod_reduce",
5014 .category = FIO_OPT_C_STAT,
5015 .group = FIO_OPT_G_INVALID,
5018 .name = "disable_bw_measurement",
5019 .alias = "disable_bw",
5020 .lname = "Disable bandwidth stats",
5021 .type = FIO_OPT_BOOL,
5022 .off1 = offsetof(struct thread_options, disable_bw),
5023 .help = "Disable bandwidth logging",
5024 .parent = "gtod_reduce",
5027 .category = FIO_OPT_C_STAT,
5028 .group = FIO_OPT_G_INVALID,
5032 .lname = "Dedicated gettimeofday() CPU",
5033 .type = FIO_OPT_INT,
5034 .off1 = offsetof(struct thread_options, gtod_cpu),
5035 .help = "Set up dedicated gettimeofday() thread on this CPU",
5036 .verify = gtod_cpu_verify,
5037 .category = FIO_OPT_C_GENERAL,
5038 .group = FIO_OPT_G_CLOCK,
5041 .name = "job_start_clock_id",
5042 .lname = "Job start clock_id",
5043 .type = FIO_OPT_INT,
5044 .off1 = offsetof(struct thread_options, job_start_clock_id),
5045 .help = "The clock_id passed to the call to clock_gettime used to record job_start in the json output format. Default is 0, or CLOCK_REALTIME",
5046 .verify = gtod_cpu_verify,
5047 .category = FIO_OPT_C_GENERAL,
5048 .group = FIO_OPT_G_CLOCK,
5051 .name = "unified_rw_reporting",
5052 .lname = "Unified RW Reporting",
5053 .type = FIO_OPT_STR,
5054 .off1 = offsetof(struct thread_options, unified_rw_rep),
5055 .help = "Unify reporting across data direction",
5057 .category = FIO_OPT_C_GENERAL,
5058 .group = FIO_OPT_G_INVALID,
5061 .oval = UNIFIED_SPLIT,
5062 .help = "Normal statistics reporting",
5065 .oval = UNIFIED_MIXED,
5066 .help = "Statistics are summed per data direction and reported together",
5069 .oval = UNIFIED_BOTH,
5070 .help = "Statistics are reported normally, followed by the mixed statistics"
5072 /* Compatibility with former boolean values */
5074 .oval = UNIFIED_SPLIT,
5075 .help = "Alias for 'none'",
5078 .oval = UNIFIED_MIXED,
5079 .help = "Alias for 'mixed'",
5082 .oval = UNIFIED_BOTH,
5083 .help = "Alias for 'both'",
5088 .name = "continue_on_error",
5089 .lname = "Continue on error",
5090 .type = FIO_OPT_STR,
5091 .off1 = offsetof(struct thread_options, continue_on_error),
5092 .help = "Continue on non-fatal errors during IO",
5094 .category = FIO_OPT_C_GENERAL,
5095 .group = FIO_OPT_G_ERR,
5098 .oval = ERROR_TYPE_NONE,
5099 .help = "Exit when an error is encountered",
5102 .oval = ERROR_TYPE_READ,
5103 .help = "Continue on read errors only",
5106 .oval = ERROR_TYPE_WRITE,
5107 .help = "Continue on write errors only",
5110 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
5111 .help = "Continue on any IO errors",
5114 .oval = ERROR_TYPE_VERIFY,
5115 .help = "Continue on verify errors only",
5118 .oval = ERROR_TYPE_ANY,
5119 .help = "Continue on all io and verify errors",
5122 .oval = ERROR_TYPE_NONE,
5123 .help = "Alias for 'none'",
5126 .oval = ERROR_TYPE_ANY,
5127 .help = "Alias for 'all'",
5132 .name = "ignore_error",
5133 .lname = "Ignore Error",
5134 .type = FIO_OPT_STR,
5135 .cb = str_ignore_error_cb,
5136 .off1 = offsetof(struct thread_options, ignore_error_nr),
5137 .help = "Set a specific list of errors to ignore",
5139 .category = FIO_OPT_C_GENERAL,
5140 .group = FIO_OPT_G_ERR,
5143 .name = "error_dump",
5144 .lname = "Error Dump",
5145 .type = FIO_OPT_BOOL,
5146 .off1 = offsetof(struct thread_options, error_dump),
5148 .help = "Dump info on each error",
5149 .category = FIO_OPT_C_GENERAL,
5150 .group = FIO_OPT_G_ERR,
5155 .type = FIO_OPT_STR_STORE,
5156 .off1 = offsetof(struct thread_options, profile),
5157 .help = "Select a specific builtin performance test",
5158 .category = FIO_OPT_C_PROFILE,
5159 .group = FIO_OPT_G_INVALID,
5164 .type = FIO_OPT_STR_STORE,
5165 .off1 = offsetof(struct thread_options, cgroup),
5166 .help = "Add job to cgroup of this name",
5167 .category = FIO_OPT_C_GENERAL,
5168 .group = FIO_OPT_G_CGROUP,
5171 .name = "cgroup_nodelete",
5172 .lname = "Cgroup no-delete",
5173 .type = FIO_OPT_BOOL,
5174 .off1 = offsetof(struct thread_options, cgroup_nodelete),
5175 .help = "Do not delete cgroups after job completion",
5178 .category = FIO_OPT_C_GENERAL,
5179 .group = FIO_OPT_G_CGROUP,
5182 .name = "cgroup_weight",
5183 .lname = "Cgroup weight",
5184 .type = FIO_OPT_INT,
5185 .off1 = offsetof(struct thread_options, cgroup_weight),
5186 .help = "Use given weight for cgroup",
5190 .category = FIO_OPT_C_GENERAL,
5191 .group = FIO_OPT_G_CGROUP,
5196 .type = FIO_OPT_INT,
5197 .off1 = offsetof(struct thread_options, uid),
5198 .help = "Run job with this user ID",
5199 .category = FIO_OPT_C_GENERAL,
5200 .group = FIO_OPT_G_CRED,
5204 .lname = "Group ID",
5205 .type = FIO_OPT_INT,
5206 .off1 = offsetof(struct thread_options, gid),
5207 .help = "Run job with this group ID",
5208 .category = FIO_OPT_C_GENERAL,
5209 .group = FIO_OPT_G_CRED,
5214 .type = FIO_OPT_STR,
5215 .off1 = offsetof(struct thread_options, kb_base),
5221 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
5225 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
5228 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
5229 .category = FIO_OPT_C_GENERAL,
5230 .group = FIO_OPT_G_INVALID,
5233 .name = "unit_base",
5234 .lname = "Unit for quantities of data (Bits or Bytes)",
5235 .type = FIO_OPT_STR,
5236 .off1 = offsetof(struct thread_options, unit_base),
5241 .help = "Auto-detect",
5244 .oval = N2S_BYTEPERSEC,
5245 .help = "Normal (byte based)",
5248 .oval = N2S_BITPERSEC,
5249 .help = "Bit based",
5252 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
5253 .category = FIO_OPT_C_GENERAL,
5254 .group = FIO_OPT_G_INVALID,
5257 .name = "hugepage-size",
5258 .lname = "Hugepage size",
5259 .type = FIO_OPT_INT,
5260 .off1 = offsetof(struct thread_options, hugepage_size),
5261 .help = "When using hugepages, specify size of each page",
5262 .def = __fio_stringify(FIO_HUGE_PAGE),
5263 .interval = 1024 * 1024,
5264 .category = FIO_OPT_C_GENERAL,
5265 .group = FIO_OPT_G_INVALID,
5269 .lname = "I/O flow ID",
5270 .type = FIO_OPT_INT,
5271 .off1 = offsetof(struct thread_options, flow_id),
5272 .help = "The flow index ID to use",
5274 .category = FIO_OPT_C_IO,
5275 .group = FIO_OPT_G_IO_FLOW,
5279 .lname = "I/O flow weight",
5280 .type = FIO_OPT_INT,
5281 .off1 = offsetof(struct thread_options, flow),
5282 .help = "Weight for flow control of this job",
5283 .parent = "flow_id",
5286 .maxval = FLOW_MAX_WEIGHT,
5287 .category = FIO_OPT_C_IO,
5288 .group = FIO_OPT_G_IO_FLOW,
5291 .name = "flow_watermark",
5292 .lname = "I/O flow watermark",
5293 .type = FIO_OPT_SOFT_DEPRECATED,
5294 .category = FIO_OPT_C_IO,
5295 .group = FIO_OPT_G_IO_FLOW,
5298 .name = "flow_sleep",
5299 .lname = "I/O flow sleep",
5300 .type = FIO_OPT_INT,
5301 .off1 = offsetof(struct thread_options, flow_sleep),
5302 .help = "How many microseconds to sleep after being held"
5303 " back by the flow control mechanism",
5304 .parent = "flow_id",
5307 .category = FIO_OPT_C_IO,
5308 .group = FIO_OPT_G_IO_FLOW,
5311 .name = "steadystate",
5312 .lname = "Steady state threshold",
5314 .type = FIO_OPT_STR,
5315 .off1 = offsetof(struct thread_options, ss_state),
5316 .cb = str_steadystate_cb,
5317 .help = "Define the criterion and limit to judge when a job has reached steady state",
5318 .def = "iops_slope:0.01%",
5321 .oval = FIO_SS_IOPS,
5322 .help = "maximum mean deviation of IOPS measurements",
5324 { .ival = "iops_slope",
5325 .oval = FIO_SS_IOPS_SLOPE,
5326 .help = "slope calculated from IOPS measurements",
5330 .help = "maximum mean deviation of bandwidth measurements",
5334 .oval = FIO_SS_BW_SLOPE,
5335 .help = "slope calculated from bandwidth measurements",
5338 .category = FIO_OPT_C_GENERAL,
5339 .group = FIO_OPT_G_RUNTIME,
5342 .name = "steadystate_duration",
5343 .lname = "Steady state duration",
5345 .parent = "steadystate",
5346 .type = FIO_OPT_STR_VAL_TIME,
5347 .off1 = offsetof(struct thread_options, ss_dur),
5348 .help = "Stop workload upon attaining steady state for specified duration",
5352 .category = FIO_OPT_C_GENERAL,
5353 .group = FIO_OPT_G_RUNTIME,
5356 .name = "steadystate_ramp_time",
5357 .lname = "Steady state ramp time",
5359 .parent = "steadystate",
5360 .type = FIO_OPT_STR_VAL_TIME,
5361 .off1 = offsetof(struct thread_options, ss_ramp_time),
5362 .help = "Delay before initiation of data collection for steady state job termination testing",
5366 .category = FIO_OPT_C_GENERAL,
5367 .group = FIO_OPT_G_RUNTIME,
5370 .name = "steadystate_check_interval",
5371 .lname = "Steady state check interval",
5372 .alias = "ss_interval",
5373 .parent = "steadystate",
5374 .type = FIO_OPT_STR_VAL_TIME,
5375 .off1 = offsetof(struct thread_options, ss_check_interval),
5376 .help = "Polling interval for the steady state check (too low means steadystate will not converge)",
5380 .category = FIO_OPT_C_GENERAL,
5381 .group = FIO_OPT_G_RUNTIME,
5388 static void add_to_lopt(struct option *lopt, struct fio_option *o,
5389 const char *name, int val)
5391 lopt->name = (char *) name;
5393 if (o->type == FIO_OPT_STR_SET)
5394 lopt->has_arg = optional_argument;
5396 lopt->has_arg = required_argument;
5399 static void options_to_lopts(struct fio_option *opts,
5400 struct option *long_options,
5401 int i, int option_type)
5403 struct fio_option *o = &opts[0];
5405 add_to_lopt(&long_options[i], o, o->name, option_type);
5408 add_to_lopt(&long_options[i], o, o->alias, option_type);
5413 assert(i < FIO_NR_OPTIONS);
5417 void fio_options_set_ioengine_opts(struct option *long_options,
5418 struct thread_data *td)
5423 while (long_options[i].name) {
5424 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
5425 memset(&long_options[i], 0, sizeof(*long_options));
5432 * Just clear out the prior ioengine options.
5437 options_to_lopts(td->io_ops->options, long_options, i,
5438 FIO_GETOPT_IOENGINE);
5441 void fio_options_dup_and_init(struct option *long_options)
5445 options_init(fio_options);
5448 while (long_options[i].name)
5451 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
5454 struct fio_keyword {
5460 static struct fio_keyword fio_keywords[] = {
5462 .word = "$pagesize",
5463 .desc = "Page size in the system",
5466 .word = "$mb_memory",
5467 .desc = "Megabytes of memory online",
5471 .desc = "Number of CPUs online in the system",
5478 void fio_keywords_exit(void)
5480 struct fio_keyword *kw;
5482 kw = &fio_keywords[0];
5490 void fio_keywords_init(void)
5492 unsigned long long mb_memory;
5496 sprintf(buf, "%lu", (unsigned long) page_size);
5497 fio_keywords[0].replace = strdup(buf);
5499 mb_memory = os_phys_mem() / (1024 * 1024);
5500 sprintf(buf, "%llu", mb_memory);
5501 fio_keywords[1].replace = strdup(buf);
5503 l = cpus_configured();
5504 sprintf(buf, "%lu", l);
5505 fio_keywords[2].replace = strdup(buf);
5510 static char *bc_calc(char *str)
5512 char buf[128], *tmp;
5517 * No math, just return string
5519 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
5520 !strchr(str, '/')) || strchr(str, '\''))
5524 * Split option from value, we only need to calculate the value
5526 tmp = strchr(str, '=');
5533 * Prevent buffer overflows; such a case isn't reasonable anyway
5535 if (strlen(str) >= 128 || strlen(tmp) > 100)
5538 sprintf(buf, "which %s > /dev/null", BC_APP);
5540 log_err("fio: bc is needed for performing math\n");
5544 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
5545 f = popen(buf, "r");
5549 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
5556 buf[(tmp - str) + ret - 1] = '\0';
5557 memcpy(buf, str, tmp - str);
5563 * Return a copy of the input string with substrings of the form ${VARNAME}
5564 * substituted with the value of the environment variable VARNAME. The
5565 * substitution always occurs, even if VARNAME is empty or the corresponding
5566 * environment variable undefined.
5568 char *fio_option_dup_subs(const char *opt)
5570 char out[OPT_LEN_MAX+1];
5571 char in[OPT_LEN_MAX+1];
5574 char *ch1, *ch2, *env;
5575 ssize_t nchr = OPT_LEN_MAX;
5578 if (strlen(opt) + 1 > OPT_LEN_MAX) {
5579 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
5583 snprintf(in, sizeof(in), "%s", opt);
5585 while (*inptr && nchr > 0) {
5586 if (inptr[0] == '$' && inptr[1] == '{') {
5587 ch2 = strchr(inptr, '}');
5588 if (ch2 && inptr+1 < ch2) {
5595 envlen = strlen(env);
5596 if (envlen <= nchr) {
5597 memcpy(outptr, env, envlen);
5607 *outptr++ = *inptr++;
5616 * Look for reserved variable names and replace them with real values
5618 static char *fio_keyword_replace(char *opt)
5624 for (i = 0; fio_keywords[i].word != NULL; i++) {
5625 struct fio_keyword *kw = &fio_keywords[i];
5627 while ((s = strstr(opt, kw->word)) != NULL) {
5628 char *new = calloc(strlen(opt) + 1, 1);
5634 * Copy part of the string before the keyword and
5635 * sprintf() the replacement after it.
5637 memcpy(new, opt, olen);
5638 len = sprintf(new + olen, "%s", kw->replace);
5641 * If there's more in the original string, copy that
5644 opt += olen + strlen(kw->word);
5645 /* keeps final zero thanks to calloc */
5647 memcpy(new + olen + len, opt, strlen(opt));
5650 * replace opt and free the old opt
5660 * Check for potential math and invoke bc, if possible
5668 static char **dup_and_sub_options(char **opts, int num_opts)
5671 char **opts_copy = malloc(num_opts * sizeof(*opts));
5672 for (i = 0; i < num_opts; i++) {
5673 opts_copy[i] = fio_option_dup_subs(opts[i]);
5676 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
5681 static void show_closest_option(const char *opt)
5683 int best_option, best_distance;
5692 while (name[i] != '\0' && name[i] != '=')
5697 best_distance = INT_MAX;
5699 while (fio_options[i].name) {
5700 distance = string_distance(name, fio_options[i].name);
5701 if (distance < best_distance) {
5702 best_distance = distance;
5708 if (best_option != -1 && string_distance_ok(name, best_distance) &&
5709 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
5710 log_err("Did you mean %s?\n", fio_options[best_option].name);
5715 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
5717 int i, ret, unknown;
5720 sort_options(opts, fio_options, num_opts);
5721 opts_copy = dup_and_sub_options(opts, num_opts);
5723 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
5724 const struct fio_option *o;
5725 int newret = parse_option(opts_copy[i], opts[i], fio_options,
5726 &o, &td->o, &td->opt_list);
5729 fio_option_mark_set(&td->o, o);
5737 opts_copy[i] = NULL;
5744 ret |= ioengine_load(td);
5746 sort_options(opts_copy, td->io_ops->options, num_opts);
5749 for (i = 0; i < num_opts; i++) {
5750 const struct fio_option *o = NULL;
5757 newret = parse_option(opts_copy[i], opts[i],
5758 td->io_ops->options, &o,
5759 td->eo, &td->opt_list);
5763 log_err("Bad option <%s>\n", opts[i]);
5764 show_closest_option(opts[i]);
5767 opts_copy[i] = NULL;
5775 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
5779 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
5781 const struct fio_option *o;
5783 o = find_option_c(fio_options, opt);
5785 fio_option_mark_set(&td->o, o);
5791 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
5794 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
5798 void fio_fill_default_options(struct thread_data *td)
5800 td->o.magic = OPT_MAGIC;
5801 fill_default_options(&td->o, fio_options);
5804 int fio_show_option_help(const char *opt)
5806 return show_cmd_help(fio_options, opt);
5810 * dupe FIO_OPT_STR_STORE options
5812 void fio_options_mem_dupe(struct thread_data *td)
5814 options_mem_dupe(fio_options, &td->o);
5816 if (td->eo && td->io_ops) {
5817 void *oldeo = td->eo;
5819 td->eo = malloc(td->io_ops->option_struct_size);
5820 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
5821 options_mem_dupe(td->io_ops->options, td->eo);
5825 unsigned int fio_get_kb_base(void *data)
5827 struct thread_data *td = cb_data_to_td(data);
5828 struct thread_options *o = &td->o;
5829 unsigned int kb_base = 0;
5832 * This is a hack... For private options, *data is not holding
5833 * a pointer to the thread_options, but to private data. This means
5834 * we can't safely dereference it, but magic is first so mem wise
5835 * it is valid. But this also means that if the job first sets
5836 * kb_base and expects that to be honored by private options,
5837 * it will be disappointed. We will return the global default
5840 if (o && o->magic == OPT_MAGIC)
5841 kb_base = o->kb_base;
5848 int add_option(const struct fio_option *o)
5850 struct fio_option *__o;
5859 if (opt_index + 1 == FIO_MAX_OPTS) {
5860 log_err("fio: FIO_MAX_OPTS is too small\n");
5864 memcpy(&fio_options[opt_index], o, sizeof(*o));
5865 fio_options[opt_index + 1].name = NULL;
5869 void invalidate_profile_options(const char *prof_name)
5871 struct fio_option *o;
5875 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5876 o->type = FIO_OPT_INVALID;
5877 o->prof_name = NULL;
5883 void add_opt_posval(const char *optname, const char *ival, const char *help)
5885 struct fio_option *o;
5888 o = find_option(fio_options, optname);
5892 for (i = 0; i < PARSE_MAX_VP; i++) {
5893 if (o->posval[i].ival)
5896 o->posval[i].ival = ival;
5897 o->posval[i].help = help;
5902 void del_opt_posval(const char *optname, const char *ival)
5904 struct fio_option *o;
5907 o = find_option(fio_options, optname);
5911 for (i = 0; i < PARSE_MAX_VP; i++) {
5912 if (!o->posval[i].ival)
5914 if (strcmp(o->posval[i].ival, ival))
5917 o->posval[i].ival = NULL;
5918 o->posval[i].help = NULL;
5922 void fio_options_free(struct thread_data *td)
5924 options_free(fio_options, &td->o);
5925 if (td->eo && td->io_ops && td->io_ops->options) {
5926 options_free(td->io_ops->options, td->eo);
5932 void fio_dump_options_free(struct thread_data *td)
5934 while (!flist_empty(&td->opt_list)) {
5935 struct print_option *p;
5937 p = flist_first_entry(&td->opt_list, struct print_option, list);
5938 flist_del_init(&p->list);
5945 struct fio_option *fio_option_find(const char *name)
5947 return find_option(fio_options, name);
5950 static struct fio_option *find_next_opt(struct fio_option *from,
5953 struct fio_option *opt;
5956 from = &fio_options[0];
5962 if (off1 == from->off1) {
5967 } while (from->name);
5972 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5974 unsigned int opt_off, index, offset;
5976 opt_off = opt - &fio_options[0];
5977 index = opt_off / (8 * sizeof(uint64_t));
5978 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5979 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
5982 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
5984 struct fio_option *opt, *next;
5987 while ((opt = find_next_opt(next, off1)) != NULL) {
5988 if (opt_is_set(o, opt))
5997 void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt)
5999 unsigned int opt_off, index, offset;
6001 opt_off = opt - &fio_options[0];
6002 index = opt_off / (8 * sizeof(uint64_t));
6003 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
6004 o->set_options[index] |= (uint64_t)1 << offset;