11 #include <netinet/in.h>
17 #include "lib/pattern.h"
21 char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
24 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
26 static char *get_opt_postfix(const char *str)
28 char *p = strstr(str, ":");
34 strip_blank_front(&p);
39 static int bs_cmp(const void *p1, const void *p2)
41 const struct bssplit *bsp1 = p1;
42 const struct bssplit *bsp2 = p2;
44 return (int) bsp1->perc - (int) bsp2->perc;
49 unsigned int val1[100];
50 unsigned int val2[100];
53 static int split_parse_ddir(struct thread_options *o, struct split *split,
54 enum fio_ddir ddir, char *str)
63 while ((fname = strsep(&str, ":")) != NULL) {
69 perc_str = strstr(fname, "/");
73 perc = atoi(perc_str);
81 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
82 log_err("fio: bssplit conversion failed\n");
87 split->val2[i] = perc;
97 static int bssplit_ddir(struct thread_options *o, enum fio_ddir ddir, char *str)
99 unsigned int i, perc, perc_missing;
100 unsigned int max_bs, min_bs;
103 memset(&split, 0, sizeof(split));
105 if (split_parse_ddir(o, &split, ddir, str))
112 o->bssplit[ddir] = malloc(split.nr * sizeof(struct bssplit));
113 o->bssplit_nr[ddir] = split.nr;
114 for (i = 0; i < split.nr; i++) {
115 if (split.val1[i] > max_bs)
116 max_bs = split.val1[i];
117 if (split.val1[i] < min_bs)
118 min_bs = split.val1[i];
120 o->bssplit[ddir][i].bs = split.val1[i];
121 o->bssplit[ddir][i].perc =split.val2[i];
125 * Now check if the percentages add up, and how much is missing
127 perc = perc_missing = 0;
128 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
129 struct bssplit *bsp = &o->bssplit[ddir][i];
131 if (bsp->perc == -1U)
137 if (perc > 100 && perc_missing > 1) {
138 log_err("fio: bssplit percentages add to more than 100%%\n");
139 free(o->bssplit[ddir]);
140 o->bssplit[ddir] = NULL;
145 * If values didn't have a percentage set, divide the remains between
149 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
151 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
152 struct bssplit *bsp = &o->bssplit[ddir][i];
154 if (bsp->perc == -1U)
155 bsp->perc = (100 - perc) / perc_missing;
159 o->min_bs[ddir] = min_bs;
160 o->max_bs[ddir] = max_bs;
163 * now sort based on percentages, for ease of lookup
165 qsort(o->bssplit[ddir], o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
169 typedef int (split_parse_fn)(struct thread_options *, enum fio_ddir, char *);
171 static int str_split_parse(struct thread_data *td, char *str, split_parse_fn *fn)
176 odir = strchr(str, ',');
178 ddir = strchr(odir + 1, ',');
180 ret = fn(&td->o, DDIR_TRIM, ddir + 1);
186 op = strdup(odir + 1);
187 ret = fn(&td->o, DDIR_TRIM, op);
192 ret = fn(&td->o, DDIR_WRITE, odir + 1);
195 ret = fn(&td->o, DDIR_READ, str);
201 ret = fn(&td->o, DDIR_WRITE, op);
206 ret = fn(&td->o, DDIR_TRIM, op);
210 ret = fn(&td->o, DDIR_READ, str);
216 static int str_bssplit_cb(void *data, const char *input)
218 struct thread_data *td = data;
222 p = str = strdup(input);
224 strip_blank_front(&str);
225 strip_blank_end(str);
227 ret = str_split_parse(td, str, bssplit_ddir);
229 if (parse_dryrun()) {
232 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
233 free(td->o.bssplit[i]);
234 td->o.bssplit[i] = NULL;
235 td->o.bssplit_nr[i] = 0;
243 static int str2error(char *str)
245 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
246 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
247 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
248 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
249 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
250 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
251 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
252 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
253 int i = 0, num = sizeof(err) / sizeof(void *);
256 if (!strcmp(err[i], str))
263 static int ignore_error_type(struct thread_data *td, int etype, char *str)
269 if (etype >= ERROR_TYPE_CNT) {
270 log_err("Illegal error type\n");
274 td->o.ignore_error_nr[etype] = 4;
275 error = malloc(4 * sizeof(struct bssplit));
278 while ((fname = strsep(&str, ":")) != NULL) {
284 * grow struct buffer, if needed
286 if (i == td->o.ignore_error_nr[etype]) {
287 td->o.ignore_error_nr[etype] <<= 1;
288 error = realloc(error, td->o.ignore_error_nr[etype]
291 if (fname[0] == 'E') {
292 error[i] = str2error(fname);
294 error[i] = atoi(fname);
296 error[i] = -error[i];
299 log_err("Unknown error %s, please use number value \n",
307 td->o.continue_on_error |= 1 << etype;
308 td->o.ignore_error_nr[etype] = i;
309 td->o.ignore_error[etype] = error;
317 static int str_ignore_error_cb(void *data, const char *input)
319 struct thread_data *td = data;
321 int type = 0, ret = 1;
326 p = str = strdup(input);
328 strip_blank_front(&str);
329 strip_blank_end(str);
335 ret = ignore_error_type(td, type, p);
345 static int str_rw_cb(void *data, const char *str)
347 struct thread_data *td = data;
348 struct thread_options *o = &td->o;
357 nr = get_opt_postfix(str);
362 o->ddir_seq_nr = atoi(nr);
366 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
367 log_err("fio: rw postfix parsing failed\n");
372 o->ddir_seq_add = val;
379 static int str_mem_cb(void *data, const char *mem)
381 struct thread_data *td = data;
383 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
384 td->o.mem_type == MEM_MMAPSHARED)
385 td->o.mmapfile = get_opt_postfix(mem);
390 static int fio_clock_source_cb(void *data, const char *str)
392 struct thread_data *td = data;
394 fio_clock_source = td->o.clocksource;
395 fio_clock_source_set = 1;
400 static int str_rwmix_read_cb(void *data, unsigned long long *val)
402 struct thread_data *td = data;
404 td->o.rwmix[DDIR_READ] = *val;
405 td->o.rwmix[DDIR_WRITE] = 100 - *val;
409 static int str_rwmix_write_cb(void *data, unsigned long long *val)
411 struct thread_data *td = data;
413 td->o.rwmix[DDIR_WRITE] = *val;
414 td->o.rwmix[DDIR_READ] = 100 - *val;
418 static int str_exitall_cb(void)
420 exitall_on_terminate = 1;
424 #ifdef FIO_HAVE_CPU_AFFINITY
425 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
427 unsigned int i, index, cpus_in_mask;
428 const long max_cpu = cpus_online();
430 cpus_in_mask = fio_cpu_count(mask);
431 cpu_index = cpu_index % cpus_in_mask;
434 for (i = 0; i < max_cpu; i++) {
435 if (!fio_cpu_isset(mask, i))
438 if (cpu_index != index)
439 fio_cpu_clear(mask, i);
444 return fio_cpu_count(mask);
447 static int str_cpumask_cb(void *data, unsigned long long *val)
449 struct thread_data *td = data;
457 ret = fio_cpuset_init(&td->o.cpumask);
459 log_err("fio: cpuset_init failed\n");
460 td_verror(td, ret, "fio_cpuset_init");
464 max_cpu = cpus_online();
466 for (i = 0; i < sizeof(int) * 8; i++) {
467 if ((1 << i) & *val) {
469 log_err("fio: CPU %d too large (max=%ld)\n", i,
473 dprint(FD_PARSE, "set cpu allowed %d\n", i);
474 fio_cpu_set(&td->o.cpumask, i);
481 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
488 ret = fio_cpuset_init(mask);
490 log_err("fio: cpuset_init failed\n");
491 td_verror(td, ret, "fio_cpuset_init");
495 p = str = strdup(input);
497 strip_blank_front(&str);
498 strip_blank_end(str);
500 max_cpu = cpus_online();
502 while ((cpu = strsep(&str, ",")) != NULL) {
511 while ((cpu2 = strsep(&str2, "-")) != NULL) {
521 while (icpu <= icpu2) {
522 if (icpu >= FIO_MAX_CPUS) {
523 log_err("fio: your OS only supports up to"
524 " %d CPUs\n", (int) FIO_MAX_CPUS);
528 if (icpu >= max_cpu) {
529 log_err("fio: CPU %d too large (max=%ld)\n",
535 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
536 fio_cpu_set(mask, icpu);
547 static int str_cpus_allowed_cb(void *data, const char *input)
549 struct thread_data *td = data;
554 return set_cpus_allowed(td, &td->o.cpumask, input);
557 static int str_verify_cpus_allowed_cb(void *data, const char *input)
559 struct thread_data *td = data;
564 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
568 static int str_log_cpus_allowed_cb(void *data, const char *input)
570 struct thread_data *td = data;
575 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
577 #endif /* CONFIG_ZLIB */
579 #endif /* FIO_HAVE_CPU_AFFINITY */
581 #ifdef CONFIG_LIBNUMA
582 static int str_numa_cpunodes_cb(void *data, char *input)
584 struct thread_data *td = data;
585 struct bitmask *verify_bitmask;
590 /* numa_parse_nodestring() parses a character string list
591 * of nodes into a bit mask. The bit mask is allocated by
592 * numa_allocate_nodemask(), so it should be freed by
593 * numa_free_nodemask().
595 verify_bitmask = numa_parse_nodestring(input);
596 if (verify_bitmask == NULL) {
597 log_err("fio: numa_parse_nodestring failed\n");
598 td_verror(td, 1, "str_numa_cpunodes_cb");
601 numa_free_nodemask(verify_bitmask);
603 td->o.numa_cpunodes = strdup(input);
607 static int str_numa_mpol_cb(void *data, char *input)
609 struct thread_data *td = data;
610 const char * const policy_types[] =
611 { "default", "prefer", "bind", "interleave", "local", NULL };
614 struct bitmask *verify_bitmask;
619 nodelist = strchr(input, ':');
621 /* NUL-terminate mode */
625 for (i = 0; i <= MPOL_LOCAL; i++) {
626 if (!strcmp(input, policy_types[i])) {
627 td->o.numa_mem_mode = i;
631 if (i > MPOL_LOCAL) {
632 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
636 switch (td->o.numa_mem_mode) {
639 * Insist on a nodelist of one node only
642 char *rest = nodelist;
643 while (isdigit(*rest))
646 log_err("fio: one node only for \'prefer\'\n");
650 log_err("fio: one node is needed for \'prefer\'\n");
654 case MPOL_INTERLEAVE:
656 * Default to online nodes with memory if no nodelist
659 nodelist = strdup("all");
664 * Don't allow a nodelist
667 log_err("fio: NO nodelist for \'local\'\n");
673 * Insist on a nodelist
676 log_err("fio: a nodelist is needed for \'bind\'\n");
683 /* numa_parse_nodestring() parses a character string list
684 * of nodes into a bit mask. The bit mask is allocated by
685 * numa_allocate_nodemask(), so it should be freed by
686 * numa_free_nodemask().
688 switch (td->o.numa_mem_mode) {
690 td->o.numa_mem_prefer_node = atoi(nodelist);
692 case MPOL_INTERLEAVE:
694 verify_bitmask = numa_parse_nodestring(nodelist);
695 if (verify_bitmask == NULL) {
696 log_err("fio: numa_parse_nodestring failed\n");
697 td_verror(td, 1, "str_numa_memnodes_cb");
700 td->o.numa_memnodes = strdup(nodelist);
701 numa_free_nodemask(verify_bitmask);
716 static int str_fst_cb(void *data, const char *str)
718 struct thread_data *td = data;
719 char *nr = get_opt_postfix(str);
721 td->file_service_nr = 1;
723 td->file_service_nr = atoi(nr);
730 #ifdef CONFIG_SYNC_FILE_RANGE
731 static int str_sfr_cb(void *data, const char *str)
733 struct thread_data *td = data;
734 char *nr = get_opt_postfix(str);
736 td->sync_file_range_nr = 1;
738 td->sync_file_range_nr = atoi(nr);
746 static int zone_cmp(const void *p1, const void *p2)
748 const struct zone_split *zsp1 = p1;
749 const struct zone_split *zsp2 = p2;
751 return (int) zsp2->access_perc - (int) zsp1->access_perc;
754 static int zone_split_ddir(struct thread_options *o, enum fio_ddir ddir,
757 unsigned int i, perc, perc_missing, sperc, sperc_missing;
760 memset(&split, 0, sizeof(split));
762 if (split_parse_ddir(o, &split, ddir, str))
767 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
768 o->zone_split_nr[ddir] = split.nr;
769 for (i = 0; i < split.nr; i++) {
770 o->zone_split[ddir][i].access_perc = split.val1[i];
771 o->zone_split[ddir][i].size_perc = split.val2[i];
775 * Now check if the percentages add up, and how much is missing
777 perc = perc_missing = 0;
778 sperc = sperc_missing = 0;
779 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
780 struct zone_split *zsp = &o->zone_split[ddir][i];
782 if (zsp->access_perc == (uint8_t) -1U)
785 perc += zsp->access_perc;
787 if (zsp->size_perc == (uint8_t) -1U)
790 sperc += zsp->size_perc;
794 if (perc > 100 || sperc > 100) {
795 log_err("fio: zone_split percentages add to more than 100%%\n");
796 free(o->zone_split[ddir]);
797 o->zone_split[ddir] = NULL;
801 log_err("fio: access percentage don't add up to 100 for zoned "
802 "random distribution (got=%u)\n", perc);
803 free(o->zone_split[ddir]);
804 o->zone_split[ddir] = NULL;
809 * If values didn't have a percentage set, divide the remains between
813 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
815 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
816 struct zone_split *zsp = &o->zone_split[ddir][i];
818 if (zsp->access_perc == (uint8_t) -1U)
819 zsp->access_perc = (100 - perc) / perc_missing;
823 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
825 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
826 struct zone_split *zsp = &o->zone_split[ddir][i];
828 if (zsp->size_perc == (uint8_t) -1U)
829 zsp->size_perc = (100 - sperc) / sperc_missing;
834 * now sort based on percentages, for ease of lookup
836 qsort(o->zone_split[ddir], o->zone_split_nr[ddir], sizeof(struct zone_split), zone_cmp);
840 static void __td_zone_gen_index(struct thread_data *td, enum fio_ddir ddir)
842 unsigned int i, j, sprev, aprev;
844 td->zone_state_index[ddir] = malloc(sizeof(struct zone_split_index) * 100);
847 for (i = 0; i < td->o.zone_split_nr[ddir]; i++) {
848 struct zone_split *zsp = &td->o.zone_split[ddir][i];
850 for (j = aprev; j < aprev + zsp->access_perc; j++) {
851 struct zone_split_index *zsi = &td->zone_state_index[ddir][j];
853 zsi->size_perc = sprev + zsp->size_perc;
854 zsi->size_perc_prev = sprev;
857 aprev += zsp->access_perc;
858 sprev += zsp->size_perc;
863 * Generate state table for indexes, so we don't have to do it inline from
866 static void td_zone_gen_index(struct thread_data *td)
870 td->zone_state_index = malloc(DDIR_RWDIR_CNT *
871 sizeof(struct zone_split_index *));
873 for (i = 0; i < DDIR_RWDIR_CNT; i++)
874 __td_zone_gen_index(td, i);
877 static int parse_zoned_distribution(struct thread_data *td, const char *input)
882 p = str = strdup(input);
884 strip_blank_front(&str);
885 strip_blank_end(str);
887 /* We expect it to start like that, bail if not */
888 if (strncmp(str, "zoned:", 6)) {
889 log_err("fio: mismatch in zoned input <%s>\n", str);
893 str += strlen("zoned:");
895 ret = str_split_parse(td, str, zone_split_ddir);
899 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
902 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
904 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
905 struct zone_split *zsp = &td->o.zone_split[i][j];
907 dprint(FD_PARSE, "\t%d: %u/%u\n", j, zsp->access_perc,
912 if (parse_dryrun()) {
915 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
916 free(td->o.zone_split[i]);
917 td->o.zone_split[i] = NULL;
918 td->o.zone_split_nr[i] = 0;
925 td_zone_gen_index(td);
927 for (i = 0; i < DDIR_RWDIR_CNT; i++)
928 td->o.zone_split_nr[i] = 0;
934 static int str_random_distribution_cb(void *data, const char *str)
936 struct thread_data *td = data;
940 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
942 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
943 val = FIO_DEF_PARETO;
944 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
946 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
947 return parse_zoned_distribution(td, str);
951 nr = get_opt_postfix(str);
952 if (nr && !str_to_float(nr, &val, 0)) {
953 log_err("fio: random postfix parsing failed\n");
960 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
962 log_err("fio: zipf theta must different than 1.0\n");
967 td->o.zipf_theta.u.f = val;
968 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
969 if (val <= 0.00 || val >= 1.00) {
970 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
975 td->o.pareto_h.u.f = val;
977 if (val <= 0.00 || val >= 100.0) {
978 log_err("fio: normal deviation out of range (0 < input < 100.0)\n");
983 td->o.gauss_dev.u.f = val;
990 * Return next name in the string. Files are separated with ':'. If the ':'
991 * is escaped with a '\', then that ':' is part of the filename and does not
992 * indicate a new file.
994 static char *get_next_name(char **ptr)
999 if (!str || !strlen(str))
1005 * No colon, we are done
1007 p = strchr(str, ':');
1014 * We got a colon, but it's the first character. Skip and
1022 if (*(p - 1) != '\\') {
1028 memmove(p - 1, p, strlen(p) + 1);
1036 static int get_max_name_idx(char *input)
1038 unsigned int cur_idx;
1041 p = str = strdup(input);
1042 for (cur_idx = 0; ; cur_idx++)
1043 if (get_next_name(&str) == NULL)
1051 * Returns the directory at the index, indexes > entires will be
1052 * assigned via modulo division of the index
1054 int set_name_idx(char *target, size_t tlen, char *input, int index)
1056 unsigned int cur_idx;
1058 char *fname, *str, *p;
1060 p = str = strdup(input);
1062 index %= get_max_name_idx(input);
1063 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1064 fname = get_next_name(&str);
1066 if (client_sockaddr_str[0]) {
1067 len = snprintf(target, tlen, "%s/%s.", fname,
1068 client_sockaddr_str);
1070 len = snprintf(target, tlen, "%s/", fname);
1072 target[tlen - 1] = '\0';
1078 static int str_filename_cb(void *data, const char *input)
1080 struct thread_data *td = data;
1081 char *fname, *str, *p;
1083 p = str = strdup(input);
1085 strip_blank_front(&str);
1086 strip_blank_end(str);
1088 if (!td->files_index)
1091 while ((fname = get_next_name(&str)) != NULL) {
1094 add_file(td, fname, 0, 1);
1101 static int str_directory_cb(void *data, const char fio_unused *unused)
1103 struct thread_data *td = data;
1105 char *dirname, *str, *p;
1111 p = str = strdup(td->o.directory);
1112 while ((dirname = get_next_name(&str)) != NULL) {
1113 if (lstat(dirname, &sb) < 0) {
1116 log_err("fio: %s is not a directory\n", dirname);
1117 td_verror(td, ret, "lstat");
1120 if (!S_ISDIR(sb.st_mode)) {
1121 log_err("fio: %s is not a directory\n", dirname);
1132 static int str_opendir_cb(void *data, const char fio_unused *str)
1134 struct thread_data *td = data;
1139 if (!td->files_index)
1142 return add_dir_files(td, td->o.opendir);
1145 static int str_buffer_pattern_cb(void *data, const char *input)
1147 struct thread_data *td = data;
1150 /* FIXME: for now buffer pattern does not support formats */
1151 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
1152 MAX_PATTERN_SIZE, NULL, 0, NULL, NULL);
1157 td->o.buffer_pattern_bytes = ret;
1158 if (!td->o.compress_percentage)
1159 td->o.refill_buffers = 0;
1160 td->o.scramble_buffers = 0;
1161 td->o.zero_buffers = 0;
1166 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1168 struct thread_data *td = data;
1170 td->flags |= TD_F_COMPRESS;
1171 td->o.compress_percentage = *il;
1175 static int str_dedupe_cb(void *data, unsigned long long *il)
1177 struct thread_data *td = data;
1179 td->flags |= TD_F_COMPRESS;
1180 td->o.dedupe_percentage = *il;
1181 td->o.refill_buffers = 1;
1185 static int str_verify_pattern_cb(void *data, const char *input)
1187 struct pattern_fmt_desc fmt_desc[] = {
1190 .len = FIELD_SIZE(struct io_u *, offset),
1191 .paste = paste_blockoff
1194 struct thread_data *td = data;
1197 td->o.verify_fmt_sz = ARRAY_SIZE(td->o.verify_fmt);
1198 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
1199 MAX_PATTERN_SIZE, fmt_desc, sizeof(fmt_desc),
1200 td->o.verify_fmt, &td->o.verify_fmt_sz);
1205 td->o.verify_pattern_bytes = ret;
1207 * VERIFY_* could already be set
1209 if (!fio_option_is_set(&td->o, verify))
1210 td->o.verify = VERIFY_PATTERN;
1215 static int str_gtod_reduce_cb(void *data, int *il)
1217 struct thread_data *td = data;
1220 td->o.disable_lat = !!val;
1221 td->o.disable_clat = !!val;
1222 td->o.disable_slat = !!val;
1223 td->o.disable_bw = !!val;
1224 td->o.clat_percentiles = !val;
1226 td->tv_cache_mask = 63;
1231 static int str_size_cb(void *data, unsigned long long *__val)
1233 struct thread_data *td = data;
1234 unsigned long long v = *__val;
1236 if (parse_is_percent(v)) {
1238 td->o.size_percent = -1ULL - v;
1245 static int rw_verify(struct fio_option *o, void *data)
1247 struct thread_data *td = data;
1249 if (read_only && td_write(td)) {
1250 log_err("fio: job <%s> has write bit set, but fio is in"
1251 " read-only mode\n", td->o.name);
1258 static int gtod_cpu_verify(struct fio_option *o, void *data)
1260 #ifndef FIO_HAVE_CPU_AFFINITY
1261 struct thread_data *td = data;
1263 if (td->o.gtod_cpu) {
1264 log_err("fio: platform must support CPU affinity for"
1265 "gettimeofday() offloading\n");
1274 * Map of job/command line options
1276 struct fio_option fio_options[FIO_MAX_OPTS] = {
1278 .name = "description",
1279 .lname = "Description of job",
1280 .type = FIO_OPT_STR_STORE,
1281 .off1 = td_var_offset(description),
1282 .help = "Text job description",
1283 .category = FIO_OPT_C_GENERAL,
1284 .group = FIO_OPT_G_DESC,
1288 .lname = "Job name",
1289 .type = FIO_OPT_STR_STORE,
1290 .off1 = td_var_offset(name),
1291 .help = "Name of this job",
1292 .category = FIO_OPT_C_GENERAL,
1293 .group = FIO_OPT_G_DESC,
1297 .lname = "Waitee name",
1298 .type = FIO_OPT_STR_STORE,
1299 .off1 = td_var_offset(wait_for),
1300 .help = "Name of the job this one wants to wait for before starting",
1301 .category = FIO_OPT_C_GENERAL,
1302 .group = FIO_OPT_G_DESC,
1306 .lname = "Filename(s)",
1307 .type = FIO_OPT_STR_STORE,
1308 .off1 = td_var_offset(filename),
1309 .cb = str_filename_cb,
1310 .prio = -1, /* must come after "directory" */
1311 .help = "File(s) to use for the workload",
1312 .category = FIO_OPT_C_FILE,
1313 .group = FIO_OPT_G_FILENAME,
1316 .name = "directory",
1317 .lname = "Directory",
1318 .type = FIO_OPT_STR_STORE,
1319 .off1 = td_var_offset(directory),
1320 .cb = str_directory_cb,
1321 .help = "Directory to store files in",
1322 .category = FIO_OPT_C_FILE,
1323 .group = FIO_OPT_G_FILENAME,
1326 .name = "filename_format",
1327 .type = FIO_OPT_STR_STORE,
1328 .off1 = td_var_offset(filename_format),
1329 .prio = -1, /* must come after "directory" */
1330 .help = "Override default $jobname.$jobnum.$filenum naming",
1331 .def = "$jobname.$jobnum.$filenum",
1332 .category = FIO_OPT_C_FILE,
1333 .group = FIO_OPT_G_FILENAME,
1337 .lname = "Lockfile",
1338 .type = FIO_OPT_STR,
1339 .off1 = td_var_offset(file_lock_mode),
1340 .help = "Lock file when doing IO to it",
1342 .parent = "filename",
1345 .category = FIO_OPT_C_FILE,
1346 .group = FIO_OPT_G_FILENAME,
1349 .oval = FILE_LOCK_NONE,
1350 .help = "No file locking",
1352 { .ival = "exclusive",
1353 .oval = FILE_LOCK_EXCLUSIVE,
1354 .help = "Exclusive file lock",
1357 .ival = "readwrite",
1358 .oval = FILE_LOCK_READWRITE,
1359 .help = "Read vs write lock",
1365 .lname = "Open directory",
1366 .type = FIO_OPT_STR_STORE,
1367 .off1 = td_var_offset(opendir),
1368 .cb = str_opendir_cb,
1369 .help = "Recursively add files from this directory and down",
1370 .category = FIO_OPT_C_FILE,
1371 .group = FIO_OPT_G_FILENAME,
1375 .lname = "Read/write",
1376 .alias = "readwrite",
1377 .type = FIO_OPT_STR,
1379 .off1 = td_var_offset(td_ddir),
1380 .help = "IO direction",
1382 .verify = rw_verify,
1383 .category = FIO_OPT_C_IO,
1384 .group = FIO_OPT_G_IO_BASIC,
1387 .oval = TD_DDIR_READ,
1388 .help = "Sequential read",
1391 .oval = TD_DDIR_WRITE,
1392 .help = "Sequential write",
1395 .oval = TD_DDIR_TRIM,
1396 .help = "Sequential trim",
1398 { .ival = "randread",
1399 .oval = TD_DDIR_RANDREAD,
1400 .help = "Random read",
1402 { .ival = "randwrite",
1403 .oval = TD_DDIR_RANDWRITE,
1404 .help = "Random write",
1406 { .ival = "randtrim",
1407 .oval = TD_DDIR_RANDTRIM,
1408 .help = "Random trim",
1412 .help = "Sequential read and write mix",
1414 { .ival = "readwrite",
1416 .help = "Sequential read and write mix",
1419 .oval = TD_DDIR_RANDRW,
1420 .help = "Random read and write mix"
1422 { .ival = "trimwrite",
1423 .oval = TD_DDIR_TRIMWRITE,
1424 .help = "Trim and write mix, trims preceding writes"
1429 .name = "rw_sequencer",
1430 .lname = "RW Sequencer",
1431 .type = FIO_OPT_STR,
1432 .off1 = td_var_offset(rw_seq),
1433 .help = "IO offset generator modifier",
1434 .def = "sequential",
1435 .category = FIO_OPT_C_IO,
1436 .group = FIO_OPT_G_IO_BASIC,
1438 { .ival = "sequential",
1440 .help = "Generate sequential offsets",
1442 { .ival = "identical",
1443 .oval = RW_SEQ_IDENT,
1444 .help = "Generate identical offsets",
1451 .lname = "IO Engine",
1452 .type = FIO_OPT_STR_STORE,
1453 .off1 = td_var_offset(ioengine),
1454 .help = "IO engine to use",
1455 .def = FIO_PREFERRED_ENGINE,
1456 .category = FIO_OPT_C_IO,
1457 .group = FIO_OPT_G_IO_BASIC,
1460 .help = "Use read/write",
1463 .help = "Use pread/pwrite",
1466 .help = "Use readv/writev",
1468 #ifdef CONFIG_PWRITEV
1470 .help = "Use preadv/pwritev",
1473 #ifdef CONFIG_PWRITEV
1474 { .ival = "pvsync2",
1475 .help = "Use preadv2/pwritev2",
1478 #ifdef CONFIG_LIBAIO
1480 .help = "Linux native asynchronous IO",
1483 #ifdef CONFIG_POSIXAIO
1484 { .ival = "posixaio",
1485 .help = "POSIX asynchronous IO",
1488 #ifdef CONFIG_SOLARISAIO
1489 { .ival = "solarisaio",
1490 .help = "Solaris native asynchronous IO",
1493 #ifdef CONFIG_WINDOWSAIO
1494 { .ival = "windowsaio",
1495 .help = "Windows native asynchronous IO"
1500 .help = "Rados Block Device asynchronous IO"
1504 .help = "Memory mapped IO"
1506 #ifdef CONFIG_LINUX_SPLICE
1508 .help = "splice/vmsplice based IO",
1510 { .ival = "netsplice",
1511 .help = "splice/vmsplice to/from the network",
1514 #ifdef FIO_HAVE_SGIO
1516 .help = "SCSI generic v3 IO",
1520 .help = "Testing engine (no data transfer)",
1523 .help = "Network IO",
1526 .help = "CPU cycle burner engine",
1530 .help = "GUASI IO engine",
1533 #ifdef FIO_HAVE_BINJECT
1534 { .ival = "binject",
1535 .help = "binject direct inject block engine",
1540 .help = "RDMA IO engine",
1543 #ifdef CONFIG_FUSION_AW
1544 { .ival = "fusion-aw-sync",
1545 .help = "Fusion-io atomic write engine",
1548 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1549 { .ival = "e4defrag",
1550 .help = "ext4 defrag engine",
1553 #ifdef CONFIG_LINUX_FALLOCATE
1555 .help = "fallocate() file based engine",
1560 .help = "Glusterfs libgfapi(sync) based engine"
1562 { .ival = "gfapi_async",
1563 .help = "Glusterfs libgfapi(async) based engine"
1566 #ifdef CONFIG_LIBHDFS
1567 { .ival = "libhdfs",
1568 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1571 { .ival = "external",
1572 .help = "Load external engine (append name)",
1578 .lname = "IO Depth",
1579 .type = FIO_OPT_INT,
1580 .off1 = td_var_offset(iodepth),
1581 .help = "Number of IO buffers to keep in flight",
1585 .category = FIO_OPT_C_IO,
1586 .group = FIO_OPT_G_IO_BASIC,
1589 .name = "iodepth_batch",
1590 .lname = "IO Depth batch",
1591 .alias = "iodepth_batch_submit",
1592 .type = FIO_OPT_INT,
1593 .off1 = td_var_offset(iodepth_batch),
1594 .help = "Number of IO buffers to submit in one go",
1595 .parent = "iodepth",
1600 .category = FIO_OPT_C_IO,
1601 .group = FIO_OPT_G_IO_BASIC,
1604 .name = "iodepth_batch_complete_min",
1605 .lname = "Min IO depth batch complete",
1606 .alias = "iodepth_batch_complete",
1607 .type = FIO_OPT_INT,
1608 .off1 = td_var_offset(iodepth_batch_complete_min),
1609 .help = "Min number of IO buffers to retrieve in one go",
1610 .parent = "iodepth",
1615 .category = FIO_OPT_C_IO,
1616 .group = FIO_OPT_G_IO_BASIC,
1619 .name = "iodepth_batch_complete_max",
1620 .lname = "Max IO depth batch complete",
1621 .type = FIO_OPT_INT,
1622 .off1 = td_var_offset(iodepth_batch_complete_max),
1623 .help = "Max number of IO buffers to retrieve in one go",
1624 .parent = "iodepth",
1628 .category = FIO_OPT_C_IO,
1629 .group = FIO_OPT_G_IO_BASIC,
1632 .name = "iodepth_low",
1633 .lname = "IO Depth batch low",
1634 .type = FIO_OPT_INT,
1635 .off1 = td_var_offset(iodepth_low),
1636 .help = "Low water mark for queuing depth",
1637 .parent = "iodepth",
1640 .category = FIO_OPT_C_IO,
1641 .group = FIO_OPT_G_IO_BASIC,
1644 .name = "io_submit_mode",
1645 .lname = "IO submit mode",
1646 .type = FIO_OPT_STR,
1647 .off1 = td_var_offset(io_submit_mode),
1648 .help = "How IO submissions and completions are done",
1650 .category = FIO_OPT_C_IO,
1651 .group = FIO_OPT_G_IO_BASIC,
1654 .oval = IO_MODE_INLINE,
1655 .help = "Submit and complete IO inline",
1657 { .ival = "offload",
1658 .oval = IO_MODE_OFFLOAD,
1659 .help = "Offload submit and complete to threads",
1666 .type = FIO_OPT_STR_VAL,
1668 .off1 = td_var_offset(size),
1669 .help = "Total size of device or files",
1670 .interval = 1024 * 1024,
1671 .category = FIO_OPT_C_IO,
1672 .group = FIO_OPT_G_INVALID,
1676 .alias = "io_limit",
1678 .type = FIO_OPT_STR_VAL,
1679 .off1 = td_var_offset(io_limit),
1680 .interval = 1024 * 1024,
1681 .category = FIO_OPT_C_IO,
1682 .group = FIO_OPT_G_INVALID,
1685 .name = "fill_device",
1686 .lname = "Fill device",
1688 .type = FIO_OPT_BOOL,
1689 .off1 = td_var_offset(fill_device),
1690 .help = "Write until an ENOSPC error occurs",
1692 .category = FIO_OPT_C_FILE,
1693 .group = FIO_OPT_G_INVALID,
1697 .lname = "File size",
1698 .type = FIO_OPT_STR_VAL,
1699 .off1 = td_var_offset(file_size_low),
1700 .off2 = td_var_offset(file_size_high),
1702 .help = "Size of individual files",
1703 .interval = 1024 * 1024,
1704 .category = FIO_OPT_C_FILE,
1705 .group = FIO_OPT_G_INVALID,
1708 .name = "file_append",
1709 .lname = "File append",
1710 .type = FIO_OPT_BOOL,
1711 .off1 = td_var_offset(file_append),
1712 .help = "IO will start at the end of the file(s)",
1714 .category = FIO_OPT_C_FILE,
1715 .group = FIO_OPT_G_INVALID,
1719 .lname = "IO offset",
1720 .alias = "fileoffset",
1721 .type = FIO_OPT_STR_VAL,
1722 .off1 = td_var_offset(start_offset),
1723 .help = "Start IO from this offset",
1725 .interval = 1024 * 1024,
1726 .category = FIO_OPT_C_IO,
1727 .group = FIO_OPT_G_INVALID,
1730 .name = "offset_increment",
1731 .lname = "IO offset increment",
1732 .type = FIO_OPT_STR_VAL,
1733 .off1 = td_var_offset(offset_increment),
1734 .help = "What is the increment from one offset to the next",
1738 .interval = 1024 * 1024,
1739 .category = FIO_OPT_C_IO,
1740 .group = FIO_OPT_G_INVALID,
1743 .name = "number_ios",
1744 .lname = "Number of IOs to perform",
1745 .type = FIO_OPT_STR_VAL,
1746 .off1 = td_var_offset(number_ios),
1747 .help = "Force job completion after this number of IOs",
1749 .category = FIO_OPT_C_IO,
1750 .group = FIO_OPT_G_INVALID,
1754 .lname = "Block size",
1755 .alias = "blocksize",
1756 .type = FIO_OPT_INT,
1757 .off1 = td_var_offset(bs[DDIR_READ]),
1758 .off2 = td_var_offset(bs[DDIR_WRITE]),
1759 .off3 = td_var_offset(bs[DDIR_TRIM]),
1761 .help = "Block size unit",
1766 .category = FIO_OPT_C_IO,
1767 .group = FIO_OPT_G_INVALID,
1771 .lname = "Block size align",
1772 .alias = "blockalign",
1773 .type = FIO_OPT_INT,
1774 .off1 = td_var_offset(ba[DDIR_READ]),
1775 .off2 = td_var_offset(ba[DDIR_WRITE]),
1776 .off3 = td_var_offset(ba[DDIR_TRIM]),
1778 .help = "IO block offset alignment",
1782 .category = FIO_OPT_C_IO,
1783 .group = FIO_OPT_G_INVALID,
1787 .lname = "Block size range",
1788 .alias = "blocksize_range",
1789 .type = FIO_OPT_RANGE,
1790 .off1 = td_var_offset(min_bs[DDIR_READ]),
1791 .off2 = td_var_offset(max_bs[DDIR_READ]),
1792 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1793 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1794 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1795 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1797 .help = "Set block size range (in more detail than bs)",
1801 .category = FIO_OPT_C_IO,
1802 .group = FIO_OPT_G_INVALID,
1806 .lname = "Block size split",
1807 .type = FIO_OPT_STR,
1808 .cb = str_bssplit_cb,
1809 .off1 = td_var_offset(bssplit),
1810 .help = "Set a specific mix of block sizes",
1813 .category = FIO_OPT_C_IO,
1814 .group = FIO_OPT_G_INVALID,
1817 .name = "bs_unaligned",
1818 .lname = "Block size unaligned",
1819 .alias = "blocksize_unaligned",
1820 .type = FIO_OPT_STR_SET,
1821 .off1 = td_var_offset(bs_unaligned),
1822 .help = "Don't sector align IO buffer sizes",
1825 .category = FIO_OPT_C_IO,
1826 .group = FIO_OPT_G_INVALID,
1829 .name = "bs_is_seq_rand",
1830 .lname = "Block size division is seq/random (not read/write)",
1831 .type = FIO_OPT_BOOL,
1832 .off1 = td_var_offset(bs_is_seq_rand),
1833 .help = "Consider any blocksize setting to be sequential,random",
1835 .parent = "blocksize",
1836 .category = FIO_OPT_C_IO,
1837 .group = FIO_OPT_G_INVALID,
1840 .name = "randrepeat",
1841 .lname = "Random repeatable",
1842 .type = FIO_OPT_BOOL,
1843 .off1 = td_var_offset(rand_repeatable),
1844 .help = "Use repeatable random IO pattern",
1848 .category = FIO_OPT_C_IO,
1849 .group = FIO_OPT_G_RANDOM,
1853 .lname = "The random generator seed",
1854 .type = FIO_OPT_STR_VAL,
1855 .off1 = td_var_offset(rand_seed),
1856 .help = "Set the random generator seed value",
1859 .category = FIO_OPT_C_IO,
1860 .group = FIO_OPT_G_RANDOM,
1863 .name = "use_os_rand",
1864 .lname = "Use OS random",
1865 .type = FIO_OPT_DEPRECATED,
1866 .off1 = td_var_offset(dep_use_os_rand),
1867 .category = FIO_OPT_C_IO,
1868 .group = FIO_OPT_G_RANDOM,
1871 .name = "norandommap",
1872 .lname = "No randommap",
1873 .type = FIO_OPT_STR_SET,
1874 .off1 = td_var_offset(norandommap),
1875 .help = "Accept potential duplicate random blocks",
1879 .category = FIO_OPT_C_IO,
1880 .group = FIO_OPT_G_RANDOM,
1883 .name = "softrandommap",
1884 .lname = "Soft randommap",
1885 .type = FIO_OPT_BOOL,
1886 .off1 = td_var_offset(softrandommap),
1887 .help = "Set norandommap if randommap allocation fails",
1888 .parent = "norandommap",
1891 .category = FIO_OPT_C_IO,
1892 .group = FIO_OPT_G_RANDOM,
1895 .name = "random_generator",
1896 .type = FIO_OPT_STR,
1897 .off1 = td_var_offset(random_generator),
1898 .help = "Type of random number generator to use",
1899 .def = "tausworthe",
1901 { .ival = "tausworthe",
1902 .oval = FIO_RAND_GEN_TAUSWORTHE,
1903 .help = "Strong Tausworthe generator",
1906 .oval = FIO_RAND_GEN_LFSR,
1907 .help = "Variable length LFSR",
1910 .ival = "tausworthe64",
1911 .oval = FIO_RAND_GEN_TAUSWORTHE64,
1912 .help = "64-bit Tausworthe variant",
1915 .category = FIO_OPT_C_IO,
1916 .group = FIO_OPT_G_RANDOM,
1919 .name = "random_distribution",
1920 .type = FIO_OPT_STR,
1921 .off1 = td_var_offset(random_distribution),
1922 .cb = str_random_distribution_cb,
1923 .help = "Random offset distribution generator",
1927 .oval = FIO_RAND_DIST_RANDOM,
1928 .help = "Completely random",
1931 .oval = FIO_RAND_DIST_ZIPF,
1932 .help = "Zipf distribution",
1935 .oval = FIO_RAND_DIST_PARETO,
1936 .help = "Pareto distribution",
1939 .oval = FIO_RAND_DIST_GAUSS,
1940 .help = "Normal (gaussian) distribution",
1943 .oval = FIO_RAND_DIST_ZONED,
1944 .help = "Zoned random distribution",
1948 .category = FIO_OPT_C_IO,
1949 .group = FIO_OPT_G_RANDOM,
1952 .name = "percentage_random",
1953 .lname = "Percentage Random",
1954 .type = FIO_OPT_INT,
1955 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1956 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1957 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1959 .help = "Percentage of seq/random mix that should be random",
1960 .def = "100,100,100",
1962 .inverse = "percentage_sequential",
1963 .category = FIO_OPT_C_IO,
1964 .group = FIO_OPT_G_RANDOM,
1967 .name = "percentage_sequential",
1968 .lname = "Percentage Sequential",
1969 .type = FIO_OPT_DEPRECATED,
1970 .category = FIO_OPT_C_IO,
1971 .group = FIO_OPT_G_RANDOM,
1974 .name = "allrandrepeat",
1975 .type = FIO_OPT_BOOL,
1976 .off1 = td_var_offset(allrand_repeatable),
1977 .help = "Use repeatable random numbers for everything",
1979 .category = FIO_OPT_C_IO,
1980 .group = FIO_OPT_G_RANDOM,
1984 .lname = "Number of files",
1985 .alias = "nr_files",
1986 .type = FIO_OPT_INT,
1987 .off1 = td_var_offset(nr_files),
1988 .help = "Split job workload between this number of files",
1991 .category = FIO_OPT_C_FILE,
1992 .group = FIO_OPT_G_INVALID,
1995 .name = "openfiles",
1996 .lname = "Number of open files",
1997 .type = FIO_OPT_INT,
1998 .off1 = td_var_offset(open_files),
1999 .help = "Number of files to keep open at the same time",
2000 .category = FIO_OPT_C_FILE,
2001 .group = FIO_OPT_G_INVALID,
2004 .name = "file_service_type",
2005 .lname = "File service type",
2006 .type = FIO_OPT_STR,
2008 .off1 = td_var_offset(file_service_type),
2009 .help = "How to select which file to service next",
2010 .def = "roundrobin",
2011 .category = FIO_OPT_C_FILE,
2012 .group = FIO_OPT_G_INVALID,
2015 .oval = FIO_FSERVICE_RANDOM,
2016 .help = "Choose a file at random",
2018 { .ival = "roundrobin",
2019 .oval = FIO_FSERVICE_RR,
2020 .help = "Round robin select files",
2022 { .ival = "sequential",
2023 .oval = FIO_FSERVICE_SEQ,
2024 .help = "Finish one file before moving to the next",
2027 .parent = "nrfiles",
2030 #ifdef CONFIG_POSIX_FALLOCATE
2032 .name = "fallocate",
2033 .lname = "Fallocate",
2034 .type = FIO_OPT_STR,
2035 .off1 = td_var_offset(fallocate_mode),
2036 .help = "Whether pre-allocation is performed when laying out files",
2038 .category = FIO_OPT_C_FILE,
2039 .group = FIO_OPT_G_INVALID,
2042 .oval = FIO_FALLOCATE_NONE,
2043 .help = "Do not pre-allocate space",
2046 .oval = FIO_FALLOCATE_POSIX,
2047 .help = "Use posix_fallocate()",
2049 #ifdef CONFIG_LINUX_FALLOCATE
2051 .oval = FIO_FALLOCATE_KEEP_SIZE,
2052 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2055 /* Compatibility with former boolean values */
2057 .oval = FIO_FALLOCATE_NONE,
2058 .help = "Alias for 'none'",
2061 .oval = FIO_FALLOCATE_POSIX,
2062 .help = "Alias for 'posix'",
2066 #endif /* CONFIG_POSIX_FALLOCATE */
2068 .name = "fadvise_hint",
2069 .lname = "Fadvise hint",
2070 .type = FIO_OPT_BOOL,
2071 .off1 = td_var_offset(fadvise_hint),
2072 .help = "Use fadvise() to advise the kernel on IO pattern",
2074 .category = FIO_OPT_C_FILE,
2075 .group = FIO_OPT_G_INVALID,
2077 #ifdef FIO_HAVE_STREAMID
2079 .name = "fadvise_stream",
2080 .lname = "Fadvise stream",
2081 .type = FIO_OPT_INT,
2082 .off1 = td_var_offset(fadvise_stream),
2083 .help = "Use fadvise() to set stream ID",
2084 .category = FIO_OPT_C_FILE,
2085 .group = FIO_OPT_G_INVALID,
2091 .type = FIO_OPT_INT,
2092 .off1 = td_var_offset(fsync_blocks),
2093 .help = "Issue fsync for writes every given number of blocks",
2096 .category = FIO_OPT_C_FILE,
2097 .group = FIO_OPT_G_INVALID,
2100 .name = "fdatasync",
2101 .lname = "Fdatasync",
2102 .type = FIO_OPT_INT,
2103 .off1 = td_var_offset(fdatasync_blocks),
2104 .help = "Issue fdatasync for writes every given number of blocks",
2107 .category = FIO_OPT_C_FILE,
2108 .group = FIO_OPT_G_INVALID,
2111 .name = "write_barrier",
2112 .lname = "Write barrier",
2113 .type = FIO_OPT_INT,
2114 .off1 = td_var_offset(barrier_blocks),
2115 .help = "Make every Nth write a barrier write",
2118 .category = FIO_OPT_C_IO,
2119 .group = FIO_OPT_G_INVALID,
2121 #ifdef CONFIG_SYNC_FILE_RANGE
2123 .name = "sync_file_range",
2124 .lname = "Sync file range",
2126 { .ival = "wait_before",
2127 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2128 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2132 .oval = SYNC_FILE_RANGE_WRITE,
2133 .help = "SYNC_FILE_RANGE_WRITE",
2137 .ival = "wait_after",
2138 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2139 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2143 .type = FIO_OPT_STR_MULTI,
2145 .off1 = td_var_offset(sync_file_range),
2146 .help = "Use sync_file_range()",
2147 .category = FIO_OPT_C_FILE,
2148 .group = FIO_OPT_G_INVALID,
2153 .lname = "Direct I/O",
2154 .type = FIO_OPT_BOOL,
2155 .off1 = td_var_offset(odirect),
2156 .help = "Use O_DIRECT IO (negates buffered)",
2158 .inverse = "buffered",
2159 .category = FIO_OPT_C_IO,
2160 .group = FIO_OPT_G_IO_TYPE,
2164 .lname = "Atomic I/O",
2165 .type = FIO_OPT_BOOL,
2166 .off1 = td_var_offset(oatomic),
2167 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2169 .category = FIO_OPT_C_IO,
2170 .group = FIO_OPT_G_IO_TYPE,
2174 .lname = "Buffered I/O",
2175 .type = FIO_OPT_BOOL,
2176 .off1 = td_var_offset(odirect),
2178 .help = "Use buffered IO (negates direct)",
2180 .inverse = "direct",
2181 .category = FIO_OPT_C_IO,
2182 .group = FIO_OPT_G_IO_TYPE,
2185 .name = "overwrite",
2186 .lname = "Overwrite",
2187 .type = FIO_OPT_BOOL,
2188 .off1 = td_var_offset(overwrite),
2189 .help = "When writing, set whether to overwrite current data",
2191 .category = FIO_OPT_C_FILE,
2192 .group = FIO_OPT_G_INVALID,
2197 .type = FIO_OPT_INT,
2198 .off1 = td_var_offset(loops),
2199 .help = "Number of times to run the job",
2202 .category = FIO_OPT_C_GENERAL,
2203 .group = FIO_OPT_G_RUNTIME,
2207 .lname = "Number of jobs",
2208 .type = FIO_OPT_INT,
2209 .off1 = td_var_offset(numjobs),
2210 .help = "Duplicate this job this many times",
2213 .category = FIO_OPT_C_GENERAL,
2214 .group = FIO_OPT_G_RUNTIME,
2217 .name = "startdelay",
2218 .lname = "Start delay",
2219 .type = FIO_OPT_STR_VAL_TIME,
2220 .off1 = td_var_offset(start_delay),
2221 .off2 = td_var_offset(start_delay_high),
2222 .help = "Only start job when this period has passed",
2226 .category = FIO_OPT_C_GENERAL,
2227 .group = FIO_OPT_G_RUNTIME,
2233 .type = FIO_OPT_STR_VAL_TIME,
2234 .off1 = td_var_offset(timeout),
2235 .help = "Stop workload when this amount of time has passed",
2239 .category = FIO_OPT_C_GENERAL,
2240 .group = FIO_OPT_G_RUNTIME,
2243 .name = "time_based",
2244 .lname = "Time based",
2245 .type = FIO_OPT_STR_SET,
2246 .off1 = td_var_offset(time_based),
2247 .help = "Keep running until runtime/timeout is met",
2248 .category = FIO_OPT_C_GENERAL,
2249 .group = FIO_OPT_G_RUNTIME,
2252 .name = "verify_only",
2253 .lname = "Verify only",
2254 .type = FIO_OPT_STR_SET,
2255 .off1 = td_var_offset(verify_only),
2256 .help = "Verifies previously written data is still valid",
2257 .category = FIO_OPT_C_GENERAL,
2258 .group = FIO_OPT_G_RUNTIME,
2261 .name = "ramp_time",
2262 .lname = "Ramp time",
2263 .type = FIO_OPT_STR_VAL_TIME,
2264 .off1 = td_var_offset(ramp_time),
2265 .help = "Ramp up time before measuring performance",
2268 .category = FIO_OPT_C_GENERAL,
2269 .group = FIO_OPT_G_RUNTIME,
2272 .name = "clocksource",
2273 .lname = "Clock source",
2274 .type = FIO_OPT_STR,
2275 .cb = fio_clock_source_cb,
2276 .off1 = td_var_offset(clocksource),
2277 .help = "What type of timing source to use",
2278 .category = FIO_OPT_C_GENERAL,
2279 .group = FIO_OPT_G_CLOCK,
2281 #ifdef CONFIG_GETTIMEOFDAY
2282 { .ival = "gettimeofday",
2284 .help = "Use gettimeofday(2) for timing",
2287 #ifdef CONFIG_CLOCK_GETTIME
2288 { .ival = "clock_gettime",
2289 .oval = CS_CGETTIME,
2290 .help = "Use clock_gettime(2) for timing",
2293 #ifdef ARCH_HAVE_CPU_CLOCK
2295 .oval = CS_CPUCLOCK,
2296 .help = "Use CPU private clock",
2304 .lname = "I/O Memory",
2305 .type = FIO_OPT_STR,
2307 .off1 = td_var_offset(mem_type),
2308 .help = "Backing type for IO buffers",
2310 .category = FIO_OPT_C_IO,
2311 .group = FIO_OPT_G_INVALID,
2315 .help = "Use malloc(3) for IO buffers",
2317 #ifndef CONFIG_NO_SHM
2320 .help = "Use shared memory segments for IO buffers",
2322 #ifdef FIO_HAVE_HUGETLB
2323 { .ival = "shmhuge",
2324 .oval = MEM_SHMHUGE,
2325 .help = "Like shm, but use huge pages",
2331 .help = "Use mmap(2) (file or anon) for IO buffers",
2333 { .ival = "mmapshared",
2334 .oval = MEM_MMAPSHARED,
2335 .help = "Like mmap, but use the shared flag",
2337 #ifdef FIO_HAVE_HUGETLB
2338 { .ival = "mmaphuge",
2339 .oval = MEM_MMAPHUGE,
2340 .help = "Like mmap, but use huge pages",
2346 .name = "iomem_align",
2347 .alias = "mem_align",
2348 .lname = "I/O memory alignment",
2349 .type = FIO_OPT_INT,
2350 .off1 = td_var_offset(mem_align),
2352 .help = "IO memory buffer offset alignment",
2356 .category = FIO_OPT_C_IO,
2357 .group = FIO_OPT_G_INVALID,
2362 .type = FIO_OPT_STR,
2363 .off1 = td_var_offset(verify),
2364 .help = "Verify data written",
2366 .category = FIO_OPT_C_IO,
2367 .group = FIO_OPT_G_VERIFY,
2370 .oval = VERIFY_NONE,
2371 .help = "Don't do IO verification",
2375 .help = "Use md5 checksums for verification",
2378 .oval = VERIFY_CRC64,
2379 .help = "Use crc64 checksums for verification",
2382 .oval = VERIFY_CRC32,
2383 .help = "Use crc32 checksums for verification",
2385 { .ival = "crc32c-intel",
2386 .oval = VERIFY_CRC32C,
2387 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2390 .oval = VERIFY_CRC32C,
2391 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2394 .oval = VERIFY_CRC16,
2395 .help = "Use crc16 checksums for verification",
2398 .oval = VERIFY_CRC7,
2399 .help = "Use crc7 checksums for verification",
2402 .oval = VERIFY_SHA1,
2403 .help = "Use sha1 checksums for verification",
2406 .oval = VERIFY_SHA256,
2407 .help = "Use sha256 checksums for verification",
2410 .oval = VERIFY_SHA512,
2411 .help = "Use sha512 checksums for verification",
2414 .oval = VERIFY_XXHASH,
2415 .help = "Use xxhash checksums for verification",
2417 /* Meta information was included into verify_header,
2418 * 'meta' verification is implied by default. */
2420 .oval = VERIFY_HDR_ONLY,
2421 .help = "Use io information for verification. "
2422 "Now is implied by default, thus option is obsolete, "
2425 { .ival = "pattern",
2426 .oval = VERIFY_PATTERN_NO_HDR,
2427 .help = "Verify strict pattern",
2431 .oval = VERIFY_NULL,
2432 .help = "Pretend to verify",
2437 .name = "do_verify",
2438 .lname = "Perform verify step",
2439 .type = FIO_OPT_BOOL,
2440 .off1 = td_var_offset(do_verify),
2441 .help = "Run verification stage after write",
2445 .category = FIO_OPT_C_IO,
2446 .group = FIO_OPT_G_VERIFY,
2449 .name = "verifysort",
2450 .lname = "Verify sort",
2451 .type = FIO_OPT_BOOL,
2452 .off1 = td_var_offset(verifysort),
2453 .help = "Sort written verify blocks for read back",
2457 .category = FIO_OPT_C_IO,
2458 .group = FIO_OPT_G_VERIFY,
2461 .name = "verifysort_nr",
2462 .type = FIO_OPT_INT,
2463 .off1 = td_var_offset(verifysort_nr),
2464 .help = "Pre-load and sort verify blocks for a read workload",
2469 .category = FIO_OPT_C_IO,
2470 .group = FIO_OPT_G_VERIFY,
2473 .name = "verify_interval",
2474 .lname = "Verify interval",
2475 .type = FIO_OPT_INT,
2476 .off1 = td_var_offset(verify_interval),
2477 .minval = 2 * sizeof(struct verify_header),
2478 .help = "Store verify buffer header every N bytes",
2481 .interval = 2 * sizeof(struct verify_header),
2482 .category = FIO_OPT_C_IO,
2483 .group = FIO_OPT_G_VERIFY,
2486 .name = "verify_offset",
2487 .lname = "Verify offset",
2488 .type = FIO_OPT_INT,
2489 .help = "Offset verify header location by N bytes",
2490 .off1 = td_var_offset(verify_offset),
2491 .minval = sizeof(struct verify_header),
2494 .category = FIO_OPT_C_IO,
2495 .group = FIO_OPT_G_VERIFY,
2498 .name = "verify_pattern",
2499 .lname = "Verify pattern",
2500 .type = FIO_OPT_STR,
2501 .cb = str_verify_pattern_cb,
2502 .off1 = td_var_offset(verify_pattern),
2503 .help = "Fill pattern for IO buffers",
2506 .category = FIO_OPT_C_IO,
2507 .group = FIO_OPT_G_VERIFY,
2510 .name = "verify_fatal",
2511 .lname = "Verify fatal",
2512 .type = FIO_OPT_BOOL,
2513 .off1 = td_var_offset(verify_fatal),
2515 .help = "Exit on a single verify failure, don't continue",
2518 .category = FIO_OPT_C_IO,
2519 .group = FIO_OPT_G_VERIFY,
2522 .name = "verify_dump",
2523 .lname = "Verify dump",
2524 .type = FIO_OPT_BOOL,
2525 .off1 = td_var_offset(verify_dump),
2527 .help = "Dump contents of good and bad blocks on failure",
2530 .category = FIO_OPT_C_IO,
2531 .group = FIO_OPT_G_VERIFY,
2534 .name = "verify_async",
2535 .lname = "Verify asynchronously",
2536 .type = FIO_OPT_INT,
2537 .off1 = td_var_offset(verify_async),
2539 .help = "Number of async verifier threads to use",
2542 .category = FIO_OPT_C_IO,
2543 .group = FIO_OPT_G_VERIFY,
2546 .name = "verify_backlog",
2547 .lname = "Verify backlog",
2548 .type = FIO_OPT_STR_VAL,
2549 .off1 = td_var_offset(verify_backlog),
2550 .help = "Verify after this number of blocks are written",
2553 .category = FIO_OPT_C_IO,
2554 .group = FIO_OPT_G_VERIFY,
2557 .name = "verify_backlog_batch",
2558 .lname = "Verify backlog batch",
2559 .type = FIO_OPT_INT,
2560 .off1 = td_var_offset(verify_batch),
2561 .help = "Verify this number of IO blocks",
2564 .category = FIO_OPT_C_IO,
2565 .group = FIO_OPT_G_VERIFY,
2567 #ifdef FIO_HAVE_CPU_AFFINITY
2569 .name = "verify_async_cpus",
2570 .lname = "Async verify CPUs",
2571 .type = FIO_OPT_STR,
2572 .cb = str_verify_cpus_allowed_cb,
2573 .off1 = td_var_offset(verify_cpumask),
2574 .help = "Set CPUs allowed for async verify threads",
2575 .parent = "verify_async",
2577 .category = FIO_OPT_C_IO,
2578 .group = FIO_OPT_G_VERIFY,
2582 .name = "experimental_verify",
2583 .off1 = td_var_offset(experimental_verify),
2584 .type = FIO_OPT_BOOL,
2585 .help = "Enable experimental verification",
2587 .category = FIO_OPT_C_IO,
2588 .group = FIO_OPT_G_VERIFY,
2591 .name = "verify_state_load",
2592 .lname = "Load verify state",
2593 .off1 = td_var_offset(verify_state),
2594 .type = FIO_OPT_BOOL,
2595 .help = "Load verify termination state",
2597 .category = FIO_OPT_C_IO,
2598 .group = FIO_OPT_G_VERIFY,
2601 .name = "verify_state_save",
2602 .lname = "Save verify state",
2603 .off1 = td_var_offset(verify_state_save),
2604 .type = FIO_OPT_BOOL,
2606 .help = "Save verify state on termination",
2608 .category = FIO_OPT_C_IO,
2609 .group = FIO_OPT_G_VERIFY,
2611 #ifdef FIO_HAVE_TRIM
2613 .name = "trim_percentage",
2614 .lname = "Trim percentage",
2615 .type = FIO_OPT_INT,
2616 .off1 = td_var_offset(trim_percentage),
2619 .help = "Number of verify blocks to discard/trim",
2624 .category = FIO_OPT_C_IO,
2625 .group = FIO_OPT_G_TRIM,
2628 .name = "trim_verify_zero",
2629 .lname = "Verify trim zero",
2630 .type = FIO_OPT_BOOL,
2631 .help = "Verify that trim/discarded blocks are returned as zeroes",
2632 .off1 = td_var_offset(trim_zero),
2633 .parent = "trim_percentage",
2636 .category = FIO_OPT_C_IO,
2637 .group = FIO_OPT_G_TRIM,
2640 .name = "trim_backlog",
2641 .lname = "Trim backlog",
2642 .type = FIO_OPT_STR_VAL,
2643 .off1 = td_var_offset(trim_backlog),
2644 .help = "Trim after this number of blocks are written",
2645 .parent = "trim_percentage",
2648 .category = FIO_OPT_C_IO,
2649 .group = FIO_OPT_G_TRIM,
2652 .name = "trim_backlog_batch",
2653 .lname = "Trim backlog batch",
2654 .type = FIO_OPT_INT,
2655 .off1 = td_var_offset(trim_batch),
2656 .help = "Trim this number of IO blocks",
2657 .parent = "trim_percentage",
2660 .category = FIO_OPT_C_IO,
2661 .group = FIO_OPT_G_TRIM,
2665 .name = "write_iolog",
2666 .lname = "Write I/O log",
2667 .type = FIO_OPT_STR_STORE,
2668 .off1 = td_var_offset(write_iolog_file),
2669 .help = "Store IO pattern to file",
2670 .category = FIO_OPT_C_IO,
2671 .group = FIO_OPT_G_IOLOG,
2674 .name = "read_iolog",
2675 .lname = "Read I/O log",
2676 .type = FIO_OPT_STR_STORE,
2677 .off1 = td_var_offset(read_iolog_file),
2678 .help = "Playback IO pattern from file",
2679 .category = FIO_OPT_C_IO,
2680 .group = FIO_OPT_G_IOLOG,
2683 .name = "replay_no_stall",
2684 .lname = "Don't stall on replay",
2685 .type = FIO_OPT_BOOL,
2686 .off1 = td_var_offset(no_stall),
2688 .parent = "read_iolog",
2690 .help = "Playback IO pattern file as fast as possible without stalls",
2691 .category = FIO_OPT_C_IO,
2692 .group = FIO_OPT_G_IOLOG,
2695 .name = "replay_redirect",
2696 .lname = "Redirect device for replay",
2697 .type = FIO_OPT_STR_STORE,
2698 .off1 = td_var_offset(replay_redirect),
2699 .parent = "read_iolog",
2701 .help = "Replay all I/O onto this device, regardless of trace device",
2702 .category = FIO_OPT_C_IO,
2703 .group = FIO_OPT_G_IOLOG,
2706 .name = "replay_scale",
2707 .lname = "Replace offset scale factor",
2708 .type = FIO_OPT_INT,
2709 .off1 = td_var_offset(replay_scale),
2710 .parent = "read_iolog",
2712 .help = "Align offsets to this blocksize",
2713 .category = FIO_OPT_C_IO,
2714 .group = FIO_OPT_G_IOLOG,
2717 .name = "replay_align",
2718 .lname = "Replace alignment",
2719 .type = FIO_OPT_INT,
2720 .off1 = td_var_offset(replay_align),
2721 .parent = "read_iolog",
2722 .help = "Scale offset down by this factor",
2723 .category = FIO_OPT_C_IO,
2724 .group = FIO_OPT_G_IOLOG,
2728 .name = "exec_prerun",
2729 .lname = "Pre-execute runnable",
2730 .type = FIO_OPT_STR_STORE,
2731 .off1 = td_var_offset(exec_prerun),
2732 .help = "Execute this file prior to running job",
2733 .category = FIO_OPT_C_GENERAL,
2734 .group = FIO_OPT_G_INVALID,
2737 .name = "exec_postrun",
2738 .lname = "Post-execute runnable",
2739 .type = FIO_OPT_STR_STORE,
2740 .off1 = td_var_offset(exec_postrun),
2741 .help = "Execute this file after running job",
2742 .category = FIO_OPT_C_GENERAL,
2743 .group = FIO_OPT_G_INVALID,
2745 #ifdef FIO_HAVE_IOSCHED_SWITCH
2747 .name = "ioscheduler",
2748 .lname = "I/O scheduler",
2749 .type = FIO_OPT_STR_STORE,
2750 .off1 = td_var_offset(ioscheduler),
2751 .help = "Use this IO scheduler on the backing device",
2752 .category = FIO_OPT_C_FILE,
2753 .group = FIO_OPT_G_INVALID,
2758 .lname = "Zone size",
2759 .type = FIO_OPT_STR_VAL,
2760 .off1 = td_var_offset(zone_size),
2761 .help = "Amount of data to read per zone",
2763 .interval = 1024 * 1024,
2764 .category = FIO_OPT_C_IO,
2765 .group = FIO_OPT_G_ZONE,
2768 .name = "zonerange",
2769 .lname = "Zone range",
2770 .type = FIO_OPT_STR_VAL,
2771 .off1 = td_var_offset(zone_range),
2772 .help = "Give size of an IO zone",
2774 .interval = 1024 * 1024,
2775 .category = FIO_OPT_C_IO,
2776 .group = FIO_OPT_G_ZONE,
2780 .lname = "Zone skip",
2781 .type = FIO_OPT_STR_VAL,
2782 .off1 = td_var_offset(zone_skip),
2783 .help = "Space between IO zones",
2785 .interval = 1024 * 1024,
2786 .category = FIO_OPT_C_IO,
2787 .group = FIO_OPT_G_ZONE,
2791 .lname = "Lock memory",
2792 .type = FIO_OPT_STR_VAL,
2793 .off1 = td_var_offset(lockmem),
2794 .help = "Lock down this amount of memory (per worker)",
2796 .interval = 1024 * 1024,
2797 .category = FIO_OPT_C_GENERAL,
2798 .group = FIO_OPT_G_INVALID,
2801 .name = "rwmixread",
2802 .lname = "Read/write mix read",
2803 .type = FIO_OPT_INT,
2804 .cb = str_rwmix_read_cb,
2805 .off1 = td_var_offset(rwmix[DDIR_READ]),
2807 .help = "Percentage of mixed workload that is reads",
2810 .inverse = "rwmixwrite",
2811 .category = FIO_OPT_C_IO,
2812 .group = FIO_OPT_G_RWMIX,
2815 .name = "rwmixwrite",
2816 .lname = "Read/write mix write",
2817 .type = FIO_OPT_INT,
2818 .cb = str_rwmix_write_cb,
2819 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
2821 .help = "Percentage of mixed workload that is writes",
2824 .inverse = "rwmixread",
2825 .category = FIO_OPT_C_IO,
2826 .group = FIO_OPT_G_RWMIX,
2829 .name = "rwmixcycle",
2830 .lname = "Read/write mix cycle",
2831 .type = FIO_OPT_DEPRECATED,
2832 .category = FIO_OPT_C_IO,
2833 .group = FIO_OPT_G_RWMIX,
2838 .type = FIO_OPT_INT,
2839 .off1 = td_var_offset(nice),
2840 .help = "Set job CPU nice value",
2845 .category = FIO_OPT_C_GENERAL,
2846 .group = FIO_OPT_G_CRED,
2848 #ifdef FIO_HAVE_IOPRIO
2851 .lname = "I/O nice priority",
2852 .type = FIO_OPT_INT,
2853 .off1 = td_var_offset(ioprio),
2854 .help = "Set job IO priority value",
2858 .category = FIO_OPT_C_GENERAL,
2859 .group = FIO_OPT_G_CRED,
2862 .name = "prioclass",
2863 .lname = "I/O nice priority class",
2864 .type = FIO_OPT_INT,
2865 .off1 = td_var_offset(ioprio_class),
2866 .help = "Set job IO priority class",
2870 .category = FIO_OPT_C_GENERAL,
2871 .group = FIO_OPT_G_CRED,
2875 .name = "thinktime",
2876 .lname = "Thinktime",
2877 .type = FIO_OPT_INT,
2878 .off1 = td_var_offset(thinktime),
2879 .help = "Idle time between IO buffers (usec)",
2882 .category = FIO_OPT_C_IO,
2883 .group = FIO_OPT_G_THINKTIME,
2886 .name = "thinktime_spin",
2887 .lname = "Thinktime spin",
2888 .type = FIO_OPT_INT,
2889 .off1 = td_var_offset(thinktime_spin),
2890 .help = "Start think time by spinning this amount (usec)",
2893 .parent = "thinktime",
2895 .category = FIO_OPT_C_IO,
2896 .group = FIO_OPT_G_THINKTIME,
2899 .name = "thinktime_blocks",
2900 .lname = "Thinktime blocks",
2901 .type = FIO_OPT_INT,
2902 .off1 = td_var_offset(thinktime_blocks),
2903 .help = "IO buffer period between 'thinktime'",
2905 .parent = "thinktime",
2907 .category = FIO_OPT_C_IO,
2908 .group = FIO_OPT_G_THINKTIME,
2912 .lname = "I/O rate",
2913 .type = FIO_OPT_INT,
2914 .off1 = td_var_offset(rate[DDIR_READ]),
2915 .off2 = td_var_offset(rate[DDIR_WRITE]),
2916 .off3 = td_var_offset(rate[DDIR_TRIM]),
2917 .help = "Set bandwidth rate",
2918 .category = FIO_OPT_C_IO,
2919 .group = FIO_OPT_G_RATE,
2924 .lname = "I/O min rate",
2925 .type = FIO_OPT_INT,
2926 .off1 = td_var_offset(ratemin[DDIR_READ]),
2927 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2928 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2929 .help = "Job must meet this rate or it will be shutdown",
2932 .category = FIO_OPT_C_IO,
2933 .group = FIO_OPT_G_RATE,
2936 .name = "rate_iops",
2937 .lname = "I/O rate IOPS",
2938 .type = FIO_OPT_INT,
2939 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2940 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2941 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2942 .help = "Limit IO used to this number of IO operations/sec",
2944 .category = FIO_OPT_C_IO,
2945 .group = FIO_OPT_G_RATE,
2948 .name = "rate_iops_min",
2949 .lname = "I/O min rate IOPS",
2950 .type = FIO_OPT_INT,
2951 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2952 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2953 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2954 .help = "Job must meet this rate or it will be shut down",
2955 .parent = "rate_iops",
2957 .category = FIO_OPT_C_IO,
2958 .group = FIO_OPT_G_RATE,
2961 .name = "rate_process",
2962 .lname = "Rate Process",
2963 .type = FIO_OPT_STR,
2964 .off1 = td_var_offset(rate_process),
2965 .help = "What process controls how rated IO is managed",
2967 .category = FIO_OPT_C_IO,
2968 .group = FIO_OPT_G_RATE,
2971 .oval = RATE_PROCESS_LINEAR,
2972 .help = "Linear rate of IO",
2976 .oval = RATE_PROCESS_POISSON,
2977 .help = "Rate follows Poisson process",
2983 .name = "rate_cycle",
2984 .alias = "ratecycle",
2985 .lname = "I/O rate cycle",
2986 .type = FIO_OPT_INT,
2987 .off1 = td_var_offset(ratecycle),
2988 .help = "Window average for rate limits (msec)",
2992 .category = FIO_OPT_C_IO,
2993 .group = FIO_OPT_G_RATE,
2996 .name = "max_latency",
2997 .type = FIO_OPT_INT,
2998 .off1 = td_var_offset(max_latency),
2999 .help = "Maximum tolerated IO latency (usec)",
3001 .category = FIO_OPT_C_IO,
3002 .group = FIO_OPT_G_LATPROF,
3005 .name = "latency_target",
3006 .lname = "Latency Target (usec)",
3007 .type = FIO_OPT_STR_VAL_TIME,
3008 .off1 = td_var_offset(latency_target),
3009 .help = "Ramp to max queue depth supporting this latency",
3011 .category = FIO_OPT_C_IO,
3012 .group = FIO_OPT_G_LATPROF,
3015 .name = "latency_window",
3016 .lname = "Latency Window (usec)",
3017 .type = FIO_OPT_STR_VAL_TIME,
3018 .off1 = td_var_offset(latency_window),
3019 .help = "Time to sustain latency_target",
3021 .category = FIO_OPT_C_IO,
3022 .group = FIO_OPT_G_LATPROF,
3025 .name = "latency_percentile",
3026 .lname = "Latency Percentile",
3027 .type = FIO_OPT_FLOAT_LIST,
3028 .off1 = td_var_offset(latency_percentile),
3029 .help = "Percentile of IOs must be below latency_target",
3034 .category = FIO_OPT_C_IO,
3035 .group = FIO_OPT_G_LATPROF,
3038 .name = "invalidate",
3039 .lname = "Cache invalidate",
3040 .type = FIO_OPT_BOOL,
3041 .off1 = td_var_offset(invalidate_cache),
3042 .help = "Invalidate buffer/page cache prior to running job",
3044 .category = FIO_OPT_C_IO,
3045 .group = FIO_OPT_G_IO_TYPE,
3049 .lname = "Synchronous I/O",
3050 .type = FIO_OPT_BOOL,
3051 .off1 = td_var_offset(sync_io),
3052 .help = "Use O_SYNC for buffered writes",
3054 .parent = "buffered",
3056 .category = FIO_OPT_C_IO,
3057 .group = FIO_OPT_G_IO_TYPE,
3060 .name = "create_serialize",
3061 .lname = "Create serialize",
3062 .type = FIO_OPT_BOOL,
3063 .off1 = td_var_offset(create_serialize),
3064 .help = "Serialize creating of job files",
3066 .category = FIO_OPT_C_FILE,
3067 .group = FIO_OPT_G_INVALID,
3070 .name = "create_fsync",
3071 .lname = "Create fsync",
3072 .type = FIO_OPT_BOOL,
3073 .off1 = td_var_offset(create_fsync),
3074 .help = "fsync file after creation",
3076 .category = FIO_OPT_C_FILE,
3077 .group = FIO_OPT_G_INVALID,
3080 .name = "create_on_open",
3081 .lname = "Create on open",
3082 .type = FIO_OPT_BOOL,
3083 .off1 = td_var_offset(create_on_open),
3084 .help = "Create files when they are opened for IO",
3086 .category = FIO_OPT_C_FILE,
3087 .group = FIO_OPT_G_INVALID,
3090 .name = "create_only",
3091 .type = FIO_OPT_BOOL,
3092 .off1 = td_var_offset(create_only),
3093 .help = "Only perform file creation phase",
3094 .category = FIO_OPT_C_FILE,
3098 .name = "allow_file_create",
3099 .lname = "Allow file create",
3100 .type = FIO_OPT_BOOL,
3101 .off1 = td_var_offset(allow_create),
3102 .help = "Permit fio to create files, if they don't exist",
3104 .category = FIO_OPT_C_FILE,
3105 .group = FIO_OPT_G_FILENAME,
3108 .name = "allow_mounted_write",
3109 .lname = "Allow mounted write",
3110 .type = FIO_OPT_BOOL,
3111 .off1 = td_var_offset(allow_mounted_write),
3112 .help = "Allow writes to a mounted partition",
3114 .category = FIO_OPT_C_FILE,
3115 .group = FIO_OPT_G_FILENAME,
3119 .lname = "Pre-read files",
3120 .type = FIO_OPT_BOOL,
3121 .off1 = td_var_offset(pre_read),
3122 .help = "Pre-read files before starting official testing",
3124 .category = FIO_OPT_C_FILE,
3125 .group = FIO_OPT_G_INVALID,
3127 #ifdef FIO_HAVE_CPU_AFFINITY
3130 .lname = "CPU mask",
3131 .type = FIO_OPT_INT,
3132 .cb = str_cpumask_cb,
3133 .off1 = td_var_offset(cpumask),
3134 .help = "CPU affinity mask",
3135 .category = FIO_OPT_C_GENERAL,
3136 .group = FIO_OPT_G_CRED,
3139 .name = "cpus_allowed",
3140 .lname = "CPUs allowed",
3141 .type = FIO_OPT_STR,
3142 .cb = str_cpus_allowed_cb,
3143 .off1 = td_var_offset(cpumask),
3144 .help = "Set CPUs allowed",
3145 .category = FIO_OPT_C_GENERAL,
3146 .group = FIO_OPT_G_CRED,
3149 .name = "cpus_allowed_policy",
3150 .lname = "CPUs allowed distribution policy",
3151 .type = FIO_OPT_STR,
3152 .off1 = td_var_offset(cpus_allowed_policy),
3153 .help = "Distribution policy for cpus_allowed",
3154 .parent = "cpus_allowed",
3158 .oval = FIO_CPUS_SHARED,
3159 .help = "Mask shared between threads",
3162 .oval = FIO_CPUS_SPLIT,
3163 .help = "Mask split between threads",
3166 .category = FIO_OPT_C_GENERAL,
3167 .group = FIO_OPT_G_CRED,
3170 #ifdef CONFIG_LIBNUMA
3172 .name = "numa_cpu_nodes",
3173 .type = FIO_OPT_STR,
3174 .cb = str_numa_cpunodes_cb,
3175 .off1 = td_var_offset(numa_cpunodes),
3176 .help = "NUMA CPU nodes bind",
3177 .category = FIO_OPT_C_GENERAL,
3178 .group = FIO_OPT_G_INVALID,
3181 .name = "numa_mem_policy",
3182 .type = FIO_OPT_STR,
3183 .cb = str_numa_mpol_cb,
3184 .off1 = td_var_offset(numa_memnodes),
3185 .help = "NUMA memory policy setup",
3186 .category = FIO_OPT_C_GENERAL,
3187 .group = FIO_OPT_G_INVALID,
3191 .name = "end_fsync",
3192 .lname = "End fsync",
3193 .type = FIO_OPT_BOOL,
3194 .off1 = td_var_offset(end_fsync),
3195 .help = "Include fsync at the end of job",
3197 .category = FIO_OPT_C_FILE,
3198 .group = FIO_OPT_G_INVALID,
3201 .name = "fsync_on_close",
3202 .lname = "Fsync on close",
3203 .type = FIO_OPT_BOOL,
3204 .off1 = td_var_offset(fsync_on_close),
3205 .help = "fsync files on close",
3207 .category = FIO_OPT_C_FILE,
3208 .group = FIO_OPT_G_INVALID,
3212 .lname = "Unlink file",
3213 .type = FIO_OPT_BOOL,
3214 .off1 = td_var_offset(unlink),
3215 .help = "Unlink created files after job has completed",
3217 .category = FIO_OPT_C_FILE,
3218 .group = FIO_OPT_G_INVALID,
3222 .lname = "Exit-all on terminate",
3223 .type = FIO_OPT_STR_SET,
3224 .cb = str_exitall_cb,
3225 .help = "Terminate all jobs when one exits",
3226 .category = FIO_OPT_C_GENERAL,
3227 .group = FIO_OPT_G_PROCESS,
3230 .name = "exitall_on_error",
3231 .lname = "Exit-all on terminate in error",
3232 .type = FIO_OPT_BOOL,
3233 .off1 = td_var_offset(unlink),
3234 .help = "Terminate all jobs when one exits in error",
3235 .category = FIO_OPT_C_GENERAL,
3236 .group = FIO_OPT_G_PROCESS,
3239 .name = "stonewall",
3240 .lname = "Wait for previous",
3241 .alias = "wait_for_previous",
3242 .type = FIO_OPT_STR_SET,
3243 .off1 = td_var_offset(stonewall),
3244 .help = "Insert a hard barrier between this job and previous",
3245 .category = FIO_OPT_C_GENERAL,
3246 .group = FIO_OPT_G_PROCESS,
3249 .name = "new_group",
3250 .lname = "New group",
3251 .type = FIO_OPT_STR_SET,
3252 .off1 = td_var_offset(new_group),
3253 .help = "Mark the start of a new group (for reporting)",
3254 .category = FIO_OPT_C_GENERAL,
3255 .group = FIO_OPT_G_PROCESS,
3260 .type = FIO_OPT_STR_SET,
3261 .off1 = td_var_offset(use_thread),
3262 .help = "Use threads instead of processes",
3263 #ifdef CONFIG_NO_SHM
3267 .category = FIO_OPT_C_GENERAL,
3268 .group = FIO_OPT_G_PROCESS,
3271 .name = "per_job_logs",
3272 .type = FIO_OPT_BOOL,
3273 .off1 = td_var_offset(per_job_logs),
3274 .help = "Include job number in generated log files or not",
3276 .category = FIO_OPT_C_LOG,
3277 .group = FIO_OPT_G_INVALID,
3280 .name = "write_bw_log",
3281 .lname = "Write bandwidth log",
3282 .type = FIO_OPT_STR_STORE,
3283 .off1 = td_var_offset(bw_log_file),
3284 .help = "Write log of bandwidth during run",
3285 .category = FIO_OPT_C_LOG,
3286 .group = FIO_OPT_G_INVALID,
3289 .name = "write_lat_log",
3290 .lname = "Write latency log",
3291 .type = FIO_OPT_STR_STORE,
3292 .off1 = td_var_offset(lat_log_file),
3293 .help = "Write log of latency during run",
3294 .category = FIO_OPT_C_LOG,
3295 .group = FIO_OPT_G_INVALID,
3298 .name = "write_iops_log",
3299 .lname = "Write IOPS log",
3300 .type = FIO_OPT_STR_STORE,
3301 .off1 = td_var_offset(iops_log_file),
3302 .help = "Write log of IOPS during run",
3303 .category = FIO_OPT_C_LOG,
3304 .group = FIO_OPT_G_INVALID,
3307 .name = "log_avg_msec",
3308 .lname = "Log averaging (msec)",
3309 .type = FIO_OPT_INT,
3310 .off1 = td_var_offset(log_avg_msec),
3311 .help = "Average bw/iops/lat logs over this period of time",
3313 .category = FIO_OPT_C_LOG,
3314 .group = FIO_OPT_G_INVALID,
3317 .name = "log_max_value",
3318 .lname = "Log maximum instead of average",
3319 .type = FIO_OPT_BOOL,
3320 .off1 = td_var_offset(log_max),
3321 .help = "Log max sample in a window instead of average",
3323 .category = FIO_OPT_C_LOG,
3324 .group = FIO_OPT_G_INVALID,
3327 .name = "log_offset",
3328 .lname = "Log offset of IO",
3329 .type = FIO_OPT_BOOL,
3330 .off1 = td_var_offset(log_offset),
3331 .help = "Include offset of IO for each log entry",
3333 .category = FIO_OPT_C_LOG,
3334 .group = FIO_OPT_G_INVALID,
3338 .name = "log_compression",
3339 .lname = "Log compression",
3340 .type = FIO_OPT_INT,
3341 .off1 = td_var_offset(log_gz),
3342 .help = "Log in compressed chunks of this size",
3344 .maxval = 512 * 1024 * 1024ULL,
3345 .category = FIO_OPT_C_LOG,
3346 .group = FIO_OPT_G_INVALID,
3348 #ifdef FIO_HAVE_CPU_AFFINITY
3350 .name = "log_compression_cpus",
3351 .lname = "Log Compression CPUs",
3352 .type = FIO_OPT_STR,
3353 .cb = str_log_cpus_allowed_cb,
3354 .off1 = td_var_offset(log_gz_cpumask),
3355 .parent = "log_compression",
3356 .help = "Limit log compression to these CPUs",
3357 .category = FIO_OPT_C_LOG,