18 #include "crc/crc32c.h"
21 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
23 static char *get_opt_postfix(const char *str)
25 char *p = strstr(str, ":");
31 strip_blank_front(&p);
36 static int converthexchartoint(char a)
56 static int bs_cmp(const void *p1, const void *p2)
58 const struct bssplit *bsp1 = p1;
59 const struct bssplit *bsp2 = p2;
61 return bsp1->perc < bsp2->perc;
64 static int bssplit_ddir(struct thread_options *o, int ddir, char *str)
66 struct bssplit *bssplit;
67 unsigned int i, perc, perc_missing;
68 unsigned int max_bs, min_bs;
72 o->bssplit_nr[ddir] = 4;
73 bssplit = malloc(4 * sizeof(struct bssplit));
78 while ((fname = strsep(&str, ":")) != NULL) {
85 * grow struct buffer, if needed
87 if (i == o->bssplit_nr[ddir]) {
88 o->bssplit_nr[ddir] <<= 1;
89 bssplit = realloc(bssplit, o->bssplit_nr[ddir]
90 * sizeof(struct bssplit));
93 perc_str = strstr(fname, "/");
97 perc = atoi(perc_str);
105 if (str_to_decimal(fname, &val, 1, o, 0)) {
106 log_err("fio: bssplit conversion failed\n");
117 bssplit[i].perc = perc;
121 o->bssplit_nr[ddir] = i;
124 * Now check if the percentages add up, and how much is missing
126 perc = perc_missing = 0;
127 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
128 struct bssplit *bsp = &bssplit[i];
130 if (bsp->perc == (unsigned char) -1)
137 log_err("fio: bssplit percentages add to more than 100%%\n");
142 * If values didn't have a percentage set, divide the remains between
146 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
147 struct bssplit *bsp = &bssplit[i];
149 if (bsp->perc == (unsigned char) -1)
150 bsp->perc = (100 - perc) / perc_missing;
154 o->min_bs[ddir] = min_bs;
155 o->max_bs[ddir] = max_bs;
158 * now sort based on percentages, for ease of lookup
160 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
161 o->bssplit[ddir] = bssplit;
165 static int str_bssplit_cb(void *data, const char *input)
167 struct thread_data *td = data;
168 char *str, *p, *odir, *ddir;
174 p = str = strdup(input);
176 strip_blank_front(&str);
177 strip_blank_end(str);
179 odir = strchr(str, ',');
181 ddir = strchr(odir + 1, ',');
183 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
189 op = strdup(odir + 1);
190 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
195 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
198 ret = bssplit_ddir(&td->o, DDIR_READ, str);
204 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
209 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
212 ret = bssplit_ddir(&td->o, DDIR_READ, str);
219 static int str2error(char *str)
221 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
222 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
223 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
224 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
225 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
226 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
227 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
228 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
229 int i = 0, num = sizeof(err) / sizeof(void *);
232 if (!strcmp(err[i], str))
239 static int ignore_error_type(struct thread_data *td, int etype, char *str)
245 if (etype >= ERROR_TYPE_CNT) {
246 log_err("Illegal error type\n");
250 td->o.ignore_error_nr[etype] = 4;
251 error = malloc(4 * sizeof(struct bssplit));
254 while ((fname = strsep(&str, ":")) != NULL) {
260 * grow struct buffer, if needed
262 if (i == td->o.ignore_error_nr[etype]) {
263 td->o.ignore_error_nr[etype] <<= 1;
264 error = realloc(error, td->o.ignore_error_nr[etype]
267 if (fname[0] == 'E') {
268 error[i] = str2error(fname);
270 error[i] = atoi(fname);
275 log_err("Unknown error %s, please use number value \n",
283 td->o.continue_on_error |= 1 << etype;
284 td->o.ignore_error_nr[etype] = i;
285 td->o.ignore_error[etype] = error;
291 static int str_ignore_error_cb(void *data, const char *input)
293 struct thread_data *td = data;
295 int type = 0, ret = 1;
300 p = str = strdup(input);
302 strip_blank_front(&str);
303 strip_blank_end(str);
309 ret = ignore_error_type(td, type, p);
319 static int str_rw_cb(void *data, const char *str)
321 struct thread_data *td = data;
322 struct thread_options *o = &td->o;
323 char *nr = get_opt_postfix(str);
335 o->ddir_seq_nr = atoi(nr);
339 if (str_to_decimal(nr, &val, 1, o, 0)) {
340 log_err("fio: rw postfix parsing failed\n");
345 o->ddir_seq_add = val;
352 static int str_mem_cb(void *data, const char *mem)
354 struct thread_data *td = data;
356 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
357 td->o.mmapfile = get_opt_postfix(mem);
362 static int fio_clock_source_cb(void *data, const char *str)
364 struct thread_data *td = data;
366 fio_clock_source = td->o.clocksource;
367 fio_clock_source_set = 1;
372 static int str_rwmix_read_cb(void *data, unsigned long long *val)
374 struct thread_data *td = data;
376 td->o.rwmix[DDIR_READ] = *val;
377 td->o.rwmix[DDIR_WRITE] = 100 - *val;
381 static int str_rwmix_write_cb(void *data, unsigned long long *val)
383 struct thread_data *td = data;
385 td->o.rwmix[DDIR_WRITE] = *val;
386 td->o.rwmix[DDIR_READ] = 100 - *val;
390 static int str_exitall_cb(void)
392 exitall_on_terminate = 1;
396 #ifdef FIO_HAVE_CPU_AFFINITY
397 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
399 unsigned int i, index, cpus_in_mask;
400 const long max_cpu = cpus_online();
402 cpus_in_mask = fio_cpu_count(mask);
403 cpu_index = cpu_index % cpus_in_mask;
406 for (i = 0; i < max_cpu; i++) {
407 if (!fio_cpu_isset(mask, i))
410 if (cpu_index != index)
411 fio_cpu_clear(mask, i);
416 return fio_cpu_count(mask);
419 static int str_cpumask_cb(void *data, unsigned long long *val)
421 struct thread_data *td = data;
429 ret = fio_cpuset_init(&td->o.cpumask);
431 log_err("fio: cpuset_init failed\n");
432 td_verror(td, ret, "fio_cpuset_init");
436 max_cpu = cpus_online();
438 for (i = 0; i < sizeof(int) * 8; i++) {
439 if ((1 << i) & *val) {
441 log_err("fio: CPU %d too large (max=%ld)\n", i,
445 dprint(FD_PARSE, "set cpu allowed %d\n", i);
446 fio_cpu_set(&td->o.cpumask, i);
450 td->o.cpumask_set = 1;
454 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
461 ret = fio_cpuset_init(mask);
463 log_err("fio: cpuset_init failed\n");
464 td_verror(td, ret, "fio_cpuset_init");
468 p = str = strdup(input);
470 strip_blank_front(&str);
471 strip_blank_end(str);
473 max_cpu = cpus_online();
475 while ((cpu = strsep(&str, ",")) != NULL) {
484 while ((cpu2 = strsep(&str2, "-")) != NULL) {
494 while (icpu <= icpu2) {
495 if (icpu >= FIO_MAX_CPUS) {
496 log_err("fio: your OS only supports up to"
497 " %d CPUs\n", (int) FIO_MAX_CPUS);
501 if (icpu > max_cpu) {
502 log_err("fio: CPU %d too large (max=%ld)\n",
508 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
509 fio_cpu_set(mask, icpu);
518 td->o.cpumask_set = 1;
522 static int str_cpus_allowed_cb(void *data, const char *input)
524 struct thread_data *td = data;
530 ret = set_cpus_allowed(td, &td->o.cpumask, input);
532 td->o.cpumask_set = 1;
537 static int str_verify_cpus_allowed_cb(void *data, const char *input)
539 struct thread_data *td = data;
542 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
544 td->o.verify_cpumask_set = 1;
550 #ifdef CONFIG_LIBNUMA
551 static int str_numa_cpunodes_cb(void *data, char *input)
553 struct thread_data *td = data;
558 /* numa_parse_nodestring() parses a character string list
559 * of nodes into a bit mask. The bit mask is allocated by
560 * numa_allocate_nodemask(), so it should be freed by
561 * numa_free_nodemask().
563 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
564 if (td->o.numa_cpunodesmask == NULL) {
565 log_err("fio: numa_parse_nodestring failed\n");
566 td_verror(td, 1, "str_numa_cpunodes_cb");
570 td->o.numa_cpumask_set = 1;
574 static int str_numa_mpol_cb(void *data, char *input)
576 struct thread_data *td = data;
577 const char * const policy_types[] =
578 { "default", "prefer", "bind", "interleave", "local", NULL };
585 nodelist = strchr(input, ':');
587 /* NUL-terminate mode */
591 for (i = 0; i <= MPOL_LOCAL; i++) {
592 if (!strcmp(input, policy_types[i])) {
593 td->o.numa_mem_mode = i;
597 if (i > MPOL_LOCAL) {
598 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
602 switch (td->o.numa_mem_mode) {
605 * Insist on a nodelist of one node only
608 char *rest = nodelist;
609 while (isdigit(*rest))
612 log_err("fio: one node only for \'prefer\'\n");
616 log_err("fio: one node is needed for \'prefer\'\n");
620 case MPOL_INTERLEAVE:
622 * Default to online nodes with memory if no nodelist
625 nodelist = strdup("all");
630 * Don't allow a nodelist
633 log_err("fio: NO nodelist for \'local\'\n");
639 * Insist on a nodelist
642 log_err("fio: a nodelist is needed for \'bind\'\n");
649 /* numa_parse_nodestring() parses a character string list
650 * of nodes into a bit mask. The bit mask is allocated by
651 * numa_allocate_nodemask(), so it should be freed by
652 * numa_free_nodemask().
654 switch (td->o.numa_mem_mode) {
656 td->o.numa_mem_prefer_node = atoi(nodelist);
658 case MPOL_INTERLEAVE:
660 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
661 if (td->o.numa_memnodesmask == NULL) {
662 log_err("fio: numa_parse_nodestring failed\n");
663 td_verror(td, 1, "str_numa_memnodes_cb");
673 td->o.numa_memmask_set = 1;
681 static int str_fst_cb(void *data, const char *str)
683 struct thread_data *td = data;
684 char *nr = get_opt_postfix(str);
686 td->file_service_nr = 1;
688 td->file_service_nr = atoi(nr);
695 #ifdef CONFIG_SYNC_FILE_RANGE
696 static int str_sfr_cb(void *data, const char *str)
698 struct thread_data *td = data;
699 char *nr = get_opt_postfix(str);
701 td->sync_file_range_nr = 1;
703 td->sync_file_range_nr = atoi(nr);
711 static int str_random_distribution_cb(void *data, const char *str)
713 struct thread_data *td = data;
720 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
722 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
727 nr = get_opt_postfix(str);
728 if (nr && !str_to_float(nr, &val)) {
729 log_err("fio: random postfix parsing failed\n");
736 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
738 log_err("fio: zipf theta must different than 1.0\n");
741 td->o.zipf_theta.u.f = val;
743 if (val <= 0.00 || val >= 1.00) {
744 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
747 td->o.pareto_h.u.f = val;
754 * Return next name in the string. Files are separated with ':'. If the ':'
755 * is escaped with a '\', then that ':' is part of the filename and does not
756 * indicate a new file.
758 static char *get_next_name(char **ptr)
763 if (!str || !strlen(str))
769 * No colon, we are done
771 p = strchr(str, ':');
778 * We got a colon, but it's the first character. Skip and
786 if (*(p - 1) != '\\') {
792 memmove(p - 1, p, strlen(p) + 1);
800 static int get_max_name_idx(char *input)
802 unsigned int cur_idx;
805 p = str = strdup(input);
806 for (cur_idx = 0; ; cur_idx++)
807 if (get_next_name(&str) == NULL)
815 * Returns the directory at the index, indexes > entires will be
816 * assigned via modulo division of the index
818 int set_name_idx(char *target, char *input, int index)
820 unsigned int cur_idx;
822 char *fname, *str, *p;
824 p = str = strdup(input);
826 index %= get_max_name_idx(input);
827 for (cur_idx = 0; cur_idx <= index; cur_idx++)
828 fname = get_next_name(&str);
830 len = sprintf(target, "%s/", fname);
836 static int str_filename_cb(void *data, const char *input)
838 struct thread_data *td = data;
839 char *fname, *str, *p;
841 p = str = strdup(input);
843 strip_blank_front(&str);
844 strip_blank_end(str);
846 if (!td->files_index)
849 while ((fname = get_next_name(&str)) != NULL) {
852 add_file(td, fname, 0, 1);
859 static int str_directory_cb(void *data, const char fio_unused *unused)
861 struct thread_data *td = data;
863 char *dirname, *str, *p;
869 p = str = strdup(td->o.directory);
870 while ((dirname = get_next_name(&str)) != NULL) {
871 if (lstat(dirname, &sb) < 0) {
874 log_err("fio: %s is not a directory\n", dirname);
875 td_verror(td, ret, "lstat");
878 if (!S_ISDIR(sb.st_mode)) {
879 log_err("fio: %s is not a directory\n", dirname);
890 static int str_lockfile_cb(void *data, const char fio_unused *str)
892 struct thread_data *td = data;
894 if (td->files_index) {
895 log_err("fio: lockfile= option must precede filename=\n");
902 static int str_opendir_cb(void *data, const char fio_unused *str)
904 struct thread_data *td = data;
909 if (!td->files_index)
912 return add_dir_files(td, td->o.opendir);
915 static int pattern_cb(char *pattern, unsigned int max_size,
916 const char *input, unsigned int *pattern_bytes)
919 int i = 0, j = 0, len, k, base = 10;
920 uint32_t pattern_length;
923 loc1 = strstr(input, "0x");
924 loc2 = strstr(input, "0X");
927 off = strtol(input, NULL, base);
928 if (off != LONG_MAX || errno != ERANGE) {
930 pattern[i] = off & 0xff;
939 j = loc1 - input + 2;
941 j = loc2 - input + 2;
944 if (len - j < max_size * 2) {
946 off = converthexchartoint(input[k--]);
948 off += (converthexchartoint(input[k--])
950 pattern[i++] = (char) off;
956 * Fill the pattern all the way to the end. This greatly reduces
957 * the number of memcpy's we have to do when verifying the IO.
960 while (i > 1 && i * 2 <= max_size) {
961 memcpy(&pattern[i], &pattern[0], i);
966 * Fill remainder, if the pattern multiple ends up not being
969 while (i > 1 && i < max_size) {
970 unsigned int b = min(pattern_length, max_size - i);
972 memcpy(&pattern[i], &pattern[0], b);
978 * The code in verify_io_u_pattern assumes a single byte pattern
979 * fills the whole verify pattern buffer.
981 memset(pattern, pattern[0], max_size);
988 static int str_buffer_pattern_cb(void *data, const char *input)
990 struct thread_data *td = data;
993 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
994 &td->o.buffer_pattern_bytes);
997 td->o.refill_buffers = 0;
998 td->o.scramble_buffers = 0;
999 td->o.zero_buffers = 0;
1005 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1007 struct thread_data *td = data;
1009 td->flags |= TD_F_COMPRESS;
1010 td->o.compress_percentage = *il;
1014 static int str_verify_pattern_cb(void *data, const char *input)
1016 struct thread_data *td = data;
1019 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1020 &td->o.verify_pattern_bytes);
1023 * VERIFY_META could already be set
1025 if (!ret && td->o.verify == VERIFY_NONE)
1026 td->o.verify = VERIFY_PATTERN;
1031 static int str_gtod_reduce_cb(void *data, int *il)
1033 struct thread_data *td = data;
1036 td->o.disable_lat = !!val;
1037 td->o.disable_clat = !!val;
1038 td->o.disable_slat = !!val;
1039 td->o.disable_bw = !!val;
1040 td->o.clat_percentiles = !val;
1042 td->tv_cache_mask = 63;
1047 static int str_gtod_cpu_cb(void *data, long long *il)
1049 struct thread_data *td = data;
1052 td->o.gtod_cpu = val;
1053 td->o.gtod_offload = 1;
1057 static int str_size_cb(void *data, unsigned long long *__val)
1059 struct thread_data *td = data;
1060 unsigned long long v = *__val;
1062 if (parse_is_percent(v)) {
1064 td->o.size_percent = -1ULL - v;
1071 static int rw_verify(struct fio_option *o, void *data)
1073 struct thread_data *td = data;
1075 if (read_only && td_write(td)) {
1076 log_err("fio: job <%s> has write bit set, but fio is in"
1077 " read-only mode\n", td->o.name);
1084 static int gtod_cpu_verify(struct fio_option *o, void *data)
1086 #ifndef FIO_HAVE_CPU_AFFINITY
1087 struct thread_data *td = data;
1089 if (td->o.gtod_cpu) {
1090 log_err("fio: platform must support CPU affinity for"
1091 "gettimeofday() offloading\n");
1102 static struct opt_group fio_opt_groups[] = {
1105 .mask = FIO_OPT_C_GENERAL,
1109 .mask = FIO_OPT_C_IO,
1113 .mask = FIO_OPT_C_FILE,
1116 .name = "Statistics",
1117 .mask = FIO_OPT_C_STAT,
1121 .mask = FIO_OPT_C_LOG,
1125 .mask = FIO_OPT_C_PROFILE,
1132 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1133 unsigned int inv_mask)
1135 struct opt_group *og;
1138 if (*mask == inv_mask || !*mask)
1141 for (i = 0; ogs[i].name; i++) {
1144 if (*mask & og->mask) {
1145 *mask &= ~(og->mask);
1153 struct opt_group *opt_group_from_mask(unsigned int *mask)
1155 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1158 static struct opt_group fio_opt_cat_groups[] = {
1160 .name = "Latency profiling",
1161 .mask = FIO_OPT_G_LATPROF,
1165 .mask = FIO_OPT_G_RATE,
1169 .mask = FIO_OPT_G_ZONE,
1172 .name = "Read/write mix",
1173 .mask = FIO_OPT_G_RWMIX,
1177 .mask = FIO_OPT_G_VERIFY,
1181 .mask = FIO_OPT_G_TRIM,
1184 .name = "I/O Logging",
1185 .mask = FIO_OPT_G_IOLOG,
1188 .name = "I/O Depth",
1189 .mask = FIO_OPT_G_IO_DEPTH,
1193 .mask = FIO_OPT_G_IO_FLOW,
1196 .name = "Description",
1197 .mask = FIO_OPT_G_DESC,
1201 .mask = FIO_OPT_G_FILENAME,
1204 .name = "General I/O",
1205 .mask = FIO_OPT_G_IO_BASIC,
1209 .mask = FIO_OPT_G_CGROUP,
1213 .mask = FIO_OPT_G_RUNTIME,
1217 .mask = FIO_OPT_G_PROCESS,
1220 .name = "Job credentials / priority",
1221 .mask = FIO_OPT_G_CRED,
1224 .name = "Clock settings",
1225 .mask = FIO_OPT_G_CLOCK,
1229 .mask = FIO_OPT_G_IO_TYPE,
1232 .name = "I/O Thinktime",
1233 .mask = FIO_OPT_G_THINKTIME,
1236 .name = "Randomizations",
1237 .mask = FIO_OPT_G_RANDOM,
1240 .name = "I/O buffers",
1241 .mask = FIO_OPT_G_IO_BUF,
1244 .name = "Tiobench profile",
1245 .mask = FIO_OPT_G_TIOBENCH,
1253 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1255 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1259 * Map of job/command line options
1261 struct fio_option fio_options[FIO_MAX_OPTS] = {
1263 .name = "description",
1264 .lname = "Description of job",
1265 .type = FIO_OPT_STR_STORE,
1266 .off1 = td_var_offset(description),
1267 .help = "Text job description",
1268 .category = FIO_OPT_C_GENERAL,
1269 .group = FIO_OPT_G_DESC,
1273 .lname = "Job name",
1274 .type = FIO_OPT_STR_STORE,
1275 .off1 = td_var_offset(name),
1276 .help = "Name of this job",
1277 .category = FIO_OPT_C_GENERAL,
1278 .group = FIO_OPT_G_DESC,
1282 .lname = "Filename(s)",
1283 .type = FIO_OPT_STR_STORE,
1284 .off1 = td_var_offset(filename),
1285 .cb = str_filename_cb,
1286 .prio = -1, /* must come after "directory" */
1287 .help = "File(s) to use for the workload",
1288 .category = FIO_OPT_C_FILE,
1289 .group = FIO_OPT_G_FILENAME,
1292 .name = "directory",
1293 .lname = "Directory",
1294 .type = FIO_OPT_STR_STORE,
1295 .off1 = td_var_offset(directory),
1296 .cb = str_directory_cb,
1297 .help = "Directory to store files in",
1298 .category = FIO_OPT_C_FILE,
1299 .group = FIO_OPT_G_FILENAME,
1302 .name = "filename_format",
1303 .type = FIO_OPT_STR_STORE,
1304 .off1 = td_var_offset(filename_format),
1305 .prio = -1, /* must come after "directory" */
1306 .help = "Override default $jobname.$jobnum.$filenum naming",
1307 .def = "$jobname.$jobnum.$filenum",
1308 .category = FIO_OPT_C_FILE,
1309 .group = FIO_OPT_G_FILENAME,
1313 .lname = "Lockfile",
1314 .type = FIO_OPT_STR,
1315 .off1 = td_var_offset(file_lock_mode),
1316 .help = "Lock file when doing IO to it",
1318 .parent = "filename",
1321 .cb = str_lockfile_cb,
1322 .category = FIO_OPT_C_FILE,
1323 .group = FIO_OPT_G_FILENAME,
1326 .oval = FILE_LOCK_NONE,
1327 .help = "No file locking",
1329 { .ival = "exclusive",
1330 .oval = FILE_LOCK_EXCLUSIVE,
1331 .help = "Exclusive file lock",
1334 .ival = "readwrite",
1335 .oval = FILE_LOCK_READWRITE,
1336 .help = "Read vs write lock",
1342 .lname = "Open directory",
1343 .type = FIO_OPT_STR_STORE,
1344 .off1 = td_var_offset(opendir),
1345 .cb = str_opendir_cb,
1346 .help = "Recursively add files from this directory and down",
1347 .category = FIO_OPT_C_FILE,
1348 .group = FIO_OPT_G_FILENAME,
1352 .lname = "Read/write",
1353 .alias = "readwrite",
1354 .type = FIO_OPT_STR,
1356 .off1 = td_var_offset(td_ddir),
1357 .help = "IO direction",
1359 .verify = rw_verify,
1360 .category = FIO_OPT_C_IO,
1361 .group = FIO_OPT_G_IO_BASIC,
1364 .oval = TD_DDIR_READ,
1365 .help = "Sequential read",
1368 .oval = TD_DDIR_WRITE,
1369 .help = "Sequential write",
1372 .oval = TD_DDIR_TRIM,
1373 .help = "Sequential trim",
1375 { .ival = "randread",
1376 .oval = TD_DDIR_RANDREAD,
1377 .help = "Random read",
1379 { .ival = "randwrite",
1380 .oval = TD_DDIR_RANDWRITE,
1381 .help = "Random write",
1383 { .ival = "randtrim",
1384 .oval = TD_DDIR_RANDTRIM,
1385 .help = "Random trim",
1389 .help = "Sequential read and write mix",
1391 { .ival = "readwrite",
1393 .help = "Sequential read and write mix",
1396 .oval = TD_DDIR_RANDRW,
1397 .help = "Random read and write mix"
1402 .name = "rw_sequencer",
1403 .lname = "RW Sequencer",
1404 .type = FIO_OPT_STR,
1405 .off1 = td_var_offset(rw_seq),
1406 .help = "IO offset generator modifier",
1407 .def = "sequential",
1408 .category = FIO_OPT_C_IO,
1409 .group = FIO_OPT_G_IO_BASIC,
1411 { .ival = "sequential",
1413 .help = "Generate sequential offsets",
1415 { .ival = "identical",
1416 .oval = RW_SEQ_IDENT,
1417 .help = "Generate identical offsets",
1424 .lname = "IO Engine",
1425 .type = FIO_OPT_STR_STORE,
1426 .off1 = td_var_offset(ioengine),
1427 .help = "IO engine to use",
1428 .def = FIO_PREFERRED_ENGINE,
1429 .category = FIO_OPT_C_IO,
1430 .group = FIO_OPT_G_IO_BASIC,
1433 .help = "Use read/write",
1436 .help = "Use pread/pwrite",
1439 .help = "Use readv/writev",
1441 #ifdef CONFIG_PWRITEV
1443 .help = "Use preadv/pwritev",
1446 #ifdef CONFIG_LIBAIO
1448 .help = "Linux native asynchronous IO",
1451 #ifdef CONFIG_POSIXAIO
1452 { .ival = "posixaio",
1453 .help = "POSIX asynchronous IO",
1456 #ifdef CONFIG_SOLARISAIO
1457 { .ival = "solarisaio",
1458 .help = "Solaris native asynchronous IO",
1461 #ifdef CONFIG_WINDOWSAIO
1462 { .ival = "windowsaio",
1463 .help = "Windows native asynchronous IO"
1468 .help = "Rados Block Device asynchronous IO"
1472 .help = "Memory mapped IO"
1474 #ifdef CONFIG_LINUX_SPLICE
1476 .help = "splice/vmsplice based IO",
1478 { .ival = "netsplice",
1479 .help = "splice/vmsplice to/from the network",
1482 #ifdef FIO_HAVE_SGIO
1484 .help = "SCSI generic v3 IO",
1488 .help = "Testing engine (no data transfer)",
1491 .help = "Network IO",
1494 .help = "CPU cycle burner engine",
1498 .help = "GUASI IO engine",
1501 #ifdef FIO_HAVE_BINJECT
1502 { .ival = "binject",
1503 .help = "binject direct inject block engine",
1508 .help = "RDMA IO engine",
1511 #ifdef CONFIG_FUSION_AW
1512 { .ival = "fusion-aw-sync",
1513 .help = "Fusion-io atomic write engine",
1516 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1517 { .ival = "e4defrag",
1518 .help = "ext4 defrag engine",
1521 #ifdef CONFIG_LINUX_FALLOCATE
1523 .help = "fallocate() file based engine",
1528 .help = "Glusterfs libgfapi based engine"
1532 { .ival = "external",
1533 .help = "Load external engine (append name)",
1539 .lname = "IO Depth",
1540 .type = FIO_OPT_INT,
1541 .off1 = td_var_offset(iodepth),
1542 .help = "Number of IO buffers to keep in flight",
1546 .category = FIO_OPT_C_IO,
1547 .group = FIO_OPT_G_IO_BASIC,
1550 .name = "iodepth_batch",
1551 .lname = "IO Depth batch",
1552 .alias = "iodepth_batch_submit",
1553 .type = FIO_OPT_INT,
1554 .off1 = td_var_offset(iodepth_batch),
1555 .help = "Number of IO buffers to submit in one go",
1556 .parent = "iodepth",
1561 .category = FIO_OPT_C_IO,
1562 .group = FIO_OPT_G_IO_BASIC,
1565 .name = "iodepth_batch_complete",
1566 .lname = "IO Depth batch complete",
1567 .type = FIO_OPT_INT,
1568 .off1 = td_var_offset(iodepth_batch_complete),
1569 .help = "Number of IO buffers to retrieve in one go",
1570 .parent = "iodepth",
1575 .category = FIO_OPT_C_IO,
1576 .group = FIO_OPT_G_IO_BASIC,
1579 .name = "iodepth_low",
1580 .lname = "IO Depth batch low",
1581 .type = FIO_OPT_INT,
1582 .off1 = td_var_offset(iodepth_low),
1583 .help = "Low water mark for queuing depth",
1584 .parent = "iodepth",
1587 .category = FIO_OPT_C_IO,
1588 .group = FIO_OPT_G_IO_BASIC,
1593 .type = FIO_OPT_STR_VAL,
1595 .help = "Total size of device or files",
1596 .interval = 1024 * 1024,
1597 .category = FIO_OPT_C_IO,
1598 .group = FIO_OPT_G_INVALID,
1601 .name = "fill_device",
1602 .lname = "Fill device",
1604 .type = FIO_OPT_BOOL,
1605 .off1 = td_var_offset(fill_device),
1606 .help = "Write until an ENOSPC error occurs",
1608 .category = FIO_OPT_C_FILE,
1609 .group = FIO_OPT_G_INVALID,
1613 .lname = "File size",
1614 .type = FIO_OPT_STR_VAL,
1615 .off1 = td_var_offset(file_size_low),
1616 .off2 = td_var_offset(file_size_high),
1618 .help = "Size of individual files",
1619 .interval = 1024 * 1024,
1620 .category = FIO_OPT_C_FILE,
1621 .group = FIO_OPT_G_INVALID,
1624 .name = "file_append",
1625 .lname = "File append",
1626 .type = FIO_OPT_BOOL,
1627 .off1 = td_var_offset(file_append),
1628 .help = "IO will start at the end of the file(s)",
1630 .category = FIO_OPT_C_FILE,
1631 .group = FIO_OPT_G_INVALID,
1635 .lname = "IO offset",
1636 .alias = "fileoffset",
1637 .type = FIO_OPT_STR_VAL,
1638 .off1 = td_var_offset(start_offset),
1639 .help = "Start IO from this offset",
1641 .interval = 1024 * 1024,
1642 .category = FIO_OPT_C_IO,
1643 .group = FIO_OPT_G_INVALID,
1646 .name = "offset_increment",
1647 .lname = "IO offset increment",
1648 .type = FIO_OPT_STR_VAL,
1649 .off1 = td_var_offset(offset_increment),
1650 .help = "What is the increment from one offset to the next",
1654 .interval = 1024 * 1024,
1655 .category = FIO_OPT_C_IO,
1656 .group = FIO_OPT_G_INVALID,
1659 .name = "number_ios",
1660 .lname = "Number of IOs to perform",
1661 .type = FIO_OPT_STR_VAL,
1662 .off1 = td_var_offset(number_ios),
1663 .help = "Force job completion of this number of IOs",
1665 .category = FIO_OPT_C_IO,
1666 .group = FIO_OPT_G_INVALID,
1670 .lname = "Block size",
1671 .alias = "blocksize",
1672 .type = FIO_OPT_INT,
1673 .off1 = td_var_offset(bs[DDIR_READ]),
1674 .off2 = td_var_offset(bs[DDIR_WRITE]),
1675 .off3 = td_var_offset(bs[DDIR_TRIM]),
1677 .help = "Block size unit",
1682 .category = FIO_OPT_C_IO,
1683 .group = FIO_OPT_G_INVALID,
1687 .lname = "Block size align",
1688 .alias = "blockalign",
1689 .type = FIO_OPT_INT,
1690 .off1 = td_var_offset(ba[DDIR_READ]),
1691 .off2 = td_var_offset(ba[DDIR_WRITE]),
1692 .off3 = td_var_offset(ba[DDIR_TRIM]),
1694 .help = "IO block offset alignment",
1698 .category = FIO_OPT_C_IO,
1699 .group = FIO_OPT_G_INVALID,
1703 .lname = "Block size range",
1704 .alias = "blocksize_range",
1705 .type = FIO_OPT_RANGE,
1706 .off1 = td_var_offset(min_bs[DDIR_READ]),
1707 .off2 = td_var_offset(max_bs[DDIR_READ]),
1708 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1709 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1710 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1711 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1713 .help = "Set block size range (in more detail than bs)",
1717 .category = FIO_OPT_C_IO,
1718 .group = FIO_OPT_G_INVALID,
1722 .lname = "Block size split",
1723 .type = FIO_OPT_STR,
1724 .cb = str_bssplit_cb,
1725 .help = "Set a specific mix of block sizes",
1728 .category = FIO_OPT_C_IO,
1729 .group = FIO_OPT_G_INVALID,
1732 .name = "bs_unaligned",
1733 .lname = "Block size unaligned",
1734 .alias = "blocksize_unaligned",
1735 .type = FIO_OPT_STR_SET,
1736 .off1 = td_var_offset(bs_unaligned),
1737 .help = "Don't sector align IO buffer sizes",
1740 .category = FIO_OPT_C_IO,
1741 .group = FIO_OPT_G_INVALID,
1744 .name = "bs_is_seq_rand",
1745 .lname = "Block size division is seq/random (not read/write)",
1746 .type = FIO_OPT_BOOL,
1747 .off1 = td_var_offset(bs_is_seq_rand),
1748 .help = "Consider any blocksize setting to be sequential,ramdom",
1750 .parent = "blocksize",
1751 .category = FIO_OPT_C_IO,
1752 .group = FIO_OPT_G_INVALID,
1755 .name = "randrepeat",
1756 .lname = "Random repeatable",
1757 .type = FIO_OPT_BOOL,
1758 .off1 = td_var_offset(rand_repeatable),
1759 .help = "Use repeatable random IO pattern",
1763 .category = FIO_OPT_C_IO,
1764 .group = FIO_OPT_G_RANDOM,
1768 .lname = "The random generator seed",
1769 .type = FIO_OPT_STR_VAL,
1770 .off1 = td_var_offset(rand_seed),
1771 .help = "Set the random generator seed value",
1773 .category = FIO_OPT_C_IO,
1774 .group = FIO_OPT_G_RANDOM,
1777 .name = "use_os_rand",
1778 .lname = "Use OS random",
1779 .type = FIO_OPT_BOOL,
1780 .off1 = td_var_offset(use_os_rand),
1781 .help = "Set to use OS random generator",
1785 .category = FIO_OPT_C_IO,
1786 .group = FIO_OPT_G_RANDOM,
1789 .name = "norandommap",
1790 .lname = "No randommap",
1791 .type = FIO_OPT_STR_SET,
1792 .off1 = td_var_offset(norandommap),
1793 .help = "Accept potential duplicate random blocks",
1797 .category = FIO_OPT_C_IO,
1798 .group = FIO_OPT_G_RANDOM,
1801 .name = "softrandommap",
1802 .lname = "Soft randommap",
1803 .type = FIO_OPT_BOOL,
1804 .off1 = td_var_offset(softrandommap),
1805 .help = "Set norandommap if randommap allocation fails",
1806 .parent = "norandommap",
1809 .category = FIO_OPT_C_IO,
1810 .group = FIO_OPT_G_RANDOM,
1813 .name = "random_generator",
1814 .type = FIO_OPT_STR,
1815 .off1 = td_var_offset(random_generator),
1816 .help = "Type of random number generator to use",
1817 .def = "tausworthe",
1819 { .ival = "tausworthe",
1820 .oval = FIO_RAND_GEN_TAUSWORTHE,
1821 .help = "Strong Tausworthe generator",
1824 .oval = FIO_RAND_GEN_LFSR,
1825 .help = "Variable length LFSR",
1828 .category = FIO_OPT_C_IO,
1829 .group = FIO_OPT_G_RANDOM,
1832 .name = "random_distribution",
1833 .type = FIO_OPT_STR,
1834 .off1 = td_var_offset(random_distribution),
1835 .cb = str_random_distribution_cb,
1836 .help = "Random offset distribution generator",
1840 .oval = FIO_RAND_DIST_RANDOM,
1841 .help = "Completely random",
1844 .oval = FIO_RAND_DIST_ZIPF,
1845 .help = "Zipf distribution",
1848 .oval = FIO_RAND_DIST_PARETO,
1849 .help = "Pareto distribution",
1852 .category = FIO_OPT_C_IO,
1853 .group = FIO_OPT_G_RANDOM,
1856 .name = "percentage_random",
1857 .lname = "Percentage Random",
1858 .type = FIO_OPT_INT,
1859 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1860 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1861 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1863 .help = "Percentage of seq/random mix that should be random",
1864 .def = "100,100,100",
1866 .inverse = "percentage_sequential",
1867 .category = FIO_OPT_C_IO,
1868 .group = FIO_OPT_G_RANDOM,
1871 .name = "percentage_sequential",
1872 .lname = "Percentage Sequential",
1873 .type = FIO_OPT_DEPRECATED,
1874 .category = FIO_OPT_C_IO,
1875 .group = FIO_OPT_G_RANDOM,
1878 .name = "allrandrepeat",
1879 .type = FIO_OPT_BOOL,
1880 .off1 = td_var_offset(allrand_repeatable),
1881 .help = "Use repeatable random numbers for everything",
1883 .category = FIO_OPT_C_IO,
1884 .group = FIO_OPT_G_RANDOM,
1888 .lname = "Number of files",
1889 .alias = "nr_files",
1890 .type = FIO_OPT_INT,
1891 .off1 = td_var_offset(nr_files),
1892 .help = "Split job workload between this number of files",
1895 .category = FIO_OPT_C_FILE,
1896 .group = FIO_OPT_G_INVALID,
1899 .name = "openfiles",
1900 .lname = "Number of open files",
1901 .type = FIO_OPT_INT,
1902 .off1 = td_var_offset(open_files),
1903 .help = "Number of files to keep open at the same time",
1904 .category = FIO_OPT_C_FILE,
1905 .group = FIO_OPT_G_INVALID,
1908 .name = "file_service_type",
1909 .lname = "File service type",
1910 .type = FIO_OPT_STR,
1912 .off1 = td_var_offset(file_service_type),
1913 .help = "How to select which file to service next",
1914 .def = "roundrobin",
1915 .category = FIO_OPT_C_FILE,
1916 .group = FIO_OPT_G_INVALID,
1919 .oval = FIO_FSERVICE_RANDOM,
1920 .help = "Choose a file at random",
1922 { .ival = "roundrobin",
1923 .oval = FIO_FSERVICE_RR,
1924 .help = "Round robin select files",
1926 { .ival = "sequential",
1927 .oval = FIO_FSERVICE_SEQ,
1928 .help = "Finish one file before moving to the next",
1931 .parent = "nrfiles",
1934 #ifdef CONFIG_POSIX_FALLOCATE
1936 .name = "fallocate",
1937 .lname = "Fallocate",
1938 .type = FIO_OPT_STR,
1939 .off1 = td_var_offset(fallocate_mode),
1940 .help = "Whether pre-allocation is performed when laying out files",
1942 .category = FIO_OPT_C_FILE,
1943 .group = FIO_OPT_G_INVALID,
1946 .oval = FIO_FALLOCATE_NONE,
1947 .help = "Do not pre-allocate space",
1950 .oval = FIO_FALLOCATE_POSIX,
1951 .help = "Use posix_fallocate()",
1953 #ifdef CONFIG_LINUX_FALLOCATE
1955 .oval = FIO_FALLOCATE_KEEP_SIZE,
1956 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1959 /* Compatibility with former boolean values */
1961 .oval = FIO_FALLOCATE_NONE,
1962 .help = "Alias for 'none'",
1965 .oval = FIO_FALLOCATE_POSIX,
1966 .help = "Alias for 'posix'",
1970 #endif /* CONFIG_POSIX_FALLOCATE */
1972 .name = "fadvise_hint",
1973 .lname = "Fadvise hint",
1974 .type = FIO_OPT_BOOL,
1975 .off1 = td_var_offset(fadvise_hint),
1976 .help = "Use fadvise() to advise the kernel on IO pattern",
1978 .category = FIO_OPT_C_FILE,
1979 .group = FIO_OPT_G_INVALID,
1984 .type = FIO_OPT_INT,
1985 .off1 = td_var_offset(fsync_blocks),
1986 .help = "Issue fsync for writes every given number of blocks",
1989 .category = FIO_OPT_C_FILE,
1990 .group = FIO_OPT_G_INVALID,
1993 .name = "fdatasync",
1994 .lname = "Fdatasync",
1995 .type = FIO_OPT_INT,
1996 .off1 = td_var_offset(fdatasync_blocks),
1997 .help = "Issue fdatasync for writes every given number of blocks",
2000 .category = FIO_OPT_C_FILE,
2001 .group = FIO_OPT_G_INVALID,
2004 .name = "write_barrier",
2005 .lname = "Write barrier",
2006 .type = FIO_OPT_INT,
2007 .off1 = td_var_offset(barrier_blocks),
2008 .help = "Make every Nth write a barrier write",
2011 .category = FIO_OPT_C_IO,
2012 .group = FIO_OPT_G_INVALID,
2014 #ifdef CONFIG_SYNC_FILE_RANGE
2016 .name = "sync_file_range",
2017 .lname = "Sync file range",
2019 { .ival = "wait_before",
2020 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2021 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2025 .oval = SYNC_FILE_RANGE_WRITE,
2026 .help = "SYNC_FILE_RANGE_WRITE",
2030 .ival = "wait_after",
2031 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2032 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2036 .type = FIO_OPT_STR_MULTI,
2038 .off1 = td_var_offset(sync_file_range),
2039 .help = "Use sync_file_range()",
2040 .category = FIO_OPT_C_FILE,
2041 .group = FIO_OPT_G_INVALID,
2046 .lname = "Direct I/O",
2047 .type = FIO_OPT_BOOL,
2048 .off1 = td_var_offset(odirect),
2049 .help = "Use O_DIRECT IO (negates buffered)",
2051 .inverse = "buffered",
2052 .category = FIO_OPT_C_IO,
2053 .group = FIO_OPT_G_IO_TYPE,
2057 .lname = "Atomic I/O",
2058 .type = FIO_OPT_BOOL,
2059 .off1 = td_var_offset(oatomic),
2060 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2062 .category = FIO_OPT_C_IO,
2063 .group = FIO_OPT_G_IO_TYPE,
2067 .lname = "Buffered I/O",
2068 .type = FIO_OPT_BOOL,
2069 .off1 = td_var_offset(odirect),
2071 .help = "Use buffered IO (negates direct)",
2073 .inverse = "direct",
2074 .category = FIO_OPT_C_IO,
2075 .group = FIO_OPT_G_IO_TYPE,
2078 .name = "overwrite",
2079 .lname = "Overwrite",
2080 .type = FIO_OPT_BOOL,
2081 .off1 = td_var_offset(overwrite),
2082 .help = "When writing, set whether to overwrite current data",
2084 .category = FIO_OPT_C_FILE,
2085 .group = FIO_OPT_G_INVALID,
2090 .type = FIO_OPT_INT,
2091 .off1 = td_var_offset(loops),
2092 .help = "Number of times to run the job",
2095 .category = FIO_OPT_C_GENERAL,
2096 .group = FIO_OPT_G_RUNTIME,
2100 .lname = "Number of jobs",
2101 .type = FIO_OPT_INT,
2102 .off1 = td_var_offset(numjobs),
2103 .help = "Duplicate this job this many times",
2106 .category = FIO_OPT_C_GENERAL,
2107 .group = FIO_OPT_G_RUNTIME,
2110 .name = "startdelay",
2111 .lname = "Start delay",
2112 .type = FIO_OPT_STR_VAL_TIME,
2113 .off1 = td_var_offset(start_delay),
2114 .off2 = td_var_offset(start_delay_high),
2115 .help = "Only start job when this period has passed",
2118 .category = FIO_OPT_C_GENERAL,
2119 .group = FIO_OPT_G_RUNTIME,
2125 .type = FIO_OPT_STR_VAL_TIME,
2126 .off1 = td_var_offset(timeout),
2127 .help = "Stop workload when this amount of time has passed",
2130 .category = FIO_OPT_C_GENERAL,
2131 .group = FIO_OPT_G_RUNTIME,
2134 .name = "time_based",
2135 .lname = "Time based",
2136 .type = FIO_OPT_STR_SET,
2137 .off1 = td_var_offset(time_based),
2138 .help = "Keep running until runtime/timeout is met",
2139 .category = FIO_OPT_C_GENERAL,
2140 .group = FIO_OPT_G_RUNTIME,
2143 .name = "verify_only",
2144 .lname = "Verify only",
2145 .type = FIO_OPT_STR_SET,
2146 .off1 = td_var_offset(verify_only),
2147 .help = "Verifies previously written data is still valid",
2148 .category = FIO_OPT_C_GENERAL,
2149 .group = FIO_OPT_G_RUNTIME,
2152 .name = "ramp_time",
2153 .lname = "Ramp time",
2154 .type = FIO_OPT_STR_VAL_TIME,
2155 .off1 = td_var_offset(ramp_time),
2156 .help = "Ramp up time before measuring performance",
2158 .category = FIO_OPT_C_GENERAL,
2159 .group = FIO_OPT_G_RUNTIME,
2162 .name = "clocksource",
2163 .lname = "Clock source",
2164 .type = FIO_OPT_STR,
2165 .cb = fio_clock_source_cb,
2166 .off1 = td_var_offset(clocksource),
2167 .help = "What type of timing source to use",
2168 .category = FIO_OPT_C_GENERAL,
2169 .group = FIO_OPT_G_CLOCK,
2171 #ifdef CONFIG_GETTIMEOFDAY
2172 { .ival = "gettimeofday",
2174 .help = "Use gettimeofday(2) for timing",
2177 #ifdef CONFIG_CLOCK_GETTIME
2178 { .ival = "clock_gettime",
2179 .oval = CS_CGETTIME,
2180 .help = "Use clock_gettime(2) for timing",
2183 #ifdef ARCH_HAVE_CPU_CLOCK
2185 .oval = CS_CPUCLOCK,
2186 .help = "Use CPU private clock",
2194 .lname = "I/O Memory",
2195 .type = FIO_OPT_STR,
2197 .off1 = td_var_offset(mem_type),
2198 .help = "Backing type for IO buffers",
2200 .category = FIO_OPT_C_IO,
2201 .group = FIO_OPT_G_INVALID,
2205 .help = "Use malloc(3) for IO buffers",
2209 .help = "Use shared memory segments for IO buffers",
2211 #ifdef FIO_HAVE_HUGETLB
2212 { .ival = "shmhuge",
2213 .oval = MEM_SHMHUGE,
2214 .help = "Like shm, but use huge pages",
2219 .help = "Use mmap(2) (file or anon) for IO buffers",
2221 #ifdef FIO_HAVE_HUGETLB
2222 { .ival = "mmaphuge",
2223 .oval = MEM_MMAPHUGE,
2224 .help = "Like mmap, but use huge pages",
2230 .name = "iomem_align",
2231 .alias = "mem_align",
2232 .lname = "I/O memory alignment",
2233 .type = FIO_OPT_INT,
2234 .off1 = td_var_offset(mem_align),
2236 .help = "IO memory buffer offset alignment",
2240 .category = FIO_OPT_C_IO,
2241 .group = FIO_OPT_G_INVALID,
2246 .type = FIO_OPT_STR,
2247 .off1 = td_var_offset(verify),
2248 .help = "Verify data written",
2250 .category = FIO_OPT_C_IO,
2251 .group = FIO_OPT_G_VERIFY,
2254 .oval = VERIFY_NONE,
2255 .help = "Don't do IO verification",
2259 .help = "Use md5 checksums for verification",
2262 .oval = VERIFY_CRC64,
2263 .help = "Use crc64 checksums for verification",
2266 .oval = VERIFY_CRC32,
2267 .help = "Use crc32 checksums for verification",
2269 { .ival = "crc32c-intel",
2270 .oval = VERIFY_CRC32C,
2271 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2274 .oval = VERIFY_CRC32C,
2275 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2278 .oval = VERIFY_CRC16,
2279 .help = "Use crc16 checksums for verification",
2282 .oval = VERIFY_CRC7,
2283 .help = "Use crc7 checksums for verification",
2286 .oval = VERIFY_SHA1,
2287 .help = "Use sha1 checksums for verification",
2290 .oval = VERIFY_SHA256,
2291 .help = "Use sha256 checksums for verification",
2294 .oval = VERIFY_SHA512,
2295 .help = "Use sha512 checksums for verification",
2298 .oval = VERIFY_XXHASH,
2299 .help = "Use xxhash checksums for verification",
2302 .oval = VERIFY_META,
2303 .help = "Use io information",
2307 .oval = VERIFY_NULL,
2308 .help = "Pretend to verify",
2313 .name = "do_verify",
2314 .lname = "Perform verify step",
2315 .type = FIO_OPT_BOOL,
2316 .off1 = td_var_offset(do_verify),
2317 .help = "Run verification stage after write",
2321 .category = FIO_OPT_C_IO,
2322 .group = FIO_OPT_G_VERIFY,
2325 .name = "verifysort",
2326 .lname = "Verify sort",
2327 .type = FIO_OPT_BOOL,
2328 .off1 = td_var_offset(verifysort),
2329 .help = "Sort written verify blocks for read back",
2333 .category = FIO_OPT_C_IO,
2334 .group = FIO_OPT_G_VERIFY,
2337 .name = "verifysort_nr",
2338 .type = FIO_OPT_INT,
2339 .off1 = td_var_offset(verifysort_nr),
2340 .help = "Pre-load and sort verify blocks for a read workload",
2345 .category = FIO_OPT_C_IO,
2346 .group = FIO_OPT_G_VERIFY,
2349 .name = "verify_interval",
2350 .lname = "Verify interval",
2351 .type = FIO_OPT_INT,
2352 .off1 = td_var_offset(verify_interval),
2353 .minval = 2 * sizeof(struct verify_header),
2354 .help = "Store verify buffer header every N bytes",
2357 .interval = 2 * sizeof(struct verify_header),
2358 .category = FIO_OPT_C_IO,
2359 .group = FIO_OPT_G_VERIFY,
2362 .name = "verify_offset",
2363 .lname = "Verify offset",
2364 .type = FIO_OPT_INT,
2365 .help = "Offset verify header location by N bytes",
2366 .off1 = td_var_offset(verify_offset),
2367 .minval = sizeof(struct verify_header),
2370 .category = FIO_OPT_C_IO,
2371 .group = FIO_OPT_G_VERIFY,
2374 .name = "verify_pattern",
2375 .lname = "Verify pattern",
2376 .type = FIO_OPT_STR,
2377 .cb = str_verify_pattern_cb,
2378 .help = "Fill pattern for IO buffers",
2381 .category = FIO_OPT_C_IO,
2382 .group = FIO_OPT_G_VERIFY,
2385 .name = "verify_fatal",
2386 .lname = "Verify fatal",
2387 .type = FIO_OPT_BOOL,
2388 .off1 = td_var_offset(verify_fatal),
2390 .help = "Exit on a single verify failure, don't continue",
2393 .category = FIO_OPT_C_IO,
2394 .group = FIO_OPT_G_VERIFY,
2397 .name = "verify_dump",
2398 .lname = "Verify dump",
2399 .type = FIO_OPT_BOOL,
2400 .off1 = td_var_offset(verify_dump),
2402 .help = "Dump contents of good and bad blocks on failure",
2405 .category = FIO_OPT_C_IO,
2406 .group = FIO_OPT_G_VERIFY,
2409 .name = "verify_async",
2410 .lname = "Verify asynchronously",
2411 .type = FIO_OPT_INT,
2412 .off1 = td_var_offset(verify_async),
2414 .help = "Number of async verifier threads to use",
2417 .category = FIO_OPT_C_IO,
2418 .group = FIO_OPT_G_VERIFY,
2421 .name = "verify_backlog",
2422 .lname = "Verify backlog",
2423 .type = FIO_OPT_STR_VAL,
2424 .off1 = td_var_offset(verify_backlog),
2425 .help = "Verify after this number of blocks are written",
2428 .category = FIO_OPT_C_IO,
2429 .group = FIO_OPT_G_VERIFY,
2432 .name = "verify_backlog_batch",
2433 .lname = "Verify backlog batch",
2434 .type = FIO_OPT_INT,
2435 .off1 = td_var_offset(verify_batch),
2436 .help = "Verify this number of IO blocks",
2439 .category = FIO_OPT_C_IO,
2440 .group = FIO_OPT_G_VERIFY,
2442 #ifdef FIO_HAVE_CPU_AFFINITY
2444 .name = "verify_async_cpus",
2445 .lname = "Async verify CPUs",
2446 .type = FIO_OPT_STR,
2447 .cb = str_verify_cpus_allowed_cb,
2448 .help = "Set CPUs allowed for async verify threads",
2449 .parent = "verify_async",
2451 .category = FIO_OPT_C_IO,
2452 .group = FIO_OPT_G_VERIFY,
2456 .name = "experimental_verify",
2457 .off1 = td_var_offset(experimental_verify),
2458 .type = FIO_OPT_BOOL,
2459 .help = "Enable experimental verification",
2460 .category = FIO_OPT_C_IO,
2461 .group = FIO_OPT_G_VERIFY,
2463 #ifdef FIO_HAVE_TRIM
2465 .name = "trim_percentage",
2466 .lname = "Trim percentage",
2467 .type = FIO_OPT_INT,
2468 .off1 = td_var_offset(trim_percentage),
2471 .help = "Number of verify blocks to discard/trim",
2476 .category = FIO_OPT_C_IO,
2477 .group = FIO_OPT_G_TRIM,
2480 .name = "trim_verify_zero",
2481 .lname = "Verify trim zero",
2482 .type = FIO_OPT_BOOL,
2483 .help = "Verify that trim/discarded blocks are returned as zeroes",
2484 .off1 = td_var_offset(trim_zero),
2485 .parent = "trim_percentage",
2488 .category = FIO_OPT_C_IO,
2489 .group = FIO_OPT_G_TRIM,
2492 .name = "trim_backlog",
2493 .lname = "Trim backlog",
2494 .type = FIO_OPT_STR_VAL,
2495 .off1 = td_var_offset(trim_backlog),
2496 .help = "Trim after this number of blocks are written",
2497 .parent = "trim_percentage",
2500 .category = FIO_OPT_C_IO,
2501 .group = FIO_OPT_G_TRIM,
2504 .name = "trim_backlog_batch",
2505 .lname = "Trim backlog batch",
2506 .type = FIO_OPT_INT,
2507 .off1 = td_var_offset(trim_batch),
2508 .help = "Trim this number of IO blocks",
2509 .parent = "trim_percentage",
2512 .category = FIO_OPT_C_IO,
2513 .group = FIO_OPT_G_TRIM,
2517 .name = "write_iolog",
2518 .lname = "Write I/O log",
2519 .type = FIO_OPT_STR_STORE,
2520 .off1 = td_var_offset(write_iolog_file),
2521 .help = "Store IO pattern to file",
2522 .category = FIO_OPT_C_IO,
2523 .group = FIO_OPT_G_IOLOG,
2526 .name = "read_iolog",
2527 .lname = "Read I/O log",
2528 .type = FIO_OPT_STR_STORE,
2529 .off1 = td_var_offset(read_iolog_file),
2530 .help = "Playback IO pattern from file",
2531 .category = FIO_OPT_C_IO,
2532 .group = FIO_OPT_G_IOLOG,
2535 .name = "replay_no_stall",
2536 .lname = "Don't stall on replay",
2537 .type = FIO_OPT_BOOL,
2538 .off1 = td_var_offset(no_stall),
2540 .parent = "read_iolog",
2542 .help = "Playback IO pattern file as fast as possible without stalls",
2543 .category = FIO_OPT_C_IO,
2544 .group = FIO_OPT_G_IOLOG,
2547 .name = "replay_redirect",
2548 .lname = "Redirect device for replay",
2549 .type = FIO_OPT_STR_STORE,
2550 .off1 = td_var_offset(replay_redirect),
2551 .parent = "read_iolog",
2553 .help = "Replay all I/O onto this device, regardless of trace device",
2554 .category = FIO_OPT_C_IO,
2555 .group = FIO_OPT_G_IOLOG,
2558 .name = "exec_prerun",
2559 .lname = "Pre-execute runnable",
2560 .type = FIO_OPT_STR_STORE,
2561 .off1 = td_var_offset(exec_prerun),
2562 .help = "Execute this file prior to running job",
2563 .category = FIO_OPT_C_GENERAL,
2564 .group = FIO_OPT_G_INVALID,
2567 .name = "exec_postrun",
2568 .lname = "Post-execute runnable",
2569 .type = FIO_OPT_STR_STORE,
2570 .off1 = td_var_offset(exec_postrun),
2571 .help = "Execute this file after running job",
2572 .category = FIO_OPT_C_GENERAL,
2573 .group = FIO_OPT_G_INVALID,
2575 #ifdef FIO_HAVE_IOSCHED_SWITCH
2577 .name = "ioscheduler",
2578 .lname = "I/O scheduler",
2579 .type = FIO_OPT_STR_STORE,
2580 .off1 = td_var_offset(ioscheduler),
2581 .help = "Use this IO scheduler on the backing device",
2582 .category = FIO_OPT_C_FILE,
2583 .group = FIO_OPT_G_INVALID,
2588 .lname = "Zone size",
2589 .type = FIO_OPT_STR_VAL,
2590 .off1 = td_var_offset(zone_size),
2591 .help = "Amount of data to read per zone",
2593 .interval = 1024 * 1024,
2594 .category = FIO_OPT_C_IO,
2595 .group = FIO_OPT_G_ZONE,
2598 .name = "zonerange",
2599 .lname = "Zone range",
2600 .type = FIO_OPT_STR_VAL,
2601 .off1 = td_var_offset(zone_range),
2602 .help = "Give size of an IO zone",
2604 .interval = 1024 * 1024,
2605 .category = FIO_OPT_C_IO,
2606 .group = FIO_OPT_G_ZONE,
2610 .lname = "Zone skip",
2611 .type = FIO_OPT_STR_VAL,
2612 .off1 = td_var_offset(zone_skip),
2613 .help = "Space between IO zones",
2615 .interval = 1024 * 1024,
2616 .category = FIO_OPT_C_IO,
2617 .group = FIO_OPT_G_ZONE,
2621 .lname = "Lock memory",
2622 .type = FIO_OPT_STR_VAL,
2623 .off1 = td_var_offset(lockmem),
2624 .help = "Lock down this amount of memory (per worker)",
2626 .interval = 1024 * 1024,
2627 .category = FIO_OPT_C_GENERAL,
2628 .group = FIO_OPT_G_INVALID,
2631 .name = "rwmixread",
2632 .lname = "Read/write mix read",
2633 .type = FIO_OPT_INT,
2634 .cb = str_rwmix_read_cb,
2636 .help = "Percentage of mixed workload that is reads",
2639 .inverse = "rwmixwrite",
2640 .category = FIO_OPT_C_IO,
2641 .group = FIO_OPT_G_RWMIX,
2644 .name = "rwmixwrite",
2645 .lname = "Read/write mix write",
2646 .type = FIO_OPT_INT,
2647 .cb = str_rwmix_write_cb,
2649 .help = "Percentage of mixed workload that is writes",
2652 .inverse = "rwmixread",
2653 .category = FIO_OPT_C_IO,
2654 .group = FIO_OPT_G_RWMIX,
2657 .name = "rwmixcycle",
2658 .lname = "Read/write mix cycle",
2659 .type = FIO_OPT_DEPRECATED,
2660 .category = FIO_OPT_C_IO,
2661 .group = FIO_OPT_G_RWMIX,
2666 .type = FIO_OPT_INT,
2667 .off1 = td_var_offset(nice),
2668 .help = "Set job CPU nice value",
2673 .category = FIO_OPT_C_GENERAL,
2674 .group = FIO_OPT_G_CRED,
2676 #ifdef FIO_HAVE_IOPRIO
2679 .lname = "I/O nice priority",
2680 .type = FIO_OPT_INT,
2681 .off1 = td_var_offset(ioprio),
2682 .help = "Set job IO priority value",
2686 .category = FIO_OPT_C_GENERAL,
2687 .group = FIO_OPT_G_CRED,
2690 .name = "prioclass",
2691 .lname = "I/O nice priority class",
2692 .type = FIO_OPT_INT,
2693 .off1 = td_var_offset(ioprio_class),
2694 .help = "Set job IO priority class",
2698 .category = FIO_OPT_C_GENERAL,
2699 .group = FIO_OPT_G_CRED,
2703 .name = "thinktime",
2704 .lname = "Thinktime",
2705 .type = FIO_OPT_INT,
2706 .off1 = td_var_offset(thinktime),
2707 .help = "Idle time between IO buffers (usec)",
2709 .category = FIO_OPT_C_IO,
2710 .group = FIO_OPT_G_THINKTIME,
2713 .name = "thinktime_spin",
2714 .lname = "Thinktime spin",
2715 .type = FIO_OPT_INT,
2716 .off1 = td_var_offset(thinktime_spin),
2717 .help = "Start think time by spinning this amount (usec)",
2719 .parent = "thinktime",
2721 .category = FIO_OPT_C_IO,
2722 .group = FIO_OPT_G_THINKTIME,
2725 .name = "thinktime_blocks",
2726 .lname = "Thinktime blocks",
2727 .type = FIO_OPT_INT,
2728 .off1 = td_var_offset(thinktime_blocks),
2729 .help = "IO buffer period between 'thinktime'",
2731 .parent = "thinktime",
2733 .category = FIO_OPT_C_IO,
2734 .group = FIO_OPT_G_THINKTIME,
2738 .lname = "I/O rate",
2739 .type = FIO_OPT_INT,
2740 .off1 = td_var_offset(rate[DDIR_READ]),
2741 .off2 = td_var_offset(rate[DDIR_WRITE]),
2742 .off3 = td_var_offset(rate[DDIR_TRIM]),
2743 .help = "Set bandwidth rate",
2744 .category = FIO_OPT_C_IO,
2745 .group = FIO_OPT_G_RATE,
2749 .lname = "I/O min rate",
2750 .type = FIO_OPT_INT,
2751 .off1 = td_var_offset(ratemin[DDIR_READ]),
2752 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2753 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2754 .help = "Job must meet this rate or it will be shutdown",
2757 .category = FIO_OPT_C_IO,
2758 .group = FIO_OPT_G_RATE,
2761 .name = "rate_iops",
2762 .lname = "I/O rate IOPS",
2763 .type = FIO_OPT_INT,
2764 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2765 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2766 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2767 .help = "Limit IO used to this number of IO operations/sec",
2769 .category = FIO_OPT_C_IO,
2770 .group = FIO_OPT_G_RATE,
2773 .name = "rate_iops_min",
2774 .lname = "I/O min rate IOPS",
2775 .type = FIO_OPT_INT,
2776 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2777 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2778 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2779 .help = "Job must meet this rate or it will be shut down",
2780 .parent = "rate_iops",
2782 .category = FIO_OPT_C_IO,
2783 .group = FIO_OPT_G_RATE,
2786 .name = "ratecycle",
2787 .lname = "I/O rate cycle",
2788 .type = FIO_OPT_INT,
2789 .off1 = td_var_offset(ratecycle),
2790 .help = "Window average for rate limits (msec)",
2794 .category = FIO_OPT_C_IO,
2795 .group = FIO_OPT_G_RATE,
2798 .name = "max_latency",
2799 .type = FIO_OPT_INT,
2800 .off1 = td_var_offset(max_latency),
2801 .help = "Maximum tolerated IO latency (usec)",
2802 .category = FIO_OPT_C_IO,
2803 .group = FIO_OPT_G_LATPROF,
2806 .name = "latency_target",
2807 .lname = "Latency Target (usec)",
2808 .type = FIO_OPT_STR_VAL_TIME,
2809 .off1 = td_var_offset(latency_target),
2810 .help = "Ramp to max queue depth supporting this latency",
2811 .category = FIO_OPT_C_IO,
2812 .group = FIO_OPT_G_LATPROF,
2815 .name = "latency_window",
2816 .lname = "Latency Window (usec)",
2817 .type = FIO_OPT_STR_VAL_TIME,
2818 .off1 = td_var_offset(latency_window),
2819 .help = "Time to sustain latency_target",
2820 .category = FIO_OPT_C_IO,
2821 .group = FIO_OPT_G_LATPROF,
2824 .name = "latency_percentile",
2825 .lname = "Latency Percentile",
2826 .type = FIO_OPT_FLOAT_LIST,
2827 .off1 = td_var_offset(latency_percentile),
2828 .help = "Percentile of IOs must be below latency_target",
2833 .category = FIO_OPT_C_IO,
2834 .group = FIO_OPT_G_LATPROF,
2837 .name = "invalidate",
2838 .lname = "Cache invalidate",
2839 .type = FIO_OPT_BOOL,
2840 .off1 = td_var_offset(invalidate_cache),
2841 .help = "Invalidate buffer/page cache prior to running job",
2843 .category = FIO_OPT_C_IO,
2844 .group = FIO_OPT_G_IO_TYPE,
2848 .lname = "Synchronous I/O",
2849 .type = FIO_OPT_BOOL,
2850 .off1 = td_var_offset(sync_io),
2851 .help = "Use O_SYNC for buffered writes",
2853 .parent = "buffered",
2855 .category = FIO_OPT_C_IO,
2856 .group = FIO_OPT_G_IO_TYPE,
2859 .name = "create_serialize",
2860 .lname = "Create serialize",
2861 .type = FIO_OPT_BOOL,
2862 .off1 = td_var_offset(create_serialize),
2863 .help = "Serialize creating of job files",
2865 .category = FIO_OPT_C_FILE,
2866 .group = FIO_OPT_G_INVALID,
2869 .name = "create_fsync",
2870 .lname = "Create fsync",
2871 .type = FIO_OPT_BOOL,
2872 .off1 = td_var_offset(create_fsync),
2873 .help = "fsync file after creation",
2875 .category = FIO_OPT_C_FILE,
2876 .group = FIO_OPT_G_INVALID,
2879 .name = "create_on_open",
2880 .lname = "Create on open",
2881 .type = FIO_OPT_BOOL,
2882 .off1 = td_var_offset(create_on_open),
2883 .help = "Create files when they are opened for IO",
2885 .category = FIO_OPT_C_FILE,
2886 .group = FIO_OPT_G_INVALID,
2889 .name = "create_only",
2890 .type = FIO_OPT_BOOL,
2891 .off1 = td_var_offset(create_only),
2892 .help = "Only perform file creation phase",
2893 .category = FIO_OPT_C_FILE,
2898 .lname = "Pre-read files",
2899 .type = FIO_OPT_BOOL,
2900 .off1 = td_var_offset(pre_read),
2901 .help = "Pre-read files before starting official testing",
2903 .category = FIO_OPT_C_FILE,
2904 .group = FIO_OPT_G_INVALID,
2906 #ifdef FIO_HAVE_CPU_AFFINITY
2909 .lname = "CPU mask",
2910 .type = FIO_OPT_INT,
2911 .cb = str_cpumask_cb,
2912 .help = "CPU affinity mask",
2913 .category = FIO_OPT_C_GENERAL,
2914 .group = FIO_OPT_G_CRED,
2917 .name = "cpus_allowed",
2918 .lname = "CPUs allowed",
2919 .type = FIO_OPT_STR,
2920 .cb = str_cpus_allowed_cb,
2921 .help = "Set CPUs allowed",
2922 .category = FIO_OPT_C_GENERAL,
2923 .group = FIO_OPT_G_CRED,
2926 .name = "cpus_allowed_policy",
2927 .lname = "CPUs allowed distribution policy",
2928 .type = FIO_OPT_STR,
2929 .off1 = td_var_offset(cpus_allowed_policy),
2930 .help = "Distribution policy for cpus_allowed",
2931 .parent = "cpus_allowed",
2935 .oval = FIO_CPUS_SHARED,
2936 .help = "Mask shared between threads",
2939 .oval = FIO_CPUS_SPLIT,
2940 .help = "Mask split between threads",
2943 .category = FIO_OPT_C_GENERAL,
2944 .group = FIO_OPT_G_CRED,
2947 #ifdef CONFIG_LIBNUMA
2949 .name = "numa_cpu_nodes",
2950 .type = FIO_OPT_STR,
2951 .cb = str_numa_cpunodes_cb,
2952 .help = "NUMA CPU nodes bind",
2953 .category = FIO_OPT_C_GENERAL,
2954 .group = FIO_OPT_G_INVALID,
2957 .name = "numa_mem_policy",
2958 .type = FIO_OPT_STR,
2959 .cb = str_numa_mpol_cb,
2960 .help = "NUMA memory policy setup",
2961 .category = FIO_OPT_C_GENERAL,
2962 .group = FIO_OPT_G_INVALID,
2966 .name = "end_fsync",
2967 .lname = "End fsync",
2968 .type = FIO_OPT_BOOL,
2969 .off1 = td_var_offset(end_fsync),
2970 .help = "Include fsync at the end of job",
2972 .category = FIO_OPT_C_FILE,
2973 .group = FIO_OPT_G_INVALID,
2976 .name = "fsync_on_close",
2977 .lname = "Fsync on close",
2978 .type = FIO_OPT_BOOL,
2979 .off1 = td_var_offset(fsync_on_close),
2980 .help = "fsync files on close",
2982 .category = FIO_OPT_C_FILE,
2983 .group = FIO_OPT_G_INVALID,
2987 .lname = "Unlink file",
2988 .type = FIO_OPT_BOOL,
2989 .off1 = td_var_offset(unlink),
2990 .help = "Unlink created files after job has completed",
2992 .category = FIO_OPT_C_FILE,
2993 .group = FIO_OPT_G_INVALID,
2997 .lname = "Exit-all on terminate",
2998 .type = FIO_OPT_STR_SET,
2999 .cb = str_exitall_cb,
3000 .help = "Terminate all jobs when one exits",
3001 .category = FIO_OPT_C_GENERAL,
3002 .group = FIO_OPT_G_PROCESS,
3005 .name = "stonewall",
3006 .lname = "Wait for previous",
3007 .alias = "wait_for_previous",
3008 .type = FIO_OPT_STR_SET,
3009 .off1 = td_var_offset(stonewall),
3010 .help = "Insert a hard barrier between this job and previous",
3011 .category = FIO_OPT_C_GENERAL,
3012 .group = FIO_OPT_G_PROCESS,
3015 .name = "new_group",
3016 .lname = "New group",
3017 .type = FIO_OPT_STR_SET,
3018 .off1 = td_var_offset(new_group),
3019 .help = "Mark the start of a new group (for reporting)",
3020 .category = FIO_OPT_C_GENERAL,
3021 .group = FIO_OPT_G_PROCESS,
3026 .type = FIO_OPT_STR_SET,
3027 .off1 = td_var_offset(use_thread),
3028 .help = "Use threads instead of processes",
3029 .category = FIO_OPT_C_GENERAL,
3030 .group = FIO_OPT_G_PROCESS,
3033 .name = "write_bw_log",
3034 .lname = "Write bandwidth log",
3035 .type = FIO_OPT_STR_STORE,
3036 .off1 = td_var_offset(bw_log_file),
3037 .help = "Write log of bandwidth during run",
3038 .category = FIO_OPT_C_LOG,
3039 .group = FIO_OPT_G_INVALID,
3042 .name = "write_lat_log",
3043 .lname = "Write latency log",
3044 .type = FIO_OPT_STR_STORE,
3045 .off1 = td_var_offset(lat_log_file),
3046 .help = "Write log of latency during run",
3047 .category = FIO_OPT_C_LOG,
3048 .group = FIO_OPT_G_INVALID,
3051 .name = "write_iops_log",
3052 .lname = "Write IOPS log",
3053 .type = FIO_OPT_STR_STORE,
3054 .off1 = td_var_offset(iops_log_file),
3055 .help = "Write log of IOPS during run",
3056 .category = FIO_OPT_C_LOG,
3057 .group = FIO_OPT_G_INVALID,
3060 .name = "log_avg_msec",
3061 .lname = "Log averaging (msec)",
3062 .type = FIO_OPT_INT,
3063 .off1 = td_var_offset(log_avg_msec),
3064 .help = "Average bw/iops/lat logs over this period of time",
3066 .category = FIO_OPT_C_LOG,
3067 .group = FIO_OPT_G_INVALID,
3070 .name = "bwavgtime",
3071 .lname = "Bandwidth average time",
3072 .type = FIO_OPT_INT,
3073 .off1 = td_var_offset(bw_avg_time),
3074 .help = "Time window over which to calculate bandwidth"
3077 .parent = "write_bw_log",
3080 .category = FIO_OPT_C_LOG,
3081 .group = FIO_OPT_G_INVALID,
3084 .name = "iopsavgtime",
3085 .lname = "IOPS average time",
3086 .type = FIO_OPT_INT,
3087 .off1 = td_var_offset(iops_avg_time),
3088 .help = "Time window over which to calculate IOPS (msec)",
3090 .parent = "write_iops_log",
3093 .category = FIO_OPT_C_LOG,
3094 .group = FIO_OPT_G_INVALID,
3097 .name = "group_reporting",
3098 .lname = "Group reporting",
3099 .type = FIO_OPT_STR_SET,
3100 .off1 = td_var_offset(group_reporting),
3101 .help = "Do reporting on a per-group basis",
3102 .category = FIO_OPT_C_STAT,
3103 .group = FIO_OPT_G_INVALID,
3106 .name = "zero_buffers",
3107 .lname = "Zero I/O buffers",
3108 .type = FIO_OPT_STR_SET,
3109 .off1 = td_var_offset(zero_buffers),
3110 .help = "Init IO buffers to all zeroes",
3111 .category = FIO_OPT_C_IO,
3112 .group = FIO_OPT_G_IO_BUF,
3115 .name = "refill_buffers",
3116 .lname = "Refill I/O buffers",
3117 .type = FIO_OPT_STR_SET,
3118 .off1 = td_var_offset(refill_buffers),
3119 .help = "Refill IO buffers on every IO submit",
3120 .category = FIO_OPT_C_IO,
3121 .group = FIO_OPT_G_IO_BUF,
3124 .name = "scramble_buffers",
3125 .lname = "Scramble I/O buffers",
3126 .type = FIO_OPT_BOOL,
3127 .off1 = td_var_offset(scramble_buffers),
3128 .help = "Slightly scramble buffers on every IO submit",
3130 .category = FIO_OPT_C_IO,
3131 .group = FIO_OPT_G_IO_BUF,
3134 .name = "buffer_pattern",
3135 .lname = "Buffer pattern",
3136 .type = FIO_OPT_STR,
3137 .cb = str_buffer_pattern_cb,
3138 .help = "Fill pattern for IO buffers",
3139 .category = FIO_OPT_C_IO,
3140 .group = FIO_OPT_G_IO_BUF,
3143 .name = "buffer_compress_percentage",
3144 .lname = "Buffer compression percentage",
3145 .type = FIO_OPT_INT,
3146 .cb = str_buffer_compress_cb,
3149 .help = "How compressible the buffer is (approximately)",
3151 .category = FIO_OPT_C_IO,
3152 .group = FIO_OPT_G_IO_BUF,
3155 .name = "buffer_compress_chunk",
3156 .lname = "Buffer compression chunk size",
3157 .type = FIO_OPT_INT,
3158 .off1 = td_var_offset(compress_chunk),
3159 .parent = "buffer_compress_percentage",
3161 .help = "Size of compressible region in buffer",
3163 .category = FIO_OPT_C_IO,
3164 .group = FIO_OPT_G_IO_BUF,
3167 .name = "clat_percentiles",
3168 .lname = "Completion latency percentiles",
3169 .type = FIO_OPT_BOOL,
3170 .off1 = td_var_offset(clat_percentiles),
3171 .help = "Enable the reporting of completion latency percentiles",
3173 .category = FIO_OPT_C_STAT,
3174 .group = FIO_OPT_G_INVALID,
3177 .name = "percentile_list",
3178 .lname = "Completion latency percentile list",
3179 .type = FIO_OPT_FLOAT_LIST,
3180 .off1 = td_var_offset(percentile_list),
3181 .off2 = td_var_offset(percentile_precision),
3182 .help = "Specify a custom list of percentiles to report",
3183 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3184 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3187 .category = FIO_OPT_C_STAT,
3188 .group = FIO_OPT_G_INVALID,
3191 #ifdef FIO_HAVE_DISK_UTIL
3193 .name = "disk_util",
3194 .lname = "Disk utilization",
3195 .type = FIO_OPT_BOOL,
3196 .off1 = td_var_offset(do_disk_util),
3197 .help = "Log disk utilization statistics",
3199 .category = FIO_OPT_C_STAT,
3200 .group = FIO_OPT_G_INVALID,
3204 .name = "gtod_reduce",
3205 .lname = "Reduce gettimeofday() calls",
3206 .type = FIO_OPT_BOOL,
3207 .help = "Greatly reduce number of gettimeofday() calls",
3208 .cb = str_gtod_reduce_cb,
3211 .category = FIO_OPT_C_STAT,
3212 .group = FIO_OPT_G_INVALID,
3215 .name = "disable_lat",
3216 .lname = "Disable all latency stats",
3217 .type = FIO_OPT_BOOL,
3218 .off1 = td_var_offset(disable_lat),
3219 .help = "Disable latency numbers",
3220 .parent = "gtod_reduce",
3223 .category = FIO_OPT_C_STAT,
3224 .group = FIO_OPT_G_INVALID,
3227 .name = "disable_clat",
3228 .lname = "Disable completion latency stats",
3229 .type = FIO_OPT_BOOL,
3230 .off1 = td_var_offset(disable_clat),
3231 .help = "Disable completion latency numbers",
3232 .parent = "gtod_reduce",
3235 .category = FIO_OPT_C_STAT,
3236 .group = FIO_OPT_G_INVALID,
3239 .name = "disable_slat",
3240 .lname = "Disable submission latency stats",
3241 .type = FIO_OPT_BOOL,
3242 .off1 = td_var_offset(disable_slat),
3243 .help = "Disable submission latency numbers",
3244 .parent = "gtod_reduce",
3247 .category = FIO_OPT_C_STAT,
3248 .group = FIO_OPT_G_INVALID,
3251 .name = "disable_bw_measurement",
3252 .lname = "Disable bandwidth stats",
3253 .type = FIO_OPT_BOOL,
3254 .off1 = td_var_offset(disable_bw),
3255 .help = "Disable bandwidth logging",
3256 .parent = "gtod_reduce",
3259 .category = FIO_OPT_C_STAT,
3260 .group = FIO_OPT_G_INVALID,
3264 .lname = "Dedicated gettimeofday() CPU",
3265 .type = FIO_OPT_INT,
3266 .cb = str_gtod_cpu_cb,
3267 .help = "Set up dedicated gettimeofday() thread on this CPU",
3268 .verify = gtod_cpu_verify,
3269 .category = FIO_OPT_C_GENERAL,
3270 .group = FIO_OPT_G_CLOCK,
3273 .name = "unified_rw_reporting",
3274 .type = FIO_OPT_BOOL,
3275 .off1 = td_var_offset(unified_rw_rep),
3276 .help = "Unify reporting across data direction",
3278 .category = FIO_OPT_C_GENERAL,
3279 .group = FIO_OPT_G_INVALID,
3282 .name = "continue_on_error",
3283 .lname = "Continue on error",
3284 .type = FIO_OPT_STR,
3285 .off1 = td_var_offset(continue_on_error),
3286 .help = "Continue on non-fatal errors during IO",
3288 .category = FIO_OPT_C_GENERAL,
3289 .group = FIO_OPT_G_ERR,
3292 .oval = ERROR_TYPE_NONE,
3293 .help = "Exit when an error is encountered",
3296 .oval = ERROR_TYPE_READ,
3297 .help = "Continue on read errors only",
3300 .oval = ERROR_TYPE_WRITE,
3301 .help = "Continue on write errors only",
3304 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3305 .help = "Continue on any IO errors",
3308 .oval = ERROR_TYPE_VERIFY,
3309 .help = "Continue on verify errors only",
3312 .oval = ERROR_TYPE_ANY,
3313 .help = "Continue on all io and verify errors",
3316 .oval = ERROR_TYPE_NONE,
3317 .help = "Alias for 'none'",
3320 .oval = ERROR_TYPE_ANY,
3321 .help = "Alias for 'all'",
3326 .name = "ignore_error",
3327 .type = FIO_OPT_STR,
3328 .cb = str_ignore_error_cb,
3329 .help = "Set a specific list of errors to ignore",
3331 .category = FIO_OPT_C_GENERAL,
3332 .group = FIO_OPT_G_ERR,
3335 .name = "error_dump",
3336 .type = FIO_OPT_BOOL,
3337 .off1 = td_var_offset(error_dump),
3339 .help = "Dump info on each error",
3340 .category = FIO_OPT_C_GENERAL,
3341 .group = FIO_OPT_G_ERR,
3346 .type = FIO_OPT_STR_STORE,
3347 .off1 = td_var_offset(profile),
3348 .help = "Select a specific builtin performance test",
3349 .category = FIO_OPT_C_PROFILE,
3350 .group = FIO_OPT_G_INVALID,
3355 .type = FIO_OPT_STR_STORE,
3356 .off1 = td_var_offset(cgroup),
3357 .help = "Add job to cgroup of this name",
3358 .category = FIO_OPT_C_GENERAL,
3359 .group = FIO_OPT_G_CGROUP,
3362 .name = "cgroup_nodelete",
3363 .lname = "Cgroup no-delete",
3364 .type = FIO_OPT_BOOL,
3365 .off1 = td_var_offset(cgroup_nodelete),
3366 .help = "Do not delete cgroups after job completion",
3369 .category = FIO_OPT_C_GENERAL,
3370 .group = FIO_OPT_G_CGROUP,
3373 .name = "cgroup_weight",
3374 .lname = "Cgroup weight",
3375 .type = FIO_OPT_INT,
3376 .off1 = td_var_offset(cgroup_weight),
3377 .help = "Use given weight for cgroup",
3381 .category = FIO_OPT_C_GENERAL,
3382 .group = FIO_OPT_G_CGROUP,
3387 .type = FIO_OPT_INT,
3388 .off1 = td_var_offset(uid),
3389 .help = "Run job with this user ID",
3390 .category = FIO_OPT_C_GENERAL,
3391 .group = FIO_OPT_G_CRED,
3395 .lname = "Group ID",
3396 .type = FIO_OPT_INT,
3397 .off1 = td_var_offset(gid),
3398 .help = "Run job with this group ID",
3399 .category = FIO_OPT_C_GENERAL,
3400 .group = FIO_OPT_G_CRED,
3405 .type = FIO_OPT_INT,
3406 .off1 = td_var_offset(kb_base),
3412 .help = "Use 1024 as the K base",
3416 .help = "Use 1000 as the K base",
3419 .help = "How many bytes per KB for reporting (1000 or 1024)",
3420 .category = FIO_OPT_C_GENERAL,
3421 .group = FIO_OPT_G_INVALID,
3424 .name = "unit_base",
3425 .lname = "Base unit for reporting (Bits or Bytes)",
3426 .type = FIO_OPT_INT,
3427 .off1 = td_var_offset(unit_base),
3432 .help = "Auto-detect",
3436 .help = "Normal (byte based)",
3440 .help = "Bit based",
3443 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3444 .category = FIO_OPT_C_GENERAL,
3445 .group = FIO_OPT_G_INVALID,
3448 .name = "hugepage-size",
3449 .lname = "Hugepage size",
3450 .type = FIO_OPT_INT,
3451 .off1 = td_var_offset(hugepage_size),
3452 .help = "When using hugepages, specify size of each page",
3453 .def = __fio_stringify(FIO_HUGE_PAGE),
3454 .interval = 1024 * 1024,
3455 .category = FIO_OPT_C_GENERAL,
3456 .group = FIO_OPT_G_INVALID,
3460 .lname = "I/O flow ID",
3461 .type = FIO_OPT_INT,
3462 .off1 = td_var_offset(flow_id),
3463 .help = "The flow index ID to use",
3465 .category = FIO_OPT_C_IO,
3466 .group = FIO_OPT_G_IO_FLOW,
3470 .lname = "I/O flow weight",
3471 .type = FIO_OPT_INT,
3472 .off1 = td_var_offset(flow),
3473 .help = "Weight for flow control of this job",
3474 .parent = "flow_id",
3477 .category = FIO_OPT_C_IO,
3478 .group = FIO_OPT_G_IO_FLOW,
3481 .name = "flow_watermark",
3482 .lname = "I/O flow watermark",
3483 .type = FIO_OPT_INT,
3484 .off1 = td_var_offset(flow_watermark),
3485 .help = "High watermark for flow control. This option"
3486 " should be set to the same value for all threads"
3487 " with non-zero flow.",
3488 .parent = "flow_id",
3491 .category = FIO_OPT_C_IO,
3492 .group = FIO_OPT_G_IO_FLOW,
3495 .name = "flow_sleep",
3496 .lname = "I/O flow sleep",
3497 .type = FIO_OPT_INT,
3498 .off1 = td_var_offset(flow_sleep),
3499 .help = "How many microseconds to sleep after being held"
3500 " back by the flow control mechanism",
3501 .parent = "flow_id",
3504 .category = FIO_OPT_C_IO,
3505 .group = FIO_OPT_G_IO_FLOW,
3512 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3513 const char *name, int val)
3515 lopt->name = (char *) name;
3517 if (o->type == FIO_OPT_STR_SET)
3518 lopt->has_arg = optional_argument;
3520 lopt->has_arg = required_argument;
3523 static void options_to_lopts(struct fio_option *opts,
3524 struct option *long_options,
3525 int i, int option_type)
3527 struct fio_option *o = &opts[0];
3529 add_to_lopt(&long_options[i], o, o->name, option_type);
3532 add_to_lopt(&long_options[i], o, o->alias, option_type);
3537 assert(i < FIO_NR_OPTIONS);
3541 void fio_options_set_ioengine_opts(struct option *long_options,
3542 struct thread_data *td)
3547 while (long_options[i].name) {
3548 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3549 memset(&long_options[i], 0, sizeof(*long_options));
3556 * Just clear out the prior ioengine options.
3561 options_to_lopts(td->io_ops->options, long_options, i,
3562 FIO_GETOPT_IOENGINE);
3565 void fio_options_dup_and_init(struct option *long_options)
3569 options_init(fio_options);
3572 while (long_options[i].name)
3575 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3578 struct fio_keyword {
3584 static struct fio_keyword fio_keywords[] = {
3586 .word = "$pagesize",
3587 .desc = "Page size in the system",
3590 .word = "$mb_memory",
3591 .desc = "Megabytes of memory online",
3595 .desc = "Number of CPUs online in the system",
3602 void fio_keywords_init(void)
3604 unsigned long long mb_memory;
3608 sprintf(buf, "%lu", (unsigned long) page_size);
3609 fio_keywords[0].replace = strdup(buf);
3611 mb_memory = os_phys_mem() / (1024 * 1024);
3612 sprintf(buf, "%llu", mb_memory);
3613 fio_keywords[1].replace = strdup(buf);
3616 sprintf(buf, "%lu", l);
3617 fio_keywords[2].replace = strdup(buf);
3622 static char *bc_calc(char *str)
3624 char buf[128], *tmp;
3629 * No math, just return string
3631 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3632 !strchr(str, '/')) || strchr(str, '\''))
3636 * Split option from value, we only need to calculate the value
3638 tmp = strchr(str, '=');
3645 * Prevent buffer overflows; such a case isn't reasonable anyway
3647 if (strlen(str) >= 128 || strlen(tmp) > 100)
3650 sprintf(buf, "which %s > /dev/null", BC_APP);
3652 log_err("fio: bc is needed for performing math\n");
3656 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3657 f = popen(buf, "r");
3661 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3666 buf[(tmp - str) + ret - 1] = '\0';
3667 memcpy(buf, str, tmp - str);
3673 * Return a copy of the input string with substrings of the form ${VARNAME}
3674 * substituted with the value of the environment variable VARNAME. The
3675 * substitution always occurs, even if VARNAME is empty or the corresponding
3676 * environment variable undefined.
3678 static char *option_dup_subs(const char *opt)
3680 char out[OPT_LEN_MAX+1];
3681 char in[OPT_LEN_MAX+1];
3684 char *ch1, *ch2, *env;
3685 ssize_t nchr = OPT_LEN_MAX;
3688 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3689 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3693 in[OPT_LEN_MAX] = '\0';
3694 strncpy(in, opt, OPT_LEN_MAX);
3696 while (*inptr && nchr > 0) {
3697 if (inptr[0] == '$' && inptr[1] == '{') {
3698 ch2 = strchr(inptr, '}');
3699 if (ch2 && inptr+1 < ch2) {
3706 envlen = strlen(env);
3707 if (envlen <= nchr) {
3708 memcpy(outptr, env, envlen);
3718 *outptr++ = *inptr++;
3727 * Look for reserved variable names and replace them with real values
3729 static char *fio_keyword_replace(char *opt)
3735 for (i = 0; fio_keywords[i].word != NULL; i++) {
3736 struct fio_keyword *kw = &fio_keywords[i];
3738 while ((s = strstr(opt, kw->word)) != NULL) {
3739 char *new = malloc(strlen(opt) + 1);
3745 * Copy part of the string before the keyword and
3746 * sprintf() the replacement after it.
3748 memcpy(new, opt, olen);
3749 len = sprintf(new + olen, "%s", kw->replace);
3752 * If there's more in the original string, copy that
3755 opt += strlen(kw->word) + olen;
3757 memcpy(new + olen + len, opt, opt - o_org - 1);
3760 * replace opt and free the old opt
3770 * Check for potential math and invoke bc, if possible
3778 static char **dup_and_sub_options(char **opts, int num_opts)
3781 char **opts_copy = malloc(num_opts * sizeof(*opts));
3782 for (i = 0; i < num_opts; i++) {
3783 opts_copy[i] = option_dup_subs(opts[i]);
3786 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3791 int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3794 int i, ret, unknown;
3797 sort_options(opts, fio_options, num_opts);
3798 opts_copy = dup_and_sub_options(opts, num_opts);
3800 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3801 struct fio_option *o;
3802 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3803 &o, td, dump_cmdline);
3811 opts_copy[i] = NULL;
3818 ret |= ioengine_load(td);
3820 sort_options(opts_copy, td->io_ops->options, num_opts);
3823 for (i = 0; i < num_opts; i++) {
3824 struct fio_option *o = NULL;
3830 newret = parse_option(opts_copy[i], opts[i],
3831 td->io_ops->options, &o,
3832 td->eo, dump_cmdline);
3836 log_err("Bad option <%s>\n", opts[i]);
3839 opts_copy[i] = NULL;
3847 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3849 return parse_cmd_option(opt, val, fio_options, td);
3852 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3855 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
3858 void fio_fill_default_options(struct thread_data *td)
3860 td->o.magic = OPT_MAGIC;
3861 fill_default_options(td, fio_options);
3864 int fio_show_option_help(const char *opt)
3866 return show_cmd_help(fio_options, opt);
3869 void options_mem_dupe(void *data, struct fio_option *options)
3871 struct fio_option *o;
3874 for (o = &options[0]; o->name; o++) {
3875 if (o->type != FIO_OPT_STR_STORE)
3878 ptr = td_var(data, o, o->off1);
3880 *ptr = strdup(*ptr);
3885 * dupe FIO_OPT_STR_STORE options
3887 void fio_options_mem_dupe(struct thread_data *td)
3889 options_mem_dupe(&td->o, fio_options);
3891 if (td->eo && td->io_ops) {
3892 void *oldeo = td->eo;
3894 td->eo = malloc(td->io_ops->option_struct_size);
3895 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3896 options_mem_dupe(td->eo, td->io_ops->options);
3900 unsigned int fio_get_kb_base(void *data)
3902 struct thread_options *o = data;
3903 unsigned int kb_base = 0;
3906 * This is a hack... For private options, *data is not holding
3907 * a pointer to the thread_options, but to private data. This means
3908 * we can't safely dereference it, but magic is first so mem wise
3909 * it is valid. But this also means that if the job first sets
3910 * kb_base and expects that to be honored by private options,
3911 * it will be disappointed. We will return the global default
3914 if (o && o->magic == OPT_MAGIC)
3915 kb_base = o->kb_base;
3922 int add_option(struct fio_option *o)
3924 struct fio_option *__o;
3933 if (opt_index + 1 == FIO_MAX_OPTS) {
3934 log_err("fio: FIO_MAX_OPTS is too small\n");
3938 memcpy(&fio_options[opt_index], o, sizeof(*o));
3939 fio_options[opt_index + 1].name = NULL;
3943 void invalidate_profile_options(const char *prof_name)
3945 struct fio_option *o;
3949 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3950 o->type = FIO_OPT_INVALID;
3951 o->prof_name = NULL;
3957 void add_opt_posval(const char *optname, const char *ival, const char *help)
3959 struct fio_option *o;
3962 o = find_option(fio_options, optname);
3966 for (i = 0; i < PARSE_MAX_VP; i++) {
3967 if (o->posval[i].ival)
3970 o->posval[i].ival = ival;
3971 o->posval[i].help = help;
3976 void del_opt_posval(const char *optname, const char *ival)
3978 struct fio_option *o;
3981 o = find_option(fio_options, optname);
3985 for (i = 0; i < PARSE_MAX_VP; i++) {
3986 if (!o->posval[i].ival)
3988 if (strcmp(o->posval[i].ival, ival))
3991 o->posval[i].ival = NULL;
3992 o->posval[i].help = NULL;
3996 void fio_options_free(struct thread_data *td)
3998 options_free(fio_options, td);
3999 if (td->eo && td->io_ops && td->io_ops->options) {
4000 options_free(td->io_ops->options, td->eo);
4006 struct fio_option *fio_option_find(const char *name)
4008 return find_option(fio_options, name);