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_data *td, int ddir, char *str)
66 struct bssplit *bssplit;
67 unsigned int i, perc, perc_missing;
68 unsigned int max_bs, min_bs;
72 td->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 == td->o.bssplit_nr[ddir]) {
88 td->o.bssplit_nr[ddir] <<= 1;
89 bssplit = realloc(bssplit, td->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, td)) {
106 log_err("fio: bssplit conversion failed\n");
117 bssplit[i].perc = perc;
121 td->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 < td->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 < td->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 td->o.min_bs[ddir] = min_bs;
155 td->o.max_bs[ddir] = max_bs;
158 * now sort based on percentages, for ease of lookup
160 qsort(bssplit, td->o.bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
161 td->o.bssplit[ddir] = bssplit;
166 static int str_bssplit_cb(void *data, const char *input)
168 struct thread_data *td = data;
169 char *str, *p, *odir, *ddir;
172 p = str = strdup(input);
174 strip_blank_front(&str);
175 strip_blank_end(str);
177 odir = strchr(str, ',');
179 ddir = strchr(odir + 1, ',');
181 ret = bssplit_ddir(td, DDIR_TRIM, ddir + 1);
187 op = strdup(odir + 1);
188 ret = bssplit_ddir(td, DDIR_TRIM, op);
193 ret = bssplit_ddir(td, DDIR_WRITE, odir + 1);
196 ret = bssplit_ddir(td, DDIR_READ, str);
202 ret = bssplit_ddir(td, DDIR_WRITE, op);
207 ret = bssplit_ddir(td, DDIR_TRIM, op);
210 ret = bssplit_ddir(td, DDIR_READ, str);
217 static int str2error(char *str)
219 const char * err[] = {"EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
220 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
221 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
222 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
223 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
224 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
225 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
226 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE"};
227 int i = 0, num = sizeof(err) / sizeof(void *);
230 if (!strcmp(err[i], str))
237 static int ignore_error_type(struct thread_data *td, int etype, char *str)
243 if (etype >= ERROR_TYPE_CNT) {
244 log_err("Illegal error type\n");
248 td->o.ignore_error_nr[etype] = 4;
249 error = malloc(4 * sizeof(struct bssplit));
252 while ((fname = strsep(&str, ":")) != NULL) {
258 * grow struct buffer, if needed
260 if (i == td->o.ignore_error_nr[etype]) {
261 td->o.ignore_error_nr[etype] <<= 1;
262 error = realloc(error, td->o.ignore_error_nr[etype]
265 if (fname[0] == 'E') {
266 error[i] = str2error(fname);
268 error[i] = atoi(fname);
273 log_err("Unknown error %s, please use number value \n",
280 td->o.continue_on_error |= 1 << etype;
281 td->o.ignore_error_nr[etype] = i;
282 td->o.ignore_error[etype] = error;
288 static int str_ignore_error_cb(void *data, const char *input)
290 struct thread_data *td = data;
292 int type = 0, ret = 1;
293 p = str = strdup(input);
295 strip_blank_front(&str);
296 strip_blank_end(str);
302 ret = ignore_error_type(td, type, p);
312 static int str_rw_cb(void *data, const char *str)
314 struct thread_data *td = data;
315 char *nr = get_opt_postfix(str);
317 td->o.ddir_seq_nr = 1;
318 td->o.ddir_seq_add = 0;
324 td->o.ddir_seq_nr = atoi(nr);
328 if (str_to_decimal(nr, &val, 1, td)) {
329 log_err("fio: rw postfix parsing failed\n");
334 td->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->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 #ifdef FIO_HAVE_IOPRIO
380 static int str_prioclass_cb(void *data, unsigned long long *val)
382 struct thread_data *td = data;
386 * mask off old class bits, str_prio_cb() may have set a default class
388 mask = (1 << IOPRIO_CLASS_SHIFT) - 1;
391 td->ioprio |= *val << IOPRIO_CLASS_SHIFT;
396 static int str_prio_cb(void *data, unsigned long long *val)
398 struct thread_data *td = data;
403 * If no class is set, assume BE
405 if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0)
406 td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT;
413 static int str_exitall_cb(void)
415 exitall_on_terminate = 1;
419 #ifdef FIO_HAVE_CPU_AFFINITY
420 static int str_cpumask_cb(void *data, unsigned long long *val)
422 struct thread_data *td = data;
427 ret = fio_cpuset_init(&td->o.cpumask);
429 log_err("fio: cpuset_init failed\n");
430 td_verror(td, ret, "fio_cpuset_init");
434 max_cpu = cpus_online();
436 for (i = 0; i < sizeof(int) * 8; i++) {
437 if ((1 << i) & *val) {
439 log_err("fio: CPU %d too large (max=%ld)\n", i,
443 dprint(FD_PARSE, "set cpu allowed %d\n", i);
444 fio_cpu_set(&td->o.cpumask, i);
448 td->o.cpumask_set = 1;
452 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
459 ret = fio_cpuset_init(mask);
461 log_err("fio: cpuset_init failed\n");
462 td_verror(td, ret, "fio_cpuset_init");
466 p = str = strdup(input);
468 strip_blank_front(&str);
469 strip_blank_end(str);
471 max_cpu = cpus_online();
473 while ((cpu = strsep(&str, ",")) != NULL) {
482 while ((cpu2 = strsep(&str2, "-")) != NULL) {
492 while (icpu <= icpu2) {
493 if (icpu >= FIO_MAX_CPUS) {
494 log_err("fio: your OS only supports up to"
495 " %d CPUs\n", (int) FIO_MAX_CPUS);
499 if (icpu > max_cpu) {
500 log_err("fio: CPU %d too large (max=%ld)\n",
506 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
507 fio_cpu_set(mask, icpu);
516 td->o.cpumask_set = 1;
520 static int str_cpus_allowed_cb(void *data, const char *input)
522 struct thread_data *td = data;
525 ret = set_cpus_allowed(td, &td->o.cpumask, input);
527 td->o.cpumask_set = 1;
532 static int str_verify_cpus_allowed_cb(void *data, const char *input)
534 struct thread_data *td = data;
537 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
539 td->o.verify_cpumask_set = 1;
545 #ifdef CONFIG_LIBNUMA
546 static int str_numa_cpunodes_cb(void *data, char *input)
548 struct thread_data *td = data;
550 /* numa_parse_nodestring() parses a character string list
551 * of nodes into a bit mask. The bit mask is allocated by
552 * numa_allocate_nodemask(), so it should be freed by
553 * numa_free_nodemask().
555 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
556 if (td->o.numa_cpunodesmask == NULL) {
557 log_err("fio: numa_parse_nodestring failed\n");
558 td_verror(td, 1, "str_numa_cpunodes_cb");
562 td->o.numa_cpumask_set = 1;
566 static int str_numa_mpol_cb(void *data, char *input)
568 struct thread_data *td = data;
569 const char * const policy_types[] =
570 { "default", "prefer", "bind", "interleave", "local" };
573 char *nodelist = strchr(input, ':');
575 /* NUL-terminate mode */
579 for (i = 0; i <= MPOL_LOCAL; i++) {
580 if (!strcmp(input, policy_types[i])) {
581 td->o.numa_mem_mode = i;
585 if (i > MPOL_LOCAL) {
586 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
590 switch (td->o.numa_mem_mode) {
593 * Insist on a nodelist of one node only
596 char *rest = nodelist;
597 while (isdigit(*rest))
600 log_err("fio: one node only for \'prefer\'\n");
604 log_err("fio: one node is needed for \'prefer\'\n");
608 case MPOL_INTERLEAVE:
610 * Default to online nodes with memory if no nodelist
613 nodelist = strdup("all");
618 * Don't allow a nodelist
621 log_err("fio: NO nodelist for \'local\'\n");
627 * Insist on a nodelist
630 log_err("fio: a nodelist is needed for \'bind\'\n");
637 /* numa_parse_nodestring() parses a character string list
638 * of nodes into a bit mask. The bit mask is allocated by
639 * numa_allocate_nodemask(), so it should be freed by
640 * numa_free_nodemask().
642 switch (td->o.numa_mem_mode) {
644 td->o.numa_mem_prefer_node = atoi(nodelist);
646 case MPOL_INTERLEAVE:
648 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
649 if (td->o.numa_memnodesmask == NULL) {
650 log_err("fio: numa_parse_nodestring failed\n");
651 td_verror(td, 1, "str_numa_memnodes_cb");
661 td->o.numa_memmask_set = 1;
669 static int str_fst_cb(void *data, const char *str)
671 struct thread_data *td = data;
672 char *nr = get_opt_postfix(str);
674 td->file_service_nr = 1;
676 td->file_service_nr = atoi(nr);
683 #ifdef CONFIG_SYNC_FILE_RANGE
684 static int str_sfr_cb(void *data, const char *str)
686 struct thread_data *td = data;
687 char *nr = get_opt_postfix(str);
689 td->sync_file_range_nr = 1;
691 td->sync_file_range_nr = atoi(nr);
699 static int str_random_distribution_cb(void *data, const char *str)
701 struct thread_data *td = data;
705 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
707 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
712 nr = get_opt_postfix(str);
713 if (nr && !str_to_float(nr, &val)) {
714 log_err("fio: random postfix parsing failed\n");
721 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
723 log_err("fio: zipf theta must different than 1.0\n");
726 td->o.zipf_theta.u.f = val;
728 if (val <= 0.00 || val >= 1.00) {
729 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
732 td->o.pareto_h.u.f = val;
738 static int check_dir(struct thread_data *td, char *fname)
741 char file[PATH_MAX], *dir;
744 if (td->o.directory) {
745 strcpy(file, td->o.directory);
750 sprintf(file + elen, "%s", fname);
756 * We can't do this on FIO_DISKLESSIO engines. The engine isn't loaded
757 * yet, so we can't do this check right here...
759 if (lstat(dir, &sb) < 0) {
762 log_err("fio: %s is not a directory\n", dir);
763 td_verror(td, ret, "lstat");
767 if (!S_ISDIR(sb.st_mode)) {
768 log_err("fio: %s is not a directory\n", dir);
778 * Return next file in the string. Files are separated with ':'. If the ':'
779 * is escaped with a '\', then that ':' is part of the filename and does not
780 * indicate a new file.
782 static char *get_next_file_name(char **ptr)
787 if (!str || !strlen(str))
793 * No colon, we are done
795 p = strchr(str, ':');
802 * We got a colon, but it's the first character. Skip and
810 if (*(p - 1) != '\\') {
816 memmove(p - 1, p, strlen(p) + 1);
823 static int str_filename_cb(void *data, const char *input)
825 struct thread_data *td = data;
826 char *fname, *str, *p;
828 p = str = strdup(input);
830 strip_blank_front(&str);
831 strip_blank_end(str);
833 if (!td->files_index)
836 while ((fname = get_next_file_name(&str)) != NULL) {
839 if (check_dir(td, fname)) {
851 static int str_directory_cb(void *data, const char fio_unused *str)
853 struct thread_data *td = data;
856 if (lstat(td->o.directory, &sb) < 0) {
859 log_err("fio: %s is not a directory\n", td->o.directory);
860 td_verror(td, ret, "lstat");
863 if (!S_ISDIR(sb.st_mode)) {
864 log_err("fio: %s is not a directory\n", td->o.directory);
871 static int str_opendir_cb(void *data, const char fio_unused *str)
873 struct thread_data *td = data;
875 if (!td->files_index)
878 return add_dir_files(td, td->o.opendir);
881 static int str_verify_pattern_cb(void *data, const char *input)
883 struct thread_data *td = data;
885 int i = 0, j = 0, len, k, base = 10;
888 loc1 = strstr(input, "0x");
889 loc2 = strstr(input, "0X");
892 off = strtol(input, NULL, base);
893 if (off != LONG_MAX || errno != ERANGE) {
895 td->o.verify_pattern[i] = off & 0xff;
904 j = loc1 - input + 2;
906 j = loc2 - input + 2;
909 if (len - j < MAX_PATTERN_SIZE * 2) {
911 off = converthexchartoint(input[k--]);
913 off += (converthexchartoint(input[k--])
915 td->o.verify_pattern[i++] = (char) off;
921 * Fill the pattern all the way to the end. This greatly reduces
922 * the number of memcpy's we have to do when verifying the IO.
924 while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) {
925 memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i);
930 * The code in verify_io_u_pattern assumes a single byte pattern
931 * fills the whole verify pattern buffer.
933 memset(td->o.verify_pattern, td->o.verify_pattern[0],
937 td->o.verify_pattern_bytes = i;
940 * VERIFY_META could already be set
942 if (td->o.verify == VERIFY_NONE)
943 td->o.verify = VERIFY_PATTERN;
948 static int str_write_bw_log_cb(void *data, const char *str)
950 struct thread_data *td = data;
953 td->o.bw_log_file = strdup(str);
955 td->o.write_bw_log = 1;
959 static int str_write_lat_log_cb(void *data, const char *str)
961 struct thread_data *td = data;
964 td->o.lat_log_file = strdup(str);
966 td->o.write_lat_log = 1;
970 static int str_write_iops_log_cb(void *data, const char *str)
972 struct thread_data *td = data;
975 td->o.iops_log_file = strdup(str);
977 td->o.write_iops_log = 1;
981 static int str_gtod_reduce_cb(void *data, int *il)
983 struct thread_data *td = data;
986 td->o.disable_lat = !!val;
987 td->o.disable_clat = !!val;
988 td->o.disable_slat = !!val;
989 td->o.disable_bw = !!val;
990 td->o.clat_percentiles = !val;
992 td->tv_cache_mask = 63;
997 static int str_gtod_cpu_cb(void *data, long long *il)
999 struct thread_data *td = data;
1002 td->o.gtod_cpu = val;
1003 td->o.gtod_offload = 1;
1007 static int str_size_cb(void *data, unsigned long long *__val)
1009 struct thread_data *td = data;
1010 unsigned long long v = *__val;
1012 if (parse_is_percent(v)) {
1014 td->o.size_percent = -1ULL - v;
1021 static int rw_verify(struct fio_option *o, void *data)
1023 struct thread_data *td = data;
1025 if (read_only && td_write(td)) {
1026 log_err("fio: job <%s> has write bit set, but fio is in"
1027 " read-only mode\n", td->o.name);
1034 static int gtod_cpu_verify(struct fio_option *o, void *data)
1036 #ifndef FIO_HAVE_CPU_AFFINITY
1037 struct thread_data *td = data;
1039 if (td->o.gtod_cpu) {
1040 log_err("fio: platform must support CPU affinity for"
1041 "gettimeofday() offloading\n");
1052 static struct opt_group fio_opt_groups[] = {
1055 .mask = FIO_OPT_C_GENERAL,
1059 .mask = FIO_OPT_C_IO,
1063 .mask = FIO_OPT_C_FILE,
1066 .name = "Statistics",
1067 .mask = FIO_OPT_C_STAT,
1071 .mask = FIO_OPT_C_LOG,
1075 .mask = FIO_OPT_C_PROFILE,
1082 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1083 unsigned int inv_mask)
1085 struct opt_group *og;
1088 if (*mask == inv_mask || !*mask)
1091 for (i = 0; ogs[i].name; i++) {
1094 if (*mask & og->mask) {
1095 *mask &= ~(og->mask);
1103 struct opt_group *opt_group_from_mask(unsigned int *mask)
1105 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1108 static struct opt_group fio_opt_cat_groups[] = {
1111 .mask = FIO_OPT_G_RATE,
1115 .mask = FIO_OPT_G_ZONE,
1118 .name = "Read/write mix",
1119 .mask = FIO_OPT_G_RWMIX,
1123 .mask = FIO_OPT_G_VERIFY,
1127 .mask = FIO_OPT_G_TRIM,
1130 .name = "I/O Logging",
1131 .mask = FIO_OPT_G_IOLOG,
1134 .name = "I/O Depth",
1135 .mask = FIO_OPT_G_IO_DEPTH,
1139 .mask = FIO_OPT_G_IO_FLOW,
1142 .name = "Description",
1143 .mask = FIO_OPT_G_DESC,
1147 .mask = FIO_OPT_G_FILENAME,
1150 .name = "General I/O",
1151 .mask = FIO_OPT_G_IO_BASIC,
1155 .mask = FIO_OPT_G_CGROUP,
1159 .mask = FIO_OPT_G_RUNTIME,
1163 .mask = FIO_OPT_G_PROCESS,
1166 .name = "Job credentials / priority",
1167 .mask = FIO_OPT_G_CRED,
1170 .name = "Clock settings",
1171 .mask = FIO_OPT_G_CLOCK,
1175 .mask = FIO_OPT_G_IO_TYPE,
1178 .name = "I/O Thinktime",
1179 .mask = FIO_OPT_G_THINKTIME,
1182 .name = "Randomizations",
1183 .mask = FIO_OPT_G_RANDOM,
1186 .name = "I/O buffers",
1187 .mask = FIO_OPT_G_IO_BUF,
1190 .name = "Tiobench profile",
1191 .mask = FIO_OPT_G_TIOBENCH,
1199 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1201 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1205 * Map of job/command line options
1207 static struct fio_option fio_options[FIO_MAX_OPTS] = {
1209 .name = "description",
1210 .lname = "Description of job",
1211 .type = FIO_OPT_STR_STORE,
1212 .off1 = td_var_offset(description),
1213 .help = "Text job description",
1214 .category = FIO_OPT_C_GENERAL,
1215 .group = FIO_OPT_G_DESC,
1219 .lname = "Job name",
1220 .type = FIO_OPT_STR_STORE,
1221 .off1 = td_var_offset(name),
1222 .help = "Name of this job",
1223 .category = FIO_OPT_C_GENERAL,
1224 .group = FIO_OPT_G_DESC,
1228 .lname = "Filename(s)",
1229 .type = FIO_OPT_STR_STORE,
1230 .off1 = td_var_offset(filename),
1231 .cb = str_filename_cb,
1232 .prio = -1, /* must come after "directory" */
1233 .help = "File(s) to use for the workload",
1234 .category = FIO_OPT_C_FILE,
1235 .group = FIO_OPT_G_FILENAME,
1238 .name = "directory",
1239 .lname = "Directory",
1240 .type = FIO_OPT_STR_STORE,
1241 .off1 = td_var_offset(directory),
1242 .cb = str_directory_cb,
1243 .help = "Directory to store files in",
1244 .category = FIO_OPT_C_FILE,
1245 .group = FIO_OPT_G_FILENAME,
1248 .name = "filename_format",
1249 .type = FIO_OPT_STR_STORE,
1250 .off1 = td_var_offset(filename_format),
1251 .prio = -1, /* must come after "directory" */
1252 .help = "Override default $jobname.$jobnum.$filenum naming",
1253 .def = "$jobname.$jobnum.$filenum",
1254 .category = FIO_OPT_C_FILE,
1255 .group = FIO_OPT_G_FILENAME,
1259 .lname = "Lockfile",
1260 .type = FIO_OPT_STR,
1261 .off1 = td_var_offset(file_lock_mode),
1262 .help = "Lock file when doing IO to it",
1263 .parent = "filename",
1266 .category = FIO_OPT_C_FILE,
1267 .group = FIO_OPT_G_FILENAME,
1270 .oval = FILE_LOCK_NONE,
1271 .help = "No file locking",
1273 { .ival = "exclusive",
1274 .oval = FILE_LOCK_EXCLUSIVE,
1275 .help = "Exclusive file lock",
1278 .ival = "readwrite",
1279 .oval = FILE_LOCK_READWRITE,
1280 .help = "Read vs write lock",
1286 .lname = "Open directory",
1287 .type = FIO_OPT_STR_STORE,
1288 .off1 = td_var_offset(opendir),
1289 .cb = str_opendir_cb,
1290 .help = "Recursively add files from this directory and down",
1291 .category = FIO_OPT_C_FILE,
1292 .group = FIO_OPT_G_FILENAME,
1296 .lname = "Read/write",
1297 .alias = "readwrite",
1298 .type = FIO_OPT_STR,
1300 .off1 = td_var_offset(td_ddir),
1301 .help = "IO direction",
1303 .verify = rw_verify,
1304 .category = FIO_OPT_C_IO,
1305 .group = FIO_OPT_G_IO_BASIC,
1308 .oval = TD_DDIR_READ,
1309 .help = "Sequential read",
1312 .oval = TD_DDIR_WRITE,
1313 .help = "Sequential write",
1316 .oval = TD_DDIR_TRIM,
1317 .help = "Sequential trim",
1319 { .ival = "randread",
1320 .oval = TD_DDIR_RANDREAD,
1321 .help = "Random read",
1323 { .ival = "randwrite",
1324 .oval = TD_DDIR_RANDWRITE,
1325 .help = "Random write",
1327 { .ival = "randtrim",
1328 .oval = TD_DDIR_RANDTRIM,
1329 .help = "Random trim",
1333 .help = "Sequential read and write mix",
1335 { .ival = "readwrite",
1337 .help = "Sequential read and write mix",
1340 .oval = TD_DDIR_RANDRW,
1341 .help = "Random read and write mix"
1346 .name = "rw_sequencer",
1347 .lname = "RW Sequencer",
1348 .type = FIO_OPT_STR,
1349 .off1 = td_var_offset(rw_seq),
1350 .help = "IO offset generator modifier",
1351 .def = "sequential",
1352 .category = FIO_OPT_C_IO,
1353 .group = FIO_OPT_G_IO_BASIC,
1355 { .ival = "sequential",
1357 .help = "Generate sequential offsets",
1359 { .ival = "identical",
1360 .oval = RW_SEQ_IDENT,
1361 .help = "Generate identical offsets",
1368 .lname = "IO Engine",
1369 .type = FIO_OPT_STR_STORE,
1370 .off1 = td_var_offset(ioengine),
1371 .help = "IO engine to use",
1372 .def = FIO_PREFERRED_ENGINE,
1373 .category = FIO_OPT_C_IO,
1374 .group = FIO_OPT_G_IO_BASIC,
1377 .help = "Use read/write",
1380 .help = "Use pread/pwrite",
1383 .help = "Use readv/writev",
1385 #ifdef CONFIG_LIBAIO
1387 .help = "Linux native asynchronous IO",
1390 #ifdef CONFIG_POSIXAIO
1391 { .ival = "posixaio",
1392 .help = "POSIX asynchronous IO",
1395 #ifdef CONFIG_SOLARISAIO
1396 { .ival = "solarisaio",
1397 .help = "Solaris native asynchronous IO",
1400 #ifdef CONFIG_WINDOWSAIO
1401 { .ival = "windowsaio",
1402 .help = "Windows native asynchronous IO"
1406 .help = "Memory mapped IO"
1408 #ifdef CONFIG_LINUX_SPLICE
1410 .help = "splice/vmsplice based IO",
1412 { .ival = "netsplice",
1413 .help = "splice/vmsplice to/from the network",
1416 #ifdef FIO_HAVE_SGIO
1418 .help = "SCSI generic v3 IO",
1422 .help = "Testing engine (no data transfer)",
1425 .help = "Network IO",
1428 .help = "CPU cycle burner engine",
1432 .help = "GUASI IO engine",
1435 #ifdef FIO_HAVE_BINJECT
1436 { .ival = "binject",
1437 .help = "binject direct inject block engine",
1442 .help = "RDMA IO engine",
1445 #ifdef CONFIG_FUSION_AW
1446 { .ival = "fusion-aw-sync",
1447 .help = "Fusion-io atomic write engine",
1450 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1451 { .ival = "e4defrag",
1452 .help = "ext4 defrag engine",
1455 #ifdef CONFIG_LINUX_FALLOCATE
1457 .help = "fallocate() file based engine",
1460 { .ival = "external",
1461 .help = "Load external engine (append name)",
1467 .lname = "IO Depth",
1468 .type = FIO_OPT_INT,
1469 .off1 = td_var_offset(iodepth),
1470 .help = "Number of IO buffers to keep in flight",
1474 .category = FIO_OPT_C_IO,
1475 .group = FIO_OPT_G_IO_BASIC,
1478 .name = "iodepth_batch",
1479 .lname = "IO Depth batch",
1480 .alias = "iodepth_batch_submit",
1481 .type = FIO_OPT_INT,
1482 .off1 = td_var_offset(iodepth_batch),
1483 .help = "Number of IO buffers to submit in one go",
1484 .parent = "iodepth",
1489 .category = FIO_OPT_C_IO,
1490 .group = FIO_OPT_G_IO_BASIC,
1493 .name = "iodepth_batch_complete",
1494 .lname = "IO Depth batch complete",
1495 .type = FIO_OPT_INT,
1496 .off1 = td_var_offset(iodepth_batch_complete),
1497 .help = "Number of IO buffers to retrieve in one go",
1498 .parent = "iodepth",
1503 .category = FIO_OPT_C_IO,
1504 .group = FIO_OPT_G_IO_BASIC,
1507 .name = "iodepth_low",
1508 .lname = "IO Depth batch low",
1509 .type = FIO_OPT_INT,
1510 .off1 = td_var_offset(iodepth_low),
1511 .help = "Low water mark for queuing depth",
1512 .parent = "iodepth",
1515 .category = FIO_OPT_C_IO,
1516 .group = FIO_OPT_G_IO_BASIC,
1521 .type = FIO_OPT_STR_VAL,
1523 .help = "Total size of device or files",
1524 .interval = 1024 * 1024,
1525 .category = FIO_OPT_C_IO,
1526 .group = FIO_OPT_G_INVALID,
1529 .name = "fill_device",
1530 .lname = "Fill device",
1532 .type = FIO_OPT_BOOL,
1533 .off1 = td_var_offset(fill_device),
1534 .help = "Write until an ENOSPC error occurs",
1536 .category = FIO_OPT_C_FILE,
1537 .group = FIO_OPT_G_INVALID,
1541 .lname = "File size",
1542 .type = FIO_OPT_STR_VAL,
1543 .off1 = td_var_offset(file_size_low),
1544 .off2 = td_var_offset(file_size_high),
1546 .help = "Size of individual files",
1547 .interval = 1024 * 1024,
1548 .category = FIO_OPT_C_FILE,
1549 .group = FIO_OPT_G_INVALID,
1553 .lname = "IO offset",
1554 .alias = "fileoffset",
1555 .type = FIO_OPT_STR_VAL,
1556 .off1 = td_var_offset(start_offset),
1557 .help = "Start IO from this offset",
1559 .interval = 1024 * 1024,
1560 .category = FIO_OPT_C_IO,
1561 .group = FIO_OPT_G_INVALID,
1564 .name = "offset_increment",
1565 .lname = "IO offset increment",
1566 .type = FIO_OPT_STR_VAL,
1567 .off1 = td_var_offset(offset_increment),
1568 .help = "What is the increment from one offset to the next",
1572 .interval = 1024 * 1024,
1573 .category = FIO_OPT_C_IO,
1574 .group = FIO_OPT_G_INVALID,
1578 .lname = "Block size",
1579 .alias = "blocksize",
1580 .type = FIO_OPT_INT,
1581 .off1 = td_var_offset(bs[DDIR_READ]),
1582 .off2 = td_var_offset(bs[DDIR_WRITE]),
1583 .off3 = td_var_offset(bs[DDIR_TRIM]),
1585 .help = "Block size unit",
1590 .category = FIO_OPT_C_IO,
1591 .group = FIO_OPT_G_INVALID,
1595 .lname = "Block size align",
1596 .alias = "blockalign",
1597 .type = FIO_OPT_INT,
1598 .off1 = td_var_offset(ba[DDIR_READ]),
1599 .off2 = td_var_offset(ba[DDIR_WRITE]),
1600 .off3 = td_var_offset(ba[DDIR_TRIM]),
1602 .help = "IO block offset alignment",
1606 .category = FIO_OPT_C_IO,
1607 .group = FIO_OPT_G_INVALID,
1611 .lname = "Block size range",
1612 .alias = "blocksize_range",
1613 .type = FIO_OPT_RANGE,
1614 .off1 = td_var_offset(min_bs[DDIR_READ]),
1615 .off2 = td_var_offset(max_bs[DDIR_READ]),
1616 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1617 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1618 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1619 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1621 .help = "Set block size range (in more detail than bs)",
1625 .category = FIO_OPT_C_IO,
1626 .group = FIO_OPT_G_INVALID,
1630 .lname = "Block size split",
1631 .type = FIO_OPT_STR,
1632 .cb = str_bssplit_cb,
1633 .help = "Set a specific mix of block sizes",
1636 .category = FIO_OPT_C_IO,
1637 .group = FIO_OPT_G_INVALID,
1640 .name = "bs_unaligned",
1641 .lname = "Block size unaligned",
1642 .alias = "blocksize_unaligned",
1643 .type = FIO_OPT_STR_SET,
1644 .off1 = td_var_offset(bs_unaligned),
1645 .help = "Don't sector align IO buffer sizes",
1648 .category = FIO_OPT_C_IO,
1649 .group = FIO_OPT_G_INVALID,
1652 .name = "randrepeat",
1653 .lname = "Random repeatable",
1654 .type = FIO_OPT_BOOL,
1655 .off1 = td_var_offset(rand_repeatable),
1656 .help = "Use repeatable random IO pattern",
1660 .category = FIO_OPT_C_IO,
1661 .group = FIO_OPT_G_RANDOM,
1664 .name = "use_os_rand",
1665 .lname = "Use OS random",
1666 .type = FIO_OPT_BOOL,
1667 .off1 = td_var_offset(use_os_rand),
1668 .help = "Set to use OS random generator",
1672 .category = FIO_OPT_C_IO,
1673 .group = FIO_OPT_G_RANDOM,
1676 .name = "norandommap",
1677 .lname = "No randommap",
1678 .type = FIO_OPT_STR_SET,
1679 .off1 = td_var_offset(norandommap),
1680 .help = "Accept potential duplicate random blocks",
1684 .category = FIO_OPT_C_IO,
1685 .group = FIO_OPT_G_RANDOM,
1688 .name = "softrandommap",
1689 .lname = "Soft randommap",
1690 .type = FIO_OPT_BOOL,
1691 .off1 = td_var_offset(softrandommap),
1692 .help = "Set norandommap if randommap allocation fails",
1693 .parent = "norandommap",
1696 .category = FIO_OPT_C_IO,
1697 .group = FIO_OPT_G_RANDOM,
1700 .name = "random_generator",
1701 .type = FIO_OPT_STR,
1702 .off1 = td_var_offset(random_generator),
1703 .help = "Type of random number generator to use",
1704 .def = "tausworthe",
1706 { .ival = "tausworthe",
1707 .oval = FIO_RAND_GEN_TAUSWORTHE,
1708 .help = "Strong Tausworthe generator",
1711 .oval = FIO_RAND_GEN_LFSR,
1712 .help = "Variable length LFSR",
1715 .category = FIO_OPT_C_IO,
1716 .group = FIO_OPT_G_RANDOM,
1719 .name = "random_distribution",
1720 .type = FIO_OPT_STR,
1721 .off1 = td_var_offset(random_distribution),
1722 .cb = str_random_distribution_cb,
1723 .help = "Random offset distribution generator",
1727 .oval = FIO_RAND_DIST_RANDOM,
1728 .help = "Completely random",
1731 .oval = FIO_RAND_DIST_ZIPF,
1732 .help = "Zipf distribution",
1735 .oval = FIO_RAND_DIST_PARETO,
1736 .help = "Pareto distribution",
1739 .category = FIO_OPT_C_IO,
1740 .group = FIO_OPT_G_RANDOM,
1744 .lname = "Number of files",
1745 .alias = "nr_files",
1746 .type = FIO_OPT_INT,
1747 .off1 = td_var_offset(nr_files),
1748 .help = "Split job workload between this number of files",
1751 .category = FIO_OPT_C_FILE,
1752 .group = FIO_OPT_G_INVALID,
1755 .name = "openfiles",
1756 .lname = "Number of open files",
1757 .type = FIO_OPT_INT,
1758 .off1 = td_var_offset(open_files),
1759 .help = "Number of files to keep open at the same time",
1760 .category = FIO_OPT_C_FILE,
1761 .group = FIO_OPT_G_INVALID,
1764 .name = "file_service_type",
1765 .lname = "File service type",
1766 .type = FIO_OPT_STR,
1768 .off1 = td_var_offset(file_service_type),
1769 .help = "How to select which file to service next",
1770 .def = "roundrobin",
1771 .category = FIO_OPT_C_FILE,
1772 .group = FIO_OPT_G_INVALID,
1775 .oval = FIO_FSERVICE_RANDOM,
1776 .help = "Choose a file at random",
1778 { .ival = "roundrobin",
1779 .oval = FIO_FSERVICE_RR,
1780 .help = "Round robin select files",
1782 { .ival = "sequential",
1783 .oval = FIO_FSERVICE_SEQ,
1784 .help = "Finish one file before moving to the next",
1787 .parent = "nrfiles",
1790 #ifdef CONFIG_POSIX_FALLOCATE
1792 .name = "fallocate",
1793 .lname = "Fallocate",
1794 .type = FIO_OPT_STR,
1795 .off1 = td_var_offset(fallocate_mode),
1796 .help = "Whether pre-allocation is performed when laying out files",
1798 .category = FIO_OPT_C_FILE,
1799 .group = FIO_OPT_G_INVALID,
1802 .oval = FIO_FALLOCATE_NONE,
1803 .help = "Do not pre-allocate space",
1806 .oval = FIO_FALLOCATE_POSIX,
1807 .help = "Use posix_fallocate()",
1809 #ifdef CONFIG_LINUX_FALLOCATE
1811 .oval = FIO_FALLOCATE_KEEP_SIZE,
1812 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1815 /* Compatibility with former boolean values */
1817 .oval = FIO_FALLOCATE_NONE,
1818 .help = "Alias for 'none'",
1821 .oval = FIO_FALLOCATE_POSIX,
1822 .help = "Alias for 'posix'",
1826 #endif /* CONFIG_POSIX_FALLOCATE */
1828 .name = "fadvise_hint",
1829 .lname = "Fadvise hint",
1830 .type = FIO_OPT_BOOL,
1831 .off1 = td_var_offset(fadvise_hint),
1832 .help = "Use fadvise() to advise the kernel on IO pattern",
1834 .category = FIO_OPT_C_FILE,
1835 .group = FIO_OPT_G_INVALID,
1840 .type = FIO_OPT_INT,
1841 .off1 = td_var_offset(fsync_blocks),
1842 .help = "Issue fsync for writes every given number of blocks",
1845 .category = FIO_OPT_C_FILE,
1846 .group = FIO_OPT_G_INVALID,
1849 .name = "fdatasync",
1850 .lname = "Fdatasync",
1851 .type = FIO_OPT_INT,
1852 .off1 = td_var_offset(fdatasync_blocks),
1853 .help = "Issue fdatasync for writes every given number of blocks",
1856 .category = FIO_OPT_C_FILE,
1857 .group = FIO_OPT_G_INVALID,
1860 .name = "write_barrier",
1861 .lname = "Write barrier",
1862 .type = FIO_OPT_INT,
1863 .off1 = td_var_offset(barrier_blocks),
1864 .help = "Make every Nth write a barrier write",
1867 .category = FIO_OPT_C_IO,
1868 .group = FIO_OPT_G_INVALID,
1870 #ifdef CONFIG_SYNC_FILE_RANGE
1872 .name = "sync_file_range",
1873 .lname = "Sync file range",
1875 { .ival = "wait_before",
1876 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1877 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
1881 .oval = SYNC_FILE_RANGE_WRITE,
1882 .help = "SYNC_FILE_RANGE_WRITE",
1886 .ival = "wait_after",
1887 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1888 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
1892 .type = FIO_OPT_STR_MULTI,
1894 .off1 = td_var_offset(sync_file_range),
1895 .help = "Use sync_file_range()",
1896 .category = FIO_OPT_C_FILE,
1897 .group = FIO_OPT_G_INVALID,
1902 .lname = "Direct I/O",
1903 .type = FIO_OPT_BOOL,
1904 .off1 = td_var_offset(odirect),
1905 .help = "Use O_DIRECT IO (negates buffered)",
1907 .inverse = "buffered",
1908 .category = FIO_OPT_C_IO,
1909 .group = FIO_OPT_G_IO_TYPE,
1913 .lname = "Buffered I/O",
1914 .type = FIO_OPT_BOOL,
1915 .off1 = td_var_offset(odirect),
1917 .help = "Use buffered IO (negates direct)",
1919 .inverse = "direct",
1920 .category = FIO_OPT_C_IO,
1921 .group = FIO_OPT_G_IO_TYPE,
1924 .name = "overwrite",
1925 .lname = "Overwrite",
1926 .type = FIO_OPT_BOOL,
1927 .off1 = td_var_offset(overwrite),
1928 .help = "When writing, set whether to overwrite current data",
1930 .category = FIO_OPT_C_FILE,
1931 .group = FIO_OPT_G_INVALID,
1936 .type = FIO_OPT_INT,
1937 .off1 = td_var_offset(loops),
1938 .help = "Number of times to run the job",
1941 .category = FIO_OPT_C_GENERAL,
1942 .group = FIO_OPT_G_RUNTIME,
1946 .lname = "Number of jobs",
1947 .type = FIO_OPT_INT,
1948 .off1 = td_var_offset(numjobs),
1949 .help = "Duplicate this job this many times",
1952 .category = FIO_OPT_C_GENERAL,
1953 .group = FIO_OPT_G_RUNTIME,
1956 .name = "startdelay",
1957 .lname = "Start delay",
1958 .type = FIO_OPT_STR_VAL_TIME,
1959 .off1 = td_var_offset(start_delay),
1960 .help = "Only start job when this period has passed",
1962 .category = FIO_OPT_C_GENERAL,
1963 .group = FIO_OPT_G_RUNTIME,
1969 .type = FIO_OPT_STR_VAL_TIME,
1970 .off1 = td_var_offset(timeout),
1971 .help = "Stop workload when this amount of time has passed",
1973 .category = FIO_OPT_C_GENERAL,
1974 .group = FIO_OPT_G_RUNTIME,
1977 .name = "time_based",
1978 .lname = "Time based",
1979 .type = FIO_OPT_STR_SET,
1980 .off1 = td_var_offset(time_based),
1981 .help = "Keep running until runtime/timeout is met",
1982 .category = FIO_OPT_C_GENERAL,
1983 .group = FIO_OPT_G_RUNTIME,
1986 .name = "ramp_time",
1987 .lname = "Ramp time",
1988 .type = FIO_OPT_STR_VAL_TIME,
1989 .off1 = td_var_offset(ramp_time),
1990 .help = "Ramp up time before measuring performance",
1991 .category = FIO_OPT_C_GENERAL,
1992 .group = FIO_OPT_G_RUNTIME,
1995 .name = "clocksource",
1996 .lname = "Clock source",
1997 .type = FIO_OPT_STR,
1998 .cb = fio_clock_source_cb,
1999 .off1 = td_var_offset(clocksource),
2000 .help = "What type of timing source to use",
2001 .category = FIO_OPT_C_GENERAL,
2002 .group = FIO_OPT_G_CLOCK,
2004 #ifdef CONFIG_GETTIMEOFDAY
2005 { .ival = "gettimeofday",
2007 .help = "Use gettimeofday(2) for timing",
2010 #ifdef CONFIG_CLOCK_GETTIME
2011 { .ival = "clock_gettime",
2012 .oval = CS_CGETTIME,
2013 .help = "Use clock_gettime(2) for timing",
2016 #ifdef ARCH_HAVE_CPU_CLOCK
2018 .oval = CS_CPUCLOCK,
2019 .help = "Use CPU private clock",
2027 .lname = "I/O Memory",
2028 .type = FIO_OPT_STR,
2030 .off1 = td_var_offset(mem_type),
2031 .help = "Backing type for IO buffers",
2033 .category = FIO_OPT_C_IO,
2034 .group = FIO_OPT_G_INVALID,
2038 .help = "Use malloc(3) for IO buffers",
2042 .help = "Use shared memory segments for IO buffers",
2044 #ifdef FIO_HAVE_HUGETLB
2045 { .ival = "shmhuge",
2046 .oval = MEM_SHMHUGE,
2047 .help = "Like shm, but use huge pages",
2052 .help = "Use mmap(2) (file or anon) for IO buffers",
2054 #ifdef FIO_HAVE_HUGETLB
2055 { .ival = "mmaphuge",
2056 .oval = MEM_MMAPHUGE,
2057 .help = "Like mmap, but use huge pages",
2063 .name = "iomem_align",
2064 .alias = "mem_align",
2065 .lname = "I/O memory alignment",
2066 .type = FIO_OPT_INT,
2067 .off1 = td_var_offset(mem_align),
2069 .help = "IO memory buffer offset alignment",
2073 .category = FIO_OPT_C_IO,
2074 .group = FIO_OPT_G_INVALID,
2079 .type = FIO_OPT_STR,
2080 .off1 = td_var_offset(verify),
2081 .help = "Verify data written",
2083 .category = FIO_OPT_C_IO,
2084 .group = FIO_OPT_G_VERIFY,
2087 .oval = VERIFY_NONE,
2088 .help = "Don't do IO verification",
2092 .help = "Use md5 checksums for verification",
2095 .oval = VERIFY_CRC64,
2096 .help = "Use crc64 checksums for verification",
2099 .oval = VERIFY_CRC32,
2100 .help = "Use crc32 checksums for verification",
2102 { .ival = "crc32c-intel",
2103 .oval = VERIFY_CRC32C,
2104 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2107 .oval = VERIFY_CRC32C,
2108 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2111 .oval = VERIFY_CRC16,
2112 .help = "Use crc16 checksums for verification",
2115 .oval = VERIFY_CRC7,
2116 .help = "Use crc7 checksums for verification",
2119 .oval = VERIFY_SHA1,
2120 .help = "Use sha1 checksums for verification",
2123 .oval = VERIFY_SHA256,
2124 .help = "Use sha256 checksums for verification",
2127 .oval = VERIFY_SHA512,
2128 .help = "Use sha512 checksums for verification",
2131 .oval = VERIFY_META,
2132 .help = "Use io information",
2136 .oval = VERIFY_NULL,
2137 .help = "Pretend to verify",
2142 .name = "do_verify",
2143 .lname = "Perform verify step",
2144 .type = FIO_OPT_BOOL,
2145 .off1 = td_var_offset(do_verify),
2146 .help = "Run verification stage after write",
2150 .category = FIO_OPT_C_IO,
2151 .group = FIO_OPT_G_VERIFY,
2154 .name = "verifysort",
2155 .lname = "Verify sort",
2156 .type = FIO_OPT_BOOL,
2157 .off1 = td_var_offset(verifysort),
2158 .help = "Sort written verify blocks for read back",
2162 .category = FIO_OPT_C_IO,
2163 .group = FIO_OPT_G_VERIFY,
2166 .name = "verifysort_nr",
2167 .type = FIO_OPT_INT,
2168 .off1 = td_var_offset(verifysort_nr),
2169 .help = "Pre-load and sort verify blocks for a read workload",
2174 .category = FIO_OPT_C_IO,
2175 .group = FIO_OPT_G_VERIFY,
2178 .name = "verify_interval",
2179 .lname = "Verify interval",
2180 .type = FIO_OPT_INT,
2181 .off1 = td_var_offset(verify_interval),
2182 .minval = 2 * sizeof(struct verify_header),
2183 .help = "Store verify buffer header every N bytes",
2186 .interval = 2 * sizeof(struct verify_header),
2187 .category = FIO_OPT_C_IO,
2188 .group = FIO_OPT_G_VERIFY,
2191 .name = "verify_offset",
2192 .lname = "Verify offset",
2193 .type = FIO_OPT_INT,
2194 .help = "Offset verify header location by N bytes",
2195 .off1 = td_var_offset(verify_offset),
2196 .minval = sizeof(struct verify_header),
2199 .category = FIO_OPT_C_IO,
2200 .group = FIO_OPT_G_VERIFY,
2203 .name = "verify_pattern",
2204 .lname = "Verify pattern",
2205 .type = FIO_OPT_STR,
2206 .cb = str_verify_pattern_cb,
2207 .help = "Fill pattern for IO buffers",
2210 .category = FIO_OPT_C_IO,
2211 .group = FIO_OPT_G_VERIFY,
2214 .name = "verify_fatal",
2215 .lname = "Verify fatal",
2216 .type = FIO_OPT_BOOL,
2217 .off1 = td_var_offset(verify_fatal),
2219 .help = "Exit on a single verify failure, don't continue",
2222 .category = FIO_OPT_C_IO,
2223 .group = FIO_OPT_G_VERIFY,
2226 .name = "verify_dump",
2227 .lname = "Verify dump",
2228 .type = FIO_OPT_BOOL,
2229 .off1 = td_var_offset(verify_dump),
2231 .help = "Dump contents of good and bad blocks on failure",
2234 .category = FIO_OPT_C_IO,
2235 .group = FIO_OPT_G_VERIFY,
2238 .name = "verify_async",
2239 .lname = "Verify asynchronously",
2240 .type = FIO_OPT_INT,
2241 .off1 = td_var_offset(verify_async),
2243 .help = "Number of async verifier threads to use",
2246 .category = FIO_OPT_C_IO,
2247 .group = FIO_OPT_G_VERIFY,
2250 .name = "verify_backlog",
2251 .lname = "Verify backlog",
2252 .type = FIO_OPT_STR_VAL,
2253 .off1 = td_var_offset(verify_backlog),
2254 .help = "Verify after this number of blocks are written",
2257 .category = FIO_OPT_C_IO,
2258 .group = FIO_OPT_G_VERIFY,
2261 .name = "verify_backlog_batch",
2262 .lname = "Verify backlog batch",
2263 .type = FIO_OPT_INT,
2264 .off1 = td_var_offset(verify_batch),
2265 .help = "Verify this number of IO blocks",
2268 .category = FIO_OPT_C_IO,
2269 .group = FIO_OPT_G_VERIFY,
2271 #ifdef FIO_HAVE_CPU_AFFINITY
2273 .name = "verify_async_cpus",
2274 .lname = "Async verify CPUs",
2275 .type = FIO_OPT_STR,
2276 .cb = str_verify_cpus_allowed_cb,
2277 .help = "Set CPUs allowed for async verify threads",
2278 .parent = "verify_async",
2280 .category = FIO_OPT_C_IO,
2281 .group = FIO_OPT_G_VERIFY,
2285 .name = "experimental_verify",
2286 .off1 = td_var_offset(experimental_verify),
2287 .type = FIO_OPT_BOOL,
2288 .help = "Enable experimental verification",
2289 .category = FIO_OPT_C_IO,
2290 .group = FIO_OPT_G_VERIFY,
2292 #ifdef FIO_HAVE_TRIM
2294 .name = "trim_percentage",
2295 .lname = "Trim percentage",
2296 .type = FIO_OPT_INT,
2297 .off1 = td_var_offset(trim_percentage),
2300 .help = "Number of verify blocks to discard/trim",
2305 .category = FIO_OPT_C_IO,
2306 .group = FIO_OPT_G_TRIM,
2309 .name = "trim_verify_zero",
2310 .lname = "Verify trim zero",
2311 .type = FIO_OPT_BOOL,
2312 .help = "Verify that trim/discarded blocks are returned as zeroes",
2313 .off1 = td_var_offset(trim_zero),
2314 .parent = "trim_percentage",
2317 .category = FIO_OPT_C_IO,
2318 .group = FIO_OPT_G_TRIM,
2321 .name = "trim_backlog",
2322 .lname = "Trim backlog",
2323 .type = FIO_OPT_STR_VAL,
2324 .off1 = td_var_offset(trim_backlog),
2325 .help = "Trim after this number of blocks are written",
2326 .parent = "trim_percentage",
2329 .category = FIO_OPT_C_IO,
2330 .group = FIO_OPT_G_TRIM,
2333 .name = "trim_backlog_batch",
2334 .lname = "Trim backlog batch",
2335 .type = FIO_OPT_INT,
2336 .off1 = td_var_offset(trim_batch),
2337 .help = "Trim this number of IO blocks",
2338 .parent = "trim_percentage",
2341 .category = FIO_OPT_C_IO,
2342 .group = FIO_OPT_G_TRIM,
2346 .name = "write_iolog",
2347 .lname = "Write I/O log",
2348 .type = FIO_OPT_STR_STORE,
2349 .off1 = td_var_offset(write_iolog_file),
2350 .help = "Store IO pattern to file",
2351 .category = FIO_OPT_C_IO,
2352 .group = FIO_OPT_G_IOLOG,
2355 .name = "read_iolog",
2356 .lname = "Read I/O log",
2357 .type = FIO_OPT_STR_STORE,
2358 .off1 = td_var_offset(read_iolog_file),
2359 .help = "Playback IO pattern from file",
2360 .category = FIO_OPT_C_IO,
2361 .group = FIO_OPT_G_IOLOG,
2364 .name = "replay_no_stall",
2365 .lname = "Don't stall on replay",
2366 .type = FIO_OPT_BOOL,
2367 .off1 = td_var_offset(no_stall),
2369 .parent = "read_iolog",
2371 .help = "Playback IO pattern file as fast as possible without stalls",
2372 .category = FIO_OPT_C_IO,
2373 .group = FIO_OPT_G_IOLOG,
2376 .name = "replay_redirect",
2377 .lname = "Redirect device for replay",
2378 .type = FIO_OPT_STR_STORE,
2379 .off1 = td_var_offset(replay_redirect),
2380 .parent = "read_iolog",
2382 .help = "Replay all I/O onto this device, regardless of trace device",
2383 .category = FIO_OPT_C_IO,
2384 .group = FIO_OPT_G_IOLOG,
2387 .name = "exec_prerun",
2388 .lname = "Pre-execute runnable",
2389 .type = FIO_OPT_STR_STORE,
2390 .off1 = td_var_offset(exec_prerun),
2391 .help = "Execute this file prior to running job",
2392 .category = FIO_OPT_C_GENERAL,
2393 .group = FIO_OPT_G_INVALID,
2396 .name = "exec_postrun",
2397 .lname = "Post-execute runnable",
2398 .type = FIO_OPT_STR_STORE,
2399 .off1 = td_var_offset(exec_postrun),
2400 .help = "Execute this file after running job",
2401 .category = FIO_OPT_C_GENERAL,
2402 .group = FIO_OPT_G_INVALID,
2404 #ifdef FIO_HAVE_IOSCHED_SWITCH
2406 .name = "ioscheduler",
2407 .lname = "I/O scheduler",
2408 .type = FIO_OPT_STR_STORE,
2409 .off1 = td_var_offset(ioscheduler),
2410 .help = "Use this IO scheduler on the backing device",
2411 .category = FIO_OPT_C_FILE,
2412 .group = FIO_OPT_G_INVALID,
2417 .lname = "Zone size",
2418 .type = FIO_OPT_STR_VAL,
2419 .off1 = td_var_offset(zone_size),
2420 .help = "Amount of data to read per zone",
2422 .interval = 1024 * 1024,
2423 .category = FIO_OPT_C_IO,
2424 .group = FIO_OPT_G_ZONE,
2427 .name = "zonerange",
2428 .lname = "Zone range",
2429 .type = FIO_OPT_STR_VAL,
2430 .off1 = td_var_offset(zone_range),
2431 .help = "Give size of an IO zone",
2433 .interval = 1024 * 1024,
2434 .category = FIO_OPT_C_IO,
2435 .group = FIO_OPT_G_ZONE,
2439 .lname = "Zone skip",
2440 .type = FIO_OPT_STR_VAL,
2441 .off1 = td_var_offset(zone_skip),
2442 .help = "Space between IO zones",
2444 .interval = 1024 * 1024,
2445 .category = FIO_OPT_C_IO,
2446 .group = FIO_OPT_G_ZONE,
2450 .lname = "Lock memory",
2451 .type = FIO_OPT_STR_VAL,
2452 .off1 = td_var_offset(lockmem),
2453 .help = "Lock down this amount of memory (per worker)",
2455 .interval = 1024 * 1024,
2456 .category = FIO_OPT_C_GENERAL,
2457 .group = FIO_OPT_G_INVALID,
2460 .name = "rwmixread",
2461 .lname = "Read/write mix read",
2462 .type = FIO_OPT_INT,
2463 .cb = str_rwmix_read_cb,
2465 .help = "Percentage of mixed workload that is reads",
2468 .inverse = "rwmixwrite",
2469 .category = FIO_OPT_C_IO,
2470 .group = FIO_OPT_G_RWMIX,
2473 .name = "rwmixwrite",
2474 .lname = "Read/write mix write",
2475 .type = FIO_OPT_INT,
2476 .cb = str_rwmix_write_cb,
2478 .help = "Percentage of mixed workload that is writes",
2481 .inverse = "rwmixread",
2482 .category = FIO_OPT_C_IO,
2483 .group = FIO_OPT_G_RWMIX,
2486 .name = "rwmixcycle",
2487 .lname = "Read/write mix cycle",
2488 .type = FIO_OPT_DEPRECATED,
2489 .category = FIO_OPT_C_IO,
2490 .group = FIO_OPT_G_RWMIX,
2495 .type = FIO_OPT_INT,
2496 .off1 = td_var_offset(nice),
2497 .help = "Set job CPU nice value",
2502 .category = FIO_OPT_C_GENERAL,
2503 .group = FIO_OPT_G_CRED,
2505 #ifdef FIO_HAVE_IOPRIO
2508 .lname = "I/O nice priority",
2509 .type = FIO_OPT_INT,
2511 .help = "Set job IO priority value",
2515 .category = FIO_OPT_C_GENERAL,
2516 .group = FIO_OPT_G_CRED,
2519 .name = "prioclass",
2520 .lname = "I/O nice priority class",
2521 .type = FIO_OPT_INT,
2522 .cb = str_prioclass_cb,
2523 .help = "Set job IO priority class",
2527 .category = FIO_OPT_C_GENERAL,
2528 .group = FIO_OPT_G_CRED,
2532 .name = "thinktime",
2533 .lname = "Thinktime",
2534 .type = FIO_OPT_INT,
2535 .off1 = td_var_offset(thinktime),
2536 .help = "Idle time between IO buffers (usec)",
2538 .category = FIO_OPT_C_IO,
2539 .group = FIO_OPT_G_THINKTIME,
2542 .name = "thinktime_spin",
2543 .lname = "Thinktime spin",
2544 .type = FIO_OPT_INT,
2545 .off1 = td_var_offset(thinktime_spin),
2546 .help = "Start think time by spinning this amount (usec)",
2548 .parent = "thinktime",
2550 .category = FIO_OPT_C_IO,
2551 .group = FIO_OPT_G_THINKTIME,
2554 .name = "thinktime_blocks",
2555 .lname = "Thinktime blocks",
2556 .type = FIO_OPT_INT,
2557 .off1 = td_var_offset(thinktime_blocks),
2558 .help = "IO buffer period between 'thinktime'",
2560 .parent = "thinktime",
2562 .category = FIO_OPT_C_IO,
2563 .group = FIO_OPT_G_THINKTIME,
2567 .lname = "I/O rate",
2568 .type = FIO_OPT_INT,
2569 .off1 = td_var_offset(rate[DDIR_READ]),
2570 .off2 = td_var_offset(rate[DDIR_WRITE]),
2571 .off3 = td_var_offset(rate[DDIR_TRIM]),
2572 .help = "Set bandwidth rate",
2573 .category = FIO_OPT_C_IO,
2574 .group = FIO_OPT_G_RATE,
2578 .lname = "I/O min rate",
2579 .type = FIO_OPT_INT,
2580 .off1 = td_var_offset(ratemin[DDIR_READ]),
2581 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2582 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2583 .help = "Job must meet this rate or it will be shutdown",
2586 .category = FIO_OPT_C_IO,
2587 .group = FIO_OPT_G_RATE,
2590 .name = "rate_iops",
2591 .lname = "I/O rate IOPS",
2592 .type = FIO_OPT_INT,
2593 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2594 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2595 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2596 .help = "Limit IO used to this number of IO operations/sec",
2598 .category = FIO_OPT_C_IO,
2599 .group = FIO_OPT_G_RATE,
2602 .name = "rate_iops_min",
2603 .lname = "I/O min rate IOPS",
2604 .type = FIO_OPT_INT,
2605 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2606 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2607 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2608 .help = "Job must meet this rate or it will be shut down",
2609 .parent = "rate_iops",
2611 .category = FIO_OPT_C_IO,
2612 .group = FIO_OPT_G_RATE,
2615 .name = "ratecycle",
2616 .lname = "I/O rate cycle",
2617 .type = FIO_OPT_INT,
2618 .off1 = td_var_offset(ratecycle),
2619 .help = "Window average for rate limits (msec)",
2623 .category = FIO_OPT_C_IO,
2624 .group = FIO_OPT_G_RATE,
2627 .name = "max_latency",
2628 .type = FIO_OPT_INT,
2629 .off1 = td_var_offset(max_latency),
2630 .help = "Maximum tolerated IO latency (usec)",
2631 .category = FIO_OPT_C_IO,
2632 .group = FIO_OPT_G_RATE,
2635 .name = "invalidate",
2636 .lname = "Cache invalidate",
2637 .type = FIO_OPT_BOOL,
2638 .off1 = td_var_offset(invalidate_cache),
2639 .help = "Invalidate buffer/page cache prior to running job",
2641 .category = FIO_OPT_C_IO,
2642 .group = FIO_OPT_G_IO_TYPE,
2646 .lname = "Synchronous I/O",
2647 .type = FIO_OPT_BOOL,
2648 .off1 = td_var_offset(sync_io),
2649 .help = "Use O_SYNC for buffered writes",
2651 .parent = "buffered",
2653 .category = FIO_OPT_C_IO,
2654 .group = FIO_OPT_G_IO_TYPE,
2657 .name = "create_serialize",
2658 .lname = "Create serialize",
2659 .type = FIO_OPT_BOOL,
2660 .off1 = td_var_offset(create_serialize),
2661 .help = "Serialize creating of job files",
2663 .category = FIO_OPT_C_FILE,
2664 .group = FIO_OPT_G_INVALID,
2667 .name = "create_fsync",
2668 .lname = "Create fsync",
2669 .type = FIO_OPT_BOOL,
2670 .off1 = td_var_offset(create_fsync),
2671 .help = "fsync file after creation",
2673 .category = FIO_OPT_C_FILE,
2674 .group = FIO_OPT_G_INVALID,
2677 .name = "create_on_open",
2678 .lname = "Create on open",
2679 .type = FIO_OPT_BOOL,
2680 .off1 = td_var_offset(create_on_open),
2681 .help = "Create files when they are opened for IO",
2683 .category = FIO_OPT_C_FILE,
2684 .group = FIO_OPT_G_INVALID,
2687 .name = "create_only",
2688 .type = FIO_OPT_BOOL,
2689 .off1 = td_var_offset(create_only),
2690 .help = "Only perform file creation phase",
2691 .category = FIO_OPT_C_FILE,
2696 .lname = "Pre-read files",
2697 .type = FIO_OPT_BOOL,
2698 .off1 = td_var_offset(pre_read),
2699 .help = "Pre-read files before starting official testing",
2701 .category = FIO_OPT_C_FILE,
2702 .group = FIO_OPT_G_INVALID,
2704 #ifdef FIO_HAVE_CPU_AFFINITY
2707 .lname = "CPU mask",
2708 .type = FIO_OPT_INT,
2709 .cb = str_cpumask_cb,
2710 .help = "CPU affinity mask",
2711 .category = FIO_OPT_C_GENERAL,
2712 .group = FIO_OPT_G_CRED,
2715 .name = "cpus_allowed",
2716 .lname = "CPUs allowed",
2717 .type = FIO_OPT_STR,
2718 .cb = str_cpus_allowed_cb,
2719 .help = "Set CPUs allowed",
2720 .category = FIO_OPT_C_GENERAL,
2721 .group = FIO_OPT_G_CRED,
2724 #ifdef CONFIG_LIBNUMA
2726 .name = "numa_cpu_nodes",
2727 .type = FIO_OPT_STR,
2728 .cb = str_numa_cpunodes_cb,
2729 .help = "NUMA CPU nodes bind",
2730 .category = FIO_OPT_C_GENERAL,
2731 .group = FIO_OPT_G_INVALID,
2734 .name = "numa_mem_policy",
2735 .type = FIO_OPT_STR,
2736 .cb = str_numa_mpol_cb,
2737 .help = "NUMA memory policy setup",
2738 .category = FIO_OPT_C_GENERAL,
2739 .group = FIO_OPT_G_INVALID,
2743 .name = "end_fsync",
2744 .lname = "End fsync",
2745 .type = FIO_OPT_BOOL,
2746 .off1 = td_var_offset(end_fsync),
2747 .help = "Include fsync at the end of job",
2749 .category = FIO_OPT_C_FILE,
2750 .group = FIO_OPT_G_INVALID,
2753 .name = "fsync_on_close",
2754 .lname = "Fsync on close",
2755 .type = FIO_OPT_BOOL,
2756 .off1 = td_var_offset(fsync_on_close),
2757 .help = "fsync files on close",
2759 .category = FIO_OPT_C_FILE,
2760 .group = FIO_OPT_G_INVALID,
2764 .lname = "Unlink file",
2765 .type = FIO_OPT_BOOL,
2766 .off1 = td_var_offset(unlink),
2767 .help = "Unlink created files after job has completed",
2769 .category = FIO_OPT_C_FILE,
2770 .group = FIO_OPT_G_INVALID,
2774 .lname = "Exit-all on terminate",
2775 .type = FIO_OPT_STR_SET,
2776 .cb = str_exitall_cb,
2777 .help = "Terminate all jobs when one exits",
2778 .category = FIO_OPT_C_GENERAL,
2779 .group = FIO_OPT_G_PROCESS,
2782 .name = "stonewall",
2783 .lname = "Wait for previous",
2784 .alias = "wait_for_previous",
2785 .type = FIO_OPT_STR_SET,
2786 .off1 = td_var_offset(stonewall),
2787 .help = "Insert a hard barrier between this job and previous",
2788 .category = FIO_OPT_C_GENERAL,
2789 .group = FIO_OPT_G_PROCESS,
2792 .name = "new_group",
2793 .lname = "New group",
2794 .type = FIO_OPT_STR_SET,
2795 .off1 = td_var_offset(new_group),
2796 .help = "Mark the start of a new group (for reporting)",
2797 .category = FIO_OPT_C_GENERAL,
2798 .group = FIO_OPT_G_PROCESS,
2803 .type = FIO_OPT_STR_SET,
2804 .off1 = td_var_offset(use_thread),
2805 .help = "Use threads instead of processes",
2806 .category = FIO_OPT_C_GENERAL,
2807 .group = FIO_OPT_G_PROCESS,
2810 .name = "write_bw_log",
2811 .lname = "Write bandwidth log",
2812 .type = FIO_OPT_STR,
2813 .off1 = td_var_offset(bw_log_file),
2814 .cb = str_write_bw_log_cb,
2815 .help = "Write log of bandwidth during run",
2816 .category = FIO_OPT_C_LOG,
2817 .group = FIO_OPT_G_INVALID,
2820 .name = "write_lat_log",
2821 .lname = "Write latency log",
2822 .type = FIO_OPT_STR,
2823 .off1 = td_var_offset(lat_log_file),
2824 .cb = str_write_lat_log_cb,
2825 .help = "Write log of latency during run",
2826 .category = FIO_OPT_C_LOG,
2827 .group = FIO_OPT_G_INVALID,
2830 .name = "write_iops_log",
2831 .lname = "Write IOPS log",
2832 .type = FIO_OPT_STR,
2833 .off1 = td_var_offset(iops_log_file),
2834 .cb = str_write_iops_log_cb,
2835 .help = "Write log of IOPS during run",
2836 .category = FIO_OPT_C_LOG,
2837 .group = FIO_OPT_G_INVALID,
2840 .name = "log_avg_msec",
2841 .lname = "Log averaging (msec)",
2842 .type = FIO_OPT_INT,
2843 .off1 = td_var_offset(log_avg_msec),
2844 .help = "Average bw/iops/lat logs over this period of time",
2846 .category = FIO_OPT_C_LOG,
2847 .group = FIO_OPT_G_INVALID,
2850 .name = "bwavgtime",
2851 .lname = "Bandwidth average time",
2852 .type = FIO_OPT_INT,
2853 .off1 = td_var_offset(bw_avg_time),
2854 .help = "Time window over which to calculate bandwidth"
2857 .parent = "write_bw_log",
2860 .category = FIO_OPT_C_LOG,
2861 .group = FIO_OPT_G_INVALID,
2864 .name = "iopsavgtime",
2865 .lname = "IOPS average time",
2866 .type = FIO_OPT_INT,
2867 .off1 = td_var_offset(iops_avg_time),
2868 .help = "Time window over which to calculate IOPS (msec)",
2870 .parent = "write_iops_log",
2873 .category = FIO_OPT_C_LOG,
2874 .group = FIO_OPT_G_INVALID,
2877 .name = "group_reporting",
2878 .lname = "Group reporting",
2879 .type = FIO_OPT_BOOL,
2880 .off1 = td_var_offset(group_reporting),
2881 .help = "Do reporting on a per-group basis",
2883 .category = FIO_OPT_C_STAT,
2884 .group = FIO_OPT_G_INVALID,
2887 .name = "zero_buffers",
2888 .lname = "Zero I/O buffers",
2889 .type = FIO_OPT_STR_SET,
2890 .off1 = td_var_offset(zero_buffers),
2891 .help = "Init IO buffers to all zeroes",
2892 .category = FIO_OPT_C_IO,
2893 .group = FIO_OPT_G_IO_BUF,
2896 .name = "refill_buffers",
2897 .lname = "Refill I/O buffers",
2898 .type = FIO_OPT_STR_SET,
2899 .off1 = td_var_offset(refill_buffers),
2900 .help = "Refill IO buffers on every IO submit",
2901 .category = FIO_OPT_C_IO,
2902 .group = FIO_OPT_G_IO_BUF,
2905 .name = "scramble_buffers",
2906 .lname = "Scramble I/O buffers",
2907 .type = FIO_OPT_BOOL,
2908 .off1 = td_var_offset(scramble_buffers),
2909 .help = "Slightly scramble buffers on every IO submit",
2911 .category = FIO_OPT_C_IO,
2912 .group = FIO_OPT_G_IO_BUF,
2915 .name = "buffer_compress_percentage",
2916 .lname = "Buffer compression percentage",
2917 .type = FIO_OPT_INT,
2918 .off1 = td_var_offset(compress_percentage),
2921 .help = "How compressible the buffer is (approximately)",
2923 .category = FIO_OPT_C_IO,
2924 .group = FIO_OPT_G_IO_BUF,
2927 .name = "buffer_compress_chunk",
2928 .lname = "Buffer compression chunk size",
2929 .type = FIO_OPT_INT,
2930 .off1 = td_var_offset(compress_chunk),
2931 .parent = "buffer_compress_percentage",
2933 .help = "Size of compressible region in buffer",
2935 .category = FIO_OPT_C_IO,
2936 .group = FIO_OPT_G_IO_BUF,
2939 .name = "clat_percentiles",
2940 .lname = "Completion latency percentiles",
2941 .type = FIO_OPT_BOOL,
2942 .off1 = td_var_offset(clat_percentiles),
2943 .help = "Enable the reporting of completion latency percentiles",
2945 .category = FIO_OPT_C_STAT,
2946 .group = FIO_OPT_G_INVALID,
2949 .name = "percentile_list",
2950 .lname = "Completion latency percentile list",
2951 .type = FIO_OPT_FLOAT_LIST,
2952 .off1 = td_var_offset(percentile_list),
2953 .off2 = td_var_offset(percentile_precision),
2954 .help = "Specify a custom list of percentiles to report",
2955 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
2956 .maxlen = FIO_IO_U_LIST_MAX_LEN,
2959 .category = FIO_OPT_C_STAT,
2960 .group = FIO_OPT_G_INVALID,
2963 #ifdef FIO_HAVE_DISK_UTIL
2965 .name = "disk_util",
2966 .lname = "Disk utilization",
2967 .type = FIO_OPT_BOOL,
2968 .off1 = td_var_offset(do_disk_util),
2969 .help = "Log disk utilization statistics",
2971 .category = FIO_OPT_C_STAT,
2972 .group = FIO_OPT_G_INVALID,
2976 .name = "gtod_reduce",
2977 .lname = "Reduce gettimeofday() calls",
2978 .type = FIO_OPT_BOOL,
2979 .help = "Greatly reduce number of gettimeofday() calls",
2980 .cb = str_gtod_reduce_cb,
2983 .category = FIO_OPT_C_STAT,
2984 .group = FIO_OPT_G_INVALID,
2987 .name = "disable_lat",
2988 .lname = "Disable all latency stats",
2989 .type = FIO_OPT_BOOL,
2990 .off1 = td_var_offset(disable_lat),
2991 .help = "Disable latency numbers",
2992 .parent = "gtod_reduce",
2995 .category = FIO_OPT_C_STAT,
2996 .group = FIO_OPT_G_INVALID,
2999 .name = "disable_clat",
3000 .lname = "Disable completion latency stats",
3001 .type = FIO_OPT_BOOL,
3002 .off1 = td_var_offset(disable_clat),
3003 .help = "Disable completion latency numbers",
3004 .parent = "gtod_reduce",
3007 .category = FIO_OPT_C_STAT,
3008 .group = FIO_OPT_G_INVALID,
3011 .name = "disable_slat",
3012 .lname = "Disable submission latency stats",
3013 .type = FIO_OPT_BOOL,
3014 .off1 = td_var_offset(disable_slat),
3015 .help = "Disable submission latency numbers",
3016 .parent = "gtod_reduce",
3019 .category = FIO_OPT_C_STAT,
3020 .group = FIO_OPT_G_INVALID,
3023 .name = "disable_bw_measurement",
3024 .lname = "Disable bandwidth stats",
3025 .type = FIO_OPT_BOOL,
3026 .off1 = td_var_offset(disable_bw),
3027 .help = "Disable bandwidth logging",
3028 .parent = "gtod_reduce",
3031 .category = FIO_OPT_C_STAT,
3032 .group = FIO_OPT_G_INVALID,
3036 .lname = "Dedicated gettimeofday() CPU",
3037 .type = FIO_OPT_INT,
3038 .cb = str_gtod_cpu_cb,
3039 .help = "Set up dedicated gettimeofday() thread on this CPU",
3040 .verify = gtod_cpu_verify,
3041 .category = FIO_OPT_C_GENERAL,
3042 .group = FIO_OPT_G_CLOCK,
3045 .name = "unified_rw_reporting",
3046 .type = FIO_OPT_BOOL,
3047 .off1 = td_var_offset(unified_rw_rep),
3048 .help = "Unify reporting across data direction",
3050 .category = FIO_OPT_C_GENERAL,
3051 .group = FIO_OPT_G_INVALID,
3054 .name = "continue_on_error",
3055 .lname = "Continue on error",
3056 .type = FIO_OPT_STR,
3057 .off1 = td_var_offset(continue_on_error),
3058 .help = "Continue on non-fatal errors during IO",
3060 .category = FIO_OPT_C_GENERAL,
3061 .group = FIO_OPT_G_ERR,
3064 .oval = ERROR_TYPE_NONE,
3065 .help = "Exit when an error is encountered",
3068 .oval = ERROR_TYPE_READ,
3069 .help = "Continue on read errors only",
3072 .oval = ERROR_TYPE_WRITE,
3073 .help = "Continue on write errors only",
3076 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3077 .help = "Continue on any IO errors",
3080 .oval = ERROR_TYPE_VERIFY,
3081 .help = "Continue on verify errors only",
3084 .oval = ERROR_TYPE_ANY,
3085 .help = "Continue on all io and verify errors",
3088 .oval = ERROR_TYPE_NONE,
3089 .help = "Alias for 'none'",
3092 .oval = ERROR_TYPE_ANY,
3093 .help = "Alias for 'all'",
3098 .name = "ignore_error",
3099 .type = FIO_OPT_STR,
3100 .cb = str_ignore_error_cb,
3101 .help = "Set a specific list of errors to ignore",
3103 .category = FIO_OPT_C_GENERAL,
3104 .group = FIO_OPT_G_ERR,
3107 .name = "error_dump",
3108 .type = FIO_OPT_BOOL,
3109 .off1 = td_var_offset(error_dump),
3111 .help = "Dump info on each error",
3112 .category = FIO_OPT_C_GENERAL,
3113 .group = FIO_OPT_G_ERR,
3118 .type = FIO_OPT_STR_STORE,
3119 .off1 = td_var_offset(profile),
3120 .help = "Select a specific builtin performance test",
3121 .category = FIO_OPT_C_PROFILE,
3122 .group = FIO_OPT_G_INVALID,
3127 .type = FIO_OPT_STR_STORE,
3128 .off1 = td_var_offset(cgroup),
3129 .help = "Add job to cgroup of this name",
3130 .category = FIO_OPT_C_GENERAL,
3131 .group = FIO_OPT_G_CGROUP,
3134 .name = "cgroup_nodelete",
3135 .lname = "Cgroup no-delete",
3136 .type = FIO_OPT_BOOL,
3137 .off1 = td_var_offset(cgroup_nodelete),
3138 .help = "Do not delete cgroups after job completion",
3141 .category = FIO_OPT_C_GENERAL,
3142 .group = FIO_OPT_G_CGROUP,
3145 .name = "cgroup_weight",
3146 .lname = "Cgroup weight",
3147 .type = FIO_OPT_INT,
3148 .off1 = td_var_offset(cgroup_weight),
3149 .help = "Use given weight for cgroup",
3153 .category = FIO_OPT_C_GENERAL,
3154 .group = FIO_OPT_G_CGROUP,
3159 .type = FIO_OPT_INT,
3160 .off1 = td_var_offset(uid),
3161 .help = "Run job with this user ID",
3162 .category = FIO_OPT_C_GENERAL,
3163 .group = FIO_OPT_G_CRED,
3167 .lname = "Group ID",
3168 .type = FIO_OPT_INT,
3169 .off1 = td_var_offset(gid),
3170 .help = "Run job with this group ID",
3171 .category = FIO_OPT_C_GENERAL,
3172 .group = FIO_OPT_G_CRED,
3177 .type = FIO_OPT_INT,
3178 .off1 = td_var_offset(kb_base),
3184 .help = "Use 1024 as the K base",
3188 .help = "Use 1000 as the K base",
3191 .help = "How many bytes per KB for reporting (1000 or 1024)",
3192 .category = FIO_OPT_C_GENERAL,
3193 .group = FIO_OPT_G_INVALID,
3196 .name = "unit_base",
3197 .lname = "Base unit for reporting (Bits or Bytes)",
3198 .type = FIO_OPT_INT,
3199 .off1 = td_var_offset(unit_base),
3204 .help = "Auto-detect",
3208 .help = "Normal (byte based)",
3212 .help = "Bit based",
3215 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3216 .category = FIO_OPT_C_GENERAL,
3217 .group = FIO_OPT_G_INVALID,
3220 .name = "hugepage-size",
3221 .lname = "Hugepage size",
3222 .type = FIO_OPT_INT,
3223 .off1 = td_var_offset(hugepage_size),
3224 .help = "When using hugepages, specify size of each page",
3225 .def = __fio_stringify(FIO_HUGE_PAGE),
3226 .interval = 1024 * 1024,
3227 .category = FIO_OPT_C_GENERAL,
3228 .group = FIO_OPT_G_INVALID,
3232 .lname = "I/O flow ID",
3233 .type = FIO_OPT_INT,
3234 .off1 = td_var_offset(flow_id),
3235 .help = "The flow index ID to use",
3237 .category = FIO_OPT_C_IO,
3238 .group = FIO_OPT_G_IO_FLOW,
3242 .lname = "I/O flow weight",
3243 .type = FIO_OPT_INT,
3244 .off1 = td_var_offset(flow),
3245 .help = "Weight for flow control of this job",
3246 .parent = "flow_id",
3249 .category = FIO_OPT_C_IO,
3250 .group = FIO_OPT_G_IO_FLOW,
3253 .name = "flow_watermark",
3254 .lname = "I/O flow watermark",
3255 .type = FIO_OPT_INT,
3256 .off1 = td_var_offset(flow_watermark),
3257 .help = "High watermark for flow control. This option"
3258 " should be set to the same value for all threads"
3259 " with non-zero flow.",
3260 .parent = "flow_id",
3263 .category = FIO_OPT_C_IO,
3264 .group = FIO_OPT_G_IO_FLOW,
3267 .name = "flow_sleep",
3268 .lname = "I/O flow sleep",
3269 .type = FIO_OPT_INT,
3270 .off1 = td_var_offset(flow_sleep),
3271 .help = "How many microseconds to sleep after being held"
3272 " back by the flow control mechanism",
3273 .parent = "flow_id",
3276 .category = FIO_OPT_C_IO,
3277 .group = FIO_OPT_G_IO_FLOW,
3284 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3285 const char *name, int val)
3287 lopt->name = (char *) name;
3289 if (o->type == FIO_OPT_STR_SET)
3290 lopt->has_arg = no_argument;
3292 lopt->has_arg = required_argument;
3295 static void options_to_lopts(struct fio_option *opts,
3296 struct option *long_options,
3297 int i, int option_type)
3299 struct fio_option *o = &opts[0];
3301 add_to_lopt(&long_options[i], o, o->name, option_type);
3304 add_to_lopt(&long_options[i], o, o->alias, option_type);
3309 assert(i < FIO_NR_OPTIONS);
3313 void fio_options_set_ioengine_opts(struct option *long_options,
3314 struct thread_data *td)
3319 while (long_options[i].name) {
3320 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3321 memset(&long_options[i], 0, sizeof(*long_options));
3328 * Just clear out the prior ioengine options.
3333 options_to_lopts(td->io_ops->options, long_options, i,
3334 FIO_GETOPT_IOENGINE);
3337 void fio_options_dup_and_init(struct option *long_options)
3341 options_init(fio_options);
3344 while (long_options[i].name)
3347 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3350 struct fio_keyword {
3356 static struct fio_keyword fio_keywords[] = {
3358 .word = "$pagesize",
3359 .desc = "Page size in the system",
3362 .word = "$mb_memory",
3363 .desc = "Megabytes of memory online",
3367 .desc = "Number of CPUs online in the system",
3374 void fio_keywords_init(void)
3376 unsigned long long mb_memory;
3380 sprintf(buf, "%lu", (unsigned long) page_size);
3381 fio_keywords[0].replace = strdup(buf);
3383 mb_memory = os_phys_mem() / (1024 * 1024);
3384 sprintf(buf, "%llu", mb_memory);
3385 fio_keywords[1].replace = strdup(buf);
3388 sprintf(buf, "%lu", l);
3389 fio_keywords[2].replace = strdup(buf);
3394 static char *bc_calc(char *str)
3396 char buf[128], *tmp;
3401 * No math, just return string
3403 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3404 !strchr(str, '/')) || strchr(str, '\''))
3408 * Split option from value, we only need to calculate the value
3410 tmp = strchr(str, '=');
3417 * Prevent buffer overflows; such a case isn't reasonable anyway
3419 if (strlen(str) >= 128 || strlen(tmp) > 100)
3422 sprintf(buf, "which %s > /dev/null", BC_APP);
3424 log_err("fio: bc is needed for performing math\n");
3428 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3429 f = popen(buf, "r");
3434 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3440 buf[(tmp - str) + ret - 1] = '\0';
3441 memcpy(buf, str, tmp - str);
3447 * Return a copy of the input string with substrings of the form ${VARNAME}
3448 * substituted with the value of the environment variable VARNAME. The
3449 * substitution always occurs, even if VARNAME is empty or the corresponding
3450 * environment variable undefined.
3452 static char *option_dup_subs(const char *opt)
3454 char out[OPT_LEN_MAX+1];
3455 char in[OPT_LEN_MAX+1];
3458 char *ch1, *ch2, *env;
3459 ssize_t nchr = OPT_LEN_MAX;
3462 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3463 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3467 in[OPT_LEN_MAX] = '\0';
3468 strncpy(in, opt, OPT_LEN_MAX);
3470 while (*inptr && nchr > 0) {
3471 if (inptr[0] == '$' && inptr[1] == '{') {
3472 ch2 = strchr(inptr, '}');
3473 if (ch2 && inptr+1 < ch2) {
3480 envlen = strlen(env);
3481 if (envlen <= nchr) {
3482 memcpy(outptr, env, envlen);
3492 *outptr++ = *inptr++;
3501 * Look for reserved variable names and replace them with real values
3503 static char *fio_keyword_replace(char *opt)
3509 for (i = 0; fio_keywords[i].word != NULL; i++) {
3510 struct fio_keyword *kw = &fio_keywords[i];
3512 while ((s = strstr(opt, kw->word)) != NULL) {
3513 char *new = malloc(strlen(opt) + 1);
3519 * Copy part of the string before the keyword and
3520 * sprintf() the replacement after it.
3522 memcpy(new, opt, olen);
3523 len = sprintf(new + olen, "%s", kw->replace);
3526 * If there's more in the original string, copy that
3529 opt += strlen(kw->word) + olen;
3531 memcpy(new + olen + len, opt, opt - o_org - 1);
3534 * replace opt and free the old opt
3544 * Check for potential math and invoke bc, if possible
3552 static char **dup_and_sub_options(char **opts, int num_opts)
3555 char **opts_copy = malloc(num_opts * sizeof(*opts));
3556 for (i = 0; i < num_opts; i++) {
3557 opts_copy[i] = option_dup_subs(opts[i]);
3560 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3565 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
3567 int i, ret, unknown;
3570 sort_options(opts, fio_options, num_opts);
3571 opts_copy = dup_and_sub_options(opts, num_opts);
3573 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3574 struct fio_option *o;
3575 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3584 opts_copy[i] = NULL;
3591 ret |= ioengine_load(td);
3593 sort_options(opts_copy, td->io_ops->options, num_opts);
3596 for (i = 0; i < num_opts; i++) {
3597 struct fio_option *o = NULL;
3603 newret = parse_option(opts_copy[i], opts[i],
3604 td->io_ops->options, &o,
3609 log_err("Bad option <%s>\n", opts[i]);
3612 opts_copy[i] = NULL;
3620 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3622 return parse_cmd_option(opt, val, fio_options, td);
3625 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3628 return parse_cmd_option(opt, val, td->io_ops->options, td);
3631 void fio_fill_default_options(struct thread_data *td)
3633 fill_default_options(td, fio_options);
3636 int fio_show_option_help(const char *opt)
3638 return show_cmd_help(fio_options, opt);
3641 void options_mem_dupe(void *data, struct fio_option *options)
3643 struct fio_option *o;
3646 for (o = &options[0]; o->name; o++) {
3647 if (o->type != FIO_OPT_STR_STORE)
3650 ptr = td_var(data, o->off1);
3652 *ptr = strdup(*ptr);
3657 * dupe FIO_OPT_STR_STORE options
3659 void fio_options_mem_dupe(struct thread_data *td)
3661 options_mem_dupe(&td->o, fio_options);
3663 if (td->eo && td->io_ops) {
3664 void *oldeo = td->eo;
3666 td->eo = malloc(td->io_ops->option_struct_size);
3667 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3668 options_mem_dupe(td->eo, td->io_ops->options);
3672 unsigned int fio_get_kb_base(void *data)
3674 struct thread_data *td = data;
3675 unsigned int kb_base = 0;
3678 kb_base = td->o.kb_base;
3685 int add_option(struct fio_option *o)
3687 struct fio_option *__o;
3696 memcpy(&fio_options[opt_index], o, sizeof(*o));
3700 void invalidate_profile_options(const char *prof_name)
3702 struct fio_option *o;
3706 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3707 o->type = FIO_OPT_INVALID;
3708 o->prof_name = NULL;
3714 void add_opt_posval(const char *optname, const char *ival, const char *help)
3716 struct fio_option *o;
3719 o = find_option(fio_options, optname);
3723 for (i = 0; i < PARSE_MAX_VP; i++) {
3724 if (o->posval[i].ival)
3727 o->posval[i].ival = ival;
3728 o->posval[i].help = help;
3733 void del_opt_posval(const char *optname, const char *ival)
3735 struct fio_option *o;
3738 o = find_option(fio_options, optname);
3742 for (i = 0; i < PARSE_MAX_VP; i++) {
3743 if (!o->posval[i].ival)
3745 if (strcmp(o->posval[i].ival, ival))
3748 o->posval[i].ival = NULL;
3749 o->posval[i].help = NULL;
3753 void fio_options_free(struct thread_data *td)
3755 options_free(fio_options, td);
3756 if (td->eo && td->io_ops && td->io_ops->options) {
3757 options_free(td->io_ops->options, td->eo);