11 #include <netinet/in.h>
17 #include "lib/pattern.h"
20 #include "crc/crc32c.h"
22 char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
24 struct pattern_fmt_desc fmt_desc[] = {
27 .len = FIELD_SIZE(struct io_u *, offset),
28 .paste = paste_blockoff
33 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
35 static char *get_opt_postfix(const char *str)
37 char *p = strstr(str, ":");
43 strip_blank_front(&p);
48 static int bs_cmp(const void *p1, const void *p2)
50 const struct bssplit *bsp1 = p1;
51 const struct bssplit *bsp2 = p2;
53 return bsp1->perc < bsp2->perc;
56 static int bssplit_ddir(struct thread_options *o, int ddir, char *str)
58 struct bssplit *bssplit;
59 unsigned int i, perc, perc_missing;
60 unsigned int max_bs, min_bs;
64 o->bssplit_nr[ddir] = 4;
65 bssplit = malloc(4 * sizeof(struct bssplit));
70 while ((fname = strsep(&str, ":")) != NULL) {
77 * grow struct buffer, if needed
79 if (i == o->bssplit_nr[ddir]) {
80 o->bssplit_nr[ddir] <<= 1;
81 bssplit = realloc(bssplit, o->bssplit_nr[ddir]
82 * sizeof(struct bssplit));
85 perc_str = strstr(fname, "/");
89 perc = atoi(perc_str);
97 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
98 log_err("fio: bssplit conversion failed\n");
109 bssplit[i].perc = perc;
113 o->bssplit_nr[ddir] = i;
116 * Now check if the percentages add up, and how much is missing
118 perc = perc_missing = 0;
119 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
120 struct bssplit *bsp = &bssplit[i];
122 if (bsp->perc == -1U)
128 if (perc > 100 && perc_missing > 1) {
129 log_err("fio: bssplit percentages add to more than 100%%\n");
135 * If values didn't have a percentage set, divide the remains between
139 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
141 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
142 struct bssplit *bsp = &bssplit[i];
144 if (bsp->perc == -1U)
145 bsp->perc = (100 - perc) / perc_missing;
149 o->min_bs[ddir] = min_bs;
150 o->max_bs[ddir] = max_bs;
153 * now sort based on percentages, for ease of lookup
155 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
156 o->bssplit[ddir] = bssplit;
160 static int str_bssplit_cb(void *data, const char *input)
162 struct thread_data *td = data;
163 char *str, *p, *odir, *ddir;
169 p = str = strdup(input);
171 strip_blank_front(&str);
172 strip_blank_end(str);
174 odir = strchr(str, ',');
176 ddir = strchr(odir + 1, ',');
178 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
184 op = strdup(odir + 1);
185 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
190 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
193 ret = bssplit_ddir(&td->o, DDIR_READ, str);
199 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
204 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
208 ret = bssplit_ddir(&td->o, DDIR_READ, str);
215 static int str2error(char *str)
217 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
218 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
219 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
220 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
221 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
222 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
223 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
224 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
225 int i = 0, num = sizeof(err) / sizeof(void *);
228 if (!strcmp(err[i], str))
235 static int ignore_error_type(struct thread_data *td, int etype, char *str)
241 if (etype >= ERROR_TYPE_CNT) {
242 log_err("Illegal error type\n");
246 td->o.ignore_error_nr[etype] = 4;
247 error = malloc(4 * sizeof(struct bssplit));
250 while ((fname = strsep(&str, ":")) != NULL) {
256 * grow struct buffer, if needed
258 if (i == td->o.ignore_error_nr[etype]) {
259 td->o.ignore_error_nr[etype] <<= 1;
260 error = realloc(error, td->o.ignore_error_nr[etype]
263 if (fname[0] == 'E') {
264 error[i] = str2error(fname);
266 error[i] = atoi(fname);
268 error[i] = -error[i];
271 log_err("Unknown error %s, please use number value \n",
279 td->o.continue_on_error |= 1 << etype;
280 td->o.ignore_error_nr[etype] = i;
281 td->o.ignore_error[etype] = error;
289 static int str_ignore_error_cb(void *data, const char *input)
291 struct thread_data *td = data;
293 int type = 0, ret = 1;
298 p = str = strdup(input);
300 strip_blank_front(&str);
301 strip_blank_end(str);
307 ret = ignore_error_type(td, type, p);
317 static int str_rw_cb(void *data, const char *str)
319 struct thread_data *td = data;
320 struct thread_options *o = &td->o;
329 nr = get_opt_postfix(str);
334 o->ddir_seq_nr = atoi(nr);
338 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
339 log_err("fio: rw postfix parsing failed\n");
344 o->ddir_seq_add = val;
351 static int str_mem_cb(void *data, const char *mem)
353 struct thread_data *td = data;
355 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
356 td->o.mem_type == MEM_MMAPSHARED)
357 td->o.mmapfile = get_opt_postfix(mem);
362 static int fio_clock_source_cb(void *data, const char *str)
364 struct thread_data *td = data;
366 fio_clock_source = td->o.clocksource;
367 fio_clock_source_set = 1;
372 static int str_rwmix_read_cb(void *data, unsigned long long *val)
374 struct thread_data *td = data;
376 td->o.rwmix[DDIR_READ] = *val;
377 td->o.rwmix[DDIR_WRITE] = 100 - *val;
381 static int str_rwmix_write_cb(void *data, unsigned long long *val)
383 struct thread_data *td = data;
385 td->o.rwmix[DDIR_WRITE] = *val;
386 td->o.rwmix[DDIR_READ] = 100 - *val;
390 static int str_exitall_cb(void)
392 exitall_on_terminate = 1;
396 #ifdef FIO_HAVE_CPU_AFFINITY
397 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
399 unsigned int i, index, cpus_in_mask;
400 const long max_cpu = cpus_online();
402 cpus_in_mask = fio_cpu_count(mask);
403 cpu_index = cpu_index % cpus_in_mask;
406 for (i = 0; i < max_cpu; i++) {
407 if (!fio_cpu_isset(mask, i))
410 if (cpu_index != index)
411 fio_cpu_clear(mask, i);
416 return fio_cpu_count(mask);
419 static int str_cpumask_cb(void *data, unsigned long long *val)
421 struct thread_data *td = data;
429 ret = fio_cpuset_init(&td->o.cpumask);
431 log_err("fio: cpuset_init failed\n");
432 td_verror(td, ret, "fio_cpuset_init");
436 max_cpu = cpus_online();
438 for (i = 0; i < sizeof(int) * 8; i++) {
439 if ((1 << i) & *val) {
441 log_err("fio: CPU %d too large (max=%ld)\n", i,
445 dprint(FD_PARSE, "set cpu allowed %d\n", i);
446 fio_cpu_set(&td->o.cpumask, i);
453 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
460 ret = fio_cpuset_init(mask);
462 log_err("fio: cpuset_init failed\n");
463 td_verror(td, ret, "fio_cpuset_init");
467 p = str = strdup(input);
469 strip_blank_front(&str);
470 strip_blank_end(str);
472 max_cpu = cpus_online();
474 while ((cpu = strsep(&str, ",")) != NULL) {
483 while ((cpu2 = strsep(&str2, "-")) != NULL) {
493 while (icpu <= icpu2) {
494 if (icpu >= FIO_MAX_CPUS) {
495 log_err("fio: your OS only supports up to"
496 " %d CPUs\n", (int) FIO_MAX_CPUS);
500 if (icpu >= max_cpu) {
501 log_err("fio: CPU %d too large (max=%ld)\n",
507 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
508 fio_cpu_set(mask, icpu);
519 static int str_cpus_allowed_cb(void *data, const char *input)
521 struct thread_data *td = data;
526 return set_cpus_allowed(td, &td->o.cpumask, input);
529 static int str_verify_cpus_allowed_cb(void *data, const char *input)
531 struct thread_data *td = data;
536 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
540 static int str_log_cpus_allowed_cb(void *data, const char *input)
542 struct thread_data *td = data;
547 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
549 #endif /* CONFIG_ZLIB */
551 #endif /* FIO_HAVE_CPU_AFFINITY */
553 #ifdef CONFIG_LIBNUMA
554 static int str_numa_cpunodes_cb(void *data, char *input)
556 struct thread_data *td = data;
557 struct bitmask *verify_bitmask;
562 /* numa_parse_nodestring() parses a character string list
563 * of nodes into a bit mask. The bit mask is allocated by
564 * numa_allocate_nodemask(), so it should be freed by
565 * numa_free_nodemask().
567 verify_bitmask = numa_parse_nodestring(input);
568 if (verify_bitmask == NULL) {
569 log_err("fio: numa_parse_nodestring failed\n");
570 td_verror(td, 1, "str_numa_cpunodes_cb");
573 numa_free_nodemask(verify_bitmask);
575 td->o.numa_cpunodes = strdup(input);
579 static int str_numa_mpol_cb(void *data, char *input)
581 struct thread_data *td = data;
582 const char * const policy_types[] =
583 { "default", "prefer", "bind", "interleave", "local", NULL };
586 struct bitmask *verify_bitmask;
591 nodelist = strchr(input, ':');
593 /* NUL-terminate mode */
597 for (i = 0; i <= MPOL_LOCAL; i++) {
598 if (!strcmp(input, policy_types[i])) {
599 td->o.numa_mem_mode = i;
603 if (i > MPOL_LOCAL) {
604 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
608 switch (td->o.numa_mem_mode) {
611 * Insist on a nodelist of one node only
614 char *rest = nodelist;
615 while (isdigit(*rest))
618 log_err("fio: one node only for \'prefer\'\n");
622 log_err("fio: one node is needed for \'prefer\'\n");
626 case MPOL_INTERLEAVE:
628 * Default to online nodes with memory if no nodelist
631 nodelist = strdup("all");
636 * Don't allow a nodelist
639 log_err("fio: NO nodelist for \'local\'\n");
645 * Insist on a nodelist
648 log_err("fio: a nodelist is needed for \'bind\'\n");
655 /* numa_parse_nodestring() parses a character string list
656 * of nodes into a bit mask. The bit mask is allocated by
657 * numa_allocate_nodemask(), so it should be freed by
658 * numa_free_nodemask().
660 switch (td->o.numa_mem_mode) {
662 td->o.numa_mem_prefer_node = atoi(nodelist);
664 case MPOL_INTERLEAVE:
666 verify_bitmask = numa_parse_nodestring(nodelist);
667 if (verify_bitmask == NULL) {
668 log_err("fio: numa_parse_nodestring failed\n");
669 td_verror(td, 1, "str_numa_memnodes_cb");
672 td->o.numa_memnodes = strdup(nodelist);
673 numa_free_nodemask(verify_bitmask);
688 static int str_fst_cb(void *data, const char *str)
690 struct thread_data *td = data;
691 char *nr = get_opt_postfix(str);
693 td->file_service_nr = 1;
695 td->file_service_nr = atoi(nr);
702 #ifdef CONFIG_SYNC_FILE_RANGE
703 static int str_sfr_cb(void *data, const char *str)
705 struct thread_data *td = data;
706 char *nr = get_opt_postfix(str);
708 td->sync_file_range_nr = 1;
710 td->sync_file_range_nr = atoi(nr);
718 static int str_random_distribution_cb(void *data, const char *str)
720 struct thread_data *td = data;
727 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
729 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
730 val = FIO_DEF_PARETO;
731 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
736 nr = get_opt_postfix(str);
737 if (nr && !str_to_float(nr, &val, 0)) {
738 log_err("fio: random postfix parsing failed\n");
745 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
747 log_err("fio: zipf theta must different than 1.0\n");
750 td->o.zipf_theta.u.f = val;
751 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
752 if (val <= 0.00 || val >= 1.00) {
753 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
756 td->o.pareto_h.u.f = val;
758 if (val <= 0.00 || val >= 100.0) {
759 log_err("fio: normal deviation out of range (0 < input < 100.0)\n");
762 td->o.gauss_dev.u.f = val;
769 * Return next name in the string. Files are separated with ':'. If the ':'
770 * is escaped with a '\', then that ':' is part of the filename and does not
771 * indicate a new file.
773 static char *get_next_name(char **ptr)
778 if (!str || !strlen(str))
784 * No colon, we are done
786 p = strchr(str, ':');
793 * We got a colon, but it's the first character. Skip and
801 if (*(p - 1) != '\\') {
807 memmove(p - 1, p, strlen(p) + 1);
815 static int get_max_name_idx(char *input)
817 unsigned int cur_idx;
820 p = str = strdup(input);
821 for (cur_idx = 0; ; cur_idx++)
822 if (get_next_name(&str) == NULL)
830 * Returns the directory at the index, indexes > entires will be
831 * assigned via modulo division of the index
833 int set_name_idx(char *target, size_t tlen, char *input, int index)
835 unsigned int cur_idx;
837 char *fname, *str, *p;
839 p = str = strdup(input);
841 index %= get_max_name_idx(input);
842 for (cur_idx = 0; cur_idx <= index; cur_idx++)
843 fname = get_next_name(&str);
845 if (client_sockaddr_str[0]) {
846 len = snprintf(target, tlen, "%s/%s.", fname,
847 client_sockaddr_str);
849 len = snprintf(target, tlen, "%s/", fname);
851 target[tlen - 1] = '\0';
857 static int str_filename_cb(void *data, const char *input)
859 struct thread_data *td = data;
860 char *fname, *str, *p;
862 p = str = strdup(input);
864 strip_blank_front(&str);
865 strip_blank_end(str);
867 if (!td->files_index)
870 while ((fname = get_next_name(&str)) != NULL) {
873 add_file(td, fname, 0, 1);
880 static int str_directory_cb(void *data, const char fio_unused *unused)
882 struct thread_data *td = data;
884 char *dirname, *str, *p;
890 p = str = strdup(td->o.directory);
891 while ((dirname = get_next_name(&str)) != NULL) {
892 if (lstat(dirname, &sb) < 0) {
895 log_err("fio: %s is not a directory\n", dirname);
896 td_verror(td, ret, "lstat");
899 if (!S_ISDIR(sb.st_mode)) {
900 log_err("fio: %s is not a directory\n", dirname);
911 static int str_opendir_cb(void *data, const char fio_unused *str)
913 struct thread_data *td = data;
918 if (!td->files_index)
921 return add_dir_files(td, td->o.opendir);
924 static int str_buffer_pattern_cb(void *data, const char *input)
926 struct thread_data *td = data;
929 /* FIXME: for now buffer pattern does not support formats */
930 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
931 MAX_PATTERN_SIZE, NULL, 0, NULL, NULL);
936 td->o.buffer_pattern_bytes = ret;
937 if (!td->o.compress_percentage)
938 td->o.refill_buffers = 0;
939 td->o.scramble_buffers = 0;
940 td->o.zero_buffers = 0;
945 static int str_buffer_compress_cb(void *data, unsigned long long *il)
947 struct thread_data *td = data;
949 td->flags |= TD_F_COMPRESS;
950 td->o.compress_percentage = *il;
954 static int str_dedupe_cb(void *data, unsigned long long *il)
956 struct thread_data *td = data;
958 td->flags |= TD_F_COMPRESS;
959 td->o.dedupe_percentage = *il;
960 td->o.refill_buffers = 1;
964 static int str_verify_pattern_cb(void *data, const char *input)
966 struct thread_data *td = data;
969 td->o.verify_fmt_sz = ARRAY_SIZE(td->o.verify_fmt);
970 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
971 MAX_PATTERN_SIZE, fmt_desc, sizeof(fmt_desc),
972 td->o.verify_fmt, &td->o.verify_fmt_sz);
977 td->o.verify_pattern_bytes = ret;
979 * VERIFY_* could already be set
981 if (!fio_option_is_set(&td->o, verify))
982 td->o.verify = VERIFY_PATTERN;
987 static int str_gtod_reduce_cb(void *data, int *il)
989 struct thread_data *td = data;
992 td->o.disable_lat = !!val;
993 td->o.disable_clat = !!val;
994 td->o.disable_slat = !!val;
995 td->o.disable_bw = !!val;
996 td->o.clat_percentiles = !val;
998 td->tv_cache_mask = 63;
1003 static int str_size_cb(void *data, unsigned long long *__val)
1005 struct thread_data *td = data;
1006 unsigned long long v = *__val;
1008 if (parse_is_percent(v)) {
1010 td->o.size_percent = -1ULL - v;
1017 static int rw_verify(struct fio_option *o, void *data)
1019 struct thread_data *td = data;
1021 if (read_only && td_write(td)) {
1022 log_err("fio: job <%s> has write bit set, but fio is in"
1023 " read-only mode\n", td->o.name);
1030 static int gtod_cpu_verify(struct fio_option *o, void *data)
1032 #ifndef FIO_HAVE_CPU_AFFINITY
1033 struct thread_data *td = data;
1035 if (td->o.gtod_cpu) {
1036 log_err("fio: platform must support CPU affinity for"
1037 "gettimeofday() offloading\n");
1048 static struct opt_group fio_opt_groups[] = {
1051 .mask = FIO_OPT_C_GENERAL,
1055 .mask = FIO_OPT_C_IO,
1059 .mask = FIO_OPT_C_FILE,
1062 .name = "Statistics",
1063 .mask = FIO_OPT_C_STAT,
1067 .mask = FIO_OPT_C_LOG,
1071 .mask = FIO_OPT_C_PROFILE,
1078 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs,
1082 struct opt_group *og;
1085 if (*mask == inv_mask || !*mask)
1088 for (i = 0; ogs[i].name; i++) {
1091 if (*mask & og->mask) {
1092 *mask &= ~(og->mask);
1100 struct opt_group *opt_group_from_mask(uint64_t *mask)
1102 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1105 static struct opt_group fio_opt_cat_groups[] = {
1107 .name = "Latency profiling",
1108 .mask = FIO_OPT_G_LATPROF,
1112 .mask = FIO_OPT_G_RATE,
1116 .mask = FIO_OPT_G_ZONE,
1119 .name = "Read/write mix",
1120 .mask = FIO_OPT_G_RWMIX,
1124 .mask = FIO_OPT_G_VERIFY,
1128 .mask = FIO_OPT_G_TRIM,
1131 .name = "I/O Logging",
1132 .mask = FIO_OPT_G_IOLOG,
1135 .name = "I/O Depth",
1136 .mask = FIO_OPT_G_IO_DEPTH,
1140 .mask = FIO_OPT_G_IO_FLOW,
1143 .name = "Description",
1144 .mask = FIO_OPT_G_DESC,
1148 .mask = FIO_OPT_G_FILENAME,
1151 .name = "General I/O",
1152 .mask = FIO_OPT_G_IO_BASIC,
1156 .mask = FIO_OPT_G_CGROUP,
1160 .mask = FIO_OPT_G_RUNTIME,
1164 .mask = FIO_OPT_G_PROCESS,
1167 .name = "Job credentials / priority",
1168 .mask = FIO_OPT_G_CRED,
1171 .name = "Clock settings",
1172 .mask = FIO_OPT_G_CLOCK,
1176 .mask = FIO_OPT_G_IO_TYPE,
1179 .name = "I/O Thinktime",
1180 .mask = FIO_OPT_G_THINKTIME,
1183 .name = "Randomizations",
1184 .mask = FIO_OPT_G_RANDOM,
1187 .name = "I/O buffers",
1188 .mask = FIO_OPT_G_IO_BUF,
1191 .name = "Tiobench profile",
1192 .mask = FIO_OPT_G_TIOBENCH,
1196 .mask = FIO_OPT_G_MTD,
1204 struct opt_group *opt_group_cat_from_mask(uint64_t *mask)
1206 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1210 * Map of job/command line options
1212 struct fio_option fio_options[FIO_MAX_OPTS] = {
1214 .name = "description",
1215 .lname = "Description of job",
1216 .type = FIO_OPT_STR_STORE,
1217 .off1 = td_var_offset(description),
1218 .help = "Text job description",
1219 .category = FIO_OPT_C_GENERAL,
1220 .group = FIO_OPT_G_DESC,
1224 .lname = "Job name",
1225 .type = FIO_OPT_STR_STORE,
1226 .off1 = td_var_offset(name),
1227 .help = "Name of this job",
1228 .category = FIO_OPT_C_GENERAL,
1229 .group = FIO_OPT_G_DESC,
1233 .lname = "Waitee name",
1234 .type = FIO_OPT_STR_STORE,
1235 .off1 = td_var_offset(wait_for),
1236 .help = "Name of the job this one wants to wait for before starting",
1237 .category = FIO_OPT_C_GENERAL,
1238 .group = FIO_OPT_G_DESC,
1242 .lname = "Filename(s)",
1243 .type = FIO_OPT_STR_STORE,
1244 .off1 = td_var_offset(filename),
1245 .cb = str_filename_cb,
1246 .prio = -1, /* must come after "directory" */
1247 .help = "File(s) to use for the workload",
1248 .category = FIO_OPT_C_FILE,
1249 .group = FIO_OPT_G_FILENAME,
1252 .name = "directory",
1253 .lname = "Directory",
1254 .type = FIO_OPT_STR_STORE,
1255 .off1 = td_var_offset(directory),
1256 .cb = str_directory_cb,
1257 .help = "Directory to store files in",
1258 .category = FIO_OPT_C_FILE,
1259 .group = FIO_OPT_G_FILENAME,
1262 .name = "filename_format",
1263 .type = FIO_OPT_STR_STORE,
1264 .off1 = td_var_offset(filename_format),
1265 .prio = -1, /* must come after "directory" */
1266 .help = "Override default $jobname.$jobnum.$filenum naming",
1267 .def = "$jobname.$jobnum.$filenum",
1268 .category = FIO_OPT_C_FILE,
1269 .group = FIO_OPT_G_FILENAME,
1273 .lname = "Lockfile",
1274 .type = FIO_OPT_STR,
1275 .off1 = td_var_offset(file_lock_mode),
1276 .help = "Lock file when doing IO to it",
1278 .parent = "filename",
1281 .category = FIO_OPT_C_FILE,
1282 .group = FIO_OPT_G_FILENAME,
1285 .oval = FILE_LOCK_NONE,
1286 .help = "No file locking",
1288 { .ival = "exclusive",
1289 .oval = FILE_LOCK_EXCLUSIVE,
1290 .help = "Exclusive file lock",
1293 .ival = "readwrite",
1294 .oval = FILE_LOCK_READWRITE,
1295 .help = "Read vs write lock",
1301 .lname = "Open directory",
1302 .type = FIO_OPT_STR_STORE,
1303 .off1 = td_var_offset(opendir),
1304 .cb = str_opendir_cb,
1305 .help = "Recursively add files from this directory and down",
1306 .category = FIO_OPT_C_FILE,
1307 .group = FIO_OPT_G_FILENAME,
1311 .lname = "Read/write",
1312 .alias = "readwrite",
1313 .type = FIO_OPT_STR,
1315 .off1 = td_var_offset(td_ddir),
1316 .help = "IO direction",
1318 .verify = rw_verify,
1319 .category = FIO_OPT_C_IO,
1320 .group = FIO_OPT_G_IO_BASIC,
1323 .oval = TD_DDIR_READ,
1324 .help = "Sequential read",
1327 .oval = TD_DDIR_WRITE,
1328 .help = "Sequential write",
1331 .oval = TD_DDIR_TRIM,
1332 .help = "Sequential trim",
1334 { .ival = "randread",
1335 .oval = TD_DDIR_RANDREAD,
1336 .help = "Random read",
1338 { .ival = "randwrite",
1339 .oval = TD_DDIR_RANDWRITE,
1340 .help = "Random write",
1342 { .ival = "randtrim",
1343 .oval = TD_DDIR_RANDTRIM,
1344 .help = "Random trim",
1348 .help = "Sequential read and write mix",
1350 { .ival = "readwrite",
1352 .help = "Sequential read and write mix",
1355 .oval = TD_DDIR_RANDRW,
1356 .help = "Random read and write mix"
1358 { .ival = "trimwrite",
1359 .oval = TD_DDIR_TRIMWRITE,
1360 .help = "Trim and write mix, trims preceding writes"
1365 .name = "rw_sequencer",
1366 .lname = "RW Sequencer",
1367 .type = FIO_OPT_STR,
1368 .off1 = td_var_offset(rw_seq),
1369 .help = "IO offset generator modifier",
1370 .def = "sequential",
1371 .category = FIO_OPT_C_IO,
1372 .group = FIO_OPT_G_IO_BASIC,
1374 { .ival = "sequential",
1376 .help = "Generate sequential offsets",
1378 { .ival = "identical",
1379 .oval = RW_SEQ_IDENT,
1380 .help = "Generate identical offsets",
1387 .lname = "IO Engine",
1388 .type = FIO_OPT_STR_STORE,
1389 .off1 = td_var_offset(ioengine),
1390 .help = "IO engine to use",
1391 .def = FIO_PREFERRED_ENGINE,
1392 .category = FIO_OPT_C_IO,
1393 .group = FIO_OPT_G_IO_BASIC,
1396 .help = "Use read/write",
1399 .help = "Use pread/pwrite",
1402 .help = "Use readv/writev",
1404 #ifdef CONFIG_PWRITEV
1406 .help = "Use preadv/pwritev",
1409 #ifdef CONFIG_LIBAIO
1411 .help = "Linux native asynchronous IO",
1414 #ifdef CONFIG_POSIXAIO
1415 { .ival = "posixaio",
1416 .help = "POSIX asynchronous IO",
1419 #ifdef CONFIG_SOLARISAIO
1420 { .ival = "solarisaio",
1421 .help = "Solaris native asynchronous IO",
1424 #ifdef CONFIG_WINDOWSAIO
1425 { .ival = "windowsaio",
1426 .help = "Windows native asynchronous IO"
1431 .help = "Rados Block Device asynchronous IO"
1435 .help = "Memory mapped IO"
1437 #ifdef CONFIG_LINUX_SPLICE
1439 .help = "splice/vmsplice based IO",
1441 { .ival = "netsplice",
1442 .help = "splice/vmsplice to/from the network",
1445 #ifdef FIO_HAVE_SGIO
1447 .help = "SCSI generic v3 IO",
1451 .help = "Testing engine (no data transfer)",
1454 .help = "Network IO",
1457 .help = "CPU cycle burner engine",
1461 .help = "GUASI IO engine",
1464 #ifdef FIO_HAVE_BINJECT
1465 { .ival = "binject",
1466 .help = "binject direct inject block engine",
1471 .help = "RDMA IO engine",
1474 #ifdef CONFIG_FUSION_AW
1475 { .ival = "fusion-aw-sync",
1476 .help = "Fusion-io atomic write engine",
1479 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1480 { .ival = "e4defrag",
1481 .help = "ext4 defrag engine",
1484 #ifdef CONFIG_LINUX_FALLOCATE
1486 .help = "fallocate() file based engine",
1491 .help = "Glusterfs libgfapi(sync) based engine"
1493 { .ival = "gfapi_async",
1494 .help = "Glusterfs libgfapi(async) based engine"
1497 #ifdef CONFIG_LIBHDFS
1498 { .ival = "libhdfs",
1499 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1502 { .ival = "external",
1503 .help = "Load external engine (append name)",
1509 .lname = "IO Depth",
1510 .type = FIO_OPT_INT,
1511 .off1 = td_var_offset(iodepth),
1512 .help = "Number of IO buffers to keep in flight",
1516 .category = FIO_OPT_C_IO,
1517 .group = FIO_OPT_G_IO_BASIC,
1520 .name = "iodepth_batch",
1521 .lname = "IO Depth batch",
1522 .alias = "iodepth_batch_submit",
1523 .type = FIO_OPT_INT,
1524 .off1 = td_var_offset(iodepth_batch),
1525 .help = "Number of IO buffers to submit in one go",
1526 .parent = "iodepth",
1531 .category = FIO_OPT_C_IO,
1532 .group = FIO_OPT_G_IO_BASIC,
1535 .name = "iodepth_batch_complete_min",
1536 .lname = "Min IO depth batch complete",
1537 .alias = "iodepth_batch_complete",
1538 .type = FIO_OPT_INT,
1539 .off1 = td_var_offset(iodepth_batch_complete_min),
1540 .help = "Min number of IO buffers to retrieve in one go",
1541 .parent = "iodepth",
1546 .category = FIO_OPT_C_IO,
1547 .group = FIO_OPT_G_IO_BASIC,
1550 .name = "iodepth_batch_complete_max",
1551 .lname = "Max IO depth batch complete",
1552 .type = FIO_OPT_INT,
1553 .off1 = td_var_offset(iodepth_batch_complete_max),
1554 .help = "Max number of IO buffers to retrieve in one go",
1555 .parent = "iodepth",
1559 .category = FIO_OPT_C_IO,
1560 .group = FIO_OPT_G_IO_BASIC,
1563 .name = "iodepth_low",
1564 .lname = "IO Depth batch low",
1565 .type = FIO_OPT_INT,
1566 .off1 = td_var_offset(iodepth_low),
1567 .help = "Low water mark for queuing depth",
1568 .parent = "iodepth",
1571 .category = FIO_OPT_C_IO,
1572 .group = FIO_OPT_G_IO_BASIC,
1575 .name = "io_submit_mode",
1576 .lname = "IO submit mode",
1577 .type = FIO_OPT_STR,
1578 .off1 = td_var_offset(io_submit_mode),
1579 .help = "How IO submissions and completions are done",
1581 .category = FIO_OPT_C_IO,
1582 .group = FIO_OPT_G_IO_BASIC,
1585 .oval = IO_MODE_INLINE,
1586 .help = "Submit and complete IO inline",
1588 { .ival = "offload",
1589 .oval = IO_MODE_OFFLOAD,
1590 .help = "Offload submit and complete to threads",
1597 .type = FIO_OPT_STR_VAL,
1599 .off1 = td_var_offset(size),
1600 .help = "Total size of device or files",
1601 .interval = 1024 * 1024,
1602 .category = FIO_OPT_C_IO,
1603 .group = FIO_OPT_G_INVALID,
1607 .alias = "io_limit",
1609 .type = FIO_OPT_STR_VAL,
1610 .off1 = td_var_offset(io_limit),
1611 .interval = 1024 * 1024,
1612 .category = FIO_OPT_C_IO,
1613 .group = FIO_OPT_G_INVALID,
1616 .name = "fill_device",
1617 .lname = "Fill device",
1619 .type = FIO_OPT_BOOL,
1620 .off1 = td_var_offset(fill_device),
1621 .help = "Write until an ENOSPC error occurs",
1623 .category = FIO_OPT_C_FILE,
1624 .group = FIO_OPT_G_INVALID,
1628 .lname = "File size",
1629 .type = FIO_OPT_STR_VAL,
1630 .off1 = td_var_offset(file_size_low),
1631 .off2 = td_var_offset(file_size_high),
1633 .help = "Size of individual files",
1634 .interval = 1024 * 1024,
1635 .category = FIO_OPT_C_FILE,
1636 .group = FIO_OPT_G_INVALID,
1639 .name = "file_append",
1640 .lname = "File append",
1641 .type = FIO_OPT_BOOL,
1642 .off1 = td_var_offset(file_append),
1643 .help = "IO will start at the end of the file(s)",
1645 .category = FIO_OPT_C_FILE,
1646 .group = FIO_OPT_G_INVALID,
1650 .lname = "IO offset",
1651 .alias = "fileoffset",
1652 .type = FIO_OPT_STR_VAL,
1653 .off1 = td_var_offset(start_offset),
1654 .help = "Start IO from this offset",
1656 .interval = 1024 * 1024,
1657 .category = FIO_OPT_C_IO,
1658 .group = FIO_OPT_G_INVALID,
1661 .name = "offset_increment",
1662 .lname = "IO offset increment",
1663 .type = FIO_OPT_STR_VAL,
1664 .off1 = td_var_offset(offset_increment),
1665 .help = "What is the increment from one offset to the next",
1669 .interval = 1024 * 1024,
1670 .category = FIO_OPT_C_IO,
1671 .group = FIO_OPT_G_INVALID,
1674 .name = "number_ios",
1675 .lname = "Number of IOs to perform",
1676 .type = FIO_OPT_STR_VAL,
1677 .off1 = td_var_offset(number_ios),
1678 .help = "Force job completion after this number of IOs",
1680 .category = FIO_OPT_C_IO,
1681 .group = FIO_OPT_G_INVALID,
1685 .lname = "Block size",
1686 .alias = "blocksize",
1687 .type = FIO_OPT_INT,
1688 .off1 = td_var_offset(bs[DDIR_READ]),
1689 .off2 = td_var_offset(bs[DDIR_WRITE]),
1690 .off3 = td_var_offset(bs[DDIR_TRIM]),
1692 .help = "Block size unit",
1697 .category = FIO_OPT_C_IO,
1698 .group = FIO_OPT_G_INVALID,
1702 .lname = "Block size align",
1703 .alias = "blockalign",
1704 .type = FIO_OPT_INT,
1705 .off1 = td_var_offset(ba[DDIR_READ]),
1706 .off2 = td_var_offset(ba[DDIR_WRITE]),
1707 .off3 = td_var_offset(ba[DDIR_TRIM]),
1709 .help = "IO block offset alignment",
1713 .category = FIO_OPT_C_IO,
1714 .group = FIO_OPT_G_INVALID,
1718 .lname = "Block size range",
1719 .alias = "blocksize_range",
1720 .type = FIO_OPT_RANGE,
1721 .off1 = td_var_offset(min_bs[DDIR_READ]),
1722 .off2 = td_var_offset(max_bs[DDIR_READ]),
1723 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1724 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1725 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1726 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1728 .help = "Set block size range (in more detail than bs)",
1732 .category = FIO_OPT_C_IO,
1733 .group = FIO_OPT_G_INVALID,
1737 .lname = "Block size split",
1738 .type = FIO_OPT_STR,
1739 .cb = str_bssplit_cb,
1740 .off1 = td_var_offset(bssplit),
1741 .help = "Set a specific mix of block sizes",
1744 .category = FIO_OPT_C_IO,
1745 .group = FIO_OPT_G_INVALID,
1748 .name = "bs_unaligned",
1749 .lname = "Block size unaligned",
1750 .alias = "blocksize_unaligned",
1751 .type = FIO_OPT_STR_SET,
1752 .off1 = td_var_offset(bs_unaligned),
1753 .help = "Don't sector align IO buffer sizes",
1756 .category = FIO_OPT_C_IO,
1757 .group = FIO_OPT_G_INVALID,
1760 .name = "bs_is_seq_rand",
1761 .lname = "Block size division is seq/random (not read/write)",
1762 .type = FIO_OPT_BOOL,
1763 .off1 = td_var_offset(bs_is_seq_rand),
1764 .help = "Consider any blocksize setting to be sequential,random",
1766 .parent = "blocksize",
1767 .category = FIO_OPT_C_IO,
1768 .group = FIO_OPT_G_INVALID,
1771 .name = "randrepeat",
1772 .lname = "Random repeatable",
1773 .type = FIO_OPT_BOOL,
1774 .off1 = td_var_offset(rand_repeatable),
1775 .help = "Use repeatable random IO pattern",
1779 .category = FIO_OPT_C_IO,
1780 .group = FIO_OPT_G_RANDOM,
1784 .lname = "The random generator seed",
1785 .type = FIO_OPT_STR_VAL,
1786 .off1 = td_var_offset(rand_seed),
1787 .help = "Set the random generator seed value",
1790 .category = FIO_OPT_C_IO,
1791 .group = FIO_OPT_G_RANDOM,
1794 .name = "use_os_rand",
1795 .lname = "Use OS random",
1796 .type = FIO_OPT_DEPRECATED,
1797 .off1 = td_var_offset(dep_use_os_rand),
1798 .category = FIO_OPT_C_IO,
1799 .group = FIO_OPT_G_RANDOM,
1802 .name = "norandommap",
1803 .lname = "No randommap",
1804 .type = FIO_OPT_STR_SET,
1805 .off1 = td_var_offset(norandommap),
1806 .help = "Accept potential duplicate random blocks",
1810 .category = FIO_OPT_C_IO,
1811 .group = FIO_OPT_G_RANDOM,
1814 .name = "softrandommap",
1815 .lname = "Soft randommap",
1816 .type = FIO_OPT_BOOL,
1817 .off1 = td_var_offset(softrandommap),
1818 .help = "Set norandommap if randommap allocation fails",
1819 .parent = "norandommap",
1822 .category = FIO_OPT_C_IO,
1823 .group = FIO_OPT_G_RANDOM,
1826 .name = "random_generator",
1827 .type = FIO_OPT_STR,
1828 .off1 = td_var_offset(random_generator),
1829 .help = "Type of random number generator to use",
1830 .def = "tausworthe",
1832 { .ival = "tausworthe",
1833 .oval = FIO_RAND_GEN_TAUSWORTHE,
1834 .help = "Strong Tausworthe generator",
1837 .oval = FIO_RAND_GEN_LFSR,
1838 .help = "Variable length LFSR",
1841 .ival = "tausworthe64",
1842 .oval = FIO_RAND_GEN_TAUSWORTHE64,
1843 .help = "64-bit Tausworthe variant",
1846 .category = FIO_OPT_C_IO,
1847 .group = FIO_OPT_G_RANDOM,
1850 .name = "random_distribution",
1851 .type = FIO_OPT_STR,
1852 .off1 = td_var_offset(random_distribution),
1853 .cb = str_random_distribution_cb,
1854 .help = "Random offset distribution generator",
1858 .oval = FIO_RAND_DIST_RANDOM,
1859 .help = "Completely random",
1862 .oval = FIO_RAND_DIST_ZIPF,
1863 .help = "Zipf distribution",
1866 .oval = FIO_RAND_DIST_PARETO,
1867 .help = "Pareto distribution",
1870 .oval = FIO_RAND_DIST_GAUSS,
1871 .help = "Normal (gaussian) distribution",
1874 .category = FIO_OPT_C_IO,
1875 .group = FIO_OPT_G_RANDOM,
1878 .name = "percentage_random",
1879 .lname = "Percentage Random",
1880 .type = FIO_OPT_INT,
1881 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1882 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1883 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1885 .help = "Percentage of seq/random mix that should be random",
1886 .def = "100,100,100",
1888 .inverse = "percentage_sequential",
1889 .category = FIO_OPT_C_IO,
1890 .group = FIO_OPT_G_RANDOM,
1893 .name = "percentage_sequential",
1894 .lname = "Percentage Sequential",
1895 .type = FIO_OPT_DEPRECATED,
1896 .category = FIO_OPT_C_IO,
1897 .group = FIO_OPT_G_RANDOM,
1900 .name = "allrandrepeat",
1901 .type = FIO_OPT_BOOL,
1902 .off1 = td_var_offset(allrand_repeatable),
1903 .help = "Use repeatable random numbers for everything",
1905 .category = FIO_OPT_C_IO,
1906 .group = FIO_OPT_G_RANDOM,
1910 .lname = "Number of files",
1911 .alias = "nr_files",
1912 .type = FIO_OPT_INT,
1913 .off1 = td_var_offset(nr_files),
1914 .help = "Split job workload between this number of files",
1917 .category = FIO_OPT_C_FILE,
1918 .group = FIO_OPT_G_INVALID,
1921 .name = "openfiles",
1922 .lname = "Number of open files",
1923 .type = FIO_OPT_INT,
1924 .off1 = td_var_offset(open_files),
1925 .help = "Number of files to keep open at the same time",
1926 .category = FIO_OPT_C_FILE,
1927 .group = FIO_OPT_G_INVALID,
1930 .name = "file_service_type",
1931 .lname = "File service type",
1932 .type = FIO_OPT_STR,
1934 .off1 = td_var_offset(file_service_type),
1935 .help = "How to select which file to service next",
1936 .def = "roundrobin",
1937 .category = FIO_OPT_C_FILE,
1938 .group = FIO_OPT_G_INVALID,
1941 .oval = FIO_FSERVICE_RANDOM,
1942 .help = "Choose a file at random",
1944 { .ival = "roundrobin",
1945 .oval = FIO_FSERVICE_RR,
1946 .help = "Round robin select files",
1948 { .ival = "sequential",
1949 .oval = FIO_FSERVICE_SEQ,
1950 .help = "Finish one file before moving to the next",
1953 .parent = "nrfiles",
1956 #ifdef CONFIG_POSIX_FALLOCATE
1958 .name = "fallocate",
1959 .lname = "Fallocate",
1960 .type = FIO_OPT_STR,
1961 .off1 = td_var_offset(fallocate_mode),
1962 .help = "Whether pre-allocation is performed when laying out files",
1964 .category = FIO_OPT_C_FILE,
1965 .group = FIO_OPT_G_INVALID,
1968 .oval = FIO_FALLOCATE_NONE,
1969 .help = "Do not pre-allocate space",
1972 .oval = FIO_FALLOCATE_POSIX,
1973 .help = "Use posix_fallocate()",
1975 #ifdef CONFIG_LINUX_FALLOCATE
1977 .oval = FIO_FALLOCATE_KEEP_SIZE,
1978 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1981 /* Compatibility with former boolean values */
1983 .oval = FIO_FALLOCATE_NONE,
1984 .help = "Alias for 'none'",
1987 .oval = FIO_FALLOCATE_POSIX,
1988 .help = "Alias for 'posix'",
1992 #endif /* CONFIG_POSIX_FALLOCATE */
1994 .name = "fadvise_hint",
1995 .lname = "Fadvise hint",
1996 .type = FIO_OPT_BOOL,
1997 .off1 = td_var_offset(fadvise_hint),
1998 .help = "Use fadvise() to advise the kernel on IO pattern",
2000 .category = FIO_OPT_C_FILE,
2001 .group = FIO_OPT_G_INVALID,
2003 #ifdef FIO_HAVE_STREAMID
2005 .name = "fadvise_stream",
2006 .lname = "Fadvise stream",
2007 .type = FIO_OPT_INT,
2008 .off1 = td_var_offset(fadvise_stream),
2009 .help = "Use fadvise() to set stream ID",
2010 .category = FIO_OPT_C_FILE,
2011 .group = FIO_OPT_G_INVALID,
2017 .type = FIO_OPT_INT,
2018 .off1 = td_var_offset(fsync_blocks),
2019 .help = "Issue fsync for writes every given number of blocks",
2022 .category = FIO_OPT_C_FILE,
2023 .group = FIO_OPT_G_INVALID,
2026 .name = "fdatasync",
2027 .lname = "Fdatasync",
2028 .type = FIO_OPT_INT,
2029 .off1 = td_var_offset(fdatasync_blocks),
2030 .help = "Issue fdatasync for writes every given number of blocks",
2033 .category = FIO_OPT_C_FILE,
2034 .group = FIO_OPT_G_INVALID,
2037 .name = "write_barrier",
2038 .lname = "Write barrier",
2039 .type = FIO_OPT_INT,
2040 .off1 = td_var_offset(barrier_blocks),
2041 .help = "Make every Nth write a barrier write",
2044 .category = FIO_OPT_C_IO,
2045 .group = FIO_OPT_G_INVALID,
2047 #ifdef CONFIG_SYNC_FILE_RANGE
2049 .name = "sync_file_range",
2050 .lname = "Sync file range",
2052 { .ival = "wait_before",
2053 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2054 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2058 .oval = SYNC_FILE_RANGE_WRITE,
2059 .help = "SYNC_FILE_RANGE_WRITE",
2063 .ival = "wait_after",
2064 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2065 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2069 .type = FIO_OPT_STR_MULTI,
2071 .off1 = td_var_offset(sync_file_range),
2072 .help = "Use sync_file_range()",
2073 .category = FIO_OPT_C_FILE,
2074 .group = FIO_OPT_G_INVALID,
2079 .lname = "Direct I/O",
2080 .type = FIO_OPT_BOOL,
2081 .off1 = td_var_offset(odirect),
2082 .help = "Use O_DIRECT IO (negates buffered)",
2084 .inverse = "buffered",
2085 .category = FIO_OPT_C_IO,
2086 .group = FIO_OPT_G_IO_TYPE,
2090 .lname = "Atomic I/O",
2091 .type = FIO_OPT_BOOL,
2092 .off1 = td_var_offset(oatomic),
2093 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2095 .category = FIO_OPT_C_IO,
2096 .group = FIO_OPT_G_IO_TYPE,
2100 .lname = "Buffered I/O",
2101 .type = FIO_OPT_BOOL,
2102 .off1 = td_var_offset(odirect),
2104 .help = "Use buffered IO (negates direct)",
2106 .inverse = "direct",
2107 .category = FIO_OPT_C_IO,
2108 .group = FIO_OPT_G_IO_TYPE,
2111 .name = "overwrite",
2112 .lname = "Overwrite",
2113 .type = FIO_OPT_BOOL,
2114 .off1 = td_var_offset(overwrite),
2115 .help = "When writing, set whether to overwrite current data",
2117 .category = FIO_OPT_C_FILE,
2118 .group = FIO_OPT_G_INVALID,
2123 .type = FIO_OPT_INT,
2124 .off1 = td_var_offset(loops),
2125 .help = "Number of times to run the job",
2128 .category = FIO_OPT_C_GENERAL,
2129 .group = FIO_OPT_G_RUNTIME,
2133 .lname = "Number of jobs",
2134 .type = FIO_OPT_INT,
2135 .off1 = td_var_offset(numjobs),
2136 .help = "Duplicate this job this many times",
2139 .category = FIO_OPT_C_GENERAL,
2140 .group = FIO_OPT_G_RUNTIME,
2143 .name = "startdelay",
2144 .lname = "Start delay",
2145 .type = FIO_OPT_STR_VAL_TIME,
2146 .off1 = td_var_offset(start_delay),
2147 .off2 = td_var_offset(start_delay_high),
2148 .help = "Only start job when this period has passed",
2152 .category = FIO_OPT_C_GENERAL,
2153 .group = FIO_OPT_G_RUNTIME,
2159 .type = FIO_OPT_STR_VAL_TIME,
2160 .off1 = td_var_offset(timeout),
2161 .help = "Stop workload when this amount of time has passed",
2165 .category = FIO_OPT_C_GENERAL,
2166 .group = FIO_OPT_G_RUNTIME,
2169 .name = "time_based",
2170 .lname = "Time based",
2171 .type = FIO_OPT_STR_SET,
2172 .off1 = td_var_offset(time_based),
2173 .help = "Keep running until runtime/timeout is met",
2174 .category = FIO_OPT_C_GENERAL,
2175 .group = FIO_OPT_G_RUNTIME,
2178 .name = "verify_only",
2179 .lname = "Verify only",
2180 .type = FIO_OPT_STR_SET,
2181 .off1 = td_var_offset(verify_only),
2182 .help = "Verifies previously written data is still valid",
2183 .category = FIO_OPT_C_GENERAL,
2184 .group = FIO_OPT_G_RUNTIME,
2187 .name = "ramp_time",
2188 .lname = "Ramp time",
2189 .type = FIO_OPT_STR_VAL_TIME,
2190 .off1 = td_var_offset(ramp_time),
2191 .help = "Ramp up time before measuring performance",
2194 .category = FIO_OPT_C_GENERAL,
2195 .group = FIO_OPT_G_RUNTIME,
2198 .name = "clocksource",
2199 .lname = "Clock source",
2200 .type = FIO_OPT_STR,
2201 .cb = fio_clock_source_cb,
2202 .off1 = td_var_offset(clocksource),
2203 .help = "What type of timing source to use",
2204 .category = FIO_OPT_C_GENERAL,
2205 .group = FIO_OPT_G_CLOCK,
2207 #ifdef CONFIG_GETTIMEOFDAY
2208 { .ival = "gettimeofday",
2210 .help = "Use gettimeofday(2) for timing",
2213 #ifdef CONFIG_CLOCK_GETTIME
2214 { .ival = "clock_gettime",
2215 .oval = CS_CGETTIME,
2216 .help = "Use clock_gettime(2) for timing",
2219 #ifdef ARCH_HAVE_CPU_CLOCK
2221 .oval = CS_CPUCLOCK,
2222 .help = "Use CPU private clock",
2230 .lname = "I/O Memory",
2231 .type = FIO_OPT_STR,
2233 .off1 = td_var_offset(mem_type),
2234 .help = "Backing type for IO buffers",
2236 .category = FIO_OPT_C_IO,
2237 .group = FIO_OPT_G_INVALID,
2241 .help = "Use malloc(3) for IO buffers",
2243 #ifndef CONFIG_NO_SHM
2246 .help = "Use shared memory segments for IO buffers",
2248 #ifdef FIO_HAVE_HUGETLB
2249 { .ival = "shmhuge",
2250 .oval = MEM_SHMHUGE,
2251 .help = "Like shm, but use huge pages",
2257 .help = "Use mmap(2) (file or anon) for IO buffers",
2259 { .ival = "mmapshared",
2260 .oval = MEM_MMAPSHARED,
2261 .help = "Like mmap, but use the shared flag",
2263 #ifdef FIO_HAVE_HUGETLB
2264 { .ival = "mmaphuge",
2265 .oval = MEM_MMAPHUGE,
2266 .help = "Like mmap, but use huge pages",
2272 .name = "iomem_align",
2273 .alias = "mem_align",
2274 .lname = "I/O memory alignment",
2275 .type = FIO_OPT_INT,
2276 .off1 = td_var_offset(mem_align),
2278 .help = "IO memory buffer offset alignment",
2282 .category = FIO_OPT_C_IO,
2283 .group = FIO_OPT_G_INVALID,
2288 .type = FIO_OPT_STR,
2289 .off1 = td_var_offset(verify),
2290 .help = "Verify data written",
2292 .category = FIO_OPT_C_IO,
2293 .group = FIO_OPT_G_VERIFY,
2296 .oval = VERIFY_NONE,
2297 .help = "Don't do IO verification",
2301 .help = "Use md5 checksums for verification",
2304 .oval = VERIFY_CRC64,
2305 .help = "Use crc64 checksums for verification",
2308 .oval = VERIFY_CRC32,
2309 .help = "Use crc32 checksums for verification",
2311 { .ival = "crc32c-intel",
2312 .oval = VERIFY_CRC32C,
2313 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2316 .oval = VERIFY_CRC32C,
2317 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2320 .oval = VERIFY_CRC16,
2321 .help = "Use crc16 checksums for verification",
2324 .oval = VERIFY_CRC7,
2325 .help = "Use crc7 checksums for verification",
2328 .oval = VERIFY_SHA1,
2329 .help = "Use sha1 checksums for verification",
2332 .oval = VERIFY_SHA256,
2333 .help = "Use sha256 checksums for verification",
2336 .oval = VERIFY_SHA512,
2337 .help = "Use sha512 checksums for verification",
2340 .oval = VERIFY_XXHASH,
2341 .help = "Use xxhash checksums for verification",
2343 /* Meta information was included into verify_header,
2344 * 'meta' verification is implied by default. */
2346 .oval = VERIFY_HDR_ONLY,
2347 .help = "Use io information for verification. "
2348 "Now is implied by default, thus option is obsolete, "
2351 { .ival = "pattern",
2352 .oval = VERIFY_PATTERN_NO_HDR,
2353 .help = "Verify strict pattern",
2357 .oval = VERIFY_NULL,
2358 .help = "Pretend to verify",
2363 .name = "do_verify",
2364 .lname = "Perform verify step",
2365 .type = FIO_OPT_BOOL,
2366 .off1 = td_var_offset(do_verify),
2367 .help = "Run verification stage after write",
2371 .category = FIO_OPT_C_IO,
2372 .group = FIO_OPT_G_VERIFY,
2375 .name = "verifysort",
2376 .lname = "Verify sort",
2377 .type = FIO_OPT_BOOL,
2378 .off1 = td_var_offset(verifysort),
2379 .help = "Sort written verify blocks for read back",
2383 .category = FIO_OPT_C_IO,
2384 .group = FIO_OPT_G_VERIFY,
2387 .name = "verifysort_nr",
2388 .type = FIO_OPT_INT,
2389 .off1 = td_var_offset(verifysort_nr),
2390 .help = "Pre-load and sort verify blocks for a read workload",
2395 .category = FIO_OPT_C_IO,
2396 .group = FIO_OPT_G_VERIFY,
2399 .name = "verify_interval",
2400 .lname = "Verify interval",
2401 .type = FIO_OPT_INT,
2402 .off1 = td_var_offset(verify_interval),
2403 .minval = 2 * sizeof(struct verify_header),
2404 .help = "Store verify buffer header every N bytes",
2407 .interval = 2 * sizeof(struct verify_header),
2408 .category = FIO_OPT_C_IO,
2409 .group = FIO_OPT_G_VERIFY,
2412 .name = "verify_offset",
2413 .lname = "Verify offset",
2414 .type = FIO_OPT_INT,
2415 .help = "Offset verify header location by N bytes",
2416 .off1 = td_var_offset(verify_offset),
2417 .minval = sizeof(struct verify_header),
2420 .category = FIO_OPT_C_IO,
2421 .group = FIO_OPT_G_VERIFY,
2424 .name = "verify_pattern",
2425 .lname = "Verify pattern",
2426 .type = FIO_OPT_STR,
2427 .cb = str_verify_pattern_cb,
2428 .off1 = td_var_offset(verify_pattern),
2429 .help = "Fill pattern for IO buffers",
2432 .category = FIO_OPT_C_IO,
2433 .group = FIO_OPT_G_VERIFY,
2436 .name = "verify_fatal",
2437 .lname = "Verify fatal",
2438 .type = FIO_OPT_BOOL,
2439 .off1 = td_var_offset(verify_fatal),
2441 .help = "Exit on a single verify failure, don't continue",
2444 .category = FIO_OPT_C_IO,
2445 .group = FIO_OPT_G_VERIFY,
2448 .name = "verify_dump",
2449 .lname = "Verify dump",
2450 .type = FIO_OPT_BOOL,
2451 .off1 = td_var_offset(verify_dump),
2453 .help = "Dump contents of good and bad blocks on failure",
2456 .category = FIO_OPT_C_IO,
2457 .group = FIO_OPT_G_VERIFY,
2460 .name = "verify_async",
2461 .lname = "Verify asynchronously",
2462 .type = FIO_OPT_INT,
2463 .off1 = td_var_offset(verify_async),
2465 .help = "Number of async verifier threads to use",
2468 .category = FIO_OPT_C_IO,
2469 .group = FIO_OPT_G_VERIFY,
2472 .name = "verify_backlog",
2473 .lname = "Verify backlog",
2474 .type = FIO_OPT_STR_VAL,
2475 .off1 = td_var_offset(verify_backlog),
2476 .help = "Verify after this number of blocks are written",
2479 .category = FIO_OPT_C_IO,
2480 .group = FIO_OPT_G_VERIFY,
2483 .name = "verify_backlog_batch",
2484 .lname = "Verify backlog batch",
2485 .type = FIO_OPT_INT,
2486 .off1 = td_var_offset(verify_batch),
2487 .help = "Verify this number of IO blocks",
2490 .category = FIO_OPT_C_IO,
2491 .group = FIO_OPT_G_VERIFY,
2493 #ifdef FIO_HAVE_CPU_AFFINITY
2495 .name = "verify_async_cpus",
2496 .lname = "Async verify CPUs",
2497 .type = FIO_OPT_STR,
2498 .cb = str_verify_cpus_allowed_cb,
2499 .off1 = td_var_offset(verify_cpumask),
2500 .help = "Set CPUs allowed for async verify threads",
2501 .parent = "verify_async",
2503 .category = FIO_OPT_C_IO,
2504 .group = FIO_OPT_G_VERIFY,
2508 .name = "experimental_verify",
2509 .off1 = td_var_offset(experimental_verify),
2510 .type = FIO_OPT_BOOL,
2511 .help = "Enable experimental verification",
2513 .category = FIO_OPT_C_IO,
2514 .group = FIO_OPT_G_VERIFY,
2517 .name = "verify_state_load",
2518 .lname = "Load verify state",
2519 .off1 = td_var_offset(verify_state),
2520 .type = FIO_OPT_BOOL,
2521 .help = "Load verify termination state",
2523 .category = FIO_OPT_C_IO,
2524 .group = FIO_OPT_G_VERIFY,
2527 .name = "verify_state_save",
2528 .lname = "Save verify state",
2529 .off1 = td_var_offset(verify_state_save),
2530 .type = FIO_OPT_BOOL,
2532 .help = "Save verify state on termination",
2534 .category = FIO_OPT_C_IO,
2535 .group = FIO_OPT_G_VERIFY,
2537 #ifdef FIO_HAVE_TRIM
2539 .name = "trim_percentage",
2540 .lname = "Trim percentage",
2541 .type = FIO_OPT_INT,
2542 .off1 = td_var_offset(trim_percentage),
2545 .help = "Number of verify blocks to discard/trim",
2550 .category = FIO_OPT_C_IO,
2551 .group = FIO_OPT_G_TRIM,
2554 .name = "trim_verify_zero",
2555 .lname = "Verify trim zero",
2556 .type = FIO_OPT_BOOL,
2557 .help = "Verify that trim/discarded blocks are returned as zeroes",
2558 .off1 = td_var_offset(trim_zero),
2559 .parent = "trim_percentage",
2562 .category = FIO_OPT_C_IO,
2563 .group = FIO_OPT_G_TRIM,
2566 .name = "trim_backlog",
2567 .lname = "Trim backlog",
2568 .type = FIO_OPT_STR_VAL,
2569 .off1 = td_var_offset(trim_backlog),
2570 .help = "Trim after this number of blocks are written",
2571 .parent = "trim_percentage",
2574 .category = FIO_OPT_C_IO,
2575 .group = FIO_OPT_G_TRIM,
2578 .name = "trim_backlog_batch",
2579 .lname = "Trim backlog batch",
2580 .type = FIO_OPT_INT,
2581 .off1 = td_var_offset(trim_batch),
2582 .help = "Trim this number of IO blocks",
2583 .parent = "trim_percentage",
2586 .category = FIO_OPT_C_IO,
2587 .group = FIO_OPT_G_TRIM,
2591 .name = "write_iolog",
2592 .lname = "Write I/O log",
2593 .type = FIO_OPT_STR_STORE,
2594 .off1 = td_var_offset(write_iolog_file),
2595 .help = "Store IO pattern to file",
2596 .category = FIO_OPT_C_IO,
2597 .group = FIO_OPT_G_IOLOG,
2600 .name = "read_iolog",
2601 .lname = "Read I/O log",
2602 .type = FIO_OPT_STR_STORE,
2603 .off1 = td_var_offset(read_iolog_file),
2604 .help = "Playback IO pattern from file",
2605 .category = FIO_OPT_C_IO,
2606 .group = FIO_OPT_G_IOLOG,
2609 .name = "replay_no_stall",
2610 .lname = "Don't stall on replay",
2611 .type = FIO_OPT_BOOL,
2612 .off1 = td_var_offset(no_stall),
2614 .parent = "read_iolog",
2616 .help = "Playback IO pattern file as fast as possible without stalls",
2617 .category = FIO_OPT_C_IO,
2618 .group = FIO_OPT_G_IOLOG,
2621 .name = "replay_redirect",
2622 .lname = "Redirect device for replay",
2623 .type = FIO_OPT_STR_STORE,
2624 .off1 = td_var_offset(replay_redirect),
2625 .parent = "read_iolog",
2627 .help = "Replay all I/O onto this device, regardless of trace device",
2628 .category = FIO_OPT_C_IO,
2629 .group = FIO_OPT_G_IOLOG,
2632 .name = "replay_scale",
2633 .lname = "Replace offset scale factor",
2634 .type = FIO_OPT_INT,
2635 .off1 = td_var_offset(replay_scale),
2636 .parent = "read_iolog",
2638 .help = "Align offsets to this blocksize",
2639 .category = FIO_OPT_C_IO,
2640 .group = FIO_OPT_G_IOLOG,
2643 .name = "replay_align",
2644 .lname = "Replace alignment",
2645 .type = FIO_OPT_INT,
2646 .off1 = td_var_offset(replay_align),
2647 .parent = "read_iolog",
2648 .help = "Scale offset down by this factor",
2649 .category = FIO_OPT_C_IO,
2650 .group = FIO_OPT_G_IOLOG,
2654 .name = "exec_prerun",
2655 .lname = "Pre-execute runnable",
2656 .type = FIO_OPT_STR_STORE,
2657 .off1 = td_var_offset(exec_prerun),
2658 .help = "Execute this file prior to running job",
2659 .category = FIO_OPT_C_GENERAL,
2660 .group = FIO_OPT_G_INVALID,
2663 .name = "exec_postrun",
2664 .lname = "Post-execute runnable",
2665 .type = FIO_OPT_STR_STORE,
2666 .off1 = td_var_offset(exec_postrun),
2667 .help = "Execute this file after running job",
2668 .category = FIO_OPT_C_GENERAL,
2669 .group = FIO_OPT_G_INVALID,
2671 #ifdef FIO_HAVE_IOSCHED_SWITCH
2673 .name = "ioscheduler",
2674 .lname = "I/O scheduler",
2675 .type = FIO_OPT_STR_STORE,
2676 .off1 = td_var_offset(ioscheduler),
2677 .help = "Use this IO scheduler on the backing device",
2678 .category = FIO_OPT_C_FILE,
2679 .group = FIO_OPT_G_INVALID,
2684 .lname = "Zone size",
2685 .type = FIO_OPT_STR_VAL,
2686 .off1 = td_var_offset(zone_size),
2687 .help = "Amount of data to read per zone",
2689 .interval = 1024 * 1024,
2690 .category = FIO_OPT_C_IO,
2691 .group = FIO_OPT_G_ZONE,
2694 .name = "zonerange",
2695 .lname = "Zone range",
2696 .type = FIO_OPT_STR_VAL,
2697 .off1 = td_var_offset(zone_range),
2698 .help = "Give size of an IO zone",
2700 .interval = 1024 * 1024,
2701 .category = FIO_OPT_C_IO,
2702 .group = FIO_OPT_G_ZONE,
2706 .lname = "Zone skip",
2707 .type = FIO_OPT_STR_VAL,
2708 .off1 = td_var_offset(zone_skip),
2709 .help = "Space between IO zones",
2711 .interval = 1024 * 1024,
2712 .category = FIO_OPT_C_IO,
2713 .group = FIO_OPT_G_ZONE,
2717 .lname = "Lock memory",
2718 .type = FIO_OPT_STR_VAL,
2719 .off1 = td_var_offset(lockmem),
2720 .help = "Lock down this amount of memory (per worker)",
2722 .interval = 1024 * 1024,
2723 .category = FIO_OPT_C_GENERAL,
2724 .group = FIO_OPT_G_INVALID,
2727 .name = "rwmixread",
2728 .lname = "Read/write mix read",
2729 .type = FIO_OPT_INT,
2730 .cb = str_rwmix_read_cb,
2731 .off1 = td_var_offset(rwmix[DDIR_READ]),
2733 .help = "Percentage of mixed workload that is reads",
2736 .inverse = "rwmixwrite",
2737 .category = FIO_OPT_C_IO,
2738 .group = FIO_OPT_G_RWMIX,
2741 .name = "rwmixwrite",
2742 .lname = "Read/write mix write",
2743 .type = FIO_OPT_INT,
2744 .cb = str_rwmix_write_cb,
2745 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
2747 .help = "Percentage of mixed workload that is writes",
2750 .inverse = "rwmixread",
2751 .category = FIO_OPT_C_IO,
2752 .group = FIO_OPT_G_RWMIX,
2755 .name = "rwmixcycle",
2756 .lname = "Read/write mix cycle",
2757 .type = FIO_OPT_DEPRECATED,
2758 .category = FIO_OPT_C_IO,
2759 .group = FIO_OPT_G_RWMIX,
2764 .type = FIO_OPT_INT,
2765 .off1 = td_var_offset(nice),
2766 .help = "Set job CPU nice value",
2771 .category = FIO_OPT_C_GENERAL,
2772 .group = FIO_OPT_G_CRED,
2774 #ifdef FIO_HAVE_IOPRIO
2777 .lname = "I/O nice priority",
2778 .type = FIO_OPT_INT,
2779 .off1 = td_var_offset(ioprio),
2780 .help = "Set job IO priority value",
2784 .category = FIO_OPT_C_GENERAL,
2785 .group = FIO_OPT_G_CRED,
2788 .name = "prioclass",
2789 .lname = "I/O nice priority class",
2790 .type = FIO_OPT_INT,
2791 .off1 = td_var_offset(ioprio_class),
2792 .help = "Set job IO priority class",
2796 .category = FIO_OPT_C_GENERAL,
2797 .group = FIO_OPT_G_CRED,
2801 .name = "thinktime",
2802 .lname = "Thinktime",
2803 .type = FIO_OPT_INT,
2804 .off1 = td_var_offset(thinktime),
2805 .help = "Idle time between IO buffers (usec)",
2808 .category = FIO_OPT_C_IO,
2809 .group = FIO_OPT_G_THINKTIME,
2812 .name = "thinktime_spin",
2813 .lname = "Thinktime spin",
2814 .type = FIO_OPT_INT,
2815 .off1 = td_var_offset(thinktime_spin),
2816 .help = "Start think time by spinning this amount (usec)",
2819 .parent = "thinktime",
2821 .category = FIO_OPT_C_IO,
2822 .group = FIO_OPT_G_THINKTIME,
2825 .name = "thinktime_blocks",
2826 .lname = "Thinktime blocks",
2827 .type = FIO_OPT_INT,
2828 .off1 = td_var_offset(thinktime_blocks),
2829 .help = "IO buffer period between 'thinktime'",
2831 .parent = "thinktime",
2833 .category = FIO_OPT_C_IO,
2834 .group = FIO_OPT_G_THINKTIME,
2838 .lname = "I/O rate",
2839 .type = FIO_OPT_INT,
2840 .off1 = td_var_offset(rate[DDIR_READ]),
2841 .off2 = td_var_offset(rate[DDIR_WRITE]),
2842 .off3 = td_var_offset(rate[DDIR_TRIM]),
2843 .help = "Set bandwidth rate",
2844 .category = FIO_OPT_C_IO,
2845 .group = FIO_OPT_G_RATE,
2850 .lname = "I/O min rate",
2851 .type = FIO_OPT_INT,
2852 .off1 = td_var_offset(ratemin[DDIR_READ]),
2853 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2854 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2855 .help = "Job must meet this rate or it will be shutdown",
2858 .category = FIO_OPT_C_IO,
2859 .group = FIO_OPT_G_RATE,
2862 .name = "rate_iops",
2863 .lname = "I/O rate IOPS",
2864 .type = FIO_OPT_INT,
2865 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2866 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2867 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2868 .help = "Limit IO used to this number of IO operations/sec",
2870 .category = FIO_OPT_C_IO,
2871 .group = FIO_OPT_G_RATE,
2874 .name = "rate_iops_min",
2875 .lname = "I/O min rate IOPS",
2876 .type = FIO_OPT_INT,
2877 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2878 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2879 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2880 .help = "Job must meet this rate or it will be shut down",
2881 .parent = "rate_iops",
2883 .category = FIO_OPT_C_IO,
2884 .group = FIO_OPT_G_RATE,
2887 .name = "rate_process",
2888 .lname = "Rate Process",
2889 .type = FIO_OPT_STR,
2890 .off1 = td_var_offset(rate_process),
2891 .help = "What process controls how rated IO is managed",
2893 .category = FIO_OPT_C_IO,
2894 .group = FIO_OPT_G_RATE,
2897 .oval = RATE_PROCESS_LINEAR,
2898 .help = "Linear rate of IO",
2902 .oval = RATE_PROCESS_POISSON,
2903 .help = "Rate follows Poisson process",
2909 .name = "rate_cycle",
2910 .alias = "ratecycle",
2911 .lname = "I/O rate cycle",
2912 .type = FIO_OPT_INT,
2913 .off1 = td_var_offset(ratecycle),
2914 .help = "Window average for rate limits (msec)",
2918 .category = FIO_OPT_C_IO,
2919 .group = FIO_OPT_G_RATE,
2922 .name = "max_latency",
2923 .type = FIO_OPT_INT,
2924 .off1 = td_var_offset(max_latency),
2925 .help = "Maximum tolerated IO latency (usec)",
2927 .category = FIO_OPT_C_IO,
2928 .group = FIO_OPT_G_LATPROF,
2931 .name = "latency_target",
2932 .lname = "Latency Target (usec)",
2933 .type = FIO_OPT_STR_VAL_TIME,
2934 .off1 = td_var_offset(latency_target),
2935 .help = "Ramp to max queue depth supporting this latency",
2937 .category = FIO_OPT_C_IO,
2938 .group = FIO_OPT_G_LATPROF,
2941 .name = "latency_window",
2942 .lname = "Latency Window (usec)",
2943 .type = FIO_OPT_STR_VAL_TIME,
2944 .off1 = td_var_offset(latency_window),
2945 .help = "Time to sustain latency_target",
2947 .category = FIO_OPT_C_IO,
2948 .group = FIO_OPT_G_LATPROF,
2951 .name = "latency_percentile",
2952 .lname = "Latency Percentile",
2953 .type = FIO_OPT_FLOAT_LIST,
2954 .off1 = td_var_offset(latency_percentile),
2955 .help = "Percentile of IOs must be below latency_target",
2960 .category = FIO_OPT_C_IO,
2961 .group = FIO_OPT_G_LATPROF,
2964 .name = "invalidate",
2965 .lname = "Cache invalidate",
2966 .type = FIO_OPT_BOOL,
2967 .off1 = td_var_offset(invalidate_cache),
2968 .help = "Invalidate buffer/page cache prior to running job",
2970 .category = FIO_OPT_C_IO,
2971 .group = FIO_OPT_G_IO_TYPE,
2975 .lname = "Synchronous I/O",
2976 .type = FIO_OPT_BOOL,
2977 .off1 = td_var_offset(sync_io),
2978 .help = "Use O_SYNC for buffered writes",
2980 .parent = "buffered",
2982 .category = FIO_OPT_C_IO,
2983 .group = FIO_OPT_G_IO_TYPE,
2986 .name = "create_serialize",
2987 .lname = "Create serialize",
2988 .type = FIO_OPT_BOOL,
2989 .off1 = td_var_offset(create_serialize),
2990 .help = "Serialize creating of job files",
2992 .category = FIO_OPT_C_FILE,
2993 .group = FIO_OPT_G_INVALID,
2996 .name = "create_fsync",
2997 .lname = "Create fsync",
2998 .type = FIO_OPT_BOOL,
2999 .off1 = td_var_offset(create_fsync),
3000 .help = "fsync file after creation",
3002 .category = FIO_OPT_C_FILE,
3003 .group = FIO_OPT_G_INVALID,
3006 .name = "create_on_open",
3007 .lname = "Create on open",
3008 .type = FIO_OPT_BOOL,
3009 .off1 = td_var_offset(create_on_open),
3010 .help = "Create files when they are opened for IO",
3012 .category = FIO_OPT_C_FILE,
3013 .group = FIO_OPT_G_INVALID,
3016 .name = "create_only",
3017 .type = FIO_OPT_BOOL,
3018 .off1 = td_var_offset(create_only),
3019 .help = "Only perform file creation phase",
3020 .category = FIO_OPT_C_FILE,
3024 .name = "allow_file_create",
3025 .lname = "Allow file create",
3026 .type = FIO_OPT_BOOL,
3027 .off1 = td_var_offset(allow_create),
3028 .help = "Permit fio to create files, if they don't exist",
3030 .category = FIO_OPT_C_FILE,
3031 .group = FIO_OPT_G_FILENAME,
3034 .name = "allow_mounted_write",
3035 .lname = "Allow mounted write",
3036 .type = FIO_OPT_BOOL,
3037 .off1 = td_var_offset(allow_mounted_write),
3038 .help = "Allow writes to a mounted partition",
3040 .category = FIO_OPT_C_FILE,
3041 .group = FIO_OPT_G_FILENAME,
3045 .lname = "Pre-read files",
3046 .type = FIO_OPT_BOOL,
3047 .off1 = td_var_offset(pre_read),
3048 .help = "Pre-read files before starting official testing",
3050 .category = FIO_OPT_C_FILE,
3051 .group = FIO_OPT_G_INVALID,
3053 #ifdef FIO_HAVE_CPU_AFFINITY
3056 .lname = "CPU mask",
3057 .type = FIO_OPT_INT,
3058 .cb = str_cpumask_cb,
3059 .off1 = td_var_offset(cpumask),
3060 .help = "CPU affinity mask",
3061 .category = FIO_OPT_C_GENERAL,
3062 .group = FIO_OPT_G_CRED,
3065 .name = "cpus_allowed",
3066 .lname = "CPUs allowed",
3067 .type = FIO_OPT_STR,
3068 .cb = str_cpus_allowed_cb,
3069 .off1 = td_var_offset(cpumask),
3070 .help = "Set CPUs allowed",
3071 .category = FIO_OPT_C_GENERAL,
3072 .group = FIO_OPT_G_CRED,
3075 .name = "cpus_allowed_policy",
3076 .lname = "CPUs allowed distribution policy",
3077 .type = FIO_OPT_STR,
3078 .off1 = td_var_offset(cpus_allowed_policy),
3079 .help = "Distribution policy for cpus_allowed",
3080 .parent = "cpus_allowed",
3084 .oval = FIO_CPUS_SHARED,
3085 .help = "Mask shared between threads",
3088 .oval = FIO_CPUS_SPLIT,
3089 .help = "Mask split between threads",
3092 .category = FIO_OPT_C_GENERAL,
3093 .group = FIO_OPT_G_CRED,
3096 #ifdef CONFIG_LIBNUMA
3098 .name = "numa_cpu_nodes",
3099 .type = FIO_OPT_STR,
3100 .cb = str_numa_cpunodes_cb,
3101 .off1 = td_var_offset(numa_cpunodes),
3102 .help = "NUMA CPU nodes bind",
3103 .category = FIO_OPT_C_GENERAL,
3104 .group = FIO_OPT_G_INVALID,
3107 .name = "numa_mem_policy",
3108 .type = FIO_OPT_STR,
3109 .cb = str_numa_mpol_cb,
3110 .off1 = td_var_offset(numa_memnodes),
3111 .help = "NUMA memory policy setup",
3112 .category = FIO_OPT_C_GENERAL,
3113 .group = FIO_OPT_G_INVALID,
3117 .name = "end_fsync",
3118 .lname = "End fsync",
3119 .type = FIO_OPT_BOOL,
3120 .off1 = td_var_offset(end_fsync),
3121 .help = "Include fsync at the end of job",
3123 .category = FIO_OPT_C_FILE,
3124 .group = FIO_OPT_G_INVALID,
3127 .name = "fsync_on_close",
3128 .lname = "Fsync on close",
3129 .type = FIO_OPT_BOOL,
3130 .off1 = td_var_offset(fsync_on_close),
3131 .help = "fsync files on close",
3133 .category = FIO_OPT_C_FILE,
3134 .group = FIO_OPT_G_INVALID,
3138 .lname = "Unlink file",
3139 .type = FIO_OPT_BOOL,
3140 .off1 = td_var_offset(unlink),
3141 .help = "Unlink created files after job has completed",
3143 .category = FIO_OPT_C_FILE,
3144 .group = FIO_OPT_G_INVALID,
3148 .lname = "Exit-all on terminate",
3149 .type = FIO_OPT_STR_SET,
3150 .cb = str_exitall_cb,
3151 .help = "Terminate all jobs when one exits",
3152 .category = FIO_OPT_C_GENERAL,
3153 .group = FIO_OPT_G_PROCESS,
3156 .name = "exitall_on_error",
3157 .lname = "Exit-all on terminate in error",
3158 .type = FIO_OPT_BOOL,
3159 .off1 = td_var_offset(unlink),
3160 .help = "Terminate all jobs when one exits in error",
3161 .category = FIO_OPT_C_GENERAL,
3162 .group = FIO_OPT_G_PROCESS,
3165 .name = "stonewall",
3166 .lname = "Wait for previous",
3167 .alias = "wait_for_previous",
3168 .type = FIO_OPT_STR_SET,
3169 .off1 = td_var_offset(stonewall),
3170 .help = "Insert a hard barrier between this job and previous",
3171 .category = FIO_OPT_C_GENERAL,
3172 .group = FIO_OPT_G_PROCESS,
3175 .name = "new_group",
3176 .lname = "New group",
3177 .type = FIO_OPT_STR_SET,
3178 .off1 = td_var_offset(new_group),
3179 .help = "Mark the start of a new group (for reporting)",
3180 .category = FIO_OPT_C_GENERAL,
3181 .group = FIO_OPT_G_PROCESS,
3186 .type = FIO_OPT_STR_SET,
3187 .off1 = td_var_offset(use_thread),
3188 .help = "Use threads instead of processes",
3189 #ifdef CONFIG_NO_SHM
3193 .category = FIO_OPT_C_GENERAL,
3194 .group = FIO_OPT_G_PROCESS,
3197 .name = "per_job_logs",
3198 .type = FIO_OPT_BOOL,
3199 .off1 = td_var_offset(per_job_logs),
3200 .help = "Include job number in generated log files or not",
3202 .category = FIO_OPT_C_LOG,
3203 .group = FIO_OPT_G_INVALID,
3206 .name = "write_bw_log",
3207 .lname = "Write bandwidth log",
3208 .type = FIO_OPT_STR_STORE,
3209 .off1 = td_var_offset(bw_log_file),
3210 .help = "Write log of bandwidth during run",
3211 .category = FIO_OPT_C_LOG,
3212 .group = FIO_OPT_G_INVALID,
3215 .name = "write_lat_log",
3216 .lname = "Write latency log",
3217 .type = FIO_OPT_STR_STORE,
3218 .off1 = td_var_offset(lat_log_file),
3219 .help = "Write log of latency during run",
3220 .category = FIO_OPT_C_LOG,
3221 .group = FIO_OPT_G_INVALID,
3224 .name = "write_iops_log",
3225 .lname = "Write IOPS log",
3226 .type = FIO_OPT_STR_STORE,
3227 .off1 = td_var_offset(iops_log_file),
3228 .help = "Write log of IOPS during run",
3229 .category = FIO_OPT_C_LOG,
3230 .group = FIO_OPT_G_INVALID,
3233 .name = "log_avg_msec",
3234 .lname = "Log averaging (msec)",
3235 .type = FIO_OPT_INT,
3236 .off1 = td_var_offset(log_avg_msec),
3237 .help = "Average bw/iops/lat logs over this period of time",
3239 .category = FIO_OPT_C_LOG,
3240 .group = FIO_OPT_G_INVALID,
3243 .name = "log_offset",
3244 .lname = "Log offset of IO",
3245 .type = FIO_OPT_BOOL,
3246 .off1 = td_var_offset(log_offset),
3247 .help = "Include offset of IO for each log entry",
3249 .category = FIO_OPT_C_LOG,
3250 .group = FIO_OPT_G_INVALID,
3254 .name = "log_compression",
3255 .lname = "Log compression",
3256 .type = FIO_OPT_INT,
3257 .off1 = td_var_offset(log_gz),
3258 .help = "Log in compressed chunks of this size",
3260 .maxval = 512 * 1024 * 1024ULL,
3261 .category = FIO_OPT_C_LOG,
3262 .group = FIO_OPT_G_INVALID,
3264 #ifdef FIO_HAVE_CPU_AFFINITY
3266 .name = "log_compression_cpus",
3267 .lname = "Log Compression CPUs",
3268 .type = FIO_OPT_STR,
3269 .cb = str_log_cpus_allowed_cb,
3270 .off1 = td_var_offset(log_gz_cpumask),
3271 .parent = "log_compression",
3272 .help = "Limit log compression to these CPUs",
3273 .category = FIO_OPT_C_LOG,
3274 .group = FIO_OPT_G_INVALID,
3278 .name = "log_store_compressed",
3279 .lname = "Log store compressed",
3280 .type = FIO_OPT_BOOL,
3281 .off1 = td_var_offset(log_gz_store),
3282 .help = "Store logs in a compressed format",
3283 .category = FIO_OPT_C_LOG,
3284 .group = FIO_OPT_G_INVALID,
3288 .name = "block_error_percentiles",
3289 .lname = "Block error percentiles",
3290 .type = FIO_OPT_BOOL,
3291 .off1 = td_var_offset(block_error_hist),
3292 .help = "Record trim block errors and make a histogram",
3294 .category = FIO_OPT_C_LOG,
3295 .group = FIO_OPT_G_INVALID,
3298 .name = "bwavgtime",
3299 .lname = "Bandwidth average time",
3300 .type = FIO_OPT_INT,
3301 .off1 = td_var_offset(bw_avg_time),
3302 .help = "Time window over which to calculate bandwidth"
3305 .parent = "write_bw_log",
3308 .category = FIO_OPT_C_LOG,
3309 .group = FIO_OPT_G_INVALID,
3312 .name = "iopsavgtime",
3313 .lname = "IOPS average time",
3314 .type = FIO_OPT_INT,
3315 .off1 = td_var_offset(iops_avg_time),
3316 .help = "Time window over which to calculate IOPS (msec)",
3318 .parent = "write_iops_log",
3321 .category = FIO_OPT_C_LOG,
3322 .group = FIO_OPT_G_INVALID,
3325 .name = "group_reporting",
3326 .lname = "Group reporting",
3327 .type = FIO_OPT_STR_SET,
3328 .off1 = td_var_offset(group_reporting),
3329 .help = "Do reporting on a per-group basis",
3330 .category = FIO_OPT_C_STAT,
3331 .group = FIO_OPT_G_INVALID,
3334 .name = "zero_buffers",
3335 .lname = "Zero I/O buffers",
3336 .type = FIO_OPT_STR_SET,
3337 .off1 = td_var_offset(zero_buffers),
3338 .help = "Init IO buffers to all zeroes",
3339 .category = FIO_OPT_C_IO,
3340 .group = FIO_OPT_G_IO_BUF,
3343 .name = "refill_buffers",
3344 .lname = "Refill I/O buffers",
3345 .type = FIO_OPT_STR_SET,
3346 .off1 = td_var_offset(refill_buffers),
3347 .help = "Refill IO buffers on every IO submit",
3348 .category = FIO_OPT_C_IO,
3349 .group = FIO_OPT_G_IO_BUF,
3352 .name = "scramble_buffers",
3353 .lname = "Scramble I/O buffers",
3354 .type = FIO_OPT_BOOL,
3355 .off1 = td_var_offset(scramble_buffers),
3356 .help = "Slightly scramble buffers on every IO submit",
3358 .category = FIO_OPT_C_IO,
3359 .group = FIO_OPT_G_IO_BUF,
3362 .name = "buffer_pattern",
3363 .lname = "Buffer pattern",
3364 .type = FIO_OPT_STR,
3365 .cb = str_buffer_pattern_cb,
3366 .off1 = td_var_offset(buffer_pattern),
3367 .help = "Fill pattern for IO buffers",
3368 .category = FIO_OPT_C_IO,
3369 .group = FIO_OPT_G_IO_BUF,
3372 .name = "buffer_compress_percentage",
3373 .lname = "Buffer compression percentage",
3374 .type = FIO_OPT_INT,
3375 .cb = str_buffer_compress_cb,
3376 .off1 = td_var_offset(compress_percentage),
3379 .help = "How compressible the buffer is (approximately)",
3381 .category = FIO_OPT_C_IO,
3382 .group = FIO_OPT_G_IO_BUF,
3385 .name = "buffer_compress_chunk",
3386 .lname = "Buffer compression chunk size",
3387 .type = FIO_OPT_INT,
3388 .off1 = td_var_offset(compress_chunk),
3389 .parent = "buffer_compress_percentage",
3391 .help = "Size of compressible region in buffer",
3393 .category = FIO_OPT_C_IO,
3394 .group = FIO_OPT_G_IO_BUF,
3397 .name = "dedupe_percentage",
3398 .lname = "Dedupe percentage",
3399 .type = FIO_OPT_INT,
3400 .cb = str_dedupe_cb,
3401 .off1 = td_var_offset(dedupe_percentage),
3404 .help = "Percentage of buffers that are dedupable",
3406 .category = FIO_OPT_C_IO,
3407 .group = FIO_OPT_G_IO_BUF,
3410 .name = "clat_percentiles",
3411 .lname = "Completion latency percentiles",
3412 .type = FIO_OPT_BOOL,
3413 .off1 = td_var_offset(clat_percentiles),
3414 .help = "Enable the reporting of completion latency percentiles",
3416 .category = FIO_OPT_C_STAT,
3417 .group = FIO_OPT_G_INVALID,
3420 .name = "percentile_list",
3421 .lname = "Percentile list",
3422 .type = FIO_OPT_FLOAT_LIST,
3423 .off1 = td_var_offset(percentile_list),
3424 .off2 = td_var_offset(percentile_precision),
3425 .help = "Specify a custom list of percentiles to report for "
3426 "completion latency and block errors",
3427 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3428 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3431 .category = FIO_OPT_C_STAT,
3432 .group = FIO_OPT_G_INVALID,
3435 #ifdef FIO_HAVE_DISK_UTIL
3437 .name = "disk_util",
3438 .lname = "Disk utilization",
3439 .type = FIO_OPT_BOOL,
3440 .off1 = td_var_offset(do_disk_util),
3441 .help = "Log disk utilization statistics",
3443 .category = FIO_OPT_C_STAT,
3444 .group = FIO_OPT_G_INVALID,
3448 .name = "gtod_reduce",
3449 .lname = "Reduce gettimeofday() calls",
3450 .type = FIO_OPT_BOOL,
3451 .help = "Greatly reduce number of gettimeofday() calls",
3452 .cb = str_gtod_reduce_cb,
3455 .category = FIO_OPT_C_STAT,
3456 .group = FIO_OPT_G_INVALID,
3459 .name = "disable_lat",
3460 .lname = "Disable all latency stats",
3461 .type = FIO_OPT_BOOL,
3462 .off1 = td_var_offset(disable_lat),
3463 .help = "Disable latency numbers",
3464 .parent = "gtod_reduce",
3467 .category = FIO_OPT_C_STAT,
3468 .group = FIO_OPT_G_INVALID,
3471 .name = "disable_clat",
3472 .lname = "Disable completion latency stats",
3473 .type = FIO_OPT_BOOL,
3474 .off1 = td_var_offset(disable_clat),
3475 .help = "Disable completion latency numbers",
3476 .parent = "gtod_reduce",
3479 .category = FIO_OPT_C_STAT,
3480 .group = FIO_OPT_G_INVALID,
3483 .name = "disable_slat",
3484 .lname = "Disable submission latency stats",
3485 .type = FIO_OPT_BOOL,
3486 .off1 = td_var_offset(disable_slat),
3487 .help = "Disable submission latency numbers",
3488 .parent = "gtod_reduce",
3491 .category = FIO_OPT_C_STAT,
3492 .group = FIO_OPT_G_INVALID,
3495 .name = "disable_bw_measurement",
3496 .lname = "Disable bandwidth stats",
3497 .type = FIO_OPT_BOOL,
3498 .off1 = td_var_offset(disable_bw),
3499 .help = "Disable bandwidth logging",
3500 .parent = "gtod_reduce",
3503 .category = FIO_OPT_C_STAT,
3504 .group = FIO_OPT_G_INVALID,
3508 .lname = "Dedicated gettimeofday() CPU",
3509 .type = FIO_OPT_INT,
3510 .off1 = td_var_offset(gtod_cpu),
3511 .help = "Set up dedicated gettimeofday() thread on this CPU",
3512 .verify = gtod_cpu_verify,
3513 .category = FIO_OPT_C_GENERAL,
3514 .group = FIO_OPT_G_CLOCK,
3517 .name = "unified_rw_reporting",
3518 .type = FIO_OPT_BOOL,
3519 .off1 = td_var_offset(unified_rw_rep),
3520 .help = "Unify reporting across data direction",
3522 .category = FIO_OPT_C_GENERAL,
3523 .group = FIO_OPT_G_INVALID,
3526 .name = "continue_on_error",
3527 .lname = "Continue on error",
3528 .type = FIO_OPT_STR,
3529 .off1 = td_var_offset(continue_on_error),
3530 .help = "Continue on non-fatal errors during IO",
3532 .category = FIO_OPT_C_GENERAL,
3533 .group = FIO_OPT_G_ERR,
3536 .oval = ERROR_TYPE_NONE,
3537 .help = "Exit when an error is encountered",
3540 .oval = ERROR_TYPE_READ,
3541 .help = "Continue on read errors only",
3544 .oval = ERROR_TYPE_WRITE,
3545 .help = "Continue on write errors only",
3548 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3549 .help = "Continue on any IO errors",
3552 .oval = ERROR_TYPE_VERIFY,
3553 .help = "Continue on verify errors only",
3556 .oval = ERROR_TYPE_ANY,
3557 .help = "Continue on all io and verify errors",
3560 .oval = ERROR_TYPE_NONE,
3561 .help = "Alias for 'none'",
3564 .oval = ERROR_TYPE_ANY,
3565 .help = "Alias for 'all'",
3570 .name = "ignore_error",
3571 .type = FIO_OPT_STR,
3572 .cb = str_ignore_error_cb,
3573 .off1 = td_var_offset(ignore_error_nr),
3574 .help = "Set a specific list of errors to ignore",
3576 .category = FIO_OPT_C_GENERAL,
3577 .group = FIO_OPT_G_ERR,
3580 .name = "error_dump",
3581 .type = FIO_OPT_BOOL,
3582 .off1 = td_var_offset(error_dump),
3584 .help = "Dump info on each error",
3585 .category = FIO_OPT_C_GENERAL,
3586 .group = FIO_OPT_G_ERR,
3591 .type = FIO_OPT_STR_STORE,
3592 .off1 = td_var_offset(profile),
3593 .help = "Select a specific builtin performance test",
3594 .category = FIO_OPT_C_PROFILE,
3595 .group = FIO_OPT_G_INVALID,
3600 .type = FIO_OPT_STR_STORE,
3601 .off1 = td_var_offset(cgroup),
3602 .help = "Add job to cgroup of this name",
3603 .category = FIO_OPT_C_GENERAL,
3604 .group = FIO_OPT_G_CGROUP,
3607 .name = "cgroup_nodelete",
3608 .lname = "Cgroup no-delete",
3609 .type = FIO_OPT_BOOL,
3610 .off1 = td_var_offset(cgroup_nodelete),
3611 .help = "Do not delete cgroups after job completion",
3614 .category = FIO_OPT_C_GENERAL,
3615 .group = FIO_OPT_G_CGROUP,
3618 .name = "cgroup_weight",
3619 .lname = "Cgroup weight",
3620 .type = FIO_OPT_INT,
3621 .off1 = td_var_offset(cgroup_weight),
3622 .help = "Use given weight for cgroup",
3626 .category = FIO_OPT_C_GENERAL,
3627 .group = FIO_OPT_G_CGROUP,
3632 .type = FIO_OPT_INT,
3633 .off1 = td_var_offset(uid),
3634 .help = "Run job with this user ID",
3635 .category = FIO_OPT_C_GENERAL,
3636 .group = FIO_OPT_G_CRED,
3640 .lname = "Group ID",
3641 .type = FIO_OPT_INT,
3642 .off1 = td_var_offset(gid),
3643 .help = "Run job with this group ID",
3644 .category = FIO_OPT_C_GENERAL,
3645 .group = FIO_OPT_G_CRED,
3650 .type = FIO_OPT_INT,
3651 .off1 = td_var_offset(kb_base),
3657 .help = "Use 1024 as the K base",
3661 .help = "Use 1000 as the K base",
3664 .help = "How many bytes per KB for reporting (1000 or 1024)",
3665 .category = FIO_OPT_C_GENERAL,
3666 .group = FIO_OPT_G_INVALID,
3669 .name = "unit_base",
3670 .lname = "Base unit for reporting (Bits or Bytes)",
3671 .type = FIO_OPT_INT,
3672 .off1 = td_var_offset(unit_base),
3677 .help = "Auto-detect",
3681 .help = "Normal (byte based)",
3685 .help = "Bit based",
3688 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3689 .category = FIO_OPT_C_GENERAL,
3690 .group = FIO_OPT_G_INVALID,
3693 .name = "hugepage-size",
3694 .lname = "Hugepage size",
3695 .type = FIO_OPT_INT,
3696 .off1 = td_var_offset(hugepage_size),
3697 .help = "When using hugepages, specify size of each page",
3698 .def = __fio_stringify(FIO_HUGE_PAGE),
3699 .interval = 1024 * 1024,
3700 .category = FIO_OPT_C_GENERAL,
3701 .group = FIO_OPT_G_INVALID,
3705 .lname = "I/O flow ID",
3706 .type = FIO_OPT_INT,
3707 .off1 = td_var_offset(flow_id),
3708 .help = "The flow index ID to use",
3710 .category = FIO_OPT_C_IO,
3711 .group = FIO_OPT_G_IO_FLOW,
3715 .lname = "I/O flow weight",
3716 .type = FIO_OPT_INT,
3717 .off1 = td_var_offset(flow),
3718 .help = "Weight for flow control of this job",
3719 .parent = "flow_id",
3722 .category = FIO_OPT_C_IO,
3723 .group = FIO_OPT_G_IO_FLOW,
3726 .name = "flow_watermark",
3727 .lname = "I/O flow watermark",
3728 .type = FIO_OPT_INT,
3729 .off1 = td_var_offset(flow_watermark),
3730 .help = "High watermark for flow control. This option"
3731 " should be set to the same value for all threads"
3732 " with non-zero flow.",
3733 .parent = "flow_id",
3736 .category = FIO_OPT_C_IO,
3737 .group = FIO_OPT_G_IO_FLOW,
3740 .name = "flow_sleep",
3741 .lname = "I/O flow sleep",
3742 .type = FIO_OPT_INT,
3743 .off1 = td_var_offset(flow_sleep),
3744 .help = "How many microseconds to sleep after being held"
3745 " back by the flow control mechanism",
3746 .parent = "flow_id",
3749 .category = FIO_OPT_C_IO,
3750 .group = FIO_OPT_G_IO_FLOW,
3754 .lname = "Skip operations against bad blocks",
3755 .type = FIO_OPT_BOOL,
3756 .off1 = td_var_offset(skip_bad),
3757 .help = "Skip operations against known bad blocks.",
3760 .category = FIO_OPT_C_IO,
3761 .group = FIO_OPT_G_MTD,
3768 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3769 const char *name, int val)
3771 lopt->name = (char *) name;
3773 if (o->type == FIO_OPT_STR_SET)
3774 lopt->has_arg = optional_argument;
3776 lopt->has_arg = required_argument;
3779 static void options_to_lopts(struct fio_option *opts,
3780 struct option *long_options,
3781 int i, int option_type)
3783 struct fio_option *o = &opts[0];
3785 add_to_lopt(&long_options[i], o, o->name, option_type);
3788 add_to_lopt(&long_options[i], o, o->alias, option_type);
3793 assert(i < FIO_NR_OPTIONS);
3797 void fio_options_set_ioengine_opts(struct option *long_options,
3798 struct thread_data *td)
3803 while (long_options[i].name) {
3804 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3805 memset(&long_options[i], 0, sizeof(*long_options));
3812 * Just clear out the prior ioengine options.
3817 options_to_lopts(td->io_ops->options, long_options, i,
3818 FIO_GETOPT_IOENGINE);
3821 void fio_options_dup_and_init(struct option *long_options)
3825 options_init(fio_options);
3828 while (long_options[i].name)
3831 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3834 struct fio_keyword {
3840 static struct fio_keyword fio_keywords[] = {
3842 .word = "$pagesize",
3843 .desc = "Page size in the system",
3846 .word = "$mb_memory",
3847 .desc = "Megabytes of memory online",
3851 .desc = "Number of CPUs online in the system",
3858 void fio_keywords_exit(void)
3860 struct fio_keyword *kw;
3862 kw = &fio_keywords[0];
3870 void fio_keywords_init(void)
3872 unsigned long long mb_memory;
3876 sprintf(buf, "%lu", (unsigned long) page_size);
3877 fio_keywords[0].replace = strdup(buf);
3879 mb_memory = os_phys_mem() / (1024 * 1024);
3880 sprintf(buf, "%llu", mb_memory);
3881 fio_keywords[1].replace = strdup(buf);
3884 sprintf(buf, "%lu", l);
3885 fio_keywords[2].replace = strdup(buf);
3890 static char *bc_calc(char *str)
3892 char buf[128], *tmp;
3897 * No math, just return string
3899 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3900 !strchr(str, '/')) || strchr(str, '\''))
3904 * Split option from value, we only need to calculate the value
3906 tmp = strchr(str, '=');
3913 * Prevent buffer overflows; such a case isn't reasonable anyway
3915 if (strlen(str) >= 128 || strlen(tmp) > 100)
3918 sprintf(buf, "which %s > /dev/null", BC_APP);
3920 log_err("fio: bc is needed for performing math\n");
3924 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3925 f = popen(buf, "r");
3929 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3936 buf[(tmp - str) + ret - 1] = '\0';
3937 memcpy(buf, str, tmp - str);
3943 * Return a copy of the input string with substrings of the form ${VARNAME}
3944 * substituted with the value of the environment variable VARNAME. The
3945 * substitution always occurs, even if VARNAME is empty or the corresponding
3946 * environment variable undefined.
3948 static char *option_dup_subs(const char *opt)
3950 char out[OPT_LEN_MAX+1];
3951 char in[OPT_LEN_MAX+1];
3954 char *ch1, *ch2, *env;
3955 ssize_t nchr = OPT_LEN_MAX;
3958 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3959 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3963 in[OPT_LEN_MAX] = '\0';
3964 strncpy(in, opt, OPT_LEN_MAX);
3966 while (*inptr && nchr > 0) {
3967 if (inptr[0] == '$' && inptr[1] == '{') {
3968 ch2 = strchr(inptr, '}');
3969 if (ch2 && inptr+1 < ch2) {
3976 envlen = strlen(env);
3977 if (envlen <= nchr) {
3978 memcpy(outptr, env, envlen);
3988 *outptr++ = *inptr++;
3997 * Look for reserved variable names and replace them with real values
3999 static char *fio_keyword_replace(char *opt)
4005 for (i = 0; fio_keywords[i].word != NULL; i++) {
4006 struct fio_keyword *kw = &fio_keywords[i];
4008 while ((s = strstr(opt, kw->word)) != NULL) {
4009 char *new = malloc(strlen(opt) + 1);
4015 * Copy part of the string before the keyword and
4016 * sprintf() the replacement after it.
4018 memcpy(new, opt, olen);
4019 len = sprintf(new + olen, "%s", kw->replace);
4022 * If there's more in the original string, copy that
4025 opt += strlen(kw->word) + olen;
4027 memcpy(new + olen + len, opt, opt - o_org - 1);
4030 * replace opt and free the old opt
4040 * Check for potential math and invoke bc, if possible
4048 static char **dup_and_sub_options(char **opts, int num_opts)
4051 char **opts_copy = malloc(num_opts * sizeof(*opts));
4052 for (i = 0; i < num_opts; i++) {
4053 opts_copy[i] = option_dup_subs(opts[i]);
4056 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
4061 static void show_closest_option(const char *opt)
4063 int best_option, best_distance;
4072 while (name[i] != '\0' && name[i] != '=')
4077 best_distance = INT_MAX;
4079 while (fio_options[i].name) {
4080 distance = string_distance(name, fio_options[i].name);
4081 if (distance < best_distance) {
4082 best_distance = distance;
4088 if (best_option != -1 && string_distance_ok(name, best_distance))
4089 log_err("Did you mean %s?\n", fio_options[best_option].name);
4094 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
4096 int i, ret, unknown;
4099 sort_options(opts, fio_options, num_opts);
4100 opts_copy = dup_and_sub_options(opts, num_opts);
4102 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
4103 struct fio_option *o;
4104 int newret = parse_option(opts_copy[i], opts[i], fio_options,
4105 &o, td, &td->opt_list);
4108 fio_option_mark_set(&td->o, o);
4116 opts_copy[i] = NULL;
4123 ret |= ioengine_load(td);
4125 sort_options(opts_copy, td->io_ops->options, num_opts);
4128 for (i = 0; i < num_opts; i++) {
4129 struct fio_option *o = NULL;
4136 newret = parse_option(opts_copy[i], opts[i],
4137 td->io_ops->options, &o,
4138 td->eo, &td->opt_list);
4142 log_err("Bad option <%s>\n", opts[i]);
4143 show_closest_option(opts[i]);
4146 opts_copy[i] = NULL;
4154 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
4158 ret = parse_cmd_option(opt, val, fio_options, td, &td->opt_list);
4160 struct fio_option *o;
4162 o = find_option(fio_options, opt);
4164 fio_option_mark_set(&td->o, o);
4170 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
4173 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
4177 void fio_fill_default_options(struct thread_data *td)
4179 td->o.magic = OPT_MAGIC;
4180 fill_default_options(td, fio_options);
4183 int fio_show_option_help(const char *opt)
4185 return show_cmd_help(fio_options, opt);
4188 void options_mem_dupe(void *data, struct fio_option *options)
4190 struct fio_option *o;
4193 for (o = &options[0]; o->name; o++) {
4194 if (o->type != FIO_OPT_STR_STORE)
4197 ptr = td_var(data, o, o->off1);
4199 *ptr = strdup(*ptr);
4204 * dupe FIO_OPT_STR_STORE options
4206 void fio_options_mem_dupe(struct thread_data *td)
4208 options_mem_dupe(&td->o, fio_options);
4210 if (td->eo && td->io_ops) {
4211 void *oldeo = td->eo;
4213 td->eo = malloc(td->io_ops->option_struct_size);
4214 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
4215 options_mem_dupe(td->eo, td->io_ops->options);
4219 unsigned int fio_get_kb_base(void *data)
4221 struct thread_options *o = data;
4222 unsigned int kb_base = 0;
4225 * This is a hack... For private options, *data is not holding
4226 * a pointer to the thread_options, but to private data. This means
4227 * we can't safely dereference it, but magic is first so mem wise
4228 * it is valid. But this also means that if the job first sets
4229 * kb_base and expects that to be honored by private options,
4230 * it will be disappointed. We will return the global default
4233 if (o && o->magic == OPT_MAGIC)
4234 kb_base = o->kb_base;
4241 int add_option(struct fio_option *o)
4243 struct fio_option *__o;
4252 if (opt_index + 1 == FIO_MAX_OPTS) {
4253 log_err("fio: FIO_MAX_OPTS is too small\n");
4257 memcpy(&fio_options[opt_index], o, sizeof(*o));
4258 fio_options[opt_index + 1].name = NULL;
4262 void invalidate_profile_options(const char *prof_name)
4264 struct fio_option *o;
4268 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
4269 o->type = FIO_OPT_INVALID;
4270 o->prof_name = NULL;
4276 void add_opt_posval(const char *optname, const char *ival, const char *help)
4278 struct fio_option *o;
4281 o = find_option(fio_options, optname);
4285 for (i = 0; i < PARSE_MAX_VP; i++) {
4286 if (o->posval[i].ival)
4289 o->posval[i].ival = ival;
4290 o->posval[i].help = help;
4295 void del_opt_posval(const char *optname, const char *ival)
4297 struct fio_option *o;
4300 o = find_option(fio_options, optname);
4304 for (i = 0; i < PARSE_MAX_VP; i++) {
4305 if (!o->posval[i].ival)
4307 if (strcmp(o->posval[i].ival, ival))
4310 o->posval[i].ival = NULL;
4311 o->posval[i].help = NULL;
4315 void fio_options_free(struct thread_data *td)
4317 options_free(fio_options, td);
4318 if (td->eo && td->io_ops && td->io_ops->options) {
4319 options_free(td->io_ops->options, td->eo);
4325 struct fio_option *fio_option_find(const char *name)
4327 return find_option(fio_options, name);
4330 static struct fio_option *find_next_opt(struct thread_options *o,
4331 struct fio_option *from,
4334 struct fio_option *opt;
4337 from = &fio_options[0];
4343 if (off1 == from->off1) {
4348 } while (from->name);
4353 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
4355 unsigned int opt_off, index, offset;
4357 opt_off = opt - &fio_options[0];
4358 index = opt_off / (8 * sizeof(uint64_t));
4359 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4360 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
4363 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
4365 struct fio_option *opt, *next;
4368 while ((opt = find_next_opt(o, next, off1)) != NULL) {
4369 if (opt_is_set(o, opt))
4378 void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)
4380 unsigned int opt_off, index, offset;
4382 opt_off = opt - &fio_options[0];
4383 index = opt_off / (8 * sizeof(uint64_t));
4384 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4385 o->set_options[index] |= (uint64_t)1 << offset;