8 #include <netinet/in.h>
13 #include "lib/pattern.h"
17 char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
19 #define cb_data_to_td(data) container_of(data, struct thread_data, o)
21 static struct pattern_fmt_desc fmt_desc[] = {
24 .len = FIELD_SIZE(struct io_u *, offset),
25 .paste = paste_blockoff
30 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
32 static char *get_opt_postfix(const char *str)
34 char *p = strstr(str, ":");
40 strip_blank_front(&p);
45 static int bs_cmp(const void *p1, const void *p2)
47 const struct bssplit *bsp1 = p1;
48 const struct bssplit *bsp2 = p2;
50 return (int) bsp1->perc - (int) bsp2->perc;
55 unsigned int val1[ZONESPLIT_MAX];
56 unsigned long long val2[ZONESPLIT_MAX];
59 static int split_parse_ddir(struct thread_options *o, struct split *split,
60 enum fio_ddir ddir, char *str, bool absolute,
61 unsigned int max_splits)
63 unsigned long long perc;
71 while ((fname = strsep(&str, ":")) != NULL) {
77 perc_str = strstr(fname, "/");
82 if (str_to_decimal(perc_str, &val, 1, o, 0, 0)) {
83 log_err("fio: split conversion failed\n");
88 perc = atoi(perc_str);
101 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
102 log_err("fio: split conversion failed\n");
106 split->val1[i] = val;
107 split->val2[i] = perc;
109 if (i == max_splits) {
110 log_err("fio: hit max of %d split entries\n", i);
119 static int bssplit_ddir(struct thread_options *o, enum fio_ddir ddir, char *str,
122 unsigned int i, perc, perc_missing;
123 unsigned int max_bs, min_bs;
126 memset(&split, 0, sizeof(split));
128 if (split_parse_ddir(o, &split, ddir, str, data, BSSPLIT_MAX))
135 o->bssplit[ddir] = malloc(split.nr * sizeof(struct bssplit));
136 o->bssplit_nr[ddir] = split.nr;
137 for (i = 0; i < split.nr; i++) {
138 if (split.val1[i] > max_bs)
139 max_bs = split.val1[i];
140 if (split.val1[i] < min_bs)
141 min_bs = split.val1[i];
143 o->bssplit[ddir][i].bs = split.val1[i];
144 o->bssplit[ddir][i].perc =split.val2[i];
148 * Now check if the percentages add up, and how much is missing
150 perc = perc_missing = 0;
151 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
152 struct bssplit *bsp = &o->bssplit[ddir][i];
154 if (bsp->perc == -1U)
160 if (perc > 100 && perc_missing > 1) {
161 log_err("fio: bssplit percentages add to more than 100%%\n");
162 free(o->bssplit[ddir]);
163 o->bssplit[ddir] = NULL;
168 * If values didn't have a percentage set, divide the remains between
172 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
174 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
175 struct bssplit *bsp = &o->bssplit[ddir][i];
177 if (bsp->perc == -1U)
178 bsp->perc = (100 - perc) / perc_missing;
182 o->min_bs[ddir] = min_bs;
183 o->max_bs[ddir] = max_bs;
186 * now sort based on percentages, for ease of lookup
188 qsort(o->bssplit[ddir], o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
192 typedef int (split_parse_fn)(struct thread_options *, enum fio_ddir, char *, bool);
194 static int str_split_parse(struct thread_data *td, char *str,
195 split_parse_fn *fn, bool data)
200 odir = strchr(str, ',');
202 ddir = strchr(odir + 1, ',');
204 ret = fn(&td->o, DDIR_TRIM, ddir + 1, data);
210 op = strdup(odir + 1);
211 ret = fn(&td->o, DDIR_TRIM, op, data);
216 ret = fn(&td->o, DDIR_WRITE, odir + 1, data);
219 ret = fn(&td->o, DDIR_READ, str, data);
225 ret = fn(&td->o, DDIR_WRITE, op, data);
230 ret = fn(&td->o, DDIR_TRIM, op, data);
234 ret = fn(&td->o, DDIR_READ, str, data);
240 static int str_bssplit_cb(void *data, const char *input)
242 struct thread_data *td = cb_data_to_td(data);
246 p = str = strdup(input);
248 strip_blank_front(&str);
249 strip_blank_end(str);
251 ret = str_split_parse(td, str, bssplit_ddir, false);
253 if (parse_dryrun()) {
256 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
257 free(td->o.bssplit[i]);
258 td->o.bssplit[i] = NULL;
259 td->o.bssplit_nr[i] = 0;
267 static int str2error(char *str)
269 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
270 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
271 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
272 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
273 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
274 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
275 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
276 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
277 int i = 0, num = sizeof(err) / sizeof(char *);
280 if (!strcmp(err[i], str))
287 static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
294 if (etype >= ERROR_TYPE_CNT) {
295 log_err("Illegal error type\n");
299 td->o.ignore_error_nr[etype] = 4;
300 error = calloc(4, sizeof(int));
303 while ((fname = strsep(&str, ":")) != NULL) {
309 * grow struct buffer, if needed
311 if (i == td->o.ignore_error_nr[etype]) {
312 td->o.ignore_error_nr[etype] <<= 1;
313 error = realloc(error, td->o.ignore_error_nr[etype]
316 if (fname[0] == 'E') {
317 error[i] = str2error(fname);
319 error[i] = atoi(fname);
321 error[i] = -error[i];
324 log_err("Unknown error %s, please use number value\n",
326 td->o.ignore_error_nr[etype] = 0;
333 td->o.continue_on_error |= 1 << etype;
334 td->o.ignore_error_nr[etype] = i;
335 td->o.ignore_error[etype] = error;
337 td->o.ignore_error_nr[etype] = 0;
345 static int str_replay_skip_cb(void *data, const char *input)
347 struct thread_data *td = cb_data_to_td(data);
354 p = str = strdup(input);
356 strip_blank_front(&str);
357 strip_blank_end(str);
363 if (!strcmp(p, "read"))
364 td->o.replay_skip |= 1u << DDIR_READ;
365 else if (!strcmp(p, "write"))
366 td->o.replay_skip |= 1u << DDIR_WRITE;
367 else if (!strcmp(p, "trim"))
368 td->o.replay_skip |= 1u << DDIR_TRIM;
369 else if (!strcmp(p, "sync"))
370 td->o.replay_skip |= 1u << DDIR_SYNC;
372 log_err("Unknown skip type: %s\n", p);
382 static int str_ignore_error_cb(void *data, const char *input)
384 struct thread_data *td = cb_data_to_td(data);
387 enum error_type_bit type = 0;
392 p = str = strdup(input);
394 strip_blank_front(&str);
395 strip_blank_end(str);
401 ret = ignore_error_type(td, type, p);
411 static int str_rw_cb(void *data, const char *str)
413 struct thread_data *td = cb_data_to_td(data);
414 struct thread_options *o = &td->o;
423 nr = get_opt_postfix(str);
428 o->ddir_seq_nr = atoi(nr);
432 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
433 log_err("fio: rw postfix parsing failed\n");
438 o->ddir_seq_add = val;
445 static int str_mem_cb(void *data, const char *mem)
447 struct thread_data *td = cb_data_to_td(data);
449 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
450 td->o.mem_type == MEM_MMAPSHARED)
451 td->o.mmapfile = get_opt_postfix(mem);
456 static int fio_clock_source_cb(void *data, const char *str)
458 struct thread_data *td = cb_data_to_td(data);
460 fio_clock_source = td->o.clocksource;
461 fio_clock_source_set = 1;
466 static int str_rwmix_read_cb(void *data, unsigned long long *val)
468 struct thread_data *td = cb_data_to_td(data);
470 td->o.rwmix[DDIR_READ] = *val;
471 td->o.rwmix[DDIR_WRITE] = 100 - *val;
475 static int str_rwmix_write_cb(void *data, unsigned long long *val)
477 struct thread_data *td = cb_data_to_td(data);
479 td->o.rwmix[DDIR_WRITE] = *val;
480 td->o.rwmix[DDIR_READ] = 100 - *val;
484 static int str_exitall_cb(void)
486 exitall_on_terminate = 1;
490 #ifdef FIO_HAVE_CPU_AFFINITY
491 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
493 unsigned int i, index, cpus_in_mask;
494 const long max_cpu = cpus_online();
496 cpus_in_mask = fio_cpu_count(mask);
497 cpu_index = cpu_index % cpus_in_mask;
500 for (i = 0; i < max_cpu; i++) {
501 if (!fio_cpu_isset(mask, i))
504 if (cpu_index != index)
505 fio_cpu_clear(mask, i);
510 return fio_cpu_count(mask);
513 static int str_cpumask_cb(void *data, unsigned long long *val)
515 struct thread_data *td = cb_data_to_td(data);
523 ret = fio_cpuset_init(&td->o.cpumask);
525 log_err("fio: cpuset_init failed\n");
526 td_verror(td, ret, "fio_cpuset_init");
530 max_cpu = cpus_online();
532 for (i = 0; i < sizeof(int) * 8; i++) {
533 if ((1 << i) & *val) {
535 log_err("fio: CPU %d too large (max=%ld)\n", i,
539 dprint(FD_PARSE, "set cpu allowed %d\n", i);
540 fio_cpu_set(&td->o.cpumask, i);
547 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
554 ret = fio_cpuset_init(mask);
556 log_err("fio: cpuset_init failed\n");
557 td_verror(td, ret, "fio_cpuset_init");
561 p = str = strdup(input);
563 strip_blank_front(&str);
564 strip_blank_end(str);
566 max_cpu = cpus_online();
568 while ((cpu = strsep(&str, ",")) != NULL) {
577 while ((cpu2 = strsep(&str2, "-")) != NULL) {
587 while (icpu <= icpu2) {
588 if (icpu >= FIO_MAX_CPUS) {
589 log_err("fio: your OS only supports up to"
590 " %d CPUs\n", (int) FIO_MAX_CPUS);
594 if (icpu >= max_cpu) {
595 log_err("fio: CPU %d too large (max=%ld)\n",
601 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
602 fio_cpu_set(mask, icpu);
613 static int str_cpus_allowed_cb(void *data, const char *input)
615 struct thread_data *td = cb_data_to_td(data);
620 return set_cpus_allowed(td, &td->o.cpumask, input);
623 static int str_verify_cpus_allowed_cb(void *data, const char *input)
625 struct thread_data *td = cb_data_to_td(data);
630 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
634 static int str_log_cpus_allowed_cb(void *data, const char *input)
636 struct thread_data *td = cb_data_to_td(data);
641 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
643 #endif /* CONFIG_ZLIB */
645 #endif /* FIO_HAVE_CPU_AFFINITY */
647 #ifdef CONFIG_LIBNUMA
648 static int str_numa_cpunodes_cb(void *data, char *input)
650 struct thread_data *td = cb_data_to_td(data);
651 struct bitmask *verify_bitmask;
656 /* numa_parse_nodestring() parses a character string list
657 * of nodes into a bit mask. The bit mask is allocated by
658 * numa_allocate_nodemask(), so it should be freed by
659 * numa_free_nodemask().
661 verify_bitmask = numa_parse_nodestring(input);
662 if (verify_bitmask == NULL) {
663 log_err("fio: numa_parse_nodestring failed\n");
664 td_verror(td, 1, "str_numa_cpunodes_cb");
667 numa_free_nodemask(verify_bitmask);
669 td->o.numa_cpunodes = strdup(input);
673 static int str_numa_mpol_cb(void *data, char *input)
675 struct thread_data *td = cb_data_to_td(data);
676 const char * const policy_types[] =
677 { "default", "prefer", "bind", "interleave", "local", NULL };
680 struct bitmask *verify_bitmask;
685 nodelist = strchr(input, ':');
687 /* NUL-terminate mode */
691 for (i = 0; i <= MPOL_LOCAL; i++) {
692 if (!strcmp(input, policy_types[i])) {
693 td->o.numa_mem_mode = i;
697 if (i > MPOL_LOCAL) {
698 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
702 switch (td->o.numa_mem_mode) {
705 * Insist on a nodelist of one node only
708 char *rest = nodelist;
709 while (isdigit(*rest))
712 log_err("fio: one node only for \'prefer\'\n");
716 log_err("fio: one node is needed for \'prefer\'\n");
720 case MPOL_INTERLEAVE:
722 * Default to online nodes with memory if no nodelist
725 nodelist = strdup("all");
730 * Don't allow a nodelist
733 log_err("fio: NO nodelist for \'local\'\n");
739 * Insist on a nodelist
742 log_err("fio: a nodelist is needed for \'bind\'\n");
749 /* numa_parse_nodestring() parses a character string list
750 * of nodes into a bit mask. The bit mask is allocated by
751 * numa_allocate_nodemask(), so it should be freed by
752 * numa_free_nodemask().
754 switch (td->o.numa_mem_mode) {
756 td->o.numa_mem_prefer_node = atoi(nodelist);
758 case MPOL_INTERLEAVE:
760 verify_bitmask = numa_parse_nodestring(nodelist);
761 if (verify_bitmask == NULL) {
762 log_err("fio: numa_parse_nodestring failed\n");
763 td_verror(td, 1, "str_numa_memnodes_cb");
766 td->o.numa_memnodes = strdup(nodelist);
767 numa_free_nodemask(verify_bitmask);
782 static int str_fst_cb(void *data, const char *str)
784 struct thread_data *td = cb_data_to_td(data);
789 td->file_service_nr = 1;
791 switch (td->o.file_service_type) {
792 case FIO_FSERVICE_RANDOM:
793 case FIO_FSERVICE_RR:
794 case FIO_FSERVICE_SEQ:
795 nr = get_opt_postfix(str);
797 td->file_service_nr = atoi(nr);
802 case FIO_FSERVICE_ZIPF:
805 case FIO_FSERVICE_PARETO:
806 val = FIO_DEF_PARETO;
808 case FIO_FSERVICE_GAUSS:
812 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
819 nr = get_opt_postfix(str);
820 if (nr && !str_to_float(nr, &val, 0)) {
821 log_err("fio: file service type random postfix parsing failed\n");
828 switch (td->o.file_service_type) {
829 case FIO_FSERVICE_ZIPF:
831 log_err("fio: zipf theta must be different than 1.0\n");
836 td->zipf_theta = val;
838 case FIO_FSERVICE_PARETO:
839 if (val <= 0.00 || val >= 1.00) {
840 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
847 case FIO_FSERVICE_GAUSS:
848 if (val < 0.00 || val >= 100.00) {
849 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
861 #ifdef CONFIG_SYNC_FILE_RANGE
862 static int str_sfr_cb(void *data, const char *str)
864 struct thread_data *td = cb_data_to_td(data);
865 char *nr = get_opt_postfix(str);
867 td->sync_file_range_nr = 1;
869 td->sync_file_range_nr = atoi(nr);
877 static int zone_split_ddir(struct thread_options *o, enum fio_ddir ddir,
878 char *str, bool absolute)
880 unsigned int i, perc, perc_missing, sperc, sperc_missing;
883 memset(&split, 0, sizeof(split));
885 if (split_parse_ddir(o, &split, ddir, str, absolute, ZONESPLIT_MAX))
890 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
891 o->zone_split_nr[ddir] = split.nr;
892 for (i = 0; i < split.nr; i++) {
893 o->zone_split[ddir][i].access_perc = split.val1[i];
895 o->zone_split[ddir][i].size = split.val2[i];
897 o->zone_split[ddir][i].size_perc = split.val2[i];
901 * Now check if the percentages add up, and how much is missing
903 perc = perc_missing = 0;
904 sperc = sperc_missing = 0;
905 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
906 struct zone_split *zsp = &o->zone_split[ddir][i];
908 if (zsp->access_perc == (uint8_t) -1U)
911 perc += zsp->access_perc;
914 if (zsp->size_perc == (uint8_t) -1U)
917 sperc += zsp->size_perc;
921 if (perc > 100 || sperc > 100) {
922 log_err("fio: zone_split percentages add to more than 100%%\n");
923 free(o->zone_split[ddir]);
924 o->zone_split[ddir] = NULL;
928 log_err("fio: access percentage don't add up to 100 for zoned "
929 "random distribution (got=%u)\n", perc);
930 free(o->zone_split[ddir]);
931 o->zone_split[ddir] = NULL;
936 * If values didn't have a percentage set, divide the remains between
940 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
942 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
943 struct zone_split *zsp = &o->zone_split[ddir][i];
945 if (zsp->access_perc == (uint8_t) -1U)
946 zsp->access_perc = (100 - perc) / perc_missing;
950 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
952 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
953 struct zone_split *zsp = &o->zone_split[ddir][i];
955 if (zsp->size_perc == (uint8_t) -1U)
956 zsp->size_perc = (100 - sperc) / sperc_missing;
963 static void __td_zone_gen_index(struct thread_data *td, enum fio_ddir ddir)
965 unsigned int i, j, sprev, aprev;
968 td->zone_state_index[ddir] = malloc(sizeof(struct zone_split_index) * 100);
970 sprev_sz = sprev = aprev = 0;
971 for (i = 0; i < td->o.zone_split_nr[ddir]; i++) {
972 struct zone_split *zsp = &td->o.zone_split[ddir][i];
974 for (j = aprev; j < aprev + zsp->access_perc; j++) {
975 struct zone_split_index *zsi = &td->zone_state_index[ddir][j];
977 zsi->size_perc = sprev + zsp->size_perc;
978 zsi->size_perc_prev = sprev;
980 zsi->size = sprev_sz + zsp->size;
981 zsi->size_prev = sprev_sz;
984 aprev += zsp->access_perc;
985 sprev += zsp->size_perc;
986 sprev_sz += zsp->size;
991 * Generate state table for indexes, so we don't have to do it inline from
994 static void td_zone_gen_index(struct thread_data *td)
998 td->zone_state_index = malloc(DDIR_RWDIR_CNT *
999 sizeof(struct zone_split_index *));
1001 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1002 __td_zone_gen_index(td, i);
1005 static int parse_zoned_distribution(struct thread_data *td, const char *input,
1008 const char *pre = absolute ? "zoned_abs:" : "zoned:";
1012 p = str = strdup(input);
1014 strip_blank_front(&str);
1015 strip_blank_end(str);
1017 /* We expect it to start like that, bail if not */
1018 if (strncmp(str, pre, strlen(pre))) {
1019 log_err("fio: mismatch in zoned input <%s>\n", str);
1025 ret = str_split_parse(td, str, zone_split_ddir, absolute);
1029 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1032 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
1034 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
1035 struct zone_split *zsp = &td->o.zone_split[i][j];
1038 dprint(FD_PARSE, "\t%d: %u/%llu\n", j,
1040 (unsigned long long) zsp->size);
1042 dprint(FD_PARSE, "\t%d: %u/%u\n", j,
1049 if (parse_dryrun()) {
1052 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1053 free(td->o.zone_split[i]);
1054 td->o.zone_split[i] = NULL;
1055 td->o.zone_split_nr[i] = 0;
1062 td_zone_gen_index(td);
1064 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1065 td->o.zone_split_nr[i] = 0;
1071 static int str_random_distribution_cb(void *data, const char *str)
1073 struct thread_data *td = cb_data_to_td(data);
1077 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1079 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1080 val = FIO_DEF_PARETO;
1081 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1083 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1084 return parse_zoned_distribution(td, str, false);
1085 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED_ABS)
1086 return parse_zoned_distribution(td, str, true);
1090 nr = get_opt_postfix(str);
1091 if (nr && !str_to_float(nr, &val, 0)) {
1092 log_err("fio: random postfix parsing failed\n");
1099 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1101 log_err("fio: zipf theta must different than 1.0\n");
1106 td->o.zipf_theta.u.f = val;
1107 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1108 if (val <= 0.00 || val >= 1.00) {
1109 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1114 td->o.pareto_h.u.f = val;
1116 if (val < 0.00 || val >= 100.0) {
1117 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1122 td->o.gauss_dev.u.f = val;
1128 static int str_steadystate_cb(void *data, const char *str)
1130 struct thread_data *td = cb_data_to_td(data);
1136 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1137 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
1138 /* should be impossible to get here */
1139 log_err("fio: unknown steady state criterion\n");
1143 nr = get_opt_postfix(str);
1145 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1150 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1151 pct = strstr(nr, "%");
1154 strip_blank_end(nr);
1155 if (!str_to_float(nr, &val, 0)) {
1156 log_err("fio: could not parse steadystate threshold percentage\n");
1161 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1166 td->o.ss_state |= FIO_SS_PCT;
1167 td->o.ss_limit.u.f = val;
1168 } else if (td->o.ss_state & FIO_SS_IOPS) {
1169 if (!str_to_float(nr, &val, 0)) {
1170 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1175 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1180 td->o.ss_limit.u.f = val;
1181 } else { /* bandwidth criterion */
1182 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1183 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1188 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1193 td->o.ss_limit.u.f = (double) ll;
1196 td->ss.state = td->o.ss_state;
1201 * Return next name in the string. Files are separated with ':'. If the ':'
1202 * is escaped with a '\', then that ':' is part of the filename and does not
1203 * indicate a new file.
1205 static char *get_next_name(char **ptr)
1210 if (!str || !strlen(str))
1216 * No colon, we are done
1218 p = strchr(str, ':');
1225 * We got a colon, but it's the first character. Skip and
1233 if (*(p - 1) != '\\') {
1239 memmove(p - 1, p, strlen(p) + 1);
1247 static int get_max_name_idx(char *input)
1249 unsigned int cur_idx;
1252 p = str = strdup(input);
1253 for (cur_idx = 0; ; cur_idx++)
1254 if (get_next_name(&str) == NULL)
1262 * Returns the directory at the index, indexes > entires will be
1263 * assigned via modulo division of the index
1265 int set_name_idx(char *target, size_t tlen, char *input, int index,
1266 bool unique_filename)
1268 unsigned int cur_idx;
1270 char *fname, *str, *p;
1272 p = str = strdup(input);
1274 index %= get_max_name_idx(input);
1275 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1276 fname = get_next_name(&str);
1278 if (client_sockaddr_str[0] && unique_filename) {
1279 len = snprintf(target, tlen, "%s/%s.", fname,
1280 client_sockaddr_str);
1282 len = snprintf(target, tlen, "%s/", fname);
1284 target[tlen - 1] = '\0';
1290 static int str_filename_cb(void *data, const char *input)
1292 struct thread_data *td = cb_data_to_td(data);
1293 char *fname, *str, *p;
1295 p = str = strdup(input);
1297 strip_blank_front(&str);
1298 strip_blank_end(str);
1301 * Ignore what we may already have from nrfiles option.
1303 if (!td->files_index)
1306 while ((fname = get_next_name(&str)) != NULL) {
1309 add_file(td, fname, 0, 1);
1316 static int str_directory_cb(void *data, const char fio_unused *unused)
1318 struct thread_data *td = cb_data_to_td(data);
1320 char *dirname, *str, *p;
1326 p = str = strdup(td->o.directory);
1327 while ((dirname = get_next_name(&str)) != NULL) {
1328 if (lstat(dirname, &sb) < 0) {
1331 log_err("fio: %s is not a directory\n", dirname);
1332 td_verror(td, ret, "lstat");
1335 if (!S_ISDIR(sb.st_mode)) {
1336 log_err("fio: %s is not a directory\n", dirname);
1347 static int str_opendir_cb(void *data, const char fio_unused *str)
1349 struct thread_data *td = cb_data_to_td(data);
1354 if (!td->files_index)
1357 return add_dir_files(td, td->o.opendir);
1360 static int str_buffer_pattern_cb(void *data, const char *input)
1362 struct thread_data *td = cb_data_to_td(data);
1365 /* FIXME: for now buffer pattern does not support formats */
1366 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
1367 MAX_PATTERN_SIZE, NULL, 0, NULL, NULL);
1372 td->o.buffer_pattern_bytes = ret;
1375 * If this job is doing any reading or has compression set,
1376 * ensure that we refill buffers for writes or we could be
1377 * invalidating the pattern through reads.
1379 if (!td->o.compress_percentage && !td_read(td))
1380 td->o.refill_buffers = 0;
1382 td->o.refill_buffers = 1;
1384 td->o.scramble_buffers = 0;
1385 td->o.zero_buffers = 0;
1390 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1392 struct thread_data *td = cb_data_to_td(data);
1394 td->flags |= TD_F_COMPRESS;
1395 td->o.compress_percentage = *il;
1399 static int str_dedupe_cb(void *data, unsigned long long *il)
1401 struct thread_data *td = cb_data_to_td(data);
1403 td->flags |= TD_F_COMPRESS;
1404 td->o.dedupe_percentage = *il;
1405 td->o.refill_buffers = 1;
1409 static int str_verify_pattern_cb(void *data, const char *input)
1411 struct thread_data *td = cb_data_to_td(data);
1414 td->o.verify_fmt_sz = ARRAY_SIZE(td->o.verify_fmt);
1415 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
1416 MAX_PATTERN_SIZE, fmt_desc, sizeof(fmt_desc),
1417 td->o.verify_fmt, &td->o.verify_fmt_sz);
1422 td->o.verify_pattern_bytes = ret;
1424 * VERIFY_* could already be set
1426 if (!fio_option_is_set(&td->o, verify))
1427 td->o.verify = VERIFY_PATTERN;
1432 static int str_gtod_reduce_cb(void *data, int *il)
1434 struct thread_data *td = cb_data_to_td(data);
1437 td->o.disable_lat = !!val;
1438 td->o.disable_clat = !!val;
1439 td->o.disable_slat = !!val;
1440 td->o.disable_bw = !!val;
1441 td->o.clat_percentiles = !val;
1443 td->ts_cache_mask = 63;
1448 static int str_offset_cb(void *data, unsigned long long *__val)
1450 struct thread_data *td = cb_data_to_td(data);
1451 unsigned long long v = *__val;
1453 if (parse_is_percent(v)) {
1454 td->o.start_offset = 0;
1455 td->o.start_offset_percent = -1ULL - v;
1456 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1457 td->o.start_offset_percent);
1459 td->o.start_offset = v;
1464 static int str_size_cb(void *data, unsigned long long *__val)
1466 struct thread_data *td = cb_data_to_td(data);
1467 unsigned long long v = *__val;
1469 if (parse_is_percent(v)) {
1471 td->o.size_percent = -1ULL - v;
1472 dprint(FD_PARSE, "SET size_percent %d\n",
1473 td->o.size_percent);
1480 static int str_write_bw_log_cb(void *data, const char *str)
1482 struct thread_data *td = cb_data_to_td(data);
1485 td->o.bw_log_file = strdup(str);
1487 td->o.write_bw_log = 1;
1491 static int str_write_lat_log_cb(void *data, const char *str)
1493 struct thread_data *td = cb_data_to_td(data);
1496 td->o.lat_log_file = strdup(str);
1498 td->o.write_lat_log = 1;
1502 static int str_write_iops_log_cb(void *data, const char *str)
1504 struct thread_data *td = cb_data_to_td(data);
1507 td->o.iops_log_file = strdup(str);
1509 td->o.write_iops_log = 1;
1513 static int str_write_hist_log_cb(void *data, const char *str)
1515 struct thread_data *td = cb_data_to_td(data);
1518 td->o.hist_log_file = strdup(str);
1520 td->o.write_hist_log = 1;
1525 * str is supposed to be a substring of the strdup'd original string,
1526 * and is valid only if it's a regular file path.
1527 * This function keeps the pointer to the path as needed later.
1529 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1530 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1531 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1533 static int str_ioengine_external_cb(void *data, const char *str)
1535 struct thread_data *td = cb_data_to_td(data);
1540 log_err("fio: null external ioengine path\n");
1544 p = (char *)str; /* str is mutable */
1545 strip_blank_front(&p);
1548 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1549 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1553 td->o.ioengine_so_path = p;
1557 static int rw_verify(const struct fio_option *o, void *data)
1559 struct thread_data *td = cb_data_to_td(data);
1561 if (read_only && td_write(td)) {
1562 log_err("fio: job <%s> has write bit set, but fio is in"
1563 " read-only mode\n", td->o.name);
1570 static int gtod_cpu_verify(const struct fio_option *o, void *data)
1572 #ifndef FIO_HAVE_CPU_AFFINITY
1573 struct thread_data *td = cb_data_to_td(data);
1575 if (td->o.gtod_cpu) {
1576 log_err("fio: platform must support CPU affinity for"
1577 "gettimeofday() offloading\n");
1586 * Map of job/command line options
1588 struct fio_option fio_options[FIO_MAX_OPTS] = {
1590 .name = "description",
1591 .lname = "Description of job",
1592 .type = FIO_OPT_STR_STORE,
1593 .off1 = offsetof(struct thread_options, description),
1594 .help = "Text job description",
1595 .category = FIO_OPT_C_GENERAL,
1596 .group = FIO_OPT_G_DESC,
1600 .lname = "Job name",
1601 .type = FIO_OPT_STR_STORE,
1602 .off1 = offsetof(struct thread_options, name),
1603 .help = "Name of this job",
1604 .category = FIO_OPT_C_GENERAL,
1605 .group = FIO_OPT_G_DESC,
1609 .lname = "Waitee name",
1610 .type = FIO_OPT_STR_STORE,
1611 .off1 = offsetof(struct thread_options, wait_for),
1612 .help = "Name of the job this one wants to wait for before starting",
1613 .category = FIO_OPT_C_GENERAL,
1614 .group = FIO_OPT_G_DESC,
1618 .lname = "Filename(s)",
1619 .type = FIO_OPT_STR_STORE,
1620 .off1 = offsetof(struct thread_options, filename),
1621 .cb = str_filename_cb,
1622 .prio = -1, /* must come after "directory" */
1623 .help = "File(s) to use for the workload",
1624 .category = FIO_OPT_C_FILE,
1625 .group = FIO_OPT_G_FILENAME,
1628 .name = "directory",
1629 .lname = "Directory",
1630 .type = FIO_OPT_STR_STORE,
1631 .off1 = offsetof(struct thread_options, directory),
1632 .cb = str_directory_cb,
1633 .help = "Directory to store files in",
1634 .category = FIO_OPT_C_FILE,
1635 .group = FIO_OPT_G_FILENAME,
1638 .name = "filename_format",
1639 .lname = "Filename Format",
1640 .type = FIO_OPT_STR_STORE,
1641 .off1 = offsetof(struct thread_options, filename_format),
1642 .prio = -1, /* must come after "directory" */
1643 .help = "Override default $jobname.$jobnum.$filenum naming",
1644 .def = "$jobname.$jobnum.$filenum",
1645 .category = FIO_OPT_C_FILE,
1646 .group = FIO_OPT_G_FILENAME,
1649 .name = "unique_filename",
1650 .lname = "Unique Filename",
1651 .type = FIO_OPT_BOOL,
1652 .off1 = offsetof(struct thread_options, unique_filename),
1653 .help = "For network clients, prefix file with source IP",
1655 .category = FIO_OPT_C_FILE,
1656 .group = FIO_OPT_G_FILENAME,
1660 .lname = "Lockfile",
1661 .type = FIO_OPT_STR,
1662 .off1 = offsetof(struct thread_options, file_lock_mode),
1663 .help = "Lock file when doing IO to it",
1665 .parent = "filename",
1668 .category = FIO_OPT_C_FILE,
1669 .group = FIO_OPT_G_FILENAME,
1672 .oval = FILE_LOCK_NONE,
1673 .help = "No file locking",
1675 { .ival = "exclusive",
1676 .oval = FILE_LOCK_EXCLUSIVE,
1677 .help = "Exclusive file lock",
1680 .ival = "readwrite",
1681 .oval = FILE_LOCK_READWRITE,
1682 .help = "Read vs write lock",
1688 .lname = "Open directory",
1689 .type = FIO_OPT_STR_STORE,
1690 .off1 = offsetof(struct thread_options, opendir),
1691 .cb = str_opendir_cb,
1692 .help = "Recursively add files from this directory and down",
1693 .category = FIO_OPT_C_FILE,
1694 .group = FIO_OPT_G_FILENAME,
1698 .lname = "Read/write",
1699 .alias = "readwrite",
1700 .type = FIO_OPT_STR,
1702 .off1 = offsetof(struct thread_options, td_ddir),
1703 .help = "IO direction",
1705 .verify = rw_verify,
1706 .category = FIO_OPT_C_IO,
1707 .group = FIO_OPT_G_IO_BASIC,
1710 .oval = TD_DDIR_READ,
1711 .help = "Sequential read",
1714 .oval = TD_DDIR_WRITE,
1715 .help = "Sequential write",
1718 .oval = TD_DDIR_TRIM,
1719 .help = "Sequential trim",
1721 { .ival = "randread",
1722 .oval = TD_DDIR_RANDREAD,
1723 .help = "Random read",
1725 { .ival = "randwrite",
1726 .oval = TD_DDIR_RANDWRITE,
1727 .help = "Random write",
1729 { .ival = "randtrim",
1730 .oval = TD_DDIR_RANDTRIM,
1731 .help = "Random trim",
1735 .help = "Sequential read and write mix",
1737 { .ival = "readwrite",
1739 .help = "Sequential read and write mix",
1742 .oval = TD_DDIR_RANDRW,
1743 .help = "Random read and write mix"
1745 { .ival = "trimwrite",
1746 .oval = TD_DDIR_TRIMWRITE,
1747 .help = "Trim and write mix, trims preceding writes"
1752 .name = "rw_sequencer",
1753 .lname = "RW Sequencer",
1754 .type = FIO_OPT_STR,
1755 .off1 = offsetof(struct thread_options, rw_seq),
1756 .help = "IO offset generator modifier",
1757 .def = "sequential",
1758 .category = FIO_OPT_C_IO,
1759 .group = FIO_OPT_G_IO_BASIC,
1761 { .ival = "sequential",
1763 .help = "Generate sequential offsets",
1765 { .ival = "identical",
1766 .oval = RW_SEQ_IDENT,
1767 .help = "Generate identical offsets",
1774 .lname = "IO Engine",
1775 .type = FIO_OPT_STR_STORE,
1776 .off1 = offsetof(struct thread_options, ioengine),
1777 .help = "IO engine to use",
1778 .def = FIO_PREFERRED_ENGINE,
1779 .category = FIO_OPT_C_IO,
1780 .group = FIO_OPT_G_IO_BASIC,
1783 .help = "Use read/write",
1786 .help = "Use pread/pwrite",
1789 .help = "Use readv/writev",
1791 #ifdef CONFIG_PWRITEV
1793 .help = "Use preadv/pwritev",
1796 #ifdef FIO_HAVE_PWRITEV2
1797 { .ival = "pvsync2",
1798 .help = "Use preadv2/pwritev2",
1801 #ifdef CONFIG_LIBAIO
1803 .help = "Linux native asynchronous IO",
1806 #ifdef CONFIG_POSIXAIO
1807 { .ival = "posixaio",
1808 .help = "POSIX asynchronous IO",
1811 #ifdef CONFIG_SOLARISAIO
1812 { .ival = "solarisaio",
1813 .help = "Solaris native asynchronous IO",
1816 #ifdef CONFIG_WINDOWSAIO
1817 { .ival = "windowsaio",
1818 .help = "Windows native asynchronous IO"
1823 .help = "Rados Block Device asynchronous IO"
1827 .help = "Memory mapped IO"
1829 #ifdef CONFIG_LINUX_SPLICE
1831 .help = "splice/vmsplice based IO",
1833 { .ival = "netsplice",
1834 .help = "splice/vmsplice to/from the network",
1837 #ifdef FIO_HAVE_SGIO
1839 .help = "SCSI generic v3 IO",
1843 .help = "Testing engine (no data transfer)",
1846 .help = "Network IO",
1849 .help = "CPU cycle burner engine",
1853 .help = "GUASI IO engine",
1858 .help = "RDMA IO engine",
1861 #ifdef CONFIG_FUSION_AW
1862 { .ival = "fusion-aw-sync",
1863 .help = "Fusion-io atomic write engine",
1866 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1867 { .ival = "e4defrag",
1868 .help = "ext4 defrag engine",
1871 #ifdef CONFIG_LINUX_FALLOCATE
1873 .help = "fallocate() file based engine",
1878 .help = "Glusterfs libgfapi(sync) based engine"
1880 { .ival = "gfapi_async",
1881 .help = "Glusterfs libgfapi(async) based engine"
1884 #ifdef CONFIG_LIBHDFS
1885 { .ival = "libhdfs",
1886 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1889 #ifdef CONFIG_PMEMBLK
1890 { .ival = "pmemblk",
1891 .help = "PMDK libpmemblk based IO engine",
1895 #ifdef CONFIG_LINUX_DEVDAX
1896 { .ival = "dev-dax",
1897 .help = "DAX Device based IO engine",
1901 .ival = "filecreate",
1902 .help = "File creation engine",
1904 { .ival = "external",
1905 .help = "Load external engine (append name)",
1906 .cb = str_ioengine_external_cb,
1908 #ifdef CONFIG_LIBPMEM
1909 { .ival = "libpmem",
1910 .help = "PMDK libpmem based IO engine",
1917 .lname = "IO Depth",
1918 .type = FIO_OPT_INT,
1919 .off1 = offsetof(struct thread_options, iodepth),
1920 .help = "Number of IO buffers to keep in flight",
1924 .category = FIO_OPT_C_IO,
1925 .group = FIO_OPT_G_IO_BASIC,
1928 .name = "iodepth_batch",
1929 .lname = "IO Depth batch",
1930 .alias = "iodepth_batch_submit",
1931 .type = FIO_OPT_INT,
1932 .off1 = offsetof(struct thread_options, iodepth_batch),
1933 .help = "Number of IO buffers to submit in one go",
1934 .parent = "iodepth",
1938 .category = FIO_OPT_C_IO,
1939 .group = FIO_OPT_G_IO_BASIC,
1942 .name = "iodepth_batch_complete_min",
1943 .lname = "Min IO depth batch complete",
1944 .alias = "iodepth_batch_complete",
1945 .type = FIO_OPT_INT,
1946 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
1947 .help = "Min number of IO buffers to retrieve in one go",
1948 .parent = "iodepth",
1953 .category = FIO_OPT_C_IO,
1954 .group = FIO_OPT_G_IO_BASIC,
1957 .name = "iodepth_batch_complete_max",
1958 .lname = "Max IO depth batch complete",
1959 .type = FIO_OPT_INT,
1960 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
1961 .help = "Max number of IO buffers to retrieve in one go",
1962 .parent = "iodepth",
1966 .category = FIO_OPT_C_IO,
1967 .group = FIO_OPT_G_IO_BASIC,
1970 .name = "iodepth_low",
1971 .lname = "IO Depth batch low",
1972 .type = FIO_OPT_INT,
1973 .off1 = offsetof(struct thread_options, iodepth_low),
1974 .help = "Low water mark for queuing depth",
1975 .parent = "iodepth",
1978 .category = FIO_OPT_C_IO,
1979 .group = FIO_OPT_G_IO_BASIC,
1982 .name = "serialize_overlap",
1983 .lname = "Serialize overlap",
1984 .off1 = offsetof(struct thread_options, serialize_overlap),
1985 .type = FIO_OPT_BOOL,
1986 .help = "Wait for in-flight IOs that collide to complete",
1987 .parent = "iodepth",
1989 .category = FIO_OPT_C_IO,
1990 .group = FIO_OPT_G_IO_BASIC,
1993 .name = "io_submit_mode",
1994 .lname = "IO submit mode",
1995 .type = FIO_OPT_STR,
1996 .off1 = offsetof(struct thread_options, io_submit_mode),
1997 .help = "How IO submissions and completions are done",
1999 .category = FIO_OPT_C_IO,
2000 .group = FIO_OPT_G_IO_BASIC,
2003 .oval = IO_MODE_INLINE,
2004 .help = "Submit and complete IO inline",
2006 { .ival = "offload",
2007 .oval = IO_MODE_OFFLOAD,
2008 .help = "Offload submit and complete to threads",
2015 .type = FIO_OPT_STR_VAL,
2017 .off1 = offsetof(struct thread_options, size),
2018 .help = "Total size of device or files",
2019 .interval = 1024 * 1024,
2020 .category = FIO_OPT_C_IO,
2021 .group = FIO_OPT_G_INVALID,
2025 .alias = "io_limit",
2027 .type = FIO_OPT_STR_VAL,
2028 .off1 = offsetof(struct thread_options, io_size),
2029 .help = "Total size of I/O to be performed",
2030 .interval = 1024 * 1024,
2031 .category = FIO_OPT_C_IO,
2032 .group = FIO_OPT_G_INVALID,
2035 .name = "fill_device",
2036 .lname = "Fill device",
2038 .type = FIO_OPT_BOOL,
2039 .off1 = offsetof(struct thread_options, fill_device),
2040 .help = "Write until an ENOSPC error occurs",
2042 .category = FIO_OPT_C_FILE,
2043 .group = FIO_OPT_G_INVALID,
2047 .lname = "File size",
2048 .type = FIO_OPT_STR_VAL,
2049 .off1 = offsetof(struct thread_options, file_size_low),
2050 .off2 = offsetof(struct thread_options, file_size_high),
2052 .help = "Size of individual files",
2053 .interval = 1024 * 1024,
2054 .category = FIO_OPT_C_FILE,
2055 .group = FIO_OPT_G_INVALID,
2058 .name = "file_append",
2059 .lname = "File append",
2060 .type = FIO_OPT_BOOL,
2061 .off1 = offsetof(struct thread_options, file_append),
2062 .help = "IO will start at the end of the file(s)",
2064 .category = FIO_OPT_C_FILE,
2065 .group = FIO_OPT_G_INVALID,
2069 .lname = "IO offset",
2070 .alias = "fileoffset",
2071 .type = FIO_OPT_STR_VAL,
2072 .cb = str_offset_cb,
2073 .off1 = offsetof(struct thread_options, start_offset),
2074 .help = "Start IO from this offset",
2076 .interval = 1024 * 1024,
2077 .category = FIO_OPT_C_IO,
2078 .group = FIO_OPT_G_INVALID,
2081 .name = "offset_align",
2082 .lname = "IO offset alignment",
2083 .type = FIO_OPT_INT,
2084 .off1 = offsetof(struct thread_options, start_offset_align),
2085 .help = "Start IO from this offset alignment",
2088 .category = FIO_OPT_C_IO,
2089 .group = FIO_OPT_G_INVALID,
2092 .name = "offset_increment",
2093 .lname = "IO offset increment",
2094 .type = FIO_OPT_STR_VAL,
2095 .off1 = offsetof(struct thread_options, offset_increment),
2096 .help = "What is the increment from one offset to the next",
2100 .interval = 1024 * 1024,
2101 .category = FIO_OPT_C_IO,
2102 .group = FIO_OPT_G_INVALID,
2105 .name = "number_ios",
2106 .lname = "Number of IOs to perform",
2107 .type = FIO_OPT_STR_VAL,
2108 .off1 = offsetof(struct thread_options, number_ios),
2109 .help = "Force job completion after this number of IOs",
2111 .category = FIO_OPT_C_IO,
2112 .group = FIO_OPT_G_INVALID,
2116 .lname = "Block size",
2117 .alias = "blocksize",
2118 .type = FIO_OPT_INT,
2119 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2120 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2121 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2123 .help = "Block size unit",
2128 .category = FIO_OPT_C_IO,
2129 .group = FIO_OPT_G_INVALID,
2133 .lname = "Block size align",
2134 .alias = "blockalign",
2135 .type = FIO_OPT_INT,
2136 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2137 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2138 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2140 .help = "IO block offset alignment",
2144 .category = FIO_OPT_C_IO,
2145 .group = FIO_OPT_G_INVALID,
2149 .lname = "Block size range",
2150 .alias = "blocksize_range",
2151 .type = FIO_OPT_RANGE,
2152 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2153 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2154 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2155 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2156 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2157 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2159 .help = "Set block size range (in more detail than bs)",
2163 .category = FIO_OPT_C_IO,
2164 .group = FIO_OPT_G_INVALID,
2168 .lname = "Block size split",
2169 .type = FIO_OPT_STR,
2170 .cb = str_bssplit_cb,
2171 .off1 = offsetof(struct thread_options, bssplit),
2172 .help = "Set a specific mix of block sizes",
2175 .category = FIO_OPT_C_IO,
2176 .group = FIO_OPT_G_INVALID,
2179 .name = "bs_unaligned",
2180 .lname = "Block size unaligned",
2181 .alias = "blocksize_unaligned",
2182 .type = FIO_OPT_STR_SET,
2183 .off1 = offsetof(struct thread_options, bs_unaligned),
2184 .help = "Don't sector align IO buffer sizes",
2187 .category = FIO_OPT_C_IO,
2188 .group = FIO_OPT_G_INVALID,
2191 .name = "bs_is_seq_rand",
2192 .lname = "Block size division is seq/random (not read/write)",
2193 .type = FIO_OPT_BOOL,
2194 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2195 .help = "Consider any blocksize setting to be sequential,random",
2197 .parent = "blocksize",
2198 .category = FIO_OPT_C_IO,
2199 .group = FIO_OPT_G_INVALID,
2202 .name = "randrepeat",
2203 .lname = "Random repeatable",
2204 .type = FIO_OPT_BOOL,
2205 .off1 = offsetof(struct thread_options, rand_repeatable),
2206 .help = "Use repeatable random IO pattern",
2210 .category = FIO_OPT_C_IO,
2211 .group = FIO_OPT_G_RANDOM,
2215 .lname = "The random generator seed",
2216 .type = FIO_OPT_STR_VAL,
2217 .off1 = offsetof(struct thread_options, rand_seed),
2218 .help = "Set the random generator seed value",
2221 .category = FIO_OPT_C_IO,
2222 .group = FIO_OPT_G_RANDOM,
2225 .name = "use_os_rand",
2226 .lname = "Use OS random",
2227 .type = FIO_OPT_DEPRECATED,
2228 .off1 = offsetof(struct thread_options, dep_use_os_rand),
2229 .category = FIO_OPT_C_IO,
2230 .group = FIO_OPT_G_RANDOM,
2233 .name = "norandommap",
2234 .lname = "No randommap",
2235 .type = FIO_OPT_STR_SET,
2236 .off1 = offsetof(struct thread_options, norandommap),
2237 .help = "Accept potential duplicate random blocks",
2241 .category = FIO_OPT_C_IO,
2242 .group = FIO_OPT_G_RANDOM,
2245 .name = "softrandommap",
2246 .lname = "Soft randommap",
2247 .type = FIO_OPT_BOOL,
2248 .off1 = offsetof(struct thread_options, softrandommap),
2249 .help = "Set norandommap if randommap allocation fails",
2250 .parent = "norandommap",
2253 .category = FIO_OPT_C_IO,
2254 .group = FIO_OPT_G_RANDOM,
2257 .name = "random_generator",
2258 .lname = "Random Generator",
2259 .type = FIO_OPT_STR,
2260 .off1 = offsetof(struct thread_options, random_generator),
2261 .help = "Type of random number generator to use",
2262 .def = "tausworthe",
2264 { .ival = "tausworthe",
2265 .oval = FIO_RAND_GEN_TAUSWORTHE,
2266 .help = "Strong Tausworthe generator",
2269 .oval = FIO_RAND_GEN_LFSR,
2270 .help = "Variable length LFSR",
2273 .ival = "tausworthe64",
2274 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2275 .help = "64-bit Tausworthe variant",
2278 .category = FIO_OPT_C_IO,
2279 .group = FIO_OPT_G_RANDOM,
2282 .name = "random_distribution",
2283 .lname = "Random Distribution",
2284 .type = FIO_OPT_STR,
2285 .off1 = offsetof(struct thread_options, random_distribution),
2286 .cb = str_random_distribution_cb,
2287 .help = "Random offset distribution generator",
2291 .oval = FIO_RAND_DIST_RANDOM,
2292 .help = "Completely random",
2295 .oval = FIO_RAND_DIST_ZIPF,
2296 .help = "Zipf distribution",
2299 .oval = FIO_RAND_DIST_PARETO,
2300 .help = "Pareto distribution",
2303 .oval = FIO_RAND_DIST_GAUSS,
2304 .help = "Normal (Gaussian) distribution",
2307 .oval = FIO_RAND_DIST_ZONED,
2308 .help = "Zoned random distribution",
2310 { .ival = "zoned_abs",
2311 .oval = FIO_RAND_DIST_ZONED_ABS,
2312 .help = "Zoned absolute random distribution",
2315 .category = FIO_OPT_C_IO,
2316 .group = FIO_OPT_G_RANDOM,
2319 .name = "percentage_random",
2320 .lname = "Percentage Random",
2321 .type = FIO_OPT_INT,
2322 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2323 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2324 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2326 .help = "Percentage of seq/random mix that should be random",
2327 .def = "100,100,100",
2329 .inverse = "percentage_sequential",
2330 .category = FIO_OPT_C_IO,
2331 .group = FIO_OPT_G_RANDOM,
2334 .name = "percentage_sequential",
2335 .lname = "Percentage Sequential",
2336 .type = FIO_OPT_DEPRECATED,
2337 .category = FIO_OPT_C_IO,
2338 .group = FIO_OPT_G_RANDOM,
2341 .name = "allrandrepeat",
2342 .lname = "All Random Repeat",
2343 .type = FIO_OPT_BOOL,
2344 .off1 = offsetof(struct thread_options, allrand_repeatable),
2345 .help = "Use repeatable random numbers for everything",
2347 .category = FIO_OPT_C_IO,
2348 .group = FIO_OPT_G_RANDOM,
2352 .lname = "Number of files",
2353 .alias = "nr_files",
2354 .type = FIO_OPT_INT,
2355 .off1 = offsetof(struct thread_options, nr_files),
2356 .help = "Split job workload between this number of files",
2359 .category = FIO_OPT_C_FILE,
2360 .group = FIO_OPT_G_INVALID,
2363 .name = "openfiles",
2364 .lname = "Number of open files",
2365 .type = FIO_OPT_INT,
2366 .off1 = offsetof(struct thread_options, open_files),
2367 .help = "Number of files to keep open at the same time",
2368 .category = FIO_OPT_C_FILE,
2369 .group = FIO_OPT_G_INVALID,
2372 .name = "file_service_type",
2373 .lname = "File service type",
2374 .type = FIO_OPT_STR,
2376 .off1 = offsetof(struct thread_options, file_service_type),
2377 .help = "How to select which file to service next",
2378 .def = "roundrobin",
2379 .category = FIO_OPT_C_FILE,
2380 .group = FIO_OPT_G_INVALID,
2383 .oval = FIO_FSERVICE_RANDOM,
2384 .help = "Choose a file at random (uniform)",
2387 .oval = FIO_FSERVICE_ZIPF,
2388 .help = "Zipf randomized",
2391 .oval = FIO_FSERVICE_PARETO,
2392 .help = "Pareto randomized",
2395 .oval = FIO_FSERVICE_GAUSS,
2396 .help = "Normal (Gaussian) randomized",
2399 .oval = FIO_FSERVICE_GAUSS,
2400 .help = "Alias for normal",
2402 { .ival = "roundrobin",
2403 .oval = FIO_FSERVICE_RR,
2404 .help = "Round robin select files",
2406 { .ival = "sequential",
2407 .oval = FIO_FSERVICE_SEQ,
2408 .help = "Finish one file before moving to the next",
2411 .parent = "nrfiles",
2414 #ifdef FIO_HAVE_ANY_FALLOCATE
2416 .name = "fallocate",
2417 .lname = "Fallocate",
2418 .type = FIO_OPT_STR,
2419 .off1 = offsetof(struct thread_options, fallocate_mode),
2420 .help = "Whether pre-allocation is performed when laying out files",
2422 .category = FIO_OPT_C_FILE,
2423 .group = FIO_OPT_G_INVALID,
2426 .oval = FIO_FALLOCATE_NONE,
2427 .help = "Do not pre-allocate space",
2430 .oval = FIO_FALLOCATE_NATIVE,
2431 .help = "Use native pre-allocation if possible",
2433 #ifdef CONFIG_POSIX_FALLOCATE
2435 .oval = FIO_FALLOCATE_POSIX,
2436 .help = "Use posix_fallocate()",
2439 #ifdef CONFIG_LINUX_FALLOCATE
2441 .oval = FIO_FALLOCATE_KEEP_SIZE,
2442 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2445 /* Compatibility with former boolean values */
2447 .oval = FIO_FALLOCATE_NONE,
2448 .help = "Alias for 'none'",
2450 #ifdef CONFIG_POSIX_FALLOCATE
2452 .oval = FIO_FALLOCATE_POSIX,
2453 .help = "Alias for 'posix'",
2458 #else /* FIO_HAVE_ANY_FALLOCATE */
2460 .name = "fallocate",
2461 .lname = "Fallocate",
2462 .type = FIO_OPT_UNSUPPORTED,
2463 .help = "Your platform does not support fallocate",
2465 #endif /* FIO_HAVE_ANY_FALLOCATE */
2467 .name = "fadvise_hint",
2468 .lname = "Fadvise hint",
2469 .type = FIO_OPT_STR,
2470 .off1 = offsetof(struct thread_options, fadvise_hint),
2474 .help = "Don't issue fadvise/madvise",
2478 .help = "Advise using fio IO pattern",
2481 .oval = F_ADV_RANDOM,
2482 .help = "Advise using FADV_RANDOM",
2484 { .ival = "sequential",
2485 .oval = F_ADV_SEQUENTIAL,
2486 .help = "Advise using FADV_SEQUENTIAL",
2489 .help = "Use fadvise() to advise the kernel on IO pattern",
2491 .category = FIO_OPT_C_FILE,
2492 .group = FIO_OPT_G_INVALID,
2497 .type = FIO_OPT_INT,
2498 .off1 = offsetof(struct thread_options, fsync_blocks),
2499 .help = "Issue fsync for writes every given number of blocks",
2502 .category = FIO_OPT_C_FILE,
2503 .group = FIO_OPT_G_INVALID,
2506 .name = "fdatasync",
2507 .lname = "Fdatasync",
2508 .type = FIO_OPT_INT,
2509 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2510 .help = "Issue fdatasync for writes every given number of blocks",
2513 .category = FIO_OPT_C_FILE,
2514 .group = FIO_OPT_G_INVALID,
2517 .name = "write_barrier",
2518 .lname = "Write barrier",
2519 .type = FIO_OPT_INT,
2520 .off1 = offsetof(struct thread_options, barrier_blocks),
2521 .help = "Make every Nth write a barrier write",
2524 .category = FIO_OPT_C_IO,
2525 .group = FIO_OPT_G_INVALID,
2527 #ifdef CONFIG_SYNC_FILE_RANGE
2529 .name = "sync_file_range",
2530 .lname = "Sync file range",
2532 { .ival = "wait_before",
2533 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2534 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2538 .oval = SYNC_FILE_RANGE_WRITE,
2539 .help = "SYNC_FILE_RANGE_WRITE",
2543 .ival = "wait_after",
2544 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2545 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2549 .type = FIO_OPT_STR_MULTI,
2551 .off1 = offsetof(struct thread_options, sync_file_range),
2552 .help = "Use sync_file_range()",
2553 .category = FIO_OPT_C_FILE,
2554 .group = FIO_OPT_G_INVALID,
2558 .name = "sync_file_range",
2559 .lname = "Sync file range",
2560 .type = FIO_OPT_UNSUPPORTED,
2561 .help = "Your platform does not support sync_file_range",
2566 .lname = "Direct I/O",
2567 .type = FIO_OPT_BOOL,
2568 .off1 = offsetof(struct thread_options, odirect),
2569 .help = "Use O_DIRECT IO (negates buffered)",
2571 .inverse = "buffered",
2572 .category = FIO_OPT_C_IO,
2573 .group = FIO_OPT_G_IO_TYPE,
2577 .lname = "Atomic I/O",
2578 .type = FIO_OPT_BOOL,
2579 .off1 = offsetof(struct thread_options, oatomic),
2580 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2582 .category = FIO_OPT_C_IO,
2583 .group = FIO_OPT_G_IO_TYPE,
2587 .lname = "Buffered I/O",
2588 .type = FIO_OPT_BOOL,
2589 .off1 = offsetof(struct thread_options, odirect),
2591 .help = "Use buffered IO (negates direct)",
2593 .inverse = "direct",
2594 .category = FIO_OPT_C_IO,
2595 .group = FIO_OPT_G_IO_TYPE,
2598 .name = "overwrite",
2599 .lname = "Overwrite",
2600 .type = FIO_OPT_BOOL,
2601 .off1 = offsetof(struct thread_options, overwrite),
2602 .help = "When writing, set whether to overwrite current data",
2604 .category = FIO_OPT_C_FILE,
2605 .group = FIO_OPT_G_INVALID,
2610 .type = FIO_OPT_INT,
2611 .off1 = offsetof(struct thread_options, loops),
2612 .help = "Number of times to run the job",
2615 .category = FIO_OPT_C_GENERAL,
2616 .group = FIO_OPT_G_RUNTIME,
2620 .lname = "Number of jobs",
2621 .type = FIO_OPT_INT,
2622 .off1 = offsetof(struct thread_options, numjobs),
2623 .help = "Duplicate this job this many times",
2626 .category = FIO_OPT_C_GENERAL,
2627 .group = FIO_OPT_G_RUNTIME,
2630 .name = "startdelay",
2631 .lname = "Start delay",
2632 .type = FIO_OPT_STR_VAL_TIME,
2633 .off1 = offsetof(struct thread_options, start_delay),
2634 .off2 = offsetof(struct thread_options, start_delay_high),
2635 .help = "Only start job when this period has passed",
2639 .category = FIO_OPT_C_GENERAL,
2640 .group = FIO_OPT_G_RUNTIME,
2646 .type = FIO_OPT_STR_VAL_TIME,
2647 .off1 = offsetof(struct thread_options, timeout),
2648 .help = "Stop workload when this amount of time has passed",
2652 .category = FIO_OPT_C_GENERAL,
2653 .group = FIO_OPT_G_RUNTIME,
2656 .name = "time_based",
2657 .lname = "Time based",
2658 .type = FIO_OPT_STR_SET,
2659 .off1 = offsetof(struct thread_options, time_based),
2660 .help = "Keep running until runtime/timeout is met",
2661 .category = FIO_OPT_C_GENERAL,
2662 .group = FIO_OPT_G_RUNTIME,
2665 .name = "verify_only",
2666 .lname = "Verify only",
2667 .type = FIO_OPT_STR_SET,
2668 .off1 = offsetof(struct thread_options, verify_only),
2669 .help = "Verifies previously written data is still valid",
2670 .category = FIO_OPT_C_GENERAL,
2671 .group = FIO_OPT_G_RUNTIME,
2674 .name = "ramp_time",
2675 .lname = "Ramp time",
2676 .type = FIO_OPT_STR_VAL_TIME,
2677 .off1 = offsetof(struct thread_options, ramp_time),
2678 .help = "Ramp up time before measuring performance",
2681 .category = FIO_OPT_C_GENERAL,
2682 .group = FIO_OPT_G_RUNTIME,
2685 .name = "clocksource",
2686 .lname = "Clock source",
2687 .type = FIO_OPT_STR,
2688 .cb = fio_clock_source_cb,
2689 .off1 = offsetof(struct thread_options, clocksource),
2690 .help = "What type of timing source to use",
2691 .category = FIO_OPT_C_GENERAL,
2692 .group = FIO_OPT_G_CLOCK,
2694 #ifdef CONFIG_GETTIMEOFDAY
2695 { .ival = "gettimeofday",
2697 .help = "Use gettimeofday(2) for timing",
2700 #ifdef CONFIG_CLOCK_GETTIME
2701 { .ival = "clock_gettime",
2702 .oval = CS_CGETTIME,
2703 .help = "Use clock_gettime(2) for timing",
2706 #ifdef ARCH_HAVE_CPU_CLOCK
2708 .oval = CS_CPUCLOCK,
2709 .help = "Use CPU private clock",
2717 .lname = "I/O Memory",
2718 .type = FIO_OPT_STR,
2720 .off1 = offsetof(struct thread_options, mem_type),
2721 .help = "Backing type for IO buffers",
2723 .category = FIO_OPT_C_IO,
2724 .group = FIO_OPT_G_INVALID,
2728 .help = "Use malloc(3) for IO buffers",
2730 #ifndef CONFIG_NO_SHM
2733 .help = "Use shared memory segments for IO buffers",
2735 #ifdef FIO_HAVE_HUGETLB
2736 { .ival = "shmhuge",
2737 .oval = MEM_SHMHUGE,
2738 .help = "Like shm, but use huge pages",
2744 .help = "Use mmap(2) (file or anon) for IO buffers",
2746 { .ival = "mmapshared",
2747 .oval = MEM_MMAPSHARED,
2748 .help = "Like mmap, but use the shared flag",
2750 #ifdef FIO_HAVE_HUGETLB
2751 { .ival = "mmaphuge",
2752 .oval = MEM_MMAPHUGE,
2753 .help = "Like mmap, but use huge pages",
2757 { .ival = "cudamalloc",
2758 .oval = MEM_CUDA_MALLOC,
2759 .help = "Allocate GPU device memory for GPUDirect RDMA",
2765 .name = "iomem_align",
2766 .alias = "mem_align",
2767 .lname = "I/O memory alignment",
2768 .type = FIO_OPT_INT,
2769 .off1 = offsetof(struct thread_options, mem_align),
2771 .help = "IO memory buffer offset alignment",
2775 .category = FIO_OPT_C_IO,
2776 .group = FIO_OPT_G_INVALID,
2781 .type = FIO_OPT_STR,
2782 .off1 = offsetof(struct thread_options, verify),
2783 .help = "Verify data written",
2785 .category = FIO_OPT_C_IO,
2786 .group = FIO_OPT_G_VERIFY,
2789 .oval = VERIFY_NONE,
2790 .help = "Don't do IO verification",
2794 .help = "Use md5 checksums for verification",
2797 .oval = VERIFY_CRC64,
2798 .help = "Use crc64 checksums for verification",
2801 .oval = VERIFY_CRC32,
2802 .help = "Use crc32 checksums for verification",
2804 { .ival = "crc32c-intel",
2805 .oval = VERIFY_CRC32C,
2806 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2809 .oval = VERIFY_CRC32C,
2810 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2813 .oval = VERIFY_CRC16,
2814 .help = "Use crc16 checksums for verification",
2817 .oval = VERIFY_CRC7,
2818 .help = "Use crc7 checksums for verification",
2821 .oval = VERIFY_SHA1,
2822 .help = "Use sha1 checksums for verification",
2825 .oval = VERIFY_SHA256,
2826 .help = "Use sha256 checksums for verification",
2829 .oval = VERIFY_SHA512,
2830 .help = "Use sha512 checksums for verification",
2832 { .ival = "sha3-224",
2833 .oval = VERIFY_SHA3_224,
2834 .help = "Use sha3-224 checksums for verification",
2836 { .ival = "sha3-256",
2837 .oval = VERIFY_SHA3_256,
2838 .help = "Use sha3-256 checksums for verification",
2840 { .ival = "sha3-384",
2841 .oval = VERIFY_SHA3_384,
2842 .help = "Use sha3-384 checksums for verification",
2844 { .ival = "sha3-512",
2845 .oval = VERIFY_SHA3_512,
2846 .help = "Use sha3-512 checksums for verification",
2849 .oval = VERIFY_XXHASH,
2850 .help = "Use xxhash checksums for verification",
2852 /* Meta information was included into verify_header,
2853 * 'meta' verification is implied by default. */
2855 .oval = VERIFY_HDR_ONLY,
2856 .help = "Use io information for verification. "
2857 "Now is implied by default, thus option is obsolete, "
2860 { .ival = "pattern",
2861 .oval = VERIFY_PATTERN_NO_HDR,
2862 .help = "Verify strict pattern",
2866 .oval = VERIFY_NULL,
2867 .help = "Pretend to verify",
2872 .name = "do_verify",
2873 .lname = "Perform verify step",
2874 .type = FIO_OPT_BOOL,
2875 .off1 = offsetof(struct thread_options, do_verify),
2876 .help = "Run verification stage after write",
2880 .category = FIO_OPT_C_IO,
2881 .group = FIO_OPT_G_VERIFY,
2884 .name = "verifysort",
2885 .lname = "Verify sort",
2886 .type = FIO_OPT_SOFT_DEPRECATED,
2887 .category = FIO_OPT_C_IO,
2888 .group = FIO_OPT_G_VERIFY,
2891 .name = "verifysort_nr",
2892 .lname = "Verify Sort Nr",
2893 .type = FIO_OPT_SOFT_DEPRECATED,
2894 .category = FIO_OPT_C_IO,
2895 .group = FIO_OPT_G_VERIFY,
2898 .name = "verify_interval",
2899 .lname = "Verify interval",
2900 .type = FIO_OPT_INT,
2901 .off1 = offsetof(struct thread_options, verify_interval),
2902 .minval = 2 * sizeof(struct verify_header),
2903 .help = "Store verify buffer header every N bytes",
2906 .interval = 2 * sizeof(struct verify_header),
2907 .category = FIO_OPT_C_IO,
2908 .group = FIO_OPT_G_VERIFY,
2911 .name = "verify_offset",
2912 .lname = "Verify offset",
2913 .type = FIO_OPT_INT,
2914 .help = "Offset verify header location by N bytes",
2915 .off1 = offsetof(struct thread_options, verify_offset),
2916 .minval = sizeof(struct verify_header),
2919 .category = FIO_OPT_C_IO,
2920 .group = FIO_OPT_G_VERIFY,
2923 .name = "verify_pattern",
2924 .lname = "Verify pattern",
2925 .type = FIO_OPT_STR,
2926 .cb = str_verify_pattern_cb,
2927 .off1 = offsetof(struct thread_options, verify_pattern),
2928 .help = "Fill pattern for IO buffers",
2931 .category = FIO_OPT_C_IO,
2932 .group = FIO_OPT_G_VERIFY,
2935 .name = "verify_fatal",
2936 .lname = "Verify fatal",
2937 .type = FIO_OPT_BOOL,
2938 .off1 = offsetof(struct thread_options, verify_fatal),
2940 .help = "Exit on a single verify failure, don't continue",
2943 .category = FIO_OPT_C_IO,
2944 .group = FIO_OPT_G_VERIFY,
2947 .name = "verify_dump",
2948 .lname = "Verify dump",
2949 .type = FIO_OPT_BOOL,
2950 .off1 = offsetof(struct thread_options, verify_dump),
2952 .help = "Dump contents of good and bad blocks on failure",
2955 .category = FIO_OPT_C_IO,
2956 .group = FIO_OPT_G_VERIFY,
2959 .name = "verify_async",
2960 .lname = "Verify asynchronously",
2961 .type = FIO_OPT_INT,
2962 .off1 = offsetof(struct thread_options, verify_async),
2964 .help = "Number of async verifier threads to use",
2967 .category = FIO_OPT_C_IO,
2968 .group = FIO_OPT_G_VERIFY,
2971 .name = "verify_backlog",
2972 .lname = "Verify backlog",
2973 .type = FIO_OPT_STR_VAL,
2974 .off1 = offsetof(struct thread_options, verify_backlog),
2975 .help = "Verify after this number of blocks are written",
2978 .category = FIO_OPT_C_IO,
2979 .group = FIO_OPT_G_VERIFY,
2982 .name = "verify_backlog_batch",
2983 .lname = "Verify backlog batch",
2984 .type = FIO_OPT_INT,
2985 .off1 = offsetof(struct thread_options, verify_batch),
2986 .help = "Verify this number of IO blocks",
2989 .category = FIO_OPT_C_IO,
2990 .group = FIO_OPT_G_VERIFY,
2992 #ifdef FIO_HAVE_CPU_AFFINITY
2994 .name = "verify_async_cpus",
2995 .lname = "Async verify CPUs",
2996 .type = FIO_OPT_STR,
2997 .cb = str_verify_cpus_allowed_cb,
2998 .off1 = offsetof(struct thread_options, verify_cpumask),
2999 .help = "Set CPUs allowed for async verify threads",
3000 .parent = "verify_async",
3002 .category = FIO_OPT_C_IO,
3003 .group = FIO_OPT_G_VERIFY,
3007 .name = "verify_async_cpus",
3008 .lname = "Async verify CPUs",
3009 .type = FIO_OPT_UNSUPPORTED,
3010 .help = "Your platform does not support CPU affinities",
3014 .name = "experimental_verify",
3015 .lname = "Experimental Verify",
3016 .off1 = offsetof(struct thread_options, experimental_verify),
3017 .type = FIO_OPT_BOOL,
3018 .help = "Enable experimental verification",
3020 .category = FIO_OPT_C_IO,
3021 .group = FIO_OPT_G_VERIFY,
3024 .name = "verify_state_load",
3025 .lname = "Load verify state",
3026 .off1 = offsetof(struct thread_options, verify_state),
3027 .type = FIO_OPT_BOOL,
3028 .help = "Load verify termination state",
3030 .category = FIO_OPT_C_IO,
3031 .group = FIO_OPT_G_VERIFY,
3034 .name = "verify_state_save",
3035 .lname = "Save verify state",
3036 .off1 = offsetof(struct thread_options, verify_state_save),
3037 .type = FIO_OPT_BOOL,
3039 .help = "Save verify state on termination",
3041 .category = FIO_OPT_C_IO,
3042 .group = FIO_OPT_G_VERIFY,
3044 #ifdef FIO_HAVE_TRIM
3046 .name = "trim_percentage",
3047 .lname = "Trim percentage",
3048 .type = FIO_OPT_INT,
3049 .off1 = offsetof(struct thread_options, trim_percentage),
3052 .help = "Number of verify blocks to trim (i.e., discard)",
3057 .category = FIO_OPT_C_IO,
3058 .group = FIO_OPT_G_TRIM,
3061 .name = "trim_verify_zero",
3062 .lname = "Verify trim zero",
3063 .type = FIO_OPT_BOOL,
3064 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3065 .off1 = offsetof(struct thread_options, trim_zero),
3066 .parent = "trim_percentage",
3069 .category = FIO_OPT_C_IO,
3070 .group = FIO_OPT_G_TRIM,
3073 .name = "trim_backlog",
3074 .lname = "Trim backlog",
3075 .type = FIO_OPT_STR_VAL,
3076 .off1 = offsetof(struct thread_options, trim_backlog),
3077 .help = "Trim after this number of blocks are written",
3078 .parent = "trim_percentage",
3081 .category = FIO_OPT_C_IO,
3082 .group = FIO_OPT_G_TRIM,
3085 .name = "trim_backlog_batch",
3086 .lname = "Trim backlog batch",
3087 .type = FIO_OPT_INT,
3088 .off1 = offsetof(struct thread_options, trim_batch),
3089 .help = "Trim this number of IO blocks",
3090 .parent = "trim_percentage",
3093 .category = FIO_OPT_C_IO,
3094 .group = FIO_OPT_G_TRIM,
3098 .name = "trim_percentage",
3099 .lname = "Trim percentage",
3100 .type = FIO_OPT_UNSUPPORTED,
3101 .help = "Fio does not support TRIM on your platform",
3104 .name = "trim_verify_zero",
3105 .lname = "Verify trim zero",
3106 .type = FIO_OPT_UNSUPPORTED,
3107 .help = "Fio does not support TRIM on your platform",
3110 .name = "trim_backlog",
3111 .lname = "Trim backlog",
3112 .type = FIO_OPT_UNSUPPORTED,
3113 .help = "Fio does not support TRIM on your platform",
3116 .name = "trim_backlog_batch",
3117 .lname = "Trim backlog batch",
3118 .type = FIO_OPT_UNSUPPORTED,
3119 .help = "Fio does not support TRIM on your platform",
3123 .name = "write_iolog",
3124 .lname = "Write I/O log",
3125 .type = FIO_OPT_STR_STORE,
3126 .off1 = offsetof(struct thread_options, write_iolog_file),
3127 .help = "Store IO pattern to file",
3128 .category = FIO_OPT_C_IO,
3129 .group = FIO_OPT_G_IOLOG,
3132 .name = "read_iolog",
3133 .lname = "Read I/O log",
3134 .type = FIO_OPT_STR_STORE,
3135 .off1 = offsetof(struct thread_options, read_iolog_file),
3136 .help = "Playback IO pattern from file",
3137 .category = FIO_OPT_C_IO,
3138 .group = FIO_OPT_G_IOLOG,
3141 .name = "replay_no_stall",
3142 .lname = "Don't stall on replay",
3143 .type = FIO_OPT_BOOL,
3144 .off1 = offsetof(struct thread_options, no_stall),
3146 .parent = "read_iolog",
3148 .help = "Playback IO pattern file as fast as possible without stalls",
3149 .category = FIO_OPT_C_IO,
3150 .group = FIO_OPT_G_IOLOG,
3153 .name = "replay_redirect",
3154 .lname = "Redirect device for replay",
3155 .type = FIO_OPT_STR_STORE,
3156 .off1 = offsetof(struct thread_options, replay_redirect),
3157 .parent = "read_iolog",
3159 .help = "Replay all I/O onto this device, regardless of trace device",
3160 .category = FIO_OPT_C_IO,
3161 .group = FIO_OPT_G_IOLOG,
3164 .name = "replay_scale",
3165 .lname = "Replace offset scale factor",
3166 .type = FIO_OPT_INT,
3167 .off1 = offsetof(struct thread_options, replay_scale),
3168 .parent = "read_iolog",
3170 .help = "Align offsets to this blocksize",
3171 .category = FIO_OPT_C_IO,
3172 .group = FIO_OPT_G_IOLOG,
3175 .name = "replay_align",
3176 .lname = "Replace alignment",
3177 .type = FIO_OPT_INT,
3178 .off1 = offsetof(struct thread_options, replay_align),
3179 .parent = "read_iolog",
3180 .help = "Scale offset down by this factor",
3181 .category = FIO_OPT_C_IO,
3182 .group = FIO_OPT_G_IOLOG,
3186 .name = "replay_time_scale",
3187 .lname = "Replay Time Scale",
3188 .type = FIO_OPT_INT,
3189 .off1 = offsetof(struct thread_options, replay_time_scale),
3192 .parent = "read_iolog",
3194 .help = "Scale time for replay events",
3195 .category = FIO_OPT_C_IO,
3196 .group = FIO_OPT_G_IOLOG,
3199 .name = "replay_skip",
3200 .lname = "Replay Skip",
3201 .type = FIO_OPT_STR,
3202 .cb = str_replay_skip_cb,
3203 .off1 = offsetof(struct thread_options, replay_skip),
3204 .parent = "read_iolog",
3205 .help = "Skip certain IO types (read,write,trim,flush)",
3206 .category = FIO_OPT_C_IO,
3207 .group = FIO_OPT_G_IOLOG,
3210 .name = "exec_prerun",
3211 .lname = "Pre-execute runnable",
3212 .type = FIO_OPT_STR_STORE,
3213 .off1 = offsetof(struct thread_options, exec_prerun),
3214 .help = "Execute this file prior to running job",
3215 .category = FIO_OPT_C_GENERAL,
3216 .group = FIO_OPT_G_INVALID,
3219 .name = "exec_postrun",
3220 .lname = "Post-execute runnable",
3221 .type = FIO_OPT_STR_STORE,
3222 .off1 = offsetof(struct thread_options, exec_postrun),
3223 .help = "Execute this file after running job",
3224 .category = FIO_OPT_C_GENERAL,
3225 .group = FIO_OPT_G_INVALID,
3227 #ifdef FIO_HAVE_IOSCHED_SWITCH
3229 .name = "ioscheduler",
3230 .lname = "I/O scheduler",
3231 .type = FIO_OPT_STR_STORE,
3232 .off1 = offsetof(struct thread_options, ioscheduler),
3233 .help = "Use this IO scheduler on the backing device",
3234 .category = FIO_OPT_C_FILE,
3235 .group = FIO_OPT_G_INVALID,
3239 .name = "ioscheduler",
3240 .lname = "I/O scheduler",
3241 .type = FIO_OPT_UNSUPPORTED,
3242 .help = "Your platform does not support IO scheduler switching",
3247 .lname = "Zone size",
3248 .type = FIO_OPT_STR_VAL,
3249 .off1 = offsetof(struct thread_options, zone_size),
3250 .help = "Amount of data to read per zone",
3252 .interval = 1024 * 1024,
3253 .category = FIO_OPT_C_IO,
3254 .group = FIO_OPT_G_ZONE,
3257 .name = "zonerange",
3258 .lname = "Zone range",
3259 .type = FIO_OPT_STR_VAL,
3260 .off1 = offsetof(struct thread_options, zone_range),
3261 .help = "Give size of an IO zone",
3263 .interval = 1024 * 1024,
3264 .category = FIO_OPT_C_IO,
3265 .group = FIO_OPT_G_ZONE,
3269 .lname = "Zone skip",
3270 .type = FIO_OPT_STR_VAL,
3271 .off1 = offsetof(struct thread_options, zone_skip),
3272 .help = "Space between IO zones",
3274 .interval = 1024 * 1024,
3275 .category = FIO_OPT_C_IO,
3276 .group = FIO_OPT_G_ZONE,
3280 .lname = "Lock memory",
3281 .type = FIO_OPT_STR_VAL,
3282 .off1 = offsetof(struct thread_options, lockmem),
3283 .help = "Lock down this amount of memory (per worker)",
3285 .interval = 1024 * 1024,
3286 .category = FIO_OPT_C_GENERAL,
3287 .group = FIO_OPT_G_INVALID,
3290 .name = "rwmixread",
3291 .lname = "Read/write mix read",
3292 .type = FIO_OPT_INT,
3293 .cb = str_rwmix_read_cb,
3294 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3296 .help = "Percentage of mixed workload that is reads",
3299 .inverse = "rwmixwrite",
3300 .category = FIO_OPT_C_IO,
3301 .group = FIO_OPT_G_RWMIX,
3304 .name = "rwmixwrite",
3305 .lname = "Read/write mix write",
3306 .type = FIO_OPT_INT,
3307 .cb = str_rwmix_write_cb,
3308 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3310 .help = "Percentage of mixed workload that is writes",
3313 .inverse = "rwmixread",
3314 .category = FIO_OPT_C_IO,
3315 .group = FIO_OPT_G_RWMIX,
3318 .name = "rwmixcycle",
3319 .lname = "Read/write mix cycle",
3320 .type = FIO_OPT_DEPRECATED,
3321 .category = FIO_OPT_C_IO,
3322 .group = FIO_OPT_G_RWMIX,
3327 .type = FIO_OPT_INT,
3328 .off1 = offsetof(struct thread_options, nice),
3329 .help = "Set job CPU nice value",
3334 .category = FIO_OPT_C_GENERAL,
3335 .group = FIO_OPT_G_CRED,
3337 #ifdef FIO_HAVE_IOPRIO
3340 .lname = "I/O nice priority",
3341 .type = FIO_OPT_INT,
3342 .off1 = offsetof(struct thread_options, ioprio),
3343 .help = "Set job IO priority value",
3344 .minval = IOPRIO_MIN_PRIO,
3345 .maxval = IOPRIO_MAX_PRIO,
3347 .category = FIO_OPT_C_GENERAL,
3348 .group = FIO_OPT_G_CRED,
3353 .lname = "I/O nice priority",
3354 .type = FIO_OPT_UNSUPPORTED,
3355 .help = "Your platform does not support IO priorities",
3358 #ifdef FIO_HAVE_IOPRIO_CLASS
3359 #ifndef FIO_HAVE_IOPRIO
3360 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3363 .name = "prioclass",
3364 .lname = "I/O nice priority class",
3365 .type = FIO_OPT_INT,
3366 .off1 = offsetof(struct thread_options, ioprio_class),
3367 .help = "Set job IO priority class",
3368 .minval = IOPRIO_MIN_PRIO_CLASS,
3369 .maxval = IOPRIO_MAX_PRIO_CLASS,
3371 .category = FIO_OPT_C_GENERAL,
3372 .group = FIO_OPT_G_CRED,
3376 .name = "prioclass",
3377 .lname = "I/O nice priority class",
3378 .type = FIO_OPT_UNSUPPORTED,
3379 .help = "Your platform does not support IO priority classes",
3383 .name = "thinktime",
3384 .lname = "Thinktime",
3385 .type = FIO_OPT_INT,
3386 .off1 = offsetof(struct thread_options, thinktime),
3387 .help = "Idle time between IO buffers (usec)",
3390 .category = FIO_OPT_C_IO,
3391 .group = FIO_OPT_G_THINKTIME,
3394 .name = "thinktime_spin",
3395 .lname = "Thinktime spin",
3396 .type = FIO_OPT_INT,
3397 .off1 = offsetof(struct thread_options, thinktime_spin),
3398 .help = "Start think time by spinning this amount (usec)",
3401 .parent = "thinktime",
3403 .category = FIO_OPT_C_IO,
3404 .group = FIO_OPT_G_THINKTIME,
3407 .name = "thinktime_blocks",
3408 .lname = "Thinktime blocks",
3409 .type = FIO_OPT_INT,
3410 .off1 = offsetof(struct thread_options, thinktime_blocks),
3411 .help = "IO buffer period between 'thinktime'",
3413 .parent = "thinktime",
3415 .category = FIO_OPT_C_IO,
3416 .group = FIO_OPT_G_THINKTIME,
3420 .lname = "I/O rate",
3421 .type = FIO_OPT_INT,
3422 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3423 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3424 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
3425 .help = "Set bandwidth rate",
3426 .category = FIO_OPT_C_IO,
3427 .group = FIO_OPT_G_RATE,
3432 .lname = "I/O min rate",
3433 .type = FIO_OPT_INT,
3434 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
3435 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
3436 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
3437 .help = "Job must meet this rate or it will be shutdown",
3440 .category = FIO_OPT_C_IO,
3441 .group = FIO_OPT_G_RATE,
3444 .name = "rate_iops",
3445 .lname = "I/O rate IOPS",
3446 .type = FIO_OPT_INT,
3447 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
3448 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
3449 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
3450 .help = "Limit IO used to this number of IO operations/sec",
3452 .category = FIO_OPT_C_IO,
3453 .group = FIO_OPT_G_RATE,
3456 .name = "rate_iops_min",
3457 .lname = "I/O min rate IOPS",
3458 .type = FIO_OPT_INT,
3459 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
3460 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
3461 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
3462 .help = "Job must meet this rate or it will be shut down",
3463 .parent = "rate_iops",
3465 .category = FIO_OPT_C_IO,
3466 .group = FIO_OPT_G_RATE,
3469 .name = "rate_process",
3470 .lname = "Rate Process",
3471 .type = FIO_OPT_STR,
3472 .off1 = offsetof(struct thread_options, rate_process),
3473 .help = "What process controls how rated IO is managed",
3475 .category = FIO_OPT_C_IO,
3476 .group = FIO_OPT_G_RATE,
3479 .oval = RATE_PROCESS_LINEAR,
3480 .help = "Linear rate of IO",
3484 .oval = RATE_PROCESS_POISSON,
3485 .help = "Rate follows Poisson process",
3491 .name = "rate_cycle",
3492 .alias = "ratecycle",
3493 .lname = "I/O rate cycle",
3494 .type = FIO_OPT_INT,
3495 .off1 = offsetof(struct thread_options, ratecycle),
3496 .help = "Window average for rate limits (msec)",
3500 .category = FIO_OPT_C_IO,
3501 .group = FIO_OPT_G_RATE,
3504 .name = "rate_ignore_thinktime",
3505 .lname = "Rate ignore thinktime",
3506 .type = FIO_OPT_BOOL,
3507 .off1 = offsetof(struct thread_options, rate_ign_think),
3508 .help = "Rated IO ignores thinktime settings",
3510 .category = FIO_OPT_C_IO,
3511 .group = FIO_OPT_G_RATE,
3514 .name = "max_latency",
3515 .lname = "Max Latency (usec)",
3516 .type = FIO_OPT_STR_VAL_TIME,
3517 .off1 = offsetof(struct thread_options, max_latency),
3518 .help = "Maximum tolerated IO latency (usec)",
3520 .category = FIO_OPT_C_IO,
3521 .group = FIO_OPT_G_LATPROF,
3524 .name = "latency_target",
3525 .lname = "Latency Target (usec)",
3526 .type = FIO_OPT_STR_VAL_TIME,
3527 .off1 = offsetof(struct thread_options, latency_target),
3528 .help = "Ramp to max queue depth supporting this latency",
3530 .category = FIO_OPT_C_IO,
3531 .group = FIO_OPT_G_LATPROF,
3534 .name = "latency_window",
3535 .lname = "Latency Window (usec)",
3536 .type = FIO_OPT_STR_VAL_TIME,
3537 .off1 = offsetof(struct thread_options, latency_window),
3538 .help = "Time to sustain latency_target",
3540 .category = FIO_OPT_C_IO,
3541 .group = FIO_OPT_G_LATPROF,
3544 .name = "latency_percentile",
3545 .lname = "Latency Percentile",
3546 .type = FIO_OPT_FLOAT_LIST,
3547 .off1 = offsetof(struct thread_options, latency_percentile),
3548 .help = "Percentile of IOs must be below latency_target",
3553 .category = FIO_OPT_C_IO,
3554 .group = FIO_OPT_G_LATPROF,
3557 .name = "invalidate",
3558 .lname = "Cache invalidate",
3559 .type = FIO_OPT_BOOL,
3560 .off1 = offsetof(struct thread_options, invalidate_cache),
3561 .help = "Invalidate buffer/page cache prior to running job",
3563 .category = FIO_OPT_C_IO,
3564 .group = FIO_OPT_G_IO_TYPE,
3568 .lname = "Synchronous I/O",
3569 .type = FIO_OPT_BOOL,
3570 .off1 = offsetof(struct thread_options, sync_io),
3571 .help = "Use O_SYNC for buffered writes",
3573 .parent = "buffered",
3575 .category = FIO_OPT_C_IO,
3576 .group = FIO_OPT_G_IO_TYPE,
3578 #ifdef FIO_HAVE_WRITE_HINT
3580 .name = "write_hint",
3581 .lname = "Write hint",
3582 .type = FIO_OPT_STR,
3583 .off1 = offsetof(struct thread_options, write_hint),
3584 .help = "Set expected write life time",
3585 .category = FIO_OPT_C_ENGINE,
3586 .group = FIO_OPT_G_INVALID,
3589 .oval = RWH_WRITE_LIFE_NONE,
3592 .oval = RWH_WRITE_LIFE_SHORT,
3595 .oval = RWH_WRITE_LIFE_MEDIUM,
3598 .oval = RWH_WRITE_LIFE_LONG,
3600 { .ival = "extreme",
3601 .oval = RWH_WRITE_LIFE_EXTREME,
3607 .name = "create_serialize",
3608 .lname = "Create serialize",
3609 .type = FIO_OPT_BOOL,
3610 .off1 = offsetof(struct thread_options, create_serialize),
3611 .help = "Serialize creation of job files",
3613 .category = FIO_OPT_C_FILE,
3614 .group = FIO_OPT_G_INVALID,
3617 .name = "create_fsync",
3618 .lname = "Create fsync",
3619 .type = FIO_OPT_BOOL,
3620 .off1 = offsetof(struct thread_options, create_fsync),
3621 .help = "fsync file after creation",
3623 .category = FIO_OPT_C_FILE,
3624 .group = FIO_OPT_G_INVALID,
3627 .name = "create_on_open",
3628 .lname = "Create on open",
3629 .type = FIO_OPT_BOOL,
3630 .off1 = offsetof(struct thread_options, create_on_open),
3631 .help = "Create files when they are opened for IO",
3633 .category = FIO_OPT_C_FILE,
3634 .group = FIO_OPT_G_INVALID,
3637 .name = "create_only",
3638 .lname = "Create Only",
3639 .type = FIO_OPT_BOOL,
3640 .off1 = offsetof(struct thread_options, create_only),
3641 .help = "Only perform file creation phase",
3642 .category = FIO_OPT_C_FILE,
3646 .name = "allow_file_create",
3647 .lname = "Allow file create",
3648 .type = FIO_OPT_BOOL,
3649 .off1 = offsetof(struct thread_options, allow_create),
3650 .help = "Permit fio to create files, if they don't exist",
3652 .category = FIO_OPT_C_FILE,
3653 .group = FIO_OPT_G_FILENAME,
3656 .name = "allow_mounted_write",
3657 .lname = "Allow mounted write",
3658 .type = FIO_OPT_BOOL,
3659 .off1 = offsetof(struct thread_options, allow_mounted_write),
3660 .help = "Allow writes to a mounted partition",
3662 .category = FIO_OPT_C_FILE,
3663 .group = FIO_OPT_G_FILENAME,
3667 .lname = "Pre-read files",
3668 .type = FIO_OPT_BOOL,
3669 .off1 = offsetof(struct thread_options, pre_read),
3670 .help = "Pre-read files before starting official testing",
3672 .category = FIO_OPT_C_FILE,
3673 .group = FIO_OPT_G_INVALID,
3675 #ifdef FIO_HAVE_CPU_AFFINITY
3678 .lname = "CPU mask",
3679 .type = FIO_OPT_INT,
3680 .cb = str_cpumask_cb,
3681 .off1 = offsetof(struct thread_options, cpumask),
3682 .help = "CPU affinity mask",
3683 .category = FIO_OPT_C_GENERAL,
3684 .group = FIO_OPT_G_CRED,
3687 .name = "cpus_allowed",
3688 .lname = "CPUs allowed",
3689 .type = FIO_OPT_STR,
3690 .cb = str_cpus_allowed_cb,
3691 .off1 = offsetof(struct thread_options, cpumask),
3692 .help = "Set CPUs allowed",
3693 .category = FIO_OPT_C_GENERAL,
3694 .group = FIO_OPT_G_CRED,
3697 .name = "cpus_allowed_policy",
3698 .lname = "CPUs allowed distribution policy",
3699 .type = FIO_OPT_STR,
3700 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
3701 .help = "Distribution policy for cpus_allowed",
3702 .parent = "cpus_allowed",
3706 .oval = FIO_CPUS_SHARED,
3707 .help = "Mask shared between threads",
3710 .oval = FIO_CPUS_SPLIT,
3711 .help = "Mask split between threads",
3714 .category = FIO_OPT_C_GENERAL,
3715 .group = FIO_OPT_G_CRED,
3720 .lname = "CPU mask",
3721 .type = FIO_OPT_UNSUPPORTED,
3722 .help = "Your platform does not support CPU affinities",
3725 .name = "cpus_allowed",
3726 .lname = "CPUs allowed",
3727 .type = FIO_OPT_UNSUPPORTED,
3728 .help = "Your platform does not support CPU affinities",
3731 .name = "cpus_allowed_policy",
3732 .lname = "CPUs allowed distribution policy",
3733 .type = FIO_OPT_UNSUPPORTED,
3734 .help = "Your platform does not support CPU affinities",
3737 #ifdef CONFIG_LIBNUMA
3739 .name = "numa_cpu_nodes",
3740 .lname = "NUMA CPU Nodes",
3741 .type = FIO_OPT_STR,
3742 .cb = str_numa_cpunodes_cb,
3743 .off1 = offsetof(struct thread_options, numa_cpunodes),
3744 .help = "NUMA CPU nodes bind",
3745 .category = FIO_OPT_C_GENERAL,
3746 .group = FIO_OPT_G_INVALID,
3749 .name = "numa_mem_policy",
3750 .lname = "NUMA Memory Policy",
3751 .type = FIO_OPT_STR,
3752 .cb = str_numa_mpol_cb,
3753 .off1 = offsetof(struct thread_options, numa_memnodes),
3754 .help = "NUMA memory policy setup",
3755 .category = FIO_OPT_C_GENERAL,
3756 .group = FIO_OPT_G_INVALID,
3760 .name = "numa_cpu_nodes",
3761 .lname = "NUMA CPU Nodes",
3762 .type = FIO_OPT_UNSUPPORTED,
3763 .help = "Build fio with libnuma-dev(el) to enable this option",
3766 .name = "numa_mem_policy",
3767 .lname = "NUMA Memory Policy",
3768 .type = FIO_OPT_UNSUPPORTED,
3769 .help = "Build fio with libnuma-dev(el) to enable this option",
3774 .name = "gpu_dev_id",
3775 .lname = "GPU device ID",
3776 .type = FIO_OPT_INT,
3777 .off1 = offsetof(struct thread_options, gpu_dev_id),
3778 .help = "Set GPU device ID for GPUDirect RDMA",
3780 .category = FIO_OPT_C_GENERAL,
3781 .group = FIO_OPT_G_INVALID,
3785 .name = "end_fsync",
3786 .lname = "End fsync",
3787 .type = FIO_OPT_BOOL,
3788 .off1 = offsetof(struct thread_options, end_fsync),
3789 .help = "Include fsync at the end of job",
3791 .category = FIO_OPT_C_FILE,
3792 .group = FIO_OPT_G_INVALID,
3795 .name = "fsync_on_close",
3796 .lname = "Fsync on close",
3797 .type = FIO_OPT_BOOL,
3798 .off1 = offsetof(struct thread_options, fsync_on_close),
3799 .help = "fsync files on close",
3801 .category = FIO_OPT_C_FILE,
3802 .group = FIO_OPT_G_INVALID,
3806 .lname = "Unlink file",
3807 .type = FIO_OPT_BOOL,
3808 .off1 = offsetof(struct thread_options, unlink),
3809 .help = "Unlink created files after job has completed",
3811 .category = FIO_OPT_C_FILE,
3812 .group = FIO_OPT_G_INVALID,
3815 .name = "unlink_each_loop",
3816 .lname = "Unlink file after each loop of a job",
3817 .type = FIO_OPT_BOOL,
3818 .off1 = offsetof(struct thread_options, unlink_each_loop),
3819 .help = "Unlink created files after each loop in a job has completed",
3821 .category = FIO_OPT_C_FILE,
3822 .group = FIO_OPT_G_INVALID,
3826 .lname = "Exit-all on terminate",
3827 .type = FIO_OPT_STR_SET,
3828 .cb = str_exitall_cb,
3829 .help = "Terminate all jobs when one exits",
3830 .category = FIO_OPT_C_GENERAL,
3831 .group = FIO_OPT_G_PROCESS,
3834 .name = "exitall_on_error",
3835 .lname = "Exit-all on terminate in error",
3836 .type = FIO_OPT_STR_SET,
3837 .off1 = offsetof(struct thread_options, exitall_error),
3838 .help = "Terminate all jobs when one exits in error",
3839 .category = FIO_OPT_C_GENERAL,
3840 .group = FIO_OPT_G_PROCESS,
3843 .name = "stonewall",
3844 .lname = "Wait for previous",
3845 .alias = "wait_for_previous",
3846 .type = FIO_OPT_STR_SET,
3847 .off1 = offsetof(struct thread_options, stonewall),
3848 .help = "Insert a hard barrier between this job and previous",
3849 .category = FIO_OPT_C_GENERAL,
3850 .group = FIO_OPT_G_PROCESS,
3853 .name = "new_group",
3854 .lname = "New group",
3855 .type = FIO_OPT_STR_SET,
3856 .off1 = offsetof(struct thread_options, new_group),
3857 .help = "Mark the start of a new group (for reporting)",
3858 .category = FIO_OPT_C_GENERAL,
3859 .group = FIO_OPT_G_PROCESS,
3864 .type = FIO_OPT_STR_SET,
3865 .off1 = offsetof(struct thread_options, use_thread),
3866 .help = "Use threads instead of processes",
3867 #ifdef CONFIG_NO_SHM
3871 .category = FIO_OPT_C_GENERAL,
3872 .group = FIO_OPT_G_PROCESS,
3875 .name = "per_job_logs",
3876 .lname = "Per Job Logs",
3877 .type = FIO_OPT_BOOL,
3878 .off1 = offsetof(struct thread_options, per_job_logs),
3879 .help = "Include job number in generated log files or not",
3881 .category = FIO_OPT_C_LOG,
3882 .group = FIO_OPT_G_INVALID,
3885 .name = "write_bw_log",
3886 .lname = "Write bandwidth log",
3887 .type = FIO_OPT_STR,
3888 .off1 = offsetof(struct thread_options, bw_log_file),
3889 .cb = str_write_bw_log_cb,
3890 .help = "Write log of bandwidth during run",
3891 .category = FIO_OPT_C_LOG,
3892 .group = FIO_OPT_G_INVALID,
3895 .name = "write_lat_log",
3896 .lname = "Write latency log",
3897 .type = FIO_OPT_STR,
3898 .off1 = offsetof(struct thread_options, lat_log_file),
3899 .cb = str_write_lat_log_cb,
3900 .help = "Write log of latency during run",
3901 .category = FIO_OPT_C_LOG,
3902 .group = FIO_OPT_G_INVALID,
3905 .name = "write_iops_log",
3906 .lname = "Write IOPS log",
3907 .type = FIO_OPT_STR,
3908 .off1 = offsetof(struct thread_options, iops_log_file),
3909 .cb = str_write_iops_log_cb,
3910 .help = "Write log of IOPS during run",
3911 .category = FIO_OPT_C_LOG,
3912 .group = FIO_OPT_G_INVALID,
3915 .name = "log_avg_msec",
3916 .lname = "Log averaging (msec)",
3917 .type = FIO_OPT_INT,
3918 .off1 = offsetof(struct thread_options, log_avg_msec),
3919 .help = "Average bw/iops/lat logs over this period of time",
3921 .category = FIO_OPT_C_LOG,
3922 .group = FIO_OPT_G_INVALID,
3925 .name = "log_hist_msec",
3926 .lname = "Log histograms (msec)",
3927 .type = FIO_OPT_INT,
3928 .off1 = offsetof(struct thread_options, log_hist_msec),
3929 .help = "Dump completion latency histograms at frequency of this time value",
3931 .category = FIO_OPT_C_LOG,
3932 .group = FIO_OPT_G_INVALID,
3935 .name = "log_hist_coarseness",
3936 .lname = "Histogram logs coarseness",
3937 .type = FIO_OPT_INT,
3938 .off1 = offsetof(struct thread_options, log_hist_coarseness),
3939 .help = "Integer in range [0,6]. Higher coarseness outputs"
3940 " fewer histogram bins per sample. The number of bins for"
3941 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
3943 .category = FIO_OPT_C_LOG,
3944 .group = FIO_OPT_G_INVALID,
3947 .name = "write_hist_log",
3948 .lname = "Write latency histogram logs",
3949 .type = FIO_OPT_STR,
3950 .off1 = offsetof(struct thread_options, hist_log_file),
3951 .cb = str_write_hist_log_cb,
3952 .help = "Write log of latency histograms during run",
3953 .category = FIO_OPT_C_LOG,
3954 .group = FIO_OPT_G_INVALID,
3957 .name = "log_max_value",
3958 .lname = "Log maximum instead of average",
3959 .type = FIO_OPT_BOOL,
3960 .off1 = offsetof(struct thread_options, log_max),
3961 .help = "Log max sample in a window instead of average",
3963 .category = FIO_OPT_C_LOG,
3964 .group = FIO_OPT_G_INVALID,
3967 .name = "log_offset",
3968 .lname = "Log offset of IO",
3969 .type = FIO_OPT_BOOL,
3970 .off1 = offsetof(struct thread_options, log_offset),
3971 .help = "Include offset of IO for each log entry",
3973 .category = FIO_OPT_C_LOG,
3974 .group = FIO_OPT_G_INVALID,
3978 .name = "log_compression",
3979 .lname = "Log compression",
3980 .type = FIO_OPT_INT,
3981 .off1 = offsetof(struct thread_options, log_gz),
3982 .help = "Log in compressed chunks of this size",
3984 .maxval = 512 * 1024 * 1024ULL,
3985 .category = FIO_OPT_C_LOG,
3986 .group = FIO_OPT_G_INVALID,
3988 #ifdef FIO_HAVE_CPU_AFFINITY
3990 .name = "log_compression_cpus",
3991 .lname = "Log Compression CPUs",
3992 .type = FIO_OPT_STR,
3993 .cb = str_log_cpus_allowed_cb,
3994 .off1 = offsetof(struct thread_options, log_gz_cpumask),
3995 .parent = "log_compression",
3996 .help = "Limit log compression to these CPUs",
3997 .category = FIO_OPT_C_LOG,
3998 .group = FIO_OPT_G_INVALID,
4002 .name = "log_compression_cpus",
4003 .lname = "Log Compression CPUs",
4004 .type = FIO_OPT_UNSUPPORTED,
4005 .help = "Your platform does not support CPU affinities",
4009 .name = "log_store_compressed",
4010 .lname = "Log store compressed",
4011 .type = FIO_OPT_BOOL,
4012 .off1 = offsetof(struct thread_options, log_gz_store),
4013 .help = "Store logs in a compressed format",
4014 .category = FIO_OPT_C_LOG,
4015 .group = FIO_OPT_G_INVALID,
4019 .name = "log_compression",
4020 .lname = "Log compression",
4021 .type = FIO_OPT_UNSUPPORTED,
4022 .help = "Install libz-dev(el) to get compression support",
4025 .name = "log_store_compressed",
4026 .lname = "Log store compressed",
4027 .type = FIO_OPT_UNSUPPORTED,
4028 .help = "Install libz-dev(el) to get compression support",
4032 .name = "log_unix_epoch",
4033 .lname = "Log epoch unix",
4034 .type = FIO_OPT_BOOL,
4035 .off1 = offsetof(struct thread_options, log_unix_epoch),
4036 .help = "Use Unix time in log files",
4037 .category = FIO_OPT_C_LOG,
4038 .group = FIO_OPT_G_INVALID,
4041 .name = "block_error_percentiles",
4042 .lname = "Block error percentiles",
4043 .type = FIO_OPT_BOOL,
4044 .off1 = offsetof(struct thread_options, block_error_hist),
4045 .help = "Record trim block errors and make a histogram",
4047 .category = FIO_OPT_C_LOG,
4048 .group = FIO_OPT_G_INVALID,
4051 .name = "bwavgtime",
4052 .lname = "Bandwidth average time",
4053 .type = FIO_OPT_INT,
4054 .off1 = offsetof(struct thread_options, bw_avg_time),
4055 .help = "Time window over which to calculate bandwidth"
4058 .parent = "write_bw_log",
4061 .category = FIO_OPT_C_LOG,
4062 .group = FIO_OPT_G_INVALID,
4065 .name = "iopsavgtime",
4066 .lname = "IOPS average time",
4067 .type = FIO_OPT_INT,
4068 .off1 = offsetof(struct thread_options, iops_avg_time),
4069 .help = "Time window over which to calculate IOPS (msec)",
4071 .parent = "write_iops_log",
4074 .category = FIO_OPT_C_LOG,
4075 .group = FIO_OPT_G_INVALID,
4078 .name = "group_reporting",
4079 .lname = "Group reporting",
4080 .type = FIO_OPT_STR_SET,
4081 .off1 = offsetof(struct thread_options, group_reporting),
4082 .help = "Do reporting on a per-group basis",
4083 .category = FIO_OPT_C_STAT,
4084 .group = FIO_OPT_G_INVALID,
4089 .type = FIO_OPT_BOOL,
4090 .off1 = offsetof(struct thread_options, stats),
4091 .help = "Enable collection of stats",
4093 .category = FIO_OPT_C_STAT,
4094 .group = FIO_OPT_G_INVALID,
4097 .name = "zero_buffers",
4098 .lname = "Zero I/O buffers",
4099 .type = FIO_OPT_STR_SET,
4100 .off1 = offsetof(struct thread_options, zero_buffers),
4101 .help = "Init IO buffers to all zeroes",
4102 .category = FIO_OPT_C_IO,
4103 .group = FIO_OPT_G_IO_BUF,
4106 .name = "refill_buffers",
4107 .lname = "Refill I/O buffers",
4108 .type = FIO_OPT_STR_SET,
4109 .off1 = offsetof(struct thread_options, refill_buffers),
4110 .help = "Refill IO buffers on every IO submit",
4111 .category = FIO_OPT_C_IO,
4112 .group = FIO_OPT_G_IO_BUF,
4115 .name = "scramble_buffers",
4116 .lname = "Scramble I/O buffers",
4117 .type = FIO_OPT_BOOL,
4118 .off1 = offsetof(struct thread_options, scramble_buffers),
4119 .help = "Slightly scramble buffers on every IO submit",
4121 .category = FIO_OPT_C_IO,
4122 .group = FIO_OPT_G_IO_BUF,
4125 .name = "buffer_pattern",
4126 .lname = "Buffer pattern",
4127 .type = FIO_OPT_STR,
4128 .cb = str_buffer_pattern_cb,
4129 .off1 = offsetof(struct thread_options, buffer_pattern),
4130 .help = "Fill pattern for IO buffers",
4131 .category = FIO_OPT_C_IO,
4132 .group = FIO_OPT_G_IO_BUF,
4135 .name = "buffer_compress_percentage",
4136 .lname = "Buffer compression percentage",
4137 .type = FIO_OPT_INT,
4138 .cb = str_buffer_compress_cb,
4139 .off1 = offsetof(struct thread_options, compress_percentage),
4142 .help = "How compressible the buffer is (approximately)",
4144 .category = FIO_OPT_C_IO,
4145 .group = FIO_OPT_G_IO_BUF,
4148 .name = "buffer_compress_chunk",
4149 .lname = "Buffer compression chunk size",
4150 .type = FIO_OPT_INT,
4151 .off1 = offsetof(struct thread_options, compress_chunk),
4152 .parent = "buffer_compress_percentage",
4154 .help = "Size of compressible region in buffer",
4157 .category = FIO_OPT_C_IO,
4158 .group = FIO_OPT_G_IO_BUF,
4161 .name = "dedupe_percentage",
4162 .lname = "Dedupe percentage",
4163 .type = FIO_OPT_INT,
4164 .cb = str_dedupe_cb,
4165 .off1 = offsetof(struct thread_options, dedupe_percentage),
4168 .help = "Percentage of buffers that are dedupable",
4170 .category = FIO_OPT_C_IO,
4171 .group = FIO_OPT_G_IO_BUF,
4174 .name = "clat_percentiles",
4175 .lname = "Completion latency percentiles",
4176 .type = FIO_OPT_BOOL,
4177 .off1 = offsetof(struct thread_options, clat_percentiles),
4178 .help = "Enable the reporting of completion latency percentiles",
4180 .inverse = "lat_percentiles",
4181 .category = FIO_OPT_C_STAT,
4182 .group = FIO_OPT_G_INVALID,
4185 .name = "lat_percentiles",
4186 .lname = "IO latency percentiles",
4187 .type = FIO_OPT_BOOL,
4188 .off1 = offsetof(struct thread_options, lat_percentiles),
4189 .help = "Enable the reporting of IO latency percentiles",
4191 .inverse = "clat_percentiles",
4192 .category = FIO_OPT_C_STAT,
4193 .group = FIO_OPT_G_INVALID,
4196 .name = "percentile_list",
4197 .lname = "Percentile list",
4198 .type = FIO_OPT_FLOAT_LIST,
4199 .off1 = offsetof(struct thread_options, percentile_list),
4200 .off2 = offsetof(struct thread_options, percentile_precision),
4201 .help = "Specify a custom list of percentiles to report for "
4202 "completion latency and block errors",
4203 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
4204 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4207 .category = FIO_OPT_C_STAT,
4208 .group = FIO_OPT_G_INVALID,
4211 .name = "significant_figures",
4212 .lname = "Significant figures",
4213 .type = FIO_OPT_INT,
4214 .off1 = offsetof(struct thread_options, sig_figs),
4217 .help = "Significant figures for output-format set to normal",
4220 .category = FIO_OPT_C_STAT,
4221 .group = FIO_OPT_G_INVALID,
4224 #ifdef FIO_HAVE_DISK_UTIL
4226 .name = "disk_util",
4227 .lname = "Disk utilization",
4228 .type = FIO_OPT_BOOL,
4229 .off1 = offsetof(struct thread_options, do_disk_util),
4230 .help = "Log disk utilization statistics",
4232 .category = FIO_OPT_C_STAT,
4233 .group = FIO_OPT_G_INVALID,
4237 .name = "disk_util",
4238 .lname = "Disk utilization",
4239 .type = FIO_OPT_UNSUPPORTED,
4240 .help = "Your platform does not support disk utilization",
4244 .name = "gtod_reduce",
4245 .lname = "Reduce gettimeofday() calls",
4246 .type = FIO_OPT_BOOL,
4247 .help = "Greatly reduce number of gettimeofday() calls",
4248 .cb = str_gtod_reduce_cb,
4251 .category = FIO_OPT_C_STAT,
4252 .group = FIO_OPT_G_INVALID,
4255 .name = "disable_lat",
4256 .lname = "Disable all latency stats",
4257 .type = FIO_OPT_BOOL,
4258 .off1 = offsetof(struct thread_options, disable_lat),
4259 .help = "Disable latency numbers",
4260 .parent = "gtod_reduce",
4263 .category = FIO_OPT_C_STAT,
4264 .group = FIO_OPT_G_INVALID,
4267 .name = "disable_clat",
4268 .lname = "Disable completion latency stats",
4269 .type = FIO_OPT_BOOL,
4270 .off1 = offsetof(struct thread_options, disable_clat),
4271 .help = "Disable completion latency numbers",
4272 .parent = "gtod_reduce",
4275 .category = FIO_OPT_C_STAT,
4276 .group = FIO_OPT_G_INVALID,
4279 .name = "disable_slat",
4280 .lname = "Disable submission latency stats",
4281 .type = FIO_OPT_BOOL,
4282 .off1 = offsetof(struct thread_options, disable_slat),
4283 .help = "Disable submission latency numbers",
4284 .parent = "gtod_reduce",
4287 .category = FIO_OPT_C_STAT,
4288 .group = FIO_OPT_G_INVALID,
4291 .name = "disable_bw_measurement",
4292 .alias = "disable_bw",
4293 .lname = "Disable bandwidth stats",
4294 .type = FIO_OPT_BOOL,
4295 .off1 = offsetof(struct thread_options, disable_bw),
4296 .help = "Disable bandwidth logging",
4297 .parent = "gtod_reduce",
4300 .category = FIO_OPT_C_STAT,
4301 .group = FIO_OPT_G_INVALID,
4305 .lname = "Dedicated gettimeofday() CPU",
4306 .type = FIO_OPT_INT,
4307 .off1 = offsetof(struct thread_options, gtod_cpu),
4308 .help = "Set up dedicated gettimeofday() thread on this CPU",
4309 .verify = gtod_cpu_verify,
4310 .category = FIO_OPT_C_GENERAL,
4311 .group = FIO_OPT_G_CLOCK,
4314 .name = "unified_rw_reporting",
4315 .lname = "Unified RW Reporting",
4316 .type = FIO_OPT_BOOL,
4317 .off1 = offsetof(struct thread_options, unified_rw_rep),
4318 .help = "Unify reporting across data direction",
4320 .category = FIO_OPT_C_GENERAL,
4321 .group = FIO_OPT_G_INVALID,
4324 .name = "continue_on_error",
4325 .lname = "Continue on error",
4326 .type = FIO_OPT_STR,
4327 .off1 = offsetof(struct thread_options, continue_on_error),
4328 .help = "Continue on non-fatal errors during IO",
4330 .category = FIO_OPT_C_GENERAL,
4331 .group = FIO_OPT_G_ERR,
4334 .oval = ERROR_TYPE_NONE,
4335 .help = "Exit when an error is encountered",
4338 .oval = ERROR_TYPE_READ,
4339 .help = "Continue on read errors only",
4342 .oval = ERROR_TYPE_WRITE,
4343 .help = "Continue on write errors only",
4346 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
4347 .help = "Continue on any IO errors",
4350 .oval = ERROR_TYPE_VERIFY,
4351 .help = "Continue on verify errors only",
4354 .oval = ERROR_TYPE_ANY,
4355 .help = "Continue on all io and verify errors",
4358 .oval = ERROR_TYPE_NONE,
4359 .help = "Alias for 'none'",
4362 .oval = ERROR_TYPE_ANY,
4363 .help = "Alias for 'all'",
4368 .name = "ignore_error",
4369 .lname = "Ignore Error",
4370 .type = FIO_OPT_STR,
4371 .cb = str_ignore_error_cb,
4372 .off1 = offsetof(struct thread_options, ignore_error_nr),
4373 .help = "Set a specific list of errors to ignore",
4375 .category = FIO_OPT_C_GENERAL,
4376 .group = FIO_OPT_G_ERR,
4379 .name = "error_dump",
4380 .lname = "Error Dump",
4381 .type = FIO_OPT_BOOL,
4382 .off1 = offsetof(struct thread_options, error_dump),
4384 .help = "Dump info on each error",
4385 .category = FIO_OPT_C_GENERAL,
4386 .group = FIO_OPT_G_ERR,
4391 .type = FIO_OPT_STR_STORE,
4392 .off1 = offsetof(struct thread_options, profile),
4393 .help = "Select a specific builtin performance test",
4394 .category = FIO_OPT_C_PROFILE,
4395 .group = FIO_OPT_G_INVALID,
4400 .type = FIO_OPT_STR_STORE,
4401 .off1 = offsetof(struct thread_options, cgroup),
4402 .help = "Add job to cgroup of this name",
4403 .category = FIO_OPT_C_GENERAL,
4404 .group = FIO_OPT_G_CGROUP,
4407 .name = "cgroup_nodelete",
4408 .lname = "Cgroup no-delete",
4409 .type = FIO_OPT_BOOL,
4410 .off1 = offsetof(struct thread_options, cgroup_nodelete),
4411 .help = "Do not delete cgroups after job completion",
4414 .category = FIO_OPT_C_GENERAL,
4415 .group = FIO_OPT_G_CGROUP,
4418 .name = "cgroup_weight",
4419 .lname = "Cgroup weight",
4420 .type = FIO_OPT_INT,
4421 .off1 = offsetof(struct thread_options, cgroup_weight),
4422 .help = "Use given weight for cgroup",
4426 .category = FIO_OPT_C_GENERAL,
4427 .group = FIO_OPT_G_CGROUP,
4432 .type = FIO_OPT_INT,
4433 .off1 = offsetof(struct thread_options, uid),
4434 .help = "Run job with this user ID",
4435 .category = FIO_OPT_C_GENERAL,
4436 .group = FIO_OPT_G_CRED,
4440 .lname = "Group ID",
4441 .type = FIO_OPT_INT,
4442 .off1 = offsetof(struct thread_options, gid),
4443 .help = "Run job with this group ID",
4444 .category = FIO_OPT_C_GENERAL,
4445 .group = FIO_OPT_G_CRED,
4450 .type = FIO_OPT_INT,
4451 .off1 = offsetof(struct thread_options, kb_base),
4457 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
4461 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
4464 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
4465 .category = FIO_OPT_C_GENERAL,
4466 .group = FIO_OPT_G_INVALID,
4469 .name = "unit_base",
4470 .lname = "Unit for quantities of data (Bits or Bytes)",
4471 .type = FIO_OPT_INT,
4472 .off1 = offsetof(struct thread_options, unit_base),
4477 .help = "Auto-detect",
4480 .oval = N2S_BYTEPERSEC,
4481 .help = "Normal (byte based)",
4484 .oval = N2S_BITPERSEC,
4485 .help = "Bit based",
4488 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
4489 .category = FIO_OPT_C_GENERAL,
4490 .group = FIO_OPT_G_INVALID,
4493 .name = "hugepage-size",
4494 .lname = "Hugepage size",
4495 .type = FIO_OPT_INT,
4496 .off1 = offsetof(struct thread_options, hugepage_size),
4497 .help = "When using hugepages, specify size of each page",
4498 .def = __fio_stringify(FIO_HUGE_PAGE),
4499 .interval = 1024 * 1024,
4500 .category = FIO_OPT_C_GENERAL,
4501 .group = FIO_OPT_G_INVALID,
4505 .lname = "I/O flow ID",
4506 .type = FIO_OPT_INT,
4507 .off1 = offsetof(struct thread_options, flow_id),
4508 .help = "The flow index ID to use",
4510 .category = FIO_OPT_C_IO,
4511 .group = FIO_OPT_G_IO_FLOW,
4515 .lname = "I/O flow weight",
4516 .type = FIO_OPT_INT,
4517 .off1 = offsetof(struct thread_options, flow),
4518 .help = "Weight for flow control of this job",
4519 .parent = "flow_id",
4522 .category = FIO_OPT_C_IO,
4523 .group = FIO_OPT_G_IO_FLOW,
4526 .name = "flow_watermark",
4527 .lname = "I/O flow watermark",
4528 .type = FIO_OPT_INT,
4529 .off1 = offsetof(struct thread_options, flow_watermark),
4530 .help = "High watermark for flow control. This option"
4531 " should be set to the same value for all threads"
4532 " with non-zero flow.",
4533 .parent = "flow_id",
4536 .category = FIO_OPT_C_IO,
4537 .group = FIO_OPT_G_IO_FLOW,
4540 .name = "flow_sleep",
4541 .lname = "I/O flow sleep",
4542 .type = FIO_OPT_INT,
4543 .off1 = offsetof(struct thread_options, flow_sleep),
4544 .help = "How many microseconds to sleep after being held"
4545 " back by the flow control mechanism",
4546 .parent = "flow_id",
4549 .category = FIO_OPT_C_IO,
4550 .group = FIO_OPT_G_IO_FLOW,
4553 .name = "steadystate",
4554 .lname = "Steady state threshold",
4556 .type = FIO_OPT_STR,
4557 .off1 = offsetof(struct thread_options, ss_state),
4558 .cb = str_steadystate_cb,
4559 .help = "Define the criterion and limit to judge when a job has reached steady state",
4560 .def = "iops_slope:0.01%",
4563 .oval = FIO_SS_IOPS,
4564 .help = "maximum mean deviation of IOPS measurements",
4566 { .ival = "iops_slope",
4567 .oval = FIO_SS_IOPS_SLOPE,
4568 .help = "slope calculated from IOPS measurements",
4572 .help = "maximum mean deviation of bandwidth measurements",
4576 .oval = FIO_SS_BW_SLOPE,
4577 .help = "slope calculated from bandwidth measurements",
4580 .category = FIO_OPT_C_GENERAL,
4581 .group = FIO_OPT_G_RUNTIME,
4584 .name = "steadystate_duration",
4585 .lname = "Steady state duration",
4587 .parent = "steadystate",
4588 .type = FIO_OPT_STR_VAL_TIME,
4589 .off1 = offsetof(struct thread_options, ss_dur),
4590 .help = "Stop workload upon attaining steady state for specified duration",
4594 .category = FIO_OPT_C_GENERAL,
4595 .group = FIO_OPT_G_RUNTIME,
4598 .name = "steadystate_ramp_time",
4599 .lname = "Steady state ramp time",
4601 .parent = "steadystate",
4602 .type = FIO_OPT_STR_VAL_TIME,
4603 .off1 = offsetof(struct thread_options, ss_ramp_time),
4604 .help = "Delay before initiation of data collection for steady state job termination testing",
4608 .category = FIO_OPT_C_GENERAL,
4609 .group = FIO_OPT_G_RUNTIME,
4616 static void add_to_lopt(struct option *lopt, struct fio_option *o,
4617 const char *name, int val)
4619 lopt->name = (char *) name;
4621 if (o->type == FIO_OPT_STR_SET)
4622 lopt->has_arg = optional_argument;
4624 lopt->has_arg = required_argument;
4627 static void options_to_lopts(struct fio_option *opts,
4628 struct option *long_options,
4629 int i, int option_type)
4631 struct fio_option *o = &opts[0];
4633 add_to_lopt(&long_options[i], o, o->name, option_type);
4636 add_to_lopt(&long_options[i], o, o->alias, option_type);
4641 assert(i < FIO_NR_OPTIONS);
4645 void fio_options_set_ioengine_opts(struct option *long_options,
4646 struct thread_data *td)
4651 while (long_options[i].name) {
4652 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
4653 memset(&long_options[i], 0, sizeof(*long_options));
4660 * Just clear out the prior ioengine options.
4665 options_to_lopts(td->io_ops->options, long_options, i,
4666 FIO_GETOPT_IOENGINE);
4669 void fio_options_dup_and_init(struct option *long_options)
4673 options_init(fio_options);
4676 while (long_options[i].name)
4679 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
4682 struct fio_keyword {
4688 static struct fio_keyword fio_keywords[] = {
4690 .word = "$pagesize",
4691 .desc = "Page size in the system",
4694 .word = "$mb_memory",
4695 .desc = "Megabytes of memory online",
4699 .desc = "Number of CPUs online in the system",
4706 void fio_keywords_exit(void)
4708 struct fio_keyword *kw;
4710 kw = &fio_keywords[0];
4718 void fio_keywords_init(void)
4720 unsigned long long mb_memory;
4724 sprintf(buf, "%lu", (unsigned long) page_size);
4725 fio_keywords[0].replace = strdup(buf);
4727 mb_memory = os_phys_mem() / (1024 * 1024);
4728 sprintf(buf, "%llu", mb_memory);
4729 fio_keywords[1].replace = strdup(buf);
4732 sprintf(buf, "%lu", l);
4733 fio_keywords[2].replace = strdup(buf);
4738 static char *bc_calc(char *str)
4740 char buf[128], *tmp;
4745 * No math, just return string
4747 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
4748 !strchr(str, '/')) || strchr(str, '\''))
4752 * Split option from value, we only need to calculate the value
4754 tmp = strchr(str, '=');
4761 * Prevent buffer overflows; such a case isn't reasonable anyway
4763 if (strlen(str) >= 128 || strlen(tmp) > 100)
4766 sprintf(buf, "which %s > /dev/null", BC_APP);
4768 log_err("fio: bc is needed for performing math\n");
4772 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
4773 f = popen(buf, "r");
4777 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
4784 buf[(tmp - str) + ret - 1] = '\0';
4785 memcpy(buf, str, tmp - str);
4791 * Return a copy of the input string with substrings of the form ${VARNAME}
4792 * substituted with the value of the environment variable VARNAME. The
4793 * substitution always occurs, even if VARNAME is empty or the corresponding
4794 * environment variable undefined.
4796 static char *option_dup_subs(const char *opt)
4798 char out[OPT_LEN_MAX+1];
4799 char in[OPT_LEN_MAX+1];
4802 char *ch1, *ch2, *env;
4803 ssize_t nchr = OPT_LEN_MAX;
4806 if (strlen(opt) + 1 > OPT_LEN_MAX) {
4807 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
4811 in[OPT_LEN_MAX] = '\0';
4812 strncpy(in, opt, OPT_LEN_MAX);
4814 while (*inptr && nchr > 0) {
4815 if (inptr[0] == '$' && inptr[1] == '{') {
4816 ch2 = strchr(inptr, '}');
4817 if (ch2 && inptr+1 < ch2) {
4824 envlen = strlen(env);
4825 if (envlen <= nchr) {
4826 memcpy(outptr, env, envlen);
4836 *outptr++ = *inptr++;
4845 * Look for reserved variable names and replace them with real values
4847 static char *fio_keyword_replace(char *opt)
4853 for (i = 0; fio_keywords[i].word != NULL; i++) {
4854 struct fio_keyword *kw = &fio_keywords[i];
4856 while ((s = strstr(opt, kw->word)) != NULL) {
4857 char *new = malloc(strlen(opt) + 1);
4863 * Copy part of the string before the keyword and
4864 * sprintf() the replacement after it.
4866 memcpy(new, opt, olen);
4867 len = sprintf(new + olen, "%s", kw->replace);
4870 * If there's more in the original string, copy that
4873 opt += strlen(kw->word) + olen;
4875 memcpy(new + olen + len, opt, opt - o_org - 1);
4878 * replace opt and free the old opt
4888 * Check for potential math and invoke bc, if possible
4896 static char **dup_and_sub_options(char **opts, int num_opts)
4899 char **opts_copy = malloc(num_opts * sizeof(*opts));
4900 for (i = 0; i < num_opts; i++) {
4901 opts_copy[i] = option_dup_subs(opts[i]);
4904 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
4909 static void show_closest_option(const char *opt)
4911 int best_option, best_distance;
4920 while (name[i] != '\0' && name[i] != '=')
4925 best_distance = INT_MAX;
4927 while (fio_options[i].name) {
4928 distance = string_distance(name, fio_options[i].name);
4929 if (distance < best_distance) {
4930 best_distance = distance;
4936 if (best_option != -1 && string_distance_ok(name, best_distance) &&
4937 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
4938 log_err("Did you mean %s?\n", fio_options[best_option].name);
4943 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
4945 int i, ret, unknown;
4948 sort_options(opts, fio_options, num_opts);
4949 opts_copy = dup_and_sub_options(opts, num_opts);
4951 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
4952 const struct fio_option *o;
4953 int newret = parse_option(opts_copy[i], opts[i], fio_options,
4954 &o, &td->o, &td->opt_list);
4957 fio_option_mark_set(&td->o, o);
4965 opts_copy[i] = NULL;
4972 ret |= ioengine_load(td);
4974 sort_options(opts_copy, td->io_ops->options, num_opts);
4977 for (i = 0; i < num_opts; i++) {
4978 const struct fio_option *o = NULL;
4985 newret = parse_option(opts_copy[i], opts[i],
4986 td->io_ops->options, &o,
4987 td->eo, &td->opt_list);
4991 log_err("Bad option <%s>\n", opts[i]);
4992 show_closest_option(opts[i]);
4995 opts_copy[i] = NULL;
5003 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
5007 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
5009 const struct fio_option *o;
5011 o = find_option_c(fio_options, opt);
5013 fio_option_mark_set(&td->o, o);
5019 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
5022 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
5026 void fio_fill_default_options(struct thread_data *td)
5028 td->o.magic = OPT_MAGIC;
5029 fill_default_options(&td->o, fio_options);
5032 int fio_show_option_help(const char *opt)
5034 return show_cmd_help(fio_options, opt);
5038 * dupe FIO_OPT_STR_STORE options
5040 void fio_options_mem_dupe(struct thread_data *td)
5042 options_mem_dupe(fio_options, &td->o);
5044 if (td->eo && td->io_ops) {
5045 void *oldeo = td->eo;
5047 td->eo = malloc(td->io_ops->option_struct_size);
5048 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
5049 options_mem_dupe(td->io_ops->options, td->eo);
5053 unsigned int fio_get_kb_base(void *data)
5055 struct thread_data *td = cb_data_to_td(data);
5056 struct thread_options *o = &td->o;
5057 unsigned int kb_base = 0;
5060 * This is a hack... For private options, *data is not holding
5061 * a pointer to the thread_options, but to private data. This means
5062 * we can't safely dereference it, but magic is first so mem wise
5063 * it is valid. But this also means that if the job first sets
5064 * kb_base and expects that to be honored by private options,
5065 * it will be disappointed. We will return the global default
5068 if (o && o->magic == OPT_MAGIC)
5069 kb_base = o->kb_base;
5076 int add_option(const struct fio_option *o)
5078 struct fio_option *__o;
5087 if (opt_index + 1 == FIO_MAX_OPTS) {
5088 log_err("fio: FIO_MAX_OPTS is too small\n");
5092 memcpy(&fio_options[opt_index], o, sizeof(*o));
5093 fio_options[opt_index + 1].name = NULL;
5097 void invalidate_profile_options(const char *prof_name)
5099 struct fio_option *o;
5103 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5104 o->type = FIO_OPT_INVALID;
5105 o->prof_name = NULL;
5111 void add_opt_posval(const char *optname, const char *ival, const char *help)
5113 struct fio_option *o;
5116 o = find_option(fio_options, optname);
5120 for (i = 0; i < PARSE_MAX_VP; i++) {
5121 if (o->posval[i].ival)
5124 o->posval[i].ival = ival;
5125 o->posval[i].help = help;
5130 void del_opt_posval(const char *optname, const char *ival)
5132 struct fio_option *o;
5135 o = find_option(fio_options, optname);
5139 for (i = 0; i < PARSE_MAX_VP; i++) {
5140 if (!o->posval[i].ival)
5142 if (strcmp(o->posval[i].ival, ival))
5145 o->posval[i].ival = NULL;
5146 o->posval[i].help = NULL;
5150 void fio_options_free(struct thread_data *td)
5152 options_free(fio_options, &td->o);
5153 if (td->eo && td->io_ops && td->io_ops->options) {
5154 options_free(td->io_ops->options, td->eo);
5160 struct fio_option *fio_option_find(const char *name)
5162 return find_option(fio_options, name);
5165 static struct fio_option *find_next_opt(struct thread_options *o,
5166 struct fio_option *from,
5169 struct fio_option *opt;
5172 from = &fio_options[0];
5178 if (off1 == from->off1) {
5183 } while (from->name);
5188 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5190 unsigned int opt_off, index, offset;
5192 opt_off = opt - &fio_options[0];
5193 index = opt_off / (8 * sizeof(uint64_t));
5194 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5195 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
5198 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
5200 struct fio_option *opt, *next;
5203 while ((opt = find_next_opt(o, next, off1)) != NULL) {
5204 if (opt_is_set(o, opt))
5213 void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt)
5215 unsigned int opt_off, index, offset;
5217 opt_off = opt - &fio_options[0];
5218 index = opt_off / (8 * sizeof(uint64_t));
5219 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5220 o->set_options[index] |= (uint64_t)1 << offset;