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",
279 td->o.continue_on_error |= 1 << etype;
280 td->o.ignore_error_nr[etype] = i;
281 td->o.ignore_error[etype] = error;
287 static int str_ignore_error_cb(void *data, const char *input)
289 struct thread_data *td = data;
291 int type = 0, ret = 1;
292 p = str = strdup(input);
294 strip_blank_front(&str);
295 strip_blank_end(str);
301 ret = ignore_error_type(td, type, p);
311 static int str_rw_cb(void *data, const char *str)
313 struct thread_data *td = data;
314 struct thread_options *o = &td->o;
315 char *nr = get_opt_postfix(str);
324 o->ddir_seq_nr = atoi(nr);
328 if (str_to_decimal(nr, &val, 1, o)) {
329 log_err("fio: rw postfix parsing failed\n");
334 o->ddir_seq_add = val;
341 static int str_mem_cb(void *data, const char *mem)
343 struct thread_data *td = data;
345 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
346 td->o.mmapfile = get_opt_postfix(mem);
351 static int fio_clock_source_cb(void *data, const char *str)
353 struct thread_data *td = data;
355 fio_clock_source = td->o.clocksource;
356 fio_clock_source_set = 1;
361 static int str_rwmix_read_cb(void *data, unsigned long long *val)
363 struct thread_data *td = data;
365 td->o.rwmix[DDIR_READ] = *val;
366 td->o.rwmix[DDIR_WRITE] = 100 - *val;
370 static int str_rwmix_write_cb(void *data, unsigned long long *val)
372 struct thread_data *td = data;
374 td->o.rwmix[DDIR_WRITE] = *val;
375 td->o.rwmix[DDIR_READ] = 100 - *val;
379 static int str_perc_rand_cb(void *data, unsigned long long *val)
381 struct thread_data *td = data;
383 td->o.perc_rand = *val;
387 static int str_perc_seq_cb(void *data, unsigned long long *val)
389 struct thread_data *td = data;
391 td->o.perc_rand = 100 - *val;
396 static int str_exitall_cb(void)
398 exitall_on_terminate = 1;
402 #ifdef FIO_HAVE_CPU_AFFINITY
403 static int str_cpumask_cb(void *data, unsigned long long *val)
405 struct thread_data *td = data;
410 ret = fio_cpuset_init(&td->o.cpumask);
412 log_err("fio: cpuset_init failed\n");
413 td_verror(td, ret, "fio_cpuset_init");
417 max_cpu = cpus_online();
419 for (i = 0; i < sizeof(int) * 8; i++) {
420 if ((1 << i) & *val) {
422 log_err("fio: CPU %d too large (max=%ld)\n", i,
426 dprint(FD_PARSE, "set cpu allowed %d\n", i);
427 fio_cpu_set(&td->o.cpumask, i);
431 td->o.cpumask_set = 1;
435 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
442 ret = fio_cpuset_init(mask);
444 log_err("fio: cpuset_init failed\n");
445 td_verror(td, ret, "fio_cpuset_init");
449 p = str = strdup(input);
451 strip_blank_front(&str);
452 strip_blank_end(str);
454 max_cpu = cpus_online();
456 while ((cpu = strsep(&str, ",")) != NULL) {
465 while ((cpu2 = strsep(&str2, "-")) != NULL) {
475 while (icpu <= icpu2) {
476 if (icpu >= FIO_MAX_CPUS) {
477 log_err("fio: your OS only supports up to"
478 " %d CPUs\n", (int) FIO_MAX_CPUS);
482 if (icpu > max_cpu) {
483 log_err("fio: CPU %d too large (max=%ld)\n",
489 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
490 fio_cpu_set(mask, icpu);
499 td->o.cpumask_set = 1;
503 static int str_cpus_allowed_cb(void *data, const char *input)
505 struct thread_data *td = data;
508 ret = set_cpus_allowed(td, &td->o.cpumask, input);
510 td->o.cpumask_set = 1;
515 static int str_verify_cpus_allowed_cb(void *data, const char *input)
517 struct thread_data *td = data;
520 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
522 td->o.verify_cpumask_set = 1;
528 #ifdef CONFIG_LIBNUMA
529 static int str_numa_cpunodes_cb(void *data, char *input)
531 struct thread_data *td = data;
533 /* numa_parse_nodestring() parses a character string list
534 * of nodes into a bit mask. The bit mask is allocated by
535 * numa_allocate_nodemask(), so it should be freed by
536 * numa_free_nodemask().
538 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
539 if (td->o.numa_cpunodesmask == NULL) {
540 log_err("fio: numa_parse_nodestring failed\n");
541 td_verror(td, 1, "str_numa_cpunodes_cb");
545 td->o.numa_cpumask_set = 1;
549 static int str_numa_mpol_cb(void *data, char *input)
551 struct thread_data *td = data;
552 const char * const policy_types[] =
553 { "default", "prefer", "bind", "interleave", "local" };
556 char *nodelist = strchr(input, ':');
558 /* NUL-terminate mode */
562 for (i = 0; i <= MPOL_LOCAL; i++) {
563 if (!strcmp(input, policy_types[i])) {
564 td->o.numa_mem_mode = i;
568 if (i > MPOL_LOCAL) {
569 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
573 switch (td->o.numa_mem_mode) {
576 * Insist on a nodelist of one node only
579 char *rest = nodelist;
580 while (isdigit(*rest))
583 log_err("fio: one node only for \'prefer\'\n");
587 log_err("fio: one node is needed for \'prefer\'\n");
591 case MPOL_INTERLEAVE:
593 * Default to online nodes with memory if no nodelist
596 nodelist = strdup("all");
601 * Don't allow a nodelist
604 log_err("fio: NO nodelist for \'local\'\n");
610 * Insist on a nodelist
613 log_err("fio: a nodelist is needed for \'bind\'\n");
620 /* numa_parse_nodestring() parses a character string list
621 * of nodes into a bit mask. The bit mask is allocated by
622 * numa_allocate_nodemask(), so it should be freed by
623 * numa_free_nodemask().
625 switch (td->o.numa_mem_mode) {
627 td->o.numa_mem_prefer_node = atoi(nodelist);
629 case MPOL_INTERLEAVE:
631 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
632 if (td->o.numa_memnodesmask == NULL) {
633 log_err("fio: numa_parse_nodestring failed\n");
634 td_verror(td, 1, "str_numa_memnodes_cb");
644 td->o.numa_memmask_set = 1;
652 static int str_fst_cb(void *data, const char *str)
654 struct thread_data *td = data;
655 char *nr = get_opt_postfix(str);
657 td->file_service_nr = 1;
659 td->file_service_nr = atoi(nr);
666 #ifdef CONFIG_SYNC_FILE_RANGE
667 static int str_sfr_cb(void *data, const char *str)
669 struct thread_data *td = data;
670 char *nr = get_opt_postfix(str);
672 td->sync_file_range_nr = 1;
674 td->sync_file_range_nr = atoi(nr);
682 static int str_random_distribution_cb(void *data, const char *str)
684 struct thread_data *td = data;
688 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
690 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
695 nr = get_opt_postfix(str);
696 if (nr && !str_to_float(nr, &val)) {
697 log_err("fio: random postfix parsing failed\n");
704 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
706 log_err("fio: zipf theta must different than 1.0\n");
709 td->o.zipf_theta.u.f = val;
711 if (val <= 0.00 || val >= 1.00) {
712 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
715 td->o.pareto_h.u.f = val;
722 * Return next file in the string. Files are separated with ':'. If the ':'
723 * is escaped with a '\', then that ':' is part of the filename and does not
724 * indicate a new file.
726 static char *get_next_file_name(char **ptr)
731 if (!str || !strlen(str))
737 * No colon, we are done
739 p = strchr(str, ':');
746 * We got a colon, but it's the first character. Skip and
754 if (*(p - 1) != '\\') {
760 memmove(p - 1, p, strlen(p) + 1);
767 static int str_filename_cb(void *data, const char *input)
769 struct thread_data *td = data;
770 char *fname, *str, *p;
772 p = str = strdup(input);
774 strip_blank_front(&str);
775 strip_blank_end(str);
777 if (!td->files_index)
780 while ((fname = get_next_file_name(&str)) != NULL) {
791 static int str_directory_cb(void *data, const char fio_unused *str)
793 struct thread_data *td = data;
796 if (lstat(td->o.directory, &sb) < 0) {
799 log_err("fio: %s is not a directory\n", td->o.directory);
800 td_verror(td, ret, "lstat");
803 if (!S_ISDIR(sb.st_mode)) {
804 log_err("fio: %s is not a directory\n", td->o.directory);
811 static int str_opendir_cb(void *data, const char fio_unused *str)
813 struct thread_data *td = data;
815 if (!td->files_index)
818 return add_dir_files(td, td->o.opendir);
821 static int str_verify_pattern_cb(void *data, const char *input)
823 struct thread_data *td = data;
825 int i = 0, j = 0, len, k, base = 10, pattern_length;
828 loc1 = strstr(input, "0x");
829 loc2 = strstr(input, "0X");
832 off = strtol(input, NULL, base);
833 if (off != LONG_MAX || errno != ERANGE) {
835 td->o.verify_pattern[i] = off & 0xff;
844 j = loc1 - input + 2;
846 j = loc2 - input + 2;
849 if (len - j < MAX_PATTERN_SIZE * 2) {
851 off = converthexchartoint(input[k--]);
853 off += (converthexchartoint(input[k--])
855 td->o.verify_pattern[i++] = (char) off;
861 * Fill the pattern all the way to the end. This greatly reduces
862 * the number of memcpy's we have to do when verifying the IO.
865 while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) {
866 memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i);
871 * Fill remainder, if the pattern multiple ends up not being
874 while (i > 1 && i < MAX_PATTERN_SIZE) {
875 unsigned int b = min(pattern_length, MAX_PATTERN_SIZE - i);
877 memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], b);
883 * The code in verify_io_u_pattern assumes a single byte pattern
884 * fills the whole verify pattern buffer.
886 memset(td->o.verify_pattern, td->o.verify_pattern[0],
890 td->o.verify_pattern_bytes = i;
893 * VERIFY_META could already be set
895 if (td->o.verify == VERIFY_NONE)
896 td->o.verify = VERIFY_PATTERN;
901 static int str_gtod_reduce_cb(void *data, int *il)
903 struct thread_data *td = data;
906 td->o.disable_lat = !!val;
907 td->o.disable_clat = !!val;
908 td->o.disable_slat = !!val;
909 td->o.disable_bw = !!val;
910 td->o.clat_percentiles = !val;
912 td->tv_cache_mask = 63;
917 static int str_gtod_cpu_cb(void *data, long long *il)
919 struct thread_data *td = data;
922 td->o.gtod_cpu = val;
923 td->o.gtod_offload = 1;
927 static int str_size_cb(void *data, unsigned long long *__val)
929 struct thread_data *td = data;
930 unsigned long long v = *__val;
932 if (parse_is_percent(v)) {
934 td->o.size_percent = -1ULL - v;
941 static int rw_verify(struct fio_option *o, void *data)
943 struct thread_data *td = data;
945 if (read_only && td_write(td)) {
946 log_err("fio: job <%s> has write bit set, but fio is in"
947 " read-only mode\n", td->o.name);
954 static int gtod_cpu_verify(struct fio_option *o, void *data)
956 #ifndef FIO_HAVE_CPU_AFFINITY
957 struct thread_data *td = data;
959 if (td->o.gtod_cpu) {
960 log_err("fio: platform must support CPU affinity for"
961 "gettimeofday() offloading\n");
972 static struct opt_group fio_opt_groups[] = {
975 .mask = FIO_OPT_C_GENERAL,
979 .mask = FIO_OPT_C_IO,
983 .mask = FIO_OPT_C_FILE,
986 .name = "Statistics",
987 .mask = FIO_OPT_C_STAT,
991 .mask = FIO_OPT_C_LOG,
995 .mask = FIO_OPT_C_PROFILE,
1002 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1003 unsigned int inv_mask)
1005 struct opt_group *og;
1008 if (*mask == inv_mask || !*mask)
1011 for (i = 0; ogs[i].name; i++) {
1014 if (*mask & og->mask) {
1015 *mask &= ~(og->mask);
1023 struct opt_group *opt_group_from_mask(unsigned int *mask)
1025 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1028 static struct opt_group fio_opt_cat_groups[] = {
1031 .mask = FIO_OPT_G_RATE,
1035 .mask = FIO_OPT_G_ZONE,
1038 .name = "Read/write mix",
1039 .mask = FIO_OPT_G_RWMIX,
1043 .mask = FIO_OPT_G_VERIFY,
1047 .mask = FIO_OPT_G_TRIM,
1050 .name = "I/O Logging",
1051 .mask = FIO_OPT_G_IOLOG,
1054 .name = "I/O Depth",
1055 .mask = FIO_OPT_G_IO_DEPTH,
1059 .mask = FIO_OPT_G_IO_FLOW,
1062 .name = "Description",
1063 .mask = FIO_OPT_G_DESC,
1067 .mask = FIO_OPT_G_FILENAME,
1070 .name = "General I/O",
1071 .mask = FIO_OPT_G_IO_BASIC,
1075 .mask = FIO_OPT_G_CGROUP,
1079 .mask = FIO_OPT_G_RUNTIME,
1083 .mask = FIO_OPT_G_PROCESS,
1086 .name = "Job credentials / priority",
1087 .mask = FIO_OPT_G_CRED,
1090 .name = "Clock settings",
1091 .mask = FIO_OPT_G_CLOCK,
1095 .mask = FIO_OPT_G_IO_TYPE,
1098 .name = "I/O Thinktime",
1099 .mask = FIO_OPT_G_THINKTIME,
1102 .name = "Randomizations",
1103 .mask = FIO_OPT_G_RANDOM,
1106 .name = "I/O buffers",
1107 .mask = FIO_OPT_G_IO_BUF,
1110 .name = "Tiobench profile",
1111 .mask = FIO_OPT_G_TIOBENCH,
1119 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1121 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1125 * Map of job/command line options
1127 struct fio_option fio_options[FIO_MAX_OPTS] = {
1129 .name = "description",
1130 .lname = "Description of job",
1131 .type = FIO_OPT_STR_STORE,
1132 .off1 = td_var_offset(description),
1133 .help = "Text job description",
1134 .category = FIO_OPT_C_GENERAL,
1135 .group = FIO_OPT_G_DESC,
1139 .lname = "Job name",
1140 .type = FIO_OPT_STR_STORE,
1141 .off1 = td_var_offset(name),
1142 .help = "Name of this job",
1143 .category = FIO_OPT_C_GENERAL,
1144 .group = FIO_OPT_G_DESC,
1148 .lname = "Filename(s)",
1149 .type = FIO_OPT_STR_STORE,
1150 .off1 = td_var_offset(filename),
1151 .cb = str_filename_cb,
1152 .prio = -1, /* must come after "directory" */
1153 .help = "File(s) to use for the workload",
1154 .category = FIO_OPT_C_FILE,
1155 .group = FIO_OPT_G_FILENAME,
1158 .name = "directory",
1159 .lname = "Directory",
1160 .type = FIO_OPT_STR_STORE,
1161 .off1 = td_var_offset(directory),
1162 .cb = str_directory_cb,
1163 .help = "Directory to store files in",
1164 .category = FIO_OPT_C_FILE,
1165 .group = FIO_OPT_G_FILENAME,
1168 .name = "filename_format",
1169 .type = FIO_OPT_STR_STORE,
1170 .off1 = td_var_offset(filename_format),
1171 .prio = -1, /* must come after "directory" */
1172 .help = "Override default $jobname.$jobnum.$filenum naming",
1173 .def = "$jobname.$jobnum.$filenum",
1174 .category = FIO_OPT_C_FILE,
1175 .group = FIO_OPT_G_FILENAME,
1179 .lname = "Lockfile",
1180 .type = FIO_OPT_STR,
1181 .off1 = td_var_offset(file_lock_mode),
1182 .help = "Lock file when doing IO to it",
1183 .parent = "filename",
1186 .category = FIO_OPT_C_FILE,
1187 .group = FIO_OPT_G_FILENAME,
1190 .oval = FILE_LOCK_NONE,
1191 .help = "No file locking",
1193 { .ival = "exclusive",
1194 .oval = FILE_LOCK_EXCLUSIVE,
1195 .help = "Exclusive file lock",
1198 .ival = "readwrite",
1199 .oval = FILE_LOCK_READWRITE,
1200 .help = "Read vs write lock",
1206 .lname = "Open directory",
1207 .type = FIO_OPT_STR_STORE,
1208 .off1 = td_var_offset(opendir),
1209 .cb = str_opendir_cb,
1210 .help = "Recursively add files from this directory and down",
1211 .category = FIO_OPT_C_FILE,
1212 .group = FIO_OPT_G_FILENAME,
1216 .lname = "Read/write",
1217 .alias = "readwrite",
1218 .type = FIO_OPT_STR,
1220 .off1 = td_var_offset(td_ddir),
1221 .help = "IO direction",
1223 .verify = rw_verify,
1224 .category = FIO_OPT_C_IO,
1225 .group = FIO_OPT_G_IO_BASIC,
1228 .oval = TD_DDIR_READ,
1229 .help = "Sequential read",
1232 .oval = TD_DDIR_WRITE,
1233 .help = "Sequential write",
1236 .oval = TD_DDIR_TRIM,
1237 .help = "Sequential trim",
1239 { .ival = "randread",
1240 .oval = TD_DDIR_RANDREAD,
1241 .help = "Random read",
1243 { .ival = "randwrite",
1244 .oval = TD_DDIR_RANDWRITE,
1245 .help = "Random write",
1247 { .ival = "randtrim",
1248 .oval = TD_DDIR_RANDTRIM,
1249 .help = "Random trim",
1253 .help = "Sequential read and write mix",
1255 { .ival = "readwrite",
1257 .help = "Sequential read and write mix",
1260 .oval = TD_DDIR_RANDRW,
1261 .help = "Random read and write mix"
1266 .name = "rw_sequencer",
1267 .lname = "RW Sequencer",
1268 .type = FIO_OPT_STR,
1269 .off1 = td_var_offset(rw_seq),
1270 .help = "IO offset generator modifier",
1271 .def = "sequential",
1272 .category = FIO_OPT_C_IO,
1273 .group = FIO_OPT_G_IO_BASIC,
1275 { .ival = "sequential",
1277 .help = "Generate sequential offsets",
1279 { .ival = "identical",
1280 .oval = RW_SEQ_IDENT,
1281 .help = "Generate identical offsets",
1288 .lname = "IO Engine",
1289 .type = FIO_OPT_STR_STORE,
1290 .off1 = td_var_offset(ioengine),
1291 .help = "IO engine to use",
1292 .def = FIO_PREFERRED_ENGINE,
1293 .category = FIO_OPT_C_IO,
1294 .group = FIO_OPT_G_IO_BASIC,
1297 .help = "Use read/write",
1300 .help = "Use pread/pwrite",
1303 .help = "Use readv/writev",
1305 #ifdef CONFIG_PWRITEV
1307 .help = "Use preadv/pwritev",
1310 #ifdef CONFIG_LIBAIO
1312 .help = "Linux native asynchronous IO",
1315 #ifdef CONFIG_POSIXAIO
1316 { .ival = "posixaio",
1317 .help = "POSIX asynchronous IO",
1320 #ifdef CONFIG_SOLARISAIO
1321 { .ival = "solarisaio",
1322 .help = "Solaris native asynchronous IO",
1325 #ifdef CONFIG_WINDOWSAIO
1326 { .ival = "windowsaio",
1327 .help = "Windows native asynchronous IO"
1331 .help = "Memory mapped IO"
1333 #ifdef CONFIG_LINUX_SPLICE
1335 .help = "splice/vmsplice based IO",
1337 { .ival = "netsplice",
1338 .help = "splice/vmsplice to/from the network",
1341 #ifdef FIO_HAVE_SGIO
1343 .help = "SCSI generic v3 IO",
1347 .help = "Testing engine (no data transfer)",
1350 .help = "Network IO",
1353 .help = "CPU cycle burner engine",
1357 .help = "GUASI IO engine",
1360 #ifdef FIO_HAVE_BINJECT
1361 { .ival = "binject",
1362 .help = "binject direct inject block engine",
1367 .help = "RDMA IO engine",
1370 #ifdef CONFIG_FUSION_AW
1371 { .ival = "fusion-aw-sync",
1372 .help = "Fusion-io atomic write engine",
1375 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1376 { .ival = "e4defrag",
1377 .help = "ext4 defrag engine",
1380 #ifdef CONFIG_LINUX_FALLOCATE
1382 .help = "fallocate() file based engine",
1385 { .ival = "external",
1386 .help = "Load external engine (append name)",
1392 .lname = "IO Depth",
1393 .type = FIO_OPT_INT,
1394 .off1 = td_var_offset(iodepth),
1395 .help = "Number of IO buffers to keep in flight",
1399 .category = FIO_OPT_C_IO,
1400 .group = FIO_OPT_G_IO_BASIC,
1403 .name = "iodepth_batch",
1404 .lname = "IO Depth batch",
1405 .alias = "iodepth_batch_submit",
1406 .type = FIO_OPT_INT,
1407 .off1 = td_var_offset(iodepth_batch),
1408 .help = "Number of IO buffers to submit in one go",
1409 .parent = "iodepth",
1414 .category = FIO_OPT_C_IO,
1415 .group = FIO_OPT_G_IO_BASIC,
1418 .name = "iodepth_batch_complete",
1419 .lname = "IO Depth batch complete",
1420 .type = FIO_OPT_INT,
1421 .off1 = td_var_offset(iodepth_batch_complete),
1422 .help = "Number of IO buffers to retrieve in one go",
1423 .parent = "iodepth",
1428 .category = FIO_OPT_C_IO,
1429 .group = FIO_OPT_G_IO_BASIC,
1432 .name = "iodepth_low",
1433 .lname = "IO Depth batch low",
1434 .type = FIO_OPT_INT,
1435 .off1 = td_var_offset(iodepth_low),
1436 .help = "Low water mark for queuing depth",
1437 .parent = "iodepth",
1440 .category = FIO_OPT_C_IO,
1441 .group = FIO_OPT_G_IO_BASIC,
1446 .type = FIO_OPT_STR_VAL,
1448 .help = "Total size of device or files",
1449 .interval = 1024 * 1024,
1450 .category = FIO_OPT_C_IO,
1451 .group = FIO_OPT_G_INVALID,
1454 .name = "fill_device",
1455 .lname = "Fill device",
1457 .type = FIO_OPT_BOOL,
1458 .off1 = td_var_offset(fill_device),
1459 .help = "Write until an ENOSPC error occurs",
1461 .category = FIO_OPT_C_FILE,
1462 .group = FIO_OPT_G_INVALID,
1466 .lname = "File size",
1467 .type = FIO_OPT_STR_VAL,
1468 .off1 = td_var_offset(file_size_low),
1469 .off2 = td_var_offset(file_size_high),
1471 .help = "Size of individual files",
1472 .interval = 1024 * 1024,
1473 .category = FIO_OPT_C_FILE,
1474 .group = FIO_OPT_G_INVALID,
1478 .lname = "IO offset",
1479 .alias = "fileoffset",
1480 .type = FIO_OPT_STR_VAL,
1481 .off1 = td_var_offset(start_offset),
1482 .help = "Start IO from this offset",
1484 .interval = 1024 * 1024,
1485 .category = FIO_OPT_C_IO,
1486 .group = FIO_OPT_G_INVALID,
1489 .name = "offset_increment",
1490 .lname = "IO offset increment",
1491 .type = FIO_OPT_STR_VAL,
1492 .off1 = td_var_offset(offset_increment),
1493 .help = "What is the increment from one offset to the next",
1497 .interval = 1024 * 1024,
1498 .category = FIO_OPT_C_IO,
1499 .group = FIO_OPT_G_INVALID,
1503 .lname = "Block size",
1504 .alias = "blocksize",
1505 .type = FIO_OPT_INT,
1506 .off1 = td_var_offset(bs[DDIR_READ]),
1507 .off2 = td_var_offset(bs[DDIR_WRITE]),
1508 .off3 = td_var_offset(bs[DDIR_TRIM]),
1510 .help = "Block size unit",
1515 .category = FIO_OPT_C_IO,
1516 .group = FIO_OPT_G_INVALID,
1520 .lname = "Block size align",
1521 .alias = "blockalign",
1522 .type = FIO_OPT_INT,
1523 .off1 = td_var_offset(ba[DDIR_READ]),
1524 .off2 = td_var_offset(ba[DDIR_WRITE]),
1525 .off3 = td_var_offset(ba[DDIR_TRIM]),
1527 .help = "IO block offset alignment",
1531 .category = FIO_OPT_C_IO,
1532 .group = FIO_OPT_G_INVALID,
1536 .lname = "Block size range",
1537 .alias = "blocksize_range",
1538 .type = FIO_OPT_RANGE,
1539 .off1 = td_var_offset(min_bs[DDIR_READ]),
1540 .off2 = td_var_offset(max_bs[DDIR_READ]),
1541 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1542 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1543 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1544 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1546 .help = "Set block size range (in more detail than bs)",
1550 .category = FIO_OPT_C_IO,
1551 .group = FIO_OPT_G_INVALID,
1555 .lname = "Block size split",
1556 .type = FIO_OPT_STR,
1557 .cb = str_bssplit_cb,
1558 .help = "Set a specific mix of block sizes",
1561 .category = FIO_OPT_C_IO,
1562 .group = FIO_OPT_G_INVALID,
1565 .name = "bs_unaligned",
1566 .lname = "Block size unaligned",
1567 .alias = "blocksize_unaligned",
1568 .type = FIO_OPT_STR_SET,
1569 .off1 = td_var_offset(bs_unaligned),
1570 .help = "Don't sector align IO buffer sizes",
1573 .category = FIO_OPT_C_IO,
1574 .group = FIO_OPT_G_INVALID,
1577 .name = "randrepeat",
1578 .lname = "Random repeatable",
1579 .type = FIO_OPT_BOOL,
1580 .off1 = td_var_offset(rand_repeatable),
1581 .help = "Use repeatable random IO pattern",
1585 .category = FIO_OPT_C_IO,
1586 .group = FIO_OPT_G_RANDOM,
1589 .name = "use_os_rand",
1590 .lname = "Use OS random",
1591 .type = FIO_OPT_BOOL,
1592 .off1 = td_var_offset(use_os_rand),
1593 .help = "Set to use OS random generator",
1597 .category = FIO_OPT_C_IO,
1598 .group = FIO_OPT_G_RANDOM,
1601 .name = "norandommap",
1602 .lname = "No randommap",
1603 .type = FIO_OPT_STR_SET,
1604 .off1 = td_var_offset(norandommap),
1605 .help = "Accept potential duplicate random blocks",
1609 .category = FIO_OPT_C_IO,
1610 .group = FIO_OPT_G_RANDOM,
1613 .name = "softrandommap",
1614 .lname = "Soft randommap",
1615 .type = FIO_OPT_BOOL,
1616 .off1 = td_var_offset(softrandommap),
1617 .help = "Set norandommap if randommap allocation fails",
1618 .parent = "norandommap",
1621 .category = FIO_OPT_C_IO,
1622 .group = FIO_OPT_G_RANDOM,
1625 .name = "random_generator",
1626 .type = FIO_OPT_STR,
1627 .off1 = td_var_offset(random_generator),
1628 .help = "Type of random number generator to use",
1629 .def = "tausworthe",
1631 { .ival = "tausworthe",
1632 .oval = FIO_RAND_GEN_TAUSWORTHE,
1633 .help = "Strong Tausworthe generator",
1636 .oval = FIO_RAND_GEN_LFSR,
1637 .help = "Variable length LFSR",
1640 .category = FIO_OPT_C_IO,
1641 .group = FIO_OPT_G_RANDOM,
1644 .name = "random_distribution",
1645 .type = FIO_OPT_STR,
1646 .off1 = td_var_offset(random_distribution),
1647 .cb = str_random_distribution_cb,
1648 .help = "Random offset distribution generator",
1652 .oval = FIO_RAND_DIST_RANDOM,
1653 .help = "Completely random",
1656 .oval = FIO_RAND_DIST_ZIPF,
1657 .help = "Zipf distribution",
1660 .oval = FIO_RAND_DIST_PARETO,
1661 .help = "Pareto distribution",
1664 .category = FIO_OPT_C_IO,
1665 .group = FIO_OPT_G_RANDOM,
1668 .name = "percentage_random",
1669 .lname = "Percentage Random",
1670 .type = FIO_OPT_INT,
1671 .cb = str_perc_rand_cb,
1673 .help = "Percentage of seq/random mix that should be random",
1676 .inverse = "percentage_sequential",
1677 .category = FIO_OPT_C_IO,
1678 .group = FIO_OPT_G_RANDOM,
1681 .name = "percentage_sequential",
1682 .lname = "Percentage Sequential",
1683 .type = FIO_OPT_INT,
1684 .cb = str_perc_seq_cb,
1686 .help = "Percentage of seq/random mix that should be sequential",
1689 .inverse = "percentage_random",
1690 .category = FIO_OPT_C_IO,
1691 .group = FIO_OPT_G_RANDOM,
1695 .lname = "Number of files",
1696 .alias = "nr_files",
1697 .type = FIO_OPT_INT,
1698 .off1 = td_var_offset(nr_files),
1699 .help = "Split job workload between this number of files",
1702 .category = FIO_OPT_C_FILE,
1703 .group = FIO_OPT_G_INVALID,
1706 .name = "openfiles",
1707 .lname = "Number of open files",
1708 .type = FIO_OPT_INT,
1709 .off1 = td_var_offset(open_files),
1710 .help = "Number of files to keep open at the same time",
1711 .category = FIO_OPT_C_FILE,
1712 .group = FIO_OPT_G_INVALID,
1715 .name = "file_service_type",
1716 .lname = "File service type",
1717 .type = FIO_OPT_STR,
1719 .off1 = td_var_offset(file_service_type),
1720 .help = "How to select which file to service next",
1721 .def = "roundrobin",
1722 .category = FIO_OPT_C_FILE,
1723 .group = FIO_OPT_G_INVALID,
1726 .oval = FIO_FSERVICE_RANDOM,
1727 .help = "Choose a file at random",
1729 { .ival = "roundrobin",
1730 .oval = FIO_FSERVICE_RR,
1731 .help = "Round robin select files",
1733 { .ival = "sequential",
1734 .oval = FIO_FSERVICE_SEQ,
1735 .help = "Finish one file before moving to the next",
1738 .parent = "nrfiles",
1741 #ifdef CONFIG_POSIX_FALLOCATE
1743 .name = "fallocate",
1744 .lname = "Fallocate",
1745 .type = FIO_OPT_STR,
1746 .off1 = td_var_offset(fallocate_mode),
1747 .help = "Whether pre-allocation is performed when laying out files",
1749 .category = FIO_OPT_C_FILE,
1750 .group = FIO_OPT_G_INVALID,
1753 .oval = FIO_FALLOCATE_NONE,
1754 .help = "Do not pre-allocate space",
1757 .oval = FIO_FALLOCATE_POSIX,
1758 .help = "Use posix_fallocate()",
1760 #ifdef CONFIG_LINUX_FALLOCATE
1762 .oval = FIO_FALLOCATE_KEEP_SIZE,
1763 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1766 /* Compatibility with former boolean values */
1768 .oval = FIO_FALLOCATE_NONE,
1769 .help = "Alias for 'none'",
1772 .oval = FIO_FALLOCATE_POSIX,
1773 .help = "Alias for 'posix'",
1777 #endif /* CONFIG_POSIX_FALLOCATE */
1779 .name = "fadvise_hint",
1780 .lname = "Fadvise hint",
1781 .type = FIO_OPT_BOOL,
1782 .off1 = td_var_offset(fadvise_hint),
1783 .help = "Use fadvise() to advise the kernel on IO pattern",
1785 .category = FIO_OPT_C_FILE,
1786 .group = FIO_OPT_G_INVALID,
1791 .type = FIO_OPT_INT,
1792 .off1 = td_var_offset(fsync_blocks),
1793 .help = "Issue fsync for writes every given number of blocks",
1796 .category = FIO_OPT_C_FILE,
1797 .group = FIO_OPT_G_INVALID,
1800 .name = "fdatasync",
1801 .lname = "Fdatasync",
1802 .type = FIO_OPT_INT,
1803 .off1 = td_var_offset(fdatasync_blocks),
1804 .help = "Issue fdatasync for writes every given number of blocks",
1807 .category = FIO_OPT_C_FILE,
1808 .group = FIO_OPT_G_INVALID,
1811 .name = "write_barrier",
1812 .lname = "Write barrier",
1813 .type = FIO_OPT_INT,
1814 .off1 = td_var_offset(barrier_blocks),
1815 .help = "Make every Nth write a barrier write",
1818 .category = FIO_OPT_C_IO,
1819 .group = FIO_OPT_G_INVALID,
1821 #ifdef CONFIG_SYNC_FILE_RANGE
1823 .name = "sync_file_range",
1824 .lname = "Sync file range",
1826 { .ival = "wait_before",
1827 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1828 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
1832 .oval = SYNC_FILE_RANGE_WRITE,
1833 .help = "SYNC_FILE_RANGE_WRITE",
1837 .ival = "wait_after",
1838 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1839 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
1843 .type = FIO_OPT_STR_MULTI,
1845 .off1 = td_var_offset(sync_file_range),
1846 .help = "Use sync_file_range()",
1847 .category = FIO_OPT_C_FILE,
1848 .group = FIO_OPT_G_INVALID,
1853 .lname = "Direct I/O",
1854 .type = FIO_OPT_BOOL,
1855 .off1 = td_var_offset(odirect),
1856 .help = "Use O_DIRECT IO (negates buffered)",
1858 .inverse = "buffered",
1859 .category = FIO_OPT_C_IO,
1860 .group = FIO_OPT_G_IO_TYPE,
1864 .lname = "Buffered I/O",
1865 .type = FIO_OPT_BOOL,
1866 .off1 = td_var_offset(odirect),
1868 .help = "Use buffered IO (negates direct)",
1870 .inverse = "direct",
1871 .category = FIO_OPT_C_IO,
1872 .group = FIO_OPT_G_IO_TYPE,
1875 .name = "overwrite",
1876 .lname = "Overwrite",
1877 .type = FIO_OPT_BOOL,
1878 .off1 = td_var_offset(overwrite),
1879 .help = "When writing, set whether to overwrite current data",
1881 .category = FIO_OPT_C_FILE,
1882 .group = FIO_OPT_G_INVALID,
1887 .type = FIO_OPT_INT,
1888 .off1 = td_var_offset(loops),
1889 .help = "Number of times to run the job",
1892 .category = FIO_OPT_C_GENERAL,
1893 .group = FIO_OPT_G_RUNTIME,
1897 .lname = "Number of jobs",
1898 .type = FIO_OPT_INT,
1899 .off1 = td_var_offset(numjobs),
1900 .help = "Duplicate this job this many times",
1903 .category = FIO_OPT_C_GENERAL,
1904 .group = FIO_OPT_G_RUNTIME,
1907 .name = "startdelay",
1908 .lname = "Start delay",
1909 .type = FIO_OPT_STR_VAL_TIME,
1910 .off1 = td_var_offset(start_delay),
1911 .help = "Only start job when this period has passed",
1913 .category = FIO_OPT_C_GENERAL,
1914 .group = FIO_OPT_G_RUNTIME,
1920 .type = FIO_OPT_STR_VAL_TIME,
1921 .off1 = td_var_offset(timeout),
1922 .help = "Stop workload when this amount of time has passed",
1924 .category = FIO_OPT_C_GENERAL,
1925 .group = FIO_OPT_G_RUNTIME,
1928 .name = "time_based",
1929 .lname = "Time based",
1930 .type = FIO_OPT_STR_SET,
1931 .off1 = td_var_offset(time_based),
1932 .help = "Keep running until runtime/timeout is met",
1933 .category = FIO_OPT_C_GENERAL,
1934 .group = FIO_OPT_G_RUNTIME,
1937 .name = "ramp_time",
1938 .lname = "Ramp time",
1939 .type = FIO_OPT_STR_VAL_TIME,
1940 .off1 = td_var_offset(ramp_time),
1941 .help = "Ramp up time before measuring performance",
1942 .category = FIO_OPT_C_GENERAL,
1943 .group = FIO_OPT_G_RUNTIME,
1946 .name = "clocksource",
1947 .lname = "Clock source",
1948 .type = FIO_OPT_STR,
1949 .cb = fio_clock_source_cb,
1950 .off1 = td_var_offset(clocksource),
1951 .help = "What type of timing source to use",
1952 .category = FIO_OPT_C_GENERAL,
1953 .group = FIO_OPT_G_CLOCK,
1955 #ifdef CONFIG_GETTIMEOFDAY
1956 { .ival = "gettimeofday",
1958 .help = "Use gettimeofday(2) for timing",
1961 #ifdef CONFIG_CLOCK_GETTIME
1962 { .ival = "clock_gettime",
1963 .oval = CS_CGETTIME,
1964 .help = "Use clock_gettime(2) for timing",
1967 #ifdef ARCH_HAVE_CPU_CLOCK
1969 .oval = CS_CPUCLOCK,
1970 .help = "Use CPU private clock",
1978 .lname = "I/O Memory",
1979 .type = FIO_OPT_STR,
1981 .off1 = td_var_offset(mem_type),
1982 .help = "Backing type for IO buffers",
1984 .category = FIO_OPT_C_IO,
1985 .group = FIO_OPT_G_INVALID,
1989 .help = "Use malloc(3) for IO buffers",
1993 .help = "Use shared memory segments for IO buffers",
1995 #ifdef FIO_HAVE_HUGETLB
1996 { .ival = "shmhuge",
1997 .oval = MEM_SHMHUGE,
1998 .help = "Like shm, but use huge pages",
2003 .help = "Use mmap(2) (file or anon) for IO buffers",
2005 #ifdef FIO_HAVE_HUGETLB
2006 { .ival = "mmaphuge",
2007 .oval = MEM_MMAPHUGE,
2008 .help = "Like mmap, but use huge pages",
2014 .name = "iomem_align",
2015 .alias = "mem_align",
2016 .lname = "I/O memory alignment",
2017 .type = FIO_OPT_INT,
2018 .off1 = td_var_offset(mem_align),
2020 .help = "IO memory buffer offset alignment",
2024 .category = FIO_OPT_C_IO,
2025 .group = FIO_OPT_G_INVALID,
2030 .type = FIO_OPT_STR,
2031 .off1 = td_var_offset(verify),
2032 .help = "Verify data written",
2034 .category = FIO_OPT_C_IO,
2035 .group = FIO_OPT_G_VERIFY,
2038 .oval = VERIFY_NONE,
2039 .help = "Don't do IO verification",
2043 .help = "Use md5 checksums for verification",
2046 .oval = VERIFY_CRC64,
2047 .help = "Use crc64 checksums for verification",
2050 .oval = VERIFY_CRC32,
2051 .help = "Use crc32 checksums for verification",
2053 { .ival = "crc32c-intel",
2054 .oval = VERIFY_CRC32C,
2055 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2058 .oval = VERIFY_CRC32C,
2059 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2062 .oval = VERIFY_CRC16,
2063 .help = "Use crc16 checksums for verification",
2066 .oval = VERIFY_CRC7,
2067 .help = "Use crc7 checksums for verification",
2070 .oval = VERIFY_SHA1,
2071 .help = "Use sha1 checksums for verification",
2074 .oval = VERIFY_SHA256,
2075 .help = "Use sha256 checksums for verification",
2078 .oval = VERIFY_SHA512,
2079 .help = "Use sha512 checksums for verification",
2082 .oval = VERIFY_META,
2083 .help = "Use io information",
2087 .oval = VERIFY_NULL,
2088 .help = "Pretend to verify",
2093 .name = "do_verify",
2094 .lname = "Perform verify step",
2095 .type = FIO_OPT_BOOL,
2096 .off1 = td_var_offset(do_verify),
2097 .help = "Run verification stage after write",
2101 .category = FIO_OPT_C_IO,
2102 .group = FIO_OPT_G_VERIFY,
2105 .name = "verifysort",
2106 .lname = "Verify sort",
2107 .type = FIO_OPT_BOOL,
2108 .off1 = td_var_offset(verifysort),
2109 .help = "Sort written verify blocks for read back",
2113 .category = FIO_OPT_C_IO,
2114 .group = FIO_OPT_G_VERIFY,
2117 .name = "verifysort_nr",
2118 .type = FIO_OPT_INT,
2119 .off1 = td_var_offset(verifysort_nr),
2120 .help = "Pre-load and sort verify blocks for a read workload",
2125 .category = FIO_OPT_C_IO,
2126 .group = FIO_OPT_G_VERIFY,
2129 .name = "verify_interval",
2130 .lname = "Verify interval",
2131 .type = FIO_OPT_INT,
2132 .off1 = td_var_offset(verify_interval),
2133 .minval = 2 * sizeof(struct verify_header),
2134 .help = "Store verify buffer header every N bytes",
2137 .interval = 2 * sizeof(struct verify_header),
2138 .category = FIO_OPT_C_IO,
2139 .group = FIO_OPT_G_VERIFY,
2142 .name = "verify_offset",
2143 .lname = "Verify offset",
2144 .type = FIO_OPT_INT,
2145 .help = "Offset verify header location by N bytes",
2146 .off1 = td_var_offset(verify_offset),
2147 .minval = sizeof(struct verify_header),
2150 .category = FIO_OPT_C_IO,
2151 .group = FIO_OPT_G_VERIFY,
2154 .name = "verify_pattern",
2155 .lname = "Verify pattern",
2156 .type = FIO_OPT_STR,
2157 .cb = str_verify_pattern_cb,
2158 .help = "Fill pattern for IO buffers",
2161 .category = FIO_OPT_C_IO,
2162 .group = FIO_OPT_G_VERIFY,
2165 .name = "verify_fatal",
2166 .lname = "Verify fatal",
2167 .type = FIO_OPT_BOOL,
2168 .off1 = td_var_offset(verify_fatal),
2170 .help = "Exit on a single verify failure, don't continue",
2173 .category = FIO_OPT_C_IO,
2174 .group = FIO_OPT_G_VERIFY,
2177 .name = "verify_dump",
2178 .lname = "Verify dump",
2179 .type = FIO_OPT_BOOL,
2180 .off1 = td_var_offset(verify_dump),
2182 .help = "Dump contents of good and bad blocks on failure",
2185 .category = FIO_OPT_C_IO,
2186 .group = FIO_OPT_G_VERIFY,
2189 .name = "verify_async",
2190 .lname = "Verify asynchronously",
2191 .type = FIO_OPT_INT,
2192 .off1 = td_var_offset(verify_async),
2194 .help = "Number of async verifier threads to use",
2197 .category = FIO_OPT_C_IO,
2198 .group = FIO_OPT_G_VERIFY,
2201 .name = "verify_backlog",
2202 .lname = "Verify backlog",
2203 .type = FIO_OPT_STR_VAL,
2204 .off1 = td_var_offset(verify_backlog),
2205 .help = "Verify after this number of blocks are written",
2208 .category = FIO_OPT_C_IO,
2209 .group = FIO_OPT_G_VERIFY,
2212 .name = "verify_backlog_batch",
2213 .lname = "Verify backlog batch",
2214 .type = FIO_OPT_INT,
2215 .off1 = td_var_offset(verify_batch),
2216 .help = "Verify this number of IO blocks",
2219 .category = FIO_OPT_C_IO,
2220 .group = FIO_OPT_G_VERIFY,
2222 #ifdef FIO_HAVE_CPU_AFFINITY
2224 .name = "verify_async_cpus",
2225 .lname = "Async verify CPUs",
2226 .type = FIO_OPT_STR,
2227 .cb = str_verify_cpus_allowed_cb,
2228 .help = "Set CPUs allowed for async verify threads",
2229 .parent = "verify_async",
2231 .category = FIO_OPT_C_IO,
2232 .group = FIO_OPT_G_VERIFY,
2236 .name = "experimental_verify",
2237 .off1 = td_var_offset(experimental_verify),
2238 .type = FIO_OPT_BOOL,
2239 .help = "Enable experimental verification",
2240 .category = FIO_OPT_C_IO,
2241 .group = FIO_OPT_G_VERIFY,
2243 #ifdef FIO_HAVE_TRIM
2245 .name = "trim_percentage",
2246 .lname = "Trim percentage",
2247 .type = FIO_OPT_INT,
2248 .off1 = td_var_offset(trim_percentage),
2251 .help = "Number of verify blocks to discard/trim",
2256 .category = FIO_OPT_C_IO,
2257 .group = FIO_OPT_G_TRIM,
2260 .name = "trim_verify_zero",
2261 .lname = "Verify trim zero",
2262 .type = FIO_OPT_BOOL,
2263 .help = "Verify that trim/discarded blocks are returned as zeroes",
2264 .off1 = td_var_offset(trim_zero),
2265 .parent = "trim_percentage",
2268 .category = FIO_OPT_C_IO,
2269 .group = FIO_OPT_G_TRIM,
2272 .name = "trim_backlog",
2273 .lname = "Trim backlog",
2274 .type = FIO_OPT_STR_VAL,
2275 .off1 = td_var_offset(trim_backlog),
2276 .help = "Trim after this number of blocks are written",
2277 .parent = "trim_percentage",
2280 .category = FIO_OPT_C_IO,
2281 .group = FIO_OPT_G_TRIM,
2284 .name = "trim_backlog_batch",
2285 .lname = "Trim backlog batch",
2286 .type = FIO_OPT_INT,
2287 .off1 = td_var_offset(trim_batch),
2288 .help = "Trim this number of IO blocks",
2289 .parent = "trim_percentage",
2292 .category = FIO_OPT_C_IO,
2293 .group = FIO_OPT_G_TRIM,
2297 .name = "write_iolog",
2298 .lname = "Write I/O log",
2299 .type = FIO_OPT_STR_STORE,
2300 .off1 = td_var_offset(write_iolog_file),
2301 .help = "Store IO pattern to file",
2302 .category = FIO_OPT_C_IO,
2303 .group = FIO_OPT_G_IOLOG,
2306 .name = "read_iolog",
2307 .lname = "Read I/O log",
2308 .type = FIO_OPT_STR_STORE,
2309 .off1 = td_var_offset(read_iolog_file),
2310 .help = "Playback IO pattern from file",
2311 .category = FIO_OPT_C_IO,
2312 .group = FIO_OPT_G_IOLOG,
2315 .name = "replay_no_stall",
2316 .lname = "Don't stall on replay",
2317 .type = FIO_OPT_BOOL,
2318 .off1 = td_var_offset(no_stall),
2320 .parent = "read_iolog",
2322 .help = "Playback IO pattern file as fast as possible without stalls",
2323 .category = FIO_OPT_C_IO,
2324 .group = FIO_OPT_G_IOLOG,
2327 .name = "replay_redirect",
2328 .lname = "Redirect device for replay",
2329 .type = FIO_OPT_STR_STORE,
2330 .off1 = td_var_offset(replay_redirect),
2331 .parent = "read_iolog",
2333 .help = "Replay all I/O onto this device, regardless of trace device",
2334 .category = FIO_OPT_C_IO,
2335 .group = FIO_OPT_G_IOLOG,
2338 .name = "exec_prerun",
2339 .lname = "Pre-execute runnable",
2340 .type = FIO_OPT_STR_STORE,
2341 .off1 = td_var_offset(exec_prerun),
2342 .help = "Execute this file prior to running job",
2343 .category = FIO_OPT_C_GENERAL,
2344 .group = FIO_OPT_G_INVALID,
2347 .name = "exec_postrun",
2348 .lname = "Post-execute runnable",
2349 .type = FIO_OPT_STR_STORE,
2350 .off1 = td_var_offset(exec_postrun),
2351 .help = "Execute this file after running job",
2352 .category = FIO_OPT_C_GENERAL,
2353 .group = FIO_OPT_G_INVALID,
2355 #ifdef FIO_HAVE_IOSCHED_SWITCH
2357 .name = "ioscheduler",
2358 .lname = "I/O scheduler",
2359 .type = FIO_OPT_STR_STORE,
2360 .off1 = td_var_offset(ioscheduler),
2361 .help = "Use this IO scheduler on the backing device",
2362 .category = FIO_OPT_C_FILE,
2363 .group = FIO_OPT_G_INVALID,
2368 .lname = "Zone size",
2369 .type = FIO_OPT_STR_VAL,
2370 .off1 = td_var_offset(zone_size),
2371 .help = "Amount of data to read per zone",
2373 .interval = 1024 * 1024,
2374 .category = FIO_OPT_C_IO,
2375 .group = FIO_OPT_G_ZONE,
2378 .name = "zonerange",
2379 .lname = "Zone range",
2380 .type = FIO_OPT_STR_VAL,
2381 .off1 = td_var_offset(zone_range),
2382 .help = "Give size of an IO zone",
2384 .interval = 1024 * 1024,
2385 .category = FIO_OPT_C_IO,
2386 .group = FIO_OPT_G_ZONE,
2390 .lname = "Zone skip",
2391 .type = FIO_OPT_STR_VAL,
2392 .off1 = td_var_offset(zone_skip),
2393 .help = "Space between IO zones",
2395 .interval = 1024 * 1024,
2396 .category = FIO_OPT_C_IO,
2397 .group = FIO_OPT_G_ZONE,
2401 .lname = "Lock memory",
2402 .type = FIO_OPT_STR_VAL,
2403 .off1 = td_var_offset(lockmem),
2404 .help = "Lock down this amount of memory (per worker)",
2406 .interval = 1024 * 1024,
2407 .category = FIO_OPT_C_GENERAL,
2408 .group = FIO_OPT_G_INVALID,
2411 .name = "rwmixread",
2412 .lname = "Read/write mix read",
2413 .type = FIO_OPT_INT,
2414 .cb = str_rwmix_read_cb,
2416 .help = "Percentage of mixed workload that is reads",
2419 .inverse = "rwmixwrite",
2420 .category = FIO_OPT_C_IO,
2421 .group = FIO_OPT_G_RWMIX,
2424 .name = "rwmixwrite",
2425 .lname = "Read/write mix write",
2426 .type = FIO_OPT_INT,
2427 .cb = str_rwmix_write_cb,
2429 .help = "Percentage of mixed workload that is writes",
2432 .inverse = "rwmixread",
2433 .category = FIO_OPT_C_IO,
2434 .group = FIO_OPT_G_RWMIX,
2437 .name = "rwmixcycle",
2438 .lname = "Read/write mix cycle",
2439 .type = FIO_OPT_DEPRECATED,
2440 .category = FIO_OPT_C_IO,
2441 .group = FIO_OPT_G_RWMIX,
2446 .type = FIO_OPT_INT,
2447 .off1 = td_var_offset(nice),
2448 .help = "Set job CPU nice value",
2453 .category = FIO_OPT_C_GENERAL,
2454 .group = FIO_OPT_G_CRED,
2456 #ifdef FIO_HAVE_IOPRIO
2459 .lname = "I/O nice priority",
2460 .type = FIO_OPT_INT,
2461 .off1 = td_var_offset(ioprio),
2462 .help = "Set job IO priority value",
2466 .category = FIO_OPT_C_GENERAL,
2467 .group = FIO_OPT_G_CRED,
2470 .name = "prioclass",
2471 .lname = "I/O nice priority class",
2472 .type = FIO_OPT_INT,
2473 .off1 = td_var_offset(ioprio_class),
2474 .help = "Set job IO priority class",
2478 .category = FIO_OPT_C_GENERAL,
2479 .group = FIO_OPT_G_CRED,
2483 .name = "thinktime",
2484 .lname = "Thinktime",
2485 .type = FIO_OPT_INT,
2486 .off1 = td_var_offset(thinktime),
2487 .help = "Idle time between IO buffers (usec)",
2489 .category = FIO_OPT_C_IO,
2490 .group = FIO_OPT_G_THINKTIME,
2493 .name = "thinktime_spin",
2494 .lname = "Thinktime spin",
2495 .type = FIO_OPT_INT,
2496 .off1 = td_var_offset(thinktime_spin),
2497 .help = "Start think time by spinning this amount (usec)",
2499 .parent = "thinktime",
2501 .category = FIO_OPT_C_IO,
2502 .group = FIO_OPT_G_THINKTIME,
2505 .name = "thinktime_blocks",
2506 .lname = "Thinktime blocks",
2507 .type = FIO_OPT_INT,
2508 .off1 = td_var_offset(thinktime_blocks),
2509 .help = "IO buffer period between 'thinktime'",
2511 .parent = "thinktime",
2513 .category = FIO_OPT_C_IO,
2514 .group = FIO_OPT_G_THINKTIME,
2518 .lname = "I/O rate",
2519 .type = FIO_OPT_INT,
2520 .off1 = td_var_offset(rate[DDIR_READ]),
2521 .off2 = td_var_offset(rate[DDIR_WRITE]),
2522 .off3 = td_var_offset(rate[DDIR_TRIM]),
2523 .help = "Set bandwidth rate",
2524 .category = FIO_OPT_C_IO,
2525 .group = FIO_OPT_G_RATE,
2529 .lname = "I/O min rate",
2530 .type = FIO_OPT_INT,
2531 .off1 = td_var_offset(ratemin[DDIR_READ]),
2532 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2533 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2534 .help = "Job must meet this rate or it will be shutdown",
2537 .category = FIO_OPT_C_IO,
2538 .group = FIO_OPT_G_RATE,
2541 .name = "rate_iops",
2542 .lname = "I/O rate IOPS",
2543 .type = FIO_OPT_INT,
2544 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2545 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2546 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2547 .help = "Limit IO used to this number of IO operations/sec",
2549 .category = FIO_OPT_C_IO,
2550 .group = FIO_OPT_G_RATE,
2553 .name = "rate_iops_min",
2554 .lname = "I/O min rate IOPS",
2555 .type = FIO_OPT_INT,
2556 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2557 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2558 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2559 .help = "Job must meet this rate or it will be shut down",
2560 .parent = "rate_iops",
2562 .category = FIO_OPT_C_IO,
2563 .group = FIO_OPT_G_RATE,
2566 .name = "ratecycle",
2567 .lname = "I/O rate cycle",
2568 .type = FIO_OPT_INT,
2569 .off1 = td_var_offset(ratecycle),
2570 .help = "Window average for rate limits (msec)",
2574 .category = FIO_OPT_C_IO,
2575 .group = FIO_OPT_G_RATE,
2578 .name = "max_latency",
2579 .type = FIO_OPT_INT,
2580 .off1 = td_var_offset(max_latency),
2581 .help = "Maximum tolerated IO latency (usec)",
2582 .category = FIO_OPT_C_IO,
2583 .group = FIO_OPT_G_RATE,
2586 .name = "invalidate",
2587 .lname = "Cache invalidate",
2588 .type = FIO_OPT_BOOL,
2589 .off1 = td_var_offset(invalidate_cache),
2590 .help = "Invalidate buffer/page cache prior to running job",
2592 .category = FIO_OPT_C_IO,
2593 .group = FIO_OPT_G_IO_TYPE,
2597 .lname = "Synchronous I/O",
2598 .type = FIO_OPT_BOOL,
2599 .off1 = td_var_offset(sync_io),
2600 .help = "Use O_SYNC for buffered writes",
2602 .parent = "buffered",
2604 .category = FIO_OPT_C_IO,
2605 .group = FIO_OPT_G_IO_TYPE,
2608 .name = "create_serialize",
2609 .lname = "Create serialize",
2610 .type = FIO_OPT_BOOL,
2611 .off1 = td_var_offset(create_serialize),
2612 .help = "Serialize creating of job files",
2614 .category = FIO_OPT_C_FILE,
2615 .group = FIO_OPT_G_INVALID,
2618 .name = "create_fsync",
2619 .lname = "Create fsync",
2620 .type = FIO_OPT_BOOL,
2621 .off1 = td_var_offset(create_fsync),
2622 .help = "fsync file after creation",
2624 .category = FIO_OPT_C_FILE,
2625 .group = FIO_OPT_G_INVALID,
2628 .name = "create_on_open",
2629 .lname = "Create on open",
2630 .type = FIO_OPT_BOOL,
2631 .off1 = td_var_offset(create_on_open),
2632 .help = "Create files when they are opened for IO",
2634 .category = FIO_OPT_C_FILE,
2635 .group = FIO_OPT_G_INVALID,
2638 .name = "create_only",
2639 .type = FIO_OPT_BOOL,
2640 .off1 = td_var_offset(create_only),
2641 .help = "Only perform file creation phase",
2642 .category = FIO_OPT_C_FILE,
2647 .lname = "Pre-read files",
2648 .type = FIO_OPT_BOOL,
2649 .off1 = td_var_offset(pre_read),
2650 .help = "Pre-read files before starting official testing",
2652 .category = FIO_OPT_C_FILE,
2653 .group = FIO_OPT_G_INVALID,
2655 #ifdef FIO_HAVE_CPU_AFFINITY
2658 .lname = "CPU mask",
2659 .type = FIO_OPT_INT,
2660 .cb = str_cpumask_cb,
2661 .help = "CPU affinity mask",
2662 .category = FIO_OPT_C_GENERAL,
2663 .group = FIO_OPT_G_CRED,
2666 .name = "cpus_allowed",
2667 .lname = "CPUs allowed",
2668 .type = FIO_OPT_STR,
2669 .cb = str_cpus_allowed_cb,
2670 .help = "Set CPUs allowed",
2671 .category = FIO_OPT_C_GENERAL,
2672 .group = FIO_OPT_G_CRED,
2675 #ifdef CONFIG_LIBNUMA
2677 .name = "numa_cpu_nodes",
2678 .type = FIO_OPT_STR,
2679 .cb = str_numa_cpunodes_cb,
2680 .help = "NUMA CPU nodes bind",
2681 .category = FIO_OPT_C_GENERAL,
2682 .group = FIO_OPT_G_INVALID,
2685 .name = "numa_mem_policy",
2686 .type = FIO_OPT_STR,
2687 .cb = str_numa_mpol_cb,
2688 .help = "NUMA memory policy setup",
2689 .category = FIO_OPT_C_GENERAL,
2690 .group = FIO_OPT_G_INVALID,
2694 .name = "end_fsync",
2695 .lname = "End fsync",
2696 .type = FIO_OPT_BOOL,
2697 .off1 = td_var_offset(end_fsync),
2698 .help = "Include fsync at the end of job",
2700 .category = FIO_OPT_C_FILE,
2701 .group = FIO_OPT_G_INVALID,
2704 .name = "fsync_on_close",
2705 .lname = "Fsync on close",
2706 .type = FIO_OPT_BOOL,
2707 .off1 = td_var_offset(fsync_on_close),
2708 .help = "fsync files on close",
2710 .category = FIO_OPT_C_FILE,
2711 .group = FIO_OPT_G_INVALID,
2715 .lname = "Unlink file",
2716 .type = FIO_OPT_BOOL,
2717 .off1 = td_var_offset(unlink),
2718 .help = "Unlink created files after job has completed",
2720 .category = FIO_OPT_C_FILE,
2721 .group = FIO_OPT_G_INVALID,
2725 .lname = "Exit-all on terminate",
2726 .type = FIO_OPT_STR_SET,
2727 .cb = str_exitall_cb,
2728 .help = "Terminate all jobs when one exits",
2729 .category = FIO_OPT_C_GENERAL,
2730 .group = FIO_OPT_G_PROCESS,
2733 .name = "stonewall",
2734 .lname = "Wait for previous",
2735 .alias = "wait_for_previous",
2736 .type = FIO_OPT_STR_SET,
2737 .off1 = td_var_offset(stonewall),
2738 .help = "Insert a hard barrier between this job and previous",
2739 .category = FIO_OPT_C_GENERAL,
2740 .group = FIO_OPT_G_PROCESS,
2743 .name = "new_group",
2744 .lname = "New group",
2745 .type = FIO_OPT_STR_SET,
2746 .off1 = td_var_offset(new_group),
2747 .help = "Mark the start of a new group (for reporting)",
2748 .category = FIO_OPT_C_GENERAL,
2749 .group = FIO_OPT_G_PROCESS,
2754 .type = FIO_OPT_STR_SET,
2755 .off1 = td_var_offset(use_thread),
2756 .help = "Use threads instead of processes",
2757 .category = FIO_OPT_C_GENERAL,
2758 .group = FIO_OPT_G_PROCESS,
2761 .name = "write_bw_log",
2762 .lname = "Write bandwidth log",
2763 .type = FIO_OPT_STR_STORE,
2764 .off1 = td_var_offset(bw_log_file),
2765 .help = "Write log of bandwidth during run",
2766 .category = FIO_OPT_C_LOG,
2767 .group = FIO_OPT_G_INVALID,
2770 .name = "write_lat_log",
2771 .lname = "Write latency log",
2772 .type = FIO_OPT_STR_STORE,
2773 .off1 = td_var_offset(lat_log_file),
2774 .help = "Write log of latency during run",
2775 .category = FIO_OPT_C_LOG,
2776 .group = FIO_OPT_G_INVALID,
2779 .name = "write_iops_log",
2780 .lname = "Write IOPS log",
2781 .type = FIO_OPT_STR_STORE,
2782 .off1 = td_var_offset(iops_log_file),
2783 .help = "Write log of IOPS during run",
2784 .category = FIO_OPT_C_LOG,
2785 .group = FIO_OPT_G_INVALID,
2788 .name = "log_avg_msec",
2789 .lname = "Log averaging (msec)",
2790 .type = FIO_OPT_INT,
2791 .off1 = td_var_offset(log_avg_msec),
2792 .help = "Average bw/iops/lat logs over this period of time",
2794 .category = FIO_OPT_C_LOG,
2795 .group = FIO_OPT_G_INVALID,
2798 .name = "bwavgtime",
2799 .lname = "Bandwidth average time",
2800 .type = FIO_OPT_INT,
2801 .off1 = td_var_offset(bw_avg_time),
2802 .help = "Time window over which to calculate bandwidth"
2805 .parent = "write_bw_log",
2808 .category = FIO_OPT_C_LOG,
2809 .group = FIO_OPT_G_INVALID,
2812 .name = "iopsavgtime",
2813 .lname = "IOPS average time",
2814 .type = FIO_OPT_INT,
2815 .off1 = td_var_offset(iops_avg_time),
2816 .help = "Time window over which to calculate IOPS (msec)",
2818 .parent = "write_iops_log",
2821 .category = FIO_OPT_C_LOG,
2822 .group = FIO_OPT_G_INVALID,
2825 .name = "group_reporting",
2826 .lname = "Group reporting",
2827 .type = FIO_OPT_STR_SET,
2828 .off1 = td_var_offset(group_reporting),
2829 .help = "Do reporting on a per-group basis",
2830 .category = FIO_OPT_C_STAT,
2831 .group = FIO_OPT_G_INVALID,
2834 .name = "zero_buffers",
2835 .lname = "Zero I/O buffers",
2836 .type = FIO_OPT_STR_SET,
2837 .off1 = td_var_offset(zero_buffers),
2838 .help = "Init IO buffers to all zeroes",
2839 .category = FIO_OPT_C_IO,
2840 .group = FIO_OPT_G_IO_BUF,
2843 .name = "refill_buffers",
2844 .lname = "Refill I/O buffers",
2845 .type = FIO_OPT_STR_SET,
2846 .off1 = td_var_offset(refill_buffers),
2847 .help = "Refill IO buffers on every IO submit",
2848 .category = FIO_OPT_C_IO,
2849 .group = FIO_OPT_G_IO_BUF,
2852 .name = "scramble_buffers",
2853 .lname = "Scramble I/O buffers",
2854 .type = FIO_OPT_BOOL,
2855 .off1 = td_var_offset(scramble_buffers),
2856 .help = "Slightly scramble buffers on every IO submit",
2858 .category = FIO_OPT_C_IO,
2859 .group = FIO_OPT_G_IO_BUF,
2862 .name = "buffer_compress_percentage",
2863 .lname = "Buffer compression percentage",
2864 .type = FIO_OPT_INT,
2865 .off1 = td_var_offset(compress_percentage),
2868 .help = "How compressible the buffer is (approximately)",
2870 .category = FIO_OPT_C_IO,
2871 .group = FIO_OPT_G_IO_BUF,
2874 .name = "buffer_compress_chunk",
2875 .lname = "Buffer compression chunk size",
2876 .type = FIO_OPT_INT,
2877 .off1 = td_var_offset(compress_chunk),
2878 .parent = "buffer_compress_percentage",
2880 .help = "Size of compressible region in buffer",
2882 .category = FIO_OPT_C_IO,
2883 .group = FIO_OPT_G_IO_BUF,
2886 .name = "clat_percentiles",
2887 .lname = "Completion latency percentiles",
2888 .type = FIO_OPT_BOOL,
2889 .off1 = td_var_offset(clat_percentiles),
2890 .help = "Enable the reporting of completion latency percentiles",
2892 .category = FIO_OPT_C_STAT,
2893 .group = FIO_OPT_G_INVALID,
2896 .name = "percentile_list",
2897 .lname = "Completion latency percentile list",
2898 .type = FIO_OPT_FLOAT_LIST,
2899 .off1 = td_var_offset(percentile_list),
2900 .off2 = td_var_offset(percentile_precision),
2901 .help = "Specify a custom list of percentiles to report",
2902 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
2903 .maxlen = FIO_IO_U_LIST_MAX_LEN,
2906 .category = FIO_OPT_C_STAT,
2907 .group = FIO_OPT_G_INVALID,
2910 #ifdef FIO_HAVE_DISK_UTIL
2912 .name = "disk_util",
2913 .lname = "Disk utilization",
2914 .type = FIO_OPT_BOOL,
2915 .off1 = td_var_offset(do_disk_util),
2916 .help = "Log disk utilization statistics",
2918 .category = FIO_OPT_C_STAT,
2919 .group = FIO_OPT_G_INVALID,
2923 .name = "gtod_reduce",
2924 .lname = "Reduce gettimeofday() calls",
2925 .type = FIO_OPT_BOOL,
2926 .help = "Greatly reduce number of gettimeofday() calls",
2927 .cb = str_gtod_reduce_cb,
2930 .category = FIO_OPT_C_STAT,
2931 .group = FIO_OPT_G_INVALID,
2934 .name = "disable_lat",
2935 .lname = "Disable all latency stats",
2936 .type = FIO_OPT_BOOL,
2937 .off1 = td_var_offset(disable_lat),
2938 .help = "Disable latency numbers",
2939 .parent = "gtod_reduce",
2942 .category = FIO_OPT_C_STAT,
2943 .group = FIO_OPT_G_INVALID,
2946 .name = "disable_clat",
2947 .lname = "Disable completion latency stats",
2948 .type = FIO_OPT_BOOL,
2949 .off1 = td_var_offset(disable_clat),
2950 .help = "Disable completion latency numbers",
2951 .parent = "gtod_reduce",
2954 .category = FIO_OPT_C_STAT,
2955 .group = FIO_OPT_G_INVALID,
2958 .name = "disable_slat",
2959 .lname = "Disable submission latency stats",
2960 .type = FIO_OPT_BOOL,
2961 .off1 = td_var_offset(disable_slat),
2962 .help = "Disable submission latency numbers",
2963 .parent = "gtod_reduce",
2966 .category = FIO_OPT_C_STAT,
2967 .group = FIO_OPT_G_INVALID,
2970 .name = "disable_bw_measurement",
2971 .lname = "Disable bandwidth stats",
2972 .type = FIO_OPT_BOOL,
2973 .off1 = td_var_offset(disable_bw),
2974 .help = "Disable bandwidth logging",
2975 .parent = "gtod_reduce",
2978 .category = FIO_OPT_C_STAT,
2979 .group = FIO_OPT_G_INVALID,
2983 .lname = "Dedicated gettimeofday() CPU",
2984 .type = FIO_OPT_INT,
2985 .cb = str_gtod_cpu_cb,
2986 .help = "Set up dedicated gettimeofday() thread on this CPU",
2987 .verify = gtod_cpu_verify,
2988 .category = FIO_OPT_C_GENERAL,
2989 .group = FIO_OPT_G_CLOCK,
2992 .name = "unified_rw_reporting",
2993 .type = FIO_OPT_BOOL,
2994 .off1 = td_var_offset(unified_rw_rep),
2995 .help = "Unify reporting across data direction",
2997 .category = FIO_OPT_C_GENERAL,
2998 .group = FIO_OPT_G_INVALID,
3001 .name = "continue_on_error",
3002 .lname = "Continue on error",
3003 .type = FIO_OPT_STR,
3004 .off1 = td_var_offset(continue_on_error),
3005 .help = "Continue on non-fatal errors during IO",
3007 .category = FIO_OPT_C_GENERAL,
3008 .group = FIO_OPT_G_ERR,
3011 .oval = ERROR_TYPE_NONE,
3012 .help = "Exit when an error is encountered",
3015 .oval = ERROR_TYPE_READ,
3016 .help = "Continue on read errors only",
3019 .oval = ERROR_TYPE_WRITE,
3020 .help = "Continue on write errors only",
3023 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3024 .help = "Continue on any IO errors",
3027 .oval = ERROR_TYPE_VERIFY,
3028 .help = "Continue on verify errors only",
3031 .oval = ERROR_TYPE_ANY,
3032 .help = "Continue on all io and verify errors",
3035 .oval = ERROR_TYPE_NONE,
3036 .help = "Alias for 'none'",
3039 .oval = ERROR_TYPE_ANY,
3040 .help = "Alias for 'all'",
3045 .name = "ignore_error",
3046 .type = FIO_OPT_STR,
3047 .cb = str_ignore_error_cb,
3048 .help = "Set a specific list of errors to ignore",
3050 .category = FIO_OPT_C_GENERAL,
3051 .group = FIO_OPT_G_ERR,
3054 .name = "error_dump",
3055 .type = FIO_OPT_BOOL,
3056 .off1 = td_var_offset(error_dump),
3058 .help = "Dump info on each error",
3059 .category = FIO_OPT_C_GENERAL,
3060 .group = FIO_OPT_G_ERR,
3065 .type = FIO_OPT_STR_STORE,
3066 .off1 = td_var_offset(profile),
3067 .help = "Select a specific builtin performance test",
3068 .category = FIO_OPT_C_PROFILE,
3069 .group = FIO_OPT_G_INVALID,
3074 .type = FIO_OPT_STR_STORE,
3075 .off1 = td_var_offset(cgroup),
3076 .help = "Add job to cgroup of this name",
3077 .category = FIO_OPT_C_GENERAL,
3078 .group = FIO_OPT_G_CGROUP,
3081 .name = "cgroup_nodelete",
3082 .lname = "Cgroup no-delete",
3083 .type = FIO_OPT_BOOL,
3084 .off1 = td_var_offset(cgroup_nodelete),
3085 .help = "Do not delete cgroups after job completion",
3088 .category = FIO_OPT_C_GENERAL,
3089 .group = FIO_OPT_G_CGROUP,
3092 .name = "cgroup_weight",
3093 .lname = "Cgroup weight",
3094 .type = FIO_OPT_INT,
3095 .off1 = td_var_offset(cgroup_weight),
3096 .help = "Use given weight for cgroup",
3100 .category = FIO_OPT_C_GENERAL,
3101 .group = FIO_OPT_G_CGROUP,
3106 .type = FIO_OPT_INT,
3107 .off1 = td_var_offset(uid),
3108 .help = "Run job with this user ID",
3109 .category = FIO_OPT_C_GENERAL,
3110 .group = FIO_OPT_G_CRED,
3114 .lname = "Group ID",
3115 .type = FIO_OPT_INT,
3116 .off1 = td_var_offset(gid),
3117 .help = "Run job with this group ID",
3118 .category = FIO_OPT_C_GENERAL,
3119 .group = FIO_OPT_G_CRED,
3124 .type = FIO_OPT_INT,
3125 .off1 = td_var_offset(kb_base),
3131 .help = "Use 1024 as the K base",
3135 .help = "Use 1000 as the K base",
3138 .help = "How many bytes per KB for reporting (1000 or 1024)",
3139 .category = FIO_OPT_C_GENERAL,
3140 .group = FIO_OPT_G_INVALID,
3143 .name = "unit_base",
3144 .lname = "Base unit for reporting (Bits or Bytes)",
3145 .type = FIO_OPT_INT,
3146 .off1 = td_var_offset(unit_base),
3151 .help = "Auto-detect",
3155 .help = "Normal (byte based)",
3159 .help = "Bit based",
3162 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3163 .category = FIO_OPT_C_GENERAL,
3164 .group = FIO_OPT_G_INVALID,
3167 .name = "hugepage-size",
3168 .lname = "Hugepage size",
3169 .type = FIO_OPT_INT,
3170 .off1 = td_var_offset(hugepage_size),
3171 .help = "When using hugepages, specify size of each page",
3172 .def = __fio_stringify(FIO_HUGE_PAGE),
3173 .interval = 1024 * 1024,
3174 .category = FIO_OPT_C_GENERAL,
3175 .group = FIO_OPT_G_INVALID,
3179 .lname = "I/O flow ID",
3180 .type = FIO_OPT_INT,
3181 .off1 = td_var_offset(flow_id),
3182 .help = "The flow index ID to use",
3184 .category = FIO_OPT_C_IO,
3185 .group = FIO_OPT_G_IO_FLOW,
3189 .lname = "I/O flow weight",
3190 .type = FIO_OPT_INT,
3191 .off1 = td_var_offset(flow),
3192 .help = "Weight for flow control of this job",
3193 .parent = "flow_id",
3196 .category = FIO_OPT_C_IO,
3197 .group = FIO_OPT_G_IO_FLOW,
3200 .name = "flow_watermark",
3201 .lname = "I/O flow watermark",
3202 .type = FIO_OPT_INT,
3203 .off1 = td_var_offset(flow_watermark),
3204 .help = "High watermark for flow control. This option"
3205 " should be set to the same value for all threads"
3206 " with non-zero flow.",
3207 .parent = "flow_id",
3210 .category = FIO_OPT_C_IO,
3211 .group = FIO_OPT_G_IO_FLOW,
3214 .name = "flow_sleep",
3215 .lname = "I/O flow sleep",
3216 .type = FIO_OPT_INT,
3217 .off1 = td_var_offset(flow_sleep),
3218 .help = "How many microseconds to sleep after being held"
3219 " back by the flow control mechanism",
3220 .parent = "flow_id",
3223 .category = FIO_OPT_C_IO,
3224 .group = FIO_OPT_G_IO_FLOW,
3231 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3232 const char *name, int val)
3234 lopt->name = (char *) name;
3236 if (o->type == FIO_OPT_STR_SET)
3237 lopt->has_arg = no_argument;
3239 lopt->has_arg = required_argument;
3242 static void options_to_lopts(struct fio_option *opts,
3243 struct option *long_options,
3244 int i, int option_type)
3246 struct fio_option *o = &opts[0];
3248 add_to_lopt(&long_options[i], o, o->name, option_type);
3251 add_to_lopt(&long_options[i], o, o->alias, option_type);
3256 assert(i < FIO_NR_OPTIONS);
3260 void fio_options_set_ioengine_opts(struct option *long_options,
3261 struct thread_data *td)
3266 while (long_options[i].name) {
3267 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3268 memset(&long_options[i], 0, sizeof(*long_options));
3275 * Just clear out the prior ioengine options.
3280 options_to_lopts(td->io_ops->options, long_options, i,
3281 FIO_GETOPT_IOENGINE);
3284 void fio_options_dup_and_init(struct option *long_options)
3288 options_init(fio_options);
3291 while (long_options[i].name)
3294 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3297 struct fio_keyword {
3303 static struct fio_keyword fio_keywords[] = {
3305 .word = "$pagesize",
3306 .desc = "Page size in the system",
3309 .word = "$mb_memory",
3310 .desc = "Megabytes of memory online",
3314 .desc = "Number of CPUs online in the system",
3321 void fio_keywords_init(void)
3323 unsigned long long mb_memory;
3327 sprintf(buf, "%lu", (unsigned long) page_size);
3328 fio_keywords[0].replace = strdup(buf);
3330 mb_memory = os_phys_mem() / (1024 * 1024);
3331 sprintf(buf, "%llu", mb_memory);
3332 fio_keywords[1].replace = strdup(buf);
3335 sprintf(buf, "%lu", l);
3336 fio_keywords[2].replace = strdup(buf);
3341 static char *bc_calc(char *str)
3343 char buf[128], *tmp;
3348 * No math, just return string
3350 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3351 !strchr(str, '/')) || strchr(str, '\''))
3355 * Split option from value, we only need to calculate the value
3357 tmp = strchr(str, '=');
3364 * Prevent buffer overflows; such a case isn't reasonable anyway
3366 if (strlen(str) >= 128 || strlen(tmp) > 100)
3369 sprintf(buf, "which %s > /dev/null", BC_APP);
3371 log_err("fio: bc is needed for performing math\n");
3375 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3376 f = popen(buf, "r");
3380 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3385 buf[(tmp - str) + ret - 1] = '\0';
3386 memcpy(buf, str, tmp - str);
3392 * Return a copy of the input string with substrings of the form ${VARNAME}
3393 * substituted with the value of the environment variable VARNAME. The
3394 * substitution always occurs, even if VARNAME is empty or the corresponding
3395 * environment variable undefined.
3397 static char *option_dup_subs(const char *opt)
3399 char out[OPT_LEN_MAX+1];
3400 char in[OPT_LEN_MAX+1];
3403 char *ch1, *ch2, *env;
3404 ssize_t nchr = OPT_LEN_MAX;
3407 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3408 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3412 in[OPT_LEN_MAX] = '\0';
3413 strncpy(in, opt, OPT_LEN_MAX);
3415 while (*inptr && nchr > 0) {
3416 if (inptr[0] == '$' && inptr[1] == '{') {
3417 ch2 = strchr(inptr, '}');
3418 if (ch2 && inptr+1 < ch2) {
3425 envlen = strlen(env);
3426 if (envlen <= nchr) {
3427 memcpy(outptr, env, envlen);
3437 *outptr++ = *inptr++;
3446 * Look for reserved variable names and replace them with real values
3448 static char *fio_keyword_replace(char *opt)
3454 for (i = 0; fio_keywords[i].word != NULL; i++) {
3455 struct fio_keyword *kw = &fio_keywords[i];
3457 while ((s = strstr(opt, kw->word)) != NULL) {
3458 char *new = malloc(strlen(opt) + 1);
3464 * Copy part of the string before the keyword and
3465 * sprintf() the replacement after it.
3467 memcpy(new, opt, olen);
3468 len = sprintf(new + olen, "%s", kw->replace);
3471 * If there's more in the original string, copy that
3474 opt += strlen(kw->word) + olen;
3476 memcpy(new + olen + len, opt, opt - o_org - 1);
3479 * replace opt and free the old opt
3489 * Check for potential math and invoke bc, if possible
3497 static char **dup_and_sub_options(char **opts, int num_opts)
3500 char **opts_copy = malloc(num_opts * sizeof(*opts));
3501 for (i = 0; i < num_opts; i++) {
3502 opts_copy[i] = option_dup_subs(opts[i]);
3505 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3510 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
3512 int i, ret, unknown;
3515 sort_options(opts, fio_options, num_opts);
3516 opts_copy = dup_and_sub_options(opts, num_opts);
3518 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3519 struct fio_option *o;
3520 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3529 opts_copy[i] = NULL;
3536 ret |= ioengine_load(td);
3538 sort_options(opts_copy, td->io_ops->options, num_opts);
3541 for (i = 0; i < num_opts; i++) {
3542 struct fio_option *o = NULL;
3548 newret = parse_option(opts_copy[i], opts[i],
3549 td->io_ops->options, &o,
3554 log_err("Bad option <%s>\n", opts[i]);
3557 opts_copy[i] = NULL;
3565 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3567 return parse_cmd_option(opt, val, fio_options, td);
3570 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3573 return parse_cmd_option(opt, val, td->io_ops->options, td);
3576 void fio_fill_default_options(struct thread_data *td)
3578 fill_default_options(td, fio_options);
3581 int fio_show_option_help(const char *opt)
3583 return show_cmd_help(fio_options, opt);
3586 void options_mem_dupe(void *data, struct fio_option *options)
3588 struct fio_option *o;
3591 for (o = &options[0]; o->name; o++) {
3592 if (o->type != FIO_OPT_STR_STORE)
3595 ptr = td_var(data, o->off1);
3597 *ptr = strdup(*ptr);
3602 * dupe FIO_OPT_STR_STORE options
3604 void fio_options_mem_dupe(struct thread_data *td)
3606 options_mem_dupe(&td->o, fio_options);
3608 if (td->eo && td->io_ops) {
3609 void *oldeo = td->eo;
3611 td->eo = malloc(td->io_ops->option_struct_size);
3612 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3613 options_mem_dupe(td->eo, td->io_ops->options);
3617 unsigned int fio_get_kb_base(void *data)
3619 struct thread_options *o = data;
3620 unsigned int kb_base = 0;
3623 kb_base = o->kb_base;
3630 int add_option(struct fio_option *o)
3632 struct fio_option *__o;
3641 memcpy(&fio_options[opt_index], o, sizeof(*o));
3645 void invalidate_profile_options(const char *prof_name)
3647 struct fio_option *o;
3651 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3652 o->type = FIO_OPT_INVALID;
3653 o->prof_name = NULL;
3659 void add_opt_posval(const char *optname, const char *ival, const char *help)
3661 struct fio_option *o;
3664 o = find_option(fio_options, optname);
3668 for (i = 0; i < PARSE_MAX_VP; i++) {
3669 if (o->posval[i].ival)
3672 o->posval[i].ival = ival;
3673 o->posval[i].help = help;
3678 void del_opt_posval(const char *optname, const char *ival)
3680 struct fio_option *o;
3683 o = find_option(fio_options, optname);
3687 for (i = 0; i < PARSE_MAX_VP; i++) {
3688 if (!o->posval[i].ival)
3690 if (strcmp(o->posval[i].ival, ival))
3693 o->posval[i].ival = NULL;
3694 o->posval[i].help = NULL;
3698 void fio_options_free(struct thread_data *td)
3700 options_free(fio_options, td);
3701 if (td->eo && td->io_ops && td->io_ops->options) {
3702 options_free(td->io_ops->options, td->eo);
3708 struct fio_option *fio_option_find(const char *name)
3710 return find_option(fio_options, name);