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(void *);
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 CONFIG_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",
1684 .category = FIO_OPT_C_IO,
1685 .group = FIO_OPT_G_IO_BASIC,
1688 .name = "iodepth_batch_complete_min",
1689 .lname = "Min IO depth batch complete",
1690 .alias = "iodepth_batch_complete",
1691 .type = FIO_OPT_INT,
1692 .off1 = td_var_offset(iodepth_batch_complete_min),
1693 .help = "Min number of IO buffers to retrieve in one go",
1694 .parent = "iodepth",
1699 .category = FIO_OPT_C_IO,
1700 .group = FIO_OPT_G_IO_BASIC,
1703 .name = "iodepth_batch_complete_max",
1704 .lname = "Max IO depth batch complete",
1705 .type = FIO_OPT_INT,
1706 .off1 = td_var_offset(iodepth_batch_complete_max),
1707 .help = "Max number of IO buffers to retrieve in one go",
1708 .parent = "iodepth",
1712 .category = FIO_OPT_C_IO,
1713 .group = FIO_OPT_G_IO_BASIC,
1716 .name = "iodepth_low",
1717 .lname = "IO Depth batch low",
1718 .type = FIO_OPT_INT,
1719 .off1 = td_var_offset(iodepth_low),
1720 .help = "Low water mark for queuing depth",
1721 .parent = "iodepth",
1724 .category = FIO_OPT_C_IO,
1725 .group = FIO_OPT_G_IO_BASIC,
1728 .name = "io_submit_mode",
1729 .lname = "IO submit mode",
1730 .type = FIO_OPT_STR,
1731 .off1 = td_var_offset(io_submit_mode),
1732 .help = "How IO submissions and completions are done",
1734 .category = FIO_OPT_C_IO,
1735 .group = FIO_OPT_G_IO_BASIC,
1738 .oval = IO_MODE_INLINE,
1739 .help = "Submit and complete IO inline",
1741 { .ival = "offload",
1742 .oval = IO_MODE_OFFLOAD,
1743 .help = "Offload submit and complete to threads",
1750 .type = FIO_OPT_STR_VAL,
1752 .off1 = td_var_offset(size),
1753 .help = "Total size of device or files",
1754 .interval = 1024 * 1024,
1755 .category = FIO_OPT_C_IO,
1756 .group = FIO_OPT_G_INVALID,
1760 .alias = "io_limit",
1762 .type = FIO_OPT_STR_VAL,
1763 .off1 = td_var_offset(io_limit),
1764 .interval = 1024 * 1024,
1765 .category = FIO_OPT_C_IO,
1766 .group = FIO_OPT_G_INVALID,
1769 .name = "fill_device",
1770 .lname = "Fill device",
1772 .type = FIO_OPT_BOOL,
1773 .off1 = td_var_offset(fill_device),
1774 .help = "Write until an ENOSPC error occurs",
1776 .category = FIO_OPT_C_FILE,
1777 .group = FIO_OPT_G_INVALID,
1781 .lname = "File size",
1782 .type = FIO_OPT_STR_VAL,
1783 .off1 = td_var_offset(file_size_low),
1784 .off2 = td_var_offset(file_size_high),
1786 .help = "Size of individual files",
1787 .interval = 1024 * 1024,
1788 .category = FIO_OPT_C_FILE,
1789 .group = FIO_OPT_G_INVALID,
1792 .name = "file_append",
1793 .lname = "File append",
1794 .type = FIO_OPT_BOOL,
1795 .off1 = td_var_offset(file_append),
1796 .help = "IO will start at the end of the file(s)",
1798 .category = FIO_OPT_C_FILE,
1799 .group = FIO_OPT_G_INVALID,
1803 .lname = "IO offset",
1804 .alias = "fileoffset",
1805 .type = FIO_OPT_STR_VAL,
1806 .off1 = td_var_offset(start_offset),
1807 .help = "Start IO from this offset",
1809 .interval = 1024 * 1024,
1810 .category = FIO_OPT_C_IO,
1811 .group = FIO_OPT_G_INVALID,
1814 .name = "offset_increment",
1815 .lname = "IO offset increment",
1816 .type = FIO_OPT_STR_VAL,
1817 .off1 = td_var_offset(offset_increment),
1818 .help = "What is the increment from one offset to the next",
1822 .interval = 1024 * 1024,
1823 .category = FIO_OPT_C_IO,
1824 .group = FIO_OPT_G_INVALID,
1827 .name = "number_ios",
1828 .lname = "Number of IOs to perform",
1829 .type = FIO_OPT_STR_VAL,
1830 .off1 = td_var_offset(number_ios),
1831 .help = "Force job completion after this number of IOs",
1833 .category = FIO_OPT_C_IO,
1834 .group = FIO_OPT_G_INVALID,
1838 .lname = "Block size",
1839 .alias = "blocksize",
1840 .type = FIO_OPT_INT,
1841 .off1 = td_var_offset(bs[DDIR_READ]),
1842 .off2 = td_var_offset(bs[DDIR_WRITE]),
1843 .off3 = td_var_offset(bs[DDIR_TRIM]),
1845 .help = "Block size unit",
1850 .category = FIO_OPT_C_IO,
1851 .group = FIO_OPT_G_INVALID,
1855 .lname = "Block size align",
1856 .alias = "blockalign",
1857 .type = FIO_OPT_INT,
1858 .off1 = td_var_offset(ba[DDIR_READ]),
1859 .off2 = td_var_offset(ba[DDIR_WRITE]),
1860 .off3 = td_var_offset(ba[DDIR_TRIM]),
1862 .help = "IO block offset alignment",
1866 .category = FIO_OPT_C_IO,
1867 .group = FIO_OPT_G_INVALID,
1871 .lname = "Block size range",
1872 .alias = "blocksize_range",
1873 .type = FIO_OPT_RANGE,
1874 .off1 = td_var_offset(min_bs[DDIR_READ]),
1875 .off2 = td_var_offset(max_bs[DDIR_READ]),
1876 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1877 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1878 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1879 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1881 .help = "Set block size range (in more detail than bs)",
1885 .category = FIO_OPT_C_IO,
1886 .group = FIO_OPT_G_INVALID,
1890 .lname = "Block size split",
1891 .type = FIO_OPT_STR,
1892 .cb = str_bssplit_cb,
1893 .off1 = td_var_offset(bssplit),
1894 .help = "Set a specific mix of block sizes",
1897 .category = FIO_OPT_C_IO,
1898 .group = FIO_OPT_G_INVALID,
1901 .name = "bs_unaligned",
1902 .lname = "Block size unaligned",
1903 .alias = "blocksize_unaligned",
1904 .type = FIO_OPT_STR_SET,
1905 .off1 = td_var_offset(bs_unaligned),
1906 .help = "Don't sector align IO buffer sizes",
1909 .category = FIO_OPT_C_IO,
1910 .group = FIO_OPT_G_INVALID,
1913 .name = "bs_is_seq_rand",
1914 .lname = "Block size division is seq/random (not read/write)",
1915 .type = FIO_OPT_BOOL,
1916 .off1 = td_var_offset(bs_is_seq_rand),
1917 .help = "Consider any blocksize setting to be sequential,random",
1919 .parent = "blocksize",
1920 .category = FIO_OPT_C_IO,
1921 .group = FIO_OPT_G_INVALID,
1924 .name = "randrepeat",
1925 .lname = "Random repeatable",
1926 .type = FIO_OPT_BOOL,
1927 .off1 = td_var_offset(rand_repeatable),
1928 .help = "Use repeatable random IO pattern",
1932 .category = FIO_OPT_C_IO,
1933 .group = FIO_OPT_G_RANDOM,
1937 .lname = "The random generator seed",
1938 .type = FIO_OPT_STR_VAL,
1939 .off1 = td_var_offset(rand_seed),
1940 .help = "Set the random generator seed value",
1943 .category = FIO_OPT_C_IO,
1944 .group = FIO_OPT_G_RANDOM,
1947 .name = "use_os_rand",
1948 .lname = "Use OS random",
1949 .type = FIO_OPT_DEPRECATED,
1950 .off1 = td_var_offset(dep_use_os_rand),
1951 .category = FIO_OPT_C_IO,
1952 .group = FIO_OPT_G_RANDOM,
1955 .name = "norandommap",
1956 .lname = "No randommap",
1957 .type = FIO_OPT_STR_SET,
1958 .off1 = td_var_offset(norandommap),
1959 .help = "Accept potential duplicate random blocks",
1963 .category = FIO_OPT_C_IO,
1964 .group = FIO_OPT_G_RANDOM,
1967 .name = "softrandommap",
1968 .lname = "Soft randommap",
1969 .type = FIO_OPT_BOOL,
1970 .off1 = td_var_offset(softrandommap),
1971 .help = "Set norandommap if randommap allocation fails",
1972 .parent = "norandommap",
1975 .category = FIO_OPT_C_IO,
1976 .group = FIO_OPT_G_RANDOM,
1979 .name = "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 .type = FIO_OPT_STR,
2005 .off1 = td_var_offset(random_distribution),
2006 .cb = str_random_distribution_cb,
2007 .help = "Random offset distribution generator",
2011 .oval = FIO_RAND_DIST_RANDOM,
2012 .help = "Completely random",
2015 .oval = FIO_RAND_DIST_ZIPF,
2016 .help = "Zipf distribution",
2019 .oval = FIO_RAND_DIST_PARETO,
2020 .help = "Pareto distribution",
2023 .oval = FIO_RAND_DIST_GAUSS,
2024 .help = "Normal (gaussian) distribution",
2027 .oval = FIO_RAND_DIST_ZONED,
2028 .help = "Zoned random distribution",
2032 .category = FIO_OPT_C_IO,
2033 .group = FIO_OPT_G_RANDOM,
2036 .name = "percentage_random",
2037 .lname = "Percentage Random",
2038 .type = FIO_OPT_INT,
2039 .off1 = td_var_offset(perc_rand[DDIR_READ]),
2040 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
2041 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
2043 .help = "Percentage of seq/random mix that should be random",
2044 .def = "100,100,100",
2046 .inverse = "percentage_sequential",
2047 .category = FIO_OPT_C_IO,
2048 .group = FIO_OPT_G_RANDOM,
2051 .name = "percentage_sequential",
2052 .lname = "Percentage Sequential",
2053 .type = FIO_OPT_DEPRECATED,
2054 .category = FIO_OPT_C_IO,
2055 .group = FIO_OPT_G_RANDOM,
2058 .name = "allrandrepeat",
2059 .type = FIO_OPT_BOOL,
2060 .off1 = td_var_offset(allrand_repeatable),
2061 .help = "Use repeatable random numbers for everything",
2063 .category = FIO_OPT_C_IO,
2064 .group = FIO_OPT_G_RANDOM,
2068 .lname = "Number of files",
2069 .alias = "nr_files",
2070 .type = FIO_OPT_INT,
2071 .off1 = td_var_offset(nr_files),
2072 .help = "Split job workload between this number of files",
2075 .category = FIO_OPT_C_FILE,
2076 .group = FIO_OPT_G_INVALID,
2079 .name = "openfiles",
2080 .lname = "Number of open files",
2081 .type = FIO_OPT_INT,
2082 .off1 = td_var_offset(open_files),
2083 .help = "Number of files to keep open at the same time",
2084 .category = FIO_OPT_C_FILE,
2085 .group = FIO_OPT_G_INVALID,
2088 .name = "file_service_type",
2089 .lname = "File service type",
2090 .type = FIO_OPT_STR,
2092 .off1 = td_var_offset(file_service_type),
2093 .help = "How to select which file to service next",
2094 .def = "roundrobin",
2095 .category = FIO_OPT_C_FILE,
2096 .group = FIO_OPT_G_INVALID,
2099 .oval = FIO_FSERVICE_RANDOM,
2100 .help = "Choose a file at random (uniform)",
2103 .oval = FIO_FSERVICE_ZIPF,
2104 .help = "Zipf randomized",
2107 .oval = FIO_FSERVICE_PARETO,
2108 .help = "Pareto randomized",
2111 .oval = FIO_FSERVICE_GAUSS,
2112 .help = "Normal (guassian) distribution",
2114 { .ival = "roundrobin",
2115 .oval = FIO_FSERVICE_RR,
2116 .help = "Round robin select files",
2118 { .ival = "sequential",
2119 .oval = FIO_FSERVICE_SEQ,
2120 .help = "Finish one file before moving to the next",
2123 .parent = "nrfiles",
2126 #ifdef CONFIG_POSIX_FALLOCATE
2128 .name = "fallocate",
2129 .lname = "Fallocate",
2130 .type = FIO_OPT_STR,
2131 .off1 = td_var_offset(fallocate_mode),
2132 .help = "Whether pre-allocation is performed when laying out files",
2134 .category = FIO_OPT_C_FILE,
2135 .group = FIO_OPT_G_INVALID,
2138 .oval = FIO_FALLOCATE_NONE,
2139 .help = "Do not pre-allocate space",
2142 .oval = FIO_FALLOCATE_POSIX,
2143 .help = "Use posix_fallocate()",
2145 #ifdef CONFIG_LINUX_FALLOCATE
2147 .oval = FIO_FALLOCATE_KEEP_SIZE,
2148 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2151 /* Compatibility with former boolean values */
2153 .oval = FIO_FALLOCATE_NONE,
2154 .help = "Alias for 'none'",
2157 .oval = FIO_FALLOCATE_POSIX,
2158 .help = "Alias for 'posix'",
2162 #endif /* CONFIG_POSIX_FALLOCATE */
2164 .name = "fadvise_hint",
2165 .lname = "Fadvise hint",
2166 .type = FIO_OPT_BOOL,
2167 .off1 = td_var_offset(fadvise_hint),
2168 .help = "Use fadvise() to advise the kernel on IO pattern",
2170 .category = FIO_OPT_C_FILE,
2171 .group = FIO_OPT_G_INVALID,
2173 #ifdef FIO_HAVE_STREAMID
2175 .name = "fadvise_stream",
2176 .lname = "Fadvise stream",
2177 .type = FIO_OPT_INT,
2178 .off1 = td_var_offset(fadvise_stream),
2179 .help = "Use fadvise() to set stream ID",
2180 .category = FIO_OPT_C_FILE,
2181 .group = FIO_OPT_G_INVALID,
2187 .type = FIO_OPT_INT,
2188 .off1 = td_var_offset(fsync_blocks),
2189 .help = "Issue fsync for writes every given number of blocks",
2192 .category = FIO_OPT_C_FILE,
2193 .group = FIO_OPT_G_INVALID,
2196 .name = "fdatasync",
2197 .lname = "Fdatasync",
2198 .type = FIO_OPT_INT,
2199 .off1 = td_var_offset(fdatasync_blocks),
2200 .help = "Issue fdatasync for writes every given number of blocks",
2203 .category = FIO_OPT_C_FILE,
2204 .group = FIO_OPT_G_INVALID,
2207 .name = "write_barrier",
2208 .lname = "Write barrier",
2209 .type = FIO_OPT_INT,
2210 .off1 = td_var_offset(barrier_blocks),
2211 .help = "Make every Nth write a barrier write",
2214 .category = FIO_OPT_C_IO,
2215 .group = FIO_OPT_G_INVALID,
2217 #ifdef CONFIG_SYNC_FILE_RANGE
2219 .name = "sync_file_range",
2220 .lname = "Sync file range",
2222 { .ival = "wait_before",
2223 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2224 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2228 .oval = SYNC_FILE_RANGE_WRITE,
2229 .help = "SYNC_FILE_RANGE_WRITE",
2233 .ival = "wait_after",
2234 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2235 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2239 .type = FIO_OPT_STR_MULTI,
2241 .off1 = td_var_offset(sync_file_range),
2242 .help = "Use sync_file_range()",
2243 .category = FIO_OPT_C_FILE,
2244 .group = FIO_OPT_G_INVALID,
2249 .lname = "Direct I/O",
2250 .type = FIO_OPT_BOOL,
2251 .off1 = td_var_offset(odirect),
2252 .help = "Use O_DIRECT IO (negates buffered)",
2254 .inverse = "buffered",
2255 .category = FIO_OPT_C_IO,
2256 .group = FIO_OPT_G_IO_TYPE,
2260 .lname = "Atomic I/O",
2261 .type = FIO_OPT_BOOL,
2262 .off1 = td_var_offset(oatomic),
2263 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2265 .category = FIO_OPT_C_IO,
2266 .group = FIO_OPT_G_IO_TYPE,
2270 .lname = "Buffered I/O",
2271 .type = FIO_OPT_BOOL,
2272 .off1 = td_var_offset(odirect),
2274 .help = "Use buffered IO (negates direct)",
2276 .inverse = "direct",
2277 .category = FIO_OPT_C_IO,
2278 .group = FIO_OPT_G_IO_TYPE,
2281 .name = "overwrite",
2282 .lname = "Overwrite",
2283 .type = FIO_OPT_BOOL,
2284 .off1 = td_var_offset(overwrite),
2285 .help = "When writing, set whether to overwrite current data",
2287 .category = FIO_OPT_C_FILE,
2288 .group = FIO_OPT_G_INVALID,
2293 .type = FIO_OPT_INT,
2294 .off1 = td_var_offset(loops),
2295 .help = "Number of times to run the job",
2298 .category = FIO_OPT_C_GENERAL,
2299 .group = FIO_OPT_G_RUNTIME,
2303 .lname = "Number of jobs",
2304 .type = FIO_OPT_INT,
2305 .off1 = td_var_offset(numjobs),
2306 .help = "Duplicate this job this many times",
2309 .category = FIO_OPT_C_GENERAL,
2310 .group = FIO_OPT_G_RUNTIME,
2313 .name = "startdelay",
2314 .lname = "Start delay",
2315 .type = FIO_OPT_STR_VAL_TIME,
2316 .off1 = td_var_offset(start_delay),
2317 .off2 = td_var_offset(start_delay_high),
2318 .help = "Only start job when this period has passed",
2322 .category = FIO_OPT_C_GENERAL,
2323 .group = FIO_OPT_G_RUNTIME,
2329 .type = FIO_OPT_STR_VAL_TIME,
2330 .off1 = td_var_offset(timeout),
2331 .help = "Stop workload when this amount of time has passed",
2335 .category = FIO_OPT_C_GENERAL,
2336 .group = FIO_OPT_G_RUNTIME,
2339 .name = "time_based",
2340 .lname = "Time based",
2341 .type = FIO_OPT_STR_SET,
2342 .off1 = td_var_offset(time_based),
2343 .help = "Keep running until runtime/timeout is met",
2344 .category = FIO_OPT_C_GENERAL,
2345 .group = FIO_OPT_G_RUNTIME,
2348 .name = "verify_only",
2349 .lname = "Verify only",
2350 .type = FIO_OPT_STR_SET,
2351 .off1 = td_var_offset(verify_only),
2352 .help = "Verifies previously written data is still valid",
2353 .category = FIO_OPT_C_GENERAL,
2354 .group = FIO_OPT_G_RUNTIME,
2357 .name = "ramp_time",
2358 .lname = "Ramp time",
2359 .type = FIO_OPT_STR_VAL_TIME,
2360 .off1 = td_var_offset(ramp_time),
2361 .help = "Ramp up time before measuring performance",
2364 .category = FIO_OPT_C_GENERAL,
2365 .group = FIO_OPT_G_RUNTIME,
2368 .name = "clocksource",
2369 .lname = "Clock source",
2370 .type = FIO_OPT_STR,
2371 .cb = fio_clock_source_cb,
2372 .off1 = td_var_offset(clocksource),
2373 .help = "What type of timing source to use",
2374 .category = FIO_OPT_C_GENERAL,
2375 .group = FIO_OPT_G_CLOCK,
2377 #ifdef CONFIG_GETTIMEOFDAY
2378 { .ival = "gettimeofday",
2380 .help = "Use gettimeofday(2) for timing",
2383 #ifdef CONFIG_CLOCK_GETTIME
2384 { .ival = "clock_gettime",
2385 .oval = CS_CGETTIME,
2386 .help = "Use clock_gettime(2) for timing",
2389 #ifdef ARCH_HAVE_CPU_CLOCK
2391 .oval = CS_CPUCLOCK,
2392 .help = "Use CPU private clock",
2400 .lname = "I/O Memory",
2401 .type = FIO_OPT_STR,
2403 .off1 = td_var_offset(mem_type),
2404 .help = "Backing type for IO buffers",
2406 .category = FIO_OPT_C_IO,
2407 .group = FIO_OPT_G_INVALID,
2411 .help = "Use malloc(3) for IO buffers",
2413 #ifndef CONFIG_NO_SHM
2416 .help = "Use shared memory segments for IO buffers",
2418 #ifdef FIO_HAVE_HUGETLB
2419 { .ival = "shmhuge",
2420 .oval = MEM_SHMHUGE,
2421 .help = "Like shm, but use huge pages",
2427 .help = "Use mmap(2) (file or anon) for IO buffers",
2429 { .ival = "mmapshared",
2430 .oval = MEM_MMAPSHARED,
2431 .help = "Like mmap, but use the shared flag",
2433 #ifdef FIO_HAVE_HUGETLB
2434 { .ival = "mmaphuge",
2435 .oval = MEM_MMAPHUGE,
2436 .help = "Like mmap, but use huge pages",
2442 .name = "iomem_align",
2443 .alias = "mem_align",
2444 .lname = "I/O memory alignment",
2445 .type = FIO_OPT_INT,
2446 .off1 = td_var_offset(mem_align),
2448 .help = "IO memory buffer offset alignment",
2452 .category = FIO_OPT_C_IO,
2453 .group = FIO_OPT_G_INVALID,
2458 .type = FIO_OPT_STR,
2459 .off1 = td_var_offset(verify),
2460 .help = "Verify data written",
2462 .category = FIO_OPT_C_IO,
2463 .group = FIO_OPT_G_VERIFY,
2466 .oval = VERIFY_NONE,
2467 .help = "Don't do IO verification",
2471 .help = "Use md5 checksums for verification",
2474 .oval = VERIFY_CRC64,
2475 .help = "Use crc64 checksums for verification",
2478 .oval = VERIFY_CRC32,
2479 .help = "Use crc32 checksums for verification",
2481 { .ival = "crc32c-intel",
2482 .oval = VERIFY_CRC32C,
2483 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2486 .oval = VERIFY_CRC32C,
2487 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2490 .oval = VERIFY_CRC16,
2491 .help = "Use crc16 checksums for verification",
2494 .oval = VERIFY_CRC7,
2495 .help = "Use crc7 checksums for verification",
2498 .oval = VERIFY_SHA1,
2499 .help = "Use sha1 checksums for verification",
2502 .oval = VERIFY_SHA256,
2503 .help = "Use sha256 checksums for verification",
2506 .oval = VERIFY_SHA512,
2507 .help = "Use sha512 checksums for verification",
2510 .oval = VERIFY_XXHASH,
2511 .help = "Use xxhash checksums for verification",
2513 /* Meta information was included into verify_header,
2514 * 'meta' verification is implied by default. */
2516 .oval = VERIFY_HDR_ONLY,
2517 .help = "Use io information for verification. "
2518 "Now is implied by default, thus option is obsolete, "
2521 { .ival = "pattern",
2522 .oval = VERIFY_PATTERN_NO_HDR,
2523 .help = "Verify strict pattern",
2527 .oval = VERIFY_NULL,
2528 .help = "Pretend to verify",
2533 .name = "do_verify",
2534 .lname = "Perform verify step",
2535 .type = FIO_OPT_BOOL,
2536 .off1 = td_var_offset(do_verify),
2537 .help = "Run verification stage after write",
2541 .category = FIO_OPT_C_IO,
2542 .group = FIO_OPT_G_VERIFY,
2545 .name = "verifysort",
2546 .lname = "Verify sort",
2547 .type = FIO_OPT_BOOL,
2548 .off1 = td_var_offset(verifysort),
2549 .help = "Sort written verify blocks for read back",
2553 .category = FIO_OPT_C_IO,
2554 .group = FIO_OPT_G_VERIFY,
2557 .name = "verifysort_nr",
2558 .type = FIO_OPT_INT,
2559 .off1 = td_var_offset(verifysort_nr),
2560 .help = "Pre-load and sort verify blocks for a read workload",
2565 .category = FIO_OPT_C_IO,
2566 .group = FIO_OPT_G_VERIFY,
2569 .name = "verify_interval",
2570 .lname = "Verify interval",
2571 .type = FIO_OPT_INT,
2572 .off1 = td_var_offset(verify_interval),
2573 .minval = 2 * sizeof(struct verify_header),
2574 .help = "Store verify buffer header every N bytes",
2577 .interval = 2 * sizeof(struct verify_header),
2578 .category = FIO_OPT_C_IO,
2579 .group = FIO_OPT_G_VERIFY,
2582 .name = "verify_offset",
2583 .lname = "Verify offset",
2584 .type = FIO_OPT_INT,
2585 .help = "Offset verify header location by N bytes",
2586 .off1 = td_var_offset(verify_offset),
2587 .minval = sizeof(struct verify_header),
2590 .category = FIO_OPT_C_IO,
2591 .group = FIO_OPT_G_VERIFY,
2594 .name = "verify_pattern",
2595 .lname = "Verify pattern",
2596 .type = FIO_OPT_STR,
2597 .cb = str_verify_pattern_cb,
2598 .off1 = td_var_offset(verify_pattern),
2599 .help = "Fill pattern for IO buffers",
2602 .category = FIO_OPT_C_IO,
2603 .group = FIO_OPT_G_VERIFY,
2606 .name = "verify_fatal",
2607 .lname = "Verify fatal",
2608 .type = FIO_OPT_BOOL,
2609 .off1 = td_var_offset(verify_fatal),
2611 .help = "Exit on a single verify failure, don't continue",
2614 .category = FIO_OPT_C_IO,
2615 .group = FIO_OPT_G_VERIFY,
2618 .name = "verify_dump",
2619 .lname = "Verify dump",
2620 .type = FIO_OPT_BOOL,
2621 .off1 = td_var_offset(verify_dump),
2623 .help = "Dump contents of good and bad blocks on failure",
2626 .category = FIO_OPT_C_IO,
2627 .group = FIO_OPT_G_VERIFY,
2630 .name = "verify_async",
2631 .lname = "Verify asynchronously",
2632 .type = FIO_OPT_INT,
2633 .off1 = td_var_offset(verify_async),
2635 .help = "Number of async verifier threads to use",
2638 .category = FIO_OPT_C_IO,
2639 .group = FIO_OPT_G_VERIFY,
2642 .name = "verify_backlog",
2643 .lname = "Verify backlog",
2644 .type = FIO_OPT_STR_VAL,
2645 .off1 = td_var_offset(verify_backlog),
2646 .help = "Verify after this number of blocks are written",
2649 .category = FIO_OPT_C_IO,
2650 .group = FIO_OPT_G_VERIFY,
2653 .name = "verify_backlog_batch",
2654 .lname = "Verify backlog batch",
2655 .type = FIO_OPT_INT,
2656 .off1 = td_var_offset(verify_batch),
2657 .help = "Verify this number of IO blocks",
2660 .category = FIO_OPT_C_IO,
2661 .group = FIO_OPT_G_VERIFY,
2663 #ifdef FIO_HAVE_CPU_AFFINITY
2665 .name = "verify_async_cpus",
2666 .lname = "Async verify CPUs",
2667 .type = FIO_OPT_STR,
2668 .cb = str_verify_cpus_allowed_cb,
2669 .off1 = td_var_offset(verify_cpumask),
2670 .help = "Set CPUs allowed for async verify threads",
2671 .parent = "verify_async",
2673 .category = FIO_OPT_C_IO,
2674 .group = FIO_OPT_G_VERIFY,
2678 .name = "experimental_verify",
2679 .off1 = td_var_offset(experimental_verify),
2680 .type = FIO_OPT_BOOL,
2681 .help = "Enable experimental verification",
2683 .category = FIO_OPT_C_IO,
2684 .group = FIO_OPT_G_VERIFY,
2687 .name = "verify_state_load",
2688 .lname = "Load verify state",
2689 .off1 = td_var_offset(verify_state),
2690 .type = FIO_OPT_BOOL,
2691 .help = "Load verify termination state",
2693 .category = FIO_OPT_C_IO,
2694 .group = FIO_OPT_G_VERIFY,
2697 .name = "verify_state_save",
2698 .lname = "Save verify state",
2699 .off1 = td_var_offset(verify_state_save),
2700 .type = FIO_OPT_BOOL,
2702 .help = "Save verify state on termination",
2704 .category = FIO_OPT_C_IO,
2705 .group = FIO_OPT_G_VERIFY,
2707 #ifdef FIO_HAVE_TRIM
2709 .name = "trim_percentage",
2710 .lname = "Trim percentage",
2711 .type = FIO_OPT_INT,
2712 .off1 = td_var_offset(trim_percentage),
2715 .help = "Number of verify blocks to discard/trim",
2720 .category = FIO_OPT_C_IO,
2721 .group = FIO_OPT_G_TRIM,
2724 .name = "trim_verify_zero",
2725 .lname = "Verify trim zero",
2726 .type = FIO_OPT_BOOL,
2727 .help = "Verify that trim/discarded blocks are returned as zeroes",
2728 .off1 = td_var_offset(trim_zero),
2729 .parent = "trim_percentage",
2732 .category = FIO_OPT_C_IO,
2733 .group = FIO_OPT_G_TRIM,
2736 .name = "trim_backlog",
2737 .lname = "Trim backlog",
2738 .type = FIO_OPT_STR_VAL,
2739 .off1 = td_var_offset(trim_backlog),
2740 .help = "Trim after this number of blocks are written",
2741 .parent = "trim_percentage",
2744 .category = FIO_OPT_C_IO,
2745 .group = FIO_OPT_G_TRIM,
2748 .name = "trim_backlog_batch",
2749 .lname = "Trim backlog batch",
2750 .type = FIO_OPT_INT,
2751 .off1 = td_var_offset(trim_batch),
2752 .help = "Trim this number of IO blocks",
2753 .parent = "trim_percentage",
2756 .category = FIO_OPT_C_IO,
2757 .group = FIO_OPT_G_TRIM,
2761 .name = "write_iolog",
2762 .lname = "Write I/O log",
2763 .type = FIO_OPT_STR_STORE,
2764 .off1 = td_var_offset(write_iolog_file),
2765 .help = "Store IO pattern to file",
2766 .category = FIO_OPT_C_IO,
2767 .group = FIO_OPT_G_IOLOG,
2770 .name = "read_iolog",
2771 .lname = "Read I/O log",
2772 .type = FIO_OPT_STR_STORE,
2773 .off1 = td_var_offset(read_iolog_file),
2774 .help = "Playback IO pattern from file",
2775 .category = FIO_OPT_C_IO,
2776 .group = FIO_OPT_G_IOLOG,
2779 .name = "replay_no_stall",
2780 .lname = "Don't stall on replay",
2781 .type = FIO_OPT_BOOL,
2782 .off1 = td_var_offset(no_stall),
2784 .parent = "read_iolog",
2786 .help = "Playback IO pattern file as fast as possible without stalls",
2787 .category = FIO_OPT_C_IO,
2788 .group = FIO_OPT_G_IOLOG,
2791 .name = "replay_redirect",
2792 .lname = "Redirect device for replay",
2793 .type = FIO_OPT_STR_STORE,
2794 .off1 = td_var_offset(replay_redirect),
2795 .parent = "read_iolog",
2797 .help = "Replay all I/O onto this device, regardless of trace device",
2798 .category = FIO_OPT_C_IO,
2799 .group = FIO_OPT_G_IOLOG,
2802 .name = "replay_scale",
2803 .lname = "Replace offset scale factor",
2804 .type = FIO_OPT_INT,
2805 .off1 = td_var_offset(replay_scale),
2806 .parent = "read_iolog",
2808 .help = "Align offsets to this blocksize",
2809 .category = FIO_OPT_C_IO,
2810 .group = FIO_OPT_G_IOLOG,
2813 .name = "replay_align",
2814 .lname = "Replace alignment",
2815 .type = FIO_OPT_INT,
2816 .off1 = td_var_offset(replay_align),
2817 .parent = "read_iolog",
2818 .help = "Scale offset down by this factor",
2819 .category = FIO_OPT_C_IO,
2820 .group = FIO_OPT_G_IOLOG,
2824 .name = "exec_prerun",
2825 .lname = "Pre-execute runnable",
2826 .type = FIO_OPT_STR_STORE,
2827 .off1 = td_var_offset(exec_prerun),
2828 .help = "Execute this file prior to running job",
2829 .category = FIO_OPT_C_GENERAL,
2830 .group = FIO_OPT_G_INVALID,
2833 .name = "exec_postrun",
2834 .lname = "Post-execute runnable",
2835 .type = FIO_OPT_STR_STORE,
2836 .off1 = td_var_offset(exec_postrun),
2837 .help = "Execute this file after running job",
2838 .category = FIO_OPT_C_GENERAL,
2839 .group = FIO_OPT_G_INVALID,
2841 #ifdef FIO_HAVE_IOSCHED_SWITCH
2843 .name = "ioscheduler",
2844 .lname = "I/O scheduler",
2845 .type = FIO_OPT_STR_STORE,
2846 .off1 = td_var_offset(ioscheduler),
2847 .help = "Use this IO scheduler on the backing device",
2848 .category = FIO_OPT_C_FILE,
2849 .group = FIO_OPT_G_INVALID,
2854 .lname = "Zone size",
2855 .type = FIO_OPT_STR_VAL,
2856 .off1 = td_var_offset(zone_size),
2857 .help = "Amount of data to read per zone",
2859 .interval = 1024 * 1024,
2860 .category = FIO_OPT_C_IO,
2861 .group = FIO_OPT_G_ZONE,
2864 .name = "zonerange",
2865 .lname = "Zone range",
2866 .type = FIO_OPT_STR_VAL,
2867 .off1 = td_var_offset(zone_range),
2868 .help = "Give size of an IO zone",
2870 .interval = 1024 * 1024,
2871 .category = FIO_OPT_C_IO,
2872 .group = FIO_OPT_G_ZONE,
2876 .lname = "Zone skip",
2877 .type = FIO_OPT_STR_VAL,
2878 .off1 = td_var_offset(zone_skip),
2879 .help = "Space between IO zones",
2881 .interval = 1024 * 1024,
2882 .category = FIO_OPT_C_IO,
2883 .group = FIO_OPT_G_ZONE,
2887 .lname = "Lock memory",
2888 .type = FIO_OPT_STR_VAL,
2889 .off1 = td_var_offset(lockmem),
2890 .help = "Lock down this amount of memory (per worker)",
2892 .interval = 1024 * 1024,
2893 .category = FIO_OPT_C_GENERAL,
2894 .group = FIO_OPT_G_INVALID,
2897 .name = "rwmixread",
2898 .lname = "Read/write mix read",
2899 .type = FIO_OPT_INT,
2900 .cb = str_rwmix_read_cb,
2901 .off1 = td_var_offset(rwmix[DDIR_READ]),
2903 .help = "Percentage of mixed workload that is reads",
2906 .inverse = "rwmixwrite",
2907 .category = FIO_OPT_C_IO,
2908 .group = FIO_OPT_G_RWMIX,
2911 .name = "rwmixwrite",
2912 .lname = "Read/write mix write",
2913 .type = FIO_OPT_INT,
2914 .cb = str_rwmix_write_cb,
2915 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
2917 .help = "Percentage of mixed workload that is writes",
2920 .inverse = "rwmixread",
2921 .category = FIO_OPT_C_IO,
2922 .group = FIO_OPT_G_RWMIX,
2925 .name = "rwmixcycle",
2926 .lname = "Read/write mix cycle",
2927 .type = FIO_OPT_DEPRECATED,
2928 .category = FIO_OPT_C_IO,
2929 .group = FIO_OPT_G_RWMIX,
2934 .type = FIO_OPT_INT,
2935 .off1 = td_var_offset(nice),
2936 .help = "Set job CPU nice value",
2941 .category = FIO_OPT_C_GENERAL,
2942 .group = FIO_OPT_G_CRED,
2944 #ifdef FIO_HAVE_IOPRIO
2947 .lname = "I/O nice priority",
2948 .type = FIO_OPT_INT,
2949 .off1 = td_var_offset(ioprio),
2950 .help = "Set job IO priority value",
2954 .category = FIO_OPT_C_GENERAL,
2955 .group = FIO_OPT_G_CRED,
2958 .name = "prioclass",
2959 .lname = "I/O nice priority class",
2960 .type = FIO_OPT_INT,
2961 .off1 = td_var_offset(ioprio_class),
2962 .help = "Set job IO priority class",
2966 .category = FIO_OPT_C_GENERAL,
2967 .group = FIO_OPT_G_CRED,
2971 .name = "thinktime",
2972 .lname = "Thinktime",
2973 .type = FIO_OPT_INT,
2974 .off1 = td_var_offset(thinktime),
2975 .help = "Idle time between IO buffers (usec)",
2978 .category = FIO_OPT_C_IO,
2979 .group = FIO_OPT_G_THINKTIME,
2982 .name = "thinktime_spin",
2983 .lname = "Thinktime spin",
2984 .type = FIO_OPT_INT,
2985 .off1 = td_var_offset(thinktime_spin),
2986 .help = "Start think time by spinning this amount (usec)",
2989 .parent = "thinktime",
2991 .category = FIO_OPT_C_IO,
2992 .group = FIO_OPT_G_THINKTIME,
2995 .name = "thinktime_blocks",
2996 .lname = "Thinktime blocks",
2997 .type = FIO_OPT_INT,
2998 .off1 = td_var_offset(thinktime_blocks),
2999 .help = "IO buffer period between 'thinktime'",
3001 .parent = "thinktime",
3003 .category = FIO_OPT_C_IO,
3004 .group = FIO_OPT_G_THINKTIME,
3008 .lname = "I/O rate",
3009 .type = FIO_OPT_INT,
3010 .off1 = td_var_offset(rate[DDIR_READ]),
3011 .off2 = td_var_offset(rate[DDIR_WRITE]),
3012 .off3 = td_var_offset(rate[DDIR_TRIM]),
3013 .help = "Set bandwidth rate",
3014 .category = FIO_OPT_C_IO,
3015 .group = FIO_OPT_G_RATE,
3020 .lname = "I/O min rate",
3021 .type = FIO_OPT_INT,
3022 .off1 = td_var_offset(ratemin[DDIR_READ]),
3023 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
3024 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
3025 .help = "Job must meet this rate or it will be shutdown",
3028 .category = FIO_OPT_C_IO,
3029 .group = FIO_OPT_G_RATE,
3032 .name = "rate_iops",
3033 .lname = "I/O rate IOPS",
3034 .type = FIO_OPT_INT,
3035 .off1 = td_var_offset(rate_iops[DDIR_READ]),
3036 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
3037 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
3038 .help = "Limit IO used to this number of IO operations/sec",
3040 .category = FIO_OPT_C_IO,
3041 .group = FIO_OPT_G_RATE,
3044 .name = "rate_iops_min",
3045 .lname = "I/O min rate IOPS",
3046 .type = FIO_OPT_INT,
3047 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
3048 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
3049 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
3050 .help = "Job must meet this rate or it will be shut down",
3051 .parent = "rate_iops",
3053 .category = FIO_OPT_C_IO,
3054 .group = FIO_OPT_G_RATE,
3057 .name = "rate_process",
3058 .lname = "Rate Process",
3059 .type = FIO_OPT_STR,
3060 .off1 = td_var_offset(rate_process),
3061 .help = "What process controls how rated IO is managed",
3063 .category = FIO_OPT_C_IO,
3064 .group = FIO_OPT_G_RATE,
3067 .oval = RATE_PROCESS_LINEAR,
3068 .help = "Linear rate of IO",
3072 .oval = RATE_PROCESS_POISSON,
3073 .help = "Rate follows Poisson process",
3079 .name = "rate_cycle",
3080 .alias = "ratecycle",
3081 .lname = "I/O rate cycle",
3082 .type = FIO_OPT_INT,
3083 .off1 = td_var_offset(ratecycle),
3084 .help = "Window average for rate limits (msec)",
3088 .category = FIO_OPT_C_IO,
3089 .group = FIO_OPT_G_RATE,
3092 .name = "max_latency",
3093 .type = FIO_OPT_INT,
3094 .off1 = td_var_offset(max_latency),
3095 .help = "Maximum tolerated IO latency (usec)",
3097 .category = FIO_OPT_C_IO,
3098 .group = FIO_OPT_G_LATPROF,
3101 .name = "latency_target",
3102 .lname = "Latency Target (usec)",
3103 .type = FIO_OPT_STR_VAL_TIME,
3104 .off1 = td_var_offset(latency_target),
3105 .help = "Ramp to max queue depth supporting this latency",
3107 .category = FIO_OPT_C_IO,
3108 .group = FIO_OPT_G_LATPROF,
3111 .name = "latency_window",
3112 .lname = "Latency Window (usec)",
3113 .type = FIO_OPT_STR_VAL_TIME,
3114 .off1 = td_var_offset(latency_window),
3115 .help = "Time to sustain latency_target",
3117 .category = FIO_OPT_C_IO,
3118 .group = FIO_OPT_G_LATPROF,
3121 .name = "latency_percentile",
3122 .lname = "Latency Percentile",
3123 .type = FIO_OPT_FLOAT_LIST,
3124 .off1 = td_var_offset(latency_percentile),
3125 .help = "Percentile of IOs must be below latency_target",
3130 .category = FIO_OPT_C_IO,
3131 .group = FIO_OPT_G_LATPROF,
3134 .name = "invalidate",
3135 .lname = "Cache invalidate",
3136 .type = FIO_OPT_BOOL,
3137 .off1 = td_var_offset(invalidate_cache),
3138 .help = "Invalidate buffer/page cache prior to running job",
3140 .category = FIO_OPT_C_IO,
3141 .group = FIO_OPT_G_IO_TYPE,
3145 .lname = "Synchronous I/O",
3146 .type = FIO_OPT_BOOL,
3147 .off1 = td_var_offset(sync_io),
3148 .help = "Use O_SYNC for buffered writes",
3150 .parent = "buffered",
3152 .category = FIO_OPT_C_IO,
3153 .group = FIO_OPT_G_IO_TYPE,
3156 .name = "create_serialize",
3157 .lname = "Create serialize",
3158 .type = FIO_OPT_BOOL,
3159 .off1 = td_var_offset(create_serialize),
3160 .help = "Serialize creating of job files",
3162 .category = FIO_OPT_C_FILE,
3163 .group = FIO_OPT_G_INVALID,
3166 .name = "create_fsync",
3167 .lname = "Create fsync",
3168 .type = FIO_OPT_BOOL,
3169 .off1 = td_var_offset(create_fsync),
3170 .help = "fsync file after creation",
3172 .category = FIO_OPT_C_FILE,
3173 .group = FIO_OPT_G_INVALID,
3176 .name = "create_on_open",
3177 .lname = "Create on open",
3178 .type = FIO_OPT_BOOL,
3179 .off1 = td_var_offset(create_on_open),
3180 .help = "Create files when they are opened for IO",
3182 .category = FIO_OPT_C_FILE,
3183 .group = FIO_OPT_G_INVALID,
3186 .name = "create_only",
3187 .type = FIO_OPT_BOOL,
3188 .off1 = td_var_offset(create_only),
3189 .help = "Only perform file creation phase",
3190 .category = FIO_OPT_C_FILE,
3194 .name = "allow_file_create",
3195 .lname = "Allow file create",
3196 .type = FIO_OPT_BOOL,
3197 .off1 = td_var_offset(allow_create),
3198 .help = "Permit fio to create files, if they don't exist",
3200 .category = FIO_OPT_C_FILE,
3201 .group = FIO_OPT_G_FILENAME,
3204 .name = "allow_mounted_write",
3205 .lname = "Allow mounted write",
3206 .type = FIO_OPT_BOOL,
3207 .off1 = td_var_offset(allow_mounted_write),
3208 .help = "Allow writes to a mounted partition",
3210 .category = FIO_OPT_C_FILE,
3211 .group = FIO_OPT_G_FILENAME,
3215 .lname = "Pre-read files",
3216 .type = FIO_OPT_BOOL,
3217 .off1 = td_var_offset(pre_read),
3218 .help = "Pre-read files before starting official testing",
3220 .category = FIO_OPT_C_FILE,
3221 .group = FIO_OPT_G_INVALID,
3223 #ifdef FIO_HAVE_CPU_AFFINITY
3226 .lname = "CPU mask",
3227 .type = FIO_OPT_INT,
3228 .cb = str_cpumask_cb,
3229 .off1 = td_var_offset(cpumask),
3230 .help = "CPU affinity mask",
3231 .category = FIO_OPT_C_GENERAL,
3232 .group = FIO_OPT_G_CRED,
3235 .name = "cpus_allowed",
3236 .lname = "CPUs allowed",
3237 .type = FIO_OPT_STR,
3238 .cb = str_cpus_allowed_cb,
3239 .off1 = td_var_offset(cpumask),
3240 .help = "Set CPUs allowed",
3241 .category = FIO_OPT_C_GENERAL,
3242 .group = FIO_OPT_G_CRED,
3245 .name = "cpus_allowed_policy",
3246 .lname = "CPUs allowed distribution policy",
3247 .type = FIO_OPT_STR,
3248 .off1 = td_var_offset(cpus_allowed_policy),
3249 .help = "Distribution policy for cpus_allowed",
3250 .parent = "cpus_allowed",
3254 .oval = FIO_CPUS_SHARED,
3255 .help = "Mask shared between threads",
3258 .oval = FIO_CPUS_SPLIT,
3259 .help = "Mask split between threads",
3262 .category = FIO_OPT_C_GENERAL,
3263 .group = FIO_OPT_G_CRED,
3266 #ifdef CONFIG_LIBNUMA
3268 .name = "numa_cpu_nodes",
3269 .type = FIO_OPT_STR,
3270 .cb = str_numa_cpunodes_cb,
3271 .off1 = td_var_offset(numa_cpunodes),
3272 .help = "NUMA CPU nodes bind",
3273 .category = FIO_OPT_C_GENERAL,
3274 .group = FIO_OPT_G_INVALID,
3277 .name = "numa_mem_policy",
3278 .type = FIO_OPT_STR,
3279 .cb = str_numa_mpol_cb,
3280 .off1 = td_var_offset(numa_memnodes),
3281 .help = "NUMA memory policy setup",
3282 .category = FIO_OPT_C_GENERAL,
3283 .group = FIO_OPT_G_INVALID,
3287 .name = "end_fsync",
3288 .lname = "End fsync",
3289 .type = FIO_OPT_BOOL,
3290 .off1 = td_var_offset(end_fsync),
3291 .help = "Include fsync at the end of job",
3293 .category = FIO_OPT_C_FILE,
3294 .group = FIO_OPT_G_INVALID,
3297 .name = "fsync_on_close",
3298 .lname = "Fsync on close",
3299 .type = FIO_OPT_BOOL,
3300 .off1 = td_var_offset(fsync_on_close),
3301 .help = "fsync files on close",
3303 .category = FIO_OPT_C_FILE,
3304 .group = FIO_OPT_G_INVALID,
3308 .lname = "Unlink file",
3309 .type = FIO_OPT_BOOL,
3310 .off1 = td_var_offset(unlink),
3311 .help = "Unlink created files after job has completed",
3313 .category = FIO_OPT_C_FILE,
3314 .group = FIO_OPT_G_INVALID,
3318 .lname = "Exit-all on terminate",
3319 .type = FIO_OPT_STR_SET,
3320 .cb = str_exitall_cb,
3321 .help = "Terminate all jobs when one exits",
3322 .category = FIO_OPT_C_GENERAL,
3323 .group = FIO_OPT_G_PROCESS,
3326 .name = "exitall_on_error",
3327 .lname = "Exit-all on terminate in error",
3328 .type = FIO_OPT_BOOL,
3329 .off1 = td_var_offset(unlink),
3330 .help = "Terminate all jobs when one exits in error",
3331 .category = FIO_OPT_C_GENERAL,
3332 .group = FIO_OPT_G_PROCESS,
3335 .name = "stonewall",
3336 .lname = "Wait for previous",
3337 .alias = "wait_for_previous",
3338 .type = FIO_OPT_STR_SET,
3339 .off1 = td_var_offset(stonewall),
3340 .help = "Insert a hard barrier between this job and previous",
3341 .category = FIO_OPT_C_GENERAL,
3342 .group = FIO_OPT_G_PROCESS,
3345 .name = "new_group",
3346 .lname = "New group",
3347 .type = FIO_OPT_STR_SET,
3348 .off1 = td_var_offset(new_group),
3349 .help = "Mark the start of a new group (for reporting)",
3350 .category = FIO_OPT_C_GENERAL,
3351 .group = FIO_OPT_G_PROCESS,
3356 .type = FIO_OPT_STR_SET,
3357 .off1 = td_var_offset(use_thread),
3358 .help = "Use threads instead of processes",
3359 #ifdef CONFIG_NO_SHM