18 #include "crc/crc32c.h"
21 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
23 static char *get_opt_postfix(const char *str)
25 char *p = strstr(str, ":");
31 strip_blank_front(&p);
36 static int converthexchartoint(char a)
56 static int bs_cmp(const void *p1, const void *p2)
58 const struct bssplit *bsp1 = p1;
59 const struct bssplit *bsp2 = p2;
61 return bsp1->perc < bsp2->perc;
64 static int bssplit_ddir(struct thread_options *o, int ddir, char *str)
66 struct bssplit *bssplit;
67 unsigned int i, perc, perc_missing;
68 unsigned int max_bs, min_bs;
72 o->bssplit_nr[ddir] = 4;
73 bssplit = malloc(4 * sizeof(struct bssplit));
78 while ((fname = strsep(&str, ":")) != NULL) {
85 * grow struct buffer, if needed
87 if (i == o->bssplit_nr[ddir]) {
88 o->bssplit_nr[ddir] <<= 1;
89 bssplit = realloc(bssplit, o->bssplit_nr[ddir]
90 * sizeof(struct bssplit));
93 perc_str = strstr(fname, "/");
97 perc = atoi(perc_str);
105 if (str_to_decimal(fname, &val, 1, o)) {
106 log_err("fio: bssplit conversion failed\n");
117 bssplit[i].perc = perc;
121 o->bssplit_nr[ddir] = i;
124 * Now check if the percentages add up, and how much is missing
126 perc = perc_missing = 0;
127 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
128 struct bssplit *bsp = &bssplit[i];
130 if (bsp->perc == (unsigned char) -1)
137 log_err("fio: bssplit percentages add to more than 100%%\n");
142 * If values didn't have a percentage set, divide the remains between
146 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
147 struct bssplit *bsp = &bssplit[i];
149 if (bsp->perc == (unsigned char) -1)
150 bsp->perc = (100 - perc) / perc_missing;
154 o->min_bs[ddir] = min_bs;
155 o->max_bs[ddir] = max_bs;
158 * now sort based on percentages, for ease of lookup
160 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
161 o->bssplit[ddir] = bssplit;
165 static int str_bssplit_cb(void *data, const char *input)
167 struct thread_data *td = data;
168 char *str, *p, *odir, *ddir;
171 p = str = strdup(input);
173 strip_blank_front(&str);
174 strip_blank_end(str);
176 odir = strchr(str, ',');
178 ddir = strchr(odir + 1, ',');
180 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
186 op = strdup(odir + 1);
187 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
192 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
195 ret = bssplit_ddir(&td->o, DDIR_READ, str);
201 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
206 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
209 ret = bssplit_ddir(&td->o, DDIR_READ, str);
216 static int str2error(char *str)
218 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
219 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
220 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
221 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
222 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
223 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
224 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
225 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
226 int i = 0, num = sizeof(err) / sizeof(void *);
229 if (!strcmp(err[i], str))
236 static int ignore_error_type(struct thread_data *td, int etype, char *str)
242 if (etype >= ERROR_TYPE_CNT) {
243 log_err("Illegal error type\n");
247 td->o.ignore_error_nr[etype] = 4;
248 error = malloc(4 * sizeof(struct bssplit));
251 while ((fname = strsep(&str, ":")) != NULL) {
257 * grow struct buffer, if needed
259 if (i == td->o.ignore_error_nr[etype]) {
260 td->o.ignore_error_nr[etype] <<= 1;
261 error = realloc(error, td->o.ignore_error_nr[etype]
264 if (fname[0] == 'E') {
265 error[i] = str2error(fname);
267 error[i] = atoi(fname);
272 log_err("Unknown error %s, please use number value \n",
279 td->o.continue_on_error |= 1 << etype;
280 td->o.ignore_error_nr[etype] = i;
281 td->o.ignore_error[etype] = error;
287 static int str_ignore_error_cb(void *data, const char *input)
289 struct thread_data *td = data;
291 int type = 0, ret = 1;
292 p = str = strdup(input);
294 strip_blank_front(&str);
295 strip_blank_end(str);
301 ret = ignore_error_type(td, type, p);
311 static int str_rw_cb(void *data, const char *str)
313 struct thread_data *td = data;
314 struct thread_options *o = &td->o;
315 char *nr = get_opt_postfix(str);
324 o->ddir_seq_nr = atoi(nr);
328 if (str_to_decimal(nr, &val, 1, o)) {
329 log_err("fio: rw postfix parsing failed\n");
334 o->ddir_seq_add = val;
341 static int str_mem_cb(void *data, const char *mem)
343 struct thread_data *td = data;
344 struct thread_options *o = &td->o;
346 if (o->mem_type == MEM_MMAPHUGE || o->mem_type == MEM_MMAP) {
347 o->mmapfile = get_opt_postfix(mem);
348 if (o->mem_type == MEM_MMAPHUGE && !o->mmapfile) {
349 log_err("fio: mmaphuge:/path/to/file\n");
357 static int fio_clock_source_cb(void *data, const char *str)
359 struct thread_data *td = data;
361 fio_clock_source = td->o.clocksource;
366 static int str_rwmix_read_cb(void *data, unsigned long long *val)
368 struct thread_data *td = data;
370 td->o.rwmix[DDIR_READ] = *val;
371 td->o.rwmix[DDIR_WRITE] = 100 - *val;
375 static int str_rwmix_write_cb(void *data, unsigned long long *val)
377 struct thread_data *td = data;
379 td->o.rwmix[DDIR_WRITE] = *val;
380 td->o.rwmix[DDIR_READ] = 100 - *val;
384 static int str_exitall_cb(void)
386 exitall_on_terminate = 1;
390 #ifdef FIO_HAVE_CPU_AFFINITY
391 static int str_cpumask_cb(void *data, unsigned long long *val)
393 struct thread_data *td = data;
398 ret = fio_cpuset_init(&td->o.cpumask);
400 log_err("fio: cpuset_init failed\n");
401 td_verror(td, ret, "fio_cpuset_init");
405 max_cpu = cpus_online();
407 for (i = 0; i < sizeof(int) * 8; i++) {
408 if ((1 << i) & *val) {
410 log_err("fio: CPU %d too large (max=%ld)\n", i,
414 dprint(FD_PARSE, "set cpu allowed %d\n", i);
415 fio_cpu_set(&td->o.cpumask, i);
419 td->o.cpumask_set = 1;
423 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
430 ret = fio_cpuset_init(mask);
432 log_err("fio: cpuset_init failed\n");
433 td_verror(td, ret, "fio_cpuset_init");
437 p = str = strdup(input);
439 strip_blank_front(&str);
440 strip_blank_end(str);
442 max_cpu = cpus_online();
444 while ((cpu = strsep(&str, ",")) != NULL) {
453 while ((cpu2 = strsep(&str2, "-")) != NULL) {
463 while (icpu <= icpu2) {
464 if (icpu >= FIO_MAX_CPUS) {
465 log_err("fio: your OS only supports up to"
466 " %d CPUs\n", (int) FIO_MAX_CPUS);
470 if (icpu > max_cpu) {
471 log_err("fio: CPU %d too large (max=%ld)\n",
477 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
478 fio_cpu_set(mask, icpu);
487 td->o.cpumask_set = 1;
491 static int str_cpus_allowed_cb(void *data, const char *input)
493 struct thread_data *td = data;
496 ret = set_cpus_allowed(td, &td->o.cpumask, input);
498 td->o.cpumask_set = 1;
503 static int str_verify_cpus_allowed_cb(void *data, const char *input)
505 struct thread_data *td = data;
508 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
510 td->o.verify_cpumask_set = 1;
516 #ifdef FIO_HAVE_LIBNUMA
517 static int str_numa_cpunodes_cb(void *data, char *input)
519 struct thread_data *td = data;
521 /* numa_parse_nodestring() parses a character string list
522 * of nodes into a bit mask. The bit mask is allocated by
523 * numa_allocate_nodemask(), so it should be freed by
524 * numa_free_nodemask().
526 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
527 if (td->o.numa_cpunodesmask == NULL) {
528 log_err("fio: numa_parse_nodestring failed\n");
529 td_verror(td, 1, "str_numa_cpunodes_cb");
533 td->o.numa_cpumask_set = 1;
537 static int str_numa_mpol_cb(void *data, char *input)
539 struct thread_data *td = data;
540 const char * const policy_types[] =
541 { "default", "prefer", "bind", "interleave", "local" };
544 char *nodelist = strchr(input, ':');
546 /* NUL-terminate mode */
550 for (i = 0; i <= MPOL_LOCAL; i++) {
551 if (!strcmp(input, policy_types[i])) {
552 td->o.numa_mem_mode = i;
556 if (i > MPOL_LOCAL) {
557 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
561 switch (td->o.numa_mem_mode) {
564 * Insist on a nodelist of one node only
567 char *rest = nodelist;
568 while (isdigit(*rest))
571 log_err("fio: one node only for \'prefer\'\n");
575 log_err("fio: one node is needed for \'prefer\'\n");
579 case MPOL_INTERLEAVE:
581 * Default to online nodes with memory if no nodelist
584 nodelist = strdup("all");
589 * Don't allow a nodelist
592 log_err("fio: NO nodelist for \'local\'\n");
598 * Insist on a nodelist
601 log_err("fio: a nodelist is needed for \'bind\'\n");
608 /* numa_parse_nodestring() parses a character string list
609 * of nodes into a bit mask. The bit mask is allocated by
610 * numa_allocate_nodemask(), so it should be freed by
611 * numa_free_nodemask().
613 switch (td->o.numa_mem_mode) {
615 td->o.numa_mem_prefer_node = atoi(nodelist);
617 case MPOL_INTERLEAVE:
619 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
620 if (td->o.numa_memnodesmask == NULL) {
621 log_err("fio: numa_parse_nodestring failed\n");
622 td_verror(td, 1, "str_numa_memnodes_cb");
632 td->o.numa_memmask_set = 1;
640 static int str_fst_cb(void *data, const char *str)
642 struct thread_data *td = data;
643 char *nr = get_opt_postfix(str);
645 td->file_service_nr = 1;
647 td->file_service_nr = atoi(nr);
654 #ifdef FIO_HAVE_SYNC_FILE_RANGE
655 static int str_sfr_cb(void *data, const char *str)
657 struct thread_data *td = data;
658 char *nr = get_opt_postfix(str);
660 td->sync_file_range_nr = 1;
662 td->sync_file_range_nr = atoi(nr);
670 static int str_random_distribution_cb(void *data, const char *str)
672 struct thread_data *td = data;
676 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
678 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
683 nr = get_opt_postfix(str);
684 if (nr && !str_to_float(nr, &val)) {
685 log_err("fio: random postfix parsing failed\n");
692 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
694 log_err("fio: zipf theta must different than 1.0\n");
697 td->o.zipf_theta.u.f = val;
699 if (val <= 0.00 || val >= 1.00) {
700 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
703 td->o.pareto_h.u.f = val;
710 * Return next file in the string. Files are separated with ':'. If the ':'
711 * is escaped with a '\', then that ':' is part of the filename and does not
712 * indicate a new file.
714 static char *get_next_file_name(char **ptr)
719 if (!str || !strlen(str))
725 * No colon, we are done
727 p = strchr(str, ':');
734 * We got a colon, but it's the first character. Skip and
742 if (*(p - 1) != '\\') {
748 memmove(p - 1, p, strlen(p) + 1);
755 static int str_filename_cb(void *data, const char *input)
757 struct thread_data *td = data;
758 char *fname, *str, *p;
760 p = str = strdup(input);
762 strip_blank_front(&str);
763 strip_blank_end(str);
765 if (!td->files_index)
768 while ((fname = get_next_file_name(&str)) != NULL) {
779 static int str_directory_cb(void *data, const char fio_unused *str)
781 struct thread_data *td = data;
784 if (lstat(td->o.directory, &sb) < 0) {
787 log_err("fio: %s is not a directory\n", td->o.directory);
788 td_verror(td, ret, "lstat");
791 if (!S_ISDIR(sb.st_mode)) {
792 log_err("fio: %s is not a directory\n", td->o.directory);
799 static int str_opendir_cb(void *data, const char fio_unused *str)
801 struct thread_data *td = data;
803 if (!td->files_index)
806 return add_dir_files(td, td->o.opendir);
809 static int str_verify_pattern_cb(void *data, const char *input)
811 struct thread_data *td = data;
813 int i = 0, j = 0, len, k, base = 10;
816 loc1 = strstr(input, "0x");
817 loc2 = strstr(input, "0X");
820 off = strtol(input, NULL, base);
821 if (off != LONG_MAX || errno != ERANGE) {
823 td->o.verify_pattern[i] = off & 0xff;
832 j = loc1 - input + 2;
834 j = loc2 - input + 2;
837 if (len - j < MAX_PATTERN_SIZE * 2) {
839 off = converthexchartoint(input[k--]);
841 off += (converthexchartoint(input[k--])
843 td->o.verify_pattern[i++] = (char) off;
849 * Fill the pattern all the way to the end. This greatly reduces
850 * the number of memcpy's we have to do when verifying the IO.
852 while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) {
853 memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i);
858 * The code in verify_io_u_pattern assumes a single byte pattern
859 * fills the whole verify pattern buffer.
861 memset(td->o.verify_pattern, td->o.verify_pattern[0],
865 td->o.verify_pattern_bytes = i;
868 * VERIFY_META could already be set
870 if (td->o.verify == VERIFY_NONE)
871 td->o.verify = VERIFY_PATTERN;
876 static int str_lockfile_cb(void *data, const char *str)
878 struct thread_data *td = data;
879 char *nr = get_opt_postfix(str);
881 td->o.lockfile_batch = 1;
883 td->o.lockfile_batch = atoi(nr);
890 static int str_gtod_reduce_cb(void *data, int *il)
892 struct thread_data *td = data;
895 td->o.disable_lat = !!val;
896 td->o.disable_clat = !!val;
897 td->o.disable_slat = !!val;
898 td->o.disable_bw = !!val;
899 td->o.clat_percentiles = !val;
901 td->tv_cache_mask = 63;
906 static int str_gtod_cpu_cb(void *data, long long *il)
908 struct thread_data *td = data;
911 td->o.gtod_cpu = val;
912 td->o.gtod_offload = 1;
916 static int str_size_cb(void *data, unsigned long long *__val)
918 struct thread_data *td = data;
919 unsigned long long v = *__val;
921 if (parse_is_percent(v)) {
923 td->o.size_percent = -1ULL - v;
930 static int rw_verify(struct fio_option *o, void *data)
932 struct thread_data *td = data;
934 if (read_only && td_write(td)) {
935 log_err("fio: job <%s> has write bit set, but fio is in"
936 " read-only mode\n", td->o.name);
943 static int gtod_cpu_verify(struct fio_option *o, void *data)
945 #ifndef FIO_HAVE_CPU_AFFINITY
946 struct thread_data *td = data;
948 if (td->o.gtod_cpu) {
949 log_err("fio: platform must support CPU affinity for"
950 "gettimeofday() offloading\n");
958 static int kb_base_verify(struct fio_option *o, void *data)
960 struct thread_data *td = data;
962 if (td->o.kb_base != 1024 && td->o.kb_base != 1000) {
963 log_err("fio: kb_base set to nonsensical value: %u\n",
974 static struct opt_group fio_opt_groups[] = {
977 .mask = FIO_OPT_C_GENERAL,
981 .mask = FIO_OPT_C_IO,
985 .mask = FIO_OPT_C_FILE,
988 .name = "Statistics",
989 .mask = FIO_OPT_C_STAT,
993 .mask = FIO_OPT_C_LOG,
997 .mask = FIO_OPT_C_PROFILE,
1004 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1005 unsigned int inv_mask)
1007 struct opt_group *og;
1010 if (*mask == inv_mask || !*mask)
1013 for (i = 0; ogs[i].name; i++) {
1016 if (*mask & og->mask) {
1017 *mask &= ~(og->mask);
1025 struct opt_group *opt_group_from_mask(unsigned int *mask)
1027 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1030 static struct opt_group fio_opt_cat_groups[] = {
1033 .mask = FIO_OPT_G_RATE,
1037 .mask = FIO_OPT_G_ZONE,
1040 .name = "Read/write mix",
1041 .mask = FIO_OPT_G_RWMIX,
1045 .mask = FIO_OPT_G_VERIFY,
1049 .mask = FIO_OPT_G_TRIM,
1052 .name = "I/O Logging",
1053 .mask = FIO_OPT_G_IOLOG,
1056 .name = "I/O Depth",
1057 .mask = FIO_OPT_G_IO_DEPTH,
1061 .mask = FIO_OPT_G_IO_FLOW,
1064 .name = "Description",
1065 .mask = FIO_OPT_G_DESC,
1069 .mask = FIO_OPT_G_FILENAME,
1072 .name = "General I/O",
1073 .mask = FIO_OPT_G_IO_BASIC,
1077 .mask = FIO_OPT_G_CGROUP,
1081 .mask = FIO_OPT_G_RUNTIME,
1085 .mask = FIO_OPT_G_PROCESS,
1088 .name = "Job credentials / priority",
1089 .mask = FIO_OPT_G_CRED,
1092 .name = "Clock settings",
1093 .mask = FIO_OPT_G_CLOCK,
1097 .mask = FIO_OPT_G_IO_TYPE,
1100 .name = "I/O Thinktime",
1101 .mask = FIO_OPT_G_THINKTIME,
1104 .name = "Randomizations",
1105 .mask = FIO_OPT_G_RANDOM,
1108 .name = "I/O buffers",
1109 .mask = FIO_OPT_G_IO_BUF,
1112 .name = "Tiobench profile",
1113 .mask = FIO_OPT_G_TIOBENCH,
1121 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1123 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1127 * Map of job/command line options
1129 struct fio_option fio_options[FIO_MAX_OPTS] = {
1131 .name = "description",
1132 .lname = "Description of job",
1133 .type = FIO_OPT_STR_STORE,
1134 .off1 = td_var_offset(description),
1135 .help = "Text job description",
1136 .category = FIO_OPT_C_GENERAL,
1137 .group = FIO_OPT_G_DESC,
1141 .lname = "Job name",
1142 .type = FIO_OPT_STR_STORE,
1143 .off1 = td_var_offset(name),
1144 .help = "Name of this job",
1145 .category = FIO_OPT_C_GENERAL,
1146 .group = FIO_OPT_G_DESC,
1150 .lname = "Filename(s)",
1151 .type = FIO_OPT_STR_STORE,
1152 .off1 = td_var_offset(filename),
1153 .cb = str_filename_cb,
1154 .prio = -1, /* must come after "directory" */
1155 .help = "File(s) to use for the workload",
1156 .category = FIO_OPT_C_FILE,
1157 .group = FIO_OPT_G_FILENAME,
1160 .name = "directory",
1161 .lname = "Directory",
1162 .type = FIO_OPT_STR_STORE,
1163 .off1 = td_var_offset(directory),
1164 .cb = str_directory_cb,
1165 .help = "Directory to store files in",
1166 .category = FIO_OPT_C_FILE,
1167 .group = FIO_OPT_G_FILENAME,
1171 .lname = "Lockfile",
1172 .type = FIO_OPT_STR,
1173 .cb = str_lockfile_cb,
1174 .off1 = td_var_offset(file_lock_mode),
1175 .help = "Lock file when doing IO to it",
1176 .parent = "filename",
1179 .category = FIO_OPT_C_FILE,
1180 .group = FIO_OPT_G_FILENAME,
1183 .oval = FILE_LOCK_NONE,
1184 .help = "No file locking",
1186 { .ival = "exclusive",
1187 .oval = FILE_LOCK_EXCLUSIVE,
1188 .help = "Exclusive file lock",
1191 .ival = "readwrite",
1192 .oval = FILE_LOCK_READWRITE,
1193 .help = "Read vs write lock",
1199 .lname = "Open directory",
1200 .type = FIO_OPT_STR_STORE,
1201 .off1 = td_var_offset(opendir),
1202 .cb = str_opendir_cb,
1203 .help = "Recursively add files from this directory and down",
1204 .category = FIO_OPT_C_FILE,
1205 .group = FIO_OPT_G_FILENAME,
1209 .lname = "Read/write",
1210 .alias = "readwrite",
1211 .type = FIO_OPT_STR,
1213 .off1 = td_var_offset(td_ddir),
1214 .help = "IO direction",
1216 .verify = rw_verify,
1217 .category = FIO_OPT_C_IO,
1218 .group = FIO_OPT_G_IO_BASIC,
1221 .oval = TD_DDIR_READ,
1222 .help = "Sequential read",
1225 .oval = TD_DDIR_WRITE,
1226 .help = "Sequential write",
1229 .oval = TD_DDIR_TRIM,
1230 .help = "Sequential trim",
1232 { .ival = "randread",
1233 .oval = TD_DDIR_RANDREAD,
1234 .help = "Random read",
1236 { .ival = "randwrite",
1237 .oval = TD_DDIR_RANDWRITE,
1238 .help = "Random write",
1240 { .ival = "randtrim",
1241 .oval = TD_DDIR_RANDTRIM,
1242 .help = "Random trim",
1246 .help = "Sequential read and write mix",
1248 { .ival = "readwrite",
1250 .help = "Sequential read and write mix",
1253 .oval = TD_DDIR_RANDRW,
1254 .help = "Random read and write mix"
1259 .name = "rw_sequencer",
1260 .lname = "RW Sequencer",
1261 .type = FIO_OPT_STR,
1262 .off1 = td_var_offset(rw_seq),
1263 .help = "IO offset generator modifier",
1264 .def = "sequential",
1265 .category = FIO_OPT_C_IO,
1266 .group = FIO_OPT_G_IO_BASIC,
1268 { .ival = "sequential",
1270 .help = "Generate sequential offsets",
1272 { .ival = "identical",
1273 .oval = RW_SEQ_IDENT,
1274 .help = "Generate identical offsets",
1281 .lname = "IO Engine",
1282 .type = FIO_OPT_STR_STORE,
1283 .off1 = td_var_offset(ioengine),
1284 .help = "IO engine to use",
1285 .def = FIO_PREFERRED_ENGINE,
1286 .category = FIO_OPT_C_IO,
1287 .group = FIO_OPT_G_IO_BASIC,
1290 .help = "Use read/write",
1293 .help = "Use pread/pwrite",
1296 .help = "Use readv/writev",
1298 #ifdef FIO_HAVE_LIBAIO
1300 .help = "Linux native asynchronous IO",
1303 #ifdef FIO_HAVE_POSIXAIO
1304 { .ival = "posixaio",
1305 .help = "POSIX asynchronous IO",
1308 #ifdef FIO_HAVE_SOLARISAIO
1309 { .ival = "solarisaio",
1310 .help = "Solaris native asynchronous IO",
1313 #ifdef FIO_HAVE_WINDOWSAIO
1314 { .ival = "windowsaio",
1315 .help = "Windows native asynchronous IO"
1319 .help = "Memory mapped IO"
1321 #ifdef FIO_HAVE_SPLICE
1323 .help = "splice/vmsplice based IO",
1325 { .ival = "netsplice",
1326 .help = "splice/vmsplice to/from the network",
1329 #ifdef FIO_HAVE_SGIO
1331 .help = "SCSI generic v3 IO",
1335 .help = "Testing engine (no data transfer)",
1338 .help = "Network IO",
1340 #ifdef FIO_HAVE_SYSLET
1341 { .ival = "syslet-rw",
1342 .help = "syslet enabled async pread/pwrite IO",
1346 .help = "CPU cycle burner engine",
1348 #ifdef FIO_HAVE_GUASI
1350 .help = "GUASI IO engine",
1353 #ifdef FIO_HAVE_BINJECT
1354 { .ival = "binject",
1355 .help = "binject direct inject block engine",
1358 #ifdef FIO_HAVE_RDMA
1360 .help = "RDMA IO engine",
1363 #ifdef FIO_HAVE_FUSION_AW
1364 { .ival = "fusion-aw-sync",
1365 .help = "Fusion-io atomic write engine",
1368 #ifdef FIO_HAVE_E4_ENG
1369 { .ival = "e4defrag",
1370 .help = "ext4 defrag engine",
1373 #ifdef FIO_HAVE_FALLOC_ENG
1375 .help = "fallocate() file based engine",
1378 { .ival = "external",
1379 .help = "Load external engine (append name)",
1385 .lname = "IO Depth",
1386 .type = FIO_OPT_INT,
1387 .off1 = td_var_offset(iodepth),
1388 .help = "Number of IO buffers to keep in flight",
1392 .category = FIO_OPT_C_IO,
1393 .group = FIO_OPT_G_IO_BASIC,
1396 .name = "iodepth_batch",
1397 .lname = "IO Depth batch",
1398 .alias = "iodepth_batch_submit",
1399 .type = FIO_OPT_INT,
1400 .off1 = td_var_offset(iodepth_batch),
1401 .help = "Number of IO buffers to submit in one go",
1402 .parent = "iodepth",
1407 .category = FIO_OPT_C_IO,
1408 .group = FIO_OPT_G_IO_BASIC,
1411 .name = "iodepth_batch_complete",
1412 .lname = "IO Depth batch complete",
1413 .type = FIO_OPT_INT,
1414 .off1 = td_var_offset(iodepth_batch_complete),
1415 .help = "Number of IO buffers to retrieve in one go",
1416 .parent = "iodepth",
1421 .category = FIO_OPT_C_IO,
1422 .group = FIO_OPT_G_IO_BASIC,
1425 .name = "iodepth_low",
1426 .lname = "IO Depth batch low",
1427 .type = FIO_OPT_INT,
1428 .off1 = td_var_offset(iodepth_low),
1429 .help = "Low water mark for queuing depth",
1430 .parent = "iodepth",
1433 .category = FIO_OPT_C_IO,
1434 .group = FIO_OPT_G_IO_BASIC,
1439 .type = FIO_OPT_STR_VAL,
1441 .help = "Total size of device or files",
1442 .interval = 1024 * 1024,
1443 .category = FIO_OPT_C_IO,
1444 .group = FIO_OPT_G_INVALID,
1447 .name = "fill_device",
1448 .lname = "Fill device",
1450 .type = FIO_OPT_BOOL,
1451 .off1 = td_var_offset(fill_device),
1452 .help = "Write until an ENOSPC error occurs",
1454 .category = FIO_OPT_C_FILE,
1455 .group = FIO_OPT_G_INVALID,
1459 .lname = "File size",
1460 .type = FIO_OPT_STR_VAL,
1461 .off1 = td_var_offset(file_size_low),
1462 .off2 = td_var_offset(file_size_high),
1464 .help = "Size of individual files",
1465 .interval = 1024 * 1024,
1466 .category = FIO_OPT_C_FILE,
1467 .group = FIO_OPT_G_INVALID,
1471 .lname = "IO offset",
1472 .alias = "fileoffset",
1473 .type = FIO_OPT_STR_VAL,
1474 .off1 = td_var_offset(start_offset),
1475 .help = "Start IO from this offset",
1477 .interval = 1024 * 1024,
1478 .category = FIO_OPT_C_IO,
1479 .group = FIO_OPT_G_INVALID,
1482 .name = "offset_increment",
1483 .lname = "IO offset increment",
1484 .type = FIO_OPT_STR_VAL,
1485 .off1 = td_var_offset(offset_increment),
1486 .help = "What is the increment from one offset to the next",
1490 .interval = 1024 * 1024,
1491 .category = FIO_OPT_C_IO,
1492 .group = FIO_OPT_G_INVALID,
1496 .lname = "Block size",
1497 .alias = "blocksize",
1498 .type = FIO_OPT_INT,
1499 .off1 = td_var_offset(bs[DDIR_READ]),
1500 .off2 = td_var_offset(bs[DDIR_WRITE]),
1501 .off3 = td_var_offset(bs[DDIR_TRIM]),
1503 .help = "Block size unit",
1508 .category = FIO_OPT_C_IO,
1509 .group = FIO_OPT_G_INVALID,
1513 .lname = "Block size align",
1514 .alias = "blockalign",
1515 .type = FIO_OPT_INT,
1516 .off1 = td_var_offset(ba[DDIR_READ]),
1517 .off2 = td_var_offset(ba[DDIR_WRITE]),
1518 .off3 = td_var_offset(ba[DDIR_TRIM]),
1520 .help = "IO block offset alignment",
1524 .category = FIO_OPT_C_IO,
1525 .group = FIO_OPT_G_INVALID,
1529 .lname = "Block size range",
1530 .alias = "blocksize_range",
1531 .type = FIO_OPT_RANGE,
1532 .off1 = td_var_offset(min_bs[DDIR_READ]),
1533 .off2 = td_var_offset(max_bs[DDIR_READ]),
1534 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1535 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1536 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1537 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1539 .help = "Set block size range (in more detail than bs)",
1543 .category = FIO_OPT_C_IO,
1544 .group = FIO_OPT_G_INVALID,
1548 .lname = "Block size split",
1549 .type = FIO_OPT_STR,
1550 .cb = str_bssplit_cb,
1551 .help = "Set a specific mix of block sizes",
1554 .category = FIO_OPT_C_IO,
1555 .group = FIO_OPT_G_INVALID,
1558 .name = "bs_unaligned",
1559 .lname = "Block size unaligned",
1560 .alias = "blocksize_unaligned",
1561 .type = FIO_OPT_STR_SET,
1562 .off1 = td_var_offset(bs_unaligned),
1563 .help = "Don't sector align IO buffer sizes",
1566 .category = FIO_OPT_C_IO,
1567 .group = FIO_OPT_G_INVALID,
1570 .name = "randrepeat",
1571 .lname = "Random repeatable",
1572 .type = FIO_OPT_BOOL,
1573 .off1 = td_var_offset(rand_repeatable),
1574 .help = "Use repeatable random IO pattern",
1578 .category = FIO_OPT_C_IO,
1579 .group = FIO_OPT_G_RANDOM,
1582 .name = "use_os_rand",
1583 .lname = "Use OS random",
1584 .type = FIO_OPT_BOOL,
1585 .off1 = td_var_offset(use_os_rand),
1586 .help = "Set to use OS random generator",
1590 .category = FIO_OPT_C_IO,
1591 .group = FIO_OPT_G_RANDOM,
1594 .name = "norandommap",
1595 .lname = "No randommap",
1596 .type = FIO_OPT_STR_SET,
1597 .off1 = td_var_offset(norandommap),
1598 .help = "Accept potential duplicate random blocks",
1602 .category = FIO_OPT_C_IO,
1603 .group = FIO_OPT_G_RANDOM,
1606 .name = "softrandommap",
1607 .lname = "Soft randommap",
1608 .type = FIO_OPT_BOOL,
1609 .off1 = td_var_offset(softrandommap),
1610 .help = "Set norandommap if randommap allocation fails",
1611 .parent = "norandommap",
1614 .category = FIO_OPT_C_IO,
1615 .group = FIO_OPT_G_RANDOM,
1618 .name = "random_generator",
1619 .type = FIO_OPT_STR,
1620 .off1 = td_var_offset(random_generator),
1621 .help = "Type of random number generator to use",
1622 .def = "tausworthe",
1624 { .ival = "tausworthe",
1625 .oval = FIO_RAND_GEN_TAUSWORTHE,
1626 .help = "Strong Tausworthe generator",
1629 .oval = FIO_RAND_GEN_LFSR,
1630 .help = "Variable length LFSR",
1633 .category = FIO_OPT_C_IO,
1634 .group = FIO_OPT_G_RANDOM,
1637 .name = "random_distribution",
1638 .type = FIO_OPT_STR,
1639 .off1 = td_var_offset(random_distribution),
1640 .cb = str_random_distribution_cb,
1641 .help = "Random offset distribution generator",
1645 .oval = FIO_RAND_DIST_RANDOM,
1646 .help = "Completely random",
1649 .oval = FIO_RAND_DIST_ZIPF,
1650 .help = "Zipf distribution",
1653 .oval = FIO_RAND_DIST_PARETO,
1654 .help = "Pareto distribution",
1657 .category = FIO_OPT_C_IO,
1658 .group = FIO_OPT_G_RANDOM,
1662 .lname = "Number of files",
1663 .alias = "nr_files",
1664 .type = FIO_OPT_INT,
1665 .off1 = td_var_offset(nr_files),
1666 .help = "Split job workload between this number of files",
1669 .category = FIO_OPT_C_FILE,
1670 .group = FIO_OPT_G_INVALID,
1673 .name = "openfiles",
1674 .lname = "Number of open files",
1675 .type = FIO_OPT_INT,
1676 .off1 = td_var_offset(open_files),
1677 .help = "Number of files to keep open at the same time",
1678 .category = FIO_OPT_C_FILE,
1679 .group = FIO_OPT_G_INVALID,
1682 .name = "file_service_type",
1683 .lname = "File service type",
1684 .type = FIO_OPT_STR,
1686 .off1 = td_var_offset(file_service_type),
1687 .help = "How to select which file to service next",
1688 .def = "roundrobin",
1689 .category = FIO_OPT_C_FILE,
1690 .group = FIO_OPT_G_INVALID,
1693 .oval = FIO_FSERVICE_RANDOM,
1694 .help = "Choose a file at random",
1696 { .ival = "roundrobin",
1697 .oval = FIO_FSERVICE_RR,
1698 .help = "Round robin select files",
1700 { .ival = "sequential",
1701 .oval = FIO_FSERVICE_SEQ,
1702 .help = "Finish one file before moving to the next",
1705 .parent = "nrfiles",
1708 #ifdef FIO_HAVE_FALLOCATE
1710 .name = "fallocate",
1711 .lname = "Fallocate",
1712 .type = FIO_OPT_STR,
1713 .off1 = td_var_offset(fallocate_mode),
1714 .help = "Whether pre-allocation is performed when laying out files",
1716 .category = FIO_OPT_C_FILE,
1717 .group = FIO_OPT_G_INVALID,
1720 .oval = FIO_FALLOCATE_NONE,
1721 .help = "Do not pre-allocate space",
1724 .oval = FIO_FALLOCATE_POSIX,
1725 .help = "Use posix_fallocate()",
1727 #ifdef FIO_HAVE_LINUX_FALLOCATE
1729 .oval = FIO_FALLOCATE_KEEP_SIZE,
1730 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1733 /* Compatibility with former boolean values */
1735 .oval = FIO_FALLOCATE_NONE,
1736 .help = "Alias for 'none'",
1739 .oval = FIO_FALLOCATE_POSIX,
1740 .help = "Alias for 'posix'",
1744 #endif /* FIO_HAVE_FALLOCATE */
1746 .name = "fadvise_hint",
1747 .lname = "Fadvise hint",
1748 .type = FIO_OPT_BOOL,
1749 .off1 = td_var_offset(fadvise_hint),
1750 .help = "Use fadvise() to advise the kernel on IO pattern",
1752 .category = FIO_OPT_C_FILE,
1753 .group = FIO_OPT_G_INVALID,
1758 .type = FIO_OPT_INT,
1759 .off1 = td_var_offset(fsync_blocks),
1760 .help = "Issue fsync for writes every given number of blocks",
1763 .category = FIO_OPT_C_FILE,
1764 .group = FIO_OPT_G_INVALID,
1767 .name = "fdatasync",
1768 .lname = "Fdatasync",
1769 .type = FIO_OPT_INT,
1770 .off1 = td_var_offset(fdatasync_blocks),
1771 .help = "Issue fdatasync for writes every given number of blocks",
1774 .category = FIO_OPT_C_FILE,
1775 .group = FIO_OPT_G_INVALID,
1778 .name = "write_barrier",
1779 .lname = "Write barrier",
1780 .type = FIO_OPT_INT,
1781 .off1 = td_var_offset(barrier_blocks),
1782 .help = "Make every Nth write a barrier write",
1785 .category = FIO_OPT_C_IO,
1786 .group = FIO_OPT_G_INVALID,
1788 #ifdef FIO_HAVE_SYNC_FILE_RANGE
1790 .name = "sync_file_range",
1791 .lname = "Sync file range",
1793 { .ival = "wait_before",
1794 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1795 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
1799 .oval = SYNC_FILE_RANGE_WRITE,
1800 .help = "SYNC_FILE_RANGE_WRITE",
1804 .ival = "wait_after",
1805 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1806 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
1810 .type = FIO_OPT_STR_MULTI,
1812 .off1 = td_var_offset(sync_file_range),
1813 .help = "Use sync_file_range()",
1814 .category = FIO_OPT_C_FILE,
1815 .group = FIO_OPT_G_INVALID,
1820 .lname = "Direct I/O",
1821 .type = FIO_OPT_BOOL,
1822 .off1 = td_var_offset(odirect),
1823 .help = "Use O_DIRECT IO (negates buffered)",
1825 .inverse = "buffered",
1826 .category = FIO_OPT_C_IO,
1827 .group = FIO_OPT_G_IO_TYPE,
1831 .lname = "Buffered I/O",
1832 .type = FIO_OPT_BOOL,
1833 .off1 = td_var_offset(odirect),
1835 .help = "Use buffered IO (negates direct)",
1837 .inverse = "direct",
1838 .category = FIO_OPT_C_IO,
1839 .group = FIO_OPT_G_IO_TYPE,
1842 .name = "overwrite",
1843 .lname = "Overwrite",
1844 .type = FIO_OPT_BOOL,
1845 .off1 = td_var_offset(overwrite),
1846 .help = "When writing, set whether to overwrite current data",
1848 .category = FIO_OPT_C_FILE,
1849 .group = FIO_OPT_G_INVALID,
1854 .type = FIO_OPT_INT,
1855 .off1 = td_var_offset(loops),
1856 .help = "Number of times to run the job",
1859 .category = FIO_OPT_C_GENERAL,
1860 .group = FIO_OPT_G_RUNTIME,
1864 .lname = "Number of jobs",
1865 .type = FIO_OPT_INT,
1866 .off1 = td_var_offset(numjobs),
1867 .help = "Duplicate this job this many times",
1870 .category = FIO_OPT_C_GENERAL,
1871 .group = FIO_OPT_G_RUNTIME,
1874 .name = "startdelay",
1875 .lname = "Start delay",
1876 .type = FIO_OPT_STR_VAL_TIME,
1877 .off1 = td_var_offset(start_delay),
1878 .help = "Only start job when this period has passed",
1880 .category = FIO_OPT_C_GENERAL,
1881 .group = FIO_OPT_G_RUNTIME,
1887 .type = FIO_OPT_STR_VAL_TIME,
1888 .off1 = td_var_offset(timeout),
1889 .help = "Stop workload when this amount of time has passed",
1891 .category = FIO_OPT_C_GENERAL,
1892 .group = FIO_OPT_G_RUNTIME,
1895 .name = "time_based",
1896 .lname = "Time based",
1897 .type = FIO_OPT_STR_SET,
1898 .off1 = td_var_offset(time_based),
1899 .help = "Keep running until runtime/timeout is met",
1900 .category = FIO_OPT_C_GENERAL,
1901 .group = FIO_OPT_G_RUNTIME,
1904 .name = "ramp_time",
1905 .lname = "Ramp time",
1906 .type = FIO_OPT_STR_VAL_TIME,
1907 .off1 = td_var_offset(ramp_time),
1908 .help = "Ramp up time before measuring performance",
1909 .category = FIO_OPT_C_GENERAL,
1910 .group = FIO_OPT_G_RUNTIME,
1913 .name = "clocksource",
1914 .lname = "Clock source",
1915 .type = FIO_OPT_STR,
1916 .cb = fio_clock_source_cb,
1917 .off1 = td_var_offset(clocksource),
1918 .help = "What type of timing source to use",
1919 .category = FIO_OPT_C_GENERAL,
1920 .group = FIO_OPT_G_CLOCK,
1922 { .ival = "gettimeofday",
1924 .help = "Use gettimeofday(2) for timing",
1926 { .ival = "clock_gettime",
1927 .oval = CS_CGETTIME,
1928 .help = "Use clock_gettime(2) for timing",
1930 #ifdef ARCH_HAVE_CPU_CLOCK
1932 .oval = CS_CPUCLOCK,
1933 .help = "Use CPU private clock",
1941 .lname = "I/O Memory",
1942 .type = FIO_OPT_STR,
1944 .off1 = td_var_offset(mem_type),
1945 .help = "Backing type for IO buffers",
1947 .category = FIO_OPT_C_IO,
1948 .group = FIO_OPT_G_INVALID,
1952 .help = "Use malloc(3) for IO buffers",
1956 .help = "Use shared memory segments for IO buffers",
1958 #ifdef FIO_HAVE_HUGETLB
1959 { .ival = "shmhuge",
1960 .oval = MEM_SHMHUGE,
1961 .help = "Like shm, but use huge pages",
1966 .help = "Use mmap(2) (file or anon) for IO buffers",
1968 #ifdef FIO_HAVE_HUGETLB
1969 { .ival = "mmaphuge",
1970 .oval = MEM_MMAPHUGE,
1971 .help = "Like mmap, but use huge pages",
1977 .name = "iomem_align",
1978 .alias = "mem_align",
1979 .lname = "I/O memory alignment",
1980 .type = FIO_OPT_INT,
1981 .off1 = td_var_offset(mem_align),
1983 .help = "IO memory buffer offset alignment",
1987 .category = FIO_OPT_C_IO,
1988 .group = FIO_OPT_G_INVALID,
1993 .type = FIO_OPT_STR,
1994 .off1 = td_var_offset(verify),
1995 .help = "Verify data written",
1997 .category = FIO_OPT_C_IO,
1998 .group = FIO_OPT_G_VERIFY,
2001 .oval = VERIFY_NONE,
2002 .help = "Don't do IO verification",
2006 .help = "Use md5 checksums for verification",
2009 .oval = VERIFY_CRC64,
2010 .help = "Use crc64 checksums for verification",
2013 .oval = VERIFY_CRC32,
2014 .help = "Use crc32 checksums for verification",
2016 { .ival = "crc32c-intel",
2017 .oval = VERIFY_CRC32C,
2018 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2021 .oval = VERIFY_CRC32C,
2022 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2025 .oval = VERIFY_CRC16,
2026 .help = "Use crc16 checksums for verification",
2029 .oval = VERIFY_CRC7,
2030 .help = "Use crc7 checksums for verification",
2033 .oval = VERIFY_SHA1,
2034 .help = "Use sha1 checksums for verification",
2037 .oval = VERIFY_SHA256,
2038 .help = "Use sha256 checksums for verification",
2041 .oval = VERIFY_SHA512,
2042 .help = "Use sha512 checksums for verification",
2045 .oval = VERIFY_META,
2046 .help = "Use io information",
2050 .oval = VERIFY_NULL,
2051 .help = "Pretend to verify",
2056 .name = "do_verify",
2057 .lname = "Perform verify step",
2058 .type = FIO_OPT_BOOL,
2059 .off1 = td_var_offset(do_verify),
2060 .help = "Run verification stage after write",
2064 .category = FIO_OPT_C_IO,
2065 .group = FIO_OPT_G_VERIFY,
2068 .name = "verifysort",
2069 .lname = "Verify sort",
2070 .type = FIO_OPT_BOOL,
2071 .off1 = td_var_offset(verifysort),
2072 .help = "Sort written verify blocks for read back",
2076 .category = FIO_OPT_C_IO,
2077 .group = FIO_OPT_G_VERIFY,
2080 .name = "verify_interval",
2081 .lname = "Verify interval",
2082 .type = FIO_OPT_INT,
2083 .off1 = td_var_offset(verify_interval),
2084 .minval = 2 * sizeof(struct verify_header),
2085 .help = "Store verify buffer header every N bytes",
2088 .interval = 2 * sizeof(struct verify_header),
2089 .category = FIO_OPT_C_IO,
2090 .group = FIO_OPT_G_VERIFY,
2093 .name = "verify_offset",
2094 .lname = "Verify offset",
2095 .type = FIO_OPT_INT,
2096 .help = "Offset verify header location by N bytes",
2097 .off1 = td_var_offset(verify_offset),
2098 .minval = sizeof(struct verify_header),
2101 .category = FIO_OPT_C_IO,
2102 .group = FIO_OPT_G_VERIFY,
2105 .name = "verify_pattern",
2106 .lname = "Verify pattern",
2107 .type = FIO_OPT_STR,
2108 .cb = str_verify_pattern_cb,
2109 .help = "Fill pattern for IO buffers",
2112 .category = FIO_OPT_C_IO,
2113 .group = FIO_OPT_G_VERIFY,
2116 .name = "verify_fatal",
2117 .lname = "Verify fatal",
2118 .type = FIO_OPT_BOOL,
2119 .off1 = td_var_offset(verify_fatal),
2121 .help = "Exit on a single verify failure, don't continue",
2124 .category = FIO_OPT_C_IO,
2125 .group = FIO_OPT_G_VERIFY,
2128 .name = "verify_dump",
2129 .lname = "Verify dump",
2130 .type = FIO_OPT_BOOL,
2131 .off1 = td_var_offset(verify_dump),
2133 .help = "Dump contents of good and bad blocks on failure",
2136 .category = FIO_OPT_C_IO,
2137 .group = FIO_OPT_G_VERIFY,
2140 .name = "verify_async",
2141 .lname = "Verify asynchronously",
2142 .type = FIO_OPT_INT,
2143 .off1 = td_var_offset(verify_async),
2145 .help = "Number of async verifier threads to use",
2148 .category = FIO_OPT_C_IO,
2149 .group = FIO_OPT_G_VERIFY,
2152 .name = "verify_backlog",
2153 .lname = "Verify backlog",
2154 .type = FIO_OPT_STR_VAL,
2155 .off1 = td_var_offset(verify_backlog),
2156 .help = "Verify after this number of blocks are written",
2159 .category = FIO_OPT_C_IO,
2160 .group = FIO_OPT_G_VERIFY,
2163 .name = "verify_backlog_batch",
2164 .lname = "Verify backlog batch",
2165 .type = FIO_OPT_INT,
2166 .off1 = td_var_offset(verify_batch),
2167 .help = "Verify this number of IO blocks",
2170 .category = FIO_OPT_C_IO,
2171 .group = FIO_OPT_G_VERIFY,
2173 #ifdef FIO_HAVE_CPU_AFFINITY
2175 .name = "verify_async_cpus",
2176 .lname = "Async verify CPUs",
2177 .type = FIO_OPT_STR,
2178 .cb = str_verify_cpus_allowed_cb,
2179 .help = "Set CPUs allowed for async verify threads",
2180 .parent = "verify_async",
2182 .category = FIO_OPT_C_IO,
2183 .group = FIO_OPT_G_VERIFY,
2186 #ifdef FIO_HAVE_TRIM
2188 .name = "trim_percentage",
2189 .lname = "Trim percentage",
2190 .type = FIO_OPT_INT,
2191 .off1 = td_var_offset(trim_percentage),
2194 .help = "Number of verify blocks to discard/trim",
2199 .category = FIO_OPT_C_IO,
2200 .group = FIO_OPT_G_TRIM,
2203 .name = "trim_verify_zero",
2204 .lname = "Verify trim zero",
2205 .type = FIO_OPT_BOOL,
2206 .help = "Verify that trim/discarded blocks are returned as zeroes",
2207 .off1 = td_var_offset(trim_zero),
2208 .parent = "trim_percentage",
2211 .category = FIO_OPT_C_IO,
2212 .group = FIO_OPT_G_TRIM,
2215 .name = "trim_backlog",
2216 .lname = "Trim backlog",
2217 .type = FIO_OPT_STR_VAL,
2218 .off1 = td_var_offset(trim_backlog),
2219 .help = "Trim after this number of blocks are written",
2220 .parent = "trim_percentage",
2223 .category = FIO_OPT_C_IO,
2224 .group = FIO_OPT_G_TRIM,
2227 .name = "trim_backlog_batch",
2228 .lname = "Trim backlog batch",
2229 .type = FIO_OPT_INT,
2230 .off1 = td_var_offset(trim_batch),
2231 .help = "Trim this number of IO blocks",
2232 .parent = "trim_percentage",
2235 .category = FIO_OPT_C_IO,
2236 .group = FIO_OPT_G_TRIM,
2240 .name = "write_iolog",
2241 .lname = "Write I/O log",
2242 .type = FIO_OPT_STR_STORE,
2243 .off1 = td_var_offset(write_iolog_file),
2244 .help = "Store IO pattern to file",
2245 .category = FIO_OPT_C_IO,
2246 .group = FIO_OPT_G_IOLOG,
2249 .name = "read_iolog",
2250 .lname = "Read I/O log",
2251 .type = FIO_OPT_STR_STORE,
2252 .off1 = td_var_offset(read_iolog_file),
2253 .help = "Playback IO pattern from file",
2254 .category = FIO_OPT_C_IO,
2255 .group = FIO_OPT_G_IOLOG,
2258 .name = "replay_no_stall",
2259 .lname = "Don't stall on replay",
2260 .type = FIO_OPT_BOOL,
2261 .off1 = td_var_offset(no_stall),
2263 .parent = "read_iolog",
2265 .help = "Playback IO pattern file as fast as possible without stalls",
2266 .category = FIO_OPT_C_IO,
2267 .group = FIO_OPT_G_IOLOG,
2270 .name = "replay_redirect",
2271 .lname = "Redirect device for replay",
2272 .type = FIO_OPT_STR_STORE,
2273 .off1 = td_var_offset(replay_redirect),
2274 .parent = "read_iolog",
2276 .help = "Replay all I/O onto this device, regardless of trace device",
2277 .category = FIO_OPT_C_IO,
2278 .group = FIO_OPT_G_IOLOG,
2281 .name = "exec_prerun",
2282 .lname = "Pre-execute runnable",
2283 .type = FIO_OPT_STR_STORE,
2284 .off1 = td_var_offset(exec_prerun),
2285 .help = "Execute this file prior to running job",
2286 .category = FIO_OPT_C_GENERAL,
2287 .group = FIO_OPT_G_INVALID,
2290 .name = "exec_postrun",
2291 .lname = "Post-execute runnable",
2292 .type = FIO_OPT_STR_STORE,
2293 .off1 = td_var_offset(exec_postrun),
2294 .help = "Execute this file after running job",
2295 .category = FIO_OPT_C_GENERAL,
2296 .group = FIO_OPT_G_INVALID,
2298 #ifdef FIO_HAVE_IOSCHED_SWITCH
2300 .name = "ioscheduler",
2301 .lname = "I/O scheduler",
2302 .type = FIO_OPT_STR_STORE,
2303 .off1 = td_var_offset(ioscheduler),
2304 .help = "Use this IO scheduler on the backing device",
2305 .category = FIO_OPT_C_FILE,
2306 .group = FIO_OPT_G_INVALID,
2311 .lname = "Zone size",
2312 .type = FIO_OPT_STR_VAL,
2313 .off1 = td_var_offset(zone_size),
2314 .help = "Amount of data to read per zone",
2316 .interval = 1024 * 1024,
2317 .category = FIO_OPT_C_IO,
2318 .group = FIO_OPT_G_ZONE,
2321 .name = "zonerange",
2322 .lname = "Zone range",
2323 .type = FIO_OPT_STR_VAL,
2324 .off1 = td_var_offset(zone_range),
2325 .help = "Give size of an IO zone",
2327 .interval = 1024 * 1024,
2328 .category = FIO_OPT_C_IO,
2329 .group = FIO_OPT_G_ZONE,
2333 .lname = "Zone skip",
2334 .type = FIO_OPT_STR_VAL,
2335 .off1 = td_var_offset(zone_skip),
2336 .help = "Space between IO zones",
2338 .interval = 1024 * 1024,
2339 .category = FIO_OPT_C_IO,
2340 .group = FIO_OPT_G_ZONE,
2344 .lname = "Lock memory",
2345 .type = FIO_OPT_STR_VAL,
2346 .off1 = td_var_offset(lockmem),
2347 .help = "Lock down this amount of memory",
2349 .interval = 1024 * 1024,
2350 .category = FIO_OPT_C_GENERAL,
2351 .group = FIO_OPT_G_INVALID,
2354 .name = "rwmixread",
2355 .lname = "Read/write mix read",
2356 .type = FIO_OPT_INT,
2357 .cb = str_rwmix_read_cb,
2359 .help = "Percentage of mixed workload that is reads",
2362 .inverse = "rwmixwrite",
2363 .category = FIO_OPT_C_IO,
2364 .group = FIO_OPT_G_RWMIX,
2367 .name = "rwmixwrite",
2368 .lname = "Read/write mix write",
2369 .type = FIO_OPT_INT,
2370 .cb = str_rwmix_write_cb,
2372 .help = "Percentage of mixed workload that is writes",
2375 .inverse = "rwmixread",
2376 .category = FIO_OPT_C_IO,
2377 .group = FIO_OPT_G_RWMIX,
2380 .name = "rwmixcycle",
2381 .lname = "Read/write mix cycle",
2382 .type = FIO_OPT_DEPRECATED,
2383 .category = FIO_OPT_C_IO,
2384 .group = FIO_OPT_G_RWMIX,
2389 .type = FIO_OPT_INT,
2390 .off1 = td_var_offset(nice),
2391 .help = "Set job CPU nice value",
2396 .category = FIO_OPT_C_GENERAL,
2397 .group = FIO_OPT_G_CRED,
2399 #ifdef FIO_HAVE_IOPRIO
2402 .lname = "I/O nice priority",
2403 .type = FIO_OPT_INT,
2404 .off1 = td_var_offset(ioprio),
2405 .help = "Set job IO priority value",
2409 .category = FIO_OPT_C_GENERAL,
2410 .group = FIO_OPT_G_CRED,
2413 .name = "prioclass",
2414 .lname = "I/O nice priority class",
2415 .type = FIO_OPT_INT,
2416 .off1 = td_var_offset(ioprio_class),
2417 .help = "Set job IO priority class",
2421 .category = FIO_OPT_C_GENERAL,
2422 .group = FIO_OPT_G_CRED,
2426 .name = "thinktime",
2427 .lname = "Thinktime",
2428 .type = FIO_OPT_INT,
2429 .off1 = td_var_offset(thinktime),
2430 .help = "Idle time between IO buffers (usec)",
2432 .category = FIO_OPT_C_IO,
2433 .group = FIO_OPT_G_THINKTIME,
2436 .name = "thinktime_spin",
2437 .lname = "Thinktime spin",
2438 .type = FIO_OPT_INT,
2439 .off1 = td_var_offset(thinktime_spin),
2440 .help = "Start think time by spinning this amount (usec)",
2442 .parent = "thinktime",
2444 .category = FIO_OPT_C_IO,
2445 .group = FIO_OPT_G_THINKTIME,
2448 .name = "thinktime_blocks",
2449 .lname = "Thinktime blocks",
2450 .type = FIO_OPT_INT,
2451 .off1 = td_var_offset(thinktime_blocks),
2452 .help = "IO buffer period between 'thinktime'",
2454 .parent = "thinktime",
2456 .category = FIO_OPT_C_IO,
2457 .group = FIO_OPT_G_THINKTIME,
2461 .lname = "I/O rate",
2462 .type = FIO_OPT_INT,
2463 .off1 = td_var_offset(rate[DDIR_READ]),
2464 .off2 = td_var_offset(rate[DDIR_WRITE]),
2465 .off3 = td_var_offset(rate[DDIR_TRIM]),
2466 .help = "Set bandwidth rate",
2467 .category = FIO_OPT_C_IO,
2468 .group = FIO_OPT_G_RATE,
2472 .lname = "I/O min rate",
2473 .type = FIO_OPT_INT,
2474 .off1 = td_var_offset(ratemin[DDIR_READ]),
2475 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2476 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2477 .help = "Job must meet this rate or it will be shutdown",
2480 .category = FIO_OPT_C_IO,
2481 .group = FIO_OPT_G_RATE,
2484 .name = "rate_iops",
2485 .lname = "I/O rate IOPS",
2486 .type = FIO_OPT_INT,
2487 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2488 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2489 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2490 .help = "Limit IO used to this number of IO operations/sec",
2492 .category = FIO_OPT_C_IO,
2493 .group = FIO_OPT_G_RATE,
2496 .name = "rate_iops_min",
2497 .lname = "I/O min rate IOPS",
2498 .type = FIO_OPT_INT,
2499 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2500 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2501 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2502 .help = "Job must meet this rate or it will be shut down",
2503 .parent = "rate_iops",
2505 .category = FIO_OPT_C_IO,
2506 .group = FIO_OPT_G_RATE,
2509 .name = "ratecycle",
2510 .lname = "I/O rate cycle",
2511 .type = FIO_OPT_INT,
2512 .off1 = td_var_offset(ratecycle),
2513 .help = "Window average for rate limits (msec)",
2517 .category = FIO_OPT_C_IO,
2518 .group = FIO_OPT_G_RATE,
2521 .name = "max_latency",
2522 .type = FIO_OPT_INT,
2523 .off1 = td_var_offset(max_latency),
2524 .help = "Maximum tolerated IO latency (usec)",
2525 .category = FIO_OPT_C_IO,
2526 .group = FIO_OPT_G_RATE,
2529 .name = "invalidate",
2530 .lname = "Cache invalidate",
2531 .type = FIO_OPT_BOOL,
2532 .off1 = td_var_offset(invalidate_cache),
2533 .help = "Invalidate buffer/page cache prior to running job",
2535 .category = FIO_OPT_C_IO,
2536 .group = FIO_OPT_G_IO_TYPE,
2540 .lname = "Synchronous I/O",
2541 .type = FIO_OPT_BOOL,
2542 .off1 = td_var_offset(sync_io),
2543 .help = "Use O_SYNC for buffered writes",
2545 .parent = "buffered",
2547 .category = FIO_OPT_C_IO,
2548 .group = FIO_OPT_G_IO_TYPE,
2551 .name = "create_serialize",
2552 .lname = "Create serialize",
2553 .type = FIO_OPT_BOOL,
2554 .off1 = td_var_offset(create_serialize),
2555 .help = "Serialize creating of job files",
2557 .category = FIO_OPT_C_FILE,
2558 .group = FIO_OPT_G_INVALID,
2561 .name = "create_fsync",
2562 .lname = "Create fsync",
2563 .type = FIO_OPT_BOOL,
2564 .off1 = td_var_offset(create_fsync),
2565 .help = "fsync file after creation",
2567 .category = FIO_OPT_C_FILE,
2568 .group = FIO_OPT_G_INVALID,
2571 .name = "create_on_open",
2572 .lname = "Create on open",
2573 .type = FIO_OPT_BOOL,
2574 .off1 = td_var_offset(create_on_open),
2575 .help = "Create files when they are opened for IO",
2577 .category = FIO_OPT_C_FILE,
2578 .group = FIO_OPT_G_INVALID,
2581 .name = "create_only",
2582 .type = FIO_OPT_BOOL,
2583 .off1 = td_var_offset(create_only),
2584 .help = "Only perform file creation phase",
2585 .category = FIO_OPT_C_FILE,
2590 .lname = "Pre-read files",
2591 .type = FIO_OPT_BOOL,
2592 .off1 = td_var_offset(pre_read),
2593 .help = "Pre-read files before starting official testing",
2595 .category = FIO_OPT_C_FILE,
2596 .group = FIO_OPT_G_INVALID,
2598 #ifdef FIO_HAVE_CPU_AFFINITY
2601 .lname = "CPU mask",
2602 .type = FIO_OPT_INT,
2603 .cb = str_cpumask_cb,
2604 .help = "CPU affinity mask",
2605 .category = FIO_OPT_C_GENERAL,
2606 .group = FIO_OPT_G_CRED,
2609 .name = "cpus_allowed",
2610 .lname = "CPUs allowed",
2611 .type = FIO_OPT_STR,
2612 .cb = str_cpus_allowed_cb,
2613 .help = "Set CPUs allowed",
2614 .category = FIO_OPT_C_GENERAL,
2615 .group = FIO_OPT_G_CRED,
2618 #ifdef FIO_HAVE_LIBNUMA
2620 .name = "numa_cpu_nodes",
2621 .type = FIO_OPT_STR,
2622 .cb = str_numa_cpunodes_cb,
2623 .help = "NUMA CPU nodes bind",
2626 .name = "numa_mem_policy",
2627 .type = FIO_OPT_STR,
2628 .cb = str_numa_mpol_cb,
2629 .help = "NUMA memory policy setup",
2633 .name = "end_fsync",
2634 .lname = "End fsync",
2635 .type = FIO_OPT_BOOL,
2636 .off1 = td_var_offset(end_fsync),
2637 .help = "Include fsync at the end of job",
2639 .category = FIO_OPT_C_FILE,
2640 .group = FIO_OPT_G_INVALID,
2643 .name = "fsync_on_close",
2644 .lname = "Fsync on close",
2645 .type = FIO_OPT_BOOL,
2646 .off1 = td_var_offset(fsync_on_close),
2647 .help = "fsync files on close",
2649 .category = FIO_OPT_C_FILE,
2650 .group = FIO_OPT_G_INVALID,
2654 .lname = "Unlink file",
2655 .type = FIO_OPT_BOOL,
2656 .off1 = td_var_offset(unlink),
2657 .help = "Unlink created files after job has completed",
2659 .category = FIO_OPT_C_FILE,
2660 .group = FIO_OPT_G_INVALID,
2664 .lname = "Exit-all on terminate",
2665 .type = FIO_OPT_STR_SET,
2666 .cb = str_exitall_cb,
2667 .help = "Terminate all jobs when one exits",
2668 .category = FIO_OPT_C_GENERAL,
2669 .group = FIO_OPT_G_PROCESS,
2672 .name = "stonewall",
2673 .lname = "Wait for previous",
2674 .alias = "wait_for_previous",
2675 .type = FIO_OPT_STR_SET,
2676 .off1 = td_var_offset(stonewall),
2677 .help = "Insert a hard barrier between this job and previous",
2678 .category = FIO_OPT_C_GENERAL,
2679 .group = FIO_OPT_G_PROCESS,
2682 .name = "new_group",
2683 .lname = "New group",
2684 .type = FIO_OPT_STR_SET,
2685 .off1 = td_var_offset(new_group),
2686 .help = "Mark the start of a new group (for reporting)",
2687 .category = FIO_OPT_C_GENERAL,
2688 .group = FIO_OPT_G_PROCESS,
2693 .type = FIO_OPT_STR_SET,
2694 .off1 = td_var_offset(use_thread),
2695 .help = "Use threads instead of processes",
2696 .category = FIO_OPT_C_GENERAL,
2697 .group = FIO_OPT_G_PROCESS,
2700 .name = "write_bw_log",
2701 .lname = "Write bandwidth log",
2702 .type = FIO_OPT_STR_STORE,
2703 .off1 = td_var_offset(bw_log_file),
2704 .help = "Write log of bandwidth during run",
2705 .category = FIO_OPT_C_LOG,
2706 .group = FIO_OPT_G_INVALID,
2709 .name = "write_lat_log",
2710 .lname = "Write latency log",
2711 .type = FIO_OPT_STR_STORE,
2712 .off1 = td_var_offset(lat_log_file),
2713 .help = "Write log of latency during run",
2714 .category = FIO_OPT_C_LOG,
2715 .group = FIO_OPT_G_INVALID,
2718 .name = "write_iops_log",
2719 .lname = "Write IOPS log",
2720 .type = FIO_OPT_STR,
2721 .off1 = td_var_offset(iops_log_file),
2722 .help = "Write log of IOPS during run",
2723 .category = FIO_OPT_C_LOG,
2724 .group = FIO_OPT_G_INVALID,
2727 .name = "log_avg_msec",
2728 .lname = "Log averaging (msec)",
2729 .type = FIO_OPT_INT,
2730 .off1 = td_var_offset(log_avg_msec),
2731 .help = "Average bw/iops/lat logs over this period of time",
2733 .category = FIO_OPT_C_LOG,
2734 .group = FIO_OPT_G_INVALID,
2737 .name = "bwavgtime",
2738 .lname = "Bandwidth average time",
2739 .type = FIO_OPT_INT,
2740 .off1 = td_var_offset(bw_avg_time),
2741 .help = "Time window over which to calculate bandwidth"
2744 .parent = "write_bw_log",
2747 .category = FIO_OPT_C_LOG,
2748 .group = FIO_OPT_G_INVALID,
2751 .name = "iopsavgtime",
2752 .lname = "IOPS average time",
2753 .type = FIO_OPT_INT,
2754 .off1 = td_var_offset(iops_avg_time),
2755 .help = "Time window over which to calculate IOPS (msec)",
2757 .parent = "write_iops_log",
2760 .category = FIO_OPT_C_LOG,
2761 .group = FIO_OPT_G_INVALID,
2764 .name = "group_reporting",
2765 .lname = "Group reporting",
2766 .type = FIO_OPT_BOOL,
2767 .off1 = td_var_offset(group_reporting),
2768 .help = "Do reporting on a per-group basis",
2770 .category = FIO_OPT_C_STAT,
2771 .group = FIO_OPT_G_INVALID,
2774 .name = "zero_buffers",
2775 .lname = "Zero I/O buffers",
2776 .type = FIO_OPT_STR_SET,
2777 .off1 = td_var_offset(zero_buffers),
2778 .help = "Init IO buffers to all zeroes",
2779 .category = FIO_OPT_C_IO,
2780 .group = FIO_OPT_G_IO_BUF,
2783 .name = "refill_buffers",
2784 .lname = "Refill I/O buffers",
2785 .type = FIO_OPT_STR_SET,
2786 .off1 = td_var_offset(refill_buffers),
2787 .help = "Refill IO buffers on every IO submit",
2788 .category = FIO_OPT_C_IO,
2789 .group = FIO_OPT_G_IO_BUF,
2792 .name = "scramble_buffers",
2793 .lname = "Scramble I/O buffers",
2794 .type = FIO_OPT_BOOL,
2795 .off1 = td_var_offset(scramble_buffers),
2796 .help = "Slightly scramble buffers on every IO submit",
2798 .category = FIO_OPT_C_IO,
2799 .group = FIO_OPT_G_IO_BUF,
2802 .name = "buffer_compress_percentage",
2803 .lname = "Buffer compression percentage",
2804 .type = FIO_OPT_INT,
2805 .off1 = td_var_offset(compress_percentage),
2808 .help = "How compressible the buffer is (approximately)",
2810 .category = FIO_OPT_C_IO,
2811 .group = FIO_OPT_G_IO_BUF,
2814 .name = "buffer_compress_chunk",
2815 .lname = "Buffer compression chunk size",
2816 .type = FIO_OPT_INT,
2817 .off1 = td_var_offset(compress_chunk),
2818 .parent = "buffer_compress_percentage",
2820 .help = "Size of compressible region in buffer",
2822 .category = FIO_OPT_C_IO,
2823 .group = FIO_OPT_G_IO_BUF,
2826 .name = "clat_percentiles",
2827 .lname = "Completion latency percentiles",
2828 .type = FIO_OPT_BOOL,
2829 .off1 = td_var_offset(clat_percentiles),
2830 .help = "Enable the reporting of completion latency percentiles",
2832 .category = FIO_OPT_C_STAT,
2833 .group = FIO_OPT_G_INVALID,
2836 .name = "percentile_list",
2837 .lname = "Completion latency percentile list",
2838 .type = FIO_OPT_FLOAT_LIST,
2839 .off1 = td_var_offset(percentile_list),
2840 .off2 = td_var_offset(overwrite_plist),
2841 .help = "Specify a custom list of percentiles to report",
2842 .maxlen = FIO_IO_U_LIST_MAX_LEN,
2845 .category = FIO_OPT_C_STAT,
2846 .group = FIO_OPT_G_INVALID,
2849 #ifdef FIO_HAVE_DISK_UTIL
2851 .name = "disk_util",
2852 .lname = "Disk utilization",
2853 .type = FIO_OPT_BOOL,
2854 .off1 = td_var_offset(do_disk_util),
2855 .help = "Log disk utilization statistics",
2857 .category = FIO_OPT_C_STAT,
2858 .group = FIO_OPT_G_INVALID,
2862 .name = "gtod_reduce",
2863 .lname = "Reduce gettimeofday() calls",
2864 .type = FIO_OPT_BOOL,
2865 .help = "Greatly reduce number of gettimeofday() calls",
2866 .cb = str_gtod_reduce_cb,
2869 .category = FIO_OPT_C_STAT,
2870 .group = FIO_OPT_G_INVALID,
2873 .name = "disable_lat",
2874 .lname = "Disable all latency stats",
2875 .type = FIO_OPT_BOOL,
2876 .off1 = td_var_offset(disable_lat),
2877 .help = "Disable latency numbers",
2878 .parent = "gtod_reduce",
2881 .category = FIO_OPT_C_STAT,
2882 .group = FIO_OPT_G_INVALID,
2885 .name = "disable_clat",
2886 .lname = "Disable completion latency stats",
2887 .type = FIO_OPT_BOOL,
2888 .off1 = td_var_offset(disable_clat),
2889 .help = "Disable completion latency numbers",
2890 .parent = "gtod_reduce",
2893 .category = FIO_OPT_C_STAT,
2894 .group = FIO_OPT_G_INVALID,
2897 .name = "disable_slat",
2898 .lname = "Disable submission latency stats",
2899 .type = FIO_OPT_BOOL,
2900 .off1 = td_var_offset(disable_slat),
2901 .help = "Disable submission latency numbers",
2902 .parent = "gtod_reduce",
2905 .category = FIO_OPT_C_STAT,
2906 .group = FIO_OPT_G_INVALID,
2909 .name = "disable_bw_measurement",
2910 .lname = "Disable bandwidth stats",
2911 .type = FIO_OPT_BOOL,
2912 .off1 = td_var_offset(disable_bw),
2913 .help = "Disable bandwidth logging",
2914 .parent = "gtod_reduce",
2917 .category = FIO_OPT_C_STAT,
2918 .group = FIO_OPT_G_INVALID,
2922 .lname = "Dedicated gettimeofday() CPU",
2923 .type = FIO_OPT_INT,
2924 .cb = str_gtod_cpu_cb,
2925 .help = "Set up dedicated gettimeofday() thread on this CPU",
2926 .verify = gtod_cpu_verify,
2927 .category = FIO_OPT_C_GENERAL,
2928 .group = FIO_OPT_G_CLOCK,
2931 .name = "continue_on_error",
2932 .lname = "Continue on error",
2933 .type = FIO_OPT_STR,
2934 .off1 = td_var_offset(continue_on_error),
2935 .help = "Continue on non-fatal errors during IO",
2937 .category = FIO_OPT_C_GENERAL,
2938 .group = FIO_OPT_G_ERR,
2941 .oval = ERROR_TYPE_NONE,
2942 .help = "Exit when an error is encountered",
2945 .oval = ERROR_TYPE_READ,
2946 .help = "Continue on read errors only",
2949 .oval = ERROR_TYPE_WRITE,
2950 .help = "Continue on write errors only",
2953 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
2954 .help = "Continue on any IO errors",
2957 .oval = ERROR_TYPE_VERIFY,
2958 .help = "Continue on verify errors only",
2961 .oval = ERROR_TYPE_ANY,
2962 .help = "Continue on all io and verify errors",
2965 .oval = ERROR_TYPE_NONE,
2966 .help = "Alias for 'none'",
2969 .oval = ERROR_TYPE_ANY,
2970 .help = "Alias for 'all'",
2975 .name = "ignore_error",
2976 .type = FIO_OPT_STR,
2977 .cb = str_ignore_error_cb,
2978 .help = "Set a specific list of errors to ignore",
2980 .category = FIO_OPT_C_GENERAL,
2981 .group = FIO_OPT_G_ERR,
2984 .name = "error_dump",
2985 .type = FIO_OPT_BOOL,
2986 .off1 = td_var_offset(error_dump),
2988 .help = "Dump info on each error",
2989 .category = FIO_OPT_C_GENERAL,
2990 .group = FIO_OPT_G_ERR,
2995 .type = FIO_OPT_STR_STORE,
2996 .off1 = td_var_offset(profile),
2997 .help = "Select a specific builtin performance test",
2998 .category = FIO_OPT_C_PROFILE,
2999 .group = FIO_OPT_G_INVALID,
3004 .type = FIO_OPT_STR_STORE,
3005 .off1 = td_var_offset(cgroup),
3006 .help = "Add job to cgroup of this name",
3007 .category = FIO_OPT_C_GENERAL,
3008 .group = FIO_OPT_G_CGROUP,
3011 .name = "cgroup_nodelete",
3012 .lname = "Cgroup no-delete",
3013 .type = FIO_OPT_BOOL,
3014 .off1 = td_var_offset(cgroup_nodelete),
3015 .help = "Do not delete cgroups after job completion",
3018 .category = FIO_OPT_C_GENERAL,
3019 .group = FIO_OPT_G_CGROUP,
3022 .name = "cgroup_weight",
3023 .lname = "Cgroup weight",
3024 .type = FIO_OPT_INT,
3025 .off1 = td_var_offset(cgroup_weight),
3026 .help = "Use given weight for cgroup",
3030 .category = FIO_OPT_C_GENERAL,
3031 .group = FIO_OPT_G_CGROUP,
3036 .type = FIO_OPT_INT,
3037 .off1 = td_var_offset(uid),
3038 .help = "Run job with this user ID",
3039 .category = FIO_OPT_C_GENERAL,
3040 .group = FIO_OPT_G_CRED,
3044 .lname = "Group ID",
3045 .type = FIO_OPT_INT,
3046 .off1 = td_var_offset(gid),
3047 .help = "Run job with this group ID",
3048 .category = FIO_OPT_C_GENERAL,
3049 .group = FIO_OPT_G_CRED,
3054 .type = FIO_OPT_INT,
3055 .off1 = td_var_offset(kb_base),
3056 .verify = kb_base_verify,
3059 .help = "How many bytes per KB for reporting (1000 or 1024)",
3060 .category = FIO_OPT_C_GENERAL,
3061 .group = FIO_OPT_G_INVALID,
3064 .name = "hugepage-size",
3065 .lname = "Hugepage size",
3066 .type = FIO_OPT_INT,
3067 .off1 = td_var_offset(hugepage_size),
3068 .help = "When using hugepages, specify size of each page",
3069 .def = __fio_stringify(FIO_HUGE_PAGE),
3070 .interval = 1024 * 1024,
3071 .category = FIO_OPT_C_GENERAL,
3072 .group = FIO_OPT_G_INVALID,
3076 .lname = "I/O flow ID",
3077 .type = FIO_OPT_INT,
3078 .off1 = td_var_offset(flow_id),
3079 .help = "The flow index ID to use",
3081 .category = FIO_OPT_C_IO,
3082 .group = FIO_OPT_G_IO_FLOW,
3086 .lname = "I/O flow weight",
3087 .type = FIO_OPT_INT,
3088 .off1 = td_var_offset(flow),
3089 .help = "Weight for flow control of this job",
3090 .parent = "flow_id",
3093 .category = FIO_OPT_C_IO,
3094 .group = FIO_OPT_G_IO_FLOW,
3097 .name = "flow_watermark",
3098 .lname = "I/O flow watermark",
3099 .type = FIO_OPT_INT,
3100 .off1 = td_var_offset(flow_watermark),
3101 .help = "High watermark for flow control. This option"
3102 " should be set to the same value for all threads"
3103 " with non-zero flow.",
3104 .parent = "flow_id",
3107 .category = FIO_OPT_C_IO,
3108 .group = FIO_OPT_G_IO_FLOW,
3111 .name = "flow_sleep",
3112 .lname = "I/O flow sleep",
3113 .type = FIO_OPT_INT,
3114 .off1 = td_var_offset(flow_sleep),
3115 .help = "How many microseconds to sleep after being held"
3116 " back by the flow control mechanism",
3117 .parent = "flow_id",
3120 .category = FIO_OPT_C_IO,
3121 .group = FIO_OPT_G_IO_FLOW,
3128 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3129 const char *name, int val)
3131 lopt->name = (char *) name;
3133 if (o->type == FIO_OPT_STR_SET)
3134 lopt->has_arg = no_argument;
3136 lopt->has_arg = required_argument;
3139 static void options_to_lopts(struct fio_option *opts,
3140 struct option *long_options,
3141 int i, int option_type)
3143 struct fio_option *o = &opts[0];
3145 add_to_lopt(&long_options[i], o, o->name, option_type);
3148 add_to_lopt(&long_options[i], o, o->alias, option_type);
3153 assert(i < FIO_NR_OPTIONS);
3157 void fio_options_set_ioengine_opts(struct option *long_options,
3158 struct thread_data *td)
3163 while (long_options[i].name) {
3164 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3165 memset(&long_options[i], 0, sizeof(*long_options));
3172 * Just clear out the prior ioengine options.
3177 options_to_lopts(td->io_ops->options, long_options, i,
3178 FIO_GETOPT_IOENGINE);
3181 void fio_options_dup_and_init(struct option *long_options)
3185 options_init(fio_options);
3188 while (long_options[i].name)
3191 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3194 struct fio_keyword {
3200 static struct fio_keyword fio_keywords[] = {
3202 .word = "$pagesize",
3203 .desc = "Page size in the system",
3206 .word = "$mb_memory",
3207 .desc = "Megabytes of memory online",
3211 .desc = "Number of CPUs online in the system",
3218 void fio_keywords_init(void)
3220 unsigned long long mb_memory;
3224 sprintf(buf, "%lu", (unsigned long) page_size);
3225 fio_keywords[0].replace = strdup(buf);
3227 mb_memory = os_phys_mem() / (1024 * 1024);
3228 sprintf(buf, "%llu", mb_memory);
3229 fio_keywords[1].replace = strdup(buf);
3232 sprintf(buf, "%lu", l);
3233 fio_keywords[2].replace = strdup(buf);
3238 static char *bc_calc(char *str)
3240 char buf[128], *tmp;
3245 * No math, just return string
3247 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3248 !strchr(str, '/')) || strchr(str, '\''))
3252 * Split option from value, we only need to calculate the value
3254 tmp = strchr(str, '=');
3261 * Prevent buffer overflows; such a case isn't reasonable anyway
3263 if (strlen(str) >= 128 || strlen(tmp) > 100)
3266 sprintf(buf, "which %s > /dev/null", BC_APP);
3268 log_err("fio: bc is needed for performing math\n");
3272 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3273 f = popen(buf, "r");
3277 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3282 buf[(tmp - str) + ret - 1] = '\0';
3283 memcpy(buf, str, tmp - str);
3289 * Return a copy of the input string with substrings of the form ${VARNAME}
3290 * substituted with the value of the environment variable VARNAME. The
3291 * substitution always occurs, even if VARNAME is empty or the corresponding
3292 * environment variable undefined.
3294 static char *option_dup_subs(const char *opt)
3296 char out[OPT_LEN_MAX+1];
3297 char in[OPT_LEN_MAX+1];
3300 char *ch1, *ch2, *env;
3301 ssize_t nchr = OPT_LEN_MAX;
3304 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3305 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3309 in[OPT_LEN_MAX] = '\0';
3310 strncpy(in, opt, OPT_LEN_MAX);
3312 while (*inptr && nchr > 0) {
3313 if (inptr[0] == '$' && inptr[1] == '{') {
3314 ch2 = strchr(inptr, '}');
3315 if (ch2 && inptr+1 < ch2) {
3322 envlen = strlen(env);
3323 if (envlen <= nchr) {
3324 memcpy(outptr, env, envlen);
3334 *outptr++ = *inptr++;
3343 * Look for reserved variable names and replace them with real values
3345 static char *fio_keyword_replace(char *opt)
3351 for (i = 0; fio_keywords[i].word != NULL; i++) {
3352 struct fio_keyword *kw = &fio_keywords[i];
3354 while ((s = strstr(opt, kw->word)) != NULL) {
3355 char *new = malloc(strlen(opt) + 1);
3361 * Copy part of the string before the keyword and
3362 * sprintf() the replacement after it.
3364 memcpy(new, opt, olen);
3365 len = sprintf(new + olen, "%s", kw->replace);