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;
174 p = str = strdup(input);
176 strip_blank_front(&str);
177 strip_blank_end(str);
179 odir = strchr(str, ',');
181 ddir = strchr(odir + 1, ',');
183 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
189 op = strdup(odir + 1);
190 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
195 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
198 ret = bssplit_ddir(&td->o, DDIR_READ, str);
204 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
209 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
212 ret = bssplit_ddir(&td->o, DDIR_READ, str);
219 static int str2error(char *str)
221 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
222 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
223 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
224 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
225 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
226 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
227 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
228 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
229 int i = 0, num = sizeof(err) / sizeof(void *);
232 if (!strcmp(err[i], str))
239 static int ignore_error_type(struct thread_data *td, int etype, char *str)
245 if (etype >= ERROR_TYPE_CNT) {
246 log_err("Illegal error type\n");
250 td->o.ignore_error_nr[etype] = 4;
251 error = malloc(4 * sizeof(struct bssplit));
254 while ((fname = strsep(&str, ":")) != NULL) {
260 * grow struct buffer, if needed
262 if (i == td->o.ignore_error_nr[etype]) {
263 td->o.ignore_error_nr[etype] <<= 1;
264 error = realloc(error, td->o.ignore_error_nr[etype]
267 if (fname[0] == 'E') {
268 error[i] = str2error(fname);
270 error[i] = atoi(fname);
275 log_err("Unknown error %s, please use number value \n",
283 td->o.continue_on_error |= 1 << etype;
284 td->o.ignore_error_nr[etype] = i;
285 td->o.ignore_error[etype] = error;
291 static int str_ignore_error_cb(void *data, const char *input)
293 struct thread_data *td = data;
295 int type = 0, ret = 1;
300 p = str = strdup(input);
302 strip_blank_front(&str);
303 strip_blank_end(str);
309 ret = ignore_error_type(td, type, p);
319 static int str_rw_cb(void *data, const char *str)
321 struct thread_data *td = data;
322 struct thread_options *o = &td->o;
323 char *nr = get_opt_postfix(str);
335 o->ddir_seq_nr = atoi(nr);
339 if (str_to_decimal(nr, &val, 1, o)) {
340 log_err("fio: rw postfix parsing failed\n");
345 o->ddir_seq_add = val;
352 static int str_mem_cb(void *data, const char *mem)
354 struct thread_data *td = data;
356 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
357 td->o.mmapfile = get_opt_postfix(mem);
362 static int fio_clock_source_cb(void *data, const char *str)
364 struct thread_data *td = data;
366 fio_clock_source = td->o.clocksource;
367 fio_clock_source_set = 1;
372 static int str_rwmix_read_cb(void *data, unsigned long long *val)
374 struct thread_data *td = data;
376 td->o.rwmix[DDIR_READ] = *val;
377 td->o.rwmix[DDIR_WRITE] = 100 - *val;
381 static int str_rwmix_write_cb(void *data, unsigned long long *val)
383 struct thread_data *td = data;
385 td->o.rwmix[DDIR_WRITE] = *val;
386 td->o.rwmix[DDIR_READ] = 100 - *val;
390 static int str_exitall_cb(void)
392 exitall_on_terminate = 1;
396 #ifdef FIO_HAVE_CPU_AFFINITY
397 static int str_cpumask_cb(void *data, unsigned long long *val)
399 struct thread_data *td = data;
407 ret = fio_cpuset_init(&td->o.cpumask);
409 log_err("fio: cpuset_init failed\n");
410 td_verror(td, ret, "fio_cpuset_init");
414 max_cpu = cpus_online();
416 for (i = 0; i < sizeof(int) * 8; i++) {
417 if ((1 << i) & *val) {
419 log_err("fio: CPU %d too large (max=%ld)\n", i,
423 dprint(FD_PARSE, "set cpu allowed %d\n", i);
424 fio_cpu_set(&td->o.cpumask, i);
428 td->o.cpumask_set = 1;
432 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
439 ret = fio_cpuset_init(mask);
441 log_err("fio: cpuset_init failed\n");
442 td_verror(td, ret, "fio_cpuset_init");
446 p = str = strdup(input);
448 strip_blank_front(&str);
449 strip_blank_end(str);
451 max_cpu = cpus_online();
453 while ((cpu = strsep(&str, ",")) != NULL) {
462 while ((cpu2 = strsep(&str2, "-")) != NULL) {
472 while (icpu <= icpu2) {
473 if (icpu >= FIO_MAX_CPUS) {
474 log_err("fio: your OS only supports up to"
475 " %d CPUs\n", (int) FIO_MAX_CPUS);
479 if (icpu > max_cpu) {
480 log_err("fio: CPU %d too large (max=%ld)\n",
486 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
487 fio_cpu_set(mask, icpu);
496 td->o.cpumask_set = 1;
500 static int str_cpus_allowed_cb(void *data, const char *input)
502 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;
536 /* numa_parse_nodestring() parses a character string list
537 * of nodes into a bit mask. The bit mask is allocated by
538 * numa_allocate_nodemask(), so it should be freed by
539 * numa_free_nodemask().
541 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
542 if (td->o.numa_cpunodesmask == NULL) {
543 log_err("fio: numa_parse_nodestring failed\n");
544 td_verror(td, 1, "str_numa_cpunodes_cb");
548 td->o.numa_cpumask_set = 1;
552 static int str_numa_mpol_cb(void *data, char *input)
554 struct thread_data *td = data;
555 const char * const policy_types[] =
556 { "default", "prefer", "bind", "interleave", "local", NULL };
563 nodelist = strchr(input, ':');
565 /* NUL-terminate mode */
569 for (i = 0; i <= MPOL_LOCAL; i++) {
570 if (!strcmp(input, policy_types[i])) {
571 td->o.numa_mem_mode = i;
575 if (i > MPOL_LOCAL) {
576 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
580 switch (td->o.numa_mem_mode) {
583 * Insist on a nodelist of one node only
586 char *rest = nodelist;
587 while (isdigit(*rest))
590 log_err("fio: one node only for \'prefer\'\n");
594 log_err("fio: one node is needed for \'prefer\'\n");
598 case MPOL_INTERLEAVE:
600 * Default to online nodes with memory if no nodelist
603 nodelist = strdup("all");
608 * Don't allow a nodelist
611 log_err("fio: NO nodelist for \'local\'\n");
617 * Insist on a nodelist
620 log_err("fio: a nodelist is needed for \'bind\'\n");
627 /* numa_parse_nodestring() parses a character string list
628 * of nodes into a bit mask. The bit mask is allocated by
629 * numa_allocate_nodemask(), so it should be freed by
630 * numa_free_nodemask().
632 switch (td->o.numa_mem_mode) {
634 td->o.numa_mem_prefer_node = atoi(nodelist);
636 case MPOL_INTERLEAVE:
638 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
639 if (td->o.numa_memnodesmask == NULL) {
640 log_err("fio: numa_parse_nodestring failed\n");
641 td_verror(td, 1, "str_numa_memnodes_cb");
651 td->o.numa_memmask_set = 1;
659 static int str_fst_cb(void *data, const char *str)
661 struct thread_data *td = data;
662 char *nr = get_opt_postfix(str);
664 td->file_service_nr = 1;
666 td->file_service_nr = atoi(nr);
673 #ifdef CONFIG_SYNC_FILE_RANGE
674 static int str_sfr_cb(void *data, const char *str)
676 struct thread_data *td = data;
677 char *nr = get_opt_postfix(str);
679 td->sync_file_range_nr = 1;
681 td->sync_file_range_nr = atoi(nr);
689 static int str_random_distribution_cb(void *data, const char *str)
691 struct thread_data *td = data;
698 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
700 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
705 nr = get_opt_postfix(str);
706 if (nr && !str_to_float(nr, &val)) {
707 log_err("fio: random postfix parsing failed\n");
714 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
716 log_err("fio: zipf theta must different than 1.0\n");
719 td->o.zipf_theta.u.f = val;
721 if (val <= 0.00 || val >= 1.00) {
722 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
725 td->o.pareto_h.u.f = val;
732 * Return next name in the string. Files are separated with ':'. If the ':'
733 * is escaped with a '\', then that ':' is part of the filename and does not
734 * indicate a new file.
736 static char *get_next_name(char **ptr)
741 if (!str || !strlen(str))
747 * No colon, we are done
749 p = strchr(str, ':');
756 * We got a colon, but it's the first character. Skip and
764 if (*(p - 1) != '\\') {
770 memmove(p - 1, p, strlen(p) + 1);
778 static int get_max_name_idx(char *input)
780 unsigned int cur_idx;
783 p = str = strdup(input);
784 for (cur_idx = 0; ; cur_idx++)
785 if (get_next_name(&str) == NULL)
793 * Returns the directory at the index, indexes > entires will be
794 * assigned via modulo division of the index
796 int set_name_idx(char *target, char *input, int index)
798 unsigned int cur_idx;
800 char *fname, *str, *p;
802 p = str = strdup(input);
804 index %= get_max_name_idx(input);
805 for (cur_idx = 0; cur_idx <= index; cur_idx++)
806 fname = get_next_name(&str);
808 len = sprintf(target, "%s/", fname);
814 static int str_filename_cb(void *data, const char *input)
816 struct thread_data *td = data;
817 char *fname, *str, *p;
819 p = str = strdup(input);
821 strip_blank_front(&str);
822 strip_blank_end(str);
824 if (!td->files_index)
827 while ((fname = get_next_name(&str)) != NULL) {
830 add_file(td, fname, 0);
838 static int str_directory_cb(void *data, const char fio_unused *unused)
840 struct thread_data *td = data;
842 char *dirname, *str, *p;
848 p = str = strdup(td->o.directory);
849 while ((dirname = get_next_name(&str)) != NULL) {
850 if (lstat(dirname, &sb) < 0) {
853 log_err("fio: %s is not a directory\n", dirname);
854 td_verror(td, ret, "lstat");
857 if (!S_ISDIR(sb.st_mode)) {
858 log_err("fio: %s is not a directory\n", dirname);
869 static int str_lockfile_cb(void *data, const char fio_unused *str)
871 struct thread_data *td = data;
873 if (td->files_index) {
874 log_err("fio: lockfile= option must precede filename=\n");
881 static int str_opendir_cb(void *data, const char fio_unused *str)
883 struct thread_data *td = data;
888 if (!td->files_index)
891 return add_dir_files(td, td->o.opendir);
894 static int pattern_cb(char *pattern, unsigned int max_size,
895 const char *input, unsigned int *pattern_bytes)
898 int i = 0, j = 0, len, k, base = 10;
899 uint32_t pattern_length;
902 loc1 = strstr(input, "0x");
903 loc2 = strstr(input, "0X");
906 off = strtol(input, NULL, base);
907 if (off != LONG_MAX || errno != ERANGE) {
909 pattern[i] = off & 0xff;
918 j = loc1 - input + 2;
920 j = loc2 - input + 2;
923 if (len - j < max_size * 2) {
925 off = converthexchartoint(input[k--]);
927 off += (converthexchartoint(input[k--])
929 pattern[i++] = (char) off;
935 * Fill the pattern all the way to the end. This greatly reduces
936 * the number of memcpy's we have to do when verifying the IO.
939 while (i > 1 && i * 2 <= max_size) {
940 memcpy(&pattern[i], &pattern[0], i);
945 * Fill remainder, if the pattern multiple ends up not being
948 while (i > 1 && i < max_size) {
949 unsigned int b = min(pattern_length, max_size - i);
951 memcpy(&pattern[i], &pattern[0], b);
957 * The code in verify_io_u_pattern assumes a single byte pattern
958 * fills the whole verify pattern buffer.
960 memset(pattern, pattern[0], max_size);
967 static int str_buffer_pattern_cb(void *data, const char *input)
969 struct thread_data *td = data;
972 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
973 &td->o.buffer_pattern_bytes);
976 td->o.refill_buffers = 0;
977 td->o.scramble_buffers = 0;
978 td->o.zero_buffers = 0;
984 static int str_verify_pattern_cb(void *data, const char *input)
986 struct thread_data *td = data;
989 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
990 &td->o.verify_pattern_bytes);
993 * VERIFY_META could already be set
995 if (!ret && td->o.verify == VERIFY_NONE)
996 td->o.verify = VERIFY_PATTERN;
1001 static int str_gtod_reduce_cb(void *data, int *il)
1003 struct thread_data *td = data;
1006 td->o.disable_lat = !!val;
1007 td->o.disable_clat = !!val;
1008 td->o.disable_slat = !!val;
1009 td->o.disable_bw = !!val;
1010 td->o.clat_percentiles = !val;
1012 td->tv_cache_mask = 63;
1017 static int str_gtod_cpu_cb(void *data, long long *il)
1019 struct thread_data *td = data;
1022 td->o.gtod_cpu = val;
1023 td->o.gtod_offload = 1;
1027 static int str_size_cb(void *data, unsigned long long *__val)
1029 struct thread_data *td = data;
1030 unsigned long long v = *__val;
1032 if (parse_is_percent(v)) {
1034 td->o.size_percent = -1ULL - v;
1041 static int rw_verify(struct fio_option *o, void *data)
1043 struct thread_data *td = data;
1045 if (read_only && td_write(td)) {
1046 log_err("fio: job <%s> has write bit set, but fio is in"
1047 " read-only mode\n", td->o.name);
1054 static int gtod_cpu_verify(struct fio_option *o, void *data)
1056 #ifndef FIO_HAVE_CPU_AFFINITY
1057 struct thread_data *td = data;
1059 if (td->o.gtod_cpu) {
1060 log_err("fio: platform must support CPU affinity for"
1061 "gettimeofday() offloading\n");
1072 static struct opt_group fio_opt_groups[] = {
1075 .mask = FIO_OPT_C_GENERAL,
1079 .mask = FIO_OPT_C_IO,
1083 .mask = FIO_OPT_C_FILE,
1086 .name = "Statistics",
1087 .mask = FIO_OPT_C_STAT,
1091 .mask = FIO_OPT_C_LOG,
1095 .mask = FIO_OPT_C_PROFILE,
1102 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1103 unsigned int inv_mask)
1105 struct opt_group *og;
1108 if (*mask == inv_mask || !*mask)
1111 for (i = 0; ogs[i].name; i++) {
1114 if (*mask & og->mask) {
1115 *mask &= ~(og->mask);
1123 struct opt_group *opt_group_from_mask(unsigned int *mask)
1125 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1128 static struct opt_group fio_opt_cat_groups[] = {
1130 .name = "Latency profiling",
1131 .mask = FIO_OPT_G_LATPROF,
1135 .mask = FIO_OPT_G_RATE,
1139 .mask = FIO_OPT_G_ZONE,
1142 .name = "Read/write mix",
1143 .mask = FIO_OPT_G_RWMIX,
1147 .mask = FIO_OPT_G_VERIFY,
1151 .mask = FIO_OPT_G_TRIM,
1154 .name = "I/O Logging",
1155 .mask = FIO_OPT_G_IOLOG,
1158 .name = "I/O Depth",
1159 .mask = FIO_OPT_G_IO_DEPTH,
1163 .mask = FIO_OPT_G_IO_FLOW,
1166 .name = "Description",
1167 .mask = FIO_OPT_G_DESC,
1171 .mask = FIO_OPT_G_FILENAME,
1174 .name = "General I/O",
1175 .mask = FIO_OPT_G_IO_BASIC,
1179 .mask = FIO_OPT_G_CGROUP,
1183 .mask = FIO_OPT_G_RUNTIME,
1187 .mask = FIO_OPT_G_PROCESS,
1190 .name = "Job credentials / priority",
1191 .mask = FIO_OPT_G_CRED,
1194 .name = "Clock settings",
1195 .mask = FIO_OPT_G_CLOCK,
1199 .mask = FIO_OPT_G_IO_TYPE,
1202 .name = "I/O Thinktime",
1203 .mask = FIO_OPT_G_THINKTIME,
1206 .name = "Randomizations",
1207 .mask = FIO_OPT_G_RANDOM,
1210 .name = "I/O buffers",
1211 .mask = FIO_OPT_G_IO_BUF,
1214 .name = "Tiobench profile",
1215 .mask = FIO_OPT_G_TIOBENCH,
1223 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1225 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1229 * Map of job/command line options
1231 struct fio_option fio_options[FIO_MAX_OPTS] = {
1233 .name = "description",
1234 .lname = "Description of job",
1235 .type = FIO_OPT_STR_STORE,
1236 .off1 = td_var_offset(description),
1237 .help = "Text job description",
1238 .category = FIO_OPT_C_GENERAL,
1239 .group = FIO_OPT_G_DESC,
1243 .lname = "Job name",
1244 .type = FIO_OPT_STR_STORE,
1245 .off1 = td_var_offset(name),
1246 .help = "Name of this job",
1247 .category = FIO_OPT_C_GENERAL,
1248 .group = FIO_OPT_G_DESC,
1252 .lname = "Filename(s)",
1253 .type = FIO_OPT_STR_STORE,
1254 .off1 = td_var_offset(filename),
1255 .cb = str_filename_cb,
1256 .prio = -1, /* must come after "directory" */
1257 .help = "File(s) to use for the workload",
1258 .category = FIO_OPT_C_FILE,
1259 .group = FIO_OPT_G_FILENAME,
1262 .name = "directory",
1263 .lname = "Directory",
1264 .type = FIO_OPT_STR_STORE,
1265 .off1 = td_var_offset(directory),
1266 .cb = str_directory_cb,
1267 .help = "Directory to store files in",
1268 .category = FIO_OPT_C_FILE,
1269 .group = FIO_OPT_G_FILENAME,
1272 .name = "filename_format",
1273 .type = FIO_OPT_STR_STORE,
1274 .off1 = td_var_offset(filename_format),
1275 .prio = -1, /* must come after "directory" */
1276 .help = "Override default $jobname.$jobnum.$filenum naming",
1277 .def = "$jobname.$jobnum.$filenum",
1278 .category = FIO_OPT_C_FILE,
1279 .group = FIO_OPT_G_FILENAME,
1283 .lname = "Lockfile",
1284 .type = FIO_OPT_STR,
1285 .off1 = td_var_offset(file_lock_mode),
1286 .help = "Lock file when doing IO to it",
1288 .parent = "filename",
1291 .cb = str_lockfile_cb,
1292 .category = FIO_OPT_C_FILE,
1293 .group = FIO_OPT_G_FILENAME,
1296 .oval = FILE_LOCK_NONE,
1297 .help = "No file locking",
1299 { .ival = "exclusive",
1300 .oval = FILE_LOCK_EXCLUSIVE,
1301 .help = "Exclusive file lock",
1304 .ival = "readwrite",
1305 .oval = FILE_LOCK_READWRITE,
1306 .help = "Read vs write lock",
1312 .lname = "Open directory",
1313 .type = FIO_OPT_STR_STORE,
1314 .off1 = td_var_offset(opendir),
1315 .cb = str_opendir_cb,
1316 .help = "Recursively add files from this directory and down",
1317 .category = FIO_OPT_C_FILE,
1318 .group = FIO_OPT_G_FILENAME,
1322 .lname = "Read/write",
1323 .alias = "readwrite",
1324 .type = FIO_OPT_STR,
1326 .off1 = td_var_offset(td_ddir),
1327 .help = "IO direction",
1329 .verify = rw_verify,
1330 .category = FIO_OPT_C_IO,
1331 .group = FIO_OPT_G_IO_BASIC,
1334 .oval = TD_DDIR_READ,
1335 .help = "Sequential read",
1338 .oval = TD_DDIR_WRITE,
1339 .help = "Sequential write",
1342 .oval = TD_DDIR_TRIM,
1343 .help = "Sequential trim",
1345 { .ival = "randread",
1346 .oval = TD_DDIR_RANDREAD,
1347 .help = "Random read",
1349 { .ival = "randwrite",
1350 .oval = TD_DDIR_RANDWRITE,
1351 .help = "Random write",
1353 { .ival = "randtrim",
1354 .oval = TD_DDIR_RANDTRIM,
1355 .help = "Random trim",
1359 .help = "Sequential read and write mix",
1361 { .ival = "readwrite",
1363 .help = "Sequential read and write mix",
1366 .oval = TD_DDIR_RANDRW,
1367 .help = "Random read and write mix"
1372 .name = "rw_sequencer",
1373 .lname = "RW Sequencer",
1374 .type = FIO_OPT_STR,
1375 .off1 = td_var_offset(rw_seq),
1376 .help = "IO offset generator modifier",
1377 .def = "sequential",
1378 .category = FIO_OPT_C_IO,
1379 .group = FIO_OPT_G_IO_BASIC,
1381 { .ival = "sequential",
1383 .help = "Generate sequential offsets",
1385 { .ival = "identical",
1386 .oval = RW_SEQ_IDENT,
1387 .help = "Generate identical offsets",
1394 .lname = "IO Engine",
1395 .type = FIO_OPT_STR_STORE,
1396 .off1 = td_var_offset(ioengine),
1397 .help = "IO engine to use",
1398 .def = FIO_PREFERRED_ENGINE,
1399 .category = FIO_OPT_C_IO,
1400 .group = FIO_OPT_G_IO_BASIC,
1403 .help = "Use read/write",
1406 .help = "Use pread/pwrite",
1409 .help = "Use readv/writev",
1411 #ifdef CONFIG_PWRITEV
1413 .help = "Use preadv/pwritev",
1416 #ifdef CONFIG_LIBAIO
1418 .help = "Linux native asynchronous IO",
1421 #ifdef CONFIG_POSIXAIO
1422 { .ival = "posixaio",
1423 .help = "POSIX asynchronous IO",
1426 #ifdef CONFIG_SOLARISAIO
1427 { .ival = "solarisaio",
1428 .help = "Solaris native asynchronous IO",
1431 #ifdef CONFIG_WINDOWSAIO
1432 { .ival = "windowsaio",
1433 .help = "Windows native asynchronous IO"
1438 .help = "Rados Block Device asynchronous IO"
1442 .help = "Memory mapped IO"
1444 #ifdef CONFIG_LINUX_SPLICE
1446 .help = "splice/vmsplice based IO",
1448 { .ival = "netsplice",
1449 .help = "splice/vmsplice to/from the network",
1452 #ifdef FIO_HAVE_SGIO
1454 .help = "SCSI generic v3 IO",
1458 .help = "Testing engine (no data transfer)",
1461 .help = "Network IO",
1464 .help = "CPU cycle burner engine",
1468 .help = "GUASI IO engine",
1471 #ifdef FIO_HAVE_BINJECT
1472 { .ival = "binject",
1473 .help = "binject direct inject block engine",
1478 .help = "RDMA IO engine",
1481 #ifdef CONFIG_FUSION_AW
1482 { .ival = "fusion-aw-sync",
1483 .help = "Fusion-io atomic write engine",
1486 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1487 { .ival = "e4defrag",
1488 .help = "ext4 defrag engine",
1491 #ifdef CONFIG_LINUX_FALLOCATE
1493 .help = "fallocate() file based engine",
1496 { .ival = "external",
1497 .help = "Load external engine (append name)",
1503 .lname = "IO Depth",
1504 .type = FIO_OPT_INT,
1505 .off1 = td_var_offset(iodepth),
1506 .help = "Number of IO buffers to keep in flight",
1510 .category = FIO_OPT_C_IO,
1511 .group = FIO_OPT_G_IO_BASIC,
1514 .name = "iodepth_batch",
1515 .lname = "IO Depth batch",
1516 .alias = "iodepth_batch_submit",
1517 .type = FIO_OPT_INT,
1518 .off1 = td_var_offset(iodepth_batch),
1519 .help = "Number of IO buffers to submit in one go",
1520 .parent = "iodepth",
1525 .category = FIO_OPT_C_IO,
1526 .group = FIO_OPT_G_IO_BASIC,
1529 .name = "iodepth_batch_complete",
1530 .lname = "IO Depth batch complete",
1531 .type = FIO_OPT_INT,
1532 .off1 = td_var_offset(iodepth_batch_complete),
1533 .help = "Number of IO buffers to retrieve in one go",
1534 .parent = "iodepth",
1539 .category = FIO_OPT_C_IO,
1540 .group = FIO_OPT_G_IO_BASIC,
1543 .name = "iodepth_low",
1544 .lname = "IO Depth batch low",
1545 .type = FIO_OPT_INT,
1546 .off1 = td_var_offset(iodepth_low),
1547 .help = "Low water mark for queuing depth",
1548 .parent = "iodepth",
1551 .category = FIO_OPT_C_IO,
1552 .group = FIO_OPT_G_IO_BASIC,
1557 .type = FIO_OPT_STR_VAL,
1559 .help = "Total size of device or files",
1560 .interval = 1024 * 1024,
1561 .category = FIO_OPT_C_IO,
1562 .group = FIO_OPT_G_INVALID,
1565 .name = "fill_device",
1566 .lname = "Fill device",
1568 .type = FIO_OPT_BOOL,
1569 .off1 = td_var_offset(fill_device),
1570 .help = "Write until an ENOSPC error occurs",
1572 .category = FIO_OPT_C_FILE,
1573 .group = FIO_OPT_G_INVALID,
1577 .lname = "File size",
1578 .type = FIO_OPT_STR_VAL,
1579 .off1 = td_var_offset(file_size_low),
1580 .off2 = td_var_offset(file_size_high),
1582 .help = "Size of individual files",
1583 .interval = 1024 * 1024,
1584 .category = FIO_OPT_C_FILE,
1585 .group = FIO_OPT_G_INVALID,
1589 .lname = "IO offset",
1590 .alias = "fileoffset",
1591 .type = FIO_OPT_STR_VAL,
1592 .off1 = td_var_offset(start_offset),
1593 .help = "Start IO from this offset",
1595 .interval = 1024 * 1024,
1596 .category = FIO_OPT_C_IO,
1597 .group = FIO_OPT_G_INVALID,
1600 .name = "offset_increment",
1601 .lname = "IO offset increment",
1602 .type = FIO_OPT_STR_VAL,
1603 .off1 = td_var_offset(offset_increment),
1604 .help = "What is the increment from one offset to the next",
1608 .interval = 1024 * 1024,
1609 .category = FIO_OPT_C_IO,
1610 .group = FIO_OPT_G_INVALID,
1613 .name = "number_ios",
1614 .lname = "Number of IOs to perform",
1615 .type = FIO_OPT_STR_VAL,
1616 .off1 = td_var_offset(number_ios),
1617 .help = "Force job completion of this number of IOs",
1619 .category = FIO_OPT_C_IO,
1620 .group = FIO_OPT_G_INVALID,
1624 .lname = "Block size",
1625 .alias = "blocksize",
1626 .type = FIO_OPT_INT,
1627 .off1 = td_var_offset(bs[DDIR_READ]),
1628 .off2 = td_var_offset(bs[DDIR_WRITE]),
1629 .off3 = td_var_offset(bs[DDIR_TRIM]),
1631 .help = "Block size unit",
1636 .category = FIO_OPT_C_IO,
1637 .group = FIO_OPT_G_INVALID,
1641 .lname = "Block size align",
1642 .alias = "blockalign",
1643 .type = FIO_OPT_INT,
1644 .off1 = td_var_offset(ba[DDIR_READ]),
1645 .off2 = td_var_offset(ba[DDIR_WRITE]),
1646 .off3 = td_var_offset(ba[DDIR_TRIM]),
1648 .help = "IO block offset alignment",
1652 .category = FIO_OPT_C_IO,
1653 .group = FIO_OPT_G_INVALID,
1657 .lname = "Block size range",
1658 .alias = "blocksize_range",
1659 .type = FIO_OPT_RANGE,
1660 .off1 = td_var_offset(min_bs[DDIR_READ]),
1661 .off2 = td_var_offset(max_bs[DDIR_READ]),
1662 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1663 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1664 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1665 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1667 .help = "Set block size range (in more detail than bs)",
1671 .category = FIO_OPT_C_IO,
1672 .group = FIO_OPT_G_INVALID,
1676 .lname = "Block size split",
1677 .type = FIO_OPT_STR,
1678 .cb = str_bssplit_cb,
1679 .help = "Set a specific mix of block sizes",
1682 .category = FIO_OPT_C_IO,
1683 .group = FIO_OPT_G_INVALID,
1686 .name = "bs_unaligned",
1687 .lname = "Block size unaligned",
1688 .alias = "blocksize_unaligned",
1689 .type = FIO_OPT_STR_SET,
1690 .off1 = td_var_offset(bs_unaligned),
1691 .help = "Don't sector align IO buffer sizes",
1694 .category = FIO_OPT_C_IO,
1695 .group = FIO_OPT_G_INVALID,
1698 .name = "bs_is_seq_rand",
1699 .lname = "Block size division is seq/random (not read/write)",
1700 .type = FIO_OPT_BOOL,
1701 .off1 = td_var_offset(bs_is_seq_rand),
1702 .help = "Consider any blocksize setting to be sequential,ramdom",
1704 .parent = "blocksize",
1705 .category = FIO_OPT_C_IO,
1706 .group = FIO_OPT_G_INVALID,
1709 .name = "randrepeat",
1710 .lname = "Random repeatable",
1711 .type = FIO_OPT_BOOL,
1712 .off1 = td_var_offset(rand_repeatable),
1713 .help = "Use repeatable random IO pattern",
1717 .category = FIO_OPT_C_IO,
1718 .group = FIO_OPT_G_RANDOM,
1722 .lname = "The random generator seed",
1723 .type = FIO_OPT_STR_VAL,
1724 .off1 = td_var_offset(rand_seed),
1725 .help = "Set the random generator seed value",
1727 .category = FIO_OPT_C_IO,
1728 .group = FIO_OPT_G_RANDOM,
1731 .name = "use_os_rand",
1732 .lname = "Use OS random",
1733 .type = FIO_OPT_BOOL,
1734 .off1 = td_var_offset(use_os_rand),
1735 .help = "Set to use OS random generator",
1739 .category = FIO_OPT_C_IO,
1740 .group = FIO_OPT_G_RANDOM,
1743 .name = "norandommap",
1744 .lname = "No randommap",
1745 .type = FIO_OPT_STR_SET,
1746 .off1 = td_var_offset(norandommap),
1747 .help = "Accept potential duplicate random blocks",
1751 .category = FIO_OPT_C_IO,
1752 .group = FIO_OPT_G_RANDOM,
1755 .name = "softrandommap",
1756 .lname = "Soft randommap",
1757 .type = FIO_OPT_BOOL,
1758 .off1 = td_var_offset(softrandommap),
1759 .help = "Set norandommap if randommap allocation fails",
1760 .parent = "norandommap",
1763 .category = FIO_OPT_C_IO,
1764 .group = FIO_OPT_G_RANDOM,
1767 .name = "random_generator",
1768 .type = FIO_OPT_STR,
1769 .off1 = td_var_offset(random_generator),
1770 .help = "Type of random number generator to use",
1771 .def = "tausworthe",
1773 { .ival = "tausworthe",
1774 .oval = FIO_RAND_GEN_TAUSWORTHE,
1775 .help = "Strong Tausworthe generator",
1778 .oval = FIO_RAND_GEN_LFSR,
1779 .help = "Variable length LFSR",
1782 .category = FIO_OPT_C_IO,
1783 .group = FIO_OPT_G_RANDOM,
1786 .name = "random_distribution",
1787 .type = FIO_OPT_STR,
1788 .off1 = td_var_offset(random_distribution),
1789 .cb = str_random_distribution_cb,
1790 .help = "Random offset distribution generator",
1794 .oval = FIO_RAND_DIST_RANDOM,
1795 .help = "Completely random",
1798 .oval = FIO_RAND_DIST_ZIPF,
1799 .help = "Zipf distribution",
1802 .oval = FIO_RAND_DIST_PARETO,
1803 .help = "Pareto distribution",
1806 .category = FIO_OPT_C_IO,
1807 .group = FIO_OPT_G_RANDOM,
1810 .name = "percentage_random",
1811 .lname = "Percentage Random",
1812 .type = FIO_OPT_INT,
1813 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1814 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1815 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1817 .help = "Percentage of seq/random mix that should be random",
1818 .def = "100,100,100",
1820 .inverse = "percentage_sequential",
1821 .category = FIO_OPT_C_IO,
1822 .group = FIO_OPT_G_RANDOM,
1825 .name = "percentage_sequential",
1826 .lname = "Percentage Sequential",
1827 .type = FIO_OPT_DEPRECATED,
1828 .category = FIO_OPT_C_IO,
1829 .group = FIO_OPT_G_RANDOM,
1832 .name = "allrandrepeat",
1833 .type = FIO_OPT_BOOL,
1834 .off1 = td_var_offset(allrand_repeatable),
1835 .help = "Use repeatable random numbers for everything",
1840 .lname = "Number of files",
1841 .alias = "nr_files",
1842 .type = FIO_OPT_INT,
1843 .off1 = td_var_offset(nr_files),
1844 .help = "Split job workload between this number of files",
1847 .category = FIO_OPT_C_FILE,
1848 .group = FIO_OPT_G_INVALID,
1851 .name = "openfiles",
1852 .lname = "Number of open files",
1853 .type = FIO_OPT_INT,
1854 .off1 = td_var_offset(open_files),
1855 .help = "Number of files to keep open at the same time",
1856 .category = FIO_OPT_C_FILE,
1857 .group = FIO_OPT_G_INVALID,
1860 .name = "file_service_type",
1861 .lname = "File service type",
1862 .type = FIO_OPT_STR,
1864 .off1 = td_var_offset(file_service_type),
1865 .help = "How to select which file to service next",
1866 .def = "roundrobin",
1867 .category = FIO_OPT_C_FILE,
1868 .group = FIO_OPT_G_INVALID,
1871 .oval = FIO_FSERVICE_RANDOM,
1872 .help = "Choose a file at random",
1874 { .ival = "roundrobin",
1875 .oval = FIO_FSERVICE_RR,
1876 .help = "Round robin select files",
1878 { .ival = "sequential",
1879 .oval = FIO_FSERVICE_SEQ,
1880 .help = "Finish one file before moving to the next",
1883 .parent = "nrfiles",
1886 #ifdef CONFIG_POSIX_FALLOCATE
1888 .name = "fallocate",
1889 .lname = "Fallocate",
1890 .type = FIO_OPT_STR,
1891 .off1 = td_var_offset(fallocate_mode),
1892 .help = "Whether pre-allocation is performed when laying out files",
1894 .category = FIO_OPT_C_FILE,
1895 .group = FIO_OPT_G_INVALID,
1898 .oval = FIO_FALLOCATE_NONE,
1899 .help = "Do not pre-allocate space",
1902 .oval = FIO_FALLOCATE_POSIX,
1903 .help = "Use posix_fallocate()",
1905 #ifdef CONFIG_LINUX_FALLOCATE
1907 .oval = FIO_FALLOCATE_KEEP_SIZE,
1908 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1911 /* Compatibility with former boolean values */
1913 .oval = FIO_FALLOCATE_NONE,
1914 .help = "Alias for 'none'",
1917 .oval = FIO_FALLOCATE_POSIX,
1918 .help = "Alias for 'posix'",
1922 #endif /* CONFIG_POSIX_FALLOCATE */
1924 .name = "fadvise_hint",
1925 .lname = "Fadvise hint",
1926 .type = FIO_OPT_BOOL,
1927 .off1 = td_var_offset(fadvise_hint),
1928 .help = "Use fadvise() to advise the kernel on IO pattern",
1930 .category = FIO_OPT_C_FILE,
1931 .group = FIO_OPT_G_INVALID,
1936 .type = FIO_OPT_INT,
1937 .off1 = td_var_offset(fsync_blocks),
1938 .help = "Issue fsync for writes every given number of blocks",
1941 .category = FIO_OPT_C_FILE,
1942 .group = FIO_OPT_G_INVALID,
1945 .name = "fdatasync",
1946 .lname = "Fdatasync",
1947 .type = FIO_OPT_INT,
1948 .off1 = td_var_offset(fdatasync_blocks),
1949 .help = "Issue fdatasync for writes every given number of blocks",
1952 .category = FIO_OPT_C_FILE,
1953 .group = FIO_OPT_G_INVALID,
1956 .name = "write_barrier",
1957 .lname = "Write barrier",
1958 .type = FIO_OPT_INT,
1959 .off1 = td_var_offset(barrier_blocks),
1960 .help = "Make every Nth write a barrier write",
1963 .category = FIO_OPT_C_IO,
1964 .group = FIO_OPT_G_INVALID,
1966 #ifdef CONFIG_SYNC_FILE_RANGE
1968 .name = "sync_file_range",
1969 .lname = "Sync file range",
1971 { .ival = "wait_before",
1972 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1973 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
1977 .oval = SYNC_FILE_RANGE_WRITE,
1978 .help = "SYNC_FILE_RANGE_WRITE",
1982 .ival = "wait_after",
1983 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1984 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
1988 .type = FIO_OPT_STR_MULTI,
1990 .off1 = td_var_offset(sync_file_range),
1991 .help = "Use sync_file_range()",
1992 .category = FIO_OPT_C_FILE,
1993 .group = FIO_OPT_G_INVALID,
1998 .lname = "Direct I/O",
1999 .type = FIO_OPT_BOOL,
2000 .off1 = td_var_offset(odirect),
2001 .help = "Use O_DIRECT IO (negates buffered)",
2003 .inverse = "buffered",
2004 .category = FIO_OPT_C_IO,
2005 .group = FIO_OPT_G_IO_TYPE,
2009 .lname = "Atomic I/O",
2010 .type = FIO_OPT_BOOL,
2011 .off1 = td_var_offset(oatomic),
2012 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2014 .category = FIO_OPT_C_IO,
2015 .group = FIO_OPT_G_IO_TYPE,
2019 .lname = "Buffered I/O",
2020 .type = FIO_OPT_BOOL,
2021 .off1 = td_var_offset(odirect),
2023 .help = "Use buffered IO (negates direct)",
2025 .inverse = "direct",
2026 .category = FIO_OPT_C_IO,
2027 .group = FIO_OPT_G_IO_TYPE,
2030 .name = "overwrite",
2031 .lname = "Overwrite",
2032 .type = FIO_OPT_BOOL,
2033 .off1 = td_var_offset(overwrite),
2034 .help = "When writing, set whether to overwrite current data",
2036 .category = FIO_OPT_C_FILE,
2037 .group = FIO_OPT_G_INVALID,
2042 .type = FIO_OPT_INT,
2043 .off1 = td_var_offset(loops),
2044 .help = "Number of times to run the job",
2047 .category = FIO_OPT_C_GENERAL,
2048 .group = FIO_OPT_G_RUNTIME,
2052 .lname = "Number of jobs",
2053 .type = FIO_OPT_INT,
2054 .off1 = td_var_offset(numjobs),
2055 .help = "Duplicate this job this many times",
2058 .category = FIO_OPT_C_GENERAL,
2059 .group = FIO_OPT_G_RUNTIME,
2062 .name = "startdelay",
2063 .lname = "Start delay",
2064 .type = FIO_OPT_STR_VAL_TIME,
2065 .off1 = td_var_offset(start_delay),
2066 .off2 = td_var_offset(start_delay_high),
2067 .help = "Only start job when this period has passed",
2069 .category = FIO_OPT_C_GENERAL,
2070 .group = FIO_OPT_G_RUNTIME,
2076 .type = FIO_OPT_STR_VAL_TIME,
2077 .off1 = td_var_offset(timeout),
2078 .help = "Stop workload when this amount of time has passed",
2080 .category = FIO_OPT_C_GENERAL,
2081 .group = FIO_OPT_G_RUNTIME,
2084 .name = "time_based",
2085 .lname = "Time based",
2086 .type = FIO_OPT_STR_SET,
2087 .off1 = td_var_offset(time_based),
2088 .help = "Keep running until runtime/timeout is met",
2089 .category = FIO_OPT_C_GENERAL,
2090 .group = FIO_OPT_G_RUNTIME,
2093 .name = "verify_only",
2094 .lname = "Verify only",
2095 .type = FIO_OPT_STR_SET,
2096 .off1 = td_var_offset(verify_only),
2097 .help = "Verifies previously written data is still valid",
2098 .category = FIO_OPT_C_GENERAL,
2099 .group = FIO_OPT_G_RUNTIME,
2102 .name = "ramp_time",
2103 .lname = "Ramp time",
2104 .type = FIO_OPT_STR_VAL_TIME,
2105 .off1 = td_var_offset(ramp_time),
2106 .help = "Ramp up time before measuring performance",
2107 .category = FIO_OPT_C_GENERAL,
2108 .group = FIO_OPT_G_RUNTIME,
2111 .name = "clocksource",
2112 .lname = "Clock source",
2113 .type = FIO_OPT_STR,
2114 .cb = fio_clock_source_cb,
2115 .off1 = td_var_offset(clocksource),
2116 .help = "What type of timing source to use",
2117 .category = FIO_OPT_C_GENERAL,
2118 .group = FIO_OPT_G_CLOCK,
2120 #ifdef CONFIG_GETTIMEOFDAY
2121 { .ival = "gettimeofday",
2123 .help = "Use gettimeofday(2) for timing",
2126 #ifdef CONFIG_CLOCK_GETTIME
2127 { .ival = "clock_gettime",
2128 .oval = CS_CGETTIME,
2129 .help = "Use clock_gettime(2) for timing",
2132 #ifdef ARCH_HAVE_CPU_CLOCK
2134 .oval = CS_CPUCLOCK,
2135 .help = "Use CPU private clock",
2143 .lname = "I/O Memory",
2144 .type = FIO_OPT_STR,
2146 .off1 = td_var_offset(mem_type),
2147 .help = "Backing type for IO buffers",
2149 .category = FIO_OPT_C_IO,
2150 .group = FIO_OPT_G_INVALID,
2154 .help = "Use malloc(3) for IO buffers",
2158 .help = "Use shared memory segments for IO buffers",
2160 #ifdef FIO_HAVE_HUGETLB
2161 { .ival = "shmhuge",
2162 .oval = MEM_SHMHUGE,
2163 .help = "Like shm, but use huge pages",
2168 .help = "Use mmap(2) (file or anon) for IO buffers",
2170 #ifdef FIO_HAVE_HUGETLB
2171 { .ival = "mmaphuge",
2172 .oval = MEM_MMAPHUGE,
2173 .help = "Like mmap, but use huge pages",
2179 .name = "iomem_align",
2180 .alias = "mem_align",
2181 .lname = "I/O memory alignment",
2182 .type = FIO_OPT_INT,
2183 .off1 = td_var_offset(mem_align),
2185 .help = "IO memory buffer offset alignment",
2189 .category = FIO_OPT_C_IO,
2190 .group = FIO_OPT_G_INVALID,
2195 .type = FIO_OPT_STR,
2196 .off1 = td_var_offset(verify),
2197 .help = "Verify data written",
2199 .category = FIO_OPT_C_IO,
2200 .group = FIO_OPT_G_VERIFY,
2203 .oval = VERIFY_NONE,
2204 .help = "Don't do IO verification",
2208 .help = "Use md5 checksums for verification",
2211 .oval = VERIFY_CRC64,
2212 .help = "Use crc64 checksums for verification",
2215 .oval = VERIFY_CRC32,
2216 .help = "Use crc32 checksums for verification",
2218 { .ival = "crc32c-intel",
2219 .oval = VERIFY_CRC32C,
2220 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2223 .oval = VERIFY_CRC32C,
2224 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2227 .oval = VERIFY_CRC16,
2228 .help = "Use crc16 checksums for verification",
2231 .oval = VERIFY_CRC7,
2232 .help = "Use crc7 checksums for verification",
2235 .oval = VERIFY_SHA1,
2236 .help = "Use sha1 checksums for verification",
2239 .oval = VERIFY_SHA256,
2240 .help = "Use sha256 checksums for verification",
2243 .oval = VERIFY_SHA512,
2244 .help = "Use sha512 checksums for verification",
2247 .oval = VERIFY_META,
2248 .help = "Use io information",
2252 .oval = VERIFY_NULL,
2253 .help = "Pretend to verify",
2258 .name = "do_verify",
2259 .lname = "Perform verify step",
2260 .type = FIO_OPT_BOOL,
2261 .off1 = td_var_offset(do_verify),
2262 .help = "Run verification stage after write",
2266 .category = FIO_OPT_C_IO,
2267 .group = FIO_OPT_G_VERIFY,
2270 .name = "verifysort",
2271 .lname = "Verify sort",
2272 .type = FIO_OPT_BOOL,
2273 .off1 = td_var_offset(verifysort),
2274 .help = "Sort written verify blocks for read back",
2278 .category = FIO_OPT_C_IO,
2279 .group = FIO_OPT_G_VERIFY,
2282 .name = "verifysort_nr",
2283 .type = FIO_OPT_INT,
2284 .off1 = td_var_offset(verifysort_nr),
2285 .help = "Pre-load and sort verify blocks for a read workload",
2290 .category = FIO_OPT_C_IO,
2291 .group = FIO_OPT_G_VERIFY,
2294 .name = "verify_interval",
2295 .lname = "Verify interval",
2296 .type = FIO_OPT_INT,
2297 .off1 = td_var_offset(verify_interval),
2298 .minval = 2 * sizeof(struct verify_header),
2299 .help = "Store verify buffer header every N bytes",
2302 .interval = 2 * sizeof(struct verify_header),
2303 .category = FIO_OPT_C_IO,
2304 .group = FIO_OPT_G_VERIFY,
2307 .name = "verify_offset",
2308 .lname = "Verify offset",
2309 .type = FIO_OPT_INT,
2310 .help = "Offset verify header location by N bytes",
2311 .off1 = td_var_offset(verify_offset),
2312 .minval = sizeof(struct verify_header),
2315 .category = FIO_OPT_C_IO,
2316 .group = FIO_OPT_G_VERIFY,
2319 .name = "verify_pattern",
2320 .lname = "Verify pattern",
2321 .type = FIO_OPT_STR,
2322 .cb = str_verify_pattern_cb,
2323 .help = "Fill pattern for IO buffers",
2326 .category = FIO_OPT_C_IO,
2327 .group = FIO_OPT_G_VERIFY,
2330 .name = "verify_fatal",
2331 .lname = "Verify fatal",
2332 .type = FIO_OPT_BOOL,
2333 .off1 = td_var_offset(verify_fatal),
2335 .help = "Exit on a single verify failure, don't continue",
2338 .category = FIO_OPT_C_IO,
2339 .group = FIO_OPT_G_VERIFY,
2342 .name = "verify_dump",
2343 .lname = "Verify dump",
2344 .type = FIO_OPT_BOOL,
2345 .off1 = td_var_offset(verify_dump),
2347 .help = "Dump contents of good and bad blocks on failure",
2350 .category = FIO_OPT_C_IO,
2351 .group = FIO_OPT_G_VERIFY,
2354 .name = "verify_async",
2355 .lname = "Verify asynchronously",
2356 .type = FIO_OPT_INT,
2357 .off1 = td_var_offset(verify_async),
2359 .help = "Number of async verifier threads to use",
2362 .category = FIO_OPT_C_IO,
2363 .group = FIO_OPT_G_VERIFY,
2366 .name = "verify_backlog",
2367 .lname = "Verify backlog",
2368 .type = FIO_OPT_STR_VAL,
2369 .off1 = td_var_offset(verify_backlog),
2370 .help = "Verify after this number of blocks are written",
2373 .category = FIO_OPT_C_IO,
2374 .group = FIO_OPT_G_VERIFY,
2377 .name = "verify_backlog_batch",
2378 .lname = "Verify backlog batch",
2379 .type = FIO_OPT_INT,
2380 .off1 = td_var_offset(verify_batch),
2381 .help = "Verify this number of IO blocks",
2384 .category = FIO_OPT_C_IO,
2385 .group = FIO_OPT_G_VERIFY,
2387 #ifdef FIO_HAVE_CPU_AFFINITY
2389 .name = "verify_async_cpus",
2390 .lname = "Async verify CPUs",
2391 .type = FIO_OPT_STR,
2392 .cb = str_verify_cpus_allowed_cb,
2393 .help = "Set CPUs allowed for async verify threads",
2394 .parent = "verify_async",
2396 .category = FIO_OPT_C_IO,
2397 .group = FIO_OPT_G_VERIFY,
2401 .name = "experimental_verify",
2402 .off1 = td_var_offset(experimental_verify),
2403 .type = FIO_OPT_BOOL,
2404 .help = "Enable experimental verification",
2405 .category = FIO_OPT_C_IO,
2406 .group = FIO_OPT_G_VERIFY,
2408 #ifdef FIO_HAVE_TRIM
2410 .name = "trim_percentage",
2411 .lname = "Trim percentage",
2412 .type = FIO_OPT_INT,
2413 .off1 = td_var_offset(trim_percentage),
2416 .help = "Number of verify blocks to discard/trim",
2421 .category = FIO_OPT_C_IO,
2422 .group = FIO_OPT_G_TRIM,
2425 .name = "trim_verify_zero",
2426 .lname = "Verify trim zero",
2427 .type = FIO_OPT_BOOL,
2428 .help = "Verify that trim/discarded blocks are returned as zeroes",
2429 .off1 = td_var_offset(trim_zero),
2430 .parent = "trim_percentage",
2433 .category = FIO_OPT_C_IO,
2434 .group = FIO_OPT_G_TRIM,
2437 .name = "trim_backlog",
2438 .lname = "Trim backlog",
2439 .type = FIO_OPT_STR_VAL,
2440 .off1 = td_var_offset(trim_backlog),
2441 .help = "Trim after this number of blocks are written",
2442 .parent = "trim_percentage",
2445 .category = FIO_OPT_C_IO,
2446 .group = FIO_OPT_G_TRIM,
2449 .name = "trim_backlog_batch",
2450 .lname = "Trim backlog batch",
2451 .type = FIO_OPT_INT,
2452 .off1 = td_var_offset(trim_batch),
2453 .help = "Trim this number of IO blocks",
2454 .parent = "trim_percentage",
2457 .category = FIO_OPT_C_IO,
2458 .group = FIO_OPT_G_TRIM,
2462 .name = "write_iolog",
2463 .lname = "Write I/O log",
2464 .type = FIO_OPT_STR_STORE,
2465 .off1 = td_var_offset(write_iolog_file),
2466 .help = "Store IO pattern to file",
2467 .category = FIO_OPT_C_IO,
2468 .group = FIO_OPT_G_IOLOG,
2471 .name = "read_iolog",
2472 .lname = "Read I/O log",
2473 .type = FIO_OPT_STR_STORE,
2474 .off1 = td_var_offset(read_iolog_file),
2475 .help = "Playback IO pattern from file",
2476 .category = FIO_OPT_C_IO,
2477 .group = FIO_OPT_G_IOLOG,
2480 .name = "replay_no_stall",
2481 .lname = "Don't stall on replay",
2482 .type = FIO_OPT_BOOL,
2483 .off1 = td_var_offset(no_stall),
2485 .parent = "read_iolog",
2487 .help = "Playback IO pattern file as fast as possible without stalls",
2488 .category = FIO_OPT_C_IO,
2489 .group = FIO_OPT_G_IOLOG,
2492 .name = "replay_redirect",
2493 .lname = "Redirect device for replay",
2494 .type = FIO_OPT_STR_STORE,
2495 .off1 = td_var_offset(replay_redirect),
2496 .parent = "read_iolog",
2498 .help = "Replay all I/O onto this device, regardless of trace device",
2499 .category = FIO_OPT_C_IO,
2500 .group = FIO_OPT_G_IOLOG,
2503 .name = "exec_prerun",
2504 .lname = "Pre-execute runnable",
2505 .type = FIO_OPT_STR_STORE,
2506 .off1 = td_var_offset(exec_prerun),
2507 .help = "Execute this file prior to running job",
2508 .category = FIO_OPT_C_GENERAL,
2509 .group = FIO_OPT_G_INVALID,
2512 .name = "exec_postrun",
2513 .lname = "Post-execute runnable",
2514 .type = FIO_OPT_STR_STORE,
2515 .off1 = td_var_offset(exec_postrun),
2516 .help = "Execute this file after running job",
2517 .category = FIO_OPT_C_GENERAL,
2518 .group = FIO_OPT_G_INVALID,
2520 #ifdef FIO_HAVE_IOSCHED_SWITCH
2522 .name = "ioscheduler",
2523 .lname = "I/O scheduler",
2524 .type = FIO_OPT_STR_STORE,
2525 .off1 = td_var_offset(ioscheduler),
2526 .help = "Use this IO scheduler on the backing device",
2527 .category = FIO_OPT_C_FILE,
2528 .group = FIO_OPT_G_INVALID,
2533 .lname = "Zone size",
2534 .type = FIO_OPT_STR_VAL,
2535 .off1 = td_var_offset(zone_size),
2536 .help = "Amount of data to read per zone",
2538 .interval = 1024 * 1024,
2539 .category = FIO_OPT_C_IO,
2540 .group = FIO_OPT_G_ZONE,
2543 .name = "zonerange",
2544 .lname = "Zone range",
2545 .type = FIO_OPT_STR_VAL,
2546 .off1 = td_var_offset(zone_range),
2547 .help = "Give size of an IO zone",
2549 .interval = 1024 * 1024,
2550 .category = FIO_OPT_C_IO,
2551 .group = FIO_OPT_G_ZONE,
2555 .lname = "Zone skip",
2556 .type = FIO_OPT_STR_VAL,
2557 .off1 = td_var_offset(zone_skip),
2558 .help = "Space between IO zones",
2560 .interval = 1024 * 1024,
2561 .category = FIO_OPT_C_IO,
2562 .group = FIO_OPT_G_ZONE,
2566 .lname = "Lock memory",
2567 .type = FIO_OPT_STR_VAL,
2568 .off1 = td_var_offset(lockmem),
2569 .help = "Lock down this amount of memory (per worker)",
2571 .interval = 1024 * 1024,
2572 .category = FIO_OPT_C_GENERAL,
2573 .group = FIO_OPT_G_INVALID,
2576 .name = "rwmixread",
2577 .lname = "Read/write mix read",
2578 .type = FIO_OPT_INT,
2579 .cb = str_rwmix_read_cb,
2581 .help = "Percentage of mixed workload that is reads",
2584 .inverse = "rwmixwrite",
2585 .category = FIO_OPT_C_IO,
2586 .group = FIO_OPT_G_RWMIX,
2589 .name = "rwmixwrite",
2590 .lname = "Read/write mix write",
2591 .type = FIO_OPT_INT,
2592 .cb = str_rwmix_write_cb,
2594 .help = "Percentage of mixed workload that is writes",
2597 .inverse = "rwmixread",
2598 .category = FIO_OPT_C_IO,
2599 .group = FIO_OPT_G_RWMIX,
2602 .name = "rwmixcycle",
2603 .lname = "Read/write mix cycle",
2604 .type = FIO_OPT_DEPRECATED,
2605 .category = FIO_OPT_C_IO,
2606 .group = FIO_OPT_G_RWMIX,
2611 .type = FIO_OPT_INT,
2612 .off1 = td_var_offset(nice),
2613 .help = "Set job CPU nice value",
2618 .category = FIO_OPT_C_GENERAL,
2619 .group = FIO_OPT_G_CRED,
2621 #ifdef FIO_HAVE_IOPRIO
2624 .lname = "I/O nice priority",
2625 .type = FIO_OPT_INT,
2626 .off1 = td_var_offset(ioprio),
2627 .help = "Set job IO priority value",
2631 .category = FIO_OPT_C_GENERAL,
2632 .group = FIO_OPT_G_CRED,
2635 .name = "prioclass",
2636 .lname = "I/O nice priority class",
2637 .type = FIO_OPT_INT,
2638 .off1 = td_var_offset(ioprio_class),
2639 .help = "Set job IO priority class",
2643 .category = FIO_OPT_C_GENERAL,
2644 .group = FIO_OPT_G_CRED,
2648 .name = "thinktime",
2649 .lname = "Thinktime",
2650 .type = FIO_OPT_INT,
2651 .off1 = td_var_offset(thinktime),
2652 .help = "Idle time between IO buffers (usec)",
2654 .category = FIO_OPT_C_IO,
2655 .group = FIO_OPT_G_THINKTIME,
2658 .name = "thinktime_spin",
2659 .lname = "Thinktime spin",
2660 .type = FIO_OPT_INT,
2661 .off1 = td_var_offset(thinktime_spin),
2662 .help = "Start think time by spinning this amount (usec)",
2664 .parent = "thinktime",
2666 .category = FIO_OPT_C_IO,
2667 .group = FIO_OPT_G_THINKTIME,
2670 .name = "thinktime_blocks",
2671 .lname = "Thinktime blocks",
2672 .type = FIO_OPT_INT,
2673 .off1 = td_var_offset(thinktime_blocks),
2674 .help = "IO buffer period between 'thinktime'",
2676 .parent = "thinktime",
2678 .category = FIO_OPT_C_IO,
2679 .group = FIO_OPT_G_THINKTIME,
2683 .lname = "I/O rate",
2684 .type = FIO_OPT_INT,
2685 .off1 = td_var_offset(rate[DDIR_READ]),
2686 .off2 = td_var_offset(rate[DDIR_WRITE]),
2687 .off3 = td_var_offset(rate[DDIR_TRIM]),
2688 .help = "Set bandwidth rate",
2689 .category = FIO_OPT_C_IO,
2690 .group = FIO_OPT_G_RATE,
2694 .lname = "I/O min rate",
2695 .type = FIO_OPT_INT,
2696 .off1 = td_var_offset(ratemin[DDIR_READ]),
2697 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2698 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2699 .help = "Job must meet this rate or it will be shutdown",
2702 .category = FIO_OPT_C_IO,
2703 .group = FIO_OPT_G_RATE,
2706 .name = "rate_iops",
2707 .lname = "I/O rate IOPS",
2708 .type = FIO_OPT_INT,
2709 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2710 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2711 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2712 .help = "Limit IO used to this number of IO operations/sec",
2714 .category = FIO_OPT_C_IO,
2715 .group = FIO_OPT_G_RATE,
2718 .name = "rate_iops_min",
2719 .lname = "I/O min rate IOPS",
2720 .type = FIO_OPT_INT,
2721 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2722 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2723 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2724 .help = "Job must meet this rate or it will be shut down",
2725 .parent = "rate_iops",
2727 .category = FIO_OPT_C_IO,
2728 .group = FIO_OPT_G_RATE,
2731 .name = "ratecycle",
2732 .lname = "I/O rate cycle",
2733 .type = FIO_OPT_INT,
2734 .off1 = td_var_offset(ratecycle),
2735 .help = "Window average for rate limits (msec)",
2739 .category = FIO_OPT_C_IO,
2740 .group = FIO_OPT_G_RATE,
2743 .name = "max_latency",
2744 .type = FIO_OPT_INT,
2745 .off1 = td_var_offset(max_latency),
2746 .help = "Maximum tolerated IO latency (usec)",
2747 .category = FIO_OPT_C_IO,
2748 .group = FIO_OPT_G_LATPROF,
2751 .name = "latency_target",
2752 .lname = "Latency Target (usec)",
2753 .type = FIO_OPT_STR_VAL_TIME,
2754 .off1 = td_var_offset(latency_target),
2755 .help = "Ramp to max queue depth supporting this latency",
2756 .category = FIO_OPT_C_IO,
2757 .group = FIO_OPT_G_LATPROF,
2760 .name = "latency_window",
2761 .lname = "Latency Window (usec)",
2762 .type = FIO_OPT_STR_VAL_TIME,
2763 .off1 = td_var_offset(latency_window),
2764 .help = "Time to sustain latency_target",
2765 .category = FIO_OPT_C_IO,
2766 .group = FIO_OPT_G_LATPROF,
2769 .name = "latency_percentile",
2770 .lname = "Latency Percentile",
2771 .type = FIO_OPT_FLOAT_LIST,
2772 .off1 = td_var_offset(latency_percentile),
2773 .help = "Percentile of IOs must be below latency_target",
2778 .category = FIO_OPT_C_IO,
2779 .group = FIO_OPT_G_LATPROF,
2782 .name = "invalidate",
2783 .lname = "Cache invalidate",
2784 .type = FIO_OPT_BOOL,
2785 .off1 = td_var_offset(invalidate_cache),
2786 .help = "Invalidate buffer/page cache prior to running job",
2788 .category = FIO_OPT_C_IO,
2789 .group = FIO_OPT_G_IO_TYPE,
2793 .lname = "Synchronous I/O",
2794 .type = FIO_OPT_BOOL,
2795 .off1 = td_var_offset(sync_io),
2796 .help = "Use O_SYNC for buffered writes",
2798 .parent = "buffered",
2800 .category = FIO_OPT_C_IO,
2801 .group = FIO_OPT_G_IO_TYPE,
2804 .name = "create_serialize",
2805 .lname = "Create serialize",
2806 .type = FIO_OPT_BOOL,
2807 .off1 = td_var_offset(create_serialize),
2808 .help = "Serialize creating of job files",
2810 .category = FIO_OPT_C_FILE,
2811 .group = FIO_OPT_G_INVALID,
2814 .name = "create_fsync",
2815 .lname = "Create fsync",
2816 .type = FIO_OPT_BOOL,
2817 .off1 = td_var_offset(create_fsync),
2818 .help = "fsync file after creation",
2820 .category = FIO_OPT_C_FILE,
2821 .group = FIO_OPT_G_INVALID,
2824 .name = "create_on_open",
2825 .lname = "Create on open",
2826 .type = FIO_OPT_BOOL,
2827 .off1 = td_var_offset(create_on_open),
2828 .help = "Create files when they are opened for IO",
2830 .category = FIO_OPT_C_FILE,
2831 .group = FIO_OPT_G_INVALID,
2834 .name = "create_only",
2835 .type = FIO_OPT_BOOL,
2836 .off1 = td_var_offset(create_only),
2837 .help = "Only perform file creation phase",
2838 .category = FIO_OPT_C_FILE,
2843 .lname = "Pre-read files",
2844 .type = FIO_OPT_BOOL,
2845 .off1 = td_var_offset(pre_read),
2846 .help = "Pre-read files before starting official testing",
2848 .category = FIO_OPT_C_FILE,
2849 .group = FIO_OPT_G_INVALID,
2851 #ifdef FIO_HAVE_CPU_AFFINITY
2854 .lname = "CPU mask",
2855 .type = FIO_OPT_INT,
2856 .cb = str_cpumask_cb,
2857 .help = "CPU affinity mask",
2858 .category = FIO_OPT_C_GENERAL,
2859 .group = FIO_OPT_G_CRED,
2862 .name = "cpus_allowed",
2863 .lname = "CPUs allowed",
2864 .type = FIO_OPT_STR,
2865 .cb = str_cpus_allowed_cb,
2866 .help = "Set CPUs allowed",
2867 .category = FIO_OPT_C_GENERAL,
2868 .group = FIO_OPT_G_CRED,
2871 #ifdef CONFIG_LIBNUMA
2873 .name = "numa_cpu_nodes",
2874 .type = FIO_OPT_STR,
2875 .cb = str_numa_cpunodes_cb,
2876 .help = "NUMA CPU nodes bind",
2877 .category = FIO_OPT_C_GENERAL,
2878 .group = FIO_OPT_G_INVALID,
2881 .name = "numa_mem_policy",
2882 .type = FIO_OPT_STR,
2883 .cb = str_numa_mpol_cb,
2884 .help = "NUMA memory policy setup",
2885 .category = FIO_OPT_C_GENERAL,
2886 .group = FIO_OPT_G_INVALID,
2890 .name = "end_fsync",
2891 .lname = "End fsync",
2892 .type = FIO_OPT_BOOL,
2893 .off1 = td_var_offset(end_fsync),
2894 .help = "Include fsync at the end of job",
2896 .category = FIO_OPT_C_FILE,
2897 .group = FIO_OPT_G_INVALID,
2900 .name = "fsync_on_close",
2901 .lname = "Fsync on close",
2902 .type = FIO_OPT_BOOL,
2903 .off1 = td_var_offset(fsync_on_close),
2904 .help = "fsync files on close",
2906 .category = FIO_OPT_C_FILE,
2907 .group = FIO_OPT_G_INVALID,
2911 .lname = "Unlink file",
2912 .type = FIO_OPT_BOOL,
2913 .off1 = td_var_offset(unlink),
2914 .help = "Unlink created files after job has completed",
2916 .category = FIO_OPT_C_FILE,
2917 .group = FIO_OPT_G_INVALID,
2921 .lname = "Exit-all on terminate",
2922 .type = FIO_OPT_STR_SET,
2923 .cb = str_exitall_cb,
2924 .help = "Terminate all jobs when one exits",
2925 .category = FIO_OPT_C_GENERAL,
2926 .group = FIO_OPT_G_PROCESS,
2929 .name = "stonewall",
2930 .lname = "Wait for previous",
2931 .alias = "wait_for_previous",
2932 .type = FIO_OPT_STR_SET,
2933 .off1 = td_var_offset(stonewall),
2934 .help = "Insert a hard barrier between this job and previous",
2935 .category = FIO_OPT_C_GENERAL,
2936 .group = FIO_OPT_G_PROCESS,
2939 .name = "new_group",
2940 .lname = "New group",
2941 .type = FIO_OPT_STR_SET,
2942 .off1 = td_var_offset(new_group),
2943 .help = "Mark the start of a new group (for reporting)",
2944 .category = FIO_OPT_C_GENERAL,
2945 .group = FIO_OPT_G_PROCESS,
2950 .type = FIO_OPT_STR_SET,
2951 .off1 = td_var_offset(use_thread),
2952 .help = "Use threads instead of processes",
2953 .category = FIO_OPT_C_GENERAL,
2954 .group = FIO_OPT_G_PROCESS,
2957 .name = "write_bw_log",
2958 .lname = "Write bandwidth log",
2959 .type = FIO_OPT_STR_STORE,
2960 .off1 = td_var_offset(bw_log_file),
2961 .help = "Write log of bandwidth during run",
2962 .category = FIO_OPT_C_LOG,
2963 .group = FIO_OPT_G_INVALID,
2966 .name = "write_lat_log",
2967 .lname = "Write latency log",
2968 .type = FIO_OPT_STR_STORE,
2969 .off1 = td_var_offset(lat_log_file),
2970 .help = "Write log of latency during run",
2971 .category = FIO_OPT_C_LOG,
2972 .group = FIO_OPT_G_INVALID,
2975 .name = "write_iops_log",
2976 .lname = "Write IOPS log",
2977 .type = FIO_OPT_STR_STORE,
2978 .off1 = td_var_offset(iops_log_file),
2979 .help = "Write log of IOPS during run",
2980 .category = FIO_OPT_C_LOG,
2981 .group = FIO_OPT_G_INVALID,
2984 .name = "log_avg_msec",
2985 .lname = "Log averaging (msec)",
2986 .type = FIO_OPT_INT,
2987 .off1 = td_var_offset(log_avg_msec),
2988 .help = "Average bw/iops/lat logs over this period of time",
2990 .category = FIO_OPT_C_LOG,
2991 .group = FIO_OPT_G_INVALID,
2994 .name = "bwavgtime",
2995 .lname = "Bandwidth average time",
2996 .type = FIO_OPT_INT,
2997 .off1 = td_var_offset(bw_avg_time),
2998 .help = "Time window over which to calculate bandwidth"
3001 .parent = "write_bw_log",
3004 .category = FIO_OPT_C_LOG,
3005 .group = FIO_OPT_G_INVALID,
3008 .name = "iopsavgtime",
3009 .lname = "IOPS average time",
3010 .type = FIO_OPT_INT,
3011 .off1 = td_var_offset(iops_avg_time),
3012 .help = "Time window over which to calculate IOPS (msec)",
3014 .parent = "write_iops_log",
3017 .category = FIO_OPT_C_LOG,
3018 .group = FIO_OPT_G_INVALID,
3021 .name = "group_reporting",
3022 .lname = "Group reporting",
3023 .type = FIO_OPT_STR_SET,
3024 .off1 = td_var_offset(group_reporting),
3025 .help = "Do reporting on a per-group basis",
3026 .category = FIO_OPT_C_STAT,
3027 .group = FIO_OPT_G_INVALID,
3030 .name = "zero_buffers",
3031 .lname = "Zero I/O buffers",
3032 .type = FIO_OPT_STR_SET,
3033 .off1 = td_var_offset(zero_buffers),
3034 .help = "Init IO buffers to all zeroes",
3035 .category = FIO_OPT_C_IO,
3036 .group = FIO_OPT_G_IO_BUF,
3039 .name = "refill_buffers",
3040 .lname = "Refill I/O buffers",
3041 .type = FIO_OPT_STR_SET,
3042 .off1 = td_var_offset(refill_buffers),
3043 .help = "Refill IO buffers on every IO submit",
3044 .category = FIO_OPT_C_IO,
3045 .group = FIO_OPT_G_IO_BUF,
3048 .name = "scramble_buffers",
3049 .lname = "Scramble I/O buffers",
3050 .type = FIO_OPT_BOOL,
3051 .off1 = td_var_offset(scramble_buffers),
3052 .help = "Slightly scramble buffers on every IO submit",
3054 .category = FIO_OPT_C_IO,
3055 .group = FIO_OPT_G_IO_BUF,
3058 .name = "buffer_pattern",
3059 .lname = "Buffer pattern",
3060 .type = FIO_OPT_STR,
3061 .cb = str_buffer_pattern_cb,
3062 .help = "Fill pattern for IO buffers",
3063 .category = FIO_OPT_C_IO,
3064 .group = FIO_OPT_G_IO_BUF,
3067 .name = "buffer_compress_percentage",
3068 .lname = "Buffer compression percentage",
3069 .type = FIO_OPT_INT,
3070 .off1 = td_var_offset(compress_percentage),
3073 .help = "How compressible the buffer is (approximately)",
3075 .category = FIO_OPT_C_IO,
3076 .group = FIO_OPT_G_IO_BUF,
3079 .name = "buffer_compress_chunk",
3080 .lname = "Buffer compression chunk size",
3081 .type = FIO_OPT_INT,
3082 .off1 = td_var_offset(compress_chunk),
3083 .parent = "buffer_compress_percentage",
3085 .help = "Size of compressible region in buffer",
3087 .category = FIO_OPT_C_IO,
3088 .group = FIO_OPT_G_IO_BUF,
3091 .name = "clat_percentiles",
3092 .lname = "Completion latency percentiles",
3093 .type = FIO_OPT_BOOL,
3094 .off1 = td_var_offset(clat_percentiles),
3095 .help = "Enable the reporting of completion latency percentiles",
3097 .category = FIO_OPT_C_STAT,
3098 .group = FIO_OPT_G_INVALID,
3101 .name = "percentile_list",
3102 .lname = "Completion latency percentile list",
3103 .type = FIO_OPT_FLOAT_LIST,
3104 .off1 = td_var_offset(percentile_list),
3105 .off2 = td_var_offset(percentile_precision),
3106 .help = "Specify a custom list of percentiles to report",
3107 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3108 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3111 .category = FIO_OPT_C_STAT,
3112 .group = FIO_OPT_G_INVALID,
3115 #ifdef FIO_HAVE_DISK_UTIL
3117 .name = "disk_util",
3118 .lname = "Disk utilization",
3119 .type = FIO_OPT_BOOL,
3120 .off1 = td_var_offset(do_disk_util),
3121 .help = "Log disk utilization statistics",
3123 .category = FIO_OPT_C_STAT,
3124 .group = FIO_OPT_G_INVALID,
3128 .name = "gtod_reduce",
3129 .lname = "Reduce gettimeofday() calls",
3130 .type = FIO_OPT_BOOL,
3131 .help = "Greatly reduce number of gettimeofday() calls",
3132 .cb = str_gtod_reduce_cb,
3135 .category = FIO_OPT_C_STAT,
3136 .group = FIO_OPT_G_INVALID,
3139 .name = "disable_lat",
3140 .lname = "Disable all latency stats",
3141 .type = FIO_OPT_BOOL,
3142 .off1 = td_var_offset(disable_lat),
3143 .help = "Disable latency numbers",
3144 .parent = "gtod_reduce",
3147 .category = FIO_OPT_C_STAT,
3148 .group = FIO_OPT_G_INVALID,
3151 .name = "disable_clat",
3152 .lname = "Disable completion latency stats",
3153 .type = FIO_OPT_BOOL,
3154 .off1 = td_var_offset(disable_clat),
3155 .help = "Disable completion latency numbers",
3156 .parent = "gtod_reduce",
3159 .category = FIO_OPT_C_STAT,
3160 .group = FIO_OPT_G_INVALID,
3163 .name = "disable_slat",
3164 .lname = "Disable submission latency stats",
3165 .type = FIO_OPT_BOOL,
3166 .off1 = td_var_offset(disable_slat),
3167 .help = "Disable submission latency numbers",
3168 .parent = "gtod_reduce",
3171 .category = FIO_OPT_C_STAT,
3172 .group = FIO_OPT_G_INVALID,
3175 .name = "disable_bw_measurement",
3176 .lname = "Disable bandwidth stats",
3177 .type = FIO_OPT_BOOL,
3178 .off1 = td_var_offset(disable_bw),
3179 .help = "Disable bandwidth logging",
3180 .parent = "gtod_reduce",
3183 .category = FIO_OPT_C_STAT,
3184 .group = FIO_OPT_G_INVALID,
3188 .lname = "Dedicated gettimeofday() CPU",
3189 .type = FIO_OPT_INT,
3190 .cb = str_gtod_cpu_cb,
3191 .help = "Set up dedicated gettimeofday() thread on this CPU",
3192 .verify = gtod_cpu_verify,
3193 .category = FIO_OPT_C_GENERAL,
3194 .group = FIO_OPT_G_CLOCK,
3197 .name = "unified_rw_reporting",
3198 .type = FIO_OPT_BOOL,
3199 .off1 = td_var_offset(unified_rw_rep),
3200 .help = "Unify reporting across data direction",
3202 .category = FIO_OPT_C_GENERAL,
3203 .group = FIO_OPT_G_INVALID,
3206 .name = "continue_on_error",
3207 .lname = "Continue on error",
3208 .type = FIO_OPT_STR,
3209 .off1 = td_var_offset(continue_on_error),
3210 .help = "Continue on non-fatal errors during IO",
3212 .category = FIO_OPT_C_GENERAL,
3213 .group = FIO_OPT_G_ERR,
3216 .oval = ERROR_TYPE_NONE,
3217 .help = "Exit when an error is encountered",
3220 .oval = ERROR_TYPE_READ,
3221 .help = "Continue on read errors only",
3224 .oval = ERROR_TYPE_WRITE,
3225 .help = "Continue on write errors only",
3228 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3229 .help = "Continue on any IO errors",
3232 .oval = ERROR_TYPE_VERIFY,
3233 .help = "Continue on verify errors only",
3236 .oval = ERROR_TYPE_ANY,
3237 .help = "Continue on all io and verify errors",
3240 .oval = ERROR_TYPE_NONE,
3241 .help = "Alias for 'none'",
3244 .oval = ERROR_TYPE_ANY,
3245 .help = "Alias for 'all'",
3250 .name = "ignore_error",
3251 .type = FIO_OPT_STR,
3252 .cb = str_ignore_error_cb,
3253 .help = "Set a specific list of errors to ignore",
3255 .category = FIO_OPT_C_GENERAL,
3256 .group = FIO_OPT_G_ERR,
3259 .name = "error_dump",
3260 .type = FIO_OPT_BOOL,
3261 .off1 = td_var_offset(error_dump),
3263 .help = "Dump info on each error",
3264 .category = FIO_OPT_C_GENERAL,
3265 .group = FIO_OPT_G_ERR,
3270 .type = FIO_OPT_STR_STORE,
3271 .off1 = td_var_offset(profile),
3272 .help = "Select a specific builtin performance test",
3273 .category = FIO_OPT_C_PROFILE,
3274 .group = FIO_OPT_G_INVALID,
3279 .type = FIO_OPT_STR_STORE,
3280 .off1 = td_var_offset(cgroup),
3281 .help = "Add job to cgroup of this name",
3282 .category = FIO_OPT_C_GENERAL,
3283 .group = FIO_OPT_G_CGROUP,
3286 .name = "cgroup_nodelete",
3287 .lname = "Cgroup no-delete",
3288 .type = FIO_OPT_BOOL,
3289 .off1 = td_var_offset(cgroup_nodelete),
3290 .help = "Do not delete cgroups after job completion",
3293 .category = FIO_OPT_C_GENERAL,
3294 .group = FIO_OPT_G_CGROUP,
3297 .name = "cgroup_weight",
3298 .lname = "Cgroup weight",
3299 .type = FIO_OPT_INT,
3300 .off1 = td_var_offset(cgroup_weight),
3301 .help = "Use given weight for cgroup",
3305 .category = FIO_OPT_C_GENERAL,
3306 .group = FIO_OPT_G_CGROUP,
3311 .type = FIO_OPT_INT,
3312 .off1 = td_var_offset(uid),
3313 .help = "Run job with this user ID",
3314 .category = FIO_OPT_C_GENERAL,
3315 .group = FIO_OPT_G_CRED,
3319 .lname = "Group ID",
3320 .type = FIO_OPT_INT,
3321 .off1 = td_var_offset(gid),
3322 .help = "Run job with this group ID",
3323 .category = FIO_OPT_C_GENERAL,
3324 .group = FIO_OPT_G_CRED,
3329 .type = FIO_OPT_INT,
3330 .off1 = td_var_offset(kb_base),
3336 .help = "Use 1024 as the K base",
3340 .help = "Use 1000 as the K base",
3343 .help = "How many bytes per KB for reporting (1000 or 1024)",
3344 .category = FIO_OPT_C_GENERAL,
3345 .group = FIO_OPT_G_INVALID,
3348 .name = "unit_base",
3349 .lname = "Base unit for reporting (Bits or Bytes)",
3350 .type = FIO_OPT_INT,
3351 .off1 = td_var_offset(unit_base),
3356 .help = "Auto-detect",
3360 .help = "Normal (byte based)",
3364 .help = "Bit based",
3367 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3368 .category = FIO_OPT_C_GENERAL,
3369 .group = FIO_OPT_G_INVALID,
3372 .name = "hugepage-size",
3373 .lname = "Hugepage size",
3374 .type = FIO_OPT_INT,
3375 .off1 = td_var_offset(hugepage_size),
3376 .help = "When using hugepages, specify size of each page",
3377 .def = __fio_stringify(FIO_HUGE_PAGE),
3378 .interval = 1024 * 1024,
3379 .category = FIO_OPT_C_GENERAL,
3380 .group = FIO_OPT_G_INVALID,
3384 .lname = "I/O flow ID",
3385 .type = FIO_OPT_INT,
3386 .off1 = td_var_offset(flow_id),
3387 .help = "The flow index ID to use",
3389 .category = FIO_OPT_C_IO,
3390 .group = FIO_OPT_G_IO_FLOW,
3394 .lname = "I/O flow weight",
3395 .type = FIO_OPT_INT,
3396 .off1 = td_var_offset(flow),
3397 .help = "Weight for flow control of this job",
3398 .parent = "flow_id",
3401 .category = FIO_OPT_C_IO,
3402 .group = FIO_OPT_G_IO_FLOW,
3405 .name = "flow_watermark",
3406 .lname = "I/O flow watermark",
3407 .type = FIO_OPT_INT,
3408 .off1 = td_var_offset(flow_watermark),
3409 .help = "High watermark for flow control. This option"
3410 " should be set to the same value for all threads"
3411 " with non-zero flow.",
3412 .parent = "flow_id",
3415 .category = FIO_OPT_C_IO,
3416 .group = FIO_OPT_G_IO_FLOW,
3419 .name = "flow_sleep",
3420 .lname = "I/O flow sleep",
3421 .type = FIO_OPT_INT,
3422 .off1 = td_var_offset(flow_sleep),
3423 .help = "How many microseconds to sleep after being held"
3424 " back by the flow control mechanism",
3425 .parent = "flow_id",
3428 .category = FIO_OPT_C_IO,
3429 .group = FIO_OPT_G_IO_FLOW,
3436 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3437 const char *name, int val)
3439 lopt->name = (char *) name;
3441 if (o->type == FIO_OPT_STR_SET)
3442 lopt->has_arg = optional_argument;
3444 lopt->has_arg = required_argument;
3447 static void options_to_lopts(struct fio_option *opts,
3448 struct option *long_options,
3449 int i, int option_type)
3451 struct fio_option *o = &opts[0];
3453 add_to_lopt(&long_options[i], o, o->name, option_type);
3456 add_to_lopt(&long_options[i], o, o->alias, option_type);
3461 assert(i < FIO_NR_OPTIONS);
3465 void fio_options_set_ioengine_opts(struct option *long_options,
3466 struct thread_data *td)
3471 while (long_options[i].name) {
3472 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3473 memset(&long_options[i], 0, sizeof(*long_options));
3480 * Just clear out the prior ioengine options.
3485 options_to_lopts(td->io_ops->options, long_options, i,
3486 FIO_GETOPT_IOENGINE);
3489 void fio_options_dup_and_init(struct option *long_options)
3493 options_init(fio_options);
3496 while (long_options[i].name)
3499 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3502 struct fio_keyword {
3508 static struct fio_keyword fio_keywords[] = {
3510 .word = "$pagesize",
3511 .desc = "Page size in the system",
3514 .word = "$mb_memory",
3515 .desc = "Megabytes of memory online",
3519 .desc = "Number of CPUs online in the system",
3526 void fio_keywords_init(void)
3528 unsigned long long mb_memory;
3532 sprintf(buf, "%lu", (unsigned long) page_size);
3533 fio_keywords[0].replace = strdup(buf);
3535 mb_memory = os_phys_mem() / (1024 * 1024);
3536 sprintf(buf, "%llu", mb_memory);
3537 fio_keywords[1].replace = strdup(buf);
3540 sprintf(buf, "%lu", l);
3541 fio_keywords[2].replace = strdup(buf);
3546 static char *bc_calc(char *str)
3548 char buf[128], *tmp;
3553 * No math, just return string
3555 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3556 !strchr(str, '/')) || strchr(str, '\''))
3560 * Split option from value, we only need to calculate the value
3562 tmp = strchr(str, '=');
3569 * Prevent buffer overflows; such a case isn't reasonable anyway
3571 if (strlen(str) >= 128 || strlen(tmp) > 100)
3574 sprintf(buf, "which %s > /dev/null", BC_APP);
3576 log_err("fio: bc is needed for performing math\n");
3580 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3581 f = popen(buf, "r");
3585 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3590 buf[(tmp - str) + ret - 1] = '\0';
3591 memcpy(buf, str, tmp - str);
3597 * Return a copy of the input string with substrings of the form ${VARNAME}
3598 * substituted with the value of the environment variable VARNAME. The
3599 * substitution always occurs, even if VARNAME is empty or the corresponding
3600 * environment variable undefined.
3602 static char *option_dup_subs(const char *opt)
3604 char out[OPT_LEN_MAX+1];
3605 char in[OPT_LEN_MAX+1];
3608 char *ch1, *ch2, *env;
3609 ssize_t nchr = OPT_LEN_MAX;
3612 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3613 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3617 in[OPT_LEN_MAX] = '\0';
3618 strncpy(in, opt, OPT_LEN_MAX);
3620 while (*inptr && nchr > 0) {
3621 if (inptr[0] == '$' && inptr[1] == '{') {
3622 ch2 = strchr(inptr, '}');
3623 if (ch2 && inptr+1 < ch2) {
3630 envlen = strlen(env);
3631 if (envlen <= nchr) {
3632 memcpy(outptr, env, envlen);
3642 *outptr++ = *inptr++;
3651 * Look for reserved variable names and replace them with real values
3653 static char *fio_keyword_replace(char *opt)
3659 for (i = 0; fio_keywords[i].word != NULL; i++) {
3660 struct fio_keyword *kw = &fio_keywords[i];
3662 while ((s = strstr(opt, kw->word)) != NULL) {
3663 char *new = malloc(strlen(opt) + 1);
3669 * Copy part of the string before the keyword and
3670 * sprintf() the replacement after it.
3672 memcpy(new, opt, olen);
3673 len = sprintf(new + olen, "%s", kw->replace);
3676 * If there's more in the original string, copy that
3679 opt += strlen(kw->word) + olen;
3681 memcpy(new + olen + len, opt, opt - o_org - 1);
3684 * replace opt and free the old opt
3694 * Check for potential math and invoke bc, if possible
3702 static char **dup_and_sub_options(char **opts, int num_opts)
3705 char **opts_copy = malloc(num_opts * sizeof(*opts));
3706 for (i = 0; i < num_opts; i++) {
3707 opts_copy[i] = option_dup_subs(opts[i]);
3710 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3715 int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3718 int i, ret, unknown;
3721 sort_options(opts, fio_options, num_opts);
3722 opts_copy = dup_and_sub_options(opts, num_opts);
3724 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3725 struct fio_option *o;
3726 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3727 &o, td, dump_cmdline);
3735 opts_copy[i] = NULL;
3742 ret |= ioengine_load(td);
3744 sort_options(opts_copy, td->io_ops->options, num_opts);
3747 for (i = 0; i < num_opts; i++) {
3748 struct fio_option *o = NULL;
3754 newret = parse_option(opts_copy[i], opts[i],
3755 td->io_ops->options, &o,
3756 td->eo, dump_cmdline);
3760 log_err("Bad option <%s>\n", opts[i]);
3763 opts_copy[i] = NULL;
3771 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3773 return parse_cmd_option(opt, val, fio_options, td);
3776 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3779 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
3782 void fio_fill_default_options(struct thread_data *td)
3784 fill_default_options(td, fio_options);
3787 int fio_show_option_help(const char *opt)
3789 return show_cmd_help(fio_options, opt);
3792 void options_mem_dupe(void *data, struct fio_option *options)
3794 struct fio_option *o;
3797 for (o = &options[0]; o->name; o++) {
3798 if (o->type != FIO_OPT_STR_STORE)
3801 ptr = td_var(data, o, o->off1);
3803 *ptr = strdup(*ptr);
3808 * dupe FIO_OPT_STR_STORE options
3810 void fio_options_mem_dupe(struct thread_data *td)
3812 options_mem_dupe(&td->o, fio_options);
3814 if (td->eo && td->io_ops) {
3815 void *oldeo = td->eo;
3817 td->eo = malloc(td->io_ops->option_struct_size);
3818 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3819 options_mem_dupe(td->eo, td->io_ops->options);
3823 unsigned int fio_get_kb_base(void *data)
3825 struct thread_options *o = data;
3826 unsigned int kb_base = 0;
3829 kb_base = o->kb_base;
3836 int add_option(struct fio_option *o)
3838 struct fio_option *__o;
3847 if (opt_index + 1 == FIO_MAX_OPTS) {
3848 log_err("fio: FIO_MAX_OPTS is too small\n");
3852 memcpy(&fio_options[opt_index], o, sizeof(*o));
3853 fio_options[opt_index + 1].name = NULL;
3857 void invalidate_profile_options(const char *prof_name)
3859 struct fio_option *o;
3863 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3864 o->type = FIO_OPT_INVALID;
3865 o->prof_name = NULL;
3871 void add_opt_posval(const char *optname, const char *ival, const char *help)
3873 struct fio_option *o;
3876 o = find_option(fio_options, optname);
3880 for (i = 0; i < PARSE_MAX_VP; i++) {
3881 if (o->posval[i].ival)
3884 o->posval[i].ival = ival;
3885 o->posval[i].help = help;
3890 void del_opt_posval(const char *optname, const char *ival)
3892 struct fio_option *o;
3895 o = find_option(fio_options, optname);
3899 for (i = 0; i < PARSE_MAX_VP; i++) {
3900 if (!o->posval[i].ival)
3902 if (strcmp(o->posval[i].ival, ival))
3905 o->posval[i].ival = NULL;
3906 o->posval[i].help = NULL;
3910 void fio_options_free(struct thread_data *td)
3912 options_free(fio_options, td);
3913 if (td->eo && td->io_ops && td->io_ops->options) {
3914 options_free(td->io_ops->options, td->eo);
3920 struct fio_option *fio_option_find(const char *name)
3922 return find_option(fio_options, name);