11 #include <netinet/in.h>
17 #include "lib/pattern.h"
21 char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
23 #define cb_data_to_td(data) container_of(data, struct thread_data, o)
25 static struct pattern_fmt_desc fmt_desc[] = {
28 .len = FIELD_SIZE(struct io_u *, offset),
29 .paste = paste_blockoff
34 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
36 static char *get_opt_postfix(const char *str)
38 char *p = strstr(str, ":");
44 strip_blank_front(&p);
49 static int bs_cmp(const void *p1, const void *p2)
51 const struct bssplit *bsp1 = p1;
52 const struct bssplit *bsp2 = p2;
54 return (int) bsp1->perc - (int) bsp2->perc;
59 unsigned int val1[ZONESPLIT_MAX];
60 unsigned long long val2[ZONESPLIT_MAX];
63 static int split_parse_ddir(struct thread_options *o, struct split *split,
64 enum fio_ddir ddir, char *str, bool absolute,
65 unsigned int max_splits)
67 unsigned long long perc;
75 while ((fname = strsep(&str, ":")) != NULL) {
81 perc_str = strstr(fname, "/");
86 if (str_to_decimal(perc_str, &val, 1, o, 0, 0)) {
87 log_err("fio: split conversion failed\n");
92 perc = atoi(perc_str);
105 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
106 log_err("fio: split conversion failed\n");
110 split->val1[i] = val;
111 split->val2[i] = perc;
113 if (i == max_splits) {
114 log_err("fio: hit max of %d split entries\n", i);
123 static int bssplit_ddir(struct thread_options *o, enum fio_ddir ddir, char *str,
126 unsigned int i, perc, perc_missing;
127 unsigned int max_bs, min_bs;
130 memset(&split, 0, sizeof(split));
132 if (split_parse_ddir(o, &split, ddir, str, data, BSSPLIT_MAX))
139 o->bssplit[ddir] = malloc(split.nr * sizeof(struct bssplit));
140 o->bssplit_nr[ddir] = split.nr;
141 for (i = 0; i < split.nr; i++) {
142 if (split.val1[i] > max_bs)
143 max_bs = split.val1[i];
144 if (split.val1[i] < min_bs)
145 min_bs = split.val1[i];
147 o->bssplit[ddir][i].bs = split.val1[i];
148 o->bssplit[ddir][i].perc =split.val2[i];
152 * Now check if the percentages add up, and how much is missing
154 perc = perc_missing = 0;
155 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
156 struct bssplit *bsp = &o->bssplit[ddir][i];
158 if (bsp->perc == -1U)
164 if (perc > 100 && perc_missing > 1) {
165 log_err("fio: bssplit percentages add to more than 100%%\n");
166 free(o->bssplit[ddir]);
167 o->bssplit[ddir] = NULL;
172 * If values didn't have a percentage set, divide the remains between
176 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
178 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
179 struct bssplit *bsp = &o->bssplit[ddir][i];
181 if (bsp->perc == -1U)
182 bsp->perc = (100 - perc) / perc_missing;
186 o->min_bs[ddir] = min_bs;
187 o->max_bs[ddir] = max_bs;
190 * now sort based on percentages, for ease of lookup
192 qsort(o->bssplit[ddir], o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
196 typedef int (split_parse_fn)(struct thread_options *, enum fio_ddir, char *, bool);
198 static int str_split_parse(struct thread_data *td, char *str,
199 split_parse_fn *fn, bool data)
204 odir = strchr(str, ',');
206 ddir = strchr(odir + 1, ',');
208 ret = fn(&td->o, DDIR_TRIM, ddir + 1, data);
214 op = strdup(odir + 1);
215 ret = fn(&td->o, DDIR_TRIM, op, data);
220 ret = fn(&td->o, DDIR_WRITE, odir + 1, data);
223 ret = fn(&td->o, DDIR_READ, str, data);
229 ret = fn(&td->o, DDIR_WRITE, op, data);
234 ret = fn(&td->o, DDIR_TRIM, op, data);
238 ret = fn(&td->o, DDIR_READ, str, data);
244 static int str_bssplit_cb(void *data, const char *input)
246 struct thread_data *td = cb_data_to_td(data);
250 p = str = strdup(input);
252 strip_blank_front(&str);
253 strip_blank_end(str);
255 ret = str_split_parse(td, str, bssplit_ddir, false);
257 if (parse_dryrun()) {
260 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
261 free(td->o.bssplit[i]);
262 td->o.bssplit[i] = NULL;
263 td->o.bssplit_nr[i] = 0;
271 static int str2error(char *str)
273 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
274 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
275 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
276 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
277 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
278 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
279 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
280 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
281 int i = 0, num = sizeof(err) / sizeof(char *);
284 if (!strcmp(err[i], str))
291 static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
298 if (etype >= ERROR_TYPE_CNT) {
299 log_err("Illegal error type\n");
303 td->o.ignore_error_nr[etype] = 4;
304 error = calloc(4, sizeof(int));
307 while ((fname = strsep(&str, ":")) != NULL) {
313 * grow struct buffer, if needed
315 if (i == td->o.ignore_error_nr[etype]) {
316 td->o.ignore_error_nr[etype] <<= 1;
317 error = realloc(error, td->o.ignore_error_nr[etype]
320 if (fname[0] == 'E') {
321 error[i] = str2error(fname);
323 error[i] = atoi(fname);
325 error[i] = -error[i];
328 log_err("Unknown error %s, please use number value\n",
330 td->o.ignore_error_nr[etype] = 0;
337 td->o.continue_on_error |= 1 << etype;
338 td->o.ignore_error_nr[etype] = i;
339 td->o.ignore_error[etype] = error;
341 td->o.ignore_error_nr[etype] = 0;
349 static int str_ignore_error_cb(void *data, const char *input)
351 struct thread_data *td = cb_data_to_td(data);
354 enum error_type_bit type = 0;
359 p = str = strdup(input);
361 strip_blank_front(&str);
362 strip_blank_end(str);
368 ret = ignore_error_type(td, type, p);
378 static int str_rw_cb(void *data, const char *str)
380 struct thread_data *td = cb_data_to_td(data);
381 struct thread_options *o = &td->o;
390 nr = get_opt_postfix(str);
395 o->ddir_seq_nr = atoi(nr);
399 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
400 log_err("fio: rw postfix parsing failed\n");
405 o->ddir_seq_add = val;
412 static int str_mem_cb(void *data, const char *mem)
414 struct thread_data *td = cb_data_to_td(data);
416 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
417 td->o.mem_type == MEM_MMAPSHARED)
418 td->o.mmapfile = get_opt_postfix(mem);
423 static int fio_clock_source_cb(void *data, const char *str)
425 struct thread_data *td = cb_data_to_td(data);
427 fio_clock_source = td->o.clocksource;
428 fio_clock_source_set = 1;
433 static int str_rwmix_read_cb(void *data, unsigned long long *val)
435 struct thread_data *td = cb_data_to_td(data);
437 td->o.rwmix[DDIR_READ] = *val;
438 td->o.rwmix[DDIR_WRITE] = 100 - *val;
442 static int str_rwmix_write_cb(void *data, unsigned long long *val)
444 struct thread_data *td = cb_data_to_td(data);
446 td->o.rwmix[DDIR_WRITE] = *val;
447 td->o.rwmix[DDIR_READ] = 100 - *val;
451 static int str_exitall_cb(void)
453 exitall_on_terminate = 1;
457 #ifdef FIO_HAVE_CPU_AFFINITY
458 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
460 unsigned int i, index, cpus_in_mask;
461 const long max_cpu = cpus_online();
463 cpus_in_mask = fio_cpu_count(mask);
464 cpu_index = cpu_index % cpus_in_mask;
467 for (i = 0; i < max_cpu; i++) {
468 if (!fio_cpu_isset(mask, i))
471 if (cpu_index != index)
472 fio_cpu_clear(mask, i);
477 return fio_cpu_count(mask);
480 static int str_cpumask_cb(void *data, unsigned long long *val)
482 struct thread_data *td = cb_data_to_td(data);
490 ret = fio_cpuset_init(&td->o.cpumask);
492 log_err("fio: cpuset_init failed\n");
493 td_verror(td, ret, "fio_cpuset_init");
497 max_cpu = cpus_online();
499 for (i = 0; i < sizeof(int) * 8; i++) {
500 if ((1 << i) & *val) {
502 log_err("fio: CPU %d too large (max=%ld)\n", i,
506 dprint(FD_PARSE, "set cpu allowed %d\n", i);
507 fio_cpu_set(&td->o.cpumask, i);
514 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
521 ret = fio_cpuset_init(mask);
523 log_err("fio: cpuset_init failed\n");
524 td_verror(td, ret, "fio_cpuset_init");
528 p = str = strdup(input);
530 strip_blank_front(&str);
531 strip_blank_end(str);
533 max_cpu = cpus_online();
535 while ((cpu = strsep(&str, ",")) != NULL) {
544 while ((cpu2 = strsep(&str2, "-")) != NULL) {
554 while (icpu <= icpu2) {
555 if (icpu >= FIO_MAX_CPUS) {
556 log_err("fio: your OS only supports up to"
557 " %d CPUs\n", (int) FIO_MAX_CPUS);
561 if (icpu >= max_cpu) {
562 log_err("fio: CPU %d too large (max=%ld)\n",
568 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
569 fio_cpu_set(mask, icpu);
580 static int str_cpus_allowed_cb(void *data, const char *input)
582 struct thread_data *td = cb_data_to_td(data);
587 return set_cpus_allowed(td, &td->o.cpumask, input);
590 static int str_verify_cpus_allowed_cb(void *data, const char *input)
592 struct thread_data *td = cb_data_to_td(data);
597 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
601 static int str_log_cpus_allowed_cb(void *data, const char *input)
603 struct thread_data *td = cb_data_to_td(data);
608 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
610 #endif /* CONFIG_ZLIB */
612 #endif /* FIO_HAVE_CPU_AFFINITY */
614 #ifdef CONFIG_LIBNUMA
615 static int str_numa_cpunodes_cb(void *data, char *input)
617 struct thread_data *td = cb_data_to_td(data);
618 struct bitmask *verify_bitmask;
623 /* numa_parse_nodestring() parses a character string list
624 * of nodes into a bit mask. The bit mask is allocated by
625 * numa_allocate_nodemask(), so it should be freed by
626 * numa_free_nodemask().
628 verify_bitmask = numa_parse_nodestring(input);
629 if (verify_bitmask == NULL) {
630 log_err("fio: numa_parse_nodestring failed\n");
631 td_verror(td, 1, "str_numa_cpunodes_cb");
634 numa_free_nodemask(verify_bitmask);
636 td->o.numa_cpunodes = strdup(input);
640 static int str_numa_mpol_cb(void *data, char *input)
642 struct thread_data *td = cb_data_to_td(data);
643 const char * const policy_types[] =
644 { "default", "prefer", "bind", "interleave", "local", NULL };
647 struct bitmask *verify_bitmask;
652 nodelist = strchr(input, ':');
654 /* NUL-terminate mode */
658 for (i = 0; i <= MPOL_LOCAL; i++) {
659 if (!strcmp(input, policy_types[i])) {
660 td->o.numa_mem_mode = i;
664 if (i > MPOL_LOCAL) {
665 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
669 switch (td->o.numa_mem_mode) {
672 * Insist on a nodelist of one node only
675 char *rest = nodelist;
676 while (isdigit(*rest))
679 log_err("fio: one node only for \'prefer\'\n");
683 log_err("fio: one node is needed for \'prefer\'\n");
687 case MPOL_INTERLEAVE:
689 * Default to online nodes with memory if no nodelist
692 nodelist = strdup("all");
697 * Don't allow a nodelist
700 log_err("fio: NO nodelist for \'local\'\n");
706 * Insist on a nodelist
709 log_err("fio: a nodelist is needed for \'bind\'\n");
716 /* numa_parse_nodestring() parses a character string list
717 * of nodes into a bit mask. The bit mask is allocated by
718 * numa_allocate_nodemask(), so it should be freed by
719 * numa_free_nodemask().
721 switch (td->o.numa_mem_mode) {
723 td->o.numa_mem_prefer_node = atoi(nodelist);
725 case MPOL_INTERLEAVE:
727 verify_bitmask = numa_parse_nodestring(nodelist);
728 if (verify_bitmask == NULL) {
729 log_err("fio: numa_parse_nodestring failed\n");
730 td_verror(td, 1, "str_numa_memnodes_cb");
733 td->o.numa_memnodes = strdup(nodelist);
734 numa_free_nodemask(verify_bitmask);
749 static int str_fst_cb(void *data, const char *str)
751 struct thread_data *td = cb_data_to_td(data);
756 td->file_service_nr = 1;
758 switch (td->o.file_service_type) {
759 case FIO_FSERVICE_RANDOM:
760 case FIO_FSERVICE_RR:
761 case FIO_FSERVICE_SEQ:
762 nr = get_opt_postfix(str);
764 td->file_service_nr = atoi(nr);
769 case FIO_FSERVICE_ZIPF:
772 case FIO_FSERVICE_PARETO:
773 val = FIO_DEF_PARETO;
775 case FIO_FSERVICE_GAUSS:
779 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
786 nr = get_opt_postfix(str);
787 if (nr && !str_to_float(nr, &val, 0)) {
788 log_err("fio: file service type random postfix parsing failed\n");
795 switch (td->o.file_service_type) {
796 case FIO_FSERVICE_ZIPF:
798 log_err("fio: zipf theta must be different than 1.0\n");
803 td->zipf_theta = val;
805 case FIO_FSERVICE_PARETO:
806 if (val <= 0.00 || val >= 1.00) {
807 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
814 case FIO_FSERVICE_GAUSS:
815 if (val < 0.00 || val >= 100.00) {
816 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
828 #ifdef CONFIG_SYNC_FILE_RANGE
829 static int str_sfr_cb(void *data, const char *str)
831 struct thread_data *td = cb_data_to_td(data);
832 char *nr = get_opt_postfix(str);
834 td->sync_file_range_nr = 1;
836 td->sync_file_range_nr = atoi(nr);
844 static int zone_split_ddir(struct thread_options *o, enum fio_ddir ddir,
845 char *str, bool absolute)
847 unsigned int i, perc, perc_missing, sperc, sperc_missing;
850 memset(&split, 0, sizeof(split));
852 if (split_parse_ddir(o, &split, ddir, str, absolute, ZONESPLIT_MAX))
857 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
858 o->zone_split_nr[ddir] = split.nr;
859 for (i = 0; i < split.nr; i++) {
860 o->zone_split[ddir][i].access_perc = split.val1[i];
862 o->zone_split[ddir][i].size = split.val2[i];
864 o->zone_split[ddir][i].size_perc = split.val2[i];
868 * Now check if the percentages add up, and how much is missing
870 perc = perc_missing = 0;
871 sperc = sperc_missing = 0;
872 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
873 struct zone_split *zsp = &o->zone_split[ddir][i];
875 if (zsp->access_perc == (uint8_t) -1U)
878 perc += zsp->access_perc;
881 if (zsp->size_perc == (uint8_t) -1U)
884 sperc += zsp->size_perc;
888 if (perc > 100 || sperc > 100) {
889 log_err("fio: zone_split percentages add to more than 100%%\n");
890 free(o->zone_split[ddir]);
891 o->zone_split[ddir] = NULL;
895 log_err("fio: access percentage don't add up to 100 for zoned "
896 "random distribution (got=%u)\n", perc);
897 free(o->zone_split[ddir]);
898 o->zone_split[ddir] = NULL;
903 * If values didn't have a percentage set, divide the remains between
907 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
909 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
910 struct zone_split *zsp = &o->zone_split[ddir][i];
912 if (zsp->access_perc == (uint8_t) -1U)
913 zsp->access_perc = (100 - perc) / perc_missing;
917 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
919 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
920 struct zone_split *zsp = &o->zone_split[ddir][i];
922 if (zsp->size_perc == (uint8_t) -1U)
923 zsp->size_perc = (100 - sperc) / sperc_missing;
930 static void __td_zone_gen_index(struct thread_data *td, enum fio_ddir ddir)
932 unsigned int i, j, sprev, aprev;
935 td->zone_state_index[ddir] = malloc(sizeof(struct zone_split_index) * 100);
937 sprev_sz = sprev = aprev = 0;
938 for (i = 0; i < td->o.zone_split_nr[ddir]; i++) {
939 struct zone_split *zsp = &td->o.zone_split[ddir][i];
941 for (j = aprev; j < aprev + zsp->access_perc; j++) {
942 struct zone_split_index *zsi = &td->zone_state_index[ddir][j];
944 zsi->size_perc = sprev + zsp->size_perc;
945 zsi->size_perc_prev = sprev;
947 zsi->size = sprev_sz + zsp->size;
948 zsi->size_prev = sprev_sz;
951 aprev += zsp->access_perc;
952 sprev += zsp->size_perc;
953 sprev_sz += zsp->size;
958 * Generate state table for indexes, so we don't have to do it inline from
961 static void td_zone_gen_index(struct thread_data *td)
965 td->zone_state_index = malloc(DDIR_RWDIR_CNT *
966 sizeof(struct zone_split_index *));
968 for (i = 0; i < DDIR_RWDIR_CNT; i++)
969 __td_zone_gen_index(td, i);
972 static int parse_zoned_distribution(struct thread_data *td, const char *input,
975 const char *pre = absolute ? "zoned_abs:" : "zoned:";
979 p = str = strdup(input);
981 strip_blank_front(&str);
982 strip_blank_end(str);
984 /* We expect it to start like that, bail if not */
985 if (strncmp(str, pre, strlen(pre))) {
986 log_err("fio: mismatch in zoned input <%s>\n", str);
992 ret = str_split_parse(td, str, zone_split_ddir, absolute);
996 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
999 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
1001 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
1002 struct zone_split *zsp = &td->o.zone_split[i][j];
1005 dprint(FD_PARSE, "\t%d: %u/%llu\n", j,
1007 (unsigned long long) zsp->size);
1009 dprint(FD_PARSE, "\t%d: %u/%u\n", j,
1016 if (parse_dryrun()) {
1019 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1020 free(td->o.zone_split[i]);
1021 td->o.zone_split[i] = NULL;
1022 td->o.zone_split_nr[i] = 0;
1029 td_zone_gen_index(td);
1031 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1032 td->o.zone_split_nr[i] = 0;
1038 static int str_random_distribution_cb(void *data, const char *str)
1040 struct thread_data *td = cb_data_to_td(data);
1044 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1046 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1047 val = FIO_DEF_PARETO;
1048 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1050 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1051 return parse_zoned_distribution(td, str, false);
1052 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED_ABS)
1053 return parse_zoned_distribution(td, str, true);
1057 nr = get_opt_postfix(str);
1058 if (nr && !str_to_float(nr, &val, 0)) {
1059 log_err("fio: random postfix parsing failed\n");
1066 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1068 log_err("fio: zipf theta must different than 1.0\n");
1073 td->o.zipf_theta.u.f = val;
1074 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1075 if (val <= 0.00 || val >= 1.00) {
1076 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1081 td->o.pareto_h.u.f = val;
1083 if (val < 0.00 || val >= 100.0) {
1084 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1089 td->o.gauss_dev.u.f = val;
1095 static int str_steadystate_cb(void *data, const char *str)
1097 struct thread_data *td = cb_data_to_td(data);
1103 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1104 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
1105 /* should be impossible to get here */
1106 log_err("fio: unknown steady state criterion\n");
1110 nr = get_opt_postfix(str);
1112 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1117 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1118 pct = strstr(nr, "%");
1121 strip_blank_end(nr);
1122 if (!str_to_float(nr, &val, 0)) {
1123 log_err("fio: could not parse steadystate threshold percentage\n");
1128 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1133 td->o.ss_state |= FIO_SS_PCT;
1134 td->o.ss_limit.u.f = val;
1135 } else if (td->o.ss_state & FIO_SS_IOPS) {
1136 if (!str_to_float(nr, &val, 0)) {
1137 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1142 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1147 td->o.ss_limit.u.f = val;
1148 } else { /* bandwidth criterion */
1149 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1150 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1155 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1160 td->o.ss_limit.u.f = (double) ll;
1163 td->ss.state = td->o.ss_state;
1168 * Return next name in the string. Files are separated with ':'. If the ':'
1169 * is escaped with a '\', then that ':' is part of the filename and does not
1170 * indicate a new file.
1172 static char *get_next_name(char **ptr)
1177 if (!str || !strlen(str))
1183 * No colon, we are done
1185 p = strchr(str, ':');
1192 * We got a colon, but it's the first character. Skip and
1200 if (*(p - 1) != '\\') {
1206 memmove(p - 1, p, strlen(p) + 1);
1214 static int get_max_name_idx(char *input)
1216 unsigned int cur_idx;
1219 p = str = strdup(input);
1220 for (cur_idx = 0; ; cur_idx++)
1221 if (get_next_name(&str) == NULL)
1229 * Returns the directory at the index, indexes > entires will be
1230 * assigned via modulo division of the index
1232 int set_name_idx(char *target, size_t tlen, char *input, int index,
1233 bool unique_filename)
1235 unsigned int cur_idx;
1237 char *fname, *str, *p;
1239 p = str = strdup(input);
1241 index %= get_max_name_idx(input);
1242 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1243 fname = get_next_name(&str);
1245 if (client_sockaddr_str[0] && unique_filename) {
1246 len = snprintf(target, tlen, "%s/%s.", fname,
1247 client_sockaddr_str);
1249 len = snprintf(target, tlen, "%s/", fname);
1251 target[tlen - 1] = '\0';
1257 static int str_filename_cb(void *data, const char *input)
1259 struct thread_data *td = cb_data_to_td(data);
1260 char *fname, *str, *p;
1262 p = str = strdup(input);
1264 strip_blank_front(&str);
1265 strip_blank_end(str);
1268 * Ignore what we may already have from nrfiles option.
1270 if (!td->files_index)
1273 while ((fname = get_next_name(&str)) != NULL) {
1276 add_file(td, fname, 0, 1);
1283 static int str_directory_cb(void *data, const char fio_unused *unused)
1285 struct thread_data *td = cb_data_to_td(data);
1287 char *dirname, *str, *p;
1293 p = str = strdup(td->o.directory);
1294 while ((dirname = get_next_name(&str)) != NULL) {
1295 if (lstat(dirname, &sb) < 0) {
1298 log_err("fio: %s is not a directory\n", dirname);
1299 td_verror(td, ret, "lstat");
1302 if (!S_ISDIR(sb.st_mode)) {
1303 log_err("fio: %s is not a directory\n", dirname);
1314 static int str_opendir_cb(void *data, const char fio_unused *str)
1316 struct thread_data *td = cb_data_to_td(data);
1321 if (!td->files_index)
1324 return add_dir_files(td, td->o.opendir);
1327 static int str_buffer_pattern_cb(void *data, const char *input)
1329 struct thread_data *td = cb_data_to_td(data);
1332 /* FIXME: for now buffer pattern does not support formats */
1333 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
1334 MAX_PATTERN_SIZE, NULL, 0, NULL, NULL);
1339 td->o.buffer_pattern_bytes = ret;
1342 * If this job is doing any reading or has compression set,
1343 * ensure that we refill buffers for writes or we could be
1344 * invalidating the pattern through reads.
1346 if (!td->o.compress_percentage && !td_read(td))
1347 td->o.refill_buffers = 0;
1349 td->o.refill_buffers = 1;
1351 td->o.scramble_buffers = 0;
1352 td->o.zero_buffers = 0;
1357 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1359 struct thread_data *td = cb_data_to_td(data);
1361 td->flags |= TD_F_COMPRESS;
1362 td->o.compress_percentage = *il;
1366 static int str_dedupe_cb(void *data, unsigned long long *il)
1368 struct thread_data *td = cb_data_to_td(data);
1370 td->flags |= TD_F_COMPRESS;
1371 td->o.dedupe_percentage = *il;
1372 td->o.refill_buffers = 1;
1376 static int str_verify_pattern_cb(void *data, const char *input)
1378 struct thread_data *td = cb_data_to_td(data);
1381 td->o.verify_fmt_sz = ARRAY_SIZE(td->o.verify_fmt);
1382 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
1383 MAX_PATTERN_SIZE, fmt_desc, sizeof(fmt_desc),
1384 td->o.verify_fmt, &td->o.verify_fmt_sz);
1389 td->o.verify_pattern_bytes = ret;
1391 * VERIFY_* could already be set
1393 if (!fio_option_is_set(&td->o, verify))
1394 td->o.verify = VERIFY_PATTERN;
1399 static int str_gtod_reduce_cb(void *data, int *il)
1401 struct thread_data *td = cb_data_to_td(data);
1404 td->o.disable_lat = !!val;
1405 td->o.disable_clat = !!val;
1406 td->o.disable_slat = !!val;
1407 td->o.disable_bw = !!val;
1408 td->o.clat_percentiles = !val;
1410 td->ts_cache_mask = 63;
1415 static int str_offset_cb(void *data, unsigned long long *__val)
1417 struct thread_data *td = cb_data_to_td(data);
1418 unsigned long long v = *__val;
1420 if (parse_is_percent(v)) {
1421 td->o.start_offset = 0;
1422 td->o.start_offset_percent = -1ULL - v;
1423 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1424 td->o.start_offset_percent);
1426 td->o.start_offset = v;
1431 static int str_size_cb(void *data, unsigned long long *__val)
1433 struct thread_data *td = cb_data_to_td(data);
1434 unsigned long long v = *__val;
1436 if (parse_is_percent(v)) {
1438 td->o.size_percent = -1ULL - v;
1439 dprint(FD_PARSE, "SET size_percent %d\n",
1440 td->o.size_percent);
1447 static int str_write_bw_log_cb(void *data, const char *str)
1449 struct thread_data *td = cb_data_to_td(data);
1452 td->o.bw_log_file = strdup(str);
1454 td->o.write_bw_log = 1;
1458 static int str_write_lat_log_cb(void *data, const char *str)
1460 struct thread_data *td = cb_data_to_td(data);
1463 td->o.lat_log_file = strdup(str);
1465 td->o.write_lat_log = 1;
1469 static int str_write_iops_log_cb(void *data, const char *str)
1471 struct thread_data *td = cb_data_to_td(data);
1474 td->o.iops_log_file = strdup(str);
1476 td->o.write_iops_log = 1;
1480 static int str_write_hist_log_cb(void *data, const char *str)
1482 struct thread_data *td = cb_data_to_td(data);
1485 td->o.hist_log_file = strdup(str);
1487 td->o.write_hist_log = 1;
1492 * str is supposed to be a substring of the strdup'd original string,
1493 * and is valid only if it's a regular file path.
1494 * This function keeps the pointer to the path as needed later.
1496 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1497 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1498 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1500 static int str_ioengine_external_cb(void *data, const char *str)
1502 struct thread_data *td = cb_data_to_td(data);
1507 log_err("fio: null external ioengine path\n");
1511 p = (char *)str; /* str is mutable */
1512 strip_blank_front(&p);
1515 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1516 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1520 td->o.ioengine_so_path = p;
1524 static int rw_verify(struct fio_option *o, void *data)
1526 struct thread_data *td = cb_data_to_td(data);
1528 if (read_only && td_write(td)) {
1529 log_err("fio: job <%s> has write bit set, but fio is in"
1530 " read-only mode\n", td->o.name);
1537 static int gtod_cpu_verify(struct fio_option *o, void *data)
1539 #ifndef FIO_HAVE_CPU_AFFINITY
1540 struct thread_data *td = cb_data_to_td(data);
1542 if (td->o.gtod_cpu) {
1543 log_err("fio: platform must support CPU affinity for"
1544 "gettimeofday() offloading\n");
1553 * Map of job/command line options
1555 struct fio_option fio_options[FIO_MAX_OPTS] = {
1557 .name = "description",
1558 .lname = "Description of job",
1559 .type = FIO_OPT_STR_STORE,
1560 .off1 = offsetof(struct thread_options, description),
1561 .help = "Text job description",
1562 .category = FIO_OPT_C_GENERAL,
1563 .group = FIO_OPT_G_DESC,
1567 .lname = "Job name",
1568 .type = FIO_OPT_STR_STORE,
1569 .off1 = offsetof(struct thread_options, name),
1570 .help = "Name of this job",
1571 .category = FIO_OPT_C_GENERAL,
1572 .group = FIO_OPT_G_DESC,
1576 .lname = "Waitee name",
1577 .type = FIO_OPT_STR_STORE,
1578 .off1 = offsetof(struct thread_options, wait_for),
1579 .help = "Name of the job this one wants to wait for before starting",
1580 .category = FIO_OPT_C_GENERAL,
1581 .group = FIO_OPT_G_DESC,
1585 .lname = "Filename(s)",
1586 .type = FIO_OPT_STR_STORE,
1587 .off1 = offsetof(struct thread_options, filename),
1588 .cb = str_filename_cb,
1589 .prio = -1, /* must come after "directory" */
1590 .help = "File(s) to use for the workload",
1591 .category = FIO_OPT_C_FILE,
1592 .group = FIO_OPT_G_FILENAME,
1595 .name = "directory",
1596 .lname = "Directory",
1597 .type = FIO_OPT_STR_STORE,
1598 .off1 = offsetof(struct thread_options, directory),
1599 .cb = str_directory_cb,
1600 .help = "Directory to store files in",
1601 .category = FIO_OPT_C_FILE,
1602 .group = FIO_OPT_G_FILENAME,
1605 .name = "filename_format",
1606 .lname = "Filename Format",
1607 .type = FIO_OPT_STR_STORE,
1608 .off1 = offsetof(struct thread_options, filename_format),
1609 .prio = -1, /* must come after "directory" */
1610 .help = "Override default $jobname.$jobnum.$filenum naming",
1611 .def = "$jobname.$jobnum.$filenum",
1612 .category = FIO_OPT_C_FILE,
1613 .group = FIO_OPT_G_FILENAME,
1616 .name = "unique_filename",
1617 .lname = "Unique Filename",
1618 .type = FIO_OPT_BOOL,
1619 .off1 = offsetof(struct thread_options, unique_filename),
1620 .help = "For network clients, prefix file with source IP",
1622 .category = FIO_OPT_C_FILE,
1623 .group = FIO_OPT_G_FILENAME,
1627 .lname = "Lockfile",
1628 .type = FIO_OPT_STR,
1629 .off1 = offsetof(struct thread_options, file_lock_mode),
1630 .help = "Lock file when doing IO to it",
1632 .parent = "filename",
1635 .category = FIO_OPT_C_FILE,
1636 .group = FIO_OPT_G_FILENAME,
1639 .oval = FILE_LOCK_NONE,
1640 .help = "No file locking",
1642 { .ival = "exclusive",
1643 .oval = FILE_LOCK_EXCLUSIVE,
1644 .help = "Exclusive file lock",
1647 .ival = "readwrite",
1648 .oval = FILE_LOCK_READWRITE,
1649 .help = "Read vs write lock",
1655 .lname = "Open directory",
1656 .type = FIO_OPT_STR_STORE,
1657 .off1 = offsetof(struct thread_options, opendir),
1658 .cb = str_opendir_cb,
1659 .help = "Recursively add files from this directory and down",
1660 .category = FIO_OPT_C_FILE,
1661 .group = FIO_OPT_G_FILENAME,
1665 .lname = "Read/write",
1666 .alias = "readwrite",
1667 .type = FIO_OPT_STR,
1669 .off1 = offsetof(struct thread_options, td_ddir),
1670 .help = "IO direction",
1672 .verify = rw_verify,
1673 .category = FIO_OPT_C_IO,
1674 .group = FIO_OPT_G_IO_BASIC,
1677 .oval = TD_DDIR_READ,
1678 .help = "Sequential read",
1681 .oval = TD_DDIR_WRITE,
1682 .help = "Sequential write",
1685 .oval = TD_DDIR_TRIM,
1686 .help = "Sequential trim",
1688 { .ival = "randread",
1689 .oval = TD_DDIR_RANDREAD,
1690 .help = "Random read",
1692 { .ival = "randwrite",
1693 .oval = TD_DDIR_RANDWRITE,
1694 .help = "Random write",
1696 { .ival = "randtrim",
1697 .oval = TD_DDIR_RANDTRIM,
1698 .help = "Random trim",
1702 .help = "Sequential read and write mix",
1704 { .ival = "readwrite",
1706 .help = "Sequential read and write mix",
1709 .oval = TD_DDIR_RANDRW,
1710 .help = "Random read and write mix"
1712 { .ival = "trimwrite",
1713 .oval = TD_DDIR_TRIMWRITE,
1714 .help = "Trim and write mix, trims preceding writes"
1719 .name = "rw_sequencer",
1720 .lname = "RW Sequencer",
1721 .type = FIO_OPT_STR,
1722 .off1 = offsetof(struct thread_options, rw_seq),
1723 .help = "IO offset generator modifier",
1724 .def = "sequential",
1725 .category = FIO_OPT_C_IO,
1726 .group = FIO_OPT_G_IO_BASIC,
1728 { .ival = "sequential",
1730 .help = "Generate sequential offsets",
1732 { .ival = "identical",
1733 .oval = RW_SEQ_IDENT,
1734 .help = "Generate identical offsets",
1741 .lname = "IO Engine",
1742 .type = FIO_OPT_STR_STORE,
1743 .off1 = offsetof(struct thread_options, ioengine),
1744 .help = "IO engine to use",
1745 .def = FIO_PREFERRED_ENGINE,
1746 .category = FIO_OPT_C_IO,
1747 .group = FIO_OPT_G_IO_BASIC,
1750 .help = "Use read/write",
1753 .help = "Use pread/pwrite",
1756 .help = "Use readv/writev",
1758 #ifdef CONFIG_PWRITEV
1760 .help = "Use preadv/pwritev",
1763 #ifdef FIO_HAVE_PWRITEV2
1764 { .ival = "pvsync2",
1765 .help = "Use preadv2/pwritev2",
1768 #ifdef CONFIG_LIBAIO
1770 .help = "Linux native asynchronous IO",
1773 #ifdef CONFIG_POSIXAIO
1774 { .ival = "posixaio",
1775 .help = "POSIX asynchronous IO",
1778 #ifdef CONFIG_SOLARISAIO
1779 { .ival = "solarisaio",
1780 .help = "Solaris native asynchronous IO",
1783 #ifdef CONFIG_WINDOWSAIO
1784 { .ival = "windowsaio",
1785 .help = "Windows native asynchronous IO"
1790 .help = "Rados Block Device asynchronous IO"
1794 .help = "Memory mapped IO"
1796 #ifdef CONFIG_LINUX_SPLICE
1798 .help = "splice/vmsplice based IO",
1800 { .ival = "netsplice",
1801 .help = "splice/vmsplice to/from the network",
1804 #ifdef FIO_HAVE_SGIO
1806 .help = "SCSI generic v3 IO",
1810 .help = "Testing engine (no data transfer)",
1813 .help = "Network IO",
1816 .help = "CPU cycle burner engine",
1820 .help = "GUASI IO engine",
1823 #ifdef FIO_HAVE_BINJECT
1824 { .ival = "binject",
1825 .help = "binject direct inject block engine",
1830 .help = "RDMA IO engine",
1833 #ifdef CONFIG_FUSION_AW
1834 { .ival = "fusion-aw-sync",
1835 .help = "Fusion-io atomic write engine",
1838 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1839 { .ival = "e4defrag",
1840 .help = "ext4 defrag engine",
1843 #ifdef CONFIG_LINUX_FALLOCATE
1845 .help = "fallocate() file based engine",
1850 .help = "Glusterfs libgfapi(sync) based engine"
1852 { .ival = "gfapi_async",
1853 .help = "Glusterfs libgfapi(async) based engine"
1856 #ifdef CONFIG_LIBHDFS
1857 { .ival = "libhdfs",
1858 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1861 #ifdef CONFIG_PMEMBLK
1862 { .ival = "pmemblk",
1863 .help = "NVML libpmemblk based IO engine",
1867 #ifdef CONFIG_LINUX_DEVDAX
1868 { .ival = "dev-dax",
1869 .help = "DAX Device based IO engine",
1873 .ival = "filecreate",
1874 .help = "File creation engine",
1876 { .ival = "external",
1877 .help = "Load external engine (append name)",
1878 .cb = str_ioengine_external_cb,
1880 #ifdef CONFIG_LIBPMEM
1881 { .ival = "libpmem",
1882 .help = "NVML libpmem based IO engine",
1889 .lname = "IO Depth",
1890 .type = FIO_OPT_INT,
1891 .off1 = offsetof(struct thread_options, iodepth),
1892 .help = "Number of IO buffers to keep in flight",
1896 .category = FIO_OPT_C_IO,
1897 .group = FIO_OPT_G_IO_BASIC,
1900 .name = "iodepth_batch",
1901 .lname = "IO Depth batch",
1902 .alias = "iodepth_batch_submit",
1903 .type = FIO_OPT_INT,
1904 .off1 = offsetof(struct thread_options, iodepth_batch),
1905 .help = "Number of IO buffers to submit in one go",
1906 .parent = "iodepth",
1910 .category = FIO_OPT_C_IO,
1911 .group = FIO_OPT_G_IO_BASIC,
1914 .name = "iodepth_batch_complete_min",
1915 .lname = "Min IO depth batch complete",
1916 .alias = "iodepth_batch_complete",
1917 .type = FIO_OPT_INT,
1918 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
1919 .help = "Min number of IO buffers to retrieve in one go",
1920 .parent = "iodepth",
1925 .category = FIO_OPT_C_IO,
1926 .group = FIO_OPT_G_IO_BASIC,
1929 .name = "iodepth_batch_complete_max",
1930 .lname = "Max IO depth batch complete",
1931 .type = FIO_OPT_INT,
1932 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
1933 .help = "Max number of IO buffers to retrieve in one go",
1934 .parent = "iodepth",
1938 .category = FIO_OPT_C_IO,
1939 .group = FIO_OPT_G_IO_BASIC,
1942 .name = "iodepth_low",
1943 .lname = "IO Depth batch low",
1944 .type = FIO_OPT_INT,
1945 .off1 = offsetof(struct thread_options, iodepth_low),
1946 .help = "Low water mark for queuing depth",
1947 .parent = "iodepth",
1950 .category = FIO_OPT_C_IO,
1951 .group = FIO_OPT_G_IO_BASIC,
1954 .name = "serialize_overlap",
1955 .lname = "Serialize overlap",
1956 .off1 = offsetof(struct thread_options, serialize_overlap),
1957 .type = FIO_OPT_BOOL,
1958 .help = "Wait for in-flight IOs that collide to complete",
1959 .parent = "iodepth",
1961 .category = FIO_OPT_C_IO,
1962 .group = FIO_OPT_G_IO_BASIC,
1965 .name = "io_submit_mode",
1966 .lname = "IO submit mode",
1967 .type = FIO_OPT_STR,
1968 .off1 = offsetof(struct thread_options, io_submit_mode),
1969 .help = "How IO submissions and completions are done",
1971 .category = FIO_OPT_C_IO,
1972 .group = FIO_OPT_G_IO_BASIC,
1975 .oval = IO_MODE_INLINE,
1976 .help = "Submit and complete IO inline",
1978 { .ival = "offload",
1979 .oval = IO_MODE_OFFLOAD,
1980 .help = "Offload submit and complete to threads",
1987 .type = FIO_OPT_STR_VAL,
1989 .off1 = offsetof(struct thread_options, size),
1990 .help = "Total size of device or files",
1991 .interval = 1024 * 1024,
1992 .category = FIO_OPT_C_IO,
1993 .group = FIO_OPT_G_INVALID,
1997 .alias = "io_limit",
1999 .type = FIO_OPT_STR_VAL,
2000 .off1 = offsetof(struct thread_options, io_size),
2001 .help = "Total size of I/O to be performed",
2002 .interval = 1024 * 1024,
2003 .category = FIO_OPT_C_IO,
2004 .group = FIO_OPT_G_INVALID,
2007 .name = "fill_device",
2008 .lname = "Fill device",
2010 .type = FIO_OPT_BOOL,
2011 .off1 = offsetof(struct thread_options, fill_device),
2012 .help = "Write until an ENOSPC error occurs",
2014 .category = FIO_OPT_C_FILE,
2015 .group = FIO_OPT_G_INVALID,
2019 .lname = "File size",
2020 .type = FIO_OPT_STR_VAL,
2021 .off1 = offsetof(struct thread_options, file_size_low),
2022 .off2 = offsetof(struct thread_options, file_size_high),
2024 .help = "Size of individual files",
2025 .interval = 1024 * 1024,
2026 .category = FIO_OPT_C_FILE,
2027 .group = FIO_OPT_G_INVALID,
2030 .name = "file_append",
2031 .lname = "File append",
2032 .type = FIO_OPT_BOOL,
2033 .off1 = offsetof(struct thread_options, file_append),
2034 .help = "IO will start at the end of the file(s)",
2036 .category = FIO_OPT_C_FILE,
2037 .group = FIO_OPT_G_INVALID,
2041 .lname = "IO offset",
2042 .alias = "fileoffset",
2043 .type = FIO_OPT_STR_VAL,
2044 .cb = str_offset_cb,
2045 .off1 = offsetof(struct thread_options, start_offset),
2046 .help = "Start IO from this offset",
2048 .interval = 1024 * 1024,
2049 .category = FIO_OPT_C_IO,
2050 .group = FIO_OPT_G_INVALID,
2053 .name = "offset_align",
2054 .lname = "IO offset alignment",
2055 .type = FIO_OPT_INT,
2056 .off1 = offsetof(struct thread_options, start_offset_align),
2057 .help = "Start IO from this offset alignment",
2060 .category = FIO_OPT_C_IO,
2061 .group = FIO_OPT_G_INVALID,
2064 .name = "offset_increment",
2065 .lname = "IO offset increment",
2066 .type = FIO_OPT_STR_VAL,
2067 .off1 = offsetof(struct thread_options, offset_increment),
2068 .help = "What is the increment from one offset to the next",
2072 .interval = 1024 * 1024,
2073 .category = FIO_OPT_C_IO,
2074 .group = FIO_OPT_G_INVALID,
2077 .name = "number_ios",
2078 .lname = "Number of IOs to perform",
2079 .type = FIO_OPT_STR_VAL,
2080 .off1 = offsetof(struct thread_options, number_ios),
2081 .help = "Force job completion after this number of IOs",
2083 .category = FIO_OPT_C_IO,
2084 .group = FIO_OPT_G_INVALID,
2088 .lname = "Block size",
2089 .alias = "blocksize",
2090 .type = FIO_OPT_INT,
2091 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2092 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2093 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2095 .help = "Block size unit",
2100 .category = FIO_OPT_C_IO,
2101 .group = FIO_OPT_G_INVALID,
2105 .lname = "Block size align",
2106 .alias = "blockalign",
2107 .type = FIO_OPT_INT,
2108 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2109 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2110 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2112 .help = "IO block offset alignment",
2116 .category = FIO_OPT_C_IO,
2117 .group = FIO_OPT_G_INVALID,
2121 .lname = "Block size range",
2122 .alias = "blocksize_range",
2123 .type = FIO_OPT_RANGE,
2124 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2125 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2126 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2127 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2128 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2129 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2131 .help = "Set block size range (in more detail than bs)",
2135 .category = FIO_OPT_C_IO,
2136 .group = FIO_OPT_G_INVALID,
2140 .lname = "Block size split",
2141 .type = FIO_OPT_STR,
2142 .cb = str_bssplit_cb,
2143 .off1 = offsetof(struct thread_options, bssplit),
2144 .help = "Set a specific mix of block sizes",
2147 .category = FIO_OPT_C_IO,
2148 .group = FIO_OPT_G_INVALID,
2151 .name = "bs_unaligned",
2152 .lname = "Block size unaligned",
2153 .alias = "blocksize_unaligned",
2154 .type = FIO_OPT_STR_SET,
2155 .off1 = offsetof(struct thread_options, bs_unaligned),
2156 .help = "Don't sector align IO buffer sizes",
2159 .category = FIO_OPT_C_IO,
2160 .group = FIO_OPT_G_INVALID,
2163 .name = "bs_is_seq_rand",
2164 .lname = "Block size division is seq/random (not read/write)",
2165 .type = FIO_OPT_BOOL,
2166 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2167 .help = "Consider any blocksize setting to be sequential,random",
2169 .parent = "blocksize",
2170 .category = FIO_OPT_C_IO,
2171 .group = FIO_OPT_G_INVALID,
2174 .name = "randrepeat",
2175 .lname = "Random repeatable",
2176 .type = FIO_OPT_BOOL,
2177 .off1 = offsetof(struct thread_options, rand_repeatable),
2178 .help = "Use repeatable random IO pattern",
2182 .category = FIO_OPT_C_IO,
2183 .group = FIO_OPT_G_RANDOM,
2187 .lname = "The random generator seed",
2188 .type = FIO_OPT_STR_VAL,
2189 .off1 = offsetof(struct thread_options, rand_seed),
2190 .help = "Set the random generator seed value",
2193 .category = FIO_OPT_C_IO,
2194 .group = FIO_OPT_G_RANDOM,
2197 .name = "use_os_rand",
2198 .lname = "Use OS random",
2199 .type = FIO_OPT_DEPRECATED,
2200 .off1 = offsetof(struct thread_options, dep_use_os_rand),
2201 .category = FIO_OPT_C_IO,
2202 .group = FIO_OPT_G_RANDOM,
2205 .name = "norandommap",
2206 .lname = "No randommap",
2207 .type = FIO_OPT_STR_SET,
2208 .off1 = offsetof(struct thread_options, norandommap),
2209 .help = "Accept potential duplicate random blocks",
2213 .category = FIO_OPT_C_IO,
2214 .group = FIO_OPT_G_RANDOM,
2217 .name = "softrandommap",
2218 .lname = "Soft randommap",
2219 .type = FIO_OPT_BOOL,
2220 .off1 = offsetof(struct thread_options, softrandommap),
2221 .help = "Set norandommap if randommap allocation fails",
2222 .parent = "norandommap",
2225 .category = FIO_OPT_C_IO,
2226 .group = FIO_OPT_G_RANDOM,
2229 .name = "random_generator",
2230 .lname = "Random Generator",
2231 .type = FIO_OPT_STR,
2232 .off1 = offsetof(struct thread_options, random_generator),
2233 .help = "Type of random number generator to use",
2234 .def = "tausworthe",
2236 { .ival = "tausworthe",
2237 .oval = FIO_RAND_GEN_TAUSWORTHE,
2238 .help = "Strong Tausworthe generator",
2241 .oval = FIO_RAND_GEN_LFSR,
2242 .help = "Variable length LFSR",
2245 .ival = "tausworthe64",
2246 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2247 .help = "64-bit Tausworthe variant",
2250 .category = FIO_OPT_C_IO,
2251 .group = FIO_OPT_G_RANDOM,
2254 .name = "random_distribution",
2255 .lname = "Random Distribution",
2256 .type = FIO_OPT_STR,
2257 .off1 = offsetof(struct thread_options, random_distribution),
2258 .cb = str_random_distribution_cb,
2259 .help = "Random offset distribution generator",
2263 .oval = FIO_RAND_DIST_RANDOM,
2264 .help = "Completely random",
2267 .oval = FIO_RAND_DIST_ZIPF,
2268 .help = "Zipf distribution",
2271 .oval = FIO_RAND_DIST_PARETO,
2272 .help = "Pareto distribution",
2275 .oval = FIO_RAND_DIST_GAUSS,
2276 .help = "Normal (Gaussian) distribution",
2279 .oval = FIO_RAND_DIST_ZONED,
2280 .help = "Zoned random distribution",
2282 { .ival = "zoned_abs",
2283 .oval = FIO_RAND_DIST_ZONED_ABS,
2284 .help = "Zoned absolute random distribution",
2287 .category = FIO_OPT_C_IO,
2288 .group = FIO_OPT_G_RANDOM,
2291 .name = "percentage_random",
2292 .lname = "Percentage Random",
2293 .type = FIO_OPT_INT,
2294 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2295 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2296 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2298 .help = "Percentage of seq/random mix that should be random",
2299 .def = "100,100,100",
2301 .inverse = "percentage_sequential",
2302 .category = FIO_OPT_C_IO,
2303 .group = FIO_OPT_G_RANDOM,
2306 .name = "percentage_sequential",
2307 .lname = "Percentage Sequential",
2308 .type = FIO_OPT_DEPRECATED,
2309 .category = FIO_OPT_C_IO,
2310 .group = FIO_OPT_G_RANDOM,
2313 .name = "allrandrepeat",
2314 .lname = "All Random Repeat",
2315 .type = FIO_OPT_BOOL,
2316 .off1 = offsetof(struct thread_options, allrand_repeatable),
2317 .help = "Use repeatable random numbers for everything",
2319 .category = FIO_OPT_C_IO,
2320 .group = FIO_OPT_G_RANDOM,
2324 .lname = "Number of files",
2325 .alias = "nr_files",
2326 .type = FIO_OPT_INT,
2327 .off1 = offsetof(struct thread_options, nr_files),
2328 .help = "Split job workload between this number of files",
2331 .category = FIO_OPT_C_FILE,
2332 .group = FIO_OPT_G_INVALID,
2335 .name = "openfiles",
2336 .lname = "Number of open files",
2337 .type = FIO_OPT_INT,
2338 .off1 = offsetof(struct thread_options, open_files),
2339 .help = "Number of files to keep open at the same time",
2340 .category = FIO_OPT_C_FILE,
2341 .group = FIO_OPT_G_INVALID,
2344 .name = "file_service_type",
2345 .lname = "File service type",
2346 .type = FIO_OPT_STR,
2348 .off1 = offsetof(struct thread_options, file_service_type),
2349 .help = "How to select which file to service next",
2350 .def = "roundrobin",
2351 .category = FIO_OPT_C_FILE,
2352 .group = FIO_OPT_G_INVALID,
2355 .oval = FIO_FSERVICE_RANDOM,
2356 .help = "Choose a file at random (uniform)",
2359 .oval = FIO_FSERVICE_ZIPF,
2360 .help = "Zipf randomized",
2363 .oval = FIO_FSERVICE_PARETO,
2364 .help = "Pareto randomized",
2367 .oval = FIO_FSERVICE_GAUSS,
2368 .help = "Normal (Gaussian) randomized",
2371 .oval = FIO_FSERVICE_GAUSS,
2372 .help = "Alias for normal",
2374 { .ival = "roundrobin",
2375 .oval = FIO_FSERVICE_RR,
2376 .help = "Round robin select files",
2378 { .ival = "sequential",
2379 .oval = FIO_FSERVICE_SEQ,
2380 .help = "Finish one file before moving to the next",
2383 .parent = "nrfiles",
2386 #ifdef FIO_HAVE_ANY_FALLOCATE
2388 .name = "fallocate",
2389 .lname = "Fallocate",
2390 .type = FIO_OPT_STR,
2391 .off1 = offsetof(struct thread_options, fallocate_mode),
2392 .help = "Whether pre-allocation is performed when laying out files",
2394 .category = FIO_OPT_C_FILE,
2395 .group = FIO_OPT_G_INVALID,
2398 .oval = FIO_FALLOCATE_NONE,
2399 .help = "Do not pre-allocate space",
2402 .oval = FIO_FALLOCATE_NATIVE,
2403 .help = "Use native pre-allocation if possible",
2405 #ifdef CONFIG_POSIX_FALLOCATE
2407 .oval = FIO_FALLOCATE_POSIX,
2408 .help = "Use posix_fallocate()",
2411 #ifdef CONFIG_LINUX_FALLOCATE
2413 .oval = FIO_FALLOCATE_KEEP_SIZE,
2414 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2417 /* Compatibility with former boolean values */
2419 .oval = FIO_FALLOCATE_NONE,
2420 .help = "Alias for 'none'",
2422 #ifdef CONFIG_POSIX_FALLOCATE
2424 .oval = FIO_FALLOCATE_POSIX,
2425 .help = "Alias for 'posix'",
2430 #else /* FIO_HAVE_ANY_FALLOCATE */
2432 .name = "fallocate",
2433 .lname = "Fallocate",
2434 .type = FIO_OPT_UNSUPPORTED,
2435 .help = "Your platform does not support fallocate",
2437 #endif /* FIO_HAVE_ANY_FALLOCATE */
2439 .name = "fadvise_hint",
2440 .lname = "Fadvise hint",
2441 .type = FIO_OPT_STR,
2442 .off1 = offsetof(struct thread_options, fadvise_hint),
2446 .help = "Don't issue fadvise/madvise",
2450 .help = "Advise using fio IO pattern",
2453 .oval = F_ADV_RANDOM,
2454 .help = "Advise using FADV_RANDOM",
2456 { .ival = "sequential",
2457 .oval = F_ADV_SEQUENTIAL,
2458 .help = "Advise using FADV_SEQUENTIAL",
2461 .help = "Use fadvise() to advise the kernel on IO pattern",
2463 .category = FIO_OPT_C_FILE,
2464 .group = FIO_OPT_G_INVALID,
2469 .type = FIO_OPT_INT,
2470 .off1 = offsetof(struct thread_options, fsync_blocks),
2471 .help = "Issue fsync for writes every given number of blocks",
2474 .category = FIO_OPT_C_FILE,
2475 .group = FIO_OPT_G_INVALID,
2478 .name = "fdatasync",
2479 .lname = "Fdatasync",
2480 .type = FIO_OPT_INT,
2481 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2482 .help = "Issue fdatasync for writes every given number of blocks",
2485 .category = FIO_OPT_C_FILE,
2486 .group = FIO_OPT_G_INVALID,
2489 .name = "write_barrier",
2490 .lname = "Write barrier",
2491 .type = FIO_OPT_INT,
2492 .off1 = offsetof(struct thread_options, barrier_blocks),
2493 .help = "Make every Nth write a barrier write",
2496 .category = FIO_OPT_C_IO,
2497 .group = FIO_OPT_G_INVALID,
2499 #ifdef CONFIG_SYNC_FILE_RANGE
2501 .name = "sync_file_range",
2502 .lname = "Sync file range",
2504 { .ival = "wait_before",
2505 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2506 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2510 .oval = SYNC_FILE_RANGE_WRITE,
2511 .help = "SYNC_FILE_RANGE_WRITE",
2515 .ival = "wait_after",
2516 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2517 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2521 .type = FIO_OPT_STR_MULTI,
2523 .off1 = offsetof(struct thread_options, sync_file_range),
2524 .help = "Use sync_file_range()",
2525 .category = FIO_OPT_C_FILE,
2526 .group = FIO_OPT_G_INVALID,
2530 .name = "sync_file_range",
2531 .lname = "Sync file range",
2532 .type = FIO_OPT_UNSUPPORTED,
2533 .help = "Your platform does not support sync_file_range",
2538 .lname = "Direct I/O",
2539 .type = FIO_OPT_BOOL,
2540 .off1 = offsetof(struct thread_options, odirect),
2541 .help = "Use O_DIRECT IO (negates buffered)",
2543 .inverse = "buffered",
2544 .category = FIO_OPT_C_IO,
2545 .group = FIO_OPT_G_IO_TYPE,
2549 .lname = "Atomic I/O",
2550 .type = FIO_OPT_BOOL,
2551 .off1 = offsetof(struct thread_options, oatomic),
2552 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2554 .category = FIO_OPT_C_IO,
2555 .group = FIO_OPT_G_IO_TYPE,
2559 .lname = "Buffered I/O",
2560 .type = FIO_OPT_BOOL,
2561 .off1 = offsetof(struct thread_options, odirect),
2563 .help = "Use buffered IO (negates direct)",
2565 .inverse = "direct",
2566 .category = FIO_OPT_C_IO,
2567 .group = FIO_OPT_G_IO_TYPE,
2570 .name = "overwrite",
2571 .lname = "Overwrite",
2572 .type = FIO_OPT_BOOL,
2573 .off1 = offsetof(struct thread_options, overwrite),
2574 .help = "When writing, set whether to overwrite current data",
2576 .category = FIO_OPT_C_FILE,
2577 .group = FIO_OPT_G_INVALID,
2582 .type = FIO_OPT_INT,
2583 .off1 = offsetof(struct thread_options, loops),
2584 .help = "Number of times to run the job",
2587 .category = FIO_OPT_C_GENERAL,
2588 .group = FIO_OPT_G_RUNTIME,
2592 .lname = "Number of jobs",
2593 .type = FIO_OPT_INT,
2594 .off1 = offsetof(struct thread_options, numjobs),
2595 .help = "Duplicate this job this many times",
2598 .category = FIO_OPT_C_GENERAL,
2599 .group = FIO_OPT_G_RUNTIME,
2602 .name = "startdelay",
2603 .lname = "Start delay",
2604 .type = FIO_OPT_STR_VAL_TIME,
2605 .off1 = offsetof(struct thread_options, start_delay),
2606 .off2 = offsetof(struct thread_options, start_delay_high),
2607 .help = "Only start job when this period has passed",
2611 .category = FIO_OPT_C_GENERAL,
2612 .group = FIO_OPT_G_RUNTIME,
2618 .type = FIO_OPT_STR_VAL_TIME,
2619 .off1 = offsetof(struct thread_options, timeout),
2620 .help = "Stop workload when this amount of time has passed",
2624 .category = FIO_OPT_C_GENERAL,
2625 .group = FIO_OPT_G_RUNTIME,
2628 .name = "time_based",
2629 .lname = "Time based",
2630 .type = FIO_OPT_STR_SET,
2631 .off1 = offsetof(struct thread_options, time_based),
2632 .help = "Keep running until runtime/timeout is met",
2633 .category = FIO_OPT_C_GENERAL,
2634 .group = FIO_OPT_G_RUNTIME,
2637 .name = "verify_only",
2638 .lname = "Verify only",
2639 .type = FIO_OPT_STR_SET,
2640 .off1 = offsetof(struct thread_options, verify_only),
2641 .help = "Verifies previously written data is still valid",
2642 .category = FIO_OPT_C_GENERAL,
2643 .group = FIO_OPT_G_RUNTIME,
2646 .name = "ramp_time",
2647 .lname = "Ramp time",
2648 .type = FIO_OPT_STR_VAL_TIME,
2649 .off1 = offsetof(struct thread_options, ramp_time),
2650 .help = "Ramp up time before measuring performance",
2653 .category = FIO_OPT_C_GENERAL,
2654 .group = FIO_OPT_G_RUNTIME,
2657 .name = "clocksource",
2658 .lname = "Clock source",
2659 .type = FIO_OPT_STR,
2660 .cb = fio_clock_source_cb,
2661 .off1 = offsetof(struct thread_options, clocksource),
2662 .help = "What type of timing source to use",
2663 .category = FIO_OPT_C_GENERAL,
2664 .group = FIO_OPT_G_CLOCK,
2666 #ifdef CONFIG_GETTIMEOFDAY
2667 { .ival = "gettimeofday",
2669 .help = "Use gettimeofday(2) for timing",
2672 #ifdef CONFIG_CLOCK_GETTIME
2673 { .ival = "clock_gettime",
2674 .oval = CS_CGETTIME,
2675 .help = "Use clock_gettime(2) for timing",
2678 #ifdef ARCH_HAVE_CPU_CLOCK
2680 .oval = CS_CPUCLOCK,
2681 .help = "Use CPU private clock",
2689 .lname = "I/O Memory",
2690 .type = FIO_OPT_STR,
2692 .off1 = offsetof(struct thread_options, mem_type),
2693 .help = "Backing type for IO buffers",
2695 .category = FIO_OPT_C_IO,
2696 .group = FIO_OPT_G_INVALID,
2700 .help = "Use malloc(3) for IO buffers",
2702 #ifndef CONFIG_NO_SHM
2705 .help = "Use shared memory segments for IO buffers",
2707 #ifdef FIO_HAVE_HUGETLB
2708 { .ival = "shmhuge",
2709 .oval = MEM_SHMHUGE,
2710 .help = "Like shm, but use huge pages",
2716 .help = "Use mmap(2) (file or anon) for IO buffers",
2718 { .ival = "mmapshared",
2719 .oval = MEM_MMAPSHARED,
2720 .help = "Like mmap, but use the shared flag",
2722 #ifdef FIO_HAVE_HUGETLB
2723 { .ival = "mmaphuge",
2724 .oval = MEM_MMAPHUGE,
2725 .help = "Like mmap, but use huge pages",
2729 { .ival = "cudamalloc",
2730 .oval = MEM_CUDA_MALLOC,
2731 .help = "Allocate GPU device memory for GPUDirect RDMA",
2737 .name = "iomem_align",
2738 .alias = "mem_align",
2739 .lname = "I/O memory alignment",
2740 .type = FIO_OPT_INT,
2741 .off1 = offsetof(struct thread_options, mem_align),
2743 .help = "IO memory buffer offset alignment",
2747 .category = FIO_OPT_C_IO,
2748 .group = FIO_OPT_G_INVALID,
2753 .type = FIO_OPT_STR,
2754 .off1 = offsetof(struct thread_options, verify),
2755 .help = "Verify data written",
2757 .category = FIO_OPT_C_IO,
2758 .group = FIO_OPT_G_VERIFY,
2761 .oval = VERIFY_NONE,
2762 .help = "Don't do IO verification",
2766 .help = "Use md5 checksums for verification",
2769 .oval = VERIFY_CRC64,
2770 .help = "Use crc64 checksums for verification",
2773 .oval = VERIFY_CRC32,
2774 .help = "Use crc32 checksums for verification",
2776 { .ival = "crc32c-intel",
2777 .oval = VERIFY_CRC32C,
2778 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2781 .oval = VERIFY_CRC32C,
2782 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2785 .oval = VERIFY_CRC16,
2786 .help = "Use crc16 checksums for verification",
2789 .oval = VERIFY_CRC7,
2790 .help = "Use crc7 checksums for verification",
2793 .oval = VERIFY_SHA1,
2794 .help = "Use sha1 checksums for verification",
2797 .oval = VERIFY_SHA256,
2798 .help = "Use sha256 checksums for verification",
2801 .oval = VERIFY_SHA512,
2802 .help = "Use sha512 checksums for verification",
2804 { .ival = "sha3-224",
2805 .oval = VERIFY_SHA3_224,
2806 .help = "Use sha3-224 checksums for verification",
2808 { .ival = "sha3-256",
2809 .oval = VERIFY_SHA3_256,
2810 .help = "Use sha3-256 checksums for verification",
2812 { .ival = "sha3-384",
2813 .oval = VERIFY_SHA3_384,
2814 .help = "Use sha3-384 checksums for verification",
2816 { .ival = "sha3-512",
2817 .oval = VERIFY_SHA3_512,
2818 .help = "Use sha3-512 checksums for verification",
2821 .oval = VERIFY_XXHASH,
2822 .help = "Use xxhash checksums for verification",
2824 /* Meta information was included into verify_header,
2825 * 'meta' verification is implied by default. */
2827 .oval = VERIFY_HDR_ONLY,
2828 .help = "Use io information for verification. "
2829 "Now is implied by default, thus option is obsolete, "
2832 { .ival = "pattern",
2833 .oval = VERIFY_PATTERN_NO_HDR,
2834 .help = "Verify strict pattern",
2838 .oval = VERIFY_NULL,
2839 .help = "Pretend to verify",
2844 .name = "do_verify",
2845 .lname = "Perform verify step",
2846 .type = FIO_OPT_BOOL,
2847 .off1 = offsetof(struct thread_options, do_verify),
2848 .help = "Run verification stage after write",
2852 .category = FIO_OPT_C_IO,
2853 .group = FIO_OPT_G_VERIFY,
2856 .name = "verifysort",
2857 .lname = "Verify sort",
2858 .type = FIO_OPT_BOOL,
2859 .off1 = offsetof(struct thread_options, verifysort),
2860 .help = "Sort written verify blocks for read back",
2864 .category = FIO_OPT_C_IO,
2865 .group = FIO_OPT_G_VERIFY,
2868 .name = "verifysort_nr",
2869 .lname = "Verify Sort Nr",
2870 .type = FIO_OPT_INT,
2871 .off1 = offsetof(struct thread_options, verifysort_nr),
2872 .help = "Pre-load and sort verify blocks for a read workload",
2877 .category = FIO_OPT_C_IO,
2878 .group = FIO_OPT_G_VERIFY,
2881 .name = "verify_interval",
2882 .lname = "Verify interval",
2883 .type = FIO_OPT_INT,
2884 .off1 = offsetof(struct thread_options, verify_interval),
2885 .minval = 2 * sizeof(struct verify_header),
2886 .help = "Store verify buffer header every N bytes",
2889 .interval = 2 * sizeof(struct verify_header),
2890 .category = FIO_OPT_C_IO,
2891 .group = FIO_OPT_G_VERIFY,
2894 .name = "verify_offset",
2895 .lname = "Verify offset",
2896 .type = FIO_OPT_INT,
2897 .help = "Offset verify header location by N bytes",
2898 .off1 = offsetof(struct thread_options, verify_offset),
2899 .minval = sizeof(struct verify_header),
2902 .category = FIO_OPT_C_IO,
2903 .group = FIO_OPT_G_VERIFY,
2906 .name = "verify_pattern",
2907 .lname = "Verify pattern",
2908 .type = FIO_OPT_STR,
2909 .cb = str_verify_pattern_cb,
2910 .off1 = offsetof(struct thread_options, verify_pattern),
2911 .help = "Fill pattern for IO buffers",
2914 .category = FIO_OPT_C_IO,
2915 .group = FIO_OPT_G_VERIFY,
2918 .name = "verify_fatal",
2919 .lname = "Verify fatal",
2920 .type = FIO_OPT_BOOL,
2921 .off1 = offsetof(struct thread_options, verify_fatal),
2923 .help = "Exit on a single verify failure, don't continue",
2926 .category = FIO_OPT_C_IO,
2927 .group = FIO_OPT_G_VERIFY,
2930 .name = "verify_dump",
2931 .lname = "Verify dump",
2932 .type = FIO_OPT_BOOL,
2933 .off1 = offsetof(struct thread_options, verify_dump),
2935 .help = "Dump contents of good and bad blocks on failure",
2938 .category = FIO_OPT_C_IO,
2939 .group = FIO_OPT_G_VERIFY,
2942 .name = "verify_async",
2943 .lname = "Verify asynchronously",
2944 .type = FIO_OPT_INT,
2945 .off1 = offsetof(struct thread_options, verify_async),
2947 .help = "Number of async verifier threads to use",
2950 .category = FIO_OPT_C_IO,
2951 .group = FIO_OPT_G_VERIFY,
2954 .name = "verify_backlog",
2955 .lname = "Verify backlog",
2956 .type = FIO_OPT_STR_VAL,
2957 .off1 = offsetof(struct thread_options, verify_backlog),
2958 .help = "Verify after this number of blocks are written",
2961 .category = FIO_OPT_C_IO,
2962 .group = FIO_OPT_G_VERIFY,
2965 .name = "verify_backlog_batch",
2966 .lname = "Verify backlog batch",
2967 .type = FIO_OPT_INT,
2968 .off1 = offsetof(struct thread_options, verify_batch),
2969 .help = "Verify this number of IO blocks",
2972 .category = FIO_OPT_C_IO,
2973 .group = FIO_OPT_G_VERIFY,
2975 #ifdef FIO_HAVE_CPU_AFFINITY
2977 .name = "verify_async_cpus",
2978 .lname = "Async verify CPUs",
2979 .type = FIO_OPT_STR,
2980 .cb = str_verify_cpus_allowed_cb,
2981 .off1 = offsetof(struct thread_options, verify_cpumask),
2982 .help = "Set CPUs allowed for async verify threads",
2983 .parent = "verify_async",
2985 .category = FIO_OPT_C_IO,
2986 .group = FIO_OPT_G_VERIFY,
2990 .name = "verify_async_cpus",
2991 .lname = "Async verify CPUs",
2992 .type = FIO_OPT_UNSUPPORTED,
2993 .help = "Your platform does not support CPU affinities",
2997 .name = "experimental_verify",
2998 .lname = "Experimental Verify",
2999 .off1 = offsetof(struct thread_options, experimental_verify),
3000 .type = FIO_OPT_BOOL,
3001 .help = "Enable experimental verification",
3003 .category = FIO_OPT_C_IO,
3004 .group = FIO_OPT_G_VERIFY,
3007 .name = "verify_state_load",
3008 .lname = "Load verify state",
3009 .off1 = offsetof(struct thread_options, verify_state),
3010 .type = FIO_OPT_BOOL,
3011 .help = "Load verify termination state",
3013 .category = FIO_OPT_C_IO,
3014 .group = FIO_OPT_G_VERIFY,
3017 .name = "verify_state_save",
3018 .lname = "Save verify state",
3019 .off1 = offsetof(struct thread_options, verify_state_save),
3020 .type = FIO_OPT_BOOL,
3022 .help = "Save verify state on termination",
3024 .category = FIO_OPT_C_IO,
3025 .group = FIO_OPT_G_VERIFY,
3027 #ifdef FIO_HAVE_TRIM
3029 .name = "trim_percentage",
3030 .lname = "Trim percentage",
3031 .type = FIO_OPT_INT,
3032 .off1 = offsetof(struct thread_options, trim_percentage),
3035 .help = "Number of verify blocks to trim (i.e., discard)",
3040 .category = FIO_OPT_C_IO,
3041 .group = FIO_OPT_G_TRIM,
3044 .name = "trim_verify_zero",
3045 .lname = "Verify trim zero",
3046 .type = FIO_OPT_BOOL,
3047 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3048 .off1 = offsetof(struct thread_options, trim_zero),
3049 .parent = "trim_percentage",
3052 .category = FIO_OPT_C_IO,
3053 .group = FIO_OPT_G_TRIM,
3056 .name = "trim_backlog",
3057 .lname = "Trim backlog",
3058 .type = FIO_OPT_STR_VAL,
3059 .off1 = offsetof(struct thread_options, trim_backlog),
3060 .help = "Trim after this number of blocks are written",
3061 .parent = "trim_percentage",
3064 .category = FIO_OPT_C_IO,
3065 .group = FIO_OPT_G_TRIM,
3068 .name = "trim_backlog_batch",
3069 .lname = "Trim backlog batch",
3070 .type = FIO_OPT_INT,
3071 .off1 = offsetof(struct thread_options, trim_batch),
3072 .help = "Trim this number of IO blocks",
3073 .parent = "trim_percentage",
3076 .category = FIO_OPT_C_IO,
3077 .group = FIO_OPT_G_TRIM,
3081 .name = "trim_percentage",
3082 .lname = "Trim percentage",
3083 .type = FIO_OPT_UNSUPPORTED,
3084 .help = "Fio does not support TRIM on your platform",
3087 .name = "trim_verify_zero",
3088 .lname = "Verify trim zero",
3089 .type = FIO_OPT_UNSUPPORTED,
3090 .help = "Fio does not support TRIM on your platform",
3093 .name = "trim_backlog",
3094 .lname = "Trim backlog",
3095 .type = FIO_OPT_UNSUPPORTED,
3096 .help = "Fio does not support TRIM on your platform",
3099 .name = "trim_backlog_batch",
3100 .lname = "Trim backlog batch",
3101 .type = FIO_OPT_UNSUPPORTED,
3102 .help = "Fio does not support TRIM on your platform",
3106 .name = "write_iolog",
3107 .lname = "Write I/O log",
3108 .type = FIO_OPT_STR_STORE,
3109 .off1 = offsetof(struct thread_options, write_iolog_file),
3110 .help = "Store IO pattern to file",
3111 .category = FIO_OPT_C_IO,
3112 .group = FIO_OPT_G_IOLOG,
3115 .name = "read_iolog",
3116 .lname = "Read I/O log",
3117 .type = FIO_OPT_STR_STORE,
3118 .off1 = offsetof(struct thread_options, read_iolog_file),
3119 .help = "Playback IO pattern from file",
3120 .category = FIO_OPT_C_IO,
3121 .group = FIO_OPT_G_IOLOG,
3124 .name = "replay_no_stall",
3125 .lname = "Don't stall on replay",
3126 .type = FIO_OPT_BOOL,
3127 .off1 = offsetof(struct thread_options, no_stall),
3129 .parent = "read_iolog",
3131 .help = "Playback IO pattern file as fast as possible without stalls",
3132 .category = FIO_OPT_C_IO,
3133 .group = FIO_OPT_G_IOLOG,
3136 .name = "replay_redirect",
3137 .lname = "Redirect device for replay",
3138 .type = FIO_OPT_STR_STORE,
3139 .off1 = offsetof(struct thread_options, replay_redirect),
3140 .parent = "read_iolog",
3142 .help = "Replay all I/O onto this device, regardless of trace device",
3143 .category = FIO_OPT_C_IO,
3144 .group = FIO_OPT_G_IOLOG,
3147 .name = "replay_scale",
3148 .lname = "Replace offset scale factor",
3149 .type = FIO_OPT_INT,
3150 .off1 = offsetof(struct thread_options, replay_scale),
3151 .parent = "read_iolog",
3153 .help = "Align offsets to this blocksize",
3154 .category = FIO_OPT_C_IO,
3155 .group = FIO_OPT_G_IOLOG,
3158 .name = "replay_align",
3159 .lname = "Replace alignment",
3160 .type = FIO_OPT_INT,
3161 .off1 = offsetof(struct thread_options, replay_align),
3162 .parent = "read_iolog",
3163 .help = "Scale offset down by this factor",
3164 .category = FIO_OPT_C_IO,
3165 .group = FIO_OPT_G_IOLOG,
3169 .name = "exec_prerun",
3170 .lname = "Pre-execute runnable",
3171 .type = FIO_OPT_STR_STORE,
3172 .off1 = offsetof(struct thread_options, exec_prerun),
3173 .help = "Execute this file prior to running job",
3174 .category = FIO_OPT_C_GENERAL,
3175 .group = FIO_OPT_G_INVALID,
3178 .name = "exec_postrun",
3179 .lname = "Post-execute runnable",
3180 .type = FIO_OPT_STR_STORE,
3181 .off1 = offsetof(struct thread_options, exec_postrun),
3182 .help = "Execute this file after running job",
3183 .category = FIO_OPT_C_GENERAL,
3184 .group = FIO_OPT_G_INVALID,
3186 #ifdef FIO_HAVE_IOSCHED_SWITCH
3188 .name = "ioscheduler",
3189 .lname = "I/O scheduler",
3190 .type = FIO_OPT_STR_STORE,
3191 .off1 = offsetof(struct thread_options, ioscheduler),
3192 .help = "Use this IO scheduler on the backing device",
3193 .category = FIO_OPT_C_FILE,
3194 .group = FIO_OPT_G_INVALID,
3198 .name = "ioscheduler",
3199 .lname = "I/O scheduler",
3200 .type = FIO_OPT_UNSUPPORTED,
3201 .help = "Your platform does not support IO scheduler switching",
3206 .lname = "Zone size",
3207 .type = FIO_OPT_STR_VAL,
3208 .off1 = offsetof(struct thread_options, zone_size),
3209 .help = "Amount of data to read per zone",
3211 .interval = 1024 * 1024,
3212 .category = FIO_OPT_C_IO,
3213 .group = FIO_OPT_G_ZONE,
3216 .name = "zonerange",
3217 .lname = "Zone range",
3218 .type = FIO_OPT_STR_VAL,
3219 .off1 = offsetof(struct thread_options, zone_range),
3220 .help = "Give size of an IO zone",
3222 .interval = 1024 * 1024,
3223 .category = FIO_OPT_C_IO,
3224 .group = FIO_OPT_G_ZONE,
3228 .lname = "Zone skip",
3229 .type = FIO_OPT_STR_VAL,
3230 .off1 = offsetof(struct thread_options, zone_skip),
3231 .help = "Space between IO zones",
3233 .interval = 1024 * 1024,
3234 .category = FIO_OPT_C_IO,
3235 .group = FIO_OPT_G_ZONE,
3239 .lname = "Lock memory",
3240 .type = FIO_OPT_STR_VAL,
3241 .off1 = offsetof(struct thread_options, lockmem),
3242 .help = "Lock down this amount of memory (per worker)",
3244 .interval = 1024 * 1024,
3245 .category = FIO_OPT_C_GENERAL,
3246 .group = FIO_OPT_G_INVALID,
3249 .name = "rwmixread",
3250 .lname = "Read/write mix read",
3251 .type = FIO_OPT_INT,
3252 .cb = str_rwmix_read_cb,
3253 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3255 .help = "Percentage of mixed workload that is reads",
3258 .inverse = "rwmixwrite",
3259 .category = FIO_OPT_C_IO,
3260 .group = FIO_OPT_G_RWMIX,
3263 .name = "rwmixwrite",
3264 .lname = "Read/write mix write",
3265 .type = FIO_OPT_INT,
3266 .cb = str_rwmix_write_cb,
3267 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3269 .help = "Percentage of mixed workload that is writes",
3272 .inverse = "rwmixread",
3273 .category = FIO_OPT_C_IO,
3274 .group = FIO_OPT_G_RWMIX,
3277 .name = "rwmixcycle",
3278 .lname = "Read/write mix cycle",
3279 .type = FIO_OPT_DEPRECATED,
3280 .category = FIO_OPT_C_IO,
3281 .group = FIO_OPT_G_RWMIX,
3286 .type = FIO_OPT_INT,
3287 .off1 = offsetof(struct thread_options, nice),
3288 .help = "Set job CPU nice value",
3293 .category = FIO_OPT_C_GENERAL,
3294 .group = FIO_OPT_G_CRED,
3296 #ifdef FIO_HAVE_IOPRIO
3299 .lname = "I/O nice priority",
3300 .type = FIO_OPT_INT,
3301 .off1 = offsetof(struct thread_options, ioprio),
3302 .help = "Set job IO priority value",
3303 .minval = IOPRIO_MIN_PRIO,
3304 .maxval = IOPRIO_MAX_PRIO,
3306 .category = FIO_OPT_C_GENERAL,
3307 .group = FIO_OPT_G_CRED,
3312 .lname = "I/O nice priority",
3313 .type = FIO_OPT_UNSUPPORTED,
3314 .help = "Your platform does not support IO priorities",
3317 #ifdef FIO_HAVE_IOPRIO_CLASS
3318 #ifndef FIO_HAVE_IOPRIO
3319 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3322 .name = "prioclass",
3323 .lname = "I/O nice priority class",
3324 .type = FIO_OPT_INT,
3325 .off1 = offsetof(struct thread_options, ioprio_class),
3326 .help = "Set job IO priority class",
3327 .minval = IOPRIO_MIN_PRIO_CLASS,
3328 .maxval = IOPRIO_MAX_PRIO_CLASS,
3330 .category = FIO_OPT_C_GENERAL,
3331 .group = FIO_OPT_G_CRED,
3335 .name = "prioclass",
3336 .lname = "I/O nice priority class",
3337 .type = FIO_OPT_UNSUPPORTED,
3338 .help = "Your platform does not support IO priority classes",
3342 .name = "thinktime",
3343 .lname = "Thinktime",
3344 .type = FIO_OPT_INT,
3345 .off1 = offsetof(struct thread_options, thinktime),
3346 .help = "Idle time between IO buffers (usec)",
3349 .category = FIO_OPT_C_IO,
3350 .group = FIO_OPT_G_THINKTIME,
3353 .name = "thinktime_spin",
3354 .lname = "Thinktime spin",
3355 .type = FIO_OPT_INT,
3356 .off1 = offsetof(struct thread_options, thinktime_spin),
3357 .help = "Start think time by spinning this amount (usec)",