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_LIBAIO
1307 .help = "Linux native asynchronous IO",
1310 #ifdef CONFIG_POSIXAIO
1311 { .ival = "posixaio",
1312 .help = "POSIX asynchronous IO",
1315 #ifdef CONFIG_SOLARISAIO
1316 { .ival = "solarisaio",
1317 .help = "Solaris native asynchronous IO",
1320 #ifdef CONFIG_WINDOWSAIO
1321 { .ival = "windowsaio",
1322 .help = "Windows native asynchronous IO"
1326 .help = "Memory mapped IO"
1328 #ifdef CONFIG_LINUX_SPLICE
1330 .help = "splice/vmsplice based IO",
1332 { .ival = "netsplice",
1333 .help = "splice/vmsplice to/from the network",
1336 #ifdef FIO_HAVE_SGIO
1338 .help = "SCSI generic v3 IO",
1342 .help = "Testing engine (no data transfer)",
1345 .help = "Network IO",
1348 .help = "CPU cycle burner engine",
1352 .help = "GUASI IO engine",
1355 #ifdef FIO_HAVE_BINJECT
1356 { .ival = "binject",
1357 .help = "binject direct inject block engine",
1362 .help = "RDMA IO engine",
1365 #ifdef CONFIG_FUSION_AW
1366 { .ival = "fusion-aw-sync",
1367 .help = "Fusion-io atomic write engine",
1370 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1371 { .ival = "e4defrag",
1372 .help = "ext4 defrag engine",
1375 #ifdef CONFIG_LINUX_FALLOCATE
1377 .help = "fallocate() file based engine",
1380 { .ival = "external",
1381 .help = "Load external engine (append name)",
1387 .lname = "IO Depth",
1388 .type = FIO_OPT_INT,
1389 .off1 = td_var_offset(iodepth),
1390 .help = "Number of IO buffers to keep in flight",
1394 .category = FIO_OPT_C_IO,
1395 .group = FIO_OPT_G_IO_BASIC,
1398 .name = "iodepth_batch",
1399 .lname = "IO Depth batch",
1400 .alias = "iodepth_batch_submit",
1401 .type = FIO_OPT_INT,
1402 .off1 = td_var_offset(iodepth_batch),
1403 .help = "Number of IO buffers to submit in one go",
1404 .parent = "iodepth",
1409 .category = FIO_OPT_C_IO,
1410 .group = FIO_OPT_G_IO_BASIC,
1413 .name = "iodepth_batch_complete",
1414 .lname = "IO Depth batch complete",
1415 .type = FIO_OPT_INT,
1416 .off1 = td_var_offset(iodepth_batch_complete),
1417 .help = "Number of IO buffers to retrieve in one go",
1418 .parent = "iodepth",
1423 .category = FIO_OPT_C_IO,
1424 .group = FIO_OPT_G_IO_BASIC,
1427 .name = "iodepth_low",
1428 .lname = "IO Depth batch low",
1429 .type = FIO_OPT_INT,
1430 .off1 = td_var_offset(iodepth_low),
1431 .help = "Low water mark for queuing depth",
1432 .parent = "iodepth",
1435 .category = FIO_OPT_C_IO,
1436 .group = FIO_OPT_G_IO_BASIC,
1441 .type = FIO_OPT_STR_VAL,
1443 .help = "Total size of device or files",
1444 .interval = 1024 * 1024,
1445 .category = FIO_OPT_C_IO,
1446 .group = FIO_OPT_G_INVALID,
1449 .name = "fill_device",
1450 .lname = "Fill device",
1452 .type = FIO_OPT_BOOL,
1453 .off1 = td_var_offset(fill_device),
1454 .help = "Write until an ENOSPC error occurs",
1456 .category = FIO_OPT_C_FILE,
1457 .group = FIO_OPT_G_INVALID,
1461 .lname = "File size",
1462 .type = FIO_OPT_STR_VAL,
1463 .off1 = td_var_offset(file_size_low),
1464 .off2 = td_var_offset(file_size_high),
1466 .help = "Size of individual files",
1467 .interval = 1024 * 1024,
1468 .category = FIO_OPT_C_FILE,
1469 .group = FIO_OPT_G_INVALID,
1473 .lname = "IO offset",
1474 .alias = "fileoffset",
1475 .type = FIO_OPT_STR_VAL,
1476 .off1 = td_var_offset(start_offset),
1477 .help = "Start IO from this offset",
1479 .interval = 1024 * 1024,
1480 .category = FIO_OPT_C_IO,
1481 .group = FIO_OPT_G_INVALID,
1484 .name = "offset_increment",
1485 .lname = "IO offset increment",
1486 .type = FIO_OPT_STR_VAL,
1487 .off1 = td_var_offset(offset_increment),
1488 .help = "What is the increment from one offset to the next",
1492 .interval = 1024 * 1024,
1493 .category = FIO_OPT_C_IO,
1494 .group = FIO_OPT_G_INVALID,
1498 .lname = "Block size",
1499 .alias = "blocksize",
1500 .type = FIO_OPT_INT,
1501 .off1 = td_var_offset(bs[DDIR_READ]),
1502 .off2 = td_var_offset(bs[DDIR_WRITE]),
1503 .off3 = td_var_offset(bs[DDIR_TRIM]),
1505 .help = "Block size unit",
1510 .category = FIO_OPT_C_IO,
1511 .group = FIO_OPT_G_INVALID,
1515 .lname = "Block size align",
1516 .alias = "blockalign",
1517 .type = FIO_OPT_INT,
1518 .off1 = td_var_offset(ba[DDIR_READ]),
1519 .off2 = td_var_offset(ba[DDIR_WRITE]),
1520 .off3 = td_var_offset(ba[DDIR_TRIM]),
1522 .help = "IO block offset alignment",
1526 .category = FIO_OPT_C_IO,
1527 .group = FIO_OPT_G_INVALID,
1531 .lname = "Block size range",
1532 .alias = "blocksize_range",
1533 .type = FIO_OPT_RANGE,
1534 .off1 = td_var_offset(min_bs[DDIR_READ]),
1535 .off2 = td_var_offset(max_bs[DDIR_READ]),
1536 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1537 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1538 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1539 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1541 .help = "Set block size range (in more detail than bs)",
1545 .category = FIO_OPT_C_IO,
1546 .group = FIO_OPT_G_INVALID,
1550 .lname = "Block size split",
1551 .type = FIO_OPT_STR,
1552 .cb = str_bssplit_cb,
1553 .help = "Set a specific mix of block sizes",
1556 .category = FIO_OPT_C_IO,
1557 .group = FIO_OPT_G_INVALID,
1560 .name = "bs_unaligned",
1561 .lname = "Block size unaligned",
1562 .alias = "blocksize_unaligned",
1563 .type = FIO_OPT_STR_SET,
1564 .off1 = td_var_offset(bs_unaligned),
1565 .help = "Don't sector align IO buffer sizes",
1568 .category = FIO_OPT_C_IO,
1569 .group = FIO_OPT_G_INVALID,
1572 .name = "randrepeat",
1573 .lname = "Random repeatable",
1574 .type = FIO_OPT_BOOL,
1575 .off1 = td_var_offset(rand_repeatable),
1576 .help = "Use repeatable random IO pattern",
1580 .category = FIO_OPT_C_IO,
1581 .group = FIO_OPT_G_RANDOM,
1584 .name = "use_os_rand",
1585 .lname = "Use OS random",
1586 .type = FIO_OPT_BOOL,
1587 .off1 = td_var_offset(use_os_rand),
1588 .help = "Set to use OS random generator",
1592 .category = FIO_OPT_C_IO,
1593 .group = FIO_OPT_G_RANDOM,
1596 .name = "norandommap",
1597 .lname = "No randommap",
1598 .type = FIO_OPT_STR_SET,
1599 .off1 = td_var_offset(norandommap),
1600 .help = "Accept potential duplicate random blocks",
1604 .category = FIO_OPT_C_IO,
1605 .group = FIO_OPT_G_RANDOM,
1608 .name = "softrandommap",
1609 .lname = "Soft randommap",
1610 .type = FIO_OPT_BOOL,
1611 .off1 = td_var_offset(softrandommap),
1612 .help = "Set norandommap if randommap allocation fails",
1613 .parent = "norandommap",
1616 .category = FIO_OPT_C_IO,
1617 .group = FIO_OPT_G_RANDOM,
1620 .name = "random_generator",
1621 .type = FIO_OPT_STR,
1622 .off1 = td_var_offset(random_generator),
1623 .help = "Type of random number generator to use",
1624 .def = "tausworthe",
1626 { .ival = "tausworthe",
1627 .oval = FIO_RAND_GEN_TAUSWORTHE,
1628 .help = "Strong Tausworthe generator",
1631 .oval = FIO_RAND_GEN_LFSR,
1632 .help = "Variable length LFSR",
1635 .category = FIO_OPT_C_IO,
1636 .group = FIO_OPT_G_RANDOM,
1639 .name = "random_distribution",
1640 .type = FIO_OPT_STR,
1641 .off1 = td_var_offset(random_distribution),
1642 .cb = str_random_distribution_cb,
1643 .help = "Random offset distribution generator",
1647 .oval = FIO_RAND_DIST_RANDOM,
1648 .help = "Completely random",
1651 .oval = FIO_RAND_DIST_ZIPF,
1652 .help = "Zipf distribution",
1655 .oval = FIO_RAND_DIST_PARETO,
1656 .help = "Pareto distribution",
1659 .category = FIO_OPT_C_IO,
1660 .group = FIO_OPT_G_RANDOM,
1663 .name = "percentage_random",
1664 .lname = "Percentage Random",
1665 .type = FIO_OPT_INT,
1666 .cb = str_perc_rand_cb,
1668 .help = "Percentage of seq/random mix that should be random",
1671 .inverse = "percentage_sequential",
1672 .category = FIO_OPT_C_IO,
1673 .group = FIO_OPT_G_RANDOM,
1676 .name = "percentage_sequential",
1677 .lname = "Percentage Sequential",
1678 .type = FIO_OPT_INT,
1679 .cb = str_perc_seq_cb,
1681 .help = "Percentage of seq/random mix that should be sequential",
1684 .inverse = "percentage_random",
1685 .category = FIO_OPT_C_IO,
1686 .group = FIO_OPT_G_RANDOM,
1690 .lname = "Number of files",
1691 .alias = "nr_files",
1692 .type = FIO_OPT_INT,
1693 .off1 = td_var_offset(nr_files),
1694 .help = "Split job workload between this number of files",
1697 .category = FIO_OPT_C_FILE,
1698 .group = FIO_OPT_G_INVALID,
1701 .name = "openfiles",
1702 .lname = "Number of open files",
1703 .type = FIO_OPT_INT,
1704 .off1 = td_var_offset(open_files),
1705 .help = "Number of files to keep open at the same time",
1706 .category = FIO_OPT_C_FILE,
1707 .group = FIO_OPT_G_INVALID,
1710 .name = "file_service_type",
1711 .lname = "File service type",
1712 .type = FIO_OPT_STR,
1714 .off1 = td_var_offset(file_service_type),
1715 .help = "How to select which file to service next",
1716 .def = "roundrobin",
1717 .category = FIO_OPT_C_FILE,
1718 .group = FIO_OPT_G_INVALID,
1721 .oval = FIO_FSERVICE_RANDOM,
1722 .help = "Choose a file at random",
1724 { .ival = "roundrobin",
1725 .oval = FIO_FSERVICE_RR,
1726 .help = "Round robin select files",
1728 { .ival = "sequential",
1729 .oval = FIO_FSERVICE_SEQ,
1730 .help = "Finish one file before moving to the next",
1733 .parent = "nrfiles",
1736 #ifdef CONFIG_POSIX_FALLOCATE
1738 .name = "fallocate",
1739 .lname = "Fallocate",
1740 .type = FIO_OPT_STR,
1741 .off1 = td_var_offset(fallocate_mode),
1742 .help = "Whether pre-allocation is performed when laying out files",
1744 .category = FIO_OPT_C_FILE,
1745 .group = FIO_OPT_G_INVALID,
1748 .oval = FIO_FALLOCATE_NONE,
1749 .help = "Do not pre-allocate space",
1752 .oval = FIO_FALLOCATE_POSIX,
1753 .help = "Use posix_fallocate()",
1755 #ifdef CONFIG_LINUX_FALLOCATE
1757 .oval = FIO_FALLOCATE_KEEP_SIZE,
1758 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1761 /* Compatibility with former boolean values */
1763 .oval = FIO_FALLOCATE_NONE,
1764 .help = "Alias for 'none'",
1767 .oval = FIO_FALLOCATE_POSIX,
1768 .help = "Alias for 'posix'",
1772 #endif /* CONFIG_POSIX_FALLOCATE */
1774 .name = "fadvise_hint",
1775 .lname = "Fadvise hint",
1776 .type = FIO_OPT_BOOL,
1777 .off1 = td_var_offset(fadvise_hint),
1778 .help = "Use fadvise() to advise the kernel on IO pattern",
1780 .category = FIO_OPT_C_FILE,
1781 .group = FIO_OPT_G_INVALID,
1786 .type = FIO_OPT_INT,
1787 .off1 = td_var_offset(fsync_blocks),
1788 .help = "Issue fsync for writes every given number of blocks",
1791 .category = FIO_OPT_C_FILE,
1792 .group = FIO_OPT_G_INVALID,
1795 .name = "fdatasync",
1796 .lname = "Fdatasync",
1797 .type = FIO_OPT_INT,
1798 .off1 = td_var_offset(fdatasync_blocks),
1799 .help = "Issue fdatasync for writes every given number of blocks",
1802 .category = FIO_OPT_C_FILE,
1803 .group = FIO_OPT_G_INVALID,
1806 .name = "write_barrier",
1807 .lname = "Write barrier",
1808 .type = FIO_OPT_INT,
1809 .off1 = td_var_offset(barrier_blocks),
1810 .help = "Make every Nth write a barrier write",
1813 .category = FIO_OPT_C_IO,
1814 .group = FIO_OPT_G_INVALID,
1816 #ifdef CONFIG_SYNC_FILE_RANGE
1818 .name = "sync_file_range",
1819 .lname = "Sync file range",
1821 { .ival = "wait_before",
1822 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1823 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
1827 .oval = SYNC_FILE_RANGE_WRITE,
1828 .help = "SYNC_FILE_RANGE_WRITE",
1832 .ival = "wait_after",
1833 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1834 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
1838 .type = FIO_OPT_STR_MULTI,
1840 .off1 = td_var_offset(sync_file_range),
1841 .help = "Use sync_file_range()",
1842 .category = FIO_OPT_C_FILE,
1843 .group = FIO_OPT_G_INVALID,
1848 .lname = "Direct I/O",
1849 .type = FIO_OPT_BOOL,
1850 .off1 = td_var_offset(odirect),
1851 .help = "Use O_DIRECT IO (negates buffered)",
1853 .inverse = "buffered",
1854 .category = FIO_OPT_C_IO,
1855 .group = FIO_OPT_G_IO_TYPE,
1859 .lname = "Buffered I/O",
1860 .type = FIO_OPT_BOOL,
1861 .off1 = td_var_offset(odirect),
1863 .help = "Use buffered IO (negates direct)",
1865 .inverse = "direct",
1866 .category = FIO_OPT_C_IO,
1867 .group = FIO_OPT_G_IO_TYPE,
1870 .name = "overwrite",
1871 .lname = "Overwrite",
1872 .type = FIO_OPT_BOOL,
1873 .off1 = td_var_offset(overwrite),
1874 .help = "When writing, set whether to overwrite current data",
1876 .category = FIO_OPT_C_FILE,
1877 .group = FIO_OPT_G_INVALID,
1882 .type = FIO_OPT_INT,
1883 .off1 = td_var_offset(loops),
1884 .help = "Number of times to run the job",
1887 .category = FIO_OPT_C_GENERAL,
1888 .group = FIO_OPT_G_RUNTIME,
1892 .lname = "Number of jobs",
1893 .type = FIO_OPT_INT,
1894 .off1 = td_var_offset(numjobs),
1895 .help = "Duplicate this job this many times",
1898 .category = FIO_OPT_C_GENERAL,
1899 .group = FIO_OPT_G_RUNTIME,
1902 .name = "startdelay",
1903 .lname = "Start delay",
1904 .type = FIO_OPT_STR_VAL_TIME,
1905 .off1 = td_var_offset(start_delay),
1906 .help = "Only start job when this period has passed",
1908 .category = FIO_OPT_C_GENERAL,
1909 .group = FIO_OPT_G_RUNTIME,
1915 .type = FIO_OPT_STR_VAL_TIME,
1916 .off1 = td_var_offset(timeout),
1917 .help = "Stop workload when this amount of time has passed",
1919 .category = FIO_OPT_C_GENERAL,
1920 .group = FIO_OPT_G_RUNTIME,
1923 .name = "time_based",
1924 .lname = "Time based",
1925 .type = FIO_OPT_STR_SET,
1926 .off1 = td_var_offset(time_based),
1927 .help = "Keep running until runtime/timeout is met",
1928 .category = FIO_OPT_C_GENERAL,
1929 .group = FIO_OPT_G_RUNTIME,
1932 .name = "ramp_time",
1933 .lname = "Ramp time",
1934 .type = FIO_OPT_STR_VAL_TIME,
1935 .off1 = td_var_offset(ramp_time),
1936 .help = "Ramp up time before measuring performance",
1937 .category = FIO_OPT_C_GENERAL,
1938 .group = FIO_OPT_G_RUNTIME,
1941 .name = "clocksource",
1942 .lname = "Clock source",
1943 .type = FIO_OPT_STR,
1944 .cb = fio_clock_source_cb,
1945 .off1 = td_var_offset(clocksource),
1946 .help = "What type of timing source to use",
1947 .category = FIO_OPT_C_GENERAL,
1948 .group = FIO_OPT_G_CLOCK,
1950 #ifdef CONFIG_GETTIMEOFDAY
1951 { .ival = "gettimeofday",
1953 .help = "Use gettimeofday(2) for timing",
1956 #ifdef CONFIG_CLOCK_GETTIME
1957 { .ival = "clock_gettime",
1958 .oval = CS_CGETTIME,
1959 .help = "Use clock_gettime(2) for timing",
1962 #ifdef ARCH_HAVE_CPU_CLOCK
1964 .oval = CS_CPUCLOCK,
1965 .help = "Use CPU private clock",
1973 .lname = "I/O Memory",
1974 .type = FIO_OPT_STR,
1976 .off1 = td_var_offset(mem_type),
1977 .help = "Backing type for IO buffers",
1979 .category = FIO_OPT_C_IO,
1980 .group = FIO_OPT_G_INVALID,
1984 .help = "Use malloc(3) for IO buffers",
1988 .help = "Use shared memory segments for IO buffers",
1990 #ifdef FIO_HAVE_HUGETLB
1991 { .ival = "shmhuge",
1992 .oval = MEM_SHMHUGE,
1993 .help = "Like shm, but use huge pages",
1998 .help = "Use mmap(2) (file or anon) for IO buffers",
2000 #ifdef FIO_HAVE_HUGETLB
2001 { .ival = "mmaphuge",
2002 .oval = MEM_MMAPHUGE,
2003 .help = "Like mmap, but use huge pages",
2009 .name = "iomem_align",
2010 .alias = "mem_align",
2011 .lname = "I/O memory alignment",
2012 .type = FIO_OPT_INT,
2013 .off1 = td_var_offset(mem_align),
2015 .help = "IO memory buffer offset alignment",
2019 .category = FIO_OPT_C_IO,
2020 .group = FIO_OPT_G_INVALID,
2025 .type = FIO_OPT_STR,
2026 .off1 = td_var_offset(verify),
2027 .help = "Verify data written",
2029 .category = FIO_OPT_C_IO,
2030 .group = FIO_OPT_G_VERIFY,
2033 .oval = VERIFY_NONE,
2034 .help = "Don't do IO verification",
2038 .help = "Use md5 checksums for verification",
2041 .oval = VERIFY_CRC64,
2042 .help = "Use crc64 checksums for verification",
2045 .oval = VERIFY_CRC32,
2046 .help = "Use crc32 checksums for verification",
2048 { .ival = "crc32c-intel",
2049 .oval = VERIFY_CRC32C,
2050 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2053 .oval = VERIFY_CRC32C,
2054 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2057 .oval = VERIFY_CRC16,
2058 .help = "Use crc16 checksums for verification",
2061 .oval = VERIFY_CRC7,
2062 .help = "Use crc7 checksums for verification",
2065 .oval = VERIFY_SHA1,
2066 .help = "Use sha1 checksums for verification",
2069 .oval = VERIFY_SHA256,
2070 .help = "Use sha256 checksums for verification",
2073 .oval = VERIFY_SHA512,
2074 .help = "Use sha512 checksums for verification",
2077 .oval = VERIFY_META,
2078 .help = "Use io information",
2082 .oval = VERIFY_NULL,
2083 .help = "Pretend to verify",
2088 .name = "do_verify",
2089 .lname = "Perform verify step",
2090 .type = FIO_OPT_BOOL,
2091 .off1 = td_var_offset(do_verify),
2092 .help = "Run verification stage after write",
2096 .category = FIO_OPT_C_IO,
2097 .group = FIO_OPT_G_VERIFY,
2100 .name = "verifysort",
2101 .lname = "Verify sort",
2102 .type = FIO_OPT_BOOL,
2103 .off1 = td_var_offset(verifysort),
2104 .help = "Sort written verify blocks for read back",
2108 .category = FIO_OPT_C_IO,
2109 .group = FIO_OPT_G_VERIFY,
2112 .name = "verifysort_nr",
2113 .type = FIO_OPT_INT,
2114 .off1 = td_var_offset(verifysort_nr),
2115 .help = "Pre-load and sort verify blocks for a read workload",
2120 .category = FIO_OPT_C_IO,
2121 .group = FIO_OPT_G_VERIFY,
2124 .name = "verify_interval",
2125 .lname = "Verify interval",
2126 .type = FIO_OPT_INT,
2127 .off1 = td_var_offset(verify_interval),
2128 .minval = 2 * sizeof(struct verify_header),
2129 .help = "Store verify buffer header every N bytes",
2132 .interval = 2 * sizeof(struct verify_header),
2133 .category = FIO_OPT_C_IO,
2134 .group = FIO_OPT_G_VERIFY,
2137 .name = "verify_offset",
2138 .lname = "Verify offset",
2139 .type = FIO_OPT_INT,
2140 .help = "Offset verify header location by N bytes",
2141 .off1 = td_var_offset(verify_offset),
2142 .minval = sizeof(struct verify_header),
2145 .category = FIO_OPT_C_IO,
2146 .group = FIO_OPT_G_VERIFY,
2149 .name = "verify_pattern",
2150 .lname = "Verify pattern",
2151 .type = FIO_OPT_STR,
2152 .cb = str_verify_pattern_cb,
2153 .help = "Fill pattern for IO buffers",
2156 .category = FIO_OPT_C_IO,
2157 .group = FIO_OPT_G_VERIFY,
2160 .name = "verify_fatal",
2161 .lname = "Verify fatal",
2162 .type = FIO_OPT_BOOL,
2163 .off1 = td_var_offset(verify_fatal),
2165 .help = "Exit on a single verify failure, don't continue",
2168 .category = FIO_OPT_C_IO,
2169 .group = FIO_OPT_G_VERIFY,
2172 .name = "verify_dump",
2173 .lname = "Verify dump",
2174 .type = FIO_OPT_BOOL,
2175 .off1 = td_var_offset(verify_dump),
2177 .help = "Dump contents of good and bad blocks on failure",
2180 .category = FIO_OPT_C_IO,
2181 .group = FIO_OPT_G_VERIFY,
2184 .name = "verify_async",
2185 .lname = "Verify asynchronously",
2186 .type = FIO_OPT_INT,
2187 .off1 = td_var_offset(verify_async),
2189 .help = "Number of async verifier threads to use",
2192 .category = FIO_OPT_C_IO,
2193 .group = FIO_OPT_G_VERIFY,
2196 .name = "verify_backlog",
2197 .lname = "Verify backlog",
2198 .type = FIO_OPT_STR_VAL,
2199 .off1 = td_var_offset(verify_backlog),
2200 .help = "Verify after this number of blocks are written",
2203 .category = FIO_OPT_C_IO,
2204 .group = FIO_OPT_G_VERIFY,
2207 .name = "verify_backlog_batch",
2208 .lname = "Verify backlog batch",
2209 .type = FIO_OPT_INT,
2210 .off1 = td_var_offset(verify_batch),
2211 .help = "Verify this number of IO blocks",
2214 .category = FIO_OPT_C_IO,
2215 .group = FIO_OPT_G_VERIFY,
2217 #ifdef FIO_HAVE_CPU_AFFINITY
2219 .name = "verify_async_cpus",
2220 .lname = "Async verify CPUs",
2221 .type = FIO_OPT_STR,
2222 .cb = str_verify_cpus_allowed_cb,
2223 .help = "Set CPUs allowed for async verify threads",
2224 .parent = "verify_async",
2226 .category = FIO_OPT_C_IO,
2227 .group = FIO_OPT_G_VERIFY,
2231 .name = "experimental_verify",
2232 .off1 = td_var_offset(experimental_verify),
2233 .type = FIO_OPT_BOOL,
2234 .help = "Enable experimental verification",
2235 .category = FIO_OPT_C_IO,
2236 .group = FIO_OPT_G_VERIFY,
2238 #ifdef FIO_HAVE_TRIM
2240 .name = "trim_percentage",
2241 .lname = "Trim percentage",
2242 .type = FIO_OPT_INT,
2243 .off1 = td_var_offset(trim_percentage),
2246 .help = "Number of verify blocks to discard/trim",
2251 .category = FIO_OPT_C_IO,
2252 .group = FIO_OPT_G_TRIM,
2255 .name = "trim_verify_zero",
2256 .lname = "Verify trim zero",
2257 .type = FIO_OPT_BOOL,
2258 .help = "Verify that trim/discarded blocks are returned as zeroes",
2259 .off1 = td_var_offset(trim_zero),
2260 .parent = "trim_percentage",
2263 .category = FIO_OPT_C_IO,
2264 .group = FIO_OPT_G_TRIM,
2267 .name = "trim_backlog",
2268 .lname = "Trim backlog",
2269 .type = FIO_OPT_STR_VAL,
2270 .off1 = td_var_offset(trim_backlog),
2271 .help = "Trim after this number of blocks are written",
2272 .parent = "trim_percentage",
2275 .category = FIO_OPT_C_IO,
2276 .group = FIO_OPT_G_TRIM,
2279 .name = "trim_backlog_batch",
2280 .lname = "Trim backlog batch",
2281 .type = FIO_OPT_INT,
2282 .off1 = td_var_offset(trim_batch),
2283 .help = "Trim this number of IO blocks",
2284 .parent = "trim_percentage",
2287 .category = FIO_OPT_C_IO,
2288 .group = FIO_OPT_G_TRIM,
2292 .name = "write_iolog",
2293 .lname = "Write I/O log",
2294 .type = FIO_OPT_STR_STORE,
2295 .off1 = td_var_offset(write_iolog_file),
2296 .help = "Store IO pattern to file",
2297 .category = FIO_OPT_C_IO,
2298 .group = FIO_OPT_G_IOLOG,
2301 .name = "read_iolog",
2302 .lname = "Read I/O log",
2303 .type = FIO_OPT_STR_STORE,
2304 .off1 = td_var_offset(read_iolog_file),
2305 .help = "Playback IO pattern from file",
2306 .category = FIO_OPT_C_IO,
2307 .group = FIO_OPT_G_IOLOG,
2310 .name = "replay_no_stall",
2311 .lname = "Don't stall on replay",
2312 .type = FIO_OPT_BOOL,
2313 .off1 = td_var_offset(no_stall),
2315 .parent = "read_iolog",
2317 .help = "Playback IO pattern file as fast as possible without stalls",
2318 .category = FIO_OPT_C_IO,
2319 .group = FIO_OPT_G_IOLOG,
2322 .name = "replay_redirect",
2323 .lname = "Redirect device for replay",
2324 .type = FIO_OPT_STR_STORE,
2325 .off1 = td_var_offset(replay_redirect),
2326 .parent = "read_iolog",
2328 .help = "Replay all I/O onto this device, regardless of trace device",
2329 .category = FIO_OPT_C_IO,
2330 .group = FIO_OPT_G_IOLOG,
2333 .name = "exec_prerun",
2334 .lname = "Pre-execute runnable",
2335 .type = FIO_OPT_STR_STORE,
2336 .off1 = td_var_offset(exec_prerun),
2337 .help = "Execute this file prior to running job",
2338 .category = FIO_OPT_C_GENERAL,
2339 .group = FIO_OPT_G_INVALID,
2342 .name = "exec_postrun",
2343 .lname = "Post-execute runnable",
2344 .type = FIO_OPT_STR_STORE,
2345 .off1 = td_var_offset(exec_postrun),
2346 .help = "Execute this file after running job",
2347 .category = FIO_OPT_C_GENERAL,
2348 .group = FIO_OPT_G_INVALID,
2350 #ifdef FIO_HAVE_IOSCHED_SWITCH
2352 .name = "ioscheduler",
2353 .lname = "I/O scheduler",
2354 .type = FIO_OPT_STR_STORE,
2355 .off1 = td_var_offset(ioscheduler),
2356 .help = "Use this IO scheduler on the backing device",
2357 .category = FIO_OPT_C_FILE,
2358 .group = FIO_OPT_G_INVALID,
2363 .lname = "Zone size",
2364 .type = FIO_OPT_STR_VAL,
2365 .off1 = td_var_offset(zone_size),
2366 .help = "Amount of data to read per zone",
2368 .interval = 1024 * 1024,
2369 .category = FIO_OPT_C_IO,
2370 .group = FIO_OPT_G_ZONE,
2373 .name = "zonerange",
2374 .lname = "Zone range",
2375 .type = FIO_OPT_STR_VAL,
2376 .off1 = td_var_offset(zone_range),
2377 .help = "Give size of an IO zone",
2379 .interval = 1024 * 1024,
2380 .category = FIO_OPT_C_IO,
2381 .group = FIO_OPT_G_ZONE,
2385 .lname = "Zone skip",
2386 .type = FIO_OPT_STR_VAL,
2387 .off1 = td_var_offset(zone_skip),
2388 .help = "Space between IO zones",
2390 .interval = 1024 * 1024,
2391 .category = FIO_OPT_C_IO,
2392 .group = FIO_OPT_G_ZONE,
2396 .lname = "Lock memory",
2397 .type = FIO_OPT_STR_VAL,
2398 .off1 = td_var_offset(lockmem),
2399 .help = "Lock down this amount of memory (per worker)",
2401 .interval = 1024 * 1024,
2402 .category = FIO_OPT_C_GENERAL,
2403 .group = FIO_OPT_G_INVALID,
2406 .name = "rwmixread",
2407 .lname = "Read/write mix read",
2408 .type = FIO_OPT_INT,
2409 .cb = str_rwmix_read_cb,
2411 .help = "Percentage of mixed workload that is reads",
2414 .inverse = "rwmixwrite",
2415 .category = FIO_OPT_C_IO,
2416 .group = FIO_OPT_G_RWMIX,
2419 .name = "rwmixwrite",
2420 .lname = "Read/write mix write",
2421 .type = FIO_OPT_INT,
2422 .cb = str_rwmix_write_cb,
2424 .help = "Percentage of mixed workload that is writes",
2427 .inverse = "rwmixread",
2428 .category = FIO_OPT_C_IO,
2429 .group = FIO_OPT_G_RWMIX,
2432 .name = "rwmixcycle",
2433 .lname = "Read/write mix cycle",
2434 .type = FIO_OPT_DEPRECATED,
2435 .category = FIO_OPT_C_IO,
2436 .group = FIO_OPT_G_RWMIX,
2441 .type = FIO_OPT_INT,
2442 .off1 = td_var_offset(nice),
2443 .help = "Set job CPU nice value",
2448 .category = FIO_OPT_C_GENERAL,
2449 .group = FIO_OPT_G_CRED,
2451 #ifdef FIO_HAVE_IOPRIO
2454 .lname = "I/O nice priority",
2455 .type = FIO_OPT_INT,
2456 .off1 = td_var_offset(ioprio),
2457 .help = "Set job IO priority value",
2461 .category = FIO_OPT_C_GENERAL,
2462 .group = FIO_OPT_G_CRED,
2465 .name = "prioclass",
2466 .lname = "I/O nice priority class",
2467 .type = FIO_OPT_INT,
2468 .off1 = td_var_offset(ioprio_class),
2469 .help = "Set job IO priority class",
2473 .category = FIO_OPT_C_GENERAL,
2474 .group = FIO_OPT_G_CRED,
2478 .name = "thinktime",
2479 .lname = "Thinktime",
2480 .type = FIO_OPT_INT,
2481 .off1 = td_var_offset(thinktime),
2482 .help = "Idle time between IO buffers (usec)",
2484 .category = FIO_OPT_C_IO,
2485 .group = FIO_OPT_G_THINKTIME,
2488 .name = "thinktime_spin",
2489 .lname = "Thinktime spin",
2490 .type = FIO_OPT_INT,
2491 .off1 = td_var_offset(thinktime_spin),
2492 .help = "Start think time by spinning this amount (usec)",
2494 .parent = "thinktime",
2496 .category = FIO_OPT_C_IO,
2497 .group = FIO_OPT_G_THINKTIME,
2500 .name = "thinktime_blocks",
2501 .lname = "Thinktime blocks",
2502 .type = FIO_OPT_INT,
2503 .off1 = td_var_offset(thinktime_blocks),
2504 .help = "IO buffer period between 'thinktime'",
2506 .parent = "thinktime",
2508 .category = FIO_OPT_C_IO,
2509 .group = FIO_OPT_G_THINKTIME,
2513 .lname = "I/O rate",
2514 .type = FIO_OPT_INT,
2515 .off1 = td_var_offset(rate[DDIR_READ]),
2516 .off2 = td_var_offset(rate[DDIR_WRITE]),
2517 .off3 = td_var_offset(rate[DDIR_TRIM]),
2518 .help = "Set bandwidth rate",
2519 .category = FIO_OPT_C_IO,
2520 .group = FIO_OPT_G_RATE,
2524 .lname = "I/O min rate",
2525 .type = FIO_OPT_INT,
2526 .off1 = td_var_offset(ratemin[DDIR_READ]),
2527 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2528 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2529 .help = "Job must meet this rate or it will be shutdown",
2532 .category = FIO_OPT_C_IO,
2533 .group = FIO_OPT_G_RATE,
2536 .name = "rate_iops",
2537 .lname = "I/O rate IOPS",
2538 .type = FIO_OPT_INT,
2539 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2540 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2541 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2542 .help = "Limit IO used to this number of IO operations/sec",
2544 .category = FIO_OPT_C_IO,
2545 .group = FIO_OPT_G_RATE,
2548 .name = "rate_iops_min",
2549 .lname = "I/O min rate IOPS",
2550 .type = FIO_OPT_INT,
2551 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2552 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2553 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2554 .help = "Job must meet this rate or it will be shut down",
2555 .parent = "rate_iops",
2557 .category = FIO_OPT_C_IO,
2558 .group = FIO_OPT_G_RATE,
2561 .name = "ratecycle",
2562 .lname = "I/O rate cycle",
2563 .type = FIO_OPT_INT,
2564 .off1 = td_var_offset(ratecycle),
2565 .help = "Window average for rate limits (msec)",
2569 .category = FIO_OPT_C_IO,
2570 .group = FIO_OPT_G_RATE,
2573 .name = "max_latency",
2574 .type = FIO_OPT_INT,
2575 .off1 = td_var_offset(max_latency),
2576 .help = "Maximum tolerated IO latency (usec)",
2577 .category = FIO_OPT_C_IO,
2578 .group = FIO_OPT_G_RATE,
2581 .name = "invalidate",
2582 .lname = "Cache invalidate",
2583 .type = FIO_OPT_BOOL,
2584 .off1 = td_var_offset(invalidate_cache),
2585 .help = "Invalidate buffer/page cache prior to running job",
2587 .category = FIO_OPT_C_IO,
2588 .group = FIO_OPT_G_IO_TYPE,
2592 .lname = "Synchronous I/O",
2593 .type = FIO_OPT_BOOL,
2594 .off1 = td_var_offset(sync_io),
2595 .help = "Use O_SYNC for buffered writes",
2597 .parent = "buffered",
2599 .category = FIO_OPT_C_IO,
2600 .group = FIO_OPT_G_IO_TYPE,
2603 .name = "create_serialize",
2604 .lname = "Create serialize",
2605 .type = FIO_OPT_BOOL,
2606 .off1 = td_var_offset(create_serialize),
2607 .help = "Serialize creating of job files",
2609 .category = FIO_OPT_C_FILE,
2610 .group = FIO_OPT_G_INVALID,
2613 .name = "create_fsync",
2614 .lname = "Create fsync",
2615 .type = FIO_OPT_BOOL,
2616 .off1 = td_var_offset(create_fsync),
2617 .help = "fsync file after creation",
2619 .category = FIO_OPT_C_FILE,
2620 .group = FIO_OPT_G_INVALID,
2623 .name = "create_on_open",
2624 .lname = "Create on open",
2625 .type = FIO_OPT_BOOL,
2626 .off1 = td_var_offset(create_on_open),
2627 .help = "Create files when they are opened for IO",
2629 .category = FIO_OPT_C_FILE,
2630 .group = FIO_OPT_G_INVALID,
2633 .name = "create_only",
2634 .type = FIO_OPT_BOOL,
2635 .off1 = td_var_offset(create_only),
2636 .help = "Only perform file creation phase",
2637 .category = FIO_OPT_C_FILE,
2642 .lname = "Pre-read files",
2643 .type = FIO_OPT_BOOL,
2644 .off1 = td_var_offset(pre_read),
2645 .help = "Pre-read files before starting official testing",
2647 .category = FIO_OPT_C_FILE,
2648 .group = FIO_OPT_G_INVALID,
2650 #ifdef FIO_HAVE_CPU_AFFINITY
2653 .lname = "CPU mask",
2654 .type = FIO_OPT_INT,
2655 .cb = str_cpumask_cb,
2656 .help = "CPU affinity mask",
2657 .category = FIO_OPT_C_GENERAL,
2658 .group = FIO_OPT_G_CRED,
2661 .name = "cpus_allowed",
2662 .lname = "CPUs allowed",
2663 .type = FIO_OPT_STR,
2664 .cb = str_cpus_allowed_cb,
2665 .help = "Set CPUs allowed",
2666 .category = FIO_OPT_C_GENERAL,
2667 .group = FIO_OPT_G_CRED,
2670 #ifdef CONFIG_LIBNUMA
2672 .name = "numa_cpu_nodes",
2673 .type = FIO_OPT_STR,
2674 .cb = str_numa_cpunodes_cb,
2675 .help = "NUMA CPU nodes bind",
2676 .category = FIO_OPT_C_GENERAL,
2677 .group = FIO_OPT_G_INVALID,
2680 .name = "numa_mem_policy",
2681 .type = FIO_OPT_STR,
2682 .cb = str_numa_mpol_cb,
2683 .help = "NUMA memory policy setup",
2684 .category = FIO_OPT_C_GENERAL,
2685 .group = FIO_OPT_G_INVALID,
2689 .name = "end_fsync",
2690 .lname = "End fsync",
2691 .type = FIO_OPT_BOOL,
2692 .off1 = td_var_offset(end_fsync),
2693 .help = "Include fsync at the end of job",
2695 .category = FIO_OPT_C_FILE,
2696 .group = FIO_OPT_G_INVALID,
2699 .name = "fsync_on_close",
2700 .lname = "Fsync on close",
2701 .type = FIO_OPT_BOOL,
2702 .off1 = td_var_offset(fsync_on_close),
2703 .help = "fsync files on close",
2705 .category = FIO_OPT_C_FILE,
2706 .group = FIO_OPT_G_INVALID,
2710 .lname = "Unlink file",
2711 .type = FIO_OPT_BOOL,
2712 .off1 = td_var_offset(unlink),
2713 .help = "Unlink created files after job has completed",
2715 .category = FIO_OPT_C_FILE,
2716 .group = FIO_OPT_G_INVALID,
2720 .lname = "Exit-all on terminate",
2721 .type = FIO_OPT_STR_SET,
2722 .cb = str_exitall_cb,
2723 .help = "Terminate all jobs when one exits",
2724 .category = FIO_OPT_C_GENERAL,
2725 .group = FIO_OPT_G_PROCESS,
2728 .name = "stonewall",
2729 .lname = "Wait for previous",
2730 .alias = "wait_for_previous",
2731 .type = FIO_OPT_STR_SET,
2732 .off1 = td_var_offset(stonewall),
2733 .help = "Insert a hard barrier between this job and previous",
2734 .category = FIO_OPT_C_GENERAL,
2735 .group = FIO_OPT_G_PROCESS,
2738 .name = "new_group",
2739 .lname = "New group",
2740 .type = FIO_OPT_STR_SET,
2741 .off1 = td_var_offset(new_group),
2742 .help = "Mark the start of a new group (for reporting)",
2743 .category = FIO_OPT_C_GENERAL,
2744 .group = FIO_OPT_G_PROCESS,
2749 .type = FIO_OPT_STR_SET,
2750 .off1 = td_var_offset(use_thread),
2751 .help = "Use threads instead of processes",
2752 .category = FIO_OPT_C_GENERAL,
2753 .group = FIO_OPT_G_PROCESS,
2756 .name = "write_bw_log",
2757 .lname = "Write bandwidth log",
2758 .type = FIO_OPT_STR_STORE,
2759 .off1 = td_var_offset(bw_log_file),
2760 .help = "Write log of bandwidth during run",
2761 .category = FIO_OPT_C_LOG,
2762 .group = FIO_OPT_G_INVALID,
2765 .name = "write_lat_log",
2766 .lname = "Write latency log",
2767 .type = FIO_OPT_STR_STORE,
2768 .off1 = td_var_offset(lat_log_file),
2769 .help = "Write log of latency during run",
2770 .category = FIO_OPT_C_LOG,
2771 .group = FIO_OPT_G_INVALID,
2774 .name = "write_iops_log",
2775 .lname = "Write IOPS log",
2776 .type = FIO_OPT_STR,
2777 .off1 = td_var_offset(iops_log_file),
2778 .help = "Write log of IOPS during run",
2779 .category = FIO_OPT_C_LOG,
2780 .group = FIO_OPT_G_INVALID,
2783 .name = "log_avg_msec",
2784 .lname = "Log averaging (msec)",
2785 .type = FIO_OPT_INT,
2786 .off1 = td_var_offset(log_avg_msec),
2787 .help = "Average bw/iops/lat logs over this period of time",
2789 .category = FIO_OPT_C_LOG,
2790 .group = FIO_OPT_G_INVALID,
2793 .name = "bwavgtime",
2794 .lname = "Bandwidth average time",
2795 .type = FIO_OPT_INT,
2796 .off1 = td_var_offset(bw_avg_time),
2797 .help = "Time window over which to calculate bandwidth"
2800 .parent = "write_bw_log",
2803 .category = FIO_OPT_C_LOG,
2804 .group = FIO_OPT_G_INVALID,
2807 .name = "iopsavgtime",
2808 .lname = "IOPS average time",
2809 .type = FIO_OPT_INT,
2810 .off1 = td_var_offset(iops_avg_time),
2811 .help = "Time window over which to calculate IOPS (msec)",
2813 .parent = "write_iops_log",
2816 .category = FIO_OPT_C_LOG,
2817 .group = FIO_OPT_G_INVALID,
2820 .name = "group_reporting",
2821 .lname = "Group reporting",
2822 .type = FIO_OPT_BOOL,
2823 .off1 = td_var_offset(group_reporting),
2824 .help = "Do reporting on a per-group basis",
2825 .category = FIO_OPT_C_STAT,
2826 .group = FIO_OPT_G_INVALID,
2829 .name = "zero_buffers",
2830 .lname = "Zero I/O buffers",
2831 .type = FIO_OPT_STR_SET,
2832 .off1 = td_var_offset(zero_buffers),
2833 .help = "Init IO buffers to all zeroes",
2834 .category = FIO_OPT_C_IO,
2835 .group = FIO_OPT_G_IO_BUF,
2838 .name = "refill_buffers",
2839 .lname = "Refill I/O buffers",
2840 .type = FIO_OPT_STR_SET,
2841 .off1 = td_var_offset(refill_buffers),
2842 .help = "Refill IO buffers on every IO submit",
2843 .category = FIO_OPT_C_IO,
2844 .group = FIO_OPT_G_IO_BUF,
2847 .name = "scramble_buffers",
2848 .lname = "Scramble I/O buffers",
2849 .type = FIO_OPT_BOOL,
2850 .off1 = td_var_offset(scramble_buffers),
2851 .help = "Slightly scramble buffers on every IO submit",
2853 .category = FIO_OPT_C_IO,
2854 .group = FIO_OPT_G_IO_BUF,
2857 .name = "buffer_compress_percentage",
2858 .lname = "Buffer compression percentage",
2859 .type = FIO_OPT_INT,
2860 .off1 = td_var_offset(compress_percentage),
2863 .help = "How compressible the buffer is (approximately)",
2865 .category = FIO_OPT_C_IO,
2866 .group = FIO_OPT_G_IO_BUF,
2869 .name = "buffer_compress_chunk",
2870 .lname = "Buffer compression chunk size",
2871 .type = FIO_OPT_INT,
2872 .off1 = td_var_offset(compress_chunk),
2873 .parent = "buffer_compress_percentage",
2875 .help = "Size of compressible region in buffer",
2877 .category = FIO_OPT_C_IO,
2878 .group = FIO_OPT_G_IO_BUF,
2881 .name = "clat_percentiles",
2882 .lname = "Completion latency percentiles",
2883 .type = FIO_OPT_BOOL,
2884 .off1 = td_var_offset(clat_percentiles),
2885 .help = "Enable the reporting of completion latency percentiles",
2887 .category = FIO_OPT_C_STAT,
2888 .group = FIO_OPT_G_INVALID,
2891 .name = "percentile_list",
2892 .lname = "Completion latency percentile list",
2893 .type = FIO_OPT_FLOAT_LIST,
2894 .off1 = td_var_offset(percentile_list),
2895 .off2 = td_var_offset(percentile_precision),
2896 .help = "Specify a custom list of percentiles to report",
2897 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
2898 .maxlen = FIO_IO_U_LIST_MAX_LEN,
2901 .category = FIO_OPT_C_STAT,
2902 .group = FIO_OPT_G_INVALID,
2905 #ifdef FIO_HAVE_DISK_UTIL
2907 .name = "disk_util",
2908 .lname = "Disk utilization",
2909 .type = FIO_OPT_BOOL,
2910 .off1 = td_var_offset(do_disk_util),
2911 .help = "Log disk utilization statistics",
2913 .category = FIO_OPT_C_STAT,
2914 .group = FIO_OPT_G_INVALID,
2918 .name = "gtod_reduce",
2919 .lname = "Reduce gettimeofday() calls",
2920 .type = FIO_OPT_BOOL,
2921 .help = "Greatly reduce number of gettimeofday() calls",
2922 .cb = str_gtod_reduce_cb,
2925 .category = FIO_OPT_C_STAT,
2926 .group = FIO_OPT_G_INVALID,
2929 .name = "disable_lat",
2930 .lname = "Disable all latency stats",
2931 .type = FIO_OPT_BOOL,
2932 .off1 = td_var_offset(disable_lat),
2933 .help = "Disable latency numbers",
2934 .parent = "gtod_reduce",
2937 .category = FIO_OPT_C_STAT,
2938 .group = FIO_OPT_G_INVALID,
2941 .name = "disable_clat",
2942 .lname = "Disable completion latency stats",
2943 .type = FIO_OPT_BOOL,
2944 .off1 = td_var_offset(disable_clat),
2945 .help = "Disable completion latency numbers",
2946 .parent = "gtod_reduce",
2949 .category = FIO_OPT_C_STAT,
2950 .group = FIO_OPT_G_INVALID,
2953 .name = "disable_slat",
2954 .lname = "Disable submission latency stats",
2955 .type = FIO_OPT_BOOL,
2956 .off1 = td_var_offset(disable_slat),
2957 .help = "Disable submission latency numbers",
2958 .parent = "gtod_reduce",
2961 .category = FIO_OPT_C_STAT,
2962 .group = FIO_OPT_G_INVALID,
2965 .name = "disable_bw_measurement",
2966 .lname = "Disable bandwidth stats",
2967 .type = FIO_OPT_BOOL,
2968 .off1 = td_var_offset(disable_bw),
2969 .help = "Disable bandwidth logging",
2970 .parent = "gtod_reduce",
2973 .category = FIO_OPT_C_STAT,
2974 .group = FIO_OPT_G_INVALID,
2978 .lname = "Dedicated gettimeofday() CPU",
2979 .type = FIO_OPT_INT,
2980 .cb = str_gtod_cpu_cb,
2981 .help = "Set up dedicated gettimeofday() thread on this CPU",
2982 .verify = gtod_cpu_verify,
2983 .category = FIO_OPT_C_GENERAL,
2984 .group = FIO_OPT_G_CLOCK,
2987 .name = "unified_rw_reporting",
2988 .type = FIO_OPT_BOOL,
2989 .off1 = td_var_offset(unified_rw_rep),
2990 .help = "Unify reporting across data direction",
2992 .category = FIO_OPT_C_GENERAL,
2993 .group = FIO_OPT_G_INVALID,
2996 .name = "continue_on_error",
2997 .lname = "Continue on error",
2998 .type = FIO_OPT_STR,
2999 .off1 = td_var_offset(continue_on_error),
3000 .help = "Continue on non-fatal errors during IO",
3002 .category = FIO_OPT_C_GENERAL,
3003 .group = FIO_OPT_G_ERR,
3006 .oval = ERROR_TYPE_NONE,
3007 .help = "Exit when an error is encountered",
3010 .oval = ERROR_TYPE_READ,
3011 .help = "Continue on read errors only",
3014 .oval = ERROR_TYPE_WRITE,
3015 .help = "Continue on write errors only",
3018 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3019 .help = "Continue on any IO errors",
3022 .oval = ERROR_TYPE_VERIFY,
3023 .help = "Continue on verify errors only",
3026 .oval = ERROR_TYPE_ANY,
3027 .help = "Continue on all io and verify errors",
3030 .oval = ERROR_TYPE_NONE,
3031 .help = "Alias for 'none'",
3034 .oval = ERROR_TYPE_ANY,
3035 .help = "Alias for 'all'",
3040 .name = "ignore_error",
3041 .type = FIO_OPT_STR,
3042 .cb = str_ignore_error_cb,
3043 .help = "Set a specific list of errors to ignore",
3045 .category = FIO_OPT_C_GENERAL,
3046 .group = FIO_OPT_G_ERR,
3049 .name = "error_dump",
3050 .type = FIO_OPT_BOOL,
3051 .off1 = td_var_offset(error_dump),
3053 .help = "Dump info on each error",
3054 .category = FIO_OPT_C_GENERAL,
3055 .group = FIO_OPT_G_ERR,
3060 .type = FIO_OPT_STR_STORE,
3061 .off1 = td_var_offset(profile),
3062 .help = "Select a specific builtin performance test",
3063 .category = FIO_OPT_C_PROFILE,
3064 .group = FIO_OPT_G_INVALID,
3069 .type = FIO_OPT_STR_STORE,
3070 .off1 = td_var_offset(cgroup),
3071 .help = "Add job to cgroup of this name",
3072 .category = FIO_OPT_C_GENERAL,
3073 .group = FIO_OPT_G_CGROUP,
3076 .name = "cgroup_nodelete",
3077 .lname = "Cgroup no-delete",
3078 .type = FIO_OPT_BOOL,
3079 .off1 = td_var_offset(cgroup_nodelete),
3080 .help = "Do not delete cgroups after job completion",
3083 .category = FIO_OPT_C_GENERAL,
3084 .group = FIO_OPT_G_CGROUP,
3087 .name = "cgroup_weight",
3088 .lname = "Cgroup weight",
3089 .type = FIO_OPT_INT,
3090 .off1 = td_var_offset(cgroup_weight),
3091 .help = "Use given weight for cgroup",
3095 .category = FIO_OPT_C_GENERAL,
3096 .group = FIO_OPT_G_CGROUP,
3101 .type = FIO_OPT_INT,
3102 .off1 = td_var_offset(uid),
3103 .help = "Run job with this user ID",
3104 .category = FIO_OPT_C_GENERAL,
3105 .group = FIO_OPT_G_CRED,
3109 .lname = "Group ID",
3110 .type = FIO_OPT_INT,
3111 .off1 = td_var_offset(gid),
3112 .help = "Run job with this group ID",
3113 .category = FIO_OPT_C_GENERAL,
3114 .group = FIO_OPT_G_CRED,
3119 .type = FIO_OPT_INT,
3120 .off1 = td_var_offset(kb_base),
3126 .help = "Use 1024 as the K base",
3130 .help = "Use 1000 as the K base",
3133 .help = "How many bytes per KB for reporting (1000 or 1024)",
3134 .category = FIO_OPT_C_GENERAL,
3135 .group = FIO_OPT_G_INVALID,
3138 .name = "unit_base",
3139 .lname = "Base unit for reporting (Bits or Bytes)",
3140 .type = FIO_OPT_INT,
3141 .off1 = td_var_offset(unit_base),
3146 .help = "Auto-detect",
3150 .help = "Normal (byte based)",
3154 .help = "Bit based",
3157 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3158 .category = FIO_OPT_C_GENERAL,
3159 .group = FIO_OPT_G_INVALID,
3162 .name = "hugepage-size",
3163 .lname = "Hugepage size",
3164 .type = FIO_OPT_INT,
3165 .off1 = td_var_offset(hugepage_size),
3166 .help = "When using hugepages, specify size of each page",
3167 .def = __fio_stringify(FIO_HUGE_PAGE),
3168 .interval = 1024 * 1024,
3169 .category = FIO_OPT_C_GENERAL,
3170 .group = FIO_OPT_G_INVALID,
3174 .lname = "I/O flow ID",
3175 .type = FIO_OPT_INT,
3176 .off1 = td_var_offset(flow_id),
3177 .help = "The flow index ID to use",
3179 .category = FIO_OPT_C_IO,
3180 .group = FIO_OPT_G_IO_FLOW,
3184 .lname = "I/O flow weight",
3185 .type = FIO_OPT_INT,
3186 .off1 = td_var_offset(flow),
3187 .help = "Weight for flow control of this job",
3188 .parent = "flow_id",
3191 .category = FIO_OPT_C_IO,
3192 .group = FIO_OPT_G_IO_FLOW,
3195 .name = "flow_watermark",
3196 .lname = "I/O flow watermark",
3197 .type = FIO_OPT_INT,
3198 .off1 = td_var_offset(flow_watermark),
3199 .help = "High watermark for flow control. This option"
3200 " should be set to the same value for all threads"
3201 " with non-zero flow.",
3202 .parent = "flow_id",
3205 .category = FIO_OPT_C_IO,
3206 .group = FIO_OPT_G_IO_FLOW,
3209 .name = "flow_sleep",
3210 .lname = "I/O flow sleep",
3211 .type = FIO_OPT_INT,
3212 .off1 = td_var_offset(flow_sleep),
3213 .help = "How many microseconds to sleep after being held"
3214 " back by the flow control mechanism",
3215 .parent = "flow_id",
3218 .category = FIO_OPT_C_IO,
3219 .group = FIO_OPT_G_IO_FLOW,
3226 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3227 const char *name, int val)
3229 lopt->name = (char *) name;
3231 if (o->type == FIO_OPT_STR_SET)
3232 lopt->has_arg = no_argument;
3234 lopt->has_arg = required_argument;
3237 static void options_to_lopts(struct fio_option *opts,
3238 struct option *long_options,
3239 int i, int option_type)
3241 struct fio_option *o = &opts[0];
3243 add_to_lopt(&long_options[i], o, o->name, option_type);
3246 add_to_lopt(&long_options[i], o, o->alias, option_type);
3251 assert(i < FIO_NR_OPTIONS);
3255 void fio_options_set_ioengine_opts(struct option *long_options,
3256 struct thread_data *td)
3261 while (long_options[i].name) {
3262 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3263 memset(&long_options[i], 0, sizeof(*long_options));
3270 * Just clear out the prior ioengine options.
3275 options_to_lopts(td->io_ops->options, long_options, i,
3276 FIO_GETOPT_IOENGINE);
3279 void fio_options_dup_and_init(struct option *long_options)
3283 options_init(fio_options);
3286 while (long_options[i].name)
3289 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3292 struct fio_keyword {
3298 static struct fio_keyword fio_keywords[] = {
3300 .word = "$pagesize",
3301 .desc = "Page size in the system",
3304 .word = "$mb_memory",
3305 .desc = "Megabytes of memory online",
3309 .desc = "Number of CPUs online in the system",
3316 void fio_keywords_init(void)
3318 unsigned long long mb_memory;
3322 sprintf(buf, "%lu", (unsigned long) page_size);
3323 fio_keywords[0].replace = strdup(buf);
3325 mb_memory = os_phys_mem() / (1024 * 1024);
3326 sprintf(buf, "%llu", mb_memory);
3327 fio_keywords[1].replace = strdup(buf);
3330 sprintf(buf, "%lu", l);
3331 fio_keywords[2].replace = strdup(buf);
3336 static char *bc_calc(char *str)
3338 char buf[128], *tmp;
3343 * No math, just return string
3345 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3346 !strchr(str, '/')) || strchr(str, '\''))
3350 * Split option from value, we only need to calculate the value
3352 tmp = strchr(str, '=');
3359 * Prevent buffer overflows; such a case isn't reasonable anyway
3361 if (strlen(str) >= 128 || strlen(tmp) > 100)
3364 sprintf(buf, "which %s > /dev/null", BC_APP);
3366 log_err("fio: bc is needed for performing math\n");
3370 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3371 f = popen(buf, "r");
3375 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3380 buf[(tmp - str) + ret - 1] = '\0';
3381 memcpy(buf, str, tmp - str);
3387 * Return a copy of the input string with substrings of the form ${VARNAME}
3388 * substituted with the value of the environment variable VARNAME. The
3389 * substitution always occurs, even if VARNAME is empty or the corresponding
3390 * environment variable undefined.
3392 static char *option_dup_subs(const char *opt)
3394 char out[OPT_LEN_MAX+1];
3395 char in[OPT_LEN_MAX+1];
3398 char *ch1, *ch2, *env;
3399 ssize_t nchr = OPT_LEN_MAX;
3402 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3403 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3407 in[OPT_LEN_MAX] = '\0';
3408 strncpy(in, opt, OPT_LEN_MAX);
3410 while (*inptr && nchr > 0) {
3411 if (inptr[0] == '$' && inptr[1] == '{') {
3412 ch2 = strchr(inptr, '}');
3413 if (ch2 && inptr+1 < ch2) {
3420 envlen = strlen(env);
3421 if (envlen <= nchr) {
3422 memcpy(outptr, env, envlen);
3432 *outptr++ = *inptr++;
3441 * Look for reserved variable names and replace them with real values
3443 static char *fio_keyword_replace(char *opt)
3449 for (i = 0; fio_keywords[i].word != NULL; i++) {
3450 struct fio_keyword *kw = &fio_keywords[i];
3452 while ((s = strstr(opt, kw->word)) != NULL) {
3453 char *new = malloc(strlen(opt) + 1);
3459 * Copy part of the string before the keyword and
3460 * sprintf() the replacement after it.
3462 memcpy(new, opt, olen);
3463 len = sprintf(new + olen, "%s", kw->replace);
3466 * If there's more in the original string, copy that
3469 opt += strlen(kw->word) + olen;
3471 memcpy(new + olen + len, opt, opt - o_org - 1);
3474 * replace opt and free the old opt
3484 * Check for potential math and invoke bc, if possible
3492 static char **dup_and_sub_options(char **opts, int num_opts)
3495 char **opts_copy = malloc(num_opts * sizeof(*opts));
3496 for (i = 0; i < num_opts; i++) {
3497 opts_copy[i] = option_dup_subs(opts[i]);
3500 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3505 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
3507 int i, ret, unknown;
3510 sort_options(opts, fio_options, num_opts);
3511 opts_copy = dup_and_sub_options(opts, num_opts);
3513 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3514 struct fio_option *o;
3515 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3524 opts_copy[i] = NULL;
3531 ret |= ioengine_load(td);
3533 sort_options(opts_copy, td->io_ops->options, num_opts);
3536 for (i = 0; i < num_opts; i++) {
3537 struct fio_option *o = NULL;
3543 newret = parse_option(opts_copy[i], opts[i],
3544 td->io_ops->options, &o,
3549 log_err("Bad option <%s>\n", opts[i]);
3552 opts_copy[i] = NULL;
3560 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3562 return parse_cmd_option(opt, val, fio_options, td);
3565 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3568 return parse_cmd_option(opt, val, td->io_ops->options, td);
3571 void fio_fill_default_options(struct thread_data *td)
3573 fill_default_options(td, fio_options);
3576 int fio_show_option_help(const char *opt)
3578 return show_cmd_help(fio_options, opt);
3581 void options_mem_dupe(void *data, struct fio_option *options)
3583 struct fio_option *o;
3586 for (o = &options[0]; o->name; o++) {
3587 if (o->type != FIO_OPT_STR_STORE)
3590 ptr = td_var(data, o->off1);
3592 *ptr = strdup(*ptr);
3597 * dupe FIO_OPT_STR_STORE options
3599 void fio_options_mem_dupe(struct thread_data *td)
3601 options_mem_dupe(&td->o, fio_options);
3603 if (td->eo && td->io_ops) {
3604 void *oldeo = td->eo;
3606 td->eo = malloc(td->io_ops->option_struct_size);
3607 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3608 options_mem_dupe(td->eo, td->io_ops->options);
3612 unsigned int fio_get_kb_base(void *data)
3614 struct thread_options *o = data;
3615 unsigned int kb_base = 0;
3618 kb_base = o->kb_base;
3625 int add_option(struct fio_option *o)
3627 struct fio_option *__o;
3636 memcpy(&fio_options[opt_index], o, sizeof(*o));
3640 void invalidate_profile_options(const char *prof_name)
3642 struct fio_option *o;
3646 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3647 o->type = FIO_OPT_INVALID;
3648 o->prof_name = NULL;
3654 void add_opt_posval(const char *optname, const char *ival, const char *help)
3656 struct fio_option *o;
3659 o = find_option(fio_options, optname);
3663 for (i = 0; i < PARSE_MAX_VP; i++) {
3664 if (o->posval[i].ival)
3667 o->posval[i].ival = ival;
3668 o->posval[i].help = help;
3673 void del_opt_posval(const char *optname, const char *ival)
3675 struct fio_option *o;
3678 o = find_option(fio_options, optname);
3682 for (i = 0; i < PARSE_MAX_VP; i++) {
3683 if (!o->posval[i].ival)
3685 if (strcmp(o->posval[i].ival, ival))
3688 o->posval[i].ival = NULL;
3689 o->posval[i].help = NULL;
3693 void fio_options_free(struct thread_data *td)
3695 options_free(fio_options, td);
3696 if (td->eo && td->io_ops && td->io_ops->options) {
3697 options_free(td->io_ops->options, td->eo);
3703 struct fio_option *fio_option_find(const char *name)
3705 return find_option(fio_options, name);