18 #include "crc/crc32c.h"
21 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
23 static char *get_opt_postfix(const char *str)
25 char *p = strstr(str, ":");
31 strip_blank_front(&p);
36 static int converthexchartoint(char a)
56 static int bs_cmp(const void *p1, const void *p2)
58 const struct bssplit *bsp1 = p1;
59 const struct bssplit *bsp2 = p2;
61 return bsp1->perc < bsp2->perc;
64 static int bssplit_ddir(struct thread_options *o, int ddir, char *str)
66 struct bssplit *bssplit;
67 unsigned int i, perc, perc_missing;
68 unsigned int max_bs, min_bs;
72 o->bssplit_nr[ddir] = 4;
73 bssplit = malloc(4 * sizeof(struct bssplit));
78 while ((fname = strsep(&str, ":")) != NULL) {
85 * grow struct buffer, if needed
87 if (i == o->bssplit_nr[ddir]) {
88 o->bssplit_nr[ddir] <<= 1;
89 bssplit = realloc(bssplit, o->bssplit_nr[ddir]
90 * sizeof(struct bssplit));
93 perc_str = strstr(fname, "/");
97 perc = atoi(perc_str);
105 if (str_to_decimal(fname, &val, 1, o, 0)) {
106 log_err("fio: bssplit conversion failed\n");
117 bssplit[i].perc = perc;
121 o->bssplit_nr[ddir] = i;
124 * Now check if the percentages add up, and how much is missing
126 perc = perc_missing = 0;
127 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
128 struct bssplit *bsp = &bssplit[i];
130 if (bsp->perc == (unsigned char) -1)
137 log_err("fio: bssplit percentages add to more than 100%%\n");
142 * If values didn't have a percentage set, divide the remains between
146 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
147 struct bssplit *bsp = &bssplit[i];
149 if (bsp->perc == (unsigned char) -1)
150 bsp->perc = (100 - perc) / perc_missing;
154 o->min_bs[ddir] = min_bs;
155 o->max_bs[ddir] = max_bs;
158 * now sort based on percentages, for ease of lookup
160 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
161 o->bssplit[ddir] = bssplit;
165 static int str_bssplit_cb(void *data, const char *input)
167 struct thread_data *td = data;
168 char *str, *p, *odir, *ddir;
174 p = str = strdup(input);
176 strip_blank_front(&str);
177 strip_blank_end(str);
179 odir = strchr(str, ',');
181 ddir = strchr(odir + 1, ',');
183 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
189 op = strdup(odir + 1);
190 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
195 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
198 ret = bssplit_ddir(&td->o, DDIR_READ, str);
204 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
209 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
212 ret = bssplit_ddir(&td->o, DDIR_READ, str);
219 static int str2error(char *str)
221 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
222 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
223 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
224 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
225 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
226 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
227 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
228 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
229 int i = 0, num = sizeof(err) / sizeof(void *);
232 if (!strcmp(err[i], str))
239 static int ignore_error_type(struct thread_data *td, int etype, char *str)
245 if (etype >= ERROR_TYPE_CNT) {
246 log_err("Illegal error type\n");
250 td->o.ignore_error_nr[etype] = 4;
251 error = malloc(4 * sizeof(struct bssplit));
254 while ((fname = strsep(&str, ":")) != NULL) {
260 * grow struct buffer, if needed
262 if (i == td->o.ignore_error_nr[etype]) {
263 td->o.ignore_error_nr[etype] <<= 1;
264 error = realloc(error, td->o.ignore_error_nr[etype]
267 if (fname[0] == 'E') {
268 error[i] = str2error(fname);
270 error[i] = atoi(fname);
275 log_err("Unknown error %s, please use number value \n",
283 td->o.continue_on_error |= 1 << etype;
284 td->o.ignore_error_nr[etype] = i;
285 td->o.ignore_error[etype] = error;
291 static int str_ignore_error_cb(void *data, const char *input)
293 struct thread_data *td = data;
295 int type = 0, ret = 1;
300 p = str = strdup(input);
302 strip_blank_front(&str);
303 strip_blank_end(str);
309 ret = ignore_error_type(td, type, p);
319 static int str_rw_cb(void *data, const char *str)
321 struct thread_data *td = data;
322 struct thread_options *o = &td->o;
323 char *nr = get_opt_postfix(str);
335 o->ddir_seq_nr = atoi(nr);
339 if (str_to_decimal(nr, &val, 1, o, 0)) {
340 log_err("fio: rw postfix parsing failed\n");
345 o->ddir_seq_add = val;
352 static int str_mem_cb(void *data, const char *mem)
354 struct thread_data *td = data;
356 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
357 td->o.mmapfile = get_opt_postfix(mem);
362 static int fio_clock_source_cb(void *data, const char *str)
364 struct thread_data *td = data;
366 fio_clock_source = td->o.clocksource;
367 fio_clock_source_set = 1;
372 static int str_rwmix_read_cb(void *data, unsigned long long *val)
374 struct thread_data *td = data;
376 td->o.rwmix[DDIR_READ] = *val;
377 td->o.rwmix[DDIR_WRITE] = 100 - *val;
381 static int str_rwmix_write_cb(void *data, unsigned long long *val)
383 struct thread_data *td = data;
385 td->o.rwmix[DDIR_WRITE] = *val;
386 td->o.rwmix[DDIR_READ] = 100 - *val;
390 static int str_exitall_cb(void)
392 exitall_on_terminate = 1;
396 #ifdef FIO_HAVE_CPU_AFFINITY
397 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
399 unsigned int i, index, cpus_in_mask;
400 const long max_cpu = cpus_online();
402 cpus_in_mask = fio_cpu_count(mask);
403 cpu_index = cpu_index % cpus_in_mask;
406 for (i = 0; i < max_cpu; i++) {
407 if (!fio_cpu_isset(mask, i))
410 if (cpu_index != index)
411 fio_cpu_clear(mask, i);
416 return fio_cpu_count(mask);
419 static int str_cpumask_cb(void *data, unsigned long long *val)
421 struct thread_data *td = data;
429 ret = fio_cpuset_init(&td->o.cpumask);
431 log_err("fio: cpuset_init failed\n");
432 td_verror(td, ret, "fio_cpuset_init");
436 max_cpu = cpus_online();
438 for (i = 0; i < sizeof(int) * 8; i++) {
439 if ((1 << i) & *val) {
441 log_err("fio: CPU %d too large (max=%ld)\n", i,
445 dprint(FD_PARSE, "set cpu allowed %d\n", i);
446 fio_cpu_set(&td->o.cpumask, i);
450 td->o.cpumask_set = 1;
454 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
461 ret = fio_cpuset_init(mask);
463 log_err("fio: cpuset_init failed\n");
464 td_verror(td, ret, "fio_cpuset_init");
468 p = str = strdup(input);
470 strip_blank_front(&str);
471 strip_blank_end(str);
473 max_cpu = cpus_online();
475 while ((cpu = strsep(&str, ",")) != NULL) {
484 while ((cpu2 = strsep(&str2, "-")) != NULL) {
494 while (icpu <= icpu2) {
495 if (icpu >= FIO_MAX_CPUS) {
496 log_err("fio: your OS only supports up to"
497 " %d CPUs\n", (int) FIO_MAX_CPUS);
501 if (icpu > max_cpu) {
502 log_err("fio: CPU %d too large (max=%ld)\n",
508 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
509 fio_cpu_set(mask, icpu);
518 td->o.cpumask_set = 1;
522 static int str_cpus_allowed_cb(void *data, const char *input)
524 struct thread_data *td = data;
530 ret = set_cpus_allowed(td, &td->o.cpumask, input);
532 td->o.cpumask_set = 1;
537 static int str_verify_cpus_allowed_cb(void *data, const char *input)
539 struct thread_data *td = data;
542 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
544 td->o.verify_cpumask_set = 1;
550 #ifdef CONFIG_LIBNUMA
551 static int str_numa_cpunodes_cb(void *data, char *input)
553 struct thread_data *td = data;
558 /* numa_parse_nodestring() parses a character string list
559 * of nodes into a bit mask. The bit mask is allocated by
560 * numa_allocate_nodemask(), so it should be freed by
561 * numa_free_nodemask().
563 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
564 if (td->o.numa_cpunodesmask == NULL) {
565 log_err("fio: numa_parse_nodestring failed\n");
566 td_verror(td, 1, "str_numa_cpunodes_cb");
570 td->o.numa_cpumask_set = 1;
574 static int str_numa_mpol_cb(void *data, char *input)
576 struct thread_data *td = data;
577 const char * const policy_types[] =
578 { "default", "prefer", "bind", "interleave", "local", NULL };
585 nodelist = strchr(input, ':');
587 /* NUL-terminate mode */
591 for (i = 0; i <= MPOL_LOCAL; i++) {
592 if (!strcmp(input, policy_types[i])) {
593 td->o.numa_mem_mode = i;
597 if (i > MPOL_LOCAL) {
598 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
602 switch (td->o.numa_mem_mode) {
605 * Insist on a nodelist of one node only
608 char *rest = nodelist;
609 while (isdigit(*rest))
612 log_err("fio: one node only for \'prefer\'\n");
616 log_err("fio: one node is needed for \'prefer\'\n");
620 case MPOL_INTERLEAVE:
622 * Default to online nodes with memory if no nodelist
625 nodelist = strdup("all");
630 * Don't allow a nodelist
633 log_err("fio: NO nodelist for \'local\'\n");
639 * Insist on a nodelist
642 log_err("fio: a nodelist is needed for \'bind\'\n");
649 /* numa_parse_nodestring() parses a character string list
650 * of nodes into a bit mask. The bit mask is allocated by
651 * numa_allocate_nodemask(), so it should be freed by
652 * numa_free_nodemask().
654 switch (td->o.numa_mem_mode) {
656 td->o.numa_mem_prefer_node = atoi(nodelist);
658 case MPOL_INTERLEAVE:
660 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
661 if (td->o.numa_memnodesmask == NULL) {
662 log_err("fio: numa_parse_nodestring failed\n");
663 td_verror(td, 1, "str_numa_memnodes_cb");
673 td->o.numa_memmask_set = 1;
681 static int str_fst_cb(void *data, const char *str)
683 struct thread_data *td = data;
684 char *nr = get_opt_postfix(str);
686 td->file_service_nr = 1;
688 td->file_service_nr = atoi(nr);
695 #ifdef CONFIG_SYNC_FILE_RANGE
696 static int str_sfr_cb(void *data, const char *str)
698 struct thread_data *td = data;
699 char *nr = get_opt_postfix(str);
701 td->sync_file_range_nr = 1;
703 td->sync_file_range_nr = atoi(nr);
711 static int str_random_distribution_cb(void *data, const char *str)
713 struct thread_data *td = data;
720 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
722 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
727 nr = get_opt_postfix(str);
728 if (nr && !str_to_float(nr, &val)) {
729 log_err("fio: random postfix parsing failed\n");
736 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
738 log_err("fio: zipf theta must different than 1.0\n");
741 td->o.zipf_theta.u.f = val;
743 if (val <= 0.00 || val >= 1.00) {
744 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
747 td->o.pareto_h.u.f = val;
754 * Return next name in the string. Files are separated with ':'. If the ':'
755 * is escaped with a '\', then that ':' is part of the filename and does not
756 * indicate a new file.
758 static char *get_next_name(char **ptr)
763 if (!str || !strlen(str))
769 * No colon, we are done
771 p = strchr(str, ':');
778 * We got a colon, but it's the first character. Skip and
786 if (*(p - 1) != '\\') {
792 memmove(p - 1, p, strlen(p) + 1);
800 static int get_max_name_idx(char *input)
802 unsigned int cur_idx;
805 p = str = strdup(input);
806 for (cur_idx = 0; ; cur_idx++)
807 if (get_next_name(&str) == NULL)
815 * Returns the directory at the index, indexes > entires will be
816 * assigned via modulo division of the index
818 int set_name_idx(char *target, char *input, int index)
820 unsigned int cur_idx;
822 char *fname, *str, *p;
824 p = str = strdup(input);
826 index %= get_max_name_idx(input);
827 for (cur_idx = 0; cur_idx <= index; cur_idx++)
828 fname = get_next_name(&str);
830 len = sprintf(target, "%s/", fname);
836 static int str_filename_cb(void *data, const char *input)
838 struct thread_data *td = data;
839 char *fname, *str, *p;
841 p = str = strdup(input);
843 strip_blank_front(&str);
844 strip_blank_end(str);
846 if (!td->files_index)
849 while ((fname = get_next_name(&str)) != NULL) {
852 add_file(td, fname, 0, 1);
859 static int str_directory_cb(void *data, const char fio_unused *unused)
861 struct thread_data *td = data;
863 char *dirname, *str, *p;
869 p = str = strdup(td->o.directory);
870 while ((dirname = get_next_name(&str)) != NULL) {
871 if (lstat(dirname, &sb) < 0) {
874 log_err("fio: %s is not a directory\n", dirname);
875 td_verror(td, ret, "lstat");
878 if (!S_ISDIR(sb.st_mode)) {
879 log_err("fio: %s is not a directory\n", dirname);
890 static int str_lockfile_cb(void *data, const char fio_unused *str)
892 struct thread_data *td = data;
894 if (td->files_index) {
895 log_err("fio: lockfile= option must precede filename=\n");
902 static int str_opendir_cb(void *data, const char fio_unused *str)
904 struct thread_data *td = data;
909 if (!td->files_index)
912 return add_dir_files(td, td->o.opendir);
915 static int pattern_cb(char *pattern, unsigned int max_size,
916 const char *input, unsigned int *pattern_bytes)
919 int i = 0, j = 0, len, k, base = 10;
920 uint32_t pattern_length;
923 loc1 = strstr(input, "0x");
924 loc2 = strstr(input, "0X");
927 off = strtol(input, NULL, base);
928 if (off != LONG_MAX || errno != ERANGE) {
930 pattern[i] = off & 0xff;
939 j = loc1 - input + 2;
941 j = loc2 - input + 2;
944 if (len - j < max_size * 2) {
946 off = converthexchartoint(input[k--]);
948 off += (converthexchartoint(input[k--])
950 pattern[i++] = (char) off;
956 * Fill the pattern all the way to the end. This greatly reduces
957 * the number of memcpy's we have to do when verifying the IO.
960 while (i > 1 && i * 2 <= max_size) {
961 memcpy(&pattern[i], &pattern[0], i);
966 * Fill remainder, if the pattern multiple ends up not being
969 while (i > 1 && i < max_size) {
970 unsigned int b = min(pattern_length, max_size - i);
972 memcpy(&pattern[i], &pattern[0], b);
978 * The code in verify_io_u_pattern assumes a single byte pattern
979 * fills the whole verify pattern buffer.
981 memset(pattern, pattern[0], max_size);
988 static int str_buffer_pattern_cb(void *data, const char *input)
990 struct thread_data *td = data;
993 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
994 &td->o.buffer_pattern_bytes);
997 td->o.refill_buffers = 0;
998 td->o.scramble_buffers = 0;
999 td->o.zero_buffers = 0;
1005 static int str_verify_pattern_cb(void *data, const char *input)
1007 struct thread_data *td = data;
1010 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1011 &td->o.verify_pattern_bytes);
1014 * VERIFY_META could already be set
1016 if (!ret && td->o.verify == VERIFY_NONE)
1017 td->o.verify = VERIFY_PATTERN;
1022 static int str_gtod_reduce_cb(void *data, int *il)
1024 struct thread_data *td = data;
1027 td->o.disable_lat = !!val;
1028 td->o.disable_clat = !!val;
1029 td->o.disable_slat = !!val;
1030 td->o.disable_bw = !!val;
1031 td->o.clat_percentiles = !val;
1033 td->tv_cache_mask = 63;
1038 static int str_gtod_cpu_cb(void *data, long long *il)
1040 struct thread_data *td = data;
1043 td->o.gtod_cpu = val;
1044 td->o.gtod_offload = 1;
1048 static int str_size_cb(void *data, unsigned long long *__val)
1050 struct thread_data *td = data;
1051 unsigned long long v = *__val;
1053 if (parse_is_percent(v)) {
1055 td->o.size_percent = -1ULL - v;
1062 static int rw_verify(struct fio_option *o, void *data)
1064 struct thread_data *td = data;
1066 if (read_only && td_write(td)) {
1067 log_err("fio: job <%s> has write bit set, but fio is in"
1068 " read-only mode\n", td->o.name);
1075 static int gtod_cpu_verify(struct fio_option *o, void *data)
1077 #ifndef FIO_HAVE_CPU_AFFINITY
1078 struct thread_data *td = data;
1080 if (td->o.gtod_cpu) {
1081 log_err("fio: platform must support CPU affinity for"
1082 "gettimeofday() offloading\n");
1093 static struct opt_group fio_opt_groups[] = {
1096 .mask = FIO_OPT_C_GENERAL,
1100 .mask = FIO_OPT_C_IO,
1104 .mask = FIO_OPT_C_FILE,
1107 .name = "Statistics",
1108 .mask = FIO_OPT_C_STAT,
1112 .mask = FIO_OPT_C_LOG,
1116 .mask = FIO_OPT_C_PROFILE,
1123 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1124 unsigned int inv_mask)
1126 struct opt_group *og;
1129 if (*mask == inv_mask || !*mask)
1132 for (i = 0; ogs[i].name; i++) {
1135 if (*mask & og->mask) {
1136 *mask &= ~(og->mask);
1144 struct opt_group *opt_group_from_mask(unsigned int *mask)
1146 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1149 static struct opt_group fio_opt_cat_groups[] = {
1151 .name = "Latency profiling",
1152 .mask = FIO_OPT_G_LATPROF,
1156 .mask = FIO_OPT_G_RATE,
1160 .mask = FIO_OPT_G_ZONE,
1163 .name = "Read/write mix",
1164 .mask = FIO_OPT_G_RWMIX,
1168 .mask = FIO_OPT_G_VERIFY,
1172 .mask = FIO_OPT_G_TRIM,
1175 .name = "I/O Logging",
1176 .mask = FIO_OPT_G_IOLOG,
1179 .name = "I/O Depth",
1180 .mask = FIO_OPT_G_IO_DEPTH,
1184 .mask = FIO_OPT_G_IO_FLOW,
1187 .name = "Description",
1188 .mask = FIO_OPT_G_DESC,
1192 .mask = FIO_OPT_G_FILENAME,
1195 .name = "General I/O",
1196 .mask = FIO_OPT_G_IO_BASIC,
1200 .mask = FIO_OPT_G_CGROUP,
1204 .mask = FIO_OPT_G_RUNTIME,
1208 .mask = FIO_OPT_G_PROCESS,
1211 .name = "Job credentials / priority",
1212 .mask = FIO_OPT_G_CRED,
1215 .name = "Clock settings",
1216 .mask = FIO_OPT_G_CLOCK,
1220 .mask = FIO_OPT_G_IO_TYPE,
1223 .name = "I/O Thinktime",
1224 .mask = FIO_OPT_G_THINKTIME,
1227 .name = "Randomizations",
1228 .mask = FIO_OPT_G_RANDOM,
1231 .name = "I/O buffers",
1232 .mask = FIO_OPT_G_IO_BUF,
1235 .name = "Tiobench profile",
1236 .mask = FIO_OPT_G_TIOBENCH,
1244 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1246 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1250 * Map of job/command line options
1252 struct fio_option fio_options[FIO_MAX_OPTS] = {
1254 .name = "description",
1255 .lname = "Description of job",
1256 .type = FIO_OPT_STR_STORE,
1257 .off1 = td_var_offset(description),
1258 .help = "Text job description",
1259 .category = FIO_OPT_C_GENERAL,
1260 .group = FIO_OPT_G_DESC,
1264 .lname = "Job name",
1265 .type = FIO_OPT_STR_STORE,
1266 .off1 = td_var_offset(name),
1267 .help = "Name of this job",
1268 .category = FIO_OPT_C_GENERAL,
1269 .group = FIO_OPT_G_DESC,
1273 .lname = "Filename(s)",
1274 .type = FIO_OPT_STR_STORE,
1275 .off1 = td_var_offset(filename),
1276 .cb = str_filename_cb,
1277 .prio = -1, /* must come after "directory" */
1278 .help = "File(s) to use for the workload",
1279 .category = FIO_OPT_C_FILE,
1280 .group = FIO_OPT_G_FILENAME,
1283 .name = "directory",
1284 .lname = "Directory",
1285 .type = FIO_OPT_STR_STORE,
1286 .off1 = td_var_offset(directory),
1287 .cb = str_directory_cb,
1288 .help = "Directory to store files in",
1289 .category = FIO_OPT_C_FILE,
1290 .group = FIO_OPT_G_FILENAME,
1293 .name = "filename_format",
1294 .type = FIO_OPT_STR_STORE,
1295 .off1 = td_var_offset(filename_format),
1296 .prio = -1, /* must come after "directory" */
1297 .help = "Override default $jobname.$jobnum.$filenum naming",
1298 .def = "$jobname.$jobnum.$filenum",
1299 .category = FIO_OPT_C_FILE,
1300 .group = FIO_OPT_G_FILENAME,
1304 .lname = "Lockfile",
1305 .type = FIO_OPT_STR,
1306 .off1 = td_var_offset(file_lock_mode),
1307 .help = "Lock file when doing IO to it",
1309 .parent = "filename",
1312 .cb = str_lockfile_cb,
1313 .category = FIO_OPT_C_FILE,
1314 .group = FIO_OPT_G_FILENAME,
1317 .oval = FILE_LOCK_NONE,
1318 .help = "No file locking",
1320 { .ival = "exclusive",
1321 .oval = FILE_LOCK_EXCLUSIVE,
1322 .help = "Exclusive file lock",
1325 .ival = "readwrite",
1326 .oval = FILE_LOCK_READWRITE,
1327 .help = "Read vs write lock",
1333 .lname = "Open directory",
1334 .type = FIO_OPT_STR_STORE,
1335 .off1 = td_var_offset(opendir),
1336 .cb = str_opendir_cb,
1337 .help = "Recursively add files from this directory and down",
1338 .category = FIO_OPT_C_FILE,
1339 .group = FIO_OPT_G_FILENAME,
1343 .lname = "Read/write",
1344 .alias = "readwrite",
1345 .type = FIO_OPT_STR,
1347 .off1 = td_var_offset(td_ddir),
1348 .help = "IO direction",
1350 .verify = rw_verify,
1351 .category = FIO_OPT_C_IO,
1352 .group = FIO_OPT_G_IO_BASIC,
1355 .oval = TD_DDIR_READ,
1356 .help = "Sequential read",
1359 .oval = TD_DDIR_WRITE,
1360 .help = "Sequential write",
1363 .oval = TD_DDIR_TRIM,
1364 .help = "Sequential trim",
1366 { .ival = "randread",
1367 .oval = TD_DDIR_RANDREAD,
1368 .help = "Random read",
1370 { .ival = "randwrite",
1371 .oval = TD_DDIR_RANDWRITE,
1372 .help = "Random write",
1374 { .ival = "randtrim",
1375 .oval = TD_DDIR_RANDTRIM,
1376 .help = "Random trim",
1380 .help = "Sequential read and write mix",
1382 { .ival = "readwrite",
1384 .help = "Sequential read and write mix",
1387 .oval = TD_DDIR_RANDRW,
1388 .help = "Random read and write mix"
1393 .name = "rw_sequencer",
1394 .lname = "RW Sequencer",
1395 .type = FIO_OPT_STR,
1396 .off1 = td_var_offset(rw_seq),
1397 .help = "IO offset generator modifier",
1398 .def = "sequential",
1399 .category = FIO_OPT_C_IO,
1400 .group = FIO_OPT_G_IO_BASIC,
1402 { .ival = "sequential",
1404 .help = "Generate sequential offsets",
1406 { .ival = "identical",
1407 .oval = RW_SEQ_IDENT,
1408 .help = "Generate identical offsets",
1415 .lname = "IO Engine",
1416 .type = FIO_OPT_STR_STORE,
1417 .off1 = td_var_offset(ioengine),
1418 .help = "IO engine to use",
1419 .def = FIO_PREFERRED_ENGINE,
1420 .category = FIO_OPT_C_IO,
1421 .group = FIO_OPT_G_IO_BASIC,
1424 .help = "Use read/write",
1427 .help = "Use pread/pwrite",
1430 .help = "Use readv/writev",
1432 #ifdef CONFIG_PWRITEV
1434 .help = "Use preadv/pwritev",
1437 #ifdef CONFIG_LIBAIO
1439 .help = "Linux native asynchronous IO",
1442 #ifdef CONFIG_POSIXAIO
1443 { .ival = "posixaio",
1444 .help = "POSIX asynchronous IO",
1447 #ifdef CONFIG_SOLARISAIO
1448 { .ival = "solarisaio",
1449 .help = "Solaris native asynchronous IO",
1452 #ifdef CONFIG_WINDOWSAIO
1453 { .ival = "windowsaio",
1454 .help = "Windows native asynchronous IO"
1459 .help = "Rados Block Device asynchronous IO"
1463 .help = "Memory mapped IO"
1465 #ifdef CONFIG_LINUX_SPLICE
1467 .help = "splice/vmsplice based IO",
1469 { .ival = "netsplice",
1470 .help = "splice/vmsplice to/from the network",
1473 #ifdef FIO_HAVE_SGIO
1475 .help = "SCSI generic v3 IO",
1479 .help = "Testing engine (no data transfer)",
1482 .help = "Network IO",
1485 .help = "CPU cycle burner engine",
1489 .help = "GUASI IO engine",
1492 #ifdef FIO_HAVE_BINJECT
1493 { .ival = "binject",
1494 .help = "binject direct inject block engine",
1499 .help = "RDMA IO engine",
1502 #ifdef CONFIG_FUSION_AW
1503 { .ival = "fusion-aw-sync",
1504 .help = "Fusion-io atomic write engine",
1507 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1508 { .ival = "e4defrag",
1509 .help = "ext4 defrag engine",
1512 #ifdef CONFIG_LINUX_FALLOCATE
1514 .help = "fallocate() file based engine",
1517 { .ival = "external",
1518 .help = "Load external engine (append name)",
1524 .lname = "IO Depth",
1525 .type = FIO_OPT_INT,
1526 .off1 = td_var_offset(iodepth),
1527 .help = "Number of IO buffers to keep in flight",
1531 .category = FIO_OPT_C_IO,
1532 .group = FIO_OPT_G_IO_BASIC,
1535 .name = "iodepth_batch",
1536 .lname = "IO Depth batch",
1537 .alias = "iodepth_batch_submit",
1538 .type = FIO_OPT_INT,
1539 .off1 = td_var_offset(iodepth_batch),
1540 .help = "Number of IO buffers to submit in one go",
1541 .parent = "iodepth",
1546 .category = FIO_OPT_C_IO,
1547 .group = FIO_OPT_G_IO_BASIC,
1550 .name = "iodepth_batch_complete",
1551 .lname = "IO Depth batch complete",
1552 .type = FIO_OPT_INT,
1553 .off1 = td_var_offset(iodepth_batch_complete),
1554 .help = "Number of IO buffers to retrieve in one go",
1555 .parent = "iodepth",
1560 .category = FIO_OPT_C_IO,
1561 .group = FIO_OPT_G_IO_BASIC,
1564 .name = "iodepth_low",
1565 .lname = "IO Depth batch low",
1566 .type = FIO_OPT_INT,
1567 .off1 = td_var_offset(iodepth_low),
1568 .help = "Low water mark for queuing depth",
1569 .parent = "iodepth",
1572 .category = FIO_OPT_C_IO,
1573 .group = FIO_OPT_G_IO_BASIC,
1578 .type = FIO_OPT_STR_VAL,
1580 .help = "Total size of device or files",
1581 .interval = 1024 * 1024,
1582 .category = FIO_OPT_C_IO,
1583 .group = FIO_OPT_G_INVALID,
1586 .name = "fill_device",
1587 .lname = "Fill device",
1589 .type = FIO_OPT_BOOL,
1590 .off1 = td_var_offset(fill_device),
1591 .help = "Write until an ENOSPC error occurs",
1593 .category = FIO_OPT_C_FILE,
1594 .group = FIO_OPT_G_INVALID,
1598 .lname = "File size",
1599 .type = FIO_OPT_STR_VAL,
1600 .off1 = td_var_offset(file_size_low),
1601 .off2 = td_var_offset(file_size_high),
1603 .help = "Size of individual files",
1604 .interval = 1024 * 1024,
1605 .category = FIO_OPT_C_FILE,
1606 .group = FIO_OPT_G_INVALID,
1610 .lname = "IO offset",
1611 .alias = "fileoffset",
1612 .type = FIO_OPT_STR_VAL,
1613 .off1 = td_var_offset(start_offset),
1614 .help = "Start IO from this offset",
1616 .interval = 1024 * 1024,
1617 .category = FIO_OPT_C_IO,
1618 .group = FIO_OPT_G_INVALID,
1621 .name = "offset_increment",
1622 .lname = "IO offset increment",
1623 .type = FIO_OPT_STR_VAL,
1624 .off1 = td_var_offset(offset_increment),
1625 .help = "What is the increment from one offset to the next",
1629 .interval = 1024 * 1024,
1630 .category = FIO_OPT_C_IO,
1631 .group = FIO_OPT_G_INVALID,
1634 .name = "number_ios",
1635 .lname = "Number of IOs to perform",
1636 .type = FIO_OPT_STR_VAL,
1637 .off1 = td_var_offset(number_ios),
1638 .help = "Force job completion of this number of IOs",
1640 .category = FIO_OPT_C_IO,
1641 .group = FIO_OPT_G_INVALID,
1645 .lname = "Block size",
1646 .alias = "blocksize",
1647 .type = FIO_OPT_INT,
1648 .off1 = td_var_offset(bs[DDIR_READ]),
1649 .off2 = td_var_offset(bs[DDIR_WRITE]),
1650 .off3 = td_var_offset(bs[DDIR_TRIM]),
1652 .help = "Block size unit",
1657 .category = FIO_OPT_C_IO,
1658 .group = FIO_OPT_G_INVALID,
1662 .lname = "Block size align",
1663 .alias = "blockalign",
1664 .type = FIO_OPT_INT,
1665 .off1 = td_var_offset(ba[DDIR_READ]),
1666 .off2 = td_var_offset(ba[DDIR_WRITE]),
1667 .off3 = td_var_offset(ba[DDIR_TRIM]),
1669 .help = "IO block offset alignment",
1673 .category = FIO_OPT_C_IO,
1674 .group = FIO_OPT_G_INVALID,
1678 .lname = "Block size range",
1679 .alias = "blocksize_range",
1680 .type = FIO_OPT_RANGE,
1681 .off1 = td_var_offset(min_bs[DDIR_READ]),
1682 .off2 = td_var_offset(max_bs[DDIR_READ]),
1683 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1684 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1685 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1686 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1688 .help = "Set block size range (in more detail than bs)",
1692 .category = FIO_OPT_C_IO,
1693 .group = FIO_OPT_G_INVALID,
1697 .lname = "Block size split",
1698 .type = FIO_OPT_STR,
1699 .cb = str_bssplit_cb,
1700 .help = "Set a specific mix of block sizes",
1703 .category = FIO_OPT_C_IO,
1704 .group = FIO_OPT_G_INVALID,
1707 .name = "bs_unaligned",
1708 .lname = "Block size unaligned",
1709 .alias = "blocksize_unaligned",
1710 .type = FIO_OPT_STR_SET,
1711 .off1 = td_var_offset(bs_unaligned),
1712 .help = "Don't sector align IO buffer sizes",
1715 .category = FIO_OPT_C_IO,
1716 .group = FIO_OPT_G_INVALID,
1719 .name = "bs_is_seq_rand",
1720 .lname = "Block size division is seq/random (not read/write)",
1721 .type = FIO_OPT_BOOL,
1722 .off1 = td_var_offset(bs_is_seq_rand),
1723 .help = "Consider any blocksize setting to be sequential,ramdom",
1725 .parent = "blocksize",
1726 .category = FIO_OPT_C_IO,
1727 .group = FIO_OPT_G_INVALID,
1730 .name = "randrepeat",
1731 .lname = "Random repeatable",
1732 .type = FIO_OPT_BOOL,
1733 .off1 = td_var_offset(rand_repeatable),
1734 .help = "Use repeatable random IO pattern",
1738 .category = FIO_OPT_C_IO,
1739 .group = FIO_OPT_G_RANDOM,
1743 .lname = "The random generator seed",
1744 .type = FIO_OPT_STR_VAL,
1745 .off1 = td_var_offset(rand_seed),
1746 .help = "Set the random generator seed value",
1748 .category = FIO_OPT_C_IO,
1749 .group = FIO_OPT_G_RANDOM,
1752 .name = "use_os_rand",
1753 .lname = "Use OS random",
1754 .type = FIO_OPT_BOOL,
1755 .off1 = td_var_offset(use_os_rand),
1756 .help = "Set to use OS random generator",
1760 .category = FIO_OPT_C_IO,
1761 .group = FIO_OPT_G_RANDOM,
1764 .name = "norandommap",
1765 .lname = "No randommap",
1766 .type = FIO_OPT_STR_SET,
1767 .off1 = td_var_offset(norandommap),
1768 .help = "Accept potential duplicate random blocks",
1772 .category = FIO_OPT_C_IO,
1773 .group = FIO_OPT_G_RANDOM,
1776 .name = "softrandommap",
1777 .lname = "Soft randommap",
1778 .type = FIO_OPT_BOOL,
1779 .off1 = td_var_offset(softrandommap),
1780 .help = "Set norandommap if randommap allocation fails",
1781 .parent = "norandommap",
1784 .category = FIO_OPT_C_IO,
1785 .group = FIO_OPT_G_RANDOM,
1788 .name = "random_generator",
1789 .type = FIO_OPT_STR,
1790 .off1 = td_var_offset(random_generator),
1791 .help = "Type of random number generator to use",
1792 .def = "tausworthe",
1794 { .ival = "tausworthe",
1795 .oval = FIO_RAND_GEN_TAUSWORTHE,
1796 .help = "Strong Tausworthe generator",
1799 .oval = FIO_RAND_GEN_LFSR,
1800 .help = "Variable length LFSR",
1803 .category = FIO_OPT_C_IO,
1804 .group = FIO_OPT_G_RANDOM,
1807 .name = "random_distribution",
1808 .type = FIO_OPT_STR,
1809 .off1 = td_var_offset(random_distribution),
1810 .cb = str_random_distribution_cb,
1811 .help = "Random offset distribution generator",
1815 .oval = FIO_RAND_DIST_RANDOM,
1816 .help = "Completely random",
1819 .oval = FIO_RAND_DIST_ZIPF,
1820 .help = "Zipf distribution",
1823 .oval = FIO_RAND_DIST_PARETO,
1824 .help = "Pareto distribution",
1827 .category = FIO_OPT_C_IO,
1828 .group = FIO_OPT_G_RANDOM,
1831 .name = "percentage_random",
1832 .lname = "Percentage Random",
1833 .type = FIO_OPT_INT,
1834 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1835 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1836 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1838 .help = "Percentage of seq/random mix that should be random",
1839 .def = "100,100,100",
1841 .inverse = "percentage_sequential",
1842 .category = FIO_OPT_C_IO,
1843 .group = FIO_OPT_G_RANDOM,
1846 .name = "percentage_sequential",
1847 .lname = "Percentage Sequential",
1848 .type = FIO_OPT_DEPRECATED,
1849 .category = FIO_OPT_C_IO,
1850 .group = FIO_OPT_G_RANDOM,
1853 .name = "allrandrepeat",
1854 .type = FIO_OPT_BOOL,
1855 .off1 = td_var_offset(allrand_repeatable),
1856 .help = "Use repeatable random numbers for everything",
1858 .category = FIO_OPT_C_IO,
1859 .group = FIO_OPT_G_RANDOM,
1863 .lname = "Number of files",
1864 .alias = "nr_files",
1865 .type = FIO_OPT_INT,
1866 .off1 = td_var_offset(nr_files),
1867 .help = "Split job workload between this number of files",
1870 .category = FIO_OPT_C_FILE,
1871 .group = FIO_OPT_G_INVALID,
1874 .name = "openfiles",
1875 .lname = "Number of open files",
1876 .type = FIO_OPT_INT,
1877 .off1 = td_var_offset(open_files),
1878 .help = "Number of files to keep open at the same time",
1879 .category = FIO_OPT_C_FILE,
1880 .group = FIO_OPT_G_INVALID,
1883 .name = "file_service_type",
1884 .lname = "File service type",
1885 .type = FIO_OPT_STR,
1887 .off1 = td_var_offset(file_service_type),
1888 .help = "How to select which file to service next",
1889 .def = "roundrobin",
1890 .category = FIO_OPT_C_FILE,
1891 .group = FIO_OPT_G_INVALID,
1894 .oval = FIO_FSERVICE_RANDOM,
1895 .help = "Choose a file at random",
1897 { .ival = "roundrobin",
1898 .oval = FIO_FSERVICE_RR,
1899 .help = "Round robin select files",
1901 { .ival = "sequential",
1902 .oval = FIO_FSERVICE_SEQ,
1903 .help = "Finish one file before moving to the next",
1906 .parent = "nrfiles",
1909 #ifdef CONFIG_POSIX_FALLOCATE
1911 .name = "fallocate",
1912 .lname = "Fallocate",
1913 .type = FIO_OPT_STR,
1914 .off1 = td_var_offset(fallocate_mode),
1915 .help = "Whether pre-allocation is performed when laying out files",
1917 .category = FIO_OPT_C_FILE,
1918 .group = FIO_OPT_G_INVALID,
1921 .oval = FIO_FALLOCATE_NONE,
1922 .help = "Do not pre-allocate space",
1925 .oval = FIO_FALLOCATE_POSIX,
1926 .help = "Use posix_fallocate()",
1928 #ifdef CONFIG_LINUX_FALLOCATE
1930 .oval = FIO_FALLOCATE_KEEP_SIZE,
1931 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1934 /* Compatibility with former boolean values */
1936 .oval = FIO_FALLOCATE_NONE,
1937 .help = "Alias for 'none'",
1940 .oval = FIO_FALLOCATE_POSIX,
1941 .help = "Alias for 'posix'",
1945 #endif /* CONFIG_POSIX_FALLOCATE */
1947 .name = "fadvise_hint",
1948 .lname = "Fadvise hint",
1949 .type = FIO_OPT_BOOL,
1950 .off1 = td_var_offset(fadvise_hint),
1951 .help = "Use fadvise() to advise the kernel on IO pattern",
1953 .category = FIO_OPT_C_FILE,
1954 .group = FIO_OPT_G_INVALID,
1959 .type = FIO_OPT_INT,
1960 .off1 = td_var_offset(fsync_blocks),
1961 .help = "Issue fsync for writes every given number of blocks",
1964 .category = FIO_OPT_C_FILE,
1965 .group = FIO_OPT_G_INVALID,
1968 .name = "fdatasync",
1969 .lname = "Fdatasync",
1970 .type = FIO_OPT_INT,
1971 .off1 = td_var_offset(fdatasync_blocks),
1972 .help = "Issue fdatasync for writes every given number of blocks",
1975 .category = FIO_OPT_C_FILE,
1976 .group = FIO_OPT_G_INVALID,
1979 .name = "write_barrier",
1980 .lname = "Write barrier",
1981 .type = FIO_OPT_INT,
1982 .off1 = td_var_offset(barrier_blocks),
1983 .help = "Make every Nth write a barrier write",
1986 .category = FIO_OPT_C_IO,
1987 .group = FIO_OPT_G_INVALID,
1989 #ifdef CONFIG_SYNC_FILE_RANGE
1991 .name = "sync_file_range",
1992 .lname = "Sync file range",
1994 { .ival = "wait_before",
1995 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1996 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2000 .oval = SYNC_FILE_RANGE_WRITE,
2001 .help = "SYNC_FILE_RANGE_WRITE",
2005 .ival = "wait_after",
2006 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2007 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2011 .type = FIO_OPT_STR_MULTI,
2013 .off1 = td_var_offset(sync_file_range),
2014 .help = "Use sync_file_range()",
2015 .category = FIO_OPT_C_FILE,
2016 .group = FIO_OPT_G_INVALID,
2021 .lname = "Direct I/O",
2022 .type = FIO_OPT_BOOL,
2023 .off1 = td_var_offset(odirect),
2024 .help = "Use O_DIRECT IO (negates buffered)",
2026 .inverse = "buffered",
2027 .category = FIO_OPT_C_IO,
2028 .group = FIO_OPT_G_IO_TYPE,
2032 .lname = "Atomic I/O",
2033 .type = FIO_OPT_BOOL,
2034 .off1 = td_var_offset(oatomic),
2035 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2037 .category = FIO_OPT_C_IO,
2038 .group = FIO_OPT_G_IO_TYPE,
2042 .lname = "Buffered I/O",
2043 .type = FIO_OPT_BOOL,
2044 .off1 = td_var_offset(odirect),
2046 .help = "Use buffered IO (negates direct)",
2048 .inverse = "direct",
2049 .category = FIO_OPT_C_IO,
2050 .group = FIO_OPT_G_IO_TYPE,
2053 .name = "overwrite",
2054 .lname = "Overwrite",
2055 .type = FIO_OPT_BOOL,
2056 .off1 = td_var_offset(overwrite),
2057 .help = "When writing, set whether to overwrite current data",
2059 .category = FIO_OPT_C_FILE,
2060 .group = FIO_OPT_G_INVALID,
2065 .type = FIO_OPT_INT,
2066 .off1 = td_var_offset(loops),
2067 .help = "Number of times to run the job",
2070 .category = FIO_OPT_C_GENERAL,
2071 .group = FIO_OPT_G_RUNTIME,
2075 .lname = "Number of jobs",
2076 .type = FIO_OPT_INT,
2077 .off1 = td_var_offset(numjobs),
2078 .help = "Duplicate this job this many times",
2081 .category = FIO_OPT_C_GENERAL,
2082 .group = FIO_OPT_G_RUNTIME,
2085 .name = "startdelay",
2086 .lname = "Start delay",
2087 .type = FIO_OPT_STR_VAL_TIME,
2088 .off1 = td_var_offset(start_delay),
2089 .off2 = td_var_offset(start_delay_high),
2090 .help = "Only start job when this period has passed",
2093 .category = FIO_OPT_C_GENERAL,
2094 .group = FIO_OPT_G_RUNTIME,
2100 .type = FIO_OPT_STR_VAL_TIME,
2101 .off1 = td_var_offset(timeout),
2102 .help = "Stop workload when this amount of time has passed",
2105 .category = FIO_OPT_C_GENERAL,
2106 .group = FIO_OPT_G_RUNTIME,
2109 .name = "time_based",
2110 .lname = "Time based",
2111 .type = FIO_OPT_STR_SET,
2112 .off1 = td_var_offset(time_based),
2113 .help = "Keep running until runtime/timeout is met",
2114 .category = FIO_OPT_C_GENERAL,
2115 .group = FIO_OPT_G_RUNTIME,
2118 .name = "verify_only",
2119 .lname = "Verify only",
2120 .type = FIO_OPT_STR_SET,
2121 .off1 = td_var_offset(verify_only),
2122 .help = "Verifies previously written data is still valid",
2123 .category = FIO_OPT_C_GENERAL,
2124 .group = FIO_OPT_G_RUNTIME,
2127 .name = "ramp_time",
2128 .lname = "Ramp time",
2129 .type = FIO_OPT_STR_VAL_TIME,
2130 .off1 = td_var_offset(ramp_time),
2131 .help = "Ramp up time before measuring performance",
2133 .category = FIO_OPT_C_GENERAL,
2134 .group = FIO_OPT_G_RUNTIME,
2137 .name = "clocksource",
2138 .lname = "Clock source",
2139 .type = FIO_OPT_STR,
2140 .cb = fio_clock_source_cb,
2141 .off1 = td_var_offset(clocksource),
2142 .help = "What type of timing source to use",
2143 .category = FIO_OPT_C_GENERAL,
2144 .group = FIO_OPT_G_CLOCK,
2146 #ifdef CONFIG_GETTIMEOFDAY
2147 { .ival = "gettimeofday",
2149 .help = "Use gettimeofday(2) for timing",
2152 #ifdef CONFIG_CLOCK_GETTIME
2153 { .ival = "clock_gettime",
2154 .oval = CS_CGETTIME,
2155 .help = "Use clock_gettime(2) for timing",
2158 #ifdef ARCH_HAVE_CPU_CLOCK
2160 .oval = CS_CPUCLOCK,
2161 .help = "Use CPU private clock",
2169 .lname = "I/O Memory",
2170 .type = FIO_OPT_STR,
2172 .off1 = td_var_offset(mem_type),
2173 .help = "Backing type for IO buffers",
2175 .category = FIO_OPT_C_IO,
2176 .group = FIO_OPT_G_INVALID,
2180 .help = "Use malloc(3) for IO buffers",
2184 .help = "Use shared memory segments for IO buffers",
2186 #ifdef FIO_HAVE_HUGETLB
2187 { .ival = "shmhuge",
2188 .oval = MEM_SHMHUGE,
2189 .help = "Like shm, but use huge pages",
2194 .help = "Use mmap(2) (file or anon) for IO buffers",
2196 #ifdef FIO_HAVE_HUGETLB
2197 { .ival = "mmaphuge",
2198 .oval = MEM_MMAPHUGE,
2199 .help = "Like mmap, but use huge pages",
2205 .name = "iomem_align",
2206 .alias = "mem_align",
2207 .lname = "I/O memory alignment",
2208 .type = FIO_OPT_INT,
2209 .off1 = td_var_offset(mem_align),
2211 .help = "IO memory buffer offset alignment",
2215 .category = FIO_OPT_C_IO,
2216 .group = FIO_OPT_G_INVALID,
2221 .type = FIO_OPT_STR,
2222 .off1 = td_var_offset(verify),
2223 .help = "Verify data written",
2225 .category = FIO_OPT_C_IO,
2226 .group = FIO_OPT_G_VERIFY,
2229 .oval = VERIFY_NONE,
2230 .help = "Don't do IO verification",
2234 .help = "Use md5 checksums for verification",
2237 .oval = VERIFY_CRC64,
2238 .help = "Use crc64 checksums for verification",
2241 .oval = VERIFY_CRC32,
2242 .help = "Use crc32 checksums for verification",
2244 { .ival = "crc32c-intel",
2245 .oval = VERIFY_CRC32C,
2246 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2249 .oval = VERIFY_CRC32C,
2250 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2253 .oval = VERIFY_CRC16,
2254 .help = "Use crc16 checksums for verification",
2257 .oval = VERIFY_CRC7,
2258 .help = "Use crc7 checksums for verification",
2261 .oval = VERIFY_SHA1,
2262 .help = "Use sha1 checksums for verification",
2265 .oval = VERIFY_SHA256,
2266 .help = "Use sha256 checksums for verification",
2269 .oval = VERIFY_SHA512,
2270 .help = "Use sha512 checksums for verification",
2273 .oval = VERIFY_XXHASH,
2274 .help = "Use xxhash checksums for verification",
2277 .oval = VERIFY_META,
2278 .help = "Use io information",
2282 .oval = VERIFY_NULL,
2283 .help = "Pretend to verify",
2288 .name = "do_verify",
2289 .lname = "Perform verify step",
2290 .type = FIO_OPT_BOOL,
2291 .off1 = td_var_offset(do_verify),
2292 .help = "Run verification stage after write",
2296 .category = FIO_OPT_C_IO,
2297 .group = FIO_OPT_G_VERIFY,
2300 .name = "verifysort",
2301 .lname = "Verify sort",
2302 .type = FIO_OPT_BOOL,
2303 .off1 = td_var_offset(verifysort),
2304 .help = "Sort written verify blocks for read back",
2308 .category = FIO_OPT_C_IO,
2309 .group = FIO_OPT_G_VERIFY,
2312 .name = "verifysort_nr",
2313 .type = FIO_OPT_INT,
2314 .off1 = td_var_offset(verifysort_nr),
2315 .help = "Pre-load and sort verify blocks for a read workload",
2320 .category = FIO_OPT_C_IO,
2321 .group = FIO_OPT_G_VERIFY,
2324 .name = "verify_interval",
2325 .lname = "Verify interval",
2326 .type = FIO_OPT_INT,
2327 .off1 = td_var_offset(verify_interval),
2328 .minval = 2 * sizeof(struct verify_header),
2329 .help = "Store verify buffer header every N bytes",
2332 .interval = 2 * sizeof(struct verify_header),
2333 .category = FIO_OPT_C_IO,
2334 .group = FIO_OPT_G_VERIFY,
2337 .name = "verify_offset",
2338 .lname = "Verify offset",
2339 .type = FIO_OPT_INT,
2340 .help = "Offset verify header location by N bytes",
2341 .off1 = td_var_offset(verify_offset),
2342 .minval = sizeof(struct verify_header),
2345 .category = FIO_OPT_C_IO,
2346 .group = FIO_OPT_G_VERIFY,
2349 .name = "verify_pattern",
2350 .lname = "Verify pattern",
2351 .type = FIO_OPT_STR,
2352 .cb = str_verify_pattern_cb,
2353 .help = "Fill pattern for IO buffers",
2356 .category = FIO_OPT_C_IO,
2357 .group = FIO_OPT_G_VERIFY,
2360 .name = "verify_fatal",
2361 .lname = "Verify fatal",
2362 .type = FIO_OPT_BOOL,
2363 .off1 = td_var_offset(verify_fatal),
2365 .help = "Exit on a single verify failure, don't continue",
2368 .category = FIO_OPT_C_IO,
2369 .group = FIO_OPT_G_VERIFY,
2372 .name = "verify_dump",
2373 .lname = "Verify dump",
2374 .type = FIO_OPT_BOOL,
2375 .off1 = td_var_offset(verify_dump),
2377 .help = "Dump contents of good and bad blocks on failure",
2380 .category = FIO_OPT_C_IO,
2381 .group = FIO_OPT_G_VERIFY,
2384 .name = "verify_async",
2385 .lname = "Verify asynchronously",
2386 .type = FIO_OPT_INT,
2387 .off1 = td_var_offset(verify_async),
2389 .help = "Number of async verifier threads to use",
2392 .category = FIO_OPT_C_IO,
2393 .group = FIO_OPT_G_VERIFY,
2396 .name = "verify_backlog",
2397 .lname = "Verify backlog",
2398 .type = FIO_OPT_STR_VAL,
2399 .off1 = td_var_offset(verify_backlog),
2400 .help = "Verify after this number of blocks are written",
2403 .category = FIO_OPT_C_IO,
2404 .group = FIO_OPT_G_VERIFY,
2407 .name = "verify_backlog_batch",
2408 .lname = "Verify backlog batch",
2409 .type = FIO_OPT_INT,
2410 .off1 = td_var_offset(verify_batch),
2411 .help = "Verify this number of IO blocks",
2414 .category = FIO_OPT_C_IO,
2415 .group = FIO_OPT_G_VERIFY,
2417 #ifdef FIO_HAVE_CPU_AFFINITY
2419 .name = "verify_async_cpus",
2420 .lname = "Async verify CPUs",
2421 .type = FIO_OPT_STR,
2422 .cb = str_verify_cpus_allowed_cb,
2423 .help = "Set CPUs allowed for async verify threads",
2424 .parent = "verify_async",
2426 .category = FIO_OPT_C_IO,
2427 .group = FIO_OPT_G_VERIFY,
2431 .name = "experimental_verify",
2432 .off1 = td_var_offset(experimental_verify),
2433 .type = FIO_OPT_BOOL,
2434 .help = "Enable experimental verification",
2435 .category = FIO_OPT_C_IO,
2436 .group = FIO_OPT_G_VERIFY,
2438 #ifdef FIO_HAVE_TRIM
2440 .name = "trim_percentage",
2441 .lname = "Trim percentage",
2442 .type = FIO_OPT_INT,
2443 .off1 = td_var_offset(trim_percentage),
2446 .help = "Number of verify blocks to discard/trim",
2451 .category = FIO_OPT_C_IO,
2452 .group = FIO_OPT_G_TRIM,
2455 .name = "trim_verify_zero",
2456 .lname = "Verify trim zero",
2457 .type = FIO_OPT_BOOL,
2458 .help = "Verify that trim/discarded blocks are returned as zeroes",
2459 .off1 = td_var_offset(trim_zero),
2460 .parent = "trim_percentage",
2463 .category = FIO_OPT_C_IO,
2464 .group = FIO_OPT_G_TRIM,
2467 .name = "trim_backlog",
2468 .lname = "Trim backlog",
2469 .type = FIO_OPT_STR_VAL,
2470 .off1 = td_var_offset(trim_backlog),
2471 .help = "Trim after this number of blocks are written",
2472 .parent = "trim_percentage",
2475 .category = FIO_OPT_C_IO,
2476 .group = FIO_OPT_G_TRIM,
2479 .name = "trim_backlog_batch",
2480 .lname = "Trim backlog batch",
2481 .type = FIO_OPT_INT,
2482 .off1 = td_var_offset(trim_batch),
2483 .help = "Trim this number of IO blocks",
2484 .parent = "trim_percentage",
2487 .category = FIO_OPT_C_IO,
2488 .group = FIO_OPT_G_TRIM,
2492 .name = "write_iolog",
2493 .lname = "Write I/O log",
2494 .type = FIO_OPT_STR_STORE,
2495 .off1 = td_var_offset(write_iolog_file),
2496 .help = "Store IO pattern to file",
2497 .category = FIO_OPT_C_IO,
2498 .group = FIO_OPT_G_IOLOG,
2501 .name = "read_iolog",
2502 .lname = "Read I/O log",
2503 .type = FIO_OPT_STR_STORE,
2504 .off1 = td_var_offset(read_iolog_file),
2505 .help = "Playback IO pattern from file",
2506 .category = FIO_OPT_C_IO,
2507 .group = FIO_OPT_G_IOLOG,
2510 .name = "replay_no_stall",
2511 .lname = "Don't stall on replay",
2512 .type = FIO_OPT_BOOL,
2513 .off1 = td_var_offset(no_stall),
2515 .parent = "read_iolog",
2517 .help = "Playback IO pattern file as fast as possible without stalls",
2518 .category = FIO_OPT_C_IO,
2519 .group = FIO_OPT_G_IOLOG,
2522 .name = "replay_redirect",
2523 .lname = "Redirect device for replay",
2524 .type = FIO_OPT_STR_STORE,
2525 .off1 = td_var_offset(replay_redirect),
2526 .parent = "read_iolog",
2528 .help = "Replay all I/O onto this device, regardless of trace device",
2529 .category = FIO_OPT_C_IO,
2530 .group = FIO_OPT_G_IOLOG,
2533 .name = "exec_prerun",
2534 .lname = "Pre-execute runnable",
2535 .type = FIO_OPT_STR_STORE,
2536 .off1 = td_var_offset(exec_prerun),
2537 .help = "Execute this file prior to running job",
2538 .category = FIO_OPT_C_GENERAL,
2539 .group = FIO_OPT_G_INVALID,
2542 .name = "exec_postrun",
2543 .lname = "Post-execute runnable",
2544 .type = FIO_OPT_STR_STORE,
2545 .off1 = td_var_offset(exec_postrun),
2546 .help = "Execute this file after running job",
2547 .category = FIO_OPT_C_GENERAL,
2548 .group = FIO_OPT_G_INVALID,
2550 #ifdef FIO_HAVE_IOSCHED_SWITCH
2552 .name = "ioscheduler",
2553 .lname = "I/O scheduler",
2554 .type = FIO_OPT_STR_STORE,
2555 .off1 = td_var_offset(ioscheduler),
2556 .help = "Use this IO scheduler on the backing device",
2557 .category = FIO_OPT_C_FILE,
2558 .group = FIO_OPT_G_INVALID,
2563 .lname = "Zone size",
2564 .type = FIO_OPT_STR_VAL,
2565 .off1 = td_var_offset(zone_size),
2566 .help = "Amount of data to read per zone",
2568 .interval = 1024 * 1024,
2569 .category = FIO_OPT_C_IO,
2570 .group = FIO_OPT_G_ZONE,
2573 .name = "zonerange",
2574 .lname = "Zone range",
2575 .type = FIO_OPT_STR_VAL,
2576 .off1 = td_var_offset(zone_range),
2577 .help = "Give size of an IO zone",
2579 .interval = 1024 * 1024,
2580 .category = FIO_OPT_C_IO,
2581 .group = FIO_OPT_G_ZONE,
2585 .lname = "Zone skip",
2586 .type = FIO_OPT_STR_VAL,
2587 .off1 = td_var_offset(zone_skip),
2588 .help = "Space between IO zones",
2590 .interval = 1024 * 1024,
2591 .category = FIO_OPT_C_IO,
2592 .group = FIO_OPT_G_ZONE,
2596 .lname = "Lock memory",
2597 .type = FIO_OPT_STR_VAL,
2598 .off1 = td_var_offset(lockmem),
2599 .help = "Lock down this amount of memory (per worker)",
2601 .interval = 1024 * 1024,
2602 .category = FIO_OPT_C_GENERAL,
2603 .group = FIO_OPT_G_INVALID,
2606 .name = "rwmixread",
2607 .lname = "Read/write mix read",
2608 .type = FIO_OPT_INT,
2609 .cb = str_rwmix_read_cb,
2611 .help = "Percentage of mixed workload that is reads",
2614 .inverse = "rwmixwrite",
2615 .category = FIO_OPT_C_IO,
2616 .group = FIO_OPT_G_RWMIX,
2619 .name = "rwmixwrite",
2620 .lname = "Read/write mix write",
2621 .type = FIO_OPT_INT,
2622 .cb = str_rwmix_write_cb,
2624 .help = "Percentage of mixed workload that is writes",
2627 .inverse = "rwmixread",
2628 .category = FIO_OPT_C_IO,
2629 .group = FIO_OPT_G_RWMIX,
2632 .name = "rwmixcycle",
2633 .lname = "Read/write mix cycle",
2634 .type = FIO_OPT_DEPRECATED,
2635 .category = FIO_OPT_C_IO,
2636 .group = FIO_OPT_G_RWMIX,
2641 .type = FIO_OPT_INT,
2642 .off1 = td_var_offset(nice),
2643 .help = "Set job CPU nice value",
2648 .category = FIO_OPT_C_GENERAL,
2649 .group = FIO_OPT_G_CRED,
2651 #ifdef FIO_HAVE_IOPRIO
2654 .lname = "I/O nice priority",
2655 .type = FIO_OPT_INT,
2656 .off1 = td_var_offset(ioprio),
2657 .help = "Set job IO priority value",
2661 .category = FIO_OPT_C_GENERAL,
2662 .group = FIO_OPT_G_CRED,
2665 .name = "prioclass",
2666 .lname = "I/O nice priority class",
2667 .type = FIO_OPT_INT,
2668 .off1 = td_var_offset(ioprio_class),
2669 .help = "Set job IO priority class",
2673 .category = FIO_OPT_C_GENERAL,
2674 .group = FIO_OPT_G_CRED,
2678 .name = "thinktime",
2679 .lname = "Thinktime",
2680 .type = FIO_OPT_INT,
2681 .off1 = td_var_offset(thinktime),
2682 .help = "Idle time between IO buffers (usec)",
2684 .category = FIO_OPT_C_IO,
2685 .group = FIO_OPT_G_THINKTIME,
2688 .name = "thinktime_spin",
2689 .lname = "Thinktime spin",
2690 .type = FIO_OPT_INT,
2691 .off1 = td_var_offset(thinktime_spin),
2692 .help = "Start think time by spinning this amount (usec)",
2694 .parent = "thinktime",
2696 .category = FIO_OPT_C_IO,
2697 .group = FIO_OPT_G_THINKTIME,
2700 .name = "thinktime_blocks",
2701 .lname = "Thinktime blocks",
2702 .type = FIO_OPT_INT,
2703 .off1 = td_var_offset(thinktime_blocks),
2704 .help = "IO buffer period between 'thinktime'",
2706 .parent = "thinktime",
2708 .category = FIO_OPT_C_IO,
2709 .group = FIO_OPT_G_THINKTIME,
2713 .lname = "I/O rate",
2714 .type = FIO_OPT_INT,
2715 .off1 = td_var_offset(rate[DDIR_READ]),
2716 .off2 = td_var_offset(rate[DDIR_WRITE]),
2717 .off3 = td_var_offset(rate[DDIR_TRIM]),
2718 .help = "Set bandwidth rate",
2719 .category = FIO_OPT_C_IO,
2720 .group = FIO_OPT_G_RATE,
2724 .lname = "I/O min rate",
2725 .type = FIO_OPT_INT,
2726 .off1 = td_var_offset(ratemin[DDIR_READ]),
2727 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2728 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2729 .help = "Job must meet this rate or it will be shutdown",
2732 .category = FIO_OPT_C_IO,
2733 .group = FIO_OPT_G_RATE,
2736 .name = "rate_iops",
2737 .lname = "I/O rate IOPS",
2738 .type = FIO_OPT_INT,
2739 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2740 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2741 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2742 .help = "Limit IO used to this number of IO operations/sec",
2744 .category = FIO_OPT_C_IO,
2745 .group = FIO_OPT_G_RATE,
2748 .name = "rate_iops_min",
2749 .lname = "I/O min rate IOPS",
2750 .type = FIO_OPT_INT,
2751 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2752 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2753 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2754 .help = "Job must meet this rate or it will be shut down",
2755 .parent = "rate_iops",
2757 .category = FIO_OPT_C_IO,
2758 .group = FIO_OPT_G_RATE,
2761 .name = "ratecycle",
2762 .lname = "I/O rate cycle",
2763 .type = FIO_OPT_INT,
2764 .off1 = td_var_offset(ratecycle),
2765 .help = "Window average for rate limits (msec)",
2769 .category = FIO_OPT_C_IO,
2770 .group = FIO_OPT_G_RATE,
2773 .name = "max_latency",
2774 .type = FIO_OPT_INT,
2775 .off1 = td_var_offset(max_latency),
2776 .help = "Maximum tolerated IO latency (usec)",
2777 .category = FIO_OPT_C_IO,
2778 .group = FIO_OPT_G_LATPROF,
2781 .name = "latency_target",
2782 .lname = "Latency Target (usec)",
2783 .type = FIO_OPT_STR_VAL_TIME,
2784 .off1 = td_var_offset(latency_target),
2785 .help = "Ramp to max queue depth supporting this latency",
2786 .category = FIO_OPT_C_IO,
2787 .group = FIO_OPT_G_LATPROF,
2790 .name = "latency_window",
2791 .lname = "Latency Window (usec)",
2792 .type = FIO_OPT_STR_VAL_TIME,
2793 .off1 = td_var_offset(latency_window),
2794 .help = "Time to sustain latency_target",
2795 .category = FIO_OPT_C_IO,
2796 .group = FIO_OPT_G_LATPROF,
2799 .name = "latency_percentile",
2800 .lname = "Latency Percentile",
2801 .type = FIO_OPT_FLOAT_LIST,
2802 .off1 = td_var_offset(latency_percentile),
2803 .help = "Percentile of IOs must be below latency_target",
2808 .category = FIO_OPT_C_IO,
2809 .group = FIO_OPT_G_LATPROF,
2812 .name = "invalidate",
2813 .lname = "Cache invalidate",
2814 .type = FIO_OPT_BOOL,
2815 .off1 = td_var_offset(invalidate_cache),
2816 .help = "Invalidate buffer/page cache prior to running job",
2818 .category = FIO_OPT_C_IO,
2819 .group = FIO_OPT_G_IO_TYPE,
2823 .lname = "Synchronous I/O",
2824 .type = FIO_OPT_BOOL,
2825 .off1 = td_var_offset(sync_io),
2826 .help = "Use O_SYNC for buffered writes",
2828 .parent = "buffered",
2830 .category = FIO_OPT_C_IO,
2831 .group = FIO_OPT_G_IO_TYPE,
2834 .name = "create_serialize",
2835 .lname = "Create serialize",
2836 .type = FIO_OPT_BOOL,
2837 .off1 = td_var_offset(create_serialize),
2838 .help = "Serialize creating of job files",
2840 .category = FIO_OPT_C_FILE,
2841 .group = FIO_OPT_G_INVALID,
2844 .name = "create_fsync",
2845 .lname = "Create fsync",
2846 .type = FIO_OPT_BOOL,
2847 .off1 = td_var_offset(create_fsync),
2848 .help = "fsync file after creation",
2850 .category = FIO_OPT_C_FILE,
2851 .group = FIO_OPT_G_INVALID,
2854 .name = "create_on_open",
2855 .lname = "Create on open",
2856 .type = FIO_OPT_BOOL,
2857 .off1 = td_var_offset(create_on_open),
2858 .help = "Create files when they are opened for IO",
2860 .category = FIO_OPT_C_FILE,
2861 .group = FIO_OPT_G_INVALID,
2864 .name = "create_only",
2865 .type = FIO_OPT_BOOL,
2866 .off1 = td_var_offset(create_only),
2867 .help = "Only perform file creation phase",
2868 .category = FIO_OPT_C_FILE,
2873 .lname = "Pre-read files",
2874 .type = FIO_OPT_BOOL,
2875 .off1 = td_var_offset(pre_read),
2876 .help = "Pre-read files before starting official testing",
2878 .category = FIO_OPT_C_FILE,
2879 .group = FIO_OPT_G_INVALID,
2881 #ifdef FIO_HAVE_CPU_AFFINITY
2884 .lname = "CPU mask",
2885 .type = FIO_OPT_INT,
2886 .cb = str_cpumask_cb,
2887 .help = "CPU affinity mask",
2888 .category = FIO_OPT_C_GENERAL,
2889 .group = FIO_OPT_G_CRED,
2892 .name = "cpus_allowed",
2893 .lname = "CPUs allowed",
2894 .type = FIO_OPT_STR,
2895 .cb = str_cpus_allowed_cb,
2896 .help = "Set CPUs allowed",
2897 .category = FIO_OPT_C_GENERAL,
2898 .group = FIO_OPT_G_CRED,
2901 .name = "cpus_allowed_policy",
2902 .lname = "CPUs allowed distribution policy",
2903 .type = FIO_OPT_STR,
2904 .off1 = td_var_offset(cpus_allowed_policy),
2905 .help = "Distribution policy for cpus_allowed",
2906 .parent = "cpus_allowed",
2910 .oval = FIO_CPUS_SHARED,
2911 .help = "Mask shared between threads",
2914 .oval = FIO_CPUS_SPLIT,
2915 .help = "Mask split between threads",
2918 .category = FIO_OPT_C_GENERAL,
2919 .group = FIO_OPT_G_CRED,
2922 #ifdef CONFIG_LIBNUMA
2924 .name = "numa_cpu_nodes",
2925 .type = FIO_OPT_STR,
2926 .cb = str_numa_cpunodes_cb,
2927 .help = "NUMA CPU nodes bind",
2928 .category = FIO_OPT_C_GENERAL,
2929 .group = FIO_OPT_G_INVALID,
2932 .name = "numa_mem_policy",
2933 .type = FIO_OPT_STR,
2934 .cb = str_numa_mpol_cb,
2935 .help = "NUMA memory policy setup",
2936 .category = FIO_OPT_C_GENERAL,
2937 .group = FIO_OPT_G_INVALID,
2941 .name = "end_fsync",
2942 .lname = "End fsync",
2943 .type = FIO_OPT_BOOL,
2944 .off1 = td_var_offset(end_fsync),
2945 .help = "Include fsync at the end of job",
2947 .category = FIO_OPT_C_FILE,
2948 .group = FIO_OPT_G_INVALID,
2951 .name = "fsync_on_close",
2952 .lname = "Fsync on close",
2953 .type = FIO_OPT_BOOL,
2954 .off1 = td_var_offset(fsync_on_close),
2955 .help = "fsync files on close",
2957 .category = FIO_OPT_C_FILE,
2958 .group = FIO_OPT_G_INVALID,
2962 .lname = "Unlink file",
2963 .type = FIO_OPT_BOOL,
2964 .off1 = td_var_offset(unlink),
2965 .help = "Unlink created files after job has completed",
2967 .category = FIO_OPT_C_FILE,
2968 .group = FIO_OPT_G_INVALID,
2972 .lname = "Exit-all on terminate",
2973 .type = FIO_OPT_STR_SET,
2974 .cb = str_exitall_cb,
2975 .help = "Terminate all jobs when one exits",
2976 .category = FIO_OPT_C_GENERAL,
2977 .group = FIO_OPT_G_PROCESS,
2980 .name = "stonewall",
2981 .lname = "Wait for previous",
2982 .alias = "wait_for_previous",
2983 .type = FIO_OPT_STR_SET,
2984 .off1 = td_var_offset(stonewall),
2985 .help = "Insert a hard barrier between this job and previous",
2986 .category = FIO_OPT_C_GENERAL,
2987 .group = FIO_OPT_G_PROCESS,
2990 .name = "new_group",
2991 .lname = "New group",
2992 .type = FIO_OPT_STR_SET,
2993 .off1 = td_var_offset(new_group),
2994 .help = "Mark the start of a new group (for reporting)",
2995 .category = FIO_OPT_C_GENERAL,
2996 .group = FIO_OPT_G_PROCESS,
3001 .type = FIO_OPT_STR_SET,
3002 .off1 = td_var_offset(use_thread),
3003 .help = "Use threads instead of processes",
3004 .category = FIO_OPT_C_GENERAL,
3005 .group = FIO_OPT_G_PROCESS,
3008 .name = "write_bw_log",
3009 .lname = "Write bandwidth log",
3010 .type = FIO_OPT_STR_STORE,
3011 .off1 = td_var_offset(bw_log_file),
3012 .help = "Write log of bandwidth during run",
3013 .category = FIO_OPT_C_LOG,
3014 .group = FIO_OPT_G_INVALID,
3017 .name = "write_lat_log",
3018 .lname = "Write latency log",
3019 .type = FIO_OPT_STR_STORE,
3020 .off1 = td_var_offset(lat_log_file),
3021 .help = "Write log of latency during run",
3022 .category = FIO_OPT_C_LOG,
3023 .group = FIO_OPT_G_INVALID,
3026 .name = "write_iops_log",
3027 .lname = "Write IOPS log",
3028 .type = FIO_OPT_STR_STORE,
3029 .off1 = td_var_offset(iops_log_file),
3030 .help = "Write log of IOPS during run",
3031 .category = FIO_OPT_C_LOG,
3032 .group = FIO_OPT_G_INVALID,
3035 .name = "log_avg_msec",
3036 .lname = "Log averaging (msec)",
3037 .type = FIO_OPT_INT,
3038 .off1 = td_var_offset(log_avg_msec),
3039 .help = "Average bw/iops/lat logs over this period of time",
3041 .category = FIO_OPT_C_LOG,
3042 .group = FIO_OPT_G_INVALID,
3045 .name = "bwavgtime",
3046 .lname = "Bandwidth average time",
3047 .type = FIO_OPT_INT,
3048 .off1 = td_var_offset(bw_avg_time),
3049 .help = "Time window over which to calculate bandwidth"
3052 .parent = "write_bw_log",
3055 .category = FIO_OPT_C_LOG,
3056 .group = FIO_OPT_G_INVALID,
3059 .name = "iopsavgtime",
3060 .lname = "IOPS average time",
3061 .type = FIO_OPT_INT,
3062 .off1 = td_var_offset(iops_avg_time),
3063 .help = "Time window over which to calculate IOPS (msec)",
3065 .parent = "write_iops_log",
3068 .category = FIO_OPT_C_LOG,
3069 .group = FIO_OPT_G_INVALID,
3072 .name = "group_reporting",
3073 .lname = "Group reporting",
3074 .type = FIO_OPT_STR_SET,
3075 .off1 = td_var_offset(group_reporting),
3076 .help = "Do reporting on a per-group basis",
3077 .category = FIO_OPT_C_STAT,
3078 .group = FIO_OPT_G_INVALID,
3081 .name = "zero_buffers",
3082 .lname = "Zero I/O buffers",
3083 .type = FIO_OPT_STR_SET,
3084 .off1 = td_var_offset(zero_buffers),
3085 .help = "Init IO buffers to all zeroes",
3086 .category = FIO_OPT_C_IO,
3087 .group = FIO_OPT_G_IO_BUF,
3090 .name = "refill_buffers",
3091 .lname = "Refill I/O buffers",
3092 .type = FIO_OPT_STR_SET,
3093 .off1 = td_var_offset(refill_buffers),
3094 .help = "Refill IO buffers on every IO submit",
3095 .category = FIO_OPT_C_IO,
3096 .group = FIO_OPT_G_IO_BUF,
3099 .name = "scramble_buffers",
3100 .lname = "Scramble I/O buffers",
3101 .type = FIO_OPT_BOOL,
3102 .off1 = td_var_offset(scramble_buffers),
3103 .help = "Slightly scramble buffers on every IO submit",
3105 .category = FIO_OPT_C_IO,
3106 .group = FIO_OPT_G_IO_BUF,
3109 .name = "buffer_pattern",
3110 .lname = "Buffer pattern",
3111 .type = FIO_OPT_STR,
3112 .cb = str_buffer_pattern_cb,
3113 .help = "Fill pattern for IO buffers",
3114 .category = FIO_OPT_C_IO,
3115 .group = FIO_OPT_G_IO_BUF,
3118 .name = "buffer_compress_percentage",
3119 .lname = "Buffer compression percentage",
3120 .type = FIO_OPT_INT,
3121 .off1 = td_var_offset(compress_percentage),
3124 .help = "How compressible the buffer is (approximately)",
3126 .category = FIO_OPT_C_IO,
3127 .group = FIO_OPT_G_IO_BUF,
3130 .name = "buffer_compress_chunk",
3131 .lname = "Buffer compression chunk size",
3132 .type = FIO_OPT_INT,
3133 .off1 = td_var_offset(compress_chunk),
3134 .parent = "buffer_compress_percentage",
3136 .help = "Size of compressible region in buffer",
3138 .category = FIO_OPT_C_IO,
3139 .group = FIO_OPT_G_IO_BUF,
3142 .name = "clat_percentiles",
3143 .lname = "Completion latency percentiles",
3144 .type = FIO_OPT_BOOL,
3145 .off1 = td_var_offset(clat_percentiles),
3146 .help = "Enable the reporting of completion latency percentiles",
3148 .category = FIO_OPT_C_STAT,
3149 .group = FIO_OPT_G_INVALID,
3152 .name = "percentile_list",
3153 .lname = "Completion latency percentile list",
3154 .type = FIO_OPT_FLOAT_LIST,
3155 .off1 = td_var_offset(percentile_list),
3156 .off2 = td_var_offset(percentile_precision),
3157 .help = "Specify a custom list of percentiles to report",
3158 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3159 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3162 .category = FIO_OPT_C_STAT,
3163 .group = FIO_OPT_G_INVALID,
3166 #ifdef FIO_HAVE_DISK_UTIL
3168 .name = "disk_util",
3169 .lname = "Disk utilization",
3170 .type = FIO_OPT_BOOL,
3171 .off1 = td_var_offset(do_disk_util),
3172 .help = "Log disk utilization statistics",
3174 .category = FIO_OPT_C_STAT,
3175 .group = FIO_OPT_G_INVALID,
3179 .name = "gtod_reduce",
3180 .lname = "Reduce gettimeofday() calls",
3181 .type = FIO_OPT_BOOL,
3182 .help = "Greatly reduce number of gettimeofday() calls",
3183 .cb = str_gtod_reduce_cb,
3186 .category = FIO_OPT_C_STAT,
3187 .group = FIO_OPT_G_INVALID,
3190 .name = "disable_lat",
3191 .lname = "Disable all latency stats",
3192 .type = FIO_OPT_BOOL,
3193 .off1 = td_var_offset(disable_lat),
3194 .help = "Disable latency numbers",
3195 .parent = "gtod_reduce",
3198 .category = FIO_OPT_C_STAT,
3199 .group = FIO_OPT_G_INVALID,
3202 .name = "disable_clat",
3203 .lname = "Disable completion latency stats",
3204 .type = FIO_OPT_BOOL,
3205 .off1 = td_var_offset(disable_clat),
3206 .help = "Disable completion latency numbers",
3207 .parent = "gtod_reduce",
3210 .category = FIO_OPT_C_STAT,
3211 .group = FIO_OPT_G_INVALID,
3214 .name = "disable_slat",
3215 .lname = "Disable submission latency stats",
3216 .type = FIO_OPT_BOOL,
3217 .off1 = td_var_offset(disable_slat),
3218 .help = "Disable submission latency numbers",
3219 .parent = "gtod_reduce",
3222 .category = FIO_OPT_C_STAT,
3223 .group = FIO_OPT_G_INVALID,
3226 .name = "disable_bw_measurement",
3227 .lname = "Disable bandwidth stats",
3228 .type = FIO_OPT_BOOL,
3229 .off1 = td_var_offset(disable_bw),
3230 .help = "Disable bandwidth logging",
3231 .parent = "gtod_reduce",
3234 .category = FIO_OPT_C_STAT,
3235 .group = FIO_OPT_G_INVALID,
3239 .lname = "Dedicated gettimeofday() CPU",
3240 .type = FIO_OPT_INT,
3241 .cb = str_gtod_cpu_cb,
3242 .help = "Set up dedicated gettimeofday() thread on this CPU",
3243 .verify = gtod_cpu_verify,
3244 .category = FIO_OPT_C_GENERAL,
3245 .group = FIO_OPT_G_CLOCK,
3248 .name = "unified_rw_reporting",
3249 .type = FIO_OPT_BOOL,
3250 .off1 = td_var_offset(unified_rw_rep),
3251 .help = "Unify reporting across data direction",
3253 .category = FIO_OPT_C_GENERAL,
3254 .group = FIO_OPT_G_INVALID,
3257 .name = "continue_on_error",
3258 .lname = "Continue on error",
3259 .type = FIO_OPT_STR,
3260 .off1 = td_var_offset(continue_on_error),
3261 .help = "Continue on non-fatal errors during IO",
3263 .category = FIO_OPT_C_GENERAL,
3264 .group = FIO_OPT_G_ERR,
3267 .oval = ERROR_TYPE_NONE,
3268 .help = "Exit when an error is encountered",
3271 .oval = ERROR_TYPE_READ,
3272 .help = "Continue on read errors only",
3275 .oval = ERROR_TYPE_WRITE,
3276 .help = "Continue on write errors only",
3279 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3280 .help = "Continue on any IO errors",
3283 .oval = ERROR_TYPE_VERIFY,
3284 .help = "Continue on verify errors only",
3287 .oval = ERROR_TYPE_ANY,
3288 .help = "Continue on all io and verify errors",
3291 .oval = ERROR_TYPE_NONE,
3292 .help = "Alias for 'none'",
3295 .oval = ERROR_TYPE_ANY,
3296 .help = "Alias for 'all'",
3301 .name = "ignore_error",
3302 .type = FIO_OPT_STR,
3303 .cb = str_ignore_error_cb,
3304 .help = "Set a specific list of errors to ignore",
3306 .category = FIO_OPT_C_GENERAL,
3307 .group = FIO_OPT_G_ERR,
3310 .name = "error_dump",
3311 .type = FIO_OPT_BOOL,
3312 .off1 = td_var_offset(error_dump),
3314 .help = "Dump info on each error",
3315 .category = FIO_OPT_C_GENERAL,
3316 .group = FIO_OPT_G_ERR,
3321 .type = FIO_OPT_STR_STORE,
3322 .off1 = td_var_offset(profile),
3323 .help = "Select a specific builtin performance test",
3324 .category = FIO_OPT_C_PROFILE,
3325 .group = FIO_OPT_G_INVALID,
3330 .type = FIO_OPT_STR_STORE,
3331 .off1 = td_var_offset(cgroup),
3332 .help = "Add job to cgroup of this name",
3333 .category = FIO_OPT_C_GENERAL,
3334 .group = FIO_OPT_G_CGROUP,
3337 .name = "cgroup_nodelete",
3338 .lname = "Cgroup no-delete",
3339 .type = FIO_OPT_BOOL,
3340 .off1 = td_var_offset(cgroup_nodelete),
3341 .help = "Do not delete cgroups after job completion",
3344 .category = FIO_OPT_C_GENERAL,
3345 .group = FIO_OPT_G_CGROUP,
3348 .name = "cgroup_weight",
3349 .lname = "Cgroup weight",
3350 .type = FIO_OPT_INT,
3351 .off1 = td_var_offset(cgroup_weight),
3352 .help = "Use given weight for cgroup",
3356 .category = FIO_OPT_C_GENERAL,
3357 .group = FIO_OPT_G_CGROUP,
3362 .type = FIO_OPT_INT,
3363 .off1 = td_var_offset(uid),
3364 .help = "Run job with this user ID",
3365 .category = FIO_OPT_C_GENERAL,
3366 .group = FIO_OPT_G_CRED,
3370 .lname = "Group ID",
3371 .type = FIO_OPT_INT,
3372 .off1 = td_var_offset(gid),
3373 .help = "Run job with this group ID",
3374 .category = FIO_OPT_C_GENERAL,
3375 .group = FIO_OPT_G_CRED,
3380 .type = FIO_OPT_INT,
3381 .off1 = td_var_offset(kb_base),
3387 .help = "Use 1024 as the K base",
3391 .help = "Use 1000 as the K base",
3394 .help = "How many bytes per KB for reporting (1000 or 1024)",
3395 .category = FIO_OPT_C_GENERAL,
3396 .group = FIO_OPT_G_INVALID,
3399 .name = "unit_base",
3400 .lname = "Base unit for reporting (Bits or Bytes)",
3401 .type = FIO_OPT_INT,
3402 .off1 = td_var_offset(unit_base),
3407 .help = "Auto-detect",
3411 .help = "Normal (byte based)",
3415 .help = "Bit based",
3418 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3419 .category = FIO_OPT_C_GENERAL,
3420 .group = FIO_OPT_G_INVALID,
3423 .name = "hugepage-size",
3424 .lname = "Hugepage size",
3425 .type = FIO_OPT_INT,
3426 .off1 = td_var_offset(hugepage_size),
3427 .help = "When using hugepages, specify size of each page",
3428 .def = __fio_stringify(FIO_HUGE_PAGE),
3429 .interval = 1024 * 1024,
3430 .category = FIO_OPT_C_GENERAL,
3431 .group = FIO_OPT_G_INVALID,
3435 .lname = "I/O flow ID",
3436 .type = FIO_OPT_INT,
3437 .off1 = td_var_offset(flow_id),
3438 .help = "The flow index ID to use",
3440 .category = FIO_OPT_C_IO,
3441 .group = FIO_OPT_G_IO_FLOW,
3445 .lname = "I/O flow weight",
3446 .type = FIO_OPT_INT,
3447 .off1 = td_var_offset(flow),
3448 .help = "Weight for flow control of this job",
3449 .parent = "flow_id",
3452 .category = FIO_OPT_C_IO,
3453 .group = FIO_OPT_G_IO_FLOW,
3456 .name = "flow_watermark",
3457 .lname = "I/O flow watermark",
3458 .type = FIO_OPT_INT,
3459 .off1 = td_var_offset(flow_watermark),
3460 .help = "High watermark for flow control. This option"
3461 " should be set to the same value for all threads"
3462 " with non-zero flow.",
3463 .parent = "flow_id",
3466 .category = FIO_OPT_C_IO,
3467 .group = FIO_OPT_G_IO_FLOW,
3470 .name = "flow_sleep",
3471 .lname = "I/O flow sleep",
3472 .type = FIO_OPT_INT,
3473 .off1 = td_var_offset(flow_sleep),
3474 .help = "How many microseconds to sleep after being held"
3475 " back by the flow control mechanism",
3476 .parent = "flow_id",
3479 .category = FIO_OPT_C_IO,
3480 .group = FIO_OPT_G_IO_FLOW,
3487 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3488 const char *name, int val)
3490 lopt->name = (char *) name;
3492 if (o->type == FIO_OPT_STR_SET)
3493 lopt->has_arg = optional_argument;
3495 lopt->has_arg = required_argument;
3498 static void options_to_lopts(struct fio_option *opts,
3499 struct option *long_options,
3500 int i, int option_type)
3502 struct fio_option *o = &opts[0];
3504 add_to_lopt(&long_options[i], o, o->name, option_type);
3507 add_to_lopt(&long_options[i], o, o->alias, option_type);
3512 assert(i < FIO_NR_OPTIONS);
3516 void fio_options_set_ioengine_opts(struct option *long_options,
3517 struct thread_data *td)
3522 while (long_options[i].name) {
3523 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3524 memset(&long_options[i], 0, sizeof(*long_options));
3531 * Just clear out the prior ioengine options.
3536 options_to_lopts(td->io_ops->options, long_options, i,
3537 FIO_GETOPT_IOENGINE);
3540 void fio_options_dup_and_init(struct option *long_options)
3544 options_init(fio_options);
3547 while (long_options[i].name)
3550 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3553 struct fio_keyword {
3559 static struct fio_keyword fio_keywords[] = {
3561 .word = "$pagesize",
3562 .desc = "Page size in the system",
3565 .word = "$mb_memory",
3566 .desc = "Megabytes of memory online",
3570 .desc = "Number of CPUs online in the system",
3577 void fio_keywords_init(void)
3579 unsigned long long mb_memory;
3583 sprintf(buf, "%lu", (unsigned long) page_size);
3584 fio_keywords[0].replace = strdup(buf);
3586 mb_memory = os_phys_mem() / (1024 * 1024);
3587 sprintf(buf, "%llu", mb_memory);
3588 fio_keywords[1].replace = strdup(buf);
3591 sprintf(buf, "%lu", l);
3592 fio_keywords[2].replace = strdup(buf);
3597 static char *bc_calc(char *str)
3599 char buf[128], *tmp;
3604 * No math, just return string
3606 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3607 !strchr(str, '/')) || strchr(str, '\''))
3611 * Split option from value, we only need to calculate the value
3613 tmp = strchr(str, '=');
3620 * Prevent buffer overflows; such a case isn't reasonable anyway
3622 if (strlen(str) >= 128 || strlen(tmp) > 100)
3625 sprintf(buf, "which %s > /dev/null", BC_APP);
3627 log_err("fio: bc is needed for performing math\n");
3631 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3632 f = popen(buf, "r");
3636 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3641 buf[(tmp - str) + ret - 1] = '\0';
3642 memcpy(buf, str, tmp - str);
3648 * Return a copy of the input string with substrings of the form ${VARNAME}
3649 * substituted with the value of the environment variable VARNAME. The
3650 * substitution always occurs, even if VARNAME is empty or the corresponding
3651 * environment variable undefined.
3653 static char *option_dup_subs(const char *opt)
3655 char out[OPT_LEN_MAX+1];
3656 char in[OPT_LEN_MAX+1];
3659 char *ch1, *ch2, *env;
3660 ssize_t nchr = OPT_LEN_MAX;
3663 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3664 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3668 in[OPT_LEN_MAX] = '\0';
3669 strncpy(in, opt, OPT_LEN_MAX);
3671 while (*inptr && nchr > 0) {
3672 if (inptr[0] == '$' && inptr[1] == '{') {
3673 ch2 = strchr(inptr, '}');
3674 if (ch2 && inptr+1 < ch2) {
3681 envlen = strlen(env);
3682 if (envlen <= nchr) {
3683 memcpy(outptr, env, envlen);
3693 *outptr++ = *inptr++;
3702 * Look for reserved variable names and replace them with real values
3704 static char *fio_keyword_replace(char *opt)
3710 for (i = 0; fio_keywords[i].word != NULL; i++) {
3711 struct fio_keyword *kw = &fio_keywords[i];
3713 while ((s = strstr(opt, kw->word)) != NULL) {
3714 char *new = malloc(strlen(opt) + 1);
3720 * Copy part of the string before the keyword and
3721 * sprintf() the replacement after it.
3723 memcpy(new, opt, olen);
3724 len = sprintf(new + olen, "%s", kw->replace);
3727 * If there's more in the original string, copy that
3730 opt += strlen(kw->word) + olen;
3732 memcpy(new + olen + len, opt, opt - o_org - 1);
3735 * replace opt and free the old opt
3745 * Check for potential math and invoke bc, if possible
3753 static char **dup_and_sub_options(char **opts, int num_opts)
3756 char **opts_copy = malloc(num_opts * sizeof(*opts));
3757 for (i = 0; i < num_opts; i++) {
3758 opts_copy[i] = option_dup_subs(opts[i]);
3761 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3766 int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3769 int i, ret, unknown;
3772 sort_options(opts, fio_options, num_opts);
3773 opts_copy = dup_and_sub_options(opts, num_opts);
3775 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3776 struct fio_option *o;
3777 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3778 &o, td, dump_cmdline);
3786 opts_copy[i] = NULL;
3793 ret |= ioengine_load(td);
3795 sort_options(opts_copy, td->io_ops->options, num_opts);
3798 for (i = 0; i < num_opts; i++) {
3799 struct fio_option *o = NULL;
3805 newret = parse_option(opts_copy[i], opts[i],
3806 td->io_ops->options, &o,
3807 td->eo, dump_cmdline);
3811 log_err("Bad option <%s>\n", opts[i]);
3814 opts_copy[i] = NULL;
3822 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3824 return parse_cmd_option(opt, val, fio_options, td);
3827 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3830 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
3833 void fio_fill_default_options(struct thread_data *td)
3835 td->o.magic = OPT_MAGIC;
3836 fill_default_options(td, fio_options);
3839 int fio_show_option_help(const char *opt)
3841 return show_cmd_help(fio_options, opt);
3844 void options_mem_dupe(void *data, struct fio_option *options)
3846 struct fio_option *o;
3849 for (o = &options[0]; o->name; o++) {
3850 if (o->type != FIO_OPT_STR_STORE)
3853 ptr = td_var(data, o, o->off1);
3855 *ptr = strdup(*ptr);
3860 * dupe FIO_OPT_STR_STORE options
3862 void fio_options_mem_dupe(struct thread_data *td)
3864 options_mem_dupe(&td->o, fio_options);
3866 if (td->eo && td->io_ops) {
3867 void *oldeo = td->eo;
3869 td->eo = malloc(td->io_ops->option_struct_size);
3870 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3871 options_mem_dupe(td->eo, td->io_ops->options);
3875 unsigned int fio_get_kb_base(void *data)
3877 struct thread_options *o = data;
3878 unsigned int kb_base = 0;
3881 * This is a hack... For private options, *data is not holding
3882 * a pointer to the thread_options, but to private data. This means
3883 * we can't safely dereference it, but magic is first so mem wise
3884 * it is valid. But this also means that if the job first sets
3885 * kb_base and expects that to be honored by private options,
3886 * it will be disappointed. We will return the global default
3889 if (o && o->magic == OPT_MAGIC)
3890 kb_base = o->kb_base;
3897 int add_option(struct fio_option *o)
3899 struct fio_option *__o;
3908 if (opt_index + 1 == FIO_MAX_OPTS) {
3909 log_err("fio: FIO_MAX_OPTS is too small\n");
3913 memcpy(&fio_options[opt_index], o, sizeof(*o));
3914 fio_options[opt_index + 1].name = NULL;
3918 void invalidate_profile_options(const char *prof_name)
3920 struct fio_option *o;
3924 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3925 o->type = FIO_OPT_INVALID;
3926 o->prof_name = NULL;
3932 void add_opt_posval(const char *optname, const char *ival, const char *help)
3934 struct fio_option *o;
3937 o = find_option(fio_options, optname);
3941 for (i = 0; i < PARSE_MAX_VP; i++) {
3942 if (o->posval[i].ival)
3945 o->posval[i].ival = ival;
3946 o->posval[i].help = help;
3951 void del_opt_posval(const char *optname, const char *ival)
3953 struct fio_option *o;
3956 o = find_option(fio_options, optname);
3960 for (i = 0; i < PARSE_MAX_VP; i++) {
3961 if (!o->posval[i].ival)
3963 if (strcmp(o->posval[i].ival, ival))
3966 o->posval[i].ival = NULL;
3967 o->posval[i].help = NULL;
3971 void fio_options_free(struct thread_data *td)
3973 options_free(fio_options, td);
3974 if (td->eo && td->io_ops && td->io_ops->options) {
3975 options_free(td->io_ops->options, td->eo);
3981 struct fio_option *fio_option_find(const char *name)
3983 return find_option(fio_options, name);