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",
1526 { .ival = "external",
1527 .help = "Load external engine (append name)",
1533 .lname = "IO Depth",
1534 .type = FIO_OPT_INT,
1535 .off1 = td_var_offset(iodepth),
1536 .help = "Number of IO buffers to keep in flight",
1540 .category = FIO_OPT_C_IO,
1541 .group = FIO_OPT_G_IO_BASIC,
1544 .name = "iodepth_batch",
1545 .lname = "IO Depth batch",
1546 .alias = "iodepth_batch_submit",
1547 .type = FIO_OPT_INT,
1548 .off1 = td_var_offset(iodepth_batch),
1549 .help = "Number of IO buffers to submit in one go",
1550 .parent = "iodepth",
1555 .category = FIO_OPT_C_IO,
1556 .group = FIO_OPT_G_IO_BASIC,
1559 .name = "iodepth_batch_complete",
1560 .lname = "IO Depth batch complete",
1561 .type = FIO_OPT_INT,
1562 .off1 = td_var_offset(iodepth_batch_complete),
1563 .help = "Number of IO buffers to retrieve in one go",
1564 .parent = "iodepth",
1569 .category = FIO_OPT_C_IO,
1570 .group = FIO_OPT_G_IO_BASIC,
1573 .name = "iodepth_low",
1574 .lname = "IO Depth batch low",
1575 .type = FIO_OPT_INT,
1576 .off1 = td_var_offset(iodepth_low),
1577 .help = "Low water mark for queuing depth",
1578 .parent = "iodepth",
1581 .category = FIO_OPT_C_IO,
1582 .group = FIO_OPT_G_IO_BASIC,
1587 .type = FIO_OPT_STR_VAL,
1589 .help = "Total size of device or files",
1590 .interval = 1024 * 1024,
1591 .category = FIO_OPT_C_IO,
1592 .group = FIO_OPT_G_INVALID,
1595 .name = "fill_device",
1596 .lname = "Fill device",
1598 .type = FIO_OPT_BOOL,
1599 .off1 = td_var_offset(fill_device),
1600 .help = "Write until an ENOSPC error occurs",
1602 .category = FIO_OPT_C_FILE,
1603 .group = FIO_OPT_G_INVALID,
1607 .lname = "File size",
1608 .type = FIO_OPT_STR_VAL,
1609 .off1 = td_var_offset(file_size_low),
1610 .off2 = td_var_offset(file_size_high),
1612 .help = "Size of individual files",
1613 .interval = 1024 * 1024,
1614 .category = FIO_OPT_C_FILE,
1615 .group = FIO_OPT_G_INVALID,
1618 .name = "file_append",
1619 .lname = "File append",
1620 .type = FIO_OPT_BOOL,
1621 .off1 = td_var_offset(file_append),
1622 .help = "IO will start at the end of the file(s)",
1624 .category = FIO_OPT_C_FILE,
1625 .group = FIO_OPT_G_INVALID,
1629 .lname = "IO offset",
1630 .alias = "fileoffset",
1631 .type = FIO_OPT_STR_VAL,
1632 .off1 = td_var_offset(start_offset),
1633 .help = "Start IO from this offset",
1635 .interval = 1024 * 1024,
1636 .category = FIO_OPT_C_IO,
1637 .group = FIO_OPT_G_INVALID,
1640 .name = "offset_increment",
1641 .lname = "IO offset increment",
1642 .type = FIO_OPT_STR_VAL,
1643 .off1 = td_var_offset(offset_increment),
1644 .help = "What is the increment from one offset to the next",
1648 .interval = 1024 * 1024,
1649 .category = FIO_OPT_C_IO,
1650 .group = FIO_OPT_G_INVALID,
1653 .name = "number_ios",
1654 .lname = "Number of IOs to perform",
1655 .type = FIO_OPT_STR_VAL,
1656 .off1 = td_var_offset(number_ios),
1657 .help = "Force job completion of this number of IOs",
1659 .category = FIO_OPT_C_IO,
1660 .group = FIO_OPT_G_INVALID,
1664 .lname = "Block size",
1665 .alias = "blocksize",
1666 .type = FIO_OPT_INT,
1667 .off1 = td_var_offset(bs[DDIR_READ]),
1668 .off2 = td_var_offset(bs[DDIR_WRITE]),
1669 .off3 = td_var_offset(bs[DDIR_TRIM]),
1671 .help = "Block size unit",
1676 .category = FIO_OPT_C_IO,
1677 .group = FIO_OPT_G_INVALID,
1681 .lname = "Block size align",
1682 .alias = "blockalign",
1683 .type = FIO_OPT_INT,
1684 .off1 = td_var_offset(ba[DDIR_READ]),
1685 .off2 = td_var_offset(ba[DDIR_WRITE]),
1686 .off3 = td_var_offset(ba[DDIR_TRIM]),
1688 .help = "IO block offset alignment",
1692 .category = FIO_OPT_C_IO,
1693 .group = FIO_OPT_G_INVALID,
1697 .lname = "Block size range",
1698 .alias = "blocksize_range",
1699 .type = FIO_OPT_RANGE,
1700 .off1 = td_var_offset(min_bs[DDIR_READ]),
1701 .off2 = td_var_offset(max_bs[DDIR_READ]),
1702 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1703 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1704 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1705 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1707 .help = "Set block size range (in more detail than bs)",
1711 .category = FIO_OPT_C_IO,
1712 .group = FIO_OPT_G_INVALID,
1716 .lname = "Block size split",
1717 .type = FIO_OPT_STR,
1718 .cb = str_bssplit_cb,
1719 .help = "Set a specific mix of block sizes",
1722 .category = FIO_OPT_C_IO,
1723 .group = FIO_OPT_G_INVALID,
1726 .name = "bs_unaligned",
1727 .lname = "Block size unaligned",
1728 .alias = "blocksize_unaligned",
1729 .type = FIO_OPT_STR_SET,
1730 .off1 = td_var_offset(bs_unaligned),
1731 .help = "Don't sector align IO buffer sizes",
1734 .category = FIO_OPT_C_IO,
1735 .group = FIO_OPT_G_INVALID,
1738 .name = "bs_is_seq_rand",
1739 .lname = "Block size division is seq/random (not read/write)",
1740 .type = FIO_OPT_BOOL,
1741 .off1 = td_var_offset(bs_is_seq_rand),
1742 .help = "Consider any blocksize setting to be sequential,ramdom",
1744 .parent = "blocksize",
1745 .category = FIO_OPT_C_IO,
1746 .group = FIO_OPT_G_INVALID,
1749 .name = "randrepeat",
1750 .lname = "Random repeatable",
1751 .type = FIO_OPT_BOOL,
1752 .off1 = td_var_offset(rand_repeatable),
1753 .help = "Use repeatable random IO pattern",
1757 .category = FIO_OPT_C_IO,
1758 .group = FIO_OPT_G_RANDOM,
1762 .lname = "The random generator seed",
1763 .type = FIO_OPT_STR_VAL,
1764 .off1 = td_var_offset(rand_seed),
1765 .help = "Set the random generator seed value",
1767 .category = FIO_OPT_C_IO,
1768 .group = FIO_OPT_G_RANDOM,
1771 .name = "use_os_rand",
1772 .lname = "Use OS random",
1773 .type = FIO_OPT_BOOL,
1774 .off1 = td_var_offset(use_os_rand),
1775 .help = "Set to use OS random generator",
1779 .category = FIO_OPT_C_IO,
1780 .group = FIO_OPT_G_RANDOM,
1783 .name = "norandommap",
1784 .lname = "No randommap",
1785 .type = FIO_OPT_STR_SET,
1786 .off1 = td_var_offset(norandommap),
1787 .help = "Accept potential duplicate random blocks",
1791 .category = FIO_OPT_C_IO,
1792 .group = FIO_OPT_G_RANDOM,
1795 .name = "softrandommap",
1796 .lname = "Soft randommap",
1797 .type = FIO_OPT_BOOL,
1798 .off1 = td_var_offset(softrandommap),
1799 .help = "Set norandommap if randommap allocation fails",
1800 .parent = "norandommap",
1803 .category = FIO_OPT_C_IO,
1804 .group = FIO_OPT_G_RANDOM,
1807 .name = "random_generator",
1808 .type = FIO_OPT_STR,
1809 .off1 = td_var_offset(random_generator),
1810 .help = "Type of random number generator to use",
1811 .def = "tausworthe",
1813 { .ival = "tausworthe",
1814 .oval = FIO_RAND_GEN_TAUSWORTHE,
1815 .help = "Strong Tausworthe generator",
1818 .oval = FIO_RAND_GEN_LFSR,
1819 .help = "Variable length LFSR",
1822 .category = FIO_OPT_C_IO,
1823 .group = FIO_OPT_G_RANDOM,
1826 .name = "random_distribution",
1827 .type = FIO_OPT_STR,
1828 .off1 = td_var_offset(random_distribution),
1829 .cb = str_random_distribution_cb,
1830 .help = "Random offset distribution generator",
1834 .oval = FIO_RAND_DIST_RANDOM,
1835 .help = "Completely random",
1838 .oval = FIO_RAND_DIST_ZIPF,
1839 .help = "Zipf distribution",
1842 .oval = FIO_RAND_DIST_PARETO,
1843 .help = "Pareto distribution",
1846 .category = FIO_OPT_C_IO,
1847 .group = FIO_OPT_G_RANDOM,
1850 .name = "percentage_random",
1851 .lname = "Percentage Random",
1852 .type = FIO_OPT_INT,
1853 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1854 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1855 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1857 .help = "Percentage of seq/random mix that should be random",
1858 .def = "100,100,100",
1860 .inverse = "percentage_sequential",
1861 .category = FIO_OPT_C_IO,
1862 .group = FIO_OPT_G_RANDOM,
1865 .name = "percentage_sequential",
1866 .lname = "Percentage Sequential",
1867 .type = FIO_OPT_DEPRECATED,
1868 .category = FIO_OPT_C_IO,
1869 .group = FIO_OPT_G_RANDOM,
1872 .name = "allrandrepeat",
1873 .type = FIO_OPT_BOOL,
1874 .off1 = td_var_offset(allrand_repeatable),
1875 .help = "Use repeatable random numbers for everything",
1877 .category = FIO_OPT_C_IO,
1878 .group = FIO_OPT_G_RANDOM,
1882 .lname = "Number of files",
1883 .alias = "nr_files",
1884 .type = FIO_OPT_INT,
1885 .off1 = td_var_offset(nr_files),
1886 .help = "Split job workload between this number of files",
1889 .category = FIO_OPT_C_FILE,
1890 .group = FIO_OPT_G_INVALID,
1893 .name = "openfiles",
1894 .lname = "Number of open files",
1895 .type = FIO_OPT_INT,
1896 .off1 = td_var_offset(open_files),
1897 .help = "Number of files to keep open at the same time",
1898 .category = FIO_OPT_C_FILE,
1899 .group = FIO_OPT_G_INVALID,
1902 .name = "file_service_type",
1903 .lname = "File service type",
1904 .type = FIO_OPT_STR,
1906 .off1 = td_var_offset(file_service_type),
1907 .help = "How to select which file to service next",
1908 .def = "roundrobin",
1909 .category = FIO_OPT_C_FILE,
1910 .group = FIO_OPT_G_INVALID,
1913 .oval = FIO_FSERVICE_RANDOM,
1914 .help = "Choose a file at random",
1916 { .ival = "roundrobin",
1917 .oval = FIO_FSERVICE_RR,
1918 .help = "Round robin select files",
1920 { .ival = "sequential",
1921 .oval = FIO_FSERVICE_SEQ,
1922 .help = "Finish one file before moving to the next",
1925 .parent = "nrfiles",
1928 #ifdef CONFIG_POSIX_FALLOCATE
1930 .name = "fallocate",
1931 .lname = "Fallocate",
1932 .type = FIO_OPT_STR,
1933 .off1 = td_var_offset(fallocate_mode),
1934 .help = "Whether pre-allocation is performed when laying out files",
1936 .category = FIO_OPT_C_FILE,
1937 .group = FIO_OPT_G_INVALID,
1940 .oval = FIO_FALLOCATE_NONE,
1941 .help = "Do not pre-allocate space",
1944 .oval = FIO_FALLOCATE_POSIX,
1945 .help = "Use posix_fallocate()",
1947 #ifdef CONFIG_LINUX_FALLOCATE
1949 .oval = FIO_FALLOCATE_KEEP_SIZE,
1950 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1953 /* Compatibility with former boolean values */
1955 .oval = FIO_FALLOCATE_NONE,
1956 .help = "Alias for 'none'",
1959 .oval = FIO_FALLOCATE_POSIX,
1960 .help = "Alias for 'posix'",
1964 #endif /* CONFIG_POSIX_FALLOCATE */
1966 .name = "fadvise_hint",
1967 .lname = "Fadvise hint",
1968 .type = FIO_OPT_BOOL,
1969 .off1 = td_var_offset(fadvise_hint),
1970 .help = "Use fadvise() to advise the kernel on IO pattern",
1972 .category = FIO_OPT_C_FILE,
1973 .group = FIO_OPT_G_INVALID,
1978 .type = FIO_OPT_INT,
1979 .off1 = td_var_offset(fsync_blocks),
1980 .help = "Issue fsync for writes every given number of blocks",
1983 .category = FIO_OPT_C_FILE,
1984 .group = FIO_OPT_G_INVALID,
1987 .name = "fdatasync",
1988 .lname = "Fdatasync",
1989 .type = FIO_OPT_INT,
1990 .off1 = td_var_offset(fdatasync_blocks),
1991 .help = "Issue fdatasync for writes every given number of blocks",
1994 .category = FIO_OPT_C_FILE,
1995 .group = FIO_OPT_G_INVALID,
1998 .name = "write_barrier",
1999 .lname = "Write barrier",
2000 .type = FIO_OPT_INT,
2001 .off1 = td_var_offset(barrier_blocks),
2002 .help = "Make every Nth write a barrier write",
2005 .category = FIO_OPT_C_IO,
2006 .group = FIO_OPT_G_INVALID,
2008 #ifdef CONFIG_SYNC_FILE_RANGE
2010 .name = "sync_file_range",
2011 .lname = "Sync file range",
2013 { .ival = "wait_before",
2014 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2015 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2019 .oval = SYNC_FILE_RANGE_WRITE,
2020 .help = "SYNC_FILE_RANGE_WRITE",
2024 .ival = "wait_after",
2025 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2026 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2030 .type = FIO_OPT_STR_MULTI,
2032 .off1 = td_var_offset(sync_file_range),
2033 .help = "Use sync_file_range()",
2034 .category = FIO_OPT_C_FILE,
2035 .group = FIO_OPT_G_INVALID,
2040 .lname = "Direct I/O",
2041 .type = FIO_OPT_BOOL,
2042 .off1 = td_var_offset(odirect),
2043 .help = "Use O_DIRECT IO (negates buffered)",
2045 .inverse = "buffered",
2046 .category = FIO_OPT_C_IO,
2047 .group = FIO_OPT_G_IO_TYPE,
2051 .lname = "Atomic I/O",
2052 .type = FIO_OPT_BOOL,
2053 .off1 = td_var_offset(oatomic),
2054 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2056 .category = FIO_OPT_C_IO,
2057 .group = FIO_OPT_G_IO_TYPE,
2061 .lname = "Buffered I/O",
2062 .type = FIO_OPT_BOOL,
2063 .off1 = td_var_offset(odirect),
2065 .help = "Use buffered IO (negates direct)",
2067 .inverse = "direct",
2068 .category = FIO_OPT_C_IO,
2069 .group = FIO_OPT_G_IO_TYPE,
2072 .name = "overwrite",
2073 .lname = "Overwrite",
2074 .type = FIO_OPT_BOOL,
2075 .off1 = td_var_offset(overwrite),
2076 .help = "When writing, set whether to overwrite current data",
2078 .category = FIO_OPT_C_FILE,
2079 .group = FIO_OPT_G_INVALID,
2084 .type = FIO_OPT_INT,
2085 .off1 = td_var_offset(loops),
2086 .help = "Number of times to run the job",
2089 .category = FIO_OPT_C_GENERAL,
2090 .group = FIO_OPT_G_RUNTIME,
2094 .lname = "Number of jobs",
2095 .type = FIO_OPT_INT,
2096 .off1 = td_var_offset(numjobs),
2097 .help = "Duplicate this job this many times",
2100 .category = FIO_OPT_C_GENERAL,
2101 .group = FIO_OPT_G_RUNTIME,
2104 .name = "startdelay",
2105 .lname = "Start delay",
2106 .type = FIO_OPT_STR_VAL_TIME,
2107 .off1 = td_var_offset(start_delay),
2108 .off2 = td_var_offset(start_delay_high),
2109 .help = "Only start job when this period has passed",
2112 .category = FIO_OPT_C_GENERAL,
2113 .group = FIO_OPT_G_RUNTIME,
2119 .type = FIO_OPT_STR_VAL_TIME,
2120 .off1 = td_var_offset(timeout),
2121 .help = "Stop workload when this amount of time has passed",
2124 .category = FIO_OPT_C_GENERAL,
2125 .group = FIO_OPT_G_RUNTIME,
2128 .name = "time_based",
2129 .lname = "Time based",
2130 .type = FIO_OPT_STR_SET,
2131 .off1 = td_var_offset(time_based),
2132 .help = "Keep running until runtime/timeout is met",
2133 .category = FIO_OPT_C_GENERAL,
2134 .group = FIO_OPT_G_RUNTIME,
2137 .name = "verify_only",
2138 .lname = "Verify only",
2139 .type = FIO_OPT_STR_SET,
2140 .off1 = td_var_offset(verify_only),
2141 .help = "Verifies previously written data is still valid",
2142 .category = FIO_OPT_C_GENERAL,
2143 .group = FIO_OPT_G_RUNTIME,
2146 .name = "ramp_time",
2147 .lname = "Ramp time",
2148 .type = FIO_OPT_STR_VAL_TIME,
2149 .off1 = td_var_offset(ramp_time),
2150 .help = "Ramp up time before measuring performance",
2152 .category = FIO_OPT_C_GENERAL,
2153 .group = FIO_OPT_G_RUNTIME,
2156 .name = "clocksource",
2157 .lname = "Clock source",
2158 .type = FIO_OPT_STR,
2159 .cb = fio_clock_source_cb,
2160 .off1 = td_var_offset(clocksource),
2161 .help = "What type of timing source to use",
2162 .category = FIO_OPT_C_GENERAL,
2163 .group = FIO_OPT_G_CLOCK,
2165 #ifdef CONFIG_GETTIMEOFDAY
2166 { .ival = "gettimeofday",
2168 .help = "Use gettimeofday(2) for timing",
2171 #ifdef CONFIG_CLOCK_GETTIME
2172 { .ival = "clock_gettime",
2173 .oval = CS_CGETTIME,
2174 .help = "Use clock_gettime(2) for timing",
2177 #ifdef ARCH_HAVE_CPU_CLOCK
2179 .oval = CS_CPUCLOCK,
2180 .help = "Use CPU private clock",
2188 .lname = "I/O Memory",
2189 .type = FIO_OPT_STR,
2191 .off1 = td_var_offset(mem_type),
2192 .help = "Backing type for IO buffers",
2194 .category = FIO_OPT_C_IO,
2195 .group = FIO_OPT_G_INVALID,
2199 .help = "Use malloc(3) for IO buffers",
2203 .help = "Use shared memory segments for IO buffers",
2205 #ifdef FIO_HAVE_HUGETLB
2206 { .ival = "shmhuge",
2207 .oval = MEM_SHMHUGE,
2208 .help = "Like shm, but use huge pages",
2213 .help = "Use mmap(2) (file or anon) for IO buffers",
2215 #ifdef FIO_HAVE_HUGETLB
2216 { .ival = "mmaphuge",
2217 .oval = MEM_MMAPHUGE,
2218 .help = "Like mmap, but use huge pages",
2224 .name = "iomem_align",
2225 .alias = "mem_align",
2226 .lname = "I/O memory alignment",
2227 .type = FIO_OPT_INT,
2228 .off1 = td_var_offset(mem_align),
2230 .help = "IO memory buffer offset alignment",
2234 .category = FIO_OPT_C_IO,
2235 .group = FIO_OPT_G_INVALID,
2240 .type = FIO_OPT_STR,
2241 .off1 = td_var_offset(verify),
2242 .help = "Verify data written",
2244 .category = FIO_OPT_C_IO,
2245 .group = FIO_OPT_G_VERIFY,
2248 .oval = VERIFY_NONE,
2249 .help = "Don't do IO verification",
2253 .help = "Use md5 checksums for verification",
2256 .oval = VERIFY_CRC64,
2257 .help = "Use crc64 checksums for verification",
2260 .oval = VERIFY_CRC32,
2261 .help = "Use crc32 checksums for verification",
2263 { .ival = "crc32c-intel",
2264 .oval = VERIFY_CRC32C,
2265 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2268 .oval = VERIFY_CRC32C,
2269 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2272 .oval = VERIFY_CRC16,
2273 .help = "Use crc16 checksums for verification",
2276 .oval = VERIFY_CRC7,
2277 .help = "Use crc7 checksums for verification",
2280 .oval = VERIFY_SHA1,
2281 .help = "Use sha1 checksums for verification",
2284 .oval = VERIFY_SHA256,
2285 .help = "Use sha256 checksums for verification",
2288 .oval = VERIFY_SHA512,
2289 .help = "Use sha512 checksums for verification",
2292 .oval = VERIFY_XXHASH,
2293 .help = "Use xxhash checksums for verification",
2296 .oval = VERIFY_META,
2297 .help = "Use io information",
2301 .oval = VERIFY_NULL,
2302 .help = "Pretend to verify",
2307 .name = "do_verify",
2308 .lname = "Perform verify step",
2309 .type = FIO_OPT_BOOL,
2310 .off1 = td_var_offset(do_verify),
2311 .help = "Run verification stage after write",
2315 .category = FIO_OPT_C_IO,
2316 .group = FIO_OPT_G_VERIFY,
2319 .name = "verifysort",
2320 .lname = "Verify sort",
2321 .type = FIO_OPT_BOOL,
2322 .off1 = td_var_offset(verifysort),
2323 .help = "Sort written verify blocks for read back",
2327 .category = FIO_OPT_C_IO,
2328 .group = FIO_OPT_G_VERIFY,
2331 .name = "verifysort_nr",
2332 .type = FIO_OPT_INT,
2333 .off1 = td_var_offset(verifysort_nr),
2334 .help = "Pre-load and sort verify blocks for a read workload",
2339 .category = FIO_OPT_C_IO,
2340 .group = FIO_OPT_G_VERIFY,
2343 .name = "verify_interval",
2344 .lname = "Verify interval",
2345 .type = FIO_OPT_INT,
2346 .off1 = td_var_offset(verify_interval),
2347 .minval = 2 * sizeof(struct verify_header),
2348 .help = "Store verify buffer header every N bytes",
2351 .interval = 2 * sizeof(struct verify_header),
2352 .category = FIO_OPT_C_IO,
2353 .group = FIO_OPT_G_VERIFY,
2356 .name = "verify_offset",
2357 .lname = "Verify offset",
2358 .type = FIO_OPT_INT,
2359 .help = "Offset verify header location by N bytes",
2360 .off1 = td_var_offset(verify_offset),
2361 .minval = sizeof(struct verify_header),
2364 .category = FIO_OPT_C_IO,
2365 .group = FIO_OPT_G_VERIFY,
2368 .name = "verify_pattern",
2369 .lname = "Verify pattern",
2370 .type = FIO_OPT_STR,
2371 .cb = str_verify_pattern_cb,
2372 .help = "Fill pattern for IO buffers",
2375 .category = FIO_OPT_C_IO,
2376 .group = FIO_OPT_G_VERIFY,
2379 .name = "verify_fatal",
2380 .lname = "Verify fatal",
2381 .type = FIO_OPT_BOOL,
2382 .off1 = td_var_offset(verify_fatal),
2384 .help = "Exit on a single verify failure, don't continue",
2387 .category = FIO_OPT_C_IO,
2388 .group = FIO_OPT_G_VERIFY,
2391 .name = "verify_dump",
2392 .lname = "Verify dump",
2393 .type = FIO_OPT_BOOL,
2394 .off1 = td_var_offset(verify_dump),
2396 .help = "Dump contents of good and bad blocks on failure",
2399 .category = FIO_OPT_C_IO,
2400 .group = FIO_OPT_G_VERIFY,
2403 .name = "verify_async",
2404 .lname = "Verify asynchronously",
2405 .type = FIO_OPT_INT,
2406 .off1 = td_var_offset(verify_async),
2408 .help = "Number of async verifier threads to use",
2411 .category = FIO_OPT_C_IO,
2412 .group = FIO_OPT_G_VERIFY,
2415 .name = "verify_backlog",
2416 .lname = "Verify backlog",
2417 .type = FIO_OPT_STR_VAL,
2418 .off1 = td_var_offset(verify_backlog),
2419 .help = "Verify after this number of blocks are written",
2422 .category = FIO_OPT_C_IO,
2423 .group = FIO_OPT_G_VERIFY,
2426 .name = "verify_backlog_batch",
2427 .lname = "Verify backlog batch",
2428 .type = FIO_OPT_INT,
2429 .off1 = td_var_offset(verify_batch),
2430 .help = "Verify this number of IO blocks",
2433 .category = FIO_OPT_C_IO,
2434 .group = FIO_OPT_G_VERIFY,
2436 #ifdef FIO_HAVE_CPU_AFFINITY
2438 .name = "verify_async_cpus",
2439 .lname = "Async verify CPUs",
2440 .type = FIO_OPT_STR,
2441 .cb = str_verify_cpus_allowed_cb,
2442 .help = "Set CPUs allowed for async verify threads",
2443 .parent = "verify_async",
2445 .category = FIO_OPT_C_IO,
2446 .group = FIO_OPT_G_VERIFY,
2450 .name = "experimental_verify",
2451 .off1 = td_var_offset(experimental_verify),
2452 .type = FIO_OPT_BOOL,
2453 .help = "Enable experimental verification",
2454 .category = FIO_OPT_C_IO,
2455 .group = FIO_OPT_G_VERIFY,
2457 #ifdef FIO_HAVE_TRIM
2459 .name = "trim_percentage",
2460 .lname = "Trim percentage",
2461 .type = FIO_OPT_INT,
2462 .off1 = td_var_offset(trim_percentage),
2465 .help = "Number of verify blocks to discard/trim",
2470 .category = FIO_OPT_C_IO,
2471 .group = FIO_OPT_G_TRIM,
2474 .name = "trim_verify_zero",
2475 .lname = "Verify trim zero",
2476 .type = FIO_OPT_BOOL,
2477 .help = "Verify that trim/discarded blocks are returned as zeroes",
2478 .off1 = td_var_offset(trim_zero),
2479 .parent = "trim_percentage",
2482 .category = FIO_OPT_C_IO,
2483 .group = FIO_OPT_G_TRIM,
2486 .name = "trim_backlog",
2487 .lname = "Trim backlog",
2488 .type = FIO_OPT_STR_VAL,
2489 .off1 = td_var_offset(trim_backlog),
2490 .help = "Trim after this number of blocks are written",
2491 .parent = "trim_percentage",
2494 .category = FIO_OPT_C_IO,
2495 .group = FIO_OPT_G_TRIM,
2498 .name = "trim_backlog_batch",
2499 .lname = "Trim backlog batch",
2500 .type = FIO_OPT_INT,
2501 .off1 = td_var_offset(trim_batch),
2502 .help = "Trim this number of IO blocks",
2503 .parent = "trim_percentage",
2506 .category = FIO_OPT_C_IO,
2507 .group = FIO_OPT_G_TRIM,
2511 .name = "write_iolog",
2512 .lname = "Write I/O log",
2513 .type = FIO_OPT_STR_STORE,
2514 .off1 = td_var_offset(write_iolog_file),
2515 .help = "Store IO pattern to file",
2516 .category = FIO_OPT_C_IO,
2517 .group = FIO_OPT_G_IOLOG,
2520 .name = "read_iolog",
2521 .lname = "Read I/O log",
2522 .type = FIO_OPT_STR_STORE,
2523 .off1 = td_var_offset(read_iolog_file),
2524 .help = "Playback IO pattern from file",
2525 .category = FIO_OPT_C_IO,
2526 .group = FIO_OPT_G_IOLOG,
2529 .name = "replay_no_stall",
2530 .lname = "Don't stall on replay",
2531 .type = FIO_OPT_BOOL,
2532 .off1 = td_var_offset(no_stall),
2534 .parent = "read_iolog",
2536 .help = "Playback IO pattern file as fast as possible without stalls",
2537 .category = FIO_OPT_C_IO,
2538 .group = FIO_OPT_G_IOLOG,
2541 .name = "replay_redirect",
2542 .lname = "Redirect device for replay",
2543 .type = FIO_OPT_STR_STORE,
2544 .off1 = td_var_offset(replay_redirect),
2545 .parent = "read_iolog",
2547 .help = "Replay all I/O onto this device, regardless of trace device",
2548 .category = FIO_OPT_C_IO,
2549 .group = FIO_OPT_G_IOLOG,
2552 .name = "exec_prerun",
2553 .lname = "Pre-execute runnable",
2554 .type = FIO_OPT_STR_STORE,
2555 .off1 = td_var_offset(exec_prerun),
2556 .help = "Execute this file prior to running job",
2557 .category = FIO_OPT_C_GENERAL,
2558 .group = FIO_OPT_G_INVALID,
2561 .name = "exec_postrun",
2562 .lname = "Post-execute runnable",
2563 .type = FIO_OPT_STR_STORE,
2564 .off1 = td_var_offset(exec_postrun),
2565 .help = "Execute this file after running job",
2566 .category = FIO_OPT_C_GENERAL,
2567 .group = FIO_OPT_G_INVALID,
2569 #ifdef FIO_HAVE_IOSCHED_SWITCH
2571 .name = "ioscheduler",
2572 .lname = "I/O scheduler",
2573 .type = FIO_OPT_STR_STORE,
2574 .off1 = td_var_offset(ioscheduler),
2575 .help = "Use this IO scheduler on the backing device",
2576 .category = FIO_OPT_C_FILE,
2577 .group = FIO_OPT_G_INVALID,
2582 .lname = "Zone size",
2583 .type = FIO_OPT_STR_VAL,
2584 .off1 = td_var_offset(zone_size),
2585 .help = "Amount of data to read per zone",
2587 .interval = 1024 * 1024,
2588 .category = FIO_OPT_C_IO,
2589 .group = FIO_OPT_G_ZONE,
2592 .name = "zonerange",
2593 .lname = "Zone range",
2594 .type = FIO_OPT_STR_VAL,
2595 .off1 = td_var_offset(zone_range),
2596 .help = "Give size of an IO zone",
2598 .interval = 1024 * 1024,
2599 .category = FIO_OPT_C_IO,
2600 .group = FIO_OPT_G_ZONE,
2604 .lname = "Zone skip",
2605 .type = FIO_OPT_STR_VAL,
2606 .off1 = td_var_offset(zone_skip),
2607 .help = "Space between IO zones",
2609 .interval = 1024 * 1024,
2610 .category = FIO_OPT_C_IO,
2611 .group = FIO_OPT_G_ZONE,
2615 .lname = "Lock memory",
2616 .type = FIO_OPT_STR_VAL,
2617 .off1 = td_var_offset(lockmem),
2618 .help = "Lock down this amount of memory (per worker)",
2620 .interval = 1024 * 1024,
2621 .category = FIO_OPT_C_GENERAL,
2622 .group = FIO_OPT_G_INVALID,
2625 .name = "rwmixread",
2626 .lname = "Read/write mix read",
2627 .type = FIO_OPT_INT,
2628 .cb = str_rwmix_read_cb,
2630 .help = "Percentage of mixed workload that is reads",
2633 .inverse = "rwmixwrite",
2634 .category = FIO_OPT_C_IO,
2635 .group = FIO_OPT_G_RWMIX,
2638 .name = "rwmixwrite",
2639 .lname = "Read/write mix write",
2640 .type = FIO_OPT_INT,
2641 .cb = str_rwmix_write_cb,
2643 .help = "Percentage of mixed workload that is writes",
2646 .inverse = "rwmixread",
2647 .category = FIO_OPT_C_IO,
2648 .group = FIO_OPT_G_RWMIX,
2651 .name = "rwmixcycle",
2652 .lname = "Read/write mix cycle",
2653 .type = FIO_OPT_DEPRECATED,
2654 .category = FIO_OPT_C_IO,
2655 .group = FIO_OPT_G_RWMIX,
2660 .type = FIO_OPT_INT,
2661 .off1 = td_var_offset(nice),
2662 .help = "Set job CPU nice value",
2667 .category = FIO_OPT_C_GENERAL,
2668 .group = FIO_OPT_G_CRED,
2670 #ifdef FIO_HAVE_IOPRIO
2673 .lname = "I/O nice priority",
2674 .type = FIO_OPT_INT,
2675 .off1 = td_var_offset(ioprio),
2676 .help = "Set job IO priority value",
2680 .category = FIO_OPT_C_GENERAL,
2681 .group = FIO_OPT_G_CRED,
2684 .name = "prioclass",
2685 .lname = "I/O nice priority class",
2686 .type = FIO_OPT_INT,
2687 .off1 = td_var_offset(ioprio_class),
2688 .help = "Set job IO priority class",
2692 .category = FIO_OPT_C_GENERAL,
2693 .group = FIO_OPT_G_CRED,
2697 .name = "thinktime",
2698 .lname = "Thinktime",
2699 .type = FIO_OPT_INT,
2700 .off1 = td_var_offset(thinktime),
2701 .help = "Idle time between IO buffers (usec)",
2703 .category = FIO_OPT_C_IO,
2704 .group = FIO_OPT_G_THINKTIME,
2707 .name = "thinktime_spin",
2708 .lname = "Thinktime spin",
2709 .type = FIO_OPT_INT,
2710 .off1 = td_var_offset(thinktime_spin),
2711 .help = "Start think time by spinning this amount (usec)",
2713 .parent = "thinktime",
2715 .category = FIO_OPT_C_IO,
2716 .group = FIO_OPT_G_THINKTIME,
2719 .name = "thinktime_blocks",
2720 .lname = "Thinktime blocks",
2721 .type = FIO_OPT_INT,
2722 .off1 = td_var_offset(thinktime_blocks),
2723 .help = "IO buffer period between 'thinktime'",
2725 .parent = "thinktime",
2727 .category = FIO_OPT_C_IO,
2728 .group = FIO_OPT_G_THINKTIME,
2732 .lname = "I/O rate",
2733 .type = FIO_OPT_INT,
2734 .off1 = td_var_offset(rate[DDIR_READ]),
2735 .off2 = td_var_offset(rate[DDIR_WRITE]),
2736 .off3 = td_var_offset(rate[DDIR_TRIM]),
2737 .help = "Set bandwidth rate",
2738 .category = FIO_OPT_C_IO,
2739 .group = FIO_OPT_G_RATE,
2743 .lname = "I/O min rate",
2744 .type = FIO_OPT_INT,
2745 .off1 = td_var_offset(ratemin[DDIR_READ]),
2746 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2747 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2748 .help = "Job must meet this rate or it will be shutdown",
2751 .category = FIO_OPT_C_IO,
2752 .group = FIO_OPT_G_RATE,
2755 .name = "rate_iops",
2756 .lname = "I/O rate IOPS",
2757 .type = FIO_OPT_INT,
2758 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2759 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2760 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2761 .help = "Limit IO used to this number of IO operations/sec",
2763 .category = FIO_OPT_C_IO,
2764 .group = FIO_OPT_G_RATE,
2767 .name = "rate_iops_min",
2768 .lname = "I/O min rate IOPS",
2769 .type = FIO_OPT_INT,
2770 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2771 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2772 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2773 .help = "Job must meet this rate or it will be shut down",
2774 .parent = "rate_iops",
2776 .category = FIO_OPT_C_IO,
2777 .group = FIO_OPT_G_RATE,
2780 .name = "ratecycle",
2781 .lname = "I/O rate cycle",
2782 .type = FIO_OPT_INT,
2783 .off1 = td_var_offset(ratecycle),
2784 .help = "Window average for rate limits (msec)",
2788 .category = FIO_OPT_C_IO,
2789 .group = FIO_OPT_G_RATE,
2792 .name = "max_latency",
2793 .type = FIO_OPT_INT,
2794 .off1 = td_var_offset(max_latency),
2795 .help = "Maximum tolerated IO latency (usec)",
2796 .category = FIO_OPT_C_IO,
2797 .group = FIO_OPT_G_LATPROF,
2800 .name = "latency_target",
2801 .lname = "Latency Target (usec)",
2802 .type = FIO_OPT_STR_VAL_TIME,
2803 .off1 = td_var_offset(latency_target),
2804 .help = "Ramp to max queue depth supporting this latency",
2805 .category = FIO_OPT_C_IO,
2806 .group = FIO_OPT_G_LATPROF,
2809 .name = "latency_window",
2810 .lname = "Latency Window (usec)",
2811 .type = FIO_OPT_STR_VAL_TIME,
2812 .off1 = td_var_offset(latency_window),
2813 .help = "Time to sustain latency_target",
2814 .category = FIO_OPT_C_IO,
2815 .group = FIO_OPT_G_LATPROF,
2818 .name = "latency_percentile",
2819 .lname = "Latency Percentile",
2820 .type = FIO_OPT_FLOAT_LIST,
2821 .off1 = td_var_offset(latency_percentile),
2822 .help = "Percentile of IOs must be below latency_target",
2827 .category = FIO_OPT_C_IO,
2828 .group = FIO_OPT_G_LATPROF,
2831 .name = "invalidate",
2832 .lname = "Cache invalidate",
2833 .type = FIO_OPT_BOOL,
2834 .off1 = td_var_offset(invalidate_cache),
2835 .help = "Invalidate buffer/page cache prior to running job",
2837 .category = FIO_OPT_C_IO,
2838 .group = FIO_OPT_G_IO_TYPE,
2842 .lname = "Synchronous I/O",
2843 .type = FIO_OPT_BOOL,
2844 .off1 = td_var_offset(sync_io),
2845 .help = "Use O_SYNC for buffered writes",
2847 .parent = "buffered",
2849 .category = FIO_OPT_C_IO,
2850 .group = FIO_OPT_G_IO_TYPE,
2853 .name = "create_serialize",
2854 .lname = "Create serialize",
2855 .type = FIO_OPT_BOOL,
2856 .off1 = td_var_offset(create_serialize),
2857 .help = "Serialize creating of job files",
2859 .category = FIO_OPT_C_FILE,
2860 .group = FIO_OPT_G_INVALID,
2863 .name = "create_fsync",
2864 .lname = "Create fsync",
2865 .type = FIO_OPT_BOOL,
2866 .off1 = td_var_offset(create_fsync),
2867 .help = "fsync file after creation",
2869 .category = FIO_OPT_C_FILE,
2870 .group = FIO_OPT_G_INVALID,
2873 .name = "create_on_open",
2874 .lname = "Create on open",
2875 .type = FIO_OPT_BOOL,
2876 .off1 = td_var_offset(create_on_open),
2877 .help = "Create files when they are opened for IO",
2879 .category = FIO_OPT_C_FILE,
2880 .group = FIO_OPT_G_INVALID,
2883 .name = "create_only",
2884 .type = FIO_OPT_BOOL,
2885 .off1 = td_var_offset(create_only),
2886 .help = "Only perform file creation phase",
2887 .category = FIO_OPT_C_FILE,
2892 .lname = "Pre-read files",
2893 .type = FIO_OPT_BOOL,
2894 .off1 = td_var_offset(pre_read),
2895 .help = "Pre-read files before starting official testing",
2897 .category = FIO_OPT_C_FILE,
2898 .group = FIO_OPT_G_INVALID,
2900 #ifdef FIO_HAVE_CPU_AFFINITY
2903 .lname = "CPU mask",
2904 .type = FIO_OPT_INT,
2905 .cb = str_cpumask_cb,
2906 .help = "CPU affinity mask",
2907 .category = FIO_OPT_C_GENERAL,
2908 .group = FIO_OPT_G_CRED,
2911 .name = "cpus_allowed",
2912 .lname = "CPUs allowed",
2913 .type = FIO_OPT_STR,
2914 .cb = str_cpus_allowed_cb,
2915 .help = "Set CPUs allowed",
2916 .category = FIO_OPT_C_GENERAL,
2917 .group = FIO_OPT_G_CRED,
2920 .name = "cpus_allowed_policy",
2921 .lname = "CPUs allowed distribution policy",
2922 .type = FIO_OPT_STR,
2923 .off1 = td_var_offset(cpus_allowed_policy),
2924 .help = "Distribution policy for cpus_allowed",
2925 .parent = "cpus_allowed",
2929 .oval = FIO_CPUS_SHARED,
2930 .help = "Mask shared between threads",
2933 .oval = FIO_CPUS_SPLIT,
2934 .help = "Mask split between threads",
2937 .category = FIO_OPT_C_GENERAL,
2938 .group = FIO_OPT_G_CRED,
2941 #ifdef CONFIG_LIBNUMA
2943 .name = "numa_cpu_nodes",
2944 .type = FIO_OPT_STR,
2945 .cb = str_numa_cpunodes_cb,
2946 .help = "NUMA CPU nodes bind",
2947 .category = FIO_OPT_C_GENERAL,
2948 .group = FIO_OPT_G_INVALID,
2951 .name = "numa_mem_policy",
2952 .type = FIO_OPT_STR,
2953 .cb = str_numa_mpol_cb,
2954 .help = "NUMA memory policy setup",
2955 .category = FIO_OPT_C_GENERAL,
2956 .group = FIO_OPT_G_INVALID,
2960 .name = "end_fsync",
2961 .lname = "End fsync",
2962 .type = FIO_OPT_BOOL,
2963 .off1 = td_var_offset(end_fsync),
2964 .help = "Include fsync at the end of job",
2966 .category = FIO_OPT_C_FILE,
2967 .group = FIO_OPT_G_INVALID,
2970 .name = "fsync_on_close",
2971 .lname = "Fsync on close",
2972 .type = FIO_OPT_BOOL,
2973 .off1 = td_var_offset(fsync_on_close),
2974 .help = "fsync files on close",
2976 .category = FIO_OPT_C_FILE,
2977 .group = FIO_OPT_G_INVALID,
2981 .lname = "Unlink file",
2982 .type = FIO_OPT_BOOL,
2983 .off1 = td_var_offset(unlink),
2984 .help = "Unlink created files after job has completed",
2986 .category = FIO_OPT_C_FILE,
2987 .group = FIO_OPT_G_INVALID,
2991 .lname = "Exit-all on terminate",
2992 .type = FIO_OPT_STR_SET,
2993 .cb = str_exitall_cb,
2994 .help = "Terminate all jobs when one exits",
2995 .category = FIO_OPT_C_GENERAL,
2996 .group = FIO_OPT_G_PROCESS,
2999 .name = "stonewall",
3000 .lname = "Wait for previous",
3001 .alias = "wait_for_previous",
3002 .type = FIO_OPT_STR_SET,
3003 .off1 = td_var_offset(stonewall),
3004 .help = "Insert a hard barrier between this job and previous",
3005 .category = FIO_OPT_C_GENERAL,
3006 .group = FIO_OPT_G_PROCESS,
3009 .name = "new_group",
3010 .lname = "New group",
3011 .type = FIO_OPT_STR_SET,
3012 .off1 = td_var_offset(new_group),
3013 .help = "Mark the start of a new group (for reporting)",
3014 .category = FIO_OPT_C_GENERAL,
3015 .group = FIO_OPT_G_PROCESS,
3020 .type = FIO_OPT_STR_SET,
3021 .off1 = td_var_offset(use_thread),
3022 .help = "Use threads instead of processes",
3023 .category = FIO_OPT_C_GENERAL,
3024 .group = FIO_OPT_G_PROCESS,
3027 .name = "write_bw_log",
3028 .lname = "Write bandwidth log",
3029 .type = FIO_OPT_STR_STORE,
3030 .off1 = td_var_offset(bw_log_file),
3031 .help = "Write log of bandwidth during run",
3032 .category = FIO_OPT_C_LOG,
3033 .group = FIO_OPT_G_INVALID,
3036 .name = "write_lat_log",
3037 .lname = "Write latency log",
3038 .type = FIO_OPT_STR_STORE,
3039 .off1 = td_var_offset(lat_log_file),
3040 .help = "Write log of latency during run",
3041 .category = FIO_OPT_C_LOG,
3042 .group = FIO_OPT_G_INVALID,
3045 .name = "write_iops_log",
3046 .lname = "Write IOPS log",
3047 .type = FIO_OPT_STR_STORE,
3048 .off1 = td_var_offset(iops_log_file),
3049 .help = "Write log of IOPS during run",
3050 .category = FIO_OPT_C_LOG,
3051 .group = FIO_OPT_G_INVALID,
3054 .name = "log_avg_msec",
3055 .lname = "Log averaging (msec)",
3056 .type = FIO_OPT_INT,
3057 .off1 = td_var_offset(log_avg_msec),
3058 .help = "Average bw/iops/lat logs over this period of time",
3060 .category = FIO_OPT_C_LOG,
3061 .group = FIO_OPT_G_INVALID,
3064 .name = "bwavgtime",
3065 .lname = "Bandwidth average time",
3066 .type = FIO_OPT_INT,
3067 .off1 = td_var_offset(bw_avg_time),
3068 .help = "Time window over which to calculate bandwidth"
3071 .parent = "write_bw_log",
3074 .category = FIO_OPT_C_LOG,
3075 .group = FIO_OPT_G_INVALID,
3078 .name = "iopsavgtime",
3079 .lname = "IOPS average time",
3080 .type = FIO_OPT_INT,
3081 .off1 = td_var_offset(iops_avg_time),
3082 .help = "Time window over which to calculate IOPS (msec)",
3084 .parent = "write_iops_log",
3087 .category = FIO_OPT_C_LOG,
3088 .group = FIO_OPT_G_INVALID,
3091 .name = "group_reporting",
3092 .lname = "Group reporting",
3093 .type = FIO_OPT_STR_SET,
3094 .off1 = td_var_offset(group_reporting),
3095 .help = "Do reporting on a per-group basis",
3096 .category = FIO_OPT_C_STAT,
3097 .group = FIO_OPT_G_INVALID,
3100 .name = "zero_buffers",
3101 .lname = "Zero I/O buffers",
3102 .type = FIO_OPT_STR_SET,
3103 .off1 = td_var_offset(zero_buffers),
3104 .help = "Init IO buffers to all zeroes",
3105 .category = FIO_OPT_C_IO,
3106 .group = FIO_OPT_G_IO_BUF,
3109 .name = "refill_buffers",
3110 .lname = "Refill I/O buffers",
3111 .type = FIO_OPT_STR_SET,
3112 .off1 = td_var_offset(refill_buffers),
3113 .help = "Refill IO buffers on every IO submit",
3114 .category = FIO_OPT_C_IO,
3115 .group = FIO_OPT_G_IO_BUF,
3118 .name = "scramble_buffers",
3119 .lname = "Scramble I/O buffers",
3120 .type = FIO_OPT_BOOL,
3121 .off1 = td_var_offset(scramble_buffers),
3122 .help = "Slightly scramble buffers on every IO submit",
3124 .category = FIO_OPT_C_IO,
3125 .group = FIO_OPT_G_IO_BUF,
3128 .name = "buffer_pattern",
3129 .lname = "Buffer pattern",
3130 .type = FIO_OPT_STR,
3131 .cb = str_buffer_pattern_cb,
3132 .help = "Fill pattern for IO buffers",
3133 .category = FIO_OPT_C_IO,
3134 .group = FIO_OPT_G_IO_BUF,
3137 .name = "buffer_compress_percentage",
3138 .lname = "Buffer compression percentage",
3139 .type = FIO_OPT_INT,
3140 .cb = str_buffer_compress_cb,
3143 .help = "How compressible the buffer is (approximately)",
3145 .category = FIO_OPT_C_IO,
3146 .group = FIO_OPT_G_IO_BUF,
3149 .name = "buffer_compress_chunk",
3150 .lname = "Buffer compression chunk size",
3151 .type = FIO_OPT_INT,
3152 .off1 = td_var_offset(compress_chunk),
3153 .parent = "buffer_compress_percentage",
3155 .help = "Size of compressible region in buffer",
3157 .category = FIO_OPT_C_IO,
3158 .group = FIO_OPT_G_IO_BUF,
3161 .name = "clat_percentiles",
3162 .lname = "Completion latency percentiles",
3163 .type = FIO_OPT_BOOL,
3164 .off1 = td_var_offset(clat_percentiles),
3165 .help = "Enable the reporting of completion latency percentiles",
3167 .category = FIO_OPT_C_STAT,
3168 .group = FIO_OPT_G_INVALID,
3171 .name = "percentile_list",
3172 .lname = "Completion latency percentile list",
3173 .type = FIO_OPT_FLOAT_LIST,
3174 .off1 = td_var_offset(percentile_list),
3175 .off2 = td_var_offset(percentile_precision),
3176 .help = "Specify a custom list of percentiles to report",
3177 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3178 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3181 .category = FIO_OPT_C_STAT,
3182 .group = FIO_OPT_G_INVALID,
3185 #ifdef FIO_HAVE_DISK_UTIL
3187 .name = "disk_util",
3188 .lname = "Disk utilization",
3189 .type = FIO_OPT_BOOL,
3190 .off1 = td_var_offset(do_disk_util),
3191 .help = "Log disk utilization statistics",
3193 .category = FIO_OPT_C_STAT,
3194 .group = FIO_OPT_G_INVALID,
3198 .name = "gtod_reduce",
3199 .lname = "Reduce gettimeofday() calls",
3200 .type = FIO_OPT_BOOL,
3201 .help = "Greatly reduce number of gettimeofday() calls",
3202 .cb = str_gtod_reduce_cb,
3205 .category = FIO_OPT_C_STAT,
3206 .group = FIO_OPT_G_INVALID,
3209 .name = "disable_lat",
3210 .lname = "Disable all latency stats",
3211 .type = FIO_OPT_BOOL,
3212 .off1 = td_var_offset(disable_lat),
3213 .help = "Disable latency numbers",
3214 .parent = "gtod_reduce",
3217 .category = FIO_OPT_C_STAT,
3218 .group = FIO_OPT_G_INVALID,
3221 .name = "disable_clat",
3222 .lname = "Disable completion latency stats",
3223 .type = FIO_OPT_BOOL,
3224 .off1 = td_var_offset(disable_clat),
3225 .help = "Disable completion latency numbers",
3226 .parent = "gtod_reduce",
3229 .category = FIO_OPT_C_STAT,
3230 .group = FIO_OPT_G_INVALID,
3233 .name = "disable_slat",
3234 .lname = "Disable submission latency stats",
3235 .type = FIO_OPT_BOOL,
3236 .off1 = td_var_offset(disable_slat),
3237 .help = "Disable submission latency numbers",
3238 .parent = "gtod_reduce",
3241 .category = FIO_OPT_C_STAT,
3242 .group = FIO_OPT_G_INVALID,
3245 .name = "disable_bw_measurement",
3246 .lname = "Disable bandwidth stats",
3247 .type = FIO_OPT_BOOL,
3248 .off1 = td_var_offset(disable_bw),
3249 .help = "Disable bandwidth logging",
3250 .parent = "gtod_reduce",
3253 .category = FIO_OPT_C_STAT,
3254 .group = FIO_OPT_G_INVALID,
3258 .lname = "Dedicated gettimeofday() CPU",
3259 .type = FIO_OPT_INT,
3260 .cb = str_gtod_cpu_cb,
3261 .help = "Set up dedicated gettimeofday() thread on this CPU",
3262 .verify = gtod_cpu_verify,
3263 .category = FIO_OPT_C_GENERAL,
3264 .group = FIO_OPT_G_CLOCK,
3267 .name = "unified_rw_reporting",
3268 .type = FIO_OPT_BOOL,
3269 .off1 = td_var_offset(unified_rw_rep),
3270 .help = "Unify reporting across data direction",
3272 .category = FIO_OPT_C_GENERAL,
3273 .group = FIO_OPT_G_INVALID,
3276 .name = "continue_on_error",
3277 .lname = "Continue on error",
3278 .type = FIO_OPT_STR,
3279 .off1 = td_var_offset(continue_on_error),
3280 .help = "Continue on non-fatal errors during IO",
3282 .category = FIO_OPT_C_GENERAL,
3283 .group = FIO_OPT_G_ERR,
3286 .oval = ERROR_TYPE_NONE,
3287 .help = "Exit when an error is encountered",
3290 .oval = ERROR_TYPE_READ,
3291 .help = "Continue on read errors only",
3294 .oval = ERROR_TYPE_WRITE,
3295 .help = "Continue on write errors only",
3298 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3299 .help = "Continue on any IO errors",
3302 .oval = ERROR_TYPE_VERIFY,
3303 .help = "Continue on verify errors only",
3306 .oval = ERROR_TYPE_ANY,
3307 .help = "Continue on all io and verify errors",
3310 .oval = ERROR_TYPE_NONE,
3311 .help = "Alias for 'none'",
3314 .oval = ERROR_TYPE_ANY,
3315 .help = "Alias for 'all'",
3320 .name = "ignore_error",
3321 .type = FIO_OPT_STR,
3322 .cb = str_ignore_error_cb,
3323 .help = "Set a specific list of errors to ignore",
3325 .category = FIO_OPT_C_GENERAL,
3326 .group = FIO_OPT_G_ERR,
3329 .name = "error_dump",
3330 .type = FIO_OPT_BOOL,
3331 .off1 = td_var_offset(error_dump),
3333 .help = "Dump info on each error",
3334 .category = FIO_OPT_C_GENERAL,
3335 .group = FIO_OPT_G_ERR,
3340 .type = FIO_OPT_STR_STORE,
3341 .off1 = td_var_offset(profile),
3342 .help = "Select a specific builtin performance test",
3343 .category = FIO_OPT_C_PROFILE,
3344 .group = FIO_OPT_G_INVALID,
3349 .type = FIO_OPT_STR_STORE,
3350 .off1 = td_var_offset(cgroup),
3351 .help = "Add job to cgroup of this name",
3352 .category = FIO_OPT_C_GENERAL,
3353 .group = FIO_OPT_G_CGROUP,
3356 .name = "cgroup_nodelete",
3357 .lname = "Cgroup no-delete",
3358 .type = FIO_OPT_BOOL,
3359 .off1 = td_var_offset(cgroup_nodelete),
3360 .help = "Do not delete cgroups after job completion",
3363 .category = FIO_OPT_C_GENERAL,
3364 .group = FIO_OPT_G_CGROUP,
3367 .name = "cgroup_weight",
3368 .lname = "Cgroup weight",
3369 .type = FIO_OPT_INT,
3370 .off1 = td_var_offset(cgroup_weight),
3371 .help = "Use given weight for cgroup",
3375 .category = FIO_OPT_C_GENERAL,
3376 .group = FIO_OPT_G_CGROUP,
3381 .type = FIO_OPT_INT,
3382 .off1 = td_var_offset(uid),
3383 .help = "Run job with this user ID",
3384 .category = FIO_OPT_C_GENERAL,
3385 .group = FIO_OPT_G_CRED,
3389 .lname = "Group ID",
3390 .type = FIO_OPT_INT,
3391 .off1 = td_var_offset(gid),
3392 .help = "Run job with this group ID",
3393 .category = FIO_OPT_C_GENERAL,
3394 .group = FIO_OPT_G_CRED,
3399 .type = FIO_OPT_INT,
3400 .off1 = td_var_offset(kb_base),
3406 .help = "Use 1024 as the K base",
3410 .help = "Use 1000 as the K base",
3413 .help = "How many bytes per KB for reporting (1000 or 1024)",
3414 .category = FIO_OPT_C_GENERAL,
3415 .group = FIO_OPT_G_INVALID,
3418 .name = "unit_base",
3419 .lname = "Base unit for reporting (Bits or Bytes)",
3420 .type = FIO_OPT_INT,
3421 .off1 = td_var_offset(unit_base),
3426 .help = "Auto-detect",
3430 .help = "Normal (byte based)",
3434 .help = "Bit based",
3437 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3438 .category = FIO_OPT_C_GENERAL,
3439 .group = FIO_OPT_G_INVALID,
3442 .name = "hugepage-size",
3443 .lname = "Hugepage size",
3444 .type = FIO_OPT_INT,
3445 .off1 = td_var_offset(hugepage_size),
3446 .help = "When using hugepages, specify size of each page",
3447 .def = __fio_stringify(FIO_HUGE_PAGE),
3448 .interval = 1024 * 1024,
3449 .category = FIO_OPT_C_GENERAL,
3450 .group = FIO_OPT_G_INVALID,
3454 .lname = "I/O flow ID",
3455 .type = FIO_OPT_INT,
3456 .off1 = td_var_offset(flow_id),
3457 .help = "The flow index ID to use",
3459 .category = FIO_OPT_C_IO,
3460 .group = FIO_OPT_G_IO_FLOW,
3464 .lname = "I/O flow weight",
3465 .type = FIO_OPT_INT,
3466 .off1 = td_var_offset(flow),
3467 .help = "Weight for flow control of this job",
3468 .parent = "flow_id",
3471 .category = FIO_OPT_C_IO,
3472 .group = FIO_OPT_G_IO_FLOW,
3475 .name = "flow_watermark",
3476 .lname = "I/O flow watermark",
3477 .type = FIO_OPT_INT,
3478 .off1 = td_var_offset(flow_watermark),
3479 .help = "High watermark for flow control. This option"
3480 " should be set to the same value for all threads"
3481 " with non-zero flow.",
3482 .parent = "flow_id",
3485 .category = FIO_OPT_C_IO,
3486 .group = FIO_OPT_G_IO_FLOW,
3489 .name = "flow_sleep",
3490 .lname = "I/O flow sleep",
3491 .type = FIO_OPT_INT,
3492 .off1 = td_var_offset(flow_sleep),
3493 .help = "How many microseconds to sleep after being held"
3494 " back by the flow control mechanism",
3495 .parent = "flow_id",
3498 .category = FIO_OPT_C_IO,
3499 .group = FIO_OPT_G_IO_FLOW,
3506 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3507 const char *name, int val)
3509 lopt->name = (char *) name;
3511 if (o->type == FIO_OPT_STR_SET)
3512 lopt->has_arg = optional_argument;
3514 lopt->has_arg = required_argument;
3517 static void options_to_lopts(struct fio_option *opts,
3518 struct option *long_options,
3519 int i, int option_type)
3521 struct fio_option *o = &opts[0];
3523 add_to_lopt(&long_options[i], o, o->name, option_type);
3526 add_to_lopt(&long_options[i], o, o->alias, option_type);
3531 assert(i < FIO_NR_OPTIONS);
3535 void fio_options_set_ioengine_opts(struct option *long_options,
3536 struct thread_data *td)
3541 while (long_options[i].name) {
3542 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3543 memset(&long_options[i], 0, sizeof(*long_options));
3550 * Just clear out the prior ioengine options.
3555 options_to_lopts(td->io_ops->options, long_options, i,
3556 FIO_GETOPT_IOENGINE);
3559 void fio_options_dup_and_init(struct option *long_options)
3563 options_init(fio_options);
3566 while (long_options[i].name)
3569 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3572 struct fio_keyword {
3578 static struct fio_keyword fio_keywords[] = {
3580 .word = "$pagesize",
3581 .desc = "Page size in the system",
3584 .word = "$mb_memory",
3585 .desc = "Megabytes of memory online",
3589 .desc = "Number of CPUs online in the system",
3596 void fio_keywords_init(void)
3598 unsigned long long mb_memory;
3602 sprintf(buf, "%lu", (unsigned long) page_size);
3603 fio_keywords[0].replace = strdup(buf);
3605 mb_memory = os_phys_mem() / (1024 * 1024);
3606 sprintf(buf, "%llu", mb_memory);
3607 fio_keywords[1].replace = strdup(buf);
3610 sprintf(buf, "%lu", l);
3611 fio_keywords[2].replace = strdup(buf);
3616 static char *bc_calc(char *str)
3618 char buf[128], *tmp;
3623 * No math, just return string
3625 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3626 !strchr(str, '/')) || strchr(str, '\''))
3630 * Split option from value, we only need to calculate the value
3632 tmp = strchr(str, '=');
3639 * Prevent buffer overflows; such a case isn't reasonable anyway
3641 if (strlen(str) >= 128 || strlen(tmp) > 100)
3644 sprintf(buf, "which %s > /dev/null", BC_APP);
3646 log_err("fio: bc is needed for performing math\n");
3650 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3651 f = popen(buf, "r");
3655 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3660 buf[(tmp - str) + ret - 1] = '\0';
3661 memcpy(buf, str, tmp - str);
3667 * Return a copy of the input string with substrings of the form ${VARNAME}
3668 * substituted with the value of the environment variable VARNAME. The
3669 * substitution always occurs, even if VARNAME is empty or the corresponding
3670 * environment variable undefined.
3672 static char *option_dup_subs(const char *opt)
3674 char out[OPT_LEN_MAX+1];
3675 char in[OPT_LEN_MAX+1];
3678 char *ch1, *ch2, *env;
3679 ssize_t nchr = OPT_LEN_MAX;
3682 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3683 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3687 in[OPT_LEN_MAX] = '\0';
3688 strncpy(in, opt, OPT_LEN_MAX);
3690 while (*inptr && nchr > 0) {
3691 if (inptr[0] == '$' && inptr[1] == '{') {
3692 ch2 = strchr(inptr, '}');
3693 if (ch2 && inptr+1 < ch2) {
3700 envlen = strlen(env);
3701 if (envlen <= nchr) {
3702 memcpy(outptr, env, envlen);
3712 *outptr++ = *inptr++;
3721 * Look for reserved variable names and replace them with real values
3723 static char *fio_keyword_replace(char *opt)
3729 for (i = 0; fio_keywords[i].word != NULL; i++) {
3730 struct fio_keyword *kw = &fio_keywords[i];
3732 while ((s = strstr(opt, kw->word)) != NULL) {
3733 char *new = malloc(strlen(opt) + 1);
3739 * Copy part of the string before the keyword and
3740 * sprintf() the replacement after it.
3742 memcpy(new, opt, olen);
3743 len = sprintf(new + olen, "%s", kw->replace);
3746 * If there's more in the original string, copy that
3749 opt += strlen(kw->word) + olen;
3751 memcpy(new + olen + len, opt, opt - o_org - 1);
3754 * replace opt and free the old opt
3764 * Check for potential math and invoke bc, if possible
3772 static char **dup_and_sub_options(char **opts, int num_opts)
3775 char **opts_copy = malloc(num_opts * sizeof(*opts));
3776 for (i = 0; i < num_opts; i++) {
3777 opts_copy[i] = option_dup_subs(opts[i]);
3780 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3785 int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3788 int i, ret, unknown;
3791 sort_options(opts, fio_options, num_opts);
3792 opts_copy = dup_and_sub_options(opts, num_opts);
3794 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3795 struct fio_option *o;
3796 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3797 &o, td, dump_cmdline);
3805 opts_copy[i] = NULL;
3812 ret |= ioengine_load(td);
3814 sort_options(opts_copy, td->io_ops->options, num_opts);
3817 for (i = 0; i < num_opts; i++) {
3818 struct fio_option *o = NULL;
3824 newret = parse_option(opts_copy[i], opts[i],
3825 td->io_ops->options, &o,
3826 td->eo, dump_cmdline);
3830 log_err("Bad option <%s>\n", opts[i]);
3833 opts_copy[i] = NULL;
3841 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3843 return parse_cmd_option(opt, val, fio_options, td);
3846 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3849 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
3852 void fio_fill_default_options(struct thread_data *td)
3854 td->o.magic = OPT_MAGIC;
3855 fill_default_options(td, fio_options);
3858 int fio_show_option_help(const char *opt)
3860 return show_cmd_help(fio_options, opt);
3863 void options_mem_dupe(void *data, struct fio_option *options)
3865 struct fio_option *o;
3868 for (o = &options[0]; o->name; o++) {
3869 if (o->type != FIO_OPT_STR_STORE)
3872 ptr = td_var(data, o, o->off1);
3874 *ptr = strdup(*ptr);
3879 * dupe FIO_OPT_STR_STORE options
3881 void fio_options_mem_dupe(struct thread_data *td)
3883 options_mem_dupe(&td->o, fio_options);
3885 if (td->eo && td->io_ops) {
3886 void *oldeo = td->eo;
3888 td->eo = malloc(td->io_ops->option_struct_size);
3889 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3890 options_mem_dupe(td->eo, td->io_ops->options);
3894 unsigned int fio_get_kb_base(void *data)
3896 struct thread_options *o = data;
3897 unsigned int kb_base = 0;
3900 * This is a hack... For private options, *data is not holding
3901 * a pointer to the thread_options, but to private data. This means
3902 * we can't safely dereference it, but magic is first so mem wise
3903 * it is valid. But this also means that if the job first sets
3904 * kb_base and expects that to be honored by private options,
3905 * it will be disappointed. We will return the global default
3908 if (o && o->magic == OPT_MAGIC)
3909 kb_base = o->kb_base;
3916 int add_option(struct fio_option *o)
3918 struct fio_option *__o;
3927 if (opt_index + 1 == FIO_MAX_OPTS) {
3928 log_err("fio: FIO_MAX_OPTS is too small\n");
3932 memcpy(&fio_options[opt_index], o, sizeof(*o));
3933 fio_options[opt_index + 1].name = NULL;
3937 void invalidate_profile_options(const char *prof_name)
3939 struct fio_option *o;
3943 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3944 o->type = FIO_OPT_INVALID;
3945 o->prof_name = NULL;
3951 void add_opt_posval(const char *optname, const char *ival, const char *help)
3953 struct fio_option *o;
3956 o = find_option(fio_options, optname);
3960 for (i = 0; i < PARSE_MAX_VP; i++) {
3961 if (o->posval[i].ival)
3964 o->posval[i].ival = ival;
3965 o->posval[i].help = help;
3970 void del_opt_posval(const char *optname, const char *ival)
3972 struct fio_option *o;
3975 o = find_option(fio_options, optname);
3979 for (i = 0; i < PARSE_MAX_VP; i++) {
3980 if (!o->posval[i].ival)
3982 if (strcmp(o->posval[i].ival, ival))
3985 o->posval[i].ival = NULL;
3986 o->posval[i].help = NULL;
3990 void fio_options_free(struct thread_data *td)
3992 options_free(fio_options, td);
3993 if (td->eo && td->io_ops && td->io_ops->options) {
3994 options_free(td->io_ops->options, td->eo);
4000 struct fio_option *fio_option_find(const char *name)
4002 return find_option(fio_options, name);