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, 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 == -1U)
136 if (perc > 100 && perc_missing > 1) {
137 log_err("fio: bssplit percentages add to more than 100%%\n");
143 * If values didn't have a percentage set, divide the remains between
147 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
149 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
150 struct bssplit *bsp = &bssplit[i];
152 if (bsp->perc == -1U)
153 bsp->perc = (100 - perc) / perc_missing;
157 o->min_bs[ddir] = min_bs;
158 o->max_bs[ddir] = max_bs;
161 * now sort based on percentages, for ease of lookup
163 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
164 o->bssplit[ddir] = bssplit;
168 static int str_bssplit_cb(void *data, const char *input)
170 struct thread_data *td = data;
171 char *str, *p, *odir, *ddir;
177 p = str = strdup(input);
179 strip_blank_front(&str);
180 strip_blank_end(str);
182 odir = strchr(str, ',');
184 ddir = strchr(odir + 1, ',');
186 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
192 op = strdup(odir + 1);
193 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
198 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
201 ret = bssplit_ddir(&td->o, DDIR_READ, str);
207 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
212 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
215 ret = bssplit_ddir(&td->o, DDIR_READ, str);
222 static int str2error(char *str)
224 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
225 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
226 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
227 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
228 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
229 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
230 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
231 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
232 int i = 0, num = sizeof(err) / sizeof(void *);
235 if (!strcmp(err[i], str))
242 static int ignore_error_type(struct thread_data *td, int etype, char *str)
248 if (etype >= ERROR_TYPE_CNT) {
249 log_err("Illegal error type\n");
253 td->o.ignore_error_nr[etype] = 4;
254 error = malloc(4 * sizeof(struct bssplit));
257 while ((fname = strsep(&str, ":")) != NULL) {
263 * grow struct buffer, if needed
265 if (i == td->o.ignore_error_nr[etype]) {
266 td->o.ignore_error_nr[etype] <<= 1;
267 error = realloc(error, td->o.ignore_error_nr[etype]
270 if (fname[0] == 'E') {
271 error[i] = str2error(fname);
273 error[i] = atoi(fname);
275 error[i] = -error[i];
278 log_err("Unknown error %s, please use number value \n",
286 td->o.continue_on_error |= 1 << etype;
287 td->o.ignore_error_nr[etype] = i;
288 td->o.ignore_error[etype] = error;
296 static int str_ignore_error_cb(void *data, const char *input)
298 struct thread_data *td = data;
300 int type = 0, ret = 1;
305 p = str = strdup(input);
307 strip_blank_front(&str);
308 strip_blank_end(str);
314 ret = ignore_error_type(td, type, p);
324 static int str_rw_cb(void *data, const char *str)
326 struct thread_data *td = data;
327 struct thread_options *o = &td->o;
336 nr = get_opt_postfix(str);
341 o->ddir_seq_nr = atoi(nr);
345 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
346 log_err("fio: rw postfix parsing failed\n");
351 o->ddir_seq_add = val;
358 static int str_mem_cb(void *data, const char *mem)
360 struct thread_data *td = data;
362 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
363 td->o.mmapfile = get_opt_postfix(mem);
368 static int fio_clock_source_cb(void *data, const char *str)
370 struct thread_data *td = data;
372 fio_clock_source = td->o.clocksource;
373 fio_clock_source_set = 1;
378 static int str_rwmix_read_cb(void *data, unsigned long long *val)
380 struct thread_data *td = data;
382 td->o.rwmix[DDIR_READ] = *val;
383 td->o.rwmix[DDIR_WRITE] = 100 - *val;
387 static int str_rwmix_write_cb(void *data, unsigned long long *val)
389 struct thread_data *td = data;
391 td->o.rwmix[DDIR_WRITE] = *val;
392 td->o.rwmix[DDIR_READ] = 100 - *val;
396 static int str_exitall_cb(void)
398 exitall_on_terminate = 1;
402 #ifdef FIO_HAVE_CPU_AFFINITY
403 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
405 unsigned int i, index, cpus_in_mask;
406 const long max_cpu = cpus_online();
408 cpus_in_mask = fio_cpu_count(mask);
409 cpu_index = cpu_index % cpus_in_mask;
412 for (i = 0; i < max_cpu; i++) {
413 if (!fio_cpu_isset(mask, i))
416 if (cpu_index != index)
417 fio_cpu_clear(mask, i);
422 return fio_cpu_count(mask);
425 static int str_cpumask_cb(void *data, unsigned long long *val)
427 struct thread_data *td = data;
435 ret = fio_cpuset_init(&td->o.cpumask);
437 log_err("fio: cpuset_init failed\n");
438 td_verror(td, ret, "fio_cpuset_init");
442 max_cpu = cpus_online();
444 for (i = 0; i < sizeof(int) * 8; i++) {
445 if ((1 << i) & *val) {
447 log_err("fio: CPU %d too large (max=%ld)\n", i,
451 dprint(FD_PARSE, "set cpu allowed %d\n", i);
452 fio_cpu_set(&td->o.cpumask, i);
459 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
466 ret = fio_cpuset_init(mask);
468 log_err("fio: cpuset_init failed\n");
469 td_verror(td, ret, "fio_cpuset_init");
473 p = str = strdup(input);
475 strip_blank_front(&str);
476 strip_blank_end(str);
478 max_cpu = cpus_online();
480 while ((cpu = strsep(&str, ",")) != NULL) {
489 while ((cpu2 = strsep(&str2, "-")) != NULL) {
499 while (icpu <= icpu2) {
500 if (icpu >= FIO_MAX_CPUS) {
501 log_err("fio: your OS only supports up to"
502 " %d CPUs\n", (int) FIO_MAX_CPUS);
506 if (icpu > max_cpu) {
507 log_err("fio: CPU %d too large (max=%ld)\n",
513 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
514 fio_cpu_set(mask, icpu);
525 static int str_cpus_allowed_cb(void *data, const char *input)
527 struct thread_data *td = data;
532 return set_cpus_allowed(td, &td->o.cpumask, input);
535 static int str_verify_cpus_allowed_cb(void *data, const char *input)
537 struct thread_data *td = data;
539 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
543 #ifdef CONFIG_LIBNUMA
544 static int str_numa_cpunodes_cb(void *data, char *input)
546 struct thread_data *td = data;
547 struct bitmask *verify_bitmask;
552 /* numa_parse_nodestring() parses a character string list
553 * of nodes into a bit mask. The bit mask is allocated by
554 * numa_allocate_nodemask(), so it should be freed by
555 * numa_free_nodemask().
557 verify_bitmask = numa_parse_nodestring(input);
558 if (verify_bitmask == NULL) {
559 log_err("fio: numa_parse_nodestring failed\n");
560 td_verror(td, 1, "str_numa_cpunodes_cb");
563 numa_free_nodemask(verify_bitmask);
565 td->o.numa_cpunodes = strdup(input);
569 static int str_numa_mpol_cb(void *data, char *input)
571 struct thread_data *td = data;
572 const char * const policy_types[] =
573 { "default", "prefer", "bind", "interleave", "local", NULL };
576 struct bitmask *verify_bitmask;
581 nodelist = strchr(input, ':');
583 /* NUL-terminate mode */
587 for (i = 0; i <= MPOL_LOCAL; i++) {
588 if (!strcmp(input, policy_types[i])) {
589 td->o.numa_mem_mode = i;
593 if (i > MPOL_LOCAL) {
594 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
598 switch (td->o.numa_mem_mode) {
601 * Insist on a nodelist of one node only
604 char *rest = nodelist;
605 while (isdigit(*rest))
608 log_err("fio: one node only for \'prefer\'\n");
612 log_err("fio: one node is needed for \'prefer\'\n");
616 case MPOL_INTERLEAVE:
618 * Default to online nodes with memory if no nodelist
621 nodelist = strdup("all");
626 * Don't allow a nodelist
629 log_err("fio: NO nodelist for \'local\'\n");
635 * Insist on a nodelist
638 log_err("fio: a nodelist is needed for \'bind\'\n");
645 /* numa_parse_nodestring() parses a character string list
646 * of nodes into a bit mask. The bit mask is allocated by
647 * numa_allocate_nodemask(), so it should be freed by
648 * numa_free_nodemask().
650 switch (td->o.numa_mem_mode) {
652 td->o.numa_mem_prefer_node = atoi(nodelist);
654 case MPOL_INTERLEAVE:
656 verify_bitmask = numa_parse_nodestring(nodelist);
657 if (verify_bitmask == NULL) {
658 log_err("fio: numa_parse_nodestring failed\n");
659 td_verror(td, 1, "str_numa_memnodes_cb");
662 td->o.numa_memnodes = strdup(nodelist);
663 numa_free_nodemask(verify_bitmask);
678 static int str_fst_cb(void *data, const char *str)
680 struct thread_data *td = data;
681 char *nr = get_opt_postfix(str);
683 td->file_service_nr = 1;
685 td->file_service_nr = atoi(nr);
692 #ifdef CONFIG_SYNC_FILE_RANGE
693 static int str_sfr_cb(void *data, const char *str)
695 struct thread_data *td = data;
696 char *nr = get_opt_postfix(str);
698 td->sync_file_range_nr = 1;
700 td->sync_file_range_nr = atoi(nr);
708 static int str_random_distribution_cb(void *data, const char *str)
710 struct thread_data *td = data;
717 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
719 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
724 nr = get_opt_postfix(str);
725 if (nr && !str_to_float(nr, &val, 0)) {
726 log_err("fio: random postfix parsing failed\n");
733 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
735 log_err("fio: zipf theta must different than 1.0\n");
738 td->o.zipf_theta.u.f = val;
740 if (val <= 0.00 || val >= 1.00) {
741 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
744 td->o.pareto_h.u.f = val;
751 * Return next name in the string. Files are separated with ':'. If the ':'
752 * is escaped with a '\', then that ':' is part of the filename and does not
753 * indicate a new file.
755 static char *get_next_name(char **ptr)
760 if (!str || !strlen(str))
766 * No colon, we are done
768 p = strchr(str, ':');
775 * We got a colon, but it's the first character. Skip and
783 if (*(p - 1) != '\\') {
789 memmove(p - 1, p, strlen(p) + 1);
797 static int get_max_name_idx(char *input)
799 unsigned int cur_idx;
802 p = str = strdup(input);
803 for (cur_idx = 0; ; cur_idx++)
804 if (get_next_name(&str) == NULL)
812 * Returns the directory at the index, indexes > entires will be
813 * assigned via modulo division of the index
815 int set_name_idx(char *target, char *input, int index)
817 unsigned int cur_idx;
819 char *fname, *str, *p;
821 p = str = strdup(input);
823 index %= get_max_name_idx(input);
824 for (cur_idx = 0; cur_idx <= index; cur_idx++)
825 fname = get_next_name(&str);
827 len = sprintf(target, "%s/", fname);
833 static int str_filename_cb(void *data, const char *input)
835 struct thread_data *td = data;
836 char *fname, *str, *p;
838 p = str = strdup(input);
840 strip_blank_front(&str);
841 strip_blank_end(str);
843 if (!td->files_index)
846 while ((fname = get_next_name(&str)) != NULL) {
849 add_file(td, fname, 0, 1);
856 static int str_directory_cb(void *data, const char fio_unused *unused)
858 struct thread_data *td = data;
860 char *dirname, *str, *p;
866 p = str = strdup(td->o.directory);
867 while ((dirname = get_next_name(&str)) != NULL) {
868 if (lstat(dirname, &sb) < 0) {
871 log_err("fio: %s is not a directory\n", dirname);
872 td_verror(td, ret, "lstat");
875 if (!S_ISDIR(sb.st_mode)) {
876 log_err("fio: %s is not a directory\n", dirname);
887 static int str_lockfile_cb(void *data, const char fio_unused *str)
889 struct thread_data *td = data;
891 if (td->files_index) {
892 log_err("fio: lockfile= option must precede filename=\n");
899 static int str_opendir_cb(void *data, const char fio_unused *str)
901 struct thread_data *td = data;
906 if (!td->files_index)
909 return add_dir_files(td, td->o.opendir);
912 static int pattern_cb(char *pattern, unsigned int max_size,
913 const char *input, unsigned int *pattern_bytes)
916 int i = 0, j = 0, len, k, base = 10;
917 uint32_t pattern_length;
921 * Check if it's a string input
923 loc1 = strchr(input, '\"');
927 if (*loc1 == '\0' || *loc1 == '\"')
932 } while (i < max_size);
941 * No string, find out if it's decimal or hexidecimal
943 loc1 = strstr(input, "0x");
944 loc2 = strstr(input, "0X");
947 off = strtol(input, NULL, base);
948 if (off != LONG_MAX || errno != ERANGE) {
950 pattern[i] = off & 0xff;
959 j = loc1 - input + 2;
961 j = loc2 - input + 2;
964 if (len - j < max_size * 2) {
966 off = converthexchartoint(input[k--]);
968 off += (converthexchartoint(input[k--])
970 pattern[i++] = (char) off;
976 * Fill the pattern all the way to the end. This greatly reduces
977 * the number of memcpy's we have to do when verifying the IO.
981 while (i > 1 && i * 2 <= max_size) {
982 memcpy(&pattern[i], &pattern[0], i);
987 * Fill remainder, if the pattern multiple ends up not being
990 while (i > 1 && i < max_size) {
991 unsigned int b = min(pattern_length, max_size - i);
993 memcpy(&pattern[i], &pattern[0], b);
999 * The code in verify_io_u_pattern assumes a single byte
1000 * pattern fills the whole verify pattern buffer.
1002 memset(pattern, pattern[0], max_size);
1009 static int str_buffer_pattern_cb(void *data, const char *input)
1011 struct thread_data *td = data;
1014 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
1015 &td->o.buffer_pattern_bytes);
1017 if (!ret && td->o.buffer_pattern_bytes) {
1018 if (!td->o.compress_percentage)
1019 td->o.refill_buffers = 0;
1020 td->o.scramble_buffers = 0;
1021 td->o.zero_buffers = 0;
1023 log_err("fio: failed parsing pattern `%s`\n", input);
1030 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1032 struct thread_data *td = data;
1034 td->flags |= TD_F_COMPRESS;
1035 td->o.compress_percentage = *il;
1039 static int str_dedupe_cb(void *data, unsigned long long *il)
1041 struct thread_data *td = data;
1043 td->flags |= TD_F_COMPRESS;
1044 td->o.dedupe_percentage = *il;
1045 td->o.refill_buffers = 1;
1049 static int str_verify_pattern_cb(void *data, const char *input)
1051 struct thread_data *td = data;
1054 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1055 &td->o.verify_pattern_bytes);
1058 * VERIFY_META could already be set
1060 if (!ret && td->o.verify == VERIFY_NONE)
1061 td->o.verify = VERIFY_PATTERN;
1066 static int str_gtod_reduce_cb(void *data, int *il)
1068 struct thread_data *td = data;
1071 td->o.disable_lat = !!val;
1072 td->o.disable_clat = !!val;
1073 td->o.disable_slat = !!val;
1074 td->o.disable_bw = !!val;
1075 td->o.clat_percentiles = !val;
1077 td->tv_cache_mask = 63;
1082 static int str_gtod_cpu_cb(void *data, long long *il)
1084 struct thread_data *td = data;
1087 td->o.gtod_cpu = val;
1088 td->o.gtod_offload = 1;
1092 static int str_size_cb(void *data, unsigned long long *__val)
1094 struct thread_data *td = data;
1095 unsigned long long v = *__val;
1097 if (parse_is_percent(v)) {
1099 td->o.size_percent = -1ULL - v;
1106 static int rw_verify(struct fio_option *o, void *data)
1108 struct thread_data *td = data;
1110 if (read_only && td_write(td)) {
1111 log_err("fio: job <%s> has write bit set, but fio is in"
1112 " read-only mode\n", td->o.name);
1119 static int gtod_cpu_verify(struct fio_option *o, void *data)
1121 #ifndef FIO_HAVE_CPU_AFFINITY
1122 struct thread_data *td = data;
1124 if (td->o.gtod_cpu) {
1125 log_err("fio: platform must support CPU affinity for"
1126 "gettimeofday() offloading\n");
1137 static struct opt_group fio_opt_groups[] = {
1140 .mask = FIO_OPT_C_GENERAL,
1144 .mask = FIO_OPT_C_IO,
1148 .mask = FIO_OPT_C_FILE,
1151 .name = "Statistics",
1152 .mask = FIO_OPT_C_STAT,
1156 .mask = FIO_OPT_C_LOG,
1160 .mask = FIO_OPT_C_PROFILE,
1167 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1168 unsigned int inv_mask)
1170 struct opt_group *og;
1173 if (*mask == inv_mask || !*mask)
1176 for (i = 0; ogs[i].name; i++) {
1179 if (*mask & og->mask) {
1180 *mask &= ~(og->mask);
1188 struct opt_group *opt_group_from_mask(unsigned int *mask)
1190 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1193 static struct opt_group fio_opt_cat_groups[] = {
1195 .name = "Latency profiling",
1196 .mask = FIO_OPT_G_LATPROF,
1200 .mask = FIO_OPT_G_RATE,
1204 .mask = FIO_OPT_G_ZONE,
1207 .name = "Read/write mix",
1208 .mask = FIO_OPT_G_RWMIX,
1212 .mask = FIO_OPT_G_VERIFY,
1216 .mask = FIO_OPT_G_TRIM,
1219 .name = "I/O Logging",
1220 .mask = FIO_OPT_G_IOLOG,
1223 .name = "I/O Depth",
1224 .mask = FIO_OPT_G_IO_DEPTH,
1228 .mask = FIO_OPT_G_IO_FLOW,
1231 .name = "Description",
1232 .mask = FIO_OPT_G_DESC,
1236 .mask = FIO_OPT_G_FILENAME,
1239 .name = "General I/O",
1240 .mask = FIO_OPT_G_IO_BASIC,
1244 .mask = FIO_OPT_G_CGROUP,
1248 .mask = FIO_OPT_G_RUNTIME,
1252 .mask = FIO_OPT_G_PROCESS,
1255 .name = "Job credentials / priority",
1256 .mask = FIO_OPT_G_CRED,
1259 .name = "Clock settings",
1260 .mask = FIO_OPT_G_CLOCK,
1264 .mask = FIO_OPT_G_IO_TYPE,
1267 .name = "I/O Thinktime",
1268 .mask = FIO_OPT_G_THINKTIME,
1271 .name = "Randomizations",
1272 .mask = FIO_OPT_G_RANDOM,
1275 .name = "I/O buffers",
1276 .mask = FIO_OPT_G_IO_BUF,
1279 .name = "Tiobench profile",
1280 .mask = FIO_OPT_G_TIOBENCH,
1288 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1290 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1294 * Map of job/command line options
1296 struct fio_option fio_options[FIO_MAX_OPTS] = {
1298 .name = "description",
1299 .lname = "Description of job",
1300 .type = FIO_OPT_STR_STORE,
1301 .off1 = td_var_offset(description),
1302 .help = "Text job description",
1303 .category = FIO_OPT_C_GENERAL,
1304 .group = FIO_OPT_G_DESC,
1308 .lname = "Job name",
1309 .type = FIO_OPT_STR_STORE,
1310 .off1 = td_var_offset(name),
1311 .help = "Name of this job",
1312 .category = FIO_OPT_C_GENERAL,
1313 .group = FIO_OPT_G_DESC,
1317 .lname = "Filename(s)",
1318 .type = FIO_OPT_STR_STORE,
1319 .off1 = td_var_offset(filename),
1320 .cb = str_filename_cb,
1321 .prio = -1, /* must come after "directory" */
1322 .help = "File(s) to use for the workload",
1323 .category = FIO_OPT_C_FILE,
1324 .group = FIO_OPT_G_FILENAME,
1327 .name = "directory",
1328 .lname = "Directory",
1329 .type = FIO_OPT_STR_STORE,
1330 .off1 = td_var_offset(directory),
1331 .cb = str_directory_cb,
1332 .help = "Directory to store files in",
1333 .category = FIO_OPT_C_FILE,
1334 .group = FIO_OPT_G_FILENAME,
1337 .name = "filename_format",
1338 .type = FIO_OPT_STR_STORE,
1339 .off1 = td_var_offset(filename_format),
1340 .prio = -1, /* must come after "directory" */
1341 .help = "Override default $jobname.$jobnum.$filenum naming",
1342 .def = "$jobname.$jobnum.$filenum",
1343 .category = FIO_OPT_C_FILE,
1344 .group = FIO_OPT_G_FILENAME,
1348 .lname = "Lockfile",
1349 .type = FIO_OPT_STR,
1350 .off1 = td_var_offset(file_lock_mode),
1351 .help = "Lock file when doing IO to it",
1353 .parent = "filename",
1356 .cb = str_lockfile_cb,
1357 .category = FIO_OPT_C_FILE,
1358 .group = FIO_OPT_G_FILENAME,
1361 .oval = FILE_LOCK_NONE,
1362 .help = "No file locking",
1364 { .ival = "exclusive",
1365 .oval = FILE_LOCK_EXCLUSIVE,
1366 .help = "Exclusive file lock",
1369 .ival = "readwrite",
1370 .oval = FILE_LOCK_READWRITE,
1371 .help = "Read vs write lock",
1377 .lname = "Open directory",
1378 .type = FIO_OPT_STR_STORE,
1379 .off1 = td_var_offset(opendir),
1380 .cb = str_opendir_cb,
1381 .help = "Recursively add files from this directory and down",
1382 .category = FIO_OPT_C_FILE,
1383 .group = FIO_OPT_G_FILENAME,
1387 .lname = "Read/write",
1388 .alias = "readwrite",
1389 .type = FIO_OPT_STR,
1391 .off1 = td_var_offset(td_ddir),
1392 .help = "IO direction",
1394 .verify = rw_verify,
1395 .category = FIO_OPT_C_IO,
1396 .group = FIO_OPT_G_IO_BASIC,
1399 .oval = TD_DDIR_READ,
1400 .help = "Sequential read",
1403 .oval = TD_DDIR_WRITE,
1404 .help = "Sequential write",
1407 .oval = TD_DDIR_TRIM,
1408 .help = "Sequential trim",
1410 { .ival = "randread",
1411 .oval = TD_DDIR_RANDREAD,
1412 .help = "Random read",
1414 { .ival = "randwrite",
1415 .oval = TD_DDIR_RANDWRITE,
1416 .help = "Random write",
1418 { .ival = "randtrim",
1419 .oval = TD_DDIR_RANDTRIM,
1420 .help = "Random trim",
1424 .help = "Sequential read and write mix",
1426 { .ival = "readwrite",
1428 .help = "Sequential read and write mix",
1431 .oval = TD_DDIR_RANDRW,
1432 .help = "Random read and write mix"
1437 .name = "rw_sequencer",
1438 .lname = "RW Sequencer",
1439 .type = FIO_OPT_STR,
1440 .off1 = td_var_offset(rw_seq),
1441 .help = "IO offset generator modifier",
1442 .def = "sequential",
1443 .category = FIO_OPT_C_IO,
1444 .group = FIO_OPT_G_IO_BASIC,
1446 { .ival = "sequential",
1448 .help = "Generate sequential offsets",
1450 { .ival = "identical",
1451 .oval = RW_SEQ_IDENT,
1452 .help = "Generate identical offsets",
1459 .lname = "IO Engine",
1460 .type = FIO_OPT_STR_STORE,
1461 .off1 = td_var_offset(ioengine),
1462 .help = "IO engine to use",
1463 .def = FIO_PREFERRED_ENGINE,
1464 .category = FIO_OPT_C_IO,
1465 .group = FIO_OPT_G_IO_BASIC,
1468 .help = "Use read/write",
1471 .help = "Use pread/pwrite",
1474 .help = "Use readv/writev",
1476 #ifdef CONFIG_PWRITEV
1478 .help = "Use preadv/pwritev",
1481 #ifdef CONFIG_LIBAIO
1483 .help = "Linux native asynchronous IO",
1486 #ifdef CONFIG_POSIXAIO
1487 { .ival = "posixaio",
1488 .help = "POSIX asynchronous IO",
1491 #ifdef CONFIG_SOLARISAIO
1492 { .ival = "solarisaio",
1493 .help = "Solaris native asynchronous IO",
1496 #ifdef CONFIG_WINDOWSAIO
1497 { .ival = "windowsaio",
1498 .help = "Windows native asynchronous IO"
1503 .help = "Rados Block Device asynchronous IO"
1507 .help = "Memory mapped IO"
1509 #ifdef CONFIG_LINUX_SPLICE
1511 .help = "splice/vmsplice based IO",
1513 { .ival = "netsplice",
1514 .help = "splice/vmsplice to/from the network",
1517 #ifdef FIO_HAVE_SGIO
1519 .help = "SCSI generic v3 IO",
1523 .help = "Testing engine (no data transfer)",
1526 .help = "Network IO",
1529 .help = "CPU cycle burner engine",
1533 .help = "GUASI IO engine",
1536 #ifdef FIO_HAVE_BINJECT
1537 { .ival = "binject",
1538 .help = "binject direct inject block engine",
1543 .help = "RDMA IO engine",
1546 #ifdef CONFIG_FUSION_AW
1547 { .ival = "fusion-aw-sync",
1548 .help = "Fusion-io atomic write engine",
1551 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1552 { .ival = "e4defrag",
1553 .help = "ext4 defrag engine",
1556 #ifdef CONFIG_LINUX_FALLOCATE
1558 .help = "fallocate() file based engine",
1563 .help = "Glusterfs libgfapi(sync) based engine"
1565 { .ival = "gfapi_async",
1566 .help = "Glusterfs libgfapi(async) based engine"
1569 #ifdef CONFIG_LIBHDFS
1570 { .ival = "libhdfs",
1571 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1574 { .ival = "external",
1575 .help = "Load external engine (append name)",
1581 .lname = "IO Depth",
1582 .type = FIO_OPT_INT,
1583 .off1 = td_var_offset(iodepth),
1584 .help = "Number of IO buffers to keep in flight",
1588 .category = FIO_OPT_C_IO,
1589 .group = FIO_OPT_G_IO_BASIC,
1592 .name = "iodepth_batch",
1593 .lname = "IO Depth batch",
1594 .alias = "iodepth_batch_submit",
1595 .type = FIO_OPT_INT,
1596 .off1 = td_var_offset(iodepth_batch),
1597 .help = "Number of IO buffers to submit in one go",
1598 .parent = "iodepth",
1603 .category = FIO_OPT_C_IO,
1604 .group = FIO_OPT_G_IO_BASIC,
1607 .name = "iodepth_batch_complete",
1608 .lname = "IO Depth batch complete",
1609 .type = FIO_OPT_INT,
1610 .off1 = td_var_offset(iodepth_batch_complete),
1611 .help = "Number of IO buffers to retrieve in one go",
1612 .parent = "iodepth",
1617 .category = FIO_OPT_C_IO,
1618 .group = FIO_OPT_G_IO_BASIC,
1621 .name = "iodepth_low",
1622 .lname = "IO Depth batch low",
1623 .type = FIO_OPT_INT,
1624 .off1 = td_var_offset(iodepth_low),
1625 .help = "Low water mark for queuing depth",
1626 .parent = "iodepth",
1629 .category = FIO_OPT_C_IO,
1630 .group = FIO_OPT_G_IO_BASIC,
1635 .type = FIO_OPT_STR_VAL,
1637 .off1 = td_var_offset(size),
1638 .help = "Total size of device or files",
1639 .interval = 1024 * 1024,
1640 .category = FIO_OPT_C_IO,
1641 .group = FIO_OPT_G_INVALID,
1645 .lname = "IO Limit",
1646 .type = FIO_OPT_STR_VAL,
1647 .off1 = td_var_offset(io_limit),
1648 .interval = 1024 * 1024,
1649 .category = FIO_OPT_C_IO,
1650 .group = FIO_OPT_G_INVALID,
1653 .name = "fill_device",
1654 .lname = "Fill device",
1656 .type = FIO_OPT_BOOL,
1657 .off1 = td_var_offset(fill_device),
1658 .help = "Write until an ENOSPC error occurs",
1660 .category = FIO_OPT_C_FILE,
1661 .group = FIO_OPT_G_INVALID,
1665 .lname = "File size",
1666 .type = FIO_OPT_STR_VAL,
1667 .off1 = td_var_offset(file_size_low),
1668 .off2 = td_var_offset(file_size_high),
1670 .help = "Size of individual files",
1671 .interval = 1024 * 1024,
1672 .category = FIO_OPT_C_FILE,
1673 .group = FIO_OPT_G_INVALID,
1676 .name = "file_append",
1677 .lname = "File append",
1678 .type = FIO_OPT_BOOL,
1679 .off1 = td_var_offset(file_append),
1680 .help = "IO will start at the end of the file(s)",
1682 .category = FIO_OPT_C_FILE,
1683 .group = FIO_OPT_G_INVALID,
1687 .lname = "IO offset",
1688 .alias = "fileoffset",
1689 .type = FIO_OPT_STR_VAL,
1690 .off1 = td_var_offset(start_offset),
1691 .help = "Start IO from this offset",
1693 .interval = 1024 * 1024,
1694 .category = FIO_OPT_C_IO,
1695 .group = FIO_OPT_G_INVALID,
1698 .name = "offset_increment",
1699 .lname = "IO offset increment",
1700 .type = FIO_OPT_STR_VAL,
1701 .off1 = td_var_offset(offset_increment),
1702 .help = "What is the increment from one offset to the next",
1706 .interval = 1024 * 1024,
1707 .category = FIO_OPT_C_IO,
1708 .group = FIO_OPT_G_INVALID,
1711 .name = "number_ios",
1712 .lname = "Number of IOs to perform",
1713 .type = FIO_OPT_STR_VAL,
1714 .off1 = td_var_offset(number_ios),
1715 .help = "Force job completion after this number of IOs",
1717 .category = FIO_OPT_C_IO,
1718 .group = FIO_OPT_G_INVALID,
1722 .lname = "Block size",
1723 .alias = "blocksize",
1724 .type = FIO_OPT_INT,
1725 .off1 = td_var_offset(bs[DDIR_READ]),
1726 .off2 = td_var_offset(bs[DDIR_WRITE]),
1727 .off3 = td_var_offset(bs[DDIR_TRIM]),
1729 .help = "Block size unit",
1734 .category = FIO_OPT_C_IO,
1735 .group = FIO_OPT_G_INVALID,
1739 .lname = "Block size align",
1740 .alias = "blockalign",
1741 .type = FIO_OPT_INT,
1742 .off1 = td_var_offset(ba[DDIR_READ]),
1743 .off2 = td_var_offset(ba[DDIR_WRITE]),
1744 .off3 = td_var_offset(ba[DDIR_TRIM]),
1746 .help = "IO block offset alignment",
1750 .category = FIO_OPT_C_IO,
1751 .group = FIO_OPT_G_INVALID,
1755 .lname = "Block size range",
1756 .alias = "blocksize_range",
1757 .type = FIO_OPT_RANGE,
1758 .off1 = td_var_offset(min_bs[DDIR_READ]),
1759 .off2 = td_var_offset(max_bs[DDIR_READ]),
1760 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1761 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1762 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1763 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1765 .help = "Set block size range (in more detail than bs)",
1769 .category = FIO_OPT_C_IO,
1770 .group = FIO_OPT_G_INVALID,
1774 .lname = "Block size split",
1775 .type = FIO_OPT_STR,
1776 .cb = str_bssplit_cb,
1777 .off1 = td_var_offset(bssplit),
1778 .help = "Set a specific mix of block sizes",
1781 .category = FIO_OPT_C_IO,
1782 .group = FIO_OPT_G_INVALID,
1785 .name = "bs_unaligned",
1786 .lname = "Block size unaligned",
1787 .alias = "blocksize_unaligned",
1788 .type = FIO_OPT_STR_SET,
1789 .off1 = td_var_offset(bs_unaligned),
1790 .help = "Don't sector align IO buffer sizes",
1793 .category = FIO_OPT_C_IO,
1794 .group = FIO_OPT_G_INVALID,
1797 .name = "bs_is_seq_rand",
1798 .lname = "Block size division is seq/random (not read/write)",
1799 .type = FIO_OPT_BOOL,
1800 .off1 = td_var_offset(bs_is_seq_rand),
1801 .help = "Consider any blocksize setting to be sequential,random",
1803 .parent = "blocksize",
1804 .category = FIO_OPT_C_IO,
1805 .group = FIO_OPT_G_INVALID,
1808 .name = "randrepeat",
1809 .lname = "Random repeatable",
1810 .type = FIO_OPT_BOOL,
1811 .off1 = td_var_offset(rand_repeatable),
1812 .help = "Use repeatable random IO pattern",
1816 .category = FIO_OPT_C_IO,
1817 .group = FIO_OPT_G_RANDOM,
1821 .lname = "The random generator seed",
1822 .type = FIO_OPT_STR_VAL,
1823 .off1 = td_var_offset(rand_seed),
1824 .help = "Set the random generator seed value",
1826 .category = FIO_OPT_C_IO,
1827 .group = FIO_OPT_G_RANDOM,
1830 .name = "use_os_rand",
1831 .lname = "Use OS random",
1832 .type = FIO_OPT_DEPRECATED,
1833 .off1 = td_var_offset(dep_use_os_rand),
1834 .category = FIO_OPT_C_IO,
1835 .group = FIO_OPT_G_RANDOM,
1838 .name = "norandommap",
1839 .lname = "No randommap",
1840 .type = FIO_OPT_STR_SET,
1841 .off1 = td_var_offset(norandommap),
1842 .help = "Accept potential duplicate random blocks",
1846 .category = FIO_OPT_C_IO,
1847 .group = FIO_OPT_G_RANDOM,
1850 .name = "softrandommap",
1851 .lname = "Soft randommap",
1852 .type = FIO_OPT_BOOL,
1853 .off1 = td_var_offset(softrandommap),
1854 .help = "Set norandommap if randommap allocation fails",
1855 .parent = "norandommap",
1858 .category = FIO_OPT_C_IO,
1859 .group = FIO_OPT_G_RANDOM,
1862 .name = "random_generator",
1863 .type = FIO_OPT_STR,
1864 .off1 = td_var_offset(random_generator),
1865 .help = "Type of random number generator to use",
1866 .def = "tausworthe",
1868 { .ival = "tausworthe",
1869 .oval = FIO_RAND_GEN_TAUSWORTHE,
1870 .help = "Strong Tausworthe generator",
1873 .oval = FIO_RAND_GEN_LFSR,
1874 .help = "Variable length LFSR",
1877 .category = FIO_OPT_C_IO,
1878 .group = FIO_OPT_G_RANDOM,
1881 .name = "random_distribution",
1882 .type = FIO_OPT_STR,
1883 .off1 = td_var_offset(random_distribution),
1884 .cb = str_random_distribution_cb,
1885 .help = "Random offset distribution generator",
1889 .oval = FIO_RAND_DIST_RANDOM,
1890 .help = "Completely random",
1893 .oval = FIO_RAND_DIST_ZIPF,
1894 .help = "Zipf distribution",
1897 .oval = FIO_RAND_DIST_PARETO,
1898 .help = "Pareto distribution",
1901 .category = FIO_OPT_C_IO,
1902 .group = FIO_OPT_G_RANDOM,
1905 .name = "percentage_random",
1906 .lname = "Percentage Random",
1907 .type = FIO_OPT_INT,
1908 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1909 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1910 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1912 .help = "Percentage of seq/random mix that should be random",
1913 .def = "100,100,100",
1915 .inverse = "percentage_sequential",
1916 .category = FIO_OPT_C_IO,
1917 .group = FIO_OPT_G_RANDOM,
1920 .name = "percentage_sequential",
1921 .lname = "Percentage Sequential",
1922 .type = FIO_OPT_DEPRECATED,
1923 .category = FIO_OPT_C_IO,
1924 .group = FIO_OPT_G_RANDOM,
1927 .name = "allrandrepeat",
1928 .type = FIO_OPT_BOOL,
1929 .off1 = td_var_offset(allrand_repeatable),
1930 .help = "Use repeatable random numbers for everything",
1932 .category = FIO_OPT_C_IO,
1933 .group = FIO_OPT_G_RANDOM,
1937 .lname = "Number of files",
1938 .alias = "nr_files",
1939 .type = FIO_OPT_INT,
1940 .off1 = td_var_offset(nr_files),
1941 .help = "Split job workload between this number of files",
1944 .category = FIO_OPT_C_FILE,
1945 .group = FIO_OPT_G_INVALID,
1948 .name = "openfiles",
1949 .lname = "Number of open files",
1950 .type = FIO_OPT_INT,
1951 .off1 = td_var_offset(open_files),
1952 .help = "Number of files to keep open at the same time",
1953 .category = FIO_OPT_C_FILE,
1954 .group = FIO_OPT_G_INVALID,
1957 .name = "file_service_type",
1958 .lname = "File service type",
1959 .type = FIO_OPT_STR,
1961 .off1 = td_var_offset(file_service_type),
1962 .help = "How to select which file to service next",
1963 .def = "roundrobin",
1964 .category = FIO_OPT_C_FILE,
1965 .group = FIO_OPT_G_INVALID,
1968 .oval = FIO_FSERVICE_RANDOM,
1969 .help = "Choose a file at random",
1971 { .ival = "roundrobin",
1972 .oval = FIO_FSERVICE_RR,
1973 .help = "Round robin select files",
1975 { .ival = "sequential",
1976 .oval = FIO_FSERVICE_SEQ,
1977 .help = "Finish one file before moving to the next",
1980 .parent = "nrfiles",
1983 #ifdef CONFIG_POSIX_FALLOCATE
1985 .name = "fallocate",
1986 .lname = "Fallocate",
1987 .type = FIO_OPT_STR,
1988 .off1 = td_var_offset(fallocate_mode),
1989 .help = "Whether pre-allocation is performed when laying out files",
1991 .category = FIO_OPT_C_FILE,
1992 .group = FIO_OPT_G_INVALID,
1995 .oval = FIO_FALLOCATE_NONE,
1996 .help = "Do not pre-allocate space",
1999 .oval = FIO_FALLOCATE_POSIX,
2000 .help = "Use posix_fallocate()",
2002 #ifdef CONFIG_LINUX_FALLOCATE
2004 .oval = FIO_FALLOCATE_KEEP_SIZE,
2005 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2008 /* Compatibility with former boolean values */
2010 .oval = FIO_FALLOCATE_NONE,
2011 .help = "Alias for 'none'",
2014 .oval = FIO_FALLOCATE_POSIX,
2015 .help = "Alias for 'posix'",
2019 #endif /* CONFIG_POSIX_FALLOCATE */
2021 .name = "fadvise_hint",
2022 .lname = "Fadvise hint",
2023 .type = FIO_OPT_BOOL,
2024 .off1 = td_var_offset(fadvise_hint),
2025 .help = "Use fadvise() to advise the kernel on IO pattern",
2027 .category = FIO_OPT_C_FILE,
2028 .group = FIO_OPT_G_INVALID,
2033 .type = FIO_OPT_INT,
2034 .off1 = td_var_offset(fsync_blocks),
2035 .help = "Issue fsync for writes every given number of blocks",
2038 .category = FIO_OPT_C_FILE,
2039 .group = FIO_OPT_G_INVALID,
2042 .name = "fdatasync",
2043 .lname = "Fdatasync",
2044 .type = FIO_OPT_INT,
2045 .off1 = td_var_offset(fdatasync_blocks),
2046 .help = "Issue fdatasync for writes every given number of blocks",
2049 .category = FIO_OPT_C_FILE,
2050 .group = FIO_OPT_G_INVALID,
2053 .name = "write_barrier",
2054 .lname = "Write barrier",
2055 .type = FIO_OPT_INT,
2056 .off1 = td_var_offset(barrier_blocks),
2057 .help = "Make every Nth write a barrier write",
2060 .category = FIO_OPT_C_IO,
2061 .group = FIO_OPT_G_INVALID,
2063 #ifdef CONFIG_SYNC_FILE_RANGE
2065 .name = "sync_file_range",
2066 .lname = "Sync file range",
2068 { .ival = "wait_before",
2069 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2070 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2074 .oval = SYNC_FILE_RANGE_WRITE,
2075 .help = "SYNC_FILE_RANGE_WRITE",
2079 .ival = "wait_after",
2080 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2081 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2085 .type = FIO_OPT_STR_MULTI,
2087 .off1 = td_var_offset(sync_file_range),
2088 .help = "Use sync_file_range()",
2089 .category = FIO_OPT_C_FILE,
2090 .group = FIO_OPT_G_INVALID,
2095 .lname = "Direct I/O",
2096 .type = FIO_OPT_BOOL,
2097 .off1 = td_var_offset(odirect),
2098 .help = "Use O_DIRECT IO (negates buffered)",
2100 .inverse = "buffered",
2101 .category = FIO_OPT_C_IO,
2102 .group = FIO_OPT_G_IO_TYPE,
2106 .lname = "Atomic I/O",
2107 .type = FIO_OPT_BOOL,
2108 .off1 = td_var_offset(oatomic),
2109 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2111 .category = FIO_OPT_C_IO,
2112 .group = FIO_OPT_G_IO_TYPE,
2116 .lname = "Buffered I/O",
2117 .type = FIO_OPT_BOOL,
2118 .off1 = td_var_offset(odirect),
2120 .help = "Use buffered IO (negates direct)",
2122 .inverse = "direct",
2123 .category = FIO_OPT_C_IO,
2124 .group = FIO_OPT_G_IO_TYPE,
2127 .name = "overwrite",
2128 .lname = "Overwrite",
2129 .type = FIO_OPT_BOOL,
2130 .off1 = td_var_offset(overwrite),
2131 .help = "When writing, set whether to overwrite current data",
2133 .category = FIO_OPT_C_FILE,
2134 .group = FIO_OPT_G_INVALID,
2139 .type = FIO_OPT_INT,
2140 .off1 = td_var_offset(loops),
2141 .help = "Number of times to run the job",
2144 .category = FIO_OPT_C_GENERAL,
2145 .group = FIO_OPT_G_RUNTIME,
2149 .lname = "Number of jobs",
2150 .type = FIO_OPT_INT,
2151 .off1 = td_var_offset(numjobs),
2152 .help = "Duplicate this job this many times",
2155 .category = FIO_OPT_C_GENERAL,
2156 .group = FIO_OPT_G_RUNTIME,
2159 .name = "startdelay",
2160 .lname = "Start delay",
2161 .type = FIO_OPT_STR_VAL_TIME,
2162 .off1 = td_var_offset(start_delay),
2163 .off2 = td_var_offset(start_delay_high),
2164 .help = "Only start job when this period has passed",
2168 .category = FIO_OPT_C_GENERAL,
2169 .group = FIO_OPT_G_RUNTIME,
2175 .type = FIO_OPT_STR_VAL_TIME,
2176 .off1 = td_var_offset(timeout),
2177 .help = "Stop workload when this amount of time has passed",
2181 .category = FIO_OPT_C_GENERAL,
2182 .group = FIO_OPT_G_RUNTIME,
2185 .name = "time_based",
2186 .lname = "Time based",
2187 .type = FIO_OPT_STR_SET,
2188 .off1 = td_var_offset(time_based),
2189 .help = "Keep running until runtime/timeout is met",
2190 .category = FIO_OPT_C_GENERAL,
2191 .group = FIO_OPT_G_RUNTIME,
2194 .name = "verify_only",
2195 .lname = "Verify only",
2196 .type = FIO_OPT_STR_SET,
2197 .off1 = td_var_offset(verify_only),
2198 .help = "Verifies previously written data is still valid",
2199 .category = FIO_OPT_C_GENERAL,
2200 .group = FIO_OPT_G_RUNTIME,
2203 .name = "ramp_time",
2204 .lname = "Ramp time",
2205 .type = FIO_OPT_STR_VAL_TIME,
2206 .off1 = td_var_offset(ramp_time),
2207 .help = "Ramp up time before measuring performance",
2210 .category = FIO_OPT_C_GENERAL,
2211 .group = FIO_OPT_G_RUNTIME,
2214 .name = "clocksource",
2215 .lname = "Clock source",
2216 .type = FIO_OPT_STR,
2217 .cb = fio_clock_source_cb,
2218 .off1 = td_var_offset(clocksource),
2219 .help = "What type of timing source to use",
2220 .category = FIO_OPT_C_GENERAL,
2221 .group = FIO_OPT_G_CLOCK,
2223 #ifdef CONFIG_GETTIMEOFDAY
2224 { .ival = "gettimeofday",
2226 .help = "Use gettimeofday(2) for timing",
2229 #ifdef CONFIG_CLOCK_GETTIME
2230 { .ival = "clock_gettime",
2231 .oval = CS_CGETTIME,
2232 .help = "Use clock_gettime(2) for timing",
2235 #ifdef ARCH_HAVE_CPU_CLOCK
2237 .oval = CS_CPUCLOCK,
2238 .help = "Use CPU private clock",
2246 .lname = "I/O Memory",
2247 .type = FIO_OPT_STR,
2249 .off1 = td_var_offset(mem_type),
2250 .help = "Backing type for IO buffers",
2252 .category = FIO_OPT_C_IO,
2253 .group = FIO_OPT_G_INVALID,
2257 .help = "Use malloc(3) for IO buffers",
2259 #ifndef CONFIG_NO_SHM
2262 .help = "Use shared memory segments for IO buffers",
2264 #ifdef FIO_HAVE_HUGETLB
2265 { .ival = "shmhuge",
2266 .oval = MEM_SHMHUGE,
2267 .help = "Like shm, but use huge pages",
2273 .help = "Use mmap(2) (file or anon) for IO buffers",
2275 #ifdef FIO_HAVE_HUGETLB
2276 { .ival = "mmaphuge",
2277 .oval = MEM_MMAPHUGE,
2278 .help = "Like mmap, but use huge pages",
2284 .name = "iomem_align",
2285 .alias = "mem_align",
2286 .lname = "I/O memory alignment",
2287 .type = FIO_OPT_INT,
2288 .off1 = td_var_offset(mem_align),
2290 .help = "IO memory buffer offset alignment",
2294 .category = FIO_OPT_C_IO,
2295 .group = FIO_OPT_G_INVALID,
2300 .type = FIO_OPT_STR,
2301 .off1 = td_var_offset(verify),
2302 .help = "Verify data written",
2304 .category = FIO_OPT_C_IO,
2305 .group = FIO_OPT_G_VERIFY,
2308 .oval = VERIFY_NONE,
2309 .help = "Don't do IO verification",
2313 .help = "Use md5 checksums for verification",
2316 .oval = VERIFY_CRC64,
2317 .help = "Use crc64 checksums for verification",
2320 .oval = VERIFY_CRC32,
2321 .help = "Use crc32 checksums for verification",
2323 { .ival = "crc32c-intel",
2324 .oval = VERIFY_CRC32C,
2325 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2328 .oval = VERIFY_CRC32C,
2329 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2332 .oval = VERIFY_CRC16,
2333 .help = "Use crc16 checksums for verification",
2336 .oval = VERIFY_CRC7,
2337 .help = "Use crc7 checksums for verification",
2340 .oval = VERIFY_SHA1,
2341 .help = "Use sha1 checksums for verification",
2344 .oval = VERIFY_SHA256,
2345 .help = "Use sha256 checksums for verification",
2348 .oval = VERIFY_SHA512,
2349 .help = "Use sha512 checksums for verification",
2352 .oval = VERIFY_XXHASH,
2353 .help = "Use xxhash checksums for verification",
2356 .oval = VERIFY_META,
2357 .help = "Use io information",
2361 .oval = VERIFY_NULL,
2362 .help = "Pretend to verify",
2367 .name = "do_verify",
2368 .lname = "Perform verify step",
2369 .type = FIO_OPT_BOOL,
2370 .off1 = td_var_offset(do_verify),
2371 .help = "Run verification stage after write",
2375 .category = FIO_OPT_C_IO,
2376 .group = FIO_OPT_G_VERIFY,
2379 .name = "verifysort",
2380 .lname = "Verify sort",
2381 .type = FIO_OPT_BOOL,
2382 .off1 = td_var_offset(verifysort),
2383 .help = "Sort written verify blocks for read back",
2387 .category = FIO_OPT_C_IO,
2388 .group = FIO_OPT_G_VERIFY,
2391 .name = "verifysort_nr",
2392 .type = FIO_OPT_INT,
2393 .off1 = td_var_offset(verifysort_nr),
2394 .help = "Pre-load and sort verify blocks for a read workload",
2399 .category = FIO_OPT_C_IO,
2400 .group = FIO_OPT_G_VERIFY,
2403 .name = "verify_interval",
2404 .lname = "Verify interval",
2405 .type = FIO_OPT_INT,
2406 .off1 = td_var_offset(verify_interval),
2407 .minval = 2 * sizeof(struct verify_header),
2408 .help = "Store verify buffer header every N bytes",
2411 .interval = 2 * sizeof(struct verify_header),
2412 .category = FIO_OPT_C_IO,
2413 .group = FIO_OPT_G_VERIFY,
2416 .name = "verify_offset",
2417 .lname = "Verify offset",
2418 .type = FIO_OPT_INT,
2419 .help = "Offset verify header location by N bytes",
2420 .off1 = td_var_offset(verify_offset),
2421 .minval = sizeof(struct verify_header),
2424 .category = FIO_OPT_C_IO,
2425 .group = FIO_OPT_G_VERIFY,
2428 .name = "verify_pattern",
2429 .lname = "Verify pattern",
2430 .type = FIO_OPT_STR,
2431 .cb = str_verify_pattern_cb,
2432 .off1 = td_var_offset(verify_pattern),
2433 .help = "Fill pattern for IO buffers",
2436 .category = FIO_OPT_C_IO,
2437 .group = FIO_OPT_G_VERIFY,
2440 .name = "verify_fatal",
2441 .lname = "Verify fatal",
2442 .type = FIO_OPT_BOOL,
2443 .off1 = td_var_offset(verify_fatal),
2445 .help = "Exit on a single verify failure, don't continue",
2448 .category = FIO_OPT_C_IO,
2449 .group = FIO_OPT_G_VERIFY,
2452 .name = "verify_dump",
2453 .lname = "Verify dump",
2454 .type = FIO_OPT_BOOL,
2455 .off1 = td_var_offset(verify_dump),
2457 .help = "Dump contents of good and bad blocks on failure",
2460 .category = FIO_OPT_C_IO,
2461 .group = FIO_OPT_G_VERIFY,
2464 .name = "verify_async",
2465 .lname = "Verify asynchronously",
2466 .type = FIO_OPT_INT,
2467 .off1 = td_var_offset(verify_async),
2469 .help = "Number of async verifier threads to use",
2472 .category = FIO_OPT_C_IO,
2473 .group = FIO_OPT_G_VERIFY,
2476 .name = "verify_backlog",
2477 .lname = "Verify backlog",
2478 .type = FIO_OPT_STR_VAL,
2479 .off1 = td_var_offset(verify_backlog),
2480 .help = "Verify after this number of blocks are written",
2483 .category = FIO_OPT_C_IO,
2484 .group = FIO_OPT_G_VERIFY,
2487 .name = "verify_backlog_batch",
2488 .lname = "Verify backlog batch",
2489 .type = FIO_OPT_INT,
2490 .off1 = td_var_offset(verify_batch),
2491 .help = "Verify this number of IO blocks",
2494 .category = FIO_OPT_C_IO,
2495 .group = FIO_OPT_G_VERIFY,
2497 #ifdef FIO_HAVE_CPU_AFFINITY
2499 .name = "verify_async_cpus",
2500 .lname = "Async verify CPUs",
2501 .type = FIO_OPT_STR,
2502 .cb = str_verify_cpus_allowed_cb,
2503 .off1 = td_var_offset(verify_cpumask),
2504 .help = "Set CPUs allowed for async verify threads",
2505 .parent = "verify_async",
2507 .category = FIO_OPT_C_IO,
2508 .group = FIO_OPT_G_VERIFY,
2512 .name = "experimental_verify",
2513 .off1 = td_var_offset(experimental_verify),
2514 .type = FIO_OPT_BOOL,
2515 .help = "Enable experimental verification",
2517 .category = FIO_OPT_C_IO,
2518 .group = FIO_OPT_G_VERIFY,
2521 .name = "verify_state_load",
2522 .lname = "Load verify state",
2523 .off1 = td_var_offset(verify_state),
2524 .type = FIO_OPT_BOOL,
2525 .help = "Load verify termination state",
2527 .category = FIO_OPT_C_IO,
2528 .group = FIO_OPT_G_VERIFY,
2531 .name = "verify_state_save",
2532 .lname = "Save verify state",
2533 .off1 = td_var_offset(verify_state_save),
2534 .type = FIO_OPT_BOOL,
2536 .help = "Save verify state on termination",
2538 .category = FIO_OPT_C_IO,
2539 .group = FIO_OPT_G_VERIFY,
2541 #ifdef FIO_HAVE_TRIM
2543 .name = "trim_percentage",
2544 .lname = "Trim percentage",
2545 .type = FIO_OPT_INT,
2546 .off1 = td_var_offset(trim_percentage),
2549 .help = "Number of verify blocks to discard/trim",
2554 .category = FIO_OPT_C_IO,
2555 .group = FIO_OPT_G_TRIM,
2558 .name = "trim_verify_zero",
2559 .lname = "Verify trim zero",
2560 .type = FIO_OPT_BOOL,
2561 .help = "Verify that trim/discarded blocks are returned as zeroes",
2562 .off1 = td_var_offset(trim_zero),
2563 .parent = "trim_percentage",
2566 .category = FIO_OPT_C_IO,
2567 .group = FIO_OPT_G_TRIM,
2570 .name = "trim_backlog",
2571 .lname = "Trim backlog",
2572 .type = FIO_OPT_STR_VAL,
2573 .off1 = td_var_offset(trim_backlog),
2574 .help = "Trim after this number of blocks are written",
2575 .parent = "trim_percentage",
2578 .category = FIO_OPT_C_IO,
2579 .group = FIO_OPT_G_TRIM,
2582 .name = "trim_backlog_batch",
2583 .lname = "Trim backlog batch",
2584 .type = FIO_OPT_INT,
2585 .off1 = td_var_offset(trim_batch),
2586 .help = "Trim this number of IO blocks",
2587 .parent = "trim_percentage",
2590 .category = FIO_OPT_C_IO,
2591 .group = FIO_OPT_G_TRIM,
2595 .name = "write_iolog",
2596 .lname = "Write I/O log",
2597 .type = FIO_OPT_STR_STORE,
2598 .off1 = td_var_offset(write_iolog_file),
2599 .help = "Store IO pattern to file",
2600 .category = FIO_OPT_C_IO,
2601 .group = FIO_OPT_G_IOLOG,
2604 .name = "read_iolog",
2605 .lname = "Read I/O log",
2606 .type = FIO_OPT_STR_STORE,
2607 .off1 = td_var_offset(read_iolog_file),
2608 .help = "Playback IO pattern from file",
2609 .category = FIO_OPT_C_IO,
2610 .group = FIO_OPT_G_IOLOG,
2613 .name = "replay_no_stall",
2614 .lname = "Don't stall on replay",
2615 .type = FIO_OPT_BOOL,
2616 .off1 = td_var_offset(no_stall),
2618 .parent = "read_iolog",
2620 .help = "Playback IO pattern file as fast as possible without stalls",
2621 .category = FIO_OPT_C_IO,
2622 .group = FIO_OPT_G_IOLOG,
2625 .name = "replay_redirect",
2626 .lname = "Redirect device for replay",
2627 .type = FIO_OPT_STR_STORE,
2628 .off1 = td_var_offset(replay_redirect),
2629 .parent = "read_iolog",
2631 .help = "Replay all I/O onto this device, regardless of trace device",
2632 .category = FIO_OPT_C_IO,
2633 .group = FIO_OPT_G_IOLOG,
2636 .name = "exec_prerun",
2637 .lname = "Pre-execute runnable",
2638 .type = FIO_OPT_STR_STORE,
2639 .off1 = td_var_offset(exec_prerun),
2640 .help = "Execute this file prior to running job",
2641 .category = FIO_OPT_C_GENERAL,
2642 .group = FIO_OPT_G_INVALID,
2645 .name = "exec_postrun",
2646 .lname = "Post-execute runnable",
2647 .type = FIO_OPT_STR_STORE,
2648 .off1 = td_var_offset(exec_postrun),
2649 .help = "Execute this file after running job",
2650 .category = FIO_OPT_C_GENERAL,
2651 .group = FIO_OPT_G_INVALID,
2653 #ifdef FIO_HAVE_IOSCHED_SWITCH
2655 .name = "ioscheduler",
2656 .lname = "I/O scheduler",
2657 .type = FIO_OPT_STR_STORE,
2658 .off1 = td_var_offset(ioscheduler),
2659 .help = "Use this IO scheduler on the backing device",
2660 .category = FIO_OPT_C_FILE,
2661 .group = FIO_OPT_G_INVALID,
2666 .lname = "Zone size",
2667 .type = FIO_OPT_STR_VAL,
2668 .off1 = td_var_offset(zone_size),
2669 .help = "Amount of data to read per zone",
2671 .interval = 1024 * 1024,
2672 .category = FIO_OPT_C_IO,
2673 .group = FIO_OPT_G_ZONE,
2676 .name = "zonerange",
2677 .lname = "Zone range",
2678 .type = FIO_OPT_STR_VAL,
2679 .off1 = td_var_offset(zone_range),
2680 .help = "Give size of an IO zone",
2682 .interval = 1024 * 1024,
2683 .category = FIO_OPT_C_IO,
2684 .group = FIO_OPT_G_ZONE,
2688 .lname = "Zone skip",
2689 .type = FIO_OPT_STR_VAL,
2690 .off1 = td_var_offset(zone_skip),
2691 .help = "Space between IO zones",
2693 .interval = 1024 * 1024,
2694 .category = FIO_OPT_C_IO,
2695 .group = FIO_OPT_G_ZONE,
2699 .lname = "Lock memory",
2700 .type = FIO_OPT_STR_VAL,
2701 .off1 = td_var_offset(lockmem),
2702 .help = "Lock down this amount of memory (per worker)",
2704 .interval = 1024 * 1024,
2705 .category = FIO_OPT_C_GENERAL,
2706 .group = FIO_OPT_G_INVALID,
2709 .name = "rwmixread",
2710 .lname = "Read/write mix read",
2711 .type = FIO_OPT_INT,
2712 .cb = str_rwmix_read_cb,
2713 .off1 = td_var_offset(rwmix[DDIR_READ]),
2715 .help = "Percentage of mixed workload that is reads",
2718 .inverse = "rwmixwrite",
2719 .category = FIO_OPT_C_IO,
2720 .group = FIO_OPT_G_RWMIX,
2723 .name = "rwmixwrite",
2724 .lname = "Read/write mix write",
2725 .type = FIO_OPT_INT,
2726 .cb = str_rwmix_write_cb,
2727 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
2729 .help = "Percentage of mixed workload that is writes",
2732 .inverse = "rwmixread",
2733 .category = FIO_OPT_C_IO,
2734 .group = FIO_OPT_G_RWMIX,
2737 .name = "rwmixcycle",
2738 .lname = "Read/write mix cycle",
2739 .type = FIO_OPT_DEPRECATED,
2740 .category = FIO_OPT_C_IO,
2741 .group = FIO_OPT_G_RWMIX,
2746 .type = FIO_OPT_INT,
2747 .off1 = td_var_offset(nice),
2748 .help = "Set job CPU nice value",
2753 .category = FIO_OPT_C_GENERAL,
2754 .group = FIO_OPT_G_CRED,
2756 #ifdef FIO_HAVE_IOPRIO
2759 .lname = "I/O nice priority",
2760 .type = FIO_OPT_INT,
2761 .off1 = td_var_offset(ioprio),
2762 .help = "Set job IO priority value",
2766 .category = FIO_OPT_C_GENERAL,
2767 .group = FIO_OPT_G_CRED,
2770 .name = "prioclass",
2771 .lname = "I/O nice priority class",
2772 .type = FIO_OPT_INT,
2773 .off1 = td_var_offset(ioprio_class),
2774 .help = "Set job IO priority class",
2778 .category = FIO_OPT_C_GENERAL,
2779 .group = FIO_OPT_G_CRED,
2783 .name = "thinktime",
2784 .lname = "Thinktime",
2785 .type = FIO_OPT_INT,
2786 .off1 = td_var_offset(thinktime),
2787 .help = "Idle time between IO buffers (usec)",
2790 .category = FIO_OPT_C_IO,
2791 .group = FIO_OPT_G_THINKTIME,
2794 .name = "thinktime_spin",
2795 .lname = "Thinktime spin",
2796 .type = FIO_OPT_INT,
2797 .off1 = td_var_offset(thinktime_spin),
2798 .help = "Start think time by spinning this amount (usec)",
2801 .parent = "thinktime",
2803 .category = FIO_OPT_C_IO,
2804 .group = FIO_OPT_G_THINKTIME,
2807 .name = "thinktime_blocks",
2808 .lname = "Thinktime blocks",
2809 .type = FIO_OPT_INT,
2810 .off1 = td_var_offset(thinktime_blocks),
2811 .help = "IO buffer period between 'thinktime'",
2813 .parent = "thinktime",
2815 .category = FIO_OPT_C_IO,
2816 .group = FIO_OPT_G_THINKTIME,
2820 .lname = "I/O rate",
2821 .type = FIO_OPT_INT,
2822 .off1 = td_var_offset(rate[DDIR_READ]),
2823 .off2 = td_var_offset(rate[DDIR_WRITE]),
2824 .off3 = td_var_offset(rate[DDIR_TRIM]),
2825 .help = "Set bandwidth rate",
2826 .category = FIO_OPT_C_IO,
2827 .group = FIO_OPT_G_RATE,
2831 .lname = "I/O min rate",
2832 .type = FIO_OPT_INT,
2833 .off1 = td_var_offset(ratemin[DDIR_READ]),
2834 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2835 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2836 .help = "Job must meet this rate or it will be shutdown",
2839 .category = FIO_OPT_C_IO,
2840 .group = FIO_OPT_G_RATE,
2843 .name = "rate_iops",
2844 .lname = "I/O rate IOPS",
2845 .type = FIO_OPT_INT,
2846 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2847 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2848 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2849 .help = "Limit IO used to this number of IO operations/sec",
2851 .category = FIO_OPT_C_IO,
2852 .group = FIO_OPT_G_RATE,
2855 .name = "rate_iops_min",
2856 .lname = "I/O min rate IOPS",
2857 .type = FIO_OPT_INT,
2858 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2859 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2860 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2861 .help = "Job must meet this rate or it will be shut down",
2862 .parent = "rate_iops",
2864 .category = FIO_OPT_C_IO,
2865 .group = FIO_OPT_G_RATE,
2868 .name = "ratecycle",
2869 .lname = "I/O rate cycle",
2870 .type = FIO_OPT_INT,
2871 .off1 = td_var_offset(ratecycle),
2872 .help = "Window average for rate limits (msec)",
2876 .category = FIO_OPT_C_IO,
2877 .group = FIO_OPT_G_RATE,
2880 .name = "max_latency",
2881 .type = FIO_OPT_INT,
2882 .off1 = td_var_offset(max_latency),
2883 .help = "Maximum tolerated IO latency (usec)",
2885 .category = FIO_OPT_C_IO,
2886 .group = FIO_OPT_G_LATPROF,
2889 .name = "latency_target",
2890 .lname = "Latency Target (usec)",
2891 .type = FIO_OPT_STR_VAL_TIME,
2892 .off1 = td_var_offset(latency_target),
2893 .help = "Ramp to max queue depth supporting this latency",
2895 .category = FIO_OPT_C_IO,
2896 .group = FIO_OPT_G_LATPROF,
2899 .name = "latency_window",
2900 .lname = "Latency Window (usec)",
2901 .type = FIO_OPT_STR_VAL_TIME,
2902 .off1 = td_var_offset(latency_window),
2903 .help = "Time to sustain latency_target",
2905 .category = FIO_OPT_C_IO,
2906 .group = FIO_OPT_G_LATPROF,
2909 .name = "latency_percentile",
2910 .lname = "Latency Percentile",
2911 .type = FIO_OPT_FLOAT_LIST,
2912 .off1 = td_var_offset(latency_percentile),
2913 .help = "Percentile of IOs must be below latency_target",
2918 .category = FIO_OPT_C_IO,
2919 .group = FIO_OPT_G_LATPROF,
2922 .name = "invalidate",
2923 .lname = "Cache invalidate",
2924 .type = FIO_OPT_BOOL,
2925 .off1 = td_var_offset(invalidate_cache),
2926 .help = "Invalidate buffer/page cache prior to running job",
2928 .category = FIO_OPT_C_IO,
2929 .group = FIO_OPT_G_IO_TYPE,
2933 .lname = "Synchronous I/O",
2934 .type = FIO_OPT_BOOL,
2935 .off1 = td_var_offset(sync_io),
2936 .help = "Use O_SYNC for buffered writes",
2938 .parent = "buffered",
2940 .category = FIO_OPT_C_IO,
2941 .group = FIO_OPT_G_IO_TYPE,
2944 .name = "create_serialize",
2945 .lname = "Create serialize",
2946 .type = FIO_OPT_BOOL,
2947 .off1 = td_var_offset(create_serialize),
2948 .help = "Serialize creating of job files",
2950 .category = FIO_OPT_C_FILE,
2951 .group = FIO_OPT_G_INVALID,
2954 .name = "create_fsync",
2955 .lname = "Create fsync",
2956 .type = FIO_OPT_BOOL,
2957 .off1 = td_var_offset(create_fsync),
2958 .help = "fsync file after creation",
2960 .category = FIO_OPT_C_FILE,
2961 .group = FIO_OPT_G_INVALID,
2964 .name = "create_on_open",
2965 .lname = "Create on open",
2966 .type = FIO_OPT_BOOL,
2967 .off1 = td_var_offset(create_on_open),
2968 .help = "Create files when they are opened for IO",
2970 .category = FIO_OPT_C_FILE,
2971 .group = FIO_OPT_G_INVALID,
2974 .name = "create_only",
2975 .type = FIO_OPT_BOOL,
2976 .off1 = td_var_offset(create_only),
2977 .help = "Only perform file creation phase",
2978 .category = FIO_OPT_C_FILE,
2983 .lname = "Pre-read files",
2984 .type = FIO_OPT_BOOL,
2985 .off1 = td_var_offset(pre_read),
2986 .help = "Pre-read files before starting official testing",
2988 .category = FIO_OPT_C_FILE,
2989 .group = FIO_OPT_G_INVALID,
2991 #ifdef FIO_HAVE_CPU_AFFINITY
2994 .lname = "CPU mask",
2995 .type = FIO_OPT_INT,
2996 .cb = str_cpumask_cb,
2997 .off1 = td_var_offset(cpumask),
2998 .help = "CPU affinity mask",
2999 .category = FIO_OPT_C_GENERAL,
3000 .group = FIO_OPT_G_CRED,
3003 .name = "cpus_allowed",
3004 .lname = "CPUs allowed",
3005 .type = FIO_OPT_STR,
3006 .cb = str_cpus_allowed_cb,
3007 .off1 = td_var_offset(cpumask),
3008 .help = "Set CPUs allowed",
3009 .category = FIO_OPT_C_GENERAL,
3010 .group = FIO_OPT_G_CRED,
3013 .name = "cpus_allowed_policy",
3014 .lname = "CPUs allowed distribution policy",
3015 .type = FIO_OPT_STR,
3016 .off1 = td_var_offset(cpus_allowed_policy),
3017 .help = "Distribution policy for cpus_allowed",
3018 .parent = "cpus_allowed",
3022 .oval = FIO_CPUS_SHARED,
3023 .help = "Mask shared between threads",
3026 .oval = FIO_CPUS_SPLIT,
3027 .help = "Mask split between threads",
3030 .category = FIO_OPT_C_GENERAL,
3031 .group = FIO_OPT_G_CRED,
3034 #ifdef CONFIG_LIBNUMA
3036 .name = "numa_cpu_nodes",
3037 .type = FIO_OPT_STR,
3038 .cb = str_numa_cpunodes_cb,
3039 .off1 = td_var_offset(numa_cpunodes),
3040 .help = "NUMA CPU nodes bind",
3041 .category = FIO_OPT_C_GENERAL,
3042 .group = FIO_OPT_G_INVALID,
3045 .name = "numa_mem_policy",
3046 .type = FIO_OPT_STR,
3047 .cb = str_numa_mpol_cb,
3048 .off1 = td_var_offset(numa_memnodes),
3049 .help = "NUMA memory policy setup",
3050 .category = FIO_OPT_C_GENERAL,
3051 .group = FIO_OPT_G_INVALID,
3055 .name = "end_fsync",
3056 .lname = "End fsync",
3057 .type = FIO_OPT_BOOL,
3058 .off1 = td_var_offset(end_fsync),
3059 .help = "Include fsync at the end of job",
3061 .category = FIO_OPT_C_FILE,
3062 .group = FIO_OPT_G_INVALID,
3065 .name = "fsync_on_close",
3066 .lname = "Fsync on close",
3067 .type = FIO_OPT_BOOL,
3068 .off1 = td_var_offset(fsync_on_close),
3069 .help = "fsync files on close",
3071 .category = FIO_OPT_C_FILE,
3072 .group = FIO_OPT_G_INVALID,
3076 .lname = "Unlink file",
3077 .type = FIO_OPT_BOOL,
3078 .off1 = td_var_offset(unlink),
3079 .help = "Unlink created files after job has completed",
3081 .category = FIO_OPT_C_FILE,
3082 .group = FIO_OPT_G_INVALID,
3086 .lname = "Exit-all on terminate",
3087 .type = FIO_OPT_STR_SET,
3088 .cb = str_exitall_cb,
3089 .help = "Terminate all jobs when one exits",
3090 .category = FIO_OPT_C_GENERAL,
3091 .group = FIO_OPT_G_PROCESS,
3094 .name = "stonewall",
3095 .lname = "Wait for previous",
3096 .alias = "wait_for_previous",
3097 .type = FIO_OPT_STR_SET,
3098 .off1 = td_var_offset(stonewall),
3099 .help = "Insert a hard barrier between this job and previous",
3100 .category = FIO_OPT_C_GENERAL,
3101 .group = FIO_OPT_G_PROCESS,
3104 .name = "new_group",
3105 .lname = "New group",
3106 .type = FIO_OPT_STR_SET,
3107 .off1 = td_var_offset(new_group),
3108 .help = "Mark the start of a new group (for reporting)",
3109 .category = FIO_OPT_C_GENERAL,
3110 .group = FIO_OPT_G_PROCESS,
3115 .type = FIO_OPT_STR_SET,
3116 .off1 = td_var_offset(use_thread),
3117 .help = "Use threads instead of processes",
3118 #ifdef CONFIG_NO_SHM
3122 .category = FIO_OPT_C_GENERAL,
3123 .group = FIO_OPT_G_PROCESS,
3126 .name = "write_bw_log",
3127 .lname = "Write bandwidth log",
3128 .type = FIO_OPT_STR_STORE,
3129 .off1 = td_var_offset(bw_log_file),
3130 .help = "Write log of bandwidth during run",
3131 .category = FIO_OPT_C_LOG,
3132 .group = FIO_OPT_G_INVALID,
3135 .name = "write_lat_log",
3136 .lname = "Write latency log",
3137 .type = FIO_OPT_STR_STORE,
3138 .off1 = td_var_offset(lat_log_file),
3139 .help = "Write log of latency during run",
3140 .category = FIO_OPT_C_LOG,
3141 .group = FIO_OPT_G_INVALID,
3144 .name = "write_iops_log",
3145 .lname = "Write IOPS log",
3146 .type = FIO_OPT_STR_STORE,
3147 .off1 = td_var_offset(iops_log_file),
3148 .help = "Write log of IOPS during run",
3149 .category = FIO_OPT_C_LOG,
3150 .group = FIO_OPT_G_INVALID,
3153 .name = "log_avg_msec",
3154 .lname = "Log averaging (msec)",
3155 .type = FIO_OPT_INT,
3156 .off1 = td_var_offset(log_avg_msec),
3157 .help = "Average bw/iops/lat logs over this period of time",
3159 .category = FIO_OPT_C_LOG,
3160 .group = FIO_OPT_G_INVALID,
3163 .name = "log_offset",
3164 .lname = "Log offset of IO",
3165 .type = FIO_OPT_BOOL,
3166 .off1 = td_var_offset(log_offset),
3167 .help = "Include offset of IO for each log entry",
3169 .category = FIO_OPT_C_LOG,
3170 .group = FIO_OPT_G_INVALID,
3174 .name = "log_compression",
3175 .lname = "Log compression",
3176 .type = FIO_OPT_INT,
3177 .off1 = td_var_offset(log_gz),
3178 .help = "Log in compressed chunks of this size",
3179 .minval = 32 * 1024 * 1024ULL,
3180 .maxval = 512 * 1024 * 1024ULL,
3181 .category = FIO_OPT_C_LOG,
3182 .group = FIO_OPT_G_INVALID,
3185 .name = "log_store_compressed",
3186 .lname = "Log store compressed",
3187 .type = FIO_OPT_BOOL,
3188 .off1 = td_var_offset(log_gz_store),
3189 .help = "Store logs in a compressed format",
3190 .category = FIO_OPT_C_LOG,
3191 .group = FIO_OPT_G_INVALID,
3195 .name = "bwavgtime",
3196 .lname = "Bandwidth average time",
3197 .type = FIO_OPT_INT,
3198 .off1 = td_var_offset(bw_avg_time),
3199 .help = "Time window over which to calculate bandwidth"
3202 .parent = "write_bw_log",
3205 .category = FIO_OPT_C_LOG,
3206 .group = FIO_OPT_G_INVALID,
3209 .name = "iopsavgtime",
3210 .lname = "IOPS average time",
3211 .type = FIO_OPT_INT,
3212 .off1 = td_var_offset(iops_avg_time),
3213 .help = "Time window over which to calculate IOPS (msec)",
3215 .parent = "write_iops_log",
3218 .category = FIO_OPT_C_LOG,
3219 .group = FIO_OPT_G_INVALID,
3222 .name = "group_reporting",
3223 .lname = "Group reporting",
3224 .type = FIO_OPT_STR_SET,
3225 .off1 = td_var_offset(group_reporting),
3226 .help = "Do reporting on a per-group basis",
3227 .category = FIO_OPT_C_STAT,
3228 .group = FIO_OPT_G_INVALID,
3231 .name = "zero_buffers",
3232 .lname = "Zero I/O buffers",
3233 .type = FIO_OPT_STR_SET,
3234 .off1 = td_var_offset(zero_buffers),
3235 .help = "Init IO buffers to all zeroes",
3236 .category = FIO_OPT_C_IO,
3237 .group = FIO_OPT_G_IO_BUF,
3240 .name = "refill_buffers",
3241 .lname = "Refill I/O buffers",
3242 .type = FIO_OPT_STR_SET,
3243 .off1 = td_var_offset(refill_buffers),
3244 .help = "Refill IO buffers on every IO submit",
3245 .category = FIO_OPT_C_IO,
3246 .group = FIO_OPT_G_IO_BUF,
3249 .name = "scramble_buffers",
3250 .lname = "Scramble I/O buffers",
3251 .type = FIO_OPT_BOOL,
3252 .off1 = td_var_offset(scramble_buffers),
3253 .help = "Slightly scramble buffers on every IO submit",
3255 .category = FIO_OPT_C_IO,
3256 .group = FIO_OPT_G_IO_BUF,
3259 .name = "buffer_pattern",
3260 .lname = "Buffer pattern",
3261 .type = FIO_OPT_STR,
3262 .cb = str_buffer_pattern_cb,
3263 .off1 = td_var_offset(buffer_pattern),
3264 .help = "Fill pattern for IO buffers",
3265 .category = FIO_OPT_C_IO,
3266 .group = FIO_OPT_G_IO_BUF,
3269 .name = "buffer_compress_percentage",
3270 .lname = "Buffer compression percentage",
3271 .type = FIO_OPT_INT,
3272 .cb = str_buffer_compress_cb,
3273 .off1 = td_var_offset(compress_percentage),
3276 .help = "How compressible the buffer is (approximately)",
3278 .category = FIO_OPT_C_IO,
3279 .group = FIO_OPT_G_IO_BUF,
3282 .name = "buffer_compress_chunk",
3283 .lname = "Buffer compression chunk size",
3284 .type = FIO_OPT_INT,
3285 .off1 = td_var_offset(compress_chunk),
3286 .parent = "buffer_compress_percentage",
3288 .help = "Size of compressible region in buffer",
3290 .category = FIO_OPT_C_IO,
3291 .group = FIO_OPT_G_IO_BUF,
3294 .name = "dedupe_percentage",
3295 .lname = "Dedupe percentage",
3296 .type = FIO_OPT_INT,
3297 .cb = str_dedupe_cb,
3298 .off1 = td_var_offset(dedupe_percentage),
3301 .help = "Percentage of buffers that are dedupable",
3303 .category = FIO_OPT_C_IO,
3304 .group = FIO_OPT_G_IO_BUF,
3307 .name = "clat_percentiles",
3308 .lname = "Completion latency percentiles",
3309 .type = FIO_OPT_BOOL,
3310 .off1 = td_var_offset(clat_percentiles),
3311 .help = "Enable the reporting of completion latency percentiles",
3313 .category = FIO_OPT_C_STAT,
3314 .group = FIO_OPT_G_INVALID,
3317 .name = "percentile_list",
3318 .lname = "Completion latency percentile list",
3319 .type = FIO_OPT_FLOAT_LIST,
3320 .off1 = td_var_offset(percentile_list),
3321 .off2 = td_var_offset(percentile_precision),
3322 .help = "Specify a custom list of percentiles to report",
3323 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3324 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3327 .category = FIO_OPT_C_STAT,
3328 .group = FIO_OPT_G_INVALID,
3331 #ifdef FIO_HAVE_DISK_UTIL
3333 .name = "disk_util",
3334 .lname = "Disk utilization",
3335 .type = FIO_OPT_BOOL,
3336 .off1 = td_var_offset(do_disk_util),
3337 .help = "Log disk utilization statistics",
3339 .category = FIO_OPT_C_STAT,
3340 .group = FIO_OPT_G_INVALID,
3344 .name = "gtod_reduce",
3345 .lname = "Reduce gettimeofday() calls",
3346 .type = FIO_OPT_BOOL,
3347 .help = "Greatly reduce number of gettimeofday() calls",
3348 .cb = str_gtod_reduce_cb,
3351 .category = FIO_OPT_C_STAT,
3352 .group = FIO_OPT_G_INVALID,
3355 .name = "disable_lat",
3356 .lname = "Disable all latency stats",
3357 .type = FIO_OPT_BOOL,
3358 .off1 = td_var_offset(disable_lat),
3359 .help = "Disable latency numbers",
3360 .parent = "gtod_reduce",
3363 .category = FIO_OPT_C_STAT,
3364 .group = FIO_OPT_G_INVALID,
3367 .name = "disable_clat",
3368 .lname = "Disable completion latency stats",
3369 .type = FIO_OPT_BOOL,
3370 .off1 = td_var_offset(disable_clat),
3371 .help = "Disable completion latency numbers",
3372 .parent = "gtod_reduce",
3375 .category = FIO_OPT_C_STAT,
3376 .group = FIO_OPT_G_INVALID,
3379 .name = "disable_slat",
3380 .lname = "Disable submission latency stats",
3381 .type = FIO_OPT_BOOL,
3382 .off1 = td_var_offset(disable_slat),
3383 .help = "Disable submission latency numbers",
3384 .parent = "gtod_reduce",
3387 .category = FIO_OPT_C_STAT,
3388 .group = FIO_OPT_G_INVALID,
3391 .name = "disable_bw_measurement",
3392 .lname = "Disable bandwidth stats",
3393 .type = FIO_OPT_BOOL,
3394 .off1 = td_var_offset(disable_bw),
3395 .help = "Disable bandwidth logging",
3396 .parent = "gtod_reduce",
3399 .category = FIO_OPT_C_STAT,
3400 .group = FIO_OPT_G_INVALID,
3404 .lname = "Dedicated gettimeofday() CPU",
3405 .type = FIO_OPT_INT,
3406 .cb = str_gtod_cpu_cb,
3407 .help = "Set up dedicated gettimeofday() thread on this CPU",
3408 .verify = gtod_cpu_verify,
3409 .category = FIO_OPT_C_GENERAL,
3410 .group = FIO_OPT_G_CLOCK,
3413 .name = "unified_rw_reporting",
3414 .type = FIO_OPT_BOOL,
3415 .off1 = td_var_offset(unified_rw_rep),
3416 .help = "Unify reporting across data direction",
3418 .category = FIO_OPT_C_GENERAL,
3419 .group = FIO_OPT_G_INVALID,
3422 .name = "continue_on_error",
3423 .lname = "Continue on error",
3424 .type = FIO_OPT_STR,
3425 .off1 = td_var_offset(continue_on_error),
3426 .help = "Continue on non-fatal errors during IO",
3428 .category = FIO_OPT_C_GENERAL,
3429 .group = FIO_OPT_G_ERR,
3432 .oval = ERROR_TYPE_NONE,
3433 .help = "Exit when an error is encountered",
3436 .oval = ERROR_TYPE_READ,
3437 .help = "Continue on read errors only",
3440 .oval = ERROR_TYPE_WRITE,
3441 .help = "Continue on write errors only",
3444 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3445 .help = "Continue on any IO errors",
3448 .oval = ERROR_TYPE_VERIFY,
3449 .help = "Continue on verify errors only",
3452 .oval = ERROR_TYPE_ANY,
3453 .help = "Continue on all io and verify errors",
3456 .oval = ERROR_TYPE_NONE,
3457 .help = "Alias for 'none'",
3460 .oval = ERROR_TYPE_ANY,
3461 .help = "Alias for 'all'",
3466 .name = "ignore_error",
3467 .type = FIO_OPT_STR,
3468 .cb = str_ignore_error_cb,
3469 .off1 = td_var_offset(ignore_error_nr),
3470 .help = "Set a specific list of errors to ignore",
3472 .category = FIO_OPT_C_GENERAL,
3473 .group = FIO_OPT_G_ERR,
3476 .name = "error_dump",
3477 .type = FIO_OPT_BOOL,
3478 .off1 = td_var_offset(error_dump),
3480 .help = "Dump info on each error",
3481 .category = FIO_OPT_C_GENERAL,
3482 .group = FIO_OPT_G_ERR,
3487 .type = FIO_OPT_STR_STORE,
3488 .off1 = td_var_offset(profile),
3489 .help = "Select a specific builtin performance test",
3490 .category = FIO_OPT_C_PROFILE,
3491 .group = FIO_OPT_G_INVALID,
3496 .type = FIO_OPT_STR_STORE,
3497 .off1 = td_var_offset(cgroup),
3498 .help = "Add job to cgroup of this name",
3499 .category = FIO_OPT_C_GENERAL,
3500 .group = FIO_OPT_G_CGROUP,
3503 .name = "cgroup_nodelete",
3504 .lname = "Cgroup no-delete",
3505 .type = FIO_OPT_BOOL,
3506 .off1 = td_var_offset(cgroup_nodelete),
3507 .help = "Do not delete cgroups after job completion",
3510 .category = FIO_OPT_C_GENERAL,
3511 .group = FIO_OPT_G_CGROUP,
3514 .name = "cgroup_weight",
3515 .lname = "Cgroup weight",
3516 .type = FIO_OPT_INT,
3517 .off1 = td_var_offset(cgroup_weight),
3518 .help = "Use given weight for cgroup",
3522 .category = FIO_OPT_C_GENERAL,
3523 .group = FIO_OPT_G_CGROUP,
3528 .type = FIO_OPT_INT,
3529 .off1 = td_var_offset(uid),
3530 .help = "Run job with this user ID",
3531 .category = FIO_OPT_C_GENERAL,
3532 .group = FIO_OPT_G_CRED,
3536 .lname = "Group ID",
3537 .type = FIO_OPT_INT,
3538 .off1 = td_var_offset(gid),
3539 .help = "Run job with this group ID",
3540 .category = FIO_OPT_C_GENERAL,
3541 .group = FIO_OPT_G_CRED,
3546 .type = FIO_OPT_INT,
3547 .off1 = td_var_offset(kb_base),
3553 .help = "Use 1024 as the K base",
3557 .help = "Use 1000 as the K base",
3560 .help = "How many bytes per KB for reporting (1000 or 1024)",
3561 .category = FIO_OPT_C_GENERAL,
3562 .group = FIO_OPT_G_INVALID,
3565 .name = "unit_base",
3566 .lname = "Base unit for reporting (Bits or Bytes)",
3567 .type = FIO_OPT_INT,
3568 .off1 = td_var_offset(unit_base),
3573 .help = "Auto-detect",
3577 .help = "Normal (byte based)",
3581 .help = "Bit based",
3584 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3585 .category = FIO_OPT_C_GENERAL,
3586 .group = FIO_OPT_G_INVALID,
3589 .name = "hugepage-size",
3590 .lname = "Hugepage size",
3591 .type = FIO_OPT_INT,
3592 .off1 = td_var_offset(hugepage_size),
3593 .help = "When using hugepages, specify size of each page",
3594 .def = __fio_stringify(FIO_HUGE_PAGE),
3595 .interval = 1024 * 1024,
3596 .category = FIO_OPT_C_GENERAL,
3597 .group = FIO_OPT_G_INVALID,
3601 .lname = "I/O flow ID",
3602 .type = FIO_OPT_INT,
3603 .off1 = td_var_offset(flow_id),
3604 .help = "The flow index ID to use",
3606 .category = FIO_OPT_C_IO,
3607 .group = FIO_OPT_G_IO_FLOW,
3611 .lname = "I/O flow weight",
3612 .type = FIO_OPT_INT,
3613 .off1 = td_var_offset(flow),
3614 .help = "Weight for flow control of this job",
3615 .parent = "flow_id",
3618 .category = FIO_OPT_C_IO,
3619 .group = FIO_OPT_G_IO_FLOW,
3622 .name = "flow_watermark",
3623 .lname = "I/O flow watermark",
3624 .type = FIO_OPT_INT,
3625 .off1 = td_var_offset(flow_watermark),
3626 .help = "High watermark for flow control. This option"
3627 " should be set to the same value for all threads"
3628 " with non-zero flow.",
3629 .parent = "flow_id",
3632 .category = FIO_OPT_C_IO,
3633 .group = FIO_OPT_G_IO_FLOW,
3636 .name = "flow_sleep",
3637 .lname = "I/O flow sleep",
3638 .type = FIO_OPT_INT,
3639 .off1 = td_var_offset(flow_sleep),
3640 .help = "How many microseconds to sleep after being held"
3641 " back by the flow control mechanism",
3642 .parent = "flow_id",
3645 .category = FIO_OPT_C_IO,
3646 .group = FIO_OPT_G_IO_FLOW,
3653 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3654 const char *name, int val)
3656 lopt->name = (char *) name;
3658 if (o->type == FIO_OPT_STR_SET)
3659 lopt->has_arg = optional_argument;
3661 lopt->has_arg = required_argument;
3664 static void options_to_lopts(struct fio_option *opts,
3665 struct option *long_options,
3666 int i, int option_type)
3668 struct fio_option *o = &opts[0];
3670 add_to_lopt(&long_options[i], o, o->name, option_type);
3673 add_to_lopt(&long_options[i], o, o->alias, option_type);
3678 assert(i < FIO_NR_OPTIONS);
3682 void fio_options_set_ioengine_opts(struct option *long_options,
3683 struct thread_data *td)
3688 while (long_options[i].name) {
3689 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3690 memset(&long_options[i], 0, sizeof(*long_options));
3697 * Just clear out the prior ioengine options.
3702 options_to_lopts(td->io_ops->options, long_options, i,
3703 FIO_GETOPT_IOENGINE);
3706 void fio_options_dup_and_init(struct option *long_options)
3710 options_init(fio_options);
3713 while (long_options[i].name)
3716 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3719 struct fio_keyword {
3725 static struct fio_keyword fio_keywords[] = {
3727 .word = "$pagesize",
3728 .desc = "Page size in the system",
3731 .word = "$mb_memory",
3732 .desc = "Megabytes of memory online",
3736 .desc = "Number of CPUs online in the system",
3743 void fio_keywords_init(void)
3745 unsigned long long mb_memory;
3749 sprintf(buf, "%lu", (unsigned long) page_size);
3750 fio_keywords[0].replace = strdup(buf);
3752 mb_memory = os_phys_mem() / (1024 * 1024);
3753 sprintf(buf, "%llu", mb_memory);
3754 fio_keywords[1].replace = strdup(buf);
3757 sprintf(buf, "%lu", l);
3758 fio_keywords[2].replace = strdup(buf);
3763 static char *bc_calc(char *str)
3765 char buf[128], *tmp;
3770 * No math, just return string
3772 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3773 !strchr(str, '/')) || strchr(str, '\''))
3777 * Split option from value, we only need to calculate the value
3779 tmp = strchr(str, '=');
3786 * Prevent buffer overflows; such a case isn't reasonable anyway
3788 if (strlen(str) >= 128 || strlen(tmp) > 100)
3791 sprintf(buf, "which %s > /dev/null", BC_APP);
3793 log_err("fio: bc is needed for performing math\n");
3797 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3798 f = popen(buf, "r");
3802 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3809 buf[(tmp - str) + ret - 1] = '\0';
3810 memcpy(buf, str, tmp - str);
3816 * Return a copy of the input string with substrings of the form ${VARNAME}
3817 * substituted with the value of the environment variable VARNAME. The
3818 * substitution always occurs, even if VARNAME is empty or the corresponding
3819 * environment variable undefined.
3821 static char *option_dup_subs(const char *opt)
3823 char out[OPT_LEN_MAX+1];
3824 char in[OPT_LEN_MAX+1];
3827 char *ch1, *ch2, *env;
3828 ssize_t nchr = OPT_LEN_MAX;
3831 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3832 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3836 in[OPT_LEN_MAX] = '\0';
3837 strncpy(in, opt, OPT_LEN_MAX);
3839 while (*inptr && nchr > 0) {
3840 if (inptr[0] == '$' && inptr[1] == '{') {
3841 ch2 = strchr(inptr, '}');
3842 if (ch2 && inptr+1 < ch2) {
3849 envlen = strlen(env);
3850 if (envlen <= nchr) {
3851 memcpy(outptr, env, envlen);
3861 *outptr++ = *inptr++;
3870 * Look for reserved variable names and replace them with real values
3872 static char *fio_keyword_replace(char *opt)
3878 for (i = 0; fio_keywords[i].word != NULL; i++) {
3879 struct fio_keyword *kw = &fio_keywords[i];
3881 while ((s = strstr(opt, kw->word)) != NULL) {
3882 char *new = malloc(strlen(opt) + 1);
3888 * Copy part of the string before the keyword and
3889 * sprintf() the replacement after it.
3891 memcpy(new, opt, olen);
3892 len = sprintf(new + olen, "%s", kw->replace);
3895 * If there's more in the original string, copy that
3898 opt += strlen(kw->word) + olen;
3900 memcpy(new + olen + len, opt, opt - o_org - 1);
3903 * replace opt and free the old opt
3913 * Check for potential math and invoke bc, if possible
3921 static char **dup_and_sub_options(char **opts, int num_opts)
3924 char **opts_copy = malloc(num_opts * sizeof(*opts));
3925 for (i = 0; i < num_opts; i++) {
3926 opts_copy[i] = option_dup_subs(opts[i]);
3929 opts_copy[i] = fio_keyword_replace(opts_copy[i]);