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, 0)) {
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, 0)) {
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, 1);
837 static int str_directory_cb(void *data, const char fio_unused *unused)
839 struct thread_data *td = data;
841 char *dirname, *str, *p;
847 p = str = strdup(td->o.directory);
848 while ((dirname = get_next_name(&str)) != NULL) {
849 if (lstat(dirname, &sb) < 0) {
852 log_err("fio: %s is not a directory\n", dirname);
853 td_verror(td, ret, "lstat");
856 if (!S_ISDIR(sb.st_mode)) {
857 log_err("fio: %s is not a directory\n", dirname);
868 static int str_lockfile_cb(void *data, const char fio_unused *str)
870 struct thread_data *td = data;
872 if (td->files_index) {
873 log_err("fio: lockfile= option must precede filename=\n");
880 static int str_opendir_cb(void *data, const char fio_unused *str)
882 struct thread_data *td = data;
887 if (!td->files_index)
890 return add_dir_files(td, td->o.opendir);
893 static int pattern_cb(char *pattern, unsigned int max_size,
894 const char *input, unsigned int *pattern_bytes)
897 int i = 0, j = 0, len, k, base = 10;
898 uint32_t pattern_length;
901 loc1 = strstr(input, "0x");
902 loc2 = strstr(input, "0X");
905 off = strtol(input, NULL, base);
906 if (off != LONG_MAX || errno != ERANGE) {
908 pattern[i] = off & 0xff;
917 j = loc1 - input + 2;
919 j = loc2 - input + 2;
922 if (len - j < max_size * 2) {
924 off = converthexchartoint(input[k--]);
926 off += (converthexchartoint(input[k--])
928 pattern[i++] = (char) off;
934 * Fill the pattern all the way to the end. This greatly reduces
935 * the number of memcpy's we have to do when verifying the IO.
938 while (i > 1 && i * 2 <= max_size) {
939 memcpy(&pattern[i], &pattern[0], i);
944 * Fill remainder, if the pattern multiple ends up not being
947 while (i > 1 && i < max_size) {
948 unsigned int b = min(pattern_length, max_size - i);
950 memcpy(&pattern[i], &pattern[0], b);
956 * The code in verify_io_u_pattern assumes a single byte pattern
957 * fills the whole verify pattern buffer.
959 memset(pattern, pattern[0], max_size);
966 static int str_buffer_pattern_cb(void *data, const char *input)
968 struct thread_data *td = data;
971 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
972 &td->o.buffer_pattern_bytes);
975 td->o.refill_buffers = 0;
976 td->o.scramble_buffers = 0;
977 td->o.zero_buffers = 0;
983 static int str_verify_pattern_cb(void *data, const char *input)
985 struct thread_data *td = data;
988 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
989 &td->o.verify_pattern_bytes);
992 * VERIFY_META could already be set
994 if (!ret && td->o.verify == VERIFY_NONE)
995 td->o.verify = VERIFY_PATTERN;
1000 static int str_gtod_reduce_cb(void *data, int *il)
1002 struct thread_data *td = data;
1005 td->o.disable_lat = !!val;
1006 td->o.disable_clat = !!val;
1007 td->o.disable_slat = !!val;
1008 td->o.disable_bw = !!val;
1009 td->o.clat_percentiles = !val;
1011 td->tv_cache_mask = 63;
1016 static int str_gtod_cpu_cb(void *data, long long *il)
1018 struct thread_data *td = data;
1021 td->o.gtod_cpu = val;
1022 td->o.gtod_offload = 1;
1026 static int str_size_cb(void *data, unsigned long long *__val)
1028 struct thread_data *td = data;
1029 unsigned long long v = *__val;
1031 if (parse_is_percent(v)) {
1033 td->o.size_percent = -1ULL - v;
1040 static int rw_verify(struct fio_option *o, void *data)
1042 struct thread_data *td = data;
1044 if (read_only && td_write(td)) {
1045 log_err("fio: job <%s> has write bit set, but fio is in"
1046 " read-only mode\n", td->o.name);
1053 static int gtod_cpu_verify(struct fio_option *o, void *data)
1055 #ifndef FIO_HAVE_CPU_AFFINITY
1056 struct thread_data *td = data;
1058 if (td->o.gtod_cpu) {
1059 log_err("fio: platform must support CPU affinity for"
1060 "gettimeofday() offloading\n");
1071 static struct opt_group fio_opt_groups[] = {
1074 .mask = FIO_OPT_C_GENERAL,
1078 .mask = FIO_OPT_C_IO,
1082 .mask = FIO_OPT_C_FILE,
1085 .name = "Statistics",
1086 .mask = FIO_OPT_C_STAT,
1090 .mask = FIO_OPT_C_LOG,
1094 .mask = FIO_OPT_C_PROFILE,
1101 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1102 unsigned int inv_mask)
1104 struct opt_group *og;
1107 if (*mask == inv_mask || !*mask)
1110 for (i = 0; ogs[i].name; i++) {
1113 if (*mask & og->mask) {
1114 *mask &= ~(og->mask);
1122 struct opt_group *opt_group_from_mask(unsigned int *mask)
1124 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1127 static struct opt_group fio_opt_cat_groups[] = {
1129 .name = "Latency profiling",
1130 .mask = FIO_OPT_G_LATPROF,
1134 .mask = FIO_OPT_G_RATE,
1138 .mask = FIO_OPT_G_ZONE,
1141 .name = "Read/write mix",
1142 .mask = FIO_OPT_G_RWMIX,
1146 .mask = FIO_OPT_G_VERIFY,
1150 .mask = FIO_OPT_G_TRIM,
1153 .name = "I/O Logging",
1154 .mask = FIO_OPT_G_IOLOG,
1157 .name = "I/O Depth",
1158 .mask = FIO_OPT_G_IO_DEPTH,
1162 .mask = FIO_OPT_G_IO_FLOW,
1165 .name = "Description",
1166 .mask = FIO_OPT_G_DESC,
1170 .mask = FIO_OPT_G_FILENAME,
1173 .name = "General I/O",
1174 .mask = FIO_OPT_G_IO_BASIC,
1178 .mask = FIO_OPT_G_CGROUP,
1182 .mask = FIO_OPT_G_RUNTIME,
1186 .mask = FIO_OPT_G_PROCESS,
1189 .name = "Job credentials / priority",
1190 .mask = FIO_OPT_G_CRED,
1193 .name = "Clock settings",
1194 .mask = FIO_OPT_G_CLOCK,
1198 .mask = FIO_OPT_G_IO_TYPE,
1201 .name = "I/O Thinktime",
1202 .mask = FIO_OPT_G_THINKTIME,
1205 .name = "Randomizations",
1206 .mask = FIO_OPT_G_RANDOM,
1209 .name = "I/O buffers",
1210 .mask = FIO_OPT_G_IO_BUF,
1213 .name = "Tiobench profile",
1214 .mask = FIO_OPT_G_TIOBENCH,
1222 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1224 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1228 * Map of job/command line options
1230 struct fio_option fio_options[FIO_MAX_OPTS] = {
1232 .name = "description",
1233 .lname = "Description of job",
1234 .type = FIO_OPT_STR_STORE,
1235 .off1 = td_var_offset(description),
1236 .help = "Text job description",
1237 .category = FIO_OPT_C_GENERAL,
1238 .group = FIO_OPT_G_DESC,
1242 .lname = "Job name",
1243 .type = FIO_OPT_STR_STORE,
1244 .off1 = td_var_offset(name),
1245 .help = "Name of this job",
1246 .category = FIO_OPT_C_GENERAL,
1247 .group = FIO_OPT_G_DESC,
1251 .lname = "Filename(s)",
1252 .type = FIO_OPT_STR_STORE,
1253 .off1 = td_var_offset(filename),
1254 .cb = str_filename_cb,
1255 .prio = -1, /* must come after "directory" */
1256 .help = "File(s) to use for the workload",
1257 .category = FIO_OPT_C_FILE,
1258 .group = FIO_OPT_G_FILENAME,
1261 .name = "directory",
1262 .lname = "Directory",
1263 .type = FIO_OPT_STR_STORE,
1264 .off1 = td_var_offset(directory),
1265 .cb = str_directory_cb,
1266 .help = "Directory to store files in",
1267 .category = FIO_OPT_C_FILE,
1268 .group = FIO_OPT_G_FILENAME,
1271 .name = "filename_format",
1272 .type = FIO_OPT_STR_STORE,
1273 .off1 = td_var_offset(filename_format),
1274 .prio = -1, /* must come after "directory" */
1275 .help = "Override default $jobname.$jobnum.$filenum naming",
1276 .def = "$jobname.$jobnum.$filenum",
1277 .category = FIO_OPT_C_FILE,
1278 .group = FIO_OPT_G_FILENAME,
1282 .lname = "Lockfile",
1283 .type = FIO_OPT_STR,
1284 .off1 = td_var_offset(file_lock_mode),
1285 .help = "Lock file when doing IO to it",
1287 .parent = "filename",
1290 .cb = str_lockfile_cb,
1291 .category = FIO_OPT_C_FILE,
1292 .group = FIO_OPT_G_FILENAME,
1295 .oval = FILE_LOCK_NONE,
1296 .help = "No file locking",
1298 { .ival = "exclusive",
1299 .oval = FILE_LOCK_EXCLUSIVE,
1300 .help = "Exclusive file lock",
1303 .ival = "readwrite",
1304 .oval = FILE_LOCK_READWRITE,
1305 .help = "Read vs write lock",
1311 .lname = "Open directory",
1312 .type = FIO_OPT_STR_STORE,
1313 .off1 = td_var_offset(opendir),
1314 .cb = str_opendir_cb,
1315 .help = "Recursively add files from this directory and down",
1316 .category = FIO_OPT_C_FILE,
1317 .group = FIO_OPT_G_FILENAME,
1321 .lname = "Read/write",
1322 .alias = "readwrite",
1323 .type = FIO_OPT_STR,
1325 .off1 = td_var_offset(td_ddir),
1326 .help = "IO direction",
1328 .verify = rw_verify,
1329 .category = FIO_OPT_C_IO,
1330 .group = FIO_OPT_G_IO_BASIC,
1333 .oval = TD_DDIR_READ,
1334 .help = "Sequential read",
1337 .oval = TD_DDIR_WRITE,
1338 .help = "Sequential write",
1341 .oval = TD_DDIR_TRIM,
1342 .help = "Sequential trim",
1344 { .ival = "randread",
1345 .oval = TD_DDIR_RANDREAD,
1346 .help = "Random read",
1348 { .ival = "randwrite",
1349 .oval = TD_DDIR_RANDWRITE,
1350 .help = "Random write",
1352 { .ival = "randtrim",
1353 .oval = TD_DDIR_RANDTRIM,
1354 .help = "Random trim",
1358 .help = "Sequential read and write mix",
1360 { .ival = "readwrite",
1362 .help = "Sequential read and write mix",
1365 .oval = TD_DDIR_RANDRW,
1366 .help = "Random read and write mix"
1371 .name = "rw_sequencer",
1372 .lname = "RW Sequencer",
1373 .type = FIO_OPT_STR,
1374 .off1 = td_var_offset(rw_seq),
1375 .help = "IO offset generator modifier",
1376 .def = "sequential",
1377 .category = FIO_OPT_C_IO,
1378 .group = FIO_OPT_G_IO_BASIC,
1380 { .ival = "sequential",
1382 .help = "Generate sequential offsets",
1384 { .ival = "identical",
1385 .oval = RW_SEQ_IDENT,
1386 .help = "Generate identical offsets",
1393 .lname = "IO Engine",
1394 .type = FIO_OPT_STR_STORE,
1395 .off1 = td_var_offset(ioengine),
1396 .help = "IO engine to use",
1397 .def = FIO_PREFERRED_ENGINE,
1398 .category = FIO_OPT_C_IO,
1399 .group = FIO_OPT_G_IO_BASIC,
1402 .help = "Use read/write",
1405 .help = "Use pread/pwrite",
1408 .help = "Use readv/writev",
1410 #ifdef CONFIG_PWRITEV
1412 .help = "Use preadv/pwritev",
1415 #ifdef CONFIG_LIBAIO
1417 .help = "Linux native asynchronous IO",
1420 #ifdef CONFIG_POSIXAIO
1421 { .ival = "posixaio",
1422 .help = "POSIX asynchronous IO",
1425 #ifdef CONFIG_SOLARISAIO
1426 { .ival = "solarisaio",
1427 .help = "Solaris native asynchronous IO",
1430 #ifdef CONFIG_WINDOWSAIO
1431 { .ival = "windowsaio",
1432 .help = "Windows native asynchronous IO"
1437 .help = "Rados Block Device asynchronous IO"
1441 .help = "Memory mapped IO"
1443 #ifdef CONFIG_LINUX_SPLICE
1445 .help = "splice/vmsplice based IO",
1447 { .ival = "netsplice",
1448 .help = "splice/vmsplice to/from the network",
1451 #ifdef FIO_HAVE_SGIO
1453 .help = "SCSI generic v3 IO",
1457 .help = "Testing engine (no data transfer)",
1460 .help = "Network IO",
1463 .help = "CPU cycle burner engine",
1467 .help = "GUASI IO engine",
1470 #ifdef FIO_HAVE_BINJECT
1471 { .ival = "binject",
1472 .help = "binject direct inject block engine",
1477 .help = "RDMA IO engine",
1480 #ifdef CONFIG_FUSION_AW
1481 { .ival = "fusion-aw-sync",
1482 .help = "Fusion-io atomic write engine",
1485 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1486 { .ival = "e4defrag",
1487 .help = "ext4 defrag engine",
1490 #ifdef CONFIG_LINUX_FALLOCATE
1492 .help = "fallocate() file based engine",
1495 { .ival = "external",
1496 .help = "Load external engine (append name)",
1502 .lname = "IO Depth",
1503 .type = FIO_OPT_INT,
1504 .off1 = td_var_offset(iodepth),
1505 .help = "Number of IO buffers to keep in flight",
1509 .category = FIO_OPT_C_IO,
1510 .group = FIO_OPT_G_IO_BASIC,
1513 .name = "iodepth_batch",
1514 .lname = "IO Depth batch",
1515 .alias = "iodepth_batch_submit",
1516 .type = FIO_OPT_INT,
1517 .off1 = td_var_offset(iodepth_batch),
1518 .help = "Number of IO buffers to submit in one go",
1519 .parent = "iodepth",
1524 .category = FIO_OPT_C_IO,
1525 .group = FIO_OPT_G_IO_BASIC,
1528 .name = "iodepth_batch_complete",
1529 .lname = "IO Depth batch complete",
1530 .type = FIO_OPT_INT,
1531 .off1 = td_var_offset(iodepth_batch_complete),
1532 .help = "Number of IO buffers to retrieve in one go",
1533 .parent = "iodepth",
1538 .category = FIO_OPT_C_IO,
1539 .group = FIO_OPT_G_IO_BASIC,
1542 .name = "iodepth_low",
1543 .lname = "IO Depth batch low",
1544 .type = FIO_OPT_INT,
1545 .off1 = td_var_offset(iodepth_low),
1546 .help = "Low water mark for queuing depth",
1547 .parent = "iodepth",
1550 .category = FIO_OPT_C_IO,
1551 .group = FIO_OPT_G_IO_BASIC,
1556 .type = FIO_OPT_STR_VAL,
1558 .help = "Total size of device or files",
1559 .interval = 1024 * 1024,
1560 .category = FIO_OPT_C_IO,
1561 .group = FIO_OPT_G_INVALID,
1564 .name = "fill_device",
1565 .lname = "Fill device",
1567 .type = FIO_OPT_BOOL,
1568 .off1 = td_var_offset(fill_device),
1569 .help = "Write until an ENOSPC error occurs",
1571 .category = FIO_OPT_C_FILE,
1572 .group = FIO_OPT_G_INVALID,
1576 .lname = "File size",
1577 .type = FIO_OPT_STR_VAL,
1578 .off1 = td_var_offset(file_size_low),
1579 .off2 = td_var_offset(file_size_high),
1581 .help = "Size of individual files",
1582 .interval = 1024 * 1024,
1583 .category = FIO_OPT_C_FILE,
1584 .group = FIO_OPT_G_INVALID,
1588 .lname = "IO offset",
1589 .alias = "fileoffset",
1590 .type = FIO_OPT_STR_VAL,
1591 .off1 = td_var_offset(start_offset),
1592 .help = "Start IO from this offset",
1594 .interval = 1024 * 1024,
1595 .category = FIO_OPT_C_IO,
1596 .group = FIO_OPT_G_INVALID,
1599 .name = "offset_increment",
1600 .lname = "IO offset increment",
1601 .type = FIO_OPT_STR_VAL,
1602 .off1 = td_var_offset(offset_increment),
1603 .help = "What is the increment from one offset to the next",
1607 .interval = 1024 * 1024,
1608 .category = FIO_OPT_C_IO,
1609 .group = FIO_OPT_G_INVALID,
1612 .name = "number_ios",
1613 .lname = "Number of IOs to perform",
1614 .type = FIO_OPT_STR_VAL,
1615 .off1 = td_var_offset(number_ios),
1616 .help = "Force job completion of this number of IOs",
1618 .category = FIO_OPT_C_IO,
1619 .group = FIO_OPT_G_INVALID,
1623 .lname = "Block size",
1624 .alias = "blocksize",
1625 .type = FIO_OPT_INT,
1626 .off1 = td_var_offset(bs[DDIR_READ]),
1627 .off2 = td_var_offset(bs[DDIR_WRITE]),
1628 .off3 = td_var_offset(bs[DDIR_TRIM]),
1630 .help = "Block size unit",
1635 .category = FIO_OPT_C_IO,
1636 .group = FIO_OPT_G_INVALID,
1640 .lname = "Block size align",
1641 .alias = "blockalign",
1642 .type = FIO_OPT_INT,
1643 .off1 = td_var_offset(ba[DDIR_READ]),
1644 .off2 = td_var_offset(ba[DDIR_WRITE]),
1645 .off3 = td_var_offset(ba[DDIR_TRIM]),
1647 .help = "IO block offset alignment",
1651 .category = FIO_OPT_C_IO,
1652 .group = FIO_OPT_G_INVALID,
1656 .lname = "Block size range",
1657 .alias = "blocksize_range",
1658 .type = FIO_OPT_RANGE,
1659 .off1 = td_var_offset(min_bs[DDIR_READ]),
1660 .off2 = td_var_offset(max_bs[DDIR_READ]),
1661 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1662 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1663 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1664 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1666 .help = "Set block size range (in more detail than bs)",
1670 .category = FIO_OPT_C_IO,
1671 .group = FIO_OPT_G_INVALID,
1675 .lname = "Block size split",
1676 .type = FIO_OPT_STR,
1677 .cb = str_bssplit_cb,
1678 .help = "Set a specific mix of block sizes",
1681 .category = FIO_OPT_C_IO,
1682 .group = FIO_OPT_G_INVALID,
1685 .name = "bs_unaligned",
1686 .lname = "Block size unaligned",
1687 .alias = "blocksize_unaligned",
1688 .type = FIO_OPT_STR_SET,
1689 .off1 = td_var_offset(bs_unaligned),
1690 .help = "Don't sector align IO buffer sizes",
1693 .category = FIO_OPT_C_IO,
1694 .group = FIO_OPT_G_INVALID,
1697 .name = "bs_is_seq_rand",
1698 .lname = "Block size division is seq/random (not read/write)",
1699 .type = FIO_OPT_BOOL,
1700 .off1 = td_var_offset(bs_is_seq_rand),
1701 .help = "Consider any blocksize setting to be sequential,ramdom",
1703 .parent = "blocksize",
1704 .category = FIO_OPT_C_IO,
1705 .group = FIO_OPT_G_INVALID,
1708 .name = "randrepeat",
1709 .lname = "Random repeatable",
1710 .type = FIO_OPT_BOOL,
1711 .off1 = td_var_offset(rand_repeatable),
1712 .help = "Use repeatable random IO pattern",
1716 .category = FIO_OPT_C_IO,
1717 .group = FIO_OPT_G_RANDOM,
1721 .lname = "The random generator seed",
1722 .type = FIO_OPT_STR_VAL,
1723 .off1 = td_var_offset(rand_seed),
1724 .help = "Set the random generator seed value",
1726 .category = FIO_OPT_C_IO,
1727 .group = FIO_OPT_G_RANDOM,
1730 .name = "use_os_rand",
1731 .lname = "Use OS random",
1732 .type = FIO_OPT_BOOL,
1733 .off1 = td_var_offset(use_os_rand),
1734 .help = "Set to use OS random generator",
1738 .category = FIO_OPT_C_IO,
1739 .group = FIO_OPT_G_RANDOM,
1742 .name = "norandommap",
1743 .lname = "No randommap",
1744 .type = FIO_OPT_STR_SET,
1745 .off1 = td_var_offset(norandommap),
1746 .help = "Accept potential duplicate random blocks",
1750 .category = FIO_OPT_C_IO,
1751 .group = FIO_OPT_G_RANDOM,
1754 .name = "softrandommap",
1755 .lname = "Soft randommap",
1756 .type = FIO_OPT_BOOL,
1757 .off1 = td_var_offset(softrandommap),
1758 .help = "Set norandommap if randommap allocation fails",
1759 .parent = "norandommap",
1762 .category = FIO_OPT_C_IO,
1763 .group = FIO_OPT_G_RANDOM,
1766 .name = "random_generator",
1767 .type = FIO_OPT_STR,
1768 .off1 = td_var_offset(random_generator),
1769 .help = "Type of random number generator to use",
1770 .def = "tausworthe",
1772 { .ival = "tausworthe",
1773 .oval = FIO_RAND_GEN_TAUSWORTHE,
1774 .help = "Strong Tausworthe generator",
1777 .oval = FIO_RAND_GEN_LFSR,
1778 .help = "Variable length LFSR",
1781 .category = FIO_OPT_C_IO,
1782 .group = FIO_OPT_G_RANDOM,
1785 .name = "random_distribution",
1786 .type = FIO_OPT_STR,
1787 .off1 = td_var_offset(random_distribution),
1788 .cb = str_random_distribution_cb,
1789 .help = "Random offset distribution generator",
1793 .oval = FIO_RAND_DIST_RANDOM,
1794 .help = "Completely random",
1797 .oval = FIO_RAND_DIST_ZIPF,
1798 .help = "Zipf distribution",
1801 .oval = FIO_RAND_DIST_PARETO,
1802 .help = "Pareto distribution",
1805 .category = FIO_OPT_C_IO,
1806 .group = FIO_OPT_G_RANDOM,
1809 .name = "percentage_random",
1810 .lname = "Percentage Random",
1811 .type = FIO_OPT_INT,
1812 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1813 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1814 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1816 .help = "Percentage of seq/random mix that should be random",
1817 .def = "100,100,100",
1819 .inverse = "percentage_sequential",
1820 .category = FIO_OPT_C_IO,
1821 .group = FIO_OPT_G_RANDOM,
1824 .name = "percentage_sequential",
1825 .lname = "Percentage Sequential",
1826 .type = FIO_OPT_DEPRECATED,
1827 .category = FIO_OPT_C_IO,
1828 .group = FIO_OPT_G_RANDOM,
1831 .name = "allrandrepeat",
1832 .type = FIO_OPT_BOOL,
1833 .off1 = td_var_offset(allrand_repeatable),
1834 .help = "Use repeatable random numbers for everything",
1836 .category = FIO_OPT_C_IO,
1837 .group = FIO_OPT_G_RANDOM,
1841 .lname = "Number of files",
1842 .alias = "nr_files",
1843 .type = FIO_OPT_INT,
1844 .off1 = td_var_offset(nr_files),
1845 .help = "Split job workload between this number of files",
1848 .category = FIO_OPT_C_FILE,
1849 .group = FIO_OPT_G_INVALID,
1852 .name = "openfiles",
1853 .lname = "Number of open files",
1854 .type = FIO_OPT_INT,
1855 .off1 = td_var_offset(open_files),
1856 .help = "Number of files to keep open at the same time",
1857 .category = FIO_OPT_C_FILE,
1858 .group = FIO_OPT_G_INVALID,
1861 .name = "file_service_type",
1862 .lname = "File service type",
1863 .type = FIO_OPT_STR,
1865 .off1 = td_var_offset(file_service_type),
1866 .help = "How to select which file to service next",
1867 .def = "roundrobin",
1868 .category = FIO_OPT_C_FILE,
1869 .group = FIO_OPT_G_INVALID,
1872 .oval = FIO_FSERVICE_RANDOM,
1873 .help = "Choose a file at random",
1875 { .ival = "roundrobin",
1876 .oval = FIO_FSERVICE_RR,
1877 .help = "Round robin select files",
1879 { .ival = "sequential",
1880 .oval = FIO_FSERVICE_SEQ,
1881 .help = "Finish one file before moving to the next",
1884 .parent = "nrfiles",
1887 #ifdef CONFIG_POSIX_FALLOCATE
1889 .name = "fallocate",
1890 .lname = "Fallocate",
1891 .type = FIO_OPT_STR,
1892 .off1 = td_var_offset(fallocate_mode),
1893 .help = "Whether pre-allocation is performed when laying out files",
1895 .category = FIO_OPT_C_FILE,
1896 .group = FIO_OPT_G_INVALID,
1899 .oval = FIO_FALLOCATE_NONE,
1900 .help = "Do not pre-allocate space",
1903 .oval = FIO_FALLOCATE_POSIX,
1904 .help = "Use posix_fallocate()",
1906 #ifdef CONFIG_LINUX_FALLOCATE
1908 .oval = FIO_FALLOCATE_KEEP_SIZE,
1909 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1912 /* Compatibility with former boolean values */
1914 .oval = FIO_FALLOCATE_NONE,
1915 .help = "Alias for 'none'",
1918 .oval = FIO_FALLOCATE_POSIX,
1919 .help = "Alias for 'posix'",
1923 #endif /* CONFIG_POSIX_FALLOCATE */
1925 .name = "fadvise_hint",
1926 .lname = "Fadvise hint",
1927 .type = FIO_OPT_BOOL,
1928 .off1 = td_var_offset(fadvise_hint),
1929 .help = "Use fadvise() to advise the kernel on IO pattern",
1931 .category = FIO_OPT_C_FILE,
1932 .group = FIO_OPT_G_INVALID,
1937 .type = FIO_OPT_INT,
1938 .off1 = td_var_offset(fsync_blocks),
1939 .help = "Issue fsync for writes every given number of blocks",
1942 .category = FIO_OPT_C_FILE,
1943 .group = FIO_OPT_G_INVALID,
1946 .name = "fdatasync",
1947 .lname = "Fdatasync",
1948 .type = FIO_OPT_INT,
1949 .off1 = td_var_offset(fdatasync_blocks),
1950 .help = "Issue fdatasync for writes every given number of blocks",
1953 .category = FIO_OPT_C_FILE,
1954 .group = FIO_OPT_G_INVALID,
1957 .name = "write_barrier",
1958 .lname = "Write barrier",
1959 .type = FIO_OPT_INT,
1960 .off1 = td_var_offset(barrier_blocks),
1961 .help = "Make every Nth write a barrier write",
1964 .category = FIO_OPT_C_IO,
1965 .group = FIO_OPT_G_INVALID,
1967 #ifdef CONFIG_SYNC_FILE_RANGE
1969 .name = "sync_file_range",
1970 .lname = "Sync file range",
1972 { .ival = "wait_before",
1973 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1974 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
1978 .oval = SYNC_FILE_RANGE_WRITE,
1979 .help = "SYNC_FILE_RANGE_WRITE",
1983 .ival = "wait_after",
1984 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1985 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
1989 .type = FIO_OPT_STR_MULTI,
1991 .off1 = td_var_offset(sync_file_range),
1992 .help = "Use sync_file_range()",
1993 .category = FIO_OPT_C_FILE,
1994 .group = FIO_OPT_G_INVALID,
1999 .lname = "Direct I/O",
2000 .type = FIO_OPT_BOOL,
2001 .off1 = td_var_offset(odirect),
2002 .help = "Use O_DIRECT IO (negates buffered)",
2004 .inverse = "buffered",
2005 .category = FIO_OPT_C_IO,
2006 .group = FIO_OPT_G_IO_TYPE,
2010 .lname = "Atomic I/O",
2011 .type = FIO_OPT_BOOL,
2012 .off1 = td_var_offset(oatomic),
2013 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2015 .category = FIO_OPT_C_IO,
2016 .group = FIO_OPT_G_IO_TYPE,
2020 .lname = "Buffered I/O",
2021 .type = FIO_OPT_BOOL,
2022 .off1 = td_var_offset(odirect),
2024 .help = "Use buffered IO (negates direct)",
2026 .inverse = "direct",
2027 .category = FIO_OPT_C_IO,
2028 .group = FIO_OPT_G_IO_TYPE,
2031 .name = "overwrite",
2032 .lname = "Overwrite",
2033 .type = FIO_OPT_BOOL,
2034 .off1 = td_var_offset(overwrite),
2035 .help = "When writing, set whether to overwrite current data",
2037 .category = FIO_OPT_C_FILE,
2038 .group = FIO_OPT_G_INVALID,
2043 .type = FIO_OPT_INT,
2044 .off1 = td_var_offset(loops),
2045 .help = "Number of times to run the job",
2048 .category = FIO_OPT_C_GENERAL,
2049 .group = FIO_OPT_G_RUNTIME,
2053 .lname = "Number of jobs",
2054 .type = FIO_OPT_INT,
2055 .off1 = td_var_offset(numjobs),
2056 .help = "Duplicate this job this many times",
2059 .category = FIO_OPT_C_GENERAL,
2060 .group = FIO_OPT_G_RUNTIME,
2063 .name = "startdelay",
2064 .lname = "Start delay",
2065 .type = FIO_OPT_STR_VAL_TIME,
2066 .off1 = td_var_offset(start_delay),
2067 .off2 = td_var_offset(start_delay_high),
2068 .help = "Only start job when this period has passed",
2071 .category = FIO_OPT_C_GENERAL,
2072 .group = FIO_OPT_G_RUNTIME,
2078 .type = FIO_OPT_STR_VAL_TIME,
2079 .off1 = td_var_offset(timeout),
2080 .help = "Stop workload when this amount of time has passed",
2083 .category = FIO_OPT_C_GENERAL,
2084 .group = FIO_OPT_G_RUNTIME,
2087 .name = "time_based",
2088 .lname = "Time based",
2089 .type = FIO_OPT_STR_SET,
2090 .off1 = td_var_offset(time_based),
2091 .help = "Keep running until runtime/timeout is met",
2092 .category = FIO_OPT_C_GENERAL,
2093 .group = FIO_OPT_G_RUNTIME,
2096 .name = "verify_only",
2097 .lname = "Verify only",
2098 .type = FIO_OPT_STR_SET,
2099 .off1 = td_var_offset(verify_only),
2100 .help = "Verifies previously written data is still valid",
2101 .category = FIO_OPT_C_GENERAL,
2102 .group = FIO_OPT_G_RUNTIME,
2105 .name = "ramp_time",
2106 .lname = "Ramp time",
2107 .type = FIO_OPT_STR_VAL_TIME,
2108 .off1 = td_var_offset(ramp_time),
2109 .help = "Ramp up time before measuring performance",
2111 .category = FIO_OPT_C_GENERAL,
2112 .group = FIO_OPT_G_RUNTIME,
2115 .name = "clocksource",
2116 .lname = "Clock source",
2117 .type = FIO_OPT_STR,
2118 .cb = fio_clock_source_cb,
2119 .off1 = td_var_offset(clocksource),
2120 .help = "What type of timing source to use",
2121 .category = FIO_OPT_C_GENERAL,
2122 .group = FIO_OPT_G_CLOCK,
2124 #ifdef CONFIG_GETTIMEOFDAY
2125 { .ival = "gettimeofday",
2127 .help = "Use gettimeofday(2) for timing",
2130 #ifdef CONFIG_CLOCK_GETTIME
2131 { .ival = "clock_gettime",
2132 .oval = CS_CGETTIME,
2133 .help = "Use clock_gettime(2) for timing",
2136 #ifdef ARCH_HAVE_CPU_CLOCK
2138 .oval = CS_CPUCLOCK,
2139 .help = "Use CPU private clock",
2147 .lname = "I/O Memory",
2148 .type = FIO_OPT_STR,
2150 .off1 = td_var_offset(mem_type),
2151 .help = "Backing type for IO buffers",
2153 .category = FIO_OPT_C_IO,
2154 .group = FIO_OPT_G_INVALID,
2158 .help = "Use malloc(3) for IO buffers",
2162 .help = "Use shared memory segments for IO buffers",
2164 #ifdef FIO_HAVE_HUGETLB
2165 { .ival = "shmhuge",
2166 .oval = MEM_SHMHUGE,
2167 .help = "Like shm, but use huge pages",
2172 .help = "Use mmap(2) (file or anon) for IO buffers",
2174 #ifdef FIO_HAVE_HUGETLB
2175 { .ival = "mmaphuge",
2176 .oval = MEM_MMAPHUGE,
2177 .help = "Like mmap, but use huge pages",
2183 .name = "iomem_align",
2184 .alias = "mem_align",
2185 .lname = "I/O memory alignment",
2186 .type = FIO_OPT_INT,
2187 .off1 = td_var_offset(mem_align),
2189 .help = "IO memory buffer offset alignment",
2193 .category = FIO_OPT_C_IO,
2194 .group = FIO_OPT_G_INVALID,
2199 .type = FIO_OPT_STR,
2200 .off1 = td_var_offset(verify),
2201 .help = "Verify data written",
2203 .category = FIO_OPT_C_IO,
2204 .group = FIO_OPT_G_VERIFY,
2207 .oval = VERIFY_NONE,
2208 .help = "Don't do IO verification",
2212 .help = "Use md5 checksums for verification",
2215 .oval = VERIFY_CRC64,
2216 .help = "Use crc64 checksums for verification",
2219 .oval = VERIFY_CRC32,
2220 .help = "Use crc32 checksums for verification",
2222 { .ival = "crc32c-intel",
2223 .oval = VERIFY_CRC32C,
2224 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2227 .oval = VERIFY_CRC32C,
2228 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2231 .oval = VERIFY_CRC16,
2232 .help = "Use crc16 checksums for verification",
2235 .oval = VERIFY_CRC7,
2236 .help = "Use crc7 checksums for verification",
2239 .oval = VERIFY_SHA1,
2240 .help = "Use sha1 checksums for verification",
2243 .oval = VERIFY_SHA256,
2244 .help = "Use sha256 checksums for verification",
2247 .oval = VERIFY_SHA512,
2248 .help = "Use sha512 checksums for verification",
2251 .oval = VERIFY_XXHASH,
2252 .help = "Use xxhash checksums for verification",
2255 .oval = VERIFY_META,
2256 .help = "Use io information",
2260 .oval = VERIFY_NULL,
2261 .help = "Pretend to verify",
2266 .name = "do_verify",
2267 .lname = "Perform verify step",
2268 .type = FIO_OPT_BOOL,
2269 .off1 = td_var_offset(do_verify),
2270 .help = "Run verification stage after write",
2274 .category = FIO_OPT_C_IO,
2275 .group = FIO_OPT_G_VERIFY,
2278 .name = "verifysort",
2279 .lname = "Verify sort",
2280 .type = FIO_OPT_BOOL,
2281 .off1 = td_var_offset(verifysort),
2282 .help = "Sort written verify blocks for read back",
2286 .category = FIO_OPT_C_IO,
2287 .group = FIO_OPT_G_VERIFY,
2290 .name = "verifysort_nr",
2291 .type = FIO_OPT_INT,
2292 .off1 = td_var_offset(verifysort_nr),
2293 .help = "Pre-load and sort verify blocks for a read workload",
2298 .category = FIO_OPT_C_IO,
2299 .group = FIO_OPT_G_VERIFY,
2302 .name = "verify_interval",
2303 .lname = "Verify interval",
2304 .type = FIO_OPT_INT,
2305 .off1 = td_var_offset(verify_interval),
2306 .minval = 2 * sizeof(struct verify_header),
2307 .help = "Store verify buffer header every N bytes",
2310 .interval = 2 * sizeof(struct verify_header),
2311 .category = FIO_OPT_C_IO,
2312 .group = FIO_OPT_G_VERIFY,
2315 .name = "verify_offset",
2316 .lname = "Verify offset",
2317 .type = FIO_OPT_INT,
2318 .help = "Offset verify header location by N bytes",
2319 .off1 = td_var_offset(verify_offset),
2320 .minval = sizeof(struct verify_header),
2323 .category = FIO_OPT_C_IO,
2324 .group = FIO_OPT_G_VERIFY,
2327 .name = "verify_pattern",
2328 .lname = "Verify pattern",
2329 .type = FIO_OPT_STR,
2330 .cb = str_verify_pattern_cb,
2331 .help = "Fill pattern for IO buffers",
2334 .category = FIO_OPT_C_IO,
2335 .group = FIO_OPT_G_VERIFY,
2338 .name = "verify_fatal",
2339 .lname = "Verify fatal",
2340 .type = FIO_OPT_BOOL,
2341 .off1 = td_var_offset(verify_fatal),
2343 .help = "Exit on a single verify failure, don't continue",
2346 .category = FIO_OPT_C_IO,
2347 .group = FIO_OPT_G_VERIFY,
2350 .name = "verify_dump",
2351 .lname = "Verify dump",
2352 .type = FIO_OPT_BOOL,
2353 .off1 = td_var_offset(verify_dump),
2355 .help = "Dump contents of good and bad blocks on failure",
2358 .category = FIO_OPT_C_IO,
2359 .group = FIO_OPT_G_VERIFY,
2362 .name = "verify_async",
2363 .lname = "Verify asynchronously",
2364 .type = FIO_OPT_INT,
2365 .off1 = td_var_offset(verify_async),
2367 .help = "Number of async verifier threads to use",
2370 .category = FIO_OPT_C_IO,
2371 .group = FIO_OPT_G_VERIFY,
2374 .name = "verify_backlog",
2375 .lname = "Verify backlog",
2376 .type = FIO_OPT_STR_VAL,
2377 .off1 = td_var_offset(verify_backlog),
2378 .help = "Verify after this number of blocks are written",
2381 .category = FIO_OPT_C_IO,
2382 .group = FIO_OPT_G_VERIFY,
2385 .name = "verify_backlog_batch",
2386 .lname = "Verify backlog batch",
2387 .type = FIO_OPT_INT,
2388 .off1 = td_var_offset(verify_batch),
2389 .help = "Verify this number of IO blocks",
2392 .category = FIO_OPT_C_IO,
2393 .group = FIO_OPT_G_VERIFY,
2395 #ifdef FIO_HAVE_CPU_AFFINITY
2397 .name = "verify_async_cpus",
2398 .lname = "Async verify CPUs",
2399 .type = FIO_OPT_STR,
2400 .cb = str_verify_cpus_allowed_cb,
2401 .help = "Set CPUs allowed for async verify threads",
2402 .parent = "verify_async",
2404 .category = FIO_OPT_C_IO,
2405 .group = FIO_OPT_G_VERIFY,
2409 .name = "experimental_verify",
2410 .off1 = td_var_offset(experimental_verify),
2411 .type = FIO_OPT_BOOL,
2412 .help = "Enable experimental verification",
2413 .category = FIO_OPT_C_IO,
2414 .group = FIO_OPT_G_VERIFY,
2416 #ifdef FIO_HAVE_TRIM
2418 .name = "trim_percentage",
2419 .lname = "Trim percentage",
2420 .type = FIO_OPT_INT,
2421 .off1 = td_var_offset(trim_percentage),
2424 .help = "Number of verify blocks to discard/trim",
2429 .category = FIO_OPT_C_IO,
2430 .group = FIO_OPT_G_TRIM,
2433 .name = "trim_verify_zero",
2434 .lname = "Verify trim zero",
2435 .type = FIO_OPT_BOOL,
2436 .help = "Verify that trim/discarded blocks are returned as zeroes",
2437 .off1 = td_var_offset(trim_zero),
2438 .parent = "trim_percentage",
2441 .category = FIO_OPT_C_IO,
2442 .group = FIO_OPT_G_TRIM,
2445 .name = "trim_backlog",
2446 .lname = "Trim backlog",
2447 .type = FIO_OPT_STR_VAL,
2448 .off1 = td_var_offset(trim_backlog),
2449 .help = "Trim after this number of blocks are written",
2450 .parent = "trim_percentage",
2453 .category = FIO_OPT_C_IO,
2454 .group = FIO_OPT_G_TRIM,
2457 .name = "trim_backlog_batch",
2458 .lname = "Trim backlog batch",
2459 .type = FIO_OPT_INT,
2460 .off1 = td_var_offset(trim_batch),
2461 .help = "Trim this number of IO blocks",
2462 .parent = "trim_percentage",
2465 .category = FIO_OPT_C_IO,
2466 .group = FIO_OPT_G_TRIM,
2470 .name = "write_iolog",
2471 .lname = "Write I/O log",
2472 .type = FIO_OPT_STR_STORE,
2473 .off1 = td_var_offset(write_iolog_file),
2474 .help = "Store IO pattern to file",
2475 .category = FIO_OPT_C_IO,
2476 .group = FIO_OPT_G_IOLOG,
2479 .name = "read_iolog",
2480 .lname = "Read I/O log",
2481 .type = FIO_OPT_STR_STORE,
2482 .off1 = td_var_offset(read_iolog_file),
2483 .help = "Playback IO pattern from file",
2484 .category = FIO_OPT_C_IO,
2485 .group = FIO_OPT_G_IOLOG,
2488 .name = "replay_no_stall",
2489 .lname = "Don't stall on replay",
2490 .type = FIO_OPT_BOOL,
2491 .off1 = td_var_offset(no_stall),
2493 .parent = "read_iolog",
2495 .help = "Playback IO pattern file as fast as possible without stalls",
2496 .category = FIO_OPT_C_IO,
2497 .group = FIO_OPT_G_IOLOG,
2500 .name = "replay_redirect",
2501 .lname = "Redirect device for replay",
2502 .type = FIO_OPT_STR_STORE,
2503 .off1 = td_var_offset(replay_redirect),
2504 .parent = "read_iolog",
2506 .help = "Replay all I/O onto this device, regardless of trace device",
2507 .category = FIO_OPT_C_IO,
2508 .group = FIO_OPT_G_IOLOG,
2511 .name = "exec_prerun",
2512 .lname = "Pre-execute runnable",
2513 .type = FIO_OPT_STR_STORE,
2514 .off1 = td_var_offset(exec_prerun),
2515 .help = "Execute this file prior to running job",
2516 .category = FIO_OPT_C_GENERAL,
2517 .group = FIO_OPT_G_INVALID,
2520 .name = "exec_postrun",
2521 .lname = "Post-execute runnable",
2522 .type = FIO_OPT_STR_STORE,
2523 .off1 = td_var_offset(exec_postrun),
2524 .help = "Execute this file after running job",
2525 .category = FIO_OPT_C_GENERAL,
2526 .group = FIO_OPT_G_INVALID,
2528 #ifdef FIO_HAVE_IOSCHED_SWITCH
2530 .name = "ioscheduler",
2531 .lname = "I/O scheduler",
2532 .type = FIO_OPT_STR_STORE,
2533 .off1 = td_var_offset(ioscheduler),
2534 .help = "Use this IO scheduler on the backing device",
2535 .category = FIO_OPT_C_FILE,
2536 .group = FIO_OPT_G_INVALID,
2541 .lname = "Zone size",
2542 .type = FIO_OPT_STR_VAL,
2543 .off1 = td_var_offset(zone_size),
2544 .help = "Amount of data to read per zone",
2546 .interval = 1024 * 1024,
2547 .category = FIO_OPT_C_IO,
2548 .group = FIO_OPT_G_ZONE,
2551 .name = "zonerange",
2552 .lname = "Zone range",
2553 .type = FIO_OPT_STR_VAL,
2554 .off1 = td_var_offset(zone_range),
2555 .help = "Give size of an IO zone",
2557 .interval = 1024 * 1024,
2558 .category = FIO_OPT_C_IO,
2559 .group = FIO_OPT_G_ZONE,
2563 .lname = "Zone skip",
2564 .type = FIO_OPT_STR_VAL,
2565 .off1 = td_var_offset(zone_skip),
2566 .help = "Space between IO zones",
2568 .interval = 1024 * 1024,
2569 .category = FIO_OPT_C_IO,
2570 .group = FIO_OPT_G_ZONE,
2574 .lname = "Lock memory",
2575 .type = FIO_OPT_STR_VAL,
2576 .off1 = td_var_offset(lockmem),
2577 .help = "Lock down this amount of memory (per worker)",
2579 .interval = 1024 * 1024,
2580 .category = FIO_OPT_C_GENERAL,
2581 .group = FIO_OPT_G_INVALID,
2584 .name = "rwmixread",
2585 .lname = "Read/write mix read",
2586 .type = FIO_OPT_INT,
2587 .cb = str_rwmix_read_cb,
2589 .help = "Percentage of mixed workload that is reads",
2592 .inverse = "rwmixwrite",
2593 .category = FIO_OPT_C_IO,
2594 .group = FIO_OPT_G_RWMIX,
2597 .name = "rwmixwrite",
2598 .lname = "Read/write mix write",
2599 .type = FIO_OPT_INT,
2600 .cb = str_rwmix_write_cb,
2602 .help = "Percentage of mixed workload that is writes",
2605 .inverse = "rwmixread",
2606 .category = FIO_OPT_C_IO,
2607 .group = FIO_OPT_G_RWMIX,
2610 .name = "rwmixcycle",
2611 .lname = "Read/write mix cycle",
2612 .type = FIO_OPT_DEPRECATED,
2613 .category = FIO_OPT_C_IO,
2614 .group = FIO_OPT_G_RWMIX,
2619 .type = FIO_OPT_INT,
2620 .off1 = td_var_offset(nice),
2621 .help = "Set job CPU nice value",
2626 .category = FIO_OPT_C_GENERAL,
2627 .group = FIO_OPT_G_CRED,
2629 #ifdef FIO_HAVE_IOPRIO
2632 .lname = "I/O nice priority",
2633 .type = FIO_OPT_INT,
2634 .off1 = td_var_offset(ioprio),
2635 .help = "Set job IO priority value",
2639 .category = FIO_OPT_C_GENERAL,
2640 .group = FIO_OPT_G_CRED,
2643 .name = "prioclass",
2644 .lname = "I/O nice priority class",
2645 .type = FIO_OPT_INT,
2646 .off1 = td_var_offset(ioprio_class),
2647 .help = "Set job IO priority class",
2651 .category = FIO_OPT_C_GENERAL,
2652 .group = FIO_OPT_G_CRED,
2656 .name = "thinktime",
2657 .lname = "Thinktime",
2658 .type = FIO_OPT_INT,
2659 .off1 = td_var_offset(thinktime),
2660 .help = "Idle time between IO buffers (usec)",
2662 .category = FIO_OPT_C_IO,
2663 .group = FIO_OPT_G_THINKTIME,
2666 .name = "thinktime_spin",
2667 .lname = "Thinktime spin",
2668 .type = FIO_OPT_INT,
2669 .off1 = td_var_offset(thinktime_spin),
2670 .help = "Start think time by spinning this amount (usec)",
2672 .parent = "thinktime",
2674 .category = FIO_OPT_C_IO,
2675 .group = FIO_OPT_G_THINKTIME,
2678 .name = "thinktime_blocks",
2679 .lname = "Thinktime blocks",
2680 .type = FIO_OPT_INT,
2681 .off1 = td_var_offset(thinktime_blocks),
2682 .help = "IO buffer period between 'thinktime'",
2684 .parent = "thinktime",
2686 .category = FIO_OPT_C_IO,
2687 .group = FIO_OPT_G_THINKTIME,
2691 .lname = "I/O rate",
2692 .type = FIO_OPT_INT,
2693 .off1 = td_var_offset(rate[DDIR_READ]),
2694 .off2 = td_var_offset(rate[DDIR_WRITE]),
2695 .off3 = td_var_offset(rate[DDIR_TRIM]),
2696 .help = "Set bandwidth rate",
2697 .category = FIO_OPT_C_IO,
2698 .group = FIO_OPT_G_RATE,
2702 .lname = "I/O min rate",
2703 .type = FIO_OPT_INT,
2704 .off1 = td_var_offset(ratemin[DDIR_READ]),
2705 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2706 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2707 .help = "Job must meet this rate or it will be shutdown",
2710 .category = FIO_OPT_C_IO,
2711 .group = FIO_OPT_G_RATE,
2714 .name = "rate_iops",
2715 .lname = "I/O rate IOPS",
2716 .type = FIO_OPT_INT,
2717 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2718 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2719 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2720 .help = "Limit IO used to this number of IO operations/sec",
2722 .category = FIO_OPT_C_IO,
2723 .group = FIO_OPT_G_RATE,
2726 .name = "rate_iops_min",
2727 .lname = "I/O min rate IOPS",
2728 .type = FIO_OPT_INT,
2729 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2730 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2731 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2732 .help = "Job must meet this rate or it will be shut down",
2733 .parent = "rate_iops",
2735 .category = FIO_OPT_C_IO,
2736 .group = FIO_OPT_G_RATE,
2739 .name = "ratecycle",
2740 .lname = "I/O rate cycle",
2741 .type = FIO_OPT_INT,
2742 .off1 = td_var_offset(ratecycle),
2743 .help = "Window average for rate limits (msec)",
2747 .category = FIO_OPT_C_IO,
2748 .group = FIO_OPT_G_RATE,
2751 .name = "max_latency",
2752 .type = FIO_OPT_INT,
2753 .off1 = td_var_offset(max_latency),
2754 .help = "Maximum tolerated IO latency (usec)",
2755 .category = FIO_OPT_C_IO,
2756 .group = FIO_OPT_G_LATPROF,
2759 .name = "latency_target",
2760 .lname = "Latency Target (usec)",
2761 .type = FIO_OPT_STR_VAL_TIME,
2762 .off1 = td_var_offset(latency_target),
2763 .help = "Ramp to max queue depth supporting this latency",
2764 .category = FIO_OPT_C_IO,
2765 .group = FIO_OPT_G_LATPROF,
2768 .name = "latency_window",
2769 .lname = "Latency Window (usec)",
2770 .type = FIO_OPT_STR_VAL_TIME,
2771 .off1 = td_var_offset(latency_window),
2772 .help = "Time to sustain latency_target",
2773 .category = FIO_OPT_C_IO,
2774 .group = FIO_OPT_G_LATPROF,
2777 .name = "latency_percentile",
2778 .lname = "Latency Percentile",
2779 .type = FIO_OPT_FLOAT_LIST,
2780 .off1 = td_var_offset(latency_percentile),
2781 .help = "Percentile of IOs must be below latency_target",
2786 .category = FIO_OPT_C_IO,
2787 .group = FIO_OPT_G_LATPROF,
2790 .name = "invalidate",
2791 .lname = "Cache invalidate",
2792 .type = FIO_OPT_BOOL,
2793 .off1 = td_var_offset(invalidate_cache),
2794 .help = "Invalidate buffer/page cache prior to running job",
2796 .category = FIO_OPT_C_IO,
2797 .group = FIO_OPT_G_IO_TYPE,
2801 .lname = "Synchronous I/O",
2802 .type = FIO_OPT_BOOL,
2803 .off1 = td_var_offset(sync_io),
2804 .help = "Use O_SYNC for buffered writes",
2806 .parent = "buffered",
2808 .category = FIO_OPT_C_IO,
2809 .group = FIO_OPT_G_IO_TYPE,
2812 .name = "create_serialize",
2813 .lname = "Create serialize",
2814 .type = FIO_OPT_BOOL,
2815 .off1 = td_var_offset(create_serialize),
2816 .help = "Serialize creating of job files",
2818 .category = FIO_OPT_C_FILE,
2819 .group = FIO_OPT_G_INVALID,
2822 .name = "create_fsync",
2823 .lname = "Create fsync",
2824 .type = FIO_OPT_BOOL,
2825 .off1 = td_var_offset(create_fsync),
2826 .help = "fsync file after creation",
2828 .category = FIO_OPT_C_FILE,
2829 .group = FIO_OPT_G_INVALID,
2832 .name = "create_on_open",
2833 .lname = "Create on open",
2834 .type = FIO_OPT_BOOL,
2835 .off1 = td_var_offset(create_on_open),
2836 .help = "Create files when they are opened for IO",
2838 .category = FIO_OPT_C_FILE,
2839 .group = FIO_OPT_G_INVALID,
2842 .name = "create_only",
2843 .type = FIO_OPT_BOOL,
2844 .off1 = td_var_offset(create_only),
2845 .help = "Only perform file creation phase",
2846 .category = FIO_OPT_C_FILE,
2851 .lname = "Pre-read files",
2852 .type = FIO_OPT_BOOL,
2853 .off1 = td_var_offset(pre_read),
2854 .help = "Pre-read files before starting official testing",
2856 .category = FIO_OPT_C_FILE,
2857 .group = FIO_OPT_G_INVALID,
2859 #ifdef FIO_HAVE_CPU_AFFINITY
2862 .lname = "CPU mask",
2863 .type = FIO_OPT_INT,
2864 .cb = str_cpumask_cb,
2865 .help = "CPU affinity mask",
2866 .category = FIO_OPT_C_GENERAL,
2867 .group = FIO_OPT_G_CRED,
2870 .name = "cpus_allowed",
2871 .lname = "CPUs allowed",
2872 .type = FIO_OPT_STR,
2873 .cb = str_cpus_allowed_cb,
2874 .help = "Set CPUs allowed",
2875 .category = FIO_OPT_C_GENERAL,
2876 .group = FIO_OPT_G_CRED,
2879 #ifdef CONFIG_LIBNUMA
2881 .name = "numa_cpu_nodes",
2882 .type = FIO_OPT_STR,
2883 .cb = str_numa_cpunodes_cb,
2884 .help = "NUMA CPU nodes bind",
2885 .category = FIO_OPT_C_GENERAL,
2886 .group = FIO_OPT_G_INVALID,
2889 .name = "numa_mem_policy",
2890 .type = FIO_OPT_STR,
2891 .cb = str_numa_mpol_cb,
2892 .help = "NUMA memory policy setup",
2893 .category = FIO_OPT_C_GENERAL,
2894 .group = FIO_OPT_G_INVALID,
2898 .name = "end_fsync",
2899 .lname = "End fsync",
2900 .type = FIO_OPT_BOOL,
2901 .off1 = td_var_offset(end_fsync),
2902 .help = "Include fsync at the end of job",
2904 .category = FIO_OPT_C_FILE,
2905 .group = FIO_OPT_G_INVALID,
2908 .name = "fsync_on_close",
2909 .lname = "Fsync on close",
2910 .type = FIO_OPT_BOOL,
2911 .off1 = td_var_offset(fsync_on_close),
2912 .help = "fsync files on close",
2914 .category = FIO_OPT_C_FILE,
2915 .group = FIO_OPT_G_INVALID,
2919 .lname = "Unlink file",
2920 .type = FIO_OPT_BOOL,
2921 .off1 = td_var_offset(unlink),
2922 .help = "Unlink created files after job has completed",
2924 .category = FIO_OPT_C_FILE,
2925 .group = FIO_OPT_G_INVALID,
2929 .lname = "Exit-all on terminate",
2930 .type = FIO_OPT_STR_SET,
2931 .cb = str_exitall_cb,
2932 .help = "Terminate all jobs when one exits",
2933 .category = FIO_OPT_C_GENERAL,
2934 .group = FIO_OPT_G_PROCESS,
2937 .name = "stonewall",
2938 .lname = "Wait for previous",
2939 .alias = "wait_for_previous",
2940 .type = FIO_OPT_STR_SET,
2941 .off1 = td_var_offset(stonewall),
2942 .help = "Insert a hard barrier between this job and previous",
2943 .category = FIO_OPT_C_GENERAL,
2944 .group = FIO_OPT_G_PROCESS,
2947 .name = "new_group",
2948 .lname = "New group",
2949 .type = FIO_OPT_STR_SET,
2950 .off1 = td_var_offset(new_group),
2951 .help = "Mark the start of a new group (for reporting)",
2952 .category = FIO_OPT_C_GENERAL,
2953 .group = FIO_OPT_G_PROCESS,
2958 .type = FIO_OPT_STR_SET,
2959 .off1 = td_var_offset(use_thread),
2960 .help = "Use threads instead of processes",
2961 .category = FIO_OPT_C_GENERAL,
2962 .group = FIO_OPT_G_PROCESS,
2965 .name = "write_bw_log",
2966 .lname = "Write bandwidth log",
2967 .type = FIO_OPT_STR_STORE,
2968 .off1 = td_var_offset(bw_log_file),
2969 .help = "Write log of bandwidth during run",
2970 .category = FIO_OPT_C_LOG,
2971 .group = FIO_OPT_G_INVALID,
2974 .name = "write_lat_log",
2975 .lname = "Write latency log",
2976 .type = FIO_OPT_STR_STORE,
2977 .off1 = td_var_offset(lat_log_file),
2978 .help = "Write log of latency during run",
2979 .category = FIO_OPT_C_LOG,
2980 .group = FIO_OPT_G_INVALID,
2983 .name = "write_iops_log",
2984 .lname = "Write IOPS log",
2985 .type = FIO_OPT_STR_STORE,
2986 .off1 = td_var_offset(iops_log_file),
2987 .help = "Write log of IOPS during run",
2988 .category = FIO_OPT_C_LOG,
2989 .group = FIO_OPT_G_INVALID,
2992 .name = "log_avg_msec",
2993 .lname = "Log averaging (msec)",
2994 .type = FIO_OPT_INT,
2995 .off1 = td_var_offset(log_avg_msec),
2996 .help = "Average bw/iops/lat logs over this period of time",
2998 .category = FIO_OPT_C_LOG,
2999 .group = FIO_OPT_G_INVALID,
3002 .name = "bwavgtime",
3003 .lname = "Bandwidth average time",
3004 .type = FIO_OPT_INT,
3005 .off1 = td_var_offset(bw_avg_time),
3006 .help = "Time window over which to calculate bandwidth"
3009 .parent = "write_bw_log",
3012 .category = FIO_OPT_C_LOG,
3013 .group = FIO_OPT_G_INVALID,
3016 .name = "iopsavgtime",
3017 .lname = "IOPS average time",
3018 .type = FIO_OPT_INT,
3019 .off1 = td_var_offset(iops_avg_time),
3020 .help = "Time window over which to calculate IOPS (msec)",
3022 .parent = "write_iops_log",
3025 .category = FIO_OPT_C_LOG,
3026 .group = FIO_OPT_G_INVALID,
3029 .name = "group_reporting",
3030 .lname = "Group reporting",
3031 .type = FIO_OPT_STR_SET,
3032 .off1 = td_var_offset(group_reporting),
3033 .help = "Do reporting on a per-group basis",
3034 .category = FIO_OPT_C_STAT,
3035 .group = FIO_OPT_G_INVALID,
3038 .name = "zero_buffers",
3039 .lname = "Zero I/O buffers",
3040 .type = FIO_OPT_STR_SET,
3041 .off1 = td_var_offset(zero_buffers),
3042 .help = "Init IO buffers to all zeroes",
3043 .category = FIO_OPT_C_IO,
3044 .group = FIO_OPT_G_IO_BUF,
3047 .name = "refill_buffers",
3048 .lname = "Refill I/O buffers",
3049 .type = FIO_OPT_STR_SET,
3050 .off1 = td_var_offset(refill_buffers),
3051 .help = "Refill IO buffers on every IO submit",
3052 .category = FIO_OPT_C_IO,
3053 .group = FIO_OPT_G_IO_BUF,
3056 .name = "scramble_buffers",
3057 .lname = "Scramble I/O buffers",
3058 .type = FIO_OPT_BOOL,
3059 .off1 = td_var_offset(scramble_buffers),
3060 .help = "Slightly scramble buffers on every IO submit",
3062 .category = FIO_OPT_C_IO,
3063 .group = FIO_OPT_G_IO_BUF,
3066 .name = "buffer_pattern",
3067 .lname = "Buffer pattern",
3068 .type = FIO_OPT_STR,
3069 .cb = str_buffer_pattern_cb,
3070 .help = "Fill pattern for IO buffers",
3071 .category = FIO_OPT_C_IO,
3072 .group = FIO_OPT_G_IO_BUF,
3075 .name = "buffer_compress_percentage",
3076 .lname = "Buffer compression percentage",
3077 .type = FIO_OPT_INT,
3078 .off1 = td_var_offset(compress_percentage),
3081 .help = "How compressible the buffer is (approximately)",
3083 .category = FIO_OPT_C_IO,
3084 .group = FIO_OPT_G_IO_BUF,
3087 .name = "buffer_compress_chunk",
3088 .lname = "Buffer compression chunk size",
3089 .type = FIO_OPT_INT,
3090 .off1 = td_var_offset(compress_chunk),
3091 .parent = "buffer_compress_percentage",
3093 .help = "Size of compressible region in buffer",
3095 .category = FIO_OPT_C_IO,
3096 .group = FIO_OPT_G_IO_BUF,
3099 .name = "clat_percentiles",
3100 .lname = "Completion latency percentiles",
3101 .type = FIO_OPT_BOOL,
3102 .off1 = td_var_offset(clat_percentiles),
3103 .help = "Enable the reporting of completion latency percentiles",
3105 .category = FIO_OPT_C_STAT,
3106 .group = FIO_OPT_G_INVALID,
3109 .name = "percentile_list",
3110 .lname = "Completion latency percentile list",
3111 .type = FIO_OPT_FLOAT_LIST,
3112 .off1 = td_var_offset(percentile_list),
3113 .off2 = td_var_offset(percentile_precision),
3114 .help = "Specify a custom list of percentiles to report",
3115 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3116 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3119 .category = FIO_OPT_C_STAT,
3120 .group = FIO_OPT_G_INVALID,
3123 #ifdef FIO_HAVE_DISK_UTIL
3125 .name = "disk_util",
3126 .lname = "Disk utilization",
3127 .type = FIO_OPT_BOOL,
3128 .off1 = td_var_offset(do_disk_util),
3129 .help = "Log disk utilization statistics",
3131 .category = FIO_OPT_C_STAT,
3132 .group = FIO_OPT_G_INVALID,
3136 .name = "gtod_reduce",
3137 .lname = "Reduce gettimeofday() calls",
3138 .type = FIO_OPT_BOOL,
3139 .help = "Greatly reduce number of gettimeofday() calls",
3140 .cb = str_gtod_reduce_cb,
3143 .category = FIO_OPT_C_STAT,
3144 .group = FIO_OPT_G_INVALID,
3147 .name = "disable_lat",
3148 .lname = "Disable all latency stats",
3149 .type = FIO_OPT_BOOL,
3150 .off1 = td_var_offset(disable_lat),
3151 .help = "Disable latency numbers",
3152 .parent = "gtod_reduce",
3155 .category = FIO_OPT_C_STAT,
3156 .group = FIO_OPT_G_INVALID,
3159 .name = "disable_clat",
3160 .lname = "Disable completion latency stats",
3161 .type = FIO_OPT_BOOL,
3162 .off1 = td_var_offset(disable_clat),
3163 .help = "Disable completion latency numbers",
3164 .parent = "gtod_reduce",
3167 .category = FIO_OPT_C_STAT,
3168 .group = FIO_OPT_G_INVALID,
3171 .name = "disable_slat",
3172 .lname = "Disable submission latency stats",
3173 .type = FIO_OPT_BOOL,
3174 .off1 = td_var_offset(disable_slat),
3175 .help = "Disable submission latency numbers",
3176 .parent = "gtod_reduce",
3179 .category = FIO_OPT_C_STAT,
3180 .group = FIO_OPT_G_INVALID,
3183 .name = "disable_bw_measurement",
3184 .lname = "Disable bandwidth stats",
3185 .type = FIO_OPT_BOOL,
3186 .off1 = td_var_offset(disable_bw),
3187 .help = "Disable bandwidth logging",
3188 .parent = "gtod_reduce",
3191 .category = FIO_OPT_C_STAT,
3192 .group = FIO_OPT_G_INVALID,
3196 .lname = "Dedicated gettimeofday() CPU",
3197 .type = FIO_OPT_INT,
3198 .cb = str_gtod_cpu_cb,
3199 .help = "Set up dedicated gettimeofday() thread on this CPU",
3200 .verify = gtod_cpu_verify,
3201 .category = FIO_OPT_C_GENERAL,
3202 .group = FIO_OPT_G_CLOCK,
3205 .name = "unified_rw_reporting",
3206 .type = FIO_OPT_BOOL,
3207 .off1 = td_var_offset(unified_rw_rep),
3208 .help = "Unify reporting across data direction",
3210 .category = FIO_OPT_C_GENERAL,
3211 .group = FIO_OPT_G_INVALID,
3214 .name = "continue_on_error",
3215 .lname = "Continue on error",
3216 .type = FIO_OPT_STR,
3217 .off1 = td_var_offset(continue_on_error),
3218 .help = "Continue on non-fatal errors during IO",
3220 .category = FIO_OPT_C_GENERAL,
3221 .group = FIO_OPT_G_ERR,
3224 .oval = ERROR_TYPE_NONE,
3225 .help = "Exit when an error is encountered",
3228 .oval = ERROR_TYPE_READ,
3229 .help = "Continue on read errors only",
3232 .oval = ERROR_TYPE_WRITE,
3233 .help = "Continue on write errors only",
3236 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3237 .help = "Continue on any IO errors",
3240 .oval = ERROR_TYPE_VERIFY,
3241 .help = "Continue on verify errors only",
3244 .oval = ERROR_TYPE_ANY,
3245 .help = "Continue on all io and verify errors",
3248 .oval = ERROR_TYPE_NONE,
3249 .help = "Alias for 'none'",
3252 .oval = ERROR_TYPE_ANY,
3253 .help = "Alias for 'all'",
3258 .name = "ignore_error",
3259 .type = FIO_OPT_STR,
3260 .cb = str_ignore_error_cb,
3261 .help = "Set a specific list of errors to ignore",
3263 .category = FIO_OPT_C_GENERAL,
3264 .group = FIO_OPT_G_ERR,
3267 .name = "error_dump",
3268 .type = FIO_OPT_BOOL,
3269 .off1 = td_var_offset(error_dump),
3271 .help = "Dump info on each error",
3272 .category = FIO_OPT_C_GENERAL,
3273 .group = FIO_OPT_G_ERR,
3278 .type = FIO_OPT_STR_STORE,
3279 .off1 = td_var_offset(profile),
3280 .help = "Select a specific builtin performance test",
3281 .category = FIO_OPT_C_PROFILE,
3282 .group = FIO_OPT_G_INVALID,
3287 .type = FIO_OPT_STR_STORE,
3288 .off1 = td_var_offset(cgroup),
3289 .help = "Add job to cgroup of this name",
3290 .category = FIO_OPT_C_GENERAL,
3291 .group = FIO_OPT_G_CGROUP,
3294 .name = "cgroup_nodelete",
3295 .lname = "Cgroup no-delete",
3296 .type = FIO_OPT_BOOL,
3297 .off1 = td_var_offset(cgroup_nodelete),
3298 .help = "Do not delete cgroups after job completion",
3301 .category = FIO_OPT_C_GENERAL,
3302 .group = FIO_OPT_G_CGROUP,
3305 .name = "cgroup_weight",
3306 .lname = "Cgroup weight",
3307 .type = FIO_OPT_INT,
3308 .off1 = td_var_offset(cgroup_weight),
3309 .help = "Use given weight for cgroup",
3313 .category = FIO_OPT_C_GENERAL,
3314 .group = FIO_OPT_G_CGROUP,
3319 .type = FIO_OPT_INT,
3320 .off1 = td_var_offset(uid),
3321 .help = "Run job with this user ID",
3322 .category = FIO_OPT_C_GENERAL,
3323 .group = FIO_OPT_G_CRED,
3327 .lname = "Group ID",
3328 .type = FIO_OPT_INT,
3329 .off1 = td_var_offset(gid),
3330 .help = "Run job with this group ID",
3331 .category = FIO_OPT_C_GENERAL,
3332 .group = FIO_OPT_G_CRED,
3337 .type = FIO_OPT_INT,
3338 .off1 = td_var_offset(kb_base),
3344 .help = "Use 1024 as the K base",
3348 .help = "Use 1000 as the K base",
3351 .help = "How many bytes per KB for reporting (1000 or 1024)",
3352 .category = FIO_OPT_C_GENERAL,
3353 .group = FIO_OPT_G_INVALID,
3356 .name = "unit_base",
3357 .lname = "Base unit for reporting (Bits or Bytes)",
3358 .type = FIO_OPT_INT,
3359 .off1 = td_var_offset(unit_base),
3364 .help = "Auto-detect",
3368 .help = "Normal (byte based)",
3372 .help = "Bit based",
3375 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3376 .category = FIO_OPT_C_GENERAL,
3377 .group = FIO_OPT_G_INVALID,
3380 .name = "hugepage-size",
3381 .lname = "Hugepage size",
3382 .type = FIO_OPT_INT,
3383 .off1 = td_var_offset(hugepage_size),
3384 .help = "When using hugepages, specify size of each page",
3385 .def = __fio_stringify(FIO_HUGE_PAGE),
3386 .interval = 1024 * 1024,
3387 .category = FIO_OPT_C_GENERAL,
3388 .group = FIO_OPT_G_INVALID,
3392 .lname = "I/O flow ID",
3393 .type = FIO_OPT_INT,
3394 .off1 = td_var_offset(flow_id),
3395 .help = "The flow index ID to use",
3397 .category = FIO_OPT_C_IO,
3398 .group = FIO_OPT_G_IO_FLOW,
3402 .lname = "I/O flow weight",
3403 .type = FIO_OPT_INT,
3404 .off1 = td_var_offset(flow),
3405 .help = "Weight for flow control of this job",
3406 .parent = "flow_id",
3409 .category = FIO_OPT_C_IO,
3410 .group = FIO_OPT_G_IO_FLOW,
3413 .name = "flow_watermark",
3414 .lname = "I/O flow watermark",
3415 .type = FIO_OPT_INT,
3416 .off1 = td_var_offset(flow_watermark),
3417 .help = "High watermark for flow control. This option"
3418 " should be set to the same value for all threads"
3419 " with non-zero flow.",
3420 .parent = "flow_id",
3423 .category = FIO_OPT_C_IO,
3424 .group = FIO_OPT_G_IO_FLOW,
3427 .name = "flow_sleep",
3428 .lname = "I/O flow sleep",
3429 .type = FIO_OPT_INT,
3430 .off1 = td_var_offset(flow_sleep),
3431 .help = "How many microseconds to sleep after being held"
3432 " back by the flow control mechanism",
3433 .parent = "flow_id",
3436 .category = FIO_OPT_C_IO,
3437 .group = FIO_OPT_G_IO_FLOW,
3444 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3445 const char *name, int val)
3447 lopt->name = (char *) name;
3449 if (o->type == FIO_OPT_STR_SET)
3450 lopt->has_arg = optional_argument;
3452 lopt->has_arg = required_argument;
3455 static void options_to_lopts(struct fio_option *opts,
3456 struct option *long_options,
3457 int i, int option_type)
3459 struct fio_option *o = &opts[0];
3461 add_to_lopt(&long_options[i], o, o->name, option_type);
3464 add_to_lopt(&long_options[i], o, o->alias, option_type);
3469 assert(i < FIO_NR_OPTIONS);
3473 void fio_options_set_ioengine_opts(struct option *long_options,
3474 struct thread_data *td)
3479 while (long_options[i].name) {
3480 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3481 memset(&long_options[i], 0, sizeof(*long_options));
3488 * Just clear out the prior ioengine options.
3493 options_to_lopts(td->io_ops->options, long_options, i,
3494 FIO_GETOPT_IOENGINE);
3497 void fio_options_dup_and_init(struct option *long_options)
3501 options_init(fio_options);
3504 while (long_options[i].name)
3507 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3510 struct fio_keyword {
3516 static struct fio_keyword fio_keywords[] = {
3518 .word = "$pagesize",
3519 .desc = "Page size in the system",
3522 .word = "$mb_memory",
3523 .desc = "Megabytes of memory online",
3527 .desc = "Number of CPUs online in the system",
3534 void fio_keywords_init(void)
3536 unsigned long long mb_memory;
3540 sprintf(buf, "%lu", (unsigned long) page_size);
3541 fio_keywords[0].replace = strdup(buf);
3543 mb_memory = os_phys_mem() / (1024 * 1024);
3544 sprintf(buf, "%llu", mb_memory);
3545 fio_keywords[1].replace = strdup(buf);
3548 sprintf(buf, "%lu", l);
3549 fio_keywords[2].replace = strdup(buf);
3554 static char *bc_calc(char *str)
3556 char buf[128], *tmp;
3561 * No math, just return string
3563 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3564 !strchr(str, '/')) || strchr(str, '\''))
3568 * Split option from value, we only need to calculate the value
3570 tmp = strchr(str, '=');
3577 * Prevent buffer overflows; such a case isn't reasonable anyway
3579 if (strlen(str) >= 128 || strlen(tmp) > 100)
3582 sprintf(buf, "which %s > /dev/null", BC_APP);
3584 log_err("fio: bc is needed for performing math\n");
3588 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3589 f = popen(buf, "r");
3593 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3598 buf[(tmp - str) + ret - 1] = '\0';
3599 memcpy(buf, str, tmp - str);
3605 * Return a copy of the input string with substrings of the form ${VARNAME}
3606 * substituted with the value of the environment variable VARNAME. The
3607 * substitution always occurs, even if VARNAME is empty or the corresponding
3608 * environment variable undefined.
3610 static char *option_dup_subs(const char *opt)
3612 char out[OPT_LEN_MAX+1];
3613 char in[OPT_LEN_MAX+1];
3616 char *ch1, *ch2, *env;
3617 ssize_t nchr = OPT_LEN_MAX;
3620 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3621 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3625 in[OPT_LEN_MAX] = '\0';
3626 strncpy(in, opt, OPT_LEN_MAX);
3628 while (*inptr && nchr > 0) {
3629 if (inptr[0] == '$' && inptr[1] == '{') {
3630 ch2 = strchr(inptr, '}');
3631 if (ch2 && inptr+1 < ch2) {
3638 envlen = strlen(env);
3639 if (envlen <= nchr) {
3640 memcpy(outptr, env, envlen);
3650 *outptr++ = *inptr++;
3659 * Look for reserved variable names and replace them with real values
3661 static char *fio_keyword_replace(char *opt)
3667 for (i = 0; fio_keywords[i].word != NULL; i++) {
3668 struct fio_keyword *kw = &fio_keywords[i];
3670 while ((s = strstr(opt, kw->word)) != NULL) {
3671 char *new = malloc(strlen(opt) + 1);
3677 * Copy part of the string before the keyword and
3678 * sprintf() the replacement after it.
3680 memcpy(new, opt, olen);
3681 len = sprintf(new + olen, "%s", kw->replace);
3684 * If there's more in the original string, copy that
3687 opt += strlen(kw->word) + olen;
3689 memcpy(new + olen + len, opt, opt - o_org - 1);
3692 * replace opt and free the old opt
3702 * Check for potential math and invoke bc, if possible
3710 static char **dup_and_sub_options(char **opts, int num_opts)
3713 char **opts_copy = malloc(num_opts * sizeof(*opts));
3714 for (i = 0; i < num_opts; i++) {
3715 opts_copy[i] = option_dup_subs(opts[i]);
3718 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3723 int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3726 int i, ret, unknown;
3729 sort_options(opts, fio_options, num_opts);
3730 opts_copy = dup_and_sub_options(opts, num_opts);
3732 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3733 struct fio_option *o;
3734 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3735 &o, td, dump_cmdline);
3743 opts_copy[i] = NULL;
3750 ret |= ioengine_load(td);
3752 sort_options(opts_copy, td->io_ops->options, num_opts);
3755 for (i = 0; i < num_opts; i++) {
3756 struct fio_option *o = NULL;
3762 newret = parse_option(opts_copy[i], opts[i],
3763 td->io_ops->options, &o,
3764 td->eo, dump_cmdline);
3768 log_err("Bad option <%s>\n", opts[i]);
3771 opts_copy[i] = NULL;
3779 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3781 return parse_cmd_option(opt, val, fio_options, td);
3784 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3787 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
3790 void fio_fill_default_options(struct thread_data *td)
3792 td->o.magic = OPT_MAGIC;
3793 fill_default_options(td, fio_options);
3796 int fio_show_option_help(const char *opt)
3798 return show_cmd_help(fio_options, opt);
3801 void options_mem_dupe(void *data, struct fio_option *options)
3803 struct fio_option *o;
3806 for (o = &options[0]; o->name; o++) {
3807 if (o->type != FIO_OPT_STR_STORE)
3810 ptr = td_var(data, o, o->off1);
3812 *ptr = strdup(*ptr);
3817 * dupe FIO_OPT_STR_STORE options
3819 void fio_options_mem_dupe(struct thread_data *td)
3821 options_mem_dupe(&td->o, fio_options);
3823 if (td->eo && td->io_ops) {
3824 void *oldeo = td->eo;
3826 td->eo = malloc(td->io_ops->option_struct_size);
3827 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3828 options_mem_dupe(td->eo, td->io_ops->options);
3832 unsigned int fio_get_kb_base(void *data)
3834 struct thread_options *o = data;
3835 unsigned int kb_base = 0;
3838 * This is a hack... For private options, *data is not holding
3839 * a pointer to the thread_options, but to private data. This means
3840 * we can't safely dereference it, but magic is first so mem wise
3841 * it is valid. But this also means that if the job first sets
3842 * kb_base and expects that to be honored by private options,
3843 * it will be disappointed. We will return the global default
3846 if (o && o->magic == OPT_MAGIC)
3847 kb_base = o->kb_base;
3854 int add_option(struct fio_option *o)
3856 struct fio_option *__o;
3865 if (opt_index + 1 == FIO_MAX_OPTS) {
3866 log_err("fio: FIO_MAX_OPTS is too small\n");
3870 memcpy(&fio_options[opt_index], o, sizeof(*o));
3871 fio_options[opt_index + 1].name = NULL;
3875 void invalidate_profile_options(const char *prof_name)
3877 struct fio_option *o;
3881 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3882 o->type = FIO_OPT_INVALID;
3883 o->prof_name = NULL;
3889 void add_opt_posval(const char *optname, const char *ival, const char *help)
3891 struct fio_option *o;
3894 o = find_option(fio_options, optname);
3898 for (i = 0; i < PARSE_MAX_VP; i++) {
3899 if (o->posval[i].ival)
3902 o->posval[i].ival = ival;
3903 o->posval[i].help = help;
3908 void del_opt_posval(const char *optname, const char *ival)
3910 struct fio_option *o;
3913 o = find_option(fio_options, optname);
3917 for (i = 0; i < PARSE_MAX_VP; i++) {
3918 if (!o->posval[i].ival)
3920 if (strcmp(o->posval[i].ival, ival))
3923 o->posval[i].ival = NULL;
3924 o->posval[i].help = NULL;
3928 void fio_options_free(struct thread_data *td)
3930 options_free(fio_options, td);
3931 if (td->eo && td->io_ops && td->io_ops->options) {
3932 options_free(td->io_ops->options, td->eo);
3938 struct fio_option *fio_option_find(const char *name)
3940 return find_option(fio_options, name);