11 #include <netinet/in.h>
17 #include "lib/pattern.h"
21 char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
24 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
26 static char *get_opt_postfix(const char *str)
28 char *p = strstr(str, ":");
34 strip_blank_front(&p);
39 static int bs_cmp(const void *p1, const void *p2)
41 const struct bssplit *bsp1 = p1;
42 const struct bssplit *bsp2 = p2;
44 return (int) bsp1->perc - (int) bsp2->perc;
47 static int bssplit_ddir(struct thread_options *o, enum fio_ddir ddir, char *str)
49 struct bssplit *bssplit;
50 unsigned int i, perc, perc_missing;
51 unsigned int max_bs, min_bs;
55 o->bssplit_nr[ddir] = 4;
56 bssplit = malloc(4 * sizeof(struct bssplit));
61 while ((fname = strsep(&str, ":")) != NULL) {
68 * grow struct buffer, if needed
70 if (i == o->bssplit_nr[ddir]) {
71 o->bssplit_nr[ddir] <<= 1;
72 bssplit = realloc(bssplit, o->bssplit_nr[ddir]
73 * sizeof(struct bssplit));
76 perc_str = strstr(fname, "/");
80 perc = atoi(perc_str);
88 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
89 log_err("fio: bssplit conversion failed\n");
100 bssplit[i].perc = perc;
104 o->bssplit_nr[ddir] = i;
107 * Now check if the percentages add up, and how much is missing
109 perc = perc_missing = 0;
110 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
111 struct bssplit *bsp = &bssplit[i];
113 if (bsp->perc == -1U)
119 if (perc > 100 && perc_missing > 1) {
120 log_err("fio: bssplit percentages add to more than 100%%\n");
126 * If values didn't have a percentage set, divide the remains between
130 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
132 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
133 struct bssplit *bsp = &bssplit[i];
135 if (bsp->perc == -1U)
136 bsp->perc = (100 - perc) / perc_missing;
140 o->min_bs[ddir] = min_bs;
141 o->max_bs[ddir] = max_bs;
144 * now sort based on percentages, for ease of lookup
146 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
147 o->bssplit[ddir] = bssplit;
151 typedef int (split_parse_fn)(struct thread_options *, enum fio_ddir, char *);
153 static int str_split_parse(struct thread_data *td, char *str, split_parse_fn *fn)
158 odir = strchr(str, ',');
160 ddir = strchr(odir + 1, ',');
162 ret = fn(&td->o, DDIR_TRIM, ddir + 1);
168 op = strdup(odir + 1);
169 ret = fn(&td->o, DDIR_TRIM, op);
174 ret = fn(&td->o, DDIR_WRITE, odir + 1);
177 ret = fn(&td->o, DDIR_READ, str);
183 ret = fn(&td->o, DDIR_WRITE, op);
188 ret = fn(&td->o, DDIR_TRIM, op);
192 ret = fn(&td->o, DDIR_READ, str);
198 static int str_bssplit_cb(void *data, const char *input)
200 struct thread_data *td = data;
207 p = str = strdup(input);
209 strip_blank_front(&str);
210 strip_blank_end(str);
212 ret = str_split_parse(td, str, bssplit_ddir);
218 static int str2error(char *str)
220 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
221 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
222 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
223 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
224 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
225 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
226 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
227 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
228 int i = 0, num = sizeof(err) / sizeof(void *);
231 if (!strcmp(err[i], str))
238 static int ignore_error_type(struct thread_data *td, int etype, char *str)
244 if (etype >= ERROR_TYPE_CNT) {
245 log_err("Illegal error type\n");
249 td->o.ignore_error_nr[etype] = 4;
250 error = malloc(4 * sizeof(struct bssplit));
253 while ((fname = strsep(&str, ":")) != NULL) {
259 * grow struct buffer, if needed
261 if (i == td->o.ignore_error_nr[etype]) {
262 td->o.ignore_error_nr[etype] <<= 1;
263 error = realloc(error, td->o.ignore_error_nr[etype]
266 if (fname[0] == 'E') {
267 error[i] = str2error(fname);
269 error[i] = atoi(fname);
271 error[i] = -error[i];
274 log_err("Unknown error %s, please use number value \n",
282 td->o.continue_on_error |= 1 << etype;
283 td->o.ignore_error_nr[etype] = i;
284 td->o.ignore_error[etype] = error;
292 static int str_ignore_error_cb(void *data, const char *input)
294 struct thread_data *td = data;
296 int type = 0, ret = 1;
301 p = str = strdup(input);
303 strip_blank_front(&str);
304 strip_blank_end(str);
310 ret = ignore_error_type(td, type, p);
320 static int str_rw_cb(void *data, const char *str)
322 struct thread_data *td = data;
323 struct thread_options *o = &td->o;
332 nr = get_opt_postfix(str);
337 o->ddir_seq_nr = atoi(nr);
341 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
342 log_err("fio: rw postfix parsing failed\n");
347 o->ddir_seq_add = val;
354 static int str_mem_cb(void *data, const char *mem)
356 struct thread_data *td = data;
358 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
359 td->o.mem_type == MEM_MMAPSHARED)
360 td->o.mmapfile = get_opt_postfix(mem);
365 static int fio_clock_source_cb(void *data, const char *str)
367 struct thread_data *td = data;
369 fio_clock_source = td->o.clocksource;
370 fio_clock_source_set = 1;
375 static int str_rwmix_read_cb(void *data, unsigned long long *val)
377 struct thread_data *td = data;
379 td->o.rwmix[DDIR_READ] = *val;
380 td->o.rwmix[DDIR_WRITE] = 100 - *val;
384 static int str_rwmix_write_cb(void *data, unsigned long long *val)
386 struct thread_data *td = data;
388 td->o.rwmix[DDIR_WRITE] = *val;
389 td->o.rwmix[DDIR_READ] = 100 - *val;
393 static int str_exitall_cb(void)
395 exitall_on_terminate = 1;
399 #ifdef FIO_HAVE_CPU_AFFINITY
400 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
402 unsigned int i, index, cpus_in_mask;
403 const long max_cpu = cpus_online();
405 cpus_in_mask = fio_cpu_count(mask);
406 cpu_index = cpu_index % cpus_in_mask;
409 for (i = 0; i < max_cpu; i++) {
410 if (!fio_cpu_isset(mask, i))
413 if (cpu_index != index)
414 fio_cpu_clear(mask, i);
419 return fio_cpu_count(mask);
422 static int str_cpumask_cb(void *data, unsigned long long *val)
424 struct thread_data *td = data;
432 ret = fio_cpuset_init(&td->o.cpumask);
434 log_err("fio: cpuset_init failed\n");
435 td_verror(td, ret, "fio_cpuset_init");
439 max_cpu = cpus_online();
441 for (i = 0; i < sizeof(int) * 8; i++) {
442 if ((1 << i) & *val) {
444 log_err("fio: CPU %d too large (max=%ld)\n", i,
448 dprint(FD_PARSE, "set cpu allowed %d\n", i);
449 fio_cpu_set(&td->o.cpumask, i);
456 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
463 ret = fio_cpuset_init(mask);
465 log_err("fio: cpuset_init failed\n");
466 td_verror(td, ret, "fio_cpuset_init");
470 p = str = strdup(input);
472 strip_blank_front(&str);
473 strip_blank_end(str);
475 max_cpu = cpus_online();
477 while ((cpu = strsep(&str, ",")) != NULL) {
486 while ((cpu2 = strsep(&str2, "-")) != NULL) {
496 while (icpu <= icpu2) {
497 if (icpu >= FIO_MAX_CPUS) {
498 log_err("fio: your OS only supports up to"
499 " %d CPUs\n", (int) FIO_MAX_CPUS);
503 if (icpu >= max_cpu) {
504 log_err("fio: CPU %d too large (max=%ld)\n",
510 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
511 fio_cpu_set(mask, icpu);
522 static int str_cpus_allowed_cb(void *data, const char *input)
524 struct thread_data *td = data;
529 return set_cpus_allowed(td, &td->o.cpumask, input);
532 static int str_verify_cpus_allowed_cb(void *data, const char *input)
534 struct thread_data *td = data;
539 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
543 static int str_log_cpus_allowed_cb(void *data, const char *input)
545 struct thread_data *td = data;
550 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
552 #endif /* CONFIG_ZLIB */
554 #endif /* FIO_HAVE_CPU_AFFINITY */
556 #ifdef CONFIG_LIBNUMA
557 static int str_numa_cpunodes_cb(void *data, char *input)
559 struct thread_data *td = data;
560 struct bitmask *verify_bitmask;
565 /* numa_parse_nodestring() parses a character string list
566 * of nodes into a bit mask. The bit mask is allocated by
567 * numa_allocate_nodemask(), so it should be freed by
568 * numa_free_nodemask().
570 verify_bitmask = numa_parse_nodestring(input);
571 if (verify_bitmask == NULL) {
572 log_err("fio: numa_parse_nodestring failed\n");
573 td_verror(td, 1, "str_numa_cpunodes_cb");
576 numa_free_nodemask(verify_bitmask);
578 td->o.numa_cpunodes = strdup(input);
582 static int str_numa_mpol_cb(void *data, char *input)
584 struct thread_data *td = data;
585 const char * const policy_types[] =
586 { "default", "prefer", "bind", "interleave", "local", NULL };
589 struct bitmask *verify_bitmask;
594 nodelist = strchr(input, ':');
596 /* NUL-terminate mode */
600 for (i = 0; i <= MPOL_LOCAL; i++) {
601 if (!strcmp(input, policy_types[i])) {
602 td->o.numa_mem_mode = i;
606 if (i > MPOL_LOCAL) {
607 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
611 switch (td->o.numa_mem_mode) {
614 * Insist on a nodelist of one node only
617 char *rest = nodelist;
618 while (isdigit(*rest))
621 log_err("fio: one node only for \'prefer\'\n");
625 log_err("fio: one node is needed for \'prefer\'\n");
629 case MPOL_INTERLEAVE:
631 * Default to online nodes with memory if no nodelist
634 nodelist = strdup("all");
639 * Don't allow a nodelist
642 log_err("fio: NO nodelist for \'local\'\n");
648 * Insist on a nodelist
651 log_err("fio: a nodelist is needed for \'bind\'\n");
658 /* numa_parse_nodestring() parses a character string list
659 * of nodes into a bit mask. The bit mask is allocated by
660 * numa_allocate_nodemask(), so it should be freed by
661 * numa_free_nodemask().
663 switch (td->o.numa_mem_mode) {
665 td->o.numa_mem_prefer_node = atoi(nodelist);
667 case MPOL_INTERLEAVE:
669 verify_bitmask = numa_parse_nodestring(nodelist);
670 if (verify_bitmask == NULL) {
671 log_err("fio: numa_parse_nodestring failed\n");
672 td_verror(td, 1, "str_numa_memnodes_cb");
675 td->o.numa_memnodes = strdup(nodelist);
676 numa_free_nodemask(verify_bitmask);
691 static int str_fst_cb(void *data, const char *str)
693 struct thread_data *td = data;
694 char *nr = get_opt_postfix(str);
696 td->file_service_nr = 1;
698 td->file_service_nr = atoi(nr);
705 #ifdef CONFIG_SYNC_FILE_RANGE
706 static int str_sfr_cb(void *data, const char *str)
708 struct thread_data *td = data;
709 char *nr = get_opt_postfix(str);
711 td->sync_file_range_nr = 1;
713 td->sync_file_range_nr = atoi(nr);
721 static int zone_cmp(const void *p1, const void *p2)
723 const struct zone_split *zsp1 = p1;
724 const struct zone_split *zsp2 = p2;
726 return (int) zsp2->access_perc - (int) zsp1->access_perc;
729 static int zone_split_ddir(struct thread_options *o, enum fio_ddir ddir,
732 struct zone_split *zsplit;
733 unsigned int i, perc, perc_missing, sperc, sperc_missing;
737 o->zone_split_nr[ddir] = 4;
738 zsplit = malloc(4 * sizeof(struct zone_split));
741 while ((fname = strsep(&str, ":")) != NULL) {
748 * grow struct buffer, if needed
750 if (i == o->zone_split_nr[ddir]) {
751 o->zone_split_nr[ddir] <<= 1;
752 zsplit = realloc(zsplit, o->zone_split_nr[ddir]
753 * sizeof(struct zone_split));
756 perc_str = strstr(fname, "/");
760 perc = atoi(perc_str);
768 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
769 log_err("fio: zone_split conversion failed\n");
774 zsplit[i].access_perc = val;
775 zsplit[i].size_perc = perc;
779 o->zone_split_nr[ddir] = i;
782 * Now check if the percentages add up, and how much is missing
784 perc = perc_missing = 0;
785 sperc = sperc_missing = 0;
786 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
787 struct zone_split *zsp = &zsplit[i];
789 if (zsp->access_perc == (uint8_t) -1U)
792 perc += zsp->access_perc;
794 if (zsp->size_perc == (uint8_t) -1U)
797 sperc += zsp->size_perc;
801 if (perc > 100 || sperc > 100) {
802 log_err("fio: zone_split percentages add to more than 100%%\n");
807 log_err("fio: access percentage don't add up to 100 for zoned "
808 "random distribution (got=%u)\n", perc);
814 * If values didn't have a percentage set, divide the remains between
818 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
820 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
821 struct zone_split *zsp = &zsplit[i];
823 if (zsp->access_perc == (uint8_t) -1U)
824 zsp->access_perc = (100 - perc) / perc_missing;
828 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
830 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
831 struct zone_split *zsp = &zsplit[i];
833 if (zsp->size_perc == (uint8_t) -1U)
834 zsp->size_perc = (100 - sperc) / sperc_missing;
839 * now sort based on percentages, for ease of lookup
841 qsort(zsplit, o->zone_split_nr[ddir], sizeof(struct zone_split), zone_cmp);
842 o->zone_split[ddir] = zsplit;
846 static void __td_zone_gen_index(struct thread_data *td, enum fio_ddir ddir)
848 unsigned int i, j, sprev, aprev;
850 td->zone_state_index[ddir] = malloc(sizeof(struct zone_split_index) * 100);
853 for (i = 0; i < td->o.zone_split_nr[ddir]; i++) {
854 struct zone_split *zsp = &td->o.zone_split[ddir][i];
856 for (j = aprev; j < aprev + zsp->access_perc; j++) {
857 struct zone_split_index *zsi = &td->zone_state_index[ddir][j];
859 zsi->size_perc = sprev + zsp->size_perc;
860 zsi->size_perc_prev = sprev;
863 aprev += zsp->access_perc;
864 sprev += zsp->size_perc;
869 * Generate state table for indexes, so we don't have to do it inline from
872 static void td_zone_gen_index(struct thread_data *td)
876 td->zone_state_index = malloc(DDIR_RWDIR_CNT *
877 sizeof(struct zone_split_index *));
879 for (i = 0; i < DDIR_RWDIR_CNT; i++)
880 __td_zone_gen_index(td, i);
883 static int parse_zoned_distribution(struct thread_data *td, const char *input)
888 p = str = strdup(input);
890 strip_blank_front(&str);
891 strip_blank_end(str);
893 /* We expect it to start like that, bail if not */
894 if (strncmp(str, "zoned:", 6)) {
895 log_err("fio: mismatch in zoned input <%s>\n", str);
899 str += strlen("zoned:");
901 ret = str_split_parse(td, str, zone_split_ddir);
905 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
908 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
910 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
911 struct zone_split *zsp = &td->o.zone_split[i][j];
913 dprint(FD_PARSE, "\t%d: %u/%u\n", j, zsp->access_perc,
919 td_zone_gen_index(td);
921 for (i = 0; i < DDIR_RWDIR_CNT; i++)
922 td->o.zone_split_nr[i] = 0;
928 static int str_random_distribution_cb(void *data, const char *str)
930 struct thread_data *td = data;
937 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
939 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
940 val = FIO_DEF_PARETO;
941 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
943 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
944 return parse_zoned_distribution(td, str);
948 nr = get_opt_postfix(str);
949 if (nr && !str_to_float(nr, &val, 0)) {
950 log_err("fio: random postfix parsing failed\n");
957 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
959 log_err("fio: zipf theta must different than 1.0\n");
962 td->o.zipf_theta.u.f = val;
963 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
964 if (val <= 0.00 || val >= 1.00) {
965 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
968 td->o.pareto_h.u.f = val;
970 if (val <= 0.00 || val >= 100.0) {
971 log_err("fio: normal deviation out of range (0 < input < 100.0)\n");
974 td->o.gauss_dev.u.f = val;
981 * Return next name in the string. Files are separated with ':'. If the ':'
982 * is escaped with a '\', then that ':' is part of the filename and does not
983 * indicate a new file.
985 static char *get_next_name(char **ptr)
990 if (!str || !strlen(str))
996 * No colon, we are done
998 p = strchr(str, ':');
1005 * We got a colon, but it's the first character. Skip and
1013 if (*(p - 1) != '\\') {
1019 memmove(p - 1, p, strlen(p) + 1);
1027 static int get_max_name_idx(char *input)
1029 unsigned int cur_idx;
1032 p = str = strdup(input);
1033 for (cur_idx = 0; ; cur_idx++)
1034 if (get_next_name(&str) == NULL)
1042 * Returns the directory at the index, indexes > entires will be
1043 * assigned via modulo division of the index
1045 int set_name_idx(char *target, size_t tlen, char *input, int index)
1047 unsigned int cur_idx;
1049 char *fname, *str, *p;
1051 p = str = strdup(input);
1053 index %= get_max_name_idx(input);
1054 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1055 fname = get_next_name(&str);
1057 if (client_sockaddr_str[0]) {
1058 len = snprintf(target, tlen, "%s/%s.", fname,
1059 client_sockaddr_str);
1061 len = snprintf(target, tlen, "%s/", fname);
1063 target[tlen - 1] = '\0';
1069 static int str_filename_cb(void *data, const char *input)
1071 struct thread_data *td = data;
1072 char *fname, *str, *p;
1074 p = str = strdup(input);
1076 strip_blank_front(&str);
1077 strip_blank_end(str);
1079 if (!td->files_index)
1082 while ((fname = get_next_name(&str)) != NULL) {
1085 add_file(td, fname, 0, 1);
1092 static int str_directory_cb(void *data, const char fio_unused *unused)
1094 struct thread_data *td = data;
1096 char *dirname, *str, *p;
1102 p = str = strdup(td->o.directory);
1103 while ((dirname = get_next_name(&str)) != NULL) {
1104 if (lstat(dirname, &sb) < 0) {
1107 log_err("fio: %s is not a directory\n", dirname);
1108 td_verror(td, ret, "lstat");
1111 if (!S_ISDIR(sb.st_mode)) {
1112 log_err("fio: %s is not a directory\n", dirname);
1123 static int str_opendir_cb(void *data, const char fio_unused *str)
1125 struct thread_data *td = data;
1130 if (!td->files_index)
1133 return add_dir_files(td, td->o.opendir);
1136 static int str_buffer_pattern_cb(void *data, const char *input)
1138 struct thread_data *td = data;
1141 /* FIXME: for now buffer pattern does not support formats */
1142 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
1143 MAX_PATTERN_SIZE, NULL, 0, NULL, NULL);
1148 td->o.buffer_pattern_bytes = ret;
1149 if (!td->o.compress_percentage)
1150 td->o.refill_buffers = 0;
1151 td->o.scramble_buffers = 0;
1152 td->o.zero_buffers = 0;
1157 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1159 struct thread_data *td = data;
1161 td->flags |= TD_F_COMPRESS;
1162 td->o.compress_percentage = *il;
1166 static int str_dedupe_cb(void *data, unsigned long long *il)
1168 struct thread_data *td = data;
1170 td->flags |= TD_F_COMPRESS;
1171 td->o.dedupe_percentage = *il;
1172 td->o.refill_buffers = 1;
1176 static int str_verify_pattern_cb(void *data, const char *input)
1178 struct pattern_fmt_desc fmt_desc[] = {
1181 .len = FIELD_SIZE(struct io_u *, offset),
1182 .paste = paste_blockoff
1185 struct thread_data *td = data;
1188 td->o.verify_fmt_sz = ARRAY_SIZE(td->o.verify_fmt);
1189 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
1190 MAX_PATTERN_SIZE, fmt_desc, sizeof(fmt_desc),
1191 td->o.verify_fmt, &td->o.verify_fmt_sz);
1196 td->o.verify_pattern_bytes = ret;
1198 * VERIFY_* could already be set
1200 if (!fio_option_is_set(&td->o, verify))
1201 td->o.verify = VERIFY_PATTERN;
1206 static int str_gtod_reduce_cb(void *data, int *il)
1208 struct thread_data *td = data;
1211 td->o.disable_lat = !!val;
1212 td->o.disable_clat = !!val;
1213 td->o.disable_slat = !!val;
1214 td->o.disable_bw = !!val;
1215 td->o.clat_percentiles = !val;
1217 td->tv_cache_mask = 63;
1222 static int str_size_cb(void *data, unsigned long long *__val)
1224 struct thread_data *td = data;
1225 unsigned long long v = *__val;
1227 if (parse_is_percent(v)) {
1229 td->o.size_percent = -1ULL - v;
1236 static int rw_verify(struct fio_option *o, void *data)
1238 struct thread_data *td = data;
1240 if (read_only && td_write(td)) {
1241 log_err("fio: job <%s> has write bit set, but fio is in"
1242 " read-only mode\n", td->o.name);
1249 static int gtod_cpu_verify(struct fio_option *o, void *data)
1251 #ifndef FIO_HAVE_CPU_AFFINITY
1252 struct thread_data *td = data;
1254 if (td->o.gtod_cpu) {
1255 log_err("fio: platform must support CPU affinity for"
1256 "gettimeofday() offloading\n");
1265 * Map of job/command line options
1267 struct fio_option fio_options[FIO_MAX_OPTS] = {
1269 .name = "description",
1270 .lname = "Description of job",
1271 .type = FIO_OPT_STR_STORE,
1272 .off1 = td_var_offset(description),
1273 .help = "Text job description",
1274 .category = FIO_OPT_C_GENERAL,
1275 .group = FIO_OPT_G_DESC,
1279 .lname = "Job name",
1280 .type = FIO_OPT_STR_STORE,
1281 .off1 = td_var_offset(name),
1282 .help = "Name of this job",
1283 .category = FIO_OPT_C_GENERAL,
1284 .group = FIO_OPT_G_DESC,
1288 .lname = "Waitee name",
1289 .type = FIO_OPT_STR_STORE,
1290 .off1 = td_var_offset(wait_for),
1291 .help = "Name of the job this one wants to wait for before starting",
1292 .category = FIO_OPT_C_GENERAL,
1293 .group = FIO_OPT_G_DESC,
1297 .lname = "Filename(s)",
1298 .type = FIO_OPT_STR_STORE,
1299 .off1 = td_var_offset(filename),
1300 .cb = str_filename_cb,
1301 .prio = -1, /* must come after "directory" */
1302 .help = "File(s) to use for the workload",
1303 .category = FIO_OPT_C_FILE,
1304 .group = FIO_OPT_G_FILENAME,
1307 .name = "directory",
1308 .lname = "Directory",
1309 .type = FIO_OPT_STR_STORE,
1310 .off1 = td_var_offset(directory),
1311 .cb = str_directory_cb,
1312 .help = "Directory to store files in",
1313 .category = FIO_OPT_C_FILE,
1314 .group = FIO_OPT_G_FILENAME,
1317 .name = "filename_format",
1318 .type = FIO_OPT_STR_STORE,
1319 .off1 = td_var_offset(filename_format),
1320 .prio = -1, /* must come after "directory" */
1321 .help = "Override default $jobname.$jobnum.$filenum naming",
1322 .def = "$jobname.$jobnum.$filenum",
1323 .category = FIO_OPT_C_FILE,
1324 .group = FIO_OPT_G_FILENAME,
1328 .lname = "Lockfile",
1329 .type = FIO_OPT_STR,
1330 .off1 = td_var_offset(file_lock_mode),
1331 .help = "Lock file when doing IO to it",
1333 .parent = "filename",
1336 .category = FIO_OPT_C_FILE,
1337 .group = FIO_OPT_G_FILENAME,
1340 .oval = FILE_LOCK_NONE,
1341 .help = "No file locking",
1343 { .ival = "exclusive",
1344 .oval = FILE_LOCK_EXCLUSIVE,
1345 .help = "Exclusive file lock",
1348 .ival = "readwrite",
1349 .oval = FILE_LOCK_READWRITE,
1350 .help = "Read vs write lock",
1356 .lname = "Open directory",
1357 .type = FIO_OPT_STR_STORE,
1358 .off1 = td_var_offset(opendir),
1359 .cb = str_opendir_cb,
1360 .help = "Recursively add files from this directory and down",
1361 .category = FIO_OPT_C_FILE,
1362 .group = FIO_OPT_G_FILENAME,
1366 .lname = "Read/write",
1367 .alias = "readwrite",
1368 .type = FIO_OPT_STR,
1370 .off1 = td_var_offset(td_ddir),
1371 .help = "IO direction",
1373 .verify = rw_verify,
1374 .category = FIO_OPT_C_IO,
1375 .group = FIO_OPT_G_IO_BASIC,
1378 .oval = TD_DDIR_READ,
1379 .help = "Sequential read",
1382 .oval = TD_DDIR_WRITE,
1383 .help = "Sequential write",
1386 .oval = TD_DDIR_TRIM,
1387 .help = "Sequential trim",
1389 { .ival = "randread",
1390 .oval = TD_DDIR_RANDREAD,
1391 .help = "Random read",
1393 { .ival = "randwrite",
1394 .oval = TD_DDIR_RANDWRITE,
1395 .help = "Random write",
1397 { .ival = "randtrim",
1398 .oval = TD_DDIR_RANDTRIM,
1399 .help = "Random trim",
1403 .help = "Sequential read and write mix",
1405 { .ival = "readwrite",
1407 .help = "Sequential read and write mix",
1410 .oval = TD_DDIR_RANDRW,
1411 .help = "Random read and write mix"
1413 { .ival = "trimwrite",
1414 .oval = TD_DDIR_TRIMWRITE,
1415 .help = "Trim and write mix, trims preceding writes"
1420 .name = "rw_sequencer",
1421 .lname = "RW Sequencer",
1422 .type = FIO_OPT_STR,
1423 .off1 = td_var_offset(rw_seq),
1424 .help = "IO offset generator modifier",
1425 .def = "sequential",
1426 .category = FIO_OPT_C_IO,
1427 .group = FIO_OPT_G_IO_BASIC,
1429 { .ival = "sequential",
1431 .help = "Generate sequential offsets",
1433 { .ival = "identical",
1434 .oval = RW_SEQ_IDENT,
1435 .help = "Generate identical offsets",
1442 .lname = "IO Engine",
1443 .type = FIO_OPT_STR_STORE,
1444 .off1 = td_var_offset(ioengine),
1445 .help = "IO engine to use",
1446 .def = FIO_PREFERRED_ENGINE,
1447 .category = FIO_OPT_C_IO,
1448 .group = FIO_OPT_G_IO_BASIC,
1451 .help = "Use read/write",
1454 .help = "Use pread/pwrite",
1457 .help = "Use readv/writev",
1459 #ifdef CONFIG_PWRITEV
1461 .help = "Use preadv/pwritev",
1464 #ifdef CONFIG_PWRITEV
1465 { .ival = "pvsync2",
1466 .help = "Use preadv2/pwritev2",
1469 #ifdef CONFIG_LIBAIO
1471 .help = "Linux native asynchronous IO",
1474 #ifdef CONFIG_POSIXAIO
1475 { .ival = "posixaio",
1476 .help = "POSIX asynchronous IO",
1479 #ifdef CONFIG_SOLARISAIO
1480 { .ival = "solarisaio",
1481 .help = "Solaris native asynchronous IO",
1484 #ifdef CONFIG_WINDOWSAIO
1485 { .ival = "windowsaio",
1486 .help = "Windows native asynchronous IO"
1491 .help = "Rados Block Device asynchronous IO"
1495 .help = "Memory mapped IO"
1497 #ifdef CONFIG_LINUX_SPLICE
1499 .help = "splice/vmsplice based IO",
1501 { .ival = "netsplice",
1502 .help = "splice/vmsplice to/from the network",
1505 #ifdef FIO_HAVE_SGIO
1507 .help = "SCSI generic v3 IO",
1511 .help = "Testing engine (no data transfer)",
1514 .help = "Network IO",
1517 .help = "CPU cycle burner engine",
1521 .help = "GUASI IO engine",
1524 #ifdef FIO_HAVE_BINJECT
1525 { .ival = "binject",
1526 .help = "binject direct inject block engine",
1531 .help = "RDMA IO engine",
1534 #ifdef CONFIG_FUSION_AW
1535 { .ival = "fusion-aw-sync",
1536 .help = "Fusion-io atomic write engine",
1539 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1540 { .ival = "e4defrag",
1541 .help = "ext4 defrag engine",
1544 #ifdef CONFIG_LINUX_FALLOCATE
1546 .help = "fallocate() file based engine",
1551 .help = "Glusterfs libgfapi(sync) based engine"
1553 { .ival = "gfapi_async",
1554 .help = "Glusterfs libgfapi(async) based engine"
1557 #ifdef CONFIG_LIBHDFS
1558 { .ival = "libhdfs",
1559 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1562 { .ival = "external",
1563 .help = "Load external engine (append name)",
1569 .lname = "IO Depth",
1570 .type = FIO_OPT_INT,
1571 .off1 = td_var_offset(iodepth),
1572 .help = "Number of IO buffers to keep in flight",
1576 .category = FIO_OPT_C_IO,
1577 .group = FIO_OPT_G_IO_BASIC,
1580 .name = "iodepth_batch",
1581 .lname = "IO Depth batch",
1582 .alias = "iodepth_batch_submit",
1583 .type = FIO_OPT_INT,
1584 .off1 = td_var_offset(iodepth_batch),
1585 .help = "Number of IO buffers to submit in one go",
1586 .parent = "iodepth",
1591 .category = FIO_OPT_C_IO,
1592 .group = FIO_OPT_G_IO_BASIC,
1595 .name = "iodepth_batch_complete_min",
1596 .lname = "Min IO depth batch complete",
1597 .alias = "iodepth_batch_complete",
1598 .type = FIO_OPT_INT,
1599 .off1 = td_var_offset(iodepth_batch_complete_min),
1600 .help = "Min number of IO buffers to retrieve in one go",
1601 .parent = "iodepth",
1606 .category = FIO_OPT_C_IO,
1607 .group = FIO_OPT_G_IO_BASIC,
1610 .name = "iodepth_batch_complete_max",
1611 .lname = "Max IO depth batch complete",
1612 .type = FIO_OPT_INT,
1613 .off1 = td_var_offset(iodepth_batch_complete_max),
1614 .help = "Max number of IO buffers to retrieve in one go",
1615 .parent = "iodepth",
1619 .category = FIO_OPT_C_IO,
1620 .group = FIO_OPT_G_IO_BASIC,
1623 .name = "iodepth_low",
1624 .lname = "IO Depth batch low",
1625 .type = FIO_OPT_INT,
1626 .off1 = td_var_offset(iodepth_low),
1627 .help = "Low water mark for queuing depth",
1628 .parent = "iodepth",
1631 .category = FIO_OPT_C_IO,
1632 .group = FIO_OPT_G_IO_BASIC,
1635 .name = "io_submit_mode",
1636 .lname = "IO submit mode",
1637 .type = FIO_OPT_STR,
1638 .off1 = td_var_offset(io_submit_mode),
1639 .help = "How IO submissions and completions are done",
1641 .category = FIO_OPT_C_IO,
1642 .group = FIO_OPT_G_IO_BASIC,
1645 .oval = IO_MODE_INLINE,
1646 .help = "Submit and complete IO inline",
1648 { .ival = "offload",
1649 .oval = IO_MODE_OFFLOAD,
1650 .help = "Offload submit and complete to threads",
1657 .type = FIO_OPT_STR_VAL,
1659 .off1 = td_var_offset(size),
1660 .help = "Total size of device or files",
1661 .interval = 1024 * 1024,
1662 .category = FIO_OPT_C_IO,
1663 .group = FIO_OPT_G_INVALID,
1667 .alias = "io_limit",
1669 .type = FIO_OPT_STR_VAL,
1670 .off1 = td_var_offset(io_limit),
1671 .interval = 1024 * 1024,
1672 .category = FIO_OPT_C_IO,
1673 .group = FIO_OPT_G_INVALID,
1676 .name = "fill_device",
1677 .lname = "Fill device",
1679 .type = FIO_OPT_BOOL,
1680 .off1 = td_var_offset(fill_device),
1681 .help = "Write until an ENOSPC error occurs",
1683 .category = FIO_OPT_C_FILE,
1684 .group = FIO_OPT_G_INVALID,
1688 .lname = "File size",
1689 .type = FIO_OPT_STR_VAL,
1690 .off1 = td_var_offset(file_size_low),
1691 .off2 = td_var_offset(file_size_high),
1693 .help = "Size of individual files",
1694 .interval = 1024 * 1024,
1695 .category = FIO_OPT_C_FILE,
1696 .group = FIO_OPT_G_INVALID,
1699 .name = "file_append",
1700 .lname = "File append",
1701 .type = FIO_OPT_BOOL,
1702 .off1 = td_var_offset(file_append),
1703 .help = "IO will start at the end of the file(s)",
1705 .category = FIO_OPT_C_FILE,
1706 .group = FIO_OPT_G_INVALID,
1710 .lname = "IO offset",
1711 .alias = "fileoffset",
1712 .type = FIO_OPT_STR_VAL,
1713 .off1 = td_var_offset(start_offset),
1714 .help = "Start IO from this offset",
1716 .interval = 1024 * 1024,
1717 .category = FIO_OPT_C_IO,
1718 .group = FIO_OPT_G_INVALID,
1721 .name = "offset_increment",
1722 .lname = "IO offset increment",
1723 .type = FIO_OPT_STR_VAL,
1724 .off1 = td_var_offset(offset_increment),
1725 .help = "What is the increment from one offset to the next",
1729 .interval = 1024 * 1024,
1730 .category = FIO_OPT_C_IO,
1731 .group = FIO_OPT_G_INVALID,
1734 .name = "number_ios",
1735 .lname = "Number of IOs to perform",
1736 .type = FIO_OPT_STR_VAL,
1737 .off1 = td_var_offset(number_ios),
1738 .help = "Force job completion after this number of IOs",
1740 .category = FIO_OPT_C_IO,
1741 .group = FIO_OPT_G_INVALID,
1745 .lname = "Block size",
1746 .alias = "blocksize",
1747 .type = FIO_OPT_INT,
1748 .off1 = td_var_offset(bs[DDIR_READ]),
1749 .off2 = td_var_offset(bs[DDIR_WRITE]),
1750 .off3 = td_var_offset(bs[DDIR_TRIM]),
1752 .help = "Block size unit",
1757 .category = FIO_OPT_C_IO,
1758 .group = FIO_OPT_G_INVALID,
1762 .lname = "Block size align",
1763 .alias = "blockalign",
1764 .type = FIO_OPT_INT,
1765 .off1 = td_var_offset(ba[DDIR_READ]),
1766 .off2 = td_var_offset(ba[DDIR_WRITE]),
1767 .off3 = td_var_offset(ba[DDIR_TRIM]),
1769 .help = "IO block offset alignment",
1773 .category = FIO_OPT_C_IO,
1774 .group = FIO_OPT_G_INVALID,
1778 .lname = "Block size range",
1779 .alias = "blocksize_range",
1780 .type = FIO_OPT_RANGE,
1781 .off1 = td_var_offset(min_bs[DDIR_READ]),
1782 .off2 = td_var_offset(max_bs[DDIR_READ]),
1783 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1784 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1785 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1786 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1788 .help = "Set block size range (in more detail than bs)",
1792 .category = FIO_OPT_C_IO,
1793 .group = FIO_OPT_G_INVALID,
1797 .lname = "Block size split",
1798 .type = FIO_OPT_STR,
1799 .cb = str_bssplit_cb,
1800 .off1 = td_var_offset(bssplit),
1801 .help = "Set a specific mix of block sizes",
1804 .category = FIO_OPT_C_IO,
1805 .group = FIO_OPT_G_INVALID,
1808 .name = "bs_unaligned",
1809 .lname = "Block size unaligned",
1810 .alias = "blocksize_unaligned",
1811 .type = FIO_OPT_STR_SET,
1812 .off1 = td_var_offset(bs_unaligned),
1813 .help = "Don't sector align IO buffer sizes",
1816 .category = FIO_OPT_C_IO,
1817 .group = FIO_OPT_G_INVALID,
1820 .name = "bs_is_seq_rand",
1821 .lname = "Block size division is seq/random (not read/write)",
1822 .type = FIO_OPT_BOOL,
1823 .off1 = td_var_offset(bs_is_seq_rand),
1824 .help = "Consider any blocksize setting to be sequential,random",
1826 .parent = "blocksize",
1827 .category = FIO_OPT_C_IO,
1828 .group = FIO_OPT_G_INVALID,
1831 .name = "randrepeat",
1832 .lname = "Random repeatable",
1833 .type = FIO_OPT_BOOL,
1834 .off1 = td_var_offset(rand_repeatable),
1835 .help = "Use repeatable random IO pattern",
1839 .category = FIO_OPT_C_IO,
1840 .group = FIO_OPT_G_RANDOM,
1844 .lname = "The random generator seed",
1845 .type = FIO_OPT_STR_VAL,
1846 .off1 = td_var_offset(rand_seed),
1847 .help = "Set the random generator seed value",
1850 .category = FIO_OPT_C_IO,
1851 .group = FIO_OPT_G_RANDOM,
1854 .name = "use_os_rand",
1855 .lname = "Use OS random",
1856 .type = FIO_OPT_DEPRECATED,
1857 .off1 = td_var_offset(dep_use_os_rand),
1858 .category = FIO_OPT_C_IO,
1859 .group = FIO_OPT_G_RANDOM,
1862 .name = "norandommap",
1863 .lname = "No randommap",
1864 .type = FIO_OPT_STR_SET,
1865 .off1 = td_var_offset(norandommap),
1866 .help = "Accept potential duplicate random blocks",
1870 .category = FIO_OPT_C_IO,
1871 .group = FIO_OPT_G_RANDOM,
1874 .name = "softrandommap",
1875 .lname = "Soft randommap",
1876 .type = FIO_OPT_BOOL,
1877 .off1 = td_var_offset(softrandommap),
1878 .help = "Set norandommap if randommap allocation fails",
1879 .parent = "norandommap",
1882 .category = FIO_OPT_C_IO,
1883 .group = FIO_OPT_G_RANDOM,
1886 .name = "random_generator",
1887 .type = FIO_OPT_STR,
1888 .off1 = td_var_offset(random_generator),
1889 .help = "Type of random number generator to use",
1890 .def = "tausworthe",
1892 { .ival = "tausworthe",
1893 .oval = FIO_RAND_GEN_TAUSWORTHE,
1894 .help = "Strong Tausworthe generator",
1897 .oval = FIO_RAND_GEN_LFSR,
1898 .help = "Variable length LFSR",
1901 .ival = "tausworthe64",
1902 .oval = FIO_RAND_GEN_TAUSWORTHE64,
1903 .help = "64-bit Tausworthe variant",
1906 .category = FIO_OPT_C_IO,
1907 .group = FIO_OPT_G_RANDOM,
1910 .name = "random_distribution",
1911 .type = FIO_OPT_STR,
1912 .off1 = td_var_offset(random_distribution),
1913 .cb = str_random_distribution_cb,
1914 .help = "Random offset distribution generator",
1918 .oval = FIO_RAND_DIST_RANDOM,
1919 .help = "Completely random",
1922 .oval = FIO_RAND_DIST_ZIPF,
1923 .help = "Zipf distribution",
1926 .oval = FIO_RAND_DIST_PARETO,
1927 .help = "Pareto distribution",
1930 .oval = FIO_RAND_DIST_GAUSS,
1931 .help = "Normal (gaussian) distribution",
1934 .oval = FIO_RAND_DIST_ZONED,
1935 .help = "Zoned random distribution",
1939 .category = FIO_OPT_C_IO,
1940 .group = FIO_OPT_G_RANDOM,
1943 .name = "percentage_random",
1944 .lname = "Percentage Random",
1945 .type = FIO_OPT_INT,
1946 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1947 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1948 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1950 .help = "Percentage of seq/random mix that should be random",
1951 .def = "100,100,100",
1953 .inverse = "percentage_sequential",
1954 .category = FIO_OPT_C_IO,
1955 .group = FIO_OPT_G_RANDOM,
1958 .name = "percentage_sequential",
1959 .lname = "Percentage Sequential",
1960 .type = FIO_OPT_DEPRECATED,
1961 .category = FIO_OPT_C_IO,
1962 .group = FIO_OPT_G_RANDOM,
1965 .name = "allrandrepeat",
1966 .type = FIO_OPT_BOOL,
1967 .off1 = td_var_offset(allrand_repeatable),
1968 .help = "Use repeatable random numbers for everything",
1970 .category = FIO_OPT_C_IO,
1971 .group = FIO_OPT_G_RANDOM,
1975 .lname = "Number of files",
1976 .alias = "nr_files",
1977 .type = FIO_OPT_INT,
1978 .off1 = td_var_offset(nr_files),
1979 .help = "Split job workload between this number of files",
1982 .category = FIO_OPT_C_FILE,
1983 .group = FIO_OPT_G_INVALID,
1986 .name = "openfiles",
1987 .lname = "Number of open files",
1988 .type = FIO_OPT_INT,
1989 .off1 = td_var_offset(open_files),
1990 .help = "Number of files to keep open at the same time",
1991 .category = FIO_OPT_C_FILE,
1992 .group = FIO_OPT_G_INVALID,
1995 .name = "file_service_type",
1996 .lname = "File service type",
1997 .type = FIO_OPT_STR,
1999 .off1 = td_var_offset(file_service_type),
2000 .help = "How to select which file to service next",
2001 .def = "roundrobin",
2002 .category = FIO_OPT_C_FILE,
2003 .group = FIO_OPT_G_INVALID,
2006 .oval = FIO_FSERVICE_RANDOM,
2007 .help = "Choose a file at random",
2009 { .ival = "roundrobin",
2010 .oval = FIO_FSERVICE_RR,
2011 .help = "Round robin select files",
2013 { .ival = "sequential",
2014 .oval = FIO_FSERVICE_SEQ,
2015 .help = "Finish one file before moving to the next",
2018 .parent = "nrfiles",
2021 #ifdef CONFIG_POSIX_FALLOCATE
2023 .name = "fallocate",
2024 .lname = "Fallocate",
2025 .type = FIO_OPT_STR,
2026 .off1 = td_var_offset(fallocate_mode),
2027 .help = "Whether pre-allocation is performed when laying out files",
2029 .category = FIO_OPT_C_FILE,
2030 .group = FIO_OPT_G_INVALID,
2033 .oval = FIO_FALLOCATE_NONE,
2034 .help = "Do not pre-allocate space",
2037 .oval = FIO_FALLOCATE_POSIX,
2038 .help = "Use posix_fallocate()",
2040 #ifdef CONFIG_LINUX_FALLOCATE
2042 .oval = FIO_FALLOCATE_KEEP_SIZE,
2043 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2046 /* Compatibility with former boolean values */
2048 .oval = FIO_FALLOCATE_NONE,
2049 .help = "Alias for 'none'",
2052 .oval = FIO_FALLOCATE_POSIX,
2053 .help = "Alias for 'posix'",
2057 #endif /* CONFIG_POSIX_FALLOCATE */
2059 .name = "fadvise_hint",
2060 .lname = "Fadvise hint",
2061 .type = FIO_OPT_BOOL,
2062 .off1 = td_var_offset(fadvise_hint),
2063 .help = "Use fadvise() to advise the kernel on IO pattern",
2065 .category = FIO_OPT_C_FILE,
2066 .group = FIO_OPT_G_INVALID,
2068 #ifdef FIO_HAVE_STREAMID
2070 .name = "fadvise_stream",
2071 .lname = "Fadvise stream",
2072 .type = FIO_OPT_INT,
2073 .off1 = td_var_offset(fadvise_stream),
2074 .help = "Use fadvise() to set stream ID",
2075 .category = FIO_OPT_C_FILE,
2076 .group = FIO_OPT_G_INVALID,
2082 .type = FIO_OPT_INT,
2083 .off1 = td_var_offset(fsync_blocks),
2084 .help = "Issue fsync for writes every given number of blocks",
2087 .category = FIO_OPT_C_FILE,
2088 .group = FIO_OPT_G_INVALID,
2091 .name = "fdatasync",
2092 .lname = "Fdatasync",
2093 .type = FIO_OPT_INT,
2094 .off1 = td_var_offset(fdatasync_blocks),
2095 .help = "Issue fdatasync for writes every given number of blocks",
2098 .category = FIO_OPT_C_FILE,
2099 .group = FIO_OPT_G_INVALID,
2102 .name = "write_barrier",
2103 .lname = "Write barrier",
2104 .type = FIO_OPT_INT,
2105 .off1 = td_var_offset(barrier_blocks),
2106 .help = "Make every Nth write a barrier write",
2109 .category = FIO_OPT_C_IO,
2110 .group = FIO_OPT_G_INVALID,
2112 #ifdef CONFIG_SYNC_FILE_RANGE
2114 .name = "sync_file_range",
2115 .lname = "Sync file range",
2117 { .ival = "wait_before",
2118 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2119 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2123 .oval = SYNC_FILE_RANGE_WRITE,
2124 .help = "SYNC_FILE_RANGE_WRITE",
2128 .ival = "wait_after",
2129 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2130 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2134 .type = FIO_OPT_STR_MULTI,
2136 .off1 = td_var_offset(sync_file_range),
2137 .help = "Use sync_file_range()",
2138 .category = FIO_OPT_C_FILE,
2139 .group = FIO_OPT_G_INVALID,
2144 .lname = "Direct I/O",
2145 .type = FIO_OPT_BOOL,
2146 .off1 = td_var_offset(odirect),
2147 .help = "Use O_DIRECT IO (negates buffered)",
2149 .inverse = "buffered",
2150 .category = FIO_OPT_C_IO,
2151 .group = FIO_OPT_G_IO_TYPE,
2155 .lname = "Atomic I/O",
2156 .type = FIO_OPT_BOOL,
2157 .off1 = td_var_offset(oatomic),
2158 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2160 .category = FIO_OPT_C_IO,
2161 .group = FIO_OPT_G_IO_TYPE,
2165 .lname = "Buffered I/O",
2166 .type = FIO_OPT_BOOL,
2167 .off1 = td_var_offset(odirect),
2169 .help = "Use buffered IO (negates direct)",
2171 .inverse = "direct",
2172 .category = FIO_OPT_C_IO,
2173 .group = FIO_OPT_G_IO_TYPE,
2176 .name = "overwrite",
2177 .lname = "Overwrite",
2178 .type = FIO_OPT_BOOL,
2179 .off1 = td_var_offset(overwrite),
2180 .help = "When writing, set whether to overwrite current data",
2182 .category = FIO_OPT_C_FILE,
2183 .group = FIO_OPT_G_INVALID,
2188 .type = FIO_OPT_INT,
2189 .off1 = td_var_offset(loops),
2190 .help = "Number of times to run the job",
2193 .category = FIO_OPT_C_GENERAL,
2194 .group = FIO_OPT_G_RUNTIME,
2198 .lname = "Number of jobs",
2199 .type = FIO_OPT_INT,
2200 .off1 = td_var_offset(numjobs),
2201 .help = "Duplicate this job this many times",
2204 .category = FIO_OPT_C_GENERAL,
2205 .group = FIO_OPT_G_RUNTIME,
2208 .name = "startdelay",
2209 .lname = "Start delay",
2210 .type = FIO_OPT_STR_VAL_TIME,
2211 .off1 = td_var_offset(start_delay),
2212 .off2 = td_var_offset(start_delay_high),
2213 .help = "Only start job when this period has passed",
2217 .category = FIO_OPT_C_GENERAL,
2218 .group = FIO_OPT_G_RUNTIME,
2224 .type = FIO_OPT_STR_VAL_TIME,
2225 .off1 = td_var_offset(timeout),
2226 .help = "Stop workload when this amount of time has passed",
2230 .category = FIO_OPT_C_GENERAL,
2231 .group = FIO_OPT_G_RUNTIME,
2234 .name = "time_based",
2235 .lname = "Time based",
2236 .type = FIO_OPT_STR_SET,
2237 .off1 = td_var_offset(time_based),
2238 .help = "Keep running until runtime/timeout is met",
2239 .category = FIO_OPT_C_GENERAL,
2240 .group = FIO_OPT_G_RUNTIME,
2243 .name = "verify_only",
2244 .lname = "Verify only",
2245 .type = FIO_OPT_STR_SET,
2246 .off1 = td_var_offset(verify_only),
2247 .help = "Verifies previously written data is still valid",
2248 .category = FIO_OPT_C_GENERAL,
2249 .group = FIO_OPT_G_RUNTIME,
2252 .name = "ramp_time",
2253 .lname = "Ramp time",
2254 .type = FIO_OPT_STR_VAL_TIME,
2255 .off1 = td_var_offset(ramp_time),
2256 .help = "Ramp up time before measuring performance",
2259 .category = FIO_OPT_C_GENERAL,
2260 .group = FIO_OPT_G_RUNTIME,
2263 .name = "clocksource",
2264 .lname = "Clock source",
2265 .type = FIO_OPT_STR,
2266 .cb = fio_clock_source_cb,
2267 .off1 = td_var_offset(clocksource),
2268 .help = "What type of timing source to use",
2269 .category = FIO_OPT_C_GENERAL,
2270 .group = FIO_OPT_G_CLOCK,
2272 #ifdef CONFIG_GETTIMEOFDAY
2273 { .ival = "gettimeofday",
2275 .help = "Use gettimeofday(2) for timing",
2278 #ifdef CONFIG_CLOCK_GETTIME
2279 { .ival = "clock_gettime",
2280 .oval = CS_CGETTIME,
2281 .help = "Use clock_gettime(2) for timing",
2284 #ifdef ARCH_HAVE_CPU_CLOCK
2286 .oval = CS_CPUCLOCK,
2287 .help = "Use CPU private clock",
2295 .lname = "I/O Memory",
2296 .type = FIO_OPT_STR,
2298 .off1 = td_var_offset(mem_type),
2299 .help = "Backing type for IO buffers",
2301 .category = FIO_OPT_C_IO,
2302 .group = FIO_OPT_G_INVALID,
2306 .help = "Use malloc(3) for IO buffers",
2308 #ifndef CONFIG_NO_SHM
2311 .help = "Use shared memory segments for IO buffers",
2313 #ifdef FIO_HAVE_HUGETLB
2314 { .ival = "shmhuge",
2315 .oval = MEM_SHMHUGE,
2316 .help = "Like shm, but use huge pages",
2322 .help = "Use mmap(2) (file or anon) for IO buffers",
2324 { .ival = "mmapshared",
2325 .oval = MEM_MMAPSHARED,
2326 .help = "Like mmap, but use the shared flag",
2328 #ifdef FIO_HAVE_HUGETLB
2329 { .ival = "mmaphuge",
2330 .oval = MEM_MMAPHUGE,
2331 .help = "Like mmap, but use huge pages",
2337 .name = "iomem_align",
2338 .alias = "mem_align",
2339 .lname = "I/O memory alignment",
2340 .type = FIO_OPT_INT,
2341 .off1 = td_var_offset(mem_align),
2343 .help = "IO memory buffer offset alignment",
2347 .category = FIO_OPT_C_IO,
2348 .group = FIO_OPT_G_INVALID,
2353 .type = FIO_OPT_STR,
2354 .off1 = td_var_offset(verify),
2355 .help = "Verify data written",
2357 .category = FIO_OPT_C_IO,
2358 .group = FIO_OPT_G_VERIFY,
2361 .oval = VERIFY_NONE,
2362 .help = "Don't do IO verification",
2366 .help = "Use md5 checksums for verification",
2369 .oval = VERIFY_CRC64,
2370 .help = "Use crc64 checksums for verification",
2373 .oval = VERIFY_CRC32,
2374 .help = "Use crc32 checksums for verification",
2376 { .ival = "crc32c-intel",
2377 .oval = VERIFY_CRC32C,
2378 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2381 .oval = VERIFY_CRC32C,
2382 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2385 .oval = VERIFY_CRC16,
2386 .help = "Use crc16 checksums for verification",
2389 .oval = VERIFY_CRC7,
2390 .help = "Use crc7 checksums for verification",
2393 .oval = VERIFY_SHA1,
2394 .help = "Use sha1 checksums for verification",
2397 .oval = VERIFY_SHA256,
2398 .help = "Use sha256 checksums for verification",
2401 .oval = VERIFY_SHA512,
2402 .help = "Use sha512 checksums for verification",
2405 .oval = VERIFY_XXHASH,
2406 .help = "Use xxhash checksums for verification",
2408 /* Meta information was included into verify_header,
2409 * 'meta' verification is implied by default. */
2411 .oval = VERIFY_HDR_ONLY,
2412 .help = "Use io information for verification. "
2413 "Now is implied by default, thus option is obsolete, "
2416 { .ival = "pattern",
2417 .oval = VERIFY_PATTERN_NO_HDR,
2418 .help = "Verify strict pattern",
2422 .oval = VERIFY_NULL,
2423 .help = "Pretend to verify",
2428 .name = "do_verify",
2429 .lname = "Perform verify step",
2430 .type = FIO_OPT_BOOL,
2431 .off1 = td_var_offset(do_verify),
2432 .help = "Run verification stage after write",
2436 .category = FIO_OPT_C_IO,
2437 .group = FIO_OPT_G_VERIFY,
2440 .name = "verifysort",
2441 .lname = "Verify sort",
2442 .type = FIO_OPT_BOOL,
2443 .off1 = td_var_offset(verifysort),
2444 .help = "Sort written verify blocks for read back",
2448 .category = FIO_OPT_C_IO,
2449 .group = FIO_OPT_G_VERIFY,
2452 .name = "verifysort_nr",
2453 .type = FIO_OPT_INT,
2454 .off1 = td_var_offset(verifysort_nr),
2455 .help = "Pre-load and sort verify blocks for a read workload",
2460 .category = FIO_OPT_C_IO,
2461 .group = FIO_OPT_G_VERIFY,
2464 .name = "verify_interval",
2465 .lname = "Verify interval",
2466 .type = FIO_OPT_INT,
2467 .off1 = td_var_offset(verify_interval),
2468 .minval = 2 * sizeof(struct verify_header),
2469 .help = "Store verify buffer header every N bytes",
2472 .interval = 2 * sizeof(struct verify_header),
2473 .category = FIO_OPT_C_IO,
2474 .group = FIO_OPT_G_VERIFY,
2477 .name = "verify_offset",
2478 .lname = "Verify offset",
2479 .type = FIO_OPT_INT,
2480 .help = "Offset verify header location by N bytes",
2481 .off1 = td_var_offset(verify_offset),
2482 .minval = sizeof(struct verify_header),
2485 .category = FIO_OPT_C_IO,
2486 .group = FIO_OPT_G_VERIFY,
2489 .name = "verify_pattern",
2490 .lname = "Verify pattern",
2491 .type = FIO_OPT_STR,
2492 .cb = str_verify_pattern_cb,
2493 .off1 = td_var_offset(verify_pattern),
2494 .help = "Fill pattern for IO buffers",
2497 .category = FIO_OPT_C_IO,
2498 .group = FIO_OPT_G_VERIFY,
2501 .name = "verify_fatal",
2502 .lname = "Verify fatal",
2503 .type = FIO_OPT_BOOL,
2504 .off1 = td_var_offset(verify_fatal),
2506 .help = "Exit on a single verify failure, don't continue",
2509 .category = FIO_OPT_C_IO,
2510 .group = FIO_OPT_G_VERIFY,
2513 .name = "verify_dump",
2514 .lname = "Verify dump",
2515 .type = FIO_OPT_BOOL,
2516 .off1 = td_var_offset(verify_dump),
2518 .help = "Dump contents of good and bad blocks on failure",
2521 .category = FIO_OPT_C_IO,
2522 .group = FIO_OPT_G_VERIFY,
2525 .name = "verify_async",
2526 .lname = "Verify asynchronously",
2527 .type = FIO_OPT_INT,
2528 .off1 = td_var_offset(verify_async),
2530 .help = "Number of async verifier threads to use",
2533 .category = FIO_OPT_C_IO,
2534 .group = FIO_OPT_G_VERIFY,
2537 .name = "verify_backlog",
2538 .lname = "Verify backlog",
2539 .type = FIO_OPT_STR_VAL,
2540 .off1 = td_var_offset(verify_backlog),
2541 .help = "Verify after this number of blocks are written",
2544 .category = FIO_OPT_C_IO,
2545 .group = FIO_OPT_G_VERIFY,
2548 .name = "verify_backlog_batch",
2549 .lname = "Verify backlog batch",
2550 .type = FIO_OPT_INT,
2551 .off1 = td_var_offset(verify_batch),
2552 .help = "Verify this number of IO blocks",
2555 .category = FIO_OPT_C_IO,
2556 .group = FIO_OPT_G_VERIFY,
2558 #ifdef FIO_HAVE_CPU_AFFINITY
2560 .name = "verify_async_cpus",
2561 .lname = "Async verify CPUs",
2562 .type = FIO_OPT_STR,
2563 .cb = str_verify_cpus_allowed_cb,
2564 .off1 = td_var_offset(verify_cpumask),
2565 .help = "Set CPUs allowed for async verify threads",
2566 .parent = "verify_async",
2568 .category = FIO_OPT_C_IO,
2569 .group = FIO_OPT_G_VERIFY,
2573 .name = "experimental_verify",
2574 .off1 = td_var_offset(experimental_verify),
2575 .type = FIO_OPT_BOOL,
2576 .help = "Enable experimental verification",
2578 .category = FIO_OPT_C_IO,
2579 .group = FIO_OPT_G_VERIFY,
2582 .name = "verify_state_load",
2583 .lname = "Load verify state",
2584 .off1 = td_var_offset(verify_state),
2585 .type = FIO_OPT_BOOL,
2586 .help = "Load verify termination state",
2588 .category = FIO_OPT_C_IO,
2589 .group = FIO_OPT_G_VERIFY,
2592 .name = "verify_state_save",
2593 .lname = "Save verify state",
2594 .off1 = td_var_offset(verify_state_save),
2595 .type = FIO_OPT_BOOL,
2597 .help = "Save verify state on termination",
2599 .category = FIO_OPT_C_IO,
2600 .group = FIO_OPT_G_VERIFY,
2602 #ifdef FIO_HAVE_TRIM
2604 .name = "trim_percentage",
2605 .lname = "Trim percentage",
2606 .type = FIO_OPT_INT,
2607 .off1 = td_var_offset(trim_percentage),
2610 .help = "Number of verify blocks to discard/trim",
2615 .category = FIO_OPT_C_IO,
2616 .group = FIO_OPT_G_TRIM,
2619 .name = "trim_verify_zero",
2620 .lname = "Verify trim zero",
2621 .type = FIO_OPT_BOOL,
2622 .help = "Verify that trim/discarded blocks are returned as zeroes",
2623 .off1 = td_var_offset(trim_zero),
2624 .parent = "trim_percentage",
2627 .category = FIO_OPT_C_IO,
2628 .group = FIO_OPT_G_TRIM,
2631 .name = "trim_backlog",
2632 .lname = "Trim backlog",
2633 .type = FIO_OPT_STR_VAL,
2634 .off1 = td_var_offset(trim_backlog),
2635 .help = "Trim after this number of blocks are written",
2636 .parent = "trim_percentage",
2639 .category = FIO_OPT_C_IO,
2640 .group = FIO_OPT_G_TRIM,
2643 .name = "trim_backlog_batch",
2644 .lname = "Trim backlog batch",
2645 .type = FIO_OPT_INT,
2646 .off1 = td_var_offset(trim_batch),
2647 .help = "Trim this number of IO blocks",
2648 .parent = "trim_percentage",
2651 .category = FIO_OPT_C_IO,
2652 .group = FIO_OPT_G_TRIM,
2656 .name = "write_iolog",
2657 .lname = "Write I/O log",
2658 .type = FIO_OPT_STR_STORE,
2659 .off1 = td_var_offset(write_iolog_file),
2660 .help = "Store IO pattern to file",
2661 .category = FIO_OPT_C_IO,
2662 .group = FIO_OPT_G_IOLOG,
2665 .name = "read_iolog",
2666 .lname = "Read I/O log",
2667 .type = FIO_OPT_STR_STORE,
2668 .off1 = td_var_offset(read_iolog_file),
2669 .help = "Playback IO pattern from file",
2670 .category = FIO_OPT_C_IO,
2671 .group = FIO_OPT_G_IOLOG,
2674 .name = "replay_no_stall",
2675 .lname = "Don't stall on replay",
2676 .type = FIO_OPT_BOOL,
2677 .off1 = td_var_offset(no_stall),
2679 .parent = "read_iolog",
2681 .help = "Playback IO pattern file as fast as possible without stalls",
2682 .category = FIO_OPT_C_IO,
2683 .group = FIO_OPT_G_IOLOG,
2686 .name = "replay_redirect",
2687 .lname = "Redirect device for replay",
2688 .type = FIO_OPT_STR_STORE,
2689 .off1 = td_var_offset(replay_redirect),
2690 .parent = "read_iolog",
2692 .help = "Replay all I/O onto this device, regardless of trace device",
2693 .category = FIO_OPT_C_IO,
2694 .group = FIO_OPT_G_IOLOG,
2697 .name = "replay_scale",
2698 .lname = "Replace offset scale factor",
2699 .type = FIO_OPT_INT,
2700 .off1 = td_var_offset(replay_scale),
2701 .parent = "read_iolog",
2703 .help = "Align offsets to this blocksize",
2704 .category = FIO_OPT_C_IO,
2705 .group = FIO_OPT_G_IOLOG,
2708 .name = "replay_align",
2709 .lname = "Replace alignment",
2710 .type = FIO_OPT_INT,
2711 .off1 = td_var_offset(replay_align),
2712 .parent = "read_iolog",
2713 .help = "Scale offset down by this factor",
2714 .category = FIO_OPT_C_IO,
2715 .group = FIO_OPT_G_IOLOG,
2719 .name = "exec_prerun",
2720 .lname = "Pre-execute runnable",
2721 .type = FIO_OPT_STR_STORE,
2722 .off1 = td_var_offset(exec_prerun),
2723 .help = "Execute this file prior to running job",
2724 .category = FIO_OPT_C_GENERAL,
2725 .group = FIO_OPT_G_INVALID,
2728 .name = "exec_postrun",
2729 .lname = "Post-execute runnable",
2730 .type = FIO_OPT_STR_STORE,
2731 .off1 = td_var_offset(exec_postrun),
2732 .help = "Execute this file after running job",
2733 .category = FIO_OPT_C_GENERAL,
2734 .group = FIO_OPT_G_INVALID,
2736 #ifdef FIO_HAVE_IOSCHED_SWITCH
2738 .name = "ioscheduler",
2739 .lname = "I/O scheduler",
2740 .type = FIO_OPT_STR_STORE,
2741 .off1 = td_var_offset(ioscheduler),
2742 .help = "Use this IO scheduler on the backing device",
2743 .category = FIO_OPT_C_FILE,
2744 .group = FIO_OPT_G_INVALID,
2749 .lname = "Zone size",
2750 .type = FIO_OPT_STR_VAL,
2751 .off1 = td_var_offset(zone_size),
2752 .help = "Amount of data to read per zone",
2754 .interval = 1024 * 1024,
2755 .category = FIO_OPT_C_IO,
2756 .group = FIO_OPT_G_ZONE,
2759 .name = "zonerange",
2760 .lname = "Zone range",
2761 .type = FIO_OPT_STR_VAL,
2762 .off1 = td_var_offset(zone_range),
2763 .help = "Give size of an IO zone",
2765 .interval = 1024 * 1024,
2766 .category = FIO_OPT_C_IO,
2767 .group = FIO_OPT_G_ZONE,
2771 .lname = "Zone skip",
2772 .type = FIO_OPT_STR_VAL,
2773 .off1 = td_var_offset(zone_skip),
2774 .help = "Space between IO zones",
2776 .interval = 1024 * 1024,
2777 .category = FIO_OPT_C_IO,
2778 .group = FIO_OPT_G_ZONE,
2782 .lname = "Lock memory",
2783 .type = FIO_OPT_STR_VAL,
2784 .off1 = td_var_offset(lockmem),
2785 .help = "Lock down this amount of memory (per worker)",
2787 .interval = 1024 * 1024,
2788 .category = FIO_OPT_C_GENERAL,
2789 .group = FIO_OPT_G_INVALID,
2792 .name = "rwmixread",
2793 .lname = "Read/write mix read",
2794 .type = FIO_OPT_INT,
2795 .cb = str_rwmix_read_cb,
2796 .off1 = td_var_offset(rwmix[DDIR_READ]),
2798 .help = "Percentage of mixed workload that is reads",
2801 .inverse = "rwmixwrite",
2802 .category = FIO_OPT_C_IO,
2803 .group = FIO_OPT_G_RWMIX,
2806 .name = "rwmixwrite",
2807 .lname = "Read/write mix write",
2808 .type = FIO_OPT_INT,
2809 .cb = str_rwmix_write_cb,
2810 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
2812 .help = "Percentage of mixed workload that is writes",
2815 .inverse = "rwmixread",
2816 .category = FIO_OPT_C_IO,
2817 .group = FIO_OPT_G_RWMIX,
2820 .name = "rwmixcycle",
2821 .lname = "Read/write mix cycle",
2822 .type = FIO_OPT_DEPRECATED,
2823 .category = FIO_OPT_C_IO,
2824 .group = FIO_OPT_G_RWMIX,
2829 .type = FIO_OPT_INT,
2830 .off1 = td_var_offset(nice),
2831 .help = "Set job CPU nice value",
2836 .category = FIO_OPT_C_GENERAL,
2837 .group = FIO_OPT_G_CRED,
2839 #ifdef FIO_HAVE_IOPRIO
2842 .lname = "I/O nice priority",
2843 .type = FIO_OPT_INT,
2844 .off1 = td_var_offset(ioprio),
2845 .help = "Set job IO priority value",
2849 .category = FIO_OPT_C_GENERAL,
2850 .group = FIO_OPT_G_CRED,
2853 .name = "prioclass",
2854 .lname = "I/O nice priority class",
2855 .type = FIO_OPT_INT,
2856 .off1 = td_var_offset(ioprio_class),
2857 .help = "Set job IO priority class",
2861 .category = FIO_OPT_C_GENERAL,
2862 .group = FIO_OPT_G_CRED,
2866 .name = "thinktime",
2867 .lname = "Thinktime",
2868 .type = FIO_OPT_INT,
2869 .off1 = td_var_offset(thinktime),
2870 .help = "Idle time between IO buffers (usec)",
2873 .category = FIO_OPT_C_IO,
2874 .group = FIO_OPT_G_THINKTIME,
2877 .name = "thinktime_spin",
2878 .lname = "Thinktime spin",
2879 .type = FIO_OPT_INT,
2880 .off1 = td_var_offset(thinktime_spin),
2881 .help = "Start think time by spinning this amount (usec)",
2884 .parent = "thinktime",
2886 .category = FIO_OPT_C_IO,
2887 .group = FIO_OPT_G_THINKTIME,
2890 .name = "thinktime_blocks",
2891 .lname = "Thinktime blocks",
2892 .type = FIO_OPT_INT,
2893 .off1 = td_var_offset(thinktime_blocks),
2894 .help = "IO buffer period between 'thinktime'",
2896 .parent = "thinktime",
2898 .category = FIO_OPT_C_IO,
2899 .group = FIO_OPT_G_THINKTIME,
2903 .lname = "I/O rate",
2904 .type = FIO_OPT_INT,
2905 .off1 = td_var_offset(rate[DDIR_READ]),
2906 .off2 = td_var_offset(rate[DDIR_WRITE]),
2907 .off3 = td_var_offset(rate[DDIR_TRIM]),
2908 .help = "Set bandwidth rate",
2909 .category = FIO_OPT_C_IO,
2910 .group = FIO_OPT_G_RATE,
2915 .lname = "I/O min rate",
2916 .type = FIO_OPT_INT,
2917 .off1 = td_var_offset(ratemin[DDIR_READ]),
2918 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2919 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2920 .help = "Job must meet this rate or it will be shutdown",
2923 .category = FIO_OPT_C_IO,
2924 .group = FIO_OPT_G_RATE,
2927 .name = "rate_iops",
2928 .lname = "I/O rate IOPS",
2929 .type = FIO_OPT_INT,
2930 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2931 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2932 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2933 .help = "Limit IO used to this number of IO operations/sec",
2935 .category = FIO_OPT_C_IO,
2936 .group = FIO_OPT_G_RATE,
2939 .name = "rate_iops_min",
2940 .lname = "I/O min rate IOPS",
2941 .type = FIO_OPT_INT,
2942 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2943 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2944 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2945 .help = "Job must meet this rate or it will be shut down",
2946 .parent = "rate_iops",
2948 .category = FIO_OPT_C_IO,
2949 .group = FIO_OPT_G_RATE,
2952 .name = "rate_process",
2953 .lname = "Rate Process",
2954 .type = FIO_OPT_STR,
2955 .off1 = td_var_offset(rate_process),
2956 .help = "What process controls how rated IO is managed",
2958 .category = FIO_OPT_C_IO,
2959 .group = FIO_OPT_G_RATE,
2962 .oval = RATE_PROCESS_LINEAR,
2963 .help = "Linear rate of IO",
2967 .oval = RATE_PROCESS_POISSON,
2968 .help = "Rate follows Poisson process",
2974 .name = "rate_cycle",
2975 .alias = "ratecycle",
2976 .lname = "I/O rate cycle",
2977 .type = FIO_OPT_INT,
2978 .off1 = td_var_offset(ratecycle),
2979 .help = "Window average for rate limits (msec)",
2983 .category = FIO_OPT_C_IO,
2984 .group = FIO_OPT_G_RATE,
2987 .name = "max_latency",
2988 .type = FIO_OPT_INT,
2989 .off1 = td_var_offset(max_latency),
2990 .help = "Maximum tolerated IO latency (usec)",
2992 .category = FIO_OPT_C_IO,
2993 .group = FIO_OPT_G_LATPROF,
2996 .name = "latency_target",
2997 .lname = "Latency Target (usec)",
2998 .type = FIO_OPT_STR_VAL_TIME,
2999 .off1 = td_var_offset(latency_target),
3000 .help = "Ramp to max queue depth supporting this latency",
3002 .category = FIO_OPT_C_IO,
3003 .group = FIO_OPT_G_LATPROF,
3006 .name = "latency_window",
3007 .lname = "Latency Window (usec)",
3008 .type = FIO_OPT_STR_VAL_TIME,
3009 .off1 = td_var_offset(latency_window),
3010 .help = "Time to sustain latency_target",
3012 .category = FIO_OPT_C_IO,
3013 .group = FIO_OPT_G_LATPROF,
3016 .name = "latency_percentile",
3017 .lname = "Latency Percentile",
3018 .type = FIO_OPT_FLOAT_LIST,
3019 .off1 = td_var_offset(latency_percentile),
3020 .help = "Percentile of IOs must be below latency_target",
3025 .category = FIO_OPT_C_IO,
3026 .group = FIO_OPT_G_LATPROF,
3029 .name = "invalidate",
3030 .lname = "Cache invalidate",
3031 .type = FIO_OPT_BOOL,
3032 .off1 = td_var_offset(invalidate_cache),
3033 .help = "Invalidate buffer/page cache prior to running job",
3035 .category = FIO_OPT_C_IO,
3036 .group = FIO_OPT_G_IO_TYPE,
3040 .lname = "Synchronous I/O",
3041 .type = FIO_OPT_BOOL,
3042 .off1 = td_var_offset(sync_io),
3043 .help = "Use O_SYNC for buffered writes",
3045 .parent = "buffered",
3047 .category = FIO_OPT_C_IO,
3048 .group = FIO_OPT_G_IO_TYPE,
3051 .name = "create_serialize",
3052 .lname = "Create serialize",
3053 .type = FIO_OPT_BOOL,
3054 .off1 = td_var_offset(create_serialize),
3055 .help = "Serialize creating of job files",
3057 .category = FIO_OPT_C_FILE,
3058 .group = FIO_OPT_G_INVALID,
3061 .name = "create_fsync",
3062 .lname = "Create fsync",
3063 .type = FIO_OPT_BOOL,
3064 .off1 = td_var_offset(create_fsync),
3065 .help = "fsync file after creation",
3067 .category = FIO_OPT_C_FILE,
3068 .group = FIO_OPT_G_INVALID,
3071 .name = "create_on_open",
3072 .lname = "Create on open",
3073 .type = FIO_OPT_BOOL,
3074 .off1 = td_var_offset(create_on_open),
3075 .help = "Create files when they are opened for IO",
3077 .category = FIO_OPT_C_FILE,
3078 .group = FIO_OPT_G_INVALID,
3081 .name = "create_only",
3082 .type = FIO_OPT_BOOL,
3083 .off1 = td_var_offset(create_only),
3084 .help = "Only perform file creation phase",
3085 .category = FIO_OPT_C_FILE,
3089 .name = "allow_file_create",
3090 .lname = "Allow file create",
3091 .type = FIO_OPT_BOOL,
3092 .off1 = td_var_offset(allow_create),
3093 .help = "Permit fio to create files, if they don't exist",
3095 .category = FIO_OPT_C_FILE,
3096 .group = FIO_OPT_G_FILENAME,
3099 .name = "allow_mounted_write",
3100 .lname = "Allow mounted write",
3101 .type = FIO_OPT_BOOL,
3102 .off1 = td_var_offset(allow_mounted_write),
3103 .help = "Allow writes to a mounted partition",
3105 .category = FIO_OPT_C_FILE,
3106 .group = FIO_OPT_G_FILENAME,
3110 .lname = "Pre-read files",
3111 .type = FIO_OPT_BOOL,
3112 .off1 = td_var_offset(pre_read),
3113 .help = "Pre-read files before starting official testing",
3115 .category = FIO_OPT_C_FILE,
3116 .group = FIO_OPT_G_INVALID,
3118 #ifdef FIO_HAVE_CPU_AFFINITY
3121 .lname = "CPU mask",
3122 .type = FIO_OPT_INT,
3123 .cb = str_cpumask_cb,
3124 .off1 = td_var_offset(cpumask),
3125 .help = "CPU affinity mask",
3126 .category = FIO_OPT_C_GENERAL,
3127 .group = FIO_OPT_G_CRED,
3130 .name = "cpus_allowed",
3131 .lname = "CPUs allowed",
3132 .type = FIO_OPT_STR,
3133 .cb = str_cpus_allowed_cb,
3134 .off1 = td_var_offset(cpumask),
3135 .help = "Set CPUs allowed",
3136 .category = FIO_OPT_C_GENERAL,
3137 .group = FIO_OPT_G_CRED,
3140 .name = "cpus_allowed_policy",
3141 .lname = "CPUs allowed distribution policy",
3142 .type = FIO_OPT_STR,
3143 .off1 = td_var_offset(cpus_allowed_policy),
3144 .help = "Distribution policy for cpus_allowed",
3145 .parent = "cpus_allowed",
3149 .oval = FIO_CPUS_SHARED,
3150 .help = "Mask shared between threads",
3153 .oval = FIO_CPUS_SPLIT,
3154 .help = "Mask split between threads",
3157 .category = FIO_OPT_C_GENERAL,
3158 .group = FIO_OPT_G_CRED,
3161 #ifdef CONFIG_LIBNUMA
3163 .name = "numa_cpu_nodes",
3164 .type = FIO_OPT_STR,
3165 .cb = str_numa_cpunodes_cb,
3166 .off1 = td_var_offset(numa_cpunodes),
3167 .help = "NUMA CPU nodes bind",
3168 .category = FIO_OPT_C_GENERAL,
3169 .group = FIO_OPT_G_INVALID,
3172 .name = "numa_mem_policy",
3173 .type = FIO_OPT_STR,
3174 .cb = str_numa_mpol_cb,
3175 .off1 = td_var_offset(numa_memnodes),
3176 .help = "NUMA memory policy setup",
3177 .category = FIO_OPT_C_GENERAL,
3178 .group = FIO_OPT_G_INVALID,
3182 .name = "end_fsync",
3183 .lname = "End fsync",
3184 .type = FIO_OPT_BOOL,
3185 .off1 = td_var_offset(end_fsync),
3186 .help = "Include fsync at the end of job",
3188 .category = FIO_OPT_C_FILE,
3189 .group = FIO_OPT_G_INVALID,
3192 .name = "fsync_on_close",
3193 .lname = "Fsync on close",
3194 .type = FIO_OPT_BOOL,
3195 .off1 = td_var_offset(fsync_on_close),
3196 .help = "fsync files on close",
3198 .category = FIO_OPT_C_FILE,
3199 .group = FIO_OPT_G_INVALID,
3203 .lname = "Unlink file",
3204 .type = FIO_OPT_BOOL,
3205 .off1 = td_var_offset(unlink),
3206 .help = "Unlink created files after job has completed",
3208 .category = FIO_OPT_C_FILE,
3209 .group = FIO_OPT_G_INVALID,
3213 .lname = "Exit-all on terminate",
3214 .type = FIO_OPT_STR_SET,
3215 .cb = str_exitall_cb,
3216 .help = "Terminate all jobs when one exits",
3217 .category = FIO_OPT_C_GENERAL,
3218 .group = FIO_OPT_G_PROCESS,
3221 .name = "exitall_on_error",
3222 .lname = "Exit-all on terminate in error",
3223 .type = FIO_OPT_BOOL,
3224 .off1 = td_var_offset(unlink),
3225 .help = "Terminate all jobs when one exits in error",
3226 .category = FIO_OPT_C_GENERAL,
3227 .group = FIO_OPT_G_PROCESS,
3230 .name = "stonewall",
3231 .lname = "Wait for previous",
3232 .alias = "wait_for_previous",
3233 .type = FIO_OPT_STR_SET,
3234 .off1 = td_var_offset(stonewall),
3235 .help = "Insert a hard barrier between this job and previous",
3236 .category = FIO_OPT_C_GENERAL,
3237 .group = FIO_OPT_G_PROCESS,
3240 .name = "new_group",
3241 .lname = "New group",
3242 .type = FIO_OPT_STR_SET,
3243 .off1 = td_var_offset(new_group),
3244 .help = "Mark the start of a new group (for reporting)",
3245 .category = FIO_OPT_C_GENERAL,
3246 .group = FIO_OPT_G_PROCESS,
3251 .type = FIO_OPT_STR_SET,
3252 .off1 = td_var_offset(use_thread),
3253 .help = "Use threads instead of processes",
3254 #ifdef CONFIG_NO_SHM
3258 .category = FIO_OPT_C_GENERAL,
3259 .group = FIO_OPT_G_PROCESS,
3262 .name = "per_job_logs",
3263 .type = FIO_OPT_BOOL,
3264 .off1 = td_var_offset(per_job_logs),
3265 .help = "Include job number in generated log files or not",
3267 .category = FIO_OPT_C_LOG,
3268 .group = FIO_OPT_G_INVALID,
3271 .name = "write_bw_log",
3272 .lname = "Write bandwidth log",
3273 .type = FIO_OPT_STR_STORE,
3274 .off1 = td_var_offset(bw_log_file),
3275 .help = "Write log of bandwidth during run",
3276 .category = FIO_OPT_C_LOG,
3277 .group = FIO_OPT_G_INVALID,
3280 .name = "write_lat_log",
3281 .lname = "Write latency log",
3282 .type = FIO_OPT_STR_STORE,
3283 .off1 = td_var_offset(lat_log_file),
3284 .help = "Write log of latency during run",
3285 .category = FIO_OPT_C_LOG,
3286 .group = FIO_OPT_G_INVALID,
3289 .name = "write_iops_log",
3290 .lname = "Write IOPS log",
3291 .type = FIO_OPT_STR_STORE,
3292 .off1 = td_var_offset(iops_log_file),
3293 .help = "Write log of IOPS during run",
3294 .category = FIO_OPT_C_LOG,
3295 .group = FIO_OPT_G_INVALID,
3298 .name = "log_avg_msec",
3299 .lname = "Log averaging (msec)",
3300 .type = FIO_OPT_INT,
3301 .off1 = td_var_offset(log_avg_msec),
3302 .help = "Average bw/iops/lat logs over this period of time",
3304 .category = FIO_OPT_C_LOG,
3305 .group = FIO_OPT_G_INVALID,
3308 .name = "log_max_value",
3309 .lname = "Log maximum instead of average",
3310 .type = FIO_OPT_BOOL,
3311 .off1 = td_var_offset(log_max),
3312 .help = "Log max sample in a window instead of average",
3314 .category = FIO_OPT_C_LOG,
3315 .group = FIO_OPT_G_INVALID,
3318 .name = "log_offset",
3319 .lname = "Log offset of IO",
3320 .type = FIO_OPT_BOOL,
3321 .off1 = td_var_offset(log_offset),
3322 .help = "Include offset of IO for each log entry",
3324 .category = FIO_OPT_C_LOG,
3325 .group = FIO_OPT_G_INVALID,
3329 .name = "log_compression",
3330 .lname = "Log compression",
3331 .type = FIO_OPT_INT,
3332 .off1 = td_var_offset(log_gz),
3333 .help = "Log in compressed chunks of this size",
3335 .maxval = 512 * 1024 * 1024ULL,
3336 .category = FIO_OPT_C_LOG,
3337 .group = FIO_OPT_G_INVALID,
3339 #ifdef FIO_HAVE_CPU_AFFINITY
3341 .name = "log_compression_cpus",
3342 .lname = "Log Compression CPUs",
3343 .type = FIO_OPT_STR,
3344 .cb = str_log_cpus_allowed_cb,
3345 .off1 = td_var_offset(log_gz_cpumask),
3346 .parent = "log_compression",
3347 .help = "Limit log compression to these CPUs",
3348 .category = FIO_OPT_C_LOG,
3349 .group = FIO_OPT_G_INVALID,
3353 .name = "log_store_compressed",
3354 .lname = "Log store compressed",
3355 .type = FIO_OPT_BOOL,
3356 .off1 = td_var_offset(log_gz_store),
3357 .help = "Store logs in a compressed format",
3358 .category = FIO_OPT_C_LOG,
3359 .group = FIO_OPT_G_INVALID,
3363 .name = "block_error_percentiles",
3364 .lname = "Block error percentiles",
3365 .type = FIO_OPT_BOOL,
3366 .off1 = td_var_offset(block_error_hist),
3367 .help = "Record trim block errors and make a histogram",
3369 .category = FIO_OPT_C_LOG,
3370 .group = FIO_OPT_G_INVALID,
3373 .name = "bwavgtime",
3374 .lname = "Bandwidth average time",
3375 .type = FIO_OPT_INT,
3376 .off1 = td_var_offset(bw_avg_time),
3377 .help = "Time window over which to calculate bandwidth"
3380 .parent = "write_bw_log",
3383 .category = FIO_OPT_C_LOG,
3384 .group = FIO_OPT_G_INVALID,
3387 .name = "iopsavgtime",
3388 .lname = "IOPS average time",
3389 .type = FIO_OPT_INT,
3390 .off1 = td_var_offset(iops_avg_time),
3391 .help = "Time window over which to calculate IOPS (msec)",
3393 .parent = "write_iops_log",
3396 .category = FIO_OPT_C_LOG,
3397 .group = FIO_OPT_G_INVALID,
3400 .name = "group_reporting",
3401 .lname = "Group reporting",
3402 .type = FIO_OPT_STR_SET,
3403 .off1 = td_var_offset(group_reporting),
3404 .help = "Do reporting on a per-group basis",
3405 .category = FIO_OPT_C_STAT,
3406 .group = FIO_OPT_G_INVALID,
3409 .name = "zero_buffers",
3410 .lname = "Zero I/O buffers",
3411 .type = FIO_OPT_STR_SET,
3412 .off1 = td_var_offset(zero_buffers),
3413 .help = "Init IO buffers to all zeroes",
3414 .category = FIO_OPT_C_IO,
3415 .group = FIO_OPT_G_IO_BUF,
3418 .name = "refill_buffers",
3419 .lname = "Refill I/O buffers",
3420 .type = FIO_OPT_STR_SET,
3421 .off1 = td_var_offset(refill_buffers),
3422 .help = "Refill IO buffers on every IO submit",
3423 .category = FIO_OPT_C_IO,
3424 .group = FIO_OPT_G_IO_BUF,
3427 .name = "scramble_buffers",
3428 .lname = "Scramble I/O buffers",
3429 .type = FIO_OPT_BOOL,
3430 .off1 = td_var_offset(scramble_buffers),
3431 .help = "Slightly scramble buffers on every IO submit",
3433 .category = FIO_OPT_C_IO,
3434 .group = FIO_OPT_G_IO_BUF,
3437 .name = "buffer_pattern",
3438 .lname = "Buffer pattern",
3439 .type = FIO_OPT_STR,
3440 .cb = str_buffer_pattern_cb,
3441 .off1 = td_var_offset(buffer_pattern),
3442 .help = "Fill pattern for IO buffers",
3443 .category = FIO_OPT_C_IO,
3444 .group = FIO_OPT_G_IO_BUF,
3447 .name = "buffer_compress_percentage",
3448 .lname = "Buffer compression percentage",
3449 .type = FIO_OPT_INT,
3450 .cb = str_buffer_compress_cb,
3451 .off1 = td_var_offset(compress_percentage),
3454 .help = "How compressible the buffer is (approximately)",
3456 .category = FIO_OPT_C_IO,
3457 .group = FIO_OPT_G_IO_BUF,
3460 .name = "buffer_compress_chunk",
3461 .lname = "Buffer compression chunk size",
3462 .type = FIO_OPT_INT,
3463 .off1 = td_var_offset(compress_chunk),
3464 .parent = "buffer_compress_percentage",
3466 .help = "Size of compressible region in buffer",
3468 .category = FIO_OPT_C_IO,
3469 .group = FIO_OPT_G_IO_BUF,
3472 .name = "dedupe_percentage",
3473 .lname = "Dedupe percentage",
3474 .type = FIO_OPT_INT,
3475 .cb = str_dedupe_cb,
3476 .off1 = td_var_offset(dedupe_percentage),
3479 .help = "Percentage of buffers that are dedupable",
3481 .category = FIO_OPT_C_IO,
3482 .group = FIO_OPT_G_IO_BUF,
3485 .name = "clat_percentiles",
3486 .lname = "Completion latency percentiles",
3487 .type = FIO_OPT_BOOL,
3488 .off1 = td_var_offset(clat_percentiles),
3489 .help = "Enable the reporting of completion latency percentiles",
3491 .category = FIO_OPT_C_STAT,
3492 .group = FIO_OPT_G_INVALID,
3495 .name = "percentile_list",
3496 .lname = "Percentile list",
3497 .type = FIO_OPT_FLOAT_LIST,
3498 .off1 = td_var_offset(percentile_list),
3499 .off2 = td_var_offset(percentile_precision),
3500 .help = "Specify a custom list of percentiles to report for "
3501 "completion latency and block errors",
3502 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3503 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3506 .category = FIO_OPT_C_STAT,
3507 .group = FIO_OPT_G_INVALID,
3510 #ifdef FIO_HAVE_DISK_UTIL
3512 .name = "disk_util",
3513 .lname = "Disk utilization",
3514 .type = FIO_OPT_BOOL,
3515 .off1 = td_var_offset(do_disk_util),
3516 .help = "Log disk utilization statistics",
3518 .category = FIO_OPT_C_STAT,
3519 .group = FIO_OPT_G_INVALID,
3523 .name = "gtod_reduce",
3524 .lname = "Reduce gettimeofday() calls",
3525 .type = FIO_OPT_BOOL,
3526 .help = "Greatly reduce number of gettimeofday() calls",
3527 .cb = str_gtod_reduce_cb,
3530 .category = FIO_OPT_C_STAT,
3531 .group = FIO_OPT_G_INVALID,
3534 .name = "disable_lat",
3535 .lname = "Disable all latency stats",
3536 .type = FIO_OPT_BOOL,
3537 .off1 = td_var_offset(disable_lat),
3538 .help = "Disable latency numbers",
3539 .parent = "gtod_reduce",
3542 .category = FIO_OPT_C_STAT,
3543 .group = FIO_OPT_G_INVALID,
3546 .name = "disable_clat",
3547 .lname = "Disable completion latency stats",
3548 .type = FIO_OPT_BOOL,
3549 .off1 = td_var_offset(disable_clat),
3550 .help = "Disable completion latency numbers",
3551 .parent = "gtod_reduce",
3554 .category = FIO_OPT_C_STAT,
3555 .group = FIO_OPT_G_INVALID,
3558 .name = "disable_slat",
3559 .lname = "Disable submission latency stats",
3560 .type = FIO_OPT_BOOL,
3561 .off1 = td_var_offset(disable_slat),
3562 .help = "Disable submission latency numbers",
3563 .parent = "gtod_reduce",
3566 .category = FIO_OPT_C_STAT,
3567 .group = FIO_OPT_G_INVALID,
3570 .name = "disable_bw_measurement",
3571 .lname = "Disable bandwidth stats",
3572 .type = FIO_OPT_BOOL,
3573 .off1 = td_var_offset(disable_bw),
3574 .help = "Disable bandwidth logging",
3575 .parent = "gtod_reduce",
3578 .category = FIO_OPT_C_STAT,
3579 .group = FIO_OPT_G_INVALID,
3583 .lname = "Dedicated gettimeofday() CPU",
3584 .type = FIO_OPT_INT,
3585 .off1 = td_var_offset(gtod_cpu),
3586 .help = "Set up dedicated gettimeofday() thread on this CPU",
3587 .verify = gtod_cpu_verify,
3588 .category = FIO_OPT_C_GENERAL,
3589 .group = FIO_OPT_G_CLOCK,
3592 .name = "unified_rw_reporting",
3593 .type = FIO_OPT_BOOL,
3594 .off1 = td_var_offset(unified_rw_rep),
3595 .help = "Unify reporting across data direction",
3597 .category = FIO_OPT_C_GENERAL,
3598 .group = FIO_OPT_G_INVALID,
3601 .name = "continue_on_error",
3602 .lname = "Continue on error",
3603 .type = FIO_OPT_STR,
3604 .off1 = td_var_offset(continue_on_error),
3605 .help = "Continue on non-fatal errors during IO",
3607 .category = FIO_OPT_C_GENERAL,
3608 .group = FIO_OPT_G_ERR,
3611 .oval = ERROR_TYPE_NONE,
3612 .help = "Exit when an error is encountered",
3615 .oval = ERROR_TYPE_READ,
3616 .help = "Continue on read errors only",
3619 .oval = ERROR_TYPE_WRITE,
3620 .help = "Continue on write errors only",
3623 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3624 .help = "Continue on any IO errors",
3627 .oval = ERROR_TYPE_VERIFY,
3628 .help = "Continue on verify errors only",
3631 .oval = ERROR_TYPE_ANY,
3632 .help = "Continue on all io and verify errors",
3635 .oval = ERROR_TYPE_NONE,
3636 .help = "Alias for 'none'",
3639 .oval = ERROR_TYPE_ANY,
3640 .help = "Alias for 'all'",
3645 .name = "ignore_error",
3646 .type = FIO_OPT_STR,
3647 .cb = str_ignore_error_cb,
3648 .off1 = td_var_offset(ignore_error_nr),
3649 .help = "Set a specific list of errors to ignore",
3651 .category = FIO_OPT_C_GENERAL,
3652 .group = FIO_OPT_G_ERR,
3655 .name = "error_dump",
3656 .type = FIO_OPT_BOOL,
3657 .off1 = td_var_offset(error_dump),
3659 .help = "Dump info on each error",
3660 .category = FIO_OPT_C_GENERAL,
3661 .group = FIO_OPT_G_ERR,
3666 .type = FIO_OPT_STR_STORE,
3667 .off1 = td_var_offset(profile),
3668 .help = "Select a specific builtin performance test",
3669 .category = FIO_OPT_C_PROFILE,
3670 .group = FIO_OPT_G_INVALID,
3675 .type = FIO_OPT_STR_STORE,
3676 .off1 = td_var_offset(cgroup),
3677 .help = "Add job to cgroup of this name",
3678 .category = FIO_OPT_C_GENERAL,
3679 .group = FIO_OPT_G_CGROUP,
3682 .name = "cgroup_nodelete",
3683 .lname = "Cgroup no-delete",
3684 .type = FIO_OPT_BOOL,
3685 .off1 = td_var_offset(cgroup_nodelete),
3686 .help = "Do not delete cgroups after job completion",
3689 .category = FIO_OPT_C_GENERAL,
3690 .group = FIO_OPT_G_CGROUP,
3693 .name = "cgroup_weight",
3694 .lname = "Cgroup weight",
3695 .type = FIO_OPT_INT,
3696 .off1 = td_var_offset(cgroup_weight),
3697 .help = "Use given weight for cgroup",
3701 .category = FIO_OPT_C_GENERAL,
3702 .group = FIO_OPT_G_CGROUP,
3707 .type = FIO_OPT_INT,
3708 .off1 = td_var_offset(uid),
3709 .help = "Run job with this user ID",
3710 .category = FIO_OPT_C_GENERAL,
3711 .group = FIO_OPT_G_CRED,
3715 .lname = "Group ID",
3716 .type = FIO_OPT_INT,
3717 .off1 = td_var_offset(gid),
3718 .help = "Run job with this group ID",
3719 .category = FIO_OPT_C_GENERAL,
3720 .group = FIO_OPT_G_CRED,
3725 .type = FIO_OPT_INT,
3726 .off1 = td_var_offset(kb_base),
3732 .help = "Use 1024 as the K base",
3736 .help = "Use 1000 as the K base",
3739 .help = "How many bytes per KB for reporting (1000 or 1024)",
3740 .category = FIO_OPT_C_GENERAL,
3741 .group = FIO_OPT_G_INVALID,
3744 .name = "unit_base",
3745 .lname = "Base unit for reporting (Bits or Bytes)",
3746 .type = FIO_OPT_INT,
3747 .off1 = td_var_offset(unit_base),
3752 .help = "Auto-detect",
3756 .help = "Normal (byte based)",
3760 .help = "Bit based",
3763 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3764 .category = FIO_OPT_C_GENERAL,
3765 .group = FIO_OPT_G_INVALID,
3768 .name = "hugepage-size",
3769 .lname = "Hugepage size",
3770 .type = FIO_OPT_INT,
3771 .off1 = td_var_offset(hugepage_size),
3772 .help = "When using hugepages, specify size of each page",
3773 .def = __fio_stringify(FIO_HUGE_PAGE),
3774 .interval = 1024 * 1024,
3775 .category = FIO_OPT_C_GENERAL,
3776 .group = FIO_OPT_G_INVALID,
3780 .lname = "I/O flow ID",
3781 .type = FIO_OPT_INT,
3782 .off1 = td_var_offset(flow_id),
3783 .help = "The flow index ID to use",
3785 .category = FIO_OPT_C_IO,
3786 .group = FIO_OPT_G_IO_FLOW,
3790 .lname = "I/O flow weight",
3791 .type = FIO_OPT_INT,
3792 .off1 = td_var_offset(flow),
3793 .help = "Weight for flow control of this job",
3794 .parent = "flow_id",
3797 .category = FIO_OPT_C_IO,
3798 .group = FIO_OPT_G_IO_FLOW,
3801 .name = "flow_watermark",
3802 .lname = "I/O flow watermark",
3803 .type = FIO_OPT_INT,
3804 .off1 = td_var_offset(flow_watermark),
3805 .help = "High watermark for flow control. This option"
3806 " should be set to the same value for all threads"
3807 " with non-zero flow.",
3808 .parent = "flow_id",
3811 .category = FIO_OPT_C_IO,
3812 .group = FIO_OPT_G_IO_FLOW,
3815 .name = "flow_sleep",
3816 .lname = "I/O flow sleep",
3817 .type = FIO_OPT_INT,
3818 .off1 = td_var_offset(flow_sleep),
3819 .help = "How many microseconds to sleep after being held"
3820 " back by the flow control mechanism",
3821 .parent = "flow_id",
3824 .category = FIO_OPT_C_IO,
3825 .group = FIO_OPT_G_IO_FLOW,
3829 .lname = "Skip operations against bad blocks",
3830 .type = FIO_OPT_BOOL,
3831 .off1 = td_var_offset(skip_bad),
3832 .help = "Skip operations against known bad blocks.",
3835 .category = FIO_OPT_C_IO,
3836 .group = FIO_OPT_G_MTD,
3843 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3844 const char *name, int val)
3846 lopt->name = (char *) name;
3848 if (o->type == FIO_OPT_STR_SET)
3849 lopt->has_arg = optional_argument;
3851 lopt->has_arg = required_argument;
3854 static void options_to_lopts(struct fio_option *opts,
3855 struct option *long_options,
3856 int i, int option_type)
3858 struct fio_option *o = &opts[0];
3860 add_to_lopt(&long_options[i], o, o->name, option_type);
3863 add_to_lopt(&long_options[i], o, o->alias, option_type);
3868 assert(i < FIO_NR_OPTIONS);
3872 void fio_options_set_ioengine_opts(struct option *long_options,
3873 struct thread_data *td)
3878 while (long_options[i].name) {
3879 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3880 memset(&long_options[i], 0, sizeof(*long_options));
3887 * Just clear out the prior ioengine options.
3892 options_to_lopts(td->io_ops->options, long_options, i,
3893 FIO_GETOPT_IOENGINE);
3896 void fio_options_dup_and_init(struct option *long_options)
3900 options_init(fio_options);
3903 while (long_options[i].name)
3906 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3909 struct fio_keyword {
3915 static struct fio_keyword fio_keywords[] = {
3917 .word = "$pagesize",
3918 .desc = "Page size in the system",
3921 .word = "$mb_memory",
3922 .desc = "Megabytes of memory online",
3926 .desc = "Number of CPUs online in the system",
3933 void fio_keywords_exit(void)
3935 struct fio_keyword *kw;
3937 kw = &fio_keywords[0];
3945 void fio_keywords_init(void)
3947 unsigned long long mb_memory;
3951 sprintf(buf, "%lu", (unsigned long) page_size);
3952 fio_keywords[0].replace = strdup(buf);
3954 mb_memory = os_phys_mem() / (1024 * 1024);
3955 sprintf(buf, "%llu", mb_memory);
3956 fio_keywords[1].replace = strdup(buf);
3959 sprintf(buf, "%lu", l);
3960 fio_keywords[2].replace = strdup(buf);
3965 static char *bc_calc(char *str)
3967 char buf[128], *tmp;
3972 * No math, just return string
3974 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3975 !strchr(str, '/')) || strchr(str, '\''))
3979 * Split option from value, we only need to calculate the value
3981 tmp = strchr(str, '=');
3988 * Prevent buffer overflows; such a case isn't reasonable anyway
3990 if (strlen(str) >= 128 || strlen(tmp) > 100)
3993 sprintf(buf, "which %s > /dev/null", BC_APP);
3995 log_err("fio: bc is needed for performing math\n");
3999 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
4000 f = popen(buf, "r");
4004 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
4011 buf[(tmp - str) + ret - 1] = '\0';
4012 memcpy(buf, str, tmp - str);
4018 * Return a copy of the input string with substrings of the form ${VARNAME}
4019 * substituted with the value of the environment variable VARNAME. The
4020 * substitution always occurs, even if VARNAME is empty or the corresponding
4021 * environment variable undefined.
4023 static char *option_dup_subs(const char *opt)
4025 char out[OPT_LEN_MAX+1];
4026 char in[OPT_LEN_MAX+1];
4029 char *ch1, *ch2, *env;
4030 ssize_t nchr = OPT_LEN_MAX;
4033 if (strlen(opt) + 1 > OPT_LEN_MAX) {
4034 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
4038 in[OPT_LEN_MAX] = '\0';
4039 strncpy(in, opt, OPT_LEN_MAX);
4041 while (*inptr && nchr > 0) {
4042 if (inptr[0] == '$' && inptr[1] == '{') {
4043 ch2 = strchr(inptr, '}');
4044 if (ch2 && inptr+1 < ch2) {
4051 envlen = strlen(env);
4052 if (envlen <= nchr) {
4053 memcpy(outptr, env, envlen);
4063 *outptr++ = *inptr++;
4072 * Look for reserved variable names and replace them with real values
4074 static char *fio_keyword_replace(char *opt)
4080 for (i = 0; fio_keywords[i].word != NULL; i++) {
4081 struct fio_keyword *kw = &fio_keywords[i];
4083 while ((s = strstr(opt, kw->word)) != NULL) {
4084 char *new = malloc(strlen(opt) + 1);
4090 * Copy part of the string before the keyword and
4091 * sprintf() the replacement after it.
4093 memcpy(new, opt, olen);
4094 len = sprintf(new + olen, "%s", kw->replace);
4097 * If there's more in the original string, copy that
4100 opt += strlen(kw->word) + olen;
4102 memcpy(new + olen + len, opt, opt - o_org - 1);
4105 * replace opt and free the old opt
4115 * Check for potential math and invoke bc, if possible
4123 static char **dup_and_sub_options(char **opts, int num_opts)
4126 char **opts_copy = malloc(num_opts * sizeof(*opts));
4127 for (i = 0; i < num_opts; i++) {
4128 opts_copy[i] = option_dup_subs(opts[i]);
4131 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
4136 static void show_closest_option(const char *opt)
4138 int best_option, best_distance;
4147 while (name[i] != '\0' && name[i] != '=')
4152 best_distance = INT_MAX;
4154 while (fio_options[i].name) {
4155 distance = string_distance(name, fio_options[i].name);
4156 if (distance < best_distance) {
4157 best_distance = distance;
4163 if (best_option != -1 && string_distance_ok(name, best_distance))
4164 log_err("Did you mean %s?\n", fio_options[best_option].name);
4169 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
4171 int i, ret, unknown;
4174 sort_options(opts, fio_options, num_opts);
4175 opts_copy = dup_and_sub_options(opts, num_opts);
4177 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
4178 struct fio_option *o;
4179 int newret = parse_option(opts_copy[i], opts[i], fio_options,
4180 &o, td, &td->opt_list);
4183 fio_option_mark_set(&td->o, o);
4191 opts_copy[i] = NULL;
4198 ret |= ioengine_load(td);
4200 sort_options(opts_copy, td->io_ops->options, num_opts);
4203 for (i = 0; i < num_opts; i++) {
4204 struct fio_option *o = NULL;
4211 newret = parse_option(opts_copy[i], opts[i],
4212 td->io_ops->options, &o,
4213 td->eo, &td->opt_list);
4217 log_err("Bad option <%s>\n", opts[i]);
4218 show_closest_option(opts[i]);
4221 opts_copy[i] = NULL;
4229 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
4233 ret = parse_cmd_option(opt, val, fio_options, td, &td->opt_list);
4235 struct fio_option *o;
4237 o = find_option(fio_options, opt);
4239 fio_option_mark_set(&td->o, o);
4245 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
4248 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
4252 void fio_fill_default_options(struct thread_data *td)
4254 td->o.magic = OPT_MAGIC;
4255 fill_default_options(td, fio_options);
4258 int fio_show_option_help(const char *opt)
4260 return show_cmd_help(fio_options, opt);
4263 void options_mem_dupe(void *data, struct fio_option *options)
4265 struct fio_option *o;
4268 for (o = &options[0]; o->name; o++) {
4269 if (o->type != FIO_OPT_STR_STORE)
4272 ptr = td_var(data, o, o->off1);
4274 *ptr = strdup(*ptr);
4279 * dupe FIO_OPT_STR_STORE options
4281 void fio_options_mem_dupe(struct thread_data *td)
4283 options_mem_dupe(&td->o, fio_options);
4285 if (td->eo && td->io_ops) {
4286 void *oldeo = td->eo;
4288 td->eo = malloc(td->io_ops->option_struct_size);
4289 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
4290 options_mem_dupe(td->eo, td->io_ops->options);
4294 unsigned int fio_get_kb_base(void *data)
4296 struct thread_options *o = data;
4297 unsigned int kb_base = 0;
4300 * This is a hack... For private options, *data is not holding
4301 * a pointer to the thread_options, but to private data. This means
4302 * we can't safely dereference it, but magic is first so mem wise
4303 * it is valid. But this also means that if the job first sets
4304 * kb_base and expects that to be honored by private options,
4305 * it will be disappointed. We will return the global default
4308 if (o && o->magic == OPT_MAGIC)
4309 kb_base = o->kb_base;
4316 int add_option(struct fio_option *o)
4318 struct fio_option *__o;
4327 if (opt_index + 1 == FIO_MAX_OPTS) {
4328 log_err("fio: FIO_MAX_OPTS is too small\n");
4332 memcpy(&fio_options[opt_index], o, sizeof(*o));
4333 fio_options[opt_index + 1].name = NULL;
4337 void invalidate_profile_options(const char *prof_name)
4339 struct fio_option *o;
4343 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
4344 o->type = FIO_OPT_INVALID;
4345 o->prof_name = NULL;
4351 void add_opt_posval(const char *optname, const char *ival, const char *help)
4353 struct fio_option *o;
4356 o = find_option(fio_options, optname);
4360 for (i = 0; i < PARSE_MAX_VP; i++) {
4361 if (o->posval[i].ival)
4364 o->posval[i].ival = ival;
4365 o->posval[i].help = help;
4370 void del_opt_posval(const char *optname, const char *ival)
4372 struct fio_option *o;
4375 o = find_option(fio_options, optname);
4379 for (i = 0; i < PARSE_MAX_VP; i++) {
4380 if (!o->posval[i].ival)
4382 if (strcmp(o->posval[i].ival, ival))
4385 o->posval[i].ival = NULL;
4386 o->posval[i].help = NULL;
4390 void fio_options_free(struct thread_data *td)
4392 options_free(fio_options, td);
4393 if (td->eo && td->io_ops && td->io_ops->options) {
4394 options_free(td->io_ops->options, td->eo);
4400 struct fio_option *fio_option_find(const char *name)
4402 return find_option(fio_options, name);
4405 static struct fio_option *find_next_opt(struct thread_options *o,
4406 struct fio_option *from,
4409 struct fio_option *opt;
4412 from = &fio_options[0];
4418 if (off1 == from->off1) {
4423 } while (from->name);
4428 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
4430 unsigned int opt_off, index, offset;
4432 opt_off = opt - &fio_options[0];
4433 index = opt_off / (8 * sizeof(uint64_t));
4434 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4435 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
4438 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
4440 struct fio_option *opt, *next;
4443 while ((opt = find_next_opt(o, next, off1)) != NULL) {
4444 if (opt_is_set(o, opt))
4453 void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)
4455 unsigned int opt_off, index, offset;
4457 opt_off = opt - &fio_options[0];
4458 index = opt_off / (8 * sizeof(uint64_t));
4459 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4460 o->set_options[index] |= (uint64_t)1 << offset;