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 file 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_file_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);
777 static int str_filename_cb(void *data, const char *input)
779 struct thread_data *td = data;
780 char *fname, *str, *p;
782 p = str = strdup(input);
784 strip_blank_front(&str);
785 strip_blank_end(str);
787 if (!td->files_index)
790 while ((fname = get_next_file_name(&str)) != NULL) {
801 static int str_directory_cb(void *data, const char fio_unused *str)
803 struct thread_data *td = data;
809 if (lstat(td->o.directory, &sb) < 0) {
812 log_err("fio: %s is not a directory\n", td->o.directory);
813 td_verror(td, ret, "lstat");
816 if (!S_ISDIR(sb.st_mode)) {
817 log_err("fio: %s is not a directory\n", td->o.directory);
824 static int str_opendir_cb(void *data, const char fio_unused *str)
826 struct thread_data *td = data;
831 if (!td->files_index)
834 return add_dir_files(td, td->o.opendir);
837 static int pattern_cb(char *pattern, unsigned int max_size,
838 const char *input, unsigned int *pattern_bytes)
841 int i = 0, j = 0, len, k, base = 10;
842 uint32_t pattern_length;
845 loc1 = strstr(input, "0x");
846 loc2 = strstr(input, "0X");
849 off = strtol(input, NULL, base);
850 if (off != LONG_MAX || errno != ERANGE) {
852 pattern[i] = off & 0xff;
861 j = loc1 - input + 2;
863 j = loc2 - input + 2;
866 if (len - j < max_size * 2) {
868 off = converthexchartoint(input[k--]);
870 off += (converthexchartoint(input[k--])
872 pattern[i++] = (char) off;
878 * Fill the pattern all the way to the end. This greatly reduces
879 * the number of memcpy's we have to do when verifying the IO.
882 while (i > 1 && i * 2 <= max_size) {
883 memcpy(&pattern[i], &pattern[0], i);
888 * Fill remainder, if the pattern multiple ends up not being
891 while (i > 1 && i < max_size) {
892 unsigned int b = min(pattern_length, max_size - i);
894 memcpy(&pattern[i], &pattern[0], b);
900 * The code in verify_io_u_pattern assumes a single byte pattern
901 * fills the whole verify pattern buffer.
903 memset(pattern, pattern[0], max_size);
910 static int str_buffer_pattern_cb(void *data, const char *input)
912 struct thread_data *td = data;
915 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
916 &td->o.buffer_pattern_bytes);
919 td->o.refill_buffers = 0;
920 td->o.scramble_buffers = 0;
921 td->o.zero_buffers = 0;
927 static int str_verify_pattern_cb(void *data, const char *input)
929 struct thread_data *td = data;
932 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
933 &td->o.verify_pattern_bytes);
936 * VERIFY_META could already be set
938 if (!ret && td->o.verify == VERIFY_NONE)
939 td->o.verify = VERIFY_PATTERN;
944 static int str_gtod_reduce_cb(void *data, int *il)
946 struct thread_data *td = data;
949 td->o.disable_lat = !!val;
950 td->o.disable_clat = !!val;
951 td->o.disable_slat = !!val;
952 td->o.disable_bw = !!val;
953 td->o.clat_percentiles = !val;
955 td->tv_cache_mask = 63;
960 static int str_gtod_cpu_cb(void *data, long long *il)
962 struct thread_data *td = data;
965 td->o.gtod_cpu = val;
966 td->o.gtod_offload = 1;
970 static int str_size_cb(void *data, unsigned long long *__val)
972 struct thread_data *td = data;
973 unsigned long long v = *__val;
975 if (parse_is_percent(v)) {
977 td->o.size_percent = -1ULL - v;
984 static int rw_verify(struct fio_option *o, void *data)
986 struct thread_data *td = data;
988 if (read_only && td_write(td)) {
989 log_err("fio: job <%s> has write bit set, but fio is in"
990 " read-only mode\n", td->o.name);
997 static int gtod_cpu_verify(struct fio_option *o, void *data)
999 #ifndef FIO_HAVE_CPU_AFFINITY
1000 struct thread_data *td = data;
1002 if (td->o.gtod_cpu) {
1003 log_err("fio: platform must support CPU affinity for"
1004 "gettimeofday() offloading\n");
1015 static struct opt_group fio_opt_groups[] = {
1018 .mask = FIO_OPT_C_GENERAL,
1022 .mask = FIO_OPT_C_IO,
1026 .mask = FIO_OPT_C_FILE,
1029 .name = "Statistics",
1030 .mask = FIO_OPT_C_STAT,
1034 .mask = FIO_OPT_C_LOG,
1038 .mask = FIO_OPT_C_PROFILE,
1045 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1046 unsigned int inv_mask)
1048 struct opt_group *og;
1051 if (*mask == inv_mask || !*mask)
1054 for (i = 0; ogs[i].name; i++) {
1057 if (*mask & og->mask) {
1058 *mask &= ~(og->mask);
1066 struct opt_group *opt_group_from_mask(unsigned int *mask)
1068 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1071 static struct opt_group fio_opt_cat_groups[] = {
1073 .name = "Latency profiling",
1074 .mask = FIO_OPT_G_LATPROF,
1078 .mask = FIO_OPT_G_RATE,
1082 .mask = FIO_OPT_G_ZONE,
1085 .name = "Read/write mix",
1086 .mask = FIO_OPT_G_RWMIX,
1090 .mask = FIO_OPT_G_VERIFY,
1094 .mask = FIO_OPT_G_TRIM,
1097 .name = "I/O Logging",
1098 .mask = FIO_OPT_G_IOLOG,
1101 .name = "I/O Depth",
1102 .mask = FIO_OPT_G_IO_DEPTH,
1106 .mask = FIO_OPT_G_IO_FLOW,
1109 .name = "Description",
1110 .mask = FIO_OPT_G_DESC,
1114 .mask = FIO_OPT_G_FILENAME,
1117 .name = "General I/O",
1118 .mask = FIO_OPT_G_IO_BASIC,
1122 .mask = FIO_OPT_G_CGROUP,
1126 .mask = FIO_OPT_G_RUNTIME,
1130 .mask = FIO_OPT_G_PROCESS,
1133 .name = "Job credentials / priority",
1134 .mask = FIO_OPT_G_CRED,
1137 .name = "Clock settings",
1138 .mask = FIO_OPT_G_CLOCK,
1142 .mask = FIO_OPT_G_IO_TYPE,
1145 .name = "I/O Thinktime",
1146 .mask = FIO_OPT_G_THINKTIME,
1149 .name = "Randomizations",
1150 .mask = FIO_OPT_G_RANDOM,
1153 .name = "I/O buffers",
1154 .mask = FIO_OPT_G_IO_BUF,
1157 .name = "Tiobench profile",
1158 .mask = FIO_OPT_G_TIOBENCH,
1166 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1168 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1172 * Map of job/command line options
1174 struct fio_option fio_options[FIO_MAX_OPTS] = {
1176 .name = "description",
1177 .lname = "Description of job",
1178 .type = FIO_OPT_STR_STORE,
1179 .off1 = td_var_offset(description),
1180 .help = "Text job description",
1181 .category = FIO_OPT_C_GENERAL,
1182 .group = FIO_OPT_G_DESC,
1186 .lname = "Job name",
1187 .type = FIO_OPT_STR_STORE,
1188 .off1 = td_var_offset(name),
1189 .help = "Name of this job",
1190 .category = FIO_OPT_C_GENERAL,
1191 .group = FIO_OPT_G_DESC,
1195 .lname = "Filename(s)",
1196 .type = FIO_OPT_STR_STORE,
1197 .off1 = td_var_offset(filename),
1198 .cb = str_filename_cb,
1199 .prio = -1, /* must come after "directory" */
1200 .help = "File(s) to use for the workload",
1201 .category = FIO_OPT_C_FILE,
1202 .group = FIO_OPT_G_FILENAME,
1205 .name = "directory",
1206 .lname = "Directory",
1207 .type = FIO_OPT_STR_STORE,
1208 .off1 = td_var_offset(directory),
1209 .cb = str_directory_cb,
1210 .help = "Directory to store files in",
1211 .category = FIO_OPT_C_FILE,
1212 .group = FIO_OPT_G_FILENAME,
1215 .name = "filename_format",
1216 .type = FIO_OPT_STR_STORE,
1217 .off1 = td_var_offset(filename_format),
1218 .prio = -1, /* must come after "directory" */
1219 .help = "Override default $jobname.$jobnum.$filenum naming",
1220 .def = "$jobname.$jobnum.$filenum",
1221 .category = FIO_OPT_C_FILE,
1222 .group = FIO_OPT_G_FILENAME,
1226 .lname = "Lockfile",
1227 .type = FIO_OPT_STR,
1228 .off1 = td_var_offset(file_lock_mode),
1229 .help = "Lock file when doing IO to it",
1230 .parent = "filename",
1233 .category = FIO_OPT_C_FILE,
1234 .group = FIO_OPT_G_FILENAME,
1237 .oval = FILE_LOCK_NONE,
1238 .help = "No file locking",
1240 { .ival = "exclusive",
1241 .oval = FILE_LOCK_EXCLUSIVE,
1242 .help = "Exclusive file lock",
1245 .ival = "readwrite",
1246 .oval = FILE_LOCK_READWRITE,
1247 .help = "Read vs write lock",
1253 .lname = "Open directory",
1254 .type = FIO_OPT_STR_STORE,
1255 .off1 = td_var_offset(opendir),
1256 .cb = str_opendir_cb,
1257 .help = "Recursively add files from this directory and down",
1258 .category = FIO_OPT_C_FILE,
1259 .group = FIO_OPT_G_FILENAME,
1263 .lname = "Read/write",
1264 .alias = "readwrite",
1265 .type = FIO_OPT_STR,
1267 .off1 = td_var_offset(td_ddir),
1268 .help = "IO direction",
1270 .verify = rw_verify,
1271 .category = FIO_OPT_C_IO,
1272 .group = FIO_OPT_G_IO_BASIC,
1275 .oval = TD_DDIR_READ,
1276 .help = "Sequential read",
1279 .oval = TD_DDIR_WRITE,
1280 .help = "Sequential write",
1283 .oval = TD_DDIR_TRIM,
1284 .help = "Sequential trim",
1286 { .ival = "randread",
1287 .oval = TD_DDIR_RANDREAD,
1288 .help = "Random read",
1290 { .ival = "randwrite",
1291 .oval = TD_DDIR_RANDWRITE,
1292 .help = "Random write",
1294 { .ival = "randtrim",
1295 .oval = TD_DDIR_RANDTRIM,
1296 .help = "Random trim",
1300 .help = "Sequential read and write mix",
1302 { .ival = "readwrite",
1304 .help = "Sequential read and write mix",
1307 .oval = TD_DDIR_RANDRW,
1308 .help = "Random read and write mix"
1313 .name = "rw_sequencer",
1314 .lname = "RW Sequencer",
1315 .type = FIO_OPT_STR,
1316 .off1 = td_var_offset(rw_seq),
1317 .help = "IO offset generator modifier",
1318 .def = "sequential",
1319 .category = FIO_OPT_C_IO,
1320 .group = FIO_OPT_G_IO_BASIC,
1322 { .ival = "sequential",
1324 .help = "Generate sequential offsets",
1326 { .ival = "identical",
1327 .oval = RW_SEQ_IDENT,
1328 .help = "Generate identical offsets",
1335 .lname = "IO Engine",
1336 .type = FIO_OPT_STR_STORE,
1337 .off1 = td_var_offset(ioengine),
1338 .help = "IO engine to use",
1339 .def = FIO_PREFERRED_ENGINE,
1340 .category = FIO_OPT_C_IO,
1341 .group = FIO_OPT_G_IO_BASIC,
1344 .help = "Use read/write",
1347 .help = "Use pread/pwrite",
1350 .help = "Use readv/writev",
1352 #ifdef CONFIG_PWRITEV
1354 .help = "Use preadv/pwritev",
1357 #ifdef CONFIG_LIBAIO
1359 .help = "Linux native asynchronous IO",
1362 #ifdef CONFIG_POSIXAIO
1363 { .ival = "posixaio",
1364 .help = "POSIX asynchronous IO",
1367 #ifdef CONFIG_SOLARISAIO
1368 { .ival = "solarisaio",
1369 .help = "Solaris native asynchronous IO",
1372 #ifdef CONFIG_WINDOWSAIO
1373 { .ival = "windowsaio",
1374 .help = "Windows native asynchronous IO"
1378 .help = "Memory mapped IO"
1380 #ifdef CONFIG_LINUX_SPLICE
1382 .help = "splice/vmsplice based IO",
1384 { .ival = "netsplice",
1385 .help = "splice/vmsplice to/from the network",
1388 #ifdef FIO_HAVE_SGIO
1390 .help = "SCSI generic v3 IO",
1394 .help = "Testing engine (no data transfer)",
1397 .help = "Network IO",
1400 .help = "CPU cycle burner engine",
1404 .help = "GUASI IO engine",
1407 #ifdef FIO_HAVE_BINJECT
1408 { .ival = "binject",
1409 .help = "binject direct inject block engine",
1414 .help = "RDMA IO engine",
1417 #ifdef CONFIG_FUSION_AW
1418 { .ival = "fusion-aw-sync",
1419 .help = "Fusion-io atomic write engine",
1422 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1423 { .ival = "e4defrag",
1424 .help = "ext4 defrag engine",
1427 #ifdef CONFIG_LINUX_FALLOCATE
1429 .help = "fallocate() file based engine",
1432 { .ival = "external",
1433 .help = "Load external engine (append name)",
1439 .lname = "IO Depth",
1440 .type = FIO_OPT_INT,
1441 .off1 = td_var_offset(iodepth),
1442 .help = "Number of IO buffers to keep in flight",
1446 .category = FIO_OPT_C_IO,
1447 .group = FIO_OPT_G_IO_BASIC,
1450 .name = "iodepth_batch",
1451 .lname = "IO Depth batch",
1452 .alias = "iodepth_batch_submit",
1453 .type = FIO_OPT_INT,
1454 .off1 = td_var_offset(iodepth_batch),
1455 .help = "Number of IO buffers to submit in one go",
1456 .parent = "iodepth",
1461 .category = FIO_OPT_C_IO,
1462 .group = FIO_OPT_G_IO_BASIC,
1465 .name = "iodepth_batch_complete",
1466 .lname = "IO Depth batch complete",
1467 .type = FIO_OPT_INT,
1468 .off1 = td_var_offset(iodepth_batch_complete),
1469 .help = "Number of IO buffers to retrieve in one go",
1470 .parent = "iodepth",
1475 .category = FIO_OPT_C_IO,
1476 .group = FIO_OPT_G_IO_BASIC,
1479 .name = "iodepth_low",
1480 .lname = "IO Depth batch low",
1481 .type = FIO_OPT_INT,
1482 .off1 = td_var_offset(iodepth_low),
1483 .help = "Low water mark for queuing depth",
1484 .parent = "iodepth",
1487 .category = FIO_OPT_C_IO,
1488 .group = FIO_OPT_G_IO_BASIC,
1493 .type = FIO_OPT_STR_VAL,
1495 .help = "Total size of device or files",
1496 .interval = 1024 * 1024,
1497 .category = FIO_OPT_C_IO,
1498 .group = FIO_OPT_G_INVALID,
1501 .name = "fill_device",
1502 .lname = "Fill device",
1504 .type = FIO_OPT_BOOL,
1505 .off1 = td_var_offset(fill_device),
1506 .help = "Write until an ENOSPC error occurs",
1508 .category = FIO_OPT_C_FILE,
1509 .group = FIO_OPT_G_INVALID,
1513 .lname = "File size",
1514 .type = FIO_OPT_STR_VAL,
1515 .off1 = td_var_offset(file_size_low),
1516 .off2 = td_var_offset(file_size_high),
1518 .help = "Size of individual files",
1519 .interval = 1024 * 1024,
1520 .category = FIO_OPT_C_FILE,
1521 .group = FIO_OPT_G_INVALID,
1525 .lname = "IO offset",
1526 .alias = "fileoffset",
1527 .type = FIO_OPT_STR_VAL,
1528 .off1 = td_var_offset(start_offset),
1529 .help = "Start IO from this offset",
1531 .interval = 1024 * 1024,
1532 .category = FIO_OPT_C_IO,
1533 .group = FIO_OPT_G_INVALID,
1536 .name = "offset_increment",
1537 .lname = "IO offset increment",
1538 .type = FIO_OPT_STR_VAL,
1539 .off1 = td_var_offset(offset_increment),
1540 .help = "What is the increment from one offset to the next",
1544 .interval = 1024 * 1024,
1545 .category = FIO_OPT_C_IO,
1546 .group = FIO_OPT_G_INVALID,
1549 .name = "number_ios",
1550 .lname = "Number of IOs to perform",
1551 .type = FIO_OPT_STR_VAL,
1552 .off1 = td_var_offset(number_ios),
1553 .help = "Force job completion of this number of IOs",
1555 .category = FIO_OPT_C_IO,
1556 .group = FIO_OPT_G_INVALID,
1560 .lname = "Block size",
1561 .alias = "blocksize",
1562 .type = FIO_OPT_INT,
1563 .off1 = td_var_offset(bs[DDIR_READ]),
1564 .off2 = td_var_offset(bs[DDIR_WRITE]),
1565 .off3 = td_var_offset(bs[DDIR_TRIM]),
1567 .help = "Block size unit",
1572 .category = FIO_OPT_C_IO,
1573 .group = FIO_OPT_G_INVALID,
1577 .lname = "Block size align",
1578 .alias = "blockalign",
1579 .type = FIO_OPT_INT,
1580 .off1 = td_var_offset(ba[DDIR_READ]),
1581 .off2 = td_var_offset(ba[DDIR_WRITE]),
1582 .off3 = td_var_offset(ba[DDIR_TRIM]),
1584 .help = "IO block offset alignment",
1588 .category = FIO_OPT_C_IO,
1589 .group = FIO_OPT_G_INVALID,
1593 .lname = "Block size range",
1594 .alias = "blocksize_range",
1595 .type = FIO_OPT_RANGE,
1596 .off1 = td_var_offset(min_bs[DDIR_READ]),
1597 .off2 = td_var_offset(max_bs[DDIR_READ]),
1598 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1599 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1600 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1601 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1603 .help = "Set block size range (in more detail than bs)",
1607 .category = FIO_OPT_C_IO,
1608 .group = FIO_OPT_G_INVALID,
1612 .lname = "Block size split",
1613 .type = FIO_OPT_STR,
1614 .cb = str_bssplit_cb,
1615 .help = "Set a specific mix of block sizes",
1618 .category = FIO_OPT_C_IO,
1619 .group = FIO_OPT_G_INVALID,
1622 .name = "bs_unaligned",
1623 .lname = "Block size unaligned",
1624 .alias = "blocksize_unaligned",
1625 .type = FIO_OPT_STR_SET,
1626 .off1 = td_var_offset(bs_unaligned),
1627 .help = "Don't sector align IO buffer sizes",
1630 .category = FIO_OPT_C_IO,
1631 .group = FIO_OPT_G_INVALID,
1634 .name = "bs_is_seq_rand",
1635 .lname = "Block size division is seq/random (not read/write)",
1636 .type = FIO_OPT_BOOL,
1637 .off1 = td_var_offset(bs_is_seq_rand),
1638 .help = "Consider any blocksize setting to be sequential,ramdom",
1640 .parent = "blocksize",
1641 .category = FIO_OPT_C_IO,
1642 .group = FIO_OPT_G_INVALID,
1645 .name = "randrepeat",
1646 .lname = "Random repeatable",
1647 .type = FIO_OPT_BOOL,
1648 .off1 = td_var_offset(rand_repeatable),
1649 .help = "Use repeatable random IO pattern",
1653 .category = FIO_OPT_C_IO,
1654 .group = FIO_OPT_G_RANDOM,
1658 .lname = "The random generator seed",
1659 .type = FIO_OPT_INT,
1660 .off1 = td_var_offset(rand_seed),
1661 .help = "Set the random generator seed value",
1663 .category = FIO_OPT_C_IO,
1664 .group = FIO_OPT_G_RANDOM,
1667 .name = "use_os_rand",
1668 .lname = "Use OS random",
1669 .type = FIO_OPT_BOOL,
1670 .off1 = td_var_offset(use_os_rand),
1671 .help = "Set to use OS random generator",
1675 .category = FIO_OPT_C_IO,
1676 .group = FIO_OPT_G_RANDOM,
1679 .name = "norandommap",
1680 .lname = "No randommap",
1681 .type = FIO_OPT_STR_SET,
1682 .off1 = td_var_offset(norandommap),
1683 .help = "Accept potential duplicate random blocks",
1687 .category = FIO_OPT_C_IO,
1688 .group = FIO_OPT_G_RANDOM,
1691 .name = "softrandommap",
1692 .lname = "Soft randommap",
1693 .type = FIO_OPT_BOOL,
1694 .off1 = td_var_offset(softrandommap),
1695 .help = "Set norandommap if randommap allocation fails",
1696 .parent = "norandommap",
1699 .category = FIO_OPT_C_IO,
1700 .group = FIO_OPT_G_RANDOM,
1703 .name = "random_generator",
1704 .type = FIO_OPT_STR,
1705 .off1 = td_var_offset(random_generator),
1706 .help = "Type of random number generator to use",
1707 .def = "tausworthe",
1709 { .ival = "tausworthe",
1710 .oval = FIO_RAND_GEN_TAUSWORTHE,
1711 .help = "Strong Tausworthe generator",
1714 .oval = FIO_RAND_GEN_LFSR,
1715 .help = "Variable length LFSR",
1718 .category = FIO_OPT_C_IO,
1719 .group = FIO_OPT_G_RANDOM,
1722 .name = "random_distribution",
1723 .type = FIO_OPT_STR,
1724 .off1 = td_var_offset(random_distribution),
1725 .cb = str_random_distribution_cb,
1726 .help = "Random offset distribution generator",
1730 .oval = FIO_RAND_DIST_RANDOM,
1731 .help = "Completely random",
1734 .oval = FIO_RAND_DIST_ZIPF,
1735 .help = "Zipf distribution",
1738 .oval = FIO_RAND_DIST_PARETO,
1739 .help = "Pareto distribution",
1742 .category = FIO_OPT_C_IO,
1743 .group = FIO_OPT_G_RANDOM,
1746 .name = "percentage_random",
1747 .lname = "Percentage Random",
1748 .type = FIO_OPT_INT,
1749 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1750 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1751 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1753 .help = "Percentage of seq/random mix that should be random",
1754 .def = "100,100,100",
1756 .inverse = "percentage_sequential",
1757 .category = FIO_OPT_C_IO,
1758 .group = FIO_OPT_G_RANDOM,
1761 .name = "percentage_sequential",
1762 .lname = "Percentage Sequential",
1763 .type = FIO_OPT_DEPRECATED,
1764 .category = FIO_OPT_C_IO,
1765 .group = FIO_OPT_G_RANDOM,
1769 .lname = "Number of files",
1770 .alias = "nr_files",
1771 .type = FIO_OPT_INT,
1772 .off1 = td_var_offset(nr_files),
1773 .help = "Split job workload between this number of files",
1776 .category = FIO_OPT_C_FILE,
1777 .group = FIO_OPT_G_INVALID,
1780 .name = "openfiles",
1781 .lname = "Number of open files",
1782 .type = FIO_OPT_INT,
1783 .off1 = td_var_offset(open_files),
1784 .help = "Number of files to keep open at the same time",
1785 .category = FIO_OPT_C_FILE,
1786 .group = FIO_OPT_G_INVALID,
1789 .name = "file_service_type",
1790 .lname = "File service type",
1791 .type = FIO_OPT_STR,
1793 .off1 = td_var_offset(file_service_type),
1794 .help = "How to select which file to service next",
1795 .def = "roundrobin",
1796 .category = FIO_OPT_C_FILE,
1797 .group = FIO_OPT_G_INVALID,
1800 .oval = FIO_FSERVICE_RANDOM,
1801 .help = "Choose a file at random",
1803 { .ival = "roundrobin",
1804 .oval = FIO_FSERVICE_RR,
1805 .help = "Round robin select files",
1807 { .ival = "sequential",
1808 .oval = FIO_FSERVICE_SEQ,
1809 .help = "Finish one file before moving to the next",
1812 .parent = "nrfiles",
1815 #ifdef CONFIG_POSIX_FALLOCATE
1817 .name = "fallocate",
1818 .lname = "Fallocate",
1819 .type = FIO_OPT_STR,
1820 .off1 = td_var_offset(fallocate_mode),
1821 .help = "Whether pre-allocation is performed when laying out files",
1823 .category = FIO_OPT_C_FILE,
1824 .group = FIO_OPT_G_INVALID,
1827 .oval = FIO_FALLOCATE_NONE,
1828 .help = "Do not pre-allocate space",
1831 .oval = FIO_FALLOCATE_POSIX,
1832 .help = "Use posix_fallocate()",
1834 #ifdef CONFIG_LINUX_FALLOCATE
1836 .oval = FIO_FALLOCATE_KEEP_SIZE,
1837 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1840 /* Compatibility with former boolean values */
1842 .oval = FIO_FALLOCATE_NONE,
1843 .help = "Alias for 'none'",
1846 .oval = FIO_FALLOCATE_POSIX,
1847 .help = "Alias for 'posix'",
1851 #endif /* CONFIG_POSIX_FALLOCATE */
1853 .name = "fadvise_hint",
1854 .lname = "Fadvise hint",
1855 .type = FIO_OPT_BOOL,
1856 .off1 = td_var_offset(fadvise_hint),
1857 .help = "Use fadvise() to advise the kernel on IO pattern",
1859 .category = FIO_OPT_C_FILE,
1860 .group = FIO_OPT_G_INVALID,
1865 .type = FIO_OPT_INT,
1866 .off1 = td_var_offset(fsync_blocks),
1867 .help = "Issue fsync for writes every given number of blocks",
1870 .category = FIO_OPT_C_FILE,
1871 .group = FIO_OPT_G_INVALID,
1874 .name = "fdatasync",
1875 .lname = "Fdatasync",
1876 .type = FIO_OPT_INT,
1877 .off1 = td_var_offset(fdatasync_blocks),
1878 .help = "Issue fdatasync for writes every given number of blocks",
1881 .category = FIO_OPT_C_FILE,
1882 .group = FIO_OPT_G_INVALID,
1885 .name = "write_barrier",
1886 .lname = "Write barrier",
1887 .type = FIO_OPT_INT,
1888 .off1 = td_var_offset(barrier_blocks),
1889 .help = "Make every Nth write a barrier write",
1892 .category = FIO_OPT_C_IO,
1893 .group = FIO_OPT_G_INVALID,
1895 #ifdef CONFIG_SYNC_FILE_RANGE
1897 .name = "sync_file_range",
1898 .lname = "Sync file range",
1900 { .ival = "wait_before",
1901 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1902 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
1906 .oval = SYNC_FILE_RANGE_WRITE,
1907 .help = "SYNC_FILE_RANGE_WRITE",
1911 .ival = "wait_after",
1912 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1913 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
1917 .type = FIO_OPT_STR_MULTI,
1919 .off1 = td_var_offset(sync_file_range),
1920 .help = "Use sync_file_range()",
1921 .category = FIO_OPT_C_FILE,
1922 .group = FIO_OPT_G_INVALID,
1927 .lname = "Direct I/O",
1928 .type = FIO_OPT_BOOL,
1929 .off1 = td_var_offset(odirect),
1930 .help = "Use O_DIRECT IO (negates buffered)",
1932 .inverse = "buffered",
1933 .category = FIO_OPT_C_IO,
1934 .group = FIO_OPT_G_IO_TYPE,
1938 .lname = "Atomic I/O",
1939 .type = FIO_OPT_BOOL,
1940 .off1 = td_var_offset(oatomic),
1941 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
1943 .category = FIO_OPT_C_IO,
1944 .group = FIO_OPT_G_IO_TYPE,
1948 .lname = "Buffered I/O",
1949 .type = FIO_OPT_BOOL,
1950 .off1 = td_var_offset(odirect),
1952 .help = "Use buffered IO (negates direct)",
1954 .inverse = "direct",
1955 .category = FIO_OPT_C_IO,
1956 .group = FIO_OPT_G_IO_TYPE,
1959 .name = "overwrite",
1960 .lname = "Overwrite",
1961 .type = FIO_OPT_BOOL,
1962 .off1 = td_var_offset(overwrite),
1963 .help = "When writing, set whether to overwrite current data",
1965 .category = FIO_OPT_C_FILE,
1966 .group = FIO_OPT_G_INVALID,
1971 .type = FIO_OPT_INT,
1972 .off1 = td_var_offset(loops),
1973 .help = "Number of times to run the job",
1976 .category = FIO_OPT_C_GENERAL,
1977 .group = FIO_OPT_G_RUNTIME,
1981 .lname = "Number of jobs",
1982 .type = FIO_OPT_INT,
1983 .off1 = td_var_offset(numjobs),
1984 .help = "Duplicate this job this many times",
1987 .category = FIO_OPT_C_GENERAL,
1988 .group = FIO_OPT_G_RUNTIME,
1991 .name = "startdelay",
1992 .lname = "Start delay",
1993 .type = FIO_OPT_STR_VAL_TIME,
1994 .off1 = td_var_offset(start_delay),
1995 .help = "Only start job when this period has passed",
1997 .category = FIO_OPT_C_GENERAL,
1998 .group = FIO_OPT_G_RUNTIME,
2004 .type = FIO_OPT_STR_VAL_TIME,
2005 .off1 = td_var_offset(timeout),
2006 .help = "Stop workload when this amount of time has passed",
2008 .category = FIO_OPT_C_GENERAL,
2009 .group = FIO_OPT_G_RUNTIME,
2012 .name = "time_based",
2013 .lname = "Time based",
2014 .type = FIO_OPT_STR_SET,
2015 .off1 = td_var_offset(time_based),
2016 .help = "Keep running until runtime/timeout is met",
2017 .category = FIO_OPT_C_GENERAL,
2018 .group = FIO_OPT_G_RUNTIME,
2021 .name = "verify_only",
2022 .lname = "Verify only",
2023 .type = FIO_OPT_STR_SET,
2024 .off1 = td_var_offset(verify_only),
2025 .help = "Verifies previously written data is still valid",
2026 .category = FIO_OPT_C_GENERAL,
2027 .group = FIO_OPT_G_RUNTIME,
2030 .name = "ramp_time",
2031 .lname = "Ramp time",
2032 .type = FIO_OPT_STR_VAL_TIME,
2033 .off1 = td_var_offset(ramp_time),
2034 .help = "Ramp up time before measuring performance",
2035 .category = FIO_OPT_C_GENERAL,
2036 .group = FIO_OPT_G_RUNTIME,
2039 .name = "clocksource",
2040 .lname = "Clock source",
2041 .type = FIO_OPT_STR,
2042 .cb = fio_clock_source_cb,
2043 .off1 = td_var_offset(clocksource),
2044 .help = "What type of timing source to use",
2045 .category = FIO_OPT_C_GENERAL,
2046 .group = FIO_OPT_G_CLOCK,
2048 #ifdef CONFIG_GETTIMEOFDAY
2049 { .ival = "gettimeofday",
2051 .help = "Use gettimeofday(2) for timing",
2054 #ifdef CONFIG_CLOCK_GETTIME
2055 { .ival = "clock_gettime",
2056 .oval = CS_CGETTIME,
2057 .help = "Use clock_gettime(2) for timing",
2060 #ifdef ARCH_HAVE_CPU_CLOCK
2062 .oval = CS_CPUCLOCK,
2063 .help = "Use CPU private clock",
2071 .lname = "I/O Memory",
2072 .type = FIO_OPT_STR,
2074 .off1 = td_var_offset(mem_type),
2075 .help = "Backing type for IO buffers",
2077 .category = FIO_OPT_C_IO,
2078 .group = FIO_OPT_G_INVALID,
2082 .help = "Use malloc(3) for IO buffers",
2086 .help = "Use shared memory segments for IO buffers",
2088 #ifdef FIO_HAVE_HUGETLB
2089 { .ival = "shmhuge",
2090 .oval = MEM_SHMHUGE,
2091 .help = "Like shm, but use huge pages",
2096 .help = "Use mmap(2) (file or anon) for IO buffers",
2098 #ifdef FIO_HAVE_HUGETLB
2099 { .ival = "mmaphuge",
2100 .oval = MEM_MMAPHUGE,
2101 .help = "Like mmap, but use huge pages",
2107 .name = "iomem_align",
2108 .alias = "mem_align",
2109 .lname = "I/O memory alignment",
2110 .type = FIO_OPT_INT,
2111 .off1 = td_var_offset(mem_align),
2113 .help = "IO memory buffer offset alignment",
2117 .category = FIO_OPT_C_IO,
2118 .group = FIO_OPT_G_INVALID,
2123 .type = FIO_OPT_STR,
2124 .off1 = td_var_offset(verify),
2125 .help = "Verify data written",
2127 .category = FIO_OPT_C_IO,
2128 .group = FIO_OPT_G_VERIFY,
2131 .oval = VERIFY_NONE,
2132 .help = "Don't do IO verification",
2136 .help = "Use md5 checksums for verification",
2139 .oval = VERIFY_CRC64,
2140 .help = "Use crc64 checksums for verification",
2143 .oval = VERIFY_CRC32,
2144 .help = "Use crc32 checksums for verification",
2146 { .ival = "crc32c-intel",
2147 .oval = VERIFY_CRC32C,
2148 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2151 .oval = VERIFY_CRC32C,
2152 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2155 .oval = VERIFY_CRC16,
2156 .help = "Use crc16 checksums for verification",
2159 .oval = VERIFY_CRC7,
2160 .help = "Use crc7 checksums for verification",
2163 .oval = VERIFY_SHA1,
2164 .help = "Use sha1 checksums for verification",
2167 .oval = VERIFY_SHA256,
2168 .help = "Use sha256 checksums for verification",
2171 .oval = VERIFY_SHA512,
2172 .help = "Use sha512 checksums for verification",
2175 .oval = VERIFY_META,
2176 .help = "Use io information",
2180 .oval = VERIFY_NULL,
2181 .help = "Pretend to verify",
2186 .name = "do_verify",
2187 .lname = "Perform verify step",
2188 .type = FIO_OPT_BOOL,
2189 .off1 = td_var_offset(do_verify),
2190 .help = "Run verification stage after write",
2194 .category = FIO_OPT_C_IO,
2195 .group = FIO_OPT_G_VERIFY,
2198 .name = "verifysort",
2199 .lname = "Verify sort",
2200 .type = FIO_OPT_BOOL,
2201 .off1 = td_var_offset(verifysort),
2202 .help = "Sort written verify blocks for read back",
2206 .category = FIO_OPT_C_IO,
2207 .group = FIO_OPT_G_VERIFY,
2210 .name = "verifysort_nr",
2211 .type = FIO_OPT_INT,
2212 .off1 = td_var_offset(verifysort_nr),
2213 .help = "Pre-load and sort verify blocks for a read workload",
2218 .category = FIO_OPT_C_IO,
2219 .group = FIO_OPT_G_VERIFY,
2222 .name = "verify_interval",
2223 .lname = "Verify interval",
2224 .type = FIO_OPT_INT,
2225 .off1 = td_var_offset(verify_interval),
2226 .minval = 2 * sizeof(struct verify_header),
2227 .help = "Store verify buffer header every N bytes",
2230 .interval = 2 * sizeof(struct verify_header),
2231 .category = FIO_OPT_C_IO,
2232 .group = FIO_OPT_G_VERIFY,
2235 .name = "verify_offset",
2236 .lname = "Verify offset",
2237 .type = FIO_OPT_INT,
2238 .help = "Offset verify header location by N bytes",
2239 .off1 = td_var_offset(verify_offset),
2240 .minval = sizeof(struct verify_header),
2243 .category = FIO_OPT_C_IO,
2244 .group = FIO_OPT_G_VERIFY,
2247 .name = "verify_pattern",
2248 .lname = "Verify pattern",
2249 .type = FIO_OPT_STR,
2250 .cb = str_verify_pattern_cb,
2251 .help = "Fill pattern for IO buffers",
2254 .category = FIO_OPT_C_IO,
2255 .group = FIO_OPT_G_VERIFY,
2258 .name = "verify_fatal",
2259 .lname = "Verify fatal",
2260 .type = FIO_OPT_BOOL,
2261 .off1 = td_var_offset(verify_fatal),
2263 .help = "Exit on a single verify failure, don't continue",
2266 .category = FIO_OPT_C_IO,
2267 .group = FIO_OPT_G_VERIFY,
2270 .name = "verify_dump",
2271 .lname = "Verify dump",
2272 .type = FIO_OPT_BOOL,
2273 .off1 = td_var_offset(verify_dump),
2275 .help = "Dump contents of good and bad blocks on failure",
2278 .category = FIO_OPT_C_IO,
2279 .group = FIO_OPT_G_VERIFY,
2282 .name = "verify_async",
2283 .lname = "Verify asynchronously",
2284 .type = FIO_OPT_INT,
2285 .off1 = td_var_offset(verify_async),
2287 .help = "Number of async verifier threads to use",
2290 .category = FIO_OPT_C_IO,
2291 .group = FIO_OPT_G_VERIFY,
2294 .name = "verify_backlog",
2295 .lname = "Verify backlog",
2296 .type = FIO_OPT_STR_VAL,
2297 .off1 = td_var_offset(verify_backlog),
2298 .help = "Verify after this number of blocks are written",
2301 .category = FIO_OPT_C_IO,
2302 .group = FIO_OPT_G_VERIFY,
2305 .name = "verify_backlog_batch",
2306 .lname = "Verify backlog batch",
2307 .type = FIO_OPT_INT,
2308 .off1 = td_var_offset(verify_batch),
2309 .help = "Verify this number of IO blocks",
2312 .category = FIO_OPT_C_IO,
2313 .group = FIO_OPT_G_VERIFY,
2315 #ifdef FIO_HAVE_CPU_AFFINITY
2317 .name = "verify_async_cpus",
2318 .lname = "Async verify CPUs",
2319 .type = FIO_OPT_STR,
2320 .cb = str_verify_cpus_allowed_cb,
2321 .help = "Set CPUs allowed for async verify threads",
2322 .parent = "verify_async",
2324 .category = FIO_OPT_C_IO,
2325 .group = FIO_OPT_G_VERIFY,
2329 .name = "experimental_verify",
2330 .off1 = td_var_offset(experimental_verify),
2331 .type = FIO_OPT_BOOL,
2332 .help = "Enable experimental verification",
2333 .category = FIO_OPT_C_IO,
2334 .group = FIO_OPT_G_VERIFY,
2336 #ifdef FIO_HAVE_TRIM
2338 .name = "trim_percentage",
2339 .lname = "Trim percentage",
2340 .type = FIO_OPT_INT,
2341 .off1 = td_var_offset(trim_percentage),
2344 .help = "Number of verify blocks to discard/trim",
2349 .category = FIO_OPT_C_IO,
2350 .group = FIO_OPT_G_TRIM,
2353 .name = "trim_verify_zero",
2354 .lname = "Verify trim zero",
2355 .type = FIO_OPT_BOOL,
2356 .help = "Verify that trim/discarded blocks are returned as zeroes",
2357 .off1 = td_var_offset(trim_zero),
2358 .parent = "trim_percentage",
2361 .category = FIO_OPT_C_IO,
2362 .group = FIO_OPT_G_TRIM,
2365 .name = "trim_backlog",
2366 .lname = "Trim backlog",
2367 .type = FIO_OPT_STR_VAL,
2368 .off1 = td_var_offset(trim_backlog),
2369 .help = "Trim after this number of blocks are written",
2370 .parent = "trim_percentage",
2373 .category = FIO_OPT_C_IO,
2374 .group = FIO_OPT_G_TRIM,
2377 .name = "trim_backlog_batch",
2378 .lname = "Trim backlog batch",
2379 .type = FIO_OPT_INT,
2380 .off1 = td_var_offset(trim_batch),
2381 .help = "Trim this number of IO blocks",
2382 .parent = "trim_percentage",
2385 .category = FIO_OPT_C_IO,
2386 .group = FIO_OPT_G_TRIM,
2390 .name = "write_iolog",
2391 .lname = "Write I/O log",
2392 .type = FIO_OPT_STR_STORE,
2393 .off1 = td_var_offset(write_iolog_file),
2394 .help = "Store IO pattern to file",
2395 .category = FIO_OPT_C_IO,
2396 .group = FIO_OPT_G_IOLOG,
2399 .name = "read_iolog",
2400 .lname = "Read I/O log",
2401 .type = FIO_OPT_STR_STORE,
2402 .off1 = td_var_offset(read_iolog_file),
2403 .help = "Playback IO pattern from file",
2404 .category = FIO_OPT_C_IO,
2405 .group = FIO_OPT_G_IOLOG,
2408 .name = "replay_no_stall",
2409 .lname = "Don't stall on replay",
2410 .type = FIO_OPT_BOOL,
2411 .off1 = td_var_offset(no_stall),
2413 .parent = "read_iolog",
2415 .help = "Playback IO pattern file as fast as possible without stalls",
2416 .category = FIO_OPT_C_IO,
2417 .group = FIO_OPT_G_IOLOG,
2420 .name = "replay_redirect",
2421 .lname = "Redirect device for replay",
2422 .type = FIO_OPT_STR_STORE,
2423 .off1 = td_var_offset(replay_redirect),
2424 .parent = "read_iolog",
2426 .help = "Replay all I/O onto this device, regardless of trace device",
2427 .category = FIO_OPT_C_IO,
2428 .group = FIO_OPT_G_IOLOG,
2431 .name = "exec_prerun",
2432 .lname = "Pre-execute runnable",
2433 .type = FIO_OPT_STR_STORE,
2434 .off1 = td_var_offset(exec_prerun),
2435 .help = "Execute this file prior to running job",
2436 .category = FIO_OPT_C_GENERAL,
2437 .group = FIO_OPT_G_INVALID,
2440 .name = "exec_postrun",
2441 .lname = "Post-execute runnable",
2442 .type = FIO_OPT_STR_STORE,
2443 .off1 = td_var_offset(exec_postrun),
2444 .help = "Execute this file after running job",
2445 .category = FIO_OPT_C_GENERAL,
2446 .group = FIO_OPT_G_INVALID,
2448 #ifdef FIO_HAVE_IOSCHED_SWITCH
2450 .name = "ioscheduler",
2451 .lname = "I/O scheduler",
2452 .type = FIO_OPT_STR_STORE,
2453 .off1 = td_var_offset(ioscheduler),
2454 .help = "Use this IO scheduler on the backing device",
2455 .category = FIO_OPT_C_FILE,
2456 .group = FIO_OPT_G_INVALID,
2461 .lname = "Zone size",
2462 .type = FIO_OPT_STR_VAL,
2463 .off1 = td_var_offset(zone_size),
2464 .help = "Amount of data to read per zone",
2466 .interval = 1024 * 1024,
2467 .category = FIO_OPT_C_IO,
2468 .group = FIO_OPT_G_ZONE,
2471 .name = "zonerange",
2472 .lname = "Zone range",
2473 .type = FIO_OPT_STR_VAL,
2474 .off1 = td_var_offset(zone_range),
2475 .help = "Give size of an IO zone",
2477 .interval = 1024 * 1024,
2478 .category = FIO_OPT_C_IO,
2479 .group = FIO_OPT_G_ZONE,
2483 .lname = "Zone skip",
2484 .type = FIO_OPT_STR_VAL,
2485 .off1 = td_var_offset(zone_skip),
2486 .help = "Space between IO zones",
2488 .interval = 1024 * 1024,
2489 .category = FIO_OPT_C_IO,
2490 .group = FIO_OPT_G_ZONE,
2494 .lname = "Lock memory",
2495 .type = FIO_OPT_STR_VAL,
2496 .off1 = td_var_offset(lockmem),
2497 .help = "Lock down this amount of memory (per worker)",
2499 .interval = 1024 * 1024,
2500 .category = FIO_OPT_C_GENERAL,
2501 .group = FIO_OPT_G_INVALID,
2504 .name = "rwmixread",
2505 .lname = "Read/write mix read",
2506 .type = FIO_OPT_INT,
2507 .cb = str_rwmix_read_cb,
2509 .help = "Percentage of mixed workload that is reads",
2512 .inverse = "rwmixwrite",
2513 .category = FIO_OPT_C_IO,
2514 .group = FIO_OPT_G_RWMIX,
2517 .name = "rwmixwrite",
2518 .lname = "Read/write mix write",
2519 .type = FIO_OPT_INT,
2520 .cb = str_rwmix_write_cb,
2522 .help = "Percentage of mixed workload that is writes",
2525 .inverse = "rwmixread",
2526 .category = FIO_OPT_C_IO,
2527 .group = FIO_OPT_G_RWMIX,
2530 .name = "rwmixcycle",
2531 .lname = "Read/write mix cycle",
2532 .type = FIO_OPT_DEPRECATED,
2533 .category = FIO_OPT_C_IO,
2534 .group = FIO_OPT_G_RWMIX,
2539 .type = FIO_OPT_INT,
2540 .off1 = td_var_offset(nice),
2541 .help = "Set job CPU nice value",
2546 .category = FIO_OPT_C_GENERAL,
2547 .group = FIO_OPT_G_CRED,
2549 #ifdef FIO_HAVE_IOPRIO
2552 .lname = "I/O nice priority",
2553 .type = FIO_OPT_INT,
2554 .off1 = td_var_offset(ioprio),
2555 .help = "Set job IO priority value",
2559 .category = FIO_OPT_C_GENERAL,
2560 .group = FIO_OPT_G_CRED,
2563 .name = "prioclass",
2564 .lname = "I/O nice priority class",
2565 .type = FIO_OPT_INT,
2566 .off1 = td_var_offset(ioprio_class),
2567 .help = "Set job IO priority class",
2571 .category = FIO_OPT_C_GENERAL,
2572 .group = FIO_OPT_G_CRED,
2576 .name = "thinktime",
2577 .lname = "Thinktime",
2578 .type = FIO_OPT_INT,
2579 .off1 = td_var_offset(thinktime),
2580 .help = "Idle time between IO buffers (usec)",
2582 .category = FIO_OPT_C_IO,
2583 .group = FIO_OPT_G_THINKTIME,
2586 .name = "thinktime_spin",
2587 .lname = "Thinktime spin",
2588 .type = FIO_OPT_INT,
2589 .off1 = td_var_offset(thinktime_spin),
2590 .help = "Start think time by spinning this amount (usec)",
2592 .parent = "thinktime",
2594 .category = FIO_OPT_C_IO,
2595 .group = FIO_OPT_G_THINKTIME,
2598 .name = "thinktime_blocks",
2599 .lname = "Thinktime blocks",
2600 .type = FIO_OPT_INT,
2601 .off1 = td_var_offset(thinktime_blocks),
2602 .help = "IO buffer period between 'thinktime'",
2604 .parent = "thinktime",
2606 .category = FIO_OPT_C_IO,
2607 .group = FIO_OPT_G_THINKTIME,
2611 .lname = "I/O rate",
2612 .type = FIO_OPT_INT,
2613 .off1 = td_var_offset(rate[DDIR_READ]),
2614 .off2 = td_var_offset(rate[DDIR_WRITE]),
2615 .off3 = td_var_offset(rate[DDIR_TRIM]),
2616 .help = "Set bandwidth rate",
2617 .category = FIO_OPT_C_IO,
2618 .group = FIO_OPT_G_RATE,
2622 .lname = "I/O min rate",
2623 .type = FIO_OPT_INT,
2624 .off1 = td_var_offset(ratemin[DDIR_READ]),
2625 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2626 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2627 .help = "Job must meet this rate or it will be shutdown",
2630 .category = FIO_OPT_C_IO,
2631 .group = FIO_OPT_G_RATE,
2634 .name = "rate_iops",
2635 .lname = "I/O rate IOPS",
2636 .type = FIO_OPT_INT,
2637 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2638 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2639 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2640 .help = "Limit IO used to this number of IO operations/sec",
2642 .category = FIO_OPT_C_IO,
2643 .group = FIO_OPT_G_RATE,
2646 .name = "rate_iops_min",
2647 .lname = "I/O min rate IOPS",
2648 .type = FIO_OPT_INT,
2649 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2650 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2651 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2652 .help = "Job must meet this rate or it will be shut down",
2653 .parent = "rate_iops",
2655 .category = FIO_OPT_C_IO,
2656 .group = FIO_OPT_G_RATE,
2659 .name = "ratecycle",
2660 .lname = "I/O rate cycle",
2661 .type = FIO_OPT_INT,
2662 .off1 = td_var_offset(ratecycle),
2663 .help = "Window average for rate limits (msec)",
2667 .category = FIO_OPT_C_IO,
2668 .group = FIO_OPT_G_RATE,
2671 .name = "max_latency",
2672 .type = FIO_OPT_INT,
2673 .off1 = td_var_offset(max_latency),
2674 .help = "Maximum tolerated IO latency (usec)",
2675 .category = FIO_OPT_C_IO,
2676 .group = FIO_OPT_G_LATPROF,
2679 .name = "latency_target",
2680 .lname = "Latency Target (usec)",
2681 .type = FIO_OPT_STR_VAL_TIME,
2682 .off1 = td_var_offset(latency_target),
2683 .help = "Ramp to max queue depth supporting this latency",
2684 .category = FIO_OPT_C_IO,
2685 .group = FIO_OPT_G_LATPROF,
2688 .name = "latency_window",
2689 .lname = "Latency Window (usec)",
2690 .type = FIO_OPT_STR_VAL_TIME,
2691 .off1 = td_var_offset(latency_window),
2692 .help = "Time to sustain latency_target",
2693 .category = FIO_OPT_C_IO,
2694 .group = FIO_OPT_G_LATPROF,
2697 .name = "latency_percentile",
2698 .lname = "Latency Percentile",
2699 .type = FIO_OPT_FLOAT_LIST,
2700 .off1 = td_var_offset(latency_percentile),
2701 .help = "Percentile of IOs must be below latency_target",
2706 .category = FIO_OPT_C_IO,
2707 .group = FIO_OPT_G_LATPROF,
2710 .name = "invalidate",
2711 .lname = "Cache invalidate",
2712 .type = FIO_OPT_BOOL,
2713 .off1 = td_var_offset(invalidate_cache),
2714 .help = "Invalidate buffer/page cache prior to running job",
2716 .category = FIO_OPT_C_IO,
2717 .group = FIO_OPT_G_IO_TYPE,
2721 .lname = "Synchronous I/O",
2722 .type = FIO_OPT_BOOL,
2723 .off1 = td_var_offset(sync_io),
2724 .help = "Use O_SYNC for buffered writes",
2726 .parent = "buffered",
2728 .category = FIO_OPT_C_IO,
2729 .group = FIO_OPT_G_IO_TYPE,
2732 .name = "create_serialize",
2733 .lname = "Create serialize",
2734 .type = FIO_OPT_BOOL,
2735 .off1 = td_var_offset(create_serialize),
2736 .help = "Serialize creating of job files",
2738 .category = FIO_OPT_C_FILE,
2739 .group = FIO_OPT_G_INVALID,
2742 .name = "create_fsync",
2743 .lname = "Create fsync",
2744 .type = FIO_OPT_BOOL,
2745 .off1 = td_var_offset(create_fsync),
2746 .help = "fsync file after creation",
2748 .category = FIO_OPT_C_FILE,
2749 .group = FIO_OPT_G_INVALID,
2752 .name = "create_on_open",
2753 .lname = "Create on open",
2754 .type = FIO_OPT_BOOL,
2755 .off1 = td_var_offset(create_on_open),
2756 .help = "Create files when they are opened for IO",
2758 .category = FIO_OPT_C_FILE,
2759 .group = FIO_OPT_G_INVALID,
2762 .name = "create_only",
2763 .type = FIO_OPT_BOOL,
2764 .off1 = td_var_offset(create_only),
2765 .help = "Only perform file creation phase",
2766 .category = FIO_OPT_C_FILE,
2771 .lname = "Pre-read files",
2772 .type = FIO_OPT_BOOL,
2773 .off1 = td_var_offset(pre_read),
2774 .help = "Pre-read files before starting official testing",
2776 .category = FIO_OPT_C_FILE,
2777 .group = FIO_OPT_G_INVALID,
2779 #ifdef FIO_HAVE_CPU_AFFINITY
2782 .lname = "CPU mask",
2783 .type = FIO_OPT_INT,
2784 .cb = str_cpumask_cb,
2785 .help = "CPU affinity mask",
2786 .category = FIO_OPT_C_GENERAL,
2787 .group = FIO_OPT_G_CRED,
2790 .name = "cpus_allowed",
2791 .lname = "CPUs allowed",
2792 .type = FIO_OPT_STR,
2793 .cb = str_cpus_allowed_cb,
2794 .help = "Set CPUs allowed",
2795 .category = FIO_OPT_C_GENERAL,
2796 .group = FIO_OPT_G_CRED,
2799 #ifdef CONFIG_LIBNUMA
2801 .name = "numa_cpu_nodes",
2802 .type = FIO_OPT_STR,
2803 .cb = str_numa_cpunodes_cb,
2804 .help = "NUMA CPU nodes bind",
2805 .category = FIO_OPT_C_GENERAL,
2806 .group = FIO_OPT_G_INVALID,
2809 .name = "numa_mem_policy",
2810 .type = FIO_OPT_STR,
2811 .cb = str_numa_mpol_cb,
2812 .help = "NUMA memory policy setup",
2813 .category = FIO_OPT_C_GENERAL,
2814 .group = FIO_OPT_G_INVALID,
2818 .name = "end_fsync",
2819 .lname = "End fsync",
2820 .type = FIO_OPT_BOOL,
2821 .off1 = td_var_offset(end_fsync),
2822 .help = "Include fsync at the end of job",
2824 .category = FIO_OPT_C_FILE,
2825 .group = FIO_OPT_G_INVALID,
2828 .name = "fsync_on_close",
2829 .lname = "Fsync on close",
2830 .type = FIO_OPT_BOOL,
2831 .off1 = td_var_offset(fsync_on_close),
2832 .help = "fsync files on close",
2834 .category = FIO_OPT_C_FILE,
2835 .group = FIO_OPT_G_INVALID,
2839 .lname = "Unlink file",
2840 .type = FIO_OPT_BOOL,
2841 .off1 = td_var_offset(unlink),
2842 .help = "Unlink created files after job has completed",
2844 .category = FIO_OPT_C_FILE,
2845 .group = FIO_OPT_G_INVALID,
2849 .lname = "Exit-all on terminate",
2850 .type = FIO_OPT_STR_SET,
2851 .cb = str_exitall_cb,
2852 .help = "Terminate all jobs when one exits",
2853 .category = FIO_OPT_C_GENERAL,
2854 .group = FIO_OPT_G_PROCESS,
2857 .name = "stonewall",
2858 .lname = "Wait for previous",
2859 .alias = "wait_for_previous",
2860 .type = FIO_OPT_STR_SET,
2861 .off1 = td_var_offset(stonewall),
2862 .help = "Insert a hard barrier between this job and previous",
2863 .category = FIO_OPT_C_GENERAL,
2864 .group = FIO_OPT_G_PROCESS,
2867 .name = "new_group",
2868 .lname = "New group",
2869 .type = FIO_OPT_STR_SET,
2870 .off1 = td_var_offset(new_group),
2871 .help = "Mark the start of a new group (for reporting)",
2872 .category = FIO_OPT_C_GENERAL,
2873 .group = FIO_OPT_G_PROCESS,
2878 .type = FIO_OPT_STR_SET,
2879 .off1 = td_var_offset(use_thread),
2880 .help = "Use threads instead of processes",
2881 .category = FIO_OPT_C_GENERAL,
2882 .group = FIO_OPT_G_PROCESS,
2885 .name = "write_bw_log",
2886 .lname = "Write bandwidth log",
2887 .type = FIO_OPT_STR_STORE,
2888 .off1 = td_var_offset(bw_log_file),
2889 .help = "Write log of bandwidth during run",
2890 .category = FIO_OPT_C_LOG,
2891 .group = FIO_OPT_G_INVALID,
2894 .name = "write_lat_log",
2895 .lname = "Write latency log",
2896 .type = FIO_OPT_STR_STORE,
2897 .off1 = td_var_offset(lat_log_file),
2898 .help = "Write log of latency during run",
2899 .category = FIO_OPT_C_LOG,
2900 .group = FIO_OPT_G_INVALID,
2903 .name = "write_iops_log",
2904 .lname = "Write IOPS log",
2905 .type = FIO_OPT_STR_STORE,
2906 .off1 = td_var_offset(iops_log_file),
2907 .help = "Write log of IOPS during run",
2908 .category = FIO_OPT_C_LOG,
2909 .group = FIO_OPT_G_INVALID,
2912 .name = "log_avg_msec",
2913 .lname = "Log averaging (msec)",
2914 .type = FIO_OPT_INT,
2915 .off1 = td_var_offset(log_avg_msec),
2916 .help = "Average bw/iops/lat logs over this period of time",
2918 .category = FIO_OPT_C_LOG,
2919 .group = FIO_OPT_G_INVALID,
2922 .name = "bwavgtime",
2923 .lname = "Bandwidth average time",
2924 .type = FIO_OPT_INT,
2925 .off1 = td_var_offset(bw_avg_time),
2926 .help = "Time window over which to calculate bandwidth"
2929 .parent = "write_bw_log",
2932 .category = FIO_OPT_C_LOG,
2933 .group = FIO_OPT_G_INVALID,
2936 .name = "iopsavgtime",
2937 .lname = "IOPS average time",
2938 .type = FIO_OPT_INT,
2939 .off1 = td_var_offset(iops_avg_time),
2940 .help = "Time window over which to calculate IOPS (msec)",
2942 .parent = "write_iops_log",
2945 .category = FIO_OPT_C_LOG,
2946 .group = FIO_OPT_G_INVALID,
2949 .name = "group_reporting",
2950 .lname = "Group reporting",
2951 .type = FIO_OPT_STR_SET,
2952 .off1 = td_var_offset(group_reporting),
2953 .help = "Do reporting on a per-group basis",
2954 .category = FIO_OPT_C_STAT,
2955 .group = FIO_OPT_G_INVALID,
2958 .name = "zero_buffers",
2959 .lname = "Zero I/O buffers",
2960 .type = FIO_OPT_STR_SET,
2961 .off1 = td_var_offset(zero_buffers),
2962 .help = "Init IO buffers to all zeroes",
2963 .category = FIO_OPT_C_IO,
2964 .group = FIO_OPT_G_IO_BUF,
2967 .name = "refill_buffers",
2968 .lname = "Refill I/O buffers",
2969 .type = FIO_OPT_STR_SET,
2970 .off1 = td_var_offset(refill_buffers),
2971 .help = "Refill IO buffers on every IO submit",
2972 .category = FIO_OPT_C_IO,
2973 .group = FIO_OPT_G_IO_BUF,
2976 .name = "scramble_buffers",
2977 .lname = "Scramble I/O buffers",
2978 .type = FIO_OPT_BOOL,
2979 .off1 = td_var_offset(scramble_buffers),
2980 .help = "Slightly scramble buffers on every IO submit",
2982 .category = FIO_OPT_C_IO,
2983 .group = FIO_OPT_G_IO_BUF,
2986 .name = "buffer_pattern",
2987 .lname = "Buffer pattern",
2988 .type = FIO_OPT_STR,
2989 .cb = str_buffer_pattern_cb,
2990 .help = "Fill pattern for IO buffers",
2991 .category = FIO_OPT_C_IO,
2992 .group = FIO_OPT_G_IO_BUF,
2995 .name = "buffer_compress_percentage",
2996 .lname = "Buffer compression percentage",
2997 .type = FIO_OPT_INT,
2998 .off1 = td_var_offset(compress_percentage),
3001 .help = "How compressible the buffer is (approximately)",
3003 .category = FIO_OPT_C_IO,
3004 .group = FIO_OPT_G_IO_BUF,
3007 .name = "buffer_compress_chunk",
3008 .lname = "Buffer compression chunk size",
3009 .type = FIO_OPT_INT,
3010 .off1 = td_var_offset(compress_chunk),
3011 .parent = "buffer_compress_percentage",
3013 .help = "Size of compressible region in buffer",
3015 .category = FIO_OPT_C_IO,
3016 .group = FIO_OPT_G_IO_BUF,
3019 .name = "clat_percentiles",
3020 .lname = "Completion latency percentiles",
3021 .type = FIO_OPT_BOOL,
3022 .off1 = td_var_offset(clat_percentiles),
3023 .help = "Enable the reporting of completion latency percentiles",
3025 .category = FIO_OPT_C_STAT,
3026 .group = FIO_OPT_G_INVALID,
3029 .name = "percentile_list",
3030 .lname = "Completion latency percentile list",
3031 .type = FIO_OPT_FLOAT_LIST,
3032 .off1 = td_var_offset(percentile_list),
3033 .off2 = td_var_offset(percentile_precision),
3034 .help = "Specify a custom list of percentiles to report",
3035 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3036 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3039 .category = FIO_OPT_C_STAT,
3040 .group = FIO_OPT_G_INVALID,
3043 #ifdef FIO_HAVE_DISK_UTIL
3045 .name = "disk_util",
3046 .lname = "Disk utilization",
3047 .type = FIO_OPT_BOOL,
3048 .off1 = td_var_offset(do_disk_util),
3049 .help = "Log disk utilization statistics",
3051 .category = FIO_OPT_C_STAT,
3052 .group = FIO_OPT_G_INVALID,
3056 .name = "gtod_reduce",
3057 .lname = "Reduce gettimeofday() calls",
3058 .type = FIO_OPT_BOOL,
3059 .help = "Greatly reduce number of gettimeofday() calls",
3060 .cb = str_gtod_reduce_cb,
3063 .category = FIO_OPT_C_STAT,
3064 .group = FIO_OPT_G_INVALID,
3067 .name = "disable_lat",
3068 .lname = "Disable all latency stats",
3069 .type = FIO_OPT_BOOL,
3070 .off1 = td_var_offset(disable_lat),
3071 .help = "Disable latency numbers",
3072 .parent = "gtod_reduce",
3075 .category = FIO_OPT_C_STAT,
3076 .group = FIO_OPT_G_INVALID,
3079 .name = "disable_clat",
3080 .lname = "Disable completion latency stats",
3081 .type = FIO_OPT_BOOL,
3082 .off1 = td_var_offset(disable_clat),
3083 .help = "Disable completion latency numbers",
3084 .parent = "gtod_reduce",
3087 .category = FIO_OPT_C_STAT,
3088 .group = FIO_OPT_G_INVALID,
3091 .name = "disable_slat",
3092 .lname = "Disable submission latency stats",
3093 .type = FIO_OPT_BOOL,
3094 .off1 = td_var_offset(disable_slat),
3095 .help = "Disable submission latency numbers",
3096 .parent = "gtod_reduce",
3099 .category = FIO_OPT_C_STAT,
3100 .group = FIO_OPT_G_INVALID,
3103 .name = "disable_bw_measurement",
3104 .lname = "Disable bandwidth stats",
3105 .type = FIO_OPT_BOOL,
3106 .off1 = td_var_offset(disable_bw),
3107 .help = "Disable bandwidth logging",
3108 .parent = "gtod_reduce",
3111 .category = FIO_OPT_C_STAT,
3112 .group = FIO_OPT_G_INVALID,
3116 .lname = "Dedicated gettimeofday() CPU",
3117 .type = FIO_OPT_INT,
3118 .cb = str_gtod_cpu_cb,
3119 .help = "Set up dedicated gettimeofday() thread on this CPU",
3120 .verify = gtod_cpu_verify,
3121 .category = FIO_OPT_C_GENERAL,
3122 .group = FIO_OPT_G_CLOCK,
3125 .name = "unified_rw_reporting",
3126 .type = FIO_OPT_BOOL,
3127 .off1 = td_var_offset(unified_rw_rep),
3128 .help = "Unify reporting across data direction",
3130 .category = FIO_OPT_C_GENERAL,
3131 .group = FIO_OPT_G_INVALID,
3134 .name = "continue_on_error",
3135 .lname = "Continue on error",
3136 .type = FIO_OPT_STR,
3137 .off1 = td_var_offset(continue_on_error),
3138 .help = "Continue on non-fatal errors during IO",
3140 .category = FIO_OPT_C_GENERAL,
3141 .group = FIO_OPT_G_ERR,
3144 .oval = ERROR_TYPE_NONE,
3145 .help = "Exit when an error is encountered",
3148 .oval = ERROR_TYPE_READ,
3149 .help = "Continue on read errors only",
3152 .oval = ERROR_TYPE_WRITE,
3153 .help = "Continue on write errors only",
3156 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3157 .help = "Continue on any IO errors",
3160 .oval = ERROR_TYPE_VERIFY,
3161 .help = "Continue on verify errors only",
3164 .oval = ERROR_TYPE_ANY,
3165 .help = "Continue on all io and verify errors",
3168 .oval = ERROR_TYPE_NONE,
3169 .help = "Alias for 'none'",
3172 .oval = ERROR_TYPE_ANY,
3173 .help = "Alias for 'all'",
3178 .name = "ignore_error",
3179 .type = FIO_OPT_STR,
3180 .cb = str_ignore_error_cb,
3181 .help = "Set a specific list of errors to ignore",
3183 .category = FIO_OPT_C_GENERAL,
3184 .group = FIO_OPT_G_ERR,
3187 .name = "error_dump",
3188 .type = FIO_OPT_BOOL,
3189 .off1 = td_var_offset(error_dump),
3191 .help = "Dump info on each error",
3192 .category = FIO_OPT_C_GENERAL,
3193 .group = FIO_OPT_G_ERR,
3198 .type = FIO_OPT_STR_STORE,
3199 .off1 = td_var_offset(profile),
3200 .help = "Select a specific builtin performance test",
3201 .category = FIO_OPT_C_PROFILE,
3202 .group = FIO_OPT_G_INVALID,
3207 .type = FIO_OPT_STR_STORE,
3208 .off1 = td_var_offset(cgroup),
3209 .help = "Add job to cgroup of this name",
3210 .category = FIO_OPT_C_GENERAL,
3211 .group = FIO_OPT_G_CGROUP,
3214 .name = "cgroup_nodelete",
3215 .lname = "Cgroup no-delete",
3216 .type = FIO_OPT_BOOL,
3217 .off1 = td_var_offset(cgroup_nodelete),
3218 .help = "Do not delete cgroups after job completion",
3221 .category = FIO_OPT_C_GENERAL,
3222 .group = FIO_OPT_G_CGROUP,
3225 .name = "cgroup_weight",
3226 .lname = "Cgroup weight",
3227 .type = FIO_OPT_INT,
3228 .off1 = td_var_offset(cgroup_weight),
3229 .help = "Use given weight for cgroup",
3233 .category = FIO_OPT_C_GENERAL,
3234 .group = FIO_OPT_G_CGROUP,
3239 .type = FIO_OPT_INT,
3240 .off1 = td_var_offset(uid),
3241 .help = "Run job with this user ID",
3242 .category = FIO_OPT_C_GENERAL,
3243 .group = FIO_OPT_G_CRED,
3247 .lname = "Group ID",
3248 .type = FIO_OPT_INT,
3249 .off1 = td_var_offset(gid),
3250 .help = "Run job with this group ID",
3251 .category = FIO_OPT_C_GENERAL,
3252 .group = FIO_OPT_G_CRED,
3257 .type = FIO_OPT_INT,
3258 .off1 = td_var_offset(kb_base),
3264 .help = "Use 1024 as the K base",
3268 .help = "Use 1000 as the K base",
3271 .help = "How many bytes per KB for reporting (1000 or 1024)",
3272 .category = FIO_OPT_C_GENERAL,
3273 .group = FIO_OPT_G_INVALID,
3276 .name = "unit_base",
3277 .lname = "Base unit for reporting (Bits or Bytes)",
3278 .type = FIO_OPT_INT,
3279 .off1 = td_var_offset(unit_base),
3284 .help = "Auto-detect",
3288 .help = "Normal (byte based)",
3292 .help = "Bit based",
3295 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3296 .category = FIO_OPT_C_GENERAL,
3297 .group = FIO_OPT_G_INVALID,
3300 .name = "hugepage-size",
3301 .lname = "Hugepage size",
3302 .type = FIO_OPT_INT,
3303 .off1 = td_var_offset(hugepage_size),
3304 .help = "When using hugepages, specify size of each page",
3305 .def = __fio_stringify(FIO_HUGE_PAGE),
3306 .interval = 1024 * 1024,
3307 .category = FIO_OPT_C_GENERAL,
3308 .group = FIO_OPT_G_INVALID,
3312 .lname = "I/O flow ID",
3313 .type = FIO_OPT_INT,
3314 .off1 = td_var_offset(flow_id),
3315 .help = "The flow index ID to use",
3317 .category = FIO_OPT_C_IO,
3318 .group = FIO_OPT_G_IO_FLOW,
3322 .lname = "I/O flow weight",
3323 .type = FIO_OPT_INT,
3324 .off1 = td_var_offset(flow),
3325 .help = "Weight for flow control of this job",
3326 .parent = "flow_id",
3329 .category = FIO_OPT_C_IO,
3330 .group = FIO_OPT_G_IO_FLOW,
3333 .name = "flow_watermark",
3334 .lname = "I/O flow watermark",
3335 .type = FIO_OPT_INT,
3336 .off1 = td_var_offset(flow_watermark),
3337 .help = "High watermark for flow control. This option"
3338 " should be set to the same value for all threads"
3339 " with non-zero flow.",
3340 .parent = "flow_id",
3343 .category = FIO_OPT_C_IO,
3344 .group = FIO_OPT_G_IO_FLOW,
3347 .name = "flow_sleep",
3348 .lname = "I/O flow sleep",
3349 .type = FIO_OPT_INT,
3350 .off1 = td_var_offset(flow_sleep),
3351 .help = "How many microseconds to sleep after being held"
3352 " back by the flow control mechanism",
3353 .parent = "flow_id",
3356 .category = FIO_OPT_C_IO,
3357 .group = FIO_OPT_G_IO_FLOW,
3364 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3365 const char *name, int val)
3367 lopt->name = (char *) name;
3369 if (o->type == FIO_OPT_STR_SET)
3370 lopt->has_arg = optional_argument;
3372 lopt->has_arg = required_argument;
3375 static void options_to_lopts(struct fio_option *opts,
3376 struct option *long_options,
3377 int i, int option_type)
3379 struct fio_option *o = &opts[0];
3381 add_to_lopt(&long_options[i], o, o->name, option_type);
3384 add_to_lopt(&long_options[i], o, o->alias, option_type);
3389 assert(i < FIO_NR_OPTIONS);
3393 void fio_options_set_ioengine_opts(struct option *long_options,
3394 struct thread_data *td)
3399 while (long_options[i].name) {
3400 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3401 memset(&long_options[i], 0, sizeof(*long_options));
3408 * Just clear out the prior ioengine options.
3413 options_to_lopts(td->io_ops->options, long_options, i,
3414 FIO_GETOPT_IOENGINE);
3417 void fio_options_dup_and_init(struct option *long_options)
3421 options_init(fio_options);
3424 while (long_options[i].name)
3427 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3430 struct fio_keyword {
3436 static struct fio_keyword fio_keywords[] = {
3438 .word = "$pagesize",
3439 .desc = "Page size in the system",
3442 .word = "$mb_memory",
3443 .desc = "Megabytes of memory online",
3447 .desc = "Number of CPUs online in the system",
3454 void fio_keywords_init(void)
3456 unsigned long long mb_memory;
3460 sprintf(buf, "%lu", (unsigned long) page_size);
3461 fio_keywords[0].replace = strdup(buf);
3463 mb_memory = os_phys_mem() / (1024 * 1024);
3464 sprintf(buf, "%llu", mb_memory);
3465 fio_keywords[1].replace = strdup(buf);
3468 sprintf(buf, "%lu", l);
3469 fio_keywords[2].replace = strdup(buf);
3474 static char *bc_calc(char *str)
3476 char buf[128], *tmp;
3481 * No math, just return string
3483 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3484 !strchr(str, '/')) || strchr(str, '\''))
3488 * Split option from value, we only need to calculate the value
3490 tmp = strchr(str, '=');
3497 * Prevent buffer overflows; such a case isn't reasonable anyway
3499 if (strlen(str) >= 128 || strlen(tmp) > 100)
3502 sprintf(buf, "which %s > /dev/null", BC_APP);
3504 log_err("fio: bc is needed for performing math\n");
3508 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3509 f = popen(buf, "r");
3513 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3518 buf[(tmp - str) + ret - 1] = '\0';
3519 memcpy(buf, str, tmp - str);
3525 * Return a copy of the input string with substrings of the form ${VARNAME}
3526 * substituted with the value of the environment variable VARNAME. The
3527 * substitution always occurs, even if VARNAME is empty or the corresponding
3528 * environment variable undefined.
3530 static char *option_dup_subs(const char *opt)
3532 char out[OPT_LEN_MAX+1];
3533 char in[OPT_LEN_MAX+1];
3536 char *ch1, *ch2, *env;
3537 ssize_t nchr = OPT_LEN_MAX;
3540 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3541 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3545 in[OPT_LEN_MAX] = '\0';
3546 strncpy(in, opt, OPT_LEN_MAX);
3548 while (*inptr && nchr > 0) {
3549 if (inptr[0] == '$' && inptr[1] == '{') {
3550 ch2 = strchr(inptr, '}');
3551 if (ch2 && inptr+1 < ch2) {
3558 envlen = strlen(env);
3559 if (envlen <= nchr) {
3560 memcpy(outptr, env, envlen);
3570 *outptr++ = *inptr++;
3579 * Look for reserved variable names and replace them with real values
3581 static char *fio_keyword_replace(char *opt)
3587 for (i = 0; fio_keywords[i].word != NULL; i++) {
3588 struct fio_keyword *kw = &fio_keywords[i];
3590 while ((s = strstr(opt, kw->word)) != NULL) {
3591 char *new = malloc(strlen(opt) + 1);
3597 * Copy part of the string before the keyword and
3598 * sprintf() the replacement after it.
3600 memcpy(new, opt, olen);
3601 len = sprintf(new + olen, "%s", kw->replace);
3604 * If there's more in the original string, copy that
3607 opt += strlen(kw->word) + olen;
3609 memcpy(new + olen + len, opt, opt - o_org - 1);
3612 * replace opt and free the old opt
3622 * Check for potential math and invoke bc, if possible
3630 static char **dup_and_sub_options(char **opts, int num_opts)
3633 char **opts_copy = malloc(num_opts * sizeof(*opts));
3634 for (i = 0; i < num_opts; i++) {
3635 opts_copy[i] = option_dup_subs(opts[i]);
3638 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3643 int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3646 int i, ret, unknown;
3649 sort_options(opts, fio_options, num_opts);
3650 opts_copy = dup_and_sub_options(opts, num_opts);
3652 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3653 struct fio_option *o;
3654 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3655 &o, td, dump_cmdline);
3663 opts_copy[i] = NULL;
3670 ret |= ioengine_load(td);
3672 sort_options(opts_copy, td->io_ops->options, num_opts);
3675 for (i = 0; i < num_opts; i++) {
3676 struct fio_option *o = NULL;
3682 newret = parse_option(opts_copy[i], opts[i],
3683 td->io_ops->options, &o,
3684 td->eo, dump_cmdline);
3688 log_err("Bad option <%s>\n", opts[i]);
3691 opts_copy[i] = NULL;
3699 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3701 return parse_cmd_option(opt, val, fio_options, td);
3704 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3707 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
3710 void fio_fill_default_options(struct thread_data *td)
3712 fill_default_options(td, fio_options);
3715 int fio_show_option_help(const char *opt)
3717 return show_cmd_help(fio_options, opt);
3720 void options_mem_dupe(void *data, struct fio_option *options)
3722 struct fio_option *o;
3725 for (o = &options[0]; o->name; o++) {
3726 if (o->type != FIO_OPT_STR_STORE)
3729 ptr = td_var(data, o->off1);
3731 *ptr = strdup(*ptr);
3736 * dupe FIO_OPT_STR_STORE options
3738 void fio_options_mem_dupe(struct thread_data *td)
3740 options_mem_dupe(&td->o, fio_options);
3742 if (td->eo && td->io_ops) {
3743 void *oldeo = td->eo;
3745 td->eo = malloc(td->io_ops->option_struct_size);
3746 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3747 options_mem_dupe(td->eo, td->io_ops->options);
3751 unsigned int fio_get_kb_base(void *data)
3753 struct thread_options *o = data;
3754 unsigned int kb_base = 0;
3757 kb_base = o->kb_base;
3764 int add_option(struct fio_option *o)
3766 struct fio_option *__o;
3775 memcpy(&fio_options[opt_index], o, sizeof(*o));
3779 void invalidate_profile_options(const char *prof_name)
3781 struct fio_option *o;
3785 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3786 o->type = FIO_OPT_INVALID;
3787 o->prof_name = NULL;
3793 void add_opt_posval(const char *optname, const char *ival, const char *help)
3795 struct fio_option *o;
3798 o = find_option(fio_options, optname);
3802 for (i = 0; i < PARSE_MAX_VP; i++) {
3803 if (o->posval[i].ival)
3806 o->posval[i].ival = ival;
3807 o->posval[i].help = help;
3812 void del_opt_posval(const char *optname, const char *ival)
3814 struct fio_option *o;
3817 o = find_option(fio_options, optname);
3821 for (i = 0; i < PARSE_MAX_VP; i++) {
3822 if (!o->posval[i].ival)
3824 if (strcmp(o->posval[i].ival, ival))
3827 o->posval[i].ival = NULL;
3828 o->posval[i].help = NULL;
3832 void fio_options_free(struct thread_data *td)
3834 options_free(fio_options, td);
3835 if (td->eo && td->io_ops && td->io_ops->options) {
3836 options_free(td->io_ops->options, td->eo);
3842 struct fio_option *fio_option_find(const char *name)
3844 return find_option(fio_options, name);