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 pattern
989 * 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);
1007 td->o.refill_buffers = 0;
1008 td->o.scramble_buffers = 0;
1009 td->o.zero_buffers = 0;
1015 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1017 struct thread_data *td = data;
1019 td->flags |= TD_F_COMPRESS;
1020 td->o.compress_percentage = *il;
1024 static int str_verify_pattern_cb(void *data, const char *input)
1026 struct thread_data *td = data;
1029 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1030 &td->o.verify_pattern_bytes);
1033 * VERIFY_META could already be set
1035 if (!ret && td->o.verify == VERIFY_NONE)
1036 td->o.verify = VERIFY_PATTERN;
1041 static int str_gtod_reduce_cb(void *data, int *il)
1043 struct thread_data *td = data;
1046 td->o.disable_lat = !!val;
1047 td->o.disable_clat = !!val;
1048 td->o.disable_slat = !!val;
1049 td->o.disable_bw = !!val;
1050 td->o.clat_percentiles = !val;
1052 td->tv_cache_mask = 63;
1057 static int str_gtod_cpu_cb(void *data, long long *il)
1059 struct thread_data *td = data;
1062 td->o.gtod_cpu = val;
1063 td->o.gtod_offload = 1;
1067 static int str_size_cb(void *data, unsigned long long *__val)
1069 struct thread_data *td = data;
1070 unsigned long long v = *__val;
1072 if (parse_is_percent(v)) {
1074 td->o.size_percent = -1ULL - v;
1081 static int rw_verify(struct fio_option *o, void *data)
1083 struct thread_data *td = data;
1085 if (read_only && td_write(td)) {
1086 log_err("fio: job <%s> has write bit set, but fio is in"
1087 " read-only mode\n", td->o.name);
1094 static int gtod_cpu_verify(struct fio_option *o, void *data)
1096 #ifndef FIO_HAVE_CPU_AFFINITY
1097 struct thread_data *td = data;
1099 if (td->o.gtod_cpu) {
1100 log_err("fio: platform must support CPU affinity for"
1101 "gettimeofday() offloading\n");
1112 static struct opt_group fio_opt_groups[] = {
1115 .mask = FIO_OPT_C_GENERAL,
1119 .mask = FIO_OPT_C_IO,
1123 .mask = FIO_OPT_C_FILE,
1126 .name = "Statistics",
1127 .mask = FIO_OPT_C_STAT,
1131 .mask = FIO_OPT_C_LOG,
1135 .mask = FIO_OPT_C_PROFILE,
1142 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1143 unsigned int inv_mask)
1145 struct opt_group *og;
1148 if (*mask == inv_mask || !*mask)
1151 for (i = 0; ogs[i].name; i++) {
1154 if (*mask & og->mask) {
1155 *mask &= ~(og->mask);
1163 struct opt_group *opt_group_from_mask(unsigned int *mask)
1165 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1168 static struct opt_group fio_opt_cat_groups[] = {
1170 .name = "Latency profiling",
1171 .mask = FIO_OPT_G_LATPROF,
1175 .mask = FIO_OPT_G_RATE,
1179 .mask = FIO_OPT_G_ZONE,
1182 .name = "Read/write mix",
1183 .mask = FIO_OPT_G_RWMIX,
1187 .mask = FIO_OPT_G_VERIFY,
1191 .mask = FIO_OPT_G_TRIM,
1194 .name = "I/O Logging",
1195 .mask = FIO_OPT_G_IOLOG,
1198 .name = "I/O Depth",
1199 .mask = FIO_OPT_G_IO_DEPTH,
1203 .mask = FIO_OPT_G_IO_FLOW,
1206 .name = "Description",
1207 .mask = FIO_OPT_G_DESC,
1211 .mask = FIO_OPT_G_FILENAME,
1214 .name = "General I/O",
1215 .mask = FIO_OPT_G_IO_BASIC,
1219 .mask = FIO_OPT_G_CGROUP,
1223 .mask = FIO_OPT_G_RUNTIME,
1227 .mask = FIO_OPT_G_PROCESS,
1230 .name = "Job credentials / priority",
1231 .mask = FIO_OPT_G_CRED,
1234 .name = "Clock settings",
1235 .mask = FIO_OPT_G_CLOCK,
1239 .mask = FIO_OPT_G_IO_TYPE,
1242 .name = "I/O Thinktime",
1243 .mask = FIO_OPT_G_THINKTIME,
1246 .name = "Randomizations",
1247 .mask = FIO_OPT_G_RANDOM,
1250 .name = "I/O buffers",
1251 .mask = FIO_OPT_G_IO_BUF,
1254 .name = "Tiobench profile",
1255 .mask = FIO_OPT_G_TIOBENCH,
1263 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1265 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1269 * Map of job/command line options
1271 struct fio_option fio_options[FIO_MAX_OPTS] = {
1273 .name = "description",
1274 .lname = "Description of job",
1275 .type = FIO_OPT_STR_STORE,
1276 .off1 = td_var_offset(description),
1277 .help = "Text job description",
1278 .category = FIO_OPT_C_GENERAL,
1279 .group = FIO_OPT_G_DESC,
1283 .lname = "Job name",
1284 .type = FIO_OPT_STR_STORE,
1285 .off1 = td_var_offset(name),
1286 .help = "Name of this job",
1287 .category = FIO_OPT_C_GENERAL,
1288 .group = FIO_OPT_G_DESC,
1292 .lname = "Filename(s)",
1293 .type = FIO_OPT_STR_STORE,
1294 .off1 = td_var_offset(filename),
1295 .cb = str_filename_cb,
1296 .prio = -1, /* must come after "directory" */
1297 .help = "File(s) to use for the workload",
1298 .category = FIO_OPT_C_FILE,
1299 .group = FIO_OPT_G_FILENAME,
1302 .name = "directory",
1303 .lname = "Directory",
1304 .type = FIO_OPT_STR_STORE,
1305 .off1 = td_var_offset(directory),
1306 .cb = str_directory_cb,
1307 .help = "Directory to store files in",
1308 .category = FIO_OPT_C_FILE,
1309 .group = FIO_OPT_G_FILENAME,
1312 .name = "filename_format",
1313 .type = FIO_OPT_STR_STORE,
1314 .off1 = td_var_offset(filename_format),
1315 .prio = -1, /* must come after "directory" */
1316 .help = "Override default $jobname.$jobnum.$filenum naming",
1317 .def = "$jobname.$jobnum.$filenum",
1318 .category = FIO_OPT_C_FILE,
1319 .group = FIO_OPT_G_FILENAME,
1323 .lname = "Lockfile",
1324 .type = FIO_OPT_STR,
1325 .off1 = td_var_offset(file_lock_mode),
1326 .help = "Lock file when doing IO to it",
1328 .parent = "filename",
1331 .cb = str_lockfile_cb,
1332 .category = FIO_OPT_C_FILE,
1333 .group = FIO_OPT_G_FILENAME,
1336 .oval = FILE_LOCK_NONE,
1337 .help = "No file locking",
1339 { .ival = "exclusive",
1340 .oval = FILE_LOCK_EXCLUSIVE,
1341 .help = "Exclusive file lock",
1344 .ival = "readwrite",
1345 .oval = FILE_LOCK_READWRITE,
1346 .help = "Read vs write lock",
1352 .lname = "Open directory",
1353 .type = FIO_OPT_STR_STORE,
1354 .off1 = td_var_offset(opendir),
1355 .cb = str_opendir_cb,
1356 .help = "Recursively add files from this directory and down",
1357 .category = FIO_OPT_C_FILE,
1358 .group = FIO_OPT_G_FILENAME,
1362 .lname = "Read/write",
1363 .alias = "readwrite",
1364 .type = FIO_OPT_STR,
1366 .off1 = td_var_offset(td_ddir),
1367 .help = "IO direction",
1369 .verify = rw_verify,
1370 .category = FIO_OPT_C_IO,
1371 .group = FIO_OPT_G_IO_BASIC,
1374 .oval = TD_DDIR_READ,
1375 .help = "Sequential read",
1378 .oval = TD_DDIR_WRITE,
1379 .help = "Sequential write",
1382 .oval = TD_DDIR_TRIM,
1383 .help = "Sequential trim",
1385 { .ival = "randread",
1386 .oval = TD_DDIR_RANDREAD,
1387 .help = "Random read",
1389 { .ival = "randwrite",
1390 .oval = TD_DDIR_RANDWRITE,
1391 .help = "Random write",
1393 { .ival = "randtrim",
1394 .oval = TD_DDIR_RANDTRIM,
1395 .help = "Random trim",
1399 .help = "Sequential read and write mix",
1401 { .ival = "readwrite",
1403 .help = "Sequential read and write mix",
1406 .oval = TD_DDIR_RANDRW,
1407 .help = "Random read and write mix"
1412 .name = "rw_sequencer",
1413 .lname = "RW Sequencer",
1414 .type = FIO_OPT_STR,
1415 .off1 = td_var_offset(rw_seq),
1416 .help = "IO offset generator modifier",
1417 .def = "sequential",
1418 .category = FIO_OPT_C_IO,
1419 .group = FIO_OPT_G_IO_BASIC,
1421 { .ival = "sequential",
1423 .help = "Generate sequential offsets",
1425 { .ival = "identical",
1426 .oval = RW_SEQ_IDENT,
1427 .help = "Generate identical offsets",
1434 .lname = "IO Engine",
1435 .type = FIO_OPT_STR_STORE,
1436 .off1 = td_var_offset(ioengine),
1437 .help = "IO engine to use",
1438 .def = FIO_PREFERRED_ENGINE,
1439 .category = FIO_OPT_C_IO,
1440 .group = FIO_OPT_G_IO_BASIC,
1443 .help = "Use read/write",
1446 .help = "Use pread/pwrite",
1449 .help = "Use readv/writev",
1451 #ifdef CONFIG_PWRITEV
1453 .help = "Use preadv/pwritev",
1456 #ifdef CONFIG_LIBAIO
1458 .help = "Linux native asynchronous IO",
1461 #ifdef CONFIG_POSIXAIO
1462 { .ival = "posixaio",
1463 .help = "POSIX asynchronous IO",
1466 #ifdef CONFIG_SOLARISAIO
1467 { .ival = "solarisaio",
1468 .help = "Solaris native asynchronous IO",
1471 #ifdef CONFIG_WINDOWSAIO
1472 { .ival = "windowsaio",
1473 .help = "Windows native asynchronous IO"
1478 .help = "Rados Block Device asynchronous IO"
1482 .help = "Memory mapped IO"
1484 #ifdef CONFIG_LINUX_SPLICE
1486 .help = "splice/vmsplice based IO",
1488 { .ival = "netsplice",
1489 .help = "splice/vmsplice to/from the network",
1492 #ifdef FIO_HAVE_SGIO
1494 .help = "SCSI generic v3 IO",
1498 .help = "Testing engine (no data transfer)",
1501 .help = "Network IO",
1504 .help = "CPU cycle burner engine",
1508 .help = "GUASI IO engine",
1511 #ifdef FIO_HAVE_BINJECT
1512 { .ival = "binject",
1513 .help = "binject direct inject block engine",
1518 .help = "RDMA IO engine",
1521 #ifdef CONFIG_FUSION_AW
1522 { .ival = "fusion-aw-sync",
1523 .help = "Fusion-io atomic write engine",
1526 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1527 { .ival = "e4defrag",
1528 .help = "ext4 defrag engine",
1531 #ifdef CONFIG_LINUX_FALLOCATE
1533 .help = "fallocate() file based engine",
1538 .help = "Glusterfs libgfapi(sync) based engine"
1540 { .ival = "gfapi_async",
1541 .help = "Glusterfs libgfapi(async) based engine"
1545 { .ival = "external",
1546 .help = "Load external engine (append name)",
1552 .lname = "IO Depth",
1553 .type = FIO_OPT_INT,
1554 .off1 = td_var_offset(iodepth),
1555 .help = "Number of IO buffers to keep in flight",
1559 .category = FIO_OPT_C_IO,
1560 .group = FIO_OPT_G_IO_BASIC,
1563 .name = "iodepth_batch",
1564 .lname = "IO Depth batch",
1565 .alias = "iodepth_batch_submit",
1566 .type = FIO_OPT_INT,
1567 .off1 = td_var_offset(iodepth_batch),
1568 .help = "Number of IO buffers to submit in one go",
1569 .parent = "iodepth",
1574 .category = FIO_OPT_C_IO,
1575 .group = FIO_OPT_G_IO_BASIC,
1578 .name = "iodepth_batch_complete",
1579 .lname = "IO Depth batch complete",
1580 .type = FIO_OPT_INT,
1581 .off1 = td_var_offset(iodepth_batch_complete),
1582 .help = "Number of IO buffers to retrieve in one go",
1583 .parent = "iodepth",
1588 .category = FIO_OPT_C_IO,
1589 .group = FIO_OPT_G_IO_BASIC,
1592 .name = "iodepth_low",
1593 .lname = "IO Depth batch low",
1594 .type = FIO_OPT_INT,
1595 .off1 = td_var_offset(iodepth_low),
1596 .help = "Low water mark for queuing depth",
1597 .parent = "iodepth",
1600 .category = FIO_OPT_C_IO,
1601 .group = FIO_OPT_G_IO_BASIC,
1606 .type = FIO_OPT_STR_VAL,
1608 .help = "Total size of device or files",
1609 .interval = 1024 * 1024,
1610 .category = FIO_OPT_C_IO,
1611 .group = FIO_OPT_G_INVALID,
1615 .lname = "IO Limit",
1616 .type = FIO_OPT_STR_VAL,
1617 .off1 = td_var_offset(io_limit),
1618 .interval = 1024 * 1024,
1619 .category = FIO_OPT_C_IO,
1620 .group = FIO_OPT_G_INVALID,
1623 .name = "fill_device",
1624 .lname = "Fill device",
1626 .type = FIO_OPT_BOOL,
1627 .off1 = td_var_offset(fill_device),
1628 .help = "Write until an ENOSPC error occurs",
1630 .category = FIO_OPT_C_FILE,
1631 .group = FIO_OPT_G_INVALID,
1635 .lname = "File size",
1636 .type = FIO_OPT_STR_VAL,
1637 .off1 = td_var_offset(file_size_low),
1638 .off2 = td_var_offset(file_size_high),
1640 .help = "Size of individual files",
1641 .interval = 1024 * 1024,
1642 .category = FIO_OPT_C_FILE,
1643 .group = FIO_OPT_G_INVALID,
1646 .name = "file_append",
1647 .lname = "File append",
1648 .type = FIO_OPT_BOOL,
1649 .off1 = td_var_offset(file_append),
1650 .help = "IO will start at the end of the file(s)",
1652 .category = FIO_OPT_C_FILE,
1653 .group = FIO_OPT_G_INVALID,
1657 .lname = "IO offset",
1658 .alias = "fileoffset",
1659 .type = FIO_OPT_STR_VAL,
1660 .off1 = td_var_offset(start_offset),
1661 .help = "Start IO from this offset",
1663 .interval = 1024 * 1024,
1664 .category = FIO_OPT_C_IO,
1665 .group = FIO_OPT_G_INVALID,
1668 .name = "offset_increment",
1669 .lname = "IO offset increment",
1670 .type = FIO_OPT_STR_VAL,
1671 .off1 = td_var_offset(offset_increment),
1672 .help = "What is the increment from one offset to the next",
1676 .interval = 1024 * 1024,
1677 .category = FIO_OPT_C_IO,
1678 .group = FIO_OPT_G_INVALID,
1681 .name = "number_ios",
1682 .lname = "Number of IOs to perform",
1683 .type = FIO_OPT_STR_VAL,
1684 .off1 = td_var_offset(number_ios),
1685 .help = "Force job completion of this number of IOs",
1687 .category = FIO_OPT_C_IO,
1688 .group = FIO_OPT_G_INVALID,
1692 .lname = "Block size",
1693 .alias = "blocksize",
1694 .type = FIO_OPT_INT,
1695 .off1 = td_var_offset(bs[DDIR_READ]),
1696 .off2 = td_var_offset(bs[DDIR_WRITE]),
1697 .off3 = td_var_offset(bs[DDIR_TRIM]),
1699 .help = "Block size unit",
1704 .category = FIO_OPT_C_IO,
1705 .group = FIO_OPT_G_INVALID,
1709 .lname = "Block size align",
1710 .alias = "blockalign",
1711 .type = FIO_OPT_INT,
1712 .off1 = td_var_offset(ba[DDIR_READ]),
1713 .off2 = td_var_offset(ba[DDIR_WRITE]),
1714 .off3 = td_var_offset(ba[DDIR_TRIM]),
1716 .help = "IO block offset alignment",
1720 .category = FIO_OPT_C_IO,
1721 .group = FIO_OPT_G_INVALID,
1725 .lname = "Block size range",
1726 .alias = "blocksize_range",
1727 .type = FIO_OPT_RANGE,
1728 .off1 = td_var_offset(min_bs[DDIR_READ]),
1729 .off2 = td_var_offset(max_bs[DDIR_READ]),
1730 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1731 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1732 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1733 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1735 .help = "Set block size range (in more detail than bs)",
1739 .category = FIO_OPT_C_IO,
1740 .group = FIO_OPT_G_INVALID,
1744 .lname = "Block size split",
1745 .type = FIO_OPT_STR,
1746 .cb = str_bssplit_cb,
1747 .help = "Set a specific mix of block sizes",
1750 .category = FIO_OPT_C_IO,
1751 .group = FIO_OPT_G_INVALID,
1754 .name = "bs_unaligned",
1755 .lname = "Block size unaligned",
1756 .alias = "blocksize_unaligned",
1757 .type = FIO_OPT_STR_SET,
1758 .off1 = td_var_offset(bs_unaligned),
1759 .help = "Don't sector align IO buffer sizes",
1762 .category = FIO_OPT_C_IO,
1763 .group = FIO_OPT_G_INVALID,
1766 .name = "bs_is_seq_rand",
1767 .lname = "Block size division is seq/random (not read/write)",
1768 .type = FIO_OPT_BOOL,
1769 .off1 = td_var_offset(bs_is_seq_rand),
1770 .help = "Consider any blocksize setting to be sequential,ramdom",
1772 .parent = "blocksize",
1773 .category = FIO_OPT_C_IO,
1774 .group = FIO_OPT_G_INVALID,
1777 .name = "randrepeat",
1778 .lname = "Random repeatable",
1779 .type = FIO_OPT_BOOL,
1780 .off1 = td_var_offset(rand_repeatable),
1781 .help = "Use repeatable random IO pattern",
1785 .category = FIO_OPT_C_IO,
1786 .group = FIO_OPT_G_RANDOM,
1790 .lname = "The random generator seed",
1791 .type = FIO_OPT_STR_VAL,
1792 .off1 = td_var_offset(rand_seed),
1793 .help = "Set the random generator seed value",
1795 .category = FIO_OPT_C_IO,
1796 .group = FIO_OPT_G_RANDOM,
1799 .name = "use_os_rand",
1800 .lname = "Use OS random",
1801 .type = FIO_OPT_BOOL,
1802 .off1 = td_var_offset(use_os_rand),
1803 .help = "Set to use OS random generator",
1807 .category = FIO_OPT_C_IO,
1808 .group = FIO_OPT_G_RANDOM,
1811 .name = "norandommap",
1812 .lname = "No randommap",
1813 .type = FIO_OPT_STR_SET,
1814 .off1 = td_var_offset(norandommap),
1815 .help = "Accept potential duplicate random blocks",
1819 .category = FIO_OPT_C_IO,
1820 .group = FIO_OPT_G_RANDOM,
1823 .name = "softrandommap",
1824 .lname = "Soft randommap",
1825 .type = FIO_OPT_BOOL,
1826 .off1 = td_var_offset(softrandommap),
1827 .help = "Set norandommap if randommap allocation fails",
1828 .parent = "norandommap",
1831 .category = FIO_OPT_C_IO,
1832 .group = FIO_OPT_G_RANDOM,
1835 .name = "random_generator",
1836 .type = FIO_OPT_STR,
1837 .off1 = td_var_offset(random_generator),
1838 .help = "Type of random number generator to use",
1839 .def = "tausworthe",
1841 { .ival = "tausworthe",
1842 .oval = FIO_RAND_GEN_TAUSWORTHE,
1843 .help = "Strong Tausworthe generator",
1846 .oval = FIO_RAND_GEN_LFSR,
1847 .help = "Variable length LFSR",
1850 .category = FIO_OPT_C_IO,
1851 .group = FIO_OPT_G_RANDOM,
1854 .name = "random_distribution",
1855 .type = FIO_OPT_STR,
1856 .off1 = td_var_offset(random_distribution),
1857 .cb = str_random_distribution_cb,
1858 .help = "Random offset distribution generator",
1862 .oval = FIO_RAND_DIST_RANDOM,
1863 .help = "Completely random",
1866 .oval = FIO_RAND_DIST_ZIPF,
1867 .help = "Zipf distribution",
1870 .oval = FIO_RAND_DIST_PARETO,
1871 .help = "Pareto distribution",
1874 .category = FIO_OPT_C_IO,
1875 .group = FIO_OPT_G_RANDOM,
1878 .name = "percentage_random",
1879 .lname = "Percentage Random",
1880 .type = FIO_OPT_INT,
1881 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1882 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1883 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1885 .help = "Percentage of seq/random mix that should be random",
1886 .def = "100,100,100",
1888 .inverse = "percentage_sequential",
1889 .category = FIO_OPT_C_IO,
1890 .group = FIO_OPT_G_RANDOM,
1893 .name = "percentage_sequential",
1894 .lname = "Percentage Sequential",
1895 .type = FIO_OPT_DEPRECATED,
1896 .category = FIO_OPT_C_IO,
1897 .group = FIO_OPT_G_RANDOM,
1900 .name = "allrandrepeat",
1901 .type = FIO_OPT_BOOL,
1902 .off1 = td_var_offset(allrand_repeatable),
1903 .help = "Use repeatable random numbers for everything",
1905 .category = FIO_OPT_C_IO,
1906 .group = FIO_OPT_G_RANDOM,
1910 .lname = "Number of files",
1911 .alias = "nr_files",
1912 .type = FIO_OPT_INT,
1913 .off1 = td_var_offset(nr_files),
1914 .help = "Split job workload between this number of files",
1917 .category = FIO_OPT_C_FILE,
1918 .group = FIO_OPT_G_INVALID,
1921 .name = "openfiles",
1922 .lname = "Number of open files",
1923 .type = FIO_OPT_INT,
1924 .off1 = td_var_offset(open_files),
1925 .help = "Number of files to keep open at the same time",
1926 .category = FIO_OPT_C_FILE,
1927 .group = FIO_OPT_G_INVALID,
1930 .name = "file_service_type",
1931 .lname = "File service type",
1932 .type = FIO_OPT_STR,
1934 .off1 = td_var_offset(file_service_type),
1935 .help = "How to select which file to service next",
1936 .def = "roundrobin",
1937 .category = FIO_OPT_C_FILE,
1938 .group = FIO_OPT_G_INVALID,
1941 .oval = FIO_FSERVICE_RANDOM,
1942 .help = "Choose a file at random",
1944 { .ival = "roundrobin",
1945 .oval = FIO_FSERVICE_RR,
1946 .help = "Round robin select files",
1948 { .ival = "sequential",
1949 .oval = FIO_FSERVICE_SEQ,
1950 .help = "Finish one file before moving to the next",
1953 .parent = "nrfiles",
1956 #ifdef CONFIG_POSIX_FALLOCATE
1958 .name = "fallocate",
1959 .lname = "Fallocate",
1960 .type = FIO_OPT_STR,
1961 .off1 = td_var_offset(fallocate_mode),
1962 .help = "Whether pre-allocation is performed when laying out files",
1964 .category = FIO_OPT_C_FILE,
1965 .group = FIO_OPT_G_INVALID,
1968 .oval = FIO_FALLOCATE_NONE,
1969 .help = "Do not pre-allocate space",
1972 .oval = FIO_FALLOCATE_POSIX,
1973 .help = "Use posix_fallocate()",
1975 #ifdef CONFIG_LINUX_FALLOCATE
1977 .oval = FIO_FALLOCATE_KEEP_SIZE,
1978 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1981 /* Compatibility with former boolean values */
1983 .oval = FIO_FALLOCATE_NONE,
1984 .help = "Alias for 'none'",
1987 .oval = FIO_FALLOCATE_POSIX,
1988 .help = "Alias for 'posix'",
1992 #endif /* CONFIG_POSIX_FALLOCATE */
1994 .name = "fadvise_hint",
1995 .lname = "Fadvise hint",
1996 .type = FIO_OPT_BOOL,
1997 .off1 = td_var_offset(fadvise_hint),
1998 .help = "Use fadvise() to advise the kernel on IO pattern",
2000 .category = FIO_OPT_C_FILE,
2001 .group = FIO_OPT_G_INVALID,
2006 .type = FIO_OPT_INT,
2007 .off1 = td_var_offset(fsync_blocks),
2008 .help = "Issue fsync for writes every given number of blocks",
2011 .category = FIO_OPT_C_FILE,
2012 .group = FIO_OPT_G_INVALID,
2015 .name = "fdatasync",
2016 .lname = "Fdatasync",
2017 .type = FIO_OPT_INT,
2018 .off1 = td_var_offset(fdatasync_blocks),
2019 .help = "Issue fdatasync for writes every given number of blocks",
2022 .category = FIO_OPT_C_FILE,
2023 .group = FIO_OPT_G_INVALID,
2026 .name = "write_barrier",
2027 .lname = "Write barrier",
2028 .type = FIO_OPT_INT,
2029 .off1 = td_var_offset(barrier_blocks),
2030 .help = "Make every Nth write a barrier write",
2033 .category = FIO_OPT_C_IO,
2034 .group = FIO_OPT_G_INVALID,
2036 #ifdef CONFIG_SYNC_FILE_RANGE
2038 .name = "sync_file_range",
2039 .lname = "Sync file range",
2041 { .ival = "wait_before",
2042 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2043 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2047 .oval = SYNC_FILE_RANGE_WRITE,
2048 .help = "SYNC_FILE_RANGE_WRITE",
2052 .ival = "wait_after",
2053 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2054 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2058 .type = FIO_OPT_STR_MULTI,
2060 .off1 = td_var_offset(sync_file_range),
2061 .help = "Use sync_file_range()",
2062 .category = FIO_OPT_C_FILE,
2063 .group = FIO_OPT_G_INVALID,
2068 .lname = "Direct I/O",
2069 .type = FIO_OPT_BOOL,
2070 .off1 = td_var_offset(odirect),
2071 .help = "Use O_DIRECT IO (negates buffered)",
2073 .inverse = "buffered",
2074 .category = FIO_OPT_C_IO,
2075 .group = FIO_OPT_G_IO_TYPE,
2079 .lname = "Atomic I/O",
2080 .type = FIO_OPT_BOOL,
2081 .off1 = td_var_offset(oatomic),
2082 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2084 .category = FIO_OPT_C_IO,
2085 .group = FIO_OPT_G_IO_TYPE,
2089 .lname = "Buffered I/O",
2090 .type = FIO_OPT_BOOL,
2091 .off1 = td_var_offset(odirect),
2093 .help = "Use buffered IO (negates direct)",
2095 .inverse = "direct",
2096 .category = FIO_OPT_C_IO,
2097 .group = FIO_OPT_G_IO_TYPE,
2100 .name = "overwrite",
2101 .lname = "Overwrite",
2102 .type = FIO_OPT_BOOL,
2103 .off1 = td_var_offset(overwrite),
2104 .help = "When writing, set whether to overwrite current data",
2106 .category = FIO_OPT_C_FILE,
2107 .group = FIO_OPT_G_INVALID,
2112 .type = FIO_OPT_INT,
2113 .off1 = td_var_offset(loops),
2114 .help = "Number of times to run the job",
2117 .category = FIO_OPT_C_GENERAL,
2118 .group = FIO_OPT_G_RUNTIME,
2122 .lname = "Number of jobs",
2123 .type = FIO_OPT_INT,
2124 .off1 = td_var_offset(numjobs),
2125 .help = "Duplicate this job this many times",
2128 .category = FIO_OPT_C_GENERAL,
2129 .group = FIO_OPT_G_RUNTIME,
2132 .name = "startdelay",
2133 .lname = "Start delay",
2134 .type = FIO_OPT_STR_VAL_TIME,
2135 .off1 = td_var_offset(start_delay),
2136 .off2 = td_var_offset(start_delay_high),
2137 .help = "Only start job when this period has passed",
2140 .category = FIO_OPT_C_GENERAL,
2141 .group = FIO_OPT_G_RUNTIME,
2147 .type = FIO_OPT_STR_VAL_TIME,
2148 .off1 = td_var_offset(timeout),
2149 .help = "Stop workload when this amount of time has passed",
2152 .category = FIO_OPT_C_GENERAL,
2153 .group = FIO_OPT_G_RUNTIME,
2156 .name = "time_based",
2157 .lname = "Time based",
2158 .type = FIO_OPT_STR_SET,
2159 .off1 = td_var_offset(time_based),
2160 .help = "Keep running until runtime/timeout is met",
2161 .category = FIO_OPT_C_GENERAL,
2162 .group = FIO_OPT_G_RUNTIME,
2165 .name = "verify_only",
2166 .lname = "Verify only",
2167 .type = FIO_OPT_STR_SET,
2168 .off1 = td_var_offset(verify_only),
2169 .help = "Verifies previously written data is still valid",
2170 .category = FIO_OPT_C_GENERAL,
2171 .group = FIO_OPT_G_RUNTIME,
2174 .name = "ramp_time",
2175 .lname = "Ramp time",
2176 .type = FIO_OPT_STR_VAL_TIME,
2177 .off1 = td_var_offset(ramp_time),
2178 .help = "Ramp up time before measuring performance",
2180 .category = FIO_OPT_C_GENERAL,
2181 .group = FIO_OPT_G_RUNTIME,
2184 .name = "clocksource",
2185 .lname = "Clock source",
2186 .type = FIO_OPT_STR,
2187 .cb = fio_clock_source_cb,
2188 .off1 = td_var_offset(clocksource),
2189 .help = "What type of timing source to use",
2190 .category = FIO_OPT_C_GENERAL,
2191 .group = FIO_OPT_G_CLOCK,
2193 #ifdef CONFIG_GETTIMEOFDAY
2194 { .ival = "gettimeofday",
2196 .help = "Use gettimeofday(2) for timing",
2199 #ifdef CONFIG_CLOCK_GETTIME
2200 { .ival = "clock_gettime",
2201 .oval = CS_CGETTIME,
2202 .help = "Use clock_gettime(2) for timing",
2205 #ifdef ARCH_HAVE_CPU_CLOCK
2207 .oval = CS_CPUCLOCK,
2208 .help = "Use CPU private clock",
2216 .lname = "I/O Memory",
2217 .type = FIO_OPT_STR,
2219 .off1 = td_var_offset(mem_type),
2220 .help = "Backing type for IO buffers",
2222 .category = FIO_OPT_C_IO,
2223 .group = FIO_OPT_G_INVALID,
2227 .help = "Use malloc(3) for IO buffers",
2229 #ifndef CONFIG_NO_SHM
2232 .help = "Use shared memory segments for IO buffers",
2234 #ifdef FIO_HAVE_HUGETLB
2235 { .ival = "shmhuge",
2236 .oval = MEM_SHMHUGE,
2237 .help = "Like shm, but use huge pages",
2243 .help = "Use mmap(2) (file or anon) for IO buffers",
2245 #ifdef FIO_HAVE_HUGETLB
2246 { .ival = "mmaphuge",
2247 .oval = MEM_MMAPHUGE,
2248 .help = "Like mmap, but use huge pages",
2254 .name = "iomem_align",
2255 .alias = "mem_align",
2256 .lname = "I/O memory alignment",
2257 .type = FIO_OPT_INT,
2258 .off1 = td_var_offset(mem_align),
2260 .help = "IO memory buffer offset alignment",
2264 .category = FIO_OPT_C_IO,
2265 .group = FIO_OPT_G_INVALID,
2270 .type = FIO_OPT_STR,
2271 .off1 = td_var_offset(verify),
2272 .help = "Verify data written",
2274 .category = FIO_OPT_C_IO,
2275 .group = FIO_OPT_G_VERIFY,
2278 .oval = VERIFY_NONE,
2279 .help = "Don't do IO verification",
2283 .help = "Use md5 checksums for verification",
2286 .oval = VERIFY_CRC64,
2287 .help = "Use crc64 checksums for verification",
2290 .oval = VERIFY_CRC32,
2291 .help = "Use crc32 checksums for verification",
2293 { .ival = "crc32c-intel",
2294 .oval = VERIFY_CRC32C,
2295 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2298 .oval = VERIFY_CRC32C,
2299 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2302 .oval = VERIFY_CRC16,
2303 .help = "Use crc16 checksums for verification",
2306 .oval = VERIFY_CRC7,
2307 .help = "Use crc7 checksums for verification",
2310 .oval = VERIFY_SHA1,
2311 .help = "Use sha1 checksums for verification",
2314 .oval = VERIFY_SHA256,
2315 .help = "Use sha256 checksums for verification",
2318 .oval = VERIFY_SHA512,
2319 .help = "Use sha512 checksums for verification",
2322 .oval = VERIFY_XXHASH,
2323 .help = "Use xxhash checksums for verification",
2326 .oval = VERIFY_META,
2327 .help = "Use io information",
2331 .oval = VERIFY_NULL,
2332 .help = "Pretend to verify",
2337 .name = "do_verify",
2338 .lname = "Perform verify step",
2339 .type = FIO_OPT_BOOL,
2340 .off1 = td_var_offset(do_verify),
2341 .help = "Run verification stage after write",
2345 .category = FIO_OPT_C_IO,
2346 .group = FIO_OPT_G_VERIFY,
2349 .name = "verifysort",
2350 .lname = "Verify sort",
2351 .type = FIO_OPT_BOOL,
2352 .off1 = td_var_offset(verifysort),
2353 .help = "Sort written verify blocks for read back",
2357 .category = FIO_OPT_C_IO,
2358 .group = FIO_OPT_G_VERIFY,
2361 .name = "verifysort_nr",
2362 .type = FIO_OPT_INT,
2363 .off1 = td_var_offset(verifysort_nr),
2364 .help = "Pre-load and sort verify blocks for a read workload",
2369 .category = FIO_OPT_C_IO,
2370 .group = FIO_OPT_G_VERIFY,
2373 .name = "verify_interval",
2374 .lname = "Verify interval",
2375 .type = FIO_OPT_INT,
2376 .off1 = td_var_offset(verify_interval),
2377 .minval = 2 * sizeof(struct verify_header),
2378 .help = "Store verify buffer header every N bytes",
2381 .interval = 2 * sizeof(struct verify_header),
2382 .category = FIO_OPT_C_IO,
2383 .group = FIO_OPT_G_VERIFY,
2386 .name = "verify_offset",
2387 .lname = "Verify offset",
2388 .type = FIO_OPT_INT,
2389 .help = "Offset verify header location by N bytes",
2390 .off1 = td_var_offset(verify_offset),
2391 .minval = sizeof(struct verify_header),
2394 .category = FIO_OPT_C_IO,
2395 .group = FIO_OPT_G_VERIFY,
2398 .name = "verify_pattern",
2399 .lname = "Verify pattern",
2400 .type = FIO_OPT_STR,
2401 .cb = str_verify_pattern_cb,
2402 .help = "Fill pattern for IO buffers",
2405 .category = FIO_OPT_C_IO,
2406 .group = FIO_OPT_G_VERIFY,
2409 .name = "verify_fatal",
2410 .lname = "Verify fatal",
2411 .type = FIO_OPT_BOOL,
2412 .off1 = td_var_offset(verify_fatal),
2414 .help = "Exit on a single verify failure, don't continue",
2417 .category = FIO_OPT_C_IO,
2418 .group = FIO_OPT_G_VERIFY,
2421 .name = "verify_dump",
2422 .lname = "Verify dump",
2423 .type = FIO_OPT_BOOL,
2424 .off1 = td_var_offset(verify_dump),
2426 .help = "Dump contents of good and bad blocks on failure",
2429 .category = FIO_OPT_C_IO,
2430 .group = FIO_OPT_G_VERIFY,
2433 .name = "verify_async",
2434 .lname = "Verify asynchronously",
2435 .type = FIO_OPT_INT,
2436 .off1 = td_var_offset(verify_async),
2438 .help = "Number of async verifier threads to use",
2441 .category = FIO_OPT_C_IO,
2442 .group = FIO_OPT_G_VERIFY,
2445 .name = "verify_backlog",
2446 .lname = "Verify backlog",
2447 .type = FIO_OPT_STR_VAL,
2448 .off1 = td_var_offset(verify_backlog),
2449 .help = "Verify after this number of blocks are written",
2452 .category = FIO_OPT_C_IO,
2453 .group = FIO_OPT_G_VERIFY,
2456 .name = "verify_backlog_batch",
2457 .lname = "Verify backlog batch",
2458 .type = FIO_OPT_INT,
2459 .off1 = td_var_offset(verify_batch),
2460 .help = "Verify this number of IO blocks",
2463 .category = FIO_OPT_C_IO,
2464 .group = FIO_OPT_G_VERIFY,
2466 #ifdef FIO_HAVE_CPU_AFFINITY
2468 .name = "verify_async_cpus",
2469 .lname = "Async verify CPUs",
2470 .type = FIO_OPT_STR,
2471 .cb = str_verify_cpus_allowed_cb,
2472 .help = "Set CPUs allowed for async verify threads",
2473 .parent = "verify_async",
2475 .category = FIO_OPT_C_IO,
2476 .group = FIO_OPT_G_VERIFY,
2480 .name = "experimental_verify",
2481 .off1 = td_var_offset(experimental_verify),
2482 .type = FIO_OPT_BOOL,
2483 .help = "Enable experimental verification",
2484 .category = FIO_OPT_C_IO,
2485 .group = FIO_OPT_G_VERIFY,
2487 #ifdef FIO_HAVE_TRIM
2489 .name = "trim_percentage",
2490 .lname = "Trim percentage",
2491 .type = FIO_OPT_INT,
2492 .off1 = td_var_offset(trim_percentage),
2495 .help = "Number of verify blocks to discard/trim",
2500 .category = FIO_OPT_C_IO,
2501 .group = FIO_OPT_G_TRIM,
2504 .name = "trim_verify_zero",
2505 .lname = "Verify trim zero",
2506 .type = FIO_OPT_BOOL,
2507 .help = "Verify that trim/discarded blocks are returned as zeroes",
2508 .off1 = td_var_offset(trim_zero),
2509 .parent = "trim_percentage",
2512 .category = FIO_OPT_C_IO,
2513 .group = FIO_OPT_G_TRIM,
2516 .name = "trim_backlog",
2517 .lname = "Trim backlog",
2518 .type = FIO_OPT_STR_VAL,
2519 .off1 = td_var_offset(trim_backlog),
2520 .help = "Trim after this number of blocks are written",
2521 .parent = "trim_percentage",
2524 .category = FIO_OPT_C_IO,
2525 .group = FIO_OPT_G_TRIM,
2528 .name = "trim_backlog_batch",
2529 .lname = "Trim backlog batch",
2530 .type = FIO_OPT_INT,
2531 .off1 = td_var_offset(trim_batch),
2532 .help = "Trim this number of IO blocks",
2533 .parent = "trim_percentage",
2536 .category = FIO_OPT_C_IO,
2537 .group = FIO_OPT_G_TRIM,
2541 .name = "write_iolog",
2542 .lname = "Write I/O log",
2543 .type = FIO_OPT_STR_STORE,
2544 .off1 = td_var_offset(write_iolog_file),
2545 .help = "Store IO pattern to file",
2546 .category = FIO_OPT_C_IO,
2547 .group = FIO_OPT_G_IOLOG,
2550 .name = "read_iolog",
2551 .lname = "Read I/O log",
2552 .type = FIO_OPT_STR_STORE,
2553 .off1 = td_var_offset(read_iolog_file),
2554 .help = "Playback IO pattern from file",
2555 .category = FIO_OPT_C_IO,
2556 .group = FIO_OPT_G_IOLOG,
2559 .name = "replay_no_stall",
2560 .lname = "Don't stall on replay",
2561 .type = FIO_OPT_BOOL,
2562 .off1 = td_var_offset(no_stall),
2564 .parent = "read_iolog",
2566 .help = "Playback IO pattern file as fast as possible without stalls",
2567 .category = FIO_OPT_C_IO,
2568 .group = FIO_OPT_G_IOLOG,
2571 .name = "replay_redirect",
2572 .lname = "Redirect device for replay",
2573 .type = FIO_OPT_STR_STORE,
2574 .off1 = td_var_offset(replay_redirect),
2575 .parent = "read_iolog",
2577 .help = "Replay all I/O onto this device, regardless of trace device",
2578 .category = FIO_OPT_C_IO,
2579 .group = FIO_OPT_G_IOLOG,
2582 .name = "exec_prerun",
2583 .lname = "Pre-execute runnable",
2584 .type = FIO_OPT_STR_STORE,
2585 .off1 = td_var_offset(exec_prerun),
2586 .help = "Execute this file prior to running job",
2587 .category = FIO_OPT_C_GENERAL,
2588 .group = FIO_OPT_G_INVALID,
2591 .name = "exec_postrun",
2592 .lname = "Post-execute runnable",
2593 .type = FIO_OPT_STR_STORE,
2594 .off1 = td_var_offset(exec_postrun),
2595 .help = "Execute this file after running job",
2596 .category = FIO_OPT_C_GENERAL,
2597 .group = FIO_OPT_G_INVALID,
2599 #ifdef FIO_HAVE_IOSCHED_SWITCH
2601 .name = "ioscheduler",
2602 .lname = "I/O scheduler",
2603 .type = FIO_OPT_STR_STORE,
2604 .off1 = td_var_offset(ioscheduler),
2605 .help = "Use this IO scheduler on the backing device",
2606 .category = FIO_OPT_C_FILE,
2607 .group = FIO_OPT_G_INVALID,
2612 .lname = "Zone size",
2613 .type = FIO_OPT_STR_VAL,
2614 .off1 = td_var_offset(zone_size),
2615 .help = "Amount of data to read per zone",
2617 .interval = 1024 * 1024,
2618 .category = FIO_OPT_C_IO,
2619 .group = FIO_OPT_G_ZONE,
2622 .name = "zonerange",
2623 .lname = "Zone range",
2624 .type = FIO_OPT_STR_VAL,
2625 .off1 = td_var_offset(zone_range),
2626 .help = "Give size of an IO zone",
2628 .interval = 1024 * 1024,
2629 .category = FIO_OPT_C_IO,
2630 .group = FIO_OPT_G_ZONE,
2634 .lname = "Zone skip",
2635 .type = FIO_OPT_STR_VAL,
2636 .off1 = td_var_offset(zone_skip),
2637 .help = "Space between IO zones",
2639 .interval = 1024 * 1024,
2640 .category = FIO_OPT_C_IO,
2641 .group = FIO_OPT_G_ZONE,
2645 .lname = "Lock memory",
2646 .type = FIO_OPT_STR_VAL,
2647 .off1 = td_var_offset(lockmem),
2648 .help = "Lock down this amount of memory (per worker)",
2650 .interval = 1024 * 1024,
2651 .category = FIO_OPT_C_GENERAL,
2652 .group = FIO_OPT_G_INVALID,
2655 .name = "rwmixread",
2656 .lname = "Read/write mix read",
2657 .type = FIO_OPT_INT,
2658 .cb = str_rwmix_read_cb,
2660 .help = "Percentage of mixed workload that is reads",
2663 .inverse = "rwmixwrite",
2664 .category = FIO_OPT_C_IO,
2665 .group = FIO_OPT_G_RWMIX,
2668 .name = "rwmixwrite",
2669 .lname = "Read/write mix write",
2670 .type = FIO_OPT_INT,
2671 .cb = str_rwmix_write_cb,
2673 .help = "Percentage of mixed workload that is writes",
2676 .inverse = "rwmixread",
2677 .category = FIO_OPT_C_IO,
2678 .group = FIO_OPT_G_RWMIX,
2681 .name = "rwmixcycle",
2682 .lname = "Read/write mix cycle",
2683 .type = FIO_OPT_DEPRECATED,
2684 .category = FIO_OPT_C_IO,
2685 .group = FIO_OPT_G_RWMIX,
2690 .type = FIO_OPT_INT,
2691 .off1 = td_var_offset(nice),
2692 .help = "Set job CPU nice value",
2697 .category = FIO_OPT_C_GENERAL,
2698 .group = FIO_OPT_G_CRED,
2700 #ifdef FIO_HAVE_IOPRIO
2703 .lname = "I/O nice priority",
2704 .type = FIO_OPT_INT,
2705 .off1 = td_var_offset(ioprio),
2706 .help = "Set job IO priority value",
2710 .category = FIO_OPT_C_GENERAL,
2711 .group = FIO_OPT_G_CRED,
2714 .name = "prioclass",
2715 .lname = "I/O nice priority class",
2716 .type = FIO_OPT_INT,
2717 .off1 = td_var_offset(ioprio_class),
2718 .help = "Set job IO priority class",
2722 .category = FIO_OPT_C_GENERAL,
2723 .group = FIO_OPT_G_CRED,
2727 .name = "thinktime",
2728 .lname = "Thinktime",
2729 .type = FIO_OPT_INT,
2730 .off1 = td_var_offset(thinktime),
2731 .help = "Idle time between IO buffers (usec)",
2733 .category = FIO_OPT_C_IO,
2734 .group = FIO_OPT_G_THINKTIME,
2737 .name = "thinktime_spin",
2738 .lname = "Thinktime spin",
2739 .type = FIO_OPT_INT,
2740 .off1 = td_var_offset(thinktime_spin),
2741 .help = "Start think time by spinning this amount (usec)",
2743 .parent = "thinktime",
2745 .category = FIO_OPT_C_IO,
2746 .group = FIO_OPT_G_THINKTIME,
2749 .name = "thinktime_blocks",
2750 .lname = "Thinktime blocks",
2751 .type = FIO_OPT_INT,
2752 .off1 = td_var_offset(thinktime_blocks),
2753 .help = "IO buffer period between 'thinktime'",
2755 .parent = "thinktime",
2757 .category = FIO_OPT_C_IO,
2758 .group = FIO_OPT_G_THINKTIME,
2762 .lname = "I/O rate",
2763 .type = FIO_OPT_INT,
2764 .off1 = td_var_offset(rate[DDIR_READ]),
2765 .off2 = td_var_offset(rate[DDIR_WRITE]),
2766 .off3 = td_var_offset(rate[DDIR_TRIM]),
2767 .help = "Set bandwidth rate",
2768 .category = FIO_OPT_C_IO,
2769 .group = FIO_OPT_G_RATE,
2773 .lname = "I/O min rate",
2774 .type = FIO_OPT_INT,
2775 .off1 = td_var_offset(ratemin[DDIR_READ]),
2776 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2777 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2778 .help = "Job must meet this rate or it will be shutdown",
2781 .category = FIO_OPT_C_IO,
2782 .group = FIO_OPT_G_RATE,
2785 .name = "rate_iops",
2786 .lname = "I/O rate IOPS",
2787 .type = FIO_OPT_INT,
2788 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2789 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2790 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2791 .help = "Limit IO used to this number of IO operations/sec",
2793 .category = FIO_OPT_C_IO,
2794 .group = FIO_OPT_G_RATE,
2797 .name = "rate_iops_min",
2798 .lname = "I/O min rate IOPS",
2799 .type = FIO_OPT_INT,
2800 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2801 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2802 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2803 .help = "Job must meet this rate or it will be shut down",
2804 .parent = "rate_iops",
2806 .category = FIO_OPT_C_IO,
2807 .group = FIO_OPT_G_RATE,
2810 .name = "ratecycle",
2811 .lname = "I/O rate cycle",
2812 .type = FIO_OPT_INT,
2813 .off1 = td_var_offset(ratecycle),
2814 .help = "Window average for rate limits (msec)",
2818 .category = FIO_OPT_C_IO,
2819 .group = FIO_OPT_G_RATE,
2822 .name = "max_latency",
2823 .type = FIO_OPT_INT,
2824 .off1 = td_var_offset(max_latency),
2825 .help = "Maximum tolerated IO latency (usec)",
2826 .category = FIO_OPT_C_IO,
2827 .group = FIO_OPT_G_LATPROF,
2830 .name = "latency_target",
2831 .lname = "Latency Target (usec)",
2832 .type = FIO_OPT_STR_VAL_TIME,
2833 .off1 = td_var_offset(latency_target),
2834 .help = "Ramp to max queue depth supporting this latency",
2835 .category = FIO_OPT_C_IO,
2836 .group = FIO_OPT_G_LATPROF,
2839 .name = "latency_window",
2840 .lname = "Latency Window (usec)",
2841 .type = FIO_OPT_STR_VAL_TIME,
2842 .off1 = td_var_offset(latency_window),
2843 .help = "Time to sustain latency_target",
2844 .category = FIO_OPT_C_IO,
2845 .group = FIO_OPT_G_LATPROF,
2848 .name = "latency_percentile",
2849 .lname = "Latency Percentile",
2850 .type = FIO_OPT_FLOAT_LIST,
2851 .off1 = td_var_offset(latency_percentile),
2852 .help = "Percentile of IOs must be below latency_target",
2857 .category = FIO_OPT_C_IO,
2858 .group = FIO_OPT_G_LATPROF,
2861 .name = "invalidate",
2862 .lname = "Cache invalidate",
2863 .type = FIO_OPT_BOOL,
2864 .off1 = td_var_offset(invalidate_cache),
2865 .help = "Invalidate buffer/page cache prior to running job",
2867 .category = FIO_OPT_C_IO,
2868 .group = FIO_OPT_G_IO_TYPE,
2872 .lname = "Synchronous I/O",
2873 .type = FIO_OPT_BOOL,
2874 .off1 = td_var_offset(sync_io),
2875 .help = "Use O_SYNC for buffered writes",
2877 .parent = "buffered",
2879 .category = FIO_OPT_C_IO,
2880 .group = FIO_OPT_G_IO_TYPE,
2883 .name = "create_serialize",
2884 .lname = "Create serialize",
2885 .type = FIO_OPT_BOOL,
2886 .off1 = td_var_offset(create_serialize),
2887 .help = "Serialize creating of job files",
2889 .category = FIO_OPT_C_FILE,
2890 .group = FIO_OPT_G_INVALID,
2893 .name = "create_fsync",
2894 .lname = "Create fsync",
2895 .type = FIO_OPT_BOOL,
2896 .off1 = td_var_offset(create_fsync),
2897 .help = "fsync file after creation",
2899 .category = FIO_OPT_C_FILE,
2900 .group = FIO_OPT_G_INVALID,
2903 .name = "create_on_open",
2904 .lname = "Create on open",
2905 .type = FIO_OPT_BOOL,
2906 .off1 = td_var_offset(create_on_open),
2907 .help = "Create files when they are opened for IO",
2909 .category = FIO_OPT_C_FILE,
2910 .group = FIO_OPT_G_INVALID,
2913 .name = "create_only",
2914 .type = FIO_OPT_BOOL,
2915 .off1 = td_var_offset(create_only),
2916 .help = "Only perform file creation phase",
2917 .category = FIO_OPT_C_FILE,
2922 .lname = "Pre-read files",
2923 .type = FIO_OPT_BOOL,
2924 .off1 = td_var_offset(pre_read),
2925 .help = "Pre-read files before starting official testing",
2927 .category = FIO_OPT_C_FILE,
2928 .group = FIO_OPT_G_INVALID,
2930 #ifdef FIO_HAVE_CPU_AFFINITY
2933 .lname = "CPU mask",
2934 .type = FIO_OPT_INT,
2935 .cb = str_cpumask_cb,
2936 .help = "CPU affinity mask",
2937 .category = FIO_OPT_C_GENERAL,
2938 .group = FIO_OPT_G_CRED,
2941 .name = "cpus_allowed",
2942 .lname = "CPUs allowed",
2943 .type = FIO_OPT_STR,
2944 .cb = str_cpus_allowed_cb,
2945 .help = "Set CPUs allowed",
2946 .category = FIO_OPT_C_GENERAL,
2947 .group = FIO_OPT_G_CRED,
2950 .name = "cpus_allowed_policy",
2951 .lname = "CPUs allowed distribution policy",
2952 .type = FIO_OPT_STR,
2953 .off1 = td_var_offset(cpus_allowed_policy),
2954 .help = "Distribution policy for cpus_allowed",
2955 .parent = "cpus_allowed",
2959 .oval = FIO_CPUS_SHARED,
2960 .help = "Mask shared between threads",
2963 .oval = FIO_CPUS_SPLIT,
2964 .help = "Mask split between threads",
2967 .category = FIO_OPT_C_GENERAL,
2968 .group = FIO_OPT_G_CRED,
2971 #ifdef CONFIG_LIBNUMA
2973 .name = "numa_cpu_nodes",
2974 .type = FIO_OPT_STR,
2975 .cb = str_numa_cpunodes_cb,
2976 .help = "NUMA CPU nodes bind",
2977 .category = FIO_OPT_C_GENERAL,
2978 .group = FIO_OPT_G_INVALID,
2981 .name = "numa_mem_policy",
2982 .type = FIO_OPT_STR,
2983 .cb = str_numa_mpol_cb,
2984 .help = "NUMA memory policy setup",
2985 .category = FIO_OPT_C_GENERAL,
2986 .group = FIO_OPT_G_INVALID,
2990 .name = "end_fsync",
2991 .lname = "End fsync",
2992 .type = FIO_OPT_BOOL,
2993 .off1 = td_var_offset(end_fsync),
2994 .help = "Include fsync at the end of job",
2996 .category = FIO_OPT_C_FILE,
2997 .group = FIO_OPT_G_INVALID,
3000 .name = "fsync_on_close",
3001 .lname = "Fsync on close",
3002 .type = FIO_OPT_BOOL,
3003 .off1 = td_var_offset(fsync_on_close),
3004 .help = "fsync files on close",
3006 .category = FIO_OPT_C_FILE,
3007 .group = FIO_OPT_G_INVALID,
3011 .lname = "Unlink file",
3012 .type = FIO_OPT_BOOL,
3013 .off1 = td_var_offset(unlink),
3014 .help = "Unlink created files after job has completed",
3016 .category = FIO_OPT_C_FILE,
3017 .group = FIO_OPT_G_INVALID,
3021 .lname = "Exit-all on terminate",
3022 .type = FIO_OPT_STR_SET,
3023 .cb = str_exitall_cb,
3024 .help = "Terminate all jobs when one exits",
3025 .category = FIO_OPT_C_GENERAL,
3026 .group = FIO_OPT_G_PROCESS,
3029 .name = "stonewall",
3030 .lname = "Wait for previous",
3031 .alias = "wait_for_previous",
3032 .type = FIO_OPT_STR_SET,
3033 .off1 = td_var_offset(stonewall),
3034 .help = "Insert a hard barrier between this job and previous",
3035 .category = FIO_OPT_C_GENERAL,
3036 .group = FIO_OPT_G_PROCESS,
3039 .name = "new_group",
3040 .lname = "New group",
3041 .type = FIO_OPT_STR_SET,
3042 .off1 = td_var_offset(new_group),
3043 .help = "Mark the start of a new group (for reporting)",
3044 .category = FIO_OPT_C_GENERAL,
3045 .group = FIO_OPT_G_PROCESS,
3050 .type = FIO_OPT_STR_SET,
3051 .off1 = td_var_offset(use_thread),
3052 .help = "Use threads instead of processes",
3053 #ifdef CONFIG_NO_SHM
3057 .category = FIO_OPT_C_GENERAL,
3058 .group = FIO_OPT_G_PROCESS,
3061 .name = "write_bw_log",
3062 .lname = "Write bandwidth log",
3063 .type = FIO_OPT_STR_STORE,
3064 .off1 = td_var_offset(bw_log_file),
3065 .help = "Write log of bandwidth during run",
3066 .category = FIO_OPT_C_LOG,
3067 .group = FIO_OPT_G_INVALID,
3070 .name = "write_lat_log",
3071 .lname = "Write latency log",
3072 .type = FIO_OPT_STR_STORE,
3073 .off1 = td_var_offset(lat_log_file),
3074 .help = "Write log of latency during run",
3075 .category = FIO_OPT_C_LOG,
3076 .group = FIO_OPT_G_INVALID,
3079 .name = "write_iops_log",
3080 .lname = "Write IOPS log",
3081 .type = FIO_OPT_STR_STORE,
3082 .off1 = td_var_offset(iops_log_file),
3083 .help = "Write log of IOPS during run",
3084 .category = FIO_OPT_C_LOG,
3085 .group = FIO_OPT_G_INVALID,
3088 .name = "log_avg_msec",
3089 .lname = "Log averaging (msec)",
3090 .type = FIO_OPT_INT,
3091 .off1 = td_var_offset(log_avg_msec),
3092 .help = "Average bw/iops/lat logs over this period of time",
3094 .category = FIO_OPT_C_LOG,
3095 .group = FIO_OPT_G_INVALID,
3098 .name = "log_offset",
3099 .lname = "Log offset of IO",
3100 .type = FIO_OPT_BOOL,
3101 .off1 = td_var_offset(log_offset),
3102 .help = "Include offset of IO for each log entry",
3104 .category = FIO_OPT_C_LOG,
3105 .group = FIO_OPT_G_INVALID,
3109 .name = "log_compression",
3110 .lname = "Log compression",
3111 .type = FIO_OPT_INT,
3112 .off1 = td_var_offset(log_gz),
3113 .help = "Log in compressed chunks of this size",
3114 .minval = 32 * 1024 * 1024ULL,
3115 .maxval = 512 * 1024 * 1024ULL,
3116 .category = FIO_OPT_C_LOG,
3117 .group = FIO_OPT_G_INVALID,
3120 .name = "log_store_compressed",
3121 .lname = "Log store compressed",
3122 .type = FIO_OPT_BOOL,
3123 .off1 = td_var_offset(log_gz_store),
3124 .help = "Store logs in a compressed format",
3125 .category = FIO_OPT_C_LOG,
3126 .group = FIO_OPT_G_INVALID,
3130 .name = "bwavgtime",
3131 .lname = "Bandwidth average time",
3132 .type = FIO_OPT_INT,
3133 .off1 = td_var_offset(bw_avg_time),
3134 .help = "Time window over which to calculate bandwidth"
3137 .parent = "write_bw_log",
3140 .category = FIO_OPT_C_LOG,
3141 .group = FIO_OPT_G_INVALID,
3144 .name = "iopsavgtime",
3145 .lname = "IOPS average time",
3146 .type = FIO_OPT_INT,
3147 .off1 = td_var_offset(iops_avg_time),
3148 .help = "Time window over which to calculate IOPS (msec)",
3150 .parent = "write_iops_log",
3153 .category = FIO_OPT_C_LOG,
3154 .group = FIO_OPT_G_INVALID,
3157 .name = "group_reporting",
3158 .lname = "Group reporting",
3159 .type = FIO_OPT_STR_SET,
3160 .off1 = td_var_offset(group_reporting),
3161 .help = "Do reporting on a per-group basis",
3162 .category = FIO_OPT_C_STAT,
3163 .group = FIO_OPT_G_INVALID,
3166 .name = "zero_buffers",
3167 .lname = "Zero I/O buffers",
3168 .type = FIO_OPT_STR_SET,
3169 .off1 = td_var_offset(zero_buffers),
3170 .help = "Init IO buffers to all zeroes",
3171 .category = FIO_OPT_C_IO,
3172 .group = FIO_OPT_G_IO_BUF,
3175 .name = "refill_buffers",
3176 .lname = "Refill I/O buffers",
3177 .type = FIO_OPT_STR_SET,
3178 .off1 = td_var_offset(refill_buffers),
3179 .help = "Refill IO buffers on every IO submit",
3180 .category = FIO_OPT_C_IO,
3181 .group = FIO_OPT_G_IO_BUF,
3184 .name = "scramble_buffers",
3185 .lname = "Scramble I/O buffers",
3186 .type = FIO_OPT_BOOL,
3187 .off1 = td_var_offset(scramble_buffers),
3188 .help = "Slightly scramble buffers on every IO submit",
3190 .category = FIO_OPT_C_IO,
3191 .group = FIO_OPT_G_IO_BUF,
3194 .name = "buffer_pattern",
3195 .lname = "Buffer pattern",
3196 .type = FIO_OPT_STR,
3197 .cb = str_buffer_pattern_cb,
3198 .help = "Fill pattern for IO buffers",
3199 .category = FIO_OPT_C_IO,
3200 .group = FIO_OPT_G_IO_BUF,
3203 .name = "buffer_compress_percentage",
3204 .lname = "Buffer compression percentage",
3205 .type = FIO_OPT_INT,
3206 .cb = str_buffer_compress_cb,
3209 .help = "How compressible the buffer is (approximately)",
3211 .category = FIO_OPT_C_IO,
3212 .group = FIO_OPT_G_IO_BUF,
3215 .name = "buffer_compress_chunk",
3216 .lname = "Buffer compression chunk size",
3217 .type = FIO_OPT_INT,
3218 .off1 = td_var_offset(compress_chunk),
3219 .parent = "buffer_compress_percentage",
3221 .help = "Size of compressible region in buffer",
3223 .category = FIO_OPT_C_IO,
3224 .group = FIO_OPT_G_IO_BUF,
3227 .name = "clat_percentiles",
3228 .lname = "Completion latency percentiles",
3229 .type = FIO_OPT_BOOL,
3230 .off1 = td_var_offset(clat_percentiles),
3231 .help = "Enable the reporting of completion latency percentiles",
3233 .category = FIO_OPT_C_STAT,
3234 .group = FIO_OPT_G_INVALID,
3237 .name = "percentile_list",
3238 .lname = "Completion latency percentile list",
3239 .type = FIO_OPT_FLOAT_LIST,
3240 .off1 = td_var_offset(percentile_list),
3241 .off2 = td_var_offset(percentile_precision),
3242 .help = "Specify a custom list of percentiles to report",
3243 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3244 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3247 .category = FIO_OPT_C_STAT,
3248 .group = FIO_OPT_G_INVALID,
3251 #ifdef FIO_HAVE_DISK_UTIL
3253 .name = "disk_util",
3254 .lname = "Disk utilization",
3255 .type = FIO_OPT_BOOL,
3256 .off1 = td_var_offset(do_disk_util),
3257 .help = "Log disk utilization statistics",
3259 .category = FIO_OPT_C_STAT,
3260 .group = FIO_OPT_G_INVALID,
3264 .name = "gtod_reduce",
3265 .lname = "Reduce gettimeofday() calls",
3266 .type = FIO_OPT_BOOL,
3267 .help = "Greatly reduce number of gettimeofday() calls",
3268 .cb = str_gtod_reduce_cb,
3271 .category = FIO_OPT_C_STAT,
3272 .group = FIO_OPT_G_INVALID,
3275 .name = "disable_lat",
3276 .lname = "Disable all latency stats",
3277 .type = FIO_OPT_BOOL,
3278 .off1 = td_var_offset(disable_lat),
3279 .help = "Disable latency numbers",
3280 .parent = "gtod_reduce",
3283 .category = FIO_OPT_C_STAT,
3284 .group = FIO_OPT_G_INVALID,
3287 .name = "disable_clat",
3288 .lname = "Disable completion latency stats",
3289 .type = FIO_OPT_BOOL,
3290 .off1 = td_var_offset(disable_clat),
3291 .help = "Disable completion latency numbers",
3292 .parent = "gtod_reduce",
3295 .category = FIO_OPT_C_STAT,
3296 .group = FIO_OPT_G_INVALID,
3299 .name = "disable_slat",
3300 .lname = "Disable submission latency stats",
3301 .type = FIO_OPT_BOOL,
3302 .off1 = td_var_offset(disable_slat),
3303 .help = "Disable submission latency numbers",
3304 .parent = "gtod_reduce",
3307 .category = FIO_OPT_C_STAT,
3308 .group = FIO_OPT_G_INVALID,
3311 .name = "disable_bw_measurement",
3312 .lname = "Disable bandwidth stats",
3313 .type = FIO_OPT_BOOL,
3314 .off1 = td_var_offset(disable_bw),
3315 .help = "Disable bandwidth logging",
3316 .parent = "gtod_reduce",
3319 .category = FIO_OPT_C_STAT,
3320 .group = FIO_OPT_G_INVALID,
3324 .lname = "Dedicated gettimeofday() CPU",
3325 .type = FIO_OPT_INT,
3326 .cb = str_gtod_cpu_cb,
3327 .help = "Set up dedicated gettimeofday() thread on this CPU",
3328 .verify = gtod_cpu_verify,
3329 .category = FIO_OPT_C_GENERAL,
3330 .group = FIO_OPT_G_CLOCK,
3333 .name = "unified_rw_reporting",
3334 .type = FIO_OPT_BOOL,
3335 .off1 = td_var_offset(unified_rw_rep),
3336 .help = "Unify reporting across data direction",
3338 .category = FIO_OPT_C_GENERAL,
3339 .group = FIO_OPT_G_INVALID,
3342 .name = "continue_on_error",
3343 .lname = "Continue on error",
3344 .type = FIO_OPT_STR,
3345 .off1 = td_var_offset(continue_on_error),
3346 .help = "Continue on non-fatal errors during IO",
3348 .category = FIO_OPT_C_GENERAL,
3349 .group = FIO_OPT_G_ERR,
3352 .oval = ERROR_TYPE_NONE,
3353 .help = "Exit when an error is encountered",
3356 .oval = ERROR_TYPE_READ,
3357 .help = "Continue on read errors only",
3360 .oval = ERROR_TYPE_WRITE,
3361 .help = "Continue on write errors only",
3364 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3365 .help = "Continue on any IO errors",
3368 .oval = ERROR_TYPE_VERIFY,
3369 .help = "Continue on verify errors only",
3372 .oval = ERROR_TYPE_ANY,
3373 .help = "Continue on all io and verify errors",
3376 .oval = ERROR_TYPE_NONE,
3377 .help = "Alias for 'none'",
3380 .oval = ERROR_TYPE_ANY,
3381 .help = "Alias for 'all'",
3386 .name = "ignore_error",
3387 .type = FIO_OPT_STR,
3388 .cb = str_ignore_error_cb,
3389 .help = "Set a specific list of errors to ignore",
3391 .category = FIO_OPT_C_GENERAL,
3392 .group = FIO_OPT_G_ERR,
3395 .name = "error_dump",
3396 .type = FIO_OPT_BOOL,
3397 .off1 = td_var_offset(error_dump),
3399 .help = "Dump info on each error",
3400 .category = FIO_OPT_C_GENERAL,
3401 .group = FIO_OPT_G_ERR,
3406 .type = FIO_OPT_STR_STORE,
3407 .off1 = td_var_offset(profile),
3408 .help = "Select a specific builtin performance test",
3409 .category = FIO_OPT_C_PROFILE,
3410 .group = FIO_OPT_G_INVALID,
3415 .type = FIO_OPT_STR_STORE,
3416 .off1 = td_var_offset(cgroup),
3417 .help = "Add job to cgroup of this name",
3418 .category = FIO_OPT_C_GENERAL,
3419 .group = FIO_OPT_G_CGROUP,
3422 .name = "cgroup_nodelete",
3423 .lname = "Cgroup no-delete",
3424 .type = FIO_OPT_BOOL,
3425 .off1 = td_var_offset(cgroup_nodelete),
3426 .help = "Do not delete cgroups after job completion",
3429 .category = FIO_OPT_C_GENERAL,
3430 .group = FIO_OPT_G_CGROUP,
3433 .name = "cgroup_weight",
3434 .lname = "Cgroup weight",
3435 .type = FIO_OPT_INT,
3436 .off1 = td_var_offset(cgroup_weight),
3437 .help = "Use given weight for cgroup",
3441 .category = FIO_OPT_C_GENERAL,
3442 .group = FIO_OPT_G_CGROUP,
3447 .type = FIO_OPT_INT,
3448 .off1 = td_var_offset(uid),
3449 .help = "Run job with this user ID",
3450 .category = FIO_OPT_C_GENERAL,
3451 .group = FIO_OPT_G_CRED,
3455 .lname = "Group ID",
3456 .type = FIO_OPT_INT,
3457 .off1 = td_var_offset(gid),
3458 .help = "Run job with this group ID",
3459 .category = FIO_OPT_C_GENERAL,
3460 .group = FIO_OPT_G_CRED,
3465 .type = FIO_OPT_INT,
3466 .off1 = td_var_offset(kb_base),
3472 .help = "Use 1024 as the K base",
3476 .help = "Use 1000 as the K base",
3479 .help = "How many bytes per KB for reporting (1000 or 1024)",
3480 .category = FIO_OPT_C_GENERAL,
3481 .group = FIO_OPT_G_INVALID,
3484 .name = "unit_base",
3485 .lname = "Base unit for reporting (Bits or Bytes)",
3486 .type = FIO_OPT_INT,
3487 .off1 = td_var_offset(unit_base),
3492 .help = "Auto-detect",
3496 .help = "Normal (byte based)",
3500 .help = "Bit based",
3503 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3504 .category = FIO_OPT_C_GENERAL,
3505 .group = FIO_OPT_G_INVALID,
3508 .name = "hugepage-size",
3509 .lname = "Hugepage size",
3510 .type = FIO_OPT_INT,
3511 .off1 = td_var_offset(hugepage_size),
3512 .help = "When using hugepages, specify size of each page",
3513 .def = __fio_stringify(FIO_HUGE_PAGE),
3514 .interval = 1024 * 1024,
3515 .category = FIO_OPT_C_GENERAL,
3516 .group = FIO_OPT_G_INVALID,
3520 .lname = "I/O flow ID",
3521 .type = FIO_OPT_INT,
3522 .off1 = td_var_offset(flow_id),
3523 .help = "The flow index ID to use",
3525 .category = FIO_OPT_C_IO,
3526 .group = FIO_OPT_G_IO_FLOW,
3530 .lname = "I/O flow weight",
3531 .type = FIO_OPT_INT,
3532 .off1 = td_var_offset(flow),
3533 .help = "Weight for flow control of this job",
3534 .parent = "flow_id",
3537 .category = FIO_OPT_C_IO,
3538 .group = FIO_OPT_G_IO_FLOW,
3541 .name = "flow_watermark",
3542 .lname = "I/O flow watermark",
3543 .type = FIO_OPT_INT,
3544 .off1 = td_var_offset(flow_watermark),
3545 .help = "High watermark for flow control. This option"
3546 " should be set to the same value for all threads"
3547 " with non-zero flow.",
3548 .parent = "flow_id",
3551 .category = FIO_OPT_C_IO,
3552 .group = FIO_OPT_G_IO_FLOW,
3555 .name = "flow_sleep",
3556 .lname = "I/O flow sleep",
3557 .type = FIO_OPT_INT,
3558 .off1 = td_var_offset(flow_sleep),
3559 .help = "How many microseconds to sleep after being held"
3560 " back by the flow control mechanism",
3561 .parent = "flow_id",
3564 .category = FIO_OPT_C_IO,
3565 .group = FIO_OPT_G_IO_FLOW,
3572 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3573 const char *name, int val)
3575 lopt->name = (char *) name;
3577 if (o->type == FIO_OPT_STR_SET)
3578 lopt->has_arg = optional_argument;
3580 lopt->has_arg = required_argument;
3583 static void options_to_lopts(struct fio_option *opts,
3584 struct option *long_options,
3585 int i, int option_type)
3587 struct fio_option *o = &opts[0];
3589 add_to_lopt(&long_options[i], o, o->name, option_type);
3592 add_to_lopt(&long_options[i], o, o->alias, option_type);
3597 assert(i < FIO_NR_OPTIONS);
3601 void fio_options_set_ioengine_opts(struct option *long_options,
3602 struct thread_data *td)
3607 while (long_options[i].name) {
3608 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3609 memset(&long_options[i], 0, sizeof(*long_options));
3616 * Just clear out the prior ioengine options.
3621 options_to_lopts(td->io_ops->options, long_options, i,
3622 FIO_GETOPT_IOENGINE);
3625 void fio_options_dup_and_init(struct option *long_options)
3629 options_init(fio_options);
3632 while (long_options[i].name)
3635 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3638 struct fio_keyword {
3644 static struct fio_keyword fio_keywords[] = {
3646 .word = "$pagesize",
3647 .desc = "Page size in the system",
3650 .word = "$mb_memory",
3651 .desc = "Megabytes of memory online",
3655 .desc = "Number of CPUs online in the system",
3662 void fio_keywords_init(void)
3664 unsigned long long mb_memory;
3668 sprintf(buf, "%lu", (unsigned long) page_size);
3669 fio_keywords[0].replace = strdup(buf);
3671 mb_memory = os_phys_mem() / (1024 * 1024);
3672 sprintf(buf, "%llu", mb_memory);
3673 fio_keywords[1].replace = strdup(buf);
3676 sprintf(buf, "%lu", l);
3677 fio_keywords[2].replace = strdup(buf);
3682 static char *bc_calc(char *str)
3684 char buf[128], *tmp;
3689 * No math, just return string
3691 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3692 !strchr(str, '/')) || strchr(str, '\''))
3696 * Split option from value, we only need to calculate the value
3698 tmp = strchr(str, '=');
3705 * Prevent buffer overflows; such a case isn't reasonable anyway
3707 if (strlen(str) >= 128 || strlen(tmp) > 100)
3710 sprintf(buf, "which %s > /dev/null", BC_APP);
3712 log_err("fio: bc is needed for performing math\n");
3716 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3717 f = popen(buf, "r");
3721 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3728 buf[(tmp - str) + ret - 1] = '\0';
3729 memcpy(buf, str, tmp - str);
3735 * Return a copy of the input string with substrings of the form ${VARNAME}
3736 * substituted with the value of the environment variable VARNAME. The
3737 * substitution always occurs, even if VARNAME is empty or the corresponding
3738 * environment variable undefined.
3740 static char *option_dup_subs(const char *opt)
3742 char out[OPT_LEN_MAX+1];
3743 char in[OPT_LEN_MAX+1];
3746 char *ch1, *ch2, *env;
3747 ssize_t nchr = OPT_LEN_MAX;
3750 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3751 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3755 in[OPT_LEN_MAX] = '\0';
3756 strncpy(in, opt, OPT_LEN_MAX);
3758 while (*inptr && nchr > 0) {
3759 if (inptr[0] == '$' && inptr[1] == '{') {
3760 ch2 = strchr(inptr, '}');
3761 if (ch2 && inptr+1 < ch2) {
3768 envlen = strlen(env);
3769 if (envlen <= nchr) {
3770 memcpy(outptr, env, envlen);
3780 *outptr++ = *inptr++;
3789 * Look for reserved variable names and replace them with real values
3791 static char *fio_keyword_replace(char *opt)
3797 for (i = 0; fio_keywords[i].word != NULL; i++) {
3798 struct fio_keyword *kw = &fio_keywords[i];
3800 while ((s = strstr(opt, kw->word)) != NULL) {
3801 char *new = malloc(strlen(opt) + 1);
3807 * Copy part of the string before the keyword and
3808 * sprintf() the replacement after it.
3810 memcpy(new, opt, olen);
3811 len = sprintf(new + olen, "%s", kw->replace);
3814 * If there's more in the original string, copy that
3817 opt += strlen(kw->word) + olen;
3819 memcpy(new + olen + len, opt, opt - o_org - 1);
3822 * replace opt and free the old opt
3832 * Check for potential math and invoke bc, if possible
3840 static char **dup_and_sub_options(char **opts, int num_opts)
3843 char **opts_copy = malloc(num_opts * sizeof(*opts));
3844 for (i = 0; i < num_opts; i++) {
3845 opts_copy[i] = option_dup_subs(opts[i]);
3848 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3853 int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3856 int i, ret, unknown;
3859 sort_options(opts, fio_options, num_opts);
3860 opts_copy = dup_and_sub_options(opts, num_opts);
3862 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3863 struct fio_option *o;
3864 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3865 &o, td, dump_cmdline);
3873 opts_copy[i] = NULL;
3880 ret |= ioengine_load(td);
3882 sort_options(opts_copy, td->io_ops->options, num_opts);
3885 for (i = 0; i < num_opts; i++) {
3886 struct fio_option *o = NULL;
3892 newret = parse_option(opts_copy[i], opts[i],
3893 td->io_ops->options, &o,
3894 td->eo, dump_cmdline);
3898 log_err("Bad option <%s>\n", opts[i]);
3901 opts_copy[i] = NULL;
3909 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3911 return parse_cmd_option(opt, val, fio_options, td);
3914 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3917 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);