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;
49 unsigned int val1[100];
50 unsigned int val2[100];
53 static int split_parse_ddir(struct thread_options *o, struct split *split,
54 enum fio_ddir ddir, char *str)
63 while ((fname = strsep(&str, ":")) != NULL) {
69 perc_str = strstr(fname, "/");
73 perc = atoi(perc_str);
81 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
82 log_err("fio: bssplit conversion failed\n");
87 split->val2[i] = perc;
97 static int bssplit_ddir(struct thread_options *o, enum fio_ddir ddir, char *str)
99 unsigned int i, perc, perc_missing;
100 unsigned int max_bs, min_bs;
103 memset(&split, 0, sizeof(split));
105 if (split_parse_ddir(o, &split, ddir, str))
112 o->bssplit[ddir] = malloc(split.nr * sizeof(struct bssplit));
113 o->bssplit_nr[ddir] = split.nr;
114 for (i = 0; i < split.nr; i++) {
115 if (split.val1[i] > max_bs)
116 max_bs = split.val1[i];
117 if (split.val1[i] < min_bs)
118 min_bs = split.val1[i];
120 o->bssplit[ddir][i].bs = split.val1[i];
121 o->bssplit[ddir][i].perc =split.val2[i];
125 * Now check if the percentages add up, and how much is missing
127 perc = perc_missing = 0;
128 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
129 struct bssplit *bsp = &o->bssplit[ddir][i];
131 if (bsp->perc == -1U)
137 if (perc > 100 && perc_missing > 1) {
138 log_err("fio: bssplit percentages add to more than 100%%\n");
139 free(o->bssplit[ddir]);
140 o->bssplit[ddir] = NULL;
145 * If values didn't have a percentage set, divide the remains between
149 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
151 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
152 struct bssplit *bsp = &o->bssplit[ddir][i];
154 if (bsp->perc == -1U)
155 bsp->perc = (100 - perc) / perc_missing;
159 o->min_bs[ddir] = min_bs;
160 o->max_bs[ddir] = max_bs;
163 * now sort based on percentages, for ease of lookup
165 qsort(o->bssplit[ddir], o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
169 typedef int (split_parse_fn)(struct thread_options *, enum fio_ddir, char *);
171 static int str_split_parse(struct thread_data *td, char *str, split_parse_fn *fn)
176 odir = strchr(str, ',');
178 ddir = strchr(odir + 1, ',');
180 ret = fn(&td->o, DDIR_TRIM, ddir + 1);
186 op = strdup(odir + 1);
187 ret = fn(&td->o, DDIR_TRIM, op);
192 ret = fn(&td->o, DDIR_WRITE, odir + 1);
195 ret = fn(&td->o, DDIR_READ, str);
201 ret = fn(&td->o, DDIR_WRITE, op);
206 ret = fn(&td->o, DDIR_TRIM, op);
210 ret = fn(&td->o, DDIR_READ, str);
216 static int str_bssplit_cb(void *data, const char *input)
218 struct thread_data *td = data;
225 p = str = strdup(input);
227 strip_blank_front(&str);
228 strip_blank_end(str);
230 ret = str_split_parse(td, str, bssplit_ddir);
236 static int str2error(char *str)
238 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
239 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
240 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
241 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
242 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
243 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
244 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
245 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
246 int i = 0, num = sizeof(err) / sizeof(void *);
249 if (!strcmp(err[i], str))
256 static int ignore_error_type(struct thread_data *td, int etype, char *str)
262 if (etype >= ERROR_TYPE_CNT) {
263 log_err("Illegal error type\n");
267 td->o.ignore_error_nr[etype] = 4;
268 error = malloc(4 * sizeof(struct bssplit));
271 while ((fname = strsep(&str, ":")) != NULL) {
277 * grow struct buffer, if needed
279 if (i == td->o.ignore_error_nr[etype]) {
280 td->o.ignore_error_nr[etype] <<= 1;
281 error = realloc(error, td->o.ignore_error_nr[etype]
284 if (fname[0] == 'E') {
285 error[i] = str2error(fname);
287 error[i] = atoi(fname);
289 error[i] = -error[i];
292 log_err("Unknown error %s, please use number value \n",
300 td->o.continue_on_error |= 1 << etype;
301 td->o.ignore_error_nr[etype] = i;
302 td->o.ignore_error[etype] = error;
310 static int str_ignore_error_cb(void *data, const char *input)
312 struct thread_data *td = data;
314 int type = 0, ret = 1;
319 p = str = strdup(input);
321 strip_blank_front(&str);
322 strip_blank_end(str);
328 ret = ignore_error_type(td, type, p);
338 static int str_rw_cb(void *data, const char *str)
340 struct thread_data *td = data;
341 struct thread_options *o = &td->o;
350 nr = get_opt_postfix(str);
355 o->ddir_seq_nr = atoi(nr);
359 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
360 log_err("fio: rw postfix parsing failed\n");
365 o->ddir_seq_add = val;
372 static int str_mem_cb(void *data, const char *mem)
374 struct thread_data *td = data;
376 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
377 td->o.mem_type == MEM_MMAPSHARED)
378 td->o.mmapfile = get_opt_postfix(mem);
383 static int fio_clock_source_cb(void *data, const char *str)
385 struct thread_data *td = data;
387 fio_clock_source = td->o.clocksource;
388 fio_clock_source_set = 1;
393 static int str_rwmix_read_cb(void *data, unsigned long long *val)
395 struct thread_data *td = data;
397 td->o.rwmix[DDIR_READ] = *val;
398 td->o.rwmix[DDIR_WRITE] = 100 - *val;
402 static int str_rwmix_write_cb(void *data, unsigned long long *val)
404 struct thread_data *td = data;
406 td->o.rwmix[DDIR_WRITE] = *val;
407 td->o.rwmix[DDIR_READ] = 100 - *val;
411 static int str_exitall_cb(void)
413 exitall_on_terminate = 1;
417 #ifdef FIO_HAVE_CPU_AFFINITY
418 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
420 unsigned int i, index, cpus_in_mask;
421 const long max_cpu = cpus_online();
423 cpus_in_mask = fio_cpu_count(mask);
424 cpu_index = cpu_index % cpus_in_mask;
427 for (i = 0; i < max_cpu; i++) {
428 if (!fio_cpu_isset(mask, i))
431 if (cpu_index != index)
432 fio_cpu_clear(mask, i);
437 return fio_cpu_count(mask);
440 static int str_cpumask_cb(void *data, unsigned long long *val)
442 struct thread_data *td = data;
450 ret = fio_cpuset_init(&td->o.cpumask);
452 log_err("fio: cpuset_init failed\n");
453 td_verror(td, ret, "fio_cpuset_init");
457 max_cpu = cpus_online();
459 for (i = 0; i < sizeof(int) * 8; i++) {
460 if ((1 << i) & *val) {
462 log_err("fio: CPU %d too large (max=%ld)\n", i,
466 dprint(FD_PARSE, "set cpu allowed %d\n", i);
467 fio_cpu_set(&td->o.cpumask, i);
474 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
481 ret = fio_cpuset_init(mask);
483 log_err("fio: cpuset_init failed\n");
484 td_verror(td, ret, "fio_cpuset_init");
488 p = str = strdup(input);
490 strip_blank_front(&str);
491 strip_blank_end(str);
493 max_cpu = cpus_online();
495 while ((cpu = strsep(&str, ",")) != NULL) {
504 while ((cpu2 = strsep(&str2, "-")) != NULL) {
514 while (icpu <= icpu2) {
515 if (icpu >= FIO_MAX_CPUS) {
516 log_err("fio: your OS only supports up to"
517 " %d CPUs\n", (int) FIO_MAX_CPUS);
521 if (icpu >= max_cpu) {
522 log_err("fio: CPU %d too large (max=%ld)\n",
528 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
529 fio_cpu_set(mask, icpu);
540 static int str_cpus_allowed_cb(void *data, const char *input)
542 struct thread_data *td = data;
547 return set_cpus_allowed(td, &td->o.cpumask, input);
550 static int str_verify_cpus_allowed_cb(void *data, const char *input)
552 struct thread_data *td = data;
557 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
561 static int str_log_cpus_allowed_cb(void *data, const char *input)
563 struct thread_data *td = data;
568 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
570 #endif /* CONFIG_ZLIB */
572 #endif /* FIO_HAVE_CPU_AFFINITY */
574 #ifdef CONFIG_LIBNUMA
575 static int str_numa_cpunodes_cb(void *data, char *input)
577 struct thread_data *td = data;
578 struct bitmask *verify_bitmask;
583 /* numa_parse_nodestring() parses a character string list
584 * of nodes into a bit mask. The bit mask is allocated by
585 * numa_allocate_nodemask(), so it should be freed by
586 * numa_free_nodemask().
588 verify_bitmask = numa_parse_nodestring(input);
589 if (verify_bitmask == NULL) {
590 log_err("fio: numa_parse_nodestring failed\n");
591 td_verror(td, 1, "str_numa_cpunodes_cb");
594 numa_free_nodemask(verify_bitmask);
596 td->o.numa_cpunodes = strdup(input);
600 static int str_numa_mpol_cb(void *data, char *input)
602 struct thread_data *td = data;
603 const char * const policy_types[] =
604 { "default", "prefer", "bind", "interleave", "local", NULL };
607 struct bitmask *verify_bitmask;
612 nodelist = strchr(input, ':');
614 /* NUL-terminate mode */
618 for (i = 0; i <= MPOL_LOCAL; i++) {
619 if (!strcmp(input, policy_types[i])) {
620 td->o.numa_mem_mode = i;
624 if (i > MPOL_LOCAL) {
625 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
629 switch (td->o.numa_mem_mode) {
632 * Insist on a nodelist of one node only
635 char *rest = nodelist;
636 while (isdigit(*rest))
639 log_err("fio: one node only for \'prefer\'\n");
643 log_err("fio: one node is needed for \'prefer\'\n");
647 case MPOL_INTERLEAVE:
649 * Default to online nodes with memory if no nodelist
652 nodelist = strdup("all");
657 * Don't allow a nodelist
660 log_err("fio: NO nodelist for \'local\'\n");
666 * Insist on a nodelist
669 log_err("fio: a nodelist is needed for \'bind\'\n");
676 /* numa_parse_nodestring() parses a character string list
677 * of nodes into a bit mask. The bit mask is allocated by
678 * numa_allocate_nodemask(), so it should be freed by
679 * numa_free_nodemask().
681 switch (td->o.numa_mem_mode) {
683 td->o.numa_mem_prefer_node = atoi(nodelist);
685 case MPOL_INTERLEAVE:
687 verify_bitmask = numa_parse_nodestring(nodelist);
688 if (verify_bitmask == NULL) {
689 log_err("fio: numa_parse_nodestring failed\n");
690 td_verror(td, 1, "str_numa_memnodes_cb");
693 td->o.numa_memnodes = strdup(nodelist);
694 numa_free_nodemask(verify_bitmask);
709 static int str_fst_cb(void *data, const char *str)
711 struct thread_data *td = data;
712 char *nr = get_opt_postfix(str);
714 td->file_service_nr = 1;
716 td->file_service_nr = atoi(nr);
723 #ifdef CONFIG_SYNC_FILE_RANGE
724 static int str_sfr_cb(void *data, const char *str)
726 struct thread_data *td = data;
727 char *nr = get_opt_postfix(str);
729 td->sync_file_range_nr = 1;
731 td->sync_file_range_nr = atoi(nr);
739 static int zone_cmp(const void *p1, const void *p2)
741 const struct zone_split *zsp1 = p1;
742 const struct zone_split *zsp2 = p2;
744 return (int) zsp2->access_perc - (int) zsp1->access_perc;
747 static int zone_split_ddir(struct thread_options *o, enum fio_ddir ddir,
750 unsigned int i, perc, perc_missing, sperc, sperc_missing;
753 memset(&split, 0, sizeof(split));
755 if (split_parse_ddir(o, &split, ddir, str))
760 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
761 o->zone_split_nr[ddir] = split.nr;
762 for (i = 0; i < split.nr; i++) {
763 o->zone_split[ddir][i].access_perc = split.val1[i];
764 o->zone_split[ddir][i].size_perc = split.val2[i];
768 * Now check if the percentages add up, and how much is missing
770 perc = perc_missing = 0;
771 sperc = sperc_missing = 0;
772 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
773 struct zone_split *zsp = &o->zone_split[ddir][i];
775 if (zsp->access_perc == (uint8_t) -1U)
778 perc += zsp->access_perc;
780 if (zsp->size_perc == (uint8_t) -1U)
783 sperc += zsp->size_perc;
787 if (perc > 100 || sperc > 100) {
788 log_err("fio: zone_split percentages add to more than 100%%\n");
789 free(o->zone_split[ddir]);
790 o->zone_split[ddir] = NULL;
794 log_err("fio: access percentage don't add up to 100 for zoned "
795 "random distribution (got=%u)\n", perc);
796 free(o->zone_split[ddir]);
797 o->zone_split[ddir] = NULL;
802 * If values didn't have a percentage set, divide the remains between
806 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
808 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
809 struct zone_split *zsp = &o->zone_split[ddir][i];
811 if (zsp->access_perc == (uint8_t) -1U)
812 zsp->access_perc = (100 - perc) / perc_missing;
816 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
818 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
819 struct zone_split *zsp = &o->zone_split[ddir][i];
821 if (zsp->size_perc == (uint8_t) -1U)
822 zsp->size_perc = (100 - sperc) / sperc_missing;
827 * now sort based on percentages, for ease of lookup
829 qsort(o->zone_split[ddir], o->zone_split_nr[ddir], sizeof(struct zone_split), zone_cmp);
833 static void __td_zone_gen_index(struct thread_data *td, enum fio_ddir ddir)
835 unsigned int i, j, sprev, aprev;
837 td->zone_state_index[ddir] = malloc(sizeof(struct zone_split_index) * 100);
840 for (i = 0; i < td->o.zone_split_nr[ddir]; i++) {
841 struct zone_split *zsp = &td->o.zone_split[ddir][i];
843 for (j = aprev; j < aprev + zsp->access_perc; j++) {
844 struct zone_split_index *zsi = &td->zone_state_index[ddir][j];
846 zsi->size_perc = sprev + zsp->size_perc;
847 zsi->size_perc_prev = sprev;
850 aprev += zsp->access_perc;
851 sprev += zsp->size_perc;
856 * Generate state table for indexes, so we don't have to do it inline from
859 static void td_zone_gen_index(struct thread_data *td)
863 td->zone_state_index = malloc(DDIR_RWDIR_CNT *
864 sizeof(struct zone_split_index *));
866 for (i = 0; i < DDIR_RWDIR_CNT; i++)
867 __td_zone_gen_index(td, i);
870 static int parse_zoned_distribution(struct thread_data *td, const char *input)
875 p = str = strdup(input);
877 strip_blank_front(&str);
878 strip_blank_end(str);
880 /* We expect it to start like that, bail if not */
881 if (strncmp(str, "zoned:", 6)) {
882 log_err("fio: mismatch in zoned input <%s>\n", str);
886 str += strlen("zoned:");
888 ret = str_split_parse(td, str, zone_split_ddir);
892 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
895 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
897 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
898 struct zone_split *zsp = &td->o.zone_split[i][j];
900 dprint(FD_PARSE, "\t%d: %u/%u\n", j, zsp->access_perc,
906 td_zone_gen_index(td);
908 for (i = 0; i < DDIR_RWDIR_CNT; i++)
909 td->o.zone_split_nr[i] = 0;
915 static int str_random_distribution_cb(void *data, const char *str)
917 struct thread_data *td = data;
924 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
926 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
927 val = FIO_DEF_PARETO;
928 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
930 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
931 return parse_zoned_distribution(td, str);
935 nr = get_opt_postfix(str);
936 if (nr && !str_to_float(nr, &val, 0)) {
937 log_err("fio: random postfix parsing failed\n");
944 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
946 log_err("fio: zipf theta must different than 1.0\n");
949 td->o.zipf_theta.u.f = val;
950 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
951 if (val <= 0.00 || val >= 1.00) {
952 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
955 td->o.pareto_h.u.f = val;
957 if (val <= 0.00 || val >= 100.0) {
958 log_err("fio: normal deviation out of range (0 < input < 100.0)\n");
961 td->o.gauss_dev.u.f = val;
968 * Return next name in the string. Files are separated with ':'. If the ':'
969 * is escaped with a '\', then that ':' is part of the filename and does not
970 * indicate a new file.
972 static char *get_next_name(char **ptr)
977 if (!str || !strlen(str))
983 * No colon, we are done
985 p = strchr(str, ':');
992 * We got a colon, but it's the first character. Skip and
1000 if (*(p - 1) != '\\') {
1006 memmove(p - 1, p, strlen(p) + 1);
1014 static int get_max_name_idx(char *input)
1016 unsigned int cur_idx;
1019 p = str = strdup(input);
1020 for (cur_idx = 0; ; cur_idx++)
1021 if (get_next_name(&str) == NULL)
1029 * Returns the directory at the index, indexes > entires will be
1030 * assigned via modulo division of the index
1032 int set_name_idx(char *target, size_t tlen, char *input, int index)
1034 unsigned int cur_idx;
1036 char *fname, *str, *p;
1038 p = str = strdup(input);
1040 index %= get_max_name_idx(input);
1041 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1042 fname = get_next_name(&str);
1044 if (client_sockaddr_str[0]) {
1045 len = snprintf(target, tlen, "%s/%s.", fname,
1046 client_sockaddr_str);
1048 len = snprintf(target, tlen, "%s/", fname);
1050 target[tlen - 1] = '\0';
1056 static int str_filename_cb(void *data, const char *input)
1058 struct thread_data *td = data;
1059 char *fname, *str, *p;
1061 p = str = strdup(input);
1063 strip_blank_front(&str);
1064 strip_blank_end(str);
1066 if (!td->files_index)
1069 while ((fname = get_next_name(&str)) != NULL) {
1072 add_file(td, fname, 0, 1);
1079 static int str_directory_cb(void *data, const char fio_unused *unused)
1081 struct thread_data *td = data;
1083 char *dirname, *str, *p;
1089 p = str = strdup(td->o.directory);
1090 while ((dirname = get_next_name(&str)) != NULL) {
1091 if (lstat(dirname, &sb) < 0) {
1094 log_err("fio: %s is not a directory\n", dirname);
1095 td_verror(td, ret, "lstat");
1098 if (!S_ISDIR(sb.st_mode)) {
1099 log_err("fio: %s is not a directory\n", dirname);
1110 static int str_opendir_cb(void *data, const char fio_unused *str)
1112 struct thread_data *td = data;
1117 if (!td->files_index)
1120 return add_dir_files(td, td->o.opendir);
1123 static int str_buffer_pattern_cb(void *data, const char *input)
1125 struct thread_data *td = data;
1128 /* FIXME: for now buffer pattern does not support formats */
1129 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
1130 MAX_PATTERN_SIZE, NULL, 0, NULL, NULL);
1135 td->o.buffer_pattern_bytes = ret;
1136 if (!td->o.compress_percentage)
1137 td->o.refill_buffers = 0;
1138 td->o.scramble_buffers = 0;
1139 td->o.zero_buffers = 0;
1144 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1146 struct thread_data *td = data;
1148 td->flags |= TD_F_COMPRESS;
1149 td->o.compress_percentage = *il;
1153 static int str_dedupe_cb(void *data, unsigned long long *il)
1155 struct thread_data *td = data;
1157 td->flags |= TD_F_COMPRESS;
1158 td->o.dedupe_percentage = *il;
1159 td->o.refill_buffers = 1;
1163 static int str_verify_pattern_cb(void *data, const char *input)
1165 struct pattern_fmt_desc fmt_desc[] = {
1168 .len = FIELD_SIZE(struct io_u *, offset),
1169 .paste = paste_blockoff
1172 struct thread_data *td = data;
1175 td->o.verify_fmt_sz = ARRAY_SIZE(td->o.verify_fmt);
1176 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
1177 MAX_PATTERN_SIZE, fmt_desc, sizeof(fmt_desc),
1178 td->o.verify_fmt, &td->o.verify_fmt_sz);
1183 td->o.verify_pattern_bytes = ret;
1185 * VERIFY_* could already be set
1187 if (!fio_option_is_set(&td->o, verify))
1188 td->o.verify = VERIFY_PATTERN;
1193 static int str_gtod_reduce_cb(void *data, int *il)
1195 struct thread_data *td = data;
1198 td->o.disable_lat = !!val;
1199 td->o.disable_clat = !!val;
1200 td->o.disable_slat = !!val;
1201 td->o.disable_bw = !!val;
1202 td->o.clat_percentiles = !val;
1204 td->tv_cache_mask = 63;
1209 static int str_size_cb(void *data, unsigned long long *__val)
1211 struct thread_data *td = data;
1212 unsigned long long v = *__val;
1214 if (parse_is_percent(v)) {
1216 td->o.size_percent = -1ULL - v;
1223 static int rw_verify(struct fio_option *o, void *data)
1225 struct thread_data *td = data;
1227 if (read_only && td_write(td)) {
1228 log_err("fio: job <%s> has write bit set, but fio is in"
1229 " read-only mode\n", td->o.name);
1236 static int gtod_cpu_verify(struct fio_option *o, void *data)
1238 #ifndef FIO_HAVE_CPU_AFFINITY
1239 struct thread_data *td = data;
1241 if (td->o.gtod_cpu) {
1242 log_err("fio: platform must support CPU affinity for"
1243 "gettimeofday() offloading\n");
1252 * Map of job/command line options
1254 struct fio_option fio_options[FIO_MAX_OPTS] = {
1256 .name = "description",
1257 .lname = "Description of job",
1258 .type = FIO_OPT_STR_STORE,
1259 .off1 = td_var_offset(description),
1260 .help = "Text job description",
1261 .category = FIO_OPT_C_GENERAL,
1262 .group = FIO_OPT_G_DESC,
1266 .lname = "Job name",
1267 .type = FIO_OPT_STR_STORE,
1268 .off1 = td_var_offset(name),
1269 .help = "Name of this job",
1270 .category = FIO_OPT_C_GENERAL,
1271 .group = FIO_OPT_G_DESC,
1275 .lname = "Waitee name",
1276 .type = FIO_OPT_STR_STORE,
1277 .off1 = td_var_offset(wait_for),
1278 .help = "Name of the job this one wants to wait for before starting",
1279 .category = FIO_OPT_C_GENERAL,
1280 .group = FIO_OPT_G_DESC,
1284 .lname = "Filename(s)",
1285 .type = FIO_OPT_STR_STORE,
1286 .off1 = td_var_offset(filename),
1287 .cb = str_filename_cb,
1288 .prio = -1, /* must come after "directory" */
1289 .help = "File(s) to use for the workload",
1290 .category = FIO_OPT_C_FILE,
1291 .group = FIO_OPT_G_FILENAME,
1294 .name = "directory",
1295 .lname = "Directory",
1296 .type = FIO_OPT_STR_STORE,
1297 .off1 = td_var_offset(directory),
1298 .cb = str_directory_cb,
1299 .help = "Directory to store files in",
1300 .category = FIO_OPT_C_FILE,
1301 .group = FIO_OPT_G_FILENAME,
1304 .name = "filename_format",
1305 .type = FIO_OPT_STR_STORE,
1306 .off1 = td_var_offset(filename_format),
1307 .prio = -1, /* must come after "directory" */
1308 .help = "Override default $jobname.$jobnum.$filenum naming",
1309 .def = "$jobname.$jobnum.$filenum",
1310 .category = FIO_OPT_C_FILE,
1311 .group = FIO_OPT_G_FILENAME,
1315 .lname = "Lockfile",
1316 .type = FIO_OPT_STR,
1317 .off1 = td_var_offset(file_lock_mode),
1318 .help = "Lock file when doing IO to it",
1320 .parent = "filename",
1323 .category = FIO_OPT_C_FILE,
1324 .group = FIO_OPT_G_FILENAME,
1327 .oval = FILE_LOCK_NONE,
1328 .help = "No file locking",
1330 { .ival = "exclusive",
1331 .oval = FILE_LOCK_EXCLUSIVE,
1332 .help = "Exclusive file lock",
1335 .ival = "readwrite",
1336 .oval = FILE_LOCK_READWRITE,
1337 .help = "Read vs write lock",
1343 .lname = "Open directory",
1344 .type = FIO_OPT_STR_STORE,
1345 .off1 = td_var_offset(opendir),
1346 .cb = str_opendir_cb,
1347 .help = "Recursively add files from this directory and down",
1348 .category = FIO_OPT_C_FILE,
1349 .group = FIO_OPT_G_FILENAME,
1353 .lname = "Read/write",
1354 .alias = "readwrite",
1355 .type = FIO_OPT_STR,
1357 .off1 = td_var_offset(td_ddir),
1358 .help = "IO direction",
1360 .verify = rw_verify,
1361 .category = FIO_OPT_C_IO,
1362 .group = FIO_OPT_G_IO_BASIC,
1365 .oval = TD_DDIR_READ,
1366 .help = "Sequential read",
1369 .oval = TD_DDIR_WRITE,
1370 .help = "Sequential write",
1373 .oval = TD_DDIR_TRIM,
1374 .help = "Sequential trim",
1376 { .ival = "randread",
1377 .oval = TD_DDIR_RANDREAD,
1378 .help = "Random read",
1380 { .ival = "randwrite",
1381 .oval = TD_DDIR_RANDWRITE,
1382 .help = "Random write",
1384 { .ival = "randtrim",
1385 .oval = TD_DDIR_RANDTRIM,
1386 .help = "Random trim",
1390 .help = "Sequential read and write mix",
1392 { .ival = "readwrite",
1394 .help = "Sequential read and write mix",
1397 .oval = TD_DDIR_RANDRW,
1398 .help = "Random read and write mix"
1400 { .ival = "trimwrite",
1401 .oval = TD_DDIR_TRIMWRITE,
1402 .help = "Trim and write mix, trims preceding writes"
1407 .name = "rw_sequencer",
1408 .lname = "RW Sequencer",
1409 .type = FIO_OPT_STR,
1410 .off1 = td_var_offset(rw_seq),
1411 .help = "IO offset generator modifier",
1412 .def = "sequential",
1413 .category = FIO_OPT_C_IO,
1414 .group = FIO_OPT_G_IO_BASIC,
1416 { .ival = "sequential",
1418 .help = "Generate sequential offsets",
1420 { .ival = "identical",
1421 .oval = RW_SEQ_IDENT,
1422 .help = "Generate identical offsets",
1429 .lname = "IO Engine",
1430 .type = FIO_OPT_STR_STORE,
1431 .off1 = td_var_offset(ioengine),
1432 .help = "IO engine to use",
1433 .def = FIO_PREFERRED_ENGINE,
1434 .category = FIO_OPT_C_IO,
1435 .group = FIO_OPT_G_IO_BASIC,
1438 .help = "Use read/write",
1441 .help = "Use pread/pwrite",
1444 .help = "Use readv/writev",
1446 #ifdef CONFIG_PWRITEV
1448 .help = "Use preadv/pwritev",
1451 #ifdef CONFIG_PWRITEV
1452 { .ival = "pvsync2",
1453 .help = "Use preadv2/pwritev2",
1456 #ifdef CONFIG_LIBAIO
1458 .help = "Linux native asynchronous IO",
1461 #ifdef CONFIG_POSIXAIO
1462 { .ival = "posixaio",
1463 .help = "POSIX asynchronous IO",
1466 #ifdef CONFIG_SOLARISAIO
1467 { .ival = "solarisaio",
1468 .help = "Solaris native asynchronous IO",
1471 #ifdef CONFIG_WINDOWSAIO
1472 { .ival = "windowsaio",
1473 .help = "Windows native asynchronous IO"
1478 .help = "Rados Block Device asynchronous IO"
1482 .help = "Memory mapped IO"
1484 #ifdef CONFIG_LINUX_SPLICE
1486 .help = "splice/vmsplice based IO",
1488 { .ival = "netsplice",
1489 .help = "splice/vmsplice to/from the network",
1492 #ifdef FIO_HAVE_SGIO
1494 .help = "SCSI generic v3 IO",
1498 .help = "Testing engine (no data transfer)",
1501 .help = "Network IO",
1504 .help = "CPU cycle burner engine",
1508 .help = "GUASI IO engine",
1511 #ifdef FIO_HAVE_BINJECT
1512 { .ival = "binject",
1513 .help = "binject direct inject block engine",
1518 .help = "RDMA IO engine",
1521 #ifdef CONFIG_FUSION_AW
1522 { .ival = "fusion-aw-sync",
1523 .help = "Fusion-io atomic write engine",
1526 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1527 { .ival = "e4defrag",
1528 .help = "ext4 defrag engine",
1531 #ifdef CONFIG_LINUX_FALLOCATE
1533 .help = "fallocate() file based engine",
1538 .help = "Glusterfs libgfapi(sync) based engine"
1540 { .ival = "gfapi_async",
1541 .help = "Glusterfs libgfapi(async) based engine"
1544 #ifdef CONFIG_LIBHDFS
1545 { .ival = "libhdfs",
1546 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1549 { .ival = "external",
1550 .help = "Load external engine (append name)",
1556 .lname = "IO Depth",
1557 .type = FIO_OPT_INT,
1558 .off1 = td_var_offset(iodepth),
1559 .help = "Number of IO buffers to keep in flight",
1563 .category = FIO_OPT_C_IO,
1564 .group = FIO_OPT_G_IO_BASIC,
1567 .name = "iodepth_batch",
1568 .lname = "IO Depth batch",
1569 .alias = "iodepth_batch_submit",
1570 .type = FIO_OPT_INT,
1571 .off1 = td_var_offset(iodepth_batch),
1572 .help = "Number of IO buffers to submit in one go",
1573 .parent = "iodepth",
1578 .category = FIO_OPT_C_IO,
1579 .group = FIO_OPT_G_IO_BASIC,
1582 .name = "iodepth_batch_complete_min",
1583 .lname = "Min IO depth batch complete",
1584 .alias = "iodepth_batch_complete",
1585 .type = FIO_OPT_INT,
1586 .off1 = td_var_offset(iodepth_batch_complete_min),
1587 .help = "Min number of IO buffers to retrieve in one go",
1588 .parent = "iodepth",
1593 .category = FIO_OPT_C_IO,
1594 .group = FIO_OPT_G_IO_BASIC,
1597 .name = "iodepth_batch_complete_max",
1598 .lname = "Max IO depth batch complete",
1599 .type = FIO_OPT_INT,
1600 .off1 = td_var_offset(iodepth_batch_complete_max),
1601 .help = "Max number of IO buffers to retrieve in one go",
1602 .parent = "iodepth",
1606 .category = FIO_OPT_C_IO,
1607 .group = FIO_OPT_G_IO_BASIC,
1610 .name = "iodepth_low",
1611 .lname = "IO Depth batch low",
1612 .type = FIO_OPT_INT,
1613 .off1 = td_var_offset(iodepth_low),
1614 .help = "Low water mark for queuing depth",
1615 .parent = "iodepth",
1618 .category = FIO_OPT_C_IO,
1619 .group = FIO_OPT_G_IO_BASIC,
1622 .name = "io_submit_mode",
1623 .lname = "IO submit mode",
1624 .type = FIO_OPT_STR,
1625 .off1 = td_var_offset(io_submit_mode),
1626 .help = "How IO submissions and completions are done",
1628 .category = FIO_OPT_C_IO,
1629 .group = FIO_OPT_G_IO_BASIC,
1632 .oval = IO_MODE_INLINE,
1633 .help = "Submit and complete IO inline",
1635 { .ival = "offload",
1636 .oval = IO_MODE_OFFLOAD,
1637 .help = "Offload submit and complete to threads",
1644 .type = FIO_OPT_STR_VAL,
1646 .off1 = td_var_offset(size),
1647 .help = "Total size of device or files",
1648 .interval = 1024 * 1024,
1649 .category = FIO_OPT_C_IO,
1650 .group = FIO_OPT_G_INVALID,
1654 .alias = "io_limit",
1656 .type = FIO_OPT_STR_VAL,
1657 .off1 = td_var_offset(io_limit),
1658 .interval = 1024 * 1024,
1659 .category = FIO_OPT_C_IO,
1660 .group = FIO_OPT_G_INVALID,
1663 .name = "fill_device",
1664 .lname = "Fill device",
1666 .type = FIO_OPT_BOOL,
1667 .off1 = td_var_offset(fill_device),
1668 .help = "Write until an ENOSPC error occurs",
1670 .category = FIO_OPT_C_FILE,
1671 .group = FIO_OPT_G_INVALID,
1675 .lname = "File size",
1676 .type = FIO_OPT_STR_VAL,
1677 .off1 = td_var_offset(file_size_low),
1678 .off2 = td_var_offset(file_size_high),
1680 .help = "Size of individual files",
1681 .interval = 1024 * 1024,
1682 .category = FIO_OPT_C_FILE,
1683 .group = FIO_OPT_G_INVALID,
1686 .name = "file_append",
1687 .lname = "File append",
1688 .type = FIO_OPT_BOOL,
1689 .off1 = td_var_offset(file_append),
1690 .help = "IO will start at the end of the file(s)",
1692 .category = FIO_OPT_C_FILE,
1693 .group = FIO_OPT_G_INVALID,
1697 .lname = "IO offset",
1698 .alias = "fileoffset",
1699 .type = FIO_OPT_STR_VAL,
1700 .off1 = td_var_offset(start_offset),
1701 .help = "Start IO from this offset",
1703 .interval = 1024 * 1024,
1704 .category = FIO_OPT_C_IO,
1705 .group = FIO_OPT_G_INVALID,
1708 .name = "offset_increment",
1709 .lname = "IO offset increment",
1710 .type = FIO_OPT_STR_VAL,
1711 .off1 = td_var_offset(offset_increment),
1712 .help = "What is the increment from one offset to the next",
1716 .interval = 1024 * 1024,
1717 .category = FIO_OPT_C_IO,
1718 .group = FIO_OPT_G_INVALID,
1721 .name = "number_ios",
1722 .lname = "Number of IOs to perform",
1723 .type = FIO_OPT_STR_VAL,
1724 .off1 = td_var_offset(number_ios),
1725 .help = "Force job completion after this number of IOs",
1727 .category = FIO_OPT_C_IO,
1728 .group = FIO_OPT_G_INVALID,
1732 .lname = "Block size",
1733 .alias = "blocksize",
1734 .type = FIO_OPT_INT,
1735 .off1 = td_var_offset(bs[DDIR_READ]),
1736 .off2 = td_var_offset(bs[DDIR_WRITE]),
1737 .off3 = td_var_offset(bs[DDIR_TRIM]),
1739 .help = "Block size unit",
1744 .category = FIO_OPT_C_IO,
1745 .group = FIO_OPT_G_INVALID,
1749 .lname = "Block size align",
1750 .alias = "blockalign",
1751 .type = FIO_OPT_INT,
1752 .off1 = td_var_offset(ba[DDIR_READ]),
1753 .off2 = td_var_offset(ba[DDIR_WRITE]),
1754 .off3 = td_var_offset(ba[DDIR_TRIM]),
1756 .help = "IO block offset alignment",
1760 .category = FIO_OPT_C_IO,
1761 .group = FIO_OPT_G_INVALID,
1765 .lname = "Block size range",
1766 .alias = "blocksize_range",
1767 .type = FIO_OPT_RANGE,
1768 .off1 = td_var_offset(min_bs[DDIR_READ]),
1769 .off2 = td_var_offset(max_bs[DDIR_READ]),
1770 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1771 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1772 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1773 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1775 .help = "Set block size range (in more detail than bs)",
1779 .category = FIO_OPT_C_IO,
1780 .group = FIO_OPT_G_INVALID,
1784 .lname = "Block size split",
1785 .type = FIO_OPT_STR,
1786 .cb = str_bssplit_cb,
1787 .off1 = td_var_offset(bssplit),
1788 .help = "Set a specific mix of block sizes",
1791 .category = FIO_OPT_C_IO,
1792 .group = FIO_OPT_G_INVALID,
1795 .name = "bs_unaligned",
1796 .lname = "Block size unaligned",
1797 .alias = "blocksize_unaligned",
1798 .type = FIO_OPT_STR_SET,
1799 .off1 = td_var_offset(bs_unaligned),
1800 .help = "Don't sector align IO buffer sizes",
1803 .category = FIO_OPT_C_IO,
1804 .group = FIO_OPT_G_INVALID,
1807 .name = "bs_is_seq_rand",
1808 .lname = "Block size division is seq/random (not read/write)",
1809 .type = FIO_OPT_BOOL,
1810 .off1 = td_var_offset(bs_is_seq_rand),
1811 .help = "Consider any blocksize setting to be sequential,random",
1813 .parent = "blocksize",
1814 .category = FIO_OPT_C_IO,
1815 .group = FIO_OPT_G_INVALID,
1818 .name = "randrepeat",
1819 .lname = "Random repeatable",
1820 .type = FIO_OPT_BOOL,
1821 .off1 = td_var_offset(rand_repeatable),
1822 .help = "Use repeatable random IO pattern",
1826 .category = FIO_OPT_C_IO,
1827 .group = FIO_OPT_G_RANDOM,
1831 .lname = "The random generator seed",
1832 .type = FIO_OPT_STR_VAL,
1833 .off1 = td_var_offset(rand_seed),
1834 .help = "Set the random generator seed value",
1837 .category = FIO_OPT_C_IO,
1838 .group = FIO_OPT_G_RANDOM,
1841 .name = "use_os_rand",
1842 .lname = "Use OS random",
1843 .type = FIO_OPT_DEPRECATED,
1844 .off1 = td_var_offset(dep_use_os_rand),
1845 .category = FIO_OPT_C_IO,
1846 .group = FIO_OPT_G_RANDOM,
1849 .name = "norandommap",
1850 .lname = "No randommap",
1851 .type = FIO_OPT_STR_SET,
1852 .off1 = td_var_offset(norandommap),
1853 .help = "Accept potential duplicate random blocks",
1857 .category = FIO_OPT_C_IO,
1858 .group = FIO_OPT_G_RANDOM,
1861 .name = "softrandommap",
1862 .lname = "Soft randommap",
1863 .type = FIO_OPT_BOOL,
1864 .off1 = td_var_offset(softrandommap),
1865 .help = "Set norandommap if randommap allocation fails",
1866 .parent = "norandommap",
1869 .category = FIO_OPT_C_IO,
1870 .group = FIO_OPT_G_RANDOM,
1873 .name = "random_generator",
1874 .type = FIO_OPT_STR,
1875 .off1 = td_var_offset(random_generator),
1876 .help = "Type of random number generator to use",
1877 .def = "tausworthe",
1879 { .ival = "tausworthe",
1880 .oval = FIO_RAND_GEN_TAUSWORTHE,
1881 .help = "Strong Tausworthe generator",
1884 .oval = FIO_RAND_GEN_LFSR,
1885 .help = "Variable length LFSR",
1888 .ival = "tausworthe64",
1889 .oval = FIO_RAND_GEN_TAUSWORTHE64,
1890 .help = "64-bit Tausworthe variant",
1893 .category = FIO_OPT_C_IO,
1894 .group = FIO_OPT_G_RANDOM,
1897 .name = "random_distribution",
1898 .type = FIO_OPT_STR,
1899 .off1 = td_var_offset(random_distribution),
1900 .cb = str_random_distribution_cb,
1901 .help = "Random offset distribution generator",
1905 .oval = FIO_RAND_DIST_RANDOM,
1906 .help = "Completely random",
1909 .oval = FIO_RAND_DIST_ZIPF,
1910 .help = "Zipf distribution",
1913 .oval = FIO_RAND_DIST_PARETO,
1914 .help = "Pareto distribution",
1917 .oval = FIO_RAND_DIST_GAUSS,
1918 .help = "Normal (gaussian) distribution",
1921 .oval = FIO_RAND_DIST_ZONED,
1922 .help = "Zoned random distribution",
1926 .category = FIO_OPT_C_IO,
1927 .group = FIO_OPT_G_RANDOM,
1930 .name = "percentage_random",
1931 .lname = "Percentage Random",
1932 .type = FIO_OPT_INT,
1933 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1934 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1935 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1937 .help = "Percentage of seq/random mix that should be random",
1938 .def = "100,100,100",
1940 .inverse = "percentage_sequential",
1941 .category = FIO_OPT_C_IO,
1942 .group = FIO_OPT_G_RANDOM,
1945 .name = "percentage_sequential",
1946 .lname = "Percentage Sequential",
1947 .type = FIO_OPT_DEPRECATED,
1948 .category = FIO_OPT_C_IO,
1949 .group = FIO_OPT_G_RANDOM,
1952 .name = "allrandrepeat",
1953 .type = FIO_OPT_BOOL,
1954 .off1 = td_var_offset(allrand_repeatable),
1955 .help = "Use repeatable random numbers for everything",
1957 .category = FIO_OPT_C_IO,
1958 .group = FIO_OPT_G_RANDOM,
1962 .lname = "Number of files",
1963 .alias = "nr_files",
1964 .type = FIO_OPT_INT,
1965 .off1 = td_var_offset(nr_files),
1966 .help = "Split job workload between this number of files",
1969 .category = FIO_OPT_C_FILE,
1970 .group = FIO_OPT_G_INVALID,
1973 .name = "openfiles",
1974 .lname = "Number of open files",
1975 .type = FIO_OPT_INT,
1976 .off1 = td_var_offset(open_files),
1977 .help = "Number of files to keep open at the same time",
1978 .category = FIO_OPT_C_FILE,
1979 .group = FIO_OPT_G_INVALID,
1982 .name = "file_service_type",
1983 .lname = "File service type",
1984 .type = FIO_OPT_STR,
1986 .off1 = td_var_offset(file_service_type),
1987 .help = "How to select which file to service next",
1988 .def = "roundrobin",
1989 .category = FIO_OPT_C_FILE,
1990 .group = FIO_OPT_G_INVALID,
1993 .oval = FIO_FSERVICE_RANDOM,
1994 .help = "Choose a file at random",
1996 { .ival = "roundrobin",
1997 .oval = FIO_FSERVICE_RR,
1998 .help = "Round robin select files",
2000 { .ival = "sequential",
2001 .oval = FIO_FSERVICE_SEQ,
2002 .help = "Finish one file before moving to the next",
2005 .parent = "nrfiles",
2008 #ifdef CONFIG_POSIX_FALLOCATE
2010 .name = "fallocate",
2011 .lname = "Fallocate",
2012 .type = FIO_OPT_STR,
2013 .off1 = td_var_offset(fallocate_mode),
2014 .help = "Whether pre-allocation is performed when laying out files",
2016 .category = FIO_OPT_C_FILE,
2017 .group = FIO_OPT_G_INVALID,
2020 .oval = FIO_FALLOCATE_NONE,
2021 .help = "Do not pre-allocate space",
2024 .oval = FIO_FALLOCATE_POSIX,
2025 .help = "Use posix_fallocate()",
2027 #ifdef CONFIG_LINUX_FALLOCATE
2029 .oval = FIO_FALLOCATE_KEEP_SIZE,
2030 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2033 /* Compatibility with former boolean values */
2035 .oval = FIO_FALLOCATE_NONE,
2036 .help = "Alias for 'none'",
2039 .oval = FIO_FALLOCATE_POSIX,
2040 .help = "Alias for 'posix'",
2044 #endif /* CONFIG_POSIX_FALLOCATE */
2046 .name = "fadvise_hint",
2047 .lname = "Fadvise hint",
2048 .type = FIO_OPT_BOOL,
2049 .off1 = td_var_offset(fadvise_hint),
2050 .help = "Use fadvise() to advise the kernel on IO pattern",
2052 .category = FIO_OPT_C_FILE,
2053 .group = FIO_OPT_G_INVALID,
2055 #ifdef FIO_HAVE_STREAMID
2057 .name = "fadvise_stream",
2058 .lname = "Fadvise stream",
2059 .type = FIO_OPT_INT,
2060 .off1 = td_var_offset(fadvise_stream),
2061 .help = "Use fadvise() to set stream ID",
2062 .category = FIO_OPT_C_FILE,
2063 .group = FIO_OPT_G_INVALID,
2069 .type = FIO_OPT_INT,
2070 .off1 = td_var_offset(fsync_blocks),
2071 .help = "Issue fsync for writes every given number of blocks",
2074 .category = FIO_OPT_C_FILE,
2075 .group = FIO_OPT_G_INVALID,
2078 .name = "fdatasync",
2079 .lname = "Fdatasync",
2080 .type = FIO_OPT_INT,
2081 .off1 = td_var_offset(fdatasync_blocks),
2082 .help = "Issue fdatasync for writes every given number of blocks",
2085 .category = FIO_OPT_C_FILE,
2086 .group = FIO_OPT_G_INVALID,
2089 .name = "write_barrier",
2090 .lname = "Write barrier",
2091 .type = FIO_OPT_INT,
2092 .off1 = td_var_offset(barrier_blocks),
2093 .help = "Make every Nth write a barrier write",
2096 .category = FIO_OPT_C_IO,
2097 .group = FIO_OPT_G_INVALID,
2099 #ifdef CONFIG_SYNC_FILE_RANGE
2101 .name = "sync_file_range",
2102 .lname = "Sync file range",
2104 { .ival = "wait_before",
2105 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2106 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2110 .oval = SYNC_FILE_RANGE_WRITE,
2111 .help = "SYNC_FILE_RANGE_WRITE",
2115 .ival = "wait_after",
2116 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2117 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2121 .type = FIO_OPT_STR_MULTI,
2123 .off1 = td_var_offset(sync_file_range),
2124 .help = "Use sync_file_range()",
2125 .category = FIO_OPT_C_FILE,
2126 .group = FIO_OPT_G_INVALID,
2131 .lname = "Direct I/O",
2132 .type = FIO_OPT_BOOL,
2133 .off1 = td_var_offset(odirect),
2134 .help = "Use O_DIRECT IO (negates buffered)",
2136 .inverse = "buffered",
2137 .category = FIO_OPT_C_IO,
2138 .group = FIO_OPT_G_IO_TYPE,
2142 .lname = "Atomic I/O",
2143 .type = FIO_OPT_BOOL,
2144 .off1 = td_var_offset(oatomic),
2145 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2147 .category = FIO_OPT_C_IO,
2148 .group = FIO_OPT_G_IO_TYPE,
2152 .lname = "Buffered I/O",
2153 .type = FIO_OPT_BOOL,
2154 .off1 = td_var_offset(odirect),
2156 .help = "Use buffered IO (negates direct)",
2158 .inverse = "direct",
2159 .category = FIO_OPT_C_IO,
2160 .group = FIO_OPT_G_IO_TYPE,
2163 .name = "overwrite",
2164 .lname = "Overwrite",
2165 .type = FIO_OPT_BOOL,
2166 .off1 = td_var_offset(overwrite),
2167 .help = "When writing, set whether to overwrite current data",
2169 .category = FIO_OPT_C_FILE,
2170 .group = FIO_OPT_G_INVALID,
2175 .type = FIO_OPT_INT,
2176 .off1 = td_var_offset(loops),
2177 .help = "Number of times to run the job",
2180 .category = FIO_OPT_C_GENERAL,
2181 .group = FIO_OPT_G_RUNTIME,
2185 .lname = "Number of jobs",
2186 .type = FIO_OPT_INT,
2187 .off1 = td_var_offset(numjobs),
2188 .help = "Duplicate this job this many times",
2191 .category = FIO_OPT_C_GENERAL,
2192 .group = FIO_OPT_G_RUNTIME,
2195 .name = "startdelay",
2196 .lname = "Start delay",
2197 .type = FIO_OPT_STR_VAL_TIME,
2198 .off1 = td_var_offset(start_delay),
2199 .off2 = td_var_offset(start_delay_high),
2200 .help = "Only start job when this period has passed",
2204 .category = FIO_OPT_C_GENERAL,
2205 .group = FIO_OPT_G_RUNTIME,
2211 .type = FIO_OPT_STR_VAL_TIME,
2212 .off1 = td_var_offset(timeout),
2213 .help = "Stop workload when this amount of time has passed",
2217 .category = FIO_OPT_C_GENERAL,
2218 .group = FIO_OPT_G_RUNTIME,
2221 .name = "time_based",
2222 .lname = "Time based",
2223 .type = FIO_OPT_STR_SET,
2224 .off1 = td_var_offset(time_based),
2225 .help = "Keep running until runtime/timeout is met",
2226 .category = FIO_OPT_C_GENERAL,
2227 .group = FIO_OPT_G_RUNTIME,
2230 .name = "verify_only",
2231 .lname = "Verify only",
2232 .type = FIO_OPT_STR_SET,
2233 .off1 = td_var_offset(verify_only),
2234 .help = "Verifies previously written data is still valid",
2235 .category = FIO_OPT_C_GENERAL,
2236 .group = FIO_OPT_G_RUNTIME,
2239 .name = "ramp_time",
2240 .lname = "Ramp time",
2241 .type = FIO_OPT_STR_VAL_TIME,
2242 .off1 = td_var_offset(ramp_time),
2243 .help = "Ramp up time before measuring performance",
2246 .category = FIO_OPT_C_GENERAL,
2247 .group = FIO_OPT_G_RUNTIME,
2250 .name = "clocksource",
2251 .lname = "Clock source",
2252 .type = FIO_OPT_STR,
2253 .cb = fio_clock_source_cb,
2254 .off1 = td_var_offset(clocksource),
2255 .help = "What type of timing source to use",
2256 .category = FIO_OPT_C_GENERAL,
2257 .group = FIO_OPT_G_CLOCK,
2259 #ifdef CONFIG_GETTIMEOFDAY
2260 { .ival = "gettimeofday",
2262 .help = "Use gettimeofday(2) for timing",
2265 #ifdef CONFIG_CLOCK_GETTIME
2266 { .ival = "clock_gettime",
2267 .oval = CS_CGETTIME,
2268 .help = "Use clock_gettime(2) for timing",
2271 #ifdef ARCH_HAVE_CPU_CLOCK
2273 .oval = CS_CPUCLOCK,
2274 .help = "Use CPU private clock",
2282 .lname = "I/O Memory",
2283 .type = FIO_OPT_STR,
2285 .off1 = td_var_offset(mem_type),
2286 .help = "Backing type for IO buffers",
2288 .category = FIO_OPT_C_IO,
2289 .group = FIO_OPT_G_INVALID,
2293 .help = "Use malloc(3) for IO buffers",
2295 #ifndef CONFIG_NO_SHM
2298 .help = "Use shared memory segments for IO buffers",
2300 #ifdef FIO_HAVE_HUGETLB
2301 { .ival = "shmhuge",
2302 .oval = MEM_SHMHUGE,
2303 .help = "Like shm, but use huge pages",
2309 .help = "Use mmap(2) (file or anon) for IO buffers",
2311 { .ival = "mmapshared",
2312 .oval = MEM_MMAPSHARED,
2313 .help = "Like mmap, but use the shared flag",
2315 #ifdef FIO_HAVE_HUGETLB
2316 { .ival = "mmaphuge",
2317 .oval = MEM_MMAPHUGE,
2318 .help = "Like mmap, but use huge pages",
2324 .name = "iomem_align",
2325 .alias = "mem_align",
2326 .lname = "I/O memory alignment",
2327 .type = FIO_OPT_INT,
2328 .off1 = td_var_offset(mem_align),
2330 .help = "IO memory buffer offset alignment",
2334 .category = FIO_OPT_C_IO,
2335 .group = FIO_OPT_G_INVALID,
2340 .type = FIO_OPT_STR,
2341 .off1 = td_var_offset(verify),
2342 .help = "Verify data written",
2344 .category = FIO_OPT_C_IO,
2345 .group = FIO_OPT_G_VERIFY,
2348 .oval = VERIFY_NONE,
2349 .help = "Don't do IO verification",
2353 .help = "Use md5 checksums for verification",
2356 .oval = VERIFY_CRC64,
2357 .help = "Use crc64 checksums for verification",
2360 .oval = VERIFY_CRC32,
2361 .help = "Use crc32 checksums for verification",
2363 { .ival = "crc32c-intel",
2364 .oval = VERIFY_CRC32C,
2365 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2368 .oval = VERIFY_CRC32C,
2369 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2372 .oval = VERIFY_CRC16,
2373 .help = "Use crc16 checksums for verification",
2376 .oval = VERIFY_CRC7,
2377 .help = "Use crc7 checksums for verification",
2380 .oval = VERIFY_SHA1,
2381 .help = "Use sha1 checksums for verification",
2384 .oval = VERIFY_SHA256,
2385 .help = "Use sha256 checksums for verification",
2388 .oval = VERIFY_SHA512,
2389 .help = "Use sha512 checksums for verification",
2392 .oval = VERIFY_XXHASH,
2393 .help = "Use xxhash checksums for verification",
2395 /* Meta information was included into verify_header,
2396 * 'meta' verification is implied by default. */
2398 .oval = VERIFY_HDR_ONLY,
2399 .help = "Use io information for verification. "
2400 "Now is implied by default, thus option is obsolete, "
2403 { .ival = "pattern",
2404 .oval = VERIFY_PATTERN_NO_HDR,
2405 .help = "Verify strict pattern",
2409 .oval = VERIFY_NULL,
2410 .help = "Pretend to verify",
2415 .name = "do_verify",
2416 .lname = "Perform verify step",
2417 .type = FIO_OPT_BOOL,
2418 .off1 = td_var_offset(do_verify),
2419 .help = "Run verification stage after write",
2423 .category = FIO_OPT_C_IO,
2424 .group = FIO_OPT_G_VERIFY,
2427 .name = "verifysort",
2428 .lname = "Verify sort",
2429 .type = FIO_OPT_BOOL,
2430 .off1 = td_var_offset(verifysort),
2431 .help = "Sort written verify blocks for read back",
2435 .category = FIO_OPT_C_IO,
2436 .group = FIO_OPT_G_VERIFY,
2439 .name = "verifysort_nr",
2440 .type = FIO_OPT_INT,
2441 .off1 = td_var_offset(verifysort_nr),
2442 .help = "Pre-load and sort verify blocks for a read workload",
2447 .category = FIO_OPT_C_IO,
2448 .group = FIO_OPT_G_VERIFY,
2451 .name = "verify_interval",
2452 .lname = "Verify interval",
2453 .type = FIO_OPT_INT,
2454 .off1 = td_var_offset(verify_interval),
2455 .minval = 2 * sizeof(struct verify_header),
2456 .help = "Store verify buffer header every N bytes",
2459 .interval = 2 * sizeof(struct verify_header),
2460 .category = FIO_OPT_C_IO,
2461 .group = FIO_OPT_G_VERIFY,
2464 .name = "verify_offset",
2465 .lname = "Verify offset",
2466 .type = FIO_OPT_INT,
2467 .help = "Offset verify header location by N bytes",
2468 .off1 = td_var_offset(verify_offset),
2469 .minval = sizeof(struct verify_header),
2472 .category = FIO_OPT_C_IO,
2473 .group = FIO_OPT_G_VERIFY,
2476 .name = "verify_pattern",
2477 .lname = "Verify pattern",
2478 .type = FIO_OPT_STR,
2479 .cb = str_verify_pattern_cb,
2480 .off1 = td_var_offset(verify_pattern),
2481 .help = "Fill pattern for IO buffers",
2484 .category = FIO_OPT_C_IO,
2485 .group = FIO_OPT_G_VERIFY,
2488 .name = "verify_fatal",
2489 .lname = "Verify fatal",
2490 .type = FIO_OPT_BOOL,
2491 .off1 = td_var_offset(verify_fatal),
2493 .help = "Exit on a single verify failure, don't continue",
2496 .category = FIO_OPT_C_IO,
2497 .group = FIO_OPT_G_VERIFY,
2500 .name = "verify_dump",
2501 .lname = "Verify dump",
2502 .type = FIO_OPT_BOOL,
2503 .off1 = td_var_offset(verify_dump),
2505 .help = "Dump contents of good and bad blocks on failure",
2508 .category = FIO_OPT_C_IO,
2509 .group = FIO_OPT_G_VERIFY,
2512 .name = "verify_async",
2513 .lname = "Verify asynchronously",
2514 .type = FIO_OPT_INT,
2515 .off1 = td_var_offset(verify_async),
2517 .help = "Number of async verifier threads to use",
2520 .category = FIO_OPT_C_IO,
2521 .group = FIO_OPT_G_VERIFY,
2524 .name = "verify_backlog",
2525 .lname = "Verify backlog",
2526 .type = FIO_OPT_STR_VAL,
2527 .off1 = td_var_offset(verify_backlog),
2528 .help = "Verify after this number of blocks are written",
2531 .category = FIO_OPT_C_IO,
2532 .group = FIO_OPT_G_VERIFY,
2535 .name = "verify_backlog_batch",
2536 .lname = "Verify backlog batch",
2537 .type = FIO_OPT_INT,
2538 .off1 = td_var_offset(verify_batch),
2539 .help = "Verify this number of IO blocks",
2542 .category = FIO_OPT_C_IO,
2543 .group = FIO_OPT_G_VERIFY,
2545 #ifdef FIO_HAVE_CPU_AFFINITY
2547 .name = "verify_async_cpus",
2548 .lname = "Async verify CPUs",
2549 .type = FIO_OPT_STR,
2550 .cb = str_verify_cpus_allowed_cb,
2551 .off1 = td_var_offset(verify_cpumask),
2552 .help = "Set CPUs allowed for async verify threads",
2553 .parent = "verify_async",
2555 .category = FIO_OPT_C_IO,
2556 .group = FIO_OPT_G_VERIFY,
2560 .name = "experimental_verify",
2561 .off1 = td_var_offset(experimental_verify),
2562 .type = FIO_OPT_BOOL,
2563 .help = "Enable experimental verification",
2565 .category = FIO_OPT_C_IO,
2566 .group = FIO_OPT_G_VERIFY,
2569 .name = "verify_state_load",
2570 .lname = "Load verify state",
2571 .off1 = td_var_offset(verify_state),
2572 .type = FIO_OPT_BOOL,
2573 .help = "Load verify termination state",
2575 .category = FIO_OPT_C_IO,
2576 .group = FIO_OPT_G_VERIFY,
2579 .name = "verify_state_save",
2580 .lname = "Save verify state",
2581 .off1 = td_var_offset(verify_state_save),
2582 .type = FIO_OPT_BOOL,
2584 .help = "Save verify state on termination",
2586 .category = FIO_OPT_C_IO,
2587 .group = FIO_OPT_G_VERIFY,
2589 #ifdef FIO_HAVE_TRIM
2591 .name = "trim_percentage",
2592 .lname = "Trim percentage",
2593 .type = FIO_OPT_INT,
2594 .off1 = td_var_offset(trim_percentage),
2597 .help = "Number of verify blocks to discard/trim",
2602 .category = FIO_OPT_C_IO,
2603 .group = FIO_OPT_G_TRIM,
2606 .name = "trim_verify_zero",
2607 .lname = "Verify trim zero",
2608 .type = FIO_OPT_BOOL,
2609 .help = "Verify that trim/discarded blocks are returned as zeroes",
2610 .off1 = td_var_offset(trim_zero),
2611 .parent = "trim_percentage",
2614 .category = FIO_OPT_C_IO,
2615 .group = FIO_OPT_G_TRIM,
2618 .name = "trim_backlog",
2619 .lname = "Trim backlog",
2620 .type = FIO_OPT_STR_VAL,
2621 .off1 = td_var_offset(trim_backlog),
2622 .help = "Trim after this number of blocks are written",
2623 .parent = "trim_percentage",
2626 .category = FIO_OPT_C_IO,
2627 .group = FIO_OPT_G_TRIM,
2630 .name = "trim_backlog_batch",
2631 .lname = "Trim backlog batch",
2632 .type = FIO_OPT_INT,
2633 .off1 = td_var_offset(trim_batch),
2634 .help = "Trim this number of IO blocks",
2635 .parent = "trim_percentage",
2638 .category = FIO_OPT_C_IO,
2639 .group = FIO_OPT_G_TRIM,
2643 .name = "write_iolog",
2644 .lname = "Write I/O log",
2645 .type = FIO_OPT_STR_STORE,
2646 .off1 = td_var_offset(write_iolog_file),
2647 .help = "Store IO pattern to file",
2648 .category = FIO_OPT_C_IO,
2649 .group = FIO_OPT_G_IOLOG,
2652 .name = "read_iolog",
2653 .lname = "Read I/O log",
2654 .type = FIO_OPT_STR_STORE,
2655 .off1 = td_var_offset(read_iolog_file),
2656 .help = "Playback IO pattern from file",
2657 .category = FIO_OPT_C_IO,
2658 .group = FIO_OPT_G_IOLOG,
2661 .name = "replay_no_stall",
2662 .lname = "Don't stall on replay",
2663 .type = FIO_OPT_BOOL,
2664 .off1 = td_var_offset(no_stall),
2666 .parent = "read_iolog",
2668 .help = "Playback IO pattern file as fast as possible without stalls",
2669 .category = FIO_OPT_C_IO,
2670 .group = FIO_OPT_G_IOLOG,
2673 .name = "replay_redirect",
2674 .lname = "Redirect device for replay",
2675 .type = FIO_OPT_STR_STORE,
2676 .off1 = td_var_offset(replay_redirect),
2677 .parent = "read_iolog",
2679 .help = "Replay all I/O onto this device, regardless of trace device",
2680 .category = FIO_OPT_C_IO,
2681 .group = FIO_OPT_G_IOLOG,
2684 .name = "replay_scale",
2685 .lname = "Replace offset scale factor",
2686 .type = FIO_OPT_INT,
2687 .off1 = td_var_offset(replay_scale),
2688 .parent = "read_iolog",
2690 .help = "Align offsets to this blocksize",
2691 .category = FIO_OPT_C_IO,
2692 .group = FIO_OPT_G_IOLOG,
2695 .name = "replay_align",
2696 .lname = "Replace alignment",
2697 .type = FIO_OPT_INT,
2698 .off1 = td_var_offset(replay_align),
2699 .parent = "read_iolog",
2700 .help = "Scale offset down by this factor",
2701 .category = FIO_OPT_C_IO,
2702 .group = FIO_OPT_G_IOLOG,
2706 .name = "exec_prerun",
2707 .lname = "Pre-execute runnable",
2708 .type = FIO_OPT_STR_STORE,
2709 .off1 = td_var_offset(exec_prerun),
2710 .help = "Execute this file prior to running job",
2711 .category = FIO_OPT_C_GENERAL,
2712 .group = FIO_OPT_G_INVALID,
2715 .name = "exec_postrun",
2716 .lname = "Post-execute runnable",
2717 .type = FIO_OPT_STR_STORE,
2718 .off1 = td_var_offset(exec_postrun),
2719 .help = "Execute this file after running job",
2720 .category = FIO_OPT_C_GENERAL,
2721 .group = FIO_OPT_G_INVALID,
2723 #ifdef FIO_HAVE_IOSCHED_SWITCH
2725 .name = "ioscheduler",
2726 .lname = "I/O scheduler",
2727 .type = FIO_OPT_STR_STORE,
2728 .off1 = td_var_offset(ioscheduler),
2729 .help = "Use this IO scheduler on the backing device",
2730 .category = FIO_OPT_C_FILE,
2731 .group = FIO_OPT_G_INVALID,
2736 .lname = "Zone size",
2737 .type = FIO_OPT_STR_VAL,
2738 .off1 = td_var_offset(zone_size),
2739 .help = "Amount of data to read per zone",
2741 .interval = 1024 * 1024,
2742 .category = FIO_OPT_C_IO,
2743 .group = FIO_OPT_G_ZONE,
2746 .name = "zonerange",
2747 .lname = "Zone range",
2748 .type = FIO_OPT_STR_VAL,
2749 .off1 = td_var_offset(zone_range),
2750 .help = "Give size of an IO zone",
2752 .interval = 1024 * 1024,
2753 .category = FIO_OPT_C_IO,
2754 .group = FIO_OPT_G_ZONE,
2758 .lname = "Zone skip",
2759 .type = FIO_OPT_STR_VAL,
2760 .off1 = td_var_offset(zone_skip),
2761 .help = "Space between IO zones",
2763 .interval = 1024 * 1024,
2764 .category = FIO_OPT_C_IO,
2765 .group = FIO_OPT_G_ZONE,
2769 .lname = "Lock memory",
2770 .type = FIO_OPT_STR_VAL,
2771 .off1 = td_var_offset(lockmem),
2772 .help = "Lock down this amount of memory (per worker)",
2774 .interval = 1024 * 1024,
2775 .category = FIO_OPT_C_GENERAL,
2776 .group = FIO_OPT_G_INVALID,
2779 .name = "rwmixread",
2780 .lname = "Read/write mix read",
2781 .type = FIO_OPT_INT,
2782 .cb = str_rwmix_read_cb,
2783 .off1 = td_var_offset(rwmix[DDIR_READ]),
2785 .help = "Percentage of mixed workload that is reads",
2788 .inverse = "rwmixwrite",
2789 .category = FIO_OPT_C_IO,
2790 .group = FIO_OPT_G_RWMIX,
2793 .name = "rwmixwrite",
2794 .lname = "Read/write mix write",
2795 .type = FIO_OPT_INT,
2796 .cb = str_rwmix_write_cb,
2797 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
2799 .help = "Percentage of mixed workload that is writes",
2802 .inverse = "rwmixread",
2803 .category = FIO_OPT_C_IO,
2804 .group = FIO_OPT_G_RWMIX,
2807 .name = "rwmixcycle",
2808 .lname = "Read/write mix cycle",
2809 .type = FIO_OPT_DEPRECATED,
2810 .category = FIO_OPT_C_IO,
2811 .group = FIO_OPT_G_RWMIX,
2816 .type = FIO_OPT_INT,
2817 .off1 = td_var_offset(nice),
2818 .help = "Set job CPU nice value",
2823 .category = FIO_OPT_C_GENERAL,
2824 .group = FIO_OPT_G_CRED,
2826 #ifdef FIO_HAVE_IOPRIO
2829 .lname = "I/O nice priority",
2830 .type = FIO_OPT_INT,
2831 .off1 = td_var_offset(ioprio),
2832 .help = "Set job IO priority value",
2836 .category = FIO_OPT_C_GENERAL,
2837 .group = FIO_OPT_G_CRED,
2840 .name = "prioclass",
2841 .lname = "I/O nice priority class",
2842 .type = FIO_OPT_INT,
2843 .off1 = td_var_offset(ioprio_class),
2844 .help = "Set job IO priority class",
2848 .category = FIO_OPT_C_GENERAL,
2849 .group = FIO_OPT_G_CRED,
2853 .name = "thinktime",
2854 .lname = "Thinktime",
2855 .type = FIO_OPT_INT,
2856 .off1 = td_var_offset(thinktime),
2857 .help = "Idle time between IO buffers (usec)",
2860 .category = FIO_OPT_C_IO,
2861 .group = FIO_OPT_G_THINKTIME,
2864 .name = "thinktime_spin",
2865 .lname = "Thinktime spin",
2866 .type = FIO_OPT_INT,
2867 .off1 = td_var_offset(thinktime_spin),
2868 .help = "Start think time by spinning this amount (usec)",
2871 .parent = "thinktime",
2873 .category = FIO_OPT_C_IO,
2874 .group = FIO_OPT_G_THINKTIME,
2877 .name = "thinktime_blocks",
2878 .lname = "Thinktime blocks",
2879 .type = FIO_OPT_INT,
2880 .off1 = td_var_offset(thinktime_blocks),
2881 .help = "IO buffer period between 'thinktime'",
2883 .parent = "thinktime",
2885 .category = FIO_OPT_C_IO,
2886 .group = FIO_OPT_G_THINKTIME,
2890 .lname = "I/O rate",
2891 .type = FIO_OPT_INT,
2892 .off1 = td_var_offset(rate[DDIR_READ]),
2893 .off2 = td_var_offset(rate[DDIR_WRITE]),
2894 .off3 = td_var_offset(rate[DDIR_TRIM]),
2895 .help = "Set bandwidth rate",
2896 .category = FIO_OPT_C_IO,
2897 .group = FIO_OPT_G_RATE,
2902 .lname = "I/O min rate",
2903 .type = FIO_OPT_INT,
2904 .off1 = td_var_offset(ratemin[DDIR_READ]),
2905 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2906 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2907 .help = "Job must meet this rate or it will be shutdown",
2910 .category = FIO_OPT_C_IO,
2911 .group = FIO_OPT_G_RATE,
2914 .name = "rate_iops",
2915 .lname = "I/O rate IOPS",
2916 .type = FIO_OPT_INT,
2917 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2918 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2919 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2920 .help = "Limit IO used to this number of IO operations/sec",
2922 .category = FIO_OPT_C_IO,
2923 .group = FIO_OPT_G_RATE,
2926 .name = "rate_iops_min",
2927 .lname = "I/O min rate IOPS",
2928 .type = FIO_OPT_INT,
2929 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2930 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2931 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2932 .help = "Job must meet this rate or it will be shut down",
2933 .parent = "rate_iops",
2935 .category = FIO_OPT_C_IO,
2936 .group = FIO_OPT_G_RATE,
2939 .name = "rate_process",
2940 .lname = "Rate Process",
2941 .type = FIO_OPT_STR,
2942 .off1 = td_var_offset(rate_process),
2943 .help = "What process controls how rated IO is managed",
2945 .category = FIO_OPT_C_IO,
2946 .group = FIO_OPT_G_RATE,
2949 .oval = RATE_PROCESS_LINEAR,
2950 .help = "Linear rate of IO",
2954 .oval = RATE_PROCESS_POISSON,
2955 .help = "Rate follows Poisson process",
2961 .name = "rate_cycle",
2962 .alias = "ratecycle",
2963 .lname = "I/O rate cycle",
2964 .type = FIO_OPT_INT,
2965 .off1 = td_var_offset(ratecycle),
2966 .help = "Window average for rate limits (msec)",
2970 .category = FIO_OPT_C_IO,
2971 .group = FIO_OPT_G_RATE,
2974 .name = "max_latency",
2975 .type = FIO_OPT_INT,
2976 .off1 = td_var_offset(max_latency),
2977 .help = "Maximum tolerated IO latency (usec)",
2979 .category = FIO_OPT_C_IO,
2980 .group = FIO_OPT_G_LATPROF,
2983 .name = "latency_target",
2984 .lname = "Latency Target (usec)",
2985 .type = FIO_OPT_STR_VAL_TIME,
2986 .off1 = td_var_offset(latency_target),
2987 .help = "Ramp to max queue depth supporting this latency",
2989 .category = FIO_OPT_C_IO,
2990 .group = FIO_OPT_G_LATPROF,
2993 .name = "latency_window",
2994 .lname = "Latency Window (usec)",
2995 .type = FIO_OPT_STR_VAL_TIME,
2996 .off1 = td_var_offset(latency_window),
2997 .help = "Time to sustain latency_target",
2999 .category = FIO_OPT_C_IO,
3000 .group = FIO_OPT_G_LATPROF,
3003 .name = "latency_percentile",
3004 .lname = "Latency Percentile",
3005 .type = FIO_OPT_FLOAT_LIST,
3006 .off1 = td_var_offset(latency_percentile),
3007 .help = "Percentile of IOs must be below latency_target",
3012 .category = FIO_OPT_C_IO,
3013 .group = FIO_OPT_G_LATPROF,
3016 .name = "invalidate",
3017 .lname = "Cache invalidate",
3018 .type = FIO_OPT_BOOL,
3019 .off1 = td_var_offset(invalidate_cache),
3020 .help = "Invalidate buffer/page cache prior to running job",
3022 .category = FIO_OPT_C_IO,
3023 .group = FIO_OPT_G_IO_TYPE,
3027 .lname = "Synchronous I/O",
3028 .type = FIO_OPT_BOOL,
3029 .off1 = td_var_offset(sync_io),
3030 .help = "Use O_SYNC for buffered writes",
3032 .parent = "buffered",
3034 .category = FIO_OPT_C_IO,
3035 .group = FIO_OPT_G_IO_TYPE,
3038 .name = "create_serialize",
3039 .lname = "Create serialize",
3040 .type = FIO_OPT_BOOL,
3041 .off1 = td_var_offset(create_serialize),
3042 .help = "Serialize creating of job files",
3044 .category = FIO_OPT_C_FILE,
3045 .group = FIO_OPT_G_INVALID,
3048 .name = "create_fsync",
3049 .lname = "Create fsync",
3050 .type = FIO_OPT_BOOL,
3051 .off1 = td_var_offset(create_fsync),
3052 .help = "fsync file after creation",
3054 .category = FIO_OPT_C_FILE,
3055 .group = FIO_OPT_G_INVALID,
3058 .name = "create_on_open",
3059 .lname = "Create on open",
3060 .type = FIO_OPT_BOOL,
3061 .off1 = td_var_offset(create_on_open),
3062 .help = "Create files when they are opened for IO",
3064 .category = FIO_OPT_C_FILE,
3065 .group = FIO_OPT_G_INVALID,
3068 .name = "create_only",
3069 .type = FIO_OPT_BOOL,
3070 .off1 = td_var_offset(create_only),
3071 .help = "Only perform file creation phase",
3072 .category = FIO_OPT_C_FILE,
3076 .name = "allow_file_create",
3077 .lname = "Allow file create",
3078 .type = FIO_OPT_BOOL,
3079 .off1 = td_var_offset(allow_create),
3080 .help = "Permit fio to create files, if they don't exist",
3082 .category = FIO_OPT_C_FILE,
3083 .group = FIO_OPT_G_FILENAME,
3086 .name = "allow_mounted_write",
3087 .lname = "Allow mounted write",
3088 .type = FIO_OPT_BOOL,
3089 .off1 = td_var_offset(allow_mounted_write),
3090 .help = "Allow writes to a mounted partition",
3092 .category = FIO_OPT_C_FILE,
3093 .group = FIO_OPT_G_FILENAME,
3097 .lname = "Pre-read files",
3098 .type = FIO_OPT_BOOL,
3099 .off1 = td_var_offset(pre_read),
3100 .help = "Pre-read files before starting official testing",
3102 .category = FIO_OPT_C_FILE,
3103 .group = FIO_OPT_G_INVALID,
3105 #ifdef FIO_HAVE_CPU_AFFINITY
3108 .lname = "CPU mask",
3109 .type = FIO_OPT_INT,
3110 .cb = str_cpumask_cb,
3111 .off1 = td_var_offset(cpumask),
3112 .help = "CPU affinity mask",
3113 .category = FIO_OPT_C_GENERAL,
3114 .group = FIO_OPT_G_CRED,
3117 .name = "cpus_allowed",
3118 .lname = "CPUs allowed",
3119 .type = FIO_OPT_STR,
3120 .cb = str_cpus_allowed_cb,
3121 .off1 = td_var_offset(cpumask),
3122 .help = "Set CPUs allowed",
3123 .category = FIO_OPT_C_GENERAL,
3124 .group = FIO_OPT_G_CRED,
3127 .name = "cpus_allowed_policy",
3128 .lname = "CPUs allowed distribution policy",
3129 .type = FIO_OPT_STR,
3130 .off1 = td_var_offset(cpus_allowed_policy),
3131 .help = "Distribution policy for cpus_allowed",
3132 .parent = "cpus_allowed",
3136 .oval = FIO_CPUS_SHARED,
3137 .help = "Mask shared between threads",
3140 .oval = FIO_CPUS_SPLIT,
3141 .help = "Mask split between threads",
3144 .category = FIO_OPT_C_GENERAL,
3145 .group = FIO_OPT_G_CRED,
3148 #ifdef CONFIG_LIBNUMA
3150 .name = "numa_cpu_nodes",
3151 .type = FIO_OPT_STR,
3152 .cb = str_numa_cpunodes_cb,
3153 .off1 = td_var_offset(numa_cpunodes),
3154 .help = "NUMA CPU nodes bind",
3155 .category = FIO_OPT_C_GENERAL,
3156 .group = FIO_OPT_G_INVALID,
3159 .name = "numa_mem_policy",
3160 .type = FIO_OPT_STR,
3161 .cb = str_numa_mpol_cb,
3162 .off1 = td_var_offset(numa_memnodes),
3163 .help = "NUMA memory policy setup",
3164 .category = FIO_OPT_C_GENERAL,
3165 .group = FIO_OPT_G_INVALID,
3169 .name = "end_fsync",
3170 .lname = "End fsync",
3171 .type = FIO_OPT_BOOL,
3172 .off1 = td_var_offset(end_fsync),
3173 .help = "Include fsync at the end of job",
3175 .category = FIO_OPT_C_FILE,
3176 .group = FIO_OPT_G_INVALID,
3179 .name = "fsync_on_close",
3180 .lname = "Fsync on close",
3181 .type = FIO_OPT_BOOL,
3182 .off1 = td_var_offset(fsync_on_close),
3183 .help = "fsync files on close",
3185 .category = FIO_OPT_C_FILE,
3186 .group = FIO_OPT_G_INVALID,
3190 .lname = "Unlink file",
3191 .type = FIO_OPT_BOOL,
3192 .off1 = td_var_offset(unlink),
3193 .help = "Unlink created files after job has completed",
3195 .category = FIO_OPT_C_FILE,
3196 .group = FIO_OPT_G_INVALID,
3200 .lname = "Exit-all on terminate",
3201 .type = FIO_OPT_STR_SET,
3202 .cb = str_exitall_cb,
3203 .help = "Terminate all jobs when one exits",
3204 .category = FIO_OPT_C_GENERAL,
3205 .group = FIO_OPT_G_PROCESS,
3208 .name = "exitall_on_error",
3209 .lname = "Exit-all on terminate in error",
3210 .type = FIO_OPT_BOOL,
3211 .off1 = td_var_offset(unlink),
3212 .help = "Terminate all jobs when one exits in error",
3213 .category = FIO_OPT_C_GENERAL,
3214 .group = FIO_OPT_G_PROCESS,
3217 .name = "stonewall",
3218 .lname = "Wait for previous",
3219 .alias = "wait_for_previous",
3220 .type = FIO_OPT_STR_SET,
3221 .off1 = td_var_offset(stonewall),
3222 .help = "Insert a hard barrier between this job and previous",
3223 .category = FIO_OPT_C_GENERAL,
3224 .group = FIO_OPT_G_PROCESS,
3227 .name = "new_group",
3228 .lname = "New group",
3229 .type = FIO_OPT_STR_SET,
3230 .off1 = td_var_offset(new_group),
3231 .help = "Mark the start of a new group (for reporting)",
3232 .category = FIO_OPT_C_GENERAL,
3233 .group = FIO_OPT_G_PROCESS,
3238 .type = FIO_OPT_STR_SET,
3239 .off1 = td_var_offset(use_thread),
3240 .help = "Use threads instead of processes",
3241 #ifdef CONFIG_NO_SHM
3245 .category = FIO_OPT_C_GENERAL,
3246 .group = FIO_OPT_G_PROCESS,
3249 .name = "per_job_logs",
3250 .type = FIO_OPT_BOOL,
3251 .off1 = td_var_offset(per_job_logs),
3252 .help = "Include job number in generated log files or not",
3254 .category = FIO_OPT_C_LOG,
3255 .group = FIO_OPT_G_INVALID,
3258 .name = "write_bw_log",
3259 .lname = "Write bandwidth log",
3260 .type = FIO_OPT_STR_STORE,
3261 .off1 = td_var_offset(bw_log_file),
3262 .help = "Write log of bandwidth during run",
3263 .category = FIO_OPT_C_LOG,
3264 .group = FIO_OPT_G_INVALID,
3267 .name = "write_lat_log",
3268 .lname = "Write latency log",
3269 .type = FIO_OPT_STR_STORE,
3270 .off1 = td_var_offset(lat_log_file),
3271 .help = "Write log of latency during run",
3272 .category = FIO_OPT_C_LOG,
3273 .group = FIO_OPT_G_INVALID,
3276 .name = "write_iops_log",
3277 .lname = "Write IOPS log",
3278 .type = FIO_OPT_STR_STORE,
3279 .off1 = td_var_offset(iops_log_file),
3280 .help = "Write log of IOPS during run",
3281 .category = FIO_OPT_C_LOG,
3282 .group = FIO_OPT_G_INVALID,
3285 .name = "log_avg_msec",
3286 .lname = "Log averaging (msec)",
3287 .type = FIO_OPT_INT,
3288 .off1 = td_var_offset(log_avg_msec),
3289 .help = "Average bw/iops/lat logs over this period of time",
3291 .category = FIO_OPT_C_LOG,
3292 .group = FIO_OPT_G_INVALID,
3295 .name = "log_max_value",
3296 .lname = "Log maximum instead of average",
3297 .type = FIO_OPT_BOOL,
3298 .off1 = td_var_offset(log_max),
3299 .help = "Log max sample in a window instead of average",
3301 .category = FIO_OPT_C_LOG,
3302 .group = FIO_OPT_G_INVALID,
3305 .name = "log_offset",
3306 .lname = "Log offset of IO",
3307 .type = FIO_OPT_BOOL,
3308 .off1 = td_var_offset(log_offset),
3309 .help = "Include offset of IO for each log entry",
3311 .category = FIO_OPT_C_LOG,
3312 .group = FIO_OPT_G_INVALID,
3316 .name = "log_compression",
3317 .lname = "Log compression",
3318 .type = FIO_OPT_INT,
3319 .off1 = td_var_offset(log_gz),
3320 .help = "Log in compressed chunks of this size",
3322 .maxval = 512 * 1024 * 1024ULL,
3323 .category = FIO_OPT_C_LOG,
3324 .group = FIO_OPT_G_INVALID,
3326 #ifdef FIO_HAVE_CPU_AFFINITY
3328 .name = "log_compression_cpus",
3329 .lname = "Log Compression CPUs",
3330 .type = FIO_OPT_STR,
3331 .cb = str_log_cpus_allowed_cb,
3332 .off1 = td_var_offset(log_gz_cpumask),
3333 .parent = "log_compression",
3334 .help = "Limit log compression to these CPUs",
3335 .category = FIO_OPT_C_LOG,
3336 .group = FIO_OPT_G_INVALID,
3340 .name = "log_store_compressed",
3341 .lname = "Log store compressed",
3342 .type = FIO_OPT_BOOL,
3343 .off1 = td_var_offset(log_gz_store),
3344 .help = "Store logs in a compressed format",
3345 .category = FIO_OPT_C_LOG,
3346 .group = FIO_OPT_G_INVALID,
3350 .name = "block_error_percentiles",
3351 .lname = "Block error percentiles",
3352 .type = FIO_OPT_BOOL,
3353 .off1 = td_var_offset(block_error_hist),
3354 .help = "Record trim block errors and make a histogram",
3356 .category = FIO_OPT_C_LOG,
3357 .group = FIO_OPT_G_INVALID,
3360 .name = "bwavgtime",
3361 .lname = "Bandwidth average time",
3362 .type = FIO_OPT_INT,
3363 .off1 = td_var_offset(bw_avg_time),
3364 .help = "Time window over which to calculate bandwidth"
3367 .parent = "write_bw_log",
3370 .category = FIO_OPT_C_LOG,
3371 .group = FIO_OPT_G_INVALID,
3374 .name = "iopsavgtime",
3375 .lname = "IOPS average time",
3376 .type = FIO_OPT_INT,
3377 .off1 = td_var_offset(iops_avg_time),
3378 .help = "Time window over which to calculate IOPS (msec)",
3380 .parent = "write_iops_log",
3383 .category = FIO_OPT_C_LOG,
3384 .group = FIO_OPT_G_INVALID,
3387 .name = "group_reporting",
3388 .lname = "Group reporting",
3389 .type = FIO_OPT_STR_SET,
3390 .off1 = td_var_offset(group_reporting),
3391 .help = "Do reporting on a per-group basis",
3392 .category = FIO_OPT_C_STAT,
3393 .group = FIO_OPT_G_INVALID,
3396 .name = "zero_buffers",
3397 .lname = "Zero I/O buffers",
3398 .type = FIO_OPT_STR_SET,
3399 .off1 = td_var_offset(zero_buffers),
3400 .help = "Init IO buffers to all zeroes",
3401 .category = FIO_OPT_C_IO,
3402 .group = FIO_OPT_G_IO_BUF,
3405 .name = "refill_buffers",
3406 .lname = "Refill I/O buffers",
3407 .type = FIO_OPT_STR_SET,
3408 .off1 = td_var_offset(refill_buffers),
3409 .help = "Refill IO buffers on every IO submit",
3410 .category = FIO_OPT_C_IO,
3411 .group = FIO_OPT_G_IO_BUF,
3414 .name = "scramble_buffers",
3415 .lname = "Scramble I/O buffers",
3416 .type = FIO_OPT_BOOL,
3417 .off1 = td_var_offset(scramble_buffers),
3418 .help = "Slightly scramble buffers on every IO submit",
3420 .category = FIO_OPT_C_IO,
3421 .group = FIO_OPT_G_IO_BUF,
3424 .name = "buffer_pattern",
3425 .lname = "Buffer pattern",
3426 .type = FIO_OPT_STR,
3427 .cb = str_buffer_pattern_cb,
3428 .off1 = td_var_offset(buffer_pattern),
3429 .help = "Fill pattern for IO buffers",
3430 .category = FIO_OPT_C_IO,
3431 .group = FIO_OPT_G_IO_BUF,
3434 .name = "buffer_compress_percentage",
3435 .lname = "Buffer compression percentage",
3436 .type = FIO_OPT_INT,
3437 .cb = str_buffer_compress_cb,
3438 .off1 = td_var_offset(compress_percentage),
3441 .help = "How compressible the buffer is (approximately)",
3443 .category = FIO_OPT_C_IO,
3444 .group = FIO_OPT_G_IO_BUF,
3447 .name = "buffer_compress_chunk",
3448 .lname = "Buffer compression chunk size",
3449 .type = FIO_OPT_INT,
3450 .off1 = td_var_offset(compress_chunk),
3451 .parent = "buffer_compress_percentage",
3453 .help = "Size of compressible region in buffer",
3455 .category = FIO_OPT_C_IO,
3456 .group = FIO_OPT_G_IO_BUF,
3459 .name = "dedupe_percentage",
3460 .lname = "Dedupe percentage",
3461 .type = FIO_OPT_INT,
3462 .cb = str_dedupe_cb,
3463 .off1 = td_var_offset(dedupe_percentage),
3466 .help = "Percentage of buffers that are dedupable",
3468 .category = FIO_OPT_C_IO,
3469 .group = FIO_OPT_G_IO_BUF,
3472 .name = "clat_percentiles",
3473 .lname = "Completion latency percentiles",
3474 .type = FIO_OPT_BOOL,
3475 .off1 = td_var_offset(clat_percentiles),
3476 .help = "Enable the reporting of completion latency percentiles",
3478 .category = FIO_OPT_C_STAT,
3479 .group = FIO_OPT_G_INVALID,
3482 .name = "percentile_list",
3483 .lname = "Percentile list",
3484 .type = FIO_OPT_FLOAT_LIST,
3485 .off1 = td_var_offset(percentile_list),
3486 .off2 = td_var_offset(percentile_precision),
3487 .help = "Specify a custom list of percentiles to report for "
3488 "completion latency and block errors",
3489 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3490 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3493 .category = FIO_OPT_C_STAT,
3494 .group = FIO_OPT_G_INVALID,
3497 #ifdef FIO_HAVE_DISK_UTIL
3499 .name = "disk_util",
3500 .lname = "Disk utilization",
3501 .type = FIO_OPT_BOOL,
3502 .off1 = td_var_offset(do_disk_util),
3503 .help = "Log disk utilization statistics",
3505 .category = FIO_OPT_C_STAT,
3506 .group = FIO_OPT_G_INVALID,
3510 .name = "gtod_reduce",
3511 .lname = "Reduce gettimeofday() calls",
3512 .type = FIO_OPT_BOOL,
3513 .help = "Greatly reduce number of gettimeofday() calls",
3514 .cb = str_gtod_reduce_cb,
3517 .category = FIO_OPT_C_STAT,
3518 .group = FIO_OPT_G_INVALID,
3521 .name = "disable_lat",
3522 .lname = "Disable all latency stats",
3523 .type = FIO_OPT_BOOL,
3524 .off1 = td_var_offset(disable_lat),
3525 .help = "Disable latency numbers",
3526 .parent = "gtod_reduce",
3529 .category = FIO_OPT_C_STAT,
3530 .group = FIO_OPT_G_INVALID,
3533 .name = "disable_clat",
3534 .lname = "Disable completion latency stats",
3535 .type = FIO_OPT_BOOL,
3536 .off1 = td_var_offset(disable_clat),
3537 .help = "Disable completion latency numbers",
3538 .parent = "gtod_reduce",
3541 .category = FIO_OPT_C_STAT,
3542 .group = FIO_OPT_G_INVALID,
3545 .name = "disable_slat",
3546 .lname = "Disable submission latency stats",
3547 .type = FIO_OPT_BOOL,
3548 .off1 = td_var_offset(disable_slat),
3549 .help = "Disable submission latency numbers",
3550 .parent = "gtod_reduce",
3553 .category = FIO_OPT_C_STAT,
3554 .group = FIO_OPT_G_INVALID,
3557 .name = "disable_bw_measurement",
3558 .lname = "Disable bandwidth stats",
3559 .type = FIO_OPT_BOOL,
3560 .off1 = td_var_offset(disable_bw),
3561 .help = "Disable bandwidth logging",
3562 .parent = "gtod_reduce",
3565 .category = FIO_OPT_C_STAT,
3566 .group = FIO_OPT_G_INVALID,
3570 .lname = "Dedicated gettimeofday() CPU",
3571 .type = FIO_OPT_INT,
3572 .off1 = td_var_offset(gtod_cpu),
3573 .help = "Set up dedicated gettimeofday() thread on this CPU",
3574 .verify = gtod_cpu_verify,
3575 .category = FIO_OPT_C_GENERAL,
3576 .group = FIO_OPT_G_CLOCK,
3579 .name = "unified_rw_reporting",
3580 .type = FIO_OPT_BOOL,
3581 .off1 = td_var_offset(unified_rw_rep),
3582 .help = "Unify reporting across data direction",
3584 .category = FIO_OPT_C_GENERAL,
3585 .group = FIO_OPT_G_INVALID,
3588 .name = "continue_on_error",
3589 .lname = "Continue on error",
3590 .type = FIO_OPT_STR,
3591 .off1 = td_var_offset(continue_on_error),
3592 .help = "Continue on non-fatal errors during IO",
3594 .category = FIO_OPT_C_GENERAL,
3595 .group = FIO_OPT_G_ERR,
3598 .oval = ERROR_TYPE_NONE,
3599 .help = "Exit when an error is encountered",
3602 .oval = ERROR_TYPE_READ,
3603 .help = "Continue on read errors only",
3606 .oval = ERROR_TYPE_WRITE,
3607 .help = "Continue on write errors only",
3610 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3611 .help = "Continue on any IO errors",
3614 .oval = ERROR_TYPE_VERIFY,
3615 .help = "Continue on verify errors only",
3618 .oval = ERROR_TYPE_ANY,
3619 .help = "Continue on all io and verify errors",
3622 .oval = ERROR_TYPE_NONE,
3623 .help = "Alias for 'none'",
3626 .oval = ERROR_TYPE_ANY,
3627 .help = "Alias for 'all'",
3632 .name = "ignore_error",
3633 .type = FIO_OPT_STR,
3634 .cb = str_ignore_error_cb,
3635 .off1 = td_var_offset(ignore_error_nr),
3636 .help = "Set a specific list of errors to ignore",
3638 .category = FIO_OPT_C_GENERAL,
3639 .group = FIO_OPT_G_ERR,
3642 .name = "error_dump",
3643 .type = FIO_OPT_BOOL,
3644 .off1 = td_var_offset(error_dump),
3646 .help = "Dump info on each error",
3647 .category = FIO_OPT_C_GENERAL,
3648 .group = FIO_OPT_G_ERR,
3653 .type = FIO_OPT_STR_STORE,
3654 .off1 = td_var_offset(profile),
3655 .help = "Select a specific builtin performance test",
3656 .category = FIO_OPT_C_PROFILE,
3657 .group = FIO_OPT_G_INVALID,
3662 .type = FIO_OPT_STR_STORE,
3663 .off1 = td_var_offset(cgroup),
3664 .help = "Add job to cgroup of this name",
3665 .category = FIO_OPT_C_GENERAL,
3666 .group = FIO_OPT_G_CGROUP,
3669 .name = "cgroup_nodelete",
3670 .lname = "Cgroup no-delete",
3671 .type = FIO_OPT_BOOL,
3672 .off1 = td_var_offset(cgroup_nodelete),
3673 .help = "Do not delete cgroups after job completion",
3676 .category = FIO_OPT_C_GENERAL,
3677 .group = FIO_OPT_G_CGROUP,
3680 .name = "cgroup_weight",
3681 .lname = "Cgroup weight",
3682 .type = FIO_OPT_INT,
3683 .off1 = td_var_offset(cgroup_weight),
3684 .help = "Use given weight for cgroup",
3688 .category = FIO_OPT_C_GENERAL,
3689 .group = FIO_OPT_G_CGROUP,
3694 .type = FIO_OPT_INT,
3695 .off1 = td_var_offset(uid),
3696 .help = "Run job with this user ID",
3697 .category = FIO_OPT_C_GENERAL,
3698 .group = FIO_OPT_G_CRED,
3702 .lname = "Group ID",
3703 .type = FIO_OPT_INT,
3704 .off1 = td_var_offset(gid),
3705 .help = "Run job with this group ID",
3706 .category = FIO_OPT_C_GENERAL,
3707 .group = FIO_OPT_G_CRED,
3712 .type = FIO_OPT_INT,
3713 .off1 = td_var_offset(kb_base),
3719 .help = "Use 1024 as the K base",
3723 .help = "Use 1000 as the K base",
3726 .help = "How many bytes per KB for reporting (1000 or 1024)",
3727 .category = FIO_OPT_C_GENERAL,
3728 .group = FIO_OPT_G_INVALID,
3731 .name = "unit_base",
3732 .lname = "Base unit for reporting (Bits or Bytes)",
3733 .type = FIO_OPT_INT,
3734 .off1 = td_var_offset(unit_base),
3739 .help = "Auto-detect",
3743 .help = "Normal (byte based)",
3747 .help = "Bit based",
3750 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3751 .category = FIO_OPT_C_GENERAL,
3752 .group = FIO_OPT_G_INVALID,
3755 .name = "hugepage-size",
3756 .lname = "Hugepage size",
3757 .type = FIO_OPT_INT,
3758 .off1 = td_var_offset(hugepage_size),
3759 .help = "When using hugepages, specify size of each page",
3760 .def = __fio_stringify(FIO_HUGE_PAGE),
3761 .interval = 1024 * 1024,
3762 .category = FIO_OPT_C_GENERAL,
3763 .group = FIO_OPT_G_INVALID,
3767 .lname = "I/O flow ID",
3768 .type = FIO_OPT_INT,
3769 .off1 = td_var_offset(flow_id),
3770 .help = "The flow index ID to use",
3772 .category = FIO_OPT_C_IO,
3773 .group = FIO_OPT_G_IO_FLOW,
3777 .lname = "I/O flow weight",
3778 .type = FIO_OPT_INT,
3779 .off1 = td_var_offset(flow),
3780 .help = "Weight for flow control of this job",
3781 .parent = "flow_id",
3784 .category = FIO_OPT_C_IO,
3785 .group = FIO_OPT_G_IO_FLOW,
3788 .name = "flow_watermark",
3789 .lname = "I/O flow watermark",
3790 .type = FIO_OPT_INT,
3791 .off1 = td_var_offset(flow_watermark),
3792 .help = "High watermark for flow control. This option"
3793 " should be set to the same value for all threads"
3794 " with non-zero flow.",
3795 .parent = "flow_id",
3798 .category = FIO_OPT_C_IO,
3799 .group = FIO_OPT_G_IO_FLOW,
3802 .name = "flow_sleep",
3803 .lname = "I/O flow sleep",
3804 .type = FIO_OPT_INT,
3805 .off1 = td_var_offset(flow_sleep),
3806 .help = "How many microseconds to sleep after being held"
3807 " back by the flow control mechanism",
3808 .parent = "flow_id",
3811 .category = FIO_OPT_C_IO,
3812 .group = FIO_OPT_G_IO_FLOW,
3816 .lname = "Skip operations against bad blocks",
3817 .type = FIO_OPT_BOOL,
3818 .off1 = td_var_offset(skip_bad),
3819 .help = "Skip operations against known bad blocks.",
3822 .category = FIO_OPT_C_IO,
3823 .group = FIO_OPT_G_MTD,
3830 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3831 const char *name, int val)
3833 lopt->name = (char *) name;
3835 if (o->type == FIO_OPT_STR_SET)
3836 lopt->has_arg = optional_argument;
3838 lopt->has_arg = required_argument;
3841 static void options_to_lopts(struct fio_option *opts,
3842 struct option *long_options,
3843 int i, int option_type)
3845 struct fio_option *o = &opts[0];
3847 add_to_lopt(&long_options[i], o, o->name, option_type);
3850 add_to_lopt(&long_options[i], o, o->alias, option_type);
3855 assert(i < FIO_NR_OPTIONS);
3859 void fio_options_set_ioengine_opts(struct option *long_options,
3860 struct thread_data *td)
3865 while (long_options[i].name) {
3866 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3867 memset(&long_options[i], 0, sizeof(*long_options));
3874 * Just clear out the prior ioengine options.
3879 options_to_lopts(td->io_ops->options, long_options, i,
3880 FIO_GETOPT_IOENGINE);
3883 void fio_options_dup_and_init(struct option *long_options)
3887 options_init(fio_options);
3890 while (long_options[i].name)
3893 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3896 struct fio_keyword {
3902 static struct fio_keyword fio_keywords[] = {
3904 .word = "$pagesize",
3905 .desc = "Page size in the system",
3908 .word = "$mb_memory",
3909 .desc = "Megabytes of memory online",
3913 .desc = "Number of CPUs online in the system",
3920 void fio_keywords_exit(void)
3922 struct fio_keyword *kw;
3924 kw = &fio_keywords[0];
3932 void fio_keywords_init(void)
3934 unsigned long long mb_memory;
3938 sprintf(buf, "%lu", (unsigned long) page_size);
3939 fio_keywords[0].replace = strdup(buf);
3941 mb_memory = os_phys_mem() / (1024 * 1024);
3942 sprintf(buf, "%llu", mb_memory);
3943 fio_keywords[1].replace = strdup(buf);
3946 sprintf(buf, "%lu", l);
3947 fio_keywords[2].replace = strdup(buf);
3952 static char *bc_calc(char *str)
3954 char buf[128], *tmp;
3959 * No math, just return string
3961 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3962 !strchr(str, '/')) || strchr(str, '\''))
3966 * Split option from value, we only need to calculate the value
3968 tmp = strchr(str, '=');
3975 * Prevent buffer overflows; such a case isn't reasonable anyway
3977 if (strlen(str) >= 128 || strlen(tmp) > 100)
3980 sprintf(buf, "which %s > /dev/null", BC_APP);
3982 log_err("fio: bc is needed for performing math\n");
3986 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3987 f = popen(buf, "r");
3991 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3998 buf[(tmp - str) + ret - 1] = '\0';
3999 memcpy(buf, str, tmp - str);
4005 * Return a copy of the input string with substrings of the form ${VARNAME}
4006 * substituted with the value of the environment variable VARNAME. The
4007 * substitution always occurs, even if VARNAME is empty or the corresponding
4008 * environment variable undefined.
4010 static char *option_dup_subs(const char *opt)
4012 char out[OPT_LEN_MAX+1];
4013 char in[OPT_LEN_MAX+1];
4016 char *ch1, *ch2, *env;
4017 ssize_t nchr = OPT_LEN_MAX;
4020 if (strlen(opt) + 1 > OPT_LEN_MAX) {
4021 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
4025 in[OPT_LEN_MAX] = '\0';
4026 strncpy(in, opt, OPT_LEN_MAX);
4028 while (*inptr && nchr > 0) {
4029 if (inptr[0] == '$' && inptr[1] == '{') {
4030 ch2 = strchr(inptr, '}');
4031 if (ch2 && inptr+1 < ch2) {
4038 envlen = strlen(env);
4039 if (envlen <= nchr) {
4040 memcpy(outptr, env, envlen);
4050 *outptr++ = *inptr++;
4059 * Look for reserved variable names and replace them with real values
4061 static char *fio_keyword_replace(char *opt)
4067 for (i = 0; fio_keywords[i].word != NULL; i++) {
4068 struct fio_keyword *kw = &fio_keywords[i];
4070 while ((s = strstr(opt, kw->word)) != NULL) {
4071 char *new = malloc(strlen(opt) + 1);
4077 * Copy part of the string before the keyword and
4078 * sprintf() the replacement after it.
4080 memcpy(new, opt, olen);
4081 len = sprintf(new + olen, "%s", kw->replace);
4084 * If there's more in the original string, copy that
4087 opt += strlen(kw->word) + olen;
4089 memcpy(new + olen + len, opt, opt - o_org - 1);
4092 * replace opt and free the old opt
4102 * Check for potential math and invoke bc, if possible
4110 static char **dup_and_sub_options(char **opts, int num_opts)
4113 char **opts_copy = malloc(num_opts * sizeof(*opts));
4114 for (i = 0; i < num_opts; i++) {
4115 opts_copy[i] = option_dup_subs(opts[i]);
4118 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
4123 static void show_closest_option(const char *opt)
4125 int best_option, best_distance;
4134 while (name[i] != '\0' && name[i] != '=')
4139 best_distance = INT_MAX;
4141 while (fio_options[i].name) {
4142 distance = string_distance(name, fio_options[i].name);
4143 if (distance < best_distance) {
4144 best_distance = distance;
4150 if (best_option != -1 && string_distance_ok(name, best_distance))
4151 log_err("Did you mean %s?\n", fio_options[best_option].name);
4156 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
4158 int i, ret, unknown;
4161 sort_options(opts, fio_options, num_opts);
4162 opts_copy = dup_and_sub_options(opts, num_opts);
4164 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
4165 struct fio_option *o;
4166 int newret = parse_option(opts_copy[i], opts[i], fio_options,
4167 &o, td, &td->opt_list);
4170 fio_option_mark_set(&td->o, o);
4178 opts_copy[i] = NULL;
4185 ret |= ioengine_load(td);
4187 sort_options(opts_copy, td->io_ops->options, num_opts);
4190 for (i = 0; i < num_opts; i++) {
4191 struct fio_option *o = NULL;
4198 newret = parse_option(opts_copy[i], opts[i],
4199 td->io_ops->options, &o,
4200 td->eo, &td->opt_list);
4204 log_err("Bad option <%s>\n", opts[i]);
4205 show_closest_option(opts[i]);
4208 opts_copy[i] = NULL;
4216 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
4220 ret = parse_cmd_option(opt, val, fio_options, td, &td->opt_list);
4222 struct fio_option *o;
4224 o = find_option(fio_options, opt);
4226 fio_option_mark_set(&td->o, o);
4232 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
4235 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
4239 void fio_fill_default_options(struct thread_data *td)
4241 td->o.magic = OPT_MAGIC;
4242 fill_default_options(td, fio_options);
4245 int fio_show_option_help(const char *opt)
4247 return show_cmd_help(fio_options, opt);
4250 void options_mem_dupe(void *data, struct fio_option *options)
4252 struct fio_option *o;
4255 for (o = &options[0]; o->name; o++) {
4256 if (o->type != FIO_OPT_STR_STORE)
4259 ptr = td_var(data, o, o->off1);
4261 *ptr = strdup(*ptr);
4266 * dupe FIO_OPT_STR_STORE options
4268 void fio_options_mem_dupe(struct thread_data *td)
4270 options_mem_dupe(&td->o, fio_options);
4272 if (td->eo && td->io_ops) {
4273 void *oldeo = td->eo;
4275 td->eo = malloc(td->io_ops->option_struct_size);
4276 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
4277 options_mem_dupe(td->eo, td->io_ops->options);
4281 unsigned int fio_get_kb_base(void *data)
4283 struct thread_options *o = data;
4284 unsigned int kb_base = 0;
4287 * This is a hack... For private options, *data is not holding
4288 * a pointer to the thread_options, but to private data. This means
4289 * we can't safely dereference it, but magic is first so mem wise
4290 * it is valid. But this also means that if the job first sets
4291 * kb_base and expects that to be honored by private options,
4292 * it will be disappointed. We will return the global default
4295 if (o && o->magic == OPT_MAGIC)
4296 kb_base = o->kb_base;
4303 int add_option(struct fio_option *o)
4305 struct fio_option *__o;
4314 if (opt_index + 1 == FIO_MAX_OPTS) {
4315 log_err("fio: FIO_MAX_OPTS is too small\n");
4319 memcpy(&fio_options[opt_index], o, sizeof(*o));
4320 fio_options[opt_index + 1].name = NULL;
4324 void invalidate_profile_options(const char *prof_name)
4326 struct fio_option *o;
4330 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
4331 o->type = FIO_OPT_INVALID;
4332 o->prof_name = NULL;
4338 void add_opt_posval(const char *optname, const char *ival, const char *help)
4340 struct fio_option *o;
4343 o = find_option(fio_options, optname);
4347 for (i = 0; i < PARSE_MAX_VP; i++) {
4348 if (o->posval[i].ival)
4351 o->posval[i].ival = ival;
4352 o->posval[i].help = help;
4357 void del_opt_posval(const char *optname, const char *ival)
4359 struct fio_option *o;
4362 o = find_option(fio_options, optname);
4366 for (i = 0; i < PARSE_MAX_VP; i++) {
4367 if (!o->posval[i].ival)
4369 if (strcmp(o->posval[i].ival, ival))
4372 o->posval[i].ival = NULL;
4373 o->posval[i].help = NULL;
4377 void fio_options_free(struct thread_data *td)
4379 options_free(fio_options, td);
4380 if (td->eo && td->io_ops && td->io_ops->options) {
4381 options_free(td->io_ops->options, td->eo);
4387 struct fio_option *fio_option_find(const char *name)
4389 return find_option(fio_options, name);
4392 static struct fio_option *find_next_opt(struct thread_options *o,
4393 struct fio_option *from,
4396 struct fio_option *opt;
4399 from = &fio_options[0];
4405 if (off1 == from->off1) {
4410 } while (from->name);
4415 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
4417 unsigned int opt_off, index, offset;
4419 opt_off = opt - &fio_options[0];
4420 index = opt_off / (8 * sizeof(uint64_t));
4421 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4422 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
4425 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
4427 struct fio_option *opt, *next;
4430 while ((opt = find_next_opt(o, next, off1)) != NULL) {
4431 if (opt_is_set(o, opt))
4440 void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)
4442 unsigned int opt_off, index, offset;
4444 opt_off = opt - &fio_options[0];
4445 index = opt_off / (8 * sizeof(uint64_t));
4446 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4447 o->set_options[index] |= (uint64_t)1 << offset;