11 #include <netinet/in.h>
17 #include "lib/pattern.h"
21 char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
23 #define cb_data_to_td(data) container_of(data, struct thread_data, o)
25 static struct pattern_fmt_desc fmt_desc[] = {
28 .len = FIELD_SIZE(struct io_u *, offset),
29 .paste = paste_blockoff
34 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
36 static char *get_opt_postfix(const char *str)
38 char *p = strstr(str, ":");
44 strip_blank_front(&p);
49 static int bs_cmp(const void *p1, const void *p2)
51 const struct bssplit *bsp1 = p1;
52 const struct bssplit *bsp2 = p2;
54 return (int) bsp1->perc - (int) bsp2->perc;
57 #define SPLIT_MAX_ENTRY 100
61 unsigned int val1[SPLIT_MAX_ENTRY];
62 unsigned long long val2[SPLIT_MAX_ENTRY];
65 static int split_parse_ddir(struct thread_options *o, struct split *split,
66 enum fio_ddir ddir, char *str, bool absolute)
68 unsigned long long perc;
76 while ((fname = strsep(&str, ":")) != NULL) {
82 perc_str = strstr(fname, "/");
87 if (str_to_decimal(perc_str, &val, 1, o, 0, 0)) {
88 log_err("fio: split conversion failed\n");
93 perc = atoi(perc_str);
106 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
107 log_err("fio: split conversion failed\n");
111 split->val1[i] = val;
112 split->val2[i] = perc;
114 if (i == SPLIT_MAX_ENTRY)
122 static int bssplit_ddir(struct thread_options *o, enum fio_ddir ddir, char *str,
125 unsigned int i, perc, perc_missing;
126 unsigned int max_bs, min_bs;
129 memset(&split, 0, sizeof(split));
131 if (split_parse_ddir(o, &split, ddir, str, data))
138 o->bssplit[ddir] = malloc(split.nr * sizeof(struct bssplit));
139 o->bssplit_nr[ddir] = split.nr;
140 for (i = 0; i < split.nr; i++) {
141 if (split.val1[i] > max_bs)
142 max_bs = split.val1[i];
143 if (split.val1[i] < min_bs)
144 min_bs = split.val1[i];
146 o->bssplit[ddir][i].bs = split.val1[i];
147 o->bssplit[ddir][i].perc =split.val2[i];
151 * Now check if the percentages add up, and how much is missing
153 perc = perc_missing = 0;
154 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
155 struct bssplit *bsp = &o->bssplit[ddir][i];
157 if (bsp->perc == -1U)
163 if (perc > 100 && perc_missing > 1) {
164 log_err("fio: bssplit percentages add to more than 100%%\n");
165 free(o->bssplit[ddir]);
166 o->bssplit[ddir] = NULL;
171 * If values didn't have a percentage set, divide the remains between
175 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
177 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
178 struct bssplit *bsp = &o->bssplit[ddir][i];
180 if (bsp->perc == -1U)
181 bsp->perc = (100 - perc) / perc_missing;
185 o->min_bs[ddir] = min_bs;
186 o->max_bs[ddir] = max_bs;
189 * now sort based on percentages, for ease of lookup
191 qsort(o->bssplit[ddir], o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
195 typedef int (split_parse_fn)(struct thread_options *, enum fio_ddir, char *, bool);
197 static int str_split_parse(struct thread_data *td, char *str,
198 split_parse_fn *fn, bool data)
203 odir = strchr(str, ',');
205 ddir = strchr(odir + 1, ',');
207 ret = fn(&td->o, DDIR_TRIM, ddir + 1, data);
213 op = strdup(odir + 1);
214 ret = fn(&td->o, DDIR_TRIM, op, data);
219 ret = fn(&td->o, DDIR_WRITE, odir + 1, data);
222 ret = fn(&td->o, DDIR_READ, str, data);
228 ret = fn(&td->o, DDIR_WRITE, op, data);
233 ret = fn(&td->o, DDIR_TRIM, op, data);
237 ret = fn(&td->o, DDIR_READ, str, data);
243 static int str_bssplit_cb(void *data, const char *input)
245 struct thread_data *td = cb_data_to_td(data);
249 p = str = strdup(input);
251 strip_blank_front(&str);
252 strip_blank_end(str);
254 ret = str_split_parse(td, str, bssplit_ddir, false);
256 if (parse_dryrun()) {
259 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
260 free(td->o.bssplit[i]);
261 td->o.bssplit[i] = NULL;
262 td->o.bssplit_nr[i] = 0;
270 static int str2error(char *str)
272 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
273 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
274 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
275 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
276 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
277 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
278 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
279 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
280 int i = 0, num = sizeof(err) / sizeof(char *);
283 if (!strcmp(err[i], str))
290 static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
297 if (etype >= ERROR_TYPE_CNT) {
298 log_err("Illegal error type\n");
302 td->o.ignore_error_nr[etype] = 4;
303 error = calloc(4, sizeof(int));
306 while ((fname = strsep(&str, ":")) != NULL) {
312 * grow struct buffer, if needed
314 if (i == td->o.ignore_error_nr[etype]) {
315 td->o.ignore_error_nr[etype] <<= 1;
316 error = realloc(error, td->o.ignore_error_nr[etype]
319 if (fname[0] == 'E') {
320 error[i] = str2error(fname);
322 error[i] = atoi(fname);
324 error[i] = -error[i];
327 log_err("Unknown error %s, please use number value\n",
329 td->o.ignore_error_nr[etype] = 0;
336 td->o.continue_on_error |= 1 << etype;
337 td->o.ignore_error_nr[etype] = i;
338 td->o.ignore_error[etype] = error;
340 td->o.ignore_error_nr[etype] = 0;
348 static int str_ignore_error_cb(void *data, const char *input)
350 struct thread_data *td = cb_data_to_td(data);
353 enum error_type_bit type = 0;
358 p = str = strdup(input);
360 strip_blank_front(&str);
361 strip_blank_end(str);
367 ret = ignore_error_type(td, type, p);
377 static int str_rw_cb(void *data, const char *str)
379 struct thread_data *td = cb_data_to_td(data);
380 struct thread_options *o = &td->o;
389 nr = get_opt_postfix(str);
394 o->ddir_seq_nr = atoi(nr);
398 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
399 log_err("fio: rw postfix parsing failed\n");
404 o->ddir_seq_add = val;
411 static int str_mem_cb(void *data, const char *mem)
413 struct thread_data *td = cb_data_to_td(data);
415 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
416 td->o.mem_type == MEM_MMAPSHARED)
417 td->o.mmapfile = get_opt_postfix(mem);
422 static int fio_clock_source_cb(void *data, const char *str)
424 struct thread_data *td = cb_data_to_td(data);
426 fio_clock_source = td->o.clocksource;
427 fio_clock_source_set = 1;
432 static int str_rwmix_read_cb(void *data, unsigned long long *val)
434 struct thread_data *td = cb_data_to_td(data);
436 td->o.rwmix[DDIR_READ] = *val;
437 td->o.rwmix[DDIR_WRITE] = 100 - *val;
441 static int str_rwmix_write_cb(void *data, unsigned long long *val)
443 struct thread_data *td = cb_data_to_td(data);
445 td->o.rwmix[DDIR_WRITE] = *val;
446 td->o.rwmix[DDIR_READ] = 100 - *val;
450 static int str_exitall_cb(void)
452 exitall_on_terminate = 1;
456 #ifdef FIO_HAVE_CPU_AFFINITY
457 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
459 unsigned int i, index, cpus_in_mask;
460 const long max_cpu = cpus_online();
462 cpus_in_mask = fio_cpu_count(mask);
463 cpu_index = cpu_index % cpus_in_mask;
466 for (i = 0; i < max_cpu; i++) {
467 if (!fio_cpu_isset(mask, i))
470 if (cpu_index != index)
471 fio_cpu_clear(mask, i);
476 return fio_cpu_count(mask);
479 static int str_cpumask_cb(void *data, unsigned long long *val)
481 struct thread_data *td = cb_data_to_td(data);
489 ret = fio_cpuset_init(&td->o.cpumask);
491 log_err("fio: cpuset_init failed\n");
492 td_verror(td, ret, "fio_cpuset_init");
496 max_cpu = cpus_online();
498 for (i = 0; i < sizeof(int) * 8; i++) {
499 if ((1 << i) & *val) {
501 log_err("fio: CPU %d too large (max=%ld)\n", i,
505 dprint(FD_PARSE, "set cpu allowed %d\n", i);
506 fio_cpu_set(&td->o.cpumask, i);
513 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
520 ret = fio_cpuset_init(mask);
522 log_err("fio: cpuset_init failed\n");
523 td_verror(td, ret, "fio_cpuset_init");
527 p = str = strdup(input);
529 strip_blank_front(&str);
530 strip_blank_end(str);
532 max_cpu = cpus_online();
534 while ((cpu = strsep(&str, ",")) != NULL) {
543 while ((cpu2 = strsep(&str2, "-")) != NULL) {
553 while (icpu <= icpu2) {
554 if (icpu >= FIO_MAX_CPUS) {
555 log_err("fio: your OS only supports up to"
556 " %d CPUs\n", (int) FIO_MAX_CPUS);
560 if (icpu >= max_cpu) {
561 log_err("fio: CPU %d too large (max=%ld)\n",
567 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
568 fio_cpu_set(mask, icpu);
579 static int str_cpus_allowed_cb(void *data, const char *input)
581 struct thread_data *td = cb_data_to_td(data);
586 return set_cpus_allowed(td, &td->o.cpumask, input);
589 static int str_verify_cpus_allowed_cb(void *data, const char *input)
591 struct thread_data *td = cb_data_to_td(data);
596 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
600 static int str_log_cpus_allowed_cb(void *data, const char *input)
602 struct thread_data *td = cb_data_to_td(data);
607 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
609 #endif /* CONFIG_ZLIB */
611 #endif /* FIO_HAVE_CPU_AFFINITY */
613 #ifdef CONFIG_LIBNUMA
614 static int str_numa_cpunodes_cb(void *data, char *input)
616 struct thread_data *td = cb_data_to_td(data);
617 struct bitmask *verify_bitmask;
622 /* numa_parse_nodestring() parses a character string list
623 * of nodes into a bit mask. The bit mask is allocated by
624 * numa_allocate_nodemask(), so it should be freed by
625 * numa_free_nodemask().
627 verify_bitmask = numa_parse_nodestring(input);
628 if (verify_bitmask == NULL) {
629 log_err("fio: numa_parse_nodestring failed\n");
630 td_verror(td, 1, "str_numa_cpunodes_cb");
633 numa_free_nodemask(verify_bitmask);
635 td->o.numa_cpunodes = strdup(input);
639 static int str_numa_mpol_cb(void *data, char *input)
641 struct thread_data *td = cb_data_to_td(data);
642 const char * const policy_types[] =
643 { "default", "prefer", "bind", "interleave", "local", NULL };
646 struct bitmask *verify_bitmask;
651 nodelist = strchr(input, ':');
653 /* NUL-terminate mode */
657 for (i = 0; i <= MPOL_LOCAL; i++) {
658 if (!strcmp(input, policy_types[i])) {
659 td->o.numa_mem_mode = i;
663 if (i > MPOL_LOCAL) {
664 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
668 switch (td->o.numa_mem_mode) {
671 * Insist on a nodelist of one node only
674 char *rest = nodelist;
675 while (isdigit(*rest))
678 log_err("fio: one node only for \'prefer\'\n");
682 log_err("fio: one node is needed for \'prefer\'\n");
686 case MPOL_INTERLEAVE:
688 * Default to online nodes with memory if no nodelist
691 nodelist = strdup("all");
696 * Don't allow a nodelist
699 log_err("fio: NO nodelist for \'local\'\n");
705 * Insist on a nodelist
708 log_err("fio: a nodelist is needed for \'bind\'\n");
715 /* numa_parse_nodestring() parses a character string list
716 * of nodes into a bit mask. The bit mask is allocated by
717 * numa_allocate_nodemask(), so it should be freed by
718 * numa_free_nodemask().
720 switch (td->o.numa_mem_mode) {
722 td->o.numa_mem_prefer_node = atoi(nodelist);
724 case MPOL_INTERLEAVE:
726 verify_bitmask = numa_parse_nodestring(nodelist);
727 if (verify_bitmask == NULL) {
728 log_err("fio: numa_parse_nodestring failed\n");
729 td_verror(td, 1, "str_numa_memnodes_cb");
732 td->o.numa_memnodes = strdup(nodelist);
733 numa_free_nodemask(verify_bitmask);
748 static int str_fst_cb(void *data, const char *str)
750 struct thread_data *td = cb_data_to_td(data);
755 td->file_service_nr = 1;
757 switch (td->o.file_service_type) {
758 case FIO_FSERVICE_RANDOM:
759 case FIO_FSERVICE_RR:
760 case FIO_FSERVICE_SEQ:
761 nr = get_opt_postfix(str);
763 td->file_service_nr = atoi(nr);
768 case FIO_FSERVICE_ZIPF:
771 case FIO_FSERVICE_PARETO:
772 val = FIO_DEF_PARETO;
774 case FIO_FSERVICE_GAUSS:
778 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
785 nr = get_opt_postfix(str);
786 if (nr && !str_to_float(nr, &val, 0)) {
787 log_err("fio: file service type random postfix parsing failed\n");
794 switch (td->o.file_service_type) {
795 case FIO_FSERVICE_ZIPF:
797 log_err("fio: zipf theta must be different than 1.0\n");
802 td->zipf_theta = val;
804 case FIO_FSERVICE_PARETO:
805 if (val <= 0.00 || val >= 1.00) {
806 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
813 case FIO_FSERVICE_GAUSS:
814 if (val < 0.00 || val >= 100.00) {
815 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
827 #ifdef CONFIG_SYNC_FILE_RANGE
828 static int str_sfr_cb(void *data, const char *str)
830 struct thread_data *td = cb_data_to_td(data);
831 char *nr = get_opt_postfix(str);
833 td->sync_file_range_nr = 1;
835 td->sync_file_range_nr = atoi(nr);
843 static int zone_split_ddir(struct thread_options *o, enum fio_ddir ddir,
844 char *str, bool absolute)
846 unsigned int i, perc, perc_missing, sperc, sperc_missing;
849 memset(&split, 0, sizeof(split));
851 if (split_parse_ddir(o, &split, ddir, str, absolute))
856 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
857 o->zone_split_nr[ddir] = split.nr;
858 for (i = 0; i < split.nr; i++) {
859 o->zone_split[ddir][i].access_perc = split.val1[i];
861 o->zone_split[ddir][i].size = split.val2[i];
863 o->zone_split[ddir][i].size_perc = split.val2[i];
867 * Now check if the percentages add up, and how much is missing
869 perc = perc_missing = 0;
870 sperc = sperc_missing = 0;
871 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
872 struct zone_split *zsp = &o->zone_split[ddir][i];
874 if (zsp->access_perc == (uint8_t) -1U)
877 perc += zsp->access_perc;
880 if (zsp->size_perc == (uint8_t) -1U)
883 sperc += zsp->size_perc;
887 if (perc > 100 || sperc > 100) {
888 log_err("fio: zone_split percentages add to more than 100%%\n");
889 free(o->zone_split[ddir]);
890 o->zone_split[ddir] = NULL;
894 log_err("fio: access percentage don't add up to 100 for zoned "
895 "random distribution (got=%u)\n", perc);
896 free(o->zone_split[ddir]);
897 o->zone_split[ddir] = NULL;
902 * If values didn't have a percentage set, divide the remains between
906 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
908 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
909 struct zone_split *zsp = &o->zone_split[ddir][i];
911 if (zsp->access_perc == (uint8_t) -1U)
912 zsp->access_perc = (100 - perc) / perc_missing;
916 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
918 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
919 struct zone_split *zsp = &o->zone_split[ddir][i];
921 if (zsp->size_perc == (uint8_t) -1U)
922 zsp->size_perc = (100 - sperc) / sperc_missing;
929 static void __td_zone_gen_index(struct thread_data *td, enum fio_ddir ddir)
931 unsigned int i, j, sprev, aprev;
934 td->zone_state_index[ddir] = malloc(sizeof(struct zone_split_index) * 100);
936 sprev_sz = sprev = aprev = 0;
937 for (i = 0; i < td->o.zone_split_nr[ddir]; i++) {
938 struct zone_split *zsp = &td->o.zone_split[ddir][i];
940 for (j = aprev; j < aprev + zsp->access_perc; j++) {
941 struct zone_split_index *zsi = &td->zone_state_index[ddir][j];
943 zsi->size_perc = sprev + zsp->size_perc;
944 zsi->size_perc_prev = sprev;
946 zsi->size = sprev_sz + zsp->size;
947 zsi->size_prev = sprev_sz;
950 aprev += zsp->access_perc;
951 sprev += zsp->size_perc;
952 sprev_sz += zsp->size;
957 * Generate state table for indexes, so we don't have to do it inline from
960 static void td_zone_gen_index(struct thread_data *td)
964 td->zone_state_index = malloc(DDIR_RWDIR_CNT *
965 sizeof(struct zone_split_index *));
967 for (i = 0; i < DDIR_RWDIR_CNT; i++)
968 __td_zone_gen_index(td, i);
971 static int parse_zoned_distribution(struct thread_data *td, const char *input,
974 const char *pre = absolute ? "zoned_abs:" : "zoned:";
978 p = str = strdup(input);
980 strip_blank_front(&str);
981 strip_blank_end(str);
983 /* We expect it to start like that, bail if not */
984 if (strncmp(str, pre, strlen(pre))) {
985 log_err("fio: mismatch in zoned input <%s>\n", str);
991 ret = str_split_parse(td, str, zone_split_ddir, absolute);
995 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
998 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
1000 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
1001 struct zone_split *zsp = &td->o.zone_split[i][j];
1004 dprint(FD_PARSE, "\t%d: %u/%llu\n", j,
1006 (unsigned long long) zsp->size);
1008 dprint(FD_PARSE, "\t%d: %u/%u\n", j,
1015 if (parse_dryrun()) {
1018 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1019 free(td->o.zone_split[i]);
1020 td->o.zone_split[i] = NULL;
1021 td->o.zone_split_nr[i] = 0;
1028 td_zone_gen_index(td);
1030 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1031 td->o.zone_split_nr[i] = 0;
1037 static int str_random_distribution_cb(void *data, const char *str)
1039 struct thread_data *td = cb_data_to_td(data);
1043 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1045 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1046 val = FIO_DEF_PARETO;
1047 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1049 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1050 return parse_zoned_distribution(td, str, false);
1051 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED_ABS)
1052 return parse_zoned_distribution(td, str, true);
1056 nr = get_opt_postfix(str);
1057 if (nr && !str_to_float(nr, &val, 0)) {
1058 log_err("fio: random postfix parsing failed\n");
1065 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1067 log_err("fio: zipf theta must different than 1.0\n");
1072 td->o.zipf_theta.u.f = val;
1073 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1074 if (val <= 0.00 || val >= 1.00) {
1075 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1080 td->o.pareto_h.u.f = val;
1082 if (val < 0.00 || val >= 100.0) {
1083 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1088 td->o.gauss_dev.u.f = val;
1094 static int str_steadystate_cb(void *data, const char *str)
1096 struct thread_data *td = cb_data_to_td(data);
1102 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1103 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
1104 /* should be impossible to get here */
1105 log_err("fio: unknown steady state criterion\n");
1109 nr = get_opt_postfix(str);
1111 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1116 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1117 pct = strstr(nr, "%");
1120 strip_blank_end(nr);
1121 if (!str_to_float(nr, &val, 0)) {
1122 log_err("fio: could not parse steadystate threshold percentage\n");
1127 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1132 td->o.ss_state |= __FIO_SS_PCT;
1133 td->o.ss_limit.u.f = val;
1134 } else if (td->o.ss_state & __FIO_SS_IOPS) {
1135 if (!str_to_float(nr, &val, 0)) {
1136 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1141 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1146 td->o.ss_limit.u.f = val;
1147 } else { /* bandwidth criterion */
1148 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1149 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1154 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1159 td->o.ss_limit.u.f = (double) ll;
1162 td->ss.state = td->o.ss_state;
1167 * Return next name in the string. Files are separated with ':'. If the ':'
1168 * is escaped with a '\', then that ':' is part of the filename and does not
1169 * indicate a new file.
1171 static char *get_next_name(char **ptr)
1176 if (!str || !strlen(str))
1182 * No colon, we are done
1184 p = strchr(str, ':');
1191 * We got a colon, but it's the first character. Skip and
1199 if (*(p - 1) != '\\') {
1205 memmove(p - 1, p, strlen(p) + 1);
1213 static int get_max_name_idx(char *input)
1215 unsigned int cur_idx;
1218 p = str = strdup(input);
1219 for (cur_idx = 0; ; cur_idx++)
1220 if (get_next_name(&str) == NULL)
1228 * Returns the directory at the index, indexes > entires will be
1229 * assigned via modulo division of the index
1231 int set_name_idx(char *target, size_t tlen, char *input, int index,
1232 bool unique_filename)
1234 unsigned int cur_idx;
1236 char *fname, *str, *p;
1238 p = str = strdup(input);
1240 index %= get_max_name_idx(input);
1241 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1242 fname = get_next_name(&str);
1244 if (client_sockaddr_str[0] && unique_filename) {
1245 len = snprintf(target, tlen, "%s/%s.", fname,
1246 client_sockaddr_str);
1248 len = snprintf(target, tlen, "%s/", fname);
1250 target[tlen - 1] = '\0';
1256 static int str_filename_cb(void *data, const char *input)
1258 struct thread_data *td = cb_data_to_td(data);
1259 char *fname, *str, *p;
1261 p = str = strdup(input);
1263 strip_blank_front(&str);
1264 strip_blank_end(str);
1267 * Ignore what we may already have from nrfiles option.
1269 if (!td->files_index)
1272 while ((fname = get_next_name(&str)) != NULL) {
1275 add_file(td, fname, 0, 1);
1282 static int str_directory_cb(void *data, const char fio_unused *unused)
1284 struct thread_data *td = cb_data_to_td(data);
1286 char *dirname, *str, *p;
1292 p = str = strdup(td->o.directory);
1293 while ((dirname = get_next_name(&str)) != NULL) {
1294 if (lstat(dirname, &sb) < 0) {
1297 log_err("fio: %s is not a directory\n", dirname);
1298 td_verror(td, ret, "lstat");
1301 if (!S_ISDIR(sb.st_mode)) {
1302 log_err("fio: %s is not a directory\n", dirname);
1313 static int str_opendir_cb(void *data, const char fio_unused *str)
1315 struct thread_data *td = cb_data_to_td(data);
1320 if (!td->files_index)
1323 return add_dir_files(td, td->o.opendir);
1326 static int str_buffer_pattern_cb(void *data, const char *input)
1328 struct thread_data *td = cb_data_to_td(data);
1331 /* FIXME: for now buffer pattern does not support formats */
1332 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
1333 MAX_PATTERN_SIZE, NULL, 0, NULL, NULL);
1338 td->o.buffer_pattern_bytes = ret;
1341 * If this job is doing any reading or has compression set,
1342 * ensure that we refill buffers for writes or we could be
1343 * invalidating the pattern through reads.
1345 if (!td->o.compress_percentage && !td_read(td))
1346 td->o.refill_buffers = 0;
1348 td->o.refill_buffers = 1;
1350 td->o.scramble_buffers = 0;
1351 td->o.zero_buffers = 0;
1356 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1358 struct thread_data *td = cb_data_to_td(data);
1360 td->flags |= TD_F_COMPRESS;
1361 td->o.compress_percentage = *il;
1365 static int str_dedupe_cb(void *data, unsigned long long *il)
1367 struct thread_data *td = cb_data_to_td(data);
1369 td->flags |= TD_F_COMPRESS;
1370 td->o.dedupe_percentage = *il;
1371 td->o.refill_buffers = 1;
1375 static int str_verify_pattern_cb(void *data, const char *input)
1377 struct thread_data *td = cb_data_to_td(data);
1380 td->o.verify_fmt_sz = ARRAY_SIZE(td->o.verify_fmt);
1381 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
1382 MAX_PATTERN_SIZE, fmt_desc, sizeof(fmt_desc),
1383 td->o.verify_fmt, &td->o.verify_fmt_sz);
1388 td->o.verify_pattern_bytes = ret;
1390 * VERIFY_* could already be set
1392 if (!fio_option_is_set(&td->o, verify))
1393 td->o.verify = VERIFY_PATTERN;
1398 static int str_gtod_reduce_cb(void *data, int *il)
1400 struct thread_data *td = cb_data_to_td(data);
1403 td->o.disable_lat = !!val;
1404 td->o.disable_clat = !!val;
1405 td->o.disable_slat = !!val;
1406 td->o.disable_bw = !!val;
1407 td->o.clat_percentiles = !val;
1409 td->ts_cache_mask = 63;
1414 static int str_offset_cb(void *data, unsigned long long *__val)
1416 struct thread_data *td = cb_data_to_td(data);
1417 unsigned long long v = *__val;
1419 if (parse_is_percent(v)) {
1420 td->o.start_offset = 0;
1421 td->o.start_offset_percent = -1ULL - v;
1422 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1423 td->o.start_offset_percent);
1425 td->o.start_offset = v;
1430 static int str_size_cb(void *data, unsigned long long *__val)
1432 struct thread_data *td = cb_data_to_td(data);
1433 unsigned long long v = *__val;
1435 if (parse_is_percent(v)) {
1437 td->o.size_percent = -1ULL - v;
1438 dprint(FD_PARSE, "SET size_percent %d\n",
1439 td->o.size_percent);
1446 static int str_write_bw_log_cb(void *data, const char *str)
1448 struct thread_data *td = cb_data_to_td(data);
1451 td->o.bw_log_file = strdup(str);
1453 td->o.write_bw_log = 1;
1457 static int str_write_lat_log_cb(void *data, const char *str)
1459 struct thread_data *td = cb_data_to_td(data);
1462 td->o.lat_log_file = strdup(str);
1464 td->o.write_lat_log = 1;
1468 static int str_write_iops_log_cb(void *data, const char *str)
1470 struct thread_data *td = cb_data_to_td(data);
1473 td->o.iops_log_file = strdup(str);
1475 td->o.write_iops_log = 1;
1479 static int str_write_hist_log_cb(void *data, const char *str)
1481 struct thread_data *td = cb_data_to_td(data);
1484 td->o.hist_log_file = strdup(str);
1486 td->o.write_hist_log = 1;
1491 * str is supposed to be a substring of the strdup'd original string,
1492 * and is valid only if it's a regular file path.
1493 * This function keeps the pointer to the path as needed later.
1495 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1496 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1497 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1499 static int str_ioengine_external_cb(void *data, const char *str)
1501 struct thread_data *td = cb_data_to_td(data);
1506 log_err("fio: null external ioengine path\n");
1510 p = (char *)str; /* str is mutable */
1511 strip_blank_front(&p);
1514 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1515 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1519 td->o.ioengine_so_path = p;
1523 static int rw_verify(struct fio_option *o, void *data)
1525 struct thread_data *td = cb_data_to_td(data);
1527 if (read_only && td_write(td)) {
1528 log_err("fio: job <%s> has write bit set, but fio is in"
1529 " read-only mode\n", td->o.name);
1536 static int gtod_cpu_verify(struct fio_option *o, void *data)
1538 #ifndef FIO_HAVE_CPU_AFFINITY
1539 struct thread_data *td = cb_data_to_td(data);
1541 if (td->o.gtod_cpu) {
1542 log_err("fio: platform must support CPU affinity for"
1543 "gettimeofday() offloading\n");
1552 * Map of job/command line options
1554 struct fio_option fio_options[FIO_MAX_OPTS] = {
1556 .name = "description",
1557 .lname = "Description of job",
1558 .type = FIO_OPT_STR_STORE,
1559 .off1 = offsetof(struct thread_options, description),
1560 .help = "Text job description",
1561 .category = FIO_OPT_C_GENERAL,
1562 .group = FIO_OPT_G_DESC,
1566 .lname = "Job name",
1567 .type = FIO_OPT_STR_STORE,
1568 .off1 = offsetof(struct thread_options, name),
1569 .help = "Name of this job",
1570 .category = FIO_OPT_C_GENERAL,
1571 .group = FIO_OPT_G_DESC,
1575 .lname = "Waitee name",
1576 .type = FIO_OPT_STR_STORE,
1577 .off1 = offsetof(struct thread_options, wait_for),
1578 .help = "Name of the job this one wants to wait for before starting",
1579 .category = FIO_OPT_C_GENERAL,
1580 .group = FIO_OPT_G_DESC,
1584 .lname = "Filename(s)",
1585 .type = FIO_OPT_STR_STORE,
1586 .off1 = offsetof(struct thread_options, filename),
1587 .cb = str_filename_cb,
1588 .prio = -1, /* must come after "directory" */
1589 .help = "File(s) to use for the workload",
1590 .category = FIO_OPT_C_FILE,
1591 .group = FIO_OPT_G_FILENAME,
1594 .name = "directory",
1595 .lname = "Directory",
1596 .type = FIO_OPT_STR_STORE,
1597 .off1 = offsetof(struct thread_options, directory),
1598 .cb = str_directory_cb,
1599 .help = "Directory to store files in",
1600 .category = FIO_OPT_C_FILE,
1601 .group = FIO_OPT_G_FILENAME,
1604 .name = "filename_format",
1605 .lname = "Filename Format",
1606 .type = FIO_OPT_STR_STORE,
1607 .off1 = offsetof(struct thread_options, filename_format),
1608 .prio = -1, /* must come after "directory" */
1609 .help = "Override default $jobname.$jobnum.$filenum naming",
1610 .def = "$jobname.$jobnum.$filenum",
1611 .category = FIO_OPT_C_FILE,
1612 .group = FIO_OPT_G_FILENAME,
1615 .name = "unique_filename",
1616 .lname = "Unique Filename",
1617 .type = FIO_OPT_BOOL,
1618 .off1 = offsetof(struct thread_options, unique_filename),
1619 .help = "For network clients, prefix file with source IP",
1621 .category = FIO_OPT_C_FILE,
1622 .group = FIO_OPT_G_FILENAME,
1626 .lname = "Lockfile",
1627 .type = FIO_OPT_STR,
1628 .off1 = offsetof(struct thread_options, file_lock_mode),
1629 .help = "Lock file when doing IO to it",
1631 .parent = "filename",
1634 .category = FIO_OPT_C_FILE,
1635 .group = FIO_OPT_G_FILENAME,
1638 .oval = FILE_LOCK_NONE,
1639 .help = "No file locking",
1641 { .ival = "exclusive",
1642 .oval = FILE_LOCK_EXCLUSIVE,
1643 .help = "Exclusive file lock",
1646 .ival = "readwrite",
1647 .oval = FILE_LOCK_READWRITE,
1648 .help = "Read vs write lock",
1654 .lname = "Open directory",
1655 .type = FIO_OPT_STR_STORE,
1656 .off1 = offsetof(struct thread_options, opendir),
1657 .cb = str_opendir_cb,
1658 .help = "Recursively add files from this directory and down",
1659 .category = FIO_OPT_C_FILE,
1660 .group = FIO_OPT_G_FILENAME,
1664 .lname = "Read/write",
1665 .alias = "readwrite",
1666 .type = FIO_OPT_STR,
1668 .off1 = offsetof(struct thread_options, td_ddir),
1669 .help = "IO direction",
1671 .verify = rw_verify,
1672 .category = FIO_OPT_C_IO,
1673 .group = FIO_OPT_G_IO_BASIC,
1676 .oval = TD_DDIR_READ,
1677 .help = "Sequential read",
1680 .oval = TD_DDIR_WRITE,
1681 .help = "Sequential write",
1684 .oval = TD_DDIR_TRIM,
1685 .help = "Sequential trim",
1687 { .ival = "randread",
1688 .oval = TD_DDIR_RANDREAD,
1689 .help = "Random read",
1691 { .ival = "randwrite",
1692 .oval = TD_DDIR_RANDWRITE,
1693 .help = "Random write",
1695 { .ival = "randtrim",
1696 .oval = TD_DDIR_RANDTRIM,
1697 .help = "Random trim",
1701 .help = "Sequential read and write mix",
1703 { .ival = "readwrite",
1705 .help = "Sequential read and write mix",
1708 .oval = TD_DDIR_RANDRW,
1709 .help = "Random read and write mix"
1711 { .ival = "trimwrite",
1712 .oval = TD_DDIR_TRIMWRITE,
1713 .help = "Trim and write mix, trims preceding writes"
1718 .name = "rw_sequencer",
1719 .lname = "RW Sequencer",
1720 .type = FIO_OPT_STR,
1721 .off1 = offsetof(struct thread_options, rw_seq),
1722 .help = "IO offset generator modifier",
1723 .def = "sequential",
1724 .category = FIO_OPT_C_IO,
1725 .group = FIO_OPT_G_IO_BASIC,
1727 { .ival = "sequential",
1729 .help = "Generate sequential offsets",
1731 { .ival = "identical",
1732 .oval = RW_SEQ_IDENT,
1733 .help = "Generate identical offsets",
1740 .lname = "IO Engine",
1741 .type = FIO_OPT_STR_STORE,
1742 .off1 = offsetof(struct thread_options, ioengine),
1743 .help = "IO engine to use",
1744 .def = FIO_PREFERRED_ENGINE,
1745 .category = FIO_OPT_C_IO,
1746 .group = FIO_OPT_G_IO_BASIC,
1749 .help = "Use read/write",
1752 .help = "Use pread/pwrite",
1755 .help = "Use readv/writev",
1757 #ifdef CONFIG_PWRITEV
1759 .help = "Use preadv/pwritev",
1762 #ifdef FIO_HAVE_PWRITEV2
1763 { .ival = "pvsync2",
1764 .help = "Use preadv2/pwritev2",
1767 #ifdef CONFIG_LIBAIO
1769 .help = "Linux native asynchronous IO",
1772 #ifdef CONFIG_POSIXAIO
1773 { .ival = "posixaio",
1774 .help = "POSIX asynchronous IO",
1777 #ifdef CONFIG_SOLARISAIO
1778 { .ival = "solarisaio",
1779 .help = "Solaris native asynchronous IO",
1782 #ifdef CONFIG_WINDOWSAIO
1783 { .ival = "windowsaio",
1784 .help = "Windows native asynchronous IO"
1789 .help = "Rados Block Device asynchronous IO"
1793 .help = "Memory mapped IO"
1795 #ifdef CONFIG_LINUX_SPLICE
1797 .help = "splice/vmsplice based IO",
1799 { .ival = "netsplice",
1800 .help = "splice/vmsplice to/from the network",
1803 #ifdef FIO_HAVE_SGIO
1805 .help = "SCSI generic v3 IO",
1809 .help = "Testing engine (no data transfer)",
1812 .help = "Network IO",
1815 .help = "CPU cycle burner engine",
1819 .help = "GUASI IO engine",
1822 #ifdef FIO_HAVE_BINJECT
1823 { .ival = "binject",
1824 .help = "binject direct inject block engine",
1829 .help = "RDMA IO engine",
1832 #ifdef CONFIG_FUSION_AW
1833 { .ival = "fusion-aw-sync",
1834 .help = "Fusion-io atomic write engine",
1837 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1838 { .ival = "e4defrag",
1839 .help = "ext4 defrag engine",
1842 #ifdef CONFIG_LINUX_FALLOCATE
1844 .help = "fallocate() file based engine",
1849 .help = "Glusterfs libgfapi(sync) based engine"
1851 { .ival = "gfapi_async",
1852 .help = "Glusterfs libgfapi(async) based engine"
1855 #ifdef CONFIG_LIBHDFS
1856 { .ival = "libhdfs",
1857 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1860 #ifdef CONFIG_PMEMBLK
1861 { .ival = "pmemblk",
1862 .help = "NVML libpmemblk based IO engine",
1866 #ifdef CONFIG_LINUX_DEVDAX
1867 { .ival = "dev-dax",
1868 .help = "DAX Device based IO engine",
1872 .ival = "filecreate",
1873 .help = "File creation engine",
1875 { .ival = "external",
1876 .help = "Load external engine (append name)",
1877 .cb = str_ioengine_external_cb,
1879 #ifdef CONFIG_LIBPMEM
1880 { .ival = "libpmem",
1881 .help = "NVML libpmem based IO engine",
1888 .lname = "IO Depth",
1889 .type = FIO_OPT_INT,
1890 .off1 = offsetof(struct thread_options, iodepth),
1891 .help = "Number of IO buffers to keep in flight",
1895 .category = FIO_OPT_C_IO,
1896 .group = FIO_OPT_G_IO_BASIC,
1899 .name = "iodepth_batch",
1900 .lname = "IO Depth batch",
1901 .alias = "iodepth_batch_submit",
1902 .type = FIO_OPT_INT,
1903 .off1 = offsetof(struct thread_options, iodepth_batch),
1904 .help = "Number of IO buffers to submit in one go",
1905 .parent = "iodepth",
1909 .category = FIO_OPT_C_IO,
1910 .group = FIO_OPT_G_IO_BASIC,
1913 .name = "iodepth_batch_complete_min",
1914 .lname = "Min IO depth batch complete",
1915 .alias = "iodepth_batch_complete",
1916 .type = FIO_OPT_INT,
1917 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
1918 .help = "Min number of IO buffers to retrieve in one go",
1919 .parent = "iodepth",
1924 .category = FIO_OPT_C_IO,
1925 .group = FIO_OPT_G_IO_BASIC,
1928 .name = "iodepth_batch_complete_max",
1929 .lname = "Max IO depth batch complete",
1930 .type = FIO_OPT_INT,
1931 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
1932 .help = "Max number of IO buffers to retrieve in one go",
1933 .parent = "iodepth",
1937 .category = FIO_OPT_C_IO,
1938 .group = FIO_OPT_G_IO_BASIC,
1941 .name = "iodepth_low",
1942 .lname = "IO Depth batch low",
1943 .type = FIO_OPT_INT,
1944 .off1 = offsetof(struct thread_options, iodepth_low),
1945 .help = "Low water mark for queuing depth",
1946 .parent = "iodepth",
1949 .category = FIO_OPT_C_IO,
1950 .group = FIO_OPT_G_IO_BASIC,
1953 .name = "serialize_overlap",
1954 .lname = "Serialize overlap",
1955 .off1 = offsetof(struct thread_options, serialize_overlap),
1956 .type = FIO_OPT_BOOL,
1957 .help = "Wait for in-flight IOs that collide to complete",
1958 .parent = "iodepth",
1960 .category = FIO_OPT_C_IO,
1961 .group = FIO_OPT_G_IO_BASIC,
1964 .name = "io_submit_mode",
1965 .lname = "IO submit mode",
1966 .type = FIO_OPT_STR,
1967 .off1 = offsetof(struct thread_options, io_submit_mode),
1968 .help = "How IO submissions and completions are done",
1970 .category = FIO_OPT_C_IO,
1971 .group = FIO_OPT_G_IO_BASIC,
1974 .oval = IO_MODE_INLINE,
1975 .help = "Submit and complete IO inline",
1977 { .ival = "offload",
1978 .oval = IO_MODE_OFFLOAD,
1979 .help = "Offload submit and complete to threads",
1986 .type = FIO_OPT_STR_VAL,
1988 .off1 = offsetof(struct thread_options, size),
1989 .help = "Total size of device or files",
1990 .interval = 1024 * 1024,
1991 .category = FIO_OPT_C_IO,
1992 .group = FIO_OPT_G_INVALID,
1996 .alias = "io_limit",
1998 .type = FIO_OPT_STR_VAL,
1999 .off1 = offsetof(struct thread_options, io_size),
2000 .help = "Total size of I/O to be performed",
2001 .interval = 1024 * 1024,
2002 .category = FIO_OPT_C_IO,
2003 .group = FIO_OPT_G_INVALID,
2006 .name = "fill_device",
2007 .lname = "Fill device",
2009 .type = FIO_OPT_BOOL,
2010 .off1 = offsetof(struct thread_options, fill_device),
2011 .help = "Write until an ENOSPC error occurs",
2013 .category = FIO_OPT_C_FILE,
2014 .group = FIO_OPT_G_INVALID,
2018 .lname = "File size",
2019 .type = FIO_OPT_STR_VAL,
2020 .off1 = offsetof(struct thread_options, file_size_low),
2021 .off2 = offsetof(struct thread_options, file_size_high),
2023 .help = "Size of individual files",
2024 .interval = 1024 * 1024,
2025 .category = FIO_OPT_C_FILE,
2026 .group = FIO_OPT_G_INVALID,
2029 .name = "file_append",
2030 .lname = "File append",
2031 .type = FIO_OPT_BOOL,
2032 .off1 = offsetof(struct thread_options, file_append),
2033 .help = "IO will start at the end of the file(s)",
2035 .category = FIO_OPT_C_FILE,
2036 .group = FIO_OPT_G_INVALID,
2040 .lname = "IO offset",
2041 .alias = "fileoffset",
2042 .type = FIO_OPT_STR_VAL,
2043 .cb = str_offset_cb,
2044 .off1 = offsetof(struct thread_options, start_offset),
2045 .help = "Start IO from this offset",
2047 .interval = 1024 * 1024,
2048 .category = FIO_OPT_C_IO,
2049 .group = FIO_OPT_G_INVALID,
2052 .name = "offset_align",
2053 .lname = "IO offset alignment",
2054 .type = FIO_OPT_INT,
2055 .off1 = offsetof(struct thread_options, start_offset_align),
2056 .help = "Start IO from this offset alignment",
2059 .category = FIO_OPT_C_IO,
2060 .group = FIO_OPT_G_INVALID,
2063 .name = "offset_increment",
2064 .lname = "IO offset increment",
2065 .type = FIO_OPT_STR_VAL,
2066 .off1 = offsetof(struct thread_options, offset_increment),
2067 .help = "What is the increment from one offset to the next",
2071 .interval = 1024 * 1024,
2072 .category = FIO_OPT_C_IO,
2073 .group = FIO_OPT_G_INVALID,
2076 .name = "number_ios",
2077 .lname = "Number of IOs to perform",
2078 .type = FIO_OPT_STR_VAL,
2079 .off1 = offsetof(struct thread_options, number_ios),
2080 .help = "Force job completion after this number of IOs",
2082 .category = FIO_OPT_C_IO,
2083 .group = FIO_OPT_G_INVALID,
2087 .lname = "Block size",
2088 .alias = "blocksize",
2089 .type = FIO_OPT_INT,
2090 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2091 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2092 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2094 .help = "Block size unit",
2099 .category = FIO_OPT_C_IO,
2100 .group = FIO_OPT_G_INVALID,
2104 .lname = "Block size align",
2105 .alias = "blockalign",
2106 .type = FIO_OPT_INT,
2107 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2108 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2109 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2111 .help = "IO block offset alignment",
2115 .category = FIO_OPT_C_IO,
2116 .group = FIO_OPT_G_INVALID,
2120 .lname = "Block size range",
2121 .alias = "blocksize_range",
2122 .type = FIO_OPT_RANGE,
2123 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2124 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2125 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2126 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2127 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2128 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2130 .help = "Set block size range (in more detail than bs)",
2134 .category = FIO_OPT_C_IO,
2135 .group = FIO_OPT_G_INVALID,
2139 .lname = "Block size split",
2140 .type = FIO_OPT_STR,
2141 .cb = str_bssplit_cb,
2142 .off1 = offsetof(struct thread_options, bssplit),
2143 .help = "Set a specific mix of block sizes",
2146 .category = FIO_OPT_C_IO,
2147 .group = FIO_OPT_G_INVALID,
2150 .name = "bs_unaligned",
2151 .lname = "Block size unaligned",
2152 .alias = "blocksize_unaligned",
2153 .type = FIO_OPT_STR_SET,
2154 .off1 = offsetof(struct thread_options, bs_unaligned),
2155 .help = "Don't sector align IO buffer sizes",
2158 .category = FIO_OPT_C_IO,
2159 .group = FIO_OPT_G_INVALID,
2162 .name = "bs_is_seq_rand",
2163 .lname = "Block size division is seq/random (not read/write)",
2164 .type = FIO_OPT_BOOL,
2165 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2166 .help = "Consider any blocksize setting to be sequential,random",
2168 .parent = "blocksize",
2169 .category = FIO_OPT_C_IO,
2170 .group = FIO_OPT_G_INVALID,
2173 .name = "randrepeat",
2174 .lname = "Random repeatable",
2175 .type = FIO_OPT_BOOL,
2176 .off1 = offsetof(struct thread_options, rand_repeatable),
2177 .help = "Use repeatable random IO pattern",
2181 .category = FIO_OPT_C_IO,
2182 .group = FIO_OPT_G_RANDOM,
2186 .lname = "The random generator seed",
2187 .type = FIO_OPT_STR_VAL,
2188 .off1 = offsetof(struct thread_options, rand_seed),
2189 .help = "Set the random generator seed value",
2192 .category = FIO_OPT_C_IO,
2193 .group = FIO_OPT_G_RANDOM,
2196 .name = "use_os_rand",
2197 .lname = "Use OS random",
2198 .type = FIO_OPT_DEPRECATED,
2199 .off1 = offsetof(struct thread_options, dep_use_os_rand),
2200 .category = FIO_OPT_C_IO,
2201 .group = FIO_OPT_G_RANDOM,
2204 .name = "norandommap",
2205 .lname = "No randommap",
2206 .type = FIO_OPT_STR_SET,
2207 .off1 = offsetof(struct thread_options, norandommap),
2208 .help = "Accept potential duplicate random blocks",
2212 .category = FIO_OPT_C_IO,
2213 .group = FIO_OPT_G_RANDOM,
2216 .name = "softrandommap",
2217 .lname = "Soft randommap",
2218 .type = FIO_OPT_BOOL,
2219 .off1 = offsetof(struct thread_options, softrandommap),
2220 .help = "Set norandommap if randommap allocation fails",
2221 .parent = "norandommap",
2224 .category = FIO_OPT_C_IO,
2225 .group = FIO_OPT_G_RANDOM,
2228 .name = "random_generator",
2229 .lname = "Random Generator",
2230 .type = FIO_OPT_STR,
2231 .off1 = offsetof(struct thread_options, random_generator),
2232 .help = "Type of random number generator to use",
2233 .def = "tausworthe",
2235 { .ival = "tausworthe",
2236 .oval = FIO_RAND_GEN_TAUSWORTHE,
2237 .help = "Strong Tausworthe generator",
2240 .oval = FIO_RAND_GEN_LFSR,
2241 .help = "Variable length LFSR",
2244 .ival = "tausworthe64",
2245 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2246 .help = "64-bit Tausworthe variant",
2249 .category = FIO_OPT_C_IO,
2250 .group = FIO_OPT_G_RANDOM,
2253 .name = "random_distribution",
2254 .lname = "Random Distribution",
2255 .type = FIO_OPT_STR,
2256 .off1 = offsetof(struct thread_options, random_distribution),
2257 .cb = str_random_distribution_cb,
2258 .help = "Random offset distribution generator",
2262 .oval = FIO_RAND_DIST_RANDOM,
2263 .help = "Completely random",
2266 .oval = FIO_RAND_DIST_ZIPF,
2267 .help = "Zipf distribution",
2270 .oval = FIO_RAND_DIST_PARETO,
2271 .help = "Pareto distribution",
2274 .oval = FIO_RAND_DIST_GAUSS,
2275 .help = "Normal (Gaussian) distribution",
2278 .oval = FIO_RAND_DIST_ZONED,
2279 .help = "Zoned random distribution",
2281 { .ival = "zoned_abs",
2282 .oval = FIO_RAND_DIST_ZONED_ABS,
2283 .help = "Zoned absolute random distribution",
2286 .category = FIO_OPT_C_IO,
2287 .group = FIO_OPT_G_RANDOM,
2290 .name = "percentage_random",
2291 .lname = "Percentage Random",
2292 .type = FIO_OPT_INT,
2293 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2294 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2295 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2297 .help = "Percentage of seq/random mix that should be random",
2298 .def = "100,100,100",
2300 .inverse = "percentage_sequential",
2301 .category = FIO_OPT_C_IO,
2302 .group = FIO_OPT_G_RANDOM,
2305 .name = "percentage_sequential",
2306 .lname = "Percentage Sequential",
2307 .type = FIO_OPT_DEPRECATED,
2308 .category = FIO_OPT_C_IO,
2309 .group = FIO_OPT_G_RANDOM,
2312 .name = "allrandrepeat",
2313 .lname = "All Random Repeat",
2314 .type = FIO_OPT_BOOL,
2315 .off1 = offsetof(struct thread_options, allrand_repeatable),
2316 .help = "Use repeatable random numbers for everything",
2318 .category = FIO_OPT_C_IO,
2319 .group = FIO_OPT_G_RANDOM,
2323 .lname = "Number of files",
2324 .alias = "nr_files",
2325 .type = FIO_OPT_INT,
2326 .off1 = offsetof(struct thread_options, nr_files),
2327 .help = "Split job workload between this number of files",
2330 .category = FIO_OPT_C_FILE,
2331 .group = FIO_OPT_G_INVALID,
2334 .name = "openfiles",
2335 .lname = "Number of open files",
2336 .type = FIO_OPT_INT,
2337 .off1 = offsetof(struct thread_options, open_files),
2338 .help = "Number of files to keep open at the same time",
2339 .category = FIO_OPT_C_FILE,
2340 .group = FIO_OPT_G_INVALID,
2343 .name = "file_service_type",
2344 .lname = "File service type",
2345 .type = FIO_OPT_STR,
2347 .off1 = offsetof(struct thread_options, file_service_type),
2348 .help = "How to select which file to service next",
2349 .def = "roundrobin",
2350 .category = FIO_OPT_C_FILE,
2351 .group = FIO_OPT_G_INVALID,
2354 .oval = FIO_FSERVICE_RANDOM,
2355 .help = "Choose a file at random (uniform)",
2358 .oval = FIO_FSERVICE_ZIPF,
2359 .help = "Zipf randomized",
2362 .oval = FIO_FSERVICE_PARETO,
2363 .help = "Pareto randomized",
2366 .oval = FIO_FSERVICE_GAUSS,
2367 .help = "Normal (Gaussian) randomized",
2370 .oval = FIO_FSERVICE_GAUSS,
2371 .help = "Alias for normal",
2373 { .ival = "roundrobin",
2374 .oval = FIO_FSERVICE_RR,
2375 .help = "Round robin select files",
2377 { .ival = "sequential",
2378 .oval = FIO_FSERVICE_SEQ,
2379 .help = "Finish one file before moving to the next",
2382 .parent = "nrfiles",
2385 #ifdef FIO_HAVE_ANY_FALLOCATE
2387 .name = "fallocate",
2388 .lname = "Fallocate",
2389 .type = FIO_OPT_STR,
2390 .off1 = offsetof(struct thread_options, fallocate_mode),
2391 .help = "Whether pre-allocation is performed when laying out files",
2393 .category = FIO_OPT_C_FILE,
2394 .group = FIO_OPT_G_INVALID,
2397 .oval = FIO_FALLOCATE_NONE,
2398 .help = "Do not pre-allocate space",
2401 .oval = FIO_FALLOCATE_NATIVE,
2402 .help = "Use native pre-allocation if possible",
2404 #ifdef CONFIG_POSIX_FALLOCATE
2406 .oval = FIO_FALLOCATE_POSIX,
2407 .help = "Use posix_fallocate()",
2410 #ifdef CONFIG_LINUX_FALLOCATE
2412 .oval = FIO_FALLOCATE_KEEP_SIZE,
2413 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2416 /* Compatibility with former boolean values */
2418 .oval = FIO_FALLOCATE_NONE,
2419 .help = "Alias for 'none'",
2421 #ifdef CONFIG_POSIX_FALLOCATE
2423 .oval = FIO_FALLOCATE_POSIX,
2424 .help = "Alias for 'posix'",
2429 #else /* FIO_HAVE_ANY_FALLOCATE */
2431 .name = "fallocate",
2432 .lname = "Fallocate",
2433 .type = FIO_OPT_UNSUPPORTED,
2434 .help = "Your platform does not support fallocate",
2436 #endif /* FIO_HAVE_ANY_FALLOCATE */
2438 .name = "fadvise_hint",
2439 .lname = "Fadvise hint",
2440 .type = FIO_OPT_STR,
2441 .off1 = offsetof(struct thread_options, fadvise_hint),
2445 .help = "Don't issue fadvise",
2449 .help = "Advise using fio IO pattern",
2452 .oval = F_ADV_RANDOM,
2453 .help = "Advise using FADV_RANDOM",
2455 { .ival = "sequential",
2456 .oval = F_ADV_SEQUENTIAL,
2457 .help = "Advise using FADV_SEQUENTIAL",
2460 .help = "Use fadvise() to advise the kernel on IO pattern",
2462 .category = FIO_OPT_C_FILE,
2463 .group = FIO_OPT_G_INVALID,
2468 .type = FIO_OPT_INT,
2469 .off1 = offsetof(struct thread_options, fsync_blocks),
2470 .help = "Issue fsync for writes every given number of blocks",
2473 .category = FIO_OPT_C_FILE,
2474 .group = FIO_OPT_G_INVALID,
2477 .name = "fdatasync",
2478 .lname = "Fdatasync",
2479 .type = FIO_OPT_INT,
2480 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2481 .help = "Issue fdatasync for writes every given number of blocks",
2484 .category = FIO_OPT_C_FILE,
2485 .group = FIO_OPT_G_INVALID,
2488 .name = "write_barrier",
2489 .lname = "Write barrier",
2490 .type = FIO_OPT_INT,
2491 .off1 = offsetof(struct thread_options, barrier_blocks),
2492 .help = "Make every Nth write a barrier write",
2495 .category = FIO_OPT_C_IO,
2496 .group = FIO_OPT_G_INVALID,
2498 #ifdef CONFIG_SYNC_FILE_RANGE
2500 .name = "sync_file_range",
2501 .lname = "Sync file range",
2503 { .ival = "wait_before",
2504 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2505 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2509 .oval = SYNC_FILE_RANGE_WRITE,
2510 .help = "SYNC_FILE_RANGE_WRITE",
2514 .ival = "wait_after",
2515 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2516 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2520 .type = FIO_OPT_STR_MULTI,
2522 .off1 = offsetof(struct thread_options, sync_file_range),
2523 .help = "Use sync_file_range()",
2524 .category = FIO_OPT_C_FILE,
2525 .group = FIO_OPT_G_INVALID,
2529 .name = "sync_file_range",
2530 .lname = "Sync file range",
2531 .type = FIO_OPT_UNSUPPORTED,
2532 .help = "Your platform does not support sync_file_range",
2537 .lname = "Direct I/O",
2538 .type = FIO_OPT_BOOL,
2539 .off1 = offsetof(struct thread_options, odirect),
2540 .help = "Use O_DIRECT IO (negates buffered)",
2542 .inverse = "buffered",
2543 .category = FIO_OPT_C_IO,
2544 .group = FIO_OPT_G_IO_TYPE,
2548 .lname = "Atomic I/O",
2549 .type = FIO_OPT_BOOL,
2550 .off1 = offsetof(struct thread_options, oatomic),
2551 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2553 .category = FIO_OPT_C_IO,
2554 .group = FIO_OPT_G_IO_TYPE,
2558 .lname = "Buffered I/O",
2559 .type = FIO_OPT_BOOL,
2560 .off1 = offsetof(struct thread_options, odirect),
2562 .help = "Use buffered IO (negates direct)",
2564 .inverse = "direct",
2565 .category = FIO_OPT_C_IO,
2566 .group = FIO_OPT_G_IO_TYPE,
2569 .name = "overwrite",
2570 .lname = "Overwrite",
2571 .type = FIO_OPT_BOOL,
2572 .off1 = offsetof(struct thread_options, overwrite),
2573 .help = "When writing, set whether to overwrite current data",
2575 .category = FIO_OPT_C_FILE,
2576 .group = FIO_OPT_G_INVALID,
2581 .type = FIO_OPT_INT,
2582 .off1 = offsetof(struct thread_options, loops),
2583 .help = "Number of times to run the job",
2586 .category = FIO_OPT_C_GENERAL,
2587 .group = FIO_OPT_G_RUNTIME,
2591 .lname = "Number of jobs",
2592 .type = FIO_OPT_INT,
2593 .off1 = offsetof(struct thread_options, numjobs),
2594 .help = "Duplicate this job this many times",
2597 .category = FIO_OPT_C_GENERAL,
2598 .group = FIO_OPT_G_RUNTIME,
2601 .name = "startdelay",
2602 .lname = "Start delay",
2603 .type = FIO_OPT_STR_VAL_TIME,
2604 .off1 = offsetof(struct thread_options, start_delay),
2605 .off2 = offsetof(struct thread_options, start_delay_high),
2606 .help = "Only start job when this period has passed",
2610 .category = FIO_OPT_C_GENERAL,
2611 .group = FIO_OPT_G_RUNTIME,
2617 .type = FIO_OPT_STR_VAL_TIME,
2618 .off1 = offsetof(struct thread_options, timeout),
2619 .help = "Stop workload when this amount of time has passed",
2623 .category = FIO_OPT_C_GENERAL,
2624 .group = FIO_OPT_G_RUNTIME,
2627 .name = "time_based",
2628 .lname = "Time based",
2629 .type = FIO_OPT_STR_SET,
2630 .off1 = offsetof(struct thread_options, time_based),
2631 .help = "Keep running until runtime/timeout is met",
2632 .category = FIO_OPT_C_GENERAL,
2633 .group = FIO_OPT_G_RUNTIME,
2636 .name = "verify_only",
2637 .lname = "Verify only",
2638 .type = FIO_OPT_STR_SET,
2639 .off1 = offsetof(struct thread_options, verify_only),
2640 .help = "Verifies previously written data is still valid",
2641 .category = FIO_OPT_C_GENERAL,
2642 .group = FIO_OPT_G_RUNTIME,
2645 .name = "ramp_time",
2646 .lname = "Ramp time",
2647 .type = FIO_OPT_STR_VAL_TIME,
2648 .off1 = offsetof(struct thread_options, ramp_time),
2649 .help = "Ramp up time before measuring performance",
2652 .category = FIO_OPT_C_GENERAL,
2653 .group = FIO_OPT_G_RUNTIME,
2656 .name = "clocksource",
2657 .lname = "Clock source",
2658 .type = FIO_OPT_STR,
2659 .cb = fio_clock_source_cb,
2660 .off1 = offsetof(struct thread_options, clocksource),
2661 .help = "What type of timing source to use",
2662 .category = FIO_OPT_C_GENERAL,
2663 .group = FIO_OPT_G_CLOCK,
2665 #ifdef CONFIG_GETTIMEOFDAY
2666 { .ival = "gettimeofday",
2668 .help = "Use gettimeofday(2) for timing",
2671 #ifdef CONFIG_CLOCK_GETTIME
2672 { .ival = "clock_gettime",
2673 .oval = CS_CGETTIME,
2674 .help = "Use clock_gettime(2) for timing",
2677 #ifdef ARCH_HAVE_CPU_CLOCK
2679 .oval = CS_CPUCLOCK,
2680 .help = "Use CPU private clock",
2688 .lname = "I/O Memory",
2689 .type = FIO_OPT_STR,
2691 .off1 = offsetof(struct thread_options, mem_type),
2692 .help = "Backing type for IO buffers",
2694 .category = FIO_OPT_C_IO,
2695 .group = FIO_OPT_G_INVALID,
2699 .help = "Use malloc(3) for IO buffers",
2701 #ifndef CONFIG_NO_SHM
2704 .help = "Use shared memory segments for IO buffers",
2706 #ifdef FIO_HAVE_HUGETLB
2707 { .ival = "shmhuge",
2708 .oval = MEM_SHMHUGE,
2709 .help = "Like shm, but use huge pages",
2715 .help = "Use mmap(2) (file or anon) for IO buffers",
2717 { .ival = "mmapshared",
2718 .oval = MEM_MMAPSHARED,
2719 .help = "Like mmap, but use the shared flag",
2721 #ifdef FIO_HAVE_HUGETLB
2722 { .ival = "mmaphuge",
2723 .oval = MEM_MMAPHUGE,
2724 .help = "Like mmap, but use huge pages",
2728 { .ival = "cudamalloc",
2729 .oval = MEM_CUDA_MALLOC,
2730 .help = "Allocate GPU device memory for GPUDirect RDMA",
2736 .name = "iomem_align",
2737 .alias = "mem_align",
2738 .lname = "I/O memory alignment",
2739 .type = FIO_OPT_INT,
2740 .off1 = offsetof(struct thread_options, mem_align),
2742 .help = "IO memory buffer offset alignment",
2746 .category = FIO_OPT_C_IO,
2747 .group = FIO_OPT_G_INVALID,
2752 .type = FIO_OPT_STR,
2753 .off1 = offsetof(struct thread_options, verify),
2754 .help = "Verify data written",
2756 .category = FIO_OPT_C_IO,
2757 .group = FIO_OPT_G_VERIFY,
2760 .oval = VERIFY_NONE,
2761 .help = "Don't do IO verification",
2765 .help = "Use md5 checksums for verification",
2768 .oval = VERIFY_CRC64,
2769 .help = "Use crc64 checksums for verification",
2772 .oval = VERIFY_CRC32,
2773 .help = "Use crc32 checksums for verification",
2775 { .ival = "crc32c-intel",
2776 .oval = VERIFY_CRC32C,
2777 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2780 .oval = VERIFY_CRC32C,
2781 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2784 .oval = VERIFY_CRC16,
2785 .help = "Use crc16 checksums for verification",
2788 .oval = VERIFY_CRC7,
2789 .help = "Use crc7 checksums for verification",
2792 .oval = VERIFY_SHA1,
2793 .help = "Use sha1 checksums for verification",
2796 .oval = VERIFY_SHA256,
2797 .help = "Use sha256 checksums for verification",
2800 .oval = VERIFY_SHA512,
2801 .help = "Use sha512 checksums for verification",
2803 { .ival = "sha3-224",
2804 .oval = VERIFY_SHA3_224,
2805 .help = "Use sha3-224 checksums for verification",
2807 { .ival = "sha3-256",
2808 .oval = VERIFY_SHA3_256,
2809 .help = "Use sha3-256 checksums for verification",
2811 { .ival = "sha3-384",
2812 .oval = VERIFY_SHA3_384,
2813 .help = "Use sha3-384 checksums for verification",
2815 { .ival = "sha3-512",
2816 .oval = VERIFY_SHA3_512,
2817 .help = "Use sha3-512 checksums for verification",
2820 .oval = VERIFY_XXHASH,
2821 .help = "Use xxhash checksums for verification",
2823 /* Meta information was included into verify_header,
2824 * 'meta' verification is implied by default. */
2826 .oval = VERIFY_HDR_ONLY,
2827 .help = "Use io information for verification. "
2828 "Now is implied by default, thus option is obsolete, "
2831 { .ival = "pattern",
2832 .oval = VERIFY_PATTERN_NO_HDR,
2833 .help = "Verify strict pattern",
2837 .oval = VERIFY_NULL,
2838 .help = "Pretend to verify",
2843 .name = "do_verify",
2844 .lname = "Perform verify step",
2845 .type = FIO_OPT_BOOL,
2846 .off1 = offsetof(struct thread_options, do_verify),
2847 .help = "Run verification stage after write",
2851 .category = FIO_OPT_C_IO,
2852 .group = FIO_OPT_G_VERIFY,
2855 .name = "verifysort",
2856 .lname = "Verify sort",
2857 .type = FIO_OPT_BOOL,
2858 .off1 = offsetof(struct thread_options, verifysort),
2859 .help = "Sort written verify blocks for read back",
2863 .category = FIO_OPT_C_IO,
2864 .group = FIO_OPT_G_VERIFY,
2867 .name = "verifysort_nr",
2868 .lname = "Verify Sort Nr",
2869 .type = FIO_OPT_INT,
2870 .off1 = offsetof(struct thread_options, verifysort_nr),
2871 .help = "Pre-load and sort verify blocks for a read workload",
2876 .category = FIO_OPT_C_IO,
2877 .group = FIO_OPT_G_VERIFY,
2880 .name = "verify_interval",
2881 .lname = "Verify interval",
2882 .type = FIO_OPT_INT,
2883 .off1 = offsetof(struct thread_options, verify_interval),
2884 .minval = 2 * sizeof(struct verify_header),
2885 .help = "Store verify buffer header every N bytes",
2888 .interval = 2 * sizeof(struct verify_header),
2889 .category = FIO_OPT_C_IO,
2890 .group = FIO_OPT_G_VERIFY,
2893 .name = "verify_offset",
2894 .lname = "Verify offset",
2895 .type = FIO_OPT_INT,
2896 .help = "Offset verify header location by N bytes",
2897 .off1 = offsetof(struct thread_options, verify_offset),
2898 .minval = sizeof(struct verify_header),
2901 .category = FIO_OPT_C_IO,
2902 .group = FIO_OPT_G_VERIFY,
2905 .name = "verify_pattern",
2906 .lname = "Verify pattern",
2907 .type = FIO_OPT_STR,
2908 .cb = str_verify_pattern_cb,
2909 .off1 = offsetof(struct thread_options, verify_pattern),
2910 .help = "Fill pattern for IO buffers",
2913 .category = FIO_OPT_C_IO,
2914 .group = FIO_OPT_G_VERIFY,
2917 .name = "verify_fatal",
2918 .lname = "Verify fatal",
2919 .type = FIO_OPT_BOOL,
2920 .off1 = offsetof(struct thread_options, verify_fatal),
2922 .help = "Exit on a single verify failure, don't continue",
2925 .category = FIO_OPT_C_IO,
2926 .group = FIO_OPT_G_VERIFY,
2929 .name = "verify_dump",
2930 .lname = "Verify dump",
2931 .type = FIO_OPT_BOOL,
2932 .off1 = offsetof(struct thread_options, verify_dump),
2934 .help = "Dump contents of good and bad blocks on failure",
2937 .category = FIO_OPT_C_IO,
2938 .group = FIO_OPT_G_VERIFY,
2941 .name = "verify_async",
2942 .lname = "Verify asynchronously",
2943 .type = FIO_OPT_INT,
2944 .off1 = offsetof(struct thread_options, verify_async),
2946 .help = "Number of async verifier threads to use",
2949 .category = FIO_OPT_C_IO,
2950 .group = FIO_OPT_G_VERIFY,
2953 .name = "verify_backlog",
2954 .lname = "Verify backlog",
2955 .type = FIO_OPT_STR_VAL,
2956 .off1 = offsetof(struct thread_options, verify_backlog),
2957 .help = "Verify after this number of blocks are written",
2960 .category = FIO_OPT_C_IO,
2961 .group = FIO_OPT_G_VERIFY,
2964 .name = "verify_backlog_batch",
2965 .lname = "Verify backlog batch",
2966 .type = FIO_OPT_INT,
2967 .off1 = offsetof(struct thread_options, verify_batch),
2968 .help = "Verify this number of IO blocks",
2971 .category = FIO_OPT_C_IO,
2972 .group = FIO_OPT_G_VERIFY,
2974 #ifdef FIO_HAVE_CPU_AFFINITY
2976 .name = "verify_async_cpus",
2977 .lname = "Async verify CPUs",
2978 .type = FIO_OPT_STR,
2979 .cb = str_verify_cpus_allowed_cb,
2980 .off1 = offsetof(struct thread_options, verify_cpumask),
2981 .help = "Set CPUs allowed for async verify threads",
2982 .parent = "verify_async",
2984 .category = FIO_OPT_C_IO,
2985 .group = FIO_OPT_G_VERIFY,
2989 .name = "verify_async_cpus",
2990 .lname = "Async verify CPUs",
2991 .type = FIO_OPT_UNSUPPORTED,
2992 .help = "Your platform does not support CPU affinities",
2996 .name = "experimental_verify",
2997 .lname = "Experimental Verify",
2998 .off1 = offsetof(struct thread_options, experimental_verify),
2999 .type = FIO_OPT_BOOL,
3000 .help = "Enable experimental verification",
3002 .category = FIO_OPT_C_IO,
3003 .group = FIO_OPT_G_VERIFY,
3006 .name = "verify_state_load",
3007 .lname = "Load verify state",
3008 .off1 = offsetof(struct thread_options, verify_state),
3009 .type = FIO_OPT_BOOL,
3010 .help = "Load verify termination state",
3012 .category = FIO_OPT_C_IO,
3013 .group = FIO_OPT_G_VERIFY,
3016 .name = "verify_state_save",
3017 .lname = "Save verify state",
3018 .off1 = offsetof(struct thread_options, verify_state_save),
3019 .type = FIO_OPT_BOOL,
3021 .help = "Save verify state on termination",
3023 .category = FIO_OPT_C_IO,
3024 .group = FIO_OPT_G_VERIFY,
3026 #ifdef FIO_HAVE_TRIM
3028 .name = "trim_percentage",
3029 .lname = "Trim percentage",
3030 .type = FIO_OPT_INT,
3031 .off1 = offsetof(struct thread_options, trim_percentage),
3034 .help = "Number of verify blocks to trim (i.e., discard)",
3039 .category = FIO_OPT_C_IO,
3040 .group = FIO_OPT_G_TRIM,
3043 .name = "trim_verify_zero",
3044 .lname = "Verify trim zero",
3045 .type = FIO_OPT_BOOL,
3046 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3047 .off1 = offsetof(struct thread_options, trim_zero),
3048 .parent = "trim_percentage",
3051 .category = FIO_OPT_C_IO,
3052 .group = FIO_OPT_G_TRIM,
3055 .name = "trim_backlog",
3056 .lname = "Trim backlog",
3057 .type = FIO_OPT_STR_VAL,
3058 .off1 = offsetof(struct thread_options, trim_backlog),
3059 .help = "Trim after this number of blocks are written",
3060 .parent = "trim_percentage",
3063 .category = FIO_OPT_C_IO,
3064 .group = FIO_OPT_G_TRIM,
3067 .name = "trim_backlog_batch",
3068 .lname = "Trim backlog batch",
3069 .type = FIO_OPT_INT,
3070 .off1 = offsetof(struct thread_options, trim_batch),
3071 .help = "Trim this number of IO blocks",
3072 .parent = "trim_percentage",
3075 .category = FIO_OPT_C_IO,
3076 .group = FIO_OPT_G_TRIM,
3080 .name = "trim_percentage",
3081 .lname = "Trim percentage",
3082 .type = FIO_OPT_UNSUPPORTED,
3083 .help = "Fio does not support TRIM on your platform",
3086 .name = "trim_verify_zero",
3087 .lname = "Verify trim zero",
3088 .type = FIO_OPT_UNSUPPORTED,
3089 .help = "Fio does not support TRIM on your platform",
3092 .name = "trim_backlog",
3093 .lname = "Trim backlog",
3094 .type = FIO_OPT_UNSUPPORTED,
3095 .help = "Fio does not support TRIM on your platform",
3098 .name = "trim_backlog_batch",
3099 .lname = "Trim backlog batch",
3100 .type = FIO_OPT_UNSUPPORTED,
3101 .help = "Fio does not support TRIM on your platform",
3105 .name = "write_iolog",
3106 .lname = "Write I/O log",
3107 .type = FIO_OPT_STR_STORE,
3108 .off1 = offsetof(struct thread_options, write_iolog_file),
3109 .help = "Store IO pattern to file",
3110 .category = FIO_OPT_C_IO,
3111 .group = FIO_OPT_G_IOLOG,
3114 .name = "read_iolog",
3115 .lname = "Read I/O log",
3116 .type = FIO_OPT_STR_STORE,
3117 .off1 = offsetof(struct thread_options, read_iolog_file),
3118 .help = "Playback IO pattern from file",
3119 .category = FIO_OPT_C_IO,
3120 .group = FIO_OPT_G_IOLOG,
3123 .name = "replay_no_stall",
3124 .lname = "Don't stall on replay",
3125 .type = FIO_OPT_BOOL,
3126 .off1 = offsetof(struct thread_options, no_stall),
3128 .parent = "read_iolog",
3130 .help = "Playback IO pattern file as fast as possible without stalls",
3131 .category = FIO_OPT_C_IO,
3132 .group = FIO_OPT_G_IOLOG,
3135 .name = "replay_redirect",
3136 .lname = "Redirect device for replay",
3137 .type = FIO_OPT_STR_STORE,
3138 .off1 = offsetof(struct thread_options, replay_redirect),
3139 .parent = "read_iolog",
3141 .help = "Replay all I/O onto this device, regardless of trace device",
3142 .category = FIO_OPT_C_IO,
3143 .group = FIO_OPT_G_IOLOG,
3146 .name = "replay_scale",
3147 .lname = "Replace offset scale factor",
3148 .type = FIO_OPT_INT,
3149 .off1 = offsetof(struct thread_options, replay_scale),
3150 .parent = "read_iolog",
3152 .help = "Align offsets to this blocksize",
3153 .category = FIO_OPT_C_IO,
3154 .group = FIO_OPT_G_IOLOG,
3157 .name = "replay_align",
3158 .lname = "Replace alignment",
3159 .type = FIO_OPT_INT,
3160 .off1 = offsetof(struct thread_options, replay_align),
3161 .parent = "read_iolog",
3162 .help = "Scale offset down by this factor",
3163 .category = FIO_OPT_C_IO,
3164 .group = FIO_OPT_G_IOLOG,
3168 .name = "exec_prerun",
3169 .lname = "Pre-execute runnable",
3170 .type = FIO_OPT_STR_STORE,
3171 .off1 = offsetof(struct thread_options, exec_prerun),
3172 .help = "Execute this file prior to running job",
3173 .category = FIO_OPT_C_GENERAL,
3174 .group = FIO_OPT_G_INVALID,
3177 .name = "exec_postrun",
3178 .lname = "Post-execute runnable",
3179 .type = FIO_OPT_STR_STORE,
3180 .off1 = offsetof(struct thread_options, exec_postrun),
3181 .help = "Execute this file after running job",
3182 .category = FIO_OPT_C_GENERAL,
3183 .group = FIO_OPT_G_INVALID,
3185 #ifdef FIO_HAVE_IOSCHED_SWITCH
3187 .name = "ioscheduler",
3188 .lname = "I/O scheduler",
3189 .type = FIO_OPT_STR_STORE,
3190 .off1 = offsetof(struct thread_options, ioscheduler),
3191 .help = "Use this IO scheduler on the backing device",
3192 .category = FIO_OPT_C_FILE,
3193 .group = FIO_OPT_G_INVALID,
3197 .name = "ioscheduler",
3198 .lname = "I/O scheduler",
3199 .type = FIO_OPT_UNSUPPORTED,
3200 .help = "Your platform does not support IO scheduler switching",
3205 .lname = "Zone size",
3206 .type = FIO_OPT_STR_VAL,
3207 .off1 = offsetof(struct thread_options, zone_size),
3208 .help = "Amount of data to read per zone",
3210 .interval = 1024 * 1024,
3211 .category = FIO_OPT_C_IO,
3212 .group = FIO_OPT_G_ZONE,
3215 .name = "zonerange",
3216 .lname = "Zone range",
3217 .type = FIO_OPT_STR_VAL,
3218 .off1 = offsetof(struct thread_options, zone_range),
3219 .help = "Give size of an IO zone",
3221 .interval = 1024 * 1024,
3222 .category = FIO_OPT_C_IO,
3223 .group = FIO_OPT_G_ZONE,
3227 .lname = "Zone skip",
3228 .type = FIO_OPT_STR_VAL,
3229 .off1 = offsetof(struct thread_options, zone_skip),
3230 .help = "Space between IO zones",
3232 .interval = 1024 * 1024,
3233 .category = FIO_OPT_C_IO,
3234 .group = FIO_OPT_G_ZONE,
3238 .lname = "Lock memory",
3239 .type = FIO_OPT_STR_VAL,
3240 .off1 = offsetof(struct thread_options, lockmem),
3241 .help = "Lock down this amount of memory (per worker)",
3243 .interval = 1024 * 1024,
3244 .category = FIO_OPT_C_GENERAL,
3245 .group = FIO_OPT_G_INVALID,
3248 .name = "rwmixread",
3249 .lname = "Read/write mix read",
3250 .type = FIO_OPT_INT,
3251 .cb = str_rwmix_read_cb,
3252 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3254 .help = "Percentage of mixed workload that is reads",
3257 .inverse = "rwmixwrite",
3258 .category = FIO_OPT_C_IO,
3259 .group = FIO_OPT_G_RWMIX,
3262 .name = "rwmixwrite",
3263 .lname = "Read/write mix write",
3264 .type = FIO_OPT_INT,
3265 .cb = str_rwmix_write_cb,
3266 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3268 .help = "Percentage of mixed workload that is writes",
3271 .inverse = "rwmixread",
3272 .category = FIO_OPT_C_IO,
3273 .group = FIO_OPT_G_RWMIX,
3276 .name = "rwmixcycle",
3277 .lname = "Read/write mix cycle",
3278 .type = FIO_OPT_DEPRECATED,
3279 .category = FIO_OPT_C_IO,
3280 .group = FIO_OPT_G_RWMIX,
3285 .type = FIO_OPT_INT,
3286 .off1 = offsetof(struct thread_options, nice),
3287 .help = "Set job CPU nice value",
3292 .category = FIO_OPT_C_GENERAL,
3293 .group = FIO_OPT_G_CRED,
3295 #ifdef FIO_HAVE_IOPRIO
3298 .lname = "I/O nice priority",
3299 .type = FIO_OPT_INT,
3300 .off1 = offsetof(struct thread_options, ioprio),
3301 .help = "Set job IO priority value",
3302 .minval = IOPRIO_MIN_PRIO,
3303 .maxval = IOPRIO_MAX_PRIO,
3305 .category = FIO_OPT_C_GENERAL,
3306 .group = FIO_OPT_G_CRED,
3311 .lname = "I/O nice priority",
3312 .type = FIO_OPT_UNSUPPORTED,
3313 .help = "Your platform does not support IO priorities",
3316 #ifdef FIO_HAVE_IOPRIO_CLASS
3317 #ifndef FIO_HAVE_IOPRIO
3318 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3321 .name = "prioclass",
3322 .lname = "I/O nice priority class",
3323 .type = FIO_OPT_INT,
3324 .off1 = offsetof(struct thread_options, ioprio_class),
3325 .help = "Set job IO priority class",
3326 .minval = IOPRIO_MIN_PRIO_CLASS,
3327 .maxval = IOPRIO_MAX_PRIO_CLASS,
3329 .category = FIO_OPT_C_GENERAL,
3330 .group = FIO_OPT_G_CRED,
3334 .name = "prioclass",
3335 .lname = "I/O nice priority class",
3336 .type = FIO_OPT_UNSUPPORTED,
3337 .help = "Your platform does not support IO priority classes",
3341 .name = "thinktime",
3342 .lname = "Thinktime",
3343 .type = FIO_OPT_INT,
3344 .off1 = offsetof(struct thread_options, thinktime),
3345 .help = "Idle time between IO buffers (usec)",
3348 .category = FIO_OPT_C_IO,
3349 .group = FIO_OPT_G_THINKTIME,
3352 .name = "thinktime_spin",
3353 .lname = "Thinktime spin",
3354 .type = FIO_OPT_INT,
3355 .off1 = offsetof(struct thread_options, thinktime_spin),
3356 .help = "Start think time by spinning this amount (usec)",
3359 .parent = "thinktime",
3361 .category = FIO_OPT_C_IO,
3362 .group = FIO_OPT_G_THINKTIME,
3365 .name = "thinktime_blocks",
3366 .lname = "Thinktime blocks",
3367 .type = FIO_OPT_INT,
3368 .off1 = offsetof(struct thread_options, thinktime_blocks),
3369 .help = "IO buffer period between 'thinktime'",
3371 .parent = "thinktime",
3373 .category = FIO_OPT_C_IO,
3374 .group = FIO_OPT_G_THINKTIME,
3378 .lname = "I/O rate",
3379 .type = FIO_OPT_INT,
3380 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3381 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3382 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
3383 .help = "Set bandwidth rate",
3384 .category = FIO_OPT_C_IO,
3385 .group = FIO_OPT_G_RATE,
3390 .lname = "I/O min rate",
3391 .type = FIO_OPT_INT,
3392 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
3393 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
3394 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
3395 .help = "Job must meet this rate or it will be shutdown",
3398 .category = FIO_OPT_C_IO,
3399 .group = FIO_OPT_G_RATE,
3402 .name = "rate_iops",
3403 .lname = "I/O rate IOPS",
3404 .type = FIO_OPT_INT,
3405 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
3406 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
3407 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
3408 .help = "Limit IO used to this number of IO operations/sec",
3410 .category = FIO_OPT_C_IO,
3411 .group = FIO_OPT_G_RATE,
3414 .name = "rate_iops_min",
3415 .lname = "I/O min rate IOPS",
3416 .type = FIO_OPT_INT,
3417 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
3418 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
3419 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
3420 .help = "Job must meet this rate or it will be shut down",
3421 .parent = "rate_iops",
3423 .category = FIO_OPT_C_IO,
3424 .group = FIO_OPT_G_RATE,
3427 .name = "rate_process",
3428 .lname = "Rate Process",
3429 .type = FIO_OPT_STR,
3430 .off1 = offsetof(struct thread_options, rate_process),
3431 .help = "What process controls how rated IO is managed",
3433 .category = FIO_OPT_C_IO,
3434 .group = FIO_OPT_G_RATE,
3437 .oval = RATE_PROCESS_LINEAR,
3438 .help = "Linear rate of IO",
3442 .oval = RATE_PROCESS_POISSON,
3443 .help = "Rate follows Poisson process",
3449 .name = "rate_cycle",
3450 .alias = "ratecycle",
3451 .lname = "I/O rate cycle",
3452 .type = FIO_OPT_INT,
3453 .off1 = offsetof(struct thread_options, ratecycle),
3454 .help = "Window average for rate limits (msec)",
3458 .category = FIO_OPT_C_IO,
3459 .group = FIO_OPT_G_RATE,
3462 .name = "max_latency",
3463 .lname = "Max Latency",
3464 .type = FIO_OPT_INT,
3465 .off1 = offsetof(struct thread_options, max_latency),
3466 .help = "Maximum tolerated IO latency (usec)",
3468 .category = FIO_OPT_C_IO,
3469 .group = FIO_OPT_G_LATPROF,
3472 .name = "latency_target",
3473 .lname = "Latency Target (usec)",
3474 .type = FIO_OPT_STR_VAL_TIME,
3475 .off1 = offsetof(struct thread_options, latency_target),
3476 .help = "Ramp to max queue depth supporting this latency",
3478 .category = FIO_OPT_C_IO,
3479 .group = FIO_OPT_G_LATPROF,
3482 .name = "latency_window",
3483 .lname = "Latency Window (usec)",
3484 .type = FIO_OPT_STR_VAL_TIME,
3485 .off1 = offsetof(struct thread_options, latency_window),
3486 .help = "Time to sustain latency_target",
3488 .category = FIO_OPT_C_IO,
3489 .group = FIO_OPT_G_LATPROF,
3492 .name = "latency_percentile",
3493 .lname = "Latency Percentile",
3494 .type = FIO_OPT_FLOAT_LIST,
3495 .off1 = offsetof(struct thread_options, latency_percentile),
3496 .help = "Percentile of IOs must be below latency_target",
3501 .category = FIO_OPT_C_IO,
3502 .group = FIO_OPT_G_LATPROF,
3505 .name = "invalidate",
3506 .lname = "Cache invalidate",
3507 .type = FIO_OPT_BOOL,
3508 .off1 = offsetof(struct thread_options, invalidate_cache),
3509 .help = "Invalidate buffer/page cache prior to running job",
3511 .category = FIO_OPT_C_IO,
3512 .group = FIO_OPT_G_IO_TYPE,
3516 .lname = "Synchronous I/O",
3517 .type = FIO_OPT_BOOL,
3518 .off1 = offsetof(struct thread_options, sync_io),
3519 .help = "Use O_SYNC for buffered writes",
3521 .parent = "buffered",
3523 .category = FIO_OPT_C_IO,
3524 .group = FIO_OPT_G_IO_TYPE,
3526 #ifdef FIO_HAVE_WRITE_HINT
3528 .name = "write_hint",
3529 .lname = "Write hint",
3530 .type = FIO_OPT_STR,
3531 .off1 = offsetof(struct thread_options, write_hint),
3532 .help = "Set expected write life time",
3533 .category = FIO_OPT_C_ENGINE,
3534 .group = FIO_OPT_G_INVALID,
3537 .oval = RWH_WRITE_LIFE_NONE,
3540 .oval = RWH_WRITE_LIFE_SHORT,
3543 .oval = RWH_WRITE_LIFE_MEDIUM,
3546 .oval = RWH_WRITE_LIFE_LONG,
3548 { .ival = "extreme",
3549 .oval = RWH_WRITE_LIFE_EXTREME,
3555 .name = "create_serialize",
3556 .lname = "Create serialize",
3557 .type = FIO_OPT_BOOL,
3558 .off1 = offsetof(struct thread_options, create_serialize),
3559 .help = "Serialize creation of job files",
3561 .category = FIO_OPT_C_FILE,
3562 .group = FIO_OPT_G_INVALID,
3565 .name = "create_fsync",
3566 .lname = "Create fsync",
3567 .type = FIO_OPT_BOOL,
3568 .off1 = offsetof(struct thread_options, create_fsync),
3569 .help = "fsync file after creation",
3571 .category = FIO_OPT_C_FILE,
3572 .group = FIO_OPT_G_INVALID,
3575 .name = "create_on_open",
3576 .lname = "Create on open",
3577 .type = FIO_OPT_BOOL,
3578 .off1 = offsetof(struct thread_options, create_on_open),
3579 .help = "Create files when they are opened for IO",
3581 .category = FIO_OPT_C_FILE,
3582 .group = FIO_OPT_G_INVALID,
3585 .name = "create_only",
3586 .lname = "Create Only",
3587 .type = FIO_OPT_BOOL,
3588 .off1 = offsetof(struct thread_options, create_only),
3589 .help = "Only perform file creation phase",
3590 .category = FIO_OPT_C_FILE,
3594 .name = "allow_file_create",
3595 .lname = "Allow file create",
3596 .type = FIO_OPT_BOOL,
3597 .off1 = offsetof(struct thread_options, allow_create),
3598 .help = "Permit fio to create files, if they don't exist",
3600 .category = FIO_OPT_C_FILE,
3601 .group = FIO_OPT_G_FILENAME,
3604 .name = "allow_mounted_write",
3605 .lname = "Allow mounted write",
3606 .type = FIO_OPT_BOOL,
3607 .off1 = offsetof(struct thread_options, allow_mounted_write),
3608 .help = "Allow writes to a mounted partition",
3610 .category = FIO_OPT_C_FILE,
3611 .group = FIO_OPT_G_FILENAME,
3615 .lname = "Pre-read files",
3616 .type = FIO_OPT_BOOL,
3617 .off1 = offsetof(struct thread_options, pre_read),
3618 .help = "Pre-read files before starting official testing",
3620 .category = FIO_OPT_C_FILE,
3621 .group = FIO_OPT_G_INVALID,
3623 #ifdef FIO_HAVE_CPU_AFFINITY
3626 .lname = "CPU mask",
3627 .type = FIO_OPT_INT,
3628 .cb = str_cpumask_cb,
3629 .off1 = offsetof(struct thread_options, cpumask),
3630 .help = "CPU affinity mask",
3631 .category = FIO_OPT_C_GENERAL,
3632 .group = FIO_OPT_G_CRED,
3635 .name = "cpus_allowed",
3636 .lname = "CPUs allowed",
3637 .type = FIO_OPT_STR,
3638 .cb = str_cpus_allowed_cb,
3639 .off1 = offsetof(struct thread_options, cpumask),
3640 .help = "Set CPUs allowed",
3641 .category = FIO_OPT_C_GENERAL,
3642 .group = FIO_OPT_G_CRED,
3645 .name = "cpus_allowed_policy",
3646 .lname = "CPUs allowed distribution policy",
3647 .type = FIO_OPT_STR,
3648 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
3649 .help = "Distribution policy for cpus_allowed",
3650 .parent = "cpus_allowed",
3654 .oval = FIO_CPUS_SHARED,
3655 .help = "Mask shared between threads",
3658 .oval = FIO_CPUS_SPLIT,
3659 .help = "Mask split between threads",
3662 .category = FIO_OPT_C_GENERAL,
3663 .group = FIO_OPT_G_CRED,
3668 .lname = "CPU mask",
3669 .type = FIO_OPT_UNSUPPORTED,
3670 .help = "Your platform does not support CPU affinities",
3673 .name = "cpus_allowed",
3674 .lname = "CPUs allowed",
3675 .type = FIO_OPT_UNSUPPORTED,
3676 .help = "Your platform does not support CPU affinities",
3679 .name = "cpus_allowed_policy",
3680 .lname = "CPUs allowed distribution policy",
3681 .type = FIO_OPT_UNSUPPORTED,
3682 .help = "Your platform does not support CPU affinities",
3685 #ifdef CONFIG_LIBNUMA
3687 .name = "numa_cpu_nodes",
3688 .lname = "NUMA CPU Nodes",
3689 .type = FIO_OPT_STR,
3690 .cb = str_numa_cpunodes_cb,
3691 .off1 = offsetof(struct thread_options, numa_cpunodes),
3692 .help = "NUMA CPU nodes bind",
3693 .category = FIO_OPT_C_GENERAL,
3694 .group = FIO_OPT_G_INVALID,
3697 .name = "numa_mem_policy",
3698 .lname = "NUMA Memory Policy",
3699 .type = FIO_OPT_STR,
3700 .cb = str_numa_mpol_cb,
3701 .off1 = offsetof(struct thread_options, numa_memnodes),
3702 .help = "NUMA memory policy setup",
3703 .category = FIO_OPT_C_GENERAL,
3704 .group = FIO_OPT_G_INVALID,
3708 .name = "numa_cpu_nodes",
3709 .lname = "NUMA CPU Nodes",
3710 .type = FIO_OPT_UNSUPPORTED,
3711 .help = "Build fio with libnuma-dev(el) to enable this option",
3714 .name = "numa_mem_policy",
3715 .lname = "NUMA Memory Policy",
3716 .type = FIO_OPT_UNSUPPORTED,
3717 .help = "Build fio with libnuma-dev(el) to enable this option",
3722 .name = "gpu_dev_id",
3723 .lname = "GPU device ID",
3724 .type = FIO_OPT_INT,
3725 .off1 = offsetof(struct thread_options, gpu_dev_id),
3726 .help = "Set GPU device ID for GPUDirect RDMA",
3728 .category = FIO_OPT_C_GENERAL,
3729 .group = FIO_OPT_G_INVALID,
3733 .name = "end_fsync",
3734 .lname = "End fsync",
3735 .type = FIO_OPT_BOOL,
3736 .off1 = offsetof(struct thread_options, end_fsync),
3737 .help = "Include fsync at the end of job",
3739 .category = FIO_OPT_C_FILE,
3740 .group = FIO_OPT_G_INVALID,
3743 .name = "fsync_on_close",
3744 .lname = "Fsync on close",
3745 .type = FIO_OPT_BOOL,
3746 .off1 = offsetof(struct thread_options, fsync_on_close),
3747 .help = "fsync files on close",
3749 .category = FIO_OPT_C_FILE,
3750 .group = FIO_OPT_G_INVALID,
3754 .lname = "Unlink file",
3755 .type = FIO_OPT_BOOL,
3756 .off1 = offsetof(struct thread_options, unlink),
3757 .help = "Unlink created files after job has completed",
3759 .category = FIO_OPT_C_FILE,
3760 .group = FIO_OPT_G_INVALID,
3763 .name = "unlink_each_loop",
3764 .lname = "Unlink file after each loop of a job",
3765 .type = FIO_OPT_BOOL,
3766 .off1 = offsetof(struct thread_options, unlink_each_loop),
3767 .help = "Unlink created files after each loop in a job has completed",
3769 .category = FIO_OPT_C_FILE,
3770 .group = FIO_OPT_G_INVALID,
3774 .lname = "Exit-all on terminate",
3775 .type = FIO_OPT_STR_SET,
3776 .cb = str_exitall_cb,
3777 .help = "Terminate all jobs when one exits",
3778 .category = FIO_OPT_C_GENERAL,
3779 .group = FIO_OPT_G_PROCESS,
3782 .name = "exitall_on_error",
3783 .lname = "Exit-all on terminate in error",
3784 .type = FIO_OPT_STR_SET,
3785 .off1 = offsetof(struct thread_options, exitall_error),
3786 .help = "Terminate all jobs when one exits in error",
3787 .category = FIO_OPT_C_GENERAL,
3788 .group = FIO_OPT_G_PROCESS,
3791 .name = "stonewall",
3792 .lname = "Wait for previous",
3793 .alias = "wait_for_previous",
3794 .type = FIO_OPT_STR_SET,
3795 .off1 = offsetof(struct thread_options, stonewall),
3796 .help = "Insert a hard barrier between this job and previous",
3797 .category = FIO_OPT_C_GENERAL,
3798 .group = FIO_OPT_G_PROCESS,
3801 .name = "new_group",
3802 .lname = "New group",
3803 .type = FIO_OPT_STR_SET,
3804 .off1 = offsetof(struct thread_options, new_group),
3805 .help = "Mark the start of a new group (for reporting)",
3806 .category = FIO_OPT_C_GENERAL,
3807 .group = FIO_OPT_G_PROCESS,
3812 .type = FIO_OPT_STR_SET,
3813 .off1 = offsetof(struct thread_options, use_thread),
3814 .help = "Use threads instead of processes",
3815 #ifdef CONFIG_NO_SHM
3819 .category = FIO_OPT_C_GENERAL,
3820 .group = FIO_OPT_G_PROCESS,
3823 .name = "per_job_logs",
3824 .lname = "Per Job Logs",
3825 .type = FIO_OPT_BOOL,
3826 .off1 = offsetof(struct thread_options, per_job_logs),
3827 .help = "Include job number in generated log files or not",
3829 .category = FIO_OPT_C_LOG,
3830 .group = FIO_OPT_G_INVALID,
3833 .name = "write_bw_log",
3834 .lname = "Write bandwidth log",
3835 .type = FIO_OPT_STR,
3836 .off1 = offsetof(struct thread_options, bw_log_file),
3837 .cb = str_write_bw_log_cb,
3838 .help = "Write log of bandwidth during run",
3839 .category = FIO_OPT_C_LOG,
3840 .group = FIO_OPT_G_INVALID,
3843 .name = "write_lat_log",
3844 .lname = "Write latency log",
3845 .type = FIO_OPT_STR,
3846 .off1 = offsetof(struct thread_options, lat_log_file),
3847 .cb = str_write_lat_log_cb,
3848 .help = "Write log of latency during run",
3849 .category = FIO_OPT_C_LOG,
3850 .group = FIO_OPT_G_INVALID,
3853 .name = "write_iops_log",
3854 .lname = "Write IOPS log",
3855 .type = FIO_OPT_STR,
3856 .off1 = offsetof(struct thread_options, iops_log_file),
3857 .cb = str_write_iops_log_cb,
3858 .help = "Write log of IOPS during run",
3859 .category = FIO_OPT_C_LOG,
3860 .group = FIO_OPT_G_INVALID,
3863 .name = "log_avg_msec",
3864 .lname = "Log averaging (msec)",
3865 .type = FIO_OPT_INT,
3866 .off1 = offsetof(struct thread_options, log_avg_msec),
3867 .help = "Average bw/iops/lat logs over this period of time",
3869 .category = FIO_OPT_C_LOG,
3870 .group = FIO_OPT_G_INVALID,
3873 .name = "log_hist_msec",
3874 .lname = "Log histograms (msec)",
3875 .type = FIO_OPT_INT,
3876 .off1 = offsetof(struct thread_options, log_hist_msec),
3877 .help = "Dump completion latency histograms at frequency of this time value",
3879 .category = FIO_OPT_C_LOG,
3880 .group = FIO_OPT_G_INVALID,
3883 .name = "log_hist_coarseness",
3884 .lname = "Histogram logs coarseness",
3885 .type = FIO_OPT_INT,
3886 .off1 = offsetof(struct thread_options, log_hist_coarseness),
3887 .help = "Integer in range [0,6]. Higher coarseness outputs"
3888 " fewer histogram bins per sample. The number of bins for"
3889 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
3891 .category = FIO_OPT_C_LOG,
3892 .group = FIO_OPT_G_INVALID,
3895 .name = "write_hist_log",
3896 .lname = "Write latency histogram logs",
3897 .type = FIO_OPT_STR,
3898 .off1 = offsetof(struct thread_options, hist_log_file),
3899 .cb = str_write_hist_log_cb,
3900 .help = "Write log of latency histograms during run",
3901 .category = FIO_OPT_C_LOG,
3902 .group = FIO_OPT_G_INVALID,
3905 .name = "log_max_value",
3906 .lname = "Log maximum instead of average",
3907 .type = FIO_OPT_BOOL,
3908 .off1 = offsetof(struct thread_options, log_max),
3909 .help = "Log max sample in a window instead of average",
3911 .category = FIO_OPT_C_LOG,
3912 .group = FIO_OPT_G_INVALID,
3915 .name = "log_offset",
3916 .lname = "Log offset of IO",
3917 .type = FIO_OPT_BOOL,
3918 .off1 = offsetof(struct thread_options, log_offset),
3919 .help = "Include offset of IO for each log entry",
3921 .category = FIO_OPT_C_LOG,
3922 .group = FIO_OPT_G_INVALID,
3926 .name = "log_compression",
3927 .lname = "Log compression",
3928 .type = FIO_OPT_INT,
3929 .off1 = offsetof(struct thread_options, log_gz),
3930 .help = "Log in compressed chunks of this size",
3932 .maxval = 512 * 1024 * 1024ULL,
3933 .category = FIO_OPT_C_LOG,
3934 .group = FIO_OPT_G_INVALID,
3936 #ifdef FIO_HAVE_CPU_AFFINITY
3938 .name = "log_compression_cpus",
3939 .lname = "Log Compression CPUs",
3940 .type = FIO_OPT_STR,
3941 .cb = str_log_cpus_allowed_cb,
3942 .off1 = offsetof(struct thread_options, log_gz_cpumask),
3943 .parent = "log_compression",
3944 .help = "Limit log compression to these CPUs",
3945 .category = FIO_OPT_C_LOG,
3946 .group = FIO_OPT_G_INVALID,
3950 .name = "log_compression_cpus",
3951 .lname = "Log Compression CPUs",
3952 .type = FIO_OPT_UNSUPPORTED,
3953 .help = "Your platform does not support CPU affinities",
3957 .name = "log_store_compressed",
3958 .lname = "Log store compressed",
3959 .type = FIO_OPT_BOOL,
3960 .off1 = offsetof(struct thread_options, log_gz_store),
3961 .help = "Store logs in a compressed format",
3962 .category = FIO_OPT_C_LOG,
3963 .group = FIO_OPT_G_INVALID,
3967 .name = "log_compression",
3968 .lname = "Log compression",
3969 .type = FIO_OPT_UNSUPPORTED,
3970 .help = "Install libz-dev(el) to get compression support",
3973 .name = "log_store_compressed",
3974 .lname = "Log store compressed",
3975 .type = FIO_OPT_UNSUPPORTED,
3976 .help = "Install libz-dev(el) to get compression support",
3980 .name = "log_unix_epoch",
3981 .lname = "Log epoch unix",
3982 .type = FIO_OPT_BOOL,
3983 .off1 = offsetof(struct thread_options, log_unix_epoch),
3984 .help = "Use Unix time in log files",
3985 .category = FIO_OPT_C_LOG,
3986 .group = FIO_OPT_G_INVALID,
3989 .name = "block_error_percentiles",
3990 .lname = "Block error percentiles",
3991 .type = FIO_OPT_BOOL,
3992 .off1 = offsetof(struct thread_options, block_error_hist),
3993 .help = "Record trim block errors and make a histogram",
3995 .category = FIO_OPT_C_LOG,
3996 .group = FIO_OPT_G_INVALID,
3999 .name = "bwavgtime",
4000 .lname = "Bandwidth average time",
4001 .type = FIO_OPT_INT,
4002 .off1 = offsetof(struct thread_options, bw_avg_time),
4003 .help = "Time window over which to calculate bandwidth"
4006 .parent = "write_bw_log",
4009 .category = FIO_OPT_C_LOG,
4010 .group = FIO_OPT_G_INVALID,
4013 .name = "iopsavgtime",
4014 .lname = "IOPS average time",
4015 .type = FIO_OPT_INT,
4016 .off1 = offsetof(struct thread_options, iops_avg_time),
4017 .help = "Time window over which to calculate IOPS (msec)",
4019 .parent = "write_iops_log",
4022 .category = FIO_OPT_C_LOG,
4023 .group = FIO_OPT_G_INVALID,
4026 .name = "group_reporting",
4027 .lname = "Group reporting",
4028 .type = FIO_OPT_STR_SET,
4029 .off1 = offsetof(struct thread_options, group_reporting),
4030 .help = "Do reporting on a per-group basis",
4031 .category = FIO_OPT_C_STAT,
4032 .group = FIO_OPT_G_INVALID,
4037 .type = FIO_OPT_BOOL,
4038 .off1 = offsetof(struct thread_options, stats),
4039 .help = "Enable collection of stats",
4041 .category = FIO_OPT_C_STAT,
4042 .group = FIO_OPT_G_INVALID,
4045 .name = "zero_buffers",
4046 .lname = "Zero I/O buffers",
4047 .type = FIO_OPT_STR_SET,
4048 .off1 = offsetof(struct thread_options, zero_buffers),
4049 .help = "Init IO buffers to all zeroes",
4050 .category = FIO_OPT_C_IO,
4051 .group = FIO_OPT_G_IO_BUF,
4054 .name = "refill_buffers",
4055 .lname = "Refill I/O buffers",
4056 .type = FIO_OPT_STR_SET,
4057 .off1 = offsetof(struct thread_options, refill_buffers),
4058 .help = "Refill IO buffers on every IO submit",
4059 .category = FIO_OPT_C_IO,
4060 .group = FIO_OPT_G_IO_BUF,
4063 .name = "scramble_buffers",
4064 .lname = "Scramble I/O buffers",
4065 .type = FIO_OPT_BOOL,
4066 .off1 = offsetof(struct thread_options, scramble_buffers),
4067 .help = "Slightly scramble buffers on every IO submit",
4069 .category = FIO_OPT_C_IO,
4070 .group = FIO_OPT_G_IO_BUF,
4073 .name = "buffer_pattern",
4074 .lname = "Buffer pattern",
4075 .type = FIO_OPT_STR,
4076 .cb = str_buffer_pattern_cb,
4077 .off1 = offsetof(struct thread_options, buffer_pattern),
4078 .help = "Fill pattern for IO buffers",
4079 .category = FIO_OPT_C_IO,
4080 .group = FIO_OPT_G_IO_BUF,
4083 .name = "buffer_compress_percentage",
4084 .lname = "Buffer compression percentage",
4085 .type = FIO_OPT_INT,
4086 .cb = str_buffer_compress_cb,
4087 .off1 = offsetof(struct thread_options, compress_percentage),
4090 .help = "How compressible the buffer is (approximately)",
4092 .category = FIO_OPT_C_IO,
4093 .group = FIO_OPT_G_IO_BUF,
4096 .name = "buffer_compress_chunk",
4097 .lname = "Buffer compression chunk size",
4098 .type = FIO_OPT_INT,
4099 .off1 = offsetof(struct thread_options, compress_chunk),
4100 .parent = "buffer_compress_percentage",
4102 .help = "Size of compressible region in buffer",
4105 .category = FIO_OPT_C_IO,
4106 .group = FIO_OPT_G_IO_BUF,
4109 .name = "dedupe_percentage",
4110 .lname = "Dedupe percentage",
4111 .type = FIO_OPT_INT,
4112 .cb = str_dedupe_cb,
4113 .off1 = offsetof(struct thread_options, dedupe_percentage),
4116 .help = "Percentage of buffers that are dedupable",
4118 .category = FIO_OPT_C_IO,
4119 .group = FIO_OPT_G_IO_BUF,
4122 .name = "clat_percentiles",
4123 .lname = "Completion latency percentiles",
4124 .type = FIO_OPT_BOOL,
4125 .off1 = offsetof(struct thread_options, clat_percentiles),
4126 .help = "Enable the reporting of completion latency percentiles",
4128 .inverse = "lat_percentiles",
4129 .category = FIO_OPT_C_STAT,
4130 .group = FIO_OPT_G_INVALID,
4133 .name = "lat_percentiles",
4134 .lname = "IO latency percentiles",
4135 .type = FIO_OPT_BOOL,
4136 .off1 = offsetof(struct thread_options, lat_percentiles),
4137 .help = "Enable the reporting of IO latency percentiles",
4139 .inverse = "clat_percentiles",
4140 .category = FIO_OPT_C_STAT,
4141 .group = FIO_OPT_G_INVALID,
4144 .name = "percentile_list",
4145 .lname = "Percentile list",
4146 .type = FIO_OPT_FLOAT_LIST,
4147 .off1 = offsetof(struct thread_options, percentile_list),
4148 .off2 = offsetof(struct thread_options, percentile_precision),
4149 .help = "Specify a custom list of percentiles to report for "
4150 "completion latency and block errors",
4151 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
4152 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4155 .category = FIO_OPT_C_STAT,
4156 .group = FIO_OPT_G_INVALID,
4159 .name = "significant_figures",
4160 .lname = "Significant figures",
4161 .type = FIO_OPT_INT,
4162 .off1 = offsetof(struct thread_options, sig_figs),
4165 .help = "Significant figures for output-format set to normal",
4168 .category = FIO_OPT_C_STAT,
4169 .group = FIO_OPT_G_INVALID,
4172 #ifdef FIO_HAVE_DISK_UTIL
4174 .name = "disk_util",
4175 .lname = "Disk utilization",
4176 .type = FIO_OPT_BOOL,
4177 .off1 = offsetof(struct thread_options, do_disk_util),
4178 .help = "Log disk utilization statistics",
4180 .category = FIO_OPT_C_STAT,
4181 .group = FIO_OPT_G_INVALID,
4185 .name = "disk_util",
4186 .lname = "Disk utilization",
4187 .type = FIO_OPT_UNSUPPORTED,
4188 .help = "Your platform does not support disk utilization",
4192 .name = "gtod_reduce",
4193 .lname = "Reduce gettimeofday() calls",
4194 .type = FIO_OPT_BOOL,
4195 .help = "Greatly reduce number of gettimeofday() calls",
4196 .cb = str_gtod_reduce_cb,
4199 .category = FIO_OPT_C_STAT,
4200 .group = FIO_OPT_G_INVALID,
4203 .name = "disable_lat",
4204 .lname = "Disable all latency stats",
4205 .type = FIO_OPT_BOOL,
4206 .off1 = offsetof(struct thread_options, disable_lat),
4207 .help = "Disable latency numbers",
4208 .parent = "gtod_reduce",
4211 .category = FIO_OPT_C_STAT,
4212 .group = FIO_OPT_G_INVALID,
4215 .name = "disable_clat",
4216 .lname = "Disable completion latency stats",
4217 .type = FIO_OPT_BOOL,
4218 .off1 = offsetof(struct thread_options, disable_clat),
4219 .help = "Disable completion latency numbers",
4220 .parent = "gtod_reduce",
4223 .category = FIO_OPT_C_STAT,
4224 .group = FIO_OPT_G_INVALID,
4227 .name = "disable_slat",
4228 .lname = "Disable submission latency stats",
4229 .type = FIO_OPT_BOOL,
4230 .off1 = offsetof(struct thread_options, disable_slat),
4231 .help = "Disable submission latency numbers",
4232 .parent = "gtod_reduce",
4235 .category = FIO_OPT_C_STAT,
4236 .group = FIO_OPT_G_INVALID,
4239 .name = "disable_bw_measurement",
4240 .alias = "disable_bw",
4241 .lname = "Disable bandwidth stats",
4242 .type = FIO_OPT_BOOL,
4243 .off1 = offsetof(struct thread_options, disable_bw),
4244 .help = "Disable bandwidth logging",
4245 .parent = "gtod_reduce",
4248 .category = FIO_OPT_C_STAT,
4249 .group = FIO_OPT_G_INVALID,
4253 .lname = "Dedicated gettimeofday() CPU",
4254 .type = FIO_OPT_INT,
4255 .off1 = offsetof(struct thread_options, gtod_cpu),
4256 .help = "Set up dedicated gettimeofday() thread on this CPU",
4257 .verify = gtod_cpu_verify,
4258 .category = FIO_OPT_C_GENERAL,
4259 .group = FIO_OPT_G_CLOCK,
4262 .name = "unified_rw_reporting",
4263 .lname = "Unified RW Reporting",
4264 .type = FIO_OPT_BOOL,
4265 .off1 = offsetof(struct thread_options, unified_rw_rep),
4266 .help = "Unify reporting across data direction",
4268 .category = FIO_OPT_C_GENERAL,
4269 .group = FIO_OPT_G_INVALID,
4272 .name = "continue_on_error",
4273 .lname = "Continue on error",
4274 .type = FIO_OPT_STR,
4275 .off1 = offsetof(struct thread_options, continue_on_error),
4276 .help = "Continue on non-fatal errors during IO",
4278 .category = FIO_OPT_C_GENERAL,
4279 .group = FIO_OPT_G_ERR,
4282 .oval = ERROR_TYPE_NONE,
4283 .help = "Exit when an error is encountered",
4286 .oval = ERROR_TYPE_READ,
4287 .help = "Continue on read errors only",
4290 .oval = ERROR_TYPE_WRITE,
4291 .help = "Continue on write errors only",
4294 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
4295 .help = "Continue on any IO errors",
4298 .oval = ERROR_TYPE_VERIFY,
4299 .help = "Continue on verify errors only",
4302 .oval = ERROR_TYPE_ANY,
4303 .help = "Continue on all io and verify errors",
4306 .oval = ERROR_TYPE_NONE,
4307 .help = "Alias for 'none'",
4310 .oval = ERROR_TYPE_ANY,
4311 .help = "Alias for 'all'",
4316 .name = "ignore_error",
4317 .lname = "Ignore Error",
4318 .type = FIO_OPT_STR,
4319 .cb = str_ignore_error_cb,
4320 .off1 = offsetof(struct thread_options, ignore_error_nr),
4321 .help = "Set a specific list of errors to ignore",
4323 .category = FIO_OPT_C_GENERAL,
4324 .group = FIO_OPT_G_ERR,
4327 .name = "error_dump",
4328 .lname = "Error Dump",
4329 .type = FIO_OPT_BOOL,
4330 .off1 = offsetof(struct thread_options, error_dump),
4332 .help = "Dump info on each error",
4333 .category = FIO_OPT_C_GENERAL,
4334 .group = FIO_OPT_G_ERR,
4339 .type = FIO_OPT_STR_STORE,
4340 .off1 = offsetof(struct thread_options, profile),
4341 .help = "Select a specific builtin performance test",
4342 .category = FIO_OPT_C_PROFILE,
4343 .group = FIO_OPT_G_INVALID,
4348 .type = FIO_OPT_STR_STORE,
4349 .off1 = offsetof(struct thread_options, cgroup),
4350 .help = "Add job to cgroup of this name",
4351 .category = FIO_OPT_C_GENERAL,
4352 .group = FIO_OPT_G_CGROUP,
4355 .name = "cgroup_nodelete",
4356 .lname = "Cgroup no-delete",
4357 .type = FIO_OPT_BOOL,
4358 .off1 = offsetof(struct thread_options, cgroup_nodelete),
4359 .help = "Do not delete cgroups after job completion",
4362 .category = FIO_OPT_C_GENERAL,
4363 .group = FIO_OPT_G_CGROUP,
4366 .name = "cgroup_weight",
4367 .lname = "Cgroup weight",
4368 .type = FIO_OPT_INT,
4369 .off1 = offsetof(struct thread_options, cgroup_weight),
4370 .help = "Use given weight for cgroup",
4374 .category = FIO_OPT_C_GENERAL,
4375 .group = FIO_OPT_G_CGROUP,
4380 .type = FIO_OPT_INT,
4381 .off1 = offsetof(struct thread_options, uid),
4382 .help = "Run job with this user ID",
4383 .category = FIO_OPT_C_GENERAL,
4384 .group = FIO_OPT_G_CRED,
4388 .lname = "Group ID",
4389 .type = FIO_OPT_INT,
4390 .off1 = offsetof(struct thread_options, gid),
4391 .help = "Run job with this group ID",
4392 .category = FIO_OPT_C_GENERAL,
4393 .group = FIO_OPT_G_CRED,
4398 .type = FIO_OPT_INT,
4399 .off1 = offsetof(struct thread_options, kb_base),
4405 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
4409 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
4412 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
4413 .category = FIO_OPT_C_GENERAL,
4414 .group = FIO_OPT_G_INVALID,
4417 .name = "unit_base",
4418 .lname = "Unit for quantities of data (Bits or Bytes)",
4419 .type = FIO_OPT_INT,
4420 .off1 = offsetof(struct thread_options, unit_base),
4425 .help = "Auto-detect",
4429 .help = "Normal (byte based)",
4433 .help = "Bit based",
4436 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
4437 .category = FIO_OPT_C_GENERAL,
4438 .group = FIO_OPT_G_INVALID,
4441 .name = "hugepage-size",
4442 .lname = "Hugepage size",
4443 .type = FIO_OPT_INT,
4444 .off1 = offsetof(struct thread_options, hugepage_size),
4445 .help = "When using hugepages, specify size of each page",
4446 .def = __fio_stringify(FIO_HUGE_PAGE),
4447 .interval = 1024 * 1024,
4448 .category = FIO_OPT_C_GENERAL,
4449 .group = FIO_OPT_G_INVALID,
4453 .lname = "I/O flow ID",
4454 .type = FIO_OPT_INT,
4455 .off1 = offsetof(struct thread_options, flow_id),
4456 .help = "The flow index ID to use",
4458 .category = FIO_OPT_C_IO,
4459 .group = FIO_OPT_G_IO_FLOW,
4463 .lname = "I/O flow weight",
4464 .type = FIO_OPT_INT,
4465 .off1 = offsetof(struct thread_options, flow),
4466 .help = "Weight for flow control of this job",
4467 .parent = "flow_id",
4470 .category = FIO_OPT_C_IO,
4471 .group = FIO_OPT_G_IO_FLOW,
4474 .name = "flow_watermark",
4475 .lname = "I/O flow watermark",
4476 .type = FIO_OPT_INT,
4477 .off1 = offsetof(struct thread_options, flow_watermark),
4478 .help = "High watermark for flow control. This option"
4479 " should be set to the same value for all threads"
4480 " with non-zero flow.",
4481 .parent = "flow_id",
4484 .category = FIO_OPT_C_IO,
4485 .group = FIO_OPT_G_IO_FLOW,
4488 .name = "flow_sleep",
4489 .lname = "I/O flow sleep",
4490 .type = FIO_OPT_INT,
4491 .off1 = offsetof(struct thread_options, flow_sleep),
4492 .help = "How many microseconds to sleep after being held"
4493 " back by the flow control mechanism",
4494 .parent = "flow_id",
4497 .category = FIO_OPT_C_IO,
4498 .group = FIO_OPT_G_IO_FLOW,
4501 .name = "steadystate",
4502 .lname = "Steady state threshold",
4504 .type = FIO_OPT_STR,
4505 .off1 = offsetof(struct thread_options, ss_state),
4506 .cb = str_steadystate_cb,
4507 .help = "Define the criterion and limit to judge when a job has reached steady state",
4508 .def = "iops_slope:0.01%",
4511 .oval = FIO_SS_IOPS,
4512 .help = "maximum mean deviation of IOPS measurements",
4514 { .ival = "iops_slope",
4515 .oval = FIO_SS_IOPS_SLOPE,
4516 .help = "slope calculated from IOPS measurements",
4520 .help = "maximum mean deviation of bandwidth measurements",
4524 .oval = FIO_SS_BW_SLOPE,
4525 .help = "slope calculated from bandwidth measurements",
4528 .category = FIO_OPT_C_GENERAL,
4529 .group = FIO_OPT_G_RUNTIME,
4532 .name = "steadystate_duration",
4533 .lname = "Steady state duration",
4535 .parent = "steadystate",
4536 .type = FIO_OPT_STR_VAL_TIME,
4537 .off1 = offsetof(struct thread_options, ss_dur),
4538 .help = "Stop workload upon attaining steady state for specified duration",
4542 .category = FIO_OPT_C_GENERAL,
4543 .group = FIO_OPT_G_RUNTIME,
4546 .name = "steadystate_ramp_time",
4547 .lname = "Steady state ramp time",
4549 .parent = "steadystate",
4550 .type = FIO_OPT_STR_VAL_TIME,
4551 .off1 = offsetof(struct thread_options, ss_ramp_time),
4552 .help = "Delay before initiation of data collection for steady state job termination testing",
4556 .category = FIO_OPT_C_GENERAL,
4557 .group = FIO_OPT_G_RUNTIME,
4564 static void add_to_lopt(struct option *lopt, struct fio_option *o,
4565 const char *name, int val)
4567 lopt->name = (char *) name;
4569 if (o->type == FIO_OPT_STR_SET)
4570 lopt->has_arg = optional_argument;
4572 lopt->has_arg = required_argument;
4575 static void options_to_lopts(struct fio_option *opts,
4576 struct option *long_options,
4577 int i, int option_type)
4579 struct fio_option *o = &opts[0];
4581 add_to_lopt(&long_options[i], o, o->name, option_type);
4584 add_to_lopt(&long_options[i], o, o->alias, option_type);
4589 assert(i < FIO_NR_OPTIONS);
4593 void fio_options_set_ioengine_opts(struct option *long_options,
4594 struct thread_data *td)
4599 while (long_options[i].name) {
4600 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
4601 memset(&long_options[i], 0, sizeof(*long_options));
4608 * Just clear out the prior ioengine options.
4613 options_to_lopts(td->io_ops->options, long_options, i,
4614 FIO_GETOPT_IOENGINE);
4617 void fio_options_dup_and_init(struct option *long_options)
4621 options_init(fio_options);
4624 while (long_options[i].name)
4627 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
4630 struct fio_keyword {
4636 static struct fio_keyword fio_keywords[] = {
4638 .word = "$pagesize",
4639 .desc = "Page size in the system",
4642 .word = "$mb_memory",
4643 .desc = "Megabytes of memory online",
4647 .desc = "Number of CPUs online in the system",
4654 void fio_keywords_exit(void)
4656 struct fio_keyword *kw;
4658 kw = &fio_keywords[0];
4666 void fio_keywords_init(void)
4668 unsigned long long mb_memory;
4672 sprintf(buf, "%lu", (unsigned long) page_size);
4673 fio_keywords[0].replace = strdup(buf);
4675 mb_memory = os_phys_mem() / (1024 * 1024);
4676 sprintf(buf, "%llu", mb_memory);
4677 fio_keywords[1].replace = strdup(buf);
4680 sprintf(buf, "%lu", l);
4681 fio_keywords[2].replace = strdup(buf);
4686 static char *bc_calc(char *str)
4688 char buf[128], *tmp;
4693 * No math, just return string
4695 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
4696 !strchr(str, '/')) || strchr(str, '\''))
4700 * Split option from value, we only need to calculate the value
4702 tmp = strchr(str, '=');
4709 * Prevent buffer overflows; such a case isn't reasonable anyway
4711 if (strlen(str) >= 128 || strlen(tmp) > 100)
4714 sprintf(buf, "which %s > /dev/null", BC_APP);
4716 log_err("fio: bc is needed for performing math\n");
4720 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
4721 f = popen(buf, "r");
4725 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
4732 buf[(tmp - str) + ret - 1] = '\0';
4733 memcpy(buf, str, tmp - str);
4739 * Return a copy of the input string with substrings of the form ${VARNAME}
4740 * substituted with the value of the environment variable VARNAME. The
4741 * substitution always occurs, even if VARNAME is empty or the corresponding
4742 * environment variable undefined.
4744 static char *option_dup_subs(const char *opt)
4746 char out[OPT_LEN_MAX+1];
4747 char in[OPT_LEN_MAX+1];
4750 char *ch1, *ch2, *env;
4751 ssize_t nchr = OPT_LEN_MAX;
4754 if (strlen(opt) + 1 > OPT_LEN_MAX) {
4755 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
4759 in[OPT_LEN_MAX] = '\0';
4760 strncpy(in, opt, OPT_LEN_MAX);
4762 while (*inptr && nchr > 0) {
4763 if (inptr[0] == '$' && inptr[1] == '{') {
4764 ch2 = strchr(inptr, '}');
4765 if (ch2 && inptr+1 < ch2) {
4772 envlen = strlen(env);
4773 if (envlen <= nchr) {
4774 memcpy(outptr, env, envlen);
4784 *outptr++ = *inptr++;
4793 * Look for reserved variable names and replace them with real values
4795 static char *fio_keyword_replace(char *opt)
4801 for (i = 0; fio_keywords[i].word != NULL; i++) {
4802 struct fio_keyword *kw = &fio_keywords[i];
4804 while ((s = strstr(opt, kw->word)) != NULL) {
4805 char *new = malloc(strlen(opt) + 1);
4811 * Copy part of the string before the keyword and
4812 * sprintf() the replacement after it.
4814 memcpy(new, opt, olen);
4815 len = sprintf(new + olen, "%s", kw->replace);
4818 * If there's more in the original string, copy that
4821 opt += strlen(kw->word) + olen;
4823 memcpy(new + olen + len, opt, opt - o_org - 1);
4826 * replace opt and free the old opt
4836 * Check for potential math and invoke bc, if possible
4844 static char **dup_and_sub_options(char **opts, int num_opts)
4847 char **opts_copy = malloc(num_opts * sizeof(*opts));
4848 for (i = 0; i < num_opts; i++) {
4849 opts_copy[i] = option_dup_subs(opts[i]);
4852 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
4857 static void show_closest_option(const char *opt)
4859 int best_option, best_distance;
4868 while (name[i] != '\0' && name[i] != '=')
4873 best_distance = INT_MAX;
4875 while (fio_options[i].name) {
4876 distance = string_distance(name, fio_options[i].name);
4877 if (distance < best_distance) {
4878 best_distance = distance;
4884 if (best_option != -1 && string_distance_ok(name, best_distance) &&
4885 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
4886 log_err("Did you mean %s?\n", fio_options[best_option].name);
4891 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
4893 int i, ret, unknown;
4896 sort_options(opts, fio_options, num_opts);
4897 opts_copy = dup_and_sub_options(opts, num_opts);
4899 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
4900 struct fio_option *o;
4901 int newret = parse_option(opts_copy[i], opts[i], fio_options,
4902 &o, &td->o, &td->opt_list);
4905 fio_option_mark_set(&td->o, o);
4913 opts_copy[i] = NULL;
4920 ret |= ioengine_load(td);
4922 sort_options(opts_copy, td->io_ops->options, num_opts);
4925 for (i = 0; i < num_opts; i++) {
4926 struct fio_option *o = NULL;
4933 newret = parse_option(opts_copy[i], opts[i],
4934 td->io_ops->options, &o,
4935 td->eo, &td->opt_list);
4939 log_err("Bad option <%s>\n", opts[i]);
4940 show_closest_option(opts[i]);
4943 opts_copy[i] = NULL;
4951 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
4955 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
4957 struct fio_option *o;
4959 o = find_option(fio_options, opt);
4961 fio_option_mark_set(&td->o, o);
4967 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
4970 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
4974 void fio_fill_default_options(struct thread_data *td)
4976 td->o.magic = OPT_MAGIC;
4977 fill_default_options(&td->o, fio_options);
4980 int fio_show_option_help(const char *opt)
4982 return show_cmd_help(fio_options, opt);
4986 * dupe FIO_OPT_STR_STORE options
4988 void fio_options_mem_dupe(struct thread_data *td)
4990 options_mem_dupe(fio_options, &td->o);
4992 if (td->eo && td->io_ops) {
4993 void *oldeo = td->eo;
4995 td->eo = malloc(td->io_ops->option_struct_size);
4996 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
4997 options_mem_dupe(td->io_ops->options, td->eo);
5001 unsigned int fio_get_kb_base(void *data)
5003 struct thread_data *td = cb_data_to_td(data);
5004 struct thread_options *o = &td->o;
5005 unsigned int kb_base = 0;
5008 * This is a hack... For private options, *data is not holding
5009 * a pointer to the thread_options, but to private data. This means
5010 * we can't safely dereference it, but magic is first so mem wise
5011 * it is valid. But this also means that if the job first sets
5012 * kb_base and expects that to be honored by private options,
5013 * it will be disappointed. We will return the global default
5016 if (o && o->magic == OPT_MAGIC)
5017 kb_base = o->kb_base;
5024 int add_option(struct fio_option *o)
5026 struct fio_option *__o;
5035 if (opt_index + 1 == FIO_MAX_OPTS) {
5036 log_err("fio: FIO_MAX_OPTS is too small\n");
5040 memcpy(&fio_options[opt_index], o, sizeof(*o));
5041 fio_options[opt_index + 1].name = NULL;
5045 void invalidate_profile_options(const char *prof_name)
5047 struct fio_option *o;
5051 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5052 o->type = FIO_OPT_INVALID;
5053 o->prof_name = NULL;
5059 void add_opt_posval(const char *optname, const char *ival, const char *help)
5061 struct fio_option *o;
5064 o = find_option(fio_options, optname);
5068 for (i = 0; i < PARSE_MAX_VP; i++) {
5069 if (o->posval[i].ival)
5072 o->posval[i].ival = ival;
5073 o->posval[i].help = help;
5078 void del_opt_posval(const char *optname, const char *ival)
5080 struct fio_option *o;
5083 o = find_option(fio_options, optname);
5087 for (i = 0; i < PARSE_MAX_VP; i++) {
5088 if (!o->posval[i].ival)
5090 if (strcmp(o->posval[i].ival, ival))
5093 o->posval[i].ival = NULL;
5094 o->posval[i].help = NULL;
5098 void fio_options_free(struct thread_data *td)
5100 options_free(fio_options, &td->o);
5101 if (td->eo && td->io_ops && td->io_ops->options) {
5102 options_free(td->io_ops->options, td->eo);
5108 struct fio_option *fio_option_find(const char *name)
5110 return find_option(fio_options, name);
5113 static struct fio_option *find_next_opt(struct thread_options *o,
5114 struct fio_option *from,
5117 struct fio_option *opt;
5120 from = &fio_options[0];
5126 if (off1 == from->off1) {
5131 } while (from->name);
5136 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5138 unsigned int opt_off, index, offset;
5140 opt_off = opt - &fio_options[0];
5141 index = opt_off / (8 * sizeof(uint64_t));
5142 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5143 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
5146 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
5148 struct fio_option *opt, *next;
5151 while ((opt = find_next_opt(o, next, off1)) != NULL) {
5152 if (opt_is_set(o, opt))
5161 void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)
5163 unsigned int opt_off, index, offset;
5165 opt_off = opt - &fio_options[0];
5166 index = opt_off / (8 * sizeof(uint64_t));
5167 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5168 o->set_options[index] |= (uint64_t)1 << offset;