11 #include <netinet/in.h>
17 #include "lib/pattern.h"
21 char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
23 struct pattern_fmt_desc fmt_desc[] = {
26 .len = FIELD_SIZE(struct io_u *, offset),
27 .paste = paste_blockoff
32 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
34 static char *get_opt_postfix(const char *str)
36 char *p = strstr(str, ":");
42 strip_blank_front(&p);
47 static int bs_cmp(const void *p1, const void *p2)
49 const struct bssplit *bsp1 = p1;
50 const struct bssplit *bsp2 = p2;
52 return (int) bsp1->perc - (int) bsp2->perc;
57 unsigned int val1[100];
58 unsigned int val2[100];
61 static int split_parse_ddir(struct thread_options *o, struct split *split,
62 enum fio_ddir ddir, char *str)
71 while ((fname = strsep(&str, ":")) != NULL) {
77 perc_str = strstr(fname, "/");
81 perc = atoi(perc_str);
89 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
90 log_err("fio: bssplit conversion failed\n");
95 split->val2[i] = perc;
105 static int bssplit_ddir(struct thread_options *o, enum fio_ddir ddir, char *str)
107 unsigned int i, perc, perc_missing;
108 unsigned int max_bs, min_bs;
111 memset(&split, 0, sizeof(split));
113 if (split_parse_ddir(o, &split, ddir, str))
120 o->bssplit[ddir] = malloc(split.nr * sizeof(struct bssplit));
121 o->bssplit_nr[ddir] = split.nr;
122 for (i = 0; i < split.nr; i++) {
123 if (split.val1[i] > max_bs)
124 max_bs = split.val1[i];
125 if (split.val1[i] < min_bs)
126 min_bs = split.val1[i];
128 o->bssplit[ddir][i].bs = split.val1[i];
129 o->bssplit[ddir][i].perc =split.val2[i];
133 * Now check if the percentages add up, and how much is missing
135 perc = perc_missing = 0;
136 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
137 struct bssplit *bsp = &o->bssplit[ddir][i];
139 if (bsp->perc == -1U)
145 if (perc > 100 && perc_missing > 1) {
146 log_err("fio: bssplit percentages add to more than 100%%\n");
147 free(o->bssplit[ddir]);
148 o->bssplit[ddir] = NULL;
153 * If values didn't have a percentage set, divide the remains between
157 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
159 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
160 struct bssplit *bsp = &o->bssplit[ddir][i];
162 if (bsp->perc == -1U)
163 bsp->perc = (100 - perc) / perc_missing;
167 o->min_bs[ddir] = min_bs;
168 o->max_bs[ddir] = max_bs;
171 * now sort based on percentages, for ease of lookup
173 qsort(o->bssplit[ddir], o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
177 typedef int (split_parse_fn)(struct thread_options *, enum fio_ddir, char *);
179 static int str_split_parse(struct thread_data *td, char *str, split_parse_fn *fn)
184 odir = strchr(str, ',');
186 ddir = strchr(odir + 1, ',');
188 ret = fn(&td->o, DDIR_TRIM, ddir + 1);
194 op = strdup(odir + 1);
195 ret = fn(&td->o, DDIR_TRIM, op);
200 ret = fn(&td->o, DDIR_WRITE, odir + 1);
203 ret = fn(&td->o, DDIR_READ, str);
209 ret = fn(&td->o, DDIR_WRITE, op);
214 ret = fn(&td->o, DDIR_TRIM, op);
218 ret = fn(&td->o, DDIR_READ, str);
224 static int str_bssplit_cb(void *data, const char *input)
226 struct thread_data *td = data;
230 p = str = strdup(input);
232 strip_blank_front(&str);
233 strip_blank_end(str);
235 ret = str_split_parse(td, str, bssplit_ddir);
237 if (parse_dryrun()) {
240 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
241 free(td->o.bssplit[i]);
242 td->o.bssplit[i] = NULL;
243 td->o.bssplit_nr[i] = 0;
251 static int str2error(char *str)
253 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
254 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
255 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
256 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
257 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
258 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
259 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
260 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
261 int i = 0, num = sizeof(err) / sizeof(char *);
264 if (!strcmp(err[i], str))
271 static int ignore_error_type(struct thread_data *td, int etype, char *str)
277 if (etype >= ERROR_TYPE_CNT) {
278 log_err("Illegal error type\n");
282 td->o.ignore_error_nr[etype] = 4;
283 error = malloc(4 * sizeof(struct bssplit));
286 while ((fname = strsep(&str, ":")) != NULL) {
292 * grow struct buffer, if needed
294 if (i == td->o.ignore_error_nr[etype]) {
295 td->o.ignore_error_nr[etype] <<= 1;
296 error = realloc(error, td->o.ignore_error_nr[etype]
299 if (fname[0] == 'E') {
300 error[i] = str2error(fname);
302 error[i] = atoi(fname);
304 error[i] = -error[i];
307 log_err("Unknown error %s, please use number value \n",
315 td->o.continue_on_error |= 1 << etype;
316 td->o.ignore_error_nr[etype] = i;
317 td->o.ignore_error[etype] = error;
325 static int str_ignore_error_cb(void *data, const char *input)
327 struct thread_data *td = data;
329 int type = 0, ret = 1;
334 p = str = strdup(input);
336 strip_blank_front(&str);
337 strip_blank_end(str);
343 ret = ignore_error_type(td, type, p);
353 static int str_rw_cb(void *data, const char *str)
355 struct thread_data *td = data;
356 struct thread_options *o = &td->o;
365 nr = get_opt_postfix(str);
370 o->ddir_seq_nr = atoi(nr);
374 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
375 log_err("fio: rw postfix parsing failed\n");
380 o->ddir_seq_add = val;
387 static int str_mem_cb(void *data, const char *mem)
389 struct thread_data *td = data;
391 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
392 td->o.mem_type == MEM_MMAPSHARED)
393 td->o.mmapfile = get_opt_postfix(mem);
398 static int fio_clock_source_cb(void *data, const char *str)
400 struct thread_data *td = data;
402 fio_clock_source = td->o.clocksource;
403 fio_clock_source_set = 1;
408 static int str_rwmix_read_cb(void *data, unsigned long long *val)
410 struct thread_data *td = data;
412 td->o.rwmix[DDIR_READ] = *val;
413 td->o.rwmix[DDIR_WRITE] = 100 - *val;
417 static int str_rwmix_write_cb(void *data, unsigned long long *val)
419 struct thread_data *td = data;
421 td->o.rwmix[DDIR_WRITE] = *val;
422 td->o.rwmix[DDIR_READ] = 100 - *val;
426 static int str_exitall_cb(void)
428 exitall_on_terminate = 1;
432 #ifdef FIO_HAVE_CPU_AFFINITY
433 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
435 unsigned int i, index, cpus_in_mask;
436 const long max_cpu = cpus_online();
438 cpus_in_mask = fio_cpu_count(mask);
439 cpu_index = cpu_index % cpus_in_mask;
442 for (i = 0; i < max_cpu; i++) {
443 if (!fio_cpu_isset(mask, i))
446 if (cpu_index != index)
447 fio_cpu_clear(mask, i);
452 return fio_cpu_count(mask);
455 static int str_cpumask_cb(void *data, unsigned long long *val)
457 struct thread_data *td = data;
465 ret = fio_cpuset_init(&td->o.cpumask);
467 log_err("fio: cpuset_init failed\n");
468 td_verror(td, ret, "fio_cpuset_init");
472 max_cpu = cpus_online();
474 for (i = 0; i < sizeof(int) * 8; i++) {
475 if ((1 << i) & *val) {
477 log_err("fio: CPU %d too large (max=%ld)\n", i,
481 dprint(FD_PARSE, "set cpu allowed %d\n", i);
482 fio_cpu_set(&td->o.cpumask, i);
489 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
496 ret = fio_cpuset_init(mask);
498 log_err("fio: cpuset_init failed\n");
499 td_verror(td, ret, "fio_cpuset_init");
503 p = str = strdup(input);
505 strip_blank_front(&str);
506 strip_blank_end(str);
508 max_cpu = cpus_online();
510 while ((cpu = strsep(&str, ",")) != NULL) {
519 while ((cpu2 = strsep(&str2, "-")) != NULL) {
529 while (icpu <= icpu2) {
530 if (icpu >= FIO_MAX_CPUS) {
531 log_err("fio: your OS only supports up to"
532 " %d CPUs\n", (int) FIO_MAX_CPUS);
536 if (icpu >= max_cpu) {
537 log_err("fio: CPU %d too large (max=%ld)\n",
543 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
544 fio_cpu_set(mask, icpu);
555 static int str_cpus_allowed_cb(void *data, const char *input)
557 struct thread_data *td = data;
562 return set_cpus_allowed(td, &td->o.cpumask, input);
565 static int str_verify_cpus_allowed_cb(void *data, const char *input)
567 struct thread_data *td = data;
572 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
576 static int str_log_cpus_allowed_cb(void *data, const char *input)
578 struct thread_data *td = data;
583 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
585 #endif /* CONFIG_ZLIB */
587 #endif /* FIO_HAVE_CPU_AFFINITY */
589 #ifdef CONFIG_LIBNUMA
590 static int str_numa_cpunodes_cb(void *data, char *input)
592 struct thread_data *td = data;
593 struct bitmask *verify_bitmask;
598 /* numa_parse_nodestring() parses a character string list
599 * of nodes into a bit mask. The bit mask is allocated by
600 * numa_allocate_nodemask(), so it should be freed by
601 * numa_free_nodemask().
603 verify_bitmask = numa_parse_nodestring(input);
604 if (verify_bitmask == NULL) {
605 log_err("fio: numa_parse_nodestring failed\n");
606 td_verror(td, 1, "str_numa_cpunodes_cb");
609 numa_free_nodemask(verify_bitmask);
611 td->o.numa_cpunodes = strdup(input);
615 static int str_numa_mpol_cb(void *data, char *input)
617 struct thread_data *td = data;
618 const char * const policy_types[] =
619 { "default", "prefer", "bind", "interleave", "local", NULL };
622 struct bitmask *verify_bitmask;
627 nodelist = strchr(input, ':');
629 /* NUL-terminate mode */
633 for (i = 0; i <= MPOL_LOCAL; i++) {
634 if (!strcmp(input, policy_types[i])) {
635 td->o.numa_mem_mode = i;
639 if (i > MPOL_LOCAL) {
640 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
644 switch (td->o.numa_mem_mode) {
647 * Insist on a nodelist of one node only
650 char *rest = nodelist;
651 while (isdigit(*rest))
654 log_err("fio: one node only for \'prefer\'\n");
658 log_err("fio: one node is needed for \'prefer\'\n");
662 case MPOL_INTERLEAVE:
664 * Default to online nodes with memory if no nodelist
667 nodelist = strdup("all");
672 * Don't allow a nodelist
675 log_err("fio: NO nodelist for \'local\'\n");
681 * Insist on a nodelist
684 log_err("fio: a nodelist is needed for \'bind\'\n");
691 /* numa_parse_nodestring() parses a character string list
692 * of nodes into a bit mask. The bit mask is allocated by
693 * numa_allocate_nodemask(), so it should be freed by
694 * numa_free_nodemask().
696 switch (td->o.numa_mem_mode) {
698 td->o.numa_mem_prefer_node = atoi(nodelist);
700 case MPOL_INTERLEAVE:
702 verify_bitmask = numa_parse_nodestring(nodelist);
703 if (verify_bitmask == NULL) {
704 log_err("fio: numa_parse_nodestring failed\n");
705 td_verror(td, 1, "str_numa_memnodes_cb");
708 td->o.numa_memnodes = strdup(nodelist);
709 numa_free_nodemask(verify_bitmask);
724 static int str_fst_cb(void *data, const char *str)
726 struct thread_data *td = data;
731 td->file_service_nr = 1;
733 switch (td->o.file_service_type) {
734 case FIO_FSERVICE_RANDOM:
735 case FIO_FSERVICE_RR:
736 case FIO_FSERVICE_SEQ:
737 nr = get_opt_postfix(str);
739 td->file_service_nr = atoi(nr);
744 case FIO_FSERVICE_ZIPF:
747 case FIO_FSERVICE_PARETO:
748 val = FIO_DEF_PARETO;
750 case FIO_FSERVICE_GAUSS:
754 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
761 nr = get_opt_postfix(str);
762 if (nr && !str_to_float(nr, &val, 0)) {
763 log_err("fio: file service type random postfix parsing failed\n");
770 switch (td->o.file_service_type) {
771 case FIO_FSERVICE_ZIPF:
773 log_err("fio: zipf theta must be different than 1.0\n");
778 td->zipf_theta = val;
780 case FIO_FSERVICE_PARETO:
781 if (val <= 0.00 || val >= 1.00) {
782 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
789 case FIO_FSERVICE_GAUSS:
790 if (val < 0.00 || val >= 100.00) {
791 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
803 #ifdef CONFIG_SYNC_FILE_RANGE
804 static int str_sfr_cb(void *data, const char *str)
806 struct thread_data *td = data;
807 char *nr = get_opt_postfix(str);
809 td->sync_file_range_nr = 1;
811 td->sync_file_range_nr = atoi(nr);
819 static int zone_cmp(const void *p1, const void *p2)
821 const struct zone_split *zsp1 = p1;
822 const struct zone_split *zsp2 = p2;
824 return (int) zsp2->access_perc - (int) zsp1->access_perc;
827 static int zone_split_ddir(struct thread_options *o, enum fio_ddir ddir,
830 unsigned int i, perc, perc_missing, sperc, sperc_missing;
833 memset(&split, 0, sizeof(split));
835 if (split_parse_ddir(o, &split, ddir, str))
840 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
841 o->zone_split_nr[ddir] = split.nr;
842 for (i = 0; i < split.nr; i++) {
843 o->zone_split[ddir][i].access_perc = split.val1[i];
844 o->zone_split[ddir][i].size_perc = split.val2[i];
848 * Now check if the percentages add up, and how much is missing
850 perc = perc_missing = 0;
851 sperc = sperc_missing = 0;
852 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
853 struct zone_split *zsp = &o->zone_split[ddir][i];
855 if (zsp->access_perc == (uint8_t) -1U)
858 perc += zsp->access_perc;
860 if (zsp->size_perc == (uint8_t) -1U)
863 sperc += zsp->size_perc;
867 if (perc > 100 || sperc > 100) {
868 log_err("fio: zone_split percentages add to more than 100%%\n");
869 free(o->zone_split[ddir]);
870 o->zone_split[ddir] = NULL;
874 log_err("fio: access percentage don't add up to 100 for zoned "
875 "random distribution (got=%u)\n", perc);
876 free(o->zone_split[ddir]);
877 o->zone_split[ddir] = NULL;
882 * If values didn't have a percentage set, divide the remains between
886 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
888 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
889 struct zone_split *zsp = &o->zone_split[ddir][i];
891 if (zsp->access_perc == (uint8_t) -1U)
892 zsp->access_perc = (100 - perc) / perc_missing;
896 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
898 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
899 struct zone_split *zsp = &o->zone_split[ddir][i];
901 if (zsp->size_perc == (uint8_t) -1U)
902 zsp->size_perc = (100 - sperc) / sperc_missing;
907 * now sort based on percentages, for ease of lookup
909 qsort(o->zone_split[ddir], o->zone_split_nr[ddir], sizeof(struct zone_split), zone_cmp);
913 static void __td_zone_gen_index(struct thread_data *td, enum fio_ddir ddir)
915 unsigned int i, j, sprev, aprev;
917 td->zone_state_index[ddir] = malloc(sizeof(struct zone_split_index) * 100);
920 for (i = 0; i < td->o.zone_split_nr[ddir]; i++) {
921 struct zone_split *zsp = &td->o.zone_split[ddir][i];
923 for (j = aprev; j < aprev + zsp->access_perc; j++) {
924 struct zone_split_index *zsi = &td->zone_state_index[ddir][j];
926 zsi->size_perc = sprev + zsp->size_perc;
927 zsi->size_perc_prev = sprev;
930 aprev += zsp->access_perc;
931 sprev += zsp->size_perc;
936 * Generate state table for indexes, so we don't have to do it inline from
939 static void td_zone_gen_index(struct thread_data *td)
943 td->zone_state_index = malloc(DDIR_RWDIR_CNT *
944 sizeof(struct zone_split_index *));
946 for (i = 0; i < DDIR_RWDIR_CNT; i++)
947 __td_zone_gen_index(td, i);
950 static int parse_zoned_distribution(struct thread_data *td, const char *input)
955 p = str = strdup(input);
957 strip_blank_front(&str);
958 strip_blank_end(str);
960 /* We expect it to start like that, bail if not */
961 if (strncmp(str, "zoned:", 6)) {
962 log_err("fio: mismatch in zoned input <%s>\n", str);
966 str += strlen("zoned:");
968 ret = str_split_parse(td, str, zone_split_ddir);
972 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
975 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
977 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
978 struct zone_split *zsp = &td->o.zone_split[i][j];
980 dprint(FD_PARSE, "\t%d: %u/%u\n", j, zsp->access_perc,
985 if (parse_dryrun()) {
988 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
989 free(td->o.zone_split[i]);
990 td->o.zone_split[i] = NULL;
991 td->o.zone_split_nr[i] = 0;
998 td_zone_gen_index(td);
1000 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1001 td->o.zone_split_nr[i] = 0;
1007 static int str_random_distribution_cb(void *data, const char *str)
1009 struct thread_data *td = data;
1013 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1015 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1016 val = FIO_DEF_PARETO;
1017 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1019 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1020 return parse_zoned_distribution(td, str);
1024 nr = get_opt_postfix(str);
1025 if (nr && !str_to_float(nr, &val, 0)) {
1026 log_err("fio: random postfix parsing failed\n");
1033 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1035 log_err("fio: zipf theta must different than 1.0\n");
1040 td->o.zipf_theta.u.f = val;
1041 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1042 if (val <= 0.00 || val >= 1.00) {
1043 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1048 td->o.pareto_h.u.f = val;
1050 if (val < 0.00 || val >= 100.0) {
1051 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1056 td->o.gauss_dev.u.f = val;
1063 * Return next name in the string. Files are separated with ':'. If the ':'
1064 * is escaped with a '\', then that ':' is part of the filename and does not
1065 * indicate a new file.
1067 static char *get_next_name(char **ptr)
1072 if (!str || !strlen(str))
1078 * No colon, we are done
1080 p = strchr(str, ':');
1087 * We got a colon, but it's the first character. Skip and
1095 if (*(p - 1) != '\\') {
1101 memmove(p - 1, p, strlen(p) + 1);
1109 static int get_max_name_idx(char *input)
1111 unsigned int cur_idx;
1114 p = str = strdup(input);
1115 for (cur_idx = 0; ; cur_idx++)
1116 if (get_next_name(&str) == NULL)
1124 * Returns the directory at the index, indexes > entires will be
1125 * assigned via modulo division of the index
1127 int set_name_idx(char *target, size_t tlen, char *input, int index,
1128 bool unique_filename)
1130 unsigned int cur_idx;
1132 char *fname, *str, *p;
1134 p = str = strdup(input);
1136 index %= get_max_name_idx(input);
1137 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1138 fname = get_next_name(&str);
1140 if (client_sockaddr_str[0] && unique_filename) {
1141 len = snprintf(target, tlen, "%s/%s.", fname,
1142 client_sockaddr_str);
1144 len = snprintf(target, tlen, "%s/", fname);
1146 target[tlen - 1] = '\0';
1152 static int str_filename_cb(void *data, const char *input)
1154 struct thread_data *td = data;
1155 char *fname, *str, *p;
1157 p = str = strdup(input);
1159 strip_blank_front(&str);
1160 strip_blank_end(str);
1162 if (!td->files_index)
1165 while ((fname = get_next_name(&str)) != NULL) {
1168 add_file(td, fname, 0, 1);
1175 static int str_directory_cb(void *data, const char fio_unused *unused)
1177 struct thread_data *td = data;
1179 char *dirname, *str, *p;
1185 p = str = strdup(td->o.directory);
1186 while ((dirname = get_next_name(&str)) != NULL) {
1187 if (lstat(dirname, &sb) < 0) {
1190 log_err("fio: %s is not a directory\n", dirname);
1191 td_verror(td, ret, "lstat");
1194 if (!S_ISDIR(sb.st_mode)) {
1195 log_err("fio: %s is not a directory\n", dirname);
1206 static int str_opendir_cb(void *data, const char fio_unused *str)
1208 struct thread_data *td = data;
1213 if (!td->files_index)
1216 return add_dir_files(td, td->o.opendir);
1219 static int str_buffer_pattern_cb(void *data, const char *input)
1221 struct thread_data *td = data;
1224 /* FIXME: for now buffer pattern does not support formats */
1225 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
1226 MAX_PATTERN_SIZE, NULL, 0, NULL, NULL);
1231 td->o.buffer_pattern_bytes = ret;
1232 if (!td->o.compress_percentage)
1233 td->o.refill_buffers = 0;
1234 td->o.scramble_buffers = 0;
1235 td->o.zero_buffers = 0;
1240 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1242 struct thread_data *td = data;
1244 td->flags |= TD_F_COMPRESS;
1245 td->o.compress_percentage = *il;
1249 static int str_dedupe_cb(void *data, unsigned long long *il)
1251 struct thread_data *td = data;
1253 td->flags |= TD_F_COMPRESS;
1254 td->o.dedupe_percentage = *il;
1255 td->o.refill_buffers = 1;
1259 static int str_verify_pattern_cb(void *data, const char *input)
1261 struct thread_data *td = data;
1264 td->o.verify_fmt_sz = ARRAY_SIZE(td->o.verify_fmt);
1265 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
1266 MAX_PATTERN_SIZE, fmt_desc, sizeof(fmt_desc),
1267 td->o.verify_fmt, &td->o.verify_fmt_sz);
1272 td->o.verify_pattern_bytes = ret;
1274 * VERIFY_* could already be set
1276 if (!fio_option_is_set(&td->o, verify))
1277 td->o.verify = VERIFY_PATTERN;
1282 static int str_gtod_reduce_cb(void *data, int *il)
1284 struct thread_data *td = data;
1287 td->o.disable_lat = !!val;
1288 td->o.disable_clat = !!val;
1289 td->o.disable_slat = !!val;
1290 td->o.disable_bw = !!val;
1291 td->o.clat_percentiles = !val;
1293 td->tv_cache_mask = 63;
1298 static int str_size_cb(void *data, unsigned long long *__val)
1300 struct thread_data *td = data;
1301 unsigned long long v = *__val;
1303 if (parse_is_percent(v)) {
1305 td->o.size_percent = -1ULL - v;
1312 static int rw_verify(struct fio_option *o, void *data)
1314 struct thread_data *td = data;
1316 if (read_only && td_write(td)) {
1317 log_err("fio: job <%s> has write bit set, but fio is in"
1318 " read-only mode\n", td->o.name);
1325 static int gtod_cpu_verify(struct fio_option *o, void *data)
1327 #ifndef FIO_HAVE_CPU_AFFINITY
1328 struct thread_data *td = data;
1330 if (td->o.gtod_cpu) {
1331 log_err("fio: platform must support CPU affinity for"
1332 "gettimeofday() offloading\n");
1341 * Map of job/command line options
1343 struct fio_option fio_options[FIO_MAX_OPTS] = {
1345 .name = "description",
1346 .lname = "Description of job",
1347 .type = FIO_OPT_STR_STORE,
1348 .off1 = td_var_offset(description),
1349 .help = "Text job description",
1350 .category = FIO_OPT_C_GENERAL,
1351 .group = FIO_OPT_G_DESC,
1355 .lname = "Job name",
1356 .type = FIO_OPT_STR_STORE,
1357 .off1 = td_var_offset(name),
1358 .help = "Name of this job",
1359 .category = FIO_OPT_C_GENERAL,
1360 .group = FIO_OPT_G_DESC,
1364 .lname = "Waitee name",
1365 .type = FIO_OPT_STR_STORE,
1366 .off1 = td_var_offset(wait_for),
1367 .help = "Name of the job this one wants to wait for before starting",
1368 .category = FIO_OPT_C_GENERAL,
1369 .group = FIO_OPT_G_DESC,
1373 .lname = "Filename(s)",
1374 .type = FIO_OPT_STR_STORE,
1375 .off1 = td_var_offset(filename),
1376 .cb = str_filename_cb,
1377 .prio = -1, /* must come after "directory" */
1378 .help = "File(s) to use for the workload",
1379 .category = FIO_OPT_C_FILE,
1380 .group = FIO_OPT_G_FILENAME,
1383 .name = "directory",
1384 .lname = "Directory",
1385 .type = FIO_OPT_STR_STORE,
1386 .off1 = td_var_offset(directory),
1387 .cb = str_directory_cb,
1388 .help = "Directory to store files in",
1389 .category = FIO_OPT_C_FILE,
1390 .group = FIO_OPT_G_FILENAME,
1393 .name = "filename_format",
1394 .lname = "Filename Format",
1395 .type = FIO_OPT_STR_STORE,
1396 .off1 = td_var_offset(filename_format),
1397 .prio = -1, /* must come after "directory" */
1398 .help = "Override default $jobname.$jobnum.$filenum naming",
1399 .def = "$jobname.$jobnum.$filenum",
1400 .category = FIO_OPT_C_FILE,
1401 .group = FIO_OPT_G_FILENAME,
1404 .name = "unique_filename",
1405 .lname = "Unique Filename",
1406 .type = FIO_OPT_BOOL,
1407 .off1 = td_var_offset(unique_filename),
1408 .help = "For network clients, prefix file with source IP",
1410 .category = FIO_OPT_C_FILE,
1411 .group = FIO_OPT_G_FILENAME,
1415 .lname = "Lockfile",
1416 .type = FIO_OPT_STR,
1417 .off1 = td_var_offset(file_lock_mode),
1418 .help = "Lock file when doing IO to it",
1420 .parent = "filename",
1423 .category = FIO_OPT_C_FILE,
1424 .group = FIO_OPT_G_FILENAME,
1427 .oval = FILE_LOCK_NONE,
1428 .help = "No file locking",
1430 { .ival = "exclusive",
1431 .oval = FILE_LOCK_EXCLUSIVE,
1432 .help = "Exclusive file lock",
1435 .ival = "readwrite",
1436 .oval = FILE_LOCK_READWRITE,
1437 .help = "Read vs write lock",
1443 .lname = "Open directory",
1444 .type = FIO_OPT_STR_STORE,
1445 .off1 = td_var_offset(opendir),
1446 .cb = str_opendir_cb,
1447 .help = "Recursively add files from this directory and down",
1448 .category = FIO_OPT_C_FILE,
1449 .group = FIO_OPT_G_FILENAME,
1453 .lname = "Read/write",
1454 .alias = "readwrite",
1455 .type = FIO_OPT_STR,
1457 .off1 = td_var_offset(td_ddir),
1458 .help = "IO direction",
1460 .verify = rw_verify,
1461 .category = FIO_OPT_C_IO,
1462 .group = FIO_OPT_G_IO_BASIC,
1465 .oval = TD_DDIR_READ,
1466 .help = "Sequential read",
1469 .oval = TD_DDIR_WRITE,
1470 .help = "Sequential write",
1473 .oval = TD_DDIR_TRIM,
1474 .help = "Sequential trim",
1476 { .ival = "randread",
1477 .oval = TD_DDIR_RANDREAD,
1478 .help = "Random read",
1480 { .ival = "randwrite",
1481 .oval = TD_DDIR_RANDWRITE,
1482 .help = "Random write",
1484 { .ival = "randtrim",
1485 .oval = TD_DDIR_RANDTRIM,
1486 .help = "Random trim",
1490 .help = "Sequential read and write mix",
1492 { .ival = "readwrite",
1494 .help = "Sequential read and write mix",
1497 .oval = TD_DDIR_RANDRW,
1498 .help = "Random read and write mix"
1500 { .ival = "trimwrite",
1501 .oval = TD_DDIR_TRIMWRITE,
1502 .help = "Trim and write mix, trims preceding writes"
1507 .name = "rw_sequencer",
1508 .lname = "RW Sequencer",
1509 .type = FIO_OPT_STR,
1510 .off1 = td_var_offset(rw_seq),
1511 .help = "IO offset generator modifier",
1512 .def = "sequential",
1513 .category = FIO_OPT_C_IO,
1514 .group = FIO_OPT_G_IO_BASIC,
1516 { .ival = "sequential",
1518 .help = "Generate sequential offsets",
1520 { .ival = "identical",
1521 .oval = RW_SEQ_IDENT,
1522 .help = "Generate identical offsets",
1529 .lname = "IO Engine",
1530 .type = FIO_OPT_STR_STORE,
1531 .off1 = td_var_offset(ioengine),
1532 .help = "IO engine to use",
1533 .def = FIO_PREFERRED_ENGINE,
1534 .category = FIO_OPT_C_IO,
1535 .group = FIO_OPT_G_IO_BASIC,
1538 .help = "Use read/write",
1541 .help = "Use pread/pwrite",
1544 .help = "Use readv/writev",
1546 #ifdef CONFIG_PWRITEV
1548 .help = "Use preadv/pwritev",
1551 #ifdef FIO_HAVE_PWRITEV2
1552 { .ival = "pvsync2",
1553 .help = "Use preadv2/pwritev2",
1556 #ifdef CONFIG_LIBAIO
1558 .help = "Linux native asynchronous IO",
1561 #ifdef CONFIG_POSIXAIO
1562 { .ival = "posixaio",
1563 .help = "POSIX asynchronous IO",
1566 #ifdef CONFIG_SOLARISAIO
1567 { .ival = "solarisaio",
1568 .help = "Solaris native asynchronous IO",
1571 #ifdef CONFIG_WINDOWSAIO
1572 { .ival = "windowsaio",
1573 .help = "Windows native asynchronous IO"
1578 .help = "Rados Block Device asynchronous IO"
1582 .help = "Memory mapped IO"
1584 #ifdef CONFIG_LINUX_SPLICE
1586 .help = "splice/vmsplice based IO",
1588 { .ival = "netsplice",
1589 .help = "splice/vmsplice to/from the network",
1592 #ifdef FIO_HAVE_SGIO
1594 .help = "SCSI generic v3 IO",
1598 .help = "Testing engine (no data transfer)",
1601 .help = "Network IO",
1604 .help = "CPU cycle burner engine",
1608 .help = "GUASI IO engine",
1611 #ifdef FIO_HAVE_BINJECT
1612 { .ival = "binject",
1613 .help = "binject direct inject block engine",
1618 .help = "RDMA IO engine",
1621 #ifdef CONFIG_FUSION_AW
1622 { .ival = "fusion-aw-sync",
1623 .help = "Fusion-io atomic write engine",
1626 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1627 { .ival = "e4defrag",
1628 .help = "ext4 defrag engine",
1631 #ifdef CONFIG_LINUX_FALLOCATE
1633 .help = "fallocate() file based engine",
1638 .help = "Glusterfs libgfapi(sync) based engine"
1640 { .ival = "gfapi_async",
1641 .help = "Glusterfs libgfapi(async) based engine"
1644 #ifdef CONFIG_LIBHDFS
1645 { .ival = "libhdfs",
1646 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1649 #ifdef CONFIG_PMEMBLK
1650 { .ival = "pmemblk",
1651 .help = "NVML libpmemblk based IO engine",
1655 { .ival = "external",
1656 .help = "Load external engine (append name)",
1662 .lname = "IO Depth",
1663 .type = FIO_OPT_INT,
1664 .off1 = td_var_offset(iodepth),
1665 .help = "Number of IO buffers to keep in flight",
1669 .category = FIO_OPT_C_IO,
1670 .group = FIO_OPT_G_IO_BASIC,
1673 .name = "iodepth_batch",
1674 .lname = "IO Depth batch",
1675 .alias = "iodepth_batch_submit",
1676 .type = FIO_OPT_INT,
1677 .off1 = td_var_offset(iodepth_batch),
1678 .help = "Number of IO buffers to submit in one go",
1679 .parent = "iodepth",
1683 .category = FIO_OPT_C_IO,
1684 .group = FIO_OPT_G_IO_BASIC,
1687 .name = "iodepth_batch_complete_min",
1688 .lname = "Min IO depth batch complete",
1689 .alias = "iodepth_batch_complete",
1690 .type = FIO_OPT_INT,
1691 .off1 = td_var_offset(iodepth_batch_complete_min),
1692 .help = "Min number of IO buffers to retrieve in one go",
1693 .parent = "iodepth",
1698 .category = FIO_OPT_C_IO,
1699 .group = FIO_OPT_G_IO_BASIC,
1702 .name = "iodepth_batch_complete_max",
1703 .lname = "Max IO depth batch complete",
1704 .type = FIO_OPT_INT,
1705 .off1 = td_var_offset(iodepth_batch_complete_max),
1706 .help = "Max number of IO buffers to retrieve in one go",
1707 .parent = "iodepth",
1711 .category = FIO_OPT_C_IO,
1712 .group = FIO_OPT_G_IO_BASIC,
1715 .name = "iodepth_low",
1716 .lname = "IO Depth batch low",
1717 .type = FIO_OPT_INT,
1718 .off1 = td_var_offset(iodepth_low),
1719 .help = "Low water mark for queuing depth",
1720 .parent = "iodepth",
1723 .category = FIO_OPT_C_IO,
1724 .group = FIO_OPT_G_IO_BASIC,
1727 .name = "io_submit_mode",
1728 .lname = "IO submit mode",
1729 .type = FIO_OPT_STR,
1730 .off1 = td_var_offset(io_submit_mode),
1731 .help = "How IO submissions and completions are done",
1733 .category = FIO_OPT_C_IO,
1734 .group = FIO_OPT_G_IO_BASIC,
1737 .oval = IO_MODE_INLINE,
1738 .help = "Submit and complete IO inline",
1740 { .ival = "offload",
1741 .oval = IO_MODE_OFFLOAD,
1742 .help = "Offload submit and complete to threads",
1749 .type = FIO_OPT_STR_VAL,
1751 .off1 = td_var_offset(size),
1752 .help = "Total size of device or files",
1753 .interval = 1024 * 1024,
1754 .category = FIO_OPT_C_IO,
1755 .group = FIO_OPT_G_INVALID,
1759 .alias = "io_limit",
1761 .type = FIO_OPT_STR_VAL,
1762 .off1 = td_var_offset(io_limit),
1763 .interval = 1024 * 1024,
1764 .category = FIO_OPT_C_IO,
1765 .group = FIO_OPT_G_INVALID,
1768 .name = "fill_device",
1769 .lname = "Fill device",
1771 .type = FIO_OPT_BOOL,
1772 .off1 = td_var_offset(fill_device),
1773 .help = "Write until an ENOSPC error occurs",
1775 .category = FIO_OPT_C_FILE,
1776 .group = FIO_OPT_G_INVALID,
1780 .lname = "File size",
1781 .type = FIO_OPT_STR_VAL,
1782 .off1 = td_var_offset(file_size_low),
1783 .off2 = td_var_offset(file_size_high),
1785 .help = "Size of individual files",
1786 .interval = 1024 * 1024,
1787 .category = FIO_OPT_C_FILE,
1788 .group = FIO_OPT_G_INVALID,
1791 .name = "file_append",
1792 .lname = "File append",
1793 .type = FIO_OPT_BOOL,
1794 .off1 = td_var_offset(file_append),
1795 .help = "IO will start at the end of the file(s)",
1797 .category = FIO_OPT_C_FILE,
1798 .group = FIO_OPT_G_INVALID,
1802 .lname = "IO offset",
1803 .alias = "fileoffset",
1804 .type = FIO_OPT_STR_VAL,
1805 .off1 = td_var_offset(start_offset),
1806 .help = "Start IO from this offset",
1808 .interval = 1024 * 1024,
1809 .category = FIO_OPT_C_IO,
1810 .group = FIO_OPT_G_INVALID,
1813 .name = "offset_increment",
1814 .lname = "IO offset increment",
1815 .type = FIO_OPT_STR_VAL,
1816 .off1 = td_var_offset(offset_increment),
1817 .help = "What is the increment from one offset to the next",
1821 .interval = 1024 * 1024,
1822 .category = FIO_OPT_C_IO,
1823 .group = FIO_OPT_G_INVALID,
1826 .name = "number_ios",
1827 .lname = "Number of IOs to perform",
1828 .type = FIO_OPT_STR_VAL,
1829 .off1 = td_var_offset(number_ios),
1830 .help = "Force job completion after this number of IOs",
1832 .category = FIO_OPT_C_IO,
1833 .group = FIO_OPT_G_INVALID,
1837 .lname = "Block size",
1838 .alias = "blocksize",
1839 .type = FIO_OPT_INT,
1840 .off1 = td_var_offset(bs[DDIR_READ]),
1841 .off2 = td_var_offset(bs[DDIR_WRITE]),
1842 .off3 = td_var_offset(bs[DDIR_TRIM]),
1844 .help = "Block size unit",
1849 .category = FIO_OPT_C_IO,
1850 .group = FIO_OPT_G_INVALID,
1854 .lname = "Block size align",
1855 .alias = "blockalign",
1856 .type = FIO_OPT_INT,
1857 .off1 = td_var_offset(ba[DDIR_READ]),
1858 .off2 = td_var_offset(ba[DDIR_WRITE]),
1859 .off3 = td_var_offset(ba[DDIR_TRIM]),
1861 .help = "IO block offset alignment",
1865 .category = FIO_OPT_C_IO,
1866 .group = FIO_OPT_G_INVALID,
1870 .lname = "Block size range",
1871 .alias = "blocksize_range",
1872 .type = FIO_OPT_RANGE,
1873 .off1 = td_var_offset(min_bs[DDIR_READ]),
1874 .off2 = td_var_offset(max_bs[DDIR_READ]),
1875 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1876 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1877 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1878 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1880 .help = "Set block size range (in more detail than bs)",
1884 .category = FIO_OPT_C_IO,
1885 .group = FIO_OPT_G_INVALID,
1889 .lname = "Block size split",
1890 .type = FIO_OPT_STR,
1891 .cb = str_bssplit_cb,
1892 .off1 = td_var_offset(bssplit),
1893 .help = "Set a specific mix of block sizes",
1896 .category = FIO_OPT_C_IO,
1897 .group = FIO_OPT_G_INVALID,
1900 .name = "bs_unaligned",
1901 .lname = "Block size unaligned",
1902 .alias = "blocksize_unaligned",
1903 .type = FIO_OPT_STR_SET,
1904 .off1 = td_var_offset(bs_unaligned),
1905 .help = "Don't sector align IO buffer sizes",
1908 .category = FIO_OPT_C_IO,
1909 .group = FIO_OPT_G_INVALID,
1912 .name = "bs_is_seq_rand",
1913 .lname = "Block size division is seq/random (not read/write)",
1914 .type = FIO_OPT_BOOL,
1915 .off1 = td_var_offset(bs_is_seq_rand),
1916 .help = "Consider any blocksize setting to be sequential,random",
1918 .parent = "blocksize",
1919 .category = FIO_OPT_C_IO,
1920 .group = FIO_OPT_G_INVALID,
1923 .name = "randrepeat",
1924 .lname = "Random repeatable",
1925 .type = FIO_OPT_BOOL,
1926 .off1 = td_var_offset(rand_repeatable),
1927 .help = "Use repeatable random IO pattern",
1931 .category = FIO_OPT_C_IO,
1932 .group = FIO_OPT_G_RANDOM,
1936 .lname = "The random generator seed",
1937 .type = FIO_OPT_STR_VAL,
1938 .off1 = td_var_offset(rand_seed),
1939 .help = "Set the random generator seed value",
1942 .category = FIO_OPT_C_IO,
1943 .group = FIO_OPT_G_RANDOM,
1946 .name = "use_os_rand",
1947 .lname = "Use OS random",
1948 .type = FIO_OPT_DEPRECATED,
1949 .off1 = td_var_offset(dep_use_os_rand),
1950 .category = FIO_OPT_C_IO,
1951 .group = FIO_OPT_G_RANDOM,
1954 .name = "norandommap",
1955 .lname = "No randommap",
1956 .type = FIO_OPT_STR_SET,
1957 .off1 = td_var_offset(norandommap),
1958 .help = "Accept potential duplicate random blocks",
1962 .category = FIO_OPT_C_IO,
1963 .group = FIO_OPT_G_RANDOM,
1966 .name = "softrandommap",
1967 .lname = "Soft randommap",
1968 .type = FIO_OPT_BOOL,
1969 .off1 = td_var_offset(softrandommap),
1970 .help = "Set norandommap if randommap allocation fails",
1971 .parent = "norandommap",
1974 .category = FIO_OPT_C_IO,
1975 .group = FIO_OPT_G_RANDOM,
1978 .name = "random_generator",
1979 .lname = "Random Generator",
1980 .type = FIO_OPT_STR,
1981 .off1 = td_var_offset(random_generator),
1982 .help = "Type of random number generator to use",
1983 .def = "tausworthe",
1985 { .ival = "tausworthe",
1986 .oval = FIO_RAND_GEN_TAUSWORTHE,
1987 .help = "Strong Tausworthe generator",
1990 .oval = FIO_RAND_GEN_LFSR,
1991 .help = "Variable length LFSR",
1994 .ival = "tausworthe64",
1995 .oval = FIO_RAND_GEN_TAUSWORTHE64,
1996 .help = "64-bit Tausworthe variant",
1999 .category = FIO_OPT_C_IO,
2000 .group = FIO_OPT_G_RANDOM,
2003 .name = "random_distribution",
2004 .lname = "Random Distribution",
2005 .type = FIO_OPT_STR,
2006 .off1 = td_var_offset(random_distribution),
2007 .cb = str_random_distribution_cb,
2008 .help = "Random offset distribution generator",
2012 .oval = FIO_RAND_DIST_RANDOM,
2013 .help = "Completely random",
2016 .oval = FIO_RAND_DIST_ZIPF,
2017 .help = "Zipf distribution",
2020 .oval = FIO_RAND_DIST_PARETO,
2021 .help = "Pareto distribution",
2024 .oval = FIO_RAND_DIST_GAUSS,
2025 .help = "Normal (Gaussian) distribution",
2028 .oval = FIO_RAND_DIST_ZONED,
2029 .help = "Zoned random distribution",
2033 .category = FIO_OPT_C_IO,
2034 .group = FIO_OPT_G_RANDOM,
2037 .name = "percentage_random",
2038 .lname = "Percentage Random",
2039 .type = FIO_OPT_INT,
2040 .off1 = td_var_offset(perc_rand[DDIR_READ]),
2041 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
2042 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
2044 .help = "Percentage of seq/random mix that should be random",
2045 .def = "100,100,100",
2047 .inverse = "percentage_sequential",
2048 .category = FIO_OPT_C_IO,
2049 .group = FIO_OPT_G_RANDOM,
2052 .name = "percentage_sequential",
2053 .lname = "Percentage Sequential",
2054 .type = FIO_OPT_DEPRECATED,
2055 .category = FIO_OPT_C_IO,
2056 .group = FIO_OPT_G_RANDOM,
2059 .name = "allrandrepeat",
2060 .lname = "All Random Repeat",
2061 .type = FIO_OPT_BOOL,
2062 .off1 = td_var_offset(allrand_repeatable),
2063 .help = "Use repeatable random numbers for everything",
2065 .category = FIO_OPT_C_IO,
2066 .group = FIO_OPT_G_RANDOM,
2070 .lname = "Number of files",
2071 .alias = "nr_files",
2072 .type = FIO_OPT_INT,
2073 .off1 = td_var_offset(nr_files),
2074 .help = "Split job workload between this number of files",
2077 .category = FIO_OPT_C_FILE,
2078 .group = FIO_OPT_G_INVALID,
2081 .name = "openfiles",
2082 .lname = "Number of open files",
2083 .type = FIO_OPT_INT,
2084 .off1 = td_var_offset(open_files),
2085 .help = "Number of files to keep open at the same time",
2086 .category = FIO_OPT_C_FILE,
2087 .group = FIO_OPT_G_INVALID,
2090 .name = "file_service_type",
2091 .lname = "File service type",
2092 .type = FIO_OPT_STR,
2094 .off1 = td_var_offset(file_service_type),
2095 .help = "How to select which file to service next",
2096 .def = "roundrobin",
2097 .category = FIO_OPT_C_FILE,
2098 .group = FIO_OPT_G_INVALID,
2101 .oval = FIO_FSERVICE_RANDOM,
2102 .help = "Choose a file at random (uniform)",
2105 .oval = FIO_FSERVICE_ZIPF,
2106 .help = "Zipf randomized",
2109 .oval = FIO_FSERVICE_PARETO,
2110 .help = "Pareto randomized",
2113 .oval = FIO_FSERVICE_GAUSS,
2114 .help = "Normal (guassian) distribution",
2116 { .ival = "roundrobin",
2117 .oval = FIO_FSERVICE_RR,
2118 .help = "Round robin select files",
2120 { .ival = "sequential",
2121 .oval = FIO_FSERVICE_SEQ,
2122 .help = "Finish one file before moving to the next",
2125 .parent = "nrfiles",
2128 #ifdef CONFIG_POSIX_FALLOCATE
2130 .name = "fallocate",
2131 .lname = "Fallocate",
2132 .type = FIO_OPT_STR,
2133 .off1 = td_var_offset(fallocate_mode),
2134 .help = "Whether pre-allocation is performed when laying out files",
2136 .category = FIO_OPT_C_FILE,
2137 .group = FIO_OPT_G_INVALID,
2140 .oval = FIO_FALLOCATE_NONE,
2141 .help = "Do not pre-allocate space",
2144 .oval = FIO_FALLOCATE_POSIX,
2145 .help = "Use posix_fallocate()",
2147 #ifdef CONFIG_LINUX_FALLOCATE
2149 .oval = FIO_FALLOCATE_KEEP_SIZE,
2150 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2153 /* Compatibility with former boolean values */
2155 .oval = FIO_FALLOCATE_NONE,
2156 .help = "Alias for 'none'",
2159 .oval = FIO_FALLOCATE_POSIX,
2160 .help = "Alias for 'posix'",
2164 #else /* CONFIG_POSIX_FALLOCATE */
2166 .name = "fallocate",
2167 .lname = "Fallocate",
2168 .type = FIO_OPT_UNSUPPORTED,
2169 .help = "Your platform does not support fallocate",
2171 #endif /* CONFIG_POSIX_FALLOCATE */
2173 .name = "fadvise_hint",
2174 .lname = "Fadvise hint",
2175 .type = FIO_OPT_BOOL,
2176 .off1 = td_var_offset(fadvise_hint),
2177 .help = "Use fadvise() to advise the kernel on IO pattern",
2179 .category = FIO_OPT_C_FILE,
2180 .group = FIO_OPT_G_INVALID,
2182 #ifdef FIO_HAVE_STREAMID
2184 .name = "fadvise_stream",
2185 .lname = "Fadvise stream",
2186 .type = FIO_OPT_INT,
2187 .off1 = td_var_offset(fadvise_stream),
2188 .help = "Use fadvise() to set stream ID",
2189 .category = FIO_OPT_C_FILE,
2190 .group = FIO_OPT_G_INVALID,
2194 .name = "fadvise_stream",
2195 .lname = "Fadvise stream",
2196 .type = FIO_OPT_UNSUPPORTED,
2197 .help = "Your platform does not support fadvise stream ID",
2203 .type = FIO_OPT_INT,
2204 .off1 = td_var_offset(fsync_blocks),
2205 .help = "Issue fsync for writes every given number of blocks",
2208 .category = FIO_OPT_C_FILE,
2209 .group = FIO_OPT_G_INVALID,
2212 .name = "fdatasync",
2213 .lname = "Fdatasync",
2214 .type = FIO_OPT_INT,
2215 .off1 = td_var_offset(fdatasync_blocks),
2216 .help = "Issue fdatasync for writes every given number of blocks",
2219 .category = FIO_OPT_C_FILE,
2220 .group = FIO_OPT_G_INVALID,
2223 .name = "write_barrier",
2224 .lname = "Write barrier",
2225 .type = FIO_OPT_INT,
2226 .off1 = td_var_offset(barrier_blocks),
2227 .help = "Make every Nth write a barrier write",
2230 .category = FIO_OPT_C_IO,
2231 .group = FIO_OPT_G_INVALID,
2233 #ifdef CONFIG_SYNC_FILE_RANGE
2235 .name = "sync_file_range",
2236 .lname = "Sync file range",
2238 { .ival = "wait_before",
2239 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2240 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2244 .oval = SYNC_FILE_RANGE_WRITE,
2245 .help = "SYNC_FILE_RANGE_WRITE",
2249 .ival = "wait_after",
2250 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2251 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2255 .type = FIO_OPT_STR_MULTI,
2257 .off1 = td_var_offset(sync_file_range),
2258 .help = "Use sync_file_range()",
2259 .category = FIO_OPT_C_FILE,
2260 .group = FIO_OPT_G_INVALID,
2264 .name = "sync_file_range",
2265 .lname = "Sync file range",
2266 .type = FIO_OPT_UNSUPPORTED,
2267 .help = "Your platform does not support sync_file_range",
2272 .lname = "Direct I/O",
2273 .type = FIO_OPT_BOOL,
2274 .off1 = td_var_offset(odirect),
2275 .help = "Use O_DIRECT IO (negates buffered)",
2277 .inverse = "buffered",
2278 .category = FIO_OPT_C_IO,
2279 .group = FIO_OPT_G_IO_TYPE,
2283 .lname = "Atomic I/O",
2284 .type = FIO_OPT_BOOL,
2285 .off1 = td_var_offset(oatomic),
2286 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2288 .category = FIO_OPT_C_IO,
2289 .group = FIO_OPT_G_IO_TYPE,
2293 .lname = "Buffered I/O",
2294 .type = FIO_OPT_BOOL,
2295 .off1 = td_var_offset(odirect),
2297 .help = "Use buffered IO (negates direct)",
2299 .inverse = "direct",
2300 .category = FIO_OPT_C_IO,
2301 .group = FIO_OPT_G_IO_TYPE,
2304 .name = "overwrite",
2305 .lname = "Overwrite",
2306 .type = FIO_OPT_BOOL,
2307 .off1 = td_var_offset(overwrite),
2308 .help = "When writing, set whether to overwrite current data",
2310 .category = FIO_OPT_C_FILE,
2311 .group = FIO_OPT_G_INVALID,
2316 .type = FIO_OPT_INT,
2317 .off1 = td_var_offset(loops),
2318 .help = "Number of times to run the job",
2321 .category = FIO_OPT_C_GENERAL,
2322 .group = FIO_OPT_G_RUNTIME,
2326 .lname = "Number of jobs",
2327 .type = FIO_OPT_INT,
2328 .off1 = td_var_offset(numjobs),
2329 .help = "Duplicate this job this many times",
2332 .category = FIO_OPT_C_GENERAL,
2333 .group = FIO_OPT_G_RUNTIME,
2336 .name = "startdelay",
2337 .lname = "Start delay",
2338 .type = FIO_OPT_STR_VAL_TIME,
2339 .off1 = td_var_offset(start_delay),
2340 .off2 = td_var_offset(start_delay_high),
2341 .help = "Only start job when this period has passed",
2345 .category = FIO_OPT_C_GENERAL,
2346 .group = FIO_OPT_G_RUNTIME,
2352 .type = FIO_OPT_STR_VAL_TIME,
2353 .off1 = td_var_offset(timeout),
2354 .help = "Stop workload when this amount of time has passed",
2358 .category = FIO_OPT_C_GENERAL,
2359 .group = FIO_OPT_G_RUNTIME,
2362 .name = "time_based",
2363 .lname = "Time based",
2364 .type = FIO_OPT_STR_SET,
2365 .off1 = td_var_offset(time_based),
2366 .help = "Keep running until runtime/timeout is met",
2367 .category = FIO_OPT_C_GENERAL,
2368 .group = FIO_OPT_G_RUNTIME,
2371 .name = "verify_only",
2372 .lname = "Verify only",
2373 .type = FIO_OPT_STR_SET,
2374 .off1 = td_var_offset(verify_only),
2375 .help = "Verifies previously written data is still valid",
2376 .category = FIO_OPT_C_GENERAL,
2377 .group = FIO_OPT_G_RUNTIME,
2380 .name = "ramp_time",
2381 .lname = "Ramp time",
2382 .type = FIO_OPT_STR_VAL_TIME,
2383 .off1 = td_var_offset(ramp_time),
2384 .help = "Ramp up time before measuring performance",
2387 .category = FIO_OPT_C_GENERAL,
2388 .group = FIO_OPT_G_RUNTIME,
2391 .name = "clocksource",
2392 .lname = "Clock source",
2393 .type = FIO_OPT_STR,
2394 .cb = fio_clock_source_cb,
2395 .off1 = td_var_offset(clocksource),
2396 .help = "What type of timing source to use",
2397 .category = FIO_OPT_C_GENERAL,
2398 .group = FIO_OPT_G_CLOCK,
2400 #ifdef CONFIG_GETTIMEOFDAY
2401 { .ival = "gettimeofday",
2403 .help = "Use gettimeofday(2) for timing",
2406 #ifdef CONFIG_CLOCK_GETTIME
2407 { .ival = "clock_gettime",
2408 .oval = CS_CGETTIME,
2409 .help = "Use clock_gettime(2) for timing",
2412 #ifdef ARCH_HAVE_CPU_CLOCK
2414 .oval = CS_CPUCLOCK,
2415 .help = "Use CPU private clock",
2423 .lname = "I/O Memory",
2424 .type = FIO_OPT_STR,
2426 .off1 = td_var_offset(mem_type),
2427 .help = "Backing type for IO buffers",
2429 .category = FIO_OPT_C_IO,
2430 .group = FIO_OPT_G_INVALID,
2434 .help = "Use malloc(3) for IO buffers",
2436 #ifndef CONFIG_NO_SHM
2439 .help = "Use shared memory segments for IO buffers",
2441 #ifdef FIO_HAVE_HUGETLB
2442 { .ival = "shmhuge",
2443 .oval = MEM_SHMHUGE,
2444 .help = "Like shm, but use huge pages",
2450 .help = "Use mmap(2) (file or anon) for IO buffers",
2452 { .ival = "mmapshared",
2453 .oval = MEM_MMAPSHARED,
2454 .help = "Like mmap, but use the shared flag",
2456 #ifdef FIO_HAVE_HUGETLB
2457 { .ival = "mmaphuge",
2458 .oval = MEM_MMAPHUGE,
2459 .help = "Like mmap, but use huge pages",
2465 .name = "iomem_align",
2466 .alias = "mem_align",
2467 .lname = "I/O memory alignment",
2468 .type = FIO_OPT_INT,
2469 .off1 = td_var_offset(mem_align),
2471 .help = "IO memory buffer offset alignment",
2475 .category = FIO_OPT_C_IO,
2476 .group = FIO_OPT_G_INVALID,
2481 .type = FIO_OPT_STR,
2482 .off1 = td_var_offset(verify),
2483 .help = "Verify data written",
2485 .category = FIO_OPT_C_IO,
2486 .group = FIO_OPT_G_VERIFY,
2489 .oval = VERIFY_NONE,
2490 .help = "Don't do IO verification",
2494 .help = "Use md5 checksums for verification",
2497 .oval = VERIFY_CRC64,
2498 .help = "Use crc64 checksums for verification",
2501 .oval = VERIFY_CRC32,
2502 .help = "Use crc32 checksums for verification",
2504 { .ival = "crc32c-intel",
2505 .oval = VERIFY_CRC32C,
2506 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2509 .oval = VERIFY_CRC32C,
2510 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2513 .oval = VERIFY_CRC16,
2514 .help = "Use crc16 checksums for verification",
2517 .oval = VERIFY_CRC7,
2518 .help = "Use crc7 checksums for verification",
2521 .oval = VERIFY_SHA1,
2522 .help = "Use sha1 checksums for verification",
2525 .oval = VERIFY_SHA256,
2526 .help = "Use sha256 checksums for verification",
2529 .oval = VERIFY_SHA512,
2530 .help = "Use sha512 checksums for verification",
2533 .oval = VERIFY_XXHASH,
2534 .help = "Use xxhash checksums for verification",
2536 /* Meta information was included into verify_header,
2537 * 'meta' verification is implied by default. */
2539 .oval = VERIFY_HDR_ONLY,
2540 .help = "Use io information for verification. "
2541 "Now is implied by default, thus option is obsolete, "
2544 { .ival = "pattern",
2545 .oval = VERIFY_PATTERN_NO_HDR,
2546 .help = "Verify strict pattern",
2550 .oval = VERIFY_NULL,
2551 .help = "Pretend to verify",
2556 .name = "do_verify",
2557 .lname = "Perform verify step",
2558 .type = FIO_OPT_BOOL,
2559 .off1 = td_var_offset(do_verify),
2560 .help = "Run verification stage after write",
2564 .category = FIO_OPT_C_IO,
2565 .group = FIO_OPT_G_VERIFY,
2568 .name = "verifysort",
2569 .lname = "Verify sort",
2570 .type = FIO_OPT_BOOL,
2571 .off1 = td_var_offset(verifysort),
2572 .help = "Sort written verify blocks for read back",
2576 .category = FIO_OPT_C_IO,
2577 .group = FIO_OPT_G_VERIFY,
2580 .name = "verifysort_nr",
2581 .lname = "Verify Sort Nr",
2582 .type = FIO_OPT_INT,
2583 .off1 = td_var_offset(verifysort_nr),
2584 .help = "Pre-load and sort verify blocks for a read workload",
2589 .category = FIO_OPT_C_IO,
2590 .group = FIO_OPT_G_VERIFY,
2593 .name = "verify_interval",
2594 .lname = "Verify interval",
2595 .type = FIO_OPT_INT,
2596 .off1 = td_var_offset(verify_interval),
2597 .minval = 2 * sizeof(struct verify_header),
2598 .help = "Store verify buffer header every N bytes",
2601 .interval = 2 * sizeof(struct verify_header),
2602 .category = FIO_OPT_C_IO,
2603 .group = FIO_OPT_G_VERIFY,
2606 .name = "verify_offset",
2607 .lname = "Verify offset",
2608 .type = FIO_OPT_INT,
2609 .help = "Offset verify header location by N bytes",
2610 .off1 = td_var_offset(verify_offset),
2611 .minval = sizeof(struct verify_header),
2614 .category = FIO_OPT_C_IO,
2615 .group = FIO_OPT_G_VERIFY,
2618 .name = "verify_pattern",
2619 .lname = "Verify pattern",
2620 .type = FIO_OPT_STR,
2621 .cb = str_verify_pattern_cb,
2622 .off1 = td_var_offset(verify_pattern),
2623 .help = "Fill pattern for IO buffers",
2626 .category = FIO_OPT_C_IO,
2627 .group = FIO_OPT_G_VERIFY,
2630 .name = "verify_fatal",
2631 .lname = "Verify fatal",
2632 .type = FIO_OPT_BOOL,
2633 .off1 = td_var_offset(verify_fatal),
2635 .help = "Exit on a single verify failure, don't continue",
2638 .category = FIO_OPT_C_IO,
2639 .group = FIO_OPT_G_VERIFY,
2642 .name = "verify_dump",
2643 .lname = "Verify dump",
2644 .type = FIO_OPT_BOOL,
2645 .off1 = td_var_offset(verify_dump),
2647 .help = "Dump contents of good and bad blocks on failure",
2650 .category = FIO_OPT_C_IO,
2651 .group = FIO_OPT_G_VERIFY,
2654 .name = "verify_async",
2655 .lname = "Verify asynchronously",
2656 .type = FIO_OPT_INT,
2657 .off1 = td_var_offset(verify_async),
2659 .help = "Number of async verifier threads to use",
2662 .category = FIO_OPT_C_IO,
2663 .group = FIO_OPT_G_VERIFY,
2666 .name = "verify_backlog",
2667 .lname = "Verify backlog",
2668 .type = FIO_OPT_STR_VAL,
2669 .off1 = td_var_offset(verify_backlog),
2670 .help = "Verify after this number of blocks are written",
2673 .category = FIO_OPT_C_IO,
2674 .group = FIO_OPT_G_VERIFY,
2677 .name = "verify_backlog_batch",
2678 .lname = "Verify backlog batch",
2679 .type = FIO_OPT_INT,
2680 .off1 = td_var_offset(verify_batch),
2681 .help = "Verify this number of IO blocks",
2684 .category = FIO_OPT_C_IO,
2685 .group = FIO_OPT_G_VERIFY,
2687 #ifdef FIO_HAVE_CPU_AFFINITY
2689 .name = "verify_async_cpus",
2690 .lname = "Async verify CPUs",
2691 .type = FIO_OPT_STR,
2692 .cb = str_verify_cpus_allowed_cb,
2693 .off1 = td_var_offset(verify_cpumask),
2694 .help = "Set CPUs allowed for async verify threads",
2695 .parent = "verify_async",
2697 .category = FIO_OPT_C_IO,
2698 .group = FIO_OPT_G_VERIFY,
2702 .name = "verify_async_cpus",
2703 .lname = "Async verify CPUs",
2704 .type = FIO_OPT_UNSUPPORTED,
2705 .help = "Your platform does not support CPU affinities",
2709 .name = "experimental_verify",
2710 .lname = "Experimental Verify",
2711 .off1 = td_var_offset(experimental_verify),
2712 .type = FIO_OPT_BOOL,
2713 .help = "Enable experimental verification",
2715 .category = FIO_OPT_C_IO,
2716 .group = FIO_OPT_G_VERIFY,
2719 .name = "verify_state_load",
2720 .lname = "Load verify state",
2721 .off1 = td_var_offset(verify_state),
2722 .type = FIO_OPT_BOOL,
2723 .help = "Load verify termination state",
2725 .category = FIO_OPT_C_IO,
2726 .group = FIO_OPT_G_VERIFY,
2729 .name = "verify_state_save",
2730 .lname = "Save verify state",
2731 .off1 = td_var_offset(verify_state_save),
2732 .type = FIO_OPT_BOOL,
2734 .help = "Save verify state on termination",
2736 .category = FIO_OPT_C_IO,
2737 .group = FIO_OPT_G_VERIFY,
2739 #ifdef FIO_HAVE_TRIM
2741 .name = "trim_percentage",
2742 .lname = "Trim percentage",
2743 .type = FIO_OPT_INT,
2744 .off1 = td_var_offset(trim_percentage),
2747 .help = "Number of verify blocks to discard/trim",
2752 .category = FIO_OPT_C_IO,
2753 .group = FIO_OPT_G_TRIM,
2756 .name = "trim_verify_zero",
2757 .lname = "Verify trim zero",
2758 .type = FIO_OPT_BOOL,
2759 .help = "Verify that trim/discarded blocks are returned as zeroes",
2760 .off1 = td_var_offset(trim_zero),
2761 .parent = "trim_percentage",
2764 .category = FIO_OPT_C_IO,
2765 .group = FIO_OPT_G_TRIM,
2768 .name = "trim_backlog",
2769 .lname = "Trim backlog",
2770 .type = FIO_OPT_STR_VAL,
2771 .off1 = td_var_offset(trim_backlog),
2772 .help = "Trim after this number of blocks are written",
2773 .parent = "trim_percentage",
2776 .category = FIO_OPT_C_IO,
2777 .group = FIO_OPT_G_TRIM,
2780 .name = "trim_backlog_batch",
2781 .lname = "Trim backlog batch",
2782 .type = FIO_OPT_INT,
2783 .off1 = td_var_offset(trim_batch),
2784 .help = "Trim this number of IO blocks",
2785 .parent = "trim_percentage",
2788 .category = FIO_OPT_C_IO,
2789 .group = FIO_OPT_G_TRIM,
2793 .name = "trim_percentage",
2794 .lname = "Trim percentage",
2795 .type = FIO_OPT_UNSUPPORTED,
2796 .help = "Fio does not support TRIM on your platform",
2799 .name = "trim_verify_zero",
2800 .lname = "Verify trim zero",
2801 .type = FIO_OPT_UNSUPPORTED,
2802 .help = "Fio does not support TRIM on your platform",
2805 .name = "trim_backlog",
2806 .lname = "Trim backlog",
2807 .type = FIO_OPT_UNSUPPORTED,
2808 .help = "Fio does not support TRIM on your platform",
2811 .name = "trim_backlog_batch",
2812 .lname = "Trim backlog batch",
2813 .type = FIO_OPT_UNSUPPORTED,
2814 .help = "Fio does not support TRIM on your platform",
2818 .name = "write_iolog",
2819 .lname = "Write I/O log",
2820 .type = FIO_OPT_STR_STORE,
2821 .off1 = td_var_offset(write_iolog_file),
2822 .help = "Store IO pattern to file",
2823 .category = FIO_OPT_C_IO,
2824 .group = FIO_OPT_G_IOLOG,
2827 .name = "read_iolog",
2828 .lname = "Read I/O log",
2829 .type = FIO_OPT_STR_STORE,
2830 .off1 = td_var_offset(read_iolog_file),
2831 .help = "Playback IO pattern from file",
2832 .category = FIO_OPT_C_IO,
2833 .group = FIO_OPT_G_IOLOG,
2836 .name = "replay_no_stall",
2837 .lname = "Don't stall on replay",
2838 .type = FIO_OPT_BOOL,
2839 .off1 = td_var_offset(no_stall),
2841 .parent = "read_iolog",
2843 .help = "Playback IO pattern file as fast as possible without stalls",
2844 .category = FIO_OPT_C_IO,
2845 .group = FIO_OPT_G_IOLOG,
2848 .name = "replay_redirect",
2849 .lname = "Redirect device for replay",
2850 .type = FIO_OPT_STR_STORE,
2851 .off1 = td_var_offset(replay_redirect),
2852 .parent = "read_iolog",
2854 .help = "Replay all I/O onto this device, regardless of trace device",
2855 .category = FIO_OPT_C_IO,
2856 .group = FIO_OPT_G_IOLOG,
2859 .name = "replay_scale",
2860 .lname = "Replace offset scale factor",
2861 .type = FIO_OPT_INT,
2862 .off1 = td_var_offset(replay_scale),
2863 .parent = "read_iolog",
2865 .help = "Align offsets to this blocksize",
2866 .category = FIO_OPT_C_IO,
2867 .group = FIO_OPT_G_IOLOG,
2870 .name = "replay_align",
2871 .lname = "Replace alignment",
2872 .type = FIO_OPT_INT,
2873 .off1 = td_var_offset(replay_align),
2874 .parent = "read_iolog",
2875 .help = "Scale offset down by this factor",
2876 .category = FIO_OPT_C_IO,
2877 .group = FIO_OPT_G_IOLOG,
2881 .name = "exec_prerun",
2882 .lname = "Pre-execute runnable",
2883 .type = FIO_OPT_STR_STORE,
2884 .off1 = td_var_offset(exec_prerun),
2885 .help = "Execute this file prior to running job",
2886 .category = FIO_OPT_C_GENERAL,
2887 .group = FIO_OPT_G_INVALID,
2890 .name = "exec_postrun",
2891 .lname = "Post-execute runnable",
2892 .type = FIO_OPT_STR_STORE,
2893 .off1 = td_var_offset(exec_postrun),
2894 .help = "Execute this file after running job",
2895 .category = FIO_OPT_C_GENERAL,
2896 .group = FIO_OPT_G_INVALID,
2898 #ifdef FIO_HAVE_IOSCHED_SWITCH
2900 .name = "ioscheduler",
2901 .lname = "I/O scheduler",
2902 .type = FIO_OPT_STR_STORE,
2903 .off1 = td_var_offset(ioscheduler),
2904 .help = "Use this IO scheduler on the backing device",
2905 .category = FIO_OPT_C_FILE,
2906 .group = FIO_OPT_G_INVALID,
2910 .name = "ioscheduler",
2911 .lname = "I/O scheduler",
2912 .type = FIO_OPT_UNSUPPORTED,
2913 .help = "Your platform does not support IO scheduler switching",
2918 .lname = "Zone size",
2919 .type = FIO_OPT_STR_VAL,
2920 .off1 = td_var_offset(zone_size),
2921 .help = "Amount of data to read per zone",
2923 .interval = 1024 * 1024,
2924 .category = FIO_OPT_C_IO,
2925 .group = FIO_OPT_G_ZONE,
2928 .name = "zonerange",
2929 .lname = "Zone range",
2930 .type = FIO_OPT_STR_VAL,
2931 .off1 = td_var_offset(zone_range),
2932 .help = "Give size of an IO zone",
2934 .interval = 1024 * 1024,
2935 .category = FIO_OPT_C_IO,
2936 .group = FIO_OPT_G_ZONE,
2940 .lname = "Zone skip",
2941 .type = FIO_OPT_STR_VAL,
2942 .off1 = td_var_offset(zone_skip),
2943 .help = "Space between IO zones",
2945 .interval = 1024 * 1024,
2946 .category = FIO_OPT_C_IO,
2947 .group = FIO_OPT_G_ZONE,
2951 .lname = "Lock memory",
2952 .type = FIO_OPT_STR_VAL,
2953 .off1 = td_var_offset(lockmem),
2954 .help = "Lock down this amount of memory (per worker)",
2956 .interval = 1024 * 1024,
2957 .category = FIO_OPT_C_GENERAL,
2958 .group = FIO_OPT_G_INVALID,
2961 .name = "rwmixread",
2962 .lname = "Read/write mix read",
2963 .type = FIO_OPT_INT,
2964 .cb = str_rwmix_read_cb,
2965 .off1 = td_var_offset(rwmix[DDIR_READ]),
2967 .help = "Percentage of mixed workload that is reads",
2970 .inverse = "rwmixwrite",
2971 .category = FIO_OPT_C_IO,
2972 .group = FIO_OPT_G_RWMIX,
2975 .name = "rwmixwrite",
2976 .lname = "Read/write mix write",
2977 .type = FIO_OPT_INT,
2978 .cb = str_rwmix_write_cb,
2979 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
2981 .help = "Percentage of mixed workload that is writes",
2984 .inverse = "rwmixread",
2985 .category = FIO_OPT_C_IO,
2986 .group = FIO_OPT_G_RWMIX,
2989 .name = "rwmixcycle",
2990 .lname = "Read/write mix cycle",
2991 .type = FIO_OPT_DEPRECATED,
2992 .category = FIO_OPT_C_IO,
2993 .group = FIO_OPT_G_RWMIX,
2998 .type = FIO_OPT_INT,
2999 .off1 = td_var_offset(nice),
3000 .help = "Set job CPU nice value",
3005 .category = FIO_OPT_C_GENERAL,
3006 .group = FIO_OPT_G_CRED,
3008 #ifdef FIO_HAVE_IOPRIO
3011 .lname = "I/O nice priority",
3012 .type = FIO_OPT_INT,
3013 .off1 = td_var_offset(ioprio),
3014 .help = "Set job IO priority value",
3015 .minval = IOPRIO_MIN_PRIO,
3016 .maxval = IOPRIO_MAX_PRIO,
3018 .category = FIO_OPT_C_GENERAL,
3019 .group = FIO_OPT_G_CRED,
3024 .lname = "I/O nice priority",
3025 .type = FIO_OPT_UNSUPPORTED,
3026 .help = "Your platform does not support IO priorities",
3029 #ifdef FIO_HAVE_IOPRIO_CLASS
3030 #ifndef FIO_HAVE_IOPRIO
3031 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3034 .name = "prioclass",
3035 .lname = "I/O nice priority class",
3036 .type = FIO_OPT_INT,
3037 .off1 = td_var_offset(ioprio_class),
3038 .help = "Set job IO priority class",
3039 .minval = IOPRIO_MIN_PRIO_CLASS,
3040 .maxval = IOPRIO_MAX_PRIO_CLASS,
3042 .category = FIO_OPT_C_GENERAL,
3043 .group = FIO_OPT_G_CRED,
3047 .name = "prioclass",
3048 .lname = "I/O nice priority class",
3049 .type = FIO_OPT_UNSUPPORTED,
3050 .help = "Your platform does not support IO priority classes",
3054 .name = "thinktime",
3055 .lname = "Thinktime",
3056 .type = FIO_OPT_INT,
3057 .off1 = td_var_offset(thinktime),
3058 .help = "Idle time between IO buffers (usec)",
3061 .category = FIO_OPT_C_IO,
3062 .group = FIO_OPT_G_THINKTIME,
3065 .name = "thinktime_spin",
3066 .lname = "Thinktime spin",
3067 .type = FIO_OPT_INT,
3068 .off1 = td_var_offset(thinktime_spin),
3069 .help = "Start think time by spinning this amount (usec)",
3072 .parent = "thinktime",
3074 .category = FIO_OPT_C_IO,
3075 .group = FIO_OPT_G_THINKTIME,
3078 .name = "thinktime_blocks",
3079 .lname = "Thinktime blocks",
3080 .type = FIO_OPT_INT,
3081 .off1 = td_var_offset(thinktime_blocks),
3082 .help = "IO buffer period between 'thinktime'",
3084 .parent = "thinktime",
3086 .category = FIO_OPT_C_IO,
3087 .group = FIO_OPT_G_THINKTIME,
3091 .lname = "I/O rate",
3092 .type = FIO_OPT_INT,
3093 .off1 = td_var_offset(rate[DDIR_READ]),
3094 .off2 = td_var_offset(rate[DDIR_WRITE]),
3095 .off3 = td_var_offset(rate[DDIR_TRIM]),
3096 .help = "Set bandwidth rate",
3097 .category = FIO_OPT_C_IO,
3098 .group = FIO_OPT_G_RATE,
3103 .lname = "I/O min rate",
3104 .type = FIO_OPT_INT,
3105 .off1 = td_var_offset(ratemin[DDIR_READ]),
3106 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
3107 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
3108 .help = "Job must meet this rate or it will be shutdown",
3111 .category = FIO_OPT_C_IO,
3112 .group = FIO_OPT_G_RATE,
3115 .name = "rate_iops",
3116 .lname = "I/O rate IOPS",
3117 .type = FIO_OPT_INT,
3118 .off1 = td_var_offset(rate_iops[DDIR_READ]),
3119 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
3120 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
3121 .help = "Limit IO used to this number of IO operations/sec",
3123 .category = FIO_OPT_C_IO,
3124 .group = FIO_OPT_G_RATE,
3127 .name = "rate_iops_min",
3128 .lname = "I/O min rate IOPS",
3129 .type = FIO_OPT_INT,
3130 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
3131 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
3132 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
3133 .help = "Job must meet this rate or it will be shut down",
3134 .parent = "rate_iops",
3136 .category = FIO_OPT_C_IO,
3137 .group = FIO_OPT_G_RATE,
3140 .name = "rate_process",
3141 .lname = "Rate Process",
3142 .type = FIO_OPT_STR,
3143 .off1 = td_var_offset(rate_process),
3144 .help = "What process controls how rated IO is managed",
3146 .category = FIO_OPT_C_IO,
3147 .group = FIO_OPT_G_RATE,
3150 .oval = RATE_PROCESS_LINEAR,
3151 .help = "Linear rate of IO",
3155 .oval = RATE_PROCESS_POISSON,
3156 .help = "Rate follows Poisson process",
3162 .name = "rate_cycle",
3163 .alias = "ratecycle",
3164 .lname = "I/O rate cycle",
3165 .type = FIO_OPT_INT,
3166 .off1 = td_var_offset(ratecycle),
3167 .help = "Window average for rate limits (msec)",
3171 .category = FIO_OPT_C_IO,
3172 .group = FIO_OPT_G_RATE,
3175 .name = "max_latency",
3176 .lname = "Max Latency",
3177 .type = FIO_OPT_INT,
3178 .off1 = td_var_offset(max_latency),
3179 .help = "Maximum tolerated IO latency (usec)",
3181 .category = FIO_OPT_C_IO,
3182 .group = FIO_OPT_G_LATPROF,
3185 .name = "latency_target",
3186 .lname = "Latency Target (usec)",
3187 .type = FIO_OPT_STR_VAL_TIME,
3188 .off1 = td_var_offset(latency_target),
3189 .help = "Ramp to max queue depth supporting this latency",
3191 .category = FIO_OPT_C_IO,
3192 .group = FIO_OPT_G_LATPROF,
3195 .name = "latency_window",
3196 .lname = "Latency Window (usec)",
3197 .type = FIO_OPT_STR_VAL_TIME,
3198 .off1 = td_var_offset(latency_window),
3199 .help = "Time to sustain latency_target",
3201 .category = FIO_OPT_C_IO,
3202 .group = FIO_OPT_G_LATPROF,
3205 .name = "latency_percentile",
3206 .lname = "Latency Percentile",
3207 .type = FIO_OPT_FLOAT_LIST,
3208 .off1 = td_var_offset(latency_percentile),
3209 .help = "Percentile of IOs must be below latency_target",
3214 .category = FIO_OPT_C_IO,
3215 .group = FIO_OPT_G_LATPROF,
3218 .name = "invalidate",
3219 .lname = "Cache invalidate",
3220 .type = FIO_OPT_BOOL,
3221 .off1 = td_var_offset(invalidate_cache),
3222 .help = "Invalidate buffer/page cache prior to running job",
3224 .category = FIO_OPT_C_IO,
3225 .group = FIO_OPT_G_IO_TYPE,
3229 .lname = "Synchronous I/O",
3230 .type = FIO_OPT_BOOL,
3231 .off1 = td_var_offset(sync_io),
3232 .help = "Use O_SYNC for buffered writes",
3234 .parent = "buffered",
3236 .category = FIO_OPT_C_IO,
3237 .group = FIO_OPT_G_IO_TYPE,
3240 .name = "create_serialize",
3241 .lname = "Create serialize",
3242 .type = FIO_OPT_BOOL,
3243 .off1 = td_var_offset(create_serialize),
3244 .help = "Serialize creating of job files",
3246 .category = FIO_OPT_C_FILE,
3247 .group = FIO_OPT_G_INVALID,
3250 .name = "create_fsync",
3251 .lname = "Create fsync",
3252 .type = FIO_OPT_BOOL,
3253 .off1 = td_var_offset(create_fsync),
3254 .help = "fsync file after creation",
3256 .category = FIO_OPT_C_FILE,
3257 .group = FIO_OPT_G_INVALID,
3260 .name = "create_on_open",
3261 .lname = "Create on open",
3262 .type = FIO_OPT_BOOL,
3263 .off1 = td_var_offset(create_on_open),
3264 .help = "Create files when they are opened for IO",
3266 .category = FIO_OPT_C_FILE,
3267 .group = FIO_OPT_G_INVALID,
3270 .name = "create_only",
3271 .lname = "Create Only",
3272 .type = FIO_OPT_BOOL,
3273 .off1 = td_var_offset(create_only),
3274 .help = "Only perform file creation phase",
3275 .category = FIO_OPT_C_FILE,
3279 .name = "allow_file_create",
3280 .lname = "Allow file create",
3281 .type = FIO_OPT_BOOL,
3282 .off1 = td_var_offset(allow_create),
3283 .help = "Permit fio to create files, if they don't exist",
3285 .category = FIO_OPT_C_FILE,
3286 .group = FIO_OPT_G_FILENAME,
3289 .name = "allow_mounted_write",
3290 .lname = "Allow mounted write",
3291 .type = FIO_OPT_BOOL,
3292 .off1 = td_var_offset(allow_mounted_write),
3293 .help = "Allow writes to a mounted partition",
3295 .category = FIO_OPT_C_FILE,
3296 .group = FIO_OPT_G_FILENAME,
3300 .lname = "Pre-read files",
3301 .type = FIO_OPT_BOOL,
3302 .off1 = td_var_offset(pre_read),
3303 .help = "Pre-read files before starting official testing",
3305 .category = FIO_OPT_C_FILE,
3306 .group = FIO_OPT_G_INVALID,
3308 #ifdef FIO_HAVE_CPU_AFFINITY
3311 .lname = "CPU mask",
3312 .type = FIO_OPT_INT,
3313 .cb = str_cpumask_cb,
3314 .off1 = td_var_offset(cpumask),
3315 .help = "CPU affinity mask",
3316 .category = FIO_OPT_C_GENERAL,
3317 .group = FIO_OPT_G_CRED,
3320 .name = "cpus_allowed",
3321 .lname = "CPUs allowed",
3322 .type = FIO_OPT_STR,
3323 .cb = str_cpus_allowed_cb,
3324 .off1 = td_var_offset(cpumask),
3325 .help = "Set CPUs allowed",
3326 .category = FIO_OPT_C_GENERAL,
3327 .group = FIO_OPT_G_CRED,
3330 .name = "cpus_allowed_policy",
3331 .lname = "CPUs allowed distribution policy",
3332 .type = FIO_OPT_STR,
3333 .off1 = td_var_offset(cpus_allowed_policy),
3334 .help = "Distribution policy for cpus_allowed",
3335 .parent = "cpus_allowed",
3339 .oval = FIO_CPUS_SHARED,
3340 .help = "Mask shared between threads",
3343 .oval = FIO_CPUS_SPLIT,
3344 .help = "Mask split between threads",
3347 .category = FIO_OPT_C_GENERAL,
3348 .group = FIO_OPT_G_CRED,
3353 .lname = "CPU mask",
3354 .type = FIO_OPT_UNSUPPORTED,
3355 .help = "Your platform does not support CPU affinities",
3358 .name = "cpus_allowed",
3359 .lname = "CPUs allowed",
3360 .type = FIO_OPT_UNSUPPORTED,
3361 .help = "Your platform does not support CPU affinities",
3364 .name = "cpus_allowed_policy",
3365 .lname = "CPUs allowed distribution policy",
3366 .type = FIO_OPT_UNSUPPORTED,
3367 .help = "Your platform does not support CPU affinities",
3370 #ifdef CONFIG_LIBNUMA
3372 .name = "numa_cpu_nodes",
3373 .lname = "NUMA CPU Nodes",
3374 .type = FIO_OPT_STR,
3375 .cb = str_numa_cpunodes_cb,
3376 .off1 = td_var_offset(numa_cpunodes),
3377 .help = "NUMA CPU nodes bind",
3378 .category = FIO_OPT_C_GENERAL,
3379 .group = FIO_OPT_G_INVALID,
3382 .name = "numa_mem_policy",
3383 .lname = "NUMA Memory Policy",
3384 .type = FIO_OPT_STR,
3385 .cb = str_numa_mpol_cb,
3386 .off1 = td_var_offset(numa_memnodes),
3387 .help = "NUMA memory policy setup",
3388 .category = FIO_OPT_C_GENERAL,
3389 .group = FIO_OPT_G_INVALID,
3393 .name = "numa_cpu_nodes",
3394 .lname = "NUMA CPU Nodes",
3395 .type = FIO_OPT_UNSUPPORTED,
3396 .help = "Build fio with libnuma-dev(el) to enable this option",
3399 .name = "numa_mem_policy",
3400 .lname = "NUMA Memory Policy",
3401 .type = FIO_OPT_UNSUPPORTED,
3402 .help = "Build fio with libnuma-dev(el) to enable this option",
3406 .name = "end_fsync",
3407 .lname = "End fsync",
3408 .type = FIO_OPT_BOOL,
3409 .off1 = td_var_offset(end_fsync),
3410 .help = "Include fsync at the end of job",
3412 .category = FIO_OPT_C_FILE,
3413 .group = FIO_OPT_G_INVALID,
3416 .name = "fsync_on_close",
3417 .lname = "Fsync on close",
3418 .type = FIO_OPT_BOOL,
3419 .off1 = td_var_offset(fsync_on_close),
3420 .help = "fsync files on close",
3422 .category = FIO_OPT_C_FILE,
3423 .group = FIO_OPT_G_INVALID,
3427 .lname = "Unlink file",
3428 .type = FIO_OPT_BOOL,
3429 .off1 = td_var_offset(unlink),
3430 .help = "Unlink created files after job has completed",
3432 .category = FIO_OPT_C_FILE,
3433 .group = FIO_OPT_G_INVALID,
3437 .lname = "Exit-all on terminate",
3438 .type = FIO_OPT_STR_SET,
3439 .cb = str_exitall_cb,
3440 .help = "Terminate all jobs when one exits",
3441 .category = FIO_OPT_C_GENERAL,
3442 .group = FIO_OPT_G_PROCESS,
3445 .name = "exitall_on_error",
3446 .lname = "Exit-all on terminate in error",
3447 .type = FIO_OPT_STR_SET,
3448 .off1 = td_var_offset(exitall_error),
3449 .help = "Terminate all jobs when one exits in error",
3450 .category = FIO_OPT_C_GENERAL,
3451 .group = FIO_OPT_G_PROCESS,
3454 .name = "stonewall",
3455 .lname = "Wait for previous",
3456 .alias = "wait_for_previous",
3457 .type = FIO_OPT_STR_SET,
3458 .off1 = td_var_offset(stonewall),
3459 .help = "Insert a hard barrier between this job and previous",
3460 .category = FIO_OPT_C_GENERAL,
3461 .group = FIO_OPT_G_PROCESS,
3464 .name = "new_group",
3465 .lname = "New group",
3466 .type = FIO_OPT_STR_SET,
3467 .off1 = td_var_offset(new_group),
3468 .help = "Mark the start of a new group (for reporting)",
3469 .category = FIO_OPT_C_GENERAL,
3470 .group = FIO_OPT_G_PROCESS,
3475 .type = FIO_OPT_STR_SET,
3476 .off1 = td_var_offset(use_thread),
3477 .help = "Use threads instead of processes",
3478 #ifdef CONFIG_NO_SHM
3482 .category = FIO_OPT_C_GENERAL,
3483 .group = FIO_OPT_G_PROCESS,
3486 .name = "per_job_logs",
3487 .lname = "Per Job Logs",
3488 .type = FIO_OPT_BOOL,
3489 .off1 = td_var_offset(per_job_logs),
3490 .help = "Include job number in generated log files or not",
3492 .category = FIO_OPT_C_LOG,
3493 .group = FIO_OPT_G_INVALID,
3496 .name = "write_bw_log",
3497 .lname = "Write bandwidth log",
3498 .type = FIO_OPT_STR_STORE,
3499 .off1 = td_var_offset(bw_log_file),
3500 .help = "Write log of bandwidth during run",
3501 .category = FIO_OPT_C_LOG,
3502 .group = FIO_OPT_G_INVALID,
3505 .name = "write_lat_log",
3506 .lname = "Write latency log",
3507 .type = FIO_OPT_STR_STORE,
3508 .off1 = td_var_offset(lat_log_file),
3509 .help = "Write log of latency during run",
3510 .category = FIO_OPT_C_LOG,
3511 .group = FIO_OPT_G_INVALID,
3514 .name = "write_iops_log",
3515 .lname = "Write IOPS log",
3516 .type = FIO_OPT_STR_STORE,
3517 .off1 = td_var_offset(iops_log_file),
3518 .help = "Write log of IOPS during run",
3519 .category = FIO_OPT_C_LOG,
3520 .group = FIO_OPT_G_INVALID,
3523 .name = "log_avg_msec",
3524 .lname = "Log averaging (msec)",
3525 .type = FIO_OPT_INT,
3526 .off1 = td_var_offset(log_avg_msec),
3527 .help = "Average bw/iops/lat logs over this period of time",
3529 .category = FIO_OPT_C_LOG,
3530 .group = FIO_OPT_G_INVALID,
3533 .name = "log_max_value",
3534 .lname = "Log maximum instead of average",
3535 .type = FIO_OPT_BOOL,
3536 .off1 = td_var_offset(log_max),
3537 .help = "Log max sample in a window instead of average",
3539 .category = FIO_OPT_C_LOG,
3540 .group = FIO_OPT_G_INVALID,
3543 .name = "log_offset",
3544 .lname = "Log offset of IO",
3545 .type = FIO_OPT_BOOL,
3546 .off1 = td_var_offset(log_offset),
3547 .help = "Include offset of IO for each log entry",
3549 .category = FIO_OPT_C_LOG,
3550 .group = FIO_OPT_G_INVALID,
3554 .name = "log_compression",
3555 .lname = "Log compression",
3556 .type = FIO_OPT_INT,
3557 .off1 = td_var_offset(log_gz),
3558 .help = "Log in compressed chunks of this size",
3560 .maxval = 512 * 1024 * 1024ULL,
3561 .category = FIO_OPT_C_LOG,
3562 .group = FIO_OPT_G_INVALID,
3564 #ifdef FIO_HAVE_CPU_AFFINITY
3566 .name = "log_compression_cpus",
3567 .lname = "Log Compression CPUs",
3568 .type = FIO_OPT_STR,
3569 .cb = str_log_cpus_allowed_cb,
3570 .off1 = td_var_offset(log_gz_cpumask),
3571 .parent = "log_compression",
3572 .help = "Limit log compression to these CPUs",
3573 .category = FIO_OPT_C_LOG,
3574 .group = FIO_OPT_G_INVALID,
3578 .name = "log_compression_cpus",
3579 .lname = "Log Compression CPUs",
3580 .type = FIO_OPT_UNSUPPORTED,
3581 .help = "Your platform does not support CPU affinities",
3585 .name = "log_store_compressed",
3586 .lname = "Log store compressed",
3587 .type = FIO_OPT_BOOL,
3588 .off1 = td_var_offset(log_gz_store),
3589 .help = "Store logs in a compressed format",
3590 .category = FIO_OPT_C_LOG,
3591 .group = FIO_OPT_G_INVALID,
3595 .name = "log_compression",
3596 .lname = "Log compression",
3597 .type = FIO_OPT_UNSUPPORTED,
3598 .help = "Install libz-dev(el) to get compression support",
3601 .name = "log_store_compressed",
3602 .lname = "Log store compressed",
3603 .type = FIO_OPT_UNSUPPORTED,
3604 .help = "Install libz-dev(el) to get compression support",
3608 .name = "block_error_percentiles",
3609 .lname = "Block error percentiles",
3610 .type = FIO_OPT_BOOL,
3611 .off1 = td_var_offset(block_error_hist),
3612 .help = "Record trim block errors and make a histogram",
3614 .category = FIO_OPT_C_LOG,
3615 .group = FIO_OPT_G_INVALID,
3618 .name = "bwavgtime",
3619 .lname = "Bandwidth average time",
3620 .type = FIO_OPT_INT,
3621 .off1 = td_var_offset(bw_avg_time),
3622 .help = "Time window over which to calculate bandwidth"
3625 .parent = "write_bw_log",
3628 .category = FIO_OPT_C_LOG,
3629 .group = FIO_OPT_G_INVALID,
3632 .name = "iopsavgtime",
3633 .lname = "IOPS average time",
3634 .type = FIO_OPT_INT,
3635 .off1 = td_var_offset(iops_avg_time),
3636 .help = "Time window over which to calculate IOPS (msec)",
3638 .parent = "write_iops_log",
3641 .category = FIO_OPT_C_LOG,
3642 .group = FIO_OPT_G_INVALID,
3645 .name = "group_reporting",
3646 .lname = "Group reporting",
3647 .type = FIO_OPT_STR_SET,
3648 .off1 = td_var_offset(group_reporting),
3649 .help = "Do reporting on a per-group basis",
3650 .category = FIO_OPT_C_STAT,
3651 .group = FIO_OPT_G_INVALID,
3654 .name = "zero_buffers",
3655 .lname = "Zero I/O buffers",
3656 .type = FIO_OPT_STR_SET,
3657 .off1 = td_var_offset(zero_buffers),
3658 .help = "Init IO buffers to all zeroes",
3659 .category = FIO_OPT_C_IO,
3660 .group = FIO_OPT_G_IO_BUF,
3663 .name = "refill_buffers",
3664 .lname = "Refill I/O buffers",
3665 .type = FIO_OPT_STR_SET,
3666 .off1 = td_var_offset(refill_buffers),
3667 .help = "Refill IO buffers on every IO submit",
3668 .category = FIO_OPT_C_IO,
3669 .group = FIO_OPT_G_IO_BUF,
3672 .name = "scramble_buffers",
3673 .lname = "Scramble I/O buffers",
3674 .type = FIO_OPT_BOOL,
3675 .off1 = td_var_offset(scramble_buffers),
3676 .help = "Slightly scramble buffers on every IO submit",
3678 .category = FIO_OPT_C_IO,
3679 .group = FIO_OPT_G_IO_BUF,
3682 .name = "buffer_pattern",
3683 .lname = "Buffer pattern",
3684 .type = FIO_OPT_STR,
3685 .cb = str_buffer_pattern_cb,
3686 .off1 = td_var_offset(buffer_pattern),
3687 .help = "Fill pattern for IO buffers",
3688 .category = FIO_OPT_C_IO,
3689 .group = FIO_OPT_G_IO_BUF,
3692 .name = "buffer_compress_percentage",
3693 .lname = "Buffer compression percentage",
3694 .type = FIO_OPT_INT,
3695 .cb = str_buffer_compress_cb,
3696 .off1 = td_var_offset(compress_percentage),
3699 .help = "How compressible the buffer is (approximately)",
3701 .category = FIO_OPT_C_IO,
3702 .group = FIO_OPT_G_IO_BUF,
3705 .name = "buffer_compress_chunk",
3706 .lname = "Buffer compression chunk size",
3707 .type = FIO_OPT_INT,
3708 .off1 = td_var_offset(compress_chunk),
3709 .parent = "buffer_compress_percentage",
3711 .help = "Size of compressible region in buffer",
3713 .category = FIO_OPT_C_IO,
3714 .group = FIO_OPT_G_IO_BUF,
3717 .name = "dedupe_percentage",
3718 .lname = "Dedupe percentage",
3719 .type = FIO_OPT_INT,
3720 .cb = str_dedupe_cb,
3721 .off1 = td_var_offset(dedupe_percentage),
3724 .help = "Percentage of buffers that are dedupable",
3726 .category = FIO_OPT_C_IO,
3727 .group = FIO_OPT_G_IO_BUF,
3730 .name = "clat_percentiles",
3731 .lname = "Completion latency percentiles",
3732 .type = FIO_OPT_BOOL,
3733 .off1 = td_var_offset(clat_percentiles),
3734 .help = "Enable the reporting of completion latency percentiles",
3736 .category = FIO_OPT_C_STAT,
3737 .group = FIO_OPT_G_INVALID,
3740 .name = "percentile_list",
3741 .lname = "Percentile list",
3742 .type = FIO_OPT_FLOAT_LIST,
3743 .off1 = td_var_offset(percentile_list),
3744 .off2 = td_var_offset(percentile_precision),
3745 .help = "Specify a custom list of percentiles to report for "
3746 "completion latency and block errors",
3747 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3748 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3751 .category = FIO_OPT_C_STAT,
3752 .group = FIO_OPT_G_INVALID,
3755 #ifdef FIO_HAVE_DISK_UTIL
3757 .name = "disk_util",
3758 .lname = "Disk utilization",
3759 .type = FIO_OPT_BOOL,
3760 .off1 = td_var_offset(do_disk_util),
3761 .help = "Log disk utilization statistics",
3763 .category = FIO_OPT_C_STAT,
3764 .group = FIO_OPT_G_INVALID,
3768 .name = "disk_util",
3769 .lname = "Disk utilization",
3770 .type = FIO_OPT_UNSUPPORTED,
3771 .help = "Your platform does not support disk utilization",
3775 .name = "gtod_reduce",
3776 .lname = "Reduce gettimeofday() calls",
3777 .type = FIO_OPT_BOOL,
3778 .help = "Greatly reduce number of gettimeofday() calls",
3779 .cb = str_gtod_reduce_cb,
3782 .category = FIO_OPT_C_STAT,
3783 .group = FIO_OPT_G_INVALID,
3786 .name = "disable_lat",
3787 .lname = "Disable all latency stats",
3788 .type = FIO_OPT_BOOL,
3789 .off1 = td_var_offset(disable_lat),
3790 .help = "Disable latency numbers",
3791 .parent = "gtod_reduce",
3794 .category = FIO_OPT_C_STAT,
3795 .group = FIO_OPT_G_INVALID,
3798 .name = "disable_clat",
3799 .lname = "Disable completion latency stats",
3800 .type = FIO_OPT_BOOL,
3801 .off1 = td_var_offset(disable_clat),
3802 .help = "Disable completion latency numbers",
3803 .parent = "gtod_reduce",
3806 .category = FIO_OPT_C_STAT,
3807 .group = FIO_OPT_G_INVALID,
3810 .name = "disable_slat",
3811 .lname = "Disable submission latency stats",
3812 .type = FIO_OPT_BOOL,
3813 .off1 = td_var_offset(disable_slat),
3814 .help = "Disable submission latency numbers",
3815 .parent = "gtod_reduce",
3818 .category = FIO_OPT_C_STAT,
3819 .group = FIO_OPT_G_INVALID,
3822 .name = "disable_bw_measurement",
3823 .lname = "Disable bandwidth stats",
3824 .type = FIO_OPT_BOOL,
3825 .off1 = td_var_offset(disable_bw),
3826 .help = "Disable bandwidth logging",
3827 .parent = "gtod_reduce",
3830 .category = FIO_OPT_C_STAT,
3831 .group = FIO_OPT_G_INVALID,
3835 .lname = "Dedicated gettimeofday() CPU",
3836 .type = FIO_OPT_INT,
3837 .off1 = td_var_offset(gtod_cpu),
3838 .help = "Set up dedicated gettimeofday() thread on this CPU",
3839 .verify = gtod_cpu_verify,
3840 .category = FIO_OPT_C_GENERAL,
3841 .group = FIO_OPT_G_CLOCK,
3844 .name = "unified_rw_reporting",
3845 .lname = "Unified RW Reporting",
3846 .type = FIO_OPT_BOOL,
3847 .off1 = td_var_offset(unified_rw_rep),
3848 .help = "Unify reporting across data direction",
3850 .category = FIO_OPT_C_GENERAL,
3851 .group = FIO_OPT_G_INVALID,
3854 .name = "continue_on_error",
3855 .lname = "Continue on error",
3856 .type = FIO_OPT_STR,
3857 .off1 = td_var_offset(continue_on_error),
3858 .help = "Continue on non-fatal errors during IO",
3860 .category = FIO_OPT_C_GENERAL,
3861 .group = FIO_OPT_G_ERR,
3864 .oval = ERROR_TYPE_NONE,
3865 .help = "Exit when an error is encountered",
3868 .oval = ERROR_TYPE_READ,
3869 .help = "Continue on read errors only",
3872 .oval = ERROR_TYPE_WRITE,
3873 .help = "Continue on write errors only",
3876 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3877 .help = "Continue on any IO errors",
3880 .oval = ERROR_TYPE_VERIFY,
3881 .help = "Continue on verify errors only",
3884 .oval = ERROR_TYPE_ANY,
3885 .help = "Continue on all io and verify errors",
3888 .oval = ERROR_TYPE_NONE,
3889 .help = "Alias for 'none'",
3892 .oval = ERROR_TYPE_ANY,
3893 .help = "Alias for 'all'",
3898 .name = "ignore_error",
3899 .lname = "Ignore Error",
3900 .type = FIO_OPT_STR,
3901 .cb = str_ignore_error_cb,
3902 .off1 = td_var_offset(ignore_error_nr),
3903 .help = "Set a specific list of errors to ignore",
3905 .category = FIO_OPT_C_GENERAL,
3906 .group = FIO_OPT_G_ERR,
3909 .name = "error_dump",
3910 .lname = "Error Dump",
3911 .type = FIO_OPT_BOOL,
3912 .off1 = td_var_offset(error_dump),
3914 .help = "Dump info on each error",
3915 .category = FIO_OPT_C_GENERAL,
3916 .group = FIO_OPT_G_ERR,
3921 .type = FIO_OPT_STR_STORE,
3922 .off1 = td_var_offset(profile),
3923 .help = "Select a specific builtin performance test",
3924 .category = FIO_OPT_C_PROFILE,
3925 .group = FIO_OPT_G_INVALID,
3930 .type = FIO_OPT_STR_STORE,
3931 .off1 = td_var_offset(cgroup),
3932 .help = "Add job to cgroup of this name",
3933 .category = FIO_OPT_C_GENERAL,
3934 .group = FIO_OPT_G_CGROUP,
3937 .name = "cgroup_nodelete",
3938 .lname = "Cgroup no-delete",
3939 .type = FIO_OPT_BOOL,
3940 .off1 = td_var_offset(cgroup_nodelete),
3941 .help = "Do not delete cgroups after job completion",
3944 .category = FIO_OPT_C_GENERAL,
3945 .group = FIO_OPT_G_CGROUP,
3948 .name = "cgroup_weight",
3949 .lname = "Cgroup weight",
3950 .type = FIO_OPT_INT,
3951 .off1 = td_var_offset(cgroup_weight),
3952 .help = "Use given weight for cgroup",
3956 .category = FIO_OPT_C_GENERAL,
3957 .group = FIO_OPT_G_CGROUP,
3962 .type = FIO_OPT_INT,
3963 .off1 = td_var_offset(uid),
3964 .help = "Run job with this user ID",
3965 .category = FIO_OPT_C_GENERAL,
3966 .group = FIO_OPT_G_CRED,
3970 .lname = "Group ID",
3971 .type = FIO_OPT_INT,
3972 .off1 = td_var_offset(gid),
3973 .help = "Run job with this group ID",
3974 .category = FIO_OPT_C_GENERAL,
3975 .group = FIO_OPT_G_CRED,
3980 .type = FIO_OPT_INT,
3981 .off1 = td_var_offset(kb_base),
3987 .help = "Use 1024 as the K base",
3991 .help = "Use 1000 as the K base",
3994 .help = "How many bytes per KB for reporting (1000 or 1024)",
3995 .category = FIO_OPT_C_GENERAL,
3996 .group = FIO_OPT_G_INVALID,
3999 .name = "unit_base",
4000 .lname = "Base unit for reporting (Bits or Bytes)",
4001 .type = FIO_OPT_INT,
4002 .off1 = td_var_offset(unit_base),
4007 .help = "Auto-detect",
4011 .help = "Normal (byte based)",
4015 .help = "Bit based",
4018 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
4019 .category = FIO_OPT_C_GENERAL,
4020 .group = FIO_OPT_G_INVALID,
4023 .name = "hugepage-size",
4024 .lname = "Hugepage size",
4025 .type = FIO_OPT_INT,
4026 .off1 = td_var_offset(hugepage_size),
4027 .help = "When using hugepages, specify size of each page",
4028 .def = __fio_stringify(FIO_HUGE_PAGE),
4029 .interval = 1024 * 1024,
4030 .category = FIO_OPT_C_GENERAL,
4031 .group = FIO_OPT_G_INVALID,
4035 .lname = "I/O flow ID",
4036 .type = FIO_OPT_INT,
4037 .off1 = td_var_offset(flow_id),
4038 .help = "The flow index ID to use",
4040 .category = FIO_OPT_C_IO,
4041 .group = FIO_OPT_G_IO_FLOW,
4045 .lname = "I/O flow weight",
4046 .type = FIO_OPT_INT,
4047 .off1 = td_var_offset(flow),
4048 .help = "Weight for flow control of this job",
4049 .parent = "flow_id",
4052 .category = FIO_OPT_C_IO,
4053 .group = FIO_OPT_G_IO_FLOW,
4056 .name = "flow_watermark",
4057 .lname = "I/O flow watermark",
4058 .type = FIO_OPT_INT,
4059 .off1 = td_var_offset(flow_watermark),
4060 .help = "High watermark for flow control. This option"
4061 " should be set to the same value for all threads"
4062 " with non-zero flow.",
4063 .parent = "flow_id",
4066 .category = FIO_OPT_C_IO,
4067 .group = FIO_OPT_G_IO_FLOW,
4070 .name = "flow_sleep",
4071 .lname = "I/O flow sleep",
4072 .type = FIO_OPT_INT,
4073 .off1 = td_var_offset(flow_sleep),
4074 .help = "How many microseconds to sleep after being held"
4075 " back by the flow control mechanism",
4076 .parent = "flow_id",
4079 .category = FIO_OPT_C_IO,
4080 .group = FIO_OPT_G_IO_FLOW,
4084 .lname = "Skip operations against bad blocks",
4085 .type = FIO_OPT_BOOL,
4086 .off1 = td_var_offset(skip_bad),
4087 .help = "Skip operations against known bad blocks.",
4090 .category = FIO_OPT_C_IO,
4091 .group = FIO_OPT_G_MTD,
4098 static void add_to_lopt(struct option *lopt, struct fio_option *o,
4099 const char *name, int val)
4101 lopt->name = (char *) name;
4103 if (o->type == FIO_OPT_STR_SET)
4104 lopt->has_arg = optional_argument;
4106 lopt->has_arg = required_argument;
4109 static void options_to_lopts(struct fio_option *opts,
4110 struct option *long_options,
4111 int i, int option_type)
4113 struct fio_option *o = &opts[0];
4115 add_to_lopt(&long_options[i], o, o->name, option_type);
4118 add_to_lopt(&long_options[i], o, o->alias, option_type);
4123 assert(i < FIO_NR_OPTIONS);
4127 void fio_options_set_ioengine_opts(struct option *long_options,
4128 struct thread_data *td)
4133 while (long_options[i].name) {
4134 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
4135 memset(&long_options[i], 0, sizeof(*long_options));
4142 * Just clear out the prior ioengine options.
4147 options_to_lopts(td->io_ops->options, long_options, i,
4148 FIO_GETOPT_IOENGINE);
4151 void fio_options_dup_and_init(struct option *long_options)
4155 options_init(fio_options);
4158 while (long_options[i].name)
4161 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
4164 struct fio_keyword {
4170 static struct fio_keyword fio_keywords[] = {
4172 .word = "$pagesize",
4173 .desc = "Page size in the system",
4176 .word = "$mb_memory",
4177 .desc = "Megabytes of memory online",
4181 .desc = "Number of CPUs online in the system",
4188 void fio_keywords_exit(void)
4190 struct fio_keyword *kw;
4192 kw = &fio_keywords[0];
4200 void fio_keywords_init(void)
4202 unsigned long long mb_memory;
4206 sprintf(buf, "%lu", (unsigned long) page_size);
4207 fio_keywords[0].replace = strdup(buf);
4209 mb_memory = os_phys_mem() / (1024 * 1024);
4210 sprintf(buf, "%llu", mb_memory);
4211 fio_keywords[1].replace = strdup(buf);
4214 sprintf(buf, "%lu", l);
4215 fio_keywords[2].replace = strdup(buf);
4220 static char *bc_calc(char *str)
4222 char buf[128], *tmp;
4227 * No math, just return string
4229 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
4230 !strchr(str, '/')) || strchr(str, '\''))
4234 * Split option from value, we only need to calculate the value
4236 tmp = strchr(str, '=');
4243 * Prevent buffer overflows; such a case isn't reasonable anyway
4245 if (strlen(str) >= 128 || strlen(tmp) > 100)
4248 sprintf(buf, "which %s > /dev/null", BC_APP);
4250 log_err("fio: bc is needed for performing math\n");
4254 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
4255 f = popen(buf, "r");
4259 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
4266 buf[(tmp - str) + ret - 1] = '\0';
4267 memcpy(buf, str, tmp - str);
4273 * Return a copy of the input string with substrings of the form ${VARNAME}
4274 * substituted with the value of the environment variable VARNAME. The
4275 * substitution always occurs, even if VARNAME is empty or the corresponding
4276 * environment variable undefined.
4278 static char *option_dup_subs(const char *opt)
4280 char out[OPT_LEN_MAX+1];
4281 char in[OPT_LEN_MAX+1];
4284 char *ch1, *ch2, *env;
4285 ssize_t nchr = OPT_LEN_MAX;
4288 if (strlen(opt) + 1 > OPT_LEN_MAX) {
4289 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
4293 in[OPT_LEN_MAX] = '\0';
4294 strncpy(in, opt, OPT_LEN_MAX);
4296 while (*inptr && nchr > 0) {
4297 if (inptr[0] == '$' && inptr[1] == '{') {
4298 ch2 = strchr(inptr, '}');
4299 if (ch2 && inptr+1 < ch2) {
4306 envlen = strlen(env);
4307 if (envlen <= nchr) {
4308 memcpy(outptr, env, envlen);
4318 *outptr++ = *inptr++;
4327 * Look for reserved variable names and replace them with real values
4329 static char *fio_keyword_replace(char *opt)
4335 for (i = 0; fio_keywords[i].word != NULL; i++) {
4336 struct fio_keyword *kw = &fio_keywords[i];
4338 while ((s = strstr(opt, kw->word)) != NULL) {
4339 char *new = malloc(strlen(opt) + 1);
4345 * Copy part of the string before the keyword and
4346 * sprintf() the replacement after it.
4348 memcpy(new, opt, olen);
4349 len = sprintf(new + olen, "%s", kw->replace);
4352 * If there's more in the original string, copy that
4355 opt += strlen(kw->word) + olen;
4357 memcpy(new + olen + len, opt, opt - o_org - 1);
4360 * replace opt and free the old opt
4370 * Check for potential math and invoke bc, if possible
4378 static char **dup_and_sub_options(char **opts, int num_opts)
4381 char **opts_copy = malloc(num_opts * sizeof(*opts));
4382 for (i = 0; i < num_opts; i++) {
4383 opts_copy[i] = option_dup_subs(opts[i]);
4386 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
4391 static void show_closest_option(const char *opt)
4393 int best_option, best_distance;
4402 while (name[i] != '\0' && name[i] != '=')
4407 best_distance = INT_MAX;
4409 while (fio_options[i].name) {
4410 distance = string_distance(name, fio_options[i].name);
4411 if (distance < best_distance) {
4412 best_distance = distance;
4418 if (best_option != -1 && string_distance_ok(name, best_distance) &&
4419 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
4420 log_err("Did you mean %s?\n", fio_options[best_option].name);
4425 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
4427 int i, ret, unknown;
4430 sort_options(opts, fio_options, num_opts);
4431 opts_copy = dup_and_sub_options(opts, num_opts);
4433 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
4434 struct fio_option *o;
4435 int newret = parse_option(opts_copy[i], opts[i], fio_options,
4436 &o, td, &td->opt_list);
4439 fio_option_mark_set(&td->o, o);
4447 opts_copy[i] = NULL;
4454 ret |= ioengine_load(td);
4456 sort_options(opts_copy, td->io_ops->options, num_opts);
4459 for (i = 0; i < num_opts; i++) {
4460 struct fio_option *o = NULL;
4467 newret = parse_option(opts_copy[i], opts[i],
4468 td->io_ops->options, &o,
4469 td->eo, &td->opt_list);
4473 log_err("Bad option <%s>\n", opts[i]);
4474 show_closest_option(opts[i]);
4477 opts_copy[i] = NULL;
4485 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
4489 ret = parse_cmd_option(opt, val, fio_options, td, &td->opt_list);
4491 struct fio_option *o;
4493 o = find_option(fio_options, opt);
4495 fio_option_mark_set(&td->o, o);
4501 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
4504 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
4508 void fio_fill_default_options(struct thread_data *td)
4510 td->o.magic = OPT_MAGIC;
4511 fill_default_options(td, fio_options);
4514 int fio_show_option_help(const char *opt)
4516 return show_cmd_help(fio_options, opt);
4519 void options_mem_dupe(void *data, struct fio_option *options)
4521 struct fio_option *o;
4524 for (o = &options[0]; o->name; o++) {
4525 if (o->type != FIO_OPT_STR_STORE)
4528 ptr = td_var(data, o, o->off1);
4530 *ptr = strdup(*ptr);
4535 * dupe FIO_OPT_STR_STORE options
4537 void fio_options_mem_dupe(struct thread_data *td)
4539 options_mem_dupe(&td->o, fio_options);
4541 if (td->eo && td->io_ops) {
4542 void *oldeo = td->eo;
4544 td->eo = malloc(td->io_ops->option_struct_size);
4545 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
4546 options_mem_dupe(td->eo, td->io_ops->options);
4550 unsigned int fio_get_kb_base(void *data)
4552 struct thread_options *o = data;
4553 unsigned int kb_base = 0;
4556 * This is a hack... For private options, *data is not holding
4557 * a pointer to the thread_options, but to private data. This means
4558 * we can't safely dereference it, but magic is first so mem wise
4559 * it is valid. But this also means that if the job first sets
4560 * kb_base and expects that to be honored by private options,
4561 * it will be disappointed. We will return the global default
4564 if (o && o->magic == OPT_MAGIC)
4565 kb_base = o->kb_base;
4572 int add_option(struct fio_option *o)
4574 struct fio_option *__o;
4583 if (opt_index + 1 == FIO_MAX_OPTS) {
4584 log_err("fio: FIO_MAX_OPTS is too small\n");
4588 memcpy(&fio_options[opt_index], o, sizeof(*o));
4589 fio_options[opt_index + 1].name = NULL;
4593 void invalidate_profile_options(const char *prof_name)
4595 struct fio_option *o;
4599 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
4600 o->type = FIO_OPT_INVALID;
4601 o->prof_name = NULL;
4607 void add_opt_posval(const char *optname, const char *ival, const char *help)
4609 struct fio_option *o;
4612 o = find_option(fio_options, optname);
4616 for (i = 0; i < PARSE_MAX_VP; i++) {
4617 if (o->posval[i].ival)
4620 o->posval[i].ival = ival;
4621 o->posval[i].help = help;
4626 void del_opt_posval(const char *optname, const char *ival)
4628 struct fio_option *o;
4631 o = find_option(fio_options, optname);
4635 for (i = 0; i < PARSE_MAX_VP; i++) {
4636 if (!o->posval[i].ival)
4638 if (strcmp(o->posval[i].ival, ival))
4641 o->posval[i].ival = NULL;
4642 o->posval[i].help = NULL;
4646 void fio_options_free(struct thread_data *td)
4648 options_free(fio_options, td);
4649 if (td->eo && td->io_ops && td->io_ops->options) {
4650 options_free(td->io_ops->options, td->eo);
4656 struct fio_option *fio_option_find(const char *name)
4658 return find_option(fio_options, name);
4661 static struct fio_option *find_next_opt(struct thread_options *o,
4662 struct fio_option *from,
4665 struct fio_option *opt;
4668 from = &fio_options[0];
4674 if (off1 == from->off1) {
4679 } while (from->name);
4684 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
4686 unsigned int opt_off, index, offset;
4688 opt_off = opt - &fio_options[0];
4689 index = opt_off / (8 * sizeof(uint64_t));
4690 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4691 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
4694 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
4696 struct fio_option *opt, *next;
4699 while ((opt = find_next_opt(o, next, off1)) != NULL) {
4700 if (opt_is_set(o, opt))
4709 void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)
4711 unsigned int opt_off, index, offset;
4713 opt_off = opt - &fio_options[0];
4714 index = opt_off / (8 * sizeof(uint64_t));
4715 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4716 o->set_options[index] |= (uint64_t)1 << offset;