18 #include "crc/crc32c.h"
21 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
23 static char *get_opt_postfix(const char *str)
25 char *p = strstr(str, ":");
31 strip_blank_front(&p);
36 static int converthexchartoint(char a)
56 static int bs_cmp(const void *p1, const void *p2)
58 const struct bssplit *bsp1 = p1;
59 const struct bssplit *bsp2 = p2;
61 return bsp1->perc < bsp2->perc;
64 static int bssplit_ddir(struct thread_options *o, int ddir, char *str)
66 struct bssplit *bssplit;
67 unsigned int i, perc, perc_missing;
68 unsigned int max_bs, min_bs;
72 o->bssplit_nr[ddir] = 4;
73 bssplit = malloc(4 * sizeof(struct bssplit));
78 while ((fname = strsep(&str, ":")) != NULL) {
85 * grow struct buffer, if needed
87 if (i == o->bssplit_nr[ddir]) {
88 o->bssplit_nr[ddir] <<= 1;
89 bssplit = realloc(bssplit, o->bssplit_nr[ddir]
90 * sizeof(struct bssplit));
93 perc_str = strstr(fname, "/");
97 perc = atoi(perc_str);
105 if (str_to_decimal(fname, &val, 1, o)) {
106 log_err("fio: bssplit conversion failed\n");
117 bssplit[i].perc = perc;
121 o->bssplit_nr[ddir] = i;
124 * Now check if the percentages add up, and how much is missing
126 perc = perc_missing = 0;
127 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
128 struct bssplit *bsp = &bssplit[i];
130 if (bsp->perc == (unsigned char) -1)
137 log_err("fio: bssplit percentages add to more than 100%%\n");
142 * If values didn't have a percentage set, divide the remains between
146 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
147 struct bssplit *bsp = &bssplit[i];
149 if (bsp->perc == (unsigned char) -1)
150 bsp->perc = (100 - perc) / perc_missing;
154 o->min_bs[ddir] = min_bs;
155 o->max_bs[ddir] = max_bs;
158 * now sort based on percentages, for ease of lookup
160 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
161 o->bssplit[ddir] = bssplit;
165 static int str_bssplit_cb(void *data, const char *input)
167 struct thread_data *td = data;
168 char *str, *p, *odir, *ddir;
171 p = str = strdup(input);
173 strip_blank_front(&str);
174 strip_blank_end(str);
176 odir = strchr(str, ',');
178 ddir = strchr(odir + 1, ',');
180 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
186 op = strdup(odir + 1);
187 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
192 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
195 ret = bssplit_ddir(&td->o, DDIR_READ, str);
201 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
206 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
209 ret = bssplit_ddir(&td->o, DDIR_READ, str);
216 static int str2error(char *str)
218 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
219 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
220 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
221 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
222 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
223 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
224 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
225 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
226 int i = 0, num = sizeof(err) / sizeof(void *);
229 if (!strcmp(err[i], str))
236 static int ignore_error_type(struct thread_data *td, int etype, char *str)
242 if (etype >= ERROR_TYPE_CNT) {
243 log_err("Illegal error type\n");
247 td->o.ignore_error_nr[etype] = 4;
248 error = malloc(4 * sizeof(struct bssplit));
251 while ((fname = strsep(&str, ":")) != NULL) {
257 * grow struct buffer, if needed
259 if (i == td->o.ignore_error_nr[etype]) {
260 td->o.ignore_error_nr[etype] <<= 1;
261 error = realloc(error, td->o.ignore_error_nr[etype]
264 if (fname[0] == 'E') {
265 error[i] = str2error(fname);
267 error[i] = atoi(fname);
272 log_err("Unknown error %s, please use number value \n",
280 td->o.continue_on_error |= 1 << etype;
281 td->o.ignore_error_nr[etype] = i;
282 td->o.ignore_error[etype] = error;
288 static int str_ignore_error_cb(void *data, const char *input)
290 struct thread_data *td = data;
292 int type = 0, ret = 1;
293 p = str = strdup(input);
295 strip_blank_front(&str);
296 strip_blank_end(str);
302 ret = ignore_error_type(td, type, p);
312 static int str_rw_cb(void *data, const char *str)
314 struct thread_data *td = data;
315 struct thread_options *o = &td->o;
316 char *nr = get_opt_postfix(str);
325 o->ddir_seq_nr = atoi(nr);
329 if (str_to_decimal(nr, &val, 1, o)) {
330 log_err("fio: rw postfix parsing failed\n");
335 o->ddir_seq_add = val;
342 static int str_mem_cb(void *data, const char *mem)
344 struct thread_data *td = data;
346 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
347 td->o.mmapfile = get_opt_postfix(mem);
352 static int fio_clock_source_cb(void *data, const char *str)
354 struct thread_data *td = data;
356 fio_clock_source = td->o.clocksource;
357 fio_clock_source_set = 1;
362 static int str_rwmix_read_cb(void *data, unsigned long long *val)
364 struct thread_data *td = data;
366 td->o.rwmix[DDIR_READ] = *val;
367 td->o.rwmix[DDIR_WRITE] = 100 - *val;
371 static int str_rwmix_write_cb(void *data, unsigned long long *val)
373 struct thread_data *td = data;
375 td->o.rwmix[DDIR_WRITE] = *val;
376 td->o.rwmix[DDIR_READ] = 100 - *val;
380 static int str_perc_rand_cb(void *data, unsigned long long *val)
382 struct thread_data *td = data;
384 td->o.perc_rand = *val;
388 static int str_perc_seq_cb(void *data, unsigned long long *val)
390 struct thread_data *td = data;
392 td->o.perc_rand = 100 - *val;
397 static int str_exitall_cb(void)
399 exitall_on_terminate = 1;
403 #ifdef FIO_HAVE_CPU_AFFINITY
404 static int str_cpumask_cb(void *data, unsigned long long *val)
406 struct thread_data *td = data;
411 ret = fio_cpuset_init(&td->o.cpumask);
413 log_err("fio: cpuset_init failed\n");
414 td_verror(td, ret, "fio_cpuset_init");
418 max_cpu = cpus_online();
420 for (i = 0; i < sizeof(int) * 8; i++) {
421 if ((1 << i) & *val) {
423 log_err("fio: CPU %d too large (max=%ld)\n", i,
427 dprint(FD_PARSE, "set cpu allowed %d\n", i);
428 fio_cpu_set(&td->o.cpumask, i);
432 td->o.cpumask_set = 1;
436 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
443 ret = fio_cpuset_init(mask);
445 log_err("fio: cpuset_init failed\n");
446 td_verror(td, ret, "fio_cpuset_init");
450 p = str = strdup(input);
452 strip_blank_front(&str);
453 strip_blank_end(str);
455 max_cpu = cpus_online();
457 while ((cpu = strsep(&str, ",")) != NULL) {
466 while ((cpu2 = strsep(&str2, "-")) != NULL) {
476 while (icpu <= icpu2) {
477 if (icpu >= FIO_MAX_CPUS) {
478 log_err("fio: your OS only supports up to"
479 " %d CPUs\n", (int) FIO_MAX_CPUS);
483 if (icpu > max_cpu) {
484 log_err("fio: CPU %d too large (max=%ld)\n",
490 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
491 fio_cpu_set(mask, icpu);
500 td->o.cpumask_set = 1;
504 static int str_cpus_allowed_cb(void *data, const char *input)
506 struct thread_data *td = data;
509 ret = set_cpus_allowed(td, &td->o.cpumask, input);
511 td->o.cpumask_set = 1;
516 static int str_verify_cpus_allowed_cb(void *data, const char *input)
518 struct thread_data *td = data;
521 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
523 td->o.verify_cpumask_set = 1;
529 #ifdef CONFIG_LIBNUMA
530 static int str_numa_cpunodes_cb(void *data, char *input)
532 struct thread_data *td = data;
534 /* numa_parse_nodestring() parses a character string list
535 * of nodes into a bit mask. The bit mask is allocated by
536 * numa_allocate_nodemask(), so it should be freed by
537 * numa_free_nodemask().
539 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
540 if (td->o.numa_cpunodesmask == NULL) {
541 log_err("fio: numa_parse_nodestring failed\n");
542 td_verror(td, 1, "str_numa_cpunodes_cb");
546 td->o.numa_cpumask_set = 1;
550 static int str_numa_mpol_cb(void *data, char *input)
552 struct thread_data *td = data;
553 const char * const policy_types[] =
554 { "default", "prefer", "bind", "interleave", "local", NULL };
557 char *nodelist = strchr(input, ':');
559 /* NUL-terminate mode */
563 for (i = 0; i <= MPOL_LOCAL; i++) {
564 if (!strcmp(input, policy_types[i])) {
565 td->o.numa_mem_mode = i;
569 if (i > MPOL_LOCAL) {
570 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
574 switch (td->o.numa_mem_mode) {
577 * Insist on a nodelist of one node only
580 char *rest = nodelist;
581 while (isdigit(*rest))
584 log_err("fio: one node only for \'prefer\'\n");
588 log_err("fio: one node is needed for \'prefer\'\n");
592 case MPOL_INTERLEAVE:
594 * Default to online nodes with memory if no nodelist
597 nodelist = strdup("all");
602 * Don't allow a nodelist
605 log_err("fio: NO nodelist for \'local\'\n");
611 * Insist on a nodelist
614 log_err("fio: a nodelist is needed for \'bind\'\n");
621 /* numa_parse_nodestring() parses a character string list
622 * of nodes into a bit mask. The bit mask is allocated by
623 * numa_allocate_nodemask(), so it should be freed by
624 * numa_free_nodemask().
626 switch (td->o.numa_mem_mode) {
628 td->o.numa_mem_prefer_node = atoi(nodelist);
630 case MPOL_INTERLEAVE:
632 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
633 if (td->o.numa_memnodesmask == NULL) {
634 log_err("fio: numa_parse_nodestring failed\n");
635 td_verror(td, 1, "str_numa_memnodes_cb");
645 td->o.numa_memmask_set = 1;
653 static int str_fst_cb(void *data, const char *str)
655 struct thread_data *td = data;
656 char *nr = get_opt_postfix(str);
658 td->file_service_nr = 1;
660 td->file_service_nr = atoi(nr);
667 #ifdef CONFIG_SYNC_FILE_RANGE
668 static int str_sfr_cb(void *data, const char *str)
670 struct thread_data *td = data;
671 char *nr = get_opt_postfix(str);
673 td->sync_file_range_nr = 1;
675 td->sync_file_range_nr = atoi(nr);
683 static int str_random_distribution_cb(void *data, const char *str)
685 struct thread_data *td = data;
689 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
691 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
696 nr = get_opt_postfix(str);
697 if (nr && !str_to_float(nr, &val)) {
698 log_err("fio: random postfix parsing failed\n");
705 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
707 log_err("fio: zipf theta must different than 1.0\n");
710 td->o.zipf_theta.u.f = val;
712 if (val <= 0.00 || val >= 1.00) {
713 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
716 td->o.pareto_h.u.f = val;
723 * Return next file in the string. Files are separated with ':'. If the ':'
724 * is escaped with a '\', then that ':' is part of the filename and does not
725 * indicate a new file.
727 static char *get_next_file_name(char **ptr)
732 if (!str || !strlen(str))
738 * No colon, we are done
740 p = strchr(str, ':');
747 * We got a colon, but it's the first character. Skip and
755 if (*(p - 1) != '\\') {
761 memmove(p - 1, p, strlen(p) + 1);
768 static int str_filename_cb(void *data, const char *input)
770 struct thread_data *td = data;
771 char *fname, *str, *p;
773 p = str = strdup(input);
775 strip_blank_front(&str);
776 strip_blank_end(str);
778 if (!td->files_index)
781 while ((fname = get_next_file_name(&str)) != NULL) {
792 static int str_directory_cb(void *data, const char fio_unused *str)
794 struct thread_data *td = data;
797 if (lstat(td->o.directory, &sb) < 0) {
800 log_err("fio: %s is not a directory\n", td->o.directory);
801 td_verror(td, ret, "lstat");
804 if (!S_ISDIR(sb.st_mode)) {
805 log_err("fio: %s is not a directory\n", td->o.directory);
812 static int str_opendir_cb(void *data, const char fio_unused *str)
814 struct thread_data *td = data;
816 if (!td->files_index)
819 return add_dir_files(td, td->o.opendir);
822 static int str_verify_pattern_cb(void *data, const char *input)
824 struct thread_data *td = data;
826 int i = 0, j = 0, len, k, base = 10, pattern_length;
829 loc1 = strstr(input, "0x");
830 loc2 = strstr(input, "0X");
833 off = strtol(input, NULL, base);
834 if (off != LONG_MAX || errno != ERANGE) {
836 td->o.verify_pattern[i] = off & 0xff;
845 j = loc1 - input + 2;
847 j = loc2 - input + 2;
850 if (len - j < MAX_PATTERN_SIZE * 2) {
852 off = converthexchartoint(input[k--]);
854 off += (converthexchartoint(input[k--])
856 td->o.verify_pattern[i++] = (char) off;
862 * Fill the pattern all the way to the end. This greatly reduces
863 * the number of memcpy's we have to do when verifying the IO.
866 while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) {
867 memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i);
872 * Fill remainder, if the pattern multiple ends up not being
875 while (i > 1 && i < MAX_PATTERN_SIZE) {
876 unsigned int b = min(pattern_length, MAX_PATTERN_SIZE - i);
878 memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], b);
884 * The code in verify_io_u_pattern assumes a single byte pattern
885 * fills the whole verify pattern buffer.
887 memset(td->o.verify_pattern, td->o.verify_pattern[0],
891 td->o.verify_pattern_bytes = i;
894 * VERIFY_META could already be set
896 if (td->o.verify == VERIFY_NONE)
897 td->o.verify = VERIFY_PATTERN;
902 static int str_gtod_reduce_cb(void *data, int *il)
904 struct thread_data *td = data;
907 td->o.disable_lat = !!val;
908 td->o.disable_clat = !!val;
909 td->o.disable_slat = !!val;
910 td->o.disable_bw = !!val;
911 td->o.clat_percentiles = !val;
913 td->tv_cache_mask = 63;
918 static int str_gtod_cpu_cb(void *data, long long *il)
920 struct thread_data *td = data;
923 td->o.gtod_cpu = val;
924 td->o.gtod_offload = 1;
928 static int str_size_cb(void *data, unsigned long long *__val)
930 struct thread_data *td = data;
931 unsigned long long v = *__val;
933 if (parse_is_percent(v)) {
935 td->o.size_percent = -1ULL - v;
942 static int rw_verify(struct fio_option *o, void *data)
944 struct thread_data *td = data;
946 if (read_only && td_write(td)) {
947 log_err("fio: job <%s> has write bit set, but fio is in"
948 " read-only mode\n", td->o.name);
955 static int gtod_cpu_verify(struct fio_option *o, void *data)
957 #ifndef FIO_HAVE_CPU_AFFINITY
958 struct thread_data *td = data;
960 if (td->o.gtod_cpu) {
961 log_err("fio: platform must support CPU affinity for"
962 "gettimeofday() offloading\n");
973 static struct opt_group fio_opt_groups[] = {
976 .mask = FIO_OPT_C_GENERAL,
980 .mask = FIO_OPT_C_IO,
984 .mask = FIO_OPT_C_FILE,
987 .name = "Statistics",
988 .mask = FIO_OPT_C_STAT,
992 .mask = FIO_OPT_C_LOG,
996 .mask = FIO_OPT_C_PROFILE,
1003 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1004 unsigned int inv_mask)
1006 struct opt_group *og;
1009 if (*mask == inv_mask || !*mask)
1012 for (i = 0; ogs[i].name; i++) {
1015 if (*mask & og->mask) {
1016 *mask &= ~(og->mask);
1024 struct opt_group *opt_group_from_mask(unsigned int *mask)
1026 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1029 static struct opt_group fio_opt_cat_groups[] = {
1032 .mask = FIO_OPT_G_RATE,
1036 .mask = FIO_OPT_G_ZONE,
1039 .name = "Read/write mix",
1040 .mask = FIO_OPT_G_RWMIX,
1044 .mask = FIO_OPT_G_VERIFY,
1048 .mask = FIO_OPT_G_TRIM,
1051 .name = "I/O Logging",
1052 .mask = FIO_OPT_G_IOLOG,
1055 .name = "I/O Depth",
1056 .mask = FIO_OPT_G_IO_DEPTH,
1060 .mask = FIO_OPT_G_IO_FLOW,
1063 .name = "Description",
1064 .mask = FIO_OPT_G_DESC,
1068 .mask = FIO_OPT_G_FILENAME,
1071 .name = "General I/O",
1072 .mask = FIO_OPT_G_IO_BASIC,
1076 .mask = FIO_OPT_G_CGROUP,
1080 .mask = FIO_OPT_G_RUNTIME,
1084 .mask = FIO_OPT_G_PROCESS,
1087 .name = "Job credentials / priority",
1088 .mask = FIO_OPT_G_CRED,
1091 .name = "Clock settings",
1092 .mask = FIO_OPT_G_CLOCK,
1096 .mask = FIO_OPT_G_IO_TYPE,
1099 .name = "I/O Thinktime",
1100 .mask = FIO_OPT_G_THINKTIME,
1103 .name = "Randomizations",
1104 .mask = FIO_OPT_G_RANDOM,
1107 .name = "I/O buffers",
1108 .mask = FIO_OPT_G_IO_BUF,
1111 .name = "Tiobench profile",
1112 .mask = FIO_OPT_G_TIOBENCH,
1120 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1122 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1126 * Map of job/command line options
1128 struct fio_option fio_options[FIO_MAX_OPTS] = {
1130 .name = "description",
1131 .lname = "Description of job",
1132 .type = FIO_OPT_STR_STORE,
1133 .off1 = td_var_offset(description),
1134 .help = "Text job description",
1135 .category = FIO_OPT_C_GENERAL,
1136 .group = FIO_OPT_G_DESC,
1140 .lname = "Job name",
1141 .type = FIO_OPT_STR_STORE,
1142 .off1 = td_var_offset(name),
1143 .help = "Name of this job",
1144 .category = FIO_OPT_C_GENERAL,
1145 .group = FIO_OPT_G_DESC,
1149 .lname = "Filename(s)",
1150 .type = FIO_OPT_STR_STORE,
1151 .off1 = td_var_offset(filename),
1152 .cb = str_filename_cb,
1153 .prio = -1, /* must come after "directory" */
1154 .help = "File(s) to use for the workload",
1155 .category = FIO_OPT_C_FILE,
1156 .group = FIO_OPT_G_FILENAME,
1159 .name = "directory",
1160 .lname = "Directory",
1161 .type = FIO_OPT_STR_STORE,
1162 .off1 = td_var_offset(directory),
1163 .cb = str_directory_cb,
1164 .help = "Directory to store files in",
1165 .category = FIO_OPT_C_FILE,
1166 .group = FIO_OPT_G_FILENAME,
1169 .name = "filename_format",
1170 .type = FIO_OPT_STR_STORE,
1171 .off1 = td_var_offset(filename_format),
1172 .prio = -1, /* must come after "directory" */
1173 .help = "Override default $jobname.$jobnum.$filenum naming",
1174 .def = "$jobname.$jobnum.$filenum",
1175 .category = FIO_OPT_C_FILE,
1176 .group = FIO_OPT_G_FILENAME,
1180 .lname = "Lockfile",
1181 .type = FIO_OPT_STR,
1182 .off1 = td_var_offset(file_lock_mode),
1183 .help = "Lock file when doing IO to it",
1184 .parent = "filename",
1187 .category = FIO_OPT_C_FILE,
1188 .group = FIO_OPT_G_FILENAME,
1191 .oval = FILE_LOCK_NONE,
1192 .help = "No file locking",
1194 { .ival = "exclusive",
1195 .oval = FILE_LOCK_EXCLUSIVE,
1196 .help = "Exclusive file lock",
1199 .ival = "readwrite",
1200 .oval = FILE_LOCK_READWRITE,
1201 .help = "Read vs write lock",
1207 .lname = "Open directory",
1208 .type = FIO_OPT_STR_STORE,
1209 .off1 = td_var_offset(opendir),
1210 .cb = str_opendir_cb,
1211 .help = "Recursively add files from this directory and down",
1212 .category = FIO_OPT_C_FILE,
1213 .group = FIO_OPT_G_FILENAME,
1217 .lname = "Read/write",
1218 .alias = "readwrite",
1219 .type = FIO_OPT_STR,
1221 .off1 = td_var_offset(td_ddir),
1222 .help = "IO direction",
1224 .verify = rw_verify,
1225 .category = FIO_OPT_C_IO,
1226 .group = FIO_OPT_G_IO_BASIC,
1229 .oval = TD_DDIR_READ,
1230 .help = "Sequential read",
1233 .oval = TD_DDIR_WRITE,
1234 .help = "Sequential write",
1237 .oval = TD_DDIR_TRIM,
1238 .help = "Sequential trim",
1240 { .ival = "randread",
1241 .oval = TD_DDIR_RANDREAD,
1242 .help = "Random read",
1244 { .ival = "randwrite",
1245 .oval = TD_DDIR_RANDWRITE,
1246 .help = "Random write",
1248 { .ival = "randtrim",
1249 .oval = TD_DDIR_RANDTRIM,
1250 .help = "Random trim",
1254 .help = "Sequential read and write mix",
1256 { .ival = "readwrite",
1258 .help = "Sequential read and write mix",
1261 .oval = TD_DDIR_RANDRW,
1262 .help = "Random read and write mix"
1267 .name = "rw_sequencer",
1268 .lname = "RW Sequencer",
1269 .type = FIO_OPT_STR,
1270 .off1 = td_var_offset(rw_seq),
1271 .help = "IO offset generator modifier",
1272 .def = "sequential",
1273 .category = FIO_OPT_C_IO,
1274 .group = FIO_OPT_G_IO_BASIC,
1276 { .ival = "sequential",
1278 .help = "Generate sequential offsets",
1280 { .ival = "identical",
1281 .oval = RW_SEQ_IDENT,
1282 .help = "Generate identical offsets",
1289 .lname = "IO Engine",
1290 .type = FIO_OPT_STR_STORE,
1291 .off1 = td_var_offset(ioengine),
1292 .help = "IO engine to use",
1293 .def = FIO_PREFERRED_ENGINE,
1294 .category = FIO_OPT_C_IO,
1295 .group = FIO_OPT_G_IO_BASIC,
1298 .help = "Use read/write",
1301 .help = "Use pread/pwrite",
1304 .help = "Use readv/writev",
1306 #ifdef CONFIG_PWRITEV
1308 .help = "Use preadv/pwritev",
1311 #ifdef CONFIG_LIBAIO
1313 .help = "Linux native asynchronous IO",
1316 #ifdef CONFIG_POSIXAIO
1317 { .ival = "posixaio",
1318 .help = "POSIX asynchronous IO",
1321 #ifdef CONFIG_SOLARISAIO
1322 { .ival = "solarisaio",
1323 .help = "Solaris native asynchronous IO",
1326 #ifdef CONFIG_WINDOWSAIO
1327 { .ival = "windowsaio",
1328 .help = "Windows native asynchronous IO"
1332 .help = "Memory mapped IO"
1334 #ifdef CONFIG_LINUX_SPLICE
1336 .help = "splice/vmsplice based IO",
1338 { .ival = "netsplice",
1339 .help = "splice/vmsplice to/from the network",
1342 #ifdef FIO_HAVE_SGIO
1344 .help = "SCSI generic v3 IO",
1348 .help = "Testing engine (no data transfer)",
1351 .help = "Network IO",
1354 .help = "CPU cycle burner engine",
1358 .help = "GUASI IO engine",
1361 #ifdef FIO_HAVE_BINJECT
1362 { .ival = "binject",
1363 .help = "binject direct inject block engine",
1368 .help = "RDMA IO engine",
1371 #ifdef CONFIG_FUSION_AW
1372 { .ival = "fusion-aw-sync",
1373 .help = "Fusion-io atomic write engine",
1376 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1377 { .ival = "e4defrag",
1378 .help = "ext4 defrag engine",
1381 #ifdef CONFIG_LINUX_FALLOCATE
1383 .help = "fallocate() file based engine",
1386 { .ival = "external",
1387 .help = "Load external engine (append name)",
1393 .lname = "IO Depth",
1394 .type = FIO_OPT_INT,
1395 .off1 = td_var_offset(iodepth),
1396 .help = "Number of IO buffers to keep in flight",
1400 .category = FIO_OPT_C_IO,
1401 .group = FIO_OPT_G_IO_BASIC,
1404 .name = "iodepth_batch",
1405 .lname = "IO Depth batch",
1406 .alias = "iodepth_batch_submit",
1407 .type = FIO_OPT_INT,
1408 .off1 = td_var_offset(iodepth_batch),
1409 .help = "Number of IO buffers to submit in one go",
1410 .parent = "iodepth",
1415 .category = FIO_OPT_C_IO,
1416 .group = FIO_OPT_G_IO_BASIC,
1419 .name = "iodepth_batch_complete",
1420 .lname = "IO Depth batch complete",
1421 .type = FIO_OPT_INT,
1422 .off1 = td_var_offset(iodepth_batch_complete),
1423 .help = "Number of IO buffers to retrieve in one go",
1424 .parent = "iodepth",
1429 .category = FIO_OPT_C_IO,
1430 .group = FIO_OPT_G_IO_BASIC,
1433 .name = "iodepth_low",
1434 .lname = "IO Depth batch low",
1435 .type = FIO_OPT_INT,
1436 .off1 = td_var_offset(iodepth_low),
1437 .help = "Low water mark for queuing depth",
1438 .parent = "iodepth",
1441 .category = FIO_OPT_C_IO,
1442 .group = FIO_OPT_G_IO_BASIC,
1447 .type = FIO_OPT_STR_VAL,
1449 .help = "Total size of device or files",
1450 .interval = 1024 * 1024,
1451 .category = FIO_OPT_C_IO,
1452 .group = FIO_OPT_G_INVALID,
1455 .name = "fill_device",
1456 .lname = "Fill device",
1458 .type = FIO_OPT_BOOL,
1459 .off1 = td_var_offset(fill_device),
1460 .help = "Write until an ENOSPC error occurs",
1462 .category = FIO_OPT_C_FILE,
1463 .group = FIO_OPT_G_INVALID,
1467 .lname = "File size",
1468 .type = FIO_OPT_STR_VAL,
1469 .off1 = td_var_offset(file_size_low),
1470 .off2 = td_var_offset(file_size_high),
1472 .help = "Size of individual files",
1473 .interval = 1024 * 1024,
1474 .category = FIO_OPT_C_FILE,
1475 .group = FIO_OPT_G_INVALID,
1479 .lname = "IO offset",
1480 .alias = "fileoffset",
1481 .type = FIO_OPT_STR_VAL,
1482 .off1 = td_var_offset(start_offset),
1483 .help = "Start IO from this offset",
1485 .interval = 1024 * 1024,
1486 .category = FIO_OPT_C_IO,
1487 .group = FIO_OPT_G_INVALID,
1490 .name = "offset_increment",
1491 .lname = "IO offset increment",
1492 .type = FIO_OPT_STR_VAL,
1493 .off1 = td_var_offset(offset_increment),
1494 .help = "What is the increment from one offset to the next",
1498 .interval = 1024 * 1024,
1499 .category = FIO_OPT_C_IO,
1500 .group = FIO_OPT_G_INVALID,
1504 .lname = "Block size",
1505 .alias = "blocksize",
1506 .type = FIO_OPT_INT,
1507 .off1 = td_var_offset(bs[DDIR_READ]),
1508 .off2 = td_var_offset(bs[DDIR_WRITE]),
1509 .off3 = td_var_offset(bs[DDIR_TRIM]),
1511 .help = "Block size unit",
1516 .category = FIO_OPT_C_IO,
1517 .group = FIO_OPT_G_INVALID,
1521 .lname = "Block size align",
1522 .alias = "blockalign",
1523 .type = FIO_OPT_INT,
1524 .off1 = td_var_offset(ba[DDIR_READ]),
1525 .off2 = td_var_offset(ba[DDIR_WRITE]),
1526 .off3 = td_var_offset(ba[DDIR_TRIM]),
1528 .help = "IO block offset alignment",
1532 .category = FIO_OPT_C_IO,
1533 .group = FIO_OPT_G_INVALID,
1537 .lname = "Block size range",
1538 .alias = "blocksize_range",
1539 .type = FIO_OPT_RANGE,
1540 .off1 = td_var_offset(min_bs[DDIR_READ]),
1541 .off2 = td_var_offset(max_bs[DDIR_READ]),
1542 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1543 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1544 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1545 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1547 .help = "Set block size range (in more detail than bs)",
1551 .category = FIO_OPT_C_IO,
1552 .group = FIO_OPT_G_INVALID,
1556 .lname = "Block size split",
1557 .type = FIO_OPT_STR,
1558 .cb = str_bssplit_cb,
1559 .help = "Set a specific mix of block sizes",
1562 .category = FIO_OPT_C_IO,
1563 .group = FIO_OPT_G_INVALID,
1566 .name = "bs_unaligned",
1567 .lname = "Block size unaligned",
1568 .alias = "blocksize_unaligned",
1569 .type = FIO_OPT_STR_SET,
1570 .off1 = td_var_offset(bs_unaligned),
1571 .help = "Don't sector align IO buffer sizes",
1574 .category = FIO_OPT_C_IO,
1575 .group = FIO_OPT_G_INVALID,
1578 .name = "randrepeat",
1579 .lname = "Random repeatable",
1580 .type = FIO_OPT_BOOL,
1581 .off1 = td_var_offset(rand_repeatable),
1582 .help = "Use repeatable random IO pattern",
1586 .category = FIO_OPT_C_IO,
1587 .group = FIO_OPT_G_RANDOM,
1590 .name = "use_os_rand",
1591 .lname = "Use OS random",
1592 .type = FIO_OPT_BOOL,
1593 .off1 = td_var_offset(use_os_rand),
1594 .help = "Set to use OS random generator",
1598 .category = FIO_OPT_C_IO,
1599 .group = FIO_OPT_G_RANDOM,
1602 .name = "norandommap",
1603 .lname = "No randommap",
1604 .type = FIO_OPT_STR_SET,
1605 .off1 = td_var_offset(norandommap),
1606 .help = "Accept potential duplicate random blocks",
1610 .category = FIO_OPT_C_IO,
1611 .group = FIO_OPT_G_RANDOM,
1614 .name = "softrandommap",
1615 .lname = "Soft randommap",
1616 .type = FIO_OPT_BOOL,
1617 .off1 = td_var_offset(softrandommap),
1618 .help = "Set norandommap if randommap allocation fails",
1619 .parent = "norandommap",
1622 .category = FIO_OPT_C_IO,
1623 .group = FIO_OPT_G_RANDOM,
1626 .name = "random_generator",
1627 .type = FIO_OPT_STR,
1628 .off1 = td_var_offset(random_generator),
1629 .help = "Type of random number generator to use",
1630 .def = "tausworthe",
1632 { .ival = "tausworthe",
1633 .oval = FIO_RAND_GEN_TAUSWORTHE,
1634 .help = "Strong Tausworthe generator",
1637 .oval = FIO_RAND_GEN_LFSR,
1638 .help = "Variable length LFSR",
1641 .category = FIO_OPT_C_IO,
1642 .group = FIO_OPT_G_RANDOM,
1645 .name = "random_distribution",
1646 .type = FIO_OPT_STR,
1647 .off1 = td_var_offset(random_distribution),
1648 .cb = str_random_distribution_cb,
1649 .help = "Random offset distribution generator",
1653 .oval = FIO_RAND_DIST_RANDOM,
1654 .help = "Completely random",
1657 .oval = FIO_RAND_DIST_ZIPF,
1658 .help = "Zipf distribution",
1661 .oval = FIO_RAND_DIST_PARETO,
1662 .help = "Pareto distribution",
1665 .category = FIO_OPT_C_IO,
1666 .group = FIO_OPT_G_RANDOM,
1669 .name = "percentage_random",
1670 .lname = "Percentage Random",
1671 .type = FIO_OPT_INT,
1672 .cb = str_perc_rand_cb,
1674 .help = "Percentage of seq/random mix that should be random",
1677 .inverse = "percentage_sequential",
1678 .category = FIO_OPT_C_IO,
1679 .group = FIO_OPT_G_RANDOM,
1682 .name = "percentage_sequential",
1683 .lname = "Percentage Sequential",
1684 .type = FIO_OPT_INT,
1685 .cb = str_perc_seq_cb,
1687 .help = "Percentage of seq/random mix that should be sequential",
1690 .inverse = "percentage_random",
1691 .category = FIO_OPT_C_IO,
1692 .group = FIO_OPT_G_RANDOM,
1696 .lname = "Number of files",
1697 .alias = "nr_files",
1698 .type = FIO_OPT_INT,
1699 .off1 = td_var_offset(nr_files),
1700 .help = "Split job workload between this number of files",
1703 .category = FIO_OPT_C_FILE,
1704 .group = FIO_OPT_G_INVALID,
1707 .name = "openfiles",
1708 .lname = "Number of open files",
1709 .type = FIO_OPT_INT,
1710 .off1 = td_var_offset(open_files),
1711 .help = "Number of files to keep open at the same time",
1712 .category = FIO_OPT_C_FILE,
1713 .group = FIO_OPT_G_INVALID,
1716 .name = "file_service_type",
1717 .lname = "File service type",
1718 .type = FIO_OPT_STR,
1720 .off1 = td_var_offset(file_service_type),
1721 .help = "How to select which file to service next",
1722 .def = "roundrobin",
1723 .category = FIO_OPT_C_FILE,
1724 .group = FIO_OPT_G_INVALID,
1727 .oval = FIO_FSERVICE_RANDOM,
1728 .help = "Choose a file at random",
1730 { .ival = "roundrobin",
1731 .oval = FIO_FSERVICE_RR,
1732 .help = "Round robin select files",
1734 { .ival = "sequential",
1735 .oval = FIO_FSERVICE_SEQ,
1736 .help = "Finish one file before moving to the next",
1739 .parent = "nrfiles",
1742 #ifdef CONFIG_POSIX_FALLOCATE
1744 .name = "fallocate",
1745 .lname = "Fallocate",
1746 .type = FIO_OPT_STR,
1747 .off1 = td_var_offset(fallocate_mode),
1748 .help = "Whether pre-allocation is performed when laying out files",
1750 .category = FIO_OPT_C_FILE,
1751 .group = FIO_OPT_G_INVALID,
1754 .oval = FIO_FALLOCATE_NONE,
1755 .help = "Do not pre-allocate space",
1758 .oval = FIO_FALLOCATE_POSIX,
1759 .help = "Use posix_fallocate()",
1761 #ifdef CONFIG_LINUX_FALLOCATE
1763 .oval = FIO_FALLOCATE_KEEP_SIZE,
1764 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1767 /* Compatibility with former boolean values */
1769 .oval = FIO_FALLOCATE_NONE,
1770 .help = "Alias for 'none'",
1773 .oval = FIO_FALLOCATE_POSIX,
1774 .help = "Alias for 'posix'",
1778 #endif /* CONFIG_POSIX_FALLOCATE */
1780 .name = "fadvise_hint",
1781 .lname = "Fadvise hint",
1782 .type = FIO_OPT_BOOL,
1783 .off1 = td_var_offset(fadvise_hint),
1784 .help = "Use fadvise() to advise the kernel on IO pattern",
1786 .category = FIO_OPT_C_FILE,
1787 .group = FIO_OPT_G_INVALID,
1792 .type = FIO_OPT_INT,
1793 .off1 = td_var_offset(fsync_blocks),
1794 .help = "Issue fsync for writes every given number of blocks",
1797 .category = FIO_OPT_C_FILE,
1798 .group = FIO_OPT_G_INVALID,
1801 .name = "fdatasync",
1802 .lname = "Fdatasync",
1803 .type = FIO_OPT_INT,
1804 .off1 = td_var_offset(fdatasync_blocks),
1805 .help = "Issue fdatasync for writes every given number of blocks",
1808 .category = FIO_OPT_C_FILE,
1809 .group = FIO_OPT_G_INVALID,
1812 .name = "write_barrier",
1813 .lname = "Write barrier",
1814 .type = FIO_OPT_INT,
1815 .off1 = td_var_offset(barrier_blocks),
1816 .help = "Make every Nth write a barrier write",
1819 .category = FIO_OPT_C_IO,
1820 .group = FIO_OPT_G_INVALID,
1822 #ifdef CONFIG_SYNC_FILE_RANGE
1824 .name = "sync_file_range",
1825 .lname = "Sync file range",
1827 { .ival = "wait_before",
1828 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1829 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
1833 .oval = SYNC_FILE_RANGE_WRITE,
1834 .help = "SYNC_FILE_RANGE_WRITE",
1838 .ival = "wait_after",
1839 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1840 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
1844 .type = FIO_OPT_STR_MULTI,
1846 .off1 = td_var_offset(sync_file_range),
1847 .help = "Use sync_file_range()",
1848 .category = FIO_OPT_C_FILE,
1849 .group = FIO_OPT_G_INVALID,
1854 .lname = "Direct I/O",
1855 .type = FIO_OPT_BOOL,
1856 .off1 = td_var_offset(odirect),
1857 .help = "Use O_DIRECT IO (negates buffered)",
1859 .inverse = "buffered",
1860 .category = FIO_OPT_C_IO,
1861 .group = FIO_OPT_G_IO_TYPE,
1865 .lname = "Buffered I/O",
1866 .type = FIO_OPT_BOOL,
1867 .off1 = td_var_offset(odirect),
1869 .help = "Use buffered IO (negates direct)",
1871 .inverse = "direct",
1872 .category = FIO_OPT_C_IO,
1873 .group = FIO_OPT_G_IO_TYPE,
1876 .name = "overwrite",
1877 .lname = "Overwrite",
1878 .type = FIO_OPT_BOOL,
1879 .off1 = td_var_offset(overwrite),
1880 .help = "When writing, set whether to overwrite current data",
1882 .category = FIO_OPT_C_FILE,
1883 .group = FIO_OPT_G_INVALID,
1888 .type = FIO_OPT_INT,
1889 .off1 = td_var_offset(loops),
1890 .help = "Number of times to run the job",
1893 .category = FIO_OPT_C_GENERAL,
1894 .group = FIO_OPT_G_RUNTIME,
1898 .lname = "Number of jobs",
1899 .type = FIO_OPT_INT,
1900 .off1 = td_var_offset(numjobs),
1901 .help = "Duplicate this job this many times",
1904 .category = FIO_OPT_C_GENERAL,
1905 .group = FIO_OPT_G_RUNTIME,
1908 .name = "startdelay",
1909 .lname = "Start delay",
1910 .type = FIO_OPT_STR_VAL_TIME,
1911 .off1 = td_var_offset(start_delay),
1912 .help = "Only start job when this period has passed",
1914 .category = FIO_OPT_C_GENERAL,
1915 .group = FIO_OPT_G_RUNTIME,
1921 .type = FIO_OPT_STR_VAL_TIME,
1922 .off1 = td_var_offset(timeout),
1923 .help = "Stop workload when this amount of time has passed",
1925 .category = FIO_OPT_C_GENERAL,
1926 .group = FIO_OPT_G_RUNTIME,
1929 .name = "time_based",
1930 .lname = "Time based",
1931 .type = FIO_OPT_STR_SET,
1932 .off1 = td_var_offset(time_based),
1933 .help = "Keep running until runtime/timeout is met",
1934 .category = FIO_OPT_C_GENERAL,
1935 .group = FIO_OPT_G_RUNTIME,
1938 .name = "ramp_time",
1939 .lname = "Ramp time",
1940 .type = FIO_OPT_STR_VAL_TIME,
1941 .off1 = td_var_offset(ramp_time),
1942 .help = "Ramp up time before measuring performance",
1943 .category = FIO_OPT_C_GENERAL,
1944 .group = FIO_OPT_G_RUNTIME,
1947 .name = "clocksource",
1948 .lname = "Clock source",
1949 .type = FIO_OPT_STR,
1950 .cb = fio_clock_source_cb,
1951 .off1 = td_var_offset(clocksource),
1952 .help = "What type of timing source to use",
1953 .category = FIO_OPT_C_GENERAL,
1954 .group = FIO_OPT_G_CLOCK,
1956 #ifdef CONFIG_GETTIMEOFDAY
1957 { .ival = "gettimeofday",
1959 .help = "Use gettimeofday(2) for timing",
1962 #ifdef CONFIG_CLOCK_GETTIME
1963 { .ival = "clock_gettime",
1964 .oval = CS_CGETTIME,
1965 .help = "Use clock_gettime(2) for timing",
1968 #ifdef ARCH_HAVE_CPU_CLOCK
1970 .oval = CS_CPUCLOCK,
1971 .help = "Use CPU private clock",
1979 .lname = "I/O Memory",
1980 .type = FIO_OPT_STR,
1982 .off1 = td_var_offset(mem_type),
1983 .help = "Backing type for IO buffers",
1985 .category = FIO_OPT_C_IO,
1986 .group = FIO_OPT_G_INVALID,
1990 .help = "Use malloc(3) for IO buffers",
1994 .help = "Use shared memory segments for IO buffers",
1996 #ifdef FIO_HAVE_HUGETLB
1997 { .ival = "shmhuge",
1998 .oval = MEM_SHMHUGE,
1999 .help = "Like shm, but use huge pages",
2004 .help = "Use mmap(2) (file or anon) for IO buffers",
2006 #ifdef FIO_HAVE_HUGETLB
2007 { .ival = "mmaphuge",
2008 .oval = MEM_MMAPHUGE,
2009 .help = "Like mmap, but use huge pages",
2015 .name = "iomem_align",
2016 .alias = "mem_align",
2017 .lname = "I/O memory alignment",
2018 .type = FIO_OPT_INT,
2019 .off1 = td_var_offset(mem_align),
2021 .help = "IO memory buffer offset alignment",
2025 .category = FIO_OPT_C_IO,
2026 .group = FIO_OPT_G_INVALID,
2031 .type = FIO_OPT_STR,
2032 .off1 = td_var_offset(verify),
2033 .help = "Verify data written",
2035 .category = FIO_OPT_C_IO,
2036 .group = FIO_OPT_G_VERIFY,
2039 .oval = VERIFY_NONE,
2040 .help = "Don't do IO verification",
2044 .help = "Use md5 checksums for verification",
2047 .oval = VERIFY_CRC64,
2048 .help = "Use crc64 checksums for verification",
2051 .oval = VERIFY_CRC32,
2052 .help = "Use crc32 checksums for verification",
2054 { .ival = "crc32c-intel",
2055 .oval = VERIFY_CRC32C,
2056 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2059 .oval = VERIFY_CRC32C,
2060 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2063 .oval = VERIFY_CRC16,
2064 .help = "Use crc16 checksums for verification",
2067 .oval = VERIFY_CRC7,
2068 .help = "Use crc7 checksums for verification",
2071 .oval = VERIFY_SHA1,
2072 .help = "Use sha1 checksums for verification",
2075 .oval = VERIFY_SHA256,
2076 .help = "Use sha256 checksums for verification",
2079 .oval = VERIFY_SHA512,
2080 .help = "Use sha512 checksums for verification",
2083 .oval = VERIFY_META,
2084 .help = "Use io information",
2088 .oval = VERIFY_NULL,
2089 .help = "Pretend to verify",
2094 .name = "do_verify",
2095 .lname = "Perform verify step",
2096 .type = FIO_OPT_BOOL,
2097 .off1 = td_var_offset(do_verify),
2098 .help = "Run verification stage after write",
2102 .category = FIO_OPT_C_IO,
2103 .group = FIO_OPT_G_VERIFY,
2106 .name = "verifysort",
2107 .lname = "Verify sort",
2108 .type = FIO_OPT_BOOL,
2109 .off1 = td_var_offset(verifysort),
2110 .help = "Sort written verify blocks for read back",
2114 .category = FIO_OPT_C_IO,
2115 .group = FIO_OPT_G_VERIFY,
2118 .name = "verifysort_nr",
2119 .type = FIO_OPT_INT,
2120 .off1 = td_var_offset(verifysort_nr),
2121 .help = "Pre-load and sort verify blocks for a read workload",
2126 .category = FIO_OPT_C_IO,
2127 .group = FIO_OPT_G_VERIFY,
2130 .name = "verify_interval",
2131 .lname = "Verify interval",
2132 .type = FIO_OPT_INT,
2133 .off1 = td_var_offset(verify_interval),
2134 .minval = 2 * sizeof(struct verify_header),
2135 .help = "Store verify buffer header every N bytes",
2138 .interval = 2 * sizeof(struct verify_header),
2139 .category = FIO_OPT_C_IO,
2140 .group = FIO_OPT_G_VERIFY,
2143 .name = "verify_offset",
2144 .lname = "Verify offset",
2145 .type = FIO_OPT_INT,
2146 .help = "Offset verify header location by N bytes",
2147 .off1 = td_var_offset(verify_offset),
2148 .minval = sizeof(struct verify_header),
2151 .category = FIO_OPT_C_IO,
2152 .group = FIO_OPT_G_VERIFY,
2155 .name = "verify_pattern",
2156 .lname = "Verify pattern",
2157 .type = FIO_OPT_STR,
2158 .cb = str_verify_pattern_cb,
2159 .help = "Fill pattern for IO buffers",
2162 .category = FIO_OPT_C_IO,
2163 .group = FIO_OPT_G_VERIFY,
2166 .name = "verify_fatal",
2167 .lname = "Verify fatal",
2168 .type = FIO_OPT_BOOL,
2169 .off1 = td_var_offset(verify_fatal),
2171 .help = "Exit on a single verify failure, don't continue",
2174 .category = FIO_OPT_C_IO,
2175 .group = FIO_OPT_G_VERIFY,
2178 .name = "verify_dump",
2179 .lname = "Verify dump",
2180 .type = FIO_OPT_BOOL,
2181 .off1 = td_var_offset(verify_dump),
2183 .help = "Dump contents of good and bad blocks on failure",
2186 .category = FIO_OPT_C_IO,
2187 .group = FIO_OPT_G_VERIFY,
2190 .name = "verify_async",
2191 .lname = "Verify asynchronously",
2192 .type = FIO_OPT_INT,
2193 .off1 = td_var_offset(verify_async),
2195 .help = "Number of async verifier threads to use",
2198 .category = FIO_OPT_C_IO,
2199 .group = FIO_OPT_G_VERIFY,
2202 .name = "verify_backlog",
2203 .lname = "Verify backlog",
2204 .type = FIO_OPT_STR_VAL,
2205 .off1 = td_var_offset(verify_backlog),
2206 .help = "Verify after this number of blocks are written",
2209 .category = FIO_OPT_C_IO,
2210 .group = FIO_OPT_G_VERIFY,
2213 .name = "verify_backlog_batch",
2214 .lname = "Verify backlog batch",
2215 .type = FIO_OPT_INT,
2216 .off1 = td_var_offset(verify_batch),
2217 .help = "Verify this number of IO blocks",
2220 .category = FIO_OPT_C_IO,
2221 .group = FIO_OPT_G_VERIFY,
2223 #ifdef FIO_HAVE_CPU_AFFINITY
2225 .name = "verify_async_cpus",
2226 .lname = "Async verify CPUs",
2227 .type = FIO_OPT_STR,
2228 .cb = str_verify_cpus_allowed_cb,
2229 .help = "Set CPUs allowed for async verify threads",
2230 .parent = "verify_async",
2232 .category = FIO_OPT_C_IO,
2233 .group = FIO_OPT_G_VERIFY,
2237 .name = "experimental_verify",
2238 .off1 = td_var_offset(experimental_verify),
2239 .type = FIO_OPT_BOOL,
2240 .help = "Enable experimental verification",
2241 .category = FIO_OPT_C_IO,
2242 .group = FIO_OPT_G_VERIFY,
2244 #ifdef FIO_HAVE_TRIM
2246 .name = "trim_percentage",
2247 .lname = "Trim percentage",
2248 .type = FIO_OPT_INT,
2249 .off1 = td_var_offset(trim_percentage),
2252 .help = "Number of verify blocks to discard/trim",
2257 .category = FIO_OPT_C_IO,
2258 .group = FIO_OPT_G_TRIM,
2261 .name = "trim_verify_zero",
2262 .lname = "Verify trim zero",
2263 .type = FIO_OPT_BOOL,
2264 .help = "Verify that trim/discarded blocks are returned as zeroes",
2265 .off1 = td_var_offset(trim_zero),
2266 .parent = "trim_percentage",
2269 .category = FIO_OPT_C_IO,
2270 .group = FIO_OPT_G_TRIM,
2273 .name = "trim_backlog",
2274 .lname = "Trim backlog",
2275 .type = FIO_OPT_STR_VAL,
2276 .off1 = td_var_offset(trim_backlog),
2277 .help = "Trim after this number of blocks are written",
2278 .parent = "trim_percentage",
2281 .category = FIO_OPT_C_IO,
2282 .group = FIO_OPT_G_TRIM,
2285 .name = "trim_backlog_batch",
2286 .lname = "Trim backlog batch",
2287 .type = FIO_OPT_INT,
2288 .off1 = td_var_offset(trim_batch),
2289 .help = "Trim this number of IO blocks",
2290 .parent = "trim_percentage",
2293 .category = FIO_OPT_C_IO,
2294 .group = FIO_OPT_G_TRIM,
2298 .name = "write_iolog",
2299 .lname = "Write I/O log",
2300 .type = FIO_OPT_STR_STORE,
2301 .off1 = td_var_offset(write_iolog_file),
2302 .help = "Store IO pattern to file",
2303 .category = FIO_OPT_C_IO,
2304 .group = FIO_OPT_G_IOLOG,
2307 .name = "read_iolog",
2308 .lname = "Read I/O log",
2309 .type = FIO_OPT_STR_STORE,
2310 .off1 = td_var_offset(read_iolog_file),
2311 .help = "Playback IO pattern from file",
2312 .category = FIO_OPT_C_IO,
2313 .group = FIO_OPT_G_IOLOG,
2316 .name = "replay_no_stall",
2317 .lname = "Don't stall on replay",
2318 .type = FIO_OPT_BOOL,
2319 .off1 = td_var_offset(no_stall),
2321 .parent = "read_iolog",
2323 .help = "Playback IO pattern file as fast as possible without stalls",
2324 .category = FIO_OPT_C_IO,
2325 .group = FIO_OPT_G_IOLOG,
2328 .name = "replay_redirect",
2329 .lname = "Redirect device for replay",
2330 .type = FIO_OPT_STR_STORE,
2331 .off1 = td_var_offset(replay_redirect),
2332 .parent = "read_iolog",
2334 .help = "Replay all I/O onto this device, regardless of trace device",
2335 .category = FIO_OPT_C_IO,
2336 .group = FIO_OPT_G_IOLOG,
2339 .name = "exec_prerun",
2340 .lname = "Pre-execute runnable",
2341 .type = FIO_OPT_STR_STORE,
2342 .off1 = td_var_offset(exec_prerun),
2343 .help = "Execute this file prior to running job",
2344 .category = FIO_OPT_C_GENERAL,
2345 .group = FIO_OPT_G_INVALID,
2348 .name = "exec_postrun",
2349 .lname = "Post-execute runnable",
2350 .type = FIO_OPT_STR_STORE,
2351 .off1 = td_var_offset(exec_postrun),
2352 .help = "Execute this file after running job",
2353 .category = FIO_OPT_C_GENERAL,
2354 .group = FIO_OPT_G_INVALID,
2356 #ifdef FIO_HAVE_IOSCHED_SWITCH
2358 .name = "ioscheduler",
2359 .lname = "I/O scheduler",
2360 .type = FIO_OPT_STR_STORE,
2361 .off1 = td_var_offset(ioscheduler),
2362 .help = "Use this IO scheduler on the backing device",
2363 .category = FIO_OPT_C_FILE,
2364 .group = FIO_OPT_G_INVALID,
2369 .lname = "Zone size",
2370 .type = FIO_OPT_STR_VAL,
2371 .off1 = td_var_offset(zone_size),
2372 .help = "Amount of data to read per zone",
2374 .interval = 1024 * 1024,
2375 .category = FIO_OPT_C_IO,
2376 .group = FIO_OPT_G_ZONE,
2379 .name = "zonerange",
2380 .lname = "Zone range",
2381 .type = FIO_OPT_STR_VAL,
2382 .off1 = td_var_offset(zone_range),
2383 .help = "Give size of an IO zone",
2385 .interval = 1024 * 1024,
2386 .category = FIO_OPT_C_IO,
2387 .group = FIO_OPT_G_ZONE,
2391 .lname = "Zone skip",
2392 .type = FIO_OPT_STR_VAL,
2393 .off1 = td_var_offset(zone_skip),
2394 .help = "Space between IO zones",
2396 .interval = 1024 * 1024,
2397 .category = FIO_OPT_C_IO,
2398 .group = FIO_OPT_G_ZONE,
2402 .lname = "Lock memory",
2403 .type = FIO_OPT_STR_VAL,
2404 .off1 = td_var_offset(lockmem),
2405 .help = "Lock down this amount of memory (per worker)",
2407 .interval = 1024 * 1024,
2408 .category = FIO_OPT_C_GENERAL,
2409 .group = FIO_OPT_G_INVALID,
2412 .name = "rwmixread",
2413 .lname = "Read/write mix read",
2414 .type = FIO_OPT_INT,
2415 .cb = str_rwmix_read_cb,
2417 .help = "Percentage of mixed workload that is reads",
2420 .inverse = "rwmixwrite",
2421 .category = FIO_OPT_C_IO,
2422 .group = FIO_OPT_G_RWMIX,
2425 .name = "rwmixwrite",
2426 .lname = "Read/write mix write",
2427 .type = FIO_OPT_INT,
2428 .cb = str_rwmix_write_cb,
2430 .help = "Percentage of mixed workload that is writes",
2433 .inverse = "rwmixread",
2434 .category = FIO_OPT_C_IO,
2435 .group = FIO_OPT_G_RWMIX,
2438 .name = "rwmixcycle",
2439 .lname = "Read/write mix cycle",
2440 .type = FIO_OPT_DEPRECATED,
2441 .category = FIO_OPT_C_IO,
2442 .group = FIO_OPT_G_RWMIX,
2447 .type = FIO_OPT_INT,
2448 .off1 = td_var_offset(nice),
2449 .help = "Set job CPU nice value",
2454 .category = FIO_OPT_C_GENERAL,
2455 .group = FIO_OPT_G_CRED,
2457 #ifdef FIO_HAVE_IOPRIO
2460 .lname = "I/O nice priority",
2461 .type = FIO_OPT_INT,
2462 .off1 = td_var_offset(ioprio),
2463 .help = "Set job IO priority value",
2467 .category = FIO_OPT_C_GENERAL,
2468 .group = FIO_OPT_G_CRED,
2471 .name = "prioclass",
2472 .lname = "I/O nice priority class",
2473 .type = FIO_OPT_INT,
2474 .off1 = td_var_offset(ioprio_class),
2475 .help = "Set job IO priority class",
2479 .category = FIO_OPT_C_GENERAL,
2480 .group = FIO_OPT_G_CRED,
2484 .name = "thinktime",
2485 .lname = "Thinktime",
2486 .type = FIO_OPT_INT,
2487 .off1 = td_var_offset(thinktime),
2488 .help = "Idle time between IO buffers (usec)",
2490 .category = FIO_OPT_C_IO,
2491 .group = FIO_OPT_G_THINKTIME,
2494 .name = "thinktime_spin",
2495 .lname = "Thinktime spin",
2496 .type = FIO_OPT_INT,
2497 .off1 = td_var_offset(thinktime_spin),
2498 .help = "Start think time by spinning this amount (usec)",
2500 .parent = "thinktime",
2502 .category = FIO_OPT_C_IO,
2503 .group = FIO_OPT_G_THINKTIME,
2506 .name = "thinktime_blocks",
2507 .lname = "Thinktime blocks",
2508 .type = FIO_OPT_INT,
2509 .off1 = td_var_offset(thinktime_blocks),
2510 .help = "IO buffer period between 'thinktime'",
2512 .parent = "thinktime",
2514 .category = FIO_OPT_C_IO,
2515 .group = FIO_OPT_G_THINKTIME,
2519 .lname = "I/O rate",
2520 .type = FIO_OPT_INT,
2521 .off1 = td_var_offset(rate[DDIR_READ]),
2522 .off2 = td_var_offset(rate[DDIR_WRITE]),
2523 .off3 = td_var_offset(rate[DDIR_TRIM]),
2524 .help = "Set bandwidth rate",
2525 .category = FIO_OPT_C_IO,
2526 .group = FIO_OPT_G_RATE,
2530 .lname = "I/O min rate",
2531 .type = FIO_OPT_INT,
2532 .off1 = td_var_offset(ratemin[DDIR_READ]),
2533 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2534 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2535 .help = "Job must meet this rate or it will be shutdown",
2538 .category = FIO_OPT_C_IO,
2539 .group = FIO_OPT_G_RATE,
2542 .name = "rate_iops",
2543 .lname = "I/O rate IOPS",
2544 .type = FIO_OPT_INT,
2545 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2546 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2547 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2548 .help = "Limit IO used to this number of IO operations/sec",
2550 .category = FIO_OPT_C_IO,
2551 .group = FIO_OPT_G_RATE,
2554 .name = "rate_iops_min",
2555 .lname = "I/O min rate IOPS",
2556 .type = FIO_OPT_INT,
2557 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2558 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2559 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2560 .help = "Job must meet this rate or it will be shut down",
2561 .parent = "rate_iops",
2563 .category = FIO_OPT_C_IO,
2564 .group = FIO_OPT_G_RATE,
2567 .name = "ratecycle",
2568 .lname = "I/O rate cycle",
2569 .type = FIO_OPT_INT,
2570 .off1 = td_var_offset(ratecycle),
2571 .help = "Window average for rate limits (msec)",
2575 .category = FIO_OPT_C_IO,
2576 .group = FIO_OPT_G_RATE,
2579 .name = "max_latency",
2580 .type = FIO_OPT_INT,
2581 .off1 = td_var_offset(max_latency),
2582 .help = "Maximum tolerated IO latency (usec)",
2583 .category = FIO_OPT_C_IO,
2584 .group = FIO_OPT_G_RATE,
2587 .name = "invalidate",
2588 .lname = "Cache invalidate",
2589 .type = FIO_OPT_BOOL,
2590 .off1 = td_var_offset(invalidate_cache),
2591 .help = "Invalidate buffer/page cache prior to running job",
2593 .category = FIO_OPT_C_IO,
2594 .group = FIO_OPT_G_IO_TYPE,
2598 .lname = "Synchronous I/O",
2599 .type = FIO_OPT_BOOL,
2600 .off1 = td_var_offset(sync_io),
2601 .help = "Use O_SYNC for buffered writes",
2603 .parent = "buffered",
2605 .category = FIO_OPT_C_IO,
2606 .group = FIO_OPT_G_IO_TYPE,
2609 .name = "create_serialize",
2610 .lname = "Create serialize",
2611 .type = FIO_OPT_BOOL,
2612 .off1 = td_var_offset(create_serialize),
2613 .help = "Serialize creating of job files",
2615 .category = FIO_OPT_C_FILE,
2616 .group = FIO_OPT_G_INVALID,
2619 .name = "create_fsync",
2620 .lname = "Create fsync",
2621 .type = FIO_OPT_BOOL,
2622 .off1 = td_var_offset(create_fsync),
2623 .help = "fsync file after creation",
2625 .category = FIO_OPT_C_FILE,
2626 .group = FIO_OPT_G_INVALID,
2629 .name = "create_on_open",
2630 .lname = "Create on open",
2631 .type = FIO_OPT_BOOL,
2632 .off1 = td_var_offset(create_on_open),
2633 .help = "Create files when they are opened for IO",
2635 .category = FIO_OPT_C_FILE,
2636 .group = FIO_OPT_G_INVALID,
2639 .name = "create_only",
2640 .type = FIO_OPT_BOOL,
2641 .off1 = td_var_offset(create_only),
2642 .help = "Only perform file creation phase",
2643 .category = FIO_OPT_C_FILE,
2648 .lname = "Pre-read files",
2649 .type = FIO_OPT_BOOL,
2650 .off1 = td_var_offset(pre_read),
2651 .help = "Pre-read files before starting official testing",
2653 .category = FIO_OPT_C_FILE,
2654 .group = FIO_OPT_G_INVALID,
2656 #ifdef FIO_HAVE_CPU_AFFINITY
2659 .lname = "CPU mask",
2660 .type = FIO_OPT_INT,
2661 .cb = str_cpumask_cb,
2662 .help = "CPU affinity mask",
2663 .category = FIO_OPT_C_GENERAL,
2664 .group = FIO_OPT_G_CRED,
2667 .name = "cpus_allowed",
2668 .lname = "CPUs allowed",
2669 .type = FIO_OPT_STR,
2670 .cb = str_cpus_allowed_cb,
2671 .help = "Set CPUs allowed",
2672 .category = FIO_OPT_C_GENERAL,
2673 .group = FIO_OPT_G_CRED,
2676 #ifdef CONFIG_LIBNUMA
2678 .name = "numa_cpu_nodes",
2679 .type = FIO_OPT_STR,
2680 .cb = str_numa_cpunodes_cb,
2681 .help = "NUMA CPU nodes bind",
2682 .category = FIO_OPT_C_GENERAL,
2683 .group = FIO_OPT_G_INVALID,
2686 .name = "numa_mem_policy",
2687 .type = FIO_OPT_STR,
2688 .cb = str_numa_mpol_cb,
2689 .help = "NUMA memory policy setup",
2690 .category = FIO_OPT_C_GENERAL,
2691 .group = FIO_OPT_G_INVALID,
2695 .name = "end_fsync",
2696 .lname = "End fsync",
2697 .type = FIO_OPT_BOOL,
2698 .off1 = td_var_offset(end_fsync),
2699 .help = "Include fsync at the end of job",
2701 .category = FIO_OPT_C_FILE,
2702 .group = FIO_OPT_G_INVALID,
2705 .name = "fsync_on_close",
2706 .lname = "Fsync on close",
2707 .type = FIO_OPT_BOOL,
2708 .off1 = td_var_offset(fsync_on_close),
2709 .help = "fsync files on close",
2711 .category = FIO_OPT_C_FILE,
2712 .group = FIO_OPT_G_INVALID,
2716 .lname = "Unlink file",
2717 .type = FIO_OPT_BOOL,
2718 .off1 = td_var_offset(unlink),
2719 .help = "Unlink created files after job has completed",
2721 .category = FIO_OPT_C_FILE,
2722 .group = FIO_OPT_G_INVALID,
2726 .lname = "Exit-all on terminate",
2727 .type = FIO_OPT_STR_SET,
2728 .cb = str_exitall_cb,
2729 .help = "Terminate all jobs when one exits",
2730 .category = FIO_OPT_C_GENERAL,
2731 .group = FIO_OPT_G_PROCESS,
2734 .name = "stonewall",
2735 .lname = "Wait for previous",
2736 .alias = "wait_for_previous",
2737 .type = FIO_OPT_STR_SET,
2738 .off1 = td_var_offset(stonewall),
2739 .help = "Insert a hard barrier between this job and previous",
2740 .category = FIO_OPT_C_GENERAL,
2741 .group = FIO_OPT_G_PROCESS,
2744 .name = "new_group",
2745 .lname = "New group",
2746 .type = FIO_OPT_STR_SET,
2747 .off1 = td_var_offset(new_group),
2748 .help = "Mark the start of a new group (for reporting)",
2749 .category = FIO_OPT_C_GENERAL,
2750 .group = FIO_OPT_G_PROCESS,
2755 .type = FIO_OPT_STR_SET,
2756 .off1 = td_var_offset(use_thread),
2757 .help = "Use threads instead of processes",
2758 .category = FIO_OPT_C_GENERAL,
2759 .group = FIO_OPT_G_PROCESS,
2762 .name = "write_bw_log",
2763 .lname = "Write bandwidth log",
2764 .type = FIO_OPT_STR_STORE,
2765 .off1 = td_var_offset(bw_log_file),
2766 .help = "Write log of bandwidth during run",
2767 .category = FIO_OPT_C_LOG,
2768 .group = FIO_OPT_G_INVALID,
2771 .name = "write_lat_log",
2772 .lname = "Write latency log",
2773 .type = FIO_OPT_STR_STORE,
2774 .off1 = td_var_offset(lat_log_file),
2775 .help = "Write log of latency during run",
2776 .category = FIO_OPT_C_LOG,
2777 .group = FIO_OPT_G_INVALID,
2780 .name = "write_iops_log",
2781 .lname = "Write IOPS log",
2782 .type = FIO_OPT_STR_STORE,
2783 .off1 = td_var_offset(iops_log_file),
2784 .help = "Write log of IOPS during run",
2785 .category = FIO_OPT_C_LOG,
2786 .group = FIO_OPT_G_INVALID,
2789 .name = "log_avg_msec",
2790 .lname = "Log averaging (msec)",
2791 .type = FIO_OPT_INT,
2792 .off1 = td_var_offset(log_avg_msec),
2793 .help = "Average bw/iops/lat logs over this period of time",
2795 .category = FIO_OPT_C_LOG,
2796 .group = FIO_OPT_G_INVALID,
2799 .name = "bwavgtime",
2800 .lname = "Bandwidth average time",
2801 .type = FIO_OPT_INT,
2802 .off1 = td_var_offset(bw_avg_time),
2803 .help = "Time window over which to calculate bandwidth"
2806 .parent = "write_bw_log",
2809 .category = FIO_OPT_C_LOG,
2810 .group = FIO_OPT_G_INVALID,
2813 .name = "iopsavgtime",
2814 .lname = "IOPS average time",
2815 .type = FIO_OPT_INT,
2816 .off1 = td_var_offset(iops_avg_time),
2817 .help = "Time window over which to calculate IOPS (msec)",
2819 .parent = "write_iops_log",
2822 .category = FIO_OPT_C_LOG,
2823 .group = FIO_OPT_G_INVALID,
2826 .name = "group_reporting",
2827 .lname = "Group reporting",
2828 .type = FIO_OPT_STR_SET,
2829 .off1 = td_var_offset(group_reporting),
2830 .help = "Do reporting on a per-group basis",
2831 .category = FIO_OPT_C_STAT,
2832 .group = FIO_OPT_G_INVALID,
2835 .name = "zero_buffers",
2836 .lname = "Zero I/O buffers",
2837 .type = FIO_OPT_STR_SET,
2838 .off1 = td_var_offset(zero_buffers),
2839 .help = "Init IO buffers to all zeroes",
2840 .category = FIO_OPT_C_IO,
2841 .group = FIO_OPT_G_IO_BUF,
2844 .name = "refill_buffers",
2845 .lname = "Refill I/O buffers",
2846 .type = FIO_OPT_STR_SET,
2847 .off1 = td_var_offset(refill_buffers),
2848 .help = "Refill IO buffers on every IO submit",
2849 .category = FIO_OPT_C_IO,
2850 .group = FIO_OPT_G_IO_BUF,
2853 .name = "scramble_buffers",
2854 .lname = "Scramble I/O buffers",
2855 .type = FIO_OPT_BOOL,
2856 .off1 = td_var_offset(scramble_buffers),
2857 .help = "Slightly scramble buffers on every IO submit",
2859 .category = FIO_OPT_C_IO,
2860 .group = FIO_OPT_G_IO_BUF,
2863 .name = "buffer_compress_percentage",
2864 .lname = "Buffer compression percentage",
2865 .type = FIO_OPT_INT,
2866 .off1 = td_var_offset(compress_percentage),
2869 .help = "How compressible the buffer is (approximately)",
2871 .category = FIO_OPT_C_IO,
2872 .group = FIO_OPT_G_IO_BUF,
2875 .name = "buffer_compress_chunk",
2876 .lname = "Buffer compression chunk size",
2877 .type = FIO_OPT_INT,
2878 .off1 = td_var_offset(compress_chunk),
2879 .parent = "buffer_compress_percentage",
2881 .help = "Size of compressible region in buffer",
2883 .category = FIO_OPT_C_IO,
2884 .group = FIO_OPT_G_IO_BUF,
2887 .name = "clat_percentiles",
2888 .lname = "Completion latency percentiles",
2889 .type = FIO_OPT_BOOL,
2890 .off1 = td_var_offset(clat_percentiles),
2891 .help = "Enable the reporting of completion latency percentiles",
2893 .category = FIO_OPT_C_STAT,
2894 .group = FIO_OPT_G_INVALID,
2897 .name = "percentile_list",
2898 .lname = "Completion latency percentile list",
2899 .type = FIO_OPT_FLOAT_LIST,
2900 .off1 = td_var_offset(percentile_list),
2901 .off2 = td_var_offset(percentile_precision),
2902 .help = "Specify a custom list of percentiles to report",
2903 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
2904 .maxlen = FIO_IO_U_LIST_MAX_LEN,
2907 .category = FIO_OPT_C_STAT,
2908 .group = FIO_OPT_G_INVALID,
2911 #ifdef FIO_HAVE_DISK_UTIL
2913 .name = "disk_util",
2914 .lname = "Disk utilization",
2915 .type = FIO_OPT_BOOL,
2916 .off1 = td_var_offset(do_disk_util),
2917 .help = "Log disk utilization statistics",
2919 .category = FIO_OPT_C_STAT,
2920 .group = FIO_OPT_G_INVALID,
2924 .name = "gtod_reduce",
2925 .lname = "Reduce gettimeofday() calls",
2926 .type = FIO_OPT_BOOL,
2927 .help = "Greatly reduce number of gettimeofday() calls",
2928 .cb = str_gtod_reduce_cb,
2931 .category = FIO_OPT_C_STAT,
2932 .group = FIO_OPT_G_INVALID,
2935 .name = "disable_lat",
2936 .lname = "Disable all latency stats",
2937 .type = FIO_OPT_BOOL,
2938 .off1 = td_var_offset(disable_lat),
2939 .help = "Disable latency numbers",
2940 .parent = "gtod_reduce",
2943 .category = FIO_OPT_C_STAT,
2944 .group = FIO_OPT_G_INVALID,
2947 .name = "disable_clat",
2948 .lname = "Disable completion latency stats",
2949 .type = FIO_OPT_BOOL,
2950 .off1 = td_var_offset(disable_clat),
2951 .help = "Disable completion latency numbers",
2952 .parent = "gtod_reduce",
2955 .category = FIO_OPT_C_STAT,
2956 .group = FIO_OPT_G_INVALID,
2959 .name = "disable_slat",
2960 .lname = "Disable submission latency stats",
2961 .type = FIO_OPT_BOOL,
2962 .off1 = td_var_offset(disable_slat),
2963 .help = "Disable submission latency numbers",
2964 .parent = "gtod_reduce",
2967 .category = FIO_OPT_C_STAT,
2968 .group = FIO_OPT_G_INVALID,
2971 .name = "disable_bw_measurement",
2972 .lname = "Disable bandwidth stats",
2973 .type = FIO_OPT_BOOL,
2974 .off1 = td_var_offset(disable_bw),
2975 .help = "Disable bandwidth logging",
2976 .parent = "gtod_reduce",
2979 .category = FIO_OPT_C_STAT,
2980 .group = FIO_OPT_G_INVALID,
2984 .lname = "Dedicated gettimeofday() CPU",
2985 .type = FIO_OPT_INT,
2986 .cb = str_gtod_cpu_cb,
2987 .help = "Set up dedicated gettimeofday() thread on this CPU",
2988 .verify = gtod_cpu_verify,
2989 .category = FIO_OPT_C_GENERAL,
2990 .group = FIO_OPT_G_CLOCK,
2993 .name = "unified_rw_reporting",
2994 .type = FIO_OPT_BOOL,
2995 .off1 = td_var_offset(unified_rw_rep),
2996 .help = "Unify reporting across data direction",
2998 .category = FIO_OPT_C_GENERAL,
2999 .group = FIO_OPT_G_INVALID,
3002 .name = "continue_on_error",
3003 .lname = "Continue on error",
3004 .type = FIO_OPT_STR,
3005 .off1 = td_var_offset(continue_on_error),
3006 .help = "Continue on non-fatal errors during IO",
3008 .category = FIO_OPT_C_GENERAL,
3009 .group = FIO_OPT_G_ERR,
3012 .oval = ERROR_TYPE_NONE,
3013 .help = "Exit when an error is encountered",
3016 .oval = ERROR_TYPE_READ,
3017 .help = "Continue on read errors only",
3020 .oval = ERROR_TYPE_WRITE,
3021 .help = "Continue on write errors only",
3024 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3025 .help = "Continue on any IO errors",
3028 .oval = ERROR_TYPE_VERIFY,
3029 .help = "Continue on verify errors only",
3032 .oval = ERROR_TYPE_ANY,
3033 .help = "Continue on all io and verify errors",
3036 .oval = ERROR_TYPE_NONE,
3037 .help = "Alias for 'none'",
3040 .oval = ERROR_TYPE_ANY,
3041 .help = "Alias for 'all'",
3046 .name = "ignore_error",
3047 .type = FIO_OPT_STR,
3048 .cb = str_ignore_error_cb,
3049 .help = "Set a specific list of errors to ignore",
3051 .category = FIO_OPT_C_GENERAL,
3052 .group = FIO_OPT_G_ERR,
3055 .name = "error_dump",
3056 .type = FIO_OPT_BOOL,
3057 .off1 = td_var_offset(error_dump),
3059 .help = "Dump info on each error",
3060 .category = FIO_OPT_C_GENERAL,
3061 .group = FIO_OPT_G_ERR,
3066 .type = FIO_OPT_STR_STORE,
3067 .off1 = td_var_offset(profile),
3068 .help = "Select a specific builtin performance test",
3069 .category = FIO_OPT_C_PROFILE,
3070 .group = FIO_OPT_G_INVALID,
3075 .type = FIO_OPT_STR_STORE,
3076 .off1 = td_var_offset(cgroup),
3077 .help = "Add job to cgroup of this name",
3078 .category = FIO_OPT_C_GENERAL,
3079 .group = FIO_OPT_G_CGROUP,
3082 .name = "cgroup_nodelete",
3083 .lname = "Cgroup no-delete",
3084 .type = FIO_OPT_BOOL,
3085 .off1 = td_var_offset(cgroup_nodelete),
3086 .help = "Do not delete cgroups after job completion",
3089 .category = FIO_OPT_C_GENERAL,
3090 .group = FIO_OPT_G_CGROUP,
3093 .name = "cgroup_weight",
3094 .lname = "Cgroup weight",
3095 .type = FIO_OPT_INT,
3096 .off1 = td_var_offset(cgroup_weight),
3097 .help = "Use given weight for cgroup",
3101 .category = FIO_OPT_C_GENERAL,
3102 .group = FIO_OPT_G_CGROUP,
3107 .type = FIO_OPT_INT,
3108 .off1 = td_var_offset(uid),
3109 .help = "Run job with this user ID",
3110 .category = FIO_OPT_C_GENERAL,
3111 .group = FIO_OPT_G_CRED,
3115 .lname = "Group ID",
3116 .type = FIO_OPT_INT,
3117 .off1 = td_var_offset(gid),
3118 .help = "Run job with this group ID",
3119 .category = FIO_OPT_C_GENERAL,
3120 .group = FIO_OPT_G_CRED,
3125 .type = FIO_OPT_INT,
3126 .off1 = td_var_offset(kb_base),
3132 .help = "Use 1024 as the K base",
3136 .help = "Use 1000 as the K base",
3139 .help = "How many bytes per KB for reporting (1000 or 1024)",
3140 .category = FIO_OPT_C_GENERAL,
3141 .group = FIO_OPT_G_INVALID,
3144 .name = "unit_base",
3145 .lname = "Base unit for reporting (Bits or Bytes)",
3146 .type = FIO_OPT_INT,
3147 .off1 = td_var_offset(unit_base),
3152 .help = "Auto-detect",
3156 .help = "Normal (byte based)",
3160 .help = "Bit based",
3163 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3164 .category = FIO_OPT_C_GENERAL,
3165 .group = FIO_OPT_G_INVALID,
3168 .name = "hugepage-size",
3169 .lname = "Hugepage size",
3170 .type = FIO_OPT_INT,
3171 .off1 = td_var_offset(hugepage_size),
3172 .help = "When using hugepages, specify size of each page",
3173 .def = __fio_stringify(FIO_HUGE_PAGE),
3174 .interval = 1024 * 1024,
3175 .category = FIO_OPT_C_GENERAL,
3176 .group = FIO_OPT_G_INVALID,
3180 .lname = "I/O flow ID",
3181 .type = FIO_OPT_INT,
3182 .off1 = td_var_offset(flow_id),
3183 .help = "The flow index ID to use",
3185 .category = FIO_OPT_C_IO,
3186 .group = FIO_OPT_G_IO_FLOW,
3190 .lname = "I/O flow weight",
3191 .type = FIO_OPT_INT,
3192 .off1 = td_var_offset(flow),
3193 .help = "Weight for flow control of this job",
3194 .parent = "flow_id",
3197 .category = FIO_OPT_C_IO,
3198 .group = FIO_OPT_G_IO_FLOW,
3201 .name = "flow_watermark",
3202 .lname = "I/O flow watermark",
3203 .type = FIO_OPT_INT,
3204 .off1 = td_var_offset(flow_watermark),
3205 .help = "High watermark for flow control. This option"
3206 " should be set to the same value for all threads"
3207 " with non-zero flow.",
3208 .parent = "flow_id",
3211 .category = FIO_OPT_C_IO,
3212 .group = FIO_OPT_G_IO_FLOW,
3215 .name = "flow_sleep",
3216 .lname = "I/O flow sleep",
3217 .type = FIO_OPT_INT,
3218 .off1 = td_var_offset(flow_sleep),
3219 .help = "How many microseconds to sleep after being held"
3220 " back by the flow control mechanism",
3221 .parent = "flow_id",
3224 .category = FIO_OPT_C_IO,
3225 .group = FIO_OPT_G_IO_FLOW,
3232 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3233 const char *name, int val)
3235 lopt->name = (char *) name;
3237 if (o->type == FIO_OPT_STR_SET)
3238 lopt->has_arg = no_argument;
3240 lopt->has_arg = required_argument;
3243 static void options_to_lopts(struct fio_option *opts,
3244 struct option *long_options,
3245 int i, int option_type)
3247 struct fio_option *o = &opts[0];
3249 add_to_lopt(&long_options[i], o, o->name, option_type);
3252 add_to_lopt(&long_options[i], o, o->alias, option_type);
3257 assert(i < FIO_NR_OPTIONS);
3261 void fio_options_set_ioengine_opts(struct option *long_options,
3262 struct thread_data *td)
3267 while (long_options[i].name) {
3268 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3269 memset(&long_options[i], 0, sizeof(*long_options));
3276 * Just clear out the prior ioengine options.
3281 options_to_lopts(td->io_ops->options, long_options, i,
3282 FIO_GETOPT_IOENGINE);
3285 void fio_options_dup_and_init(struct option *long_options)
3289 options_init(fio_options);
3292 while (long_options[i].name)
3295 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3298 struct fio_keyword {
3304 static struct fio_keyword fio_keywords[] = {
3306 .word = "$pagesize",
3307 .desc = "Page size in the system",
3310 .word = "$mb_memory",
3311 .desc = "Megabytes of memory online",
3315 .desc = "Number of CPUs online in the system",
3322 void fio_keywords_init(void)
3324 unsigned long long mb_memory;
3328 sprintf(buf, "%lu", (unsigned long) page_size);
3329 fio_keywords[0].replace = strdup(buf);
3331 mb_memory = os_phys_mem() / (1024 * 1024);
3332 sprintf(buf, "%llu", mb_memory);
3333 fio_keywords[1].replace = strdup(buf);
3336 sprintf(buf, "%lu", l);
3337 fio_keywords[2].replace = strdup(buf);
3342 static char *bc_calc(char *str)
3344 char buf[128], *tmp;
3349 * No math, just return string
3351 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3352 !strchr(str, '/')) || strchr(str, '\''))
3356 * Split option from value, we only need to calculate the value
3358 tmp = strchr(str, '=');
3365 * Prevent buffer overflows; such a case isn't reasonable anyway
3367 if (strlen(str) >= 128 || strlen(tmp) > 100)
3370 sprintf(buf, "which %s > /dev/null", BC_APP);
3372 log_err("fio: bc is needed for performing math\n");
3376 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3377 f = popen(buf, "r");
3381 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3386 buf[(tmp - str) + ret - 1] = '\0';
3387 memcpy(buf, str, tmp - str);
3393 * Return a copy of the input string with substrings of the form ${VARNAME}
3394 * substituted with the value of the environment variable VARNAME. The
3395 * substitution always occurs, even if VARNAME is empty or the corresponding
3396 * environment variable undefined.
3398 static char *option_dup_subs(const char *opt)
3400 char out[OPT_LEN_MAX+1];
3401 char in[OPT_LEN_MAX+1];
3404 char *ch1, *ch2, *env;
3405 ssize_t nchr = OPT_LEN_MAX;
3408 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3409 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3413 in[OPT_LEN_MAX] = '\0';
3414 strncpy(in, opt, OPT_LEN_MAX);
3416 while (*inptr && nchr > 0) {
3417 if (inptr[0] == '$' && inptr[1] == '{') {
3418 ch2 = strchr(inptr, '}');
3419 if (ch2 && inptr+1 < ch2) {
3426 envlen = strlen(env);
3427 if (envlen <= nchr) {
3428 memcpy(outptr, env, envlen);
3438 *outptr++ = *inptr++;
3447 * Look for reserved variable names and replace them with real values
3449 static char *fio_keyword_replace(char *opt)
3455 for (i = 0; fio_keywords[i].word != NULL; i++) {
3456 struct fio_keyword *kw = &fio_keywords[i];
3458 while ((s = strstr(opt, kw->word)) != NULL) {
3459 char *new = malloc(strlen(opt) + 1);
3465 * Copy part of the string before the keyword and
3466 * sprintf() the replacement after it.
3468 memcpy(new, opt, olen);
3469 len = sprintf(new + olen, "%s", kw->replace);
3472 * If there's more in the original string, copy that
3475 opt += strlen(kw->word) + olen;
3477 memcpy(new + olen + len, opt, opt - o_org - 1);
3480 * replace opt and free the old opt
3490 * Check for potential math and invoke bc, if possible
3498 static char **dup_and_sub_options(char **opts, int num_opts)
3501 char **opts_copy = malloc(num_opts * sizeof(*opts));
3502 for (i = 0; i < num_opts; i++) {
3503 opts_copy[i] = option_dup_subs(opts[i]);
3506 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3511 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
3513 int i, ret, unknown;
3516 sort_options(opts, fio_options, num_opts);
3517 opts_copy = dup_and_sub_options(opts, num_opts);
3519 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3520 struct fio_option *o;
3521 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3530 opts_copy[i] = NULL;
3537 ret |= ioengine_load(td);
3539 sort_options(opts_copy, td->io_ops->options, num_opts);
3542 for (i = 0; i < num_opts; i++) {
3543 struct fio_option *o = NULL;
3549 newret = parse_option(opts_copy[i], opts[i],
3550 td->io_ops->options, &o,
3555 log_err("Bad option <%s>\n", opts[i]);
3558 opts_copy[i] = NULL;
3566 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3568 return parse_cmd_option(opt, val, fio_options, td);
3571 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3574 return parse_cmd_option(opt, val, td->io_ops->options, td);
3577 void fio_fill_default_options(struct thread_data *td)
3579 fill_default_options(td, fio_options);
3582 int fio_show_option_help(const char *opt)
3584 return show_cmd_help(fio_options, opt);
3587 void options_mem_dupe(void *data, struct fio_option *options)
3589 struct fio_option *o;
3592 for (o = &options[0]; o->name; o++) {
3593 if (o->type != FIO_OPT_STR_STORE)
3596 ptr = td_var(data, o->off1);
3598 *ptr = strdup(*ptr);
3603 * dupe FIO_OPT_STR_STORE options
3605 void fio_options_mem_dupe(struct thread_data *td)
3607 options_mem_dupe(&td->o, fio_options);
3609 if (td->eo && td->io_ops) {
3610 void *oldeo = td->eo;
3612 td->eo = malloc(td->io_ops->option_struct_size);
3613 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3614 options_mem_dupe(td->eo, td->io_ops->options);
3618 unsigned int fio_get_kb_base(void *data)
3620 struct thread_options *o = data;
3621 unsigned int kb_base = 0;
3624 kb_base = o->kb_base;
3631 int add_option(struct fio_option *o)
3633 struct fio_option *__o;
3642 memcpy(&fio_options[opt_index], o, sizeof(*o));
3646 void invalidate_profile_options(const char *prof_name)
3648 struct fio_option *o;
3652 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3653 o->type = FIO_OPT_INVALID;
3654 o->prof_name = NULL;
3660 void add_opt_posval(const char *optname, const char *ival, const char *help)
3662 struct fio_option *o;
3665 o = find_option(fio_options, optname);
3669 for (i = 0; i < PARSE_MAX_VP; i++) {
3670 if (o->posval[i].ival)
3673 o->posval[i].ival = ival;
3674 o->posval[i].help = help;
3679 void del_opt_posval(const char *optname, const char *ival)
3681 struct fio_option *o;
3684 o = find_option(fio_options, optname);
3688 for (i = 0; i < PARSE_MAX_VP; i++) {
3689 if (!o->posval[i].ival)
3691 if (strcmp(o->posval[i].ival, ival))
3694 o->posval[i].ival = NULL;
3695 o->posval[i].help = NULL;
3699 void fio_options_free(struct thread_data *td)
3701 options_free(fio_options, td);
3702 if (td->eo && td->io_ops && td->io_ops->options) {
3703 options_free(td->io_ops->options, td->eo);
3709 struct fio_option *fio_option_find(const char *name)
3711 return find_option(fio_options, name);