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);
272 error[i] = -error[i];
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;
293 static int str_ignore_error_cb(void *data, const char *input)
295 struct thread_data *td = data;
297 int type = 0, ret = 1;
302 p = str = strdup(input);
304 strip_blank_front(&str);
305 strip_blank_end(str);
311 ret = ignore_error_type(td, type, p);
321 static int str_rw_cb(void *data, const char *str)
323 struct thread_data *td = data;
324 struct thread_options *o = &td->o;
333 nr = get_opt_postfix(str);
338 o->ddir_seq_nr = atoi(nr);
342 if (str_to_decimal(nr, &val, 1, o, 0)) {
343 log_err("fio: rw postfix parsing failed\n");
348 o->ddir_seq_add = val;
355 static int str_mem_cb(void *data, const char *mem)
357 struct thread_data *td = data;
359 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
360 td->o.mmapfile = get_opt_postfix(mem);
365 static int fio_clock_source_cb(void *data, const char *str)
367 struct thread_data *td = data;
369 fio_clock_source = td->o.clocksource;
370 fio_clock_source_set = 1;
375 static int str_rwmix_read_cb(void *data, unsigned long long *val)
377 struct thread_data *td = data;
379 td->o.rwmix[DDIR_READ] = *val;
380 td->o.rwmix[DDIR_WRITE] = 100 - *val;
384 static int str_rwmix_write_cb(void *data, unsigned long long *val)
386 struct thread_data *td = data;
388 td->o.rwmix[DDIR_WRITE] = *val;
389 td->o.rwmix[DDIR_READ] = 100 - *val;
393 static int str_exitall_cb(void)
395 exitall_on_terminate = 1;
399 #ifdef FIO_HAVE_CPU_AFFINITY
400 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
402 unsigned int i, index, cpus_in_mask;
403 const long max_cpu = cpus_online();
405 cpus_in_mask = fio_cpu_count(mask);
406 cpu_index = cpu_index % cpus_in_mask;
409 for (i = 0; i < max_cpu; i++) {
410 if (!fio_cpu_isset(mask, i))
413 if (cpu_index != index)
414 fio_cpu_clear(mask, i);
419 return fio_cpu_count(mask);
422 static int str_cpumask_cb(void *data, unsigned long long *val)
424 struct thread_data *td = data;
432 ret = fio_cpuset_init(&td->o.cpumask);
434 log_err("fio: cpuset_init failed\n");
435 td_verror(td, ret, "fio_cpuset_init");
439 max_cpu = cpus_online();
441 for (i = 0; i < sizeof(int) * 8; i++) {
442 if ((1 << i) & *val) {
444 log_err("fio: CPU %d too large (max=%ld)\n", i,
448 dprint(FD_PARSE, "set cpu allowed %d\n", i);
449 fio_cpu_set(&td->o.cpumask, i);
453 td->o.cpumask_set = 1;
457 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
464 ret = fio_cpuset_init(mask);
466 log_err("fio: cpuset_init failed\n");
467 td_verror(td, ret, "fio_cpuset_init");
471 p = str = strdup(input);
473 strip_blank_front(&str);
474 strip_blank_end(str);
476 max_cpu = cpus_online();
478 while ((cpu = strsep(&str, ",")) != NULL) {
487 while ((cpu2 = strsep(&str2, "-")) != NULL) {
497 while (icpu <= icpu2) {
498 if (icpu >= FIO_MAX_CPUS) {
499 log_err("fio: your OS only supports up to"
500 " %d CPUs\n", (int) FIO_MAX_CPUS);
504 if (icpu > max_cpu) {
505 log_err("fio: CPU %d too large (max=%ld)\n",
511 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
512 fio_cpu_set(mask, icpu);
521 td->o.cpumask_set = 1;
525 static int str_cpus_allowed_cb(void *data, const char *input)
527 struct thread_data *td = data;
533 ret = set_cpus_allowed(td, &td->o.cpumask, input);
535 td->o.cpumask_set = 1;
540 static int str_verify_cpus_allowed_cb(void *data, const char *input)
542 struct thread_data *td = data;
545 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
547 td->o.verify_cpumask_set = 1;
553 #ifdef CONFIG_LIBNUMA
554 static int str_numa_cpunodes_cb(void *data, char *input)
556 struct thread_data *td = data;
557 struct bitmask *verify_bitmask;
562 /* numa_parse_nodestring() parses a character string list
563 * of nodes into a bit mask. The bit mask is allocated by
564 * numa_allocate_nodemask(), so it should be freed by
565 * numa_free_nodemask().
567 verify_bitmask = numa_parse_nodestring(input);
568 if (verify_bitmask == NULL) {
569 log_err("fio: numa_parse_nodestring failed\n");
570 td_verror(td, 1, "str_numa_cpunodes_cb");
573 numa_free_nodemask(verify_bitmask);
575 td->o.numa_cpunodes = strdup(input);
576 td->o.numa_cpumask_set = 1;
580 static int str_numa_mpol_cb(void *data, char *input)
582 struct thread_data *td = data;
583 const char * const policy_types[] =
584 { "default", "prefer", "bind", "interleave", "local", NULL };
587 struct bitmask *verify_bitmask;
592 nodelist = strchr(input, ':');
594 /* NUL-terminate mode */
598 for (i = 0; i <= MPOL_LOCAL; i++) {
599 if (!strcmp(input, policy_types[i])) {
600 td->o.numa_mem_mode = i;
604 if (i > MPOL_LOCAL) {
605 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
609 switch (td->o.numa_mem_mode) {
612 * Insist on a nodelist of one node only
615 char *rest = nodelist;
616 while (isdigit(*rest))
619 log_err("fio: one node only for \'prefer\'\n");
623 log_err("fio: one node is needed for \'prefer\'\n");
627 case MPOL_INTERLEAVE:
629 * Default to online nodes with memory if no nodelist
632 nodelist = strdup("all");
637 * Don't allow a nodelist
640 log_err("fio: NO nodelist for \'local\'\n");
646 * Insist on a nodelist
649 log_err("fio: a nodelist is needed for \'bind\'\n");
656 /* numa_parse_nodestring() parses a character string list
657 * of nodes into a bit mask. The bit mask is allocated by
658 * numa_allocate_nodemask(), so it should be freed by
659 * numa_free_nodemask().
661 switch (td->o.numa_mem_mode) {
663 td->o.numa_mem_prefer_node = atoi(nodelist);
665 case MPOL_INTERLEAVE:
667 verify_bitmask = numa_parse_nodestring(nodelist);
668 if (verify_bitmask == NULL) {
669 log_err("fio: numa_parse_nodestring failed\n");
670 td_verror(td, 1, "str_numa_memnodes_cb");
673 td->o.numa_memnodes = strdup(nodelist);
674 numa_free_nodemask(verify_bitmask);
683 td->o.numa_memmask_set = 1;
691 static int str_fst_cb(void *data, const char *str)
693 struct thread_data *td = data;
694 char *nr = get_opt_postfix(str);
696 td->file_service_nr = 1;
698 td->file_service_nr = atoi(nr);
705 #ifdef CONFIG_SYNC_FILE_RANGE
706 static int str_sfr_cb(void *data, const char *str)
708 struct thread_data *td = data;
709 char *nr = get_opt_postfix(str);
711 td->sync_file_range_nr = 1;
713 td->sync_file_range_nr = atoi(nr);
721 static int str_random_distribution_cb(void *data, const char *str)
723 struct thread_data *td = data;
730 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
732 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
737 nr = get_opt_postfix(str);
738 if (nr && !str_to_float(nr, &val)) {
739 log_err("fio: random postfix parsing failed\n");
746 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
748 log_err("fio: zipf theta must different than 1.0\n");
751 td->o.zipf_theta.u.f = val;
753 if (val <= 0.00 || val >= 1.00) {
754 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
757 td->o.pareto_h.u.f = val;
764 * Return next name in the string. Files are separated with ':'. If the ':'
765 * is escaped with a '\', then that ':' is part of the filename and does not
766 * indicate a new file.
768 static char *get_next_name(char **ptr)
773 if (!str || !strlen(str))
779 * No colon, we are done
781 p = strchr(str, ':');
788 * We got a colon, but it's the first character. Skip and
796 if (*(p - 1) != '\\') {
802 memmove(p - 1, p, strlen(p) + 1);
810 static int get_max_name_idx(char *input)
812 unsigned int cur_idx;
815 p = str = strdup(input);
816 for (cur_idx = 0; ; cur_idx++)
817 if (get_next_name(&str) == NULL)
825 * Returns the directory at the index, indexes > entires will be
826 * assigned via modulo division of the index
828 int set_name_idx(char *target, char *input, int index)
830 unsigned int cur_idx;
832 char *fname, *str, *p;
834 p = str = strdup(input);
836 index %= get_max_name_idx(input);
837 for (cur_idx = 0; cur_idx <= index; cur_idx++)
838 fname = get_next_name(&str);
840 len = sprintf(target, "%s/", fname);
846 static int str_filename_cb(void *data, const char *input)
848 struct thread_data *td = data;
849 char *fname, *str, *p;
851 p = str = strdup(input);
853 strip_blank_front(&str);
854 strip_blank_end(str);
856 if (!td->files_index)
859 while ((fname = get_next_name(&str)) != NULL) {
862 add_file(td, fname, 0, 1);
869 static int str_directory_cb(void *data, const char fio_unused *unused)
871 struct thread_data *td = data;
873 char *dirname, *str, *p;
879 p = str = strdup(td->o.directory);
880 while ((dirname = get_next_name(&str)) != NULL) {
881 if (lstat(dirname, &sb) < 0) {
884 log_err("fio: %s is not a directory\n", dirname);
885 td_verror(td, ret, "lstat");
888 if (!S_ISDIR(sb.st_mode)) {
889 log_err("fio: %s is not a directory\n", dirname);
900 static int str_lockfile_cb(void *data, const char fio_unused *str)
902 struct thread_data *td = data;
904 if (td->files_index) {
905 log_err("fio: lockfile= option must precede filename=\n");
912 static int str_opendir_cb(void *data, const char fio_unused *str)
914 struct thread_data *td = data;
919 if (!td->files_index)
922 return add_dir_files(td, td->o.opendir);
925 static int pattern_cb(char *pattern, unsigned int max_size,
926 const char *input, unsigned int *pattern_bytes)
929 int i = 0, j = 0, len, k, base = 10;
930 uint32_t pattern_length;
933 loc1 = strstr(input, "0x");
934 loc2 = strstr(input, "0X");
937 off = strtol(input, NULL, base);
938 if (off != LONG_MAX || errno != ERANGE) {
940 pattern[i] = off & 0xff;
949 j = loc1 - input + 2;
951 j = loc2 - input + 2;
954 if (len - j < max_size * 2) {
956 off = converthexchartoint(input[k--]);
958 off += (converthexchartoint(input[k--])
960 pattern[i++] = (char) off;
966 * Fill the pattern all the way to the end. This greatly reduces
967 * the number of memcpy's we have to do when verifying the IO.
970 while (i > 1 && i * 2 <= max_size) {
971 memcpy(&pattern[i], &pattern[0], i);
976 * Fill remainder, if the pattern multiple ends up not being
979 while (i > 1 && i < max_size) {
980 unsigned int b = min(pattern_length, max_size - i);
982 memcpy(&pattern[i], &pattern[0], b);
988 * The code in verify_io_u_pattern assumes a single byte
989 * pattern fills the whole verify pattern buffer.
991 memset(pattern, pattern[0], max_size);
998 static int str_buffer_pattern_cb(void *data, const char *input)
1000 struct thread_data *td = data;
1003 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
1004 &td->o.buffer_pattern_bytes);
1006 if (!ret && td->o.buffer_pattern_bytes) {
1007 td->o.refill_buffers = 0;
1008 td->o.scramble_buffers = 0;
1009 td->o.zero_buffers = 0;
1011 log_err("fio: failed parsing pattern `%s`\n", input);
1018 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1020 struct thread_data *td = data;
1022 td->flags |= TD_F_COMPRESS;
1023 td->o.compress_percentage = *il;
1027 static int str_verify_pattern_cb(void *data, const char *input)
1029 struct thread_data *td = data;
1032 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1033 &td->o.verify_pattern_bytes);
1036 * VERIFY_META could already be set
1038 if (!ret && td->o.verify == VERIFY_NONE)
1039 td->o.verify = VERIFY_PATTERN;
1044 static int str_gtod_reduce_cb(void *data, int *il)
1046 struct thread_data *td = data;
1049 td->o.disable_lat = !!val;
1050 td->o.disable_clat = !!val;
1051 td->o.disable_slat = !!val;
1052 td->o.disable_bw = !!val;
1053 td->o.clat_percentiles = !val;
1055 td->tv_cache_mask = 63;
1060 static int str_gtod_cpu_cb(void *data, long long *il)
1062 struct thread_data *td = data;
1065 td->o.gtod_cpu = val;
1066 td->o.gtod_offload = 1;
1070 static int str_size_cb(void *data, unsigned long long *__val)
1072 struct thread_data *td = data;
1073 unsigned long long v = *__val;
1075 if (parse_is_percent(v)) {
1077 td->o.size_percent = -1ULL - v;
1084 static int rw_verify(struct fio_option *o, void *data)
1086 struct thread_data *td = data;
1088 if (read_only && td_write(td)) {
1089 log_err("fio: job <%s> has write bit set, but fio is in"
1090 " read-only mode\n", td->o.name);
1097 static int gtod_cpu_verify(struct fio_option *o, void *data)
1099 #ifndef FIO_HAVE_CPU_AFFINITY
1100 struct thread_data *td = data;
1102 if (td->o.gtod_cpu) {
1103 log_err("fio: platform must support CPU affinity for"
1104 "gettimeofday() offloading\n");
1115 static struct opt_group fio_opt_groups[] = {
1118 .mask = FIO_OPT_C_GENERAL,
1122 .mask = FIO_OPT_C_IO,
1126 .mask = FIO_OPT_C_FILE,
1129 .name = "Statistics",
1130 .mask = FIO_OPT_C_STAT,
1134 .mask = FIO_OPT_C_LOG,
1138 .mask = FIO_OPT_C_PROFILE,
1145 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1146 unsigned int inv_mask)
1148 struct opt_group *og;
1151 if (*mask == inv_mask || !*mask)
1154 for (i = 0; ogs[i].name; i++) {
1157 if (*mask & og->mask) {
1158 *mask &= ~(og->mask);
1166 struct opt_group *opt_group_from_mask(unsigned int *mask)
1168 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1171 static struct opt_group fio_opt_cat_groups[] = {
1173 .name = "Latency profiling",
1174 .mask = FIO_OPT_G_LATPROF,
1178 .mask = FIO_OPT_G_RATE,
1182 .mask = FIO_OPT_G_ZONE,
1185 .name = "Read/write mix",
1186 .mask = FIO_OPT_G_RWMIX,
1190 .mask = FIO_OPT_G_VERIFY,
1194 .mask = FIO_OPT_G_TRIM,
1197 .name = "I/O Logging",
1198 .mask = FIO_OPT_G_IOLOG,
1201 .name = "I/O Depth",
1202 .mask = FIO_OPT_G_IO_DEPTH,
1206 .mask = FIO_OPT_G_IO_FLOW,
1209 .name = "Description",
1210 .mask = FIO_OPT_G_DESC,
1214 .mask = FIO_OPT_G_FILENAME,
1217 .name = "General I/O",
1218 .mask = FIO_OPT_G_IO_BASIC,
1222 .mask = FIO_OPT_G_CGROUP,
1226 .mask = FIO_OPT_G_RUNTIME,
1230 .mask = FIO_OPT_G_PROCESS,
1233 .name = "Job credentials / priority",
1234 .mask = FIO_OPT_G_CRED,
1237 .name = "Clock settings",
1238 .mask = FIO_OPT_G_CLOCK,
1242 .mask = FIO_OPT_G_IO_TYPE,
1245 .name = "I/O Thinktime",
1246 .mask = FIO_OPT_G_THINKTIME,
1249 .name = "Randomizations",
1250 .mask = FIO_OPT_G_RANDOM,
1253 .name = "I/O buffers",
1254 .mask = FIO_OPT_G_IO_BUF,
1257 .name = "Tiobench profile",
1258 .mask = FIO_OPT_G_TIOBENCH,
1266 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1268 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1272 * Map of job/command line options
1274 struct fio_option fio_options[FIO_MAX_OPTS] = {
1276 .name = "description",
1277 .lname = "Description of job",
1278 .type = FIO_OPT_STR_STORE,
1279 .off1 = td_var_offset(description),
1280 .help = "Text job description",
1281 .category = FIO_OPT_C_GENERAL,
1282 .group = FIO_OPT_G_DESC,
1286 .lname = "Job name",
1287 .type = FIO_OPT_STR_STORE,
1288 .off1 = td_var_offset(name),
1289 .help = "Name of this job",
1290 .category = FIO_OPT_C_GENERAL,
1291 .group = FIO_OPT_G_DESC,
1295 .lname = "Filename(s)",
1296 .type = FIO_OPT_STR_STORE,
1297 .off1 = td_var_offset(filename),
1298 .cb = str_filename_cb,
1299 .prio = -1, /* must come after "directory" */
1300 .help = "File(s) to use for the workload",
1301 .category = FIO_OPT_C_FILE,
1302 .group = FIO_OPT_G_FILENAME,
1305 .name = "directory",
1306 .lname = "Directory",
1307 .type = FIO_OPT_STR_STORE,
1308 .off1 = td_var_offset(directory),
1309 .cb = str_directory_cb,
1310 .help = "Directory to store files in",
1311 .category = FIO_OPT_C_FILE,
1312 .group = FIO_OPT_G_FILENAME,
1315 .name = "filename_format",
1316 .type = FIO_OPT_STR_STORE,
1317 .off1 = td_var_offset(filename_format),
1318 .prio = -1, /* must come after "directory" */
1319 .help = "Override default $jobname.$jobnum.$filenum naming",
1320 .def = "$jobname.$jobnum.$filenum",
1321 .category = FIO_OPT_C_FILE,
1322 .group = FIO_OPT_G_FILENAME,
1326 .lname = "Lockfile",
1327 .type = FIO_OPT_STR,
1328 .off1 = td_var_offset(file_lock_mode),
1329 .help = "Lock file when doing IO to it",
1331 .parent = "filename",
1334 .cb = str_lockfile_cb,
1335 .category = FIO_OPT_C_FILE,
1336 .group = FIO_OPT_G_FILENAME,
1339 .oval = FILE_LOCK_NONE,
1340 .help = "No file locking",
1342 { .ival = "exclusive",
1343 .oval = FILE_LOCK_EXCLUSIVE,
1344 .help = "Exclusive file lock",
1347 .ival = "readwrite",
1348 .oval = FILE_LOCK_READWRITE,
1349 .help = "Read vs write lock",
1355 .lname = "Open directory",
1356 .type = FIO_OPT_STR_STORE,
1357 .off1 = td_var_offset(opendir),
1358 .cb = str_opendir_cb,
1359 .help = "Recursively add files from this directory and down",
1360 .category = FIO_OPT_C_FILE,
1361 .group = FIO_OPT_G_FILENAME,
1365 .lname = "Read/write",
1366 .alias = "readwrite",
1367 .type = FIO_OPT_STR,
1369 .off1 = td_var_offset(td_ddir),
1370 .help = "IO direction",
1372 .verify = rw_verify,
1373 .category = FIO_OPT_C_IO,
1374 .group = FIO_OPT_G_IO_BASIC,
1377 .oval = TD_DDIR_READ,
1378 .help = "Sequential read",
1381 .oval = TD_DDIR_WRITE,
1382 .help = "Sequential write",
1385 .oval = TD_DDIR_TRIM,
1386 .help = "Sequential trim",
1388 { .ival = "randread",
1389 .oval = TD_DDIR_RANDREAD,
1390 .help = "Random read",
1392 { .ival = "randwrite",
1393 .oval = TD_DDIR_RANDWRITE,
1394 .help = "Random write",
1396 { .ival = "randtrim",
1397 .oval = TD_DDIR_RANDTRIM,
1398 .help = "Random trim",
1402 .help = "Sequential read and write mix",
1404 { .ival = "readwrite",
1406 .help = "Sequential read and write mix",
1409 .oval = TD_DDIR_RANDRW,
1410 .help = "Random read and write mix"
1415 .name = "rw_sequencer",
1416 .lname = "RW Sequencer",
1417 .type = FIO_OPT_STR,
1418 .off1 = td_var_offset(rw_seq),
1419 .help = "IO offset generator modifier",
1420 .def = "sequential",
1421 .category = FIO_OPT_C_IO,
1422 .group = FIO_OPT_G_IO_BASIC,
1424 { .ival = "sequential",
1426 .help = "Generate sequential offsets",
1428 { .ival = "identical",
1429 .oval = RW_SEQ_IDENT,
1430 .help = "Generate identical offsets",
1437 .lname = "IO Engine",
1438 .type = FIO_OPT_STR_STORE,
1439 .off1 = td_var_offset(ioengine),
1440 .help = "IO engine to use",
1441 .def = FIO_PREFERRED_ENGINE,
1442 .category = FIO_OPT_C_IO,
1443 .group = FIO_OPT_G_IO_BASIC,
1446 .help = "Use read/write",
1449 .help = "Use pread/pwrite",
1452 .help = "Use readv/writev",
1454 #ifdef CONFIG_PWRITEV
1456 .help = "Use preadv/pwritev",
1459 #ifdef CONFIG_LIBAIO
1461 .help = "Linux native asynchronous IO",
1464 #ifdef CONFIG_POSIXAIO
1465 { .ival = "posixaio",
1466 .help = "POSIX asynchronous IO",
1469 #ifdef CONFIG_SOLARISAIO
1470 { .ival = "solarisaio",
1471 .help = "Solaris native asynchronous IO",
1474 #ifdef CONFIG_WINDOWSAIO
1475 { .ival = "windowsaio",
1476 .help = "Windows native asynchronous IO"
1481 .help = "Rados Block Device asynchronous IO"
1485 .help = "Memory mapped IO"
1487 #ifdef CONFIG_LINUX_SPLICE
1489 .help = "splice/vmsplice based IO",
1491 { .ival = "netsplice",
1492 .help = "splice/vmsplice to/from the network",
1495 #ifdef FIO_HAVE_SGIO
1497 .help = "SCSI generic v3 IO",
1501 .help = "Testing engine (no data transfer)",
1504 .help = "Network IO",
1507 .help = "CPU cycle burner engine",
1511 .help = "GUASI IO engine",
1514 #ifdef FIO_HAVE_BINJECT
1515 { .ival = "binject",
1516 .help = "binject direct inject block engine",
1521 .help = "RDMA IO engine",
1524 #ifdef CONFIG_FUSION_AW
1525 { .ival = "fusion-aw-sync",
1526 .help = "Fusion-io atomic write engine",
1529 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1530 { .ival = "e4defrag",
1531 .help = "ext4 defrag engine",
1534 #ifdef CONFIG_LINUX_FALLOCATE
1536 .help = "fallocate() file based engine",
1541 .help = "Glusterfs libgfapi(sync) based engine"
1543 { .ival = "gfapi_async",
1544 .help = "Glusterfs libgfapi(async) based engine"
1547 #ifdef CONFIG_LIBHDFS
1548 { .ival = "libhdfs",
1549 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1552 { .ival = "external",
1553 .help = "Load external engine (append name)",
1559 .lname = "IO Depth",
1560 .type = FIO_OPT_INT,
1561 .off1 = td_var_offset(iodepth),
1562 .help = "Number of IO buffers to keep in flight",
1566 .category = FIO_OPT_C_IO,
1567 .group = FIO_OPT_G_IO_BASIC,
1570 .name = "iodepth_batch",
1571 .lname = "IO Depth batch",
1572 .alias = "iodepth_batch_submit",
1573 .type = FIO_OPT_INT,
1574 .off1 = td_var_offset(iodepth_batch),
1575 .help = "Number of IO buffers to submit in one go",
1576 .parent = "iodepth",
1581 .category = FIO_OPT_C_IO,
1582 .group = FIO_OPT_G_IO_BASIC,
1585 .name = "iodepth_batch_complete",
1586 .lname = "IO Depth batch complete",
1587 .type = FIO_OPT_INT,
1588 .off1 = td_var_offset(iodepth_batch_complete),
1589 .help = "Number of IO buffers to retrieve in one go",
1590 .parent = "iodepth",
1595 .category = FIO_OPT_C_IO,
1596 .group = FIO_OPT_G_IO_BASIC,
1599 .name = "iodepth_low",
1600 .lname = "IO Depth batch low",
1601 .type = FIO_OPT_INT,
1602 .off1 = td_var_offset(iodepth_low),
1603 .help = "Low water mark for queuing depth",
1604 .parent = "iodepth",
1607 .category = FIO_OPT_C_IO,
1608 .group = FIO_OPT_G_IO_BASIC,
1613 .type = FIO_OPT_STR_VAL,
1615 .help = "Total size of device or files",
1616 .interval = 1024 * 1024,
1617 .category = FIO_OPT_C_IO,
1618 .group = FIO_OPT_G_INVALID,
1622 .lname = "IO Limit",
1623 .type = FIO_OPT_STR_VAL,
1624 .off1 = td_var_offset(io_limit),
1625 .interval = 1024 * 1024,
1626 .category = FIO_OPT_C_IO,
1627 .group = FIO_OPT_G_INVALID,
1630 .name = "fill_device",
1631 .lname = "Fill device",
1633 .type = FIO_OPT_BOOL,
1634 .off1 = td_var_offset(fill_device),
1635 .help = "Write until an ENOSPC error occurs",
1637 .category = FIO_OPT_C_FILE,
1638 .group = FIO_OPT_G_INVALID,
1642 .lname = "File size",
1643 .type = FIO_OPT_STR_VAL,
1644 .off1 = td_var_offset(file_size_low),
1645 .off2 = td_var_offset(file_size_high),
1647 .help = "Size of individual files",
1648 .interval = 1024 * 1024,
1649 .category = FIO_OPT_C_FILE,
1650 .group = FIO_OPT_G_INVALID,
1653 .name = "file_append",
1654 .lname = "File append",
1655 .type = FIO_OPT_BOOL,
1656 .off1 = td_var_offset(file_append),
1657 .help = "IO will start at the end of the file(s)",
1659 .category = FIO_OPT_C_FILE,
1660 .group = FIO_OPT_G_INVALID,
1664 .lname = "IO offset",
1665 .alias = "fileoffset",
1666 .type = FIO_OPT_STR_VAL,
1667 .off1 = td_var_offset(start_offset),
1668 .help = "Start IO from this offset",
1670 .interval = 1024 * 1024,
1671 .category = FIO_OPT_C_IO,
1672 .group = FIO_OPT_G_INVALID,
1675 .name = "offset_increment",
1676 .lname = "IO offset increment",
1677 .type = FIO_OPT_STR_VAL,
1678 .off1 = td_var_offset(offset_increment),
1679 .help = "What is the increment from one offset to the next",
1683 .interval = 1024 * 1024,
1684 .category = FIO_OPT_C_IO,
1685 .group = FIO_OPT_G_INVALID,
1688 .name = "number_ios",
1689 .lname = "Number of IOs to perform",
1690 .type = FIO_OPT_STR_VAL,
1691 .off1 = td_var_offset(number_ios),
1692 .help = "Force job completion of this number of IOs",
1694 .category = FIO_OPT_C_IO,
1695 .group = FIO_OPT_G_INVALID,
1699 .lname = "Block size",
1700 .alias = "blocksize",
1701 .type = FIO_OPT_INT,
1702 .off1 = td_var_offset(bs[DDIR_READ]),
1703 .off2 = td_var_offset(bs[DDIR_WRITE]),
1704 .off3 = td_var_offset(bs[DDIR_TRIM]),
1706 .help = "Block size unit",
1711 .category = FIO_OPT_C_IO,
1712 .group = FIO_OPT_G_INVALID,
1716 .lname = "Block size align",
1717 .alias = "blockalign",
1718 .type = FIO_OPT_INT,
1719 .off1 = td_var_offset(ba[DDIR_READ]),
1720 .off2 = td_var_offset(ba[DDIR_WRITE]),
1721 .off3 = td_var_offset(ba[DDIR_TRIM]),
1723 .help = "IO block offset alignment",
1727 .category = FIO_OPT_C_IO,
1728 .group = FIO_OPT_G_INVALID,
1732 .lname = "Block size range",
1733 .alias = "blocksize_range",
1734 .type = FIO_OPT_RANGE,
1735 .off1 = td_var_offset(min_bs[DDIR_READ]),
1736 .off2 = td_var_offset(max_bs[DDIR_READ]),
1737 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1738 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1739 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1740 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1742 .help = "Set block size range (in more detail than bs)",
1746 .category = FIO_OPT_C_IO,
1747 .group = FIO_OPT_G_INVALID,
1751 .lname = "Block size split",
1752 .type = FIO_OPT_STR,
1753 .cb = str_bssplit_cb,
1754 .help = "Set a specific mix of block sizes",
1757 .category = FIO_OPT_C_IO,
1758 .group = FIO_OPT_G_INVALID,
1761 .name = "bs_unaligned",
1762 .lname = "Block size unaligned",
1763 .alias = "blocksize_unaligned",
1764 .type = FIO_OPT_STR_SET,
1765 .off1 = td_var_offset(bs_unaligned),
1766 .help = "Don't sector align IO buffer sizes",
1769 .category = FIO_OPT_C_IO,
1770 .group = FIO_OPT_G_INVALID,
1773 .name = "bs_is_seq_rand",
1774 .lname = "Block size division is seq/random (not read/write)",
1775 .type = FIO_OPT_BOOL,
1776 .off1 = td_var_offset(bs_is_seq_rand),
1777 .help = "Consider any blocksize setting to be sequential,ramdom",
1779 .parent = "blocksize",
1780 .category = FIO_OPT_C_IO,
1781 .group = FIO_OPT_G_INVALID,
1784 .name = "randrepeat",
1785 .lname = "Random repeatable",
1786 .type = FIO_OPT_BOOL,
1787 .off1 = td_var_offset(rand_repeatable),
1788 .help = "Use repeatable random IO pattern",
1792 .category = FIO_OPT_C_IO,
1793 .group = FIO_OPT_G_RANDOM,
1797 .lname = "The random generator seed",
1798 .type = FIO_OPT_STR_VAL,
1799 .off1 = td_var_offset(rand_seed),
1800 .help = "Set the random generator seed value",
1802 .category = FIO_OPT_C_IO,
1803 .group = FIO_OPT_G_RANDOM,
1806 .name = "use_os_rand",
1807 .lname = "Use OS random",
1808 .type = FIO_OPT_BOOL,
1809 .off1 = td_var_offset(use_os_rand),
1810 .help = "Set to use OS random generator",
1814 .category = FIO_OPT_C_IO,
1815 .group = FIO_OPT_G_RANDOM,
1818 .name = "norandommap",
1819 .lname = "No randommap",
1820 .type = FIO_OPT_STR_SET,
1821 .off1 = td_var_offset(norandommap),
1822 .help = "Accept potential duplicate random blocks",
1826 .category = FIO_OPT_C_IO,
1827 .group = FIO_OPT_G_RANDOM,
1830 .name = "softrandommap",
1831 .lname = "Soft randommap",
1832 .type = FIO_OPT_BOOL,
1833 .off1 = td_var_offset(softrandommap),
1834 .help = "Set norandommap if randommap allocation fails",
1835 .parent = "norandommap",
1838 .category = FIO_OPT_C_IO,
1839 .group = FIO_OPT_G_RANDOM,
1842 .name = "random_generator",
1843 .type = FIO_OPT_STR,
1844 .off1 = td_var_offset(random_generator),
1845 .help = "Type of random number generator to use",
1846 .def = "tausworthe",
1848 { .ival = "tausworthe",
1849 .oval = FIO_RAND_GEN_TAUSWORTHE,
1850 .help = "Strong Tausworthe generator",
1853 .oval = FIO_RAND_GEN_LFSR,
1854 .help = "Variable length LFSR",
1857 .category = FIO_OPT_C_IO,
1858 .group = FIO_OPT_G_RANDOM,
1861 .name = "random_distribution",
1862 .type = FIO_OPT_STR,
1863 .off1 = td_var_offset(random_distribution),
1864 .cb = str_random_distribution_cb,
1865 .help = "Random offset distribution generator",
1869 .oval = FIO_RAND_DIST_RANDOM,
1870 .help = "Completely random",
1873 .oval = FIO_RAND_DIST_ZIPF,
1874 .help = "Zipf distribution",
1877 .oval = FIO_RAND_DIST_PARETO,
1878 .help = "Pareto distribution",
1881 .category = FIO_OPT_C_IO,
1882 .group = FIO_OPT_G_RANDOM,
1885 .name = "percentage_random",
1886 .lname = "Percentage Random",
1887 .type = FIO_OPT_INT,
1888 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1889 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1890 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1892 .help = "Percentage of seq/random mix that should be random",
1893 .def = "100,100,100",
1895 .inverse = "percentage_sequential",
1896 .category = FIO_OPT_C_IO,
1897 .group = FIO_OPT_G_RANDOM,
1900 .name = "percentage_sequential",
1901 .lname = "Percentage Sequential",
1902 .type = FIO_OPT_DEPRECATED,
1903 .category = FIO_OPT_C_IO,
1904 .group = FIO_OPT_G_RANDOM,
1907 .name = "allrandrepeat",
1908 .type = FIO_OPT_BOOL,
1909 .off1 = td_var_offset(allrand_repeatable),
1910 .help = "Use repeatable random numbers for everything",
1912 .category = FIO_OPT_C_IO,
1913 .group = FIO_OPT_G_RANDOM,
1917 .lname = "Number of files",
1918 .alias = "nr_files",
1919 .type = FIO_OPT_INT,
1920 .off1 = td_var_offset(nr_files),
1921 .help = "Split job workload between this number of files",
1924 .category = FIO_OPT_C_FILE,
1925 .group = FIO_OPT_G_INVALID,
1928 .name = "openfiles",
1929 .lname = "Number of open files",
1930 .type = FIO_OPT_INT,
1931 .off1 = td_var_offset(open_files),
1932 .help = "Number of files to keep open at the same time",
1933 .category = FIO_OPT_C_FILE,
1934 .group = FIO_OPT_G_INVALID,
1937 .name = "file_service_type",
1938 .lname = "File service type",
1939 .type = FIO_OPT_STR,
1941 .off1 = td_var_offset(file_service_type),
1942 .help = "How to select which file to service next",
1943 .def = "roundrobin",
1944 .category = FIO_OPT_C_FILE,
1945 .group = FIO_OPT_G_INVALID,
1948 .oval = FIO_FSERVICE_RANDOM,
1949 .help = "Choose a file at random",
1951 { .ival = "roundrobin",
1952 .oval = FIO_FSERVICE_RR,
1953 .help = "Round robin select files",
1955 { .ival = "sequential",
1956 .oval = FIO_FSERVICE_SEQ,
1957 .help = "Finish one file before moving to the next",
1960 .parent = "nrfiles",
1963 #ifdef CONFIG_POSIX_FALLOCATE
1965 .name = "fallocate",
1966 .lname = "Fallocate",
1967 .type = FIO_OPT_STR,
1968 .off1 = td_var_offset(fallocate_mode),
1969 .help = "Whether pre-allocation is performed when laying out files",
1971 .category = FIO_OPT_C_FILE,
1972 .group = FIO_OPT_G_INVALID,
1975 .oval = FIO_FALLOCATE_NONE,
1976 .help = "Do not pre-allocate space",
1979 .oval = FIO_FALLOCATE_POSIX,
1980 .help = "Use posix_fallocate()",
1982 #ifdef CONFIG_LINUX_FALLOCATE
1984 .oval = FIO_FALLOCATE_KEEP_SIZE,
1985 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1988 /* Compatibility with former boolean values */
1990 .oval = FIO_FALLOCATE_NONE,
1991 .help = "Alias for 'none'",
1994 .oval = FIO_FALLOCATE_POSIX,
1995 .help = "Alias for 'posix'",
1999 #endif /* CONFIG_POSIX_FALLOCATE */
2001 .name = "fadvise_hint",
2002 .lname = "Fadvise hint",
2003 .type = FIO_OPT_BOOL,
2004 .off1 = td_var_offset(fadvise_hint),
2005 .help = "Use fadvise() to advise the kernel on IO pattern",
2007 .category = FIO_OPT_C_FILE,
2008 .group = FIO_OPT_G_INVALID,
2013 .type = FIO_OPT_INT,
2014 .off1 = td_var_offset(fsync_blocks),
2015 .help = "Issue fsync for writes every given number of blocks",
2018 .category = FIO_OPT_C_FILE,
2019 .group = FIO_OPT_G_INVALID,
2022 .name = "fdatasync",
2023 .lname = "Fdatasync",
2024 .type = FIO_OPT_INT,
2025 .off1 = td_var_offset(fdatasync_blocks),
2026 .help = "Issue fdatasync for writes every given number of blocks",
2029 .category = FIO_OPT_C_FILE,
2030 .group = FIO_OPT_G_INVALID,
2033 .name = "write_barrier",
2034 .lname = "Write barrier",
2035 .type = FIO_OPT_INT,
2036 .off1 = td_var_offset(barrier_blocks),
2037 .help = "Make every Nth write a barrier write",
2040 .category = FIO_OPT_C_IO,
2041 .group = FIO_OPT_G_INVALID,
2043 #ifdef CONFIG_SYNC_FILE_RANGE
2045 .name = "sync_file_range",
2046 .lname = "Sync file range",
2048 { .ival = "wait_before",
2049 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2050 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2054 .oval = SYNC_FILE_RANGE_WRITE,
2055 .help = "SYNC_FILE_RANGE_WRITE",
2059 .ival = "wait_after",
2060 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2061 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2065 .type = FIO_OPT_STR_MULTI,
2067 .off1 = td_var_offset(sync_file_range),
2068 .help = "Use sync_file_range()",
2069 .category = FIO_OPT_C_FILE,
2070 .group = FIO_OPT_G_INVALID,
2075 .lname = "Direct I/O",
2076 .type = FIO_OPT_BOOL,
2077 .off1 = td_var_offset(odirect),
2078 .help = "Use O_DIRECT IO (negates buffered)",
2080 .inverse = "buffered",
2081 .category = FIO_OPT_C_IO,
2082 .group = FIO_OPT_G_IO_TYPE,
2086 .lname = "Atomic I/O",
2087 .type = FIO_OPT_BOOL,
2088 .off1 = td_var_offset(oatomic),
2089 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2091 .category = FIO_OPT_C_IO,
2092 .group = FIO_OPT_G_IO_TYPE,
2096 .lname = "Buffered I/O",
2097 .type = FIO_OPT_BOOL,
2098 .off1 = td_var_offset(odirect),
2100 .help = "Use buffered IO (negates direct)",
2102 .inverse = "direct",
2103 .category = FIO_OPT_C_IO,
2104 .group = FIO_OPT_G_IO_TYPE,
2107 .name = "overwrite",
2108 .lname = "Overwrite",
2109 .type = FIO_OPT_BOOL,
2110 .off1 = td_var_offset(overwrite),
2111 .help = "When writing, set whether to overwrite current data",
2113 .category = FIO_OPT_C_FILE,
2114 .group = FIO_OPT_G_INVALID,
2119 .type = FIO_OPT_INT,
2120 .off1 = td_var_offset(loops),
2121 .help = "Number of times to run the job",
2124 .category = FIO_OPT_C_GENERAL,
2125 .group = FIO_OPT_G_RUNTIME,
2129 .lname = "Number of jobs",
2130 .type = FIO_OPT_INT,
2131 .off1 = td_var_offset(numjobs),
2132 .help = "Duplicate this job this many times",
2135 .category = FIO_OPT_C_GENERAL,
2136 .group = FIO_OPT_G_RUNTIME,
2139 .name = "startdelay",
2140 .lname = "Start delay",
2141 .type = FIO_OPT_STR_VAL_TIME,
2142 .off1 = td_var_offset(start_delay),
2143 .off2 = td_var_offset(start_delay_high),
2144 .help = "Only start job when this period has passed",
2147 .category = FIO_OPT_C_GENERAL,
2148 .group = FIO_OPT_G_RUNTIME,
2154 .type = FIO_OPT_STR_VAL_TIME,
2155 .off1 = td_var_offset(timeout),
2156 .help = "Stop workload when this amount of time has passed",
2159 .category = FIO_OPT_C_GENERAL,
2160 .group = FIO_OPT_G_RUNTIME,
2163 .name = "time_based",
2164 .lname = "Time based",
2165 .type = FIO_OPT_STR_SET,
2166 .off1 = td_var_offset(time_based),
2167 .help = "Keep running until runtime/timeout is met",
2168 .category = FIO_OPT_C_GENERAL,
2169 .group = FIO_OPT_G_RUNTIME,
2172 .name = "verify_only",
2173 .lname = "Verify only",
2174 .type = FIO_OPT_STR_SET,
2175 .off1 = td_var_offset(verify_only),
2176 .help = "Verifies previously written data is still valid",
2177 .category = FIO_OPT_C_GENERAL,
2178 .group = FIO_OPT_G_RUNTIME,
2181 .name = "ramp_time",
2182 .lname = "Ramp time",
2183 .type = FIO_OPT_STR_VAL_TIME,
2184 .off1 = td_var_offset(ramp_time),
2185 .help = "Ramp up time before measuring performance",
2187 .category = FIO_OPT_C_GENERAL,
2188 .group = FIO_OPT_G_RUNTIME,
2191 .name = "clocksource",
2192 .lname = "Clock source",
2193 .type = FIO_OPT_STR,
2194 .cb = fio_clock_source_cb,
2195 .off1 = td_var_offset(clocksource),
2196 .help = "What type of timing source to use",
2197 .category = FIO_OPT_C_GENERAL,
2198 .group = FIO_OPT_G_CLOCK,
2200 #ifdef CONFIG_GETTIMEOFDAY
2201 { .ival = "gettimeofday",
2203 .help = "Use gettimeofday(2) for timing",
2206 #ifdef CONFIG_CLOCK_GETTIME
2207 { .ival = "clock_gettime",
2208 .oval = CS_CGETTIME,
2209 .help = "Use clock_gettime(2) for timing",
2212 #ifdef ARCH_HAVE_CPU_CLOCK
2214 .oval = CS_CPUCLOCK,
2215 .help = "Use CPU private clock",
2223 .lname = "I/O Memory",
2224 .type = FIO_OPT_STR,
2226 .off1 = td_var_offset(mem_type),
2227 .help = "Backing type for IO buffers",
2229 .category = FIO_OPT_C_IO,
2230 .group = FIO_OPT_G_INVALID,
2234 .help = "Use malloc(3) for IO buffers",
2236 #ifndef CONFIG_NO_SHM
2239 .help = "Use shared memory segments for IO buffers",
2241 #ifdef FIO_HAVE_HUGETLB
2242 { .ival = "shmhuge",
2243 .oval = MEM_SHMHUGE,
2244 .help = "Like shm, but use huge pages",
2250 .help = "Use mmap(2) (file or anon) for IO buffers",
2252 #ifdef FIO_HAVE_HUGETLB
2253 { .ival = "mmaphuge",
2254 .oval = MEM_MMAPHUGE,
2255 .help = "Like mmap, but use huge pages",
2261 .name = "iomem_align",
2262 .alias = "mem_align",
2263 .lname = "I/O memory alignment",
2264 .type = FIO_OPT_INT,
2265 .off1 = td_var_offset(mem_align),
2267 .help = "IO memory buffer offset alignment",
2271 .category = FIO_OPT_C_IO,
2272 .group = FIO_OPT_G_INVALID,
2277 .type = FIO_OPT_STR,
2278 .off1 = td_var_offset(verify),
2279 .help = "Verify data written",
2281 .category = FIO_OPT_C_IO,
2282 .group = FIO_OPT_G_VERIFY,
2285 .oval = VERIFY_NONE,
2286 .help = "Don't do IO verification",
2290 .help = "Use md5 checksums for verification",
2293 .oval = VERIFY_CRC64,
2294 .help = "Use crc64 checksums for verification",
2297 .oval = VERIFY_CRC32,
2298 .help = "Use crc32 checksums for verification",
2300 { .ival = "crc32c-intel",
2301 .oval = VERIFY_CRC32C,
2302 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2305 .oval = VERIFY_CRC32C,
2306 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2309 .oval = VERIFY_CRC16,
2310 .help = "Use crc16 checksums for verification",
2313 .oval = VERIFY_CRC7,
2314 .help = "Use crc7 checksums for verification",
2317 .oval = VERIFY_SHA1,
2318 .help = "Use sha1 checksums for verification",
2321 .oval = VERIFY_SHA256,
2322 .help = "Use sha256 checksums for verification",
2325 .oval = VERIFY_SHA512,
2326 .help = "Use sha512 checksums for verification",
2329 .oval = VERIFY_XXHASH,
2330 .help = "Use xxhash checksums for verification",
2333 .oval = VERIFY_META,
2334 .help = "Use io information",
2338 .oval = VERIFY_NULL,
2339 .help = "Pretend to verify",
2344 .name = "do_verify",
2345 .lname = "Perform verify step",
2346 .type = FIO_OPT_BOOL,
2347 .off1 = td_var_offset(do_verify),
2348 .help = "Run verification stage after write",
2352 .category = FIO_OPT_C_IO,
2353 .group = FIO_OPT_G_VERIFY,
2356 .name = "verifysort",
2357 .lname = "Verify sort",
2358 .type = FIO_OPT_BOOL,
2359 .off1 = td_var_offset(verifysort),
2360 .help = "Sort written verify blocks for read back",
2364 .category = FIO_OPT_C_IO,
2365 .group = FIO_OPT_G_VERIFY,
2368 .name = "verifysort_nr",
2369 .type = FIO_OPT_INT,
2370 .off1 = td_var_offset(verifysort_nr),
2371 .help = "Pre-load and sort verify blocks for a read workload",
2376 .category = FIO_OPT_C_IO,
2377 .group = FIO_OPT_G_VERIFY,
2380 .name = "verify_interval",
2381 .lname = "Verify interval",
2382 .type = FIO_OPT_INT,
2383 .off1 = td_var_offset(verify_interval),
2384 .minval = 2 * sizeof(struct verify_header),
2385 .help = "Store verify buffer header every N bytes",
2388 .interval = 2 * sizeof(struct verify_header),
2389 .category = FIO_OPT_C_IO,
2390 .group = FIO_OPT_G_VERIFY,
2393 .name = "verify_offset",
2394 .lname = "Verify offset",
2395 .type = FIO_OPT_INT,
2396 .help = "Offset verify header location by N bytes",
2397 .off1 = td_var_offset(verify_offset),
2398 .minval = sizeof(struct verify_header),
2401 .category = FIO_OPT_C_IO,
2402 .group = FIO_OPT_G_VERIFY,
2405 .name = "verify_pattern",
2406 .lname = "Verify pattern",
2407 .type = FIO_OPT_STR,
2408 .cb = str_verify_pattern_cb,
2409 .help = "Fill pattern for IO buffers",
2412 .category = FIO_OPT_C_IO,
2413 .group = FIO_OPT_G_VERIFY,
2416 .name = "verify_fatal",
2417 .lname = "Verify fatal",
2418 .type = FIO_OPT_BOOL,
2419 .off1 = td_var_offset(verify_fatal),
2421 .help = "Exit on a single verify failure, don't continue",
2424 .category = FIO_OPT_C_IO,
2425 .group = FIO_OPT_G_VERIFY,
2428 .name = "verify_dump",
2429 .lname = "Verify dump",
2430 .type = FIO_OPT_BOOL,
2431 .off1 = td_var_offset(verify_dump),
2433 .help = "Dump contents of good and bad blocks on failure",
2436 .category = FIO_OPT_C_IO,
2437 .group = FIO_OPT_G_VERIFY,
2440 .name = "verify_async",
2441 .lname = "Verify asynchronously",
2442 .type = FIO_OPT_INT,
2443 .off1 = td_var_offset(verify_async),
2445 .help = "Number of async verifier threads to use",
2448 .category = FIO_OPT_C_IO,
2449 .group = FIO_OPT_G_VERIFY,
2452 .name = "verify_backlog",
2453 .lname = "Verify backlog",
2454 .type = FIO_OPT_STR_VAL,
2455 .off1 = td_var_offset(verify_backlog),
2456 .help = "Verify after this number of blocks are written",
2459 .category = FIO_OPT_C_IO,
2460 .group = FIO_OPT_G_VERIFY,
2463 .name = "verify_backlog_batch",
2464 .lname = "Verify backlog batch",
2465 .type = FIO_OPT_INT,
2466 .off1 = td_var_offset(verify_batch),
2467 .help = "Verify this number of IO blocks",
2470 .category = FIO_OPT_C_IO,
2471 .group = FIO_OPT_G_VERIFY,
2473 #ifdef FIO_HAVE_CPU_AFFINITY
2475 .name = "verify_async_cpus",
2476 .lname = "Async verify CPUs",
2477 .type = FIO_OPT_STR,
2478 .cb = str_verify_cpus_allowed_cb,
2479 .help = "Set CPUs allowed for async verify threads",
2480 .parent = "verify_async",
2482 .category = FIO_OPT_C_IO,
2483 .group = FIO_OPT_G_VERIFY,
2487 .name = "experimental_verify",
2488 .off1 = td_var_offset(experimental_verify),
2489 .type = FIO_OPT_BOOL,
2490 .help = "Enable experimental verification",
2491 .category = FIO_OPT_C_IO,
2492 .group = FIO_OPT_G_VERIFY,
2494 #ifdef FIO_HAVE_TRIM
2496 .name = "trim_percentage",
2497 .lname = "Trim percentage",
2498 .type = FIO_OPT_INT,
2499 .off1 = td_var_offset(trim_percentage),
2502 .help = "Number of verify blocks to discard/trim",
2507 .category = FIO_OPT_C_IO,
2508 .group = FIO_OPT_G_TRIM,
2511 .name = "trim_verify_zero",
2512 .lname = "Verify trim zero",
2513 .type = FIO_OPT_BOOL,
2514 .help = "Verify that trim/discarded blocks are returned as zeroes",
2515 .off1 = td_var_offset(trim_zero),
2516 .parent = "trim_percentage",
2519 .category = FIO_OPT_C_IO,
2520 .group = FIO_OPT_G_TRIM,
2523 .name = "trim_backlog",
2524 .lname = "Trim backlog",
2525 .type = FIO_OPT_STR_VAL,
2526 .off1 = td_var_offset(trim_backlog),
2527 .help = "Trim after this number of blocks are written",
2528 .parent = "trim_percentage",
2531 .category = FIO_OPT_C_IO,
2532 .group = FIO_OPT_G_TRIM,
2535 .name = "trim_backlog_batch",
2536 .lname = "Trim backlog batch",
2537 .type = FIO_OPT_INT,
2538 .off1 = td_var_offset(trim_batch),
2539 .help = "Trim this number of IO blocks",
2540 .parent = "trim_percentage",
2543 .category = FIO_OPT_C_IO,
2544 .group = FIO_OPT_G_TRIM,
2548 .name = "write_iolog",
2549 .lname = "Write I/O log",
2550 .type = FIO_OPT_STR_STORE,
2551 .off1 = td_var_offset(write_iolog_file),
2552 .help = "Store IO pattern to file",
2553 .category = FIO_OPT_C_IO,
2554 .group = FIO_OPT_G_IOLOG,
2557 .name = "read_iolog",
2558 .lname = "Read I/O log",
2559 .type = FIO_OPT_STR_STORE,
2560 .off1 = td_var_offset(read_iolog_file),
2561 .help = "Playback IO pattern from file",
2562 .category = FIO_OPT_C_IO,
2563 .group = FIO_OPT_G_IOLOG,
2566 .name = "replay_no_stall",
2567 .lname = "Don't stall on replay",
2568 .type = FIO_OPT_BOOL,
2569 .off1 = td_var_offset(no_stall),
2571 .parent = "read_iolog",
2573 .help = "Playback IO pattern file as fast as possible without stalls",
2574 .category = FIO_OPT_C_IO,
2575 .group = FIO_OPT_G_IOLOG,
2578 .name = "replay_redirect",
2579 .lname = "Redirect device for replay",
2580 .type = FIO_OPT_STR_STORE,
2581 .off1 = td_var_offset(replay_redirect),
2582 .parent = "read_iolog",
2584 .help = "Replay all I/O onto this device, regardless of trace device",
2585 .category = FIO_OPT_C_IO,
2586 .group = FIO_OPT_G_IOLOG,
2589 .name = "exec_prerun",
2590 .lname = "Pre-execute runnable",
2591 .type = FIO_OPT_STR_STORE,
2592 .off1 = td_var_offset(exec_prerun),
2593 .help = "Execute this file prior to running job",
2594 .category = FIO_OPT_C_GENERAL,
2595 .group = FIO_OPT_G_INVALID,
2598 .name = "exec_postrun",
2599 .lname = "Post-execute runnable",
2600 .type = FIO_OPT_STR_STORE,
2601 .off1 = td_var_offset(exec_postrun),
2602 .help = "Execute this file after running job",
2603 .category = FIO_OPT_C_GENERAL,
2604 .group = FIO_OPT_G_INVALID,
2606 #ifdef FIO_HAVE_IOSCHED_SWITCH
2608 .name = "ioscheduler",
2609 .lname = "I/O scheduler",
2610 .type = FIO_OPT_STR_STORE,
2611 .off1 = td_var_offset(ioscheduler),
2612 .help = "Use this IO scheduler on the backing device",
2613 .category = FIO_OPT_C_FILE,
2614 .group = FIO_OPT_G_INVALID,
2619 .lname = "Zone size",
2620 .type = FIO_OPT_STR_VAL,
2621 .off1 = td_var_offset(zone_size),
2622 .help = "Amount of data to read per zone",
2624 .interval = 1024 * 1024,
2625 .category = FIO_OPT_C_IO,
2626 .group = FIO_OPT_G_ZONE,
2629 .name = "zonerange",
2630 .lname = "Zone range",
2631 .type = FIO_OPT_STR_VAL,
2632 .off1 = td_var_offset(zone_range),
2633 .help = "Give size of an IO zone",
2635 .interval = 1024 * 1024,
2636 .category = FIO_OPT_C_IO,
2637 .group = FIO_OPT_G_ZONE,
2641 .lname = "Zone skip",
2642 .type = FIO_OPT_STR_VAL,
2643 .off1 = td_var_offset(zone_skip),
2644 .help = "Space between IO zones",
2646 .interval = 1024 * 1024,
2647 .category = FIO_OPT_C_IO,
2648 .group = FIO_OPT_G_ZONE,
2652 .lname = "Lock memory",
2653 .type = FIO_OPT_STR_VAL,
2654 .off1 = td_var_offset(lockmem),
2655 .help = "Lock down this amount of memory (per worker)",
2657 .interval = 1024 * 1024,
2658 .category = FIO_OPT_C_GENERAL,
2659 .group = FIO_OPT_G_INVALID,
2662 .name = "rwmixread",
2663 .lname = "Read/write mix read",
2664 .type = FIO_OPT_INT,
2665 .cb = str_rwmix_read_cb,
2667 .help = "Percentage of mixed workload that is reads",
2670 .inverse = "rwmixwrite",
2671 .category = FIO_OPT_C_IO,
2672 .group = FIO_OPT_G_RWMIX,
2675 .name = "rwmixwrite",
2676 .lname = "Read/write mix write",
2677 .type = FIO_OPT_INT,
2678 .cb = str_rwmix_write_cb,
2680 .help = "Percentage of mixed workload that is writes",
2683 .inverse = "rwmixread",
2684 .category = FIO_OPT_C_IO,
2685 .group = FIO_OPT_G_RWMIX,
2688 .name = "rwmixcycle",
2689 .lname = "Read/write mix cycle",
2690 .type = FIO_OPT_DEPRECATED,
2691 .category = FIO_OPT_C_IO,
2692 .group = FIO_OPT_G_RWMIX,
2697 .type = FIO_OPT_INT,
2698 .off1 = td_var_offset(nice),
2699 .help = "Set job CPU nice value",
2704 .category = FIO_OPT_C_GENERAL,
2705 .group = FIO_OPT_G_CRED,
2707 #ifdef FIO_HAVE_IOPRIO
2710 .lname = "I/O nice priority",
2711 .type = FIO_OPT_INT,
2712 .off1 = td_var_offset(ioprio),
2713 .help = "Set job IO priority value",
2717 .category = FIO_OPT_C_GENERAL,
2718 .group = FIO_OPT_G_CRED,
2721 .name = "prioclass",
2722 .lname = "I/O nice priority class",
2723 .type = FIO_OPT_INT,
2724 .off1 = td_var_offset(ioprio_class),
2725 .help = "Set job IO priority class",
2729 .category = FIO_OPT_C_GENERAL,
2730 .group = FIO_OPT_G_CRED,
2734 .name = "thinktime",
2735 .lname = "Thinktime",
2736 .type = FIO_OPT_INT,
2737 .off1 = td_var_offset(thinktime),
2738 .help = "Idle time between IO buffers (usec)",
2740 .category = FIO_OPT_C_IO,
2741 .group = FIO_OPT_G_THINKTIME,
2744 .name = "thinktime_spin",
2745 .lname = "Thinktime spin",
2746 .type = FIO_OPT_INT,
2747 .off1 = td_var_offset(thinktime_spin),
2748 .help = "Start think time by spinning this amount (usec)",
2750 .parent = "thinktime",
2752 .category = FIO_OPT_C_IO,
2753 .group = FIO_OPT_G_THINKTIME,
2756 .name = "thinktime_blocks",
2757 .lname = "Thinktime blocks",
2758 .type = FIO_OPT_INT,
2759 .off1 = td_var_offset(thinktime_blocks),
2760 .help = "IO buffer period between 'thinktime'",
2762 .parent = "thinktime",
2764 .category = FIO_OPT_C_IO,
2765 .group = FIO_OPT_G_THINKTIME,
2769 .lname = "I/O rate",
2770 .type = FIO_OPT_INT,
2771 .off1 = td_var_offset(rate[DDIR_READ]),
2772 .off2 = td_var_offset(rate[DDIR_WRITE]),
2773 .off3 = td_var_offset(rate[DDIR_TRIM]),
2774 .help = "Set bandwidth rate",
2775 .category = FIO_OPT_C_IO,
2776 .group = FIO_OPT_G_RATE,
2780 .lname = "I/O min rate",
2781 .type = FIO_OPT_INT,
2782 .off1 = td_var_offset(ratemin[DDIR_READ]),
2783 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2784 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2785 .help = "Job must meet this rate or it will be shutdown",
2788 .category = FIO_OPT_C_IO,
2789 .group = FIO_OPT_G_RATE,
2792 .name = "rate_iops",
2793 .lname = "I/O rate IOPS",
2794 .type = FIO_OPT_INT,
2795 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2796 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2797 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2798 .help = "Limit IO used to this number of IO operations/sec",
2800 .category = FIO_OPT_C_IO,
2801 .group = FIO_OPT_G_RATE,
2804 .name = "rate_iops_min",
2805 .lname = "I/O min rate IOPS",
2806 .type = FIO_OPT_INT,
2807 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2808 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2809 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2810 .help = "Job must meet this rate or it will be shut down",
2811 .parent = "rate_iops",
2813 .category = FIO_OPT_C_IO,
2814 .group = FIO_OPT_G_RATE,
2817 .name = "ratecycle",
2818 .lname = "I/O rate cycle",
2819 .type = FIO_OPT_INT,
2820 .off1 = td_var_offset(ratecycle),
2821 .help = "Window average for rate limits (msec)",
2825 .category = FIO_OPT_C_IO,
2826 .group = FIO_OPT_G_RATE,
2829 .name = "max_latency",
2830 .type = FIO_OPT_INT,
2831 .off1 = td_var_offset(max_latency),
2832 .help = "Maximum tolerated IO latency (usec)",
2833 .category = FIO_OPT_C_IO,
2834 .group = FIO_OPT_G_LATPROF,
2837 .name = "latency_target",
2838 .lname = "Latency Target (usec)",
2839 .type = FIO_OPT_STR_VAL_TIME,
2840 .off1 = td_var_offset(latency_target),
2841 .help = "Ramp to max queue depth supporting this latency",
2842 .category = FIO_OPT_C_IO,
2843 .group = FIO_OPT_G_LATPROF,
2846 .name = "latency_window",
2847 .lname = "Latency Window (usec)",
2848 .type = FIO_OPT_STR_VAL_TIME,
2849 .off1 = td_var_offset(latency_window),
2850 .help = "Time to sustain latency_target",
2851 .category = FIO_OPT_C_IO,
2852 .group = FIO_OPT_G_LATPROF,
2855 .name = "latency_percentile",
2856 .lname = "Latency Percentile",
2857 .type = FIO_OPT_FLOAT_LIST,
2858 .off1 = td_var_offset(latency_percentile),
2859 .help = "Percentile of IOs must be below latency_target",
2864 .category = FIO_OPT_C_IO,
2865 .group = FIO_OPT_G_LATPROF,
2868 .name = "invalidate",
2869 .lname = "Cache invalidate",
2870 .type = FIO_OPT_BOOL,
2871 .off1 = td_var_offset(invalidate_cache),
2872 .help = "Invalidate buffer/page cache prior to running job",
2874 .category = FIO_OPT_C_IO,
2875 .group = FIO_OPT_G_IO_TYPE,
2879 .lname = "Synchronous I/O",
2880 .type = FIO_OPT_BOOL,
2881 .off1 = td_var_offset(sync_io),
2882 .help = "Use O_SYNC for buffered writes",
2884 .parent = "buffered",
2886 .category = FIO_OPT_C_IO,
2887 .group = FIO_OPT_G_IO_TYPE,
2890 .name = "create_serialize",
2891 .lname = "Create serialize",
2892 .type = FIO_OPT_BOOL,
2893 .off1 = td_var_offset(create_serialize),
2894 .help = "Serialize creating of job files",
2896 .category = FIO_OPT_C_FILE,
2897 .group = FIO_OPT_G_INVALID,
2900 .name = "create_fsync",
2901 .lname = "Create fsync",
2902 .type = FIO_OPT_BOOL,
2903 .off1 = td_var_offset(create_fsync),
2904 .help = "fsync file after creation",
2906 .category = FIO_OPT_C_FILE,
2907 .group = FIO_OPT_G_INVALID,
2910 .name = "create_on_open",
2911 .lname = "Create on open",
2912 .type = FIO_OPT_BOOL,
2913 .off1 = td_var_offset(create_on_open),
2914 .help = "Create files when they are opened for IO",
2916 .category = FIO_OPT_C_FILE,
2917 .group = FIO_OPT_G_INVALID,
2920 .name = "create_only",
2921 .type = FIO_OPT_BOOL,
2922 .off1 = td_var_offset(create_only),
2923 .help = "Only perform file creation phase",
2924 .category = FIO_OPT_C_FILE,
2929 .lname = "Pre-read files",
2930 .type = FIO_OPT_BOOL,
2931 .off1 = td_var_offset(pre_read),
2932 .help = "Pre-read files before starting official testing",
2934 .category = FIO_OPT_C_FILE,
2935 .group = FIO_OPT_G_INVALID,
2937 #ifdef FIO_HAVE_CPU_AFFINITY
2940 .lname = "CPU mask",
2941 .type = FIO_OPT_INT,
2942 .cb = str_cpumask_cb,
2943 .help = "CPU affinity mask",
2944 .category = FIO_OPT_C_GENERAL,
2945 .group = FIO_OPT_G_CRED,
2948 .name = "cpus_allowed",
2949 .lname = "CPUs allowed",
2950 .type = FIO_OPT_STR,
2951 .cb = str_cpus_allowed_cb,
2952 .help = "Set CPUs allowed",
2953 .category = FIO_OPT_C_GENERAL,
2954 .group = FIO_OPT_G_CRED,
2957 .name = "cpus_allowed_policy",
2958 .lname = "CPUs allowed distribution policy",
2959 .type = FIO_OPT_STR,
2960 .off1 = td_var_offset(cpus_allowed_policy),
2961 .help = "Distribution policy for cpus_allowed",
2962 .parent = "cpus_allowed",
2966 .oval = FIO_CPUS_SHARED,
2967 .help = "Mask shared between threads",
2970 .oval = FIO_CPUS_SPLIT,
2971 .help = "Mask split between threads",
2974 .category = FIO_OPT_C_GENERAL,
2975 .group = FIO_OPT_G_CRED,
2978 #ifdef CONFIG_LIBNUMA
2980 .name = "numa_cpu_nodes",
2981 .type = FIO_OPT_STR,
2982 .cb = str_numa_cpunodes_cb,
2983 .help = "NUMA CPU nodes bind",
2984 .category = FIO_OPT_C_GENERAL,
2985 .group = FIO_OPT_G_INVALID,
2988 .name = "numa_mem_policy",
2989 .type = FIO_OPT_STR,
2990 .cb = str_numa_mpol_cb,
2991 .help = "NUMA memory policy setup",
2992 .category = FIO_OPT_C_GENERAL,
2993 .group = FIO_OPT_G_INVALID,
2997 .name = "end_fsync",
2998 .lname = "End fsync",
2999 .type = FIO_OPT_BOOL,
3000 .off1 = td_var_offset(end_fsync),
3001 .help = "Include fsync at the end of job",
3003 .category = FIO_OPT_C_FILE,
3004 .group = FIO_OPT_G_INVALID,
3007 .name = "fsync_on_close",
3008 .lname = "Fsync on close",
3009 .type = FIO_OPT_BOOL,
3010 .off1 = td_var_offset(fsync_on_close),
3011 .help = "fsync files on close",
3013 .category = FIO_OPT_C_FILE,
3014 .group = FIO_OPT_G_INVALID,
3018 .lname = "Unlink file",
3019 .type = FIO_OPT_BOOL,
3020 .off1 = td_var_offset(unlink),
3021 .help = "Unlink created files after job has completed",
3023 .category = FIO_OPT_C_FILE,
3024 .group = FIO_OPT_G_INVALID,
3028 .lname = "Exit-all on terminate",
3029 .type = FIO_OPT_STR_SET,
3030 .cb = str_exitall_cb,
3031 .help = "Terminate all jobs when one exits",
3032 .category = FIO_OPT_C_GENERAL,
3033 .group = FIO_OPT_G_PROCESS,
3036 .name = "stonewall",
3037 .lname = "Wait for previous",
3038 .alias = "wait_for_previous",
3039 .type = FIO_OPT_STR_SET,
3040 .off1 = td_var_offset(stonewall),
3041 .help = "Insert a hard barrier between this job and previous",
3042 .category = FIO_OPT_C_GENERAL,
3043 .group = FIO_OPT_G_PROCESS,
3046 .name = "new_group",
3047 .lname = "New group",
3048 .type = FIO_OPT_STR_SET,
3049 .off1 = td_var_offset(new_group),
3050 .help = "Mark the start of a new group (for reporting)",
3051 .category = FIO_OPT_C_GENERAL,
3052 .group = FIO_OPT_G_PROCESS,
3057 .type = FIO_OPT_STR_SET,
3058 .off1 = td_var_offset(use_thread),
3059 .help = "Use threads instead of processes",
3060 #ifdef CONFIG_NO_SHM
3064 .category = FIO_OPT_C_GENERAL,
3065 .group = FIO_OPT_G_PROCESS,
3068 .name = "write_bw_log",
3069 .lname = "Write bandwidth log",
3070 .type = FIO_OPT_STR_STORE,
3071 .off1 = td_var_offset(bw_log_file),
3072 .help = "Write log of bandwidth during run",
3073 .category = FIO_OPT_C_LOG,
3074 .group = FIO_OPT_G_INVALID,
3077 .name = "write_lat_log",
3078 .lname = "Write latency log",
3079 .type = FIO_OPT_STR_STORE,
3080 .off1 = td_var_offset(lat_log_file),
3081 .help = "Write log of latency during run",
3082 .category = FIO_OPT_C_LOG,
3083 .group = FIO_OPT_G_INVALID,
3086 .name = "write_iops_log",
3087 .lname = "Write IOPS log",
3088 .type = FIO_OPT_STR_STORE,
3089 .off1 = td_var_offset(iops_log_file),
3090 .help = "Write log of IOPS during run",
3091 .category = FIO_OPT_C_LOG,
3092 .group = FIO_OPT_G_INVALID,
3095 .name = "log_avg_msec",
3096 .lname = "Log averaging (msec)",
3097 .type = FIO_OPT_INT,
3098 .off1 = td_var_offset(log_avg_msec),
3099 .help = "Average bw/iops/lat logs over this period of time",
3101 .category = FIO_OPT_C_LOG,
3102 .group = FIO_OPT_G_INVALID,
3105 .name = "log_offset",
3106 .lname = "Log offset of IO",
3107 .type = FIO_OPT_BOOL,
3108 .off1 = td_var_offset(log_offset),
3109 .help = "Include offset of IO for each log entry",
3111 .category = FIO_OPT_C_LOG,
3112 .group = FIO_OPT_G_INVALID,
3116 .name = "log_compression",
3117 .lname = "Log compression",
3118 .type = FIO_OPT_INT,
3119 .off1 = td_var_offset(log_gz),
3120 .help = "Log in compressed chunks of this size",
3121 .minval = 32 * 1024 * 1024ULL,
3122 .maxval = 512 * 1024 * 1024ULL,
3123 .category = FIO_OPT_C_LOG,
3124 .group = FIO_OPT_G_INVALID,
3127 .name = "log_store_compressed",
3128 .lname = "Log store compressed",
3129 .type = FIO_OPT_BOOL,
3130 .off1 = td_var_offset(log_gz_store),
3131 .help = "Store logs in a compressed format",
3132 .category = FIO_OPT_C_LOG,
3133 .group = FIO_OPT_G_INVALID,
3137 .name = "bwavgtime",
3138 .lname = "Bandwidth average time",
3139 .type = FIO_OPT_INT,
3140 .off1 = td_var_offset(bw_avg_time),
3141 .help = "Time window over which to calculate bandwidth"
3144 .parent = "write_bw_log",
3147 .category = FIO_OPT_C_LOG,
3148 .group = FIO_OPT_G_INVALID,
3151 .name = "iopsavgtime",
3152 .lname = "IOPS average time",
3153 .type = FIO_OPT_INT,
3154 .off1 = td_var_offset(iops_avg_time),
3155 .help = "Time window over which to calculate IOPS (msec)",
3157 .parent = "write_iops_log",
3160 .category = FIO_OPT_C_LOG,
3161 .group = FIO_OPT_G_INVALID,
3164 .name = "group_reporting",
3165 .lname = "Group reporting",
3166 .type = FIO_OPT_STR_SET,
3167 .off1 = td_var_offset(group_reporting),
3168 .help = "Do reporting on a per-group basis",
3169 .category = FIO_OPT_C_STAT,
3170 .group = FIO_OPT_G_INVALID,
3173 .name = "zero_buffers",
3174 .lname = "Zero I/O buffers",
3175 .type = FIO_OPT_STR_SET,
3176 .off1 = td_var_offset(zero_buffers),
3177 .help = "Init IO buffers to all zeroes",
3178 .category = FIO_OPT_C_IO,
3179 .group = FIO_OPT_G_IO_BUF,
3182 .name = "refill_buffers",
3183 .lname = "Refill I/O buffers",
3184 .type = FIO_OPT_STR_SET,
3185 .off1 = td_var_offset(refill_buffers),
3186 .help = "Refill IO buffers on every IO submit",
3187 .category = FIO_OPT_C_IO,
3188 .group = FIO_OPT_G_IO_BUF,
3191 .name = "scramble_buffers",
3192 .lname = "Scramble I/O buffers",
3193 .type = FIO_OPT_BOOL,
3194 .off1 = td_var_offset(scramble_buffers),
3195 .help = "Slightly scramble buffers on every IO submit",
3197 .category = FIO_OPT_C_IO,
3198 .group = FIO_OPT_G_IO_BUF,
3201 .name = "buffer_pattern",
3202 .lname = "Buffer pattern",
3203 .type = FIO_OPT_STR,
3204 .cb = str_buffer_pattern_cb,
3205 .help = "Fill pattern for IO buffers",
3206 .category = FIO_OPT_C_IO,
3207 .group = FIO_OPT_G_IO_BUF,
3210 .name = "buffer_compress_percentage",
3211 .lname = "Buffer compression percentage",
3212 .type = FIO_OPT_INT,
3213 .cb = str_buffer_compress_cb,
3216 .help = "How compressible the buffer is (approximately)",
3218 .category = FIO_OPT_C_IO,
3219 .group = FIO_OPT_G_IO_BUF,
3222 .name = "buffer_compress_chunk",
3223 .lname = "Buffer compression chunk size",
3224 .type = FIO_OPT_INT,
3225 .off1 = td_var_offset(compress_chunk),
3226 .parent = "buffer_compress_percentage",
3228 .help = "Size of compressible region in buffer",
3230 .category = FIO_OPT_C_IO,
3231 .group = FIO_OPT_G_IO_BUF,
3234 .name = "clat_percentiles",
3235 .lname = "Completion latency percentiles",
3236 .type = FIO_OPT_BOOL,
3237 .off1 = td_var_offset(clat_percentiles),
3238 .help = "Enable the reporting of completion latency percentiles",
3240 .category = FIO_OPT_C_STAT,
3241 .group = FIO_OPT_G_INVALID,
3244 .name = "percentile_list",
3245 .lname = "Completion latency percentile list",
3246 .type = FIO_OPT_FLOAT_LIST,
3247 .off1 = td_var_offset(percentile_list),
3248 .off2 = td_var_offset(percentile_precision),
3249 .help = "Specify a custom list of percentiles to report",
3250 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3251 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3254 .category = FIO_OPT_C_STAT,
3255 .group = FIO_OPT_G_INVALID,
3258 #ifdef FIO_HAVE_DISK_UTIL
3260 .name = "disk_util",
3261 .lname = "Disk utilization",
3262 .type = FIO_OPT_BOOL,
3263 .off1 = td_var_offset(do_disk_util),
3264 .help = "Log disk utilization statistics",
3266 .category = FIO_OPT_C_STAT,
3267 .group = FIO_OPT_G_INVALID,
3271 .name = "gtod_reduce",
3272 .lname = "Reduce gettimeofday() calls",
3273 .type = FIO_OPT_BOOL,
3274 .help = "Greatly reduce number of gettimeofday() calls",
3275 .cb = str_gtod_reduce_cb,
3278 .category = FIO_OPT_C_STAT,
3279 .group = FIO_OPT_G_INVALID,
3282 .name = "disable_lat",
3283 .lname = "Disable all latency stats",
3284 .type = FIO_OPT_BOOL,
3285 .off1 = td_var_offset(disable_lat),
3286 .help = "Disable latency numbers",
3287 .parent = "gtod_reduce",
3290 .category = FIO_OPT_C_STAT,
3291 .group = FIO_OPT_G_INVALID,
3294 .name = "disable_clat",
3295 .lname = "Disable completion latency stats",
3296 .type = FIO_OPT_BOOL,
3297 .off1 = td_var_offset(disable_clat),
3298 .help = "Disable completion latency numbers",
3299 .parent = "gtod_reduce",
3302 .category = FIO_OPT_C_STAT,
3303 .group = FIO_OPT_G_INVALID,
3306 .name = "disable_slat",
3307 .lname = "Disable submission latency stats",
3308 .type = FIO_OPT_BOOL,
3309 .off1 = td_var_offset(disable_slat),
3310 .help = "Disable submission latency numbers",
3311 .parent = "gtod_reduce",
3314 .category = FIO_OPT_C_STAT,
3315 .group = FIO_OPT_G_INVALID,
3318 .name = "disable_bw_measurement",
3319 .lname = "Disable bandwidth stats",
3320 .type = FIO_OPT_BOOL,
3321 .off1 = td_var_offset(disable_bw),
3322 .help = "Disable bandwidth logging",
3323 .parent = "gtod_reduce",
3326 .category = FIO_OPT_C_STAT,
3327 .group = FIO_OPT_G_INVALID,
3331 .lname = "Dedicated gettimeofday() CPU",
3332 .type = FIO_OPT_INT,
3333 .cb = str_gtod_cpu_cb,
3334 .help = "Set up dedicated gettimeofday() thread on this CPU",
3335 .verify = gtod_cpu_verify,
3336 .category = FIO_OPT_C_GENERAL,
3337 .group = FIO_OPT_G_CLOCK,
3340 .name = "unified_rw_reporting",
3341 .type = FIO_OPT_BOOL,
3342 .off1 = td_var_offset(unified_rw_rep),
3343 .help = "Unify reporting across data direction",
3345 .category = FIO_OPT_C_GENERAL,
3346 .group = FIO_OPT_G_INVALID,
3349 .name = "continue_on_error",
3350 .lname = "Continue on error",
3351 .type = FIO_OPT_STR,
3352 .off1 = td_var_offset(continue_on_error),
3353 .help = "Continue on non-fatal errors during IO",
3355 .category = FIO_OPT_C_GENERAL,
3356 .group = FIO_OPT_G_ERR,
3359 .oval = ERROR_TYPE_NONE,
3360 .help = "Exit when an error is encountered",
3363 .oval = ERROR_TYPE_READ,
3364 .help = "Continue on read errors only",
3367 .oval = ERROR_TYPE_WRITE,
3368 .help = "Continue on write errors only",
3371 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3372 .help = "Continue on any IO errors",
3375 .oval = ERROR_TYPE_VERIFY,
3376 .help = "Continue on verify errors only",
3379 .oval = ERROR_TYPE_ANY,
3380 .help = "Continue on all io and verify errors",
3383 .oval = ERROR_TYPE_NONE,
3384 .help = "Alias for 'none'",
3387 .oval = ERROR_TYPE_ANY,
3388 .help = "Alias for 'all'",
3393 .name = "ignore_error",
3394 .type = FIO_OPT_STR,
3395 .cb = str_ignore_error_cb,
3396 .help = "Set a specific list of errors to ignore",
3398 .category = FIO_OPT_C_GENERAL,
3399 .group = FIO_OPT_G_ERR,
3402 .name = "error_dump",
3403 .type = FIO_OPT_BOOL,
3404 .off1 = td_var_offset(error_dump),
3406 .help = "Dump info on each error",
3407 .category = FIO_OPT_C_GENERAL,
3408 .group = FIO_OPT_G_ERR,
3413 .type = FIO_OPT_STR_STORE,
3414 .off1 = td_var_offset(profile),
3415 .help = "Select a specific builtin performance test",
3416 .category = FIO_OPT_C_PROFILE,
3417 .group = FIO_OPT_G_INVALID,
3422 .type = FIO_OPT_STR_STORE,
3423 .off1 = td_var_offset(cgroup),
3424 .help = "Add job to cgroup of this name",
3425 .category = FIO_OPT_C_GENERAL,
3426 .group = FIO_OPT_G_CGROUP,
3429 .name = "cgroup_nodelete",
3430 .lname = "Cgroup no-delete",
3431 .type = FIO_OPT_BOOL,
3432 .off1 = td_var_offset(cgroup_nodelete),
3433 .help = "Do not delete cgroups after job completion",
3436 .category = FIO_OPT_C_GENERAL,
3437 .group = FIO_OPT_G_CGROUP,
3440 .name = "cgroup_weight",
3441 .lname = "Cgroup weight",
3442 .type = FIO_OPT_INT,
3443 .off1 = td_var_offset(cgroup_weight),
3444 .help = "Use given weight for cgroup",
3448 .category = FIO_OPT_C_GENERAL,
3449 .group = FIO_OPT_G_CGROUP,
3454 .type = FIO_OPT_INT,
3455 .off1 = td_var_offset(uid),
3456 .help = "Run job with this user ID",
3457 .category = FIO_OPT_C_GENERAL,
3458 .group = FIO_OPT_G_CRED,
3462 .lname = "Group ID",
3463 .type = FIO_OPT_INT,
3464 .off1 = td_var_offset(gid),
3465 .help = "Run job with this group ID",
3466 .category = FIO_OPT_C_GENERAL,
3467 .group = FIO_OPT_G_CRED,
3472 .type = FIO_OPT_INT,
3473 .off1 = td_var_offset(kb_base),
3479 .help = "Use 1024 as the K base",
3483 .help = "Use 1000 as the K base",
3486 .help = "How many bytes per KB for reporting (1000 or 1024)",
3487 .category = FIO_OPT_C_GENERAL,
3488 .group = FIO_OPT_G_INVALID,
3491 .name = "unit_base",
3492 .lname = "Base unit for reporting (Bits or Bytes)",
3493 .type = FIO_OPT_INT,
3494 .off1 = td_var_offset(unit_base),
3499 .help = "Auto-detect",
3503 .help = "Normal (byte based)",
3507 .help = "Bit based",
3510 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3511 .category = FIO_OPT_C_GENERAL,
3512 .group = FIO_OPT_G_INVALID,
3515 .name = "hugepage-size",
3516 .lname = "Hugepage size",
3517 .type = FIO_OPT_INT,
3518 .off1 = td_var_offset(hugepage_size),
3519 .help = "When using hugepages, specify size of each page",
3520 .def = __fio_stringify(FIO_HUGE_PAGE),
3521 .interval = 1024 * 1024,
3522 .category = FIO_OPT_C_GENERAL,
3523 .group = FIO_OPT_G_INVALID,
3527 .lname = "I/O flow ID",
3528 .type = FIO_OPT_INT,
3529 .off1 = td_var_offset(flow_id),
3530 .help = "The flow index ID to use",
3532 .category = FIO_OPT_C_IO,
3533 .group = FIO_OPT_G_IO_FLOW,
3537 .lname = "I/O flow weight",
3538 .type = FIO_OPT_INT,
3539 .off1 = td_var_offset(flow),
3540 .help = "Weight for flow control of this job",
3541 .parent = "flow_id",
3544 .category = FIO_OPT_C_IO,
3545 .group = FIO_OPT_G_IO_FLOW,
3548 .name = "flow_watermark",
3549 .lname = "I/O flow watermark",
3550 .type = FIO_OPT_INT,
3551 .off1 = td_var_offset(flow_watermark),
3552 .help = "High watermark for flow control. This option"
3553 " should be set to the same value for all threads"
3554 " with non-zero flow.",
3555 .parent = "flow_id",
3558 .category = FIO_OPT_C_IO,
3559 .group = FIO_OPT_G_IO_FLOW,
3562 .name = "flow_sleep",
3563 .lname = "I/O flow sleep",
3564 .type = FIO_OPT_INT,
3565 .off1 = td_var_offset(flow_sleep),
3566 .help = "How many microseconds to sleep after being held"
3567 " back by the flow control mechanism",
3568 .parent = "flow_id",
3571 .category = FIO_OPT_C_IO,
3572 .group = FIO_OPT_G_IO_FLOW,
3579 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3580 const char *name, int val)
3582 lopt->name = (char *) name;
3584 if (o->type == FIO_OPT_STR_SET)
3585 lopt->has_arg = optional_argument;
3587 lopt->has_arg = required_argument;
3590 static void options_to_lopts(struct fio_option *opts,
3591 struct option *long_options,
3592 int i, int option_type)
3594 struct fio_option *o = &opts[0];
3596 add_to_lopt(&long_options[i], o, o->name, option_type);
3599 add_to_lopt(&long_options[i], o, o->alias, option_type);
3604 assert(i < FIO_NR_OPTIONS);
3608 void fio_options_set_ioengine_opts(struct option *long_options,
3609 struct thread_data *td)
3614 while (long_options[i].name) {
3615 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3616 memset(&long_options[i], 0, sizeof(*long_options));
3623 * Just clear out the prior ioengine options.
3628 options_to_lopts(td->io_ops->options, long_options, i,
3629 FIO_GETOPT_IOENGINE);
3632 void fio_options_dup_and_init(struct option *long_options)
3636 options_init(fio_options);
3639 while (long_options[i].name)
3642 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3645 struct fio_keyword {
3651 static struct fio_keyword fio_keywords[] = {
3653 .word = "$pagesize",
3654 .desc = "Page size in the system",
3657 .word = "$mb_memory",
3658 .desc = "Megabytes of memory online",
3662 .desc = "Number of CPUs online in the system",
3669 void fio_keywords_init(void)
3671 unsigned long long mb_memory;
3675 sprintf(buf, "%lu", (unsigned long) page_size);
3676 fio_keywords[0].replace = strdup(buf);
3678 mb_memory = os_phys_mem() / (1024 * 1024);
3679 sprintf(buf, "%llu", mb_memory);
3680 fio_keywords[1].replace = strdup(buf);
3683 sprintf(buf, "%lu", l);
3684 fio_keywords[2].replace = strdup(buf);
3689 static char *bc_calc(char *str)
3691 char buf[128], *tmp;
3696 * No math, just return string
3698 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3699 !strchr(str, '/')) || strchr(str, '\''))
3703 * Split option from value, we only need to calculate the value
3705 tmp = strchr(str, '=');
3712 * Prevent buffer overflows; such a case isn't reasonable anyway
3714 if (strlen(str) >= 128 || strlen(tmp) > 100)
3717 sprintf(buf, "which %s > /dev/null", BC_APP);
3719 log_err("fio: bc is needed for performing math\n");
3723 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3724 f = popen(buf, "r");
3728 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3735 buf[(tmp - str) + ret - 1] = '\0';
3736 memcpy(buf, str, tmp - str);
3742 * Return a copy of the input string with substrings of the form ${VARNAME}
3743 * substituted with the value of the environment variable VARNAME. The
3744 * substitution always occurs, even if VARNAME is empty or the corresponding
3745 * environment variable undefined.
3747 static char *option_dup_subs(const char *opt)
3749 char out[OPT_LEN_MAX+1];
3750 char in[OPT_LEN_MAX+1];
3753 char *ch1, *ch2, *env;
3754 ssize_t nchr = OPT_LEN_MAX;
3757 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3758 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3762 in[OPT_LEN_MAX] = '\0';
3763 strncpy(in, opt, OPT_LEN_MAX);
3765 while (*inptr && nchr > 0) {
3766 if (inptr[0] == '$' && inptr[1] == '{') {
3767 ch2 = strchr(inptr, '}');
3768 if (ch2 && inptr+1 < ch2) {
3775 envlen = strlen(env);
3776 if (envlen <= nchr) {
3777 memcpy(outptr, env, envlen);
3787 *outptr++ = *inptr++;
3796 * Look for reserved variable names and replace them with real values
3798 static char *fio_keyword_replace(char *opt)
3804 for (i = 0; fio_keywords[i].word != NULL; i++) {
3805 struct fio_keyword *kw = &fio_keywords[i];
3807 while ((s = strstr(opt, kw->word)) != NULL) {
3808 char *new = malloc(strlen(opt) + 1);
3814 * Copy part of the string before the keyword and
3815 * sprintf() the replacement after it.
3817 memcpy(new, opt, olen);
3818 len = sprintf(new + olen, "%s", kw->replace);
3821 * If there's more in the original string, copy that
3824 opt += strlen(kw->word) + olen;
3826 memcpy(new + olen + len, opt, opt - o_org - 1);
3829 * replace opt and free the old opt
3839 * Check for potential math and invoke bc, if possible
3847 static char **dup_and_sub_options(char **opts, int num_opts)
3850 char **opts_copy = malloc(num_opts * sizeof(*opts));
3851 for (i = 0; i < num_opts; i++) {
3852 opts_copy[i] = option_dup_subs(opts[i]);
3855 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3860 int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3863 int i, ret, unknown;
3866 sort_options(opts, fio_options, num_opts);
3867 opts_copy = dup_and_sub_options(opts, num_opts);
3869 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3870 struct fio_option *o;
3871 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3872 &o, td, dump_cmdline);
3880 opts_copy[i] = NULL;
3887 ret |= ioengine_load(td);
3889 sort_options(opts_copy, td->io_ops->options, num_opts);
3892 for (i = 0; i < num_opts; i++) {
3893 struct fio_option *o = NULL;
3899 newret = parse_option(opts_copy[i], opts[i],
3900 td->io_ops->options, &o,
3901 td->eo, dump_cmdline);
3905 log_err("Bad option <%s>\n", opts[i]);
3908 opts_copy[i] = NULL;
3916 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3918 return parse_cmd_option(opt, val, fio_options, td);
3921 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3924 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
3927 void fio_fill_default_options(struct thread_data *td)
3929 td->o.magic = OPT_MAGIC;
3930 fill_default_options(td, fio_options);
3933 int fio_show_option_help(const char *opt)
3935 return show_cmd_help(fio_options, opt);
3938 void options_mem_dupe(void *data, struct fio_option *options)