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);
539 static int str_log_cpus_allowed_cb(void *data, const char *input)
541 struct thread_data *td = data;
546 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
551 #ifdef CONFIG_LIBNUMA
552 static int str_numa_cpunodes_cb(void *data, char *input)
554 struct thread_data *td = data;
555 struct bitmask *verify_bitmask;
560 /* numa_parse_nodestring() parses a character string list
561 * of nodes into a bit mask. The bit mask is allocated by
562 * numa_allocate_nodemask(), so it should be freed by
563 * numa_free_nodemask().
565 verify_bitmask = numa_parse_nodestring(input);
566 if (verify_bitmask == NULL) {
567 log_err("fio: numa_parse_nodestring failed\n");
568 td_verror(td, 1, "str_numa_cpunodes_cb");
571 numa_free_nodemask(verify_bitmask);
573 td->o.numa_cpunodes = strdup(input);
577 static int str_numa_mpol_cb(void *data, char *input)
579 struct thread_data *td = data;
580 const char * const policy_types[] =
581 { "default", "prefer", "bind", "interleave", "local", NULL };
584 struct bitmask *verify_bitmask;
589 nodelist = strchr(input, ':');
591 /* NUL-terminate mode */
595 for (i = 0; i <= MPOL_LOCAL; i++) {
596 if (!strcmp(input, policy_types[i])) {
597 td->o.numa_mem_mode = i;
601 if (i > MPOL_LOCAL) {
602 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
606 switch (td->o.numa_mem_mode) {
609 * Insist on a nodelist of one node only
612 char *rest = nodelist;
613 while (isdigit(*rest))
616 log_err("fio: one node only for \'prefer\'\n");
620 log_err("fio: one node is needed for \'prefer\'\n");
624 case MPOL_INTERLEAVE:
626 * Default to online nodes with memory if no nodelist
629 nodelist = strdup("all");
634 * Don't allow a nodelist
637 log_err("fio: NO nodelist for \'local\'\n");
643 * Insist on a nodelist
646 log_err("fio: a nodelist is needed for \'bind\'\n");
653 /* numa_parse_nodestring() parses a character string list
654 * of nodes into a bit mask. The bit mask is allocated by
655 * numa_allocate_nodemask(), so it should be freed by
656 * numa_free_nodemask().
658 switch (td->o.numa_mem_mode) {
660 td->o.numa_mem_prefer_node = atoi(nodelist);
662 case MPOL_INTERLEAVE:
664 verify_bitmask = numa_parse_nodestring(nodelist);
665 if (verify_bitmask == NULL) {
666 log_err("fio: numa_parse_nodestring failed\n");
667 td_verror(td, 1, "str_numa_memnodes_cb");
670 td->o.numa_memnodes = strdup(nodelist);
671 numa_free_nodemask(verify_bitmask);
686 static int str_fst_cb(void *data, const char *str)
688 struct thread_data *td = data;
689 char *nr = get_opt_postfix(str);
691 td->file_service_nr = 1;
693 td->file_service_nr = atoi(nr);
700 #ifdef CONFIG_SYNC_FILE_RANGE
701 static int str_sfr_cb(void *data, const char *str)
703 struct thread_data *td = data;
704 char *nr = get_opt_postfix(str);
706 td->sync_file_range_nr = 1;
708 td->sync_file_range_nr = atoi(nr);
716 static int str_random_distribution_cb(void *data, const char *str)
718 struct thread_data *td = data;
725 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
727 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
728 val = FIO_DEF_PARETO;
729 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
734 nr = get_opt_postfix(str);
735 if (nr && !str_to_float(nr, &val, 0)) {
736 log_err("fio: random postfix parsing failed\n");
743 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
745 log_err("fio: zipf theta must different than 1.0\n");
748 td->o.zipf_theta.u.f = val;
749 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
750 if (val <= 0.00 || val >= 1.00) {
751 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
754 td->o.pareto_h.u.f = val;
756 if (val <= 0.00 || val >= 100.0) {
757 log_err("fio: normal deviation out of range (0 < input < 100.0)\n");
760 td->o.gauss_dev.u.f = val;
767 * Return next name in the string. Files are separated with ':'. If the ':'
768 * is escaped with a '\', then that ':' is part of the filename and does not
769 * indicate a new file.
771 static char *get_next_name(char **ptr)
776 if (!str || !strlen(str))
782 * No colon, we are done
784 p = strchr(str, ':');
791 * We got a colon, but it's the first character. Skip and
799 if (*(p - 1) != '\\') {
805 memmove(p - 1, p, strlen(p) + 1);
813 static int get_max_name_idx(char *input)
815 unsigned int cur_idx;
818 p = str = strdup(input);
819 for (cur_idx = 0; ; cur_idx++)
820 if (get_next_name(&str) == NULL)
828 * Returns the directory at the index, indexes > entires will be
829 * assigned via modulo division of the index
831 int set_name_idx(char *target, size_t tlen, char *input, int index)
833 unsigned int cur_idx;
835 char *fname, *str, *p;
837 p = str = strdup(input);
839 index %= get_max_name_idx(input);
840 for (cur_idx = 0; cur_idx <= index; cur_idx++)
841 fname = get_next_name(&str);
843 if (client_sockaddr_str[0]) {
844 len = snprintf(target, tlen, "%s/%s.", fname,
845 client_sockaddr_str);
847 len = snprintf(target, tlen, "%s/", fname);
849 target[tlen - 1] = '\0';
855 static int str_filename_cb(void *data, const char *input)
857 struct thread_data *td = data;
858 char *fname, *str, *p;
860 p = str = strdup(input);
862 strip_blank_front(&str);
863 strip_blank_end(str);
865 if (!td->files_index)
868 while ((fname = get_next_name(&str)) != NULL) {
871 add_file(td, fname, 0, 1);
878 static int str_directory_cb(void *data, const char fio_unused *unused)
880 struct thread_data *td = data;
882 char *dirname, *str, *p;
888 p = str = strdup(td->o.directory);
889 while ((dirname = get_next_name(&str)) != NULL) {
890 if (lstat(dirname, &sb) < 0) {
893 log_err("fio: %s is not a directory\n", dirname);
894 td_verror(td, ret, "lstat");
897 if (!S_ISDIR(sb.st_mode)) {
898 log_err("fio: %s is not a directory\n", dirname);
909 static int str_opendir_cb(void *data, const char fio_unused *str)
911 struct thread_data *td = data;
916 if (!td->files_index)
919 return add_dir_files(td, td->o.opendir);
922 static int str_buffer_pattern_cb(void *data, const char *input)
924 struct thread_data *td = data;
927 /* FIXME: for now buffer pattern does not support formats */
928 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
929 MAX_PATTERN_SIZE, NULL, 0, NULL, NULL);
934 td->o.buffer_pattern_bytes = ret;
935 if (!td->o.compress_percentage)
936 td->o.refill_buffers = 0;
937 td->o.scramble_buffers = 0;
938 td->o.zero_buffers = 0;
943 static int str_buffer_compress_cb(void *data, unsigned long long *il)
945 struct thread_data *td = data;
947 td->flags |= TD_F_COMPRESS;
948 td->o.compress_percentage = *il;
952 static int str_dedupe_cb(void *data, unsigned long long *il)
954 struct thread_data *td = data;
956 td->flags |= TD_F_COMPRESS;
957 td->o.dedupe_percentage = *il;
958 td->o.refill_buffers = 1;
962 static int str_verify_pattern_cb(void *data, const char *input)
964 struct thread_data *td = data;
967 td->o.verify_fmt_sz = ARRAY_SIZE(td->o.verify_fmt);
968 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
969 MAX_PATTERN_SIZE, fmt_desc, sizeof(fmt_desc),
970 td->o.verify_fmt, &td->o.verify_fmt_sz);
975 td->o.verify_pattern_bytes = ret;
977 * VERIFY_* could already be set
979 if (!fio_option_is_set(&td->o, verify))
980 td->o.verify = VERIFY_PATTERN;
985 static int str_gtod_reduce_cb(void *data, int *il)
987 struct thread_data *td = data;
990 td->o.disable_lat = !!val;
991 td->o.disable_clat = !!val;
992 td->o.disable_slat = !!val;
993 td->o.disable_bw = !!val;
994 td->o.clat_percentiles = !val;
996 td->tv_cache_mask = 63;
1001 static int str_size_cb(void *data, unsigned long long *__val)
1003 struct thread_data *td = data;
1004 unsigned long long v = *__val;
1006 if (parse_is_percent(v)) {
1008 td->o.size_percent = -1ULL - v;
1015 static int rw_verify(struct fio_option *o, void *data)
1017 struct thread_data *td = data;
1019 if (read_only && td_write(td)) {
1020 log_err("fio: job <%s> has write bit set, but fio is in"
1021 " read-only mode\n", td->o.name);
1028 static int gtod_cpu_verify(struct fio_option *o, void *data)
1030 #ifndef FIO_HAVE_CPU_AFFINITY
1031 struct thread_data *td = data;
1033 if (td->o.gtod_cpu) {
1034 log_err("fio: platform must support CPU affinity for"
1035 "gettimeofday() offloading\n");
1046 static struct opt_group fio_opt_groups[] = {
1049 .mask = FIO_OPT_C_GENERAL,
1053 .mask = FIO_OPT_C_IO,
1057 .mask = FIO_OPT_C_FILE,
1060 .name = "Statistics",
1061 .mask = FIO_OPT_C_STAT,
1065 .mask = FIO_OPT_C_LOG,
1069 .mask = FIO_OPT_C_PROFILE,
1076 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1077 unsigned int inv_mask)
1079 struct opt_group *og;
1082 if (*mask == inv_mask || !*mask)
1085 for (i = 0; ogs[i].name; i++) {
1088 if (*mask & og->mask) {
1089 *mask &= ~(og->mask);
1097 struct opt_group *opt_group_from_mask(unsigned int *mask)
1099 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1102 static struct opt_group fio_opt_cat_groups[] = {
1104 .name = "Latency profiling",
1105 .mask = FIO_OPT_G_LATPROF,
1109 .mask = FIO_OPT_G_RATE,
1113 .mask = FIO_OPT_G_ZONE,
1116 .name = "Read/write mix",
1117 .mask = FIO_OPT_G_RWMIX,
1121 .mask = FIO_OPT_G_VERIFY,
1125 .mask = FIO_OPT_G_TRIM,
1128 .name = "I/O Logging",
1129 .mask = FIO_OPT_G_IOLOG,
1132 .name = "I/O Depth",
1133 .mask = FIO_OPT_G_IO_DEPTH,
1137 .mask = FIO_OPT_G_IO_FLOW,
1140 .name = "Description",
1141 .mask = FIO_OPT_G_DESC,
1145 .mask = FIO_OPT_G_FILENAME,
1148 .name = "General I/O",
1149 .mask = FIO_OPT_G_IO_BASIC,
1153 .mask = FIO_OPT_G_CGROUP,
1157 .mask = FIO_OPT_G_RUNTIME,
1161 .mask = FIO_OPT_G_PROCESS,
1164 .name = "Job credentials / priority",
1165 .mask = FIO_OPT_G_CRED,
1168 .name = "Clock settings",
1169 .mask = FIO_OPT_G_CLOCK,
1173 .mask = FIO_OPT_G_IO_TYPE,
1176 .name = "I/O Thinktime",
1177 .mask = FIO_OPT_G_THINKTIME,
1180 .name = "Randomizations",
1181 .mask = FIO_OPT_G_RANDOM,
1184 .name = "I/O buffers",
1185 .mask = FIO_OPT_G_IO_BUF,
1188 .name = "Tiobench profile",
1189 .mask = FIO_OPT_G_TIOBENCH,
1193 .mask = FIO_OPT_G_MTD,
1201 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1203 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1207 * Map of job/command line options
1209 struct fio_option fio_options[FIO_MAX_OPTS] = {
1211 .name = "description",
1212 .lname = "Description of job",
1213 .type = FIO_OPT_STR_STORE,
1214 .off1 = td_var_offset(description),
1215 .help = "Text job description",
1216 .category = FIO_OPT_C_GENERAL,
1217 .group = FIO_OPT_G_DESC,
1221 .lname = "Job name",
1222 .type = FIO_OPT_STR_STORE,
1223 .off1 = td_var_offset(name),
1224 .help = "Name of this job",
1225 .category = FIO_OPT_C_GENERAL,
1226 .group = FIO_OPT_G_DESC,
1230 .lname = "Filename(s)",
1231 .type = FIO_OPT_STR_STORE,
1232 .off1 = td_var_offset(filename),
1233 .cb = str_filename_cb,
1234 .prio = -1, /* must come after "directory" */
1235 .help = "File(s) to use for the workload",
1236 .category = FIO_OPT_C_FILE,
1237 .group = FIO_OPT_G_FILENAME,
1240 .name = "directory",
1241 .lname = "Directory",
1242 .type = FIO_OPT_STR_STORE,
1243 .off1 = td_var_offset(directory),
1244 .cb = str_directory_cb,
1245 .help = "Directory to store files in",
1246 .category = FIO_OPT_C_FILE,
1247 .group = FIO_OPT_G_FILENAME,
1250 .name = "filename_format",
1251 .type = FIO_OPT_STR_STORE,
1252 .off1 = td_var_offset(filename_format),
1253 .prio = -1, /* must come after "directory" */
1254 .help = "Override default $jobname.$jobnum.$filenum naming",
1255 .def = "$jobname.$jobnum.$filenum",
1256 .category = FIO_OPT_C_FILE,
1257 .group = FIO_OPT_G_FILENAME,
1261 .lname = "Lockfile",
1262 .type = FIO_OPT_STR,
1263 .off1 = td_var_offset(file_lock_mode),
1264 .help = "Lock file when doing IO to it",
1266 .parent = "filename",
1269 .category = FIO_OPT_C_FILE,
1270 .group = FIO_OPT_G_FILENAME,
1273 .oval = FILE_LOCK_NONE,
1274 .help = "No file locking",
1276 { .ival = "exclusive",
1277 .oval = FILE_LOCK_EXCLUSIVE,
1278 .help = "Exclusive file lock",
1281 .ival = "readwrite",
1282 .oval = FILE_LOCK_READWRITE,
1283 .help = "Read vs write lock",
1289 .lname = "Open directory",
1290 .type = FIO_OPT_STR_STORE,
1291 .off1 = td_var_offset(opendir),
1292 .cb = str_opendir_cb,
1293 .help = "Recursively add files from this directory and down",
1294 .category = FIO_OPT_C_FILE,
1295 .group = FIO_OPT_G_FILENAME,
1299 .lname = "Read/write",
1300 .alias = "readwrite",
1301 .type = FIO_OPT_STR,
1303 .off1 = td_var_offset(td_ddir),
1304 .help = "IO direction",
1306 .verify = rw_verify,
1307 .category = FIO_OPT_C_IO,
1308 .group = FIO_OPT_G_IO_BASIC,
1311 .oval = TD_DDIR_READ,
1312 .help = "Sequential read",
1315 .oval = TD_DDIR_WRITE,
1316 .help = "Sequential write",
1319 .oval = TD_DDIR_TRIM,
1320 .help = "Sequential trim",
1322 { .ival = "randread",
1323 .oval = TD_DDIR_RANDREAD,
1324 .help = "Random read",
1326 { .ival = "randwrite",
1327 .oval = TD_DDIR_RANDWRITE,
1328 .help = "Random write",
1330 { .ival = "randtrim",
1331 .oval = TD_DDIR_RANDTRIM,
1332 .help = "Random trim",
1336 .help = "Sequential read and write mix",
1338 { .ival = "readwrite",
1340 .help = "Sequential read and write mix",
1343 .oval = TD_DDIR_RANDRW,
1344 .help = "Random read and write mix"
1346 { .ival = "trimwrite",
1347 .oval = TD_DDIR_TRIMWRITE,
1348 .help = "Trim and write mix, trims preceding writes"
1353 .name = "rw_sequencer",
1354 .lname = "RW Sequencer",
1355 .type = FIO_OPT_STR,
1356 .off1 = td_var_offset(rw_seq),
1357 .help = "IO offset generator modifier",
1358 .def = "sequential",
1359 .category = FIO_OPT_C_IO,
1360 .group = FIO_OPT_G_IO_BASIC,
1362 { .ival = "sequential",
1364 .help = "Generate sequential offsets",
1366 { .ival = "identical",
1367 .oval = RW_SEQ_IDENT,
1368 .help = "Generate identical offsets",
1375 .lname = "IO Engine",
1376 .type = FIO_OPT_STR_STORE,
1377 .off1 = td_var_offset(ioengine),
1378 .help = "IO engine to use",
1379 .def = FIO_PREFERRED_ENGINE,
1380 .category = FIO_OPT_C_IO,
1381 .group = FIO_OPT_G_IO_BASIC,
1384 .help = "Use read/write",
1387 .help = "Use pread/pwrite",
1390 .help = "Use readv/writev",
1392 #ifdef CONFIG_PWRITEV
1394 .help = "Use preadv/pwritev",
1397 #ifdef CONFIG_LIBAIO
1399 .help = "Linux native asynchronous IO",
1402 #ifdef CONFIG_POSIXAIO
1403 { .ival = "posixaio",
1404 .help = "POSIX asynchronous IO",
1407 #ifdef CONFIG_SOLARISAIO
1408 { .ival = "solarisaio",
1409 .help = "Solaris native asynchronous IO",
1412 #ifdef CONFIG_WINDOWSAIO
1413 { .ival = "windowsaio",
1414 .help = "Windows native asynchronous IO"
1419 .help = "Rados Block Device asynchronous IO"
1423 .help = "Memory mapped IO"
1425 #ifdef CONFIG_LINUX_SPLICE
1427 .help = "splice/vmsplice based IO",
1429 { .ival = "netsplice",
1430 .help = "splice/vmsplice to/from the network",
1433 #ifdef FIO_HAVE_SGIO
1435 .help = "SCSI generic v3 IO",
1439 .help = "Testing engine (no data transfer)",
1442 .help = "Network IO",
1445 .help = "CPU cycle burner engine",
1449 .help = "GUASI IO engine",
1452 #ifdef FIO_HAVE_BINJECT
1453 { .ival = "binject",
1454 .help = "binject direct inject block engine",
1459 .help = "RDMA IO engine",
1462 #ifdef CONFIG_FUSION_AW
1463 { .ival = "fusion-aw-sync",
1464 .help = "Fusion-io atomic write engine",
1467 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1468 { .ival = "e4defrag",
1469 .help = "ext4 defrag engine",
1472 #ifdef CONFIG_LINUX_FALLOCATE
1474 .help = "fallocate() file based engine",
1479 .help = "Glusterfs libgfapi(sync) based engine"
1481 { .ival = "gfapi_async",
1482 .help = "Glusterfs libgfapi(async) based engine"
1485 #ifdef CONFIG_LIBHDFS
1486 { .ival = "libhdfs",
1487 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1490 { .ival = "external",
1491 .help = "Load external engine (append name)",
1497 .lname = "IO Depth",
1498 .type = FIO_OPT_INT,
1499 .off1 = td_var_offset(iodepth),
1500 .help = "Number of IO buffers to keep in flight",
1504 .category = FIO_OPT_C_IO,
1505 .group = FIO_OPT_G_IO_BASIC,
1508 .name = "iodepth_batch",
1509 .lname = "IO Depth batch",
1510 .alias = "iodepth_batch_submit",
1511 .type = FIO_OPT_INT,
1512 .off1 = td_var_offset(iodepth_batch),
1513 .help = "Number of IO buffers to submit in one go",
1514 .parent = "iodepth",
1519 .category = FIO_OPT_C_IO,
1520 .group = FIO_OPT_G_IO_BASIC,
1523 .name = "iodepth_batch_complete_min",
1524 .lname = "Min IO depth batch complete",
1525 .alias = "iodepth_batch_complete",
1526 .type = FIO_OPT_INT,
1527 .off1 = td_var_offset(iodepth_batch_complete_min),
1528 .help = "Min number of IO buffers to retrieve in one go",
1529 .parent = "iodepth",
1534 .category = FIO_OPT_C_IO,
1535 .group = FIO_OPT_G_IO_BASIC,
1538 .name = "iodepth_batch_complete_max",
1539 .lname = "Max IO depth batch complete",
1540 .type = FIO_OPT_INT,
1541 .off1 = td_var_offset(iodepth_batch_complete_max),
1542 .help = "Max number of IO buffers to retrieve in one go",
1543 .parent = "iodepth",
1547 .category = FIO_OPT_C_IO,
1548 .group = FIO_OPT_G_IO_BASIC,
1551 .name = "iodepth_low",
1552 .lname = "IO Depth batch low",
1553 .type = FIO_OPT_INT,
1554 .off1 = td_var_offset(iodepth_low),
1555 .help = "Low water mark for queuing depth",
1556 .parent = "iodepth",
1559 .category = FIO_OPT_C_IO,
1560 .group = FIO_OPT_G_IO_BASIC,
1563 .name = "io_submit_mode",
1564 .lname = "IO submit mode",
1565 .type = FIO_OPT_STR,
1566 .off1 = td_var_offset(io_submit_mode),
1567 .help = "How IO submissions and completions are done",
1569 .category = FIO_OPT_C_IO,
1570 .group = FIO_OPT_G_IO_BASIC,
1573 .oval = IO_MODE_INLINE,
1574 .help = "Submit and complete IO inline",
1576 { .ival = "offload",
1577 .oval = IO_MODE_OFFLOAD,
1578 .help = "Offload submit and complete to threads",
1585 .type = FIO_OPT_STR_VAL,
1587 .off1 = td_var_offset(size),
1588 .help = "Total size of device or files",
1589 .interval = 1024 * 1024,
1590 .category = FIO_OPT_C_IO,
1591 .group = FIO_OPT_G_INVALID,
1595 .alias = "io_limit",
1597 .type = FIO_OPT_STR_VAL,
1598 .off1 = td_var_offset(io_limit),
1599 .interval = 1024 * 1024,
1600 .category = FIO_OPT_C_IO,
1601 .group = FIO_OPT_G_INVALID,
1604 .name = "fill_device",
1605 .lname = "Fill device",
1607 .type = FIO_OPT_BOOL,
1608 .off1 = td_var_offset(fill_device),
1609 .help = "Write until an ENOSPC error occurs",
1611 .category = FIO_OPT_C_FILE,
1612 .group = FIO_OPT_G_INVALID,
1616 .lname = "File size",
1617 .type = FIO_OPT_STR_VAL,
1618 .off1 = td_var_offset(file_size_low),
1619 .off2 = td_var_offset(file_size_high),
1621 .help = "Size of individual files",
1622 .interval = 1024 * 1024,
1623 .category = FIO_OPT_C_FILE,
1624 .group = FIO_OPT_G_INVALID,
1627 .name = "file_append",
1628 .lname = "File append",
1629 .type = FIO_OPT_BOOL,
1630 .off1 = td_var_offset(file_append),
1631 .help = "IO will start at the end of the file(s)",
1633 .category = FIO_OPT_C_FILE,
1634 .group = FIO_OPT_G_INVALID,
1638 .lname = "IO offset",
1639 .alias = "fileoffset",
1640 .type = FIO_OPT_STR_VAL,
1641 .off1 = td_var_offset(start_offset),
1642 .help = "Start IO from this offset",
1644 .interval = 1024 * 1024,
1645 .category = FIO_OPT_C_IO,
1646 .group = FIO_OPT_G_INVALID,
1649 .name = "offset_increment",
1650 .lname = "IO offset increment",
1651 .type = FIO_OPT_STR_VAL,
1652 .off1 = td_var_offset(offset_increment),
1653 .help = "What is the increment from one offset to the next",
1657 .interval = 1024 * 1024,
1658 .category = FIO_OPT_C_IO,
1659 .group = FIO_OPT_G_INVALID,
1662 .name = "number_ios",
1663 .lname = "Number of IOs to perform",
1664 .type = FIO_OPT_STR_VAL,
1665 .off1 = td_var_offset(number_ios),
1666 .help = "Force job completion after this number of IOs",
1668 .category = FIO_OPT_C_IO,
1669 .group = FIO_OPT_G_INVALID,
1673 .lname = "Block size",
1674 .alias = "blocksize",
1675 .type = FIO_OPT_INT,
1676 .off1 = td_var_offset(bs[DDIR_READ]),
1677 .off2 = td_var_offset(bs[DDIR_WRITE]),
1678 .off3 = td_var_offset(bs[DDIR_TRIM]),
1680 .help = "Block size unit",
1685 .category = FIO_OPT_C_IO,
1686 .group = FIO_OPT_G_INVALID,
1690 .lname = "Block size align",
1691 .alias = "blockalign",
1692 .type = FIO_OPT_INT,
1693 .off1 = td_var_offset(ba[DDIR_READ]),
1694 .off2 = td_var_offset(ba[DDIR_WRITE]),
1695 .off3 = td_var_offset(ba[DDIR_TRIM]),
1697 .help = "IO block offset alignment",
1701 .category = FIO_OPT_C_IO,
1702 .group = FIO_OPT_G_INVALID,
1706 .lname = "Block size range",
1707 .alias = "blocksize_range",
1708 .type = FIO_OPT_RANGE,
1709 .off1 = td_var_offset(min_bs[DDIR_READ]),
1710 .off2 = td_var_offset(max_bs[DDIR_READ]),
1711 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1712 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1713 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1714 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1716 .help = "Set block size range (in more detail than bs)",
1720 .category = FIO_OPT_C_IO,
1721 .group = FIO_OPT_G_INVALID,
1725 .lname = "Block size split",
1726 .type = FIO_OPT_STR,
1727 .cb = str_bssplit_cb,
1728 .off1 = td_var_offset(bssplit),
1729 .help = "Set a specific mix of block sizes",
1732 .category = FIO_OPT_C_IO,
1733 .group = FIO_OPT_G_INVALID,
1736 .name = "bs_unaligned",
1737 .lname = "Block size unaligned",
1738 .alias = "blocksize_unaligned",
1739 .type = FIO_OPT_STR_SET,
1740 .off1 = td_var_offset(bs_unaligned),
1741 .help = "Don't sector align IO buffer sizes",
1744 .category = FIO_OPT_C_IO,
1745 .group = FIO_OPT_G_INVALID,
1748 .name = "bs_is_seq_rand",
1749 .lname = "Block size division is seq/random (not read/write)",
1750 .type = FIO_OPT_BOOL,
1751 .off1 = td_var_offset(bs_is_seq_rand),
1752 .help = "Consider any blocksize setting to be sequential,random",
1754 .parent = "blocksize",
1755 .category = FIO_OPT_C_IO,
1756 .group = FIO_OPT_G_INVALID,
1759 .name = "randrepeat",
1760 .lname = "Random repeatable",
1761 .type = FIO_OPT_BOOL,
1762 .off1 = td_var_offset(rand_repeatable),
1763 .help = "Use repeatable random IO pattern",
1767 .category = FIO_OPT_C_IO,
1768 .group = FIO_OPT_G_RANDOM,
1772 .lname = "The random generator seed",
1773 .type = FIO_OPT_STR_VAL,
1774 .off1 = td_var_offset(rand_seed),
1775 .help = "Set the random generator seed value",
1778 .category = FIO_OPT_C_IO,
1779 .group = FIO_OPT_G_RANDOM,
1782 .name = "use_os_rand",
1783 .lname = "Use OS random",
1784 .type = FIO_OPT_DEPRECATED,
1785 .off1 = td_var_offset(dep_use_os_rand),
1786 .category = FIO_OPT_C_IO,
1787 .group = FIO_OPT_G_RANDOM,
1790 .name = "norandommap",
1791 .lname = "No randommap",
1792 .type = FIO_OPT_STR_SET,
1793 .off1 = td_var_offset(norandommap),
1794 .help = "Accept potential duplicate random blocks",
1798 .category = FIO_OPT_C_IO,
1799 .group = FIO_OPT_G_RANDOM,
1802 .name = "softrandommap",
1803 .lname = "Soft randommap",
1804 .type = FIO_OPT_BOOL,
1805 .off1 = td_var_offset(softrandommap),
1806 .help = "Set norandommap if randommap allocation fails",
1807 .parent = "norandommap",
1810 .category = FIO_OPT_C_IO,
1811 .group = FIO_OPT_G_RANDOM,
1814 .name = "random_generator",
1815 .type = FIO_OPT_STR,
1816 .off1 = td_var_offset(random_generator),
1817 .help = "Type of random number generator to use",
1818 .def = "tausworthe",
1820 { .ival = "tausworthe",
1821 .oval = FIO_RAND_GEN_TAUSWORTHE,
1822 .help = "Strong Tausworthe generator",
1825 .oval = FIO_RAND_GEN_LFSR,
1826 .help = "Variable length LFSR",
1829 .ival = "tausworthe64",
1830 .oval = FIO_RAND_GEN_TAUSWORTHE64,
1831 .help = "64-bit Tausworthe variant",
1834 .category = FIO_OPT_C_IO,
1835 .group = FIO_OPT_G_RANDOM,
1838 .name = "random_distribution",
1839 .type = FIO_OPT_STR,
1840 .off1 = td_var_offset(random_distribution),
1841 .cb = str_random_distribution_cb,
1842 .help = "Random offset distribution generator",
1846 .oval = FIO_RAND_DIST_RANDOM,
1847 .help = "Completely random",
1850 .oval = FIO_RAND_DIST_ZIPF,
1851 .help = "Zipf distribution",
1854 .oval = FIO_RAND_DIST_PARETO,
1855 .help = "Pareto distribution",
1858 .oval = FIO_RAND_DIST_GAUSS,
1859 .help = "Normal (gaussian) distribution",
1862 .category = FIO_OPT_C_IO,
1863 .group = FIO_OPT_G_RANDOM,
1866 .name = "percentage_random",
1867 .lname = "Percentage Random",
1868 .type = FIO_OPT_INT,
1869 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1870 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1871 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1873 .help = "Percentage of seq/random mix that should be random",
1874 .def = "100,100,100",
1876 .inverse = "percentage_sequential",
1877 .category = FIO_OPT_C_IO,
1878 .group = FIO_OPT_G_RANDOM,
1881 .name = "percentage_sequential",
1882 .lname = "Percentage Sequential",
1883 .type = FIO_OPT_DEPRECATED,
1884 .category = FIO_OPT_C_IO,
1885 .group = FIO_OPT_G_RANDOM,
1888 .name = "allrandrepeat",
1889 .type = FIO_OPT_BOOL,
1890 .off1 = td_var_offset(allrand_repeatable),
1891 .help = "Use repeatable random numbers for everything",
1893 .category = FIO_OPT_C_IO,
1894 .group = FIO_OPT_G_RANDOM,
1898 .lname = "Number of files",
1899 .alias = "nr_files",
1900 .type = FIO_OPT_INT,
1901 .off1 = td_var_offset(nr_files),
1902 .help = "Split job workload between this number of files",
1905 .category = FIO_OPT_C_FILE,
1906 .group = FIO_OPT_G_INVALID,
1909 .name = "openfiles",
1910 .lname = "Number of open files",
1911 .type = FIO_OPT_INT,
1912 .off1 = td_var_offset(open_files),
1913 .help = "Number of files to keep open at the same time",
1914 .category = FIO_OPT_C_FILE,
1915 .group = FIO_OPT_G_INVALID,
1918 .name = "file_service_type",
1919 .lname = "File service type",
1920 .type = FIO_OPT_STR,
1922 .off1 = td_var_offset(file_service_type),
1923 .help = "How to select which file to service next",
1924 .def = "roundrobin",
1925 .category = FIO_OPT_C_FILE,
1926 .group = FIO_OPT_G_INVALID,
1929 .oval = FIO_FSERVICE_RANDOM,
1930 .help = "Choose a file at random",
1932 { .ival = "roundrobin",
1933 .oval = FIO_FSERVICE_RR,
1934 .help = "Round robin select files",
1936 { .ival = "sequential",
1937 .oval = FIO_FSERVICE_SEQ,
1938 .help = "Finish one file before moving to the next",
1941 .parent = "nrfiles",
1944 #ifdef CONFIG_POSIX_FALLOCATE
1946 .name = "fallocate",
1947 .lname = "Fallocate",
1948 .type = FIO_OPT_STR,
1949 .off1 = td_var_offset(fallocate_mode),
1950 .help = "Whether pre-allocation is performed when laying out files",
1952 .category = FIO_OPT_C_FILE,
1953 .group = FIO_OPT_G_INVALID,
1956 .oval = FIO_FALLOCATE_NONE,
1957 .help = "Do not pre-allocate space",
1960 .oval = FIO_FALLOCATE_POSIX,
1961 .help = "Use posix_fallocate()",
1963 #ifdef CONFIG_LINUX_FALLOCATE
1965 .oval = FIO_FALLOCATE_KEEP_SIZE,
1966 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1969 /* Compatibility with former boolean values */
1971 .oval = FIO_FALLOCATE_NONE,
1972 .help = "Alias for 'none'",
1975 .oval = FIO_FALLOCATE_POSIX,
1976 .help = "Alias for 'posix'",
1980 #endif /* CONFIG_POSIX_FALLOCATE */
1982 .name = "fadvise_hint",
1983 .lname = "Fadvise hint",
1984 .type = FIO_OPT_BOOL,
1985 .off1 = td_var_offset(fadvise_hint),
1986 .help = "Use fadvise() to advise the kernel on IO pattern",
1988 .category = FIO_OPT_C_FILE,
1989 .group = FIO_OPT_G_INVALID,
1991 #ifdef FIO_HAVE_STREAMID
1993 .name = "fadvise_stream",
1994 .lname = "Fadvise stream",
1995 .type = FIO_OPT_INT,
1996 .off1 = td_var_offset(fadvise_stream),
1997 .help = "Use fadvise() to set stream ID",
1998 .category = FIO_OPT_C_FILE,
1999 .group = FIO_OPT_G_INVALID,
2005 .type = FIO_OPT_INT,
2006 .off1 = td_var_offset(fsync_blocks),
2007 .help = "Issue fsync for writes every given number of blocks",
2010 .category = FIO_OPT_C_FILE,
2011 .group = FIO_OPT_G_INVALID,
2014 .name = "fdatasync",
2015 .lname = "Fdatasync",
2016 .type = FIO_OPT_INT,
2017 .off1 = td_var_offset(fdatasync_blocks),
2018 .help = "Issue fdatasync for writes every given number of blocks",
2021 .category = FIO_OPT_C_FILE,
2022 .group = FIO_OPT_G_INVALID,
2025 .name = "write_barrier",
2026 .lname = "Write barrier",
2027 .type = FIO_OPT_INT,
2028 .off1 = td_var_offset(barrier_blocks),
2029 .help = "Make every Nth write a barrier write",
2032 .category = FIO_OPT_C_IO,
2033 .group = FIO_OPT_G_INVALID,
2035 #ifdef CONFIG_SYNC_FILE_RANGE
2037 .name = "sync_file_range",
2038 .lname = "Sync file range",
2040 { .ival = "wait_before",
2041 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2042 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2046 .oval = SYNC_FILE_RANGE_WRITE,
2047 .help = "SYNC_FILE_RANGE_WRITE",
2051 .ival = "wait_after",
2052 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2053 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2057 .type = FIO_OPT_STR_MULTI,
2059 .off1 = td_var_offset(sync_file_range),
2060 .help = "Use sync_file_range()",
2061 .category = FIO_OPT_C_FILE,
2062 .group = FIO_OPT_G_INVALID,
2067 .lname = "Direct I/O",
2068 .type = FIO_OPT_BOOL,
2069 .off1 = td_var_offset(odirect),
2070 .help = "Use O_DIRECT IO (negates buffered)",
2072 .inverse = "buffered",
2073 .category = FIO_OPT_C_IO,
2074 .group = FIO_OPT_G_IO_TYPE,
2078 .lname = "Atomic I/O",
2079 .type = FIO_OPT_BOOL,
2080 .off1 = td_var_offset(oatomic),
2081 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2083 .category = FIO_OPT_C_IO,
2084 .group = FIO_OPT_G_IO_TYPE,
2088 .lname = "Buffered I/O",
2089 .type = FIO_OPT_BOOL,
2090 .off1 = td_var_offset(odirect),
2092 .help = "Use buffered IO (negates direct)",
2094 .inverse = "direct",
2095 .category = FIO_OPT_C_IO,
2096 .group = FIO_OPT_G_IO_TYPE,
2099 .name = "overwrite",
2100 .lname = "Overwrite",
2101 .type = FIO_OPT_BOOL,
2102 .off1 = td_var_offset(overwrite),
2103 .help = "When writing, set whether to overwrite current data",
2105 .category = FIO_OPT_C_FILE,
2106 .group = FIO_OPT_G_INVALID,
2111 .type = FIO_OPT_INT,
2112 .off1 = td_var_offset(loops),
2113 .help = "Number of times to run the job",
2116 .category = FIO_OPT_C_GENERAL,
2117 .group = FIO_OPT_G_RUNTIME,
2121 .lname = "Number of jobs",
2122 .type = FIO_OPT_INT,
2123 .off1 = td_var_offset(numjobs),
2124 .help = "Duplicate this job this many times",
2127 .category = FIO_OPT_C_GENERAL,
2128 .group = FIO_OPT_G_RUNTIME,
2131 .name = "startdelay",
2132 .lname = "Start delay",
2133 .type = FIO_OPT_STR_VAL_TIME,
2134 .off1 = td_var_offset(start_delay),
2135 .off2 = td_var_offset(start_delay_high),
2136 .help = "Only start job when this period has passed",
2140 .category = FIO_OPT_C_GENERAL,
2141 .group = FIO_OPT_G_RUNTIME,
2147 .type = FIO_OPT_STR_VAL_TIME,
2148 .off1 = td_var_offset(timeout),
2149 .help = "Stop workload when this amount of time has passed",
2153 .category = FIO_OPT_C_GENERAL,
2154 .group = FIO_OPT_G_RUNTIME,
2157 .name = "time_based",
2158 .lname = "Time based",
2159 .type = FIO_OPT_STR_SET,
2160 .off1 = td_var_offset(time_based),
2161 .help = "Keep running until runtime/timeout is met",
2162 .category = FIO_OPT_C_GENERAL,
2163 .group = FIO_OPT_G_RUNTIME,
2166 .name = "verify_only",
2167 .lname = "Verify only",
2168 .type = FIO_OPT_STR_SET,
2169 .off1 = td_var_offset(verify_only),
2170 .help = "Verifies previously written data is still valid",
2171 .category = FIO_OPT_C_GENERAL,
2172 .group = FIO_OPT_G_RUNTIME,
2175 .name = "ramp_time",
2176 .lname = "Ramp time",
2177 .type = FIO_OPT_STR_VAL_TIME,
2178 .off1 = td_var_offset(ramp_time),
2179 .help = "Ramp up time before measuring performance",
2182 .category = FIO_OPT_C_GENERAL,
2183 .group = FIO_OPT_G_RUNTIME,
2186 .name = "clocksource",
2187 .lname = "Clock source",
2188 .type = FIO_OPT_STR,
2189 .cb = fio_clock_source_cb,
2190 .off1 = td_var_offset(clocksource),
2191 .help = "What type of timing source to use",
2192 .category = FIO_OPT_C_GENERAL,
2193 .group = FIO_OPT_G_CLOCK,
2195 #ifdef CONFIG_GETTIMEOFDAY
2196 { .ival = "gettimeofday",
2198 .help = "Use gettimeofday(2) for timing",
2201 #ifdef CONFIG_CLOCK_GETTIME
2202 { .ival = "clock_gettime",
2203 .oval = CS_CGETTIME,
2204 .help = "Use clock_gettime(2) for timing",
2207 #ifdef ARCH_HAVE_CPU_CLOCK
2209 .oval = CS_CPUCLOCK,
2210 .help = "Use CPU private clock",
2218 .lname = "I/O Memory",
2219 .type = FIO_OPT_STR,
2221 .off1 = td_var_offset(mem_type),
2222 .help = "Backing type for IO buffers",
2224 .category = FIO_OPT_C_IO,
2225 .group = FIO_OPT_G_INVALID,
2229 .help = "Use malloc(3) for IO buffers",
2231 #ifndef CONFIG_NO_SHM
2234 .help = "Use shared memory segments for IO buffers",
2236 #ifdef FIO_HAVE_HUGETLB
2237 { .ival = "shmhuge",
2238 .oval = MEM_SHMHUGE,
2239 .help = "Like shm, but use huge pages",
2245 .help = "Use mmap(2) (file or anon) for IO buffers",
2247 { .ival = "mmapshared",
2248 .oval = MEM_MMAPSHARED,
2249 .help = "Like mmap, but use the shared flag",
2251 #ifdef FIO_HAVE_HUGETLB
2252 { .ival = "mmaphuge",
2253 .oval = MEM_MMAPHUGE,
2254 .help = "Like mmap, but use huge pages",
2260 .name = "iomem_align",
2261 .alias = "mem_align",
2262 .lname = "I/O memory alignment",
2263 .type = FIO_OPT_INT,
2264 .off1 = td_var_offset(mem_align),
2266 .help = "IO memory buffer offset alignment",
2270 .category = FIO_OPT_C_IO,
2271 .group = FIO_OPT_G_INVALID,
2276 .type = FIO_OPT_STR,
2277 .off1 = td_var_offset(verify),
2278 .help = "Verify data written",
2280 .category = FIO_OPT_C_IO,
2281 .group = FIO_OPT_G_VERIFY,
2284 .oval = VERIFY_NONE,
2285 .help = "Don't do IO verification",
2289 .help = "Use md5 checksums for verification",
2292 .oval = VERIFY_CRC64,
2293 .help = "Use crc64 checksums for verification",
2296 .oval = VERIFY_CRC32,
2297 .help = "Use crc32 checksums for verification",
2299 { .ival = "crc32c-intel",
2300 .oval = VERIFY_CRC32C,
2301 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2304 .oval = VERIFY_CRC32C,
2305 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2308 .oval = VERIFY_CRC16,
2309 .help = "Use crc16 checksums for verification",
2312 .oval = VERIFY_CRC7,
2313 .help = "Use crc7 checksums for verification",
2316 .oval = VERIFY_SHA1,
2317 .help = "Use sha1 checksums for verification",
2320 .oval = VERIFY_SHA256,
2321 .help = "Use sha256 checksums for verification",
2324 .oval = VERIFY_SHA512,
2325 .help = "Use sha512 checksums for verification",
2328 .oval = VERIFY_XXHASH,
2329 .help = "Use xxhash checksums for verification",
2331 /* Meta information was included into verify_header,
2332 * 'meta' verification is implied by default. */
2334 .oval = VERIFY_HDR_ONLY,
2335 .help = "Use io information for verification. "
2336 "Now is implied by default, thus option is obsolete, "
2339 { .ival = "pattern",
2340 .oval = VERIFY_PATTERN_NO_HDR,
2341 .help = "Verify strict pattern",
2345 .oval = VERIFY_NULL,
2346 .help = "Pretend to verify",
2351 .name = "do_verify",
2352 .lname = "Perform verify step",
2353 .type = FIO_OPT_BOOL,
2354 .off1 = td_var_offset(do_verify),
2355 .help = "Run verification stage after write",
2359 .category = FIO_OPT_C_IO,
2360 .group = FIO_OPT_G_VERIFY,
2363 .name = "verifysort",
2364 .lname = "Verify sort",
2365 .type = FIO_OPT_BOOL,
2366 .off1 = td_var_offset(verifysort),
2367 .help = "Sort written verify blocks for read back",
2371 .category = FIO_OPT_C_IO,
2372 .group = FIO_OPT_G_VERIFY,
2375 .name = "verifysort_nr",
2376 .type = FIO_OPT_INT,
2377 .off1 = td_var_offset(verifysort_nr),
2378 .help = "Pre-load and sort verify blocks for a read workload",
2383 .category = FIO_OPT_C_IO,
2384 .group = FIO_OPT_G_VERIFY,
2387 .name = "verify_interval",
2388 .lname = "Verify interval",
2389 .type = FIO_OPT_INT,
2390 .off1 = td_var_offset(verify_interval),
2391 .minval = 2 * sizeof(struct verify_header),
2392 .help = "Store verify buffer header every N bytes",
2395 .interval = 2 * sizeof(struct verify_header),
2396 .category = FIO_OPT_C_IO,
2397 .group = FIO_OPT_G_VERIFY,
2400 .name = "verify_offset",
2401 .lname = "Verify offset",
2402 .type = FIO_OPT_INT,
2403 .help = "Offset verify header location by N bytes",
2404 .off1 = td_var_offset(verify_offset),
2405 .minval = sizeof(struct verify_header),
2408 .category = FIO_OPT_C_IO,
2409 .group = FIO_OPT_G_VERIFY,
2412 .name = "verify_pattern",
2413 .lname = "Verify pattern",
2414 .type = FIO_OPT_STR,
2415 .cb = str_verify_pattern_cb,
2416 .off1 = td_var_offset(verify_pattern),
2417 .help = "Fill pattern for IO buffers",
2420 .category = FIO_OPT_C_IO,
2421 .group = FIO_OPT_G_VERIFY,
2424 .name = "verify_fatal",
2425 .lname = "Verify fatal",
2426 .type = FIO_OPT_BOOL,
2427 .off1 = td_var_offset(verify_fatal),
2429 .help = "Exit on a single verify failure, don't continue",
2432 .category = FIO_OPT_C_IO,
2433 .group = FIO_OPT_G_VERIFY,
2436 .name = "verify_dump",
2437 .lname = "Verify dump",
2438 .type = FIO_OPT_BOOL,
2439 .off1 = td_var_offset(verify_dump),
2441 .help = "Dump contents of good and bad blocks on failure",
2444 .category = FIO_OPT_C_IO,
2445 .group = FIO_OPT_G_VERIFY,
2448 .name = "verify_async",
2449 .lname = "Verify asynchronously",
2450 .type = FIO_OPT_INT,
2451 .off1 = td_var_offset(verify_async),
2453 .help = "Number of async verifier threads to use",
2456 .category = FIO_OPT_C_IO,
2457 .group = FIO_OPT_G_VERIFY,
2460 .name = "verify_backlog",
2461 .lname = "Verify backlog",
2462 .type = FIO_OPT_STR_VAL,
2463 .off1 = td_var_offset(verify_backlog),
2464 .help = "Verify after this number of blocks are written",
2467 .category = FIO_OPT_C_IO,
2468 .group = FIO_OPT_G_VERIFY,
2471 .name = "verify_backlog_batch",
2472 .lname = "Verify backlog batch",
2473 .type = FIO_OPT_INT,
2474 .off1 = td_var_offset(verify_batch),
2475 .help = "Verify this number of IO blocks",
2478 .category = FIO_OPT_C_IO,
2479 .group = FIO_OPT_G_VERIFY,
2481 #ifdef FIO_HAVE_CPU_AFFINITY
2483 .name = "verify_async_cpus",
2484 .lname = "Async verify CPUs",
2485 .type = FIO_OPT_STR,
2486 .cb = str_verify_cpus_allowed_cb,
2487 .off1 = td_var_offset(verify_cpumask),
2488 .help = "Set CPUs allowed for async verify threads",
2489 .parent = "verify_async",
2491 .category = FIO_OPT_C_IO,
2492 .group = FIO_OPT_G_VERIFY,
2496 .name = "experimental_verify",
2497 .off1 = td_var_offset(experimental_verify),
2498 .type = FIO_OPT_BOOL,
2499 .help = "Enable experimental verification",
2501 .category = FIO_OPT_C_IO,
2502 .group = FIO_OPT_G_VERIFY,
2505 .name = "verify_state_load",
2506 .lname = "Load verify state",
2507 .off1 = td_var_offset(verify_state),
2508 .type = FIO_OPT_BOOL,
2509 .help = "Load verify termination state",
2511 .category = FIO_OPT_C_IO,
2512 .group = FIO_OPT_G_VERIFY,
2515 .name = "verify_state_save",
2516 .lname = "Save verify state",
2517 .off1 = td_var_offset(verify_state_save),
2518 .type = FIO_OPT_BOOL,
2520 .help = "Save verify state on termination",
2522 .category = FIO_OPT_C_IO,
2523 .group = FIO_OPT_G_VERIFY,
2525 #ifdef FIO_HAVE_TRIM
2527 .name = "trim_percentage",
2528 .lname = "Trim percentage",
2529 .type = FIO_OPT_INT,
2530 .off1 = td_var_offset(trim_percentage),
2533 .help = "Number of verify blocks to discard/trim",
2538 .category = FIO_OPT_C_IO,
2539 .group = FIO_OPT_G_TRIM,
2542 .name = "trim_verify_zero",
2543 .lname = "Verify trim zero",
2544 .type = FIO_OPT_BOOL,
2545 .help = "Verify that trim/discarded blocks are returned as zeroes",
2546 .off1 = td_var_offset(trim_zero),
2547 .parent = "trim_percentage",
2550 .category = FIO_OPT_C_IO,
2551 .group = FIO_OPT_G_TRIM,
2554 .name = "trim_backlog",
2555 .lname = "Trim backlog",
2556 .type = FIO_OPT_STR_VAL,
2557 .off1 = td_var_offset(trim_backlog),
2558 .help = "Trim after this number of blocks are written",
2559 .parent = "trim_percentage",
2562 .category = FIO_OPT_C_IO,
2563 .group = FIO_OPT_G_TRIM,
2566 .name = "trim_backlog_batch",
2567 .lname = "Trim backlog batch",
2568 .type = FIO_OPT_INT,
2569 .off1 = td_var_offset(trim_batch),
2570 .help = "Trim this number of IO blocks",
2571 .parent = "trim_percentage",
2574 .category = FIO_OPT_C_IO,
2575 .group = FIO_OPT_G_TRIM,
2579 .name = "write_iolog",
2580 .lname = "Write I/O log",
2581 .type = FIO_OPT_STR_STORE,
2582 .off1 = td_var_offset(write_iolog_file),
2583 .help = "Store IO pattern to file",
2584 .category = FIO_OPT_C_IO,
2585 .group = FIO_OPT_G_IOLOG,
2588 .name = "read_iolog",
2589 .lname = "Read I/O log",
2590 .type = FIO_OPT_STR_STORE,
2591 .off1 = td_var_offset(read_iolog_file),
2592 .help = "Playback IO pattern from file",
2593 .category = FIO_OPT_C_IO,
2594 .group = FIO_OPT_G_IOLOG,
2597 .name = "replay_no_stall",
2598 .lname = "Don't stall on replay",
2599 .type = FIO_OPT_BOOL,
2600 .off1 = td_var_offset(no_stall),
2602 .parent = "read_iolog",
2604 .help = "Playback IO pattern file as fast as possible without stalls",
2605 .category = FIO_OPT_C_IO,
2606 .group = FIO_OPT_G_IOLOG,
2609 .name = "replay_redirect",
2610 .lname = "Redirect device for replay",
2611 .type = FIO_OPT_STR_STORE,
2612 .off1 = td_var_offset(replay_redirect),
2613 .parent = "read_iolog",
2615 .help = "Replay all I/O onto this device, regardless of trace device",
2616 .category = FIO_OPT_C_IO,
2617 .group = FIO_OPT_G_IOLOG,
2620 .name = "replay_scale",
2621 .lname = "Replace offset scale factor",
2622 .type = FIO_OPT_INT,
2623 .off1 = td_var_offset(replay_scale),
2624 .parent = "read_iolog",
2626 .help = "Align offsets to this blocksize",
2627 .category = FIO_OPT_C_IO,
2628 .group = FIO_OPT_G_IOLOG,
2631 .name = "replay_align",
2632 .lname = "Replace alignment",
2633 .type = FIO_OPT_INT,
2634 .off1 = td_var_offset(replay_align),
2635 .parent = "read_iolog",
2636 .help = "Scale offset down by this factor",
2637 .category = FIO_OPT_C_IO,
2638 .group = FIO_OPT_G_IOLOG,
2642 .name = "exec_prerun",
2643 .lname = "Pre-execute runnable",
2644 .type = FIO_OPT_STR_STORE,
2645 .off1 = td_var_offset(exec_prerun),
2646 .help = "Execute this file prior to running job",
2647 .category = FIO_OPT_C_GENERAL,
2648 .group = FIO_OPT_G_INVALID,
2651 .name = "exec_postrun",
2652 .lname = "Post-execute runnable",
2653 .type = FIO_OPT_STR_STORE,
2654 .off1 = td_var_offset(exec_postrun),
2655 .help = "Execute this file after running job",
2656 .category = FIO_OPT_C_GENERAL,
2657 .group = FIO_OPT_G_INVALID,
2659 #ifdef FIO_HAVE_IOSCHED_SWITCH
2661 .name = "ioscheduler",
2662 .lname = "I/O scheduler",
2663 .type = FIO_OPT_STR_STORE,
2664 .off1 = td_var_offset(ioscheduler),
2665 .help = "Use this IO scheduler on the backing device",
2666 .category = FIO_OPT_C_FILE,
2667 .group = FIO_OPT_G_INVALID,
2672 .lname = "Zone size",
2673 .type = FIO_OPT_STR_VAL,
2674 .off1 = td_var_offset(zone_size),
2675 .help = "Amount of data to read per zone",
2677 .interval = 1024 * 1024,
2678 .category = FIO_OPT_C_IO,
2679 .group = FIO_OPT_G_ZONE,
2682 .name = "zonerange",
2683 .lname = "Zone range",
2684 .type = FIO_OPT_STR_VAL,
2685 .off1 = td_var_offset(zone_range),
2686 .help = "Give size of an IO zone",
2688 .interval = 1024 * 1024,
2689 .category = FIO_OPT_C_IO,
2690 .group = FIO_OPT_G_ZONE,
2694 .lname = "Zone skip",
2695 .type = FIO_OPT_STR_VAL,
2696 .off1 = td_var_offset(zone_skip),
2697 .help = "Space between IO zones",
2699 .interval = 1024 * 1024,
2700 .category = FIO_OPT_C_IO,
2701 .group = FIO_OPT_G_ZONE,
2705 .lname = "Lock memory",
2706 .type = FIO_OPT_STR_VAL,
2707 .off1 = td_var_offset(lockmem),
2708 .help = "Lock down this amount of memory (per worker)",
2710 .interval = 1024 * 1024,
2711 .category = FIO_OPT_C_GENERAL,
2712 .group = FIO_OPT_G_INVALID,
2715 .name = "rwmixread",
2716 .lname = "Read/write mix read",
2717 .type = FIO_OPT_INT,
2718 .cb = str_rwmix_read_cb,
2719 .off1 = td_var_offset(rwmix[DDIR_READ]),
2721 .help = "Percentage of mixed workload that is reads",
2724 .inverse = "rwmixwrite",
2725 .category = FIO_OPT_C_IO,
2726 .group = FIO_OPT_G_RWMIX,
2729 .name = "rwmixwrite",
2730 .lname = "Read/write mix write",
2731 .type = FIO_OPT_INT,
2732 .cb = str_rwmix_write_cb,
2733 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
2735 .help = "Percentage of mixed workload that is writes",
2738 .inverse = "rwmixread",
2739 .category = FIO_OPT_C_IO,
2740 .group = FIO_OPT_G_RWMIX,
2743 .name = "rwmixcycle",
2744 .lname = "Read/write mix cycle",
2745 .type = FIO_OPT_DEPRECATED,
2746 .category = FIO_OPT_C_IO,
2747 .group = FIO_OPT_G_RWMIX,
2752 .type = FIO_OPT_INT,
2753 .off1 = td_var_offset(nice),
2754 .help = "Set job CPU nice value",
2759 .category = FIO_OPT_C_GENERAL,
2760 .group = FIO_OPT_G_CRED,
2762 #ifdef FIO_HAVE_IOPRIO
2765 .lname = "I/O nice priority",
2766 .type = FIO_OPT_INT,
2767 .off1 = td_var_offset(ioprio),
2768 .help = "Set job IO priority value",
2772 .category = FIO_OPT_C_GENERAL,
2773 .group = FIO_OPT_G_CRED,
2776 .name = "prioclass",
2777 .lname = "I/O nice priority class",
2778 .type = FIO_OPT_INT,
2779 .off1 = td_var_offset(ioprio_class),
2780 .help = "Set job IO priority class",
2784 .category = FIO_OPT_C_GENERAL,
2785 .group = FIO_OPT_G_CRED,
2789 .name = "thinktime",
2790 .lname = "Thinktime",
2791 .type = FIO_OPT_INT,
2792 .off1 = td_var_offset(thinktime),
2793 .help = "Idle time between IO buffers (usec)",
2796 .category = FIO_OPT_C_IO,
2797 .group = FIO_OPT_G_THINKTIME,
2800 .name = "thinktime_spin",
2801 .lname = "Thinktime spin",
2802 .type = FIO_OPT_INT,
2803 .off1 = td_var_offset(thinktime_spin),
2804 .help = "Start think time by spinning this amount (usec)",
2807 .parent = "thinktime",
2809 .category = FIO_OPT_C_IO,
2810 .group = FIO_OPT_G_THINKTIME,
2813 .name = "thinktime_blocks",
2814 .lname = "Thinktime blocks",
2815 .type = FIO_OPT_INT,
2816 .off1 = td_var_offset(thinktime_blocks),
2817 .help = "IO buffer period between 'thinktime'",
2819 .parent = "thinktime",
2821 .category = FIO_OPT_C_IO,
2822 .group = FIO_OPT_G_THINKTIME,
2826 .lname = "I/O rate",
2827 .type = FIO_OPT_INT,
2828 .off1 = td_var_offset(rate[DDIR_READ]),
2829 .off2 = td_var_offset(rate[DDIR_WRITE]),
2830 .off3 = td_var_offset(rate[DDIR_TRIM]),
2831 .help = "Set bandwidth rate",
2832 .category = FIO_OPT_C_IO,
2833 .group = FIO_OPT_G_RATE,
2838 .lname = "I/O min rate",
2839 .type = FIO_OPT_INT,
2840 .off1 = td_var_offset(ratemin[DDIR_READ]),
2841 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2842 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2843 .help = "Job must meet this rate or it will be shutdown",
2846 .category = FIO_OPT_C_IO,
2847 .group = FIO_OPT_G_RATE,
2850 .name = "rate_iops",
2851 .lname = "I/O rate IOPS",
2852 .type = FIO_OPT_INT,
2853 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2854 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2855 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2856 .help = "Limit IO used to this number of IO operations/sec",
2858 .category = FIO_OPT_C_IO,
2859 .group = FIO_OPT_G_RATE,
2862 .name = "rate_iops_min",
2863 .lname = "I/O min rate IOPS",
2864 .type = FIO_OPT_INT,
2865 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2866 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2867 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2868 .help = "Job must meet this rate or it will be shut down",
2869 .parent = "rate_iops",
2871 .category = FIO_OPT_C_IO,
2872 .group = FIO_OPT_G_RATE,
2875 .name = "rate_process",
2876 .lname = "Rate Process",
2877 .type = FIO_OPT_STR,
2878 .off1 = td_var_offset(rate_process),
2879 .help = "What process controls how rated IO is managed",
2881 .category = FIO_OPT_C_IO,
2882 .group = FIO_OPT_G_RATE,
2885 .oval = RATE_PROCESS_LINEAR,
2886 .help = "Linear rate of IO",
2890 .oval = RATE_PROCESS_POISSON,
2891 .help = "Rate follows Poisson process",
2897 .name = "rate_cycle",
2898 .alias = "ratecycle",
2899 .lname = "I/O rate cycle",
2900 .type = FIO_OPT_INT,
2901 .off1 = td_var_offset(ratecycle),
2902 .help = "Window average for rate limits (msec)",
2906 .category = FIO_OPT_C_IO,
2907 .group = FIO_OPT_G_RATE,
2910 .name = "max_latency",
2911 .type = FIO_OPT_INT,
2912 .off1 = td_var_offset(max_latency),
2913 .help = "Maximum tolerated IO latency (usec)",
2915 .category = FIO_OPT_C_IO,
2916 .group = FIO_OPT_G_LATPROF,
2919 .name = "latency_target",
2920 .lname = "Latency Target (usec)",
2921 .type = FIO_OPT_STR_VAL_TIME,
2922 .off1 = td_var_offset(latency_target),
2923 .help = "Ramp to max queue depth supporting this latency",
2925 .category = FIO_OPT_C_IO,
2926 .group = FIO_OPT_G_LATPROF,
2929 .name = "latency_window",
2930 .lname = "Latency Window (usec)",
2931 .type = FIO_OPT_STR_VAL_TIME,
2932 .off1 = td_var_offset(latency_window),
2933 .help = "Time to sustain latency_target",
2935 .category = FIO_OPT_C_IO,
2936 .group = FIO_OPT_G_LATPROF,
2939 .name = "latency_percentile",
2940 .lname = "Latency Percentile",
2941 .type = FIO_OPT_FLOAT_LIST,
2942 .off1 = td_var_offset(latency_percentile),
2943 .help = "Percentile of IOs must be below latency_target",
2948 .category = FIO_OPT_C_IO,
2949 .group = FIO_OPT_G_LATPROF,
2952 .name = "invalidate",
2953 .lname = "Cache invalidate",
2954 .type = FIO_OPT_BOOL,
2955 .off1 = td_var_offset(invalidate_cache),
2956 .help = "Invalidate buffer/page cache prior to running job",
2958 .category = FIO_OPT_C_IO,
2959 .group = FIO_OPT_G_IO_TYPE,
2963 .lname = "Synchronous I/O",
2964 .type = FIO_OPT_BOOL,
2965 .off1 = td_var_offset(sync_io),
2966 .help = "Use O_SYNC for buffered writes",
2968 .parent = "buffered",
2970 .category = FIO_OPT_C_IO,
2971 .group = FIO_OPT_G_IO_TYPE,
2974 .name = "create_serialize",
2975 .lname = "Create serialize",
2976 .type = FIO_OPT_BOOL,
2977 .off1 = td_var_offset(create_serialize),
2978 .help = "Serialize creating of job files",
2980 .category = FIO_OPT_C_FILE,
2981 .group = FIO_OPT_G_INVALID,
2984 .name = "create_fsync",
2985 .lname = "Create fsync",
2986 .type = FIO_OPT_BOOL,
2987 .off1 = td_var_offset(create_fsync),
2988 .help = "fsync file after creation",
2990 .category = FIO_OPT_C_FILE,
2991 .group = FIO_OPT_G_INVALID,
2994 .name = "create_on_open",
2995 .lname = "Create on open",
2996 .type = FIO_OPT_BOOL,
2997 .off1 = td_var_offset(create_on_open),
2998 .help = "Create files when they are opened for IO",
3000 .category = FIO_OPT_C_FILE,
3001 .group = FIO_OPT_G_INVALID,
3004 .name = "create_only",
3005 .type = FIO_OPT_BOOL,
3006 .off1 = td_var_offset(create_only),
3007 .help = "Only perform file creation phase",
3008 .category = FIO_OPT_C_FILE,
3012 .name = "allow_file_create",
3013 .lname = "Allow file create",
3014 .type = FIO_OPT_BOOL,
3015 .off1 = td_var_offset(allow_create),
3016 .help = "Permit fio to create files, if they don't exist",
3018 .category = FIO_OPT_C_FILE,
3019 .group = FIO_OPT_G_FILENAME,
3022 .name = "allow_mounted_write",
3023 .lname = "Allow mounted write",
3024 .type = FIO_OPT_BOOL,
3025 .off1 = td_var_offset(allow_mounted_write),
3026 .help = "Allow writes to a mounted partition",
3028 .category = FIO_OPT_C_FILE,
3029 .group = FIO_OPT_G_FILENAME,
3033 .lname = "Pre-read files",
3034 .type = FIO_OPT_BOOL,
3035 .off1 = td_var_offset(pre_read),
3036 .help = "Pre-read files before starting official testing",
3038 .category = FIO_OPT_C_FILE,
3039 .group = FIO_OPT_G_INVALID,
3041 #ifdef FIO_HAVE_CPU_AFFINITY
3044 .lname = "CPU mask",
3045 .type = FIO_OPT_INT,
3046 .cb = str_cpumask_cb,
3047 .off1 = td_var_offset(cpumask),
3048 .help = "CPU affinity mask",
3049 .category = FIO_OPT_C_GENERAL,
3050 .group = FIO_OPT_G_CRED,
3053 .name = "cpus_allowed",
3054 .lname = "CPUs allowed",
3055 .type = FIO_OPT_STR,
3056 .cb = str_cpus_allowed_cb,
3057 .off1 = td_var_offset(cpumask),
3058 .help = "Set CPUs allowed",
3059 .category = FIO_OPT_C_GENERAL,
3060 .group = FIO_OPT_G_CRED,
3063 .name = "cpus_allowed_policy",
3064 .lname = "CPUs allowed distribution policy",
3065 .type = FIO_OPT_STR,
3066 .off1 = td_var_offset(cpus_allowed_policy),
3067 .help = "Distribution policy for cpus_allowed",
3068 .parent = "cpus_allowed",
3072 .oval = FIO_CPUS_SHARED,
3073 .help = "Mask shared between threads",
3076 .oval = FIO_CPUS_SPLIT,
3077 .help = "Mask split between threads",
3080 .category = FIO_OPT_C_GENERAL,
3081 .group = FIO_OPT_G_CRED,
3084 #ifdef CONFIG_LIBNUMA
3086 .name = "numa_cpu_nodes",
3087 .type = FIO_OPT_STR,
3088 .cb = str_numa_cpunodes_cb,
3089 .off1 = td_var_offset(numa_cpunodes),
3090 .help = "NUMA CPU nodes bind",
3091 .category = FIO_OPT_C_GENERAL,
3092 .group = FIO_OPT_G_INVALID,
3095 .name = "numa_mem_policy",
3096 .type = FIO_OPT_STR,
3097 .cb = str_numa_mpol_cb,
3098 .off1 = td_var_offset(numa_memnodes),
3099 .help = "NUMA memory policy setup",
3100 .category = FIO_OPT_C_GENERAL,
3101 .group = FIO_OPT_G_INVALID,
3105 .name = "end_fsync",
3106 .lname = "End fsync",
3107 .type = FIO_OPT_BOOL,
3108 .off1 = td_var_offset(end_fsync),
3109 .help = "Include fsync at the end of job",
3111 .category = FIO_OPT_C_FILE,
3112 .group = FIO_OPT_G_INVALID,
3115 .name = "fsync_on_close",
3116 .lname = "Fsync on close",
3117 .type = FIO_OPT_BOOL,
3118 .off1 = td_var_offset(fsync_on_close),
3119 .help = "fsync files on close",
3121 .category = FIO_OPT_C_FILE,
3122 .group = FIO_OPT_G_INVALID,
3126 .lname = "Unlink file",
3127 .type = FIO_OPT_BOOL,
3128 .off1 = td_var_offset(unlink),
3129 .help = "Unlink created files after job has completed",
3131 .category = FIO_OPT_C_FILE,
3132 .group = FIO_OPT_G_INVALID,
3136 .lname = "Exit-all on terminate",
3137 .type = FIO_OPT_STR_SET,
3138 .cb = str_exitall_cb,
3139 .help = "Terminate all jobs when one exits",
3140 .category = FIO_OPT_C_GENERAL,
3141 .group = FIO_OPT_G_PROCESS,
3144 .name = "stonewall",
3145 .lname = "Wait for previous",
3146 .alias = "wait_for_previous",
3147 .type = FIO_OPT_STR_SET,
3148 .off1 = td_var_offset(stonewall),
3149 .help = "Insert a hard barrier between this job and previous",
3150 .category = FIO_OPT_C_GENERAL,
3151 .group = FIO_OPT_G_PROCESS,
3154 .name = "new_group",
3155 .lname = "New group",
3156 .type = FIO_OPT_STR_SET,
3157 .off1 = td_var_offset(new_group),
3158 .help = "Mark the start of a new group (for reporting)",
3159 .category = FIO_OPT_C_GENERAL,
3160 .group = FIO_OPT_G_PROCESS,
3165 .type = FIO_OPT_STR_SET,
3166 .off1 = td_var_offset(use_thread),
3167 .help = "Use threads instead of processes",
3168 #ifdef CONFIG_NO_SHM
3172 .category = FIO_OPT_C_GENERAL,
3173 .group = FIO_OPT_G_PROCESS,
3176 .name = "per_job_logs",
3177 .type = FIO_OPT_BOOL,
3178 .off1 = td_var_offset(per_job_logs),
3179 .help = "Include job number in generated log files or not",
3181 .category = FIO_OPT_C_LOG,
3182 .group = FIO_OPT_G_INVALID,
3185 .name = "write_bw_log",
3186 .lname = "Write bandwidth log",
3187 .type = FIO_OPT_STR_STORE,
3188 .off1 = td_var_offset(bw_log_file),
3189 .help = "Write log of bandwidth during run",
3190 .category = FIO_OPT_C_LOG,
3191 .group = FIO_OPT_G_INVALID,
3194 .name = "write_lat_log",
3195 .lname = "Write latency log",
3196 .type = FIO_OPT_STR_STORE,
3197 .off1 = td_var_offset(lat_log_file),
3198 .help = "Write log of latency during run",
3199 .category = FIO_OPT_C_LOG,
3200 .group = FIO_OPT_G_INVALID,
3203 .name = "write_iops_log",
3204 .lname = "Write IOPS log",
3205 .type = FIO_OPT_STR_STORE,
3206 .off1 = td_var_offset(iops_log_file),
3207 .help = "Write log of IOPS during run",
3208 .category = FIO_OPT_C_LOG,
3209 .group = FIO_OPT_G_INVALID,
3212 .name = "log_avg_msec",
3213 .lname = "Log averaging (msec)",
3214 .type = FIO_OPT_INT,
3215 .off1 = td_var_offset(log_avg_msec),
3216 .help = "Average bw/iops/lat logs over this period of time",
3218 .category = FIO_OPT_C_LOG,
3219 .group = FIO_OPT_G_INVALID,
3222 .name = "log_offset",
3223 .lname = "Log offset of IO",
3224 .type = FIO_OPT_BOOL,
3225 .off1 = td_var_offset(log_offset),
3226 .help = "Include offset of IO for each log entry",
3228 .category = FIO_OPT_C_LOG,
3229 .group = FIO_OPT_G_INVALID,
3233 .name = "log_compression",
3234 .lname = "Log compression",
3235 .type = FIO_OPT_INT,
3236 .off1 = td_var_offset(log_gz),
3237 .help = "Log in compressed chunks of this size",
3239 .maxval = 512 * 1024 * 1024ULL,
3240 .category = FIO_OPT_C_LOG,
3241 .group = FIO_OPT_G_INVALID,
3243 #ifdef FIO_HAVE_CPU_AFFINITY
3245 .name = "log_compression_cpus",
3246 .lname = "Log Compression CPUs",
3247 .type = FIO_OPT_STR,
3248 .cb = str_log_cpus_allowed_cb,
3249 .off1 = td_var_offset(log_gz_cpumask),
3250 .parent = "log_compression",
3251 .help = "Limit log compression to these CPUs",
3252 .category = FIO_OPT_C_LOG,
3253 .group = FIO_OPT_G_INVALID,
3257 .name = "log_store_compressed",
3258 .lname = "Log store compressed",
3259 .type = FIO_OPT_BOOL,
3260 .off1 = td_var_offset(log_gz_store),
3261 .help = "Store logs in a compressed format",
3262 .category = FIO_OPT_C_LOG,
3263 .group = FIO_OPT_G_INVALID,
3267 .name = "block_error_percentiles",
3268 .lname = "Block error percentiles",
3269 .type = FIO_OPT_BOOL,
3270 .off1 = td_var_offset(block_error_hist),
3271 .help = "Record trim block errors and make a histogram",
3273 .category = FIO_OPT_C_LOG,
3274 .group = FIO_OPT_G_INVALID,
3277 .name = "bwavgtime",
3278 .lname = "Bandwidth average time",
3279 .type = FIO_OPT_INT,
3280 .off1 = td_var_offset(bw_avg_time),
3281 .help = "Time window over which to calculate bandwidth"
3284 .parent = "write_bw_log",
3287 .category = FIO_OPT_C_LOG,
3288 .group = FIO_OPT_G_INVALID,
3291 .name = "iopsavgtime",
3292 .lname = "IOPS average time",
3293 .type = FIO_OPT_INT,
3294 .off1 = td_var_offset(iops_avg_time),
3295 .help = "Time window over which to calculate IOPS (msec)",
3297 .parent = "write_iops_log",
3300 .category = FIO_OPT_C_LOG,
3301 .group = FIO_OPT_G_INVALID,
3304 .name = "group_reporting",
3305 .lname = "Group reporting",
3306 .type = FIO_OPT_STR_SET,
3307 .off1 = td_var_offset(group_reporting),
3308 .help = "Do reporting on a per-group basis",
3309 .category = FIO_OPT_C_STAT,
3310 .group = FIO_OPT_G_INVALID,
3313 .name = "zero_buffers",
3314 .lname = "Zero I/O buffers",
3315 .type = FIO_OPT_STR_SET,
3316 .off1 = td_var_offset(zero_buffers),
3317 .help = "Init IO buffers to all zeroes",
3318 .category = FIO_OPT_C_IO,
3319 .group = FIO_OPT_G_IO_BUF,
3322 .name = "refill_buffers",
3323 .lname = "Refill I/O buffers",
3324 .type = FIO_OPT_STR_SET,
3325 .off1 = td_var_offset(refill_buffers),
3326 .help = "Refill IO buffers on every IO submit",
3327 .category = FIO_OPT_C_IO,
3328 .group = FIO_OPT_G_IO_BUF,
3331 .name = "scramble_buffers",
3332 .lname = "Scramble I/O buffers",
3333 .type = FIO_OPT_BOOL,
3334 .off1 = td_var_offset(scramble_buffers),
3335 .help = "Slightly scramble buffers on every IO submit",
3337 .category = FIO_OPT_C_IO,
3338 .group = FIO_OPT_G_IO_BUF,
3341 .name = "buffer_pattern",
3342 .lname = "Buffer pattern",
3343 .type = FIO_OPT_STR,
3344 .cb = str_buffer_pattern_cb,
3345 .off1 = td_var_offset(buffer_pattern),
3346 .help = "Fill pattern for IO buffers",
3347 .category = FIO_OPT_C_IO,
3348 .group = FIO_OPT_G_IO_BUF,
3351 .name = "buffer_compress_percentage",
3352 .lname = "Buffer compression percentage",
3353 .type = FIO_OPT_INT,
3354 .cb = str_buffer_compress_cb,
3355 .off1 = td_var_offset(compress_percentage),
3358 .help = "How compressible the buffer is (approximately)",
3360 .category = FIO_OPT_C_IO,
3361 .group = FIO_OPT_G_IO_BUF,
3364 .name = "buffer_compress_chunk",
3365 .lname = "Buffer compression chunk size",
3366 .type = FIO_OPT_INT,
3367 .off1 = td_var_offset(compress_chunk),
3368 .parent = "buffer_compress_percentage",
3370 .help = "Size of compressible region in buffer",
3372 .category = FIO_OPT_C_IO,
3373 .group = FIO_OPT_G_IO_BUF,
3376 .name = "dedupe_percentage",
3377 .lname = "Dedupe percentage",
3378 .type = FIO_OPT_INT,
3379 .cb = str_dedupe_cb,
3380 .off1 = td_var_offset(dedupe_percentage),
3383 .help = "Percentage of buffers that are dedupable",
3385 .category = FIO_OPT_C_IO,
3386 .group = FIO_OPT_G_IO_BUF,
3389 .name = "clat_percentiles",
3390 .lname = "Completion latency percentiles",
3391 .type = FIO_OPT_BOOL,
3392 .off1 = td_var_offset(clat_percentiles),
3393 .help = "Enable the reporting of completion latency percentiles",
3395 .category = FIO_OPT_C_STAT,
3396 .group = FIO_OPT_G_INVALID,
3399 .name = "percentile_list",
3400 .lname = "Percentile list",
3401 .type = FIO_OPT_FLOAT_LIST,
3402 .off1 = td_var_offset(percentile_list),
3403 .off2 = td_var_offset(percentile_precision),
3404 .help = "Specify a custom list of percentiles to report for "
3405 "completion latency and block errors",
3406 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3407 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3410 .category = FIO_OPT_C_STAT,
3411 .group = FIO_OPT_G_INVALID,
3414 #ifdef FIO_HAVE_DISK_UTIL
3416 .name = "disk_util",
3417 .lname = "Disk utilization",
3418 .type = FIO_OPT_BOOL,
3419 .off1 = td_var_offset(do_disk_util),
3420 .help = "Log disk utilization statistics",
3422 .category = FIO_OPT_C_STAT,
3423 .group = FIO_OPT_G_INVALID,
3427 .name = "gtod_reduce",
3428 .lname = "Reduce gettimeofday() calls",
3429 .type = FIO_OPT_BOOL,
3430 .help = "Greatly reduce number of gettimeofday() calls",
3431 .cb = str_gtod_reduce_cb,
3434 .category = FIO_OPT_C_STAT,
3435 .group = FIO_OPT_G_INVALID,
3438 .name = "disable_lat",
3439 .lname = "Disable all latency stats",
3440 .type = FIO_OPT_BOOL,
3441 .off1 = td_var_offset(disable_lat),
3442 .help = "Disable latency numbers",
3443 .parent = "gtod_reduce",
3446 .category = FIO_OPT_C_STAT,
3447 .group = FIO_OPT_G_INVALID,
3450 .name = "disable_clat",
3451 .lname = "Disable completion latency stats",
3452 .type = FIO_OPT_BOOL,
3453 .off1 = td_var_offset(disable_clat),
3454 .help = "Disable completion latency numbers",
3455 .parent = "gtod_reduce",
3458 .category = FIO_OPT_C_STAT,
3459 .group = FIO_OPT_G_INVALID,
3462 .name = "disable_slat",
3463 .lname = "Disable submission latency stats",
3464 .type = FIO_OPT_BOOL,
3465 .off1 = td_var_offset(disable_slat),
3466 .help = "Disable submission latency numbers",
3467 .parent = "gtod_reduce",
3470 .category = FIO_OPT_C_STAT,
3471 .group = FIO_OPT_G_INVALID,
3474 .name = "disable_bw_measurement",
3475 .lname = "Disable bandwidth stats",
3476 .type = FIO_OPT_BOOL,
3477 .off1 = td_var_offset(disable_bw),
3478 .help = "Disable bandwidth logging",
3479 .parent = "gtod_reduce",
3482 .category = FIO_OPT_C_STAT,
3483 .group = FIO_OPT_G_INVALID,
3487 .lname = "Dedicated gettimeofday() CPU",
3488 .type = FIO_OPT_INT,
3489 .off1 = td_var_offset(gtod_cpu),
3490 .help = "Set up dedicated gettimeofday() thread on this CPU",
3491 .verify = gtod_cpu_verify,
3492 .category = FIO_OPT_C_GENERAL,
3493 .group = FIO_OPT_G_CLOCK,
3496 .name = "unified_rw_reporting",
3497 .type = FIO_OPT_BOOL,
3498 .off1 = td_var_offset(unified_rw_rep),
3499 .help = "Unify reporting across data direction",
3501 .category = FIO_OPT_C_GENERAL,
3502 .group = FIO_OPT_G_INVALID,
3505 .name = "continue_on_error",
3506 .lname = "Continue on error",
3507 .type = FIO_OPT_STR,
3508 .off1 = td_var_offset(continue_on_error),
3509 .help = "Continue on non-fatal errors during IO",
3511 .category = FIO_OPT_C_GENERAL,
3512 .group = FIO_OPT_G_ERR,
3515 .oval = ERROR_TYPE_NONE,
3516 .help = "Exit when an error is encountered",
3519 .oval = ERROR_TYPE_READ,
3520 .help = "Continue on read errors only",
3523 .oval = ERROR_TYPE_WRITE,
3524 .help = "Continue on write errors only",
3527 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3528 .help = "Continue on any IO errors",
3531 .oval = ERROR_TYPE_VERIFY,
3532 .help = "Continue on verify errors only",
3535 .oval = ERROR_TYPE_ANY,
3536 .help = "Continue on all io and verify errors",
3539 .oval = ERROR_TYPE_NONE,
3540 .help = "Alias for 'none'",
3543 .oval = ERROR_TYPE_ANY,
3544 .help = "Alias for 'all'",
3549 .name = "ignore_error",
3550 .type = FIO_OPT_STR,
3551 .cb = str_ignore_error_cb,
3552 .off1 = td_var_offset(ignore_error_nr),
3553 .help = "Set a specific list of errors to ignore",
3555 .category = FIO_OPT_C_GENERAL,
3556 .group = FIO_OPT_G_ERR,
3559 .name = "error_dump",
3560 .type = FIO_OPT_BOOL,
3561 .off1 = td_var_offset(error_dump),
3563 .help = "Dump info on each error",
3564 .category = FIO_OPT_C_GENERAL,
3565 .group = FIO_OPT_G_ERR,
3570 .type = FIO_OPT_STR_STORE,
3571 .off1 = td_var_offset(profile),
3572 .help = "Select a specific builtin performance test",
3573 .category = FIO_OPT_C_PROFILE,
3574 .group = FIO_OPT_G_INVALID,
3579 .type = FIO_OPT_STR_STORE,
3580 .off1 = td_var_offset(cgroup),
3581 .help = "Add job to cgroup of this name",
3582 .category = FIO_OPT_C_GENERAL,
3583 .group = FIO_OPT_G_CGROUP,
3586 .name = "cgroup_nodelete",
3587 .lname = "Cgroup no-delete",
3588 .type = FIO_OPT_BOOL,
3589 .off1 = td_var_offset(cgroup_nodelete),
3590 .help = "Do not delete cgroups after job completion",
3593 .category = FIO_OPT_C_GENERAL,
3594 .group = FIO_OPT_G_CGROUP,
3597 .name = "cgroup_weight",
3598 .lname = "Cgroup weight",
3599 .type = FIO_OPT_INT,
3600 .off1 = td_var_offset(cgroup_weight),
3601 .help = "Use given weight for cgroup",
3605 .category = FIO_OPT_C_GENERAL,
3606 .group = FIO_OPT_G_CGROUP,
3611 .type = FIO_OPT_INT,
3612 .off1 = td_var_offset(uid),
3613 .help = "Run job with this user ID",
3614 .category = FIO_OPT_C_GENERAL,
3615 .group = FIO_OPT_G_CRED,
3619 .lname = "Group ID",
3620 .type = FIO_OPT_INT,
3621 .off1 = td_var_offset(gid),
3622 .help = "Run job with this group ID",
3623 .category = FIO_OPT_C_GENERAL,
3624 .group = FIO_OPT_G_CRED,
3629 .type = FIO_OPT_INT,
3630 .off1 = td_var_offset(kb_base),
3636 .help = "Use 1024 as the K base",
3640 .help = "Use 1000 as the K base",
3643 .help = "How many bytes per KB for reporting (1000 or 1024)",
3644 .category = FIO_OPT_C_GENERAL,
3645 .group = FIO_OPT_G_INVALID,
3648 .name = "unit_base",
3649 .lname = "Base unit for reporting (Bits or Bytes)",
3650 .type = FIO_OPT_INT,
3651 .off1 = td_var_offset(unit_base),
3656 .help = "Auto-detect",
3660 .help = "Normal (byte based)",
3664 .help = "Bit based",
3667 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3668 .category = FIO_OPT_C_GENERAL,
3669 .group = FIO_OPT_G_INVALID,
3672 .name = "hugepage-size",
3673 .lname = "Hugepage size",
3674 .type = FIO_OPT_INT,
3675 .off1 = td_var_offset(hugepage_size),
3676 .help = "When using hugepages, specify size of each page",
3677 .def = __fio_stringify(FIO_HUGE_PAGE),
3678 .interval = 1024 * 1024,
3679 .category = FIO_OPT_C_GENERAL,
3680 .group = FIO_OPT_G_INVALID,
3684 .lname = "I/O flow ID",
3685 .type = FIO_OPT_INT,
3686 .off1 = td_var_offset(flow_id),
3687 .help = "The flow index ID to use",
3689 .category = FIO_OPT_C_IO,
3690 .group = FIO_OPT_G_IO_FLOW,
3694 .lname = "I/O flow weight",
3695 .type = FIO_OPT_INT,
3696 .off1 = td_var_offset(flow),
3697 .help = "Weight for flow control of this job",
3698 .parent = "flow_id",
3701 .category = FIO_OPT_C_IO,
3702 .group = FIO_OPT_G_IO_FLOW,
3705 .name = "flow_watermark",
3706 .lname = "I/O flow watermark",
3707 .type = FIO_OPT_INT,
3708 .off1 = td_var_offset(flow_watermark),
3709 .help = "High watermark for flow control. This option"
3710 " should be set to the same value for all threads"
3711 " with non-zero flow.",
3712 .parent = "flow_id",
3715 .category = FIO_OPT_C_IO,
3716 .group = FIO_OPT_G_IO_FLOW,
3719 .name = "flow_sleep",
3720 .lname = "I/O flow sleep",
3721 .type = FIO_OPT_INT,
3722 .off1 = td_var_offset(flow_sleep),
3723 .help = "How many microseconds to sleep after being held"
3724 " back by the flow control mechanism",
3725 .parent = "flow_id",
3728 .category = FIO_OPT_C_IO,
3729 .group = FIO_OPT_G_IO_FLOW,
3733 .lname = "Skip operations against bad blocks",
3734 .type = FIO_OPT_BOOL,
3735 .off1 = td_var_offset(skip_bad),
3736 .help = "Skip operations against known bad blocks.",
3739 .category = FIO_OPT_C_IO,
3740 .group = FIO_OPT_G_MTD,
3747 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3748 const char *name, int val)
3750 lopt->name = (char *) name;
3752 if (o->type == FIO_OPT_STR_SET)
3753 lopt->has_arg = optional_argument;
3755 lopt->has_arg = required_argument;
3758 static void options_to_lopts(struct fio_option *opts,
3759 struct option *long_options,
3760 int i, int option_type)
3762 struct fio_option *o = &opts[0];
3764 add_to_lopt(&long_options[i], o, o->name, option_type);
3767 add_to_lopt(&long_options[i], o, o->alias, option_type);
3772 assert(i < FIO_NR_OPTIONS);
3776 void fio_options_set_ioengine_opts(struct option *long_options,
3777 struct thread_data *td)
3782 while (long_options[i].name) {
3783 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3784 memset(&long_options[i], 0, sizeof(*long_options));
3791 * Just clear out the prior ioengine options.
3796 options_to_lopts(td->io_ops->options, long_options, i,
3797 FIO_GETOPT_IOENGINE);
3800 void fio_options_dup_and_init(struct option *long_options)
3804 options_init(fio_options);
3807 while (long_options[i].name)
3810 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3813 struct fio_keyword {
3819 static struct fio_keyword fio_keywords[] = {
3821 .word = "$pagesize",
3822 .desc = "Page size in the system",
3825 .word = "$mb_memory",
3826 .desc = "Megabytes of memory online",
3830 .desc = "Number of CPUs online in the system",
3837 void fio_keywords_exit(void)
3839 struct fio_keyword *kw;
3841 kw = &fio_keywords[0];
3849 void fio_keywords_init(void)
3851 unsigned long long mb_memory;
3855 sprintf(buf, "%lu", (unsigned long) page_size);
3856 fio_keywords[0].replace = strdup(buf);
3858 mb_memory = os_phys_mem() / (1024 * 1024);
3859 sprintf(buf, "%llu", mb_memory);
3860 fio_keywords[1].replace = strdup(buf);
3863 sprintf(buf, "%lu", l);
3864 fio_keywords[2].replace = strdup(buf);
3869 static char *bc_calc(char *str)
3871 char buf[128], *tmp;
3876 * No math, just return string
3878 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3879 !strchr(str, '/')) || strchr(str, '\''))
3883 * Split option from value, we only need to calculate the value
3885 tmp = strchr(str, '=');
3892 * Prevent buffer overflows; such a case isn't reasonable anyway
3894 if (strlen(str) >= 128 || strlen(tmp) > 100)
3897 sprintf(buf, "which %s > /dev/null", BC_APP);
3899 log_err("fio: bc is needed for performing math\n");
3903 sprintf(buf, "echo '%s' | %s"