18 #include "crc/crc32c.h"
21 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
23 static char *get_opt_postfix(const char *str)
25 char *p = strstr(str, ":");
31 strip_blank_front(&p);
36 static int converthexchartoint(char a)
56 static int bs_cmp(const void *p1, const void *p2)
58 const struct bssplit *bsp1 = p1;
59 const struct bssplit *bsp2 = p2;
61 return bsp1->perc < bsp2->perc;
64 static int bssplit_ddir(struct thread_options *o, int ddir, char *str)
66 struct bssplit *bssplit;
67 unsigned int i, perc, perc_missing;
68 unsigned int max_bs, min_bs;
72 o->bssplit_nr[ddir] = 4;
73 bssplit = malloc(4 * sizeof(struct bssplit));
78 while ((fname = strsep(&str, ":")) != NULL) {
85 * grow struct buffer, if needed
87 if (i == o->bssplit_nr[ddir]) {
88 o->bssplit_nr[ddir] <<= 1;
89 bssplit = realloc(bssplit, o->bssplit_nr[ddir]
90 * sizeof(struct bssplit));
93 perc_str = strstr(fname, "/");
97 perc = atoi(perc_str);
105 if (str_to_decimal(fname, &val, 1, o, 0)) {
106 log_err("fio: bssplit conversion failed\n");
117 bssplit[i].perc = perc;
121 o->bssplit_nr[ddir] = i;
124 * Now check if the percentages add up, and how much is missing
126 perc = perc_missing = 0;
127 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
128 struct bssplit *bsp = &bssplit[i];
130 if (bsp->perc == -1U)
136 if (perc > 100 && perc_missing > 1) {
137 log_err("fio: bssplit percentages add to more than 100%%\n");
143 * If values didn't have a percentage set, divide the remains between
147 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
149 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
150 struct bssplit *bsp = &bssplit[i];
152 if (bsp->perc == -1U)
153 bsp->perc = (100 - perc) / perc_missing;
157 o->min_bs[ddir] = min_bs;
158 o->max_bs[ddir] = max_bs;
161 * now sort based on percentages, for ease of lookup
163 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
164 o->bssplit[ddir] = bssplit;
168 static int str_bssplit_cb(void *data, const char *input)
170 struct thread_data *td = data;
171 char *str, *p, *odir, *ddir;
177 p = str = strdup(input);
179 strip_blank_front(&str);
180 strip_blank_end(str);
182 odir = strchr(str, ',');
184 ddir = strchr(odir + 1, ',');
186 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
192 op = strdup(odir + 1);
193 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
198 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
201 ret = bssplit_ddir(&td->o, DDIR_READ, str);
207 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
212 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
215 ret = bssplit_ddir(&td->o, DDIR_READ, str);
222 static int str2error(char *str)
224 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
225 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
226 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
227 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
228 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
229 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
230 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
231 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
232 int i = 0, num = sizeof(err) / sizeof(void *);
235 if (!strcmp(err[i], str))
242 static int ignore_error_type(struct thread_data *td, int etype, char *str)
248 if (etype >= ERROR_TYPE_CNT) {
249 log_err("Illegal error type\n");
253 td->o.ignore_error_nr[etype] = 4;
254 error = malloc(4 * sizeof(struct bssplit));
257 while ((fname = strsep(&str, ":")) != NULL) {
263 * grow struct buffer, if needed
265 if (i == td->o.ignore_error_nr[etype]) {
266 td->o.ignore_error_nr[etype] <<= 1;
267 error = realloc(error, td->o.ignore_error_nr[etype]
270 if (fname[0] == 'E') {
271 error[i] = str2error(fname);
273 error[i] = atoi(fname);
275 error[i] = -error[i];
278 log_err("Unknown error %s, please use number value \n",
286 td->o.continue_on_error |= 1 << etype;
287 td->o.ignore_error_nr[etype] = i;
288 td->o.ignore_error[etype] = error;
296 static int str_ignore_error_cb(void *data, const char *input)
298 struct thread_data *td = data;
300 int type = 0, ret = 1;
305 p = str = strdup(input);
307 strip_blank_front(&str);
308 strip_blank_end(str);
314 ret = ignore_error_type(td, type, p);
324 static int str_rw_cb(void *data, const char *str)
326 struct thread_data *td = data;
327 struct thread_options *o = &td->o;
336 nr = get_opt_postfix(str);
341 o->ddir_seq_nr = atoi(nr);
345 if (str_to_decimal(nr, &val, 1, o, 0)) {
346 log_err("fio: rw postfix parsing failed\n");
351 o->ddir_seq_add = val;
358 static int str_mem_cb(void *data, const char *mem)
360 struct thread_data *td = data;
362 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
363 td->o.mmapfile = get_opt_postfix(mem);
368 static int fio_clock_source_cb(void *data, const char *str)
370 struct thread_data *td = data;
372 fio_clock_source = td->o.clocksource;
373 fio_clock_source_set = 1;
378 static int str_rwmix_read_cb(void *data, unsigned long long *val)
380 struct thread_data *td = data;
382 td->o.rwmix[DDIR_READ] = *val;
383 td->o.rwmix[DDIR_WRITE] = 100 - *val;
387 static int str_rwmix_write_cb(void *data, unsigned long long *val)
389 struct thread_data *td = data;
391 td->o.rwmix[DDIR_WRITE] = *val;
392 td->o.rwmix[DDIR_READ] = 100 - *val;
396 static int str_exitall_cb(void)
398 exitall_on_terminate = 1;
402 #ifdef FIO_HAVE_CPU_AFFINITY
403 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
405 unsigned int i, index, cpus_in_mask;
406 const long max_cpu = cpus_online();
408 cpus_in_mask = fio_cpu_count(mask);
409 cpu_index = cpu_index % cpus_in_mask;
412 for (i = 0; i < max_cpu; i++) {
413 if (!fio_cpu_isset(mask, i))
416 if (cpu_index != index)
417 fio_cpu_clear(mask, i);
422 return fio_cpu_count(mask);
425 static int str_cpumask_cb(void *data, unsigned long long *val)
427 struct thread_data *td = data;
435 ret = fio_cpuset_init(&td->o.cpumask);
437 log_err("fio: cpuset_init failed\n");
438 td_verror(td, ret, "fio_cpuset_init");
442 max_cpu = cpus_online();
444 for (i = 0; i < sizeof(int) * 8; i++) {
445 if ((1 << i) & *val) {
447 log_err("fio: CPU %d too large (max=%ld)\n", i,
451 dprint(FD_PARSE, "set cpu allowed %d\n", i);
452 fio_cpu_set(&td->o.cpumask, i);
456 td->o.cpumask_set = 1;
460 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
467 ret = fio_cpuset_init(mask);
469 log_err("fio: cpuset_init failed\n");
470 td_verror(td, ret, "fio_cpuset_init");
474 p = str = strdup(input);
476 strip_blank_front(&str);
477 strip_blank_end(str);
479 max_cpu = cpus_online();
481 while ((cpu = strsep(&str, ",")) != NULL) {
490 while ((cpu2 = strsep(&str2, "-")) != NULL) {
500 while (icpu <= icpu2) {
501 if (icpu >= FIO_MAX_CPUS) {
502 log_err("fio: your OS only supports up to"
503 " %d CPUs\n", (int) FIO_MAX_CPUS);
507 if (icpu > max_cpu) {
508 log_err("fio: CPU %d too large (max=%ld)\n",
514 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
515 fio_cpu_set(mask, icpu);
524 td->o.cpumask_set = 1;
528 static int str_cpus_allowed_cb(void *data, const char *input)
530 struct thread_data *td = data;
536 ret = set_cpus_allowed(td, &td->o.cpumask, input);
538 td->o.cpumask_set = 1;
543 static int str_verify_cpus_allowed_cb(void *data, const char *input)
545 struct thread_data *td = data;
548 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
550 td->o.verify_cpumask_set = 1;
556 #ifdef CONFIG_LIBNUMA
557 static int str_numa_cpunodes_cb(void *data, char *input)
559 struct thread_data *td = data;
560 struct bitmask *verify_bitmask;
565 /* numa_parse_nodestring() parses a character string list
566 * of nodes into a bit mask. The bit mask is allocated by
567 * numa_allocate_nodemask(), so it should be freed by
568 * numa_free_nodemask().
570 verify_bitmask = numa_parse_nodestring(input);
571 if (verify_bitmask == NULL) {
572 log_err("fio: numa_parse_nodestring failed\n");
573 td_verror(td, 1, "str_numa_cpunodes_cb");
576 numa_free_nodemask(verify_bitmask);
578 td->o.numa_cpunodes = strdup(input);
579 td->o.numa_cpumask_set = 1;
583 static int str_numa_mpol_cb(void *data, char *input)
585 struct thread_data *td = data;
586 const char * const policy_types[] =
587 { "default", "prefer", "bind", "interleave", "local", NULL };
590 struct bitmask *verify_bitmask;
595 nodelist = strchr(input, ':');
597 /* NUL-terminate mode */
601 for (i = 0; i <= MPOL_LOCAL; i++) {
602 if (!strcmp(input, policy_types[i])) {
603 td->o.numa_mem_mode = i;
607 if (i > MPOL_LOCAL) {
608 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
612 switch (td->o.numa_mem_mode) {
615 * Insist on a nodelist of one node only
618 char *rest = nodelist;
619 while (isdigit(*rest))
622 log_err("fio: one node only for \'prefer\'\n");
626 log_err("fio: one node is needed for \'prefer\'\n");
630 case MPOL_INTERLEAVE:
632 * Default to online nodes with memory if no nodelist
635 nodelist = strdup("all");
640 * Don't allow a nodelist
643 log_err("fio: NO nodelist for \'local\'\n");
649 * Insist on a nodelist
652 log_err("fio: a nodelist is needed for \'bind\'\n");
659 /* numa_parse_nodestring() parses a character string list
660 * of nodes into a bit mask. The bit mask is allocated by
661 * numa_allocate_nodemask(), so it should be freed by
662 * numa_free_nodemask().
664 switch (td->o.numa_mem_mode) {
666 td->o.numa_mem_prefer_node = atoi(nodelist);
668 case MPOL_INTERLEAVE:
670 verify_bitmask = numa_parse_nodestring(nodelist);
671 if (verify_bitmask == NULL) {
672 log_err("fio: numa_parse_nodestring failed\n");
673 td_verror(td, 1, "str_numa_memnodes_cb");
676 td->o.numa_memnodes = strdup(nodelist);
677 numa_free_nodemask(verify_bitmask);
686 td->o.numa_memmask_set = 1;
694 static int str_fst_cb(void *data, const char *str)
696 struct thread_data *td = data;
697 char *nr = get_opt_postfix(str);
699 td->file_service_nr = 1;
701 td->file_service_nr = atoi(nr);
708 #ifdef CONFIG_SYNC_FILE_RANGE
709 static int str_sfr_cb(void *data, const char *str)
711 struct thread_data *td = data;
712 char *nr = get_opt_postfix(str);
714 td->sync_file_range_nr = 1;
716 td->sync_file_range_nr = atoi(nr);
724 static int str_random_distribution_cb(void *data, const char *str)
726 struct thread_data *td = data;
733 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
735 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
740 nr = get_opt_postfix(str);
741 if (nr && !str_to_float(nr, &val)) {
742 log_err("fio: random postfix parsing failed\n");
749 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
751 log_err("fio: zipf theta must different than 1.0\n");
754 td->o.zipf_theta.u.f = val;
756 if (val <= 0.00 || val >= 1.00) {
757 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
760 td->o.pareto_h.u.f = val;
767 * Return next name in the string. Files are separated with ':'. If the ':'
768 * is escaped with a '\', then that ':' is part of the filename and does not
769 * indicate a new file.
771 static char *get_next_name(char **ptr)
776 if (!str || !strlen(str))
782 * No colon, we are done
784 p = strchr(str, ':');
791 * We got a colon, but it's the first character. Skip and
799 if (*(p - 1) != '\\') {
805 memmove(p - 1, p, strlen(p) + 1);
813 static int get_max_name_idx(char *input)
815 unsigned int cur_idx;
818 p = str = strdup(input);
819 for (cur_idx = 0; ; cur_idx++)
820 if (get_next_name(&str) == NULL)
828 * Returns the directory at the index, indexes > entires will be
829 * assigned via modulo division of the index
831 int set_name_idx(char *target, char *input, int index)
833 unsigned int cur_idx;
835 char *fname, *str, *p;
837 p = str = strdup(input);
839 index %= get_max_name_idx(input);
840 for (cur_idx = 0; cur_idx <= index; cur_idx++)
841 fname = get_next_name(&str);
843 len = sprintf(target, "%s/", fname);
849 static int str_filename_cb(void *data, const char *input)
851 struct thread_data *td = data;
852 char *fname, *str, *p;
854 p = str = strdup(input);
856 strip_blank_front(&str);
857 strip_blank_end(str);
859 if (!td->files_index)
862 while ((fname = get_next_name(&str)) != NULL) {
865 add_file(td, fname, 0, 1);
872 static int str_directory_cb(void *data, const char fio_unused *unused)
874 struct thread_data *td = data;
876 char *dirname, *str, *p;
882 p = str = strdup(td->o.directory);
883 while ((dirname = get_next_name(&str)) != NULL) {
884 if (lstat(dirname, &sb) < 0) {
887 log_err("fio: %s is not a directory\n", dirname);
888 td_verror(td, ret, "lstat");
891 if (!S_ISDIR(sb.st_mode)) {
892 log_err("fio: %s is not a directory\n", dirname);
903 static int str_lockfile_cb(void *data, const char fio_unused *str)
905 struct thread_data *td = data;
907 if (td->files_index) {
908 log_err("fio: lockfile= option must precede filename=\n");
915 static int str_opendir_cb(void *data, const char fio_unused *str)
917 struct thread_data *td = data;
922 if (!td->files_index)
925 return add_dir_files(td, td->o.opendir);
928 static int pattern_cb(char *pattern, unsigned int max_size,
929 const char *input, unsigned int *pattern_bytes)
932 int i = 0, j = 0, len, k, base = 10;
933 uint32_t pattern_length;
937 * Check if it's a string input
939 loc1 = strchr(input, '\"');
943 if (*loc1 == '\0' || *loc1 == '\"')
948 } while (i < max_size);
957 * No string, find out if it's decimal or hexidecimal
959 loc1 = strstr(input, "0x");
960 loc2 = strstr(input, "0X");
963 off = strtol(input, NULL, base);
964 if (off != LONG_MAX || errno != ERANGE) {
966 pattern[i] = off & 0xff;
975 j = loc1 - input + 2;
977 j = loc2 - input + 2;
980 if (len - j < max_size * 2) {
982 off = converthexchartoint(input[k--]);
984 off += (converthexchartoint(input[k--])
986 pattern[i++] = (char) off;
992 * Fill the pattern all the way to the end. This greatly reduces
993 * the number of memcpy's we have to do when verifying the IO.
997 while (i > 1 && i * 2 <= max_size) {
998 memcpy(&pattern[i], &pattern[0], i);
1003 * Fill remainder, if the pattern multiple ends up not being
1006 while (i > 1 && i < max_size) {
1007 unsigned int b = min(pattern_length, max_size - i);
1009 memcpy(&pattern[i], &pattern[0], b);
1015 * The code in verify_io_u_pattern assumes a single byte
1016 * pattern fills the whole verify pattern buffer.
1018 memset(pattern, pattern[0], max_size);
1025 static int str_buffer_pattern_cb(void *data, const char *input)
1027 struct thread_data *td = data;
1030 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
1031 &td->o.buffer_pattern_bytes);
1033 if (!ret && td->o.buffer_pattern_bytes) {
1034 td->o.refill_buffers = 0;
1035 td->o.scramble_buffers = 0;
1036 td->o.zero_buffers = 0;
1038 log_err("fio: failed parsing pattern `%s`\n", input);
1045 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1047 struct thread_data *td = data;
1049 td->flags |= TD_F_COMPRESS;
1050 td->o.compress_percentage = *il;
1054 static int str_dedupe_cb(void *data, unsigned long long *il)
1056 struct thread_data *td = data;
1058 td->flags |= TD_F_COMPRESS;
1059 td->o.dedupe_percentage = *il;
1060 td->o.refill_buffers = 1;
1064 static int str_verify_pattern_cb(void *data, const char *input)
1066 struct thread_data *td = data;
1069 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1070 &td->o.verify_pattern_bytes);
1073 * VERIFY_META could already be set
1075 if (!ret && td->o.verify == VERIFY_NONE)
1076 td->o.verify = VERIFY_PATTERN;
1081 static int str_gtod_reduce_cb(void *data, int *il)
1083 struct thread_data *td = data;
1086 td->o.disable_lat = !!val;
1087 td->o.disable_clat = !!val;
1088 td->o.disable_slat = !!val;
1089 td->o.disable_bw = !!val;
1090 td->o.clat_percentiles = !val;
1092 td->tv_cache_mask = 63;
1097 static int str_gtod_cpu_cb(void *data, long long *il)
1099 struct thread_data *td = data;
1102 td->o.gtod_cpu = val;
1103 td->o.gtod_offload = 1;
1107 static int str_size_cb(void *data, unsigned long long *__val)
1109 struct thread_data *td = data;
1110 unsigned long long v = *__val;
1112 if (parse_is_percent(v)) {
1114 td->o.size_percent = -1ULL - v;
1121 static int rw_verify(struct fio_option *o, void *data)
1123 struct thread_data *td = data;
1125 if (read_only && td_write(td)) {
1126 log_err("fio: job <%s> has write bit set, but fio is in"
1127 " read-only mode\n", td->o.name);
1134 static int gtod_cpu_verify(struct fio_option *o, void *data)
1136 #ifndef FIO_HAVE_CPU_AFFINITY
1137 struct thread_data *td = data;
1139 if (td->o.gtod_cpu) {
1140 log_err("fio: platform must support CPU affinity for"
1141 "gettimeofday() offloading\n");
1152 static struct opt_group fio_opt_groups[] = {
1155 .mask = FIO_OPT_C_GENERAL,
1159 .mask = FIO_OPT_C_IO,
1163 .mask = FIO_OPT_C_FILE,
1166 .name = "Statistics",
1167 .mask = FIO_OPT_C_STAT,
1171 .mask = FIO_OPT_C_LOG,
1175 .mask = FIO_OPT_C_PROFILE,
1182 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1183 unsigned int inv_mask)
1185 struct opt_group *og;
1188 if (*mask == inv_mask || !*mask)
1191 for (i = 0; ogs[i].name; i++) {
1194 if (*mask & og->mask) {
1195 *mask &= ~(og->mask);
1203 struct opt_group *opt_group_from_mask(unsigned int *mask)
1205 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1208 static struct opt_group fio_opt_cat_groups[] = {
1210 .name = "Latency profiling",
1211 .mask = FIO_OPT_G_LATPROF,
1215 .mask = FIO_OPT_G_RATE,
1219 .mask = FIO_OPT_G_ZONE,
1222 .name = "Read/write mix",
1223 .mask = FIO_OPT_G_RWMIX,
1227 .mask = FIO_OPT_G_VERIFY,
1231 .mask = FIO_OPT_G_TRIM,
1234 .name = "I/O Logging",
1235 .mask = FIO_OPT_G_IOLOG,
1238 .name = "I/O Depth",
1239 .mask = FIO_OPT_G_IO_DEPTH,
1243 .mask = FIO_OPT_G_IO_FLOW,
1246 .name = "Description",
1247 .mask = FIO_OPT_G_DESC,
1251 .mask = FIO_OPT_G_FILENAME,
1254 .name = "General I/O",
1255 .mask = FIO_OPT_G_IO_BASIC,
1259 .mask = FIO_OPT_G_CGROUP,
1263 .mask = FIO_OPT_G_RUNTIME,
1267 .mask = FIO_OPT_G_PROCESS,
1270 .name = "Job credentials / priority",
1271 .mask = FIO_OPT_G_CRED,
1274 .name = "Clock settings",
1275 .mask = FIO_OPT_G_CLOCK,
1279 .mask = FIO_OPT_G_IO_TYPE,
1282 .name = "I/O Thinktime",
1283 .mask = FIO_OPT_G_THINKTIME,
1286 .name = "Randomizations",
1287 .mask = FIO_OPT_G_RANDOM,
1290 .name = "I/O buffers",
1291 .mask = FIO_OPT_G_IO_BUF,
1294 .name = "Tiobench profile",
1295 .mask = FIO_OPT_G_TIOBENCH,
1303 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1305 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1309 * Map of job/command line options
1311 struct fio_option fio_options[FIO_MAX_OPTS] = {
1313 .name = "description",
1314 .lname = "Description of job",
1315 .type = FIO_OPT_STR_STORE,
1316 .off1 = td_var_offset(description),
1317 .help = "Text job description",
1318 .category = FIO_OPT_C_GENERAL,
1319 .group = FIO_OPT_G_DESC,
1323 .lname = "Job name",
1324 .type = FIO_OPT_STR_STORE,
1325 .off1 = td_var_offset(name),
1326 .help = "Name of this job",
1327 .category = FIO_OPT_C_GENERAL,
1328 .group = FIO_OPT_G_DESC,
1332 .lname = "Filename(s)",
1333 .type = FIO_OPT_STR_STORE,
1334 .off1 = td_var_offset(filename),
1335 .cb = str_filename_cb,
1336 .prio = -1, /* must come after "directory" */
1337 .help = "File(s) to use for the workload",
1338 .category = FIO_OPT_C_FILE,
1339 .group = FIO_OPT_G_FILENAME,
1342 .name = "directory",
1343 .lname = "Directory",
1344 .type = FIO_OPT_STR_STORE,
1345 .off1 = td_var_offset(directory),
1346 .cb = str_directory_cb,
1347 .help = "Directory to store files in",
1348 .category = FIO_OPT_C_FILE,
1349 .group = FIO_OPT_G_FILENAME,
1352 .name = "filename_format",
1353 .type = FIO_OPT_STR_STORE,
1354 .off1 = td_var_offset(filename_format),
1355 .prio = -1, /* must come after "directory" */
1356 .help = "Override default $jobname.$jobnum.$filenum naming",
1357 .def = "$jobname.$jobnum.$filenum",
1358 .category = FIO_OPT_C_FILE,
1359 .group = FIO_OPT_G_FILENAME,
1363 .lname = "Lockfile",
1364 .type = FIO_OPT_STR,
1365 .off1 = td_var_offset(file_lock_mode),
1366 .help = "Lock file when doing IO to it",
1368 .parent = "filename",
1371 .cb = str_lockfile_cb,
1372 .category = FIO_OPT_C_FILE,
1373 .group = FIO_OPT_G_FILENAME,
1376 .oval = FILE_LOCK_NONE,
1377 .help = "No file locking",
1379 { .ival = "exclusive",
1380 .oval = FILE_LOCK_EXCLUSIVE,
1381 .help = "Exclusive file lock",
1384 .ival = "readwrite",
1385 .oval = FILE_LOCK_READWRITE,
1386 .help = "Read vs write lock",
1392 .lname = "Open directory",
1393 .type = FIO_OPT_STR_STORE,
1394 .off1 = td_var_offset(opendir),
1395 .cb = str_opendir_cb,
1396 .help = "Recursively add files from this directory and down",
1397 .category = FIO_OPT_C_FILE,
1398 .group = FIO_OPT_G_FILENAME,
1402 .lname = "Read/write",
1403 .alias = "readwrite",
1404 .type = FIO_OPT_STR,
1406 .off1 = td_var_offset(td_ddir),
1407 .help = "IO direction",
1409 .verify = rw_verify,
1410 .category = FIO_OPT_C_IO,
1411 .group = FIO_OPT_G_IO_BASIC,
1414 .oval = TD_DDIR_READ,
1415 .help = "Sequential read",
1418 .oval = TD_DDIR_WRITE,
1419 .help = "Sequential write",
1422 .oval = TD_DDIR_TRIM,
1423 .help = "Sequential trim",
1425 { .ival = "randread",
1426 .oval = TD_DDIR_RANDREAD,
1427 .help = "Random read",
1429 { .ival = "randwrite",
1430 .oval = TD_DDIR_RANDWRITE,
1431 .help = "Random write",
1433 { .ival = "randtrim",
1434 .oval = TD_DDIR_RANDTRIM,
1435 .help = "Random trim",
1439 .help = "Sequential read and write mix",
1441 { .ival = "readwrite",
1443 .help = "Sequential read and write mix",
1446 .oval = TD_DDIR_RANDRW,
1447 .help = "Random read and write mix"
1452 .name = "rw_sequencer",
1453 .lname = "RW Sequencer",
1454 .type = FIO_OPT_STR,
1455 .off1 = td_var_offset(rw_seq),
1456 .help = "IO offset generator modifier",
1457 .def = "sequential",
1458 .category = FIO_OPT_C_IO,
1459 .group = FIO_OPT_G_IO_BASIC,
1461 { .ival = "sequential",
1463 .help = "Generate sequential offsets",
1465 { .ival = "identical",
1466 .oval = RW_SEQ_IDENT,
1467 .help = "Generate identical offsets",
1474 .lname = "IO Engine",
1475 .type = FIO_OPT_STR_STORE,
1476 .off1 = td_var_offset(ioengine),
1477 .help = "IO engine to use",
1478 .def = FIO_PREFERRED_ENGINE,
1479 .category = FIO_OPT_C_IO,
1480 .group = FIO_OPT_G_IO_BASIC,
1483 .help = "Use read/write",
1486 .help = "Use pread/pwrite",
1489 .help = "Use readv/writev",
1491 #ifdef CONFIG_PWRITEV
1493 .help = "Use preadv/pwritev",
1496 #ifdef CONFIG_LIBAIO
1498 .help = "Linux native asynchronous IO",
1501 #ifdef CONFIG_POSIXAIO
1502 { .ival = "posixaio",
1503 .help = "POSIX asynchronous IO",
1506 #ifdef CONFIG_SOLARISAIO
1507 { .ival = "solarisaio",
1508 .help = "Solaris native asynchronous IO",
1511 #ifdef CONFIG_WINDOWSAIO
1512 { .ival = "windowsaio",
1513 .help = "Windows native asynchronous IO"
1518 .help = "Rados Block Device asynchronous IO"
1522 .help = "Memory mapped IO"
1524 #ifdef CONFIG_LINUX_SPLICE
1526 .help = "splice/vmsplice based IO",
1528 { .ival = "netsplice",
1529 .help = "splice/vmsplice to/from the network",
1532 #ifdef FIO_HAVE_SGIO
1534 .help = "SCSI generic v3 IO",
1538 .help = "Testing engine (no data transfer)",
1541 .help = "Network IO",
1544 .help = "CPU cycle burner engine",
1548 .help = "GUASI IO engine",
1551 #ifdef FIO_HAVE_BINJECT
1552 { .ival = "binject",
1553 .help = "binject direct inject block engine",
1558 .help = "RDMA IO engine",
1561 #ifdef CONFIG_FUSION_AW
1562 { .ival = "fusion-aw-sync",
1563 .help = "Fusion-io atomic write engine",
1566 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1567 { .ival = "e4defrag",
1568 .help = "ext4 defrag engine",
1571 #ifdef CONFIG_LINUX_FALLOCATE
1573 .help = "fallocate() file based engine",
1578 .help = "Glusterfs libgfapi(sync) based engine"
1580 { .ival = "gfapi_async",
1581 .help = "Glusterfs libgfapi(async) based engine"
1584 #ifdef CONFIG_LIBHDFS
1585 { .ival = "libhdfs",
1586 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1589 { .ival = "external",
1590 .help = "Load external engine (append name)",
1596 .lname = "IO Depth",
1597 .type = FIO_OPT_INT,
1598 .off1 = td_var_offset(iodepth),
1599 .help = "Number of IO buffers to keep in flight",
1603 .category = FIO_OPT_C_IO,
1604 .group = FIO_OPT_G_IO_BASIC,
1607 .name = "iodepth_batch",
1608 .lname = "IO Depth batch",
1609 .alias = "iodepth_batch_submit",
1610 .type = FIO_OPT_INT,
1611 .off1 = td_var_offset(iodepth_batch),
1612 .help = "Number of IO buffers to submit in one go",
1613 .parent = "iodepth",
1618 .category = FIO_OPT_C_IO,
1619 .group = FIO_OPT_G_IO_BASIC,
1622 .name = "iodepth_batch_complete",
1623 .lname = "IO Depth batch complete",
1624 .type = FIO_OPT_INT,
1625 .off1 = td_var_offset(iodepth_batch_complete),
1626 .help = "Number of IO buffers to retrieve in one go",
1627 .parent = "iodepth",
1632 .category = FIO_OPT_C_IO,
1633 .group = FIO_OPT_G_IO_BASIC,
1636 .name = "iodepth_low",
1637 .lname = "IO Depth batch low",
1638 .type = FIO_OPT_INT,
1639 .off1 = td_var_offset(iodepth_low),
1640 .help = "Low water mark for queuing depth",
1641 .parent = "iodepth",
1644 .category = FIO_OPT_C_IO,
1645 .group = FIO_OPT_G_IO_BASIC,
1650 .type = FIO_OPT_STR_VAL,
1652 .help = "Total size of device or files",
1653 .interval = 1024 * 1024,
1654 .category = FIO_OPT_C_IO,
1655 .group = FIO_OPT_G_INVALID,
1659 .lname = "IO Limit",
1660 .type = FIO_OPT_STR_VAL,
1661 .off1 = td_var_offset(io_limit),
1662 .interval = 1024 * 1024,
1663 .category = FIO_OPT_C_IO,
1664 .group = FIO_OPT_G_INVALID,
1667 .name = "fill_device",
1668 .lname = "Fill device",
1670 .type = FIO_OPT_BOOL,
1671 .off1 = td_var_offset(fill_device),
1672 .help = "Write until an ENOSPC error occurs",
1674 .category = FIO_OPT_C_FILE,
1675 .group = FIO_OPT_G_INVALID,
1679 .lname = "File size",
1680 .type = FIO_OPT_STR_VAL,
1681 .off1 = td_var_offset(file_size_low),
1682 .off2 = td_var_offset(file_size_high),
1684 .help = "Size of individual files",
1685 .interval = 1024 * 1024,
1686 .category = FIO_OPT_C_FILE,
1687 .group = FIO_OPT_G_INVALID,
1690 .name = "file_append",
1691 .lname = "File append",
1692 .type = FIO_OPT_BOOL,
1693 .off1 = td_var_offset(file_append),
1694 .help = "IO will start at the end of the file(s)",
1696 .category = FIO_OPT_C_FILE,
1697 .group = FIO_OPT_G_INVALID,
1701 .lname = "IO offset",
1702 .alias = "fileoffset",
1703 .type = FIO_OPT_STR_VAL,
1704 .off1 = td_var_offset(start_offset),
1705 .help = "Start IO from this offset",
1707 .interval = 1024 * 1024,
1708 .category = FIO_OPT_C_IO,
1709 .group = FIO_OPT_G_INVALID,
1712 .name = "offset_increment",
1713 .lname = "IO offset increment",
1714 .type = FIO_OPT_STR_VAL,
1715 .off1 = td_var_offset(offset_increment),
1716 .help = "What is the increment from one offset to the next",
1720 .interval = 1024 * 1024,
1721 .category = FIO_OPT_C_IO,
1722 .group = FIO_OPT_G_INVALID,
1725 .name = "number_ios",
1726 .lname = "Number of IOs to perform",
1727 .type = FIO_OPT_STR_VAL,
1728 .off1 = td_var_offset(number_ios),
1729 .help = "Force job completion after this number of IOs",
1731 .category = FIO_OPT_C_IO,
1732 .group = FIO_OPT_G_INVALID,
1736 .lname = "Block size",
1737 .alias = "blocksize",
1738 .type = FIO_OPT_INT,
1739 .off1 = td_var_offset(bs[DDIR_READ]),
1740 .off2 = td_var_offset(bs[DDIR_WRITE]),
1741 .off3 = td_var_offset(bs[DDIR_TRIM]),
1743 .help = "Block size unit",
1748 .category = FIO_OPT_C_IO,
1749 .group = FIO_OPT_G_INVALID,
1753 .lname = "Block size align",
1754 .alias = "blockalign",
1755 .type = FIO_OPT_INT,
1756 .off1 = td_var_offset(ba[DDIR_READ]),
1757 .off2 = td_var_offset(ba[DDIR_WRITE]),
1758 .off3 = td_var_offset(ba[DDIR_TRIM]),
1760 .help = "IO block offset alignment",
1764 .category = FIO_OPT_C_IO,
1765 .group = FIO_OPT_G_INVALID,
1769 .lname = "Block size range",
1770 .alias = "blocksize_range",
1771 .type = FIO_OPT_RANGE,
1772 .off1 = td_var_offset(min_bs[DDIR_READ]),
1773 .off2 = td_var_offset(max_bs[DDIR_READ]),
1774 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1775 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1776 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1777 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1779 .help = "Set block size range (in more detail than bs)",
1783 .category = FIO_OPT_C_IO,
1784 .group = FIO_OPT_G_INVALID,
1788 .lname = "Block size split",
1789 .type = FIO_OPT_STR,
1790 .cb = str_bssplit_cb,
1791 .help = "Set a specific mix of block sizes",
1794 .category = FIO_OPT_C_IO,
1795 .group = FIO_OPT_G_INVALID,
1798 .name = "bs_unaligned",
1799 .lname = "Block size unaligned",
1800 .alias = "blocksize_unaligned",
1801 .type = FIO_OPT_STR_SET,
1802 .off1 = td_var_offset(bs_unaligned),
1803 .help = "Don't sector align IO buffer sizes",
1806 .category = FIO_OPT_C_IO,
1807 .group = FIO_OPT_G_INVALID,
1810 .name = "bs_is_seq_rand",
1811 .lname = "Block size division is seq/random (not read/write)",
1812 .type = FIO_OPT_BOOL,
1813 .off1 = td_var_offset(bs_is_seq_rand),
1814 .help = "Consider any blocksize setting to be sequential,random",
1816 .parent = "blocksize",
1817 .category = FIO_OPT_C_IO,
1818 .group = FIO_OPT_G_INVALID,
1821 .name = "randrepeat",
1822 .lname = "Random repeatable",
1823 .type = FIO_OPT_BOOL,
1824 .off1 = td_var_offset(rand_repeatable),
1825 .help = "Use repeatable random IO pattern",
1829 .category = FIO_OPT_C_IO,
1830 .group = FIO_OPT_G_RANDOM,
1834 .lname = "The random generator seed",
1835 .type = FIO_OPT_STR_VAL,
1836 .off1 = td_var_offset(rand_seed),
1837 .help = "Set the random generator seed value",
1839 .category = FIO_OPT_C_IO,
1840 .group = FIO_OPT_G_RANDOM,
1843 .name = "use_os_rand",
1844 .lname = "Use OS random",
1845 .type = FIO_OPT_BOOL,
1846 .off1 = td_var_offset(use_os_rand),
1847 .help = "Set to use OS random generator",
1851 .category = FIO_OPT_C_IO,
1852 .group = FIO_OPT_G_RANDOM,
1855 .name = "norandommap",
1856 .lname = "No randommap",
1857 .type = FIO_OPT_STR_SET,
1858 .off1 = td_var_offset(norandommap),
1859 .help = "Accept potential duplicate random blocks",
1863 .category = FIO_OPT_C_IO,
1864 .group = FIO_OPT_G_RANDOM,
1867 .name = "softrandommap",
1868 .lname = "Soft randommap",
1869 .type = FIO_OPT_BOOL,
1870 .off1 = td_var_offset(softrandommap),
1871 .help = "Set norandommap if randommap allocation fails",
1872 .parent = "norandommap",
1875 .category = FIO_OPT_C_IO,
1876 .group = FIO_OPT_G_RANDOM,
1879 .name = "random_generator",
1880 .type = FIO_OPT_STR,
1881 .off1 = td_var_offset(random_generator),
1882 .help = "Type of random number generator to use",
1883 .def = "tausworthe",
1885 { .ival = "tausworthe",
1886 .oval = FIO_RAND_GEN_TAUSWORTHE,
1887 .help = "Strong Tausworthe generator",
1890 .oval = FIO_RAND_GEN_LFSR,
1891 .help = "Variable length LFSR",
1894 .category = FIO_OPT_C_IO,
1895 .group = FIO_OPT_G_RANDOM,
1898 .name = "random_distribution",
1899 .type = FIO_OPT_STR,
1900 .off1 = td_var_offset(random_distribution),
1901 .cb = str_random_distribution_cb,
1902 .help = "Random offset distribution generator",
1906 .oval = FIO_RAND_DIST_RANDOM,
1907 .help = "Completely random",
1910 .oval = FIO_RAND_DIST_ZIPF,
1911 .help = "Zipf distribution",
1914 .oval = FIO_RAND_DIST_PARETO,
1915 .help = "Pareto distribution",
1918 .category = FIO_OPT_C_IO,
1919 .group = FIO_OPT_G_RANDOM,
1922 .name = "percentage_random",
1923 .lname = "Percentage Random",
1924 .type = FIO_OPT_INT,
1925 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1926 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1927 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1929 .help = "Percentage of seq/random mix that should be random",
1930 .def = "100,100,100",
1932 .inverse = "percentage_sequential",
1933 .category = FIO_OPT_C_IO,
1934 .group = FIO_OPT_G_RANDOM,
1937 .name = "percentage_sequential",
1938 .lname = "Percentage Sequential",
1939 .type = FIO_OPT_DEPRECATED,
1940 .category = FIO_OPT_C_IO,
1941 .group = FIO_OPT_G_RANDOM,
1944 .name = "allrandrepeat",
1945 .type = FIO_OPT_BOOL,
1946 .off1 = td_var_offset(allrand_repeatable),
1947 .help = "Use repeatable random numbers for everything",
1949 .category = FIO_OPT_C_IO,
1950 .group = FIO_OPT_G_RANDOM,
1954 .lname = "Number of files",
1955 .alias = "nr_files",
1956 .type = FIO_OPT_INT,
1957 .off1 = td_var_offset(nr_files),
1958 .help = "Split job workload between this number of files",
1961 .category = FIO_OPT_C_FILE,
1962 .group = FIO_OPT_G_INVALID,
1965 .name = "openfiles",
1966 .lname = "Number of open files",
1967 .type = FIO_OPT_INT,
1968 .off1 = td_var_offset(open_files),
1969 .help = "Number of files to keep open at the same time",
1970 .category = FIO_OPT_C_FILE,
1971 .group = FIO_OPT_G_INVALID,
1974 .name = "file_service_type",
1975 .lname = "File service type",
1976 .type = FIO_OPT_STR,
1978 .off1 = td_var_offset(file_service_type),
1979 .help = "How to select which file to service next",
1980 .def = "roundrobin",
1981 .category = FIO_OPT_C_FILE,
1982 .group = FIO_OPT_G_INVALID,
1985 .oval = FIO_FSERVICE_RANDOM,
1986 .help = "Choose a file at random",
1988 { .ival = "roundrobin",
1989 .oval = FIO_FSERVICE_RR,
1990 .help = "Round robin select files",
1992 { .ival = "sequential",
1993 .oval = FIO_FSERVICE_SEQ,
1994 .help = "Finish one file before moving to the next",
1997 .parent = "nrfiles",
2000 #ifdef CONFIG_POSIX_FALLOCATE
2002 .name = "fallocate",
2003 .lname = "Fallocate",
2004 .type = FIO_OPT_STR,
2005 .off1 = td_var_offset(fallocate_mode),
2006 .help = "Whether pre-allocation is performed when laying out files",
2008 .category = FIO_OPT_C_FILE,
2009 .group = FIO_OPT_G_INVALID,
2012 .oval = FIO_FALLOCATE_NONE,
2013 .help = "Do not pre-allocate space",
2016 .oval = FIO_FALLOCATE_POSIX,
2017 .help = "Use posix_fallocate()",
2019 #ifdef CONFIG_LINUX_FALLOCATE
2021 .oval = FIO_FALLOCATE_KEEP_SIZE,
2022 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2025 /* Compatibility with former boolean values */
2027 .oval = FIO_FALLOCATE_NONE,
2028 .help = "Alias for 'none'",
2031 .oval = FIO_FALLOCATE_POSIX,
2032 .help = "Alias for 'posix'",
2036 #endif /* CONFIG_POSIX_FALLOCATE */
2038 .name = "fadvise_hint",
2039 .lname = "Fadvise hint",
2040 .type = FIO_OPT_BOOL,
2041 .off1 = td_var_offset(fadvise_hint),
2042 .help = "Use fadvise() to advise the kernel on IO pattern",
2044 .category = FIO_OPT_C_FILE,
2045 .group = FIO_OPT_G_INVALID,
2050 .type = FIO_OPT_INT,
2051 .off1 = td_var_offset(fsync_blocks),
2052 .help = "Issue fsync for writes every given number of blocks",
2055 .category = FIO_OPT_C_FILE,
2056 .group = FIO_OPT_G_INVALID,
2059 .name = "fdatasync",
2060 .lname = "Fdatasync",
2061 .type = FIO_OPT_INT,
2062 .off1 = td_var_offset(fdatasync_blocks),
2063 .help = "Issue fdatasync for writes every given number of blocks",
2066 .category = FIO_OPT_C_FILE,
2067 .group = FIO_OPT_G_INVALID,
2070 .name = "write_barrier",
2071 .lname = "Write barrier",
2072 .type = FIO_OPT_INT,
2073 .off1 = td_var_offset(barrier_blocks),
2074 .help = "Make every Nth write a barrier write",
2077 .category = FIO_OPT_C_IO,
2078 .group = FIO_OPT_G_INVALID,
2080 #ifdef CONFIG_SYNC_FILE_RANGE
2082 .name = "sync_file_range",
2083 .lname = "Sync file range",
2085 { .ival = "wait_before",
2086 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2087 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2091 .oval = SYNC_FILE_RANGE_WRITE,
2092 .help = "SYNC_FILE_RANGE_WRITE",
2096 .ival = "wait_after",
2097 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2098 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2102 .type = FIO_OPT_STR_MULTI,
2104 .off1 = td_var_offset(sync_file_range),
2105 .help = "Use sync_file_range()",
2106 .category = FIO_OPT_C_FILE,
2107 .group = FIO_OPT_G_INVALID,
2112 .lname = "Direct I/O",
2113 .type = FIO_OPT_BOOL,
2114 .off1 = td_var_offset(odirect),
2115 .help = "Use O_DIRECT IO (negates buffered)",
2117 .inverse = "buffered",
2118 .category = FIO_OPT_C_IO,
2119 .group = FIO_OPT_G_IO_TYPE,
2123 .lname = "Atomic I/O",
2124 .type = FIO_OPT_BOOL,
2125 .off1 = td_var_offset(oatomic),
2126 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2128 .category = FIO_OPT_C_IO,
2129 .group = FIO_OPT_G_IO_TYPE,
2133 .lname = "Buffered I/O",
2134 .type = FIO_OPT_BOOL,
2135 .off1 = td_var_offset(odirect),
2137 .help = "Use buffered IO (negates direct)",
2139 .inverse = "direct",
2140 .category = FIO_OPT_C_IO,
2141 .group = FIO_OPT_G_IO_TYPE,
2144 .name = "overwrite",
2145 .lname = "Overwrite",
2146 .type = FIO_OPT_BOOL,
2147 .off1 = td_var_offset(overwrite),
2148 .help = "When writing, set whether to overwrite current data",
2150 .category = FIO_OPT_C_FILE,
2151 .group = FIO_OPT_G_INVALID,
2156 .type = FIO_OPT_INT,
2157 .off1 = td_var_offset(loops),
2158 .help = "Number of times to run the job",
2161 .category = FIO_OPT_C_GENERAL,
2162 .group = FIO_OPT_G_RUNTIME,
2166 .lname = "Number of jobs",
2167 .type = FIO_OPT_INT,
2168 .off1 = td_var_offset(numjobs),
2169 .help = "Duplicate this job this many times",
2172 .category = FIO_OPT_C_GENERAL,
2173 .group = FIO_OPT_G_RUNTIME,
2176 .name = "startdelay",
2177 .lname = "Start delay",
2178 .type = FIO_OPT_STR_VAL_TIME,
2179 .off1 = td_var_offset(start_delay),
2180 .off2 = td_var_offset(start_delay_high),
2181 .help = "Only start job when this period has passed",
2184 .category = FIO_OPT_C_GENERAL,
2185 .group = FIO_OPT_G_RUNTIME,
2191 .type = FIO_OPT_STR_VAL_TIME,
2192 .off1 = td_var_offset(timeout),
2193 .help = "Stop workload when this amount of time has passed",
2196 .category = FIO_OPT_C_GENERAL,
2197 .group = FIO_OPT_G_RUNTIME,
2200 .name = "time_based",
2201 .lname = "Time based",
2202 .type = FIO_OPT_STR_SET,
2203 .off1 = td_var_offset(time_based),
2204 .help = "Keep running until runtime/timeout is met",
2205 .category = FIO_OPT_C_GENERAL,
2206 .group = FIO_OPT_G_RUNTIME,
2209 .name = "verify_only",
2210 .lname = "Verify only",
2211 .type = FIO_OPT_STR_SET,
2212 .off1 = td_var_offset(verify_only),
2213 .help = "Verifies previously written data is still valid",
2214 .category = FIO_OPT_C_GENERAL,
2215 .group = FIO_OPT_G_RUNTIME,
2218 .name = "ramp_time",
2219 .lname = "Ramp time",
2220 .type = FIO_OPT_STR_VAL_TIME,
2221 .off1 = td_var_offset(ramp_time),
2222 .help = "Ramp up time before measuring performance",
2224 .category = FIO_OPT_C_GENERAL,
2225 .group = FIO_OPT_G_RUNTIME,
2228 .name = "clocksource",
2229 .lname = "Clock source",
2230 .type = FIO_OPT_STR,
2231 .cb = fio_clock_source_cb,
2232 .off1 = td_var_offset(clocksource),
2233 .help = "What type of timing source to use",
2234 .category = FIO_OPT_C_GENERAL,
2235 .group = FIO_OPT_G_CLOCK,
2237 #ifdef CONFIG_GETTIMEOFDAY
2238 { .ival = "gettimeofday",
2240 .help = "Use gettimeofday(2) for timing",
2243 #ifdef CONFIG_CLOCK_GETTIME
2244 { .ival = "clock_gettime",
2245 .oval = CS_CGETTIME,
2246 .help = "Use clock_gettime(2) for timing",
2249 #ifdef ARCH_HAVE_CPU_CLOCK
2251 .oval = CS_CPUCLOCK,
2252 .help = "Use CPU private clock",
2260 .lname = "I/O Memory",
2261 .type = FIO_OPT_STR,
2263 .off1 = td_var_offset(mem_type),
2264 .help = "Backing type for IO buffers",
2266 .category = FIO_OPT_C_IO,
2267 .group = FIO_OPT_G_INVALID,
2271 .help = "Use malloc(3) for IO buffers",
2273 #ifndef CONFIG_NO_SHM
2276 .help = "Use shared memory segments for IO buffers",
2278 #ifdef FIO_HAVE_HUGETLB
2279 { .ival = "shmhuge",
2280 .oval = MEM_SHMHUGE,
2281 .help = "Like shm, but use huge pages",
2287 .help = "Use mmap(2) (file or anon) for IO buffers",
2289 #ifdef FIO_HAVE_HUGETLB
2290 { .ival = "mmaphuge",
2291 .oval = MEM_MMAPHUGE,
2292 .help = "Like mmap, but use huge pages",
2298 .name = "iomem_align",
2299 .alias = "mem_align",
2300 .lname = "I/O memory alignment",
2301 .type = FIO_OPT_INT,
2302 .off1 = td_var_offset(mem_align),
2304 .help = "IO memory buffer offset alignment",
2308 .category = FIO_OPT_C_IO,
2309 .group = FIO_OPT_G_INVALID,
2314 .type = FIO_OPT_STR,
2315 .off1 = td_var_offset(verify),
2316 .help = "Verify data written",
2318 .category = FIO_OPT_C_IO,
2319 .group = FIO_OPT_G_VERIFY,
2322 .oval = VERIFY_NONE,
2323 .help = "Don't do IO verification",
2327 .help = "Use md5 checksums for verification",
2330 .oval = VERIFY_CRC64,
2331 .help = "Use crc64 checksums for verification",
2334 .oval = VERIFY_CRC32,
2335 .help = "Use crc32 checksums for verification",
2337 { .ival = "crc32c-intel",
2338 .oval = VERIFY_CRC32C,
2339 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2342 .oval = VERIFY_CRC32C,
2343 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2346 .oval = VERIFY_CRC16,
2347 .help = "Use crc16 checksums for verification",
2350 .oval = VERIFY_CRC7,
2351 .help = "Use crc7 checksums for verification",
2354 .oval = VERIFY_SHA1,
2355 .help = "Use sha1 checksums for verification",
2358 .oval = VERIFY_SHA256,
2359 .help = "Use sha256 checksums for verification",
2362 .oval = VERIFY_SHA512,
2363 .help = "Use sha512 checksums for verification",
2366 .oval = VERIFY_XXHASH,
2367 .help = "Use xxhash checksums for verification",
2370 .oval = VERIFY_META,
2371 .help = "Use io information",
2375 .oval = VERIFY_NULL,
2376 .help = "Pretend to verify",
2381 .name = "do_verify",
2382 .lname = "Perform verify step",
2383 .type = FIO_OPT_BOOL,
2384 .off1 = td_var_offset(do_verify),
2385 .help = "Run verification stage after write",
2389 .category = FIO_OPT_C_IO,
2390 .group = FIO_OPT_G_VERIFY,
2393 .name = "verifysort",
2394 .lname = "Verify sort",
2395 .type = FIO_OPT_BOOL,
2396 .off1 = td_var_offset(verifysort),
2397 .help = "Sort written verify blocks for read back",
2401 .category = FIO_OPT_C_IO,
2402 .group = FIO_OPT_G_VERIFY,
2405 .name = "verifysort_nr",
2406 .type = FIO_OPT_INT,
2407 .off1 = td_var_offset(verifysort_nr),
2408 .help = "Pre-load and sort verify blocks for a read workload",
2413 .category = FIO_OPT_C_IO,
2414 .group = FIO_OPT_G_VERIFY,
2417 .name = "verify_interval",
2418 .lname = "Verify interval",
2419 .type = FIO_OPT_INT,
2420 .off1 = td_var_offset(verify_interval),
2421 .minval = 2 * sizeof(struct verify_header),
2422 .help = "Store verify buffer header every N bytes",
2425 .interval = 2 * sizeof(struct verify_header),
2426 .category = FIO_OPT_C_IO,
2427 .group = FIO_OPT_G_VERIFY,
2430 .name = "verify_offset",
2431 .lname = "Verify offset",
2432 .type = FIO_OPT_INT,
2433 .help = "Offset verify header location by N bytes",
2434 .off1 = td_var_offset(verify_offset),
2435 .minval = sizeof(struct verify_header),
2438 .category = FIO_OPT_C_IO,
2439 .group = FIO_OPT_G_VERIFY,
2442 .name = "verify_pattern",
2443 .lname = "Verify pattern",
2444 .type = FIO_OPT_STR,
2445 .cb = str_verify_pattern_cb,
2446 .help = "Fill pattern for IO buffers",
2449 .category = FIO_OPT_C_IO,
2450 .group = FIO_OPT_G_VERIFY,
2453 .name = "verify_fatal",
2454 .lname = "Verify fatal",
2455 .type = FIO_OPT_BOOL,
2456 .off1 = td_var_offset(verify_fatal),
2458 .help = "Exit on a single verify failure, don't continue",
2461 .category = FIO_OPT_C_IO,
2462 .group = FIO_OPT_G_VERIFY,
2465 .name = "verify_dump",
2466 .lname = "Verify dump",
2467 .type = FIO_OPT_BOOL,
2468 .off1 = td_var_offset(verify_dump),
2470 .help = "Dump contents of good and bad blocks on failure",
2473 .category = FIO_OPT_C_IO,
2474 .group = FIO_OPT_G_VERIFY,
2477 .name = "verify_async",
2478 .lname = "Verify asynchronously",
2479 .type = FIO_OPT_INT,
2480 .off1 = td_var_offset(verify_async),
2482 .help = "Number of async verifier threads to use",
2485 .category = FIO_OPT_C_IO,
2486 .group = FIO_OPT_G_VERIFY,
2489 .name = "verify_backlog",
2490 .lname = "Verify backlog",
2491 .type = FIO_OPT_STR_VAL,
2492 .off1 = td_var_offset(verify_backlog),
2493 .help = "Verify after this number of blocks are written",
2496 .category = FIO_OPT_C_IO,
2497 .group = FIO_OPT_G_VERIFY,
2500 .name = "verify_backlog_batch",
2501 .lname = "Verify backlog batch",
2502 .type = FIO_OPT_INT,
2503 .off1 = td_var_offset(verify_batch),
2504 .help = "Verify this number of IO blocks",
2507 .category = FIO_OPT_C_IO,
2508 .group = FIO_OPT_G_VERIFY,
2510 #ifdef FIO_HAVE_CPU_AFFINITY
2512 .name = "verify_async_cpus",
2513 .lname = "Async verify CPUs",
2514 .type = FIO_OPT_STR,
2515 .cb = str_verify_cpus_allowed_cb,
2516 .help = "Set CPUs allowed for async verify threads",
2517 .parent = "verify_async",
2519 .category = FIO_OPT_C_IO,
2520 .group = FIO_OPT_G_VERIFY,
2524 .name = "experimental_verify",
2525 .off1 = td_var_offset(experimental_verify),
2526 .type = FIO_OPT_BOOL,
2527 .help = "Enable experimental verification",
2528 .category = FIO_OPT_C_IO,
2529 .group = FIO_OPT_G_VERIFY,
2531 #ifdef FIO_HAVE_TRIM
2533 .name = "trim_percentage",
2534 .lname = "Trim percentage",
2535 .type = FIO_OPT_INT,
2536 .off1 = td_var_offset(trim_percentage),
2539 .help = "Number of verify blocks to discard/trim",
2544 .category = FIO_OPT_C_IO,
2545 .group = FIO_OPT_G_TRIM,
2548 .name = "trim_verify_zero",
2549 .lname = "Verify trim zero",
2550 .type = FIO_OPT_BOOL,
2551 .help = "Verify that trim/discarded blocks are returned as zeroes",
2552 .off1 = td_var_offset(trim_zero),
2553 .parent = "trim_percentage",
2556 .category = FIO_OPT_C_IO,
2557 .group = FIO_OPT_G_TRIM,
2560 .name = "trim_backlog",
2561 .lname = "Trim backlog",
2562 .type = FIO_OPT_STR_VAL,
2563 .off1 = td_var_offset(trim_backlog),
2564 .help = "Trim after this number of blocks are written",
2565 .parent = "trim_percentage",
2568 .category = FIO_OPT_C_IO,
2569 .group = FIO_OPT_G_TRIM,
2572 .name = "trim_backlog_batch",
2573 .lname = "Trim backlog batch",
2574 .type = FIO_OPT_INT,
2575 .off1 = td_var_offset(trim_batch),
2576 .help = "Trim this number of IO blocks",
2577 .parent = "trim_percentage",
2580 .category = FIO_OPT_C_IO,
2581 .group = FIO_OPT_G_TRIM,
2585 .name = "write_iolog",
2586 .lname = "Write I/O log",
2587 .type = FIO_OPT_STR_STORE,
2588 .off1 = td_var_offset(write_iolog_file),
2589 .help = "Store IO pattern to file",
2590 .category = FIO_OPT_C_IO,
2591 .group = FIO_OPT_G_IOLOG,
2594 .name = "read_iolog",
2595 .lname = "Read I/O log",
2596 .type = FIO_OPT_STR_STORE,
2597 .off1 = td_var_offset(read_iolog_file),
2598 .help = "Playback IO pattern from file",
2599 .category = FIO_OPT_C_IO,
2600 .group = FIO_OPT_G_IOLOG,
2603 .name = "replay_no_stall",
2604 .lname = "Don't stall on replay",
2605 .type = FIO_OPT_BOOL,
2606 .off1 = td_var_offset(no_stall),
2608 .parent = "read_iolog",
2610 .help = "Playback IO pattern file as fast as possible without stalls",
2611 .category = FIO_OPT_C_IO,
2612 .group = FIO_OPT_G_IOLOG,
2615 .name = "replay_redirect",
2616 .lname = "Redirect device for replay",
2617 .type = FIO_OPT_STR_STORE,
2618 .off1 = td_var_offset(replay_redirect),
2619 .parent = "read_iolog",
2621 .help = "Replay all I/O onto this device, regardless of trace device",
2622 .category = FIO_OPT_C_IO,
2623 .group = FIO_OPT_G_IOLOG,
2626 .name = "exec_prerun",
2627 .lname = "Pre-execute runnable",
2628 .type = FIO_OPT_STR_STORE,
2629 .off1 = td_var_offset(exec_prerun),
2630 .help = "Execute this file prior to running job",
2631 .category = FIO_OPT_C_GENERAL,
2632 .group = FIO_OPT_G_INVALID,
2635 .name = "exec_postrun",
2636 .lname = "Post-execute runnable",
2637 .type = FIO_OPT_STR_STORE,
2638 .off1 = td_var_offset(exec_postrun),
2639 .help = "Execute this file after running job",
2640 .category = FIO_OPT_C_GENERAL,
2641 .group = FIO_OPT_G_INVALID,
2643 #ifdef FIO_HAVE_IOSCHED_SWITCH
2645 .name = "ioscheduler",
2646 .lname = "I/O scheduler",
2647 .type = FIO_OPT_STR_STORE,
2648 .off1 = td_var_offset(ioscheduler),
2649 .help = "Use this IO scheduler on the backing device",
2650 .category = FIO_OPT_C_FILE,
2651 .group = FIO_OPT_G_INVALID,
2656 .lname = "Zone size",
2657 .type = FIO_OPT_STR_VAL,
2658 .off1 = td_var_offset(zone_size),
2659 .help = "Amount of data to read per zone",
2661 .interval = 1024 * 1024,
2662 .category = FIO_OPT_C_IO,
2663 .group = FIO_OPT_G_ZONE,
2666 .name = "zonerange",
2667 .lname = "Zone range",
2668 .type = FIO_OPT_STR_VAL,
2669 .off1 = td_var_offset(zone_range),
2670 .help = "Give size of an IO zone",
2672 .interval = 1024 * 1024,
2673 .category = FIO_OPT_C_IO,
2674 .group = FIO_OPT_G_ZONE,
2678 .lname = "Zone skip",
2679 .type = FIO_OPT_STR_VAL,
2680 .off1 = td_var_offset(zone_skip),
2681 .help = "Space between IO zones",
2683 .interval = 1024 * 1024,
2684 .category = FIO_OPT_C_IO,
2685 .group = FIO_OPT_G_ZONE,
2689 .lname = "Lock memory",
2690 .type = FIO_OPT_STR_VAL,
2691 .off1 = td_var_offset(lockmem),
2692 .help = "Lock down this amount of memory (per worker)",
2694 .interval = 1024 * 1024,
2695 .category = FIO_OPT_C_GENERAL,
2696 .group = FIO_OPT_G_INVALID,
2699 .name = "rwmixread",
2700 .lname = "Read/write mix read",
2701 .type = FIO_OPT_INT,
2702 .cb = str_rwmix_read_cb,
2704 .help = "Percentage of mixed workload that is reads",
2707 .inverse = "rwmixwrite",
2708 .category = FIO_OPT_C_IO,
2709 .group = FIO_OPT_G_RWMIX,
2712 .name = "rwmixwrite",
2713 .lname = "Read/write mix write",
2714 .type = FIO_OPT_INT,
2715 .cb = str_rwmix_write_cb,
2717 .help = "Percentage of mixed workload that is writes",
2720 .inverse = "rwmixread",
2721 .category = FIO_OPT_C_IO,
2722 .group = FIO_OPT_G_RWMIX,
2725 .name = "rwmixcycle",
2726 .lname = "Read/write mix cycle",
2727 .type = FIO_OPT_DEPRECATED,
2728 .category = FIO_OPT_C_IO,
2729 .group = FIO_OPT_G_RWMIX,
2734 .type = FIO_OPT_INT,
2735 .off1 = td_var_offset(nice),
2736 .help = "Set job CPU nice value",
2741 .category = FIO_OPT_C_GENERAL,
2742 .group = FIO_OPT_G_CRED,
2744 #ifdef FIO_HAVE_IOPRIO
2747 .lname = "I/O nice priority",
2748 .type = FIO_OPT_INT,
2749 .off1 = td_var_offset(ioprio),
2750 .help = "Set job IO priority value",
2754 .category = FIO_OPT_C_GENERAL,
2755 .group = FIO_OPT_G_CRED,
2758 .name = "prioclass",
2759 .lname = "I/O nice priority class",
2760 .type = FIO_OPT_INT,
2761 .off1 = td_var_offset(ioprio_class),
2762 .help = "Set job IO priority class",
2766 .category = FIO_OPT_C_GENERAL,
2767 .group = FIO_OPT_G_CRED,
2771 .name = "thinktime",
2772 .lname = "Thinktime",
2773 .type = FIO_OPT_INT,
2774 .off1 = td_var_offset(thinktime),
2775 .help = "Idle time between IO buffers (usec)",
2777 .category = FIO_OPT_C_IO,
2778 .group = FIO_OPT_G_THINKTIME,
2781 .name = "thinktime_spin",
2782 .lname = "Thinktime spin",
2783 .type = FIO_OPT_INT,
2784 .off1 = td_var_offset(thinktime_spin),
2785 .help = "Start think time by spinning this amount (usec)",
2787 .parent = "thinktime",
2789 .category = FIO_OPT_C_IO,
2790 .group = FIO_OPT_G_THINKTIME,
2793 .name = "thinktime_blocks",
2794 .lname = "Thinktime blocks",
2795 .type = FIO_OPT_INT,
2796 .off1 = td_var_offset(thinktime_blocks),
2797 .help = "IO buffer period between 'thinktime'",
2799 .parent = "thinktime",
2801 .category = FIO_OPT_C_IO,
2802 .group = FIO_OPT_G_THINKTIME,
2806 .lname = "I/O rate",
2807 .type = FIO_OPT_INT,
2808 .off1 = td_var_offset(rate[DDIR_READ]),
2809 .off2 = td_var_offset(rate[DDIR_WRITE]),
2810 .off3 = td_var_offset(rate[DDIR_TRIM]),
2811 .help = "Set bandwidth rate",
2812 .category = FIO_OPT_C_IO,
2813 .group = FIO_OPT_G_RATE,
2817 .lname = "I/O min rate",
2818 .type = FIO_OPT_INT,
2819 .off1 = td_var_offset(ratemin[DDIR_READ]),
2820 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2821 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2822 .help = "Job must meet this rate or it will be shutdown",
2825 .category = FIO_OPT_C_IO,
2826 .group = FIO_OPT_G_RATE,
2829 .name = "rate_iops",
2830 .lname = "I/O rate IOPS",
2831 .type = FIO_OPT_INT,
2832 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2833 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2834 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2835 .help = "Limit IO used to this number of IO operations/sec",
2837 .category = FIO_OPT_C_IO,
2838 .group = FIO_OPT_G_RATE,
2841 .name = "rate_iops_min",
2842 .lname = "I/O min rate IOPS",
2843 .type = FIO_OPT_INT,
2844 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2845 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2846 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2847 .help = "Job must meet this rate or it will be shut down",
2848 .parent = "rate_iops",
2850 .category = FIO_OPT_C_IO,
2851 .group = FIO_OPT_G_RATE,
2854 .name = "ratecycle",
2855 .lname = "I/O rate cycle",
2856 .type = FIO_OPT_INT,
2857 .off1 = td_var_offset(ratecycle),
2858 .help = "Window average for rate limits (msec)",
2862 .category = FIO_OPT_C_IO,
2863 .group = FIO_OPT_G_RATE,
2866 .name = "max_latency",
2867 .type = FIO_OPT_INT,
2868 .off1 = td_var_offset(max_latency),
2869 .help = "Maximum tolerated IO latency (usec)",
2870 .category = FIO_OPT_C_IO,
2871 .group = FIO_OPT_G_LATPROF,
2874 .name = "latency_target",
2875 .lname = "Latency Target (usec)",
2876 .type = FIO_OPT_STR_VAL_TIME,
2877 .off1 = td_var_offset(latency_target),
2878 .help = "Ramp to max queue depth supporting this latency",
2879 .category = FIO_OPT_C_IO,
2880 .group = FIO_OPT_G_LATPROF,
2883 .name = "latency_window",
2884 .lname = "Latency Window (usec)",
2885 .type = FIO_OPT_STR_VAL_TIME,
2886 .off1 = td_var_offset(latency_window),
2887 .help = "Time to sustain latency_target",
2888 .category = FIO_OPT_C_IO,
2889 .group = FIO_OPT_G_LATPROF,
2892 .name = "latency_percentile",
2893 .lname = "Latency Percentile",
2894 .type = FIO_OPT_FLOAT_LIST,
2895 .off1 = td_var_offset(latency_percentile),
2896 .help = "Percentile of IOs must be below latency_target",
2901 .category = FIO_OPT_C_IO,
2902 .group = FIO_OPT_G_LATPROF,
2905 .name = "invalidate",
2906 .lname = "Cache invalidate",
2907 .type = FIO_OPT_BOOL,
2908 .off1 = td_var_offset(invalidate_cache),
2909 .help = "Invalidate buffer/page cache prior to running job",
2911 .category = FIO_OPT_C_IO,
2912 .group = FIO_OPT_G_IO_TYPE,
2916 .lname = "Synchronous I/O",
2917 .type = FIO_OPT_BOOL,
2918 .off1 = td_var_offset(sync_io),
2919 .help = "Use O_SYNC for buffered writes",
2921 .parent = "buffered",
2923 .category = FIO_OPT_C_IO,
2924 .group = FIO_OPT_G_IO_TYPE,
2927 .name = "create_serialize",
2928 .lname = "Create serialize",
2929 .type = FIO_OPT_BOOL,
2930 .off1 = td_var_offset(create_serialize),
2931 .help = "Serialize creating of job files",
2933 .category = FIO_OPT_C_FILE,
2934 .group = FIO_OPT_G_INVALID,
2937 .name = "create_fsync",
2938 .lname = "Create fsync",
2939 .type = FIO_OPT_BOOL,
2940 .off1 = td_var_offset(create_fsync),
2941 .help = "fsync file after creation",
2943 .category = FIO_OPT_C_FILE,
2944 .group = FIO_OPT_G_INVALID,
2947 .name = "create_on_open",
2948 .lname = "Create on open",
2949 .type = FIO_OPT_BOOL,
2950 .off1 = td_var_offset(create_on_open),
2951 .help = "Create files when they are opened for IO",
2953 .category = FIO_OPT_C_FILE,
2954 .group = FIO_OPT_G_INVALID,
2957 .name = "create_only",
2958 .type = FIO_OPT_BOOL,
2959 .off1 = td_var_offset(create_only),
2960 .help = "Only perform file creation phase",
2961 .category = FIO_OPT_C_FILE,
2966 .lname = "Pre-read files",
2967 .type = FIO_OPT_BOOL,
2968 .off1 = td_var_offset(pre_read),
2969 .help = "Pre-read files before starting official testing",
2971 .category = FIO_OPT_C_FILE,
2972 .group = FIO_OPT_G_INVALID,
2974 #ifdef FIO_HAVE_CPU_AFFINITY
2977 .lname = "CPU mask",
2978 .type = FIO_OPT_INT,
2979 .cb = str_cpumask_cb,
2980 .help = "CPU affinity mask",
2981 .category = FIO_OPT_C_GENERAL,
2982 .group = FIO_OPT_G_CRED,
2985 .name = "cpus_allowed",
2986 .lname = "CPUs allowed",
2987 .type = FIO_OPT_STR,
2988 .cb = str_cpus_allowed_cb,
2989 .help = "Set CPUs allowed",
2990 .category = FIO_OPT_C_GENERAL,
2991 .group = FIO_OPT_G_CRED,
2994 .name = "cpus_allowed_policy",
2995 .lname = "CPUs allowed distribution policy",
2996 .type = FIO_OPT_STR,
2997 .off1 = td_var_offset(cpus_allowed_policy),
2998 .help = "Distribution policy for cpus_allowed",
2999 .parent = "cpus_allowed",
3003 .oval = FIO_CPUS_SHARED,
3004 .help = "Mask shared between threads",
3007 .oval = FIO_CPUS_SPLIT,
3008 .help = "Mask split between threads",
3011 .category = FIO_OPT_C_GENERAL,
3012 .group = FIO_OPT_G_CRED,
3015 #ifdef CONFIG_LIBNUMA
3017 .name = "numa_cpu_nodes",
3018 .type = FIO_OPT_STR,
3019 .cb = str_numa_cpunodes_cb,
3020 .help = "NUMA CPU nodes bind",
3021 .category = FIO_OPT_C_GENERAL,
3022 .group = FIO_OPT_G_INVALID,
3025 .name = "numa_mem_policy",
3026 .type = FIO_OPT_STR,
3027 .cb = str_numa_mpol_cb,
3028 .help = "NUMA memory policy setup",
3029 .category = FIO_OPT_C_GENERAL,
3030 .group = FIO_OPT_G_INVALID,
3034 .name = "end_fsync",
3035 .lname = "End fsync",
3036 .type = FIO_OPT_BOOL,
3037 .off1 = td_var_offset(end_fsync),
3038 .help = "Include fsync at the end of job",
3040 .category = FIO_OPT_C_FILE,
3041 .group = FIO_OPT_G_INVALID,
3044 .name = "fsync_on_close",
3045 .lname = "Fsync on close",
3046 .type = FIO_OPT_BOOL,
3047 .off1 = td_var_offset(fsync_on_close),
3048 .help = "fsync files on close",
3050 .category = FIO_OPT_C_FILE,
3051 .group = FIO_OPT_G_INVALID,
3055 .lname = "Unlink file",
3056 .type = FIO_OPT_BOOL,
3057 .off1 = td_var_offset(unlink),
3058 .help = "Unlink created files after job has completed",
3060 .category = FIO_OPT_C_FILE,
3061 .group = FIO_OPT_G_INVALID,
3065 .lname = "Exit-all on terminate",
3066 .type = FIO_OPT_STR_SET,
3067 .cb = str_exitall_cb,
3068 .help = "Terminate all jobs when one exits",
3069 .category = FIO_OPT_C_GENERAL,
3070 .group = FIO_OPT_G_PROCESS,
3073 .name = "stonewall",
3074 .lname = "Wait for previous",
3075 .alias = "wait_for_previous",
3076 .type = FIO_OPT_STR_SET,
3077 .off1 = td_var_offset(stonewall),
3078 .help = "Insert a hard barrier between this job and previous",
3079 .category = FIO_OPT_C_GENERAL,
3080 .group = FIO_OPT_G_PROCESS,
3083 .name = "new_group",
3084 .lname = "New group",
3085 .type = FIO_OPT_STR_SET,
3086 .off1 = td_var_offset(new_group),
3087 .help = "Mark the start of a new group (for reporting)",
3088 .category = FIO_OPT_C_GENERAL,
3089 .group = FIO_OPT_G_PROCESS,
3094 .type = FIO_OPT_STR_SET,
3095 .off1 = td_var_offset(use_thread),
3096 .help = "Use threads instead of processes",
3097 #ifdef CONFIG_NO_SHM
3101 .category = FIO_OPT_C_GENERAL,
3102 .group = FIO_OPT_G_PROCESS,
3105 .name = "write_bw_log",
3106 .lname = "Write bandwidth log",
3107 .type = FIO_OPT_STR_STORE,
3108 .off1 = td_var_offset(bw_log_file),
3109 .help = "Write log of bandwidth during run",
3110 .category = FIO_OPT_C_LOG,
3111 .group = FIO_OPT_G_INVALID,
3114 .name = "write_lat_log",
3115 .lname = "Write latency log",
3116 .type = FIO_OPT_STR_STORE,
3117 .off1 = td_var_offset(lat_log_file),
3118 .help = "Write log of latency during run",
3119 .category = FIO_OPT_C_LOG,
3120 .group = FIO_OPT_G_INVALID,
3123 .name = "write_iops_log",
3124 .lname = "Write IOPS log",
3125 .type = FIO_OPT_STR_STORE,
3126 .off1 = td_var_offset(iops_log_file),
3127 .help = "Write log of IOPS during run",
3128 .category = FIO_OPT_C_LOG,
3129 .group = FIO_OPT_G_INVALID,
3132 .name = "log_avg_msec",
3133 .lname = "Log averaging (msec)",
3134 .type = FIO_OPT_INT,
3135 .off1 = td_var_offset(log_avg_msec),
3136 .help = "Average bw/iops/lat logs over this period of time",
3138 .category = FIO_OPT_C_LOG,
3139 .group = FIO_OPT_G_INVALID,
3142 .name = "log_offset",
3143 .lname = "Log offset of IO",
3144 .type = FIO_OPT_BOOL,
3145 .off1 = td_var_offset(log_offset),
3146 .help = "Include offset of IO for each log entry",
3148 .category = FIO_OPT_C_LOG,
3149 .group = FIO_OPT_G_INVALID,
3153 .name = "log_compression",
3154 .lname = "Log compression",
3155 .type = FIO_OPT_INT,
3156 .off1 = td_var_offset(log_gz),
3157 .help = "Log in compressed chunks of this size",
3158 .minval = 32 * 1024 * 1024ULL,
3159 .maxval = 512 * 1024 * 1024ULL,
3160 .category = FIO_OPT_C_LOG,
3161 .group = FIO_OPT_G_INVALID,
3164 .name = "log_store_compressed",
3165 .lname = "Log store compressed",
3166 .type = FIO_OPT_BOOL,
3167 .off1 = td_var_offset(log_gz_store),
3168 .help = "Store logs in a compressed format",
3169 .category = FIO_OPT_C_LOG,
3170 .group = FIO_OPT_G_INVALID,
3174 .name = "bwavgtime",
3175 .lname = "Bandwidth average time",
3176 .type = FIO_OPT_INT,
3177 .off1 = td_var_offset(bw_avg_time),
3178 .help = "Time window over which to calculate bandwidth"
3181 .parent = "write_bw_log",
3184 .category = FIO_OPT_C_LOG,
3185 .group = FIO_OPT_G_INVALID,
3188 .name = "iopsavgtime",
3189 .lname = "IOPS average time",
3190 .type = FIO_OPT_INT,
3191 .off1 = td_var_offset(iops_avg_time),
3192 .help = "Time window over which to calculate IOPS (msec)",
3194 .parent = "write_iops_log",
3197 .category = FIO_OPT_C_LOG,
3198 .group = FIO_OPT_G_INVALID,
3201 .name = "group_reporting",
3202 .lname = "Group reporting",
3203 .type = FIO_OPT_STR_SET,
3204 .off1 = td_var_offset(group_reporting),
3205 .help = "Do reporting on a per-group basis",
3206 .category = FIO_OPT_C_STAT,
3207 .group = FIO_OPT_G_INVALID,
3210 .name = "zero_buffers",
3211 .lname = "Zero I/O buffers",
3212 .type = FIO_OPT_STR_SET,
3213 .off1 = td_var_offset(zero_buffers),
3214 .help = "Init IO buffers to all zeroes",
3215 .category = FIO_OPT_C_IO,
3216 .group = FIO_OPT_G_IO_BUF,
3219 .name = "refill_buffers",
3220 .lname = "Refill I/O buffers",
3221 .type = FIO_OPT_STR_SET,
3222 .off1 = td_var_offset(refill_buffers),
3223 .help = "Refill IO buffers on every IO submit",
3224 .category = FIO_OPT_C_IO,
3225 .group = FIO_OPT_G_IO_BUF,
3228 .name = "scramble_buffers",
3229 .lname = "Scramble I/O buffers",
3230 .type = FIO_OPT_BOOL,
3231 .off1 = td_var_offset(scramble_buffers),
3232 .help = "Slightly scramble buffers on every IO submit",
3234 .category = FIO_OPT_C_IO,
3235 .group = FIO_OPT_G_IO_BUF,
3238 .name = "buffer_pattern",
3239 .lname = "Buffer pattern",
3240 .type = FIO_OPT_STR,
3241 .cb = str_buffer_pattern_cb,
3242 .help = "Fill pattern for IO buffers",
3243 .category = FIO_OPT_C_IO,
3244 .group = FIO_OPT_G_IO_BUF,
3247 .name = "buffer_compress_percentage",
3248 .lname = "Buffer compression percentage",
3249 .type = FIO_OPT_INT,
3250 .cb = str_buffer_compress_cb,
3253 .help = "How compressible the buffer is (approximately)",
3255 .category = FIO_OPT_C_IO,
3256 .group = FIO_OPT_G_IO_BUF,
3259 .name = "buffer_compress_chunk",
3260 .lname = "Buffer compression chunk size",
3261 .type = FIO_OPT_INT,
3262 .off1 = td_var_offset(compress_chunk),
3263 .parent = "buffer_compress_percentage",
3265 .help = "Size of compressible region in buffer",
3267 .category = FIO_OPT_C_IO,
3268 .group = FIO_OPT_G_IO_BUF,
3271 .name = "dedupe_percentage",
3272 .lname = "Dedupe percentage",
3273 .type = FIO_OPT_INT,
3274 .cb = str_dedupe_cb,
3277 .help = "Percentage of buffers that are dedupable",
3279 .category = FIO_OPT_C_IO,
3280 .group = FIO_OPT_G_IO_BUF,
3283 .name = "clat_percentiles",
3284 .lname = "Completion latency percentiles",
3285 .type = FIO_OPT_BOOL,
3286 .off1 = td_var_offset(clat_percentiles),
3287 .help = "Enable the reporting of completion latency percentiles",
3289 .category = FIO_OPT_C_STAT,
3290 .group = FIO_OPT_G_INVALID,
3293 .name = "percentile_list",
3294 .lname = "Completion latency percentile list",
3295 .type = FIO_OPT_FLOAT_LIST,
3296 .off1 = td_var_offset(percentile_list),
3297 .off2 = td_var_offset(percentile_precision),
3298 .help = "Specify a custom list of percentiles to report",
3299 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3300 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3303 .category = FIO_OPT_C_STAT,
3304 .group = FIO_OPT_G_INVALID,
3307 #ifdef FIO_HAVE_DISK_UTIL
3309 .name = "disk_util",
3310 .lname = "Disk utilization",
3311 .type = FIO_OPT_BOOL,
3312 .off1 = td_var_offset(do_disk_util),
3313 .help = "Log disk utilization statistics",
3315 .category = FIO_OPT_C_STAT,
3316 .group = FIO_OPT_G_INVALID,
3320 .name = "gtod_reduce",
3321 .lname = "Reduce gettimeofday() calls",
3322 .type = FIO_OPT_BOOL,
3323 .help = "Greatly reduce number of gettimeofday() calls",
3324 .cb = str_gtod_reduce_cb,
3327 .category = FIO_OPT_C_STAT,
3328 .group = FIO_OPT_G_INVALID,
3331 .name = "disable_lat",
3332 .lname = "Disable all latency stats",
3333 .type = FIO_OPT_BOOL,
3334 .off1 = td_var_offset(disable_lat),
3335 .help = "Disable latency numbers",
3336 .parent = "gtod_reduce",
3339 .category = FIO_OPT_C_STAT,
3340 .group = FIO_OPT_G_INVALID,
3343 .name = "disable_clat",
3344 .lname = "Disable completion latency stats",
3345 .type = FIO_OPT_BOOL,
3346 .off1 = td_var_offset(disable_clat),
3347 .help = "Disable completion latency numbers",
3348 .parent = "gtod_reduce",
3351 .category = FIO_OPT_C_STAT,
3352 .group = FIO_OPT_G_INVALID,
3355 .name = "disable_slat",
3356 .lname = "Disable submission latency stats",
3357 .type = FIO_OPT_BOOL,
3358 .off1 = td_var_offset(disable_slat),
3359 .help = "Disable submission latency numbers",
3360 .parent = "gtod_reduce",
3363 .category = FIO_OPT_C_STAT,
3364 .group = FIO_OPT_G_INVALID,
3367 .name = "disable_bw_measurement",
3368 .lname = "Disable bandwidth stats",
3369 .type = FIO_OPT_BOOL,
3370 .off1 = td_var_offset(disable_bw),
3371 .help = "Disable bandwidth logging",
3372 .parent = "gtod_reduce",
3375 .category = FIO_OPT_C_STAT,
3376 .group = FIO_OPT_G_INVALID,
3380 .lname = "Dedicated gettimeofday() CPU",
3381 .type = FIO_OPT_INT,
3382 .cb = str_gtod_cpu_cb,
3383 .help = "Set up dedicated gettimeofday() thread on this CPU",
3384 .verify = gtod_cpu_verify,
3385 .category = FIO_OPT_C_GENERAL,
3386 .group = FIO_OPT_G_CLOCK,
3389 .name = "unified_rw_reporting",
3390 .type = FIO_OPT_BOOL,
3391 .off1 = td_var_offset(unified_rw_rep),
3392 .help = "Unify reporting across data direction",
3394 .category = FIO_OPT_C_GENERAL,
3395 .group = FIO_OPT_G_INVALID,
3398 .name = "continue_on_error",
3399 .lname = "Continue on error",
3400 .type = FIO_OPT_STR,
3401 .off1 = td_var_offset(continue_on_error),
3402 .help = "Continue on non-fatal errors during IO",
3404 .category = FIO_OPT_C_GENERAL,
3405 .group = FIO_OPT_G_ERR,
3408 .oval = ERROR_TYPE_NONE,
3409 .help = "Exit when an error is encountered",
3412 .oval = ERROR_TYPE_READ,
3413 .help = "Continue on read errors only",
3416 .oval = ERROR_TYPE_WRITE,
3417 .help = "Continue on write errors only",
3420 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3421 .help = "Continue on any IO errors",
3424 .oval = ERROR_TYPE_VERIFY,
3425 .help = "Continue on verify errors only",
3428 .oval = ERROR_TYPE_ANY,
3429 .help = "Continue on all io and verify errors",
3432 .oval = ERROR_TYPE_NONE,
3433 .help = "Alias for 'none'",
3436 .oval = ERROR_TYPE_ANY,
3437 .help = "Alias for 'all'",
3442 .name = "ignore_error",
3443 .type = FIO_OPT_STR,
3444 .cb = str_ignore_error_cb,
3445 .help = "Set a specific list of errors to ignore",
3447 .category = FIO_OPT_C_GENERAL,
3448 .group = FIO_OPT_G_ERR,
3451 .name = "error_dump",
3452 .type = FIO_OPT_BOOL,
3453 .off1 = td_var_offset(error_dump),
3455 .help = "Dump info on each error",
3456 .category = FIO_OPT_C_GENERAL,
3457 .group = FIO_OPT_G_ERR,
3462 .type = FIO_OPT_STR_STORE,
3463 .off1 = td_var_offset(profile),
3464 .help = "Select a specific builtin performance test",
3465 .category = FIO_OPT_C_PROFILE,
3466 .group = FIO_OPT_G_INVALID,
3471 .type = FIO_OPT_STR_STORE,
3472 .off1 = td_var_offset(cgroup),
3473 .help = "Add job to cgroup of this name",
3474 .category = FIO_OPT_C_GENERAL,
3475 .group = FIO_OPT_G_CGROUP,
3478 .name = "cgroup_nodelete",
3479 .lname = "Cgroup no-delete",
3480 .type = FIO_OPT_BOOL,
3481 .off1 = td_var_offset(cgroup_nodelete),
3482 .help = "Do not delete cgroups after job completion",
3485 .category = FIO_OPT_C_GENERAL,
3486 .group = FIO_OPT_G_CGROUP,
3489 .name = "cgroup_weight",
3490 .lname = "Cgroup weight",
3491 .type = FIO_OPT_INT,
3492 .off1 = td_var_offset(cgroup_weight),
3493 .help = "Use given weight for cgroup",
3497 .category = FIO_OPT_C_GENERAL,
3498 .group = FIO_OPT_G_CGROUP,
3503 .type = FIO_OPT_INT,
3504 .off1 = td_var_offset(uid),
3505 .help = "Run job with this user ID",
3506 .category = FIO_OPT_C_GENERAL,
3507 .group = FIO_OPT_G_CRED,
3511 .lname = "Group ID",
3512 .type = FIO_OPT_INT,
3513 .off1 = td_var_offset(gid),
3514 .help = "Run job with this group ID",
3515 .category = FIO_OPT_C_GENERAL,
3516 .group = FIO_OPT_G_CRED,
3521 .type = FIO_OPT_INT,
3522 .off1 = td_var_offset(kb_base),
3528 .help = "Use 1024 as the K base",
3532 .help = "Use 1000 as the K base",
3535 .help = "How many bytes per KB for reporting (1000 or 1024)",
3536 .category = FIO_OPT_C_GENERAL,
3537 .group = FIO_OPT_G_INVALID,
3540 .name = "unit_base",
3541 .lname = "Base unit for reporting (Bits or Bytes)",
3542 .type = FIO_OPT_INT,
3543 .off1 = td_var_offset(unit_base),
3548 .help = "Auto-detect",
3552 .help = "Normal (byte based)",
3556 .help = "Bit based",
3559 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3560 .category = FIO_OPT_C_GENERAL,
3561 .group = FIO_OPT_G_INVALID,
3564 .name = "hugepage-size",
3565 .lname = "Hugepage size",
3566 .type = FIO_OPT_INT,
3567 .off1 = td_var_offset(hugepage_size),
3568 .help = "When using hugepages, specify size of each page",
3569 .def = __fio_stringify(FIO_HUGE_PAGE),
3570 .interval = 1024 * 1024,
3571 .category = FIO_OPT_C_GENERAL,
3572 .group = FIO_OPT_G_INVALID,
3576 .lname = "I/O flow ID",
3577 .type = FIO_OPT_INT,
3578 .off1 = td_var_offset(flow_id),
3579 .help = "The flow index ID to use",
3581 .category = FIO_OPT_C_IO,
3582 .group = FIO_OPT_G_IO_FLOW,
3586 .lname = "I/O flow weight",
3587 .type = FIO_OPT_INT,
3588 .off1 = td_var_offset(flow),
3589 .help = "Weight for flow control of this job",
3590 .parent = "flow_id",
3593 .category = FIO_OPT_C_IO,
3594 .group = FIO_OPT_G_IO_FLOW,
3597 .name = "flow_watermark",
3598 .lname = "I/O flow watermark",
3599 .type = FIO_OPT_INT,
3600 .off1 = td_var_offset(flow_watermark),
3601 .help = "High watermark for flow control. This option"
3602 " should be set to the same value for all threads"
3603 " with non-zero flow.",
3604 .parent = "flow_id",
3607 .category = FIO_OPT_C_IO,
3608 .group = FIO_OPT_G_IO_FLOW,
3611 .name = "flow_sleep",
3612 .lname = "I/O flow sleep",
3613 .type = FIO_OPT_INT,
3614 .off1 = td_var_offset(flow_sleep),
3615 .help = "How many microseconds to sleep after being held"
3616 " back by the flow control mechanism",
3617 .parent = "flow_id",
3620 .category = FIO_OPT_C_IO,
3621 .group = FIO_OPT_G_IO_FLOW,
3628 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3629 const char *name, int val)
3631 lopt->name = (char *) name;
3633 if (o->type == FIO_OPT_STR_SET)
3634 lopt->has_arg = optional_argument;
3636 lopt->has_arg = required_argument;
3639 static void options_to_lopts(struct fio_option *opts,
3640 struct option *long_options,
3641 int i, int option_type)
3643 struct fio_option *o = &opts[0];
3645 add_to_lopt(&long_options[i], o, o->name, option_type);
3648 add_to_lopt(&long_options[i], o, o->alias, option_type);
3653 assert(i < FIO_NR_OPTIONS);
3657 void fio_options_set_ioengine_opts(struct option *long_options,
3658 struct thread_data *td)
3663 while (long_options[i].name) {
3664 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3665 memset(&long_options[i], 0, sizeof(*long_options));
3672 * Just clear out the prior ioengine options.
3677 options_to_lopts(td->io_ops->options, long_options, i,
3678 FIO_GETOPT_IOENGINE);
3681 void fio_options_dup_and_init(struct option *long_options)
3685 options_init(fio_options);
3688 while (long_options[i].name)
3691 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3694 struct fio_keyword {
3700 static struct fio_keyword fio_keywords[] = {
3702 .word = "$pagesize",
3703 .desc = "Page size in the system",
3706 .word = "$mb_memory",
3707 .desc = "Megabytes of memory online",
3711 .desc = "Number of CPUs online in the system",
3718 void fio_keywords_init(void)
3720 unsigned long long mb_memory;
3724 sprintf(buf, "%lu", (unsigned long) page_size);
3725 fio_keywords[0].replace = strdup(buf);
3727 mb_memory = os_phys_mem() / (1024 * 1024);
3728 sprintf(buf, "%llu", mb_memory);
3729 fio_keywords[1].replace = strdup(buf);
3732 sprintf(buf, "%lu", l);
3733 fio_keywords[2].replace = strdup(buf);
3738 static char *bc_calc(char *str)
3740 char buf[128], *tmp;
3745 * No math, just return string
3747 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3748 !strchr(str, '/')) || strchr(str, '\''))
3752 * Split option from value, we only need to calculate the value
3754 tmp = strchr(str, '=');
3761 * Prevent buffer overflows; such a case isn't reasonable anyway
3763 if (strlen(str) >= 128 || strlen(tmp) > 100)
3766 sprintf(buf, "which %s > /dev/null", BC_APP);
3768 log_err("fio: bc is needed for performing math\n");
3772 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3773 f = popen(buf, "r");
3777 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3784 buf[(tmp - str) + ret - 1] = '\0';
3785 memcpy(buf, str, tmp - str);
3791 * Return a copy of the input string with substrings of the form ${VARNAME}
3792 * substituted with the value of the environment variable VARNAME. The
3793 * substitution always occurs, even if VARNAME is empty or the corresponding
3794 * environment variable undefined.
3796 static char *option_dup_subs(const char *opt)
3798 char out[OPT_LEN_MAX+1];
3799 char in[OPT_LEN_MAX+1];
3802 char *ch1, *ch2, *env;
3803 ssize_t nchr = OPT_LEN_MAX;
3806 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3807 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3811 in[OPT_LEN_MAX] = '\0';
3812 strncpy(in, opt, OPT_LEN_MAX);
3814 while (*inptr && nchr > 0) {
3815 if (inptr[0] == '$' && inptr[1] == '{') {
3816 ch2 = strchr(inptr, '}');
3817 if (ch2 && inptr+1 < ch2) {
3824 envlen = strlen(env);
3825 if (envlen <= nchr) {
3826 memcpy(outptr, env, envlen);
3836 *outptr++ = *inptr++;
3845 * Look for reserved variable names and replace them with real values
3847 static char *fio_keyword_replace(char *opt)
3853 for (i = 0; fio_keywords[i].word != NULL; i++) {
3854 struct fio_keyword *kw = &fio_keywords[i];
3856 while ((s = strstr(opt, kw->word)) != NULL) {
3857 char *new = malloc(strlen(opt) + 1);
3863 * Copy part of the string before the keyword and
3864 * sprintf() the replacement after it.
3866 memcpy(new, opt, olen);
3867 len = sprintf(new + olen, "%s", kw->replace);
3870 * If there's more in the original string, copy that
3873 opt += strlen(kw->word) + olen;
3875 memcpy(new + olen + len, opt, opt - o_org - 1);
3878 * replace opt and free the old opt
3888 * Check for potential math and invoke bc, if possible
3896 static char **dup_and_sub_options(char **opts, int num_opts)
3899 char **opts_copy = malloc(num_opts * sizeof(*opts));
3900 for (i = 0; i < num_opts; i++) {
3901 opts_copy[i] = option_dup_subs(opts[i]);
3904 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3909 int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3912 int i, ret, unknown;
3915 sort_options(opts, fio_options, num_opts);
3916 opts_copy = dup_and_sub_options(opts, num_opts);
3918 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3919 struct fio_option *o;
3920 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3921 &o, td, dump_cmdline);
3929 opts_copy[i] = NULL;
3936 ret |= ioengine_load(td);
3938 sort_options(opts_copy, td->io_ops->options, num_opts);
3941 for (i = 0; i < num_opts; i++) {
3942 struct fio_option *o = NULL;
3948 newret = parse_option(opts_copy[i], opts[i],
3949 td->io_ops->options, &o,
3950 td->eo, dump_cmdline);
3954 log_err("Bad option <%s>\n", opts[i]);
3957 opts_copy[i] = NULL;
3965 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3967 return parse_cmd_option(opt, val, fio_options, td);
3970 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3973 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
3976 void fio_fill_default_options(struct thread_data *td)
3978 td->o.magic = OPT_MAGIC;
3979 fill_default_options(td, fio_options);
3982 int fio_show_option_help(const char *opt)
3984 return show_cmd_help(fio_options, opt);
3987 void options_mem_dupe(void *data, struct fio_option *options)
3989 struct fio_option *o;
3992 for (o = &options[0]; o->name; o++) {
3993 if (o->type != FIO_OPT_STR_STORE)
3996 ptr = td_var(data, o, o->off1);
3998 *ptr = strdup(*ptr);
4003 * dupe FIO_OPT_STR_STORE options
4005 void fio_options_mem_dupe(struct thread_data *td)
4007 options_mem_dupe(&td->o, fio_options);
4009 if (td->eo && td->io_ops) {
4010 void *oldeo = td->eo;
4012 td->eo = malloc(td->io_ops->option_struct_size);
4013 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
4014 options_mem_dupe(td->eo, td->io_ops->options);
4018 unsigned int fio_get_kb_base(void *data)
4020 struct thread_options *o = data;
4021 unsigned int kb_base = 0;
4024 * This is a hack... For private options, *data is not holding
4025 * a pointer to the thread_options, but to private data. This means
4026 * we can't safely dereference it, but magic is first so mem wise
4027 * it is valid. But this also means that if the job first sets
4028 * kb_base and expects that to be honored by private options,
4029 * it will be disappointed. We will return the global default
4032 if (o && o->magic == OPT_MAGIC)
4033 kb_base = o->kb_base;
4040 int add_option(struct fio_option *o)
4042 struct fio_option *__o;
4051 if (opt_index + 1 == FIO_MAX_OPTS) {
4052 log_err("fio: FIO_MAX_OPTS is too small\n");
4056 memcpy(&fio_options[opt_index], o, sizeof(*o));
4057 fio_options[opt_index + 1].name = NULL;
4061 void invalidate_profile_options(const char *prof_name)
4063 struct fio_option *o;
4067 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
4068 o->type = FIO_OPT_INVALID;
4069 o->prof_name = NULL;
4075 void add_opt_posval(const char *optname, const char *ival, const char *help)
4077 struct fio_option *o;
4080 o = find_option(fio_options, optname);
4084 for (i = 0; i < PARSE_MAX_VP; i++) {
4085 if (o->posval[i].ival)
4088 o->posval[i].ival = ival;
4089 o->posval[i].help = help;
4094 void del_opt_posval(const char *optname, const char *ival)
4096 struct fio_option *o;
4099 o = find_option(fio_options, optname);
4103 for (i = 0; i < PARSE_MAX_VP; i++) {
4104 if (!o->posval[i].ival)
4106 if (strcmp(o->posval[i].ival, ival))
4109 o->posval[i].ival = NULL;
4110 o->posval[i].help = NULL;
4114 void fio_options_free(struct thread_data *td)
4116 options_free(fio_options, td);
4117 if (td->eo && td->io_ops && td->io_ops->options) {
4118 options_free(td->io_ops->options, td->eo);
4124 struct fio_option *fio_option_find(const char *name)
4126 return find_option(fio_options, name);