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)
399 const long max_cpu = cpus_online();
402 for (i = 0; i < max_cpu; i++) {
404 fio_cpu_clear(mask, i);
409 return fio_cpu_count(mask);
412 static int str_cpumask_cb(void *data, unsigned long long *val)
414 struct thread_data *td = data;
422 ret = fio_cpuset_init(&td->o.cpumask);
424 log_err("fio: cpuset_init failed\n");
425 td_verror(td, ret, "fio_cpuset_init");
429 max_cpu = cpus_online();
431 for (i = 0; i < sizeof(int) * 8; i++) {
432 if ((1 << i) & *val) {
434 log_err("fio: CPU %d too large (max=%ld)\n", i,
438 dprint(FD_PARSE, "set cpu allowed %d\n", i);
439 fio_cpu_set(&td->o.cpumask, i);
443 td->o.cpumask_set = 1;
447 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
454 ret = fio_cpuset_init(mask);
456 log_err("fio: cpuset_init failed\n");
457 td_verror(td, ret, "fio_cpuset_init");
461 p = str = strdup(input);
463 strip_blank_front(&str);
464 strip_blank_end(str);
466 max_cpu = cpus_online();
468 while ((cpu = strsep(&str, ",")) != NULL) {
477 while ((cpu2 = strsep(&str2, "-")) != NULL) {
487 while (icpu <= icpu2) {
488 if (icpu >= FIO_MAX_CPUS) {
489 log_err("fio: your OS only supports up to"
490 " %d CPUs\n", (int) FIO_MAX_CPUS);
494 if (icpu > max_cpu) {
495 log_err("fio: CPU %d too large (max=%ld)\n",
501 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
502 fio_cpu_set(mask, icpu);
511 td->o.cpumask_set = 1;
515 static int str_cpus_allowed_cb(void *data, const char *input)
517 struct thread_data *td = data;
523 ret = set_cpus_allowed(td, &td->o.cpumask, input);
525 td->o.cpumask_set = 1;
530 static int str_verify_cpus_allowed_cb(void *data, const char *input)
532 struct thread_data *td = data;
535 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
537 td->o.verify_cpumask_set = 1;
543 #ifdef CONFIG_LIBNUMA
544 static int str_numa_cpunodes_cb(void *data, char *input)
546 struct thread_data *td = data;
551 /* numa_parse_nodestring() parses a character string list
552 * of nodes into a bit mask. The bit mask is allocated by
553 * numa_allocate_nodemask(), so it should be freed by
554 * numa_free_nodemask().
556 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
557 if (td->o.numa_cpunodesmask == NULL) {
558 log_err("fio: numa_parse_nodestring failed\n");
559 td_verror(td, 1, "str_numa_cpunodes_cb");
563 td->o.numa_cpumask_set = 1;
567 static int str_numa_mpol_cb(void *data, char *input)
569 struct thread_data *td = data;
570 const char * const policy_types[] =
571 { "default", "prefer", "bind", "interleave", "local", NULL };
578 nodelist = strchr(input, ':');
580 /* NUL-terminate mode */
584 for (i = 0; i <= MPOL_LOCAL; i++) {
585 if (!strcmp(input, policy_types[i])) {
586 td->o.numa_mem_mode = i;
590 if (i > MPOL_LOCAL) {
591 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
595 switch (td->o.numa_mem_mode) {
598 * Insist on a nodelist of one node only
601 char *rest = nodelist;
602 while (isdigit(*rest))
605 log_err("fio: one node only for \'prefer\'\n");
609 log_err("fio: one node is needed for \'prefer\'\n");
613 case MPOL_INTERLEAVE:
615 * Default to online nodes with memory if no nodelist
618 nodelist = strdup("all");
623 * Don't allow a nodelist
626 log_err("fio: NO nodelist for \'local\'\n");
632 * Insist on a nodelist
635 log_err("fio: a nodelist is needed for \'bind\'\n");
642 /* numa_parse_nodestring() parses a character string list
643 * of nodes into a bit mask. The bit mask is allocated by
644 * numa_allocate_nodemask(), so it should be freed by
645 * numa_free_nodemask().
647 switch (td->o.numa_mem_mode) {
649 td->o.numa_mem_prefer_node = atoi(nodelist);
651 case MPOL_INTERLEAVE:
653 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
654 if (td->o.numa_memnodesmask == NULL) {
655 log_err("fio: numa_parse_nodestring failed\n");
656 td_verror(td, 1, "str_numa_memnodes_cb");
666 td->o.numa_memmask_set = 1;
674 static int str_fst_cb(void *data, const char *str)
676 struct thread_data *td = data;
677 char *nr = get_opt_postfix(str);
679 td->file_service_nr = 1;
681 td->file_service_nr = atoi(nr);
688 #ifdef CONFIG_SYNC_FILE_RANGE
689 static int str_sfr_cb(void *data, const char *str)
691 struct thread_data *td = data;
692 char *nr = get_opt_postfix(str);
694 td->sync_file_range_nr = 1;
696 td->sync_file_range_nr = atoi(nr);
704 static int str_random_distribution_cb(void *data, const char *str)
706 struct thread_data *td = data;
713 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
715 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
720 nr = get_opt_postfix(str);
721 if (nr && !str_to_float(nr, &val)) {
722 log_err("fio: random postfix parsing failed\n");
729 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
731 log_err("fio: zipf theta must different than 1.0\n");
734 td->o.zipf_theta.u.f = val;
736 if (val <= 0.00 || val >= 1.00) {
737 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
740 td->o.pareto_h.u.f = val;
747 * Return next name in the string. Files are separated with ':'. If the ':'
748 * is escaped with a '\', then that ':' is part of the filename and does not
749 * indicate a new file.
751 static char *get_next_name(char **ptr)
756 if (!str || !strlen(str))
762 * No colon, we are done
764 p = strchr(str, ':');
771 * We got a colon, but it's the first character. Skip and
779 if (*(p - 1) != '\\') {
785 memmove(p - 1, p, strlen(p) + 1);
793 static int get_max_name_idx(char *input)
795 unsigned int cur_idx;
798 p = str = strdup(input);
799 for (cur_idx = 0; ; cur_idx++)
800 if (get_next_name(&str) == NULL)
808 * Returns the directory at the index, indexes > entires will be
809 * assigned via modulo division of the index
811 int set_name_idx(char *target, char *input, int index)
813 unsigned int cur_idx;
815 char *fname, *str, *p;
817 p = str = strdup(input);
819 index %= get_max_name_idx(input);
820 for (cur_idx = 0; cur_idx <= index; cur_idx++)
821 fname = get_next_name(&str);
823 len = sprintf(target, "%s/", fname);
829 static int str_filename_cb(void *data, const char *input)
831 struct thread_data *td = data;
832 char *fname, *str, *p;
834 p = str = strdup(input);
836 strip_blank_front(&str);
837 strip_blank_end(str);
839 if (!td->files_index)
842 while ((fname = get_next_name(&str)) != NULL) {
845 add_file(td, fname, 0, 1);
852 static int str_directory_cb(void *data, const char fio_unused *unused)
854 struct thread_data *td = data;
856 char *dirname, *str, *p;
862 p = str = strdup(td->o.directory);
863 while ((dirname = get_next_name(&str)) != NULL) {
864 if (lstat(dirname, &sb) < 0) {
867 log_err("fio: %s is not a directory\n", dirname);
868 td_verror(td, ret, "lstat");
871 if (!S_ISDIR(sb.st_mode)) {
872 log_err("fio: %s is not a directory\n", dirname);
883 static int str_lockfile_cb(void *data, const char fio_unused *str)
885 struct thread_data *td = data;
887 if (td->files_index) {
888 log_err("fio: lockfile= option must precede filename=\n");
895 static int str_opendir_cb(void *data, const char fio_unused *str)
897 struct thread_data *td = data;
902 if (!td->files_index)
905 return add_dir_files(td, td->o.opendir);
908 static int pattern_cb(char *pattern, unsigned int max_size,
909 const char *input, unsigned int *pattern_bytes)
912 int i = 0, j = 0, len, k, base = 10;
913 uint32_t pattern_length;
916 loc1 = strstr(input, "0x");
917 loc2 = strstr(input, "0X");
920 off = strtol(input, NULL, base);
921 if (off != LONG_MAX || errno != ERANGE) {
923 pattern[i] = off & 0xff;
932 j = loc1 - input + 2;
934 j = loc2 - input + 2;
937 if (len - j < max_size * 2) {
939 off = converthexchartoint(input[k--]);
941 off += (converthexchartoint(input[k--])
943 pattern[i++] = (char) off;
949 * Fill the pattern all the way to the end. This greatly reduces
950 * the number of memcpy's we have to do when verifying the IO.
953 while (i > 1 && i * 2 <= max_size) {
954 memcpy(&pattern[i], &pattern[0], i);
959 * Fill remainder, if the pattern multiple ends up not being
962 while (i > 1 && i < max_size) {
963 unsigned int b = min(pattern_length, max_size - i);
965 memcpy(&pattern[i], &pattern[0], b);
971 * The code in verify_io_u_pattern assumes a single byte pattern
972 * fills the whole verify pattern buffer.
974 memset(pattern, pattern[0], max_size);
981 static int str_buffer_pattern_cb(void *data, const char *input)
983 struct thread_data *td = data;
986 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
987 &td->o.buffer_pattern_bytes);
990 td->o.refill_buffers = 0;
991 td->o.scramble_buffers = 0;
992 td->o.zero_buffers = 0;
998 static int str_verify_pattern_cb(void *data, const char *input)
1000 struct thread_data *td = data;
1003 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1004 &td->o.verify_pattern_bytes);
1007 * VERIFY_META could already be set
1009 if (!ret && td->o.verify == VERIFY_NONE)
1010 td->o.verify = VERIFY_PATTERN;
1015 static int str_gtod_reduce_cb(void *data, int *il)
1017 struct thread_data *td = data;
1020 td->o.disable_lat = !!val;
1021 td->o.disable_clat = !!val;
1022 td->o.disable_slat = !!val;
1023 td->o.disable_bw = !!val;
1024 td->o.clat_percentiles = !val;
1026 td->tv_cache_mask = 63;
1031 static int str_gtod_cpu_cb(void *data, long long *il)
1033 struct thread_data *td = data;
1036 td->o.gtod_cpu = val;
1037 td->o.gtod_offload = 1;
1041 static int str_size_cb(void *data, unsigned long long *__val)
1043 struct thread_data *td = data;
1044 unsigned long long v = *__val;
1046 if (parse_is_percent(v)) {
1048 td->o.size_percent = -1ULL - v;
1055 static int rw_verify(struct fio_option *o, void *data)
1057 struct thread_data *td = data;
1059 if (read_only && td_write(td)) {
1060 log_err("fio: job <%s> has write bit set, but fio is in"
1061 " read-only mode\n", td->o.name);
1068 static int gtod_cpu_verify(struct fio_option *o, void *data)
1070 #ifndef FIO_HAVE_CPU_AFFINITY
1071 struct thread_data *td = data;
1073 if (td->o.gtod_cpu) {
1074 log_err("fio: platform must support CPU affinity for"
1075 "gettimeofday() offloading\n");
1086 static struct opt_group fio_opt_groups[] = {
1089 .mask = FIO_OPT_C_GENERAL,
1093 .mask = FIO_OPT_C_IO,
1097 .mask = FIO_OPT_C_FILE,
1100 .name = "Statistics",
1101 .mask = FIO_OPT_C_STAT,
1105 .mask = FIO_OPT_C_LOG,
1109 .mask = FIO_OPT_C_PROFILE,
1116 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1117 unsigned int inv_mask)
1119 struct opt_group *og;
1122 if (*mask == inv_mask || !*mask)
1125 for (i = 0; ogs[i].name; i++) {
1128 if (*mask & og->mask) {
1129 *mask &= ~(og->mask);
1137 struct opt_group *opt_group_from_mask(unsigned int *mask)
1139 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1142 static struct opt_group fio_opt_cat_groups[] = {
1144 .name = "Latency profiling",
1145 .mask = FIO_OPT_G_LATPROF,
1149 .mask = FIO_OPT_G_RATE,
1153 .mask = FIO_OPT_G_ZONE,
1156 .name = "Read/write mix",
1157 .mask = FIO_OPT_G_RWMIX,
1161 .mask = FIO_OPT_G_VERIFY,
1165 .mask = FIO_OPT_G_TRIM,
1168 .name = "I/O Logging",
1169 .mask = FIO_OPT_G_IOLOG,
1172 .name = "I/O Depth",
1173 .mask = FIO_OPT_G_IO_DEPTH,
1177 .mask = FIO_OPT_G_IO_FLOW,
1180 .name = "Description",
1181 .mask = FIO_OPT_G_DESC,
1185 .mask = FIO_OPT_G_FILENAME,
1188 .name = "General I/O",
1189 .mask = FIO_OPT_G_IO_BASIC,
1193 .mask = FIO_OPT_G_CGROUP,
1197 .mask = FIO_OPT_G_RUNTIME,
1201 .mask = FIO_OPT_G_PROCESS,
1204 .name = "Job credentials / priority",
1205 .mask = FIO_OPT_G_CRED,
1208 .name = "Clock settings",
1209 .mask = FIO_OPT_G_CLOCK,
1213 .mask = FIO_OPT_G_IO_TYPE,
1216 .name = "I/O Thinktime",
1217 .mask = FIO_OPT_G_THINKTIME,
1220 .name = "Randomizations",
1221 .mask = FIO_OPT_G_RANDOM,
1224 .name = "I/O buffers",
1225 .mask = FIO_OPT_G_IO_BUF,
1228 .name = "Tiobench profile",
1229 .mask = FIO_OPT_G_TIOBENCH,
1237 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1239 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1243 * Map of job/command line options
1245 struct fio_option fio_options[FIO_MAX_OPTS] = {
1247 .name = "description",
1248 .lname = "Description of job",
1249 .type = FIO_OPT_STR_STORE,
1250 .off1 = td_var_offset(description),
1251 .help = "Text job description",
1252 .category = FIO_OPT_C_GENERAL,
1253 .group = FIO_OPT_G_DESC,
1257 .lname = "Job name",
1258 .type = FIO_OPT_STR_STORE,
1259 .off1 = td_var_offset(name),
1260 .help = "Name of this job",
1261 .category = FIO_OPT_C_GENERAL,
1262 .group = FIO_OPT_G_DESC,
1266 .lname = "Filename(s)",
1267 .type = FIO_OPT_STR_STORE,
1268 .off1 = td_var_offset(filename),
1269 .cb = str_filename_cb,
1270 .prio = -1, /* must come after "directory" */
1271 .help = "File(s) to use for the workload",
1272 .category = FIO_OPT_C_FILE,
1273 .group = FIO_OPT_G_FILENAME,
1276 .name = "directory",
1277 .lname = "Directory",
1278 .type = FIO_OPT_STR_STORE,
1279 .off1 = td_var_offset(directory),
1280 .cb = str_directory_cb,
1281 .help = "Directory to store files in",
1282 .category = FIO_OPT_C_FILE,
1283 .group = FIO_OPT_G_FILENAME,
1286 .name = "filename_format",
1287 .type = FIO_OPT_STR_STORE,
1288 .off1 = td_var_offset(filename_format),
1289 .prio = -1, /* must come after "directory" */
1290 .help = "Override default $jobname.$jobnum.$filenum naming",
1291 .def = "$jobname.$jobnum.$filenum",
1292 .category = FIO_OPT_C_FILE,
1293 .group = FIO_OPT_G_FILENAME,
1297 .lname = "Lockfile",
1298 .type = FIO_OPT_STR,
1299 .off1 = td_var_offset(file_lock_mode),
1300 .help = "Lock file when doing IO to it",
1302 .parent = "filename",
1305 .cb = str_lockfile_cb,
1306 .category = FIO_OPT_C_FILE,
1307 .group = FIO_OPT_G_FILENAME,
1310 .oval = FILE_LOCK_NONE,
1311 .help = "No file locking",
1313 { .ival = "exclusive",
1314 .oval = FILE_LOCK_EXCLUSIVE,
1315 .help = "Exclusive file lock",
1318 .ival = "readwrite",
1319 .oval = FILE_LOCK_READWRITE,
1320 .help = "Read vs write lock",
1326 .lname = "Open directory",
1327 .type = FIO_OPT_STR_STORE,
1328 .off1 = td_var_offset(opendir),
1329 .cb = str_opendir_cb,
1330 .help = "Recursively add files from this directory and down",
1331 .category = FIO_OPT_C_FILE,
1332 .group = FIO_OPT_G_FILENAME,
1336 .lname = "Read/write",
1337 .alias = "readwrite",
1338 .type = FIO_OPT_STR,
1340 .off1 = td_var_offset(td_ddir),
1341 .help = "IO direction",
1343 .verify = rw_verify,
1344 .category = FIO_OPT_C_IO,
1345 .group = FIO_OPT_G_IO_BASIC,
1348 .oval = TD_DDIR_READ,
1349 .help = "Sequential read",
1352 .oval = TD_DDIR_WRITE,
1353 .help = "Sequential write",
1356 .oval = TD_DDIR_TRIM,
1357 .help = "Sequential trim",
1359 { .ival = "randread",
1360 .oval = TD_DDIR_RANDREAD,
1361 .help = "Random read",
1363 { .ival = "randwrite",
1364 .oval = TD_DDIR_RANDWRITE,
1365 .help = "Random write",
1367 { .ival = "randtrim",
1368 .oval = TD_DDIR_RANDTRIM,
1369 .help = "Random trim",
1373 .help = "Sequential read and write mix",
1375 { .ival = "readwrite",
1377 .help = "Sequential read and write mix",
1380 .oval = TD_DDIR_RANDRW,
1381 .help = "Random read and write mix"
1386 .name = "rw_sequencer",
1387 .lname = "RW Sequencer",
1388 .type = FIO_OPT_STR,
1389 .off1 = td_var_offset(rw_seq),
1390 .help = "IO offset generator modifier",
1391 .def = "sequential",
1392 .category = FIO_OPT_C_IO,
1393 .group = FIO_OPT_G_IO_BASIC,
1395 { .ival = "sequential",
1397 .help = "Generate sequential offsets",
1399 { .ival = "identical",
1400 .oval = RW_SEQ_IDENT,
1401 .help = "Generate identical offsets",
1408 .lname = "IO Engine",
1409 .type = FIO_OPT_STR_STORE,
1410 .off1 = td_var_offset(ioengine),
1411 .help = "IO engine to use",
1412 .def = FIO_PREFERRED_ENGINE,
1413 .category = FIO_OPT_C_IO,
1414 .group = FIO_OPT_G_IO_BASIC,
1417 .help = "Use read/write",
1420 .help = "Use pread/pwrite",
1423 .help = "Use readv/writev",
1425 #ifdef CONFIG_PWRITEV
1427 .help = "Use preadv/pwritev",
1430 #ifdef CONFIG_LIBAIO
1432 .help = "Linux native asynchronous IO",
1435 #ifdef CONFIG_POSIXAIO
1436 { .ival = "posixaio",
1437 .help = "POSIX asynchronous IO",
1440 #ifdef CONFIG_SOLARISAIO
1441 { .ival = "solarisaio",
1442 .help = "Solaris native asynchronous IO",
1445 #ifdef CONFIG_WINDOWSAIO
1446 { .ival = "windowsaio",
1447 .help = "Windows native asynchronous IO"
1452 .help = "Rados Block Device asynchronous IO"
1456 .help = "Memory mapped IO"
1458 #ifdef CONFIG_LINUX_SPLICE
1460 .help = "splice/vmsplice based IO",
1462 { .ival = "netsplice",
1463 .help = "splice/vmsplice to/from the network",
1466 #ifdef FIO_HAVE_SGIO
1468 .help = "SCSI generic v3 IO",
1472 .help = "Testing engine (no data transfer)",
1475 .help = "Network IO",
1478 .help = "CPU cycle burner engine",
1482 .help = "GUASI IO engine",
1485 #ifdef FIO_HAVE_BINJECT
1486 { .ival = "binject",
1487 .help = "binject direct inject block engine",
1492 .help = "RDMA IO engine",
1495 #ifdef CONFIG_FUSION_AW
1496 { .ival = "fusion-aw-sync",
1497 .help = "Fusion-io atomic write engine",
1500 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1501 { .ival = "e4defrag",
1502 .help = "ext4 defrag engine",
1505 #ifdef CONFIG_LINUX_FALLOCATE
1507 .help = "fallocate() file based engine",
1510 { .ival = "external",
1511 .help = "Load external engine (append name)",
1517 .lname = "IO Depth",
1518 .type = FIO_OPT_INT,
1519 .off1 = td_var_offset(iodepth),
1520 .help = "Number of IO buffers to keep in flight",
1524 .category = FIO_OPT_C_IO,
1525 .group = FIO_OPT_G_IO_BASIC,
1528 .name = "iodepth_batch",
1529 .lname = "IO Depth batch",
1530 .alias = "iodepth_batch_submit",
1531 .type = FIO_OPT_INT,
1532 .off1 = td_var_offset(iodepth_batch),
1533 .help = "Number of IO buffers to submit in one go",
1534 .parent = "iodepth",
1539 .category = FIO_OPT_C_IO,
1540 .group = FIO_OPT_G_IO_BASIC,
1543 .name = "iodepth_batch_complete",
1544 .lname = "IO Depth batch complete",
1545 .type = FIO_OPT_INT,
1546 .off1 = td_var_offset(iodepth_batch_complete),
1547 .help = "Number of IO buffers to retrieve in one go",
1548 .parent = "iodepth",
1553 .category = FIO_OPT_C_IO,
1554 .group = FIO_OPT_G_IO_BASIC,
1557 .name = "iodepth_low",
1558 .lname = "IO Depth batch low",
1559 .type = FIO_OPT_INT,
1560 .off1 = td_var_offset(iodepth_low),
1561 .help = "Low water mark for queuing depth",
1562 .parent = "iodepth",
1565 .category = FIO_OPT_C_IO,
1566 .group = FIO_OPT_G_IO_BASIC,
1571 .type = FIO_OPT_STR_VAL,
1573 .help = "Total size of device or files",
1574 .interval = 1024 * 1024,
1575 .category = FIO_OPT_C_IO,
1576 .group = FIO_OPT_G_INVALID,
1579 .name = "fill_device",
1580 .lname = "Fill device",
1582 .type = FIO_OPT_BOOL,
1583 .off1 = td_var_offset(fill_device),
1584 .help = "Write until an ENOSPC error occurs",
1586 .category = FIO_OPT_C_FILE,
1587 .group = FIO_OPT_G_INVALID,
1591 .lname = "File size",
1592 .type = FIO_OPT_STR_VAL,
1593 .off1 = td_var_offset(file_size_low),
1594 .off2 = td_var_offset(file_size_high),
1596 .help = "Size of individual files",
1597 .interval = 1024 * 1024,
1598 .category = FIO_OPT_C_FILE,
1599 .group = FIO_OPT_G_INVALID,
1603 .lname = "IO offset",
1604 .alias = "fileoffset",
1605 .type = FIO_OPT_STR_VAL,
1606 .off1 = td_var_offset(start_offset),
1607 .help = "Start IO from this offset",
1609 .interval = 1024 * 1024,
1610 .category = FIO_OPT_C_IO,
1611 .group = FIO_OPT_G_INVALID,
1614 .name = "offset_increment",
1615 .lname = "IO offset increment",
1616 .type = FIO_OPT_STR_VAL,
1617 .off1 = td_var_offset(offset_increment),
1618 .help = "What is the increment from one offset to the next",
1622 .interval = 1024 * 1024,
1623 .category = FIO_OPT_C_IO,
1624 .group = FIO_OPT_G_INVALID,
1627 .name = "number_ios",
1628 .lname = "Number of IOs to perform",
1629 .type = FIO_OPT_STR_VAL,
1630 .off1 = td_var_offset(number_ios),
1631 .help = "Force job completion of this number of IOs",
1633 .category = FIO_OPT_C_IO,
1634 .group = FIO_OPT_G_INVALID,
1638 .lname = "Block size",
1639 .alias = "blocksize",
1640 .type = FIO_OPT_INT,
1641 .off1 = td_var_offset(bs[DDIR_READ]),
1642 .off2 = td_var_offset(bs[DDIR_WRITE]),
1643 .off3 = td_var_offset(bs[DDIR_TRIM]),
1645 .help = "Block size unit",
1650 .category = FIO_OPT_C_IO,
1651 .group = FIO_OPT_G_INVALID,
1655 .lname = "Block size align",
1656 .alias = "blockalign",
1657 .type = FIO_OPT_INT,
1658 .off1 = td_var_offset(ba[DDIR_READ]),
1659 .off2 = td_var_offset(ba[DDIR_WRITE]),
1660 .off3 = td_var_offset(ba[DDIR_TRIM]),
1662 .help = "IO block offset alignment",
1666 .category = FIO_OPT_C_IO,
1667 .group = FIO_OPT_G_INVALID,
1671 .lname = "Block size range",
1672 .alias = "blocksize_range",
1673 .type = FIO_OPT_RANGE,
1674 .off1 = td_var_offset(min_bs[DDIR_READ]),
1675 .off2 = td_var_offset(max_bs[DDIR_READ]),
1676 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1677 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1678 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1679 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1681 .help = "Set block size range (in more detail than bs)",
1685 .category = FIO_OPT_C_IO,
1686 .group = FIO_OPT_G_INVALID,
1690 .lname = "Block size split",
1691 .type = FIO_OPT_STR,
1692 .cb = str_bssplit_cb,
1693 .help = "Set a specific mix of block sizes",
1696 .category = FIO_OPT_C_IO,
1697 .group = FIO_OPT_G_INVALID,
1700 .name = "bs_unaligned",
1701 .lname = "Block size unaligned",
1702 .alias = "blocksize_unaligned",
1703 .type = FIO_OPT_STR_SET,
1704 .off1 = td_var_offset(bs_unaligned),
1705 .help = "Don't sector align IO buffer sizes",
1708 .category = FIO_OPT_C_IO,
1709 .group = FIO_OPT_G_INVALID,
1712 .name = "bs_is_seq_rand",
1713 .lname = "Block size division is seq/random (not read/write)",
1714 .type = FIO_OPT_BOOL,
1715 .off1 = td_var_offset(bs_is_seq_rand),
1716 .help = "Consider any blocksize setting to be sequential,ramdom",
1718 .parent = "blocksize",
1719 .category = FIO_OPT_C_IO,
1720 .group = FIO_OPT_G_INVALID,
1723 .name = "randrepeat",
1724 .lname = "Random repeatable",
1725 .type = FIO_OPT_BOOL,
1726 .off1 = td_var_offset(rand_repeatable),
1727 .help = "Use repeatable random IO pattern",
1731 .category = FIO_OPT_C_IO,
1732 .group = FIO_OPT_G_RANDOM,
1736 .lname = "The random generator seed",
1737 .type = FIO_OPT_STR_VAL,
1738 .off1 = td_var_offset(rand_seed),
1739 .help = "Set the random generator seed value",
1741 .category = FIO_OPT_C_IO,
1742 .group = FIO_OPT_G_RANDOM,
1745 .name = "use_os_rand",
1746 .lname = "Use OS random",
1747 .type = FIO_OPT_BOOL,
1748 .off1 = td_var_offset(use_os_rand),
1749 .help = "Set to use OS random generator",
1753 .category = FIO_OPT_C_IO,
1754 .group = FIO_OPT_G_RANDOM,
1757 .name = "norandommap",
1758 .lname = "No randommap",
1759 .type = FIO_OPT_STR_SET,
1760 .off1 = td_var_offset(norandommap),
1761 .help = "Accept potential duplicate random blocks",
1765 .category = FIO_OPT_C_IO,
1766 .group = FIO_OPT_G_RANDOM,
1769 .name = "softrandommap",
1770 .lname = "Soft randommap",
1771 .type = FIO_OPT_BOOL,
1772 .off1 = td_var_offset(softrandommap),
1773 .help = "Set norandommap if randommap allocation fails",
1774 .parent = "norandommap",
1777 .category = FIO_OPT_C_IO,
1778 .group = FIO_OPT_G_RANDOM,
1781 .name = "random_generator",
1782 .type = FIO_OPT_STR,
1783 .off1 = td_var_offset(random_generator),
1784 .help = "Type of random number generator to use",
1785 .def = "tausworthe",
1787 { .ival = "tausworthe",
1788 .oval = FIO_RAND_GEN_TAUSWORTHE,
1789 .help = "Strong Tausworthe generator",
1792 .oval = FIO_RAND_GEN_LFSR,
1793 .help = "Variable length LFSR",
1796 .category = FIO_OPT_C_IO,
1797 .group = FIO_OPT_G_RANDOM,
1800 .name = "random_distribution",
1801 .type = FIO_OPT_STR,
1802 .off1 = td_var_offset(random_distribution),
1803 .cb = str_random_distribution_cb,
1804 .help = "Random offset distribution generator",
1808 .oval = FIO_RAND_DIST_RANDOM,
1809 .help = "Completely random",
1812 .oval = FIO_RAND_DIST_ZIPF,
1813 .help = "Zipf distribution",
1816 .oval = FIO_RAND_DIST_PARETO,
1817 .help = "Pareto distribution",
1820 .category = FIO_OPT_C_IO,
1821 .group = FIO_OPT_G_RANDOM,
1824 .name = "percentage_random",
1825 .lname = "Percentage Random",
1826 .type = FIO_OPT_INT,
1827 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1828 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1829 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1831 .help = "Percentage of seq/random mix that should be random",
1832 .def = "100,100,100",
1834 .inverse = "percentage_sequential",
1835 .category = FIO_OPT_C_IO,
1836 .group = FIO_OPT_G_RANDOM,
1839 .name = "percentage_sequential",
1840 .lname = "Percentage Sequential",
1841 .type = FIO_OPT_DEPRECATED,
1842 .category = FIO_OPT_C_IO,
1843 .group = FIO_OPT_G_RANDOM,
1846 .name = "allrandrepeat",
1847 .type = FIO_OPT_BOOL,
1848 .off1 = td_var_offset(allrand_repeatable),
1849 .help = "Use repeatable random numbers for everything",
1851 .category = FIO_OPT_C_IO,
1852 .group = FIO_OPT_G_RANDOM,
1856 .lname = "Number of files",
1857 .alias = "nr_files",
1858 .type = FIO_OPT_INT,
1859 .off1 = td_var_offset(nr_files),
1860 .help = "Split job workload between this number of files",
1863 .category = FIO_OPT_C_FILE,
1864 .group = FIO_OPT_G_INVALID,
1867 .name = "openfiles",
1868 .lname = "Number of open files",
1869 .type = FIO_OPT_INT,
1870 .off1 = td_var_offset(open_files),
1871 .help = "Number of files to keep open at the same time",
1872 .category = FIO_OPT_C_FILE,
1873 .group = FIO_OPT_G_INVALID,
1876 .name = "file_service_type",
1877 .lname = "File service type",
1878 .type = FIO_OPT_STR,
1880 .off1 = td_var_offset(file_service_type),
1881 .help = "How to select which file to service next",
1882 .def = "roundrobin",
1883 .category = FIO_OPT_C_FILE,
1884 .group = FIO_OPT_G_INVALID,
1887 .oval = FIO_FSERVICE_RANDOM,
1888 .help = "Choose a file at random",
1890 { .ival = "roundrobin",
1891 .oval = FIO_FSERVICE_RR,
1892 .help = "Round robin select files",
1894 { .ival = "sequential",
1895 .oval = FIO_FSERVICE_SEQ,
1896 .help = "Finish one file before moving to the next",
1899 .parent = "nrfiles",
1902 #ifdef CONFIG_POSIX_FALLOCATE
1904 .name = "fallocate",
1905 .lname = "Fallocate",
1906 .type = FIO_OPT_STR,
1907 .off1 = td_var_offset(fallocate_mode),
1908 .help = "Whether pre-allocation is performed when laying out files",
1910 .category = FIO_OPT_C_FILE,
1911 .group = FIO_OPT_G_INVALID,
1914 .oval = FIO_FALLOCATE_NONE,
1915 .help = "Do not pre-allocate space",
1918 .oval = FIO_FALLOCATE_POSIX,
1919 .help = "Use posix_fallocate()",
1921 #ifdef CONFIG_LINUX_FALLOCATE
1923 .oval = FIO_FALLOCATE_KEEP_SIZE,
1924 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1927 /* Compatibility with former boolean values */
1929 .oval = FIO_FALLOCATE_NONE,
1930 .help = "Alias for 'none'",
1933 .oval = FIO_FALLOCATE_POSIX,
1934 .help = "Alias for 'posix'",
1938 #endif /* CONFIG_POSIX_FALLOCATE */
1940 .name = "fadvise_hint",
1941 .lname = "Fadvise hint",
1942 .type = FIO_OPT_BOOL,
1943 .off1 = td_var_offset(fadvise_hint),
1944 .help = "Use fadvise() to advise the kernel on IO pattern",
1946 .category = FIO_OPT_C_FILE,
1947 .group = FIO_OPT_G_INVALID,
1952 .type = FIO_OPT_INT,
1953 .off1 = td_var_offset(fsync_blocks),
1954 .help = "Issue fsync for writes every given number of blocks",
1957 .category = FIO_OPT_C_FILE,
1958 .group = FIO_OPT_G_INVALID,
1961 .name = "fdatasync",
1962 .lname = "Fdatasync",
1963 .type = FIO_OPT_INT,
1964 .off1 = td_var_offset(fdatasync_blocks),
1965 .help = "Issue fdatasync for writes every given number of blocks",
1968 .category = FIO_OPT_C_FILE,
1969 .group = FIO_OPT_G_INVALID,
1972 .name = "write_barrier",
1973 .lname = "Write barrier",
1974 .type = FIO_OPT_INT,
1975 .off1 = td_var_offset(barrier_blocks),
1976 .help = "Make every Nth write a barrier write",
1979 .category = FIO_OPT_C_IO,
1980 .group = FIO_OPT_G_INVALID,
1982 #ifdef CONFIG_SYNC_FILE_RANGE
1984 .name = "sync_file_range",
1985 .lname = "Sync file range",
1987 { .ival = "wait_before",
1988 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1989 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
1993 .oval = SYNC_FILE_RANGE_WRITE,
1994 .help = "SYNC_FILE_RANGE_WRITE",
1998 .ival = "wait_after",
1999 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2000 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2004 .type = FIO_OPT_STR_MULTI,
2006 .off1 = td_var_offset(sync_file_range),
2007 .help = "Use sync_file_range()",
2008 .category = FIO_OPT_C_FILE,
2009 .group = FIO_OPT_G_INVALID,
2014 .lname = "Direct I/O",
2015 .type = FIO_OPT_BOOL,
2016 .off1 = td_var_offset(odirect),
2017 .help = "Use O_DIRECT IO (negates buffered)",
2019 .inverse = "buffered",
2020 .category = FIO_OPT_C_IO,
2021 .group = FIO_OPT_G_IO_TYPE,
2025 .lname = "Atomic I/O",
2026 .type = FIO_OPT_BOOL,
2027 .off1 = td_var_offset(oatomic),
2028 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2030 .category = FIO_OPT_C_IO,
2031 .group = FIO_OPT_G_IO_TYPE,
2035 .lname = "Buffered I/O",
2036 .type = FIO_OPT_BOOL,
2037 .off1 = td_var_offset(odirect),
2039 .help = "Use buffered IO (negates direct)",
2041 .inverse = "direct",
2042 .category = FIO_OPT_C_IO,
2043 .group = FIO_OPT_G_IO_TYPE,
2046 .name = "overwrite",
2047 .lname = "Overwrite",
2048 .type = FIO_OPT_BOOL,
2049 .off1 = td_var_offset(overwrite),
2050 .help = "When writing, set whether to overwrite current data",
2052 .category = FIO_OPT_C_FILE,
2053 .group = FIO_OPT_G_INVALID,
2058 .type = FIO_OPT_INT,
2059 .off1 = td_var_offset(loops),
2060 .help = "Number of times to run the job",
2063 .category = FIO_OPT_C_GENERAL,
2064 .group = FIO_OPT_G_RUNTIME,
2068 .lname = "Number of jobs",
2069 .type = FIO_OPT_INT,
2070 .off1 = td_var_offset(numjobs),
2071 .help = "Duplicate this job this many times",
2074 .category = FIO_OPT_C_GENERAL,
2075 .group = FIO_OPT_G_RUNTIME,
2078 .name = "startdelay",
2079 .lname = "Start delay",
2080 .type = FIO_OPT_STR_VAL_TIME,
2081 .off1 = td_var_offset(start_delay),
2082 .off2 = td_var_offset(start_delay_high),
2083 .help = "Only start job when this period has passed",
2086 .category = FIO_OPT_C_GENERAL,
2087 .group = FIO_OPT_G_RUNTIME,
2093 .type = FIO_OPT_STR_VAL_TIME,
2094 .off1 = td_var_offset(timeout),
2095 .help = "Stop workload when this amount of time has passed",
2098 .category = FIO_OPT_C_GENERAL,
2099 .group = FIO_OPT_G_RUNTIME,
2102 .name = "time_based",
2103 .lname = "Time based",
2104 .type = FIO_OPT_STR_SET,
2105 .off1 = td_var_offset(time_based),
2106 .help = "Keep running until runtime/timeout is met",
2107 .category = FIO_OPT_C_GENERAL,
2108 .group = FIO_OPT_G_RUNTIME,
2111 .name = "verify_only",
2112 .lname = "Verify only",
2113 .type = FIO_OPT_STR_SET,
2114 .off1 = td_var_offset(verify_only),
2115 .help = "Verifies previously written data is still valid",
2116 .category = FIO_OPT_C_GENERAL,
2117 .group = FIO_OPT_G_RUNTIME,
2120 .name = "ramp_time",
2121 .lname = "Ramp time",
2122 .type = FIO_OPT_STR_VAL_TIME,
2123 .off1 = td_var_offset(ramp_time),
2124 .help = "Ramp up time before measuring performance",
2126 .category = FIO_OPT_C_GENERAL,
2127 .group = FIO_OPT_G_RUNTIME,
2130 .name = "clocksource",
2131 .lname = "Clock source",
2132 .type = FIO_OPT_STR,
2133 .cb = fio_clock_source_cb,
2134 .off1 = td_var_offset(clocksource),
2135 .help = "What type of timing source to use",
2136 .category = FIO_OPT_C_GENERAL,
2137 .group = FIO_OPT_G_CLOCK,
2139 #ifdef CONFIG_GETTIMEOFDAY
2140 { .ival = "gettimeofday",
2142 .help = "Use gettimeofday(2) for timing",
2145 #ifdef CONFIG_CLOCK_GETTIME
2146 { .ival = "clock_gettime",
2147 .oval = CS_CGETTIME,
2148 .help = "Use clock_gettime(2) for timing",
2151 #ifdef ARCH_HAVE_CPU_CLOCK
2153 .oval = CS_CPUCLOCK,
2154 .help = "Use CPU private clock",
2162 .lname = "I/O Memory",
2163 .type = FIO_OPT_STR,
2165 .off1 = td_var_offset(mem_type),
2166 .help = "Backing type for IO buffers",
2168 .category = FIO_OPT_C_IO,
2169 .group = FIO_OPT_G_INVALID,
2173 .help = "Use malloc(3) for IO buffers",
2177 .help = "Use shared memory segments for IO buffers",
2179 #ifdef FIO_HAVE_HUGETLB
2180 { .ival = "shmhuge",
2181 .oval = MEM_SHMHUGE,
2182 .help = "Like shm, but use huge pages",
2187 .help = "Use mmap(2) (file or anon) for IO buffers",
2189 #ifdef FIO_HAVE_HUGETLB
2190 { .ival = "mmaphuge",
2191 .oval = MEM_MMAPHUGE,
2192 .help = "Like mmap, but use huge pages",
2198 .name = "iomem_align",
2199 .alias = "mem_align",
2200 .lname = "I/O memory alignment",
2201 .type = FIO_OPT_INT,
2202 .off1 = td_var_offset(mem_align),
2204 .help = "IO memory buffer offset alignment",
2208 .category = FIO_OPT_C_IO,
2209 .group = FIO_OPT_G_INVALID,
2214 .type = FIO_OPT_STR,
2215 .off1 = td_var_offset(verify),
2216 .help = "Verify data written",
2218 .category = FIO_OPT_C_IO,
2219 .group = FIO_OPT_G_VERIFY,
2222 .oval = VERIFY_NONE,
2223 .help = "Don't do IO verification",
2227 .help = "Use md5 checksums for verification",
2230 .oval = VERIFY_CRC64,
2231 .help = "Use crc64 checksums for verification",
2234 .oval = VERIFY_CRC32,
2235 .help = "Use crc32 checksums for verification",
2237 { .ival = "crc32c-intel",
2238 .oval = VERIFY_CRC32C,
2239 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2242 .oval = VERIFY_CRC32C,
2243 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2246 .oval = VERIFY_CRC16,
2247 .help = "Use crc16 checksums for verification",
2250 .oval = VERIFY_CRC7,
2251 .help = "Use crc7 checksums for verification",
2254 .oval = VERIFY_SHA1,
2255 .help = "Use sha1 checksums for verification",
2258 .oval = VERIFY_SHA256,
2259 .help = "Use sha256 checksums for verification",
2262 .oval = VERIFY_SHA512,
2263 .help = "Use sha512 checksums for verification",
2266 .oval = VERIFY_XXHASH,
2267 .help = "Use xxhash checksums for verification",
2270 .oval = VERIFY_META,
2271 .help = "Use io information",
2275 .oval = VERIFY_NULL,
2276 .help = "Pretend to verify",
2281 .name = "do_verify",
2282 .lname = "Perform verify step",
2283 .type = FIO_OPT_BOOL,
2284 .off1 = td_var_offset(do_verify),
2285 .help = "Run verification stage after write",
2289 .category = FIO_OPT_C_IO,
2290 .group = FIO_OPT_G_VERIFY,
2293 .name = "verifysort",
2294 .lname = "Verify sort",
2295 .type = FIO_OPT_BOOL,
2296 .off1 = td_var_offset(verifysort),
2297 .help = "Sort written verify blocks for read back",
2301 .category = FIO_OPT_C_IO,
2302 .group = FIO_OPT_G_VERIFY,
2305 .name = "verifysort_nr",
2306 .type = FIO_OPT_INT,
2307 .off1 = td_var_offset(verifysort_nr),
2308 .help = "Pre-load and sort verify blocks for a read workload",
2313 .category = FIO_OPT_C_IO,
2314 .group = FIO_OPT_G_VERIFY,
2317 .name = "verify_interval",
2318 .lname = "Verify interval",
2319 .type = FIO_OPT_INT,
2320 .off1 = td_var_offset(verify_interval),
2321 .minval = 2 * sizeof(struct verify_header),
2322 .help = "Store verify buffer header every N bytes",
2325 .interval = 2 * sizeof(struct verify_header),
2326 .category = FIO_OPT_C_IO,
2327 .group = FIO_OPT_G_VERIFY,
2330 .name = "verify_offset",
2331 .lname = "Verify offset",
2332 .type = FIO_OPT_INT,
2333 .help = "Offset verify header location by N bytes",
2334 .off1 = td_var_offset(verify_offset),
2335 .minval = sizeof(struct verify_header),
2338 .category = FIO_OPT_C_IO,
2339 .group = FIO_OPT_G_VERIFY,
2342 .name = "verify_pattern",
2343 .lname = "Verify pattern",
2344 .type = FIO_OPT_STR,
2345 .cb = str_verify_pattern_cb,
2346 .help = "Fill pattern for IO buffers",
2349 .category = FIO_OPT_C_IO,
2350 .group = FIO_OPT_G_VERIFY,
2353 .name = "verify_fatal",
2354 .lname = "Verify fatal",
2355 .type = FIO_OPT_BOOL,
2356 .off1 = td_var_offset(verify_fatal),
2358 .help = "Exit on a single verify failure, don't continue",
2361 .category = FIO_OPT_C_IO,
2362 .group = FIO_OPT_G_VERIFY,
2365 .name = "verify_dump",
2366 .lname = "Verify dump",
2367 .type = FIO_OPT_BOOL,
2368 .off1 = td_var_offset(verify_dump),
2370 .help = "Dump contents of good and bad blocks on failure",
2373 .category = FIO_OPT_C_IO,
2374 .group = FIO_OPT_G_VERIFY,
2377 .name = "verify_async",
2378 .lname = "Verify asynchronously",
2379 .type = FIO_OPT_INT,
2380 .off1 = td_var_offset(verify_async),
2382 .help = "Number of async verifier threads to use",
2385 .category = FIO_OPT_C_IO,
2386 .group = FIO_OPT_G_VERIFY,
2389 .name = "verify_backlog",
2390 .lname = "Verify backlog",
2391 .type = FIO_OPT_STR_VAL,
2392 .off1 = td_var_offset(verify_backlog),
2393 .help = "Verify after this number of blocks are written",
2396 .category = FIO_OPT_C_IO,
2397 .group = FIO_OPT_G_VERIFY,
2400 .name = "verify_backlog_batch",
2401 .lname = "Verify backlog batch",
2402 .type = FIO_OPT_INT,
2403 .off1 = td_var_offset(verify_batch),
2404 .help = "Verify this number of IO blocks",
2407 .category = FIO_OPT_C_IO,
2408 .group = FIO_OPT_G_VERIFY,
2410 #ifdef FIO_HAVE_CPU_AFFINITY
2412 .name = "verify_async_cpus",
2413 .lname = "Async verify CPUs",
2414 .type = FIO_OPT_STR,
2415 .cb = str_verify_cpus_allowed_cb,
2416 .help = "Set CPUs allowed for async verify threads",
2417 .parent = "verify_async",
2419 .category = FIO_OPT_C_IO,
2420 .group = FIO_OPT_G_VERIFY,
2424 .name = "experimental_verify",
2425 .off1 = td_var_offset(experimental_verify),
2426 .type = FIO_OPT_BOOL,
2427 .help = "Enable experimental verification",
2428 .category = FIO_OPT_C_IO,
2429 .group = FIO_OPT_G_VERIFY,
2431 #ifdef FIO_HAVE_TRIM
2433 .name = "trim_percentage",
2434 .lname = "Trim percentage",
2435 .type = FIO_OPT_INT,
2436 .off1 = td_var_offset(trim_percentage),
2439 .help = "Number of verify blocks to discard/trim",
2444 .category = FIO_OPT_C_IO,
2445 .group = FIO_OPT_G_TRIM,
2448 .name = "trim_verify_zero",
2449 .lname = "Verify trim zero",
2450 .type = FIO_OPT_BOOL,
2451 .help = "Verify that trim/discarded blocks are returned as zeroes",
2452 .off1 = td_var_offset(trim_zero),
2453 .parent = "trim_percentage",
2456 .category = FIO_OPT_C_IO,
2457 .group = FIO_OPT_G_TRIM,
2460 .name = "trim_backlog",
2461 .lname = "Trim backlog",
2462 .type = FIO_OPT_STR_VAL,
2463 .off1 = td_var_offset(trim_backlog),
2464 .help = "Trim after this number of blocks are written",
2465 .parent = "trim_percentage",
2468 .category = FIO_OPT_C_IO,
2469 .group = FIO_OPT_G_TRIM,
2472 .name = "trim_backlog_batch",
2473 .lname = "Trim backlog batch",
2474 .type = FIO_OPT_INT,
2475 .off1 = td_var_offset(trim_batch),
2476 .help = "Trim this number of IO blocks",
2477 .parent = "trim_percentage",
2480 .category = FIO_OPT_C_IO,
2481 .group = FIO_OPT_G_TRIM,
2485 .name = "write_iolog",
2486 .lname = "Write I/O log",
2487 .type = FIO_OPT_STR_STORE,
2488 .off1 = td_var_offset(write_iolog_file),
2489 .help = "Store IO pattern to file",
2490 .category = FIO_OPT_C_IO,
2491 .group = FIO_OPT_G_IOLOG,
2494 .name = "read_iolog",
2495 .lname = "Read I/O log",
2496 .type = FIO_OPT_STR_STORE,
2497 .off1 = td_var_offset(read_iolog_file),
2498 .help = "Playback IO pattern from file",
2499 .category = FIO_OPT_C_IO,
2500 .group = FIO_OPT_G_IOLOG,
2503 .name = "replay_no_stall",
2504 .lname = "Don't stall on replay",
2505 .type = FIO_OPT_BOOL,
2506 .off1 = td_var_offset(no_stall),
2508 .parent = "read_iolog",
2510 .help = "Playback IO pattern file as fast as possible without stalls",
2511 .category = FIO_OPT_C_IO,
2512 .group = FIO_OPT_G_IOLOG,
2515 .name = "replay_redirect",
2516 .lname = "Redirect device for replay",
2517 .type = FIO_OPT_STR_STORE,
2518 .off1 = td_var_offset(replay_redirect),
2519 .parent = "read_iolog",
2521 .help = "Replay all I/O onto this device, regardless of trace device",
2522 .category = FIO_OPT_C_IO,
2523 .group = FIO_OPT_G_IOLOG,
2526 .name = "exec_prerun",
2527 .lname = "Pre-execute runnable",
2528 .type = FIO_OPT_STR_STORE,
2529 .off1 = td_var_offset(exec_prerun),
2530 .help = "Execute this file prior to running job",
2531 .category = FIO_OPT_C_GENERAL,
2532 .group = FIO_OPT_G_INVALID,
2535 .name = "exec_postrun",
2536 .lname = "Post-execute runnable",
2537 .type = FIO_OPT_STR_STORE,
2538 .off1 = td_var_offset(exec_postrun),
2539 .help = "Execute this file after running job",
2540 .category = FIO_OPT_C_GENERAL,
2541 .group = FIO_OPT_G_INVALID,
2543 #ifdef FIO_HAVE_IOSCHED_SWITCH
2545 .name = "ioscheduler",
2546 .lname = "I/O scheduler",
2547 .type = FIO_OPT_STR_STORE,
2548 .off1 = td_var_offset(ioscheduler),
2549 .help = "Use this IO scheduler on the backing device",
2550 .category = FIO_OPT_C_FILE,
2551 .group = FIO_OPT_G_INVALID,
2556 .lname = "Zone size",
2557 .type = FIO_OPT_STR_VAL,
2558 .off1 = td_var_offset(zone_size),
2559 .help = "Amount of data to read per zone",
2561 .interval = 1024 * 1024,
2562 .category = FIO_OPT_C_IO,
2563 .group = FIO_OPT_G_ZONE,
2566 .name = "zonerange",
2567 .lname = "Zone range",
2568 .type = FIO_OPT_STR_VAL,
2569 .off1 = td_var_offset(zone_range),
2570 .help = "Give size of an IO zone",
2572 .interval = 1024 * 1024,
2573 .category = FIO_OPT_C_IO,
2574 .group = FIO_OPT_G_ZONE,
2578 .lname = "Zone skip",
2579 .type = FIO_OPT_STR_VAL,
2580 .off1 = td_var_offset(zone_skip),
2581 .help = "Space between IO zones",
2583 .interval = 1024 * 1024,
2584 .category = FIO_OPT_C_IO,
2585 .group = FIO_OPT_G_ZONE,
2589 .lname = "Lock memory",
2590 .type = FIO_OPT_STR_VAL,
2591 .off1 = td_var_offset(lockmem),
2592 .help = "Lock down this amount of memory (per worker)",
2594 .interval = 1024 * 1024,
2595 .category = FIO_OPT_C_GENERAL,
2596 .group = FIO_OPT_G_INVALID,
2599 .name = "rwmixread",
2600 .lname = "Read/write mix read",
2601 .type = FIO_OPT_INT,
2602 .cb = str_rwmix_read_cb,
2604 .help = "Percentage of mixed workload that is reads",
2607 .inverse = "rwmixwrite",
2608 .category = FIO_OPT_C_IO,
2609 .group = FIO_OPT_G_RWMIX,
2612 .name = "rwmixwrite",
2613 .lname = "Read/write mix write",
2614 .type = FIO_OPT_INT,
2615 .cb = str_rwmix_write_cb,
2617 .help = "Percentage of mixed workload that is writes",
2620 .inverse = "rwmixread",
2621 .category = FIO_OPT_C_IO,
2622 .group = FIO_OPT_G_RWMIX,
2625 .name = "rwmixcycle",
2626 .lname = "Read/write mix cycle",
2627 .type = FIO_OPT_DEPRECATED,
2628 .category = FIO_OPT_C_IO,
2629 .group = FIO_OPT_G_RWMIX,
2634 .type = FIO_OPT_INT,
2635 .off1 = td_var_offset(nice),
2636 .help = "Set job CPU nice value",
2641 .category = FIO_OPT_C_GENERAL,
2642 .group = FIO_OPT_G_CRED,
2644 #ifdef FIO_HAVE_IOPRIO
2647 .lname = "I/O nice priority",
2648 .type = FIO_OPT_INT,
2649 .off1 = td_var_offset(ioprio),
2650 .help = "Set job IO priority value",
2654 .category = FIO_OPT_C_GENERAL,
2655 .group = FIO_OPT_G_CRED,
2658 .name = "prioclass",
2659 .lname = "I/O nice priority class",
2660 .type = FIO_OPT_INT,
2661 .off1 = td_var_offset(ioprio_class),
2662 .help = "Set job IO priority class",
2666 .category = FIO_OPT_C_GENERAL,
2667 .group = FIO_OPT_G_CRED,
2671 .name = "thinktime",
2672 .lname = "Thinktime",
2673 .type = FIO_OPT_INT,
2674 .off1 = td_var_offset(thinktime),
2675 .help = "Idle time between IO buffers (usec)",
2677 .category = FIO_OPT_C_IO,
2678 .group = FIO_OPT_G_THINKTIME,
2681 .name = "thinktime_spin",
2682 .lname = "Thinktime spin",
2683 .type = FIO_OPT_INT,
2684 .off1 = td_var_offset(thinktime_spin),
2685 .help = "Start think time by spinning this amount (usec)",
2687 .parent = "thinktime",
2689 .category = FIO_OPT_C_IO,
2690 .group = FIO_OPT_G_THINKTIME,
2693 .name = "thinktime_blocks",
2694 .lname = "Thinktime blocks",
2695 .type = FIO_OPT_INT,
2696 .off1 = td_var_offset(thinktime_blocks),
2697 .help = "IO buffer period between 'thinktime'",
2699 .parent = "thinktime",
2701 .category = FIO_OPT_C_IO,
2702 .group = FIO_OPT_G_THINKTIME,
2706 .lname = "I/O rate",
2707 .type = FIO_OPT_INT,
2708 .off1 = td_var_offset(rate[DDIR_READ]),
2709 .off2 = td_var_offset(rate[DDIR_WRITE]),
2710 .off3 = td_var_offset(rate[DDIR_TRIM]),
2711 .help = "Set bandwidth rate",
2712 .category = FIO_OPT_C_IO,
2713 .group = FIO_OPT_G_RATE,
2717 .lname = "I/O min rate",
2718 .type = FIO_OPT_INT,
2719 .off1 = td_var_offset(ratemin[DDIR_READ]),
2720 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2721 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2722 .help = "Job must meet this rate or it will be shutdown",
2725 .category = FIO_OPT_C_IO,
2726 .group = FIO_OPT_G_RATE,
2729 .name = "rate_iops",
2730 .lname = "I/O rate IOPS",
2731 .type = FIO_OPT_INT,
2732 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2733 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2734 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2735 .help = "Limit IO used to this number of IO operations/sec",
2737 .category = FIO_OPT_C_IO,
2738 .group = FIO_OPT_G_RATE,
2741 .name = "rate_iops_min",
2742 .lname = "I/O min rate IOPS",
2743 .type = FIO_OPT_INT,
2744 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2745 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2746 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2747 .help = "Job must meet this rate or it will be shut down",
2748 .parent = "rate_iops",
2750 .category = FIO_OPT_C_IO,
2751 .group = FIO_OPT_G_RATE,
2754 .name = "ratecycle",
2755 .lname = "I/O rate cycle",
2756 .type = FIO_OPT_INT,
2757 .off1 = td_var_offset(ratecycle),
2758 .help = "Window average for rate limits (msec)",
2762 .category = FIO_OPT_C_IO,
2763 .group = FIO_OPT_G_RATE,
2766 .name = "max_latency",
2767 .type = FIO_OPT_INT,
2768 .off1 = td_var_offset(max_latency),
2769 .help = "Maximum tolerated IO latency (usec)",
2770 .category = FIO_OPT_C_IO,
2771 .group = FIO_OPT_G_LATPROF,
2774 .name = "latency_target",
2775 .lname = "Latency Target (usec)",
2776 .type = FIO_OPT_STR_VAL_TIME,
2777 .off1 = td_var_offset(latency_target),
2778 .help = "Ramp to max queue depth supporting this latency",
2779 .category = FIO_OPT_C_IO,
2780 .group = FIO_OPT_G_LATPROF,
2783 .name = "latency_window",
2784 .lname = "Latency Window (usec)",
2785 .type = FIO_OPT_STR_VAL_TIME,
2786 .off1 = td_var_offset(latency_window),
2787 .help = "Time to sustain latency_target",
2788 .category = FIO_OPT_C_IO,
2789 .group = FIO_OPT_G_LATPROF,
2792 .name = "latency_percentile",
2793 .lname = "Latency Percentile",
2794 .type = FIO_OPT_FLOAT_LIST,
2795 .off1 = td_var_offset(latency_percentile),
2796 .help = "Percentile of IOs must be below latency_target",
2801 .category = FIO_OPT_C_IO,
2802 .group = FIO_OPT_G_LATPROF,
2805 .name = "invalidate",
2806 .lname = "Cache invalidate",
2807 .type = FIO_OPT_BOOL,
2808 .off1 = td_var_offset(invalidate_cache),
2809 .help = "Invalidate buffer/page cache prior to running job",
2811 .category = FIO_OPT_C_IO,
2812 .group = FIO_OPT_G_IO_TYPE,
2816 .lname = "Synchronous I/O",
2817 .type = FIO_OPT_BOOL,
2818 .off1 = td_var_offset(sync_io),
2819 .help = "Use O_SYNC for buffered writes",
2821 .parent = "buffered",
2823 .category = FIO_OPT_C_IO,
2824 .group = FIO_OPT_G_IO_TYPE,
2827 .name = "create_serialize",
2828 .lname = "Create serialize",
2829 .type = FIO_OPT_BOOL,
2830 .off1 = td_var_offset(create_serialize),
2831 .help = "Serialize creating of job files",
2833 .category = FIO_OPT_C_FILE,
2834 .group = FIO_OPT_G_INVALID,
2837 .name = "create_fsync",
2838 .lname = "Create fsync",
2839 .type = FIO_OPT_BOOL,
2840 .off1 = td_var_offset(create_fsync),
2841 .help = "fsync file after creation",
2843 .category = FIO_OPT_C_FILE,
2844 .group = FIO_OPT_G_INVALID,
2847 .name = "create_on_open",
2848 .lname = "Create on open",
2849 .type = FIO_OPT_BOOL,
2850 .off1 = td_var_offset(create_on_open),
2851 .help = "Create files when they are opened for IO",
2853 .category = FIO_OPT_C_FILE,
2854 .group = FIO_OPT_G_INVALID,
2857 .name = "create_only",
2858 .type = FIO_OPT_BOOL,
2859 .off1 = td_var_offset(create_only),
2860 .help = "Only perform file creation phase",
2861 .category = FIO_OPT_C_FILE,
2866 .lname = "Pre-read files",
2867 .type = FIO_OPT_BOOL,
2868 .off1 = td_var_offset(pre_read),
2869 .help = "Pre-read files before starting official testing",
2871 .category = FIO_OPT_C_FILE,
2872 .group = FIO_OPT_G_INVALID,
2874 #ifdef FIO_HAVE_CPU_AFFINITY
2877 .lname = "CPU mask",
2878 .type = FIO_OPT_INT,
2879 .cb = str_cpumask_cb,
2880 .help = "CPU affinity mask",
2881 .category = FIO_OPT_C_GENERAL,
2882 .group = FIO_OPT_G_CRED,
2885 .name = "cpus_allowed",
2886 .lname = "CPUs allowed",
2887 .type = FIO_OPT_STR,
2888 .cb = str_cpus_allowed_cb,
2889 .help = "Set CPUs allowed",
2890 .category = FIO_OPT_C_GENERAL,
2891 .group = FIO_OPT_G_CRED,
2894 .name = "cpus_allowed_policy",
2895 .lname = "CPUs allowed distribution policy",
2896 .type = FIO_OPT_STR,
2897 .off1 = td_var_offset(cpus_allowed_policy),
2898 .help = "Distribution policy for cpus_allowed",
2899 .parent = "cpus_allowed",
2903 .oval = FIO_CPUS_SHARED,
2904 .help = "Mask shared between threads",
2907 .oval = FIO_CPUS_SPLIT,
2908 .help = "Mask split between threads",
2911 .category = FIO_OPT_C_GENERAL,
2912 .group = FIO_OPT_G_CRED,
2915 #ifdef CONFIG_LIBNUMA
2917 .name = "numa_cpu_nodes",
2918 .type = FIO_OPT_STR,
2919 .cb = str_numa_cpunodes_cb,
2920 .help = "NUMA CPU nodes bind",
2921 .category = FIO_OPT_C_GENERAL,
2922 .group = FIO_OPT_G_INVALID,
2925 .name = "numa_mem_policy",
2926 .type = FIO_OPT_STR,
2927 .cb = str_numa_mpol_cb,
2928 .help = "NUMA memory policy setup",
2929 .category = FIO_OPT_C_GENERAL,
2930 .group = FIO_OPT_G_INVALID,
2934 .name = "end_fsync",
2935 .lname = "End fsync",
2936 .type = FIO_OPT_BOOL,
2937 .off1 = td_var_offset(end_fsync),
2938 .help = "Include fsync at the end of job",
2940 .category = FIO_OPT_C_FILE,
2941 .group = FIO_OPT_G_INVALID,
2944 .name = "fsync_on_close",
2945 .lname = "Fsync on close",
2946 .type = FIO_OPT_BOOL,
2947 .off1 = td_var_offset(fsync_on_close),
2948 .help = "fsync files on close",
2950 .category = FIO_OPT_C_FILE,
2951 .group = FIO_OPT_G_INVALID,
2955 .lname = "Unlink file",
2956 .type = FIO_OPT_BOOL,
2957 .off1 = td_var_offset(unlink),
2958 .help = "Unlink created files after job has completed",
2960 .category = FIO_OPT_C_FILE,
2961 .group = FIO_OPT_G_INVALID,
2965 .lname = "Exit-all on terminate",
2966 .type = FIO_OPT_STR_SET,
2967 .cb = str_exitall_cb,
2968 .help = "Terminate all jobs when one exits",
2969 .category = FIO_OPT_C_GENERAL,
2970 .group = FIO_OPT_G_PROCESS,
2973 .name = "stonewall",
2974 .lname = "Wait for previous",
2975 .alias = "wait_for_previous",
2976 .type = FIO_OPT_STR_SET,
2977 .off1 = td_var_offset(stonewall),
2978 .help = "Insert a hard barrier between this job and previous",
2979 .category = FIO_OPT_C_GENERAL,
2980 .group = FIO_OPT_G_PROCESS,
2983 .name = "new_group",
2984 .lname = "New group",
2985 .type = FIO_OPT_STR_SET,
2986 .off1 = td_var_offset(new_group),
2987 .help = "Mark the start of a new group (for reporting)",
2988 .category = FIO_OPT_C_GENERAL,
2989 .group = FIO_OPT_G_PROCESS,
2994 .type = FIO_OPT_STR_SET,
2995 .off1 = td_var_offset(use_thread),
2996 .help = "Use threads instead of processes",
2997 .category = FIO_OPT_C_GENERAL,
2998 .group = FIO_OPT_G_PROCESS,
3001 .name = "write_bw_log",
3002 .lname = "Write bandwidth log",
3003 .type = FIO_OPT_STR_STORE,
3004 .off1 = td_var_offset(bw_log_file),
3005 .help = "Write log of bandwidth during run",
3006 .category = FIO_OPT_C_LOG,
3007 .group = FIO_OPT_G_INVALID,
3010 .name = "write_lat_log",
3011 .lname = "Write latency log",
3012 .type = FIO_OPT_STR_STORE,
3013 .off1 = td_var_offset(lat_log_file),
3014 .help = "Write log of latency during run",
3015 .category = FIO_OPT_C_LOG,
3016 .group = FIO_OPT_G_INVALID,
3019 .name = "write_iops_log",
3020 .lname = "Write IOPS log",
3021 .type = FIO_OPT_STR_STORE,
3022 .off1 = td_var_offset(iops_log_file),
3023 .help = "Write log of IOPS during run",
3024 .category = FIO_OPT_C_LOG,
3025 .group = FIO_OPT_G_INVALID,
3028 .name = "log_avg_msec",
3029 .lname = "Log averaging (msec)",
3030 .type = FIO_OPT_INT,
3031 .off1 = td_var_offset(log_avg_msec),
3032 .help = "Average bw/iops/lat logs over this period of time",
3034 .category = FIO_OPT_C_LOG,
3035 .group = FIO_OPT_G_INVALID,
3038 .name = "bwavgtime",
3039 .lname = "Bandwidth average time",
3040 .type = FIO_OPT_INT,
3041 .off1 = td_var_offset(bw_avg_time),
3042 .help = "Time window over which to calculate bandwidth"
3045 .parent = "write_bw_log",
3048 .category = FIO_OPT_C_LOG,
3049 .group = FIO_OPT_G_INVALID,
3052 .name = "iopsavgtime",
3053 .lname = "IOPS average time",
3054 .type = FIO_OPT_INT,
3055 .off1 = td_var_offset(iops_avg_time),
3056 .help = "Time window over which to calculate IOPS (msec)",
3058 .parent = "write_iops_log",
3061 .category = FIO_OPT_C_LOG,
3062 .group = FIO_OPT_G_INVALID,
3065 .name = "group_reporting",
3066 .lname = "Group reporting",
3067 .type = FIO_OPT_STR_SET,
3068 .off1 = td_var_offset(group_reporting),
3069 .help = "Do reporting on a per-group basis",
3070 .category = FIO_OPT_C_STAT,
3071 .group = FIO_OPT_G_INVALID,
3074 .name = "zero_buffers",
3075 .lname = "Zero I/O buffers",
3076 .type = FIO_OPT_STR_SET,
3077 .off1 = td_var_offset(zero_buffers),
3078 .help = "Init IO buffers to all zeroes",
3079 .category = FIO_OPT_C_IO,
3080 .group = FIO_OPT_G_IO_BUF,
3083 .name = "refill_buffers",
3084 .lname = "Refill I/O buffers",
3085 .type = FIO_OPT_STR_SET,
3086 .off1 = td_var_offset(refill_buffers),
3087 .help = "Refill IO buffers on every IO submit",
3088 .category = FIO_OPT_C_IO,
3089 .group = FIO_OPT_G_IO_BUF,
3092 .name = "scramble_buffers",
3093 .lname = "Scramble I/O buffers",
3094 .type = FIO_OPT_BOOL,
3095 .off1 = td_var_offset(scramble_buffers),
3096 .help = "Slightly scramble buffers on every IO submit",
3098 .category = FIO_OPT_C_IO,
3099 .group = FIO_OPT_G_IO_BUF,
3102 .name = "buffer_pattern",
3103 .lname = "Buffer pattern",
3104 .type = FIO_OPT_STR,
3105 .cb = str_buffer_pattern_cb,
3106 .help = "Fill pattern for IO buffers",
3107 .category = FIO_OPT_C_IO,
3108 .group = FIO_OPT_G_IO_BUF,
3111 .name = "buffer_compress_percentage",
3112 .lname = "Buffer compression percentage",
3113 .type = FIO_OPT_INT,
3114 .off1 = td_var_offset(compress_percentage),
3117 .help = "How compressible the buffer is (approximately)",
3119 .category = FIO_OPT_C_IO,
3120 .group = FIO_OPT_G_IO_BUF,
3123 .name = "buffer_compress_chunk",
3124 .lname = "Buffer compression chunk size",
3125 .type = FIO_OPT_INT,
3126 .off1 = td_var_offset(compress_chunk),
3127 .parent = "buffer_compress_percentage",
3129 .help = "Size of compressible region in buffer",
3131 .category = FIO_OPT_C_IO,
3132 .group = FIO_OPT_G_IO_BUF,
3135 .name = "clat_percentiles",
3136 .lname = "Completion latency percentiles",
3137 .type = FIO_OPT_BOOL,
3138 .off1 = td_var_offset(clat_percentiles),
3139 .help = "Enable the reporting of completion latency percentiles",
3141 .category = FIO_OPT_C_STAT,
3142 .group = FIO_OPT_G_INVALID,
3145 .name = "percentile_list",
3146 .lname = "Completion latency percentile list",
3147 .type = FIO_OPT_FLOAT_LIST,
3148 .off1 = td_var_offset(percentile_list),
3149 .off2 = td_var_offset(percentile_precision),
3150 .help = "Specify a custom list of percentiles to report",
3151 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3152 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3155 .category = FIO_OPT_C_STAT,
3156 .group = FIO_OPT_G_INVALID,
3159 #ifdef FIO_HAVE_DISK_UTIL
3161 .name = "disk_util",
3162 .lname = "Disk utilization",
3163 .type = FIO_OPT_BOOL,
3164 .off1 = td_var_offset(do_disk_util),
3165 .help = "Log disk utilization statistics",
3167 .category = FIO_OPT_C_STAT,
3168 .group = FIO_OPT_G_INVALID,
3172 .name = "gtod_reduce",
3173 .lname = "Reduce gettimeofday() calls",
3174 .type = FIO_OPT_BOOL,
3175 .help = "Greatly reduce number of gettimeofday() calls",
3176 .cb = str_gtod_reduce_cb,
3179 .category = FIO_OPT_C_STAT,
3180 .group = FIO_OPT_G_INVALID,
3183 .name = "disable_lat",
3184 .lname = "Disable all latency stats",
3185 .type = FIO_OPT_BOOL,
3186 .off1 = td_var_offset(disable_lat),
3187 .help = "Disable latency numbers",
3188 .parent = "gtod_reduce",
3191 .category = FIO_OPT_C_STAT,
3192 .group = FIO_OPT_G_INVALID,
3195 .name = "disable_clat",
3196 .lname = "Disable completion latency stats",
3197 .type = FIO_OPT_BOOL,
3198 .off1 = td_var_offset(disable_clat),
3199 .help = "Disable completion latency numbers",
3200 .parent = "gtod_reduce",
3203 .category = FIO_OPT_C_STAT,
3204 .group = FIO_OPT_G_INVALID,
3207 .name = "disable_slat",
3208 .lname = "Disable submission latency stats",
3209 .type = FIO_OPT_BOOL,
3210 .off1 = td_var_offset(disable_slat),
3211 .help = "Disable submission latency numbers",
3212 .parent = "gtod_reduce",
3215 .category = FIO_OPT_C_STAT,
3216 .group = FIO_OPT_G_INVALID,
3219 .name = "disable_bw_measurement",
3220 .lname = "Disable bandwidth stats",
3221 .type = FIO_OPT_BOOL,
3222 .off1 = td_var_offset(disable_bw),
3223 .help = "Disable bandwidth logging",
3224 .parent = "gtod_reduce",
3227 .category = FIO_OPT_C_STAT,
3228 .group = FIO_OPT_G_INVALID,
3232 .lname = "Dedicated gettimeofday() CPU",
3233 .type = FIO_OPT_INT,
3234 .cb = str_gtod_cpu_cb,
3235 .help = "Set up dedicated gettimeofday() thread on this CPU",
3236 .verify = gtod_cpu_verify,
3237 .category = FIO_OPT_C_GENERAL,
3238 .group = FIO_OPT_G_CLOCK,
3241 .name = "unified_rw_reporting",
3242 .type = FIO_OPT_BOOL,
3243 .off1 = td_var_offset(unified_rw_rep),
3244 .help = "Unify reporting across data direction",
3246 .category = FIO_OPT_C_GENERAL,
3247 .group = FIO_OPT_G_INVALID,
3250 .name = "continue_on_error",
3251 .lname = "Continue on error",
3252 .type = FIO_OPT_STR,
3253 .off1 = td_var_offset(continue_on_error),
3254 .help = "Continue on non-fatal errors during IO",
3256 .category = FIO_OPT_C_GENERAL,
3257 .group = FIO_OPT_G_ERR,
3260 .oval = ERROR_TYPE_NONE,
3261 .help = "Exit when an error is encountered",
3264 .oval = ERROR_TYPE_READ,
3265 .help = "Continue on read errors only",
3268 .oval = ERROR_TYPE_WRITE,
3269 .help = "Continue on write errors only",
3272 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3273 .help = "Continue on any IO errors",
3276 .oval = ERROR_TYPE_VERIFY,
3277 .help = "Continue on verify errors only",
3280 .oval = ERROR_TYPE_ANY,
3281 .help = "Continue on all io and verify errors",
3284 .oval = ERROR_TYPE_NONE,
3285 .help = "Alias for 'none'",
3288 .oval = ERROR_TYPE_ANY,
3289 .help = "Alias for 'all'",
3294 .name = "ignore_error",
3295 .type = FIO_OPT_STR,
3296 .cb = str_ignore_error_cb,
3297 .help = "Set a specific list of errors to ignore",
3299 .category = FIO_OPT_C_GENERAL,
3300 .group = FIO_OPT_G_ERR,
3303 .name = "error_dump",
3304 .type = FIO_OPT_BOOL,
3305 .off1 = td_var_offset(error_dump),
3307 .help = "Dump info on each error",
3308 .category = FIO_OPT_C_GENERAL,
3309 .group = FIO_OPT_G_ERR,
3314 .type = FIO_OPT_STR_STORE,
3315 .off1 = td_var_offset(profile),
3316 .help = "Select a specific builtin performance test",
3317 .category = FIO_OPT_C_PROFILE,
3318 .group = FIO_OPT_G_INVALID,
3323 .type = FIO_OPT_STR_STORE,
3324 .off1 = td_var_offset(cgroup),
3325 .help = "Add job to cgroup of this name",
3326 .category = FIO_OPT_C_GENERAL,
3327 .group = FIO_OPT_G_CGROUP,
3330 .name = "cgroup_nodelete",
3331 .lname = "Cgroup no-delete",
3332 .type = FIO_OPT_BOOL,
3333 .off1 = td_var_offset(cgroup_nodelete),
3334 .help = "Do not delete cgroups after job completion",
3337 .category = FIO_OPT_C_GENERAL,
3338 .group = FIO_OPT_G_CGROUP,
3341 .name = "cgroup_weight",
3342 .lname = "Cgroup weight",
3343 .type = FIO_OPT_INT,
3344 .off1 = td_var_offset(cgroup_weight),
3345 .help = "Use given weight for cgroup",
3349 .category = FIO_OPT_C_GENERAL,
3350 .group = FIO_OPT_G_CGROUP,
3355 .type = FIO_OPT_INT,
3356 .off1 = td_var_offset(uid),
3357 .help = "Run job with this user ID",
3358 .category = FIO_OPT_C_GENERAL,
3359 .group = FIO_OPT_G_CRED,
3363 .lname = "Group ID",
3364 .type = FIO_OPT_INT,
3365 .off1 = td_var_offset(gid),
3366 .help = "Run job with this group ID",
3367 .category = FIO_OPT_C_GENERAL,
3368 .group = FIO_OPT_G_CRED,
3373 .type = FIO_OPT_INT,
3374 .off1 = td_var_offset(kb_base),
3380 .help = "Use 1024 as the K base",
3384 .help = "Use 1000 as the K base",
3387 .help = "How many bytes per KB for reporting (1000 or 1024)",
3388 .category = FIO_OPT_C_GENERAL,
3389 .group = FIO_OPT_G_INVALID,
3392 .name = "unit_base",
3393 .lname = "Base unit for reporting (Bits or Bytes)",
3394 .type = FIO_OPT_INT,
3395 .off1 = td_var_offset(unit_base),
3400 .help = "Auto-detect",
3404 .help = "Normal (byte based)",
3408 .help = "Bit based",
3411 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3412 .category = FIO_OPT_C_GENERAL,
3413 .group = FIO_OPT_G_INVALID,
3416 .name = "hugepage-size",
3417 .lname = "Hugepage size",
3418 .type = FIO_OPT_INT,
3419 .off1 = td_var_offset(hugepage_size),
3420 .help = "When using hugepages, specify size of each page",
3421 .def = __fio_stringify(FIO_HUGE_PAGE),
3422 .interval = 1024 * 1024,
3423 .category = FIO_OPT_C_GENERAL,
3424 .group = FIO_OPT_G_INVALID,
3428 .lname = "I/O flow ID",
3429 .type = FIO_OPT_INT,
3430 .off1 = td_var_offset(flow_id),
3431 .help = "The flow index ID to use",
3433 .category = FIO_OPT_C_IO,
3434 .group = FIO_OPT_G_IO_FLOW,
3438 .lname = "I/O flow weight",
3439 .type = FIO_OPT_INT,
3440 .off1 = td_var_offset(flow),
3441 .help = "Weight for flow control of this job",
3442 .parent = "flow_id",
3445 .category = FIO_OPT_C_IO,
3446 .group = FIO_OPT_G_IO_FLOW,
3449 .name = "flow_watermark",
3450 .lname = "I/O flow watermark",
3451 .type = FIO_OPT_INT,
3452 .off1 = td_var_offset(flow_watermark),
3453 .help = "High watermark for flow control. This option"
3454 " should be set to the same value for all threads"
3455 " with non-zero flow.",
3456 .parent = "flow_id",
3459 .category = FIO_OPT_C_IO,
3460 .group = FIO_OPT_G_IO_FLOW,
3463 .name = "flow_sleep",
3464 .lname = "I/O flow sleep",
3465 .type = FIO_OPT_INT,
3466 .off1 = td_var_offset(flow_sleep),
3467 .help = "How many microseconds to sleep after being held"
3468 " back by the flow control mechanism",
3469 .parent = "flow_id",
3472 .category = FIO_OPT_C_IO,
3473 .group = FIO_OPT_G_IO_FLOW,
3480 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3481 const char *name, int val)
3483 lopt->name = (char *) name;
3485 if (o->type == FIO_OPT_STR_SET)
3486 lopt->has_arg = optional_argument;
3488 lopt->has_arg = required_argument;
3491 static void options_to_lopts(struct fio_option *opts,
3492 struct option *long_options,
3493 int i, int option_type)
3495 struct fio_option *o = &opts[0];
3497 add_to_lopt(&long_options[i], o, o->name, option_type);
3500 add_to_lopt(&long_options[i], o, o->alias, option_type);
3505 assert(i < FIO_NR_OPTIONS);
3509 void fio_options_set_ioengine_opts(struct option *long_options,
3510 struct thread_data *td)
3515 while (long_options[i].name) {
3516 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3517 memset(&long_options[i], 0, sizeof(*long_options));
3524 * Just clear out the prior ioengine options.
3529 options_to_lopts(td->io_ops->options, long_options, i,
3530 FIO_GETOPT_IOENGINE);
3533 void fio_options_dup_and_init(struct option *long_options)
3537 options_init(fio_options);
3540 while (long_options[i].name)
3543 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3546 struct fio_keyword {
3552 static struct fio_keyword fio_keywords[] = {
3554 .word = "$pagesize",
3555 .desc = "Page size in the system",
3558 .word = "$mb_memory",
3559 .desc = "Megabytes of memory online",
3563 .desc = "Number of CPUs online in the system",
3570 void fio_keywords_init(void)
3572 unsigned long long mb_memory;
3576 sprintf(buf, "%lu", (unsigned long) page_size);
3577 fio_keywords[0].replace = strdup(buf);
3579 mb_memory = os_phys_mem() / (1024 * 1024);
3580 sprintf(buf, "%llu", mb_memory);
3581 fio_keywords[1].replace = strdup(buf);
3584 sprintf(buf, "%lu", l);
3585 fio_keywords[2].replace = strdup(buf);
3590 static char *bc_calc(char *str)
3592 char buf[128], *tmp;
3597 * No math, just return string
3599 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3600 !strchr(str, '/')) || strchr(str, '\''))
3604 * Split option from value, we only need to calculate the value
3606 tmp = strchr(str, '=');
3613 * Prevent buffer overflows; such a case isn't reasonable anyway
3615 if (strlen(str) >= 128 || strlen(tmp) > 100)
3618 sprintf(buf, "which %s > /dev/null", BC_APP);
3620 log_err("fio: bc is needed for performing math\n");
3624 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3625 f = popen(buf, "r");
3629 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3634 buf[(tmp - str) + ret - 1] = '\0';
3635 memcpy(buf, str, tmp - str);
3641 * Return a copy of the input string with substrings of the form ${VARNAME}
3642 * substituted with the value of the environment variable VARNAME. The
3643 * substitution always occurs, even if VARNAME is empty or the corresponding
3644 * environment variable undefined.
3646 static char *option_dup_subs(const char *opt)
3648 char out[OPT_LEN_MAX+1];
3649 char in[OPT_LEN_MAX+1];
3652 char *ch1, *ch2, *env;
3653 ssize_t nchr = OPT_LEN_MAX;
3656 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3657 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3661 in[OPT_LEN_MAX] = '\0';
3662 strncpy(in, opt, OPT_LEN_MAX);
3664 while (*inptr && nchr > 0) {
3665 if (inptr[0] == '$' && inptr[1] == '{') {
3666 ch2 = strchr(inptr, '}');
3667 if (ch2 && inptr+1 < ch2) {
3674 envlen = strlen(env);
3675 if (envlen <= nchr) {
3676 memcpy(outptr, env, envlen);
3686 *outptr++ = *inptr++;
3695 * Look for reserved variable names and replace them with real values
3697 static char *fio_keyword_replace(char *opt)
3703 for (i = 0; fio_keywords[i].word != NULL; i++) {
3704 struct fio_keyword *kw = &fio_keywords[i];
3706 while ((s = strstr(opt, kw->word)) != NULL) {
3707 char *new = malloc(strlen(opt) + 1);
3713 * Copy part of the string before the keyword and
3714 * sprintf() the replacement after it.
3716 memcpy(new, opt, olen);
3717 len = sprintf(new + olen, "%s", kw->replace);
3720 * If there's more in the original string, copy that
3723 opt += strlen(kw->word) + olen;
3725 memcpy(new + olen + len, opt, opt - o_org - 1);
3728 * replace opt and free the old opt
3738 * Check for potential math and invoke bc, if possible
3746 static char **dup_and_sub_options(char **opts, int num_opts)
3749 char **opts_copy = malloc(num_opts * sizeof(*opts));
3750 for (i = 0; i < num_opts; i++) {
3751 opts_copy[i] = option_dup_subs(opts[i]);
3754 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3759 int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3762 int i, ret, unknown;
3765 sort_options(opts, fio_options, num_opts);
3766 opts_copy = dup_and_sub_options(opts, num_opts);
3768 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3769 struct fio_option *o;
3770 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3771 &o, td, dump_cmdline);
3779 opts_copy[i] = NULL;
3786 ret |= ioengine_load(td);
3788 sort_options(opts_copy, td->io_ops->options, num_opts);
3791 for (i = 0; i < num_opts; i++) {
3792 struct fio_option *o = NULL;
3798 newret = parse_option(opts_copy[i], opts[i],
3799 td->io_ops->options, &o,
3800 td->eo, dump_cmdline);
3804 log_err("Bad option <%s>\n", opts[i]);
3807 opts_copy[i] = NULL;
3815 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3817 return parse_cmd_option(opt, val, fio_options, td);
3820 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3823 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
3826 void fio_fill_default_options(struct thread_data *td)
3828 td->o.magic = OPT_MAGIC;
3829 fill_default_options(td, fio_options);
3832 int fio_show_option_help(const char *opt)
3834 return show_cmd_help(fio_options, opt);
3837 void options_mem_dupe(void *data, struct fio_option *options)
3839 struct fio_option *o;
3842 for (o = &options[0]; o->name; o++) {
3843 if (o->type != FIO_OPT_STR_STORE)
3846 ptr = td_var(data, o, o->off1);
3848 *ptr = strdup(*ptr);
3853 * dupe FIO_OPT_STR_STORE options
3855 void fio_options_mem_dupe(struct thread_data *td)
3857 options_mem_dupe(&td->o, fio_options);
3859 if (td->eo && td->io_ops) {
3860 void *oldeo = td->eo;
3862 td->eo = malloc(td->io_ops->option_struct_size);
3863 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3864 options_mem_dupe(td->eo, td->io_ops->options);
3868 unsigned int fio_get_kb_base(void *data)
3870 struct thread_options *o = data;
3871 unsigned int kb_base = 0;
3874 * This is a hack... For private options, *data is not holding
3875 * a pointer to the thread_options, but to private data. This means
3876 * we can't safely dereference it, but magic is first so mem wise
3877 * it is valid. But this also means that if the job first sets
3878 * kb_base and expects that to be honored by private options,
3879 * it will be disappointed. We will return the global default
3882 if (o && o->magic == OPT_MAGIC)
3883 kb_base = o->kb_base;
3890 int add_option(struct fio_option *o)
3892 struct fio_option *__o;
3901 if (opt_index + 1 == FIO_MAX_OPTS) {
3902 log_err("fio: FIO_MAX_OPTS is too small\n");
3906 memcpy(&fio_options[opt_index], o, sizeof(*o));
3907 fio_options[opt_index + 1].name = NULL;
3911 void invalidate_profile_options(const char *prof_name)
3913 struct fio_option *o;
3917 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3918 o->type = FIO_OPT_INVALID;
3919 o->prof_name = NULL;
3925 void add_opt_posval(const char *optname, const char *ival, const char *help)
3927 struct fio_option *o;
3930 o = find_option(fio_options, optname);
3934 for (i = 0; i < PARSE_MAX_VP; i++) {
3935 if (o->posval[i].ival)
3938 o->posval[i].ival = ival;
3939 o->posval[i].help = help;
3944 void del_opt_posval(const char *optname, const char *ival)
3946 struct fio_option *o;
3949 o = find_option(fio_options, optname);
3953 for (i = 0; i < PARSE_MAX_VP; i++) {
3954 if (!o->posval[i].ival)
3956 if (strcmp(o->posval[i].ival, ival))
3959 o->posval[i].ival = NULL;
3960 o->posval[i].help = NULL;
3964 void fio_options_free(struct thread_data *td)
3966 options_free(fio_options, td);
3967 if (td->eo && td->io_ops && td->io_ops->options) {
3968 options_free(td->io_ops->options, td->eo);
3974 struct fio_option *fio_option_find(const char *name)
3976 return find_option(fio_options, name);