8 #include <netinet/in.h>
13 #include "lib/pattern.h"
18 char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
20 #define cb_data_to_td(data) container_of(data, struct thread_data, o)
22 static const struct pattern_fmt_desc fmt_desc[] = {
25 .len = FIO_FIELD_SIZE(struct io_u *, offset),
26 .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 bool split_parse_distr(const char *str, double *val, double *center)
61 r = str_to_float(cp, center, 0);
63 r = r && str_to_float(p, val, 0);
68 static int bs_cmp(const void *p1, const void *p2)
70 const struct bssplit *bsp1 = p1;
71 const struct bssplit *bsp2 = p2;
73 return (int) bsp1->perc - (int) bsp2->perc;
76 int split_parse_ddir(struct thread_options *o, struct split *split,
77 char *str, bool absolute, unsigned int max_splits)
79 unsigned long long perc;
87 while ((fname = strsep(&str, ":")) != NULL) {
93 perc_str = strstr(fname, "/");
98 if (str_to_decimal(perc_str, &val, 1, o, 0, 0)) {
99 log_err("fio: split conversion failed\n");
104 perc = atoi(perc_str);
117 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
118 log_err("fio: split conversion failed\n");
122 split->val1[i] = val;
123 split->val2[i] = perc;
125 if (i == max_splits) {
126 log_err("fio: hit max of %d split entries\n", i);
135 static int bssplit_ddir(struct thread_options *o, void *eo,
136 enum fio_ddir ddir, char *str, bool data)
138 unsigned int i, perc, perc_missing;
139 unsigned long long max_bs, min_bs;
142 memset(&split, 0, sizeof(split));
144 if (split_parse_ddir(o, &split, str, data, BSSPLIT_MAX))
151 o->bssplit[ddir] = malloc(split.nr * sizeof(struct bssplit));
152 o->bssplit_nr[ddir] = split.nr;
153 for (i = 0; i < split.nr; i++) {
154 if (split.val1[i] > max_bs)
155 max_bs = split.val1[i];
156 if (split.val1[i] < min_bs)
157 min_bs = split.val1[i];
159 o->bssplit[ddir][i].bs = split.val1[i];
160 o->bssplit[ddir][i].perc =split.val2[i];
164 * Now check if the percentages add up, and how much is missing
166 perc = perc_missing = 0;
167 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
168 struct bssplit *bsp = &o->bssplit[ddir][i];
170 if (bsp->perc == -1U)
176 if (perc > 100 && perc_missing > 1) {
177 log_err("fio: bssplit percentages add to more than 100%%\n");
178 free(o->bssplit[ddir]);
179 o->bssplit[ddir] = NULL;
184 * If values didn't have a percentage set, divide the remains between
188 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
190 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
191 struct bssplit *bsp = &o->bssplit[ddir][i];
193 if (bsp->perc == -1U)
194 bsp->perc = (100 - perc) / perc_missing;
198 o->min_bs[ddir] = min_bs;
199 o->max_bs[ddir] = max_bs;
202 * now sort based on percentages, for ease of lookup
204 qsort(o->bssplit[ddir], o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
208 int str_split_parse(struct thread_data *td, char *str,
209 split_parse_fn *fn, void *eo, bool data)
214 odir = strchr(str, ',');
216 ddir = strchr(odir + 1, ',');
218 ret = fn(&td->o, eo, DDIR_TRIM, ddir + 1, data);
224 op = strdup(odir + 1);
225 ret = fn(&td->o, eo, DDIR_TRIM, op, data);
230 ret = fn(&td->o, eo, DDIR_WRITE, odir + 1, data);
233 ret = fn(&td->o, eo, DDIR_READ, str, data);
239 ret = fn(&td->o, eo, DDIR_WRITE, op, data);
244 ret = fn(&td->o, eo, DDIR_TRIM, op, data);
248 ret = fn(&td->o, eo, DDIR_READ, str, data);
254 static int str_bssplit_cb(void *data, const char *input)
256 struct thread_data *td = cb_data_to_td(data);
260 p = str = strdup(input);
262 strip_blank_front(&str);
263 strip_blank_end(str);
265 ret = str_split_parse(td, str, bssplit_ddir, NULL, false);
267 if (parse_dryrun()) {
270 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
271 free(td->o.bssplit[i]);
272 td->o.bssplit[i] = NULL;
273 td->o.bssplit_nr[i] = 0;
281 static int str2error(char *str)
283 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
284 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
285 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
286 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
287 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
288 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
289 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
290 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
291 int i = 0, num = sizeof(err) / sizeof(char *);
294 if (!strcmp(err[i], str))
301 static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
308 if (etype >= ERROR_TYPE_CNT) {
309 log_err("Illegal error type\n");
313 td->o.ignore_error_nr[etype] = 4;
314 error = calloc(4, sizeof(int));
317 while ((fname = strsep(&str, ":")) != NULL) {
323 * grow struct buffer, if needed
325 if (i == td->o.ignore_error_nr[etype]) {
326 td->o.ignore_error_nr[etype] <<= 1;
327 error = realloc(error, td->o.ignore_error_nr[etype]
330 if (fname[0] == 'E') {
331 error[i] = str2error(fname);
333 error[i] = atoi(fname);
335 error[i] = -error[i];
338 log_err("Unknown error %s, please use number value\n",
340 td->o.ignore_error_nr[etype] = 0;
347 td->o.continue_on_error |= 1 << etype;
348 td->o.ignore_error_nr[etype] = i;
349 td->o.ignore_error[etype] = error;
351 td->o.ignore_error_nr[etype] = 0;
359 static int str_replay_skip_cb(void *data, const char *input)
361 struct thread_data *td = cb_data_to_td(data);
368 p = str = strdup(input);
370 strip_blank_front(&str);
371 strip_blank_end(str);
377 if (!strcmp(p, "read"))
378 td->o.replay_skip |= 1u << DDIR_READ;
379 else if (!strcmp(p, "write"))
380 td->o.replay_skip |= 1u << DDIR_WRITE;
381 else if (!strcmp(p, "trim"))
382 td->o.replay_skip |= 1u << DDIR_TRIM;
383 else if (!strcmp(p, "sync"))
384 td->o.replay_skip |= 1u << DDIR_SYNC;
386 log_err("Unknown skip type: %s\n", p);
396 static int str_ignore_error_cb(void *data, const char *input)
398 struct thread_data *td = cb_data_to_td(data);
401 enum error_type_bit type = 0;
406 p = str = strdup(input);
408 strip_blank_front(&str);
409 strip_blank_end(str);
415 ret = ignore_error_type(td, type, p);
425 static int str_rw_cb(void *data, const char *str)
427 struct thread_data *td = cb_data_to_td(data);
428 struct thread_options *o = &td->o;
437 nr = get_opt_postfix(str);
442 o->ddir_seq_nr = atoi(nr);
446 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
447 log_err("fio: rw postfix parsing failed\n");
452 o->ddir_seq_add = val;
459 static int str_mem_cb(void *data, const char *mem)
461 struct thread_data *td = cb_data_to_td(data);
463 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
464 td->o.mem_type == MEM_MMAPSHARED)
465 td->o.mmapfile = get_opt_postfix(mem);
470 static int fio_clock_source_cb(void *data, const char *str)
472 struct thread_data *td = cb_data_to_td(data);
474 fio_clock_source = td->o.clocksource;
475 fio_clock_source_set = 1;
480 static int str_rwmix_read_cb(void *data, unsigned long long *val)
482 struct thread_data *td = cb_data_to_td(data);
484 td->o.rwmix[DDIR_READ] = *val;
485 td->o.rwmix[DDIR_WRITE] = 100 - *val;
489 static int str_rwmix_write_cb(void *data, unsigned long long *val)
491 struct thread_data *td = cb_data_to_td(data);
493 td->o.rwmix[DDIR_WRITE] = *val;
494 td->o.rwmix[DDIR_READ] = 100 - *val;
498 static int str_exitall_cb(void)
500 exitall_on_terminate = true;
504 #ifdef FIO_HAVE_CPU_AFFINITY
505 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
507 unsigned int i, index, cpus_in_mask;
508 const long max_cpu = cpus_online();
510 cpus_in_mask = fio_cpu_count(mask);
514 cpu_index = cpu_index % cpus_in_mask;
517 for (i = 0; i < max_cpu; i++) {
518 if (!fio_cpu_isset(mask, i))
521 if (cpu_index != index)
522 fio_cpu_clear(mask, i);
527 return fio_cpu_count(mask);
530 static int str_cpumask_cb(void *data, unsigned long long *val)
532 struct thread_data *td = cb_data_to_td(data);
540 ret = fio_cpuset_init(&td->o.cpumask);
542 log_err("fio: cpuset_init failed\n");
543 td_verror(td, ret, "fio_cpuset_init");
547 max_cpu = cpus_online();
549 for (i = 0; i < sizeof(int) * 8; i++) {
550 if ((1 << i) & *val) {
552 log_err("fio: CPU %d too large (max=%ld)\n", i,
556 dprint(FD_PARSE, "set cpu allowed %d\n", i);
557 fio_cpu_set(&td->o.cpumask, i);
564 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
571 ret = fio_cpuset_init(mask);
573 log_err("fio: cpuset_init failed\n");
574 td_verror(td, ret, "fio_cpuset_init");
578 p = str = strdup(input);
580 strip_blank_front(&str);
581 strip_blank_end(str);
583 max_cpu = cpus_online();
585 while ((cpu = strsep(&str, ",")) != NULL) {
594 while ((cpu2 = strsep(&str2, "-")) != NULL) {
604 while (icpu <= icpu2) {
605 if (icpu >= FIO_MAX_CPUS) {
606 log_err("fio: your OS only supports up to"
607 " %d CPUs\n", (int) FIO_MAX_CPUS);
611 if (icpu >= max_cpu) {
612 log_err("fio: CPU %d too large (max=%ld)\n",
618 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
619 fio_cpu_set(mask, icpu);
630 static int str_cpus_allowed_cb(void *data, const char *input)
632 struct thread_data *td = cb_data_to_td(data);
637 return set_cpus_allowed(td, &td->o.cpumask, input);
640 static int str_verify_cpus_allowed_cb(void *data, const char *input)
642 struct thread_data *td = cb_data_to_td(data);
647 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
651 static int str_log_cpus_allowed_cb(void *data, const char *input)
653 struct thread_data *td = cb_data_to_td(data);
658 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
660 #endif /* CONFIG_ZLIB */
662 #endif /* FIO_HAVE_CPU_AFFINITY */
664 #ifdef CONFIG_LIBNUMA
665 static int str_numa_cpunodes_cb(void *data, char *input)
667 struct thread_data *td = cb_data_to_td(data);
668 struct bitmask *verify_bitmask;
673 /* numa_parse_nodestring() parses a character string list
674 * of nodes into a bit mask. The bit mask is allocated by
675 * numa_allocate_nodemask(), so it should be freed by
676 * numa_free_nodemask().
678 verify_bitmask = numa_parse_nodestring(input);
679 if (verify_bitmask == NULL) {
680 log_err("fio: numa_parse_nodestring failed\n");
681 td_verror(td, 1, "str_numa_cpunodes_cb");
684 numa_free_nodemask(verify_bitmask);
686 td->o.numa_cpunodes = strdup(input);
690 static int str_numa_mpol_cb(void *data, char *input)
692 struct thread_data *td = cb_data_to_td(data);
693 const char * const policy_types[] =
694 { "default", "prefer", "bind", "interleave", "local", NULL };
697 struct bitmask *verify_bitmask;
702 nodelist = strchr(input, ':');
704 /* NUL-terminate mode */
708 for (i = 0; i <= MPOL_LOCAL; i++) {
709 if (!strcmp(input, policy_types[i])) {
710 td->o.numa_mem_mode = i;
714 if (i > MPOL_LOCAL) {
715 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
719 switch (td->o.numa_mem_mode) {
722 * Insist on a nodelist of one node only
725 char *rest = nodelist;
726 while (isdigit(*rest))
729 log_err("fio: one node only for \'prefer\'\n");
733 log_err("fio: one node is needed for \'prefer\'\n");
737 case MPOL_INTERLEAVE:
739 * Default to online nodes with memory if no nodelist
742 nodelist = strdup("all");
747 * Don't allow a nodelist
750 log_err("fio: NO nodelist for \'local\'\n");
756 * Insist on a nodelist
759 log_err("fio: a nodelist is needed for \'bind\'\n");
766 /* numa_parse_nodestring() parses a character string list
767 * of nodes into a bit mask. The bit mask is allocated by
768 * numa_allocate_nodemask(), so it should be freed by
769 * numa_free_nodemask().
771 switch (td->o.numa_mem_mode) {
773 td->o.numa_mem_prefer_node = atoi(nodelist);
775 case MPOL_INTERLEAVE:
777 verify_bitmask = numa_parse_nodestring(nodelist);
778 if (verify_bitmask == NULL) {
779 log_err("fio: numa_parse_nodestring failed\n");
780 td_verror(td, 1, "str_numa_memnodes_cb");
783 td->o.numa_memnodes = strdup(nodelist);
784 numa_free_nodemask(verify_bitmask);
799 static int str_fst_cb(void *data, const char *str)
801 struct thread_data *td = cb_data_to_td(data);
807 td->file_service_nr = 1;
809 switch (td->o.file_service_type) {
810 case FIO_FSERVICE_RANDOM:
811 case FIO_FSERVICE_RR:
812 case FIO_FSERVICE_SEQ:
813 nr = get_opt_postfix(str);
815 td->file_service_nr = atoi(nr);
820 case FIO_FSERVICE_ZIPF:
823 case FIO_FSERVICE_PARETO:
824 val = FIO_DEF_PARETO;
826 case FIO_FSERVICE_GAUSS:
830 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
837 nr = get_opt_postfix(str);
838 if (nr && !split_parse_distr(nr, &val, ¢er)) {
839 log_err("fio: file service type random postfix parsing failed\n");
846 if (center != -1 && (center < 0.00 || center > 1.00)) {
847 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
850 td->random_center = center;
852 switch (td->o.file_service_type) {
853 case FIO_FSERVICE_ZIPF:
855 log_err("fio: zipf theta must be different than 1.0\n");
860 td->zipf_theta = val;
862 case FIO_FSERVICE_PARETO:
863 if (val <= 0.00 || val >= 1.00) {
864 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
871 case FIO_FSERVICE_GAUSS:
872 if (val < 0.00 || val >= 100.00) {
873 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
885 #ifdef CONFIG_SYNC_FILE_RANGE
886 static int str_sfr_cb(void *data, const char *str)
888 struct thread_data *td = cb_data_to_td(data);
889 char *nr = get_opt_postfix(str);
891 td->sync_file_range_nr = 1;
893 td->sync_file_range_nr = atoi(nr);
901 static int zone_split_ddir(struct thread_options *o, void *eo,
902 enum fio_ddir ddir, char *str, bool absolute)
904 unsigned int i, perc, perc_missing, sperc, sperc_missing;
907 memset(&split, 0, sizeof(split));
909 if (split_parse_ddir(o, &split, str, absolute, ZONESPLIT_MAX))
914 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
915 o->zone_split_nr[ddir] = split.nr;
916 for (i = 0; i < split.nr; i++) {
917 o->zone_split[ddir][i].access_perc = split.val1[i];
919 o->zone_split[ddir][i].size = split.val2[i];
921 o->zone_split[ddir][i].size_perc = split.val2[i];
925 * Now check if the percentages add up, and how much is missing
927 perc = perc_missing = 0;
928 sperc = sperc_missing = 0;
929 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
930 struct zone_split *zsp = &o->zone_split[ddir][i];
932 if (zsp->access_perc == (uint8_t) -1U)
935 perc += zsp->access_perc;
938 if (zsp->size_perc == (uint8_t) -1U)
941 sperc += zsp->size_perc;
945 if (perc > 100 || sperc > 100) {
946 log_err("fio: zone_split percentages add to more than 100%%\n");
947 free(o->zone_split[ddir]);
948 o->zone_split[ddir] = NULL;
952 log_err("fio: access percentage don't add up to 100 for zoned "
953 "random distribution (got=%u)\n", perc);
954 free(o->zone_split[ddir]);
955 o->zone_split[ddir] = NULL;
960 * If values didn't have a percentage set, divide the remains between
964 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
966 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
967 struct zone_split *zsp = &o->zone_split[ddir][i];
969 if (zsp->access_perc == (uint8_t) -1U)
970 zsp->access_perc = (100 - perc) / perc_missing;
974 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
976 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
977 struct zone_split *zsp = &o->zone_split[ddir][i];
979 if (zsp->size_perc == (uint8_t) -1U)
980 zsp->size_perc = (100 - sperc) / sperc_missing;
987 static int parse_zoned_distribution(struct thread_data *td, const char *input,
990 const char *pre = absolute ? "zoned_abs:" : "zoned:";
994 p = str = strdup(input);
996 strip_blank_front(&str);
997 strip_blank_end(str);
999 /* We expect it to start like that, bail if not */
1000 if (strncmp(str, pre, strlen(pre))) {
1001 log_err("fio: mismatch in zoned input <%s>\n", str);
1007 ret = str_split_parse(td, str, zone_split_ddir, NULL, absolute);
1011 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1014 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
1016 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
1017 struct zone_split *zsp = &td->o.zone_split[i][j];
1020 dprint(FD_PARSE, "\t%d: %u/%llu\n", j,
1022 (unsigned long long) zsp->size);
1024 dprint(FD_PARSE, "\t%d: %u/%u\n", j,
1031 if (parse_dryrun()) {
1032 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1033 free(td->o.zone_split[i]);
1034 td->o.zone_split[i] = NULL;
1035 td->o.zone_split_nr[i] = 0;
1042 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1043 td->o.zone_split_nr[i] = 0;
1049 static int str_random_distribution_cb(void *data, const char *str)
1051 struct thread_data *td = cb_data_to_td(data);
1056 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
1058 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
1059 val = FIO_DEF_PARETO;
1060 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1062 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
1063 return parse_zoned_distribution(td, str, false);
1064 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED_ABS)
1065 return parse_zoned_distribution(td, str, true);
1069 nr = get_opt_postfix(str);
1070 if (nr && !split_parse_distr(nr, &val, ¢er)) {
1071 log_err("fio: random postfix parsing failed\n");
1078 if (center != -1 && (center < 0.00 || center > 1.00)) {
1079 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
1082 td->o.random_center.u.f = center;
1084 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1086 log_err("fio: zipf theta must different than 1.0\n");
1091 td->o.zipf_theta.u.f = val;
1092 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
1093 if (val <= 0.00 || val >= 1.00) {
1094 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1099 td->o.pareto_h.u.f = val;
1101 if (val < 0.00 || val >= 100.0) {
1102 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
1107 td->o.gauss_dev.u.f = val;
1113 static int str_steadystate_cb(void *data, const char *str)
1115 struct thread_data *td = cb_data_to_td(data);
1121 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1122 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
1123 /* should be impossible to get here */
1124 log_err("fio: unknown steady state criterion\n");
1128 nr = get_opt_postfix(str);
1130 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1135 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1136 pct = strstr(nr, "%");
1139 strip_blank_end(nr);
1140 if (!str_to_float(nr, &val, 0)) {
1141 log_err("fio: could not parse steadystate threshold percentage\n");
1146 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1151 td->o.ss_state |= FIO_SS_PCT;
1152 td->o.ss_limit.u.f = val;
1153 } else if (td->o.ss_state & FIO_SS_IOPS) {
1154 if (!str_to_float(nr, &val, 0)) {
1155 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1160 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1165 td->o.ss_limit.u.f = val;
1166 } else { /* bandwidth criterion */
1167 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1168 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1173 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1178 td->o.ss_limit.u.f = (double) ll;
1181 td->ss.state = td->o.ss_state;
1186 * Return next name in the string. Files are separated with ':'. If the ':'
1187 * is escaped with a '\', then that ':' is part of the filename and does not
1188 * indicate a new file.
1190 char *get_next_str(char **ptr)
1195 if (!str || !strlen(str))
1201 * No colon, we are done
1203 p = strchr(str, ':');
1210 * We got a colon, but it's the first character. Skip and
1218 if (*(p - 1) != '\\') {
1224 memmove(p - 1, p, strlen(p) + 1);
1232 int get_max_str_idx(char *input)
1234 unsigned int cur_idx;
1237 p = str = strdup(input);
1238 for (cur_idx = 0; ; cur_idx++)
1239 if (get_next_str(&str) == NULL)
1247 * Returns the directory at the index, indexes > entires will be
1248 * assigned via modulo division of the index
1250 int set_name_idx(char *target, size_t tlen, char *input, int index,
1251 bool unique_filename)
1253 unsigned int cur_idx;
1255 char *fname, *str, *p;
1257 p = str = strdup(input);
1259 index %= get_max_str_idx(input);
1260 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1261 fname = get_next_str(&str);
1263 if (client_sockaddr_str[0] && unique_filename) {
1264 len = snprintf(target, tlen, "%s/%s.", fname,
1265 client_sockaddr_str);
1267 len = snprintf(target, tlen, "%s%c", fname,
1268 FIO_OS_PATH_SEPARATOR);
1270 target[tlen - 1] = '\0';
1276 char* get_name_by_idx(char *input, int index)
1278 unsigned int cur_idx;
1279 char *fname, *str, *p;
1281 p = str = strdup(input);
1283 index %= get_max_str_idx(input);
1284 for (cur_idx = 0; cur_idx <= index; cur_idx++)
1285 fname = get_next_str(&str);
1287 fname = strdup(fname);
1293 static int str_filename_cb(void *data, const char *input)
1295 struct thread_data *td = cb_data_to_td(data);
1296 char *fname, *str, *p;
1298 p = str = strdup(input);
1300 strip_blank_front(&str);
1301 strip_blank_end(str);
1304 * Ignore what we may already have from nrfiles option.
1306 if (!td->files_index)
1309 while ((fname = get_next_str(&str)) != NULL) {
1312 add_file(td, fname, 0, 1);
1319 static int str_directory_cb(void *data, const char fio_unused *unused)
1321 struct thread_data *td = cb_data_to_td(data);
1323 char *dirname, *str, *p;
1329 p = str = strdup(td->o.directory);
1330 while ((dirname = get_next_str(&str)) != NULL) {
1331 if (lstat(dirname, &sb) < 0) {
1334 log_err("fio: %s is not a directory\n", dirname);
1335 td_verror(td, ret, "lstat");
1338 if (!S_ISDIR(sb.st_mode)) {
1339 log_err("fio: %s is not a directory\n", dirname);
1350 static int str_opendir_cb(void *data, const char fio_unused *str)
1352 struct thread_data *td = cb_data_to_td(data);
1357 if (!td->files_index)
1360 return add_dir_files(td, td->o.opendir);
1363 static int str_buffer_pattern_cb(void *data, const char *input)
1365 struct thread_data *td = cb_data_to_td(data);
1368 /* FIXME: for now buffer pattern does not support formats */
1369 ret = parse_and_fill_pattern(input, strlen(input), td->o.buffer_pattern,
1370 MAX_PATTERN_SIZE, NULL, NULL, NULL);
1375 td->o.buffer_pattern_bytes = ret;
1378 * If this job is doing any reading or has compression set,
1379 * ensure that we refill buffers for writes or we could be
1380 * invalidating the pattern through reads.
1382 if (!td->o.compress_percentage && !td_read(td))
1383 td->o.refill_buffers = 0;
1385 td->o.refill_buffers = 1;
1387 td->o.scramble_buffers = 0;
1388 td->o.zero_buffers = 0;
1393 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1395 struct thread_data *td = cb_data_to_td(data);
1397 td->flags |= TD_F_COMPRESS;
1398 td->o.compress_percentage = *il;
1402 static int str_dedupe_cb(void *data, unsigned long long *il)
1404 struct thread_data *td = cb_data_to_td(data);
1406 td->flags |= TD_F_COMPRESS;
1407 td->o.dedupe_percentage = *il;
1408 td->o.refill_buffers = 1;
1412 static int str_verify_pattern_cb(void *data, const char *input)
1414 struct thread_data *td = cb_data_to_td(data);
1417 td->o.verify_fmt_sz = FIO_ARRAY_SIZE(td->o.verify_fmt);
1418 ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
1419 MAX_PATTERN_SIZE, fmt_desc,
1420 td->o.verify_fmt, &td->o.verify_fmt_sz);
1425 td->o.verify_pattern_bytes = ret;
1427 * VERIFY_* could already be set
1429 if (!fio_option_is_set(&td->o, verify))
1430 td->o.verify = VERIFY_PATTERN;
1435 static int str_gtod_reduce_cb(void *data, int *il)
1437 struct thread_data *td = cb_data_to_td(data);
1441 * Only modfiy options if gtod_reduce==1
1442 * Otherwise leave settings alone.
1445 td->o.disable_lat = 1;
1446 td->o.disable_clat = 1;
1447 td->o.disable_slat = 1;
1448 td->o.disable_bw = 1;
1449 td->o.clat_percentiles = 0;
1450 td->o.lat_percentiles = 0;
1451 td->o.slat_percentiles = 0;
1452 td->ts_cache_mask = 63;
1458 static int str_offset_cb(void *data, unsigned long long *__val)
1460 struct thread_data *td = cb_data_to_td(data);
1461 unsigned long long v = *__val;
1463 if (parse_is_percent(v)) {
1464 td->o.start_offset = 0;
1465 td->o.start_offset_percent = -1ULL - v;
1466 td->o.start_offset_nz = 0;
1467 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1468 td->o.start_offset_percent);
1469 } else if (parse_is_zone(v)) {
1470 td->o.start_offset = 0;
1471 td->o.start_offset_percent = 0;
1472 td->o.start_offset_nz = v - ZONE_BASE_VAL;
1474 td->o.start_offset = v;
1479 static int str_offset_increment_cb(void *data, unsigned long long *__val)
1481 struct thread_data *td = cb_data_to_td(data);
1482 unsigned long long v = *__val;
1484 if (parse_is_percent(v)) {
1485 td->o.offset_increment = 0;
1486 td->o.offset_increment_percent = -1ULL - v;
1487 td->o.offset_increment_nz = 0;
1488 dprint(FD_PARSE, "SET offset_increment_percent %d\n",
1489 td->o.offset_increment_percent);
1490 } else if (parse_is_zone(v)) {
1491 td->o.offset_increment = 0;
1492 td->o.offset_increment_percent = 0;
1493 td->o.offset_increment_nz = v - ZONE_BASE_VAL;
1495 td->o.offset_increment = v;
1500 static int str_size_cb(void *data, unsigned long long *__val)
1502 struct thread_data *td = cb_data_to_td(data);
1503 unsigned long long v = *__val;
1505 if (parse_is_percent(v)) {
1507 td->o.size_percent = -1ULL - v;
1508 dprint(FD_PARSE, "SET size_percent %d\n",
1509 td->o.size_percent);
1510 } else if (parse_is_zone(v)) {
1512 td->o.size_percent = 0;
1513 td->o.size_nz = v - ZONE_BASE_VAL;
1520 static int str_io_size_cb(void *data, unsigned long long *__val)
1522 struct thread_data *td = cb_data_to_td(data);
1523 unsigned long long v = *__val;
1525 if (parse_is_percent_uncapped(v)) {
1527 td->o.io_size_percent = -1ULL - v;
1528 if (td->o.io_size_percent > 100) {
1529 log_err("fio: io_size values greater than 100%% aren't supported\n");
1532 dprint(FD_PARSE, "SET io_size_percent %d\n",
1533 td->o.io_size_percent);
1534 } else if (parse_is_zone(v)) {
1536 td->o.io_size_percent = 0;
1537 td->o.io_size_nz = v - ZONE_BASE_VAL;
1544 static int str_zoneskip_cb(void *data, unsigned long long *__val)
1546 struct thread_data *td = cb_data_to_td(data);
1547 unsigned long long v = *__val;
1549 if (parse_is_zone(v)) {
1550 td->o.zone_skip = 0;
1551 td->o.zone_skip_nz = v - ZONE_BASE_VAL;
1553 td->o.zone_skip = v;
1558 static int str_write_bw_log_cb(void *data, const char *str)
1560 struct thread_data *td = cb_data_to_td(data);
1563 td->o.bw_log_file = strdup(str);
1565 td->o.write_bw_log = 1;
1569 static int str_write_lat_log_cb(void *data, const char *str)
1571 struct thread_data *td = cb_data_to_td(data);
1574 td->o.lat_log_file = strdup(str);
1576 td->o.write_lat_log = 1;
1580 static int str_write_iops_log_cb(void *data, const char *str)
1582 struct thread_data *td = cb_data_to_td(data);
1585 td->o.iops_log_file = strdup(str);
1587 td->o.write_iops_log = 1;
1591 static int str_write_hist_log_cb(void *data, const char *str)
1593 struct thread_data *td = cb_data_to_td(data);
1596 td->o.hist_log_file = strdup(str);
1598 td->o.write_hist_log = 1;
1603 * str is supposed to be a substring of the strdup'd original string,
1604 * and is valid only if it's a regular file path.
1605 * This function keeps the pointer to the path as needed later.
1607 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1608 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1609 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1611 static int str_ioengine_external_cb(void *data, const char *str)
1613 struct thread_data *td = cb_data_to_td(data);
1618 log_err("fio: null external ioengine path\n");
1622 p = (char *)str; /* str is mutable */
1623 strip_blank_front(&p);
1626 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1627 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1631 td->o.ioengine_so_path = p;
1635 static int rw_verify(const struct fio_option *o, void *data)
1637 struct thread_data *td = cb_data_to_td(data);
1639 if (read_only && (td_write(td) || td_trim(td))) {
1640 log_err("fio: job <%s> has write or trim bit set, but"
1641 " fio is in read-only mode\n", td->o.name);
1648 static int gtod_cpu_verify(const struct fio_option *o, void *data)
1650 #ifndef FIO_HAVE_CPU_AFFINITY
1651 struct thread_data *td = cb_data_to_td(data);
1653 if (td->o.gtod_cpu) {
1654 log_err("fio: platform must support CPU affinity for"
1655 "gettimeofday() offloading\n");
1664 * Map of job/command line options
1666 struct fio_option fio_options[FIO_MAX_OPTS] = {
1668 .name = "description",
1669 .lname = "Description of job",
1670 .type = FIO_OPT_STR_STORE,
1671 .off1 = offsetof(struct thread_options, description),
1672 .help = "Text job description",
1673 .category = FIO_OPT_C_GENERAL,
1674 .group = FIO_OPT_G_DESC,
1678 .lname = "Job name",
1679 .type = FIO_OPT_STR_STORE,
1680 .off1 = offsetof(struct thread_options, name),
1681 .help = "Name of this job",
1682 .category = FIO_OPT_C_GENERAL,
1683 .group = FIO_OPT_G_DESC,
1687 .lname = "Waitee name",
1688 .type = FIO_OPT_STR_STORE,
1689 .off1 = offsetof(struct thread_options, wait_for),
1690 .help = "Name of the job this one wants to wait for before starting",
1691 .category = FIO_OPT_C_GENERAL,
1692 .group = FIO_OPT_G_DESC,
1696 .lname = "Filename(s)",
1697 .type = FIO_OPT_STR_STORE,
1698 .off1 = offsetof(struct thread_options, filename),
1700 .cb = str_filename_cb,
1701 .prio = -1, /* must come after "directory" */
1702 .help = "File(s) to use for the workload",
1703 .category = FIO_OPT_C_FILE,
1704 .group = FIO_OPT_G_FILENAME,
1707 .name = "directory",
1708 .lname = "Directory",
1709 .type = FIO_OPT_STR_STORE,
1710 .off1 = offsetof(struct thread_options, directory),
1711 .cb = str_directory_cb,
1712 .help = "Directory to store files in",
1713 .category = FIO_OPT_C_FILE,
1714 .group = FIO_OPT_G_FILENAME,
1717 .name = "filename_format",
1718 .lname = "Filename Format",
1719 .type = FIO_OPT_STR_STORE,
1720 .off1 = offsetof(struct thread_options, filename_format),
1721 .prio = -1, /* must come after "directory" */
1722 .help = "Override default $jobname.$jobnum.$filenum naming",
1723 .def = "$jobname.$jobnum.$filenum",
1724 .category = FIO_OPT_C_FILE,
1725 .group = FIO_OPT_G_FILENAME,
1728 .name = "unique_filename",
1729 .lname = "Unique Filename",
1730 .type = FIO_OPT_BOOL,
1731 .off1 = offsetof(struct thread_options, unique_filename),
1732 .help = "For network clients, prefix file with source IP",
1734 .category = FIO_OPT_C_FILE,
1735 .group = FIO_OPT_G_FILENAME,
1739 .lname = "Lockfile",
1740 .type = FIO_OPT_STR,
1741 .off1 = offsetof(struct thread_options, file_lock_mode),
1742 .help = "Lock file when doing IO to it",
1744 .parent = "filename",
1747 .category = FIO_OPT_C_FILE,
1748 .group = FIO_OPT_G_FILENAME,
1751 .oval = FILE_LOCK_NONE,
1752 .help = "No file locking",
1754 { .ival = "exclusive",
1755 .oval = FILE_LOCK_EXCLUSIVE,
1756 .help = "Exclusive file lock",
1759 .ival = "readwrite",
1760 .oval = FILE_LOCK_READWRITE,
1761 .help = "Read vs write lock",
1767 .lname = "Open directory",
1768 .type = FIO_OPT_STR_STORE,
1769 .off1 = offsetof(struct thread_options, opendir),
1770 .cb = str_opendir_cb,
1771 .help = "Recursively add files from this directory and down",
1772 .category = FIO_OPT_C_FILE,
1773 .group = FIO_OPT_G_FILENAME,
1777 .lname = "Read/write",
1778 .alias = "readwrite",
1779 .type = FIO_OPT_STR,
1781 .off1 = offsetof(struct thread_options, td_ddir),
1782 .help = "IO direction",
1784 .verify = rw_verify,
1785 .category = FIO_OPT_C_IO,
1786 .group = FIO_OPT_G_IO_BASIC,
1789 .oval = TD_DDIR_READ,
1790 .help = "Sequential read",
1793 .oval = TD_DDIR_WRITE,
1794 .help = "Sequential write",
1797 .oval = TD_DDIR_TRIM,
1798 .help = "Sequential trim",
1800 { .ival = "randread",
1801 .oval = TD_DDIR_RANDREAD,
1802 .help = "Random read",
1804 { .ival = "randwrite",
1805 .oval = TD_DDIR_RANDWRITE,
1806 .help = "Random write",
1808 { .ival = "randtrim",
1809 .oval = TD_DDIR_RANDTRIM,
1810 .help = "Random trim",
1814 .help = "Sequential read and write mix",
1816 { .ival = "readwrite",
1818 .help = "Sequential read and write mix",
1821 .oval = TD_DDIR_RANDRW,
1822 .help = "Random read and write mix"
1824 { .ival = "trimwrite",
1825 .oval = TD_DDIR_TRIMWRITE,
1826 .help = "Trim and write mix, trims preceding writes"
1831 .name = "rw_sequencer",
1832 .lname = "RW Sequencer",
1833 .type = FIO_OPT_STR,
1834 .off1 = offsetof(struct thread_options, rw_seq),
1835 .help = "IO offset generator modifier",
1836 .def = "sequential",
1837 .category = FIO_OPT_C_IO,
1838 .group = FIO_OPT_G_IO_BASIC,
1840 { .ival = "sequential",
1842 .help = "Generate sequential offsets",
1844 { .ival = "identical",
1845 .oval = RW_SEQ_IDENT,
1846 .help = "Generate identical offsets",
1853 .lname = "IO Engine",
1854 .type = FIO_OPT_STR_STORE,
1855 .off1 = offsetof(struct thread_options, ioengine),
1856 .help = "IO engine to use",
1857 .def = FIO_PREFERRED_ENGINE,
1858 .category = FIO_OPT_C_IO,
1859 .group = FIO_OPT_G_IO_BASIC,
1862 .help = "Use read/write",
1865 .help = "Use pread/pwrite",
1868 .help = "Use readv/writev",
1870 #ifdef CONFIG_PWRITEV
1872 .help = "Use preadv/pwritev",
1875 #ifdef FIO_HAVE_PWRITEV2
1876 { .ival = "pvsync2",
1877 .help = "Use preadv2/pwritev2",
1880 #ifdef CONFIG_LIBAIO
1882 .help = "Linux native asynchronous IO",
1885 #ifdef ARCH_HAVE_IOURING
1886 { .ival = "io_uring",
1887 .help = "Fast Linux native aio",
1890 #ifdef CONFIG_POSIXAIO
1891 { .ival = "posixaio",
1892 .help = "POSIX asynchronous IO",
1895 #ifdef CONFIG_SOLARISAIO
1896 { .ival = "solarisaio",
1897 .help = "Solaris native asynchronous IO",
1900 #ifdef CONFIG_WINDOWSAIO
1901 { .ival = "windowsaio",
1902 .help = "Windows native asynchronous IO"
1907 .help = "Rados Block Device asynchronous IO"
1911 .help = "Memory mapped IO"
1913 #ifdef CONFIG_LINUX_SPLICE
1915 .help = "splice/vmsplice based IO",
1917 { .ival = "netsplice",
1918 .help = "splice/vmsplice to/from the network",
1921 #ifdef FIO_HAVE_SGIO
1923 .help = "SCSI generic v3 IO",
1927 .help = "Testing engine (no data transfer)",
1930 .help = "Network IO",
1933 .help = "CPU cycle burner engine",
1937 .help = "RDMA IO engine",
1940 #ifdef CONFIG_LIBRPMA_APM
1941 { .ival = "librpma_apm",
1942 .help = "librpma IO engine in APM mode",
1945 #ifdef CONFIG_LIBRPMA_GPSPM
1946 { .ival = "librpma_gpspm",
1947 .help = "librpma IO engine in GPSPM mode",
1950 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1951 { .ival = "e4defrag",
1952 .help = "ext4 defrag engine",
1955 #ifdef CONFIG_LINUX_FALLOCATE
1957 .help = "fallocate() file based engine",
1962 .help = "Glusterfs libgfapi(sync) based engine"
1964 { .ival = "gfapi_async",
1965 .help = "Glusterfs libgfapi(async) based engine"
1968 #ifdef CONFIG_LIBHDFS
1969 { .ival = "libhdfs",
1970 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1973 #ifdef CONFIG_PMEMBLK
1974 { .ival = "pmemblk",
1975 .help = "PMDK libpmemblk based IO engine",
1980 { .ival = "ime_psync",
1981 .help = "DDN's IME synchronous IO engine",
1983 { .ival = "ime_psyncv",
1984 .help = "DDN's IME synchronous IO engine using iovecs",
1986 { .ival = "ime_aio",
1987 .help = "DDN's IME asynchronous IO engine",
1990 #ifdef CONFIG_LINUX_DEVDAX
1991 { .ival = "dev-dax",
1992 .help = "DAX Device based IO engine",
1996 .ival = "filecreate",
1997 .help = "File creation engine",
1999 { .ival = "external",
2000 .help = "Load external engine (append name)",
2001 .cb = str_ioengine_external_cb,
2003 #ifdef CONFIG_LIBPMEM
2004 { .ival = "libpmem",
2005 .help = "PMDK libpmem based IO engine",
2010 .help = "HTTP (WebDAV/S3) IO engine",
2014 .help = "Network Block Device (NBD) IO engine"
2018 .help = "DAOS File System (dfs) IO engine",
2023 .help = "NFS IO engine",
2030 .lname = "IO Depth",
2031 .type = FIO_OPT_INT,
2032 .off1 = offsetof(struct thread_options, iodepth),
2033 .help = "Number of IO buffers to keep in flight",
2037 .category = FIO_OPT_C_IO,
2038 .group = FIO_OPT_G_IO_BASIC,
2041 .name = "iodepth_batch",
2042 .lname = "IO Depth batch",
2043 .alias = "iodepth_batch_submit",
2044 .type = FIO_OPT_INT,
2045 .off1 = offsetof(struct thread_options, iodepth_batch),
2046 .help = "Number of IO buffers to submit in one go",
2047 .parent = "iodepth",
2051 .category = FIO_OPT_C_IO,
2052 .group = FIO_OPT_G_IO_BASIC,
2055 .name = "iodepth_batch_complete_min",
2056 .lname = "Min IO depth batch complete",
2057 .alias = "iodepth_batch_complete",
2058 .type = FIO_OPT_INT,
2059 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
2060 .help = "Min number of IO buffers to retrieve in one go",
2061 .parent = "iodepth",
2066 .category = FIO_OPT_C_IO,
2067 .group = FIO_OPT_G_IO_BASIC,
2070 .name = "iodepth_batch_complete_max",
2071 .lname = "Max IO depth batch complete",
2072 .type = FIO_OPT_INT,
2073 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
2074 .help = "Max number of IO buffers to retrieve in one go",
2075 .parent = "iodepth",
2079 .category = FIO_OPT_C_IO,
2080 .group = FIO_OPT_G_IO_BASIC,
2083 .name = "iodepth_low",
2084 .lname = "IO Depth batch low",
2085 .type = FIO_OPT_INT,
2086 .off1 = offsetof(struct thread_options, iodepth_low),
2087 .help = "Low water mark for queuing depth",
2088 .parent = "iodepth",
2091 .category = FIO_OPT_C_IO,
2092 .group = FIO_OPT_G_IO_BASIC,
2095 .name = "serialize_overlap",
2096 .lname = "Serialize overlap",
2097 .off1 = offsetof(struct thread_options, serialize_overlap),
2098 .type = FIO_OPT_BOOL,
2099 .help = "Wait for in-flight IOs that collide to complete",
2100 .parent = "iodepth",
2102 .category = FIO_OPT_C_IO,
2103 .group = FIO_OPT_G_IO_BASIC,
2106 .name = "io_submit_mode",
2107 .lname = "IO submit mode",
2108 .type = FIO_OPT_STR,
2109 .off1 = offsetof(struct thread_options, io_submit_mode),
2110 .help = "How IO submissions and completions are done",
2112 .category = FIO_OPT_C_IO,
2113 .group = FIO_OPT_G_IO_BASIC,
2116 .oval = IO_MODE_INLINE,
2117 .help = "Submit and complete IO inline",
2119 { .ival = "offload",
2120 .oval = IO_MODE_OFFLOAD,
2121 .help = "Offload submit and complete to threads",
2128 .type = FIO_OPT_STR_VAL_ZONE,
2130 .off1 = offsetof(struct thread_options, size),
2131 .help = "Total size of device or files",
2132 .category = FIO_OPT_C_IO,
2133 .group = FIO_OPT_G_INVALID,
2137 .alias = "io_limit",
2139 .type = FIO_OPT_STR_VAL_ZONE,
2140 .cb = str_io_size_cb,
2141 .off1 = offsetof(struct thread_options, io_size),
2142 .help = "Total size of I/O to be performed",
2143 .category = FIO_OPT_C_IO,
2144 .group = FIO_OPT_G_INVALID,
2147 .name = "fill_device",
2148 .lname = "Fill device",
2150 .type = FIO_OPT_BOOL,
2151 .off1 = offsetof(struct thread_options, fill_device),
2152 .help = "Write until an ENOSPC error occurs",
2154 .category = FIO_OPT_C_FILE,
2155 .group = FIO_OPT_G_INVALID,
2159 .lname = "File size",
2160 .type = FIO_OPT_STR_VAL,
2161 .off1 = offsetof(struct thread_options, file_size_low),
2162 .off2 = offsetof(struct thread_options, file_size_high),
2164 .help = "Size of individual files",
2165 .interval = 1024 * 1024,
2166 .category = FIO_OPT_C_FILE,
2167 .group = FIO_OPT_G_INVALID,
2170 .name = "file_append",
2171 .lname = "File append",
2172 .type = FIO_OPT_BOOL,
2173 .off1 = offsetof(struct thread_options, file_append),
2174 .help = "IO will start at the end of the file(s)",
2176 .category = FIO_OPT_C_FILE,
2177 .group = FIO_OPT_G_INVALID,
2181 .lname = "IO offset",
2182 .alias = "fileoffset",
2183 .type = FIO_OPT_STR_VAL_ZONE,
2184 .cb = str_offset_cb,
2185 .off1 = offsetof(struct thread_options, start_offset),
2186 .help = "Start IO from this offset",
2188 .category = FIO_OPT_C_IO,
2189 .group = FIO_OPT_G_INVALID,
2192 .name = "offset_align",
2193 .lname = "IO offset alignment",
2194 .type = FIO_OPT_INT,
2195 .off1 = offsetof(struct thread_options, start_offset_align),
2196 .help = "Start IO from this offset alignment",
2199 .category = FIO_OPT_C_IO,
2200 .group = FIO_OPT_G_INVALID,
2203 .name = "offset_increment",
2204 .lname = "IO offset increment",
2205 .type = FIO_OPT_STR_VAL_ZONE,
2206 .cb = str_offset_increment_cb,
2207 .off1 = offsetof(struct thread_options, offset_increment),
2208 .help = "What is the increment from one offset to the next",
2212 .category = FIO_OPT_C_IO,
2213 .group = FIO_OPT_G_INVALID,
2216 .name = "number_ios",
2217 .lname = "Number of IOs to perform",
2218 .type = FIO_OPT_STR_VAL,
2219 .off1 = offsetof(struct thread_options, number_ios),
2220 .help = "Force job completion after this number of IOs",
2222 .category = FIO_OPT_C_IO,
2223 .group = FIO_OPT_G_INVALID,
2227 .lname = "Block size",
2228 .alias = "blocksize",
2229 .type = FIO_OPT_ULL,
2230 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2231 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2232 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
2234 .help = "Block size unit",
2239 .category = FIO_OPT_C_IO,
2240 .group = FIO_OPT_G_INVALID,
2244 .lname = "Block size align",
2245 .alias = "blockalign",
2246 .type = FIO_OPT_ULL,
2247 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2248 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2249 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2251 .help = "IO block offset alignment",
2255 .category = FIO_OPT_C_IO,
2256 .group = FIO_OPT_G_INVALID,
2260 .lname = "Block size range",
2261 .alias = "blocksize_range",
2262 .type = FIO_OPT_RANGE,
2263 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2264 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2265 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2266 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2267 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2268 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
2270 .help = "Set block size range (in more detail than bs)",
2274 .category = FIO_OPT_C_IO,
2275 .group = FIO_OPT_G_INVALID,
2279 .lname = "Block size split",
2280 .type = FIO_OPT_STR_ULL,
2281 .cb = str_bssplit_cb,
2282 .off1 = offsetof(struct thread_options, bssplit),
2283 .help = "Set a specific mix of block sizes",
2286 .category = FIO_OPT_C_IO,
2287 .group = FIO_OPT_G_INVALID,
2290 .name = "bs_unaligned",
2291 .lname = "Block size unaligned",
2292 .alias = "blocksize_unaligned",
2293 .type = FIO_OPT_STR_SET,
2294 .off1 = offsetof(struct thread_options, bs_unaligned),
2295 .help = "Don't sector align IO buffer sizes",
2298 .category = FIO_OPT_C_IO,
2299 .group = FIO_OPT_G_INVALID,
2302 .name = "bs_is_seq_rand",
2303 .lname = "Block size division is seq/random (not read/write)",
2304 .type = FIO_OPT_BOOL,
2305 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
2306 .help = "Consider any blocksize setting to be sequential,random",
2308 .parent = "blocksize",
2309 .category = FIO_OPT_C_IO,
2310 .group = FIO_OPT_G_INVALID,
2313 .name = "randrepeat",
2314 .lname = "Random repeatable",
2315 .type = FIO_OPT_BOOL,
2316 .off1 = offsetof(struct thread_options, rand_repeatable),
2317 .help = "Use repeatable random IO pattern",
2321 .category = FIO_OPT_C_IO,
2322 .group = FIO_OPT_G_RANDOM,
2326 .lname = "The random generator seed",
2327 .type = FIO_OPT_STR_VAL,
2328 .off1 = offsetof(struct thread_options, rand_seed),
2329 .help = "Set the random generator seed value",
2332 .category = FIO_OPT_C_IO,
2333 .group = FIO_OPT_G_RANDOM,
2336 .name = "norandommap",
2337 .lname = "No randommap",
2338 .type = FIO_OPT_STR_SET,
2339 .off1 = offsetof(struct thread_options, norandommap),
2340 .help = "Accept potential duplicate random blocks",
2344 .category = FIO_OPT_C_IO,
2345 .group = FIO_OPT_G_RANDOM,
2348 .name = "softrandommap",
2349 .lname = "Soft randommap",
2350 .type = FIO_OPT_BOOL,
2351 .off1 = offsetof(struct thread_options, softrandommap),
2352 .help = "Set norandommap if randommap allocation fails",
2353 .parent = "norandommap",
2356 .category = FIO_OPT_C_IO,
2357 .group = FIO_OPT_G_RANDOM,
2360 .name = "random_generator",
2361 .lname = "Random Generator",
2362 .type = FIO_OPT_STR,
2363 .off1 = offsetof(struct thread_options, random_generator),
2364 .help = "Type of random number generator to use",
2365 .def = "tausworthe",
2367 { .ival = "tausworthe",
2368 .oval = FIO_RAND_GEN_TAUSWORTHE,
2369 .help = "Strong Tausworthe generator",
2372 .oval = FIO_RAND_GEN_LFSR,
2373 .help = "Variable length LFSR",
2376 .ival = "tausworthe64",
2377 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2378 .help = "64-bit Tausworthe variant",
2381 .category = FIO_OPT_C_IO,
2382 .group = FIO_OPT_G_RANDOM,
2385 .name = "random_distribution",
2386 .lname = "Random Distribution",
2387 .type = FIO_OPT_STR,
2388 .off1 = offsetof(struct thread_options, random_distribution),
2389 .cb = str_random_distribution_cb,
2390 .help = "Random offset distribution generator",
2394 .oval = FIO_RAND_DIST_RANDOM,
2395 .help = "Completely random",
2398 .oval = FIO_RAND_DIST_ZIPF,
2399 .help = "Zipf distribution",
2402 .oval = FIO_RAND_DIST_PARETO,
2403 .help = "Pareto distribution",
2406 .oval = FIO_RAND_DIST_GAUSS,
2407 .help = "Normal (Gaussian) distribution",
2410 .oval = FIO_RAND_DIST_ZONED,
2411 .help = "Zoned random distribution",
2413 { .ival = "zoned_abs",
2414 .oval = FIO_RAND_DIST_ZONED_ABS,
2415 .help = "Zoned absolute random distribution",
2418 .category = FIO_OPT_C_IO,
2419 .group = FIO_OPT_G_RANDOM,
2422 .name = "percentage_random",
2423 .lname = "Percentage Random",
2424 .type = FIO_OPT_INT,
2425 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2426 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2427 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
2429 .help = "Percentage of seq/random mix that should be random",
2430 .def = "100,100,100",
2432 .inverse = "percentage_sequential",
2433 .category = FIO_OPT_C_IO,
2434 .group = FIO_OPT_G_RANDOM,
2437 .name = "percentage_sequential",
2438 .lname = "Percentage Sequential",
2439 .type = FIO_OPT_DEPRECATED,
2440 .category = FIO_OPT_C_IO,
2441 .group = FIO_OPT_G_RANDOM,
2444 .name = "allrandrepeat",
2445 .lname = "All Random Repeat",
2446 .type = FIO_OPT_BOOL,
2447 .off1 = offsetof(struct thread_options, allrand_repeatable),
2448 .help = "Use repeatable random numbers for everything",
2450 .category = FIO_OPT_C_IO,
2451 .group = FIO_OPT_G_RANDOM,
2455 .lname = "Number of files",
2456 .alias = "nr_files",
2457 .type = FIO_OPT_INT,
2458 .off1 = offsetof(struct thread_options, nr_files),
2459 .help = "Split job workload between this number of files",
2462 .category = FIO_OPT_C_FILE,
2463 .group = FIO_OPT_G_INVALID,
2466 .name = "openfiles",
2467 .lname = "Number of open files",
2468 .type = FIO_OPT_INT,
2469 .off1 = offsetof(struct thread_options, open_files),
2470 .help = "Number of files to keep open at the same time",
2471 .category = FIO_OPT_C_FILE,
2472 .group = FIO_OPT_G_INVALID,
2475 .name = "file_service_type",
2476 .lname = "File service type",
2477 .type = FIO_OPT_STR,
2479 .off1 = offsetof(struct thread_options, file_service_type),
2480 .help = "How to select which file to service next",
2481 .def = "roundrobin",
2482 .category = FIO_OPT_C_FILE,
2483 .group = FIO_OPT_G_INVALID,
2486 .oval = FIO_FSERVICE_RANDOM,
2487 .help = "Choose a file at random (uniform)",
2490 .oval = FIO_FSERVICE_ZIPF,
2491 .help = "Zipf randomized",
2494 .oval = FIO_FSERVICE_PARETO,
2495 .help = "Pareto randomized",
2498 .oval = FIO_FSERVICE_GAUSS,
2499 .help = "Normal (Gaussian) randomized",
2502 .oval = FIO_FSERVICE_GAUSS,
2503 .help = "Alias for normal",
2505 { .ival = "roundrobin",
2506 .oval = FIO_FSERVICE_RR,
2507 .help = "Round robin select files",
2509 { .ival = "sequential",
2510 .oval = FIO_FSERVICE_SEQ,
2511 .help = "Finish one file before moving to the next",
2514 .parent = "nrfiles",
2518 .name = "fallocate",
2519 .lname = "Fallocate",
2520 .type = FIO_OPT_STR,
2521 .off1 = offsetof(struct thread_options, fallocate_mode),
2522 .help = "Whether pre-allocation is performed when laying out files",
2523 #ifdef FIO_HAVE_DEFAULT_FALLOCATE
2528 .category = FIO_OPT_C_FILE,
2529 .group = FIO_OPT_G_INVALID,
2532 .oval = FIO_FALLOCATE_NONE,
2533 .help = "Do not pre-allocate space",
2536 .oval = FIO_FALLOCATE_NATIVE,
2537 .help = "Use native pre-allocation if possible",
2539 #ifdef CONFIG_POSIX_FALLOCATE
2541 .oval = FIO_FALLOCATE_POSIX,
2542 .help = "Use posix_fallocate()",
2545 #ifdef CONFIG_LINUX_FALLOCATE
2547 .oval = FIO_FALLOCATE_KEEP_SIZE,
2548 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2551 { .ival = "truncate",
2552 .oval = FIO_FALLOCATE_TRUNCATE,
2553 .help = "Truncate file to final size instead of allocating"
2555 /* Compatibility with former boolean values */
2557 .oval = FIO_FALLOCATE_NONE,
2558 .help = "Alias for 'none'",
2560 #ifdef CONFIG_POSIX_FALLOCATE
2562 .oval = FIO_FALLOCATE_POSIX,
2563 .help = "Alias for 'posix'",
2569 .name = "fadvise_hint",
2570 .lname = "Fadvise hint",
2571 .type = FIO_OPT_STR,
2572 .off1 = offsetof(struct thread_options, fadvise_hint),
2576 .help = "Don't issue fadvise/madvise",
2580 .help = "Advise using fio IO pattern",
2583 .oval = F_ADV_RANDOM,
2584 .help = "Advise using FADV_RANDOM",
2586 { .ival = "sequential",
2587 .oval = F_ADV_SEQUENTIAL,
2588 .help = "Advise using FADV_SEQUENTIAL",
2591 .help = "Use fadvise() to advise the kernel on IO pattern",
2593 .category = FIO_OPT_C_FILE,
2594 .group = FIO_OPT_G_INVALID,
2599 .type = FIO_OPT_INT,
2600 .off1 = offsetof(struct thread_options, fsync_blocks),
2601 .help = "Issue fsync for writes every given number of blocks",
2604 .category = FIO_OPT_C_FILE,
2605 .group = FIO_OPT_G_INVALID,
2608 .name = "fdatasync",
2609 .lname = "Fdatasync",
2610 .type = FIO_OPT_INT,
2611 .off1 = offsetof(struct thread_options, fdatasync_blocks),
2612 .help = "Issue fdatasync for writes every given number of blocks",
2615 .category = FIO_OPT_C_FILE,
2616 .group = FIO_OPT_G_INVALID,
2619 .name = "write_barrier",
2620 .lname = "Write barrier",
2621 .type = FIO_OPT_INT,
2622 .off1 = offsetof(struct thread_options, barrier_blocks),
2623 .help = "Make every Nth write a barrier write",
2626 .category = FIO_OPT_C_IO,
2627 .group = FIO_OPT_G_INVALID,
2629 #ifdef CONFIG_SYNC_FILE_RANGE
2631 .name = "sync_file_range",
2632 .lname = "Sync file range",
2634 { .ival = "wait_before",
2635 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2636 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2640 .oval = SYNC_FILE_RANGE_WRITE,
2641 .help = "SYNC_FILE_RANGE_WRITE",
2645 .ival = "wait_after",
2646 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2647 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2651 .type = FIO_OPT_STR_MULTI,
2653 .off1 = offsetof(struct thread_options, sync_file_range),
2654 .help = "Use sync_file_range()",
2655 .category = FIO_OPT_C_FILE,
2656 .group = FIO_OPT_G_INVALID,
2660 .name = "sync_file_range",
2661 .lname = "Sync file range",
2662 .type = FIO_OPT_UNSUPPORTED,
2663 .help = "Your platform does not support sync_file_range",
2668 .lname = "Direct I/O",
2669 .type = FIO_OPT_BOOL,
2670 .off1 = offsetof(struct thread_options, odirect),
2671 .help = "Use O_DIRECT IO (negates buffered)",
2673 .inverse = "buffered",
2674 .category = FIO_OPT_C_IO,
2675 .group = FIO_OPT_G_IO_TYPE,
2679 .lname = "Atomic I/O",
2680 .type = FIO_OPT_BOOL,
2681 .off1 = offsetof(struct thread_options, oatomic),
2682 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2684 .category = FIO_OPT_C_IO,
2685 .group = FIO_OPT_G_IO_TYPE,
2689 .lname = "Buffered I/O",
2690 .type = FIO_OPT_BOOL,
2691 .off1 = offsetof(struct thread_options, odirect),
2693 .help = "Use buffered IO (negates direct)",
2695 .inverse = "direct",
2696 .category = FIO_OPT_C_IO,
2697 .group = FIO_OPT_G_IO_TYPE,
2700 .name = "overwrite",
2701 .lname = "Overwrite",
2702 .type = FIO_OPT_BOOL,
2703 .off1 = offsetof(struct thread_options, overwrite),
2704 .help = "When writing, set whether to overwrite current data",
2706 .category = FIO_OPT_C_FILE,
2707 .group = FIO_OPT_G_INVALID,
2712 .type = FIO_OPT_INT,
2713 .off1 = offsetof(struct thread_options, loops),
2714 .help = "Number of times to run the job",
2717 .category = FIO_OPT_C_GENERAL,
2718 .group = FIO_OPT_G_RUNTIME,
2722 .lname = "Number of jobs",
2723 .type = FIO_OPT_INT,
2724 .off1 = offsetof(struct thread_options, numjobs),
2725 .help = "Duplicate this job this many times",
2728 .category = FIO_OPT_C_GENERAL,
2729 .group = FIO_OPT_G_RUNTIME,
2732 .name = "startdelay",
2733 .lname = "Start delay",
2734 .type = FIO_OPT_STR_VAL_TIME,
2735 .off1 = offsetof(struct thread_options, start_delay),
2736 .off2 = offsetof(struct thread_options, start_delay_high),
2737 .help = "Only start job when this period has passed",
2741 .category = FIO_OPT_C_GENERAL,
2742 .group = FIO_OPT_G_RUNTIME,
2748 .type = FIO_OPT_STR_VAL_TIME,
2749 .off1 = offsetof(struct thread_options, timeout),
2750 .help = "Stop workload when this amount of time has passed",
2754 .category = FIO_OPT_C_GENERAL,
2755 .group = FIO_OPT_G_RUNTIME,
2758 .name = "time_based",
2759 .lname = "Time based",
2760 .type = FIO_OPT_STR_SET,
2761 .off1 = offsetof(struct thread_options, time_based),
2762 .help = "Keep running until runtime/timeout is met",
2763 .category = FIO_OPT_C_GENERAL,
2764 .group = FIO_OPT_G_RUNTIME,
2767 .name = "verify_only",
2768 .lname = "Verify only",
2769 .type = FIO_OPT_STR_SET,
2770 .off1 = offsetof(struct thread_options, verify_only),
2771 .help = "Verifies previously written data is still valid",
2772 .category = FIO_OPT_C_GENERAL,
2773 .group = FIO_OPT_G_RUNTIME,
2776 .name = "ramp_time",
2777 .lname = "Ramp time",
2778 .type = FIO_OPT_STR_VAL_TIME,
2779 .off1 = offsetof(struct thread_options, ramp_time),
2780 .help = "Ramp up time before measuring performance",
2783 .category = FIO_OPT_C_GENERAL,
2784 .group = FIO_OPT_G_RUNTIME,
2787 .name = "clocksource",
2788 .lname = "Clock source",
2789 .type = FIO_OPT_STR,
2790 .cb = fio_clock_source_cb,
2791 .off1 = offsetof(struct thread_options, clocksource),
2792 .help = "What type of timing source to use",
2793 .category = FIO_OPT_C_GENERAL,
2794 .group = FIO_OPT_G_CLOCK,
2796 #ifdef CONFIG_GETTIMEOFDAY
2797 { .ival = "gettimeofday",
2799 .help = "Use gettimeofday(2) for timing",
2802 #ifdef CONFIG_CLOCK_GETTIME
2803 { .ival = "clock_gettime",
2804 .oval = CS_CGETTIME,
2805 .help = "Use clock_gettime(2) for timing",
2808 #ifdef ARCH_HAVE_CPU_CLOCK
2810 .oval = CS_CPUCLOCK,
2811 .help = "Use CPU private clock",
2819 .lname = "I/O Memory",
2820 .type = FIO_OPT_STR,
2822 .off1 = offsetof(struct thread_options, mem_type),
2823 .help = "Backing type for IO buffers",
2825 .category = FIO_OPT_C_IO,
2826 .group = FIO_OPT_G_INVALID,
2830 .help = "Use malloc(3) for IO buffers",
2832 #ifndef CONFIG_NO_SHM
2835 .help = "Use shared memory segments for IO buffers",
2837 #ifdef FIO_HAVE_HUGETLB
2838 { .ival = "shmhuge",
2839 .oval = MEM_SHMHUGE,
2840 .help = "Like shm, but use huge pages",
2846 .help = "Use mmap(2) (file or anon) for IO buffers",
2848 { .ival = "mmapshared",
2849 .oval = MEM_MMAPSHARED,
2850 .help = "Like mmap, but use the shared flag",
2852 #ifdef FIO_HAVE_HUGETLB
2853 { .ival = "mmaphuge",
2854 .oval = MEM_MMAPHUGE,
2855 .help = "Like mmap, but use huge pages",
2859 { .ival = "cudamalloc",
2860 .oval = MEM_CUDA_MALLOC,
2861 .help = "Allocate GPU device memory for GPUDirect RDMA",
2867 .name = "iomem_align",
2868 .alias = "mem_align",
2869 .lname = "I/O memory alignment",
2870 .type = FIO_OPT_INT,
2871 .off1 = offsetof(struct thread_options, mem_align),
2873 .help = "IO memory buffer offset alignment",
2877 .category = FIO_OPT_C_IO,
2878 .group = FIO_OPT_G_INVALID,
2883 .type = FIO_OPT_STR,
2884 .off1 = offsetof(struct thread_options, verify),
2885 .help = "Verify data written",
2887 .category = FIO_OPT_C_IO,
2888 .group = FIO_OPT_G_VERIFY,
2891 .oval = VERIFY_NONE,
2892 .help = "Don't do IO verification",
2896 .help = "Use md5 checksums for verification",
2899 .oval = VERIFY_CRC64,
2900 .help = "Use crc64 checksums for verification",
2903 .oval = VERIFY_CRC32,
2904 .help = "Use crc32 checksums for verification",
2906 { .ival = "crc32c-intel",
2907 .oval = VERIFY_CRC32C,
2908 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2911 .oval = VERIFY_CRC32C,
2912 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2915 .oval = VERIFY_CRC16,
2916 .help = "Use crc16 checksums for verification",
2919 .oval = VERIFY_CRC7,
2920 .help = "Use crc7 checksums for verification",
2923 .oval = VERIFY_SHA1,
2924 .help = "Use sha1 checksums for verification",
2927 .oval = VERIFY_SHA256,
2928 .help = "Use sha256 checksums for verification",
2931 .oval = VERIFY_SHA512,
2932 .help = "Use sha512 checksums for verification",
2934 { .ival = "sha3-224",
2935 .oval = VERIFY_SHA3_224,
2936 .help = "Use sha3-224 checksums for verification",
2938 { .ival = "sha3-256",
2939 .oval = VERIFY_SHA3_256,
2940 .help = "Use sha3-256 checksums for verification",
2942 { .ival = "sha3-384",
2943 .oval = VERIFY_SHA3_384,
2944 .help = "Use sha3-384 checksums for verification",
2946 { .ival = "sha3-512",
2947 .oval = VERIFY_SHA3_512,
2948 .help = "Use sha3-512 checksums for verification",
2951 .oval = VERIFY_XXHASH,
2952 .help = "Use xxhash checksums for verification",
2954 /* Meta information was included into verify_header,
2955 * 'meta' verification is implied by default. */
2957 .oval = VERIFY_HDR_ONLY,
2958 .help = "Use io information for verification. "
2959 "Now is implied by default, thus option is obsolete, "
2962 { .ival = "pattern",
2963 .oval = VERIFY_PATTERN_NO_HDR,
2964 .help = "Verify strict pattern",
2968 .oval = VERIFY_NULL,
2969 .help = "Pretend to verify",
2974 .name = "do_verify",
2975 .lname = "Perform verify step",
2976 .type = FIO_OPT_BOOL,
2977 .off1 = offsetof(struct thread_options, do_verify),
2978 .help = "Run verification stage after write",
2982 .category = FIO_OPT_C_IO,
2983 .group = FIO_OPT_G_VERIFY,
2986 .name = "verifysort",
2987 .lname = "Verify sort",
2988 .type = FIO_OPT_SOFT_DEPRECATED,
2989 .category = FIO_OPT_C_IO,
2990 .group = FIO_OPT_G_VERIFY,
2993 .name = "verifysort_nr",
2994 .lname = "Verify Sort Nr",
2995 .type = FIO_OPT_SOFT_DEPRECATED,
2996 .category = FIO_OPT_C_IO,
2997 .group = FIO_OPT_G_VERIFY,
3000 .name = "verify_interval",
3001 .lname = "Verify interval",
3002 .type = FIO_OPT_INT,
3003 .off1 = offsetof(struct thread_options, verify_interval),
3004 .minval = 2 * sizeof(struct verify_header),
3005 .help = "Store verify buffer header every N bytes",
3008 .interval = 2 * sizeof(struct verify_header),
3009 .category = FIO_OPT_C_IO,
3010 .group = FIO_OPT_G_VERIFY,
3013 .name = "verify_offset",
3014 .lname = "Verify offset",
3015 .type = FIO_OPT_INT,
3016 .help = "Offset verify header location by N bytes",
3017 .off1 = offsetof(struct thread_options, verify_offset),
3018 .minval = sizeof(struct verify_header),
3021 .category = FIO_OPT_C_IO,
3022 .group = FIO_OPT_G_VERIFY,
3025 .name = "verify_pattern",
3026 .lname = "Verify pattern",
3027 .type = FIO_OPT_STR,
3028 .cb = str_verify_pattern_cb,
3029 .off1 = offsetof(struct thread_options, verify_pattern),
3030 .help = "Fill pattern for IO buffers",
3033 .category = FIO_OPT_C_IO,
3034 .group = FIO_OPT_G_VERIFY,
3037 .name = "verify_fatal",
3038 .lname = "Verify fatal",
3039 .type = FIO_OPT_BOOL,
3040 .off1 = offsetof(struct thread_options, verify_fatal),
3042 .help = "Exit on a single verify failure, don't continue",
3045 .category = FIO_OPT_C_IO,
3046 .group = FIO_OPT_G_VERIFY,
3049 .name = "verify_dump",
3050 .lname = "Verify dump",
3051 .type = FIO_OPT_BOOL,
3052 .off1 = offsetof(struct thread_options, verify_dump),
3054 .help = "Dump contents of good and bad blocks on failure",
3057 .category = FIO_OPT_C_IO,
3058 .group = FIO_OPT_G_VERIFY,
3061 .name = "verify_async",
3062 .lname = "Verify asynchronously",
3063 .type = FIO_OPT_INT,
3064 .off1 = offsetof(struct thread_options, verify_async),
3066 .help = "Number of async verifier threads to use",
3069 .category = FIO_OPT_C_IO,
3070 .group = FIO_OPT_G_VERIFY,
3073 .name = "verify_backlog",
3074 .lname = "Verify backlog",
3075 .type = FIO_OPT_STR_VAL,
3076 .off1 = offsetof(struct thread_options, verify_backlog),
3077 .help = "Verify after this number of blocks are written",
3080 .category = FIO_OPT_C_IO,
3081 .group = FIO_OPT_G_VERIFY,
3084 .name = "verify_backlog_batch",
3085 .lname = "Verify backlog batch",
3086 .type = FIO_OPT_INT,
3087 .off1 = offsetof(struct thread_options, verify_batch),
3088 .help = "Verify this number of IO blocks",
3091 .category = FIO_OPT_C_IO,
3092 .group = FIO_OPT_G_VERIFY,
3094 #ifdef FIO_HAVE_CPU_AFFINITY
3096 .name = "verify_async_cpus",
3097 .lname = "Async verify CPUs",
3098 .type = FIO_OPT_STR,
3099 .cb = str_verify_cpus_allowed_cb,
3100 .off1 = offsetof(struct thread_options, verify_cpumask),
3101 .help = "Set CPUs allowed for async verify threads",
3102 .parent = "verify_async",
3104 .category = FIO_OPT_C_IO,
3105 .group = FIO_OPT_G_VERIFY,
3109 .name = "verify_async_cpus",
3110 .lname = "Async verify CPUs",
3111 .type = FIO_OPT_UNSUPPORTED,
3112 .help = "Your platform does not support CPU affinities",
3116 .name = "experimental_verify",
3117 .lname = "Experimental Verify",
3118 .off1 = offsetof(struct thread_options, experimental_verify),
3119 .type = FIO_OPT_BOOL,
3120 .help = "Enable experimental verification",
3122 .category = FIO_OPT_C_IO,
3123 .group = FIO_OPT_G_VERIFY,
3126 .name = "verify_state_load",
3127 .lname = "Load verify state",
3128 .off1 = offsetof(struct thread_options, verify_state),
3129 .type = FIO_OPT_BOOL,
3130 .help = "Load verify termination state",
3132 .category = FIO_OPT_C_IO,
3133 .group = FIO_OPT_G_VERIFY,
3136 .name = "verify_state_save",
3137 .lname = "Save verify state",
3138 .off1 = offsetof(struct thread_options, verify_state_save),
3139 .type = FIO_OPT_BOOL,
3141 .help = "Save verify state on termination",
3143 .category = FIO_OPT_C_IO,
3144 .group = FIO_OPT_G_VERIFY,
3146 #ifdef FIO_HAVE_TRIM
3148 .name = "trim_percentage",
3149 .lname = "Trim percentage",
3150 .type = FIO_OPT_INT,
3151 .off1 = offsetof(struct thread_options, trim_percentage),
3154 .help = "Number of verify blocks to trim (i.e., discard)",
3159 .category = FIO_OPT_C_IO,
3160 .group = FIO_OPT_G_TRIM,
3163 .name = "trim_verify_zero",
3164 .lname = "Verify trim zero",
3165 .type = FIO_OPT_BOOL,
3166 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
3167 .off1 = offsetof(struct thread_options, trim_zero),
3168 .parent = "trim_percentage",
3171 .category = FIO_OPT_C_IO,
3172 .group = FIO_OPT_G_TRIM,
3175 .name = "trim_backlog",
3176 .lname = "Trim backlog",
3177 .type = FIO_OPT_STR_VAL,
3178 .off1 = offsetof(struct thread_options, trim_backlog),
3179 .help = "Trim after this number of blocks are written",
3180 .parent = "trim_percentage",
3183 .category = FIO_OPT_C_IO,
3184 .group = FIO_OPT_G_TRIM,
3187 .name = "trim_backlog_batch",
3188 .lname = "Trim backlog batch",
3189 .type = FIO_OPT_INT,
3190 .off1 = offsetof(struct thread_options, trim_batch),
3191 .help = "Trim this number of IO blocks",
3192 .parent = "trim_percentage",
3195 .category = FIO_OPT_C_IO,
3196 .group = FIO_OPT_G_TRIM,
3200 .name = "trim_percentage",
3201 .lname = "Trim percentage",
3202 .type = FIO_OPT_UNSUPPORTED,
3203 .help = "Fio does not support TRIM on your platform",
3206 .name = "trim_verify_zero",
3207 .lname = "Verify trim zero",
3208 .type = FIO_OPT_UNSUPPORTED,
3209 .help = "Fio does not support TRIM on your platform",
3212 .name = "trim_backlog",
3213 .lname = "Trim backlog",
3214 .type = FIO_OPT_UNSUPPORTED,
3215 .help = "Fio does not support TRIM on your platform",
3218 .name = "trim_backlog_batch",
3219 .lname = "Trim backlog batch",
3220 .type = FIO_OPT_UNSUPPORTED,
3221 .help = "Fio does not support TRIM on your platform",
3225 .name = "write_iolog",
3226 .lname = "Write I/O log",
3227 .type = FIO_OPT_STR_STORE,
3228 .off1 = offsetof(struct thread_options, write_iolog_file),
3229 .help = "Store IO pattern to file",
3230 .category = FIO_OPT_C_IO,
3231 .group = FIO_OPT_G_IOLOG,
3234 .name = "read_iolog",
3235 .lname = "Read I/O log",
3236 .type = FIO_OPT_STR_STORE,
3237 .off1 = offsetof(struct thread_options, read_iolog_file),
3238 .help = "Playback IO pattern from file",
3239 .category = FIO_OPT_C_IO,
3240 .group = FIO_OPT_G_IOLOG,
3243 .name = "read_iolog_chunked",
3244 .lname = "Read I/O log in parts",
3245 .type = FIO_OPT_BOOL,
3246 .off1 = offsetof(struct thread_options, read_iolog_chunked),
3248 .parent = "read_iolog",
3249 .help = "Parse IO pattern in chunks",
3250 .category = FIO_OPT_C_IO,
3251 .group = FIO_OPT_G_IOLOG,
3254 .name = "replay_no_stall",
3255 .lname = "Don't stall on replay",
3256 .type = FIO_OPT_BOOL,
3257 .off1 = offsetof(struct thread_options, no_stall),
3259 .parent = "read_iolog",
3261 .help = "Playback IO pattern file as fast as possible without stalls",
3262 .category = FIO_OPT_C_IO,
3263 .group = FIO_OPT_G_IOLOG,
3266 .name = "replay_redirect",
3267 .lname = "Redirect device for replay",
3268 .type = FIO_OPT_STR_STORE,
3269 .off1 = offsetof(struct thread_options, replay_redirect),
3270 .parent = "read_iolog",
3272 .help = "Replay all I/O onto this device, regardless of trace device",
3273 .category = FIO_OPT_C_IO,
3274 .group = FIO_OPT_G_IOLOG,
3277 .name = "replay_scale",
3278 .lname = "Replace offset scale factor",
3279 .type = FIO_OPT_INT,
3280 .off1 = offsetof(struct thread_options, replay_scale),
3281 .parent = "read_iolog",
3283 .help = "Align offsets to this blocksize",
3284 .category = FIO_OPT_C_IO,
3285 .group = FIO_OPT_G_IOLOG,
3288 .name = "replay_align",
3289 .lname = "Replace alignment",
3290 .type = FIO_OPT_INT,
3291 .off1 = offsetof(struct thread_options, replay_align),
3292 .parent = "read_iolog",
3293 .help = "Scale offset down by this factor",
3294 .category = FIO_OPT_C_IO,
3295 .group = FIO_OPT_G_IOLOG,
3299 .name = "replay_time_scale",
3300 .lname = "Replay Time Scale",
3301 .type = FIO_OPT_INT,
3302 .off1 = offsetof(struct thread_options, replay_time_scale),
3305 .parent = "read_iolog",
3307 .help = "Scale time for replay events",
3308 .category = FIO_OPT_C_IO,
3309 .group = FIO_OPT_G_IOLOG,
3312 .name = "replay_skip",
3313 .lname = "Replay Skip",
3314 .type = FIO_OPT_STR,
3315 .cb = str_replay_skip_cb,
3316 .off1 = offsetof(struct thread_options, replay_skip),
3317 .parent = "read_iolog",
3318 .help = "Skip certain IO types (read,write,trim,flush)",
3319 .category = FIO_OPT_C_IO,
3320 .group = FIO_OPT_G_IOLOG,
3323 .name = "merge_blktrace_file",
3324 .lname = "Merged blktrace output filename",
3325 .type = FIO_OPT_STR_STORE,
3326 .off1 = offsetof(struct thread_options, merge_blktrace_file),
3327 .help = "Merged blktrace output filename",
3328 .category = FIO_OPT_C_IO,
3329 .group = FIO_OPT_G_IOLOG,
3332 .name = "merge_blktrace_scalars",
3333 .lname = "Percentage to scale each trace",
3334 .type = FIO_OPT_FLOAT_LIST,
3335 .off1 = offsetof(struct thread_options, merge_blktrace_scalars),
3336 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3337 .help = "Percentage to scale each trace",
3338 .category = FIO_OPT_C_IO,
3339 .group = FIO_OPT_G_IOLOG,
3342 .name = "merge_blktrace_iters",
3343 .lname = "Number of iterations to run per trace",
3344 .type = FIO_OPT_FLOAT_LIST,
3345 .off1 = offsetof(struct thread_options, merge_blktrace_iters),
3346 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3347 .help = "Number of iterations to run per trace",
3348 .category = FIO_OPT_C_IO,
3349 .group = FIO_OPT_G_IOLOG,
3352 .name = "exec_prerun",
3353 .lname = "Pre-execute runnable",
3354 .type = FIO_OPT_STR_STORE,
3355 .off1 = offsetof(struct thread_options, exec_prerun),
3356 .help = "Execute this file prior to running job",
3357 .category = FIO_OPT_C_GENERAL,
3358 .group = FIO_OPT_G_INVALID,
3361 .name = "exec_postrun",
3362 .lname = "Post-execute runnable",
3363 .type = FIO_OPT_STR_STORE,
3364 .off1 = offsetof(struct thread_options, exec_postrun),
3365 .help = "Execute this file after running job",
3366 .category = FIO_OPT_C_GENERAL,
3367 .group = FIO_OPT_G_INVALID,
3369 #ifdef FIO_HAVE_IOSCHED_SWITCH
3371 .name = "ioscheduler",
3372 .lname = "I/O scheduler",
3373 .type = FIO_OPT_STR_STORE,
3374 .off1 = offsetof(struct thread_options, ioscheduler),
3375 .help = "Use this IO scheduler on the backing device",
3376 .category = FIO_OPT_C_FILE,
3377 .group = FIO_OPT_G_INVALID,
3381 .name = "ioscheduler",
3382 .lname = "I/O scheduler",
3383 .type = FIO_OPT_UNSUPPORTED,
3384 .help = "Your platform does not support IO scheduler switching",
3389 .lname = "Zone mode",
3390 .help = "Mode for the zonesize, zonerange and zoneskip parameters",
3391 .type = FIO_OPT_STR,
3392 .off1 = offsetof(struct thread_options, zone_mode),
3394 .category = FIO_OPT_C_IO,
3395 .group = FIO_OPT_G_ZONE,
3398 .oval = ZONE_MODE_NONE,
3399 .help = "no zoning",
3401 { .ival = "strided",
3402 .oval = ZONE_MODE_STRIDED,
3403 .help = "strided mode - random I/O is restricted to a single zone",
3406 .oval = ZONE_MODE_ZBD,
3407 .help = "zoned block device mode - random I/O selects one of multiple zones randomly",
3413 .lname = "Zone size",
3414 .type = FIO_OPT_STR_VAL,
3415 .off1 = offsetof(struct thread_options, zone_size),
3416 .help = "Amount of data to read per zone",
3418 .interval = 1024 * 1024,
3419 .category = FIO_OPT_C_IO,
3420 .group = FIO_OPT_G_ZONE,
3423 .name = "zonecapacity",
3424 .lname = "Zone capacity",
3425 .type = FIO_OPT_STR_VAL,
3426 .off1 = offsetof(struct thread_options, zone_capacity),
3427 .help = "Capacity per zone",
3429 .interval = 1024 * 1024,
3430 .category = FIO_OPT_C_IO,
3431 .group = FIO_OPT_G_ZONE,
3434 .name = "zonerange",
3435 .lname = "Zone range",
3436 .type = FIO_OPT_STR_VAL,
3437 .off1 = offsetof(struct thread_options, zone_range),
3438 .help = "Give size of an IO zone",
3440 .interval = 1024 * 1024,
3441 .category = FIO_OPT_C_IO,
3442 .group = FIO_OPT_G_ZONE,
3446 .lname = "Zone skip",
3447 .type = FIO_OPT_STR_VAL_ZONE,
3448 .cb = str_zoneskip_cb,
3449 .off1 = offsetof(struct thread_options, zone_skip),
3450 .help = "Space between IO zones",
3452 .category = FIO_OPT_C_IO,
3453 .group = FIO_OPT_G_ZONE,
3456 .name = "read_beyond_wp",
3457 .lname = "Allow reads beyond the zone write pointer",
3458 .type = FIO_OPT_BOOL,
3459 .off1 = offsetof(struct thread_options, read_beyond_wp),
3460 .help = "Allow reads beyond the zone write pointer",
3462 .category = FIO_OPT_C_IO,
3463 .group = FIO_OPT_G_INVALID,
3466 .name = "max_open_zones",
3467 .lname = "Per device/file maximum number of open zones",
3468 .type = FIO_OPT_INT,
3469 .off1 = offsetof(struct thread_options, max_open_zones),
3470 .maxval = ZBD_MAX_OPEN_ZONES,
3471 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd",
3473 .category = FIO_OPT_C_IO,
3474 .group = FIO_OPT_G_INVALID,
3477 .name = "job_max_open_zones",
3478 .lname = "Job maximum number of open zones",
3479 .type = FIO_OPT_INT,
3480 .off1 = offsetof(struct thread_options, job_max_open_zones),
3481 .maxval = ZBD_MAX_OPEN_ZONES,
3482 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd by one thread/process",
3484 .category = FIO_OPT_C_IO,
3485 .group = FIO_OPT_G_INVALID,
3488 .name = "ignore_zone_limits",
3489 .lname = "Ignore zone resource limits",
3490 .type = FIO_OPT_BOOL,
3491 .off1 = offsetof(struct thread_options, ignore_zone_limits),
3493 .help = "Ignore the zone resource limits (max open/active zones) reported by the device",
3494 .category = FIO_OPT_C_IO,
3495 .group = FIO_OPT_G_INVALID,
3498 .name = "zone_reset_threshold",
3499 .lname = "Zone reset threshold",
3500 .help = "Zoned block device reset threshold",
3501 .type = FIO_OPT_FLOAT_LIST,
3503 .off1 = offsetof(struct thread_options, zrt),
3506 .category = FIO_OPT_C_IO,
3507 .group = FIO_OPT_G_ZONE,
3510 .name = "zone_reset_frequency",
3511 .lname = "Zone reset frequency",
3512 .help = "Zoned block device zone reset frequency in HZ",
3513 .type = FIO_OPT_FLOAT_LIST,
3515 .off1 = offsetof(struct thread_options, zrf),
3518 .category = FIO_OPT_C_IO,
3519 .group = FIO_OPT_G_ZONE,
3523 .lname = "Lock memory",
3524 .type = FIO_OPT_STR_VAL,
3525 .off1 = offsetof(struct thread_options, lockmem),
3526 .help = "Lock down this amount of memory (per worker)",
3528 .interval = 1024 * 1024,
3529 .category = FIO_OPT_C_GENERAL,
3530 .group = FIO_OPT_G_INVALID,
3533 .name = "rwmixread",
3534 .lname = "Read/write mix read",
3535 .type = FIO_OPT_INT,
3536 .cb = str_rwmix_read_cb,
3537 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
3539 .help = "Percentage of mixed workload that is reads",
3542 .inverse = "rwmixwrite",
3543 .category = FIO_OPT_C_IO,
3544 .group = FIO_OPT_G_RWMIX,
3547 .name = "rwmixwrite",
3548 .lname = "Read/write mix write",
3549 .type = FIO_OPT_INT,
3550 .cb = str_rwmix_write_cb,
3551 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
3553 .help = "Percentage of mixed workload that is writes",
3556 .inverse = "rwmixread",
3557 .category = FIO_OPT_C_IO,
3558 .group = FIO_OPT_G_RWMIX,
3561 .name = "rwmixcycle",
3562 .lname = "Read/write mix cycle",
3563 .type = FIO_OPT_DEPRECATED,
3564 .category = FIO_OPT_C_IO,
3565 .group = FIO_OPT_G_RWMIX,
3570 .type = FIO_OPT_INT,
3571 .off1 = offsetof(struct thread_options, nice),
3572 .help = "Set job CPU nice value",
3577 .category = FIO_OPT_C_GENERAL,
3578 .group = FIO_OPT_G_CRED,
3580 #ifdef FIO_HAVE_IOPRIO
3583 .lname = "I/O nice priority",
3584 .type = FIO_OPT_INT,
3585 .off1 = offsetof(struct thread_options, ioprio),
3586 .help = "Set job IO priority value",
3587 .minval = IOPRIO_MIN_PRIO,
3588 .maxval = IOPRIO_MAX_PRIO,
3590 .category = FIO_OPT_C_GENERAL,
3591 .group = FIO_OPT_G_CRED,
3596 .lname = "I/O nice priority",
3597 .type = FIO_OPT_UNSUPPORTED,
3598 .help = "Your platform does not support IO priorities",
3601 #ifdef FIO_HAVE_IOPRIO_CLASS
3602 #ifndef FIO_HAVE_IOPRIO
3603 #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3606 .name = "prioclass",
3607 .lname = "I/O nice priority class",
3608 .type = FIO_OPT_INT,
3609 .off1 = offsetof(struct thread_options, ioprio_class),
3610 .help = "Set job IO priority class",
3611 .minval = IOPRIO_MIN_PRIO_CLASS,
3612 .maxval = IOPRIO_MAX_PRIO_CLASS,
3614 .category = FIO_OPT_C_GENERAL,
3615 .group = FIO_OPT_G_CRED,
3619 .name = "prioclass",
3620 .lname = "I/O nice priority class",
3621 .type = FIO_OPT_UNSUPPORTED,
3622 .help = "Your platform does not support IO priority classes",
3626 .name = "thinktime",
3627 .lname = "Thinktime",
3628 .type = FIO_OPT_INT,
3629 .off1 = offsetof(struct thread_options, thinktime),
3630 .help = "Idle time between IO buffers (usec)",
3633 .category = FIO_OPT_C_IO,
3634 .group = FIO_OPT_G_THINKTIME,
3637 .name = "thinktime_spin",
3638 .lname = "Thinktime spin",
3639 .type = FIO_OPT_INT,
3640 .off1 = offsetof(struct thread_options, thinktime_spin),
3641 .help = "Start think time by spinning this amount (usec)",
3644 .parent = "thinktime",
3646 .category = FIO_OPT_C_IO,
3647 .group = FIO_OPT_G_THINKTIME,
3650 .name = "thinktime_blocks",
3651 .lname = "Thinktime blocks",
3652 .type = FIO_OPT_INT,
3653 .off1 = offsetof(struct thread_options, thinktime_blocks),
3654 .help = "IO buffer period between 'thinktime'",
3656 .parent = "thinktime",
3658 .category = FIO_OPT_C_IO,
3659 .group = FIO_OPT_G_THINKTIME,
3662 .name = "thinktime_blocks_type",
3663 .lname = "Thinktime blocks type",
3664 .type = FIO_OPT_STR,
3665 .off1 = offsetof(struct thread_options, thinktime_blocks_type),
3666 .help = "How thinktime_blocks takes effect",
3668 .category = FIO_OPT_C_IO,
3669 .group = FIO_OPT_G_THINKTIME,
3671 { .ival = "complete",
3672 .oval = THINKTIME_BLOCKS_TYPE_COMPLETE,
3673 .help = "thinktime_blocks takes effect at the completion side",
3677 .oval = THINKTIME_BLOCKS_TYPE_ISSUE,
3678 .help = "thinktime_blocks takes effect at the issue side",
3681 .parent = "thinktime",
3684 .name = "thinktime_iotime",
3685 .lname = "Thinktime interval",
3686 .type = FIO_OPT_INT,
3687 .off1 = offsetof(struct thread_options, thinktime_iotime),
3688 .help = "IO time interval between 'thinktime'",
3690 .parent = "thinktime",
3694 .category = FIO_OPT_C_IO,
3695 .group = FIO_OPT_G_THINKTIME,
3699 .lname = "I/O rate",
3700 .type = FIO_OPT_ULL,
3701 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3702 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3703 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
3704 .help = "Set bandwidth rate",
3705 .category = FIO_OPT_C_IO,
3706 .group = FIO_OPT_G_RATE,
3711 .lname = "I/O min rate",
3712 .type = FIO_OPT_ULL,
3713 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
3714 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
3715 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
3716 .help = "Job must meet this rate or it will be shutdown",
3719 .category = FIO_OPT_C_IO,
3720 .group = FIO_OPT_G_RATE,
3723 .name = "rate_iops",
3724 .lname = "I/O rate IOPS",
3725 .type = FIO_OPT_INT,
3726 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
3727 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
3728 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
3729 .help = "Limit IO used to this number of IO operations/sec",
3731 .category = FIO_OPT_C_IO,
3732 .group = FIO_OPT_G_RATE,
3735 .name = "rate_iops_min",
3736 .lname = "I/O min rate IOPS",
3737 .type = FIO_OPT_INT,
3738 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
3739 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
3740 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
3741 .help = "Job must meet this rate or it will be shut down",
3742 .parent = "rate_iops",
3744 .category = FIO_OPT_C_IO,
3745 .group = FIO_OPT_G_RATE,
3748 .name = "rate_process",
3749 .lname = "Rate Process",
3750 .type = FIO_OPT_STR,
3751 .off1 = offsetof(struct thread_options, rate_process),
3752 .help = "What process controls how rated IO is managed",
3754 .category = FIO_OPT_C_IO,
3755 .group = FIO_OPT_G_RATE,
3758 .oval = RATE_PROCESS_LINEAR,
3759 .help = "Linear rate of IO",
3763 .oval = RATE_PROCESS_POISSON,
3764 .help = "Rate follows Poisson process",
3770 .name = "rate_cycle",
3771 .alias = "ratecycle",
3772 .lname = "I/O rate cycle",
3773 .type = FIO_OPT_INT,
3774 .off1 = offsetof(struct thread_options, ratecycle),
3775 .help = "Window average for rate limits (msec)",
3779 .category = FIO_OPT_C_IO,
3780 .group = FIO_OPT_G_RATE,
3783 .name = "rate_ignore_thinktime",
3784 .lname = "Rate ignore thinktime",
3785 .type = FIO_OPT_BOOL,
3786 .off1 = offsetof(struct thread_options, rate_ign_think),
3787 .help = "Rated IO ignores thinktime settings",
3789 .category = FIO_OPT_C_IO,
3790 .group = FIO_OPT_G_RATE,
3793 .name = "max_latency",
3794 .lname = "Max Latency (usec)",
3795 .type = FIO_OPT_ULL,
3796 .off1 = offsetof(struct thread_options, max_latency[DDIR_READ]),
3797 .off2 = offsetof(struct thread_options, max_latency[DDIR_WRITE]),
3798 .off3 = offsetof(struct thread_options, max_latency[DDIR_TRIM]),
3799 .help = "Maximum tolerated IO latency (usec)",
3801 .category = FIO_OPT_C_IO,
3802 .group = FIO_OPT_G_LATPROF,
3805 .name = "latency_target",
3806 .lname = "Latency Target (usec)",
3807 .type = FIO_OPT_STR_VAL_TIME,
3808 .off1 = offsetof(struct thread_options, latency_target),
3809 .help = "Ramp to max queue depth supporting this latency",
3811 .category = FIO_OPT_C_IO,
3812 .group = FIO_OPT_G_LATPROF,
3815 .name = "latency_window",
3816 .lname = "Latency Window (usec)",
3817 .type = FIO_OPT_STR_VAL_TIME,
3818 .off1 = offsetof(struct thread_options, latency_window),
3819 .help = "Time to sustain latency_target",
3821 .category = FIO_OPT_C_IO,
3822 .group = FIO_OPT_G_LATPROF,
3825 .name = "latency_percentile",
3826 .lname = "Latency Percentile",
3827 .type = FIO_OPT_FLOAT_LIST,
3828 .off1 = offsetof(struct thread_options, latency_percentile),
3829 .help = "Percentile of IOs must be below latency_target",
3834 .category = FIO_OPT_C_IO,
3835 .group = FIO_OPT_G_LATPROF,
3838 .name = "latency_run",
3839 .lname = "Latency Run",
3840 .type = FIO_OPT_BOOL,
3841 .off1 = offsetof(struct thread_options, latency_run),
3842 .help = "Keep adjusting queue depth to match latency_target",
3844 .category = FIO_OPT_C_IO,
3845 .group = FIO_OPT_G_LATPROF,
3848 .name = "invalidate",
3849 .lname = "Cache invalidate",
3850 .type = FIO_OPT_BOOL,
3851 .off1 = offsetof(struct thread_options, invalidate_cache),
3852 .help = "Invalidate buffer/page cache prior to running job",
3854 .category = FIO_OPT_C_IO,
3855 .group = FIO_OPT_G_IO_TYPE,
3859 .lname = "Synchronous I/O",
3860 .type = FIO_OPT_STR,
3861 .off1 = offsetof(struct thread_options, sync_io),
3862 .help = "Use synchronous write IO",
3865 .category = FIO_OPT_C_IO,
3866 .group = FIO_OPT_G_IO_TYPE,
3887 #ifdef FIO_HAVE_WRITE_HINT
3889 .name = "write_hint",
3890 .lname = "Write hint",
3891 .type = FIO_OPT_STR,
3892 .off1 = offsetof(struct thread_options, write_hint),
3893 .help = "Set expected write life time",
3894 .category = FIO_OPT_C_ENGINE,
3895 .group = FIO_OPT_G_INVALID,
3898 .oval = RWH_WRITE_LIFE_NONE,
3901 .oval = RWH_WRITE_LIFE_SHORT,
3904 .oval = RWH_WRITE_LIFE_MEDIUM,
3907 .oval = RWH_WRITE_LIFE_LONG,
3909 { .ival = "extreme",
3910 .oval = RWH_WRITE_LIFE_EXTREME,
3916 .name = "create_serialize",
3917 .lname = "Create serialize",
3918 .type = FIO_OPT_BOOL,
3919 .off1 = offsetof(struct thread_options, create_serialize),
3920 .help = "Serialize creation of job files",
3922 .category = FIO_OPT_C_FILE,
3923 .group = FIO_OPT_G_INVALID,
3926 .name = "create_fsync",
3927 .lname = "Create fsync",
3928 .type = FIO_OPT_BOOL,
3929 .off1 = offsetof(struct thread_options, create_fsync),
3930 .help = "fsync file after creation",
3932 .category = FIO_OPT_C_FILE,
3933 .group = FIO_OPT_G_INVALID,
3936 .name = "create_on_open",
3937 .lname = "Create on open",
3938 .type = FIO_OPT_BOOL,
3939 .off1 = offsetof(struct thread_options, create_on_open),
3940 .help = "Create files when they are opened for IO",
3942 .category = FIO_OPT_C_FILE,
3943 .group = FIO_OPT_G_INVALID,
3946 .name = "create_only",
3947 .lname = "Create Only",
3948 .type = FIO_OPT_BOOL,
3949 .off1 = offsetof(struct thread_options, create_only),
3950 .help = "Only perform file creation phase",
3951 .category = FIO_OPT_C_FILE,
3955 .name = "allow_file_create",
3956 .lname = "Allow file create",
3957 .type = FIO_OPT_BOOL,
3958 .off1 = offsetof(struct thread_options, allow_create),
3959 .help = "Permit fio to create files, if they don't exist",
3961 .category = FIO_OPT_C_FILE,
3962 .group = FIO_OPT_G_FILENAME,
3965 .name = "allow_mounted_write",
3966 .lname = "Allow mounted write",
3967 .type = FIO_OPT_BOOL,
3968 .off1 = offsetof(struct thread_options, allow_mounted_write),
3969 .help = "Allow writes to a mounted partition",
3971 .category = FIO_OPT_C_FILE,
3972 .group = FIO_OPT_G_FILENAME,
3976 .lname = "Pre-read files",
3977 .type = FIO_OPT_BOOL,
3978 .off1 = offsetof(struct thread_options, pre_read),
3979 .help = "Pre-read files before starting official testing",
3981 .category = FIO_OPT_C_FILE,
3982 .group = FIO_OPT_G_INVALID,
3984 #ifdef FIO_HAVE_CPU_AFFINITY
3987 .lname = "CPU mask",
3988 .type = FIO_OPT_INT,
3989 .cb = str_cpumask_cb,
3990 .off1 = offsetof(struct thread_options, cpumask),
3991 .help = "CPU affinity mask",
3992 .category = FIO_OPT_C_GENERAL,
3993 .group = FIO_OPT_G_CRED,
3996 .name = "cpus_allowed",
3997 .lname = "CPUs allowed",
3998 .type = FIO_OPT_STR,
3999 .cb = str_cpus_allowed_cb,
4000 .off1 = offsetof(struct thread_options, cpumask),
4001 .help = "Set CPUs allowed",
4002 .category = FIO_OPT_C_GENERAL,
4003 .group = FIO_OPT_G_CRED,
4006 .name = "cpus_allowed_policy",
4007 .lname = "CPUs allowed distribution policy",
4008 .type = FIO_OPT_STR,
4009 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
4010 .help = "Distribution policy for cpus_allowed",
4011 .parent = "cpus_allowed",
4015 .oval = FIO_CPUS_SHARED,
4016 .help = "Mask shared between threads",
4019 .oval = FIO_CPUS_SPLIT,
4020 .help = "Mask split between threads",
4023 .category = FIO_OPT_C_GENERAL,
4024 .group = FIO_OPT_G_CRED,
4029 .lname = "CPU mask",
4030 .type = FIO_OPT_UNSUPPORTED,
4031 .help = "Your platform does not support CPU affinities",
4034 .name = "cpus_allowed",
4035 .lname = "CPUs allowed",
4036 .type = FIO_OPT_UNSUPPORTED,
4037 .help = "Your platform does not support CPU affinities",
4040 .name = "cpus_allowed_policy",
4041 .lname = "CPUs allowed distribution policy",
4042 .type = FIO_OPT_UNSUPPORTED,
4043 .help = "Your platform does not support CPU affinities",
4046 #ifdef CONFIG_LIBNUMA
4048 .name = "numa_cpu_nodes",
4049 .lname = "NUMA CPU Nodes",
4050 .type = FIO_OPT_STR,
4051 .cb = str_numa_cpunodes_cb,
4052 .off1 = offsetof(struct thread_options, numa_cpunodes),
4053 .help = "NUMA CPU nodes bind",
4054 .category = FIO_OPT_C_GENERAL,
4055 .group = FIO_OPT_G_INVALID,
4058 .name = "numa_mem_policy",
4059 .lname = "NUMA Memory Policy",
4060 .type = FIO_OPT_STR,
4061 .cb = str_numa_mpol_cb,
4062 .off1 = offsetof(struct thread_options, numa_memnodes),
4063 .help = "NUMA memory policy setup",
4064 .category = FIO_OPT_C_GENERAL,
4065 .group = FIO_OPT_G_INVALID,
4069 .name = "numa_cpu_nodes",
4070 .lname = "NUMA CPU Nodes",
4071 .type = FIO_OPT_UNSUPPORTED,
4072 .help = "Build fio with libnuma-dev(el) to enable this option",
4075 .name = "numa_mem_policy",
4076 .lname = "NUMA Memory Policy",
4077 .type = FIO_OPT_UNSUPPORTED,
4078 .help = "Build fio with libnuma-dev(el) to enable this option",
4083 .name = "gpu_dev_id",
4084 .lname = "GPU device ID",
4085 .type = FIO_OPT_INT,
4086 .off1 = offsetof(struct thread_options, gpu_dev_id),
4087 .help = "Set GPU device ID for GPUDirect RDMA",
4089 .category = FIO_OPT_C_GENERAL,
4090 .group = FIO_OPT_G_INVALID,
4094 .name = "end_fsync",
4095 .lname = "End fsync",
4096 .type = FIO_OPT_BOOL,
4097 .off1 = offsetof(struct thread_options, end_fsync),
4098 .help = "Include fsync at the end of job",
4100 .category = FIO_OPT_C_FILE,
4101 .group = FIO_OPT_G_INVALID,
4104 .name = "fsync_on_close",
4105 .lname = "Fsync on close",
4106 .type = FIO_OPT_BOOL,
4107 .off1 = offsetof(struct thread_options, fsync_on_close),
4108 .help = "fsync files on close",
4110 .category = FIO_OPT_C_FILE,
4111 .group = FIO_OPT_G_INVALID,
4115 .lname = "Unlink file",
4116 .type = FIO_OPT_BOOL,
4117 .off1 = offsetof(struct thread_options, unlink),
4118 .help = "Unlink created files after job has completed",
4120 .category = FIO_OPT_C_FILE,
4121 .group = FIO_OPT_G_INVALID,
4124 .name = "unlink_each_loop",
4125 .lname = "Unlink file after each loop of a job",
4126 .type = FIO_OPT_BOOL,
4127 .off1 = offsetof(struct thread_options, unlink_each_loop),
4128 .help = "Unlink created files after each loop in a job has completed",
4130 .category = FIO_OPT_C_FILE,
4131 .group = FIO_OPT_G_INVALID,
4135 .lname = "Exit-all on terminate",
4136 .type = FIO_OPT_STR_SET,
4137 .cb = str_exitall_cb,
4138 .help = "Terminate all jobs when one exits",
4139 .category = FIO_OPT_C_GENERAL,
4140 .group = FIO_OPT_G_PROCESS,
4143 .name = "exit_what",
4144 .lname = "What jobs to quit on terminate",
4145 .type = FIO_OPT_STR,
4146 .off1 = offsetof(struct thread_options, exit_what),
4147 .help = "Fine-grained control for exitall",
4149 .category = FIO_OPT_C_GENERAL,
4150 .group = FIO_OPT_G_PROCESS,
4153 .oval = TERMINATE_GROUP,
4154 .help = "exit_all=1 default behaviour",
4156 { .ival = "stonewall",
4157 .oval = TERMINATE_STONEWALL,
4158 .help = "quit all currently running jobs; continue with next stonewall",
4161 .oval = TERMINATE_ALL,
4162 .help = "Quit everything",
4167 .name = "exitall_on_error",
4168 .lname = "Exit-all on terminate in error",
4169 .type = FIO_OPT_STR_SET,
4170 .off1 = offsetof(struct thread_options, exitall_error),
4171 .help = "Terminate all jobs when one exits in error",
4172 .category = FIO_OPT_C_GENERAL,
4173 .group = FIO_OPT_G_PROCESS,
4176 .name = "stonewall",
4177 .lname = "Wait for previous",
4178 .alias = "wait_for_previous",
4179 .type = FIO_OPT_STR_SET,
4180 .off1 = offsetof(struct thread_options, stonewall),
4181 .help = "Insert a hard barrier between this job and previous",
4182 .category = FIO_OPT_C_GENERAL,
4183 .group = FIO_OPT_G_PROCESS,
4186 .name = "new_group",
4187 .lname = "New group",
4188 .type = FIO_OPT_STR_SET,
4189 .off1 = offsetof(struct thread_options, new_group),
4190 .help = "Mark the start of a new group (for reporting)",
4191 .category = FIO_OPT_C_GENERAL,
4192 .group = FIO_OPT_G_PROCESS,
4197 .type = FIO_OPT_STR_SET,
4198 .off1 = offsetof(struct thread_options, use_thread),
4199 .help = "Use threads instead of processes",
4200 #ifdef CONFIG_NO_SHM
4204 .category = FIO_OPT_C_GENERAL,
4205 .group = FIO_OPT_G_PROCESS,
4208 .name = "per_job_logs",
4209 .lname = "Per Job Logs",
4210 .type = FIO_OPT_BOOL,
4211 .off1 = offsetof(struct thread_options, per_job_logs),
4212 .help = "Include job number in generated log files or not",
4214 .category = FIO_OPT_C_LOG,
4215 .group = FIO_OPT_G_INVALID,
4218 .name = "write_bw_log",
4219 .lname = "Write bandwidth log",
4220 .type = FIO_OPT_STR,
4221 .off1 = offsetof(struct thread_options, bw_log_file),
4222 .cb = str_write_bw_log_cb,
4223 .help = "Write log of bandwidth during run",
4224 .category = FIO_OPT_C_LOG,
4225 .group = FIO_OPT_G_INVALID,
4228 .name = "write_lat_log",
4229 .lname = "Write latency log",
4230 .type = FIO_OPT_STR,
4231 .off1 = offsetof(struct thread_options, lat_log_file),
4232 .cb = str_write_lat_log_cb,
4233 .help = "Write log of latency during run",
4234 .category = FIO_OPT_C_LOG,
4235 .group = FIO_OPT_G_INVALID,
4238 .name = "write_iops_log",
4239 .lname = "Write IOPS log",
4240 .type = FIO_OPT_STR,
4241 .off1 = offsetof(struct thread_options, iops_log_file),
4242 .cb = str_write_iops_log_cb,
4243 .help = "Write log of IOPS during run",
4244 .category = FIO_OPT_C_LOG,
4245 .group = FIO_OPT_G_INVALID,
4248 .name = "log_entries",
4249 .lname = "Log entries",
4250 .type = FIO_OPT_INT,
4251 .off1 = offsetof(struct thread_options, log_entries),
4252 .help = "Initial number of entries in a job IO log",
4253 .def = __fio_stringify(DEF_LOG_ENTRIES),
4254 .minval = DEF_LOG_ENTRIES,
4255 .maxval = MAX_LOG_ENTRIES,
4256 .category = FIO_OPT_C_LOG,
4257 .group = FIO_OPT_G_INVALID,
4260 .name = "log_avg_msec",
4261 .lname = "Log averaging (msec)",
4262 .type = FIO_OPT_INT,
4263 .off1 = offsetof(struct thread_options, log_avg_msec),
4264 .help = "Average bw/iops/lat logs over this period of time",
4266 .category = FIO_OPT_C_LOG,
4267 .group = FIO_OPT_G_INVALID,
4270 .name = "log_hist_msec",
4271 .lname = "Log histograms (msec)",
4272 .type = FIO_OPT_INT,
4273 .off1 = offsetof(struct thread_options, log_hist_msec),
4274 .help = "Dump completion latency histograms at frequency of this time value",
4276 .category = FIO_OPT_C_LOG,
4277 .group = FIO_OPT_G_INVALID,
4280 .name = "log_hist_coarseness",
4281 .lname = "Histogram logs coarseness",
4282 .type = FIO_OPT_INT,
4283 .off1 = offsetof(struct thread_options, log_hist_coarseness),
4284 .help = "Integer in range [0,6]. Higher coarseness outputs"
4285 " fewer histogram bins per sample. The number of bins for"
4286 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
4288 .category = FIO_OPT_C_LOG,
4289 .group = FIO_OPT_G_INVALID,
4292 .name = "write_hist_log",
4293 .lname = "Write latency histogram logs",
4294 .type = FIO_OPT_STR,
4295 .off1 = offsetof(struct thread_options, hist_log_file),
4296 .cb = str_write_hist_log_cb,
4297 .help = "Write log of latency histograms during run",
4298 .category = FIO_OPT_C_LOG,
4299 .group = FIO_OPT_G_INVALID,
4302 .name = "log_max_value",
4303 .lname = "Log maximum instead of average",
4304 .type = FIO_OPT_BOOL,
4305 .off1 = offsetof(struct thread_options, log_max),
4306 .help = "Log max sample in a window instead of average",
4308 .category = FIO_OPT_C_LOG,
4309 .group = FIO_OPT_G_INVALID,
4312 .name = "log_offset",
4313 .lname = "Log offset of IO",
4314 .type = FIO_OPT_BOOL,
4315 .off1 = offsetof(struct thread_options, log_offset),
4316 .help = "Include offset of IO for each log entry",
4318 .category = FIO_OPT_C_LOG,
4319 .group = FIO_OPT_G_INVALID,
4323 .lname = "Log priority of IO",
4324 .type = FIO_OPT_BOOL,
4325 .off1 = offsetof(struct thread_options, log_prio),
4326 .help = "Include priority value of IO for each log entry",
4328 .category = FIO_OPT_C_LOG,
4329 .group = FIO_OPT_G_INVALID,
4333 .name = "log_compression",
4334 .lname = "Log compression",
4335 .type = FIO_OPT_INT,
4336 .off1 = offsetof(struct thread_options, log_gz),
4337 .help = "Log in compressed chunks of this size",
4339 .maxval = 512 * 1024 * 1024ULL,
4340 .category = FIO_OPT_C_LOG,
4341 .group = FIO_OPT_G_INVALID,
4343 #ifdef FIO_HAVE_CPU_AFFINITY
4345 .name = "log_compression_cpus",
4346 .lname = "Log Compression CPUs",
4347 .type = FIO_OPT_STR,
4348 .cb = str_log_cpus_allowed_cb,
4349 .off1 = offsetof(struct thread_options, log_gz_cpumask),
4350 .parent = "log_compression",
4351 .help = "Limit log compression to these CPUs",
4352 .category = FIO_OPT_C_LOG,
4353 .group = FIO_OPT_G_INVALID,
4357 .name = "log_compression_cpus",
4358 .lname = "Log Compression CPUs",
4359 .type = FIO_OPT_UNSUPPORTED,
4360 .help = "Your platform does not support CPU affinities",
4364 .name = "log_store_compressed",
4365 .lname = "Log store compressed",
4366 .type = FIO_OPT_BOOL,
4367 .off1 = offsetof(struct thread_options, log_gz_store),
4368 .help = "Store logs in a compressed format",
4369 .category = FIO_OPT_C_LOG,
4370 .group = FIO_OPT_G_INVALID,
4374 .name = "log_compression",
4375 .lname = "Log compression",
4376 .type = FIO_OPT_UNSUPPORTED,
4377 .help = "Install libz-dev(el) to get compression support",
4380 .name = "log_store_compressed",
4381 .lname = "Log store compressed",
4382 .type = FIO_OPT_UNSUPPORTED,
4383 .help = "Install libz-dev(el) to get compression support",
4387 .name = "log_unix_epoch",
4388 .lname = "Log epoch unix",
4389 .type = FIO_OPT_BOOL,
4390 .off1 = offsetof(struct thread_options, log_unix_epoch),
4391 .help = "Use Unix time in log files",
4392 .category = FIO_OPT_C_LOG,
4393 .group = FIO_OPT_G_INVALID,
4396 .name = "block_error_percentiles",
4397 .lname = "Block error percentiles",
4398 .type = FIO_OPT_BOOL,
4399 .off1 = offsetof(struct thread_options, block_error_hist),
4400 .help = "Record trim block errors and make a histogram",
4402 .category = FIO_OPT_C_LOG,
4403 .group = FIO_OPT_G_INVALID,
4406 .name = "bwavgtime",
4407 .lname = "Bandwidth average time",
4408 .type = FIO_OPT_INT,
4409 .off1 = offsetof(struct thread_options, bw_avg_time),
4410 .help = "Time window over which to calculate bandwidth"
4413 .parent = "write_bw_log",
4416 .category = FIO_OPT_C_LOG,
4417 .group = FIO_OPT_G_INVALID,
4420 .name = "iopsavgtime",
4421 .lname = "IOPS average time",
4422 .type = FIO_OPT_INT,
4423 .off1 = offsetof(struct thread_options, iops_avg_time),
4424 .help = "Time window over which to calculate IOPS (msec)",
4426 .parent = "write_iops_log",
4429 .category = FIO_OPT_C_LOG,
4430 .group = FIO_OPT_G_INVALID,
4433 .name = "group_reporting",
4434 .lname = "Group reporting",
4435 .type = FIO_OPT_STR_SET,
4436 .off1 = offsetof(struct thread_options, group_reporting),
4437 .help = "Do reporting on a per-group basis",
4438 .category = FIO_OPT_C_STAT,
4439 .group = FIO_OPT_G_INVALID,
4444 .type = FIO_OPT_BOOL,
4445 .off1 = offsetof(struct thread_options, stats),
4446 .help = "Enable collection of stats",
4448 .category = FIO_OPT_C_STAT,
4449 .group = FIO_OPT_G_INVALID,
4452 .name = "zero_buffers",
4453 .lname = "Zero I/O buffers",
4454 .type = FIO_OPT_STR_SET,
4455 .off1 = offsetof(struct thread_options, zero_buffers),
4456 .help = "Init IO buffers to all zeroes",
4457 .category = FIO_OPT_C_IO,
4458 .group = FIO_OPT_G_IO_BUF,
4461 .name = "refill_buffers",
4462 .lname = "Refill I/O buffers",
4463 .type = FIO_OPT_STR_SET,
4464 .off1 = offsetof(struct thread_options, refill_buffers),
4465 .help = "Refill IO buffers on every IO submit",
4466 .category = FIO_OPT_C_IO,
4467 .group = FIO_OPT_G_IO_BUF,
4470 .name = "scramble_buffers",
4471 .lname = "Scramble I/O buffers",
4472 .type = FIO_OPT_BOOL,
4473 .off1 = offsetof(struct thread_options, scramble_buffers),
4474 .help = "Slightly scramble buffers on every IO submit",
4476 .category = FIO_OPT_C_IO,
4477 .group = FIO_OPT_G_IO_BUF,
4480 .name = "buffer_pattern",
4481 .lname = "Buffer pattern",
4482 .type = FIO_OPT_STR,
4483 .cb = str_buffer_pattern_cb,
4484 .off1 = offsetof(struct thread_options, buffer_pattern),
4485 .help = "Fill pattern for IO buffers",
4486 .category = FIO_OPT_C_IO,
4487 .group = FIO_OPT_G_IO_BUF,
4490 .name = "buffer_compress_percentage",
4491 .lname = "Buffer compression percentage",
4492 .type = FIO_OPT_INT,
4493 .cb = str_buffer_compress_cb,
4494 .off1 = offsetof(struct thread_options, compress_percentage),
4497 .help = "How compressible the buffer is (approximately)",
4499 .category = FIO_OPT_C_IO,
4500 .group = FIO_OPT_G_IO_BUF,
4503 .name = "buffer_compress_chunk",
4504 .lname = "Buffer compression chunk size",
4505 .type = FIO_OPT_INT,
4506 .off1 = offsetof(struct thread_options, compress_chunk),
4507 .parent = "buffer_compress_percentage",
4509 .help = "Size of compressible region in buffer",
4512 .category = FIO_OPT_C_IO,
4513 .group = FIO_OPT_G_IO_BUF,
4516 .name = "dedupe_percentage",
4517 .lname = "Dedupe percentage",
4518 .type = FIO_OPT_INT,
4519 .cb = str_dedupe_cb,
4520 .off1 = offsetof(struct thread_options, dedupe_percentage),
4523 .help = "Percentage of buffers that are dedupable",
4525 .category = FIO_OPT_C_IO,
4526 .group = FIO_OPT_G_IO_BUF,
4529 .name = "dedupe_mode",
4530 .lname = "Dedupe mode",
4531 .help = "Mode for the deduplication buffer generation",
4532 .type = FIO_OPT_STR,
4533 .off1 = offsetof(struct thread_options, dedupe_mode),
4534 .parent = "dedupe_percentage",
4536 .category = FIO_OPT_C_IO,
4537 .group = FIO_OPT_G_IO_BUF,
4540 .oval = DEDUPE_MODE_REPEAT,
4541 .help = "repeat previous page",
4543 { .ival = "working_set",
4544 .oval = DEDUPE_MODE_WORKING_SET,
4545 .help = "choose a page randomly from limited working set defined in dedupe_working_set_percentage",
4550 .name = "dedupe_working_set_percentage",
4551 .lname = "Dedupe working set percentage",
4552 .help = "Dedupe working set size in percentages from file or device size used to generate dedupe patterns from",
4553 .type = FIO_OPT_INT,
4554 .off1 = offsetof(struct thread_options, dedupe_working_set_percentage),
4555 .parent = "dedupe_percentage",
4559 .category = FIO_OPT_C_IO,
4560 .group = FIO_OPT_G_IO_BUF,
4563 .name = "clat_percentiles",
4564 .lname = "Completion latency percentiles",
4565 .type = FIO_OPT_BOOL,
4566 .off1 = offsetof(struct thread_options, clat_percentiles),
4567 .help = "Enable the reporting of completion latency percentiles",
4569 .category = FIO_OPT_C_STAT,
4570 .group = FIO_OPT_G_INVALID,
4573 .name = "lat_percentiles",
4574 .lname = "IO latency percentiles",
4575 .type = FIO_OPT_BOOL,
4576 .off1 = offsetof(struct thread_options, lat_percentiles),
4577 .help = "Enable the reporting of IO latency percentiles",
4579 .category = FIO_OPT_C_STAT,
4580 .group = FIO_OPT_G_INVALID,
4583 .name = "slat_percentiles",
4584 .lname = "Submission latency percentiles",
4585 .type = FIO_OPT_BOOL,
4586 .off1 = offsetof(struct thread_options, slat_percentiles),
4587 .help = "Enable the reporting of submission latency percentiles",
4589 .category = FIO_OPT_C_STAT,
4590 .group = FIO_OPT_G_INVALID,
4593 .name = "percentile_list",
4594 .lname = "Percentile list",
4595 .type = FIO_OPT_FLOAT_LIST,
4596 .off1 = offsetof(struct thread_options, percentile_list),
4597 .off2 = offsetof(struct thread_options, percentile_precision),
4598 .help = "Specify a custom list of percentiles to report for "
4599 "completion latency and block errors",
4600 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
4601 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4604 .category = FIO_OPT_C_STAT,
4605 .group = FIO_OPT_G_INVALID,
4608 .name = "significant_figures",
4609 .lname = "Significant figures",
4610 .type = FIO_OPT_INT,
4611 .off1 = offsetof(struct thread_options, sig_figs),
4614 .help = "Significant figures for output-format set to normal",
4617 .category = FIO_OPT_C_STAT,
4618 .group = FIO_OPT_G_INVALID,
4621 #ifdef FIO_HAVE_DISK_UTIL
4623 .name = "disk_util",
4624 .lname = "Disk utilization",
4625 .type = FIO_OPT_BOOL,
4626 .off1 = offsetof(struct thread_options, do_disk_util),
4627 .help = "Log disk utilization statistics",
4629 .category = FIO_OPT_C_STAT,
4630 .group = FIO_OPT_G_INVALID,
4634 .name = "disk_util",
4635 .lname = "Disk utilization",
4636 .type = FIO_OPT_UNSUPPORTED,
4637 .help = "Your platform does not support disk utilization",
4641 .name = "gtod_reduce",
4642 .lname = "Reduce gettimeofday() calls",
4643 .type = FIO_OPT_BOOL,
4644 .help = "Greatly reduce number of gettimeofday() calls",
4645 .cb = str_gtod_reduce_cb,
4648 .category = FIO_OPT_C_STAT,
4649 .group = FIO_OPT_G_INVALID,
4652 .name = "disable_lat",
4653 .lname = "Disable all latency stats",
4654 .type = FIO_OPT_BOOL,
4655 .off1 = offsetof(struct thread_options, disable_lat),
4656 .help = "Disable latency numbers",
4657 .parent = "gtod_reduce",
4660 .category = FIO_OPT_C_STAT,
4661 .group = FIO_OPT_G_INVALID,
4664 .name = "disable_clat",
4665 .lname = "Disable completion latency stats",
4666 .type = FIO_OPT_BOOL,
4667 .off1 = offsetof(struct thread_options, disable_clat),
4668 .help = "Disable completion latency numbers",
4669 .parent = "gtod_reduce",
4672 .category = FIO_OPT_C_STAT,
4673 .group = FIO_OPT_G_INVALID,
4676 .name = "disable_slat",
4677 .lname = "Disable submission latency stats",
4678 .type = FIO_OPT_BOOL,
4679 .off1 = offsetof(struct thread_options, disable_slat),
4680 .help = "Disable submission latency numbers",
4681 .parent = "gtod_reduce",
4684 .category = FIO_OPT_C_STAT,
4685 .group = FIO_OPT_G_INVALID,
4688 .name = "disable_bw_measurement",
4689 .alias = "disable_bw",
4690 .lname = "Disable bandwidth stats",
4691 .type = FIO_OPT_BOOL,
4692 .off1 = offsetof(struct thread_options, disable_bw),
4693 .help = "Disable bandwidth logging",
4694 .parent = "gtod_reduce",
4697 .category = FIO_OPT_C_STAT,
4698 .group = FIO_OPT_G_INVALID,
4702 .lname = "Dedicated gettimeofday() CPU",
4703 .type = FIO_OPT_INT,
4704 .off1 = offsetof(struct thread_options, gtod_cpu),
4705 .help = "Set up dedicated gettimeofday() thread on this CPU",
4706 .verify = gtod_cpu_verify,
4707 .category = FIO_OPT_C_GENERAL,
4708 .group = FIO_OPT_G_CLOCK,
4711 .name = "unified_rw_reporting",
4712 .lname = "Unified RW Reporting",
4713 .type = FIO_OPT_STR,
4714 .off1 = offsetof(struct thread_options, unified_rw_rep),
4715 .help = "Unify reporting across data direction",
4717 .category = FIO_OPT_C_GENERAL,
4718 .group = FIO_OPT_G_INVALID,
4721 .oval = UNIFIED_SPLIT,
4722 .help = "Normal statistics reporting",
4725 .oval = UNIFIED_MIXED,
4726 .help = "Statistics are summed per data direction and reported together",
4729 .oval = UNIFIED_BOTH,
4730 .help = "Statistics are reported normally, followed by the mixed statistics"
4732 /* Compatibility with former boolean values */
4734 .oval = UNIFIED_SPLIT,
4735 .help = "Alias for 'none'",
4738 .oval = UNIFIED_MIXED,
4739 .help = "Alias for 'mixed'",
4742 .oval = UNIFIED_BOTH,
4743 .help = "Alias for 'both'",
4748 .name = "continue_on_error",
4749 .lname = "Continue on error",
4750 .type = FIO_OPT_STR,
4751 .off1 = offsetof(struct thread_options, continue_on_error),
4752 .help = "Continue on non-fatal errors during IO",
4754 .category = FIO_OPT_C_GENERAL,
4755 .group = FIO_OPT_G_ERR,
4758 .oval = ERROR_TYPE_NONE,
4759 .help = "Exit when an error is encountered",
4762 .oval = ERROR_TYPE_READ,
4763 .help = "Continue on read errors only",
4766 .oval = ERROR_TYPE_WRITE,
4767 .help = "Continue on write errors only",
4770 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
4771 .help = "Continue on any IO errors",
4774 .oval = ERROR_TYPE_VERIFY,
4775 .help = "Continue on verify errors only",
4778 .oval = ERROR_TYPE_ANY,
4779 .help = "Continue on all io and verify errors",
4782 .oval = ERROR_TYPE_NONE,
4783 .help = "Alias for 'none'",
4786 .oval = ERROR_TYPE_ANY,
4787 .help = "Alias for 'all'",
4792 .name = "ignore_error",
4793 .lname = "Ignore Error",
4794 .type = FIO_OPT_STR,
4795 .cb = str_ignore_error_cb,
4796 .off1 = offsetof(struct thread_options, ignore_error_nr),
4797 .help = "Set a specific list of errors to ignore",
4799 .category = FIO_OPT_C_GENERAL,
4800 .group = FIO_OPT_G_ERR,
4803 .name = "error_dump",
4804 .lname = "Error Dump",
4805 .type = FIO_OPT_BOOL,
4806 .off1 = offsetof(struct thread_options, error_dump),
4808 .help = "Dump info on each error",
4809 .category = FIO_OPT_C_GENERAL,
4810 .group = FIO_OPT_G_ERR,
4815 .type = FIO_OPT_STR_STORE,
4816 .off1 = offsetof(struct thread_options, profile),
4817 .help = "Select a specific builtin performance test",
4818 .category = FIO_OPT_C_PROFILE,
4819 .group = FIO_OPT_G_INVALID,
4824 .type = FIO_OPT_STR_STORE,
4825 .off1 = offsetof(struct thread_options, cgroup),
4826 .help = "Add job to cgroup of this name",
4827 .category = FIO_OPT_C_GENERAL,
4828 .group = FIO_OPT_G_CGROUP,
4831 .name = "cgroup_nodelete",
4832 .lname = "Cgroup no-delete",
4833 .type = FIO_OPT_BOOL,
4834 .off1 = offsetof(struct thread_options, cgroup_nodelete),
4835 .help = "Do not delete cgroups after job completion",
4838 .category = FIO_OPT_C_GENERAL,
4839 .group = FIO_OPT_G_CGROUP,
4842 .name = "cgroup_weight",
4843 .lname = "Cgroup weight",
4844 .type = FIO_OPT_INT,
4845 .off1 = offsetof(struct thread_options, cgroup_weight),
4846 .help = "Use given weight for cgroup",
4850 .category = FIO_OPT_C_GENERAL,
4851 .group = FIO_OPT_G_CGROUP,
4856 .type = FIO_OPT_INT,
4857 .off1 = offsetof(struct thread_options, uid),
4858 .help = "Run job with this user ID",
4859 .category = FIO_OPT_C_GENERAL,
4860 .group = FIO_OPT_G_CRED,
4864 .lname = "Group ID",
4865 .type = FIO_OPT_INT,
4866 .off1 = offsetof(struct thread_options, gid),
4867 .help = "Run job with this group ID",
4868 .category = FIO_OPT_C_GENERAL,
4869 .group = FIO_OPT_G_CRED,
4874 .type = FIO_OPT_STR,
4875 .off1 = offsetof(struct thread_options, kb_base),
4881 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
4885 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
4888 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
4889 .category = FIO_OPT_C_GENERAL,
4890 .group = FIO_OPT_G_INVALID,
4893 .name = "unit_base",
4894 .lname = "Unit for quantities of data (Bits or Bytes)",
4895 .type = FIO_OPT_STR,
4896 .off1 = offsetof(struct thread_options, unit_base),
4901 .help = "Auto-detect",
4904 .oval = N2S_BYTEPERSEC,
4905 .help = "Normal (byte based)",
4908 .oval = N2S_BITPERSEC,
4909 .help = "Bit based",
4912 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
4913 .category = FIO_OPT_C_GENERAL,
4914 .group = FIO_OPT_G_INVALID,
4917 .name = "hugepage-size",
4918 .lname = "Hugepage size",
4919 .type = FIO_OPT_INT,
4920 .off1 = offsetof(struct thread_options, hugepage_size),
4921 .help = "When using hugepages, specify size of each page",
4922 .def = __fio_stringify(FIO_HUGE_PAGE),
4923 .interval = 1024 * 1024,
4924 .category = FIO_OPT_C_GENERAL,
4925 .group = FIO_OPT_G_INVALID,
4929 .lname = "I/O flow ID",
4930 .type = FIO_OPT_INT,
4931 .off1 = offsetof(struct thread_options, flow_id),
4932 .help = "The flow index ID to use",
4934 .category = FIO_OPT_C_IO,
4935 .group = FIO_OPT_G_IO_FLOW,
4939 .lname = "I/O flow weight",
4940 .type = FIO_OPT_INT,
4941 .off1 = offsetof(struct thread_options, flow),
4942 .help = "Weight for flow control of this job",
4943 .parent = "flow_id",
4946 .maxval = FLOW_MAX_WEIGHT,
4947 .category = FIO_OPT_C_IO,
4948 .group = FIO_OPT_G_IO_FLOW,
4951 .name = "flow_watermark",
4952 .lname = "I/O flow watermark",
4953 .type = FIO_OPT_SOFT_DEPRECATED,
4954 .category = FIO_OPT_C_IO,
4955 .group = FIO_OPT_G_IO_FLOW,
4958 .name = "flow_sleep",
4959 .lname = "I/O flow sleep",
4960 .type = FIO_OPT_INT,
4961 .off1 = offsetof(struct thread_options, flow_sleep),
4962 .help = "How many microseconds to sleep after being held"
4963 " back by the flow control mechanism",
4964 .parent = "flow_id",
4967 .category = FIO_OPT_C_IO,
4968 .group = FIO_OPT_G_IO_FLOW,
4971 .name = "steadystate",
4972 .lname = "Steady state threshold",
4974 .type = FIO_OPT_STR,
4975 .off1 = offsetof(struct thread_options, ss_state),
4976 .cb = str_steadystate_cb,
4977 .help = "Define the criterion and limit to judge when a job has reached steady state",
4978 .def = "iops_slope:0.01%",
4981 .oval = FIO_SS_IOPS,
4982 .help = "maximum mean deviation of IOPS measurements",
4984 { .ival = "iops_slope",
4985 .oval = FIO_SS_IOPS_SLOPE,
4986 .help = "slope calculated from IOPS measurements",
4990 .help = "maximum mean deviation of bandwidth measurements",
4994 .oval = FIO_SS_BW_SLOPE,
4995 .help = "slope calculated from bandwidth measurements",
4998 .category = FIO_OPT_C_GENERAL,
4999 .group = FIO_OPT_G_RUNTIME,
5002 .name = "steadystate_duration",
5003 .lname = "Steady state duration",
5005 .parent = "steadystate",
5006 .type = FIO_OPT_STR_VAL_TIME,
5007 .off1 = offsetof(struct thread_options, ss_dur),
5008 .help = "Stop workload upon attaining steady state for specified duration",
5012 .category = FIO_OPT_C_GENERAL,
5013 .group = FIO_OPT_G_RUNTIME,
5016 .name = "steadystate_ramp_time",
5017 .lname = "Steady state ramp time",
5019 .parent = "steadystate",
5020 .type = FIO_OPT_STR_VAL_TIME,
5021 .off1 = offsetof(struct thread_options, ss_ramp_time),
5022 .help = "Delay before initiation of data collection for steady state job termination testing",
5026 .category = FIO_OPT_C_GENERAL,
5027 .group = FIO_OPT_G_RUNTIME,
5034 static void add_to_lopt(struct option *lopt, struct fio_option *o,
5035 const char *name, int val)
5037 lopt->name = (char *) name;
5039 if (o->type == FIO_OPT_STR_SET)
5040 lopt->has_arg = optional_argument;
5042 lopt->has_arg = required_argument;
5045 static void options_to_lopts(struct fio_option *opts,
5046 struct option *long_options,
5047 int i, int option_type)
5049 struct fio_option *o = &opts[0];
5051 add_to_lopt(&long_options[i], o, o->name, option_type);
5054 add_to_lopt(&long_options[i], o, o->alias, option_type);
5059 assert(i < FIO_NR_OPTIONS);
5063 void fio_options_set_ioengine_opts(struct option *long_options,
5064 struct thread_data *td)
5069 while (long_options[i].name) {
5070 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
5071 memset(&long_options[i], 0, sizeof(*long_options));
5078 * Just clear out the prior ioengine options.
5083 options_to_lopts(td->io_ops->options, long_options, i,
5084 FIO_GETOPT_IOENGINE);
5087 void fio_options_dup_and_init(struct option *long_options)
5091 options_init(fio_options);
5094 while (long_options[i].name)
5097 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
5100 struct fio_keyword {
5106 static struct fio_keyword fio_keywords[] = {
5108 .word = "$pagesize",
5109 .desc = "Page size in the system",
5112 .word = "$mb_memory",
5113 .desc = "Megabytes of memory online",
5117 .desc = "Number of CPUs online in the system",
5124 void fio_keywords_exit(void)
5126 struct fio_keyword *kw;
5128 kw = &fio_keywords[0];
5136 void fio_keywords_init(void)
5138 unsigned long long mb_memory;
5142 sprintf(buf, "%lu", (unsigned long) page_size);
5143 fio_keywords[0].replace = strdup(buf);
5145 mb_memory = os_phys_mem() / (1024 * 1024);
5146 sprintf(buf, "%llu", mb_memory);
5147 fio_keywords[1].replace = strdup(buf);
5150 sprintf(buf, "%lu", l);
5151 fio_keywords[2].replace = strdup(buf);
5156 static char *bc_calc(char *str)
5158 char buf[128], *tmp;
5163 * No math, just return string
5165 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
5166 !strchr(str, '/')) || strchr(str, '\''))
5170 * Split option from value, we only need to calculate the value
5172 tmp = strchr(str, '=');
5179 * Prevent buffer overflows; such a case isn't reasonable anyway
5181 if (strlen(str) >= 128 || strlen(tmp) > 100)
5184 sprintf(buf, "which %s > /dev/null", BC_APP);
5186 log_err("fio: bc is needed for performing math\n");
5190 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
5191 f = popen(buf, "r");
5195 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
5202 buf[(tmp - str) + ret - 1] = '\0';
5203 memcpy(buf, str, tmp - str);
5209 * Return a copy of the input string with substrings of the form ${VARNAME}
5210 * substituted with the value of the environment variable VARNAME. The
5211 * substitution always occurs, even if VARNAME is empty or the corresponding
5212 * environment variable undefined.
5214 char *fio_option_dup_subs(const char *opt)
5216 char out[OPT_LEN_MAX+1];
5217 char in[OPT_LEN_MAX+1];
5220 char *ch1, *ch2, *env;
5221 ssize_t nchr = OPT_LEN_MAX;
5224 if (strlen(opt) + 1 > OPT_LEN_MAX) {
5225 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
5229 snprintf(in, sizeof(in), "%s", opt);
5231 while (*inptr && nchr > 0) {
5232 if (inptr[0] == '$' && inptr[1] == '{') {
5233 ch2 = strchr(inptr, '}');
5234 if (ch2 && inptr+1 < ch2) {
5241 envlen = strlen(env);
5242 if (envlen <= nchr) {
5243 memcpy(outptr, env, envlen);
5253 *outptr++ = *inptr++;
5262 * Look for reserved variable names and replace them with real values
5264 static char *fio_keyword_replace(char *opt)
5270 for (i = 0; fio_keywords[i].word != NULL; i++) {
5271 struct fio_keyword *kw = &fio_keywords[i];
5273 while ((s = strstr(opt, kw->word)) != NULL) {
5274 char *new = calloc(strlen(opt) + 1, 1);
5280 * Copy part of the string before the keyword and
5281 * sprintf() the replacement after it.
5283 memcpy(new, opt, olen);
5284 len = sprintf(new + olen, "%s", kw->replace);
5287 * If there's more in the original string, copy that
5290 opt += olen + strlen(kw->word);
5291 /* keeps final zero thanks to calloc */
5293 memcpy(new + olen + len, opt, strlen(opt));
5296 * replace opt and free the old opt
5306 * Check for potential math and invoke bc, if possible
5314 static char **dup_and_sub_options(char **opts, int num_opts)
5317 char **opts_copy = malloc(num_opts * sizeof(*opts));
5318 for (i = 0; i < num_opts; i++) {
5319 opts_copy[i] = fio_option_dup_subs(opts[i]);
5322 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
5327 static void show_closest_option(const char *opt)
5329 int best_option, best_distance;
5338 while (name[i] != '\0' && name[i] != '=')
5343 best_distance = INT_MAX;
5345 while (fio_options[i].name) {
5346 distance = string_distance(name, fio_options[i].name);
5347 if (distance < best_distance) {
5348 best_distance = distance;
5354 if (best_option != -1 && string_distance_ok(name, best_distance) &&
5355 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
5356 log_err("Did you mean %s?\n", fio_options[best_option].name);
5361 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
5363 int i, ret, unknown;
5366 sort_options(opts, fio_options, num_opts);
5367 opts_copy = dup_and_sub_options(opts, num_opts);
5369 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
5370 const struct fio_option *o;
5371 int newret = parse_option(opts_copy[i], opts[i], fio_options,
5372 &o, &td->o, &td->opt_list);
5375 fio_option_mark_set(&td->o, o);
5383 opts_copy[i] = NULL;
5390 ret |= ioengine_load(td);
5392 sort_options(opts_copy, td->io_ops->options, num_opts);
5395 for (i = 0; i < num_opts; i++) {
5396 const struct fio_option *o = NULL;
5403 newret = parse_option(opts_copy[i], opts[i],
5404 td->io_ops->options, &o,
5405 td->eo, &td->opt_list);
5409 log_err("Bad option <%s>\n", opts[i]);
5410 show_closest_option(opts[i]);
5413 opts_copy[i] = NULL;
5421 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
5425 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
5427 const struct fio_option *o;
5429 o = find_option_c(fio_options, opt);
5431 fio_option_mark_set(&td->o, o);
5437 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
5440 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
5444 void fio_fill_default_options(struct thread_data *td)
5446 td->o.magic = OPT_MAGIC;
5447 fill_default_options(&td->o, fio_options);
5450 int fio_show_option_help(const char *opt)
5452 return show_cmd_help(fio_options, opt);
5456 * dupe FIO_OPT_STR_STORE options
5458 void fio_options_mem_dupe(struct thread_data *td)
5460 options_mem_dupe(fio_options, &td->o);
5462 if (td->eo && td->io_ops) {
5463 void *oldeo = td->eo;
5465 td->eo = malloc(td->io_ops->option_struct_size);
5466 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
5467 options_mem_dupe(td->io_ops->options, td->eo);
5471 unsigned int fio_get_kb_base(void *data)
5473 struct thread_data *td = cb_data_to_td(data);
5474 struct thread_options *o = &td->o;
5475 unsigned int kb_base = 0;
5478 * This is a hack... For private options, *data is not holding
5479 * a pointer to the thread_options, but to private data. This means
5480 * we can't safely dereference it, but magic is first so mem wise
5481 * it is valid. But this also means that if the job first sets
5482 * kb_base and expects that to be honored by private options,
5483 * it will be disappointed. We will return the global default
5486 if (o && o->magic == OPT_MAGIC)
5487 kb_base = o->kb_base;
5494 int add_option(const struct fio_option *o)
5496 struct fio_option *__o;
5505 if (opt_index + 1 == FIO_MAX_OPTS) {
5506 log_err("fio: FIO_MAX_OPTS is too small\n");
5510 memcpy(&fio_options[opt_index], o, sizeof(*o));
5511 fio_options[opt_index + 1].name = NULL;
5515 void invalidate_profile_options(const char *prof_name)
5517 struct fio_option *o;
5521 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5522 o->type = FIO_OPT_INVALID;
5523 o->prof_name = NULL;
5529 void add_opt_posval(const char *optname, const char *ival, const char *help)
5531 struct fio_option *o;
5534 o = find_option(fio_options, optname);
5538 for (i = 0; i < PARSE_MAX_VP; i++) {
5539 if (o->posval[i].ival)
5542 o->posval[i].ival = ival;
5543 o->posval[i].help = help;
5548 void del_opt_posval(const char *optname, const char *ival)
5550 struct fio_option *o;
5553 o = find_option(fio_options, optname);
5557 for (i = 0; i < PARSE_MAX_VP; i++) {
5558 if (!o->posval[i].ival)
5560 if (strcmp(o->posval[i].ival, ival))
5563 o->posval[i].ival = NULL;
5564 o->posval[i].help = NULL;
5568 void fio_options_free(struct thread_data *td)
5570 options_free(fio_options, &td->o);
5571 if (td->eo && td->io_ops && td->io_ops->options) {
5572 options_free(td->io_ops->options, td->eo);
5578 void fio_dump_options_free(struct thread_data *td)
5580 while (!flist_empty(&td->opt_list)) {
5581 struct print_option *p;
5583 p = flist_first_entry(&td->opt_list, struct print_option, list);
5584 flist_del_init(&p->list);
5591 struct fio_option *fio_option_find(const char *name)
5593 return find_option(fio_options, name);
5596 static struct fio_option *find_next_opt(struct fio_option *from,
5599 struct fio_option *opt;
5602 from = &fio_options[0];
5608 if (off1 == from->off1) {
5613 } while (from->name);
5618 static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5620 unsigned int opt_off, index, offset;
5622 opt_off = opt - &fio_options[0];
5623 index = opt_off / (8 * sizeof(uint64_t));
5624 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5625 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
5628 bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
5630 struct fio_option *opt, *next;
5633 while ((opt = find_next_opt(next, off1)) != NULL) {
5634 if (opt_is_set(o, opt))
5643 void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt)
5645 unsigned int opt_off, index, offset;
5647 opt_off = opt - &fio_options[0];
5648 index = opt_off / (8 * sizeof(uint64_t));
5649 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
5650 o->set_options[index] |= (uint64_t)1 << offset;