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 == (unsigned char) -1)
136 if (perc > 100 && perc_missing > 1) {
137 log_err("fio: bssplit percentages add to more than 100%%\n");
142 * If values didn't have a percentage set, divide the remains between
146 if (perc_missing == 1)
148 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
149 struct bssplit *bsp = &bssplit[i];
151 if (bsp->perc == (unsigned char) -1)
152 bsp->perc = (100 - perc) / perc_missing;
156 o->min_bs[ddir] = min_bs;
157 o->max_bs[ddir] = max_bs;
160 * now sort based on percentages, for ease of lookup
162 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
163 o->bssplit[ddir] = bssplit;
167 static int str_bssplit_cb(void *data, const char *input)
169 struct thread_data *td = data;
170 char *str, *p, *odir, *ddir;
176 p = str = strdup(input);
178 strip_blank_front(&str);
179 strip_blank_end(str);
181 odir = strchr(str, ',');
183 ddir = strchr(odir + 1, ',');
185 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
191 op = strdup(odir + 1);
192 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
197 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
200 ret = bssplit_ddir(&td->o, DDIR_READ, str);
206 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
211 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
214 ret = bssplit_ddir(&td->o, DDIR_READ, str);
221 static int str2error(char *str)
223 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
224 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
225 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
226 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
227 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
228 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
229 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
230 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
231 int i = 0, num = sizeof(err) / sizeof(void *);
234 if (!strcmp(err[i], str))
241 static int ignore_error_type(struct thread_data *td, int etype, char *str)
247 if (etype >= ERROR_TYPE_CNT) {
248 log_err("Illegal error type\n");
252 td->o.ignore_error_nr[etype] = 4;
253 error = malloc(4 * sizeof(struct bssplit));
256 while ((fname = strsep(&str, ":")) != NULL) {
262 * grow struct buffer, if needed
264 if (i == td->o.ignore_error_nr[etype]) {
265 td->o.ignore_error_nr[etype] <<= 1;
266 error = realloc(error, td->o.ignore_error_nr[etype]
269 if (fname[0] == 'E') {
270 error[i] = str2error(fname);
272 error[i] = atoi(fname);
274 error[i] = -error[i];
277 log_err("Unknown error %s, please use number value \n",
285 td->o.continue_on_error |= 1 << etype;
286 td->o.ignore_error_nr[etype] = i;
287 td->o.ignore_error[etype] = error;
295 static int str_ignore_error_cb(void *data, const char *input)
297 struct thread_data *td = data;
299 int type = 0, ret = 1;
304 p = str = strdup(input);
306 strip_blank_front(&str);
307 strip_blank_end(str);
313 ret = ignore_error_type(td, type, p);
323 static int str_rw_cb(void *data, const char *str)
325 struct thread_data *td = data;
326 struct thread_options *o = &td->o;
335 nr = get_opt_postfix(str);
340 o->ddir_seq_nr = atoi(nr);
344 if (str_to_decimal(nr, &val, 1, o, 0)) {
345 log_err("fio: rw postfix parsing failed\n");
350 o->ddir_seq_add = val;
357 static int str_mem_cb(void *data, const char *mem)
359 struct thread_data *td = data;
361 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
362 td->o.mmapfile = get_opt_postfix(mem);
367 static int fio_clock_source_cb(void *data, const char *str)
369 struct thread_data *td = data;
371 fio_clock_source = td->o.clocksource;
372 fio_clock_source_set = 1;
377 static int str_rwmix_read_cb(void *data, unsigned long long *val)
379 struct thread_data *td = data;
381 td->o.rwmix[DDIR_READ] = *val;
382 td->o.rwmix[DDIR_WRITE] = 100 - *val;
386 static int str_rwmix_write_cb(void *data, unsigned long long *val)
388 struct thread_data *td = data;
390 td->o.rwmix[DDIR_WRITE] = *val;
391 td->o.rwmix[DDIR_READ] = 100 - *val;
395 static int str_exitall_cb(void)
397 exitall_on_terminate = 1;
401 #ifdef FIO_HAVE_CPU_AFFINITY
402 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
404 unsigned int i, index, cpus_in_mask;
405 const long max_cpu = cpus_online();
407 cpus_in_mask = fio_cpu_count(mask);
408 cpu_index = cpu_index % cpus_in_mask;
411 for (i = 0; i < max_cpu; i++) {
412 if (!fio_cpu_isset(mask, i))
415 if (cpu_index != index)
416 fio_cpu_clear(mask, i);
421 return fio_cpu_count(mask);
424 static int str_cpumask_cb(void *data, unsigned long long *val)
426 struct thread_data *td = data;
434 ret = fio_cpuset_init(&td->o.cpumask);
436 log_err("fio: cpuset_init failed\n");
437 td_verror(td, ret, "fio_cpuset_init");
441 max_cpu = cpus_online();
443 for (i = 0; i < sizeof(int) * 8; i++) {
444 if ((1 << i) & *val) {
446 log_err("fio: CPU %d too large (max=%ld)\n", i,
450 dprint(FD_PARSE, "set cpu allowed %d\n", i);
451 fio_cpu_set(&td->o.cpumask, i);
455 td->o.cpumask_set = 1;
459 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
466 ret = fio_cpuset_init(mask);
468 log_err("fio: cpuset_init failed\n");
469 td_verror(td, ret, "fio_cpuset_init");
473 p = str = strdup(input);
475 strip_blank_front(&str);
476 strip_blank_end(str);
478 max_cpu = cpus_online();
480 while ((cpu = strsep(&str, ",")) != NULL) {
489 while ((cpu2 = strsep(&str2, "-")) != NULL) {
499 while (icpu <= icpu2) {
500 if (icpu >= FIO_MAX_CPUS) {
501 log_err("fio: your OS only supports up to"
502 " %d CPUs\n", (int) FIO_MAX_CPUS);
506 if (icpu > max_cpu) {
507 log_err("fio: CPU %d too large (max=%ld)\n",
513 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
514 fio_cpu_set(mask, icpu);
523 td->o.cpumask_set = 1;
527 static int str_cpus_allowed_cb(void *data, const char *input)
529 struct thread_data *td = data;
535 ret = set_cpus_allowed(td, &td->o.cpumask, input);
537 td->o.cpumask_set = 1;
542 static int str_verify_cpus_allowed_cb(void *data, const char *input)
544 struct thread_data *td = data;
547 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
549 td->o.verify_cpumask_set = 1;
555 #ifdef CONFIG_LIBNUMA
556 static int str_numa_cpunodes_cb(void *data, char *input)
558 struct thread_data *td = data;
559 struct bitmask *verify_bitmask;
564 /* numa_parse_nodestring() parses a character string list
565 * of nodes into a bit mask. The bit mask is allocated by
566 * numa_allocate_nodemask(), so it should be freed by
567 * numa_free_nodemask().
569 verify_bitmask = numa_parse_nodestring(input);
570 if (verify_bitmask == NULL) {
571 log_err("fio: numa_parse_nodestring failed\n");
572 td_verror(td, 1, "str_numa_cpunodes_cb");
575 numa_free_nodemask(verify_bitmask);
577 td->o.numa_cpunodes = strdup(input);
578 td->o.numa_cpumask_set = 1;
582 static int str_numa_mpol_cb(void *data, char *input)
584 struct thread_data *td = data;
585 const char * const policy_types[] =
586 { "default", "prefer", "bind", "interleave", "local", NULL };
589 struct bitmask *verify_bitmask;
594 nodelist = strchr(input, ':');
596 /* NUL-terminate mode */
600 for (i = 0; i <= MPOL_LOCAL; i++) {
601 if (!strcmp(input, policy_types[i])) {
602 td->o.numa_mem_mode = i;
606 if (i > MPOL_LOCAL) {
607 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
611 switch (td->o.numa_mem_mode) {
614 * Insist on a nodelist of one node only
617 char *rest = nodelist;
618 while (isdigit(*rest))
621 log_err("fio: one node only for \'prefer\'\n");
625 log_err("fio: one node is needed for \'prefer\'\n");
629 case MPOL_INTERLEAVE:
631 * Default to online nodes with memory if no nodelist
634 nodelist = strdup("all");
639 * Don't allow a nodelist
642 log_err("fio: NO nodelist for \'local\'\n");
648 * Insist on a nodelist
651 log_err("fio: a nodelist is needed for \'bind\'\n");
658 /* numa_parse_nodestring() parses a character string list
659 * of nodes into a bit mask. The bit mask is allocated by
660 * numa_allocate_nodemask(), so it should be freed by
661 * numa_free_nodemask().
663 switch (td->o.numa_mem_mode) {
665 td->o.numa_mem_prefer_node = atoi(nodelist);
667 case MPOL_INTERLEAVE:
669 verify_bitmask = numa_parse_nodestring(nodelist);
670 if (verify_bitmask == NULL) {
671 log_err("fio: numa_parse_nodestring failed\n");
672 td_verror(td, 1, "str_numa_memnodes_cb");
675 td->o.numa_memnodes = strdup(nodelist);
676 numa_free_nodemask(verify_bitmask);
685 td->o.numa_memmask_set = 1;
693 static int str_fst_cb(void *data, const char *str)
695 struct thread_data *td = data;
696 char *nr = get_opt_postfix(str);
698 td->file_service_nr = 1;
700 td->file_service_nr = atoi(nr);
707 #ifdef CONFIG_SYNC_FILE_RANGE
708 static int str_sfr_cb(void *data, const char *str)
710 struct thread_data *td = data;
711 char *nr = get_opt_postfix(str);
713 td->sync_file_range_nr = 1;
715 td->sync_file_range_nr = atoi(nr);
723 static int str_random_distribution_cb(void *data, const char *str)
725 struct thread_data *td = data;
732 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
734 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
739 nr = get_opt_postfix(str);
740 if (nr && !str_to_float(nr, &val)) {
741 log_err("fio: random postfix parsing failed\n");
748 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
750 log_err("fio: zipf theta must different than 1.0\n");
753 td->o.zipf_theta.u.f = val;
755 if (val <= 0.00 || val >= 1.00) {
756 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
759 td->o.pareto_h.u.f = val;
766 * Return next name in the string. Files are separated with ':'. If the ':'
767 * is escaped with a '\', then that ':' is part of the filename and does not
768 * indicate a new file.
770 static char *get_next_name(char **ptr)
775 if (!str || !strlen(str))
781 * No colon, we are done
783 p = strchr(str, ':');
790 * We got a colon, but it's the first character. Skip and
798 if (*(p - 1) != '\\') {
804 memmove(p - 1, p, strlen(p) + 1);
812 static int get_max_name_idx(char *input)
814 unsigned int cur_idx;
817 p = str = strdup(input);
818 for (cur_idx = 0; ; cur_idx++)
819 if (get_next_name(&str) == NULL)
827 * Returns the directory at the index, indexes > entires will be
828 * assigned via modulo division of the index
830 int set_name_idx(char *target, char *input, int index)
832 unsigned int cur_idx;
834 char *fname, *str, *p;
836 p = str = strdup(input);
838 index %= get_max_name_idx(input);
839 for (cur_idx = 0; cur_idx <= index; cur_idx++)
840 fname = get_next_name(&str);
842 len = sprintf(target, "%s/", fname);
848 static int str_filename_cb(void *data, const char *input)
850 struct thread_data *td = data;
851 char *fname, *str, *p;
853 p = str = strdup(input);
855 strip_blank_front(&str);
856 strip_blank_end(str);
858 if (!td->files_index)
861 while ((fname = get_next_name(&str)) != NULL) {
864 add_file(td, fname, 0, 1);
871 static int str_directory_cb(void *data, const char fio_unused *unused)
873 struct thread_data *td = data;
875 char *dirname, *str, *p;
881 p = str = strdup(td->o.directory);
882 while ((dirname = get_next_name(&str)) != NULL) {
883 if (lstat(dirname, &sb) < 0) {
886 log_err("fio: %s is not a directory\n", dirname);
887 td_verror(td, ret, "lstat");
890 if (!S_ISDIR(sb.st_mode)) {
891 log_err("fio: %s is not a directory\n", dirname);
902 static int str_lockfile_cb(void *data, const char fio_unused *str)
904 struct thread_data *td = data;
906 if (td->files_index) {
907 log_err("fio: lockfile= option must precede filename=\n");
914 static int str_opendir_cb(void *data, const char fio_unused *str)
916 struct thread_data *td = data;
921 if (!td->files_index)
924 return add_dir_files(td, td->o.opendir);
927 static int pattern_cb(char *pattern, unsigned int max_size,
928 const char *input, unsigned int *pattern_bytes)
931 int i = 0, j = 0, len, k, base = 10;
932 uint32_t pattern_length;
936 * Check if it's a string input
938 loc1 = strchr(input, '\"');
942 if (*loc1 == '\0' || *loc1 == '\"')
947 } while (i < max_size);
956 * No string, find out if it's decimal or hexidecimal
958 loc1 = strstr(input, "0x");
959 loc2 = strstr(input, "0X");
962 off = strtol(input, NULL, base);
963 if (off != LONG_MAX || errno != ERANGE) {
965 pattern[i] = off & 0xff;
974 j = loc1 - input + 2;
976 j = loc2 - input + 2;
979 if (len - j < max_size * 2) {
981 off = converthexchartoint(input[k--]);
983 off += (converthexchartoint(input[k--])
985 pattern[i++] = (char) off;
991 * Fill the pattern all the way to the end. This greatly reduces
992 * the number of memcpy's we have to do when verifying the IO.
996 while (i > 1 && i * 2 <= max_size) {
997 memcpy(&pattern[i], &pattern[0], i);
1002 * Fill remainder, if the pattern multiple ends up not being
1005 while (i > 1 && i < max_size) {
1006 unsigned int b = min(pattern_length, max_size - i);
1008 memcpy(&pattern[i], &pattern[0], b);
1014 * The code in verify_io_u_pattern assumes a single byte
1015 * pattern fills the whole verify pattern buffer.
1017 memset(pattern, pattern[0], max_size);
1024 static int str_buffer_pattern_cb(void *data, const char *input)
1026 struct thread_data *td = data;
1029 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
1030 &td->o.buffer_pattern_bytes);
1032 if (!ret && td->o.buffer_pattern_bytes) {
1033 td->o.refill_buffers = 0;
1034 td->o.scramble_buffers = 0;
1035 td->o.zero_buffers = 0;
1037 log_err("fio: failed parsing pattern `%s`\n", input);
1044 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1046 struct thread_data *td = data;
1048 td->flags |= TD_F_COMPRESS;
1049 td->o.compress_percentage = *il;
1053 static int str_verify_pattern_cb(void *data, const char *input)
1055 struct thread_data *td = data;
1058 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1059 &td->o.verify_pattern_bytes);
1062 * VERIFY_META could already be set
1064 if (!ret && td->o.verify == VERIFY_NONE)
1065 td->o.verify = VERIFY_PATTERN;
1070 static int str_gtod_reduce_cb(void *data, int *il)
1072 struct thread_data *td = data;
1075 td->o.disable_lat = !!val;
1076 td->o.disable_clat = !!val;
1077 td->o.disable_slat = !!val;
1078 td->o.disable_bw = !!val;
1079 td->o.clat_percentiles = !val;
1081 td->tv_cache_mask = 63;
1086 static int str_gtod_cpu_cb(void *data, long long *il)
1088 struct thread_data *td = data;
1091 td->o.gtod_cpu = val;
1092 td->o.gtod_offload = 1;
1096 static int str_size_cb(void *data, unsigned long long *__val)
1098 struct thread_data *td = data;
1099 unsigned long long v = *__val;
1101 if (parse_is_percent(v)) {
1103 td->o.size_percent = -1ULL - v;
1110 static int rw_verify(struct fio_option *o, void *data)
1112 struct thread_data *td = data;
1114 if (read_only && td_write(td)) {
1115 log_err("fio: job <%s> has write bit set, but fio is in"
1116 " read-only mode\n", td->o.name);
1123 static int gtod_cpu_verify(struct fio_option *o, void *data)
1125 #ifndef FIO_HAVE_CPU_AFFINITY
1126 struct thread_data *td = data;
1128 if (td->o.gtod_cpu) {
1129 log_err("fio: platform must support CPU affinity for"
1130 "gettimeofday() offloading\n");
1141 static struct opt_group fio_opt_groups[] = {
1144 .mask = FIO_OPT_C_GENERAL,
1148 .mask = FIO_OPT_C_IO,
1152 .mask = FIO_OPT_C_FILE,
1155 .name = "Statistics",
1156 .mask = FIO_OPT_C_STAT,
1160 .mask = FIO_OPT_C_LOG,
1164 .mask = FIO_OPT_C_PROFILE,
1171 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1172 unsigned int inv_mask)
1174 struct opt_group *og;
1177 if (*mask == inv_mask || !*mask)
1180 for (i = 0; ogs[i].name; i++) {
1183 if (*mask & og->mask) {
1184 *mask &= ~(og->mask);
1192 struct opt_group *opt_group_from_mask(unsigned int *mask)
1194 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1197 static struct opt_group fio_opt_cat_groups[] = {
1199 .name = "Latency profiling",
1200 .mask = FIO_OPT_G_LATPROF,
1204 .mask = FIO_OPT_G_RATE,
1208 .mask = FIO_OPT_G_ZONE,
1211 .name = "Read/write mix",
1212 .mask = FIO_OPT_G_RWMIX,
1216 .mask = FIO_OPT_G_VERIFY,
1220 .mask = FIO_OPT_G_TRIM,
1223 .name = "I/O Logging",
1224 .mask = FIO_OPT_G_IOLOG,
1227 .name = "I/O Depth",
1228 .mask = FIO_OPT_G_IO_DEPTH,
1232 .mask = FIO_OPT_G_IO_FLOW,
1235 .name = "Description",
1236 .mask = FIO_OPT_G_DESC,
1240 .mask = FIO_OPT_G_FILENAME,
1243 .name = "General I/O",
1244 .mask = FIO_OPT_G_IO_BASIC,
1248 .mask = FIO_OPT_G_CGROUP,
1252 .mask = FIO_OPT_G_RUNTIME,
1256 .mask = FIO_OPT_G_PROCESS,
1259 .name = "Job credentials / priority",
1260 .mask = FIO_OPT_G_CRED,
1263 .name = "Clock settings",
1264 .mask = FIO_OPT_G_CLOCK,
1268 .mask = FIO_OPT_G_IO_TYPE,
1271 .name = "I/O Thinktime",
1272 .mask = FIO_OPT_G_THINKTIME,
1275 .name = "Randomizations",
1276 .mask = FIO_OPT_G_RANDOM,
1279 .name = "I/O buffers",
1280 .mask = FIO_OPT_G_IO_BUF,
1283 .name = "Tiobench profile",
1284 .mask = FIO_OPT_G_TIOBENCH,
1292 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1294 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1298 * Map of job/command line options
1300 struct fio_option fio_options[FIO_MAX_OPTS] = {
1302 .name = "description",
1303 .lname = "Description of job",
1304 .type = FIO_OPT_STR_STORE,
1305 .off1 = td_var_offset(description),
1306 .help = "Text job description",
1307 .category = FIO_OPT_C_GENERAL,
1308 .group = FIO_OPT_G_DESC,
1312 .lname = "Job name",
1313 .type = FIO_OPT_STR_STORE,
1314 .off1 = td_var_offset(name),
1315 .help = "Name of this job",
1316 .category = FIO_OPT_C_GENERAL,
1317 .group = FIO_OPT_G_DESC,
1321 .lname = "Filename(s)",
1322 .type = FIO_OPT_STR_STORE,
1323 .off1 = td_var_offset(filename),
1324 .cb = str_filename_cb,
1325 .prio = -1, /* must come after "directory" */
1326 .help = "File(s) to use for the workload",
1327 .category = FIO_OPT_C_FILE,
1328 .group = FIO_OPT_G_FILENAME,
1331 .name = "directory",
1332 .lname = "Directory",
1333 .type = FIO_OPT_STR_STORE,
1334 .off1 = td_var_offset(directory),
1335 .cb = str_directory_cb,
1336 .help = "Directory to store files in",
1337 .category = FIO_OPT_C_FILE,
1338 .group = FIO_OPT_G_FILENAME,
1341 .name = "filename_format",
1342 .type = FIO_OPT_STR_STORE,
1343 .off1 = td_var_offset(filename_format),
1344 .prio = -1, /* must come after "directory" */
1345 .help = "Override default $jobname.$jobnum.$filenum naming",
1346 .def = "$jobname.$jobnum.$filenum",
1347 .category = FIO_OPT_C_FILE,
1348 .group = FIO_OPT_G_FILENAME,
1352 .lname = "Lockfile",
1353 .type = FIO_OPT_STR,
1354 .off1 = td_var_offset(file_lock_mode),
1355 .help = "Lock file when doing IO to it",
1357 .parent = "filename",
1360 .cb = str_lockfile_cb,
1361 .category = FIO_OPT_C_FILE,
1362 .group = FIO_OPT_G_FILENAME,
1365 .oval = FILE_LOCK_NONE,
1366 .help = "No file locking",
1368 { .ival = "exclusive",
1369 .oval = FILE_LOCK_EXCLUSIVE,
1370 .help = "Exclusive file lock",
1373 .ival = "readwrite",
1374 .oval = FILE_LOCK_READWRITE,
1375 .help = "Read vs write lock",
1381 .lname = "Open directory",
1382 .type = FIO_OPT_STR_STORE,
1383 .off1 = td_var_offset(opendir),
1384 .cb = str_opendir_cb,
1385 .help = "Recursively add files from this directory and down",
1386 .category = FIO_OPT_C_FILE,
1387 .group = FIO_OPT_G_FILENAME,
1391 .lname = "Read/write",
1392 .alias = "readwrite",
1393 .type = FIO_OPT_STR,
1395 .off1 = td_var_offset(td_ddir),
1396 .help = "IO direction",
1398 .verify = rw_verify,
1399 .category = FIO_OPT_C_IO,
1400 .group = FIO_OPT_G_IO_BASIC,
1403 .oval = TD_DDIR_READ,
1404 .help = "Sequential read",
1407 .oval = TD_DDIR_WRITE,
1408 .help = "Sequential write",
1411 .oval = TD_DDIR_TRIM,
1412 .help = "Sequential trim",
1414 { .ival = "randread",
1415 .oval = TD_DDIR_RANDREAD,
1416 .help = "Random read",
1418 { .ival = "randwrite",
1419 .oval = TD_DDIR_RANDWRITE,
1420 .help = "Random write",
1422 { .ival = "randtrim",
1423 .oval = TD_DDIR_RANDTRIM,
1424 .help = "Random trim",
1428 .help = "Sequential read and write mix",
1430 { .ival = "readwrite",
1432 .help = "Sequential read and write mix",
1435 .oval = TD_DDIR_RANDRW,
1436 .help = "Random read and write mix"
1441 .name = "rw_sequencer",
1442 .lname = "RW Sequencer",
1443 .type = FIO_OPT_STR,
1444 .off1 = td_var_offset(rw_seq),
1445 .help = "IO offset generator modifier",
1446 .def = "sequential",
1447 .category = FIO_OPT_C_IO,
1448 .group = FIO_OPT_G_IO_BASIC,
1450 { .ival = "sequential",
1452 .help = "Generate sequential offsets",
1454 { .ival = "identical",
1455 .oval = RW_SEQ_IDENT,
1456 .help = "Generate identical offsets",
1463 .lname = "IO Engine",
1464 .type = FIO_OPT_STR_STORE,
1465 .off1 = td_var_offset(ioengine),
1466 .help = "IO engine to use",
1467 .def = FIO_PREFERRED_ENGINE,
1468 .category = FIO_OPT_C_IO,
1469 .group = FIO_OPT_G_IO_BASIC,
1472 .help = "Use read/write",
1475 .help = "Use pread/pwrite",
1478 .help = "Use readv/writev",
1480 #ifdef CONFIG_PWRITEV
1482 .help = "Use preadv/pwritev",
1485 #ifdef CONFIG_LIBAIO
1487 .help = "Linux native asynchronous IO",
1490 #ifdef CONFIG_POSIXAIO
1491 { .ival = "posixaio",
1492 .help = "POSIX asynchronous IO",
1495 #ifdef CONFIG_SOLARISAIO
1496 { .ival = "solarisaio",
1497 .help = "Solaris native asynchronous IO",
1500 #ifdef CONFIG_WINDOWSAIO
1501 { .ival = "windowsaio",
1502 .help = "Windows native asynchronous IO"
1507 .help = "Rados Block Device asynchronous IO"
1511 .help = "Memory mapped IO"
1513 #ifdef CONFIG_LINUX_SPLICE
1515 .help = "splice/vmsplice based IO",
1517 { .ival = "netsplice",
1518 .help = "splice/vmsplice to/from the network",
1521 #ifdef FIO_HAVE_SGIO
1523 .help = "SCSI generic v3 IO",
1527 .help = "Testing engine (no data transfer)",
1530 .help = "Network IO",
1533 .help = "CPU cycle burner engine",
1537 .help = "GUASI IO engine",
1540 #ifdef FIO_HAVE_BINJECT
1541 { .ival = "binject",
1542 .help = "binject direct inject block engine",
1547 .help = "RDMA IO engine",
1550 #ifdef CONFIG_FUSION_AW
1551 { .ival = "fusion-aw-sync",
1552 .help = "Fusion-io atomic write engine",
1555 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1556 { .ival = "e4defrag",
1557 .help = "ext4 defrag engine",
1560 #ifdef CONFIG_LINUX_FALLOCATE
1562 .help = "fallocate() file based engine",
1567 .help = "Glusterfs libgfapi(sync) based engine"
1569 { .ival = "gfapi_async",
1570 .help = "Glusterfs libgfapi(async) based engine"
1573 #ifdef CONFIG_LIBHDFS
1574 { .ival = "libhdfs",
1575 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1578 { .ival = "external",
1579 .help = "Load external engine (append name)",
1585 .lname = "IO Depth",
1586 .type = FIO_OPT_INT,
1587 .off1 = td_var_offset(iodepth),
1588 .help = "Number of IO buffers to keep in flight",
1592 .category = FIO_OPT_C_IO,
1593 .group = FIO_OPT_G_IO_BASIC,
1596 .name = "iodepth_batch",
1597 .lname = "IO Depth batch",
1598 .alias = "iodepth_batch_submit",
1599 .type = FIO_OPT_INT,
1600 .off1 = td_var_offset(iodepth_batch),
1601 .help = "Number of IO buffers to submit in one go",
1602 .parent = "iodepth",
1607 .category = FIO_OPT_C_IO,
1608 .group = FIO_OPT_G_IO_BASIC,
1611 .name = "iodepth_batch_complete",
1612 .lname = "IO Depth batch complete",
1613 .type = FIO_OPT_INT,
1614 .off1 = td_var_offset(iodepth_batch_complete),
1615 .help = "Number of IO buffers to retrieve in one go",
1616 .parent = "iodepth",
1621 .category = FIO_OPT_C_IO,
1622 .group = FIO_OPT_G_IO_BASIC,
1625 .name = "iodepth_low",
1626 .lname = "IO Depth batch low",
1627 .type = FIO_OPT_INT,
1628 .off1 = td_var_offset(iodepth_low),
1629 .help = "Low water mark for queuing depth",
1630 .parent = "iodepth",
1633 .category = FIO_OPT_C_IO,
1634 .group = FIO_OPT_G_IO_BASIC,
1639 .type = FIO_OPT_STR_VAL,
1641 .help = "Total size of device or files",
1642 .interval = 1024 * 1024,
1643 .category = FIO_OPT_C_IO,
1644 .group = FIO_OPT_G_INVALID,
1648 .lname = "IO Limit",
1649 .type = FIO_OPT_STR_VAL,
1650 .off1 = td_var_offset(io_limit),
1651 .interval = 1024 * 1024,
1652 .category = FIO_OPT_C_IO,
1653 .group = FIO_OPT_G_INVALID,
1656 .name = "fill_device",
1657 .lname = "Fill device",
1659 .type = FIO_OPT_BOOL,
1660 .off1 = td_var_offset(fill_device),
1661 .help = "Write until an ENOSPC error occurs",
1663 .category = FIO_OPT_C_FILE,
1664 .group = FIO_OPT_G_INVALID,
1668 .lname = "File size",
1669 .type = FIO_OPT_STR_VAL,
1670 .off1 = td_var_offset(file_size_low),
1671 .off2 = td_var_offset(file_size_high),
1673 .help = "Size of individual files",
1674 .interval = 1024 * 1024,
1675 .category = FIO_OPT_C_FILE,
1676 .group = FIO_OPT_G_INVALID,
1679 .name = "file_append",
1680 .lname = "File append",
1681 .type = FIO_OPT_BOOL,
1682 .off1 = td_var_offset(file_append),
1683 .help = "IO will start at the end of the file(s)",
1685 .category = FIO_OPT_C_FILE,
1686 .group = FIO_OPT_G_INVALID,
1690 .lname = "IO offset",
1691 .alias = "fileoffset",
1692 .type = FIO_OPT_STR_VAL,
1693 .off1 = td_var_offset(start_offset),
1694 .help = "Start IO from this offset",
1696 .interval = 1024 * 1024,
1697 .category = FIO_OPT_C_IO,
1698 .group = FIO_OPT_G_INVALID,
1701 .name = "offset_increment",
1702 .lname = "IO offset increment",
1703 .type = FIO_OPT_STR_VAL,
1704 .off1 = td_var_offset(offset_increment),
1705 .help = "What is the increment from one offset to the next",
1709 .interval = 1024 * 1024,
1710 .category = FIO_OPT_C_IO,
1711 .group = FIO_OPT_G_INVALID,
1714 .name = "number_ios",
1715 .lname = "Number of IOs to perform",
1716 .type = FIO_OPT_STR_VAL,
1717 .off1 = td_var_offset(number_ios),
1718 .help = "Force job completion of this number of IOs",
1720 .category = FIO_OPT_C_IO,
1721 .group = FIO_OPT_G_INVALID,
1725 .lname = "Block size",
1726 .alias = "blocksize",
1727 .type = FIO_OPT_INT,
1728 .off1 = td_var_offset(bs[DDIR_READ]),
1729 .off2 = td_var_offset(bs[DDIR_WRITE]),
1730 .off3 = td_var_offset(bs[DDIR_TRIM]),
1732 .help = "Block size unit",
1737 .category = FIO_OPT_C_IO,
1738 .group = FIO_OPT_G_INVALID,
1742 .lname = "Block size align",
1743 .alias = "blockalign",
1744 .type = FIO_OPT_INT,
1745 .off1 = td_var_offset(ba[DDIR_READ]),
1746 .off2 = td_var_offset(ba[DDIR_WRITE]),
1747 .off3 = td_var_offset(ba[DDIR_TRIM]),
1749 .help = "IO block offset alignment",
1753 .category = FIO_OPT_C_IO,
1754 .group = FIO_OPT_G_INVALID,
1758 .lname = "Block size range",
1759 .alias = "blocksize_range",
1760 .type = FIO_OPT_RANGE,
1761 .off1 = td_var_offset(min_bs[DDIR_READ]),
1762 .off2 = td_var_offset(max_bs[DDIR_READ]),
1763 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1764 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1765 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1766 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1768 .help = "Set block size range (in more detail than bs)",
1772 .category = FIO_OPT_C_IO,
1773 .group = FIO_OPT_G_INVALID,
1777 .lname = "Block size split",
1778 .type = FIO_OPT_STR,
1779 .cb = str_bssplit_cb,
1780 .help = "Set a specific mix of block sizes",
1783 .category = FIO_OPT_C_IO,
1784 .group = FIO_OPT_G_INVALID,
1787 .name = "bs_unaligned",
1788 .lname = "Block size unaligned",
1789 .alias = "blocksize_unaligned",
1790 .type = FIO_OPT_STR_SET,
1791 .off1 = td_var_offset(bs_unaligned),
1792 .help = "Don't sector align IO buffer sizes",
1795 .category = FIO_OPT_C_IO,
1796 .group = FIO_OPT_G_INVALID,
1799 .name = "bs_is_seq_rand",
1800 .lname = "Block size division is seq/random (not read/write)",
1801 .type = FIO_OPT_BOOL,
1802 .off1 = td_var_offset(bs_is_seq_rand),
1803 .help = "Consider any blocksize setting to be sequential,ramdom",
1805 .parent = "blocksize",
1806 .category = FIO_OPT_C_IO,
1807 .group = FIO_OPT_G_INVALID,
1810 .name = "randrepeat",
1811 .lname = "Random repeatable",
1812 .type = FIO_OPT_BOOL,
1813 .off1 = td_var_offset(rand_repeatable),
1814 .help = "Use repeatable random IO pattern",
1818 .category = FIO_OPT_C_IO,
1819 .group = FIO_OPT_G_RANDOM,
1823 .lname = "The random generator seed",
1824 .type = FIO_OPT_STR_VAL,
1825 .off1 = td_var_offset(rand_seed),
1826 .help = "Set the random generator seed value",
1828 .category = FIO_OPT_C_IO,
1829 .group = FIO_OPT_G_RANDOM,
1832 .name = "use_os_rand",
1833 .lname = "Use OS random",
1834 .type = FIO_OPT_BOOL,
1835 .off1 = td_var_offset(use_os_rand),
1836 .help = "Set to use OS random generator",
1840 .category = FIO_OPT_C_IO,
1841 .group = FIO_OPT_G_RANDOM,
1844 .name = "norandommap",
1845 .lname = "No randommap",
1846 .type = FIO_OPT_STR_SET,
1847 .off1 = td_var_offset(norandommap),
1848 .help = "Accept potential duplicate random blocks",
1852 .category = FIO_OPT_C_IO,
1853 .group = FIO_OPT_G_RANDOM,
1856 .name = "softrandommap",
1857 .lname = "Soft randommap",
1858 .type = FIO_OPT_BOOL,
1859 .off1 = td_var_offset(softrandommap),
1860 .help = "Set norandommap if randommap allocation fails",
1861 .parent = "norandommap",
1864 .category = FIO_OPT_C_IO,
1865 .group = FIO_OPT_G_RANDOM,
1868 .name = "random_generator",
1869 .type = FIO_OPT_STR,
1870 .off1 = td_var_offset(random_generator),
1871 .help = "Type of random number generator to use",
1872 .def = "tausworthe",
1874 { .ival = "tausworthe",
1875 .oval = FIO_RAND_GEN_TAUSWORTHE,
1876 .help = "Strong Tausworthe generator",
1879 .oval = FIO_RAND_GEN_LFSR,
1880 .help = "Variable length LFSR",
1883 .category = FIO_OPT_C_IO,
1884 .group = FIO_OPT_G_RANDOM,
1887 .name = "random_distribution",
1888 .type = FIO_OPT_STR,
1889 .off1 = td_var_offset(random_distribution),
1890 .cb = str_random_distribution_cb,
1891 .help = "Random offset distribution generator",
1895 .oval = FIO_RAND_DIST_RANDOM,
1896 .help = "Completely random",
1899 .oval = FIO_RAND_DIST_ZIPF,
1900 .help = "Zipf distribution",
1903 .oval = FIO_RAND_DIST_PARETO,
1904 .help = "Pareto distribution",
1907 .category = FIO_OPT_C_IO,
1908 .group = FIO_OPT_G_RANDOM,
1911 .name = "percentage_random",
1912 .lname = "Percentage Random",
1913 .type = FIO_OPT_INT,
1914 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1915 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1916 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1918 .help = "Percentage of seq/random mix that should be random",
1919 .def = "100,100,100",
1921 .inverse = "percentage_sequential",
1922 .category = FIO_OPT_C_IO,
1923 .group = FIO_OPT_G_RANDOM,
1926 .name = "percentage_sequential",
1927 .lname = "Percentage Sequential",
1928 .type = FIO_OPT_DEPRECATED,
1929 .category = FIO_OPT_C_IO,
1930 .group = FIO_OPT_G_RANDOM,
1933 .name = "allrandrepeat",
1934 .type = FIO_OPT_BOOL,
1935 .off1 = td_var_offset(allrand_repeatable),
1936 .help = "Use repeatable random numbers for everything",
1938 .category = FIO_OPT_C_IO,
1939 .group = FIO_OPT_G_RANDOM,
1943 .lname = "Number of files",
1944 .alias = "nr_files",
1945 .type = FIO_OPT_INT,
1946 .off1 = td_var_offset(nr_files),
1947 .help = "Split job workload between this number of files",
1950 .category = FIO_OPT_C_FILE,
1951 .group = FIO_OPT_G_INVALID,
1954 .name = "openfiles",
1955 .lname = "Number of open files",
1956 .type = FIO_OPT_INT,
1957 .off1 = td_var_offset(open_files),
1958 .help = "Number of files to keep open at the same time",
1959 .category = FIO_OPT_C_FILE,
1960 .group = FIO_OPT_G_INVALID,
1963 .name = "file_service_type",
1964 .lname = "File service type",
1965 .type = FIO_OPT_STR,
1967 .off1 = td_var_offset(file_service_type),
1968 .help = "How to select which file to service next",
1969 .def = "roundrobin",
1970 .category = FIO_OPT_C_FILE,
1971 .group = FIO_OPT_G_INVALID,
1974 .oval = FIO_FSERVICE_RANDOM,
1975 .help = "Choose a file at random",
1977 { .ival = "roundrobin",
1978 .oval = FIO_FSERVICE_RR,
1979 .help = "Round robin select files",
1981 { .ival = "sequential",
1982 .oval = FIO_FSERVICE_SEQ,
1983 .help = "Finish one file before moving to the next",
1986 .parent = "nrfiles",
1989 #ifdef CONFIG_POSIX_FALLOCATE
1991 .name = "fallocate",
1992 .lname = "Fallocate",
1993 .type = FIO_OPT_STR,
1994 .off1 = td_var_offset(fallocate_mode),
1995 .help = "Whether pre-allocation is performed when laying out files",
1997 .category = FIO_OPT_C_FILE,
1998 .group = FIO_OPT_G_INVALID,
2001 .oval = FIO_FALLOCATE_NONE,
2002 .help = "Do not pre-allocate space",
2005 .oval = FIO_FALLOCATE_POSIX,
2006 .help = "Use posix_fallocate()",
2008 #ifdef CONFIG_LINUX_FALLOCATE
2010 .oval = FIO_FALLOCATE_KEEP_SIZE,
2011 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2014 /* Compatibility with former boolean values */
2016 .oval = FIO_FALLOCATE_NONE,
2017 .help = "Alias for 'none'",
2020 .oval = FIO_FALLOCATE_POSIX,
2021 .help = "Alias for 'posix'",
2025 #endif /* CONFIG_POSIX_FALLOCATE */
2027 .name = "fadvise_hint",
2028 .lname = "Fadvise hint",
2029 .type = FIO_OPT_BOOL,
2030 .off1 = td_var_offset(fadvise_hint),
2031 .help = "Use fadvise() to advise the kernel on IO pattern",
2033 .category = FIO_OPT_C_FILE,
2034 .group = FIO_OPT_G_INVALID,
2039 .type = FIO_OPT_INT,
2040 .off1 = td_var_offset(fsync_blocks),
2041 .help = "Issue fsync for writes every given number of blocks",
2044 .category = FIO_OPT_C_FILE,
2045 .group = FIO_OPT_G_INVALID,
2048 .name = "fdatasync",
2049 .lname = "Fdatasync",
2050 .type = FIO_OPT_INT,
2051 .off1 = td_var_offset(fdatasync_blocks),
2052 .help = "Issue fdatasync for writes every given number of blocks",
2055 .category = FIO_OPT_C_FILE,
2056 .group = FIO_OPT_G_INVALID,
2059 .name = "write_barrier",
2060 .lname = "Write barrier",
2061 .type = FIO_OPT_INT,
2062 .off1 = td_var_offset(barrier_blocks),
2063 .help = "Make every Nth write a barrier write",
2066 .category = FIO_OPT_C_IO,
2067 .group = FIO_OPT_G_INVALID,
2069 #ifdef CONFIG_SYNC_FILE_RANGE
2071 .name = "sync_file_range",
2072 .lname = "Sync file range",
2074 { .ival = "wait_before",
2075 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2076 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2080 .oval = SYNC_FILE_RANGE_WRITE,
2081 .help = "SYNC_FILE_RANGE_WRITE",
2085 .ival = "wait_after",
2086 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2087 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2091 .type = FIO_OPT_STR_MULTI,
2093 .off1 = td_var_offset(sync_file_range),
2094 .help = "Use sync_file_range()",
2095 .category = FIO_OPT_C_FILE,
2096 .group = FIO_OPT_G_INVALID,
2101 .lname = "Direct I/O",
2102 .type = FIO_OPT_BOOL,
2103 .off1 = td_var_offset(odirect),
2104 .help = "Use O_DIRECT IO (negates buffered)",
2106 .inverse = "buffered",
2107 .category = FIO_OPT_C_IO,
2108 .group = FIO_OPT_G_IO_TYPE,
2112 .lname = "Atomic I/O",
2113 .type = FIO_OPT_BOOL,
2114 .off1 = td_var_offset(oatomic),
2115 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2117 .category = FIO_OPT_C_IO,
2118 .group = FIO_OPT_G_IO_TYPE,
2122 .lname = "Buffered I/O",
2123 .type = FIO_OPT_BOOL,
2124 .off1 = td_var_offset(odirect),
2126 .help = "Use buffered IO (negates direct)",
2128 .inverse = "direct",
2129 .category = FIO_OPT_C_IO,
2130 .group = FIO_OPT_G_IO_TYPE,
2133 .name = "overwrite",
2134 .lname = "Overwrite",
2135 .type = FIO_OPT_BOOL,
2136 .off1 = td_var_offset(overwrite),
2137 .help = "When writing, set whether to overwrite current data",
2139 .category = FIO_OPT_C_FILE,
2140 .group = FIO_OPT_G_INVALID,
2145 .type = FIO_OPT_INT,
2146 .off1 = td_var_offset(loops),
2147 .help = "Number of times to run the job",
2150 .category = FIO_OPT_C_GENERAL,
2151 .group = FIO_OPT_G_RUNTIME,
2155 .lname = "Number of jobs",
2156 .type = FIO_OPT_INT,
2157 .off1 = td_var_offset(numjobs),
2158 .help = "Duplicate this job this many times",
2161 .category = FIO_OPT_C_GENERAL,
2162 .group = FIO_OPT_G_RUNTIME,
2165 .name = "startdelay",
2166 .lname = "Start delay",
2167 .type = FIO_OPT_STR_VAL_TIME,
2168 .off1 = td_var_offset(start_delay),
2169 .off2 = td_var_offset(start_delay_high),
2170 .help = "Only start job when this period has passed",
2173 .category = FIO_OPT_C_GENERAL,
2174 .group = FIO_OPT_G_RUNTIME,
2180 .type = FIO_OPT_STR_VAL_TIME,
2181 .off1 = td_var_offset(timeout),
2182 .help = "Stop workload when this amount of time has passed",
2185 .category = FIO_OPT_C_GENERAL,
2186 .group = FIO_OPT_G_RUNTIME,
2189 .name = "time_based",
2190 .lname = "Time based",
2191 .type = FIO_OPT_STR_SET,
2192 .off1 = td_var_offset(time_based),
2193 .help = "Keep running until runtime/timeout is met",
2194 .category = FIO_OPT_C_GENERAL,
2195 .group = FIO_OPT_G_RUNTIME,
2198 .name = "verify_only",
2199 .lname = "Verify only",
2200 .type = FIO_OPT_STR_SET,
2201 .off1 = td_var_offset(verify_only),
2202 .help = "Verifies previously written data is still valid",
2203 .category = FIO_OPT_C_GENERAL,
2204 .group = FIO_OPT_G_RUNTIME,
2207 .name = "ramp_time",
2208 .lname = "Ramp time",
2209 .type = FIO_OPT_STR_VAL_TIME,
2210 .off1 = td_var_offset(ramp_time),
2211 .help = "Ramp up time before measuring performance",
2213 .category = FIO_OPT_C_GENERAL,
2214 .group = FIO_OPT_G_RUNTIME,
2217 .name = "clocksource",
2218 .lname = "Clock source",
2219 .type = FIO_OPT_STR,
2220 .cb = fio_clock_source_cb,
2221 .off1 = td_var_offset(clocksource),
2222 .help = "What type of timing source to use",
2223 .category = FIO_OPT_C_GENERAL,
2224 .group = FIO_OPT_G_CLOCK,
2226 #ifdef CONFIG_GETTIMEOFDAY
2227 { .ival = "gettimeofday",
2229 .help = "Use gettimeofday(2) for timing",
2232 #ifdef CONFIG_CLOCK_GETTIME
2233 { .ival = "clock_gettime",
2234 .oval = CS_CGETTIME,
2235 .help = "Use clock_gettime(2) for timing",
2238 #ifdef ARCH_HAVE_CPU_CLOCK
2240 .oval = CS_CPUCLOCK,
2241 .help = "Use CPU private clock",
2249 .lname = "I/O Memory",
2250 .type = FIO_OPT_STR,
2252 .off1 = td_var_offset(mem_type),
2253 .help = "Backing type for IO buffers",
2255 .category = FIO_OPT_C_IO,
2256 .group = FIO_OPT_G_INVALID,
2260 .help = "Use malloc(3) for IO buffers",
2262 #ifndef CONFIG_NO_SHM
2265 .help = "Use shared memory segments for IO buffers",
2267 #ifdef FIO_HAVE_HUGETLB
2268 { .ival = "shmhuge",
2269 .oval = MEM_SHMHUGE,
2270 .help = "Like shm, but use huge pages",
2276 .help = "Use mmap(2) (file or anon) for IO buffers",
2278 #ifdef FIO_HAVE_HUGETLB
2279 { .ival = "mmaphuge",
2280 .oval = MEM_MMAPHUGE,
2281 .help = "Like mmap, but use huge pages",
2287 .name = "iomem_align",
2288 .alias = "mem_align",
2289 .lname = "I/O memory alignment",
2290 .type = FIO_OPT_INT,
2291 .off1 = td_var_offset(mem_align),
2293 .help = "IO memory buffer offset alignment",
2297 .category = FIO_OPT_C_IO,
2298 .group = FIO_OPT_G_INVALID,
2303 .type = FIO_OPT_STR,
2304 .off1 = td_var_offset(verify),
2305 .help = "Verify data written",
2307 .category = FIO_OPT_C_IO,
2308 .group = FIO_OPT_G_VERIFY,
2311 .oval = VERIFY_NONE,
2312 .help = "Don't do IO verification",
2316 .help = "Use md5 checksums for verification",
2319 .oval = VERIFY_CRC64,
2320 .help = "Use crc64 checksums for verification",
2323 .oval = VERIFY_CRC32,
2324 .help = "Use crc32 checksums for verification",
2326 { .ival = "crc32c-intel",
2327 .oval = VERIFY_CRC32C,
2328 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2331 .oval = VERIFY_CRC32C,
2332 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2335 .oval = VERIFY_CRC16,
2336 .help = "Use crc16 checksums for verification",
2339 .oval = VERIFY_CRC7,
2340 .help = "Use crc7 checksums for verification",
2343 .oval = VERIFY_SHA1,
2344 .help = "Use sha1 checksums for verification",
2347 .oval = VERIFY_SHA256,
2348 .help = "Use sha256 checksums for verification",
2351 .oval = VERIFY_SHA512,
2352 .help = "Use sha512 checksums for verification",
2355 .oval = VERIFY_XXHASH,
2356 .help = "Use xxhash checksums for verification",
2359 .oval = VERIFY_META,
2360 .help = "Use io information",
2364 .oval = VERIFY_NULL,
2365 .help = "Pretend to verify",
2370 .name = "do_verify",
2371 .lname = "Perform verify step",
2372 .type = FIO_OPT_BOOL,
2373 .off1 = td_var_offset(do_verify),
2374 .help = "Run verification stage after write",
2378 .category = FIO_OPT_C_IO,
2379 .group = FIO_OPT_G_VERIFY,
2382 .name = "verifysort",
2383 .lname = "Verify sort",
2384 .type = FIO_OPT_BOOL,
2385 .off1 = td_var_offset(verifysort),
2386 .help = "Sort written verify blocks for read back",
2390 .category = FIO_OPT_C_IO,
2391 .group = FIO_OPT_G_VERIFY,
2394 .name = "verifysort_nr",
2395 .type = FIO_OPT_INT,
2396 .off1 = td_var_offset(verifysort_nr),
2397 .help = "Pre-load and sort verify blocks for a read workload",
2402 .category = FIO_OPT_C_IO,
2403 .group = FIO_OPT_G_VERIFY,
2406 .name = "verify_interval",
2407 .lname = "Verify interval",
2408 .type = FIO_OPT_INT,
2409 .off1 = td_var_offset(verify_interval),
2410 .minval = 2 * sizeof(struct verify_header),
2411 .help = "Store verify buffer header every N bytes",
2414 .interval = 2 * sizeof(struct verify_header),
2415 .category = FIO_OPT_C_IO,
2416 .group = FIO_OPT_G_VERIFY,
2419 .name = "verify_offset",
2420 .lname = "Verify offset",
2421 .type = FIO_OPT_INT,
2422 .help = "Offset verify header location by N bytes",
2423 .off1 = td_var_offset(verify_offset),
2424 .minval = sizeof(struct verify_header),
2427 .category = FIO_OPT_C_IO,
2428 .group = FIO_OPT_G_VERIFY,
2431 .name = "verify_pattern",
2432 .lname = "Verify pattern",
2433 .type = FIO_OPT_STR,
2434 .cb = str_verify_pattern_cb,
2435 .help = "Fill pattern for IO buffers",
2438 .category = FIO_OPT_C_IO,
2439 .group = FIO_OPT_G_VERIFY,
2442 .name = "verify_fatal",
2443 .lname = "Verify fatal",
2444 .type = FIO_OPT_BOOL,
2445 .off1 = td_var_offset(verify_fatal),
2447 .help = "Exit on a single verify failure, don't continue",
2450 .category = FIO_OPT_C_IO,
2451 .group = FIO_OPT_G_VERIFY,
2454 .name = "verify_dump",
2455 .lname = "Verify dump",
2456 .type = FIO_OPT_BOOL,
2457 .off1 = td_var_offset(verify_dump),
2459 .help = "Dump contents of good and bad blocks on failure",
2462 .category = FIO_OPT_C_IO,
2463 .group = FIO_OPT_G_VERIFY,
2466 .name = "verify_async",
2467 .lname = "Verify asynchronously",
2468 .type = FIO_OPT_INT,
2469 .off1 = td_var_offset(verify_async),
2471 .help = "Number of async verifier threads to use",
2474 .category = FIO_OPT_C_IO,
2475 .group = FIO_OPT_G_VERIFY,
2478 .name = "verify_backlog",
2479 .lname = "Verify backlog",
2480 .type = FIO_OPT_STR_VAL,
2481 .off1 = td_var_offset(verify_backlog),
2482 .help = "Verify after this number of blocks are written",
2485 .category = FIO_OPT_C_IO,
2486 .group = FIO_OPT_G_VERIFY,
2489 .name = "verify_backlog_batch",
2490 .lname = "Verify backlog batch",
2491 .type = FIO_OPT_INT,
2492 .off1 = td_var_offset(verify_batch),
2493 .help = "Verify this number of IO blocks",
2496 .category = FIO_OPT_C_IO,
2497 .group = FIO_OPT_G_VERIFY,
2499 #ifdef FIO_HAVE_CPU_AFFINITY
2501 .name = "verify_async_cpus",
2502 .lname = "Async verify CPUs",
2503 .type = FIO_OPT_STR,
2504 .cb = str_verify_cpus_allowed_cb,
2505 .help = "Set CPUs allowed for async verify threads",
2506 .parent = "verify_async",
2508 .category = FIO_OPT_C_IO,
2509 .group = FIO_OPT_G_VERIFY,
2513 .name = "experimental_verify",
2514 .off1 = td_var_offset(experimental_verify),
2515 .type = FIO_OPT_BOOL,
2516 .help = "Enable experimental verification",
2517 .category = FIO_OPT_C_IO,
2518 .group = FIO_OPT_G_VERIFY,
2520 #ifdef FIO_HAVE_TRIM
2522 .name = "trim_percentage",
2523 .lname = "Trim percentage",
2524 .type = FIO_OPT_INT,
2525 .off1 = td_var_offset(trim_percentage),
2528 .help = "Number of verify blocks to discard/trim",
2533 .category = FIO_OPT_C_IO,
2534 .group = FIO_OPT_G_TRIM,
2537 .name = "trim_verify_zero",
2538 .lname = "Verify trim zero",
2539 .type = FIO_OPT_BOOL,
2540 .help = "Verify that trim/discarded blocks are returned as zeroes",
2541 .off1 = td_var_offset(trim_zero),
2542 .parent = "trim_percentage",
2545 .category = FIO_OPT_C_IO,
2546 .group = FIO_OPT_G_TRIM,
2549 .name = "trim_backlog",
2550 .lname = "Trim backlog",
2551 .type = FIO_OPT_STR_VAL,
2552 .off1 = td_var_offset(trim_backlog),
2553 .help = "Trim after this number of blocks are written",
2554 .parent = "trim_percentage",
2557 .category = FIO_OPT_C_IO,
2558 .group = FIO_OPT_G_TRIM,
2561 .name = "trim_backlog_batch",
2562 .lname = "Trim backlog batch",
2563 .type = FIO_OPT_INT,
2564 .off1 = td_var_offset(trim_batch),
2565 .help = "Trim this number of IO blocks",
2566 .parent = "trim_percentage",
2569 .category = FIO_OPT_C_IO,
2570 .group = FIO_OPT_G_TRIM,
2574 .name = "write_iolog",
2575 .lname = "Write I/O log",
2576 .type = FIO_OPT_STR_STORE,
2577 .off1 = td_var_offset(write_iolog_file),
2578 .help = "Store IO pattern to file",
2579 .category = FIO_OPT_C_IO,
2580 .group = FIO_OPT_G_IOLOG,
2583 .name = "read_iolog",
2584 .lname = "Read I/O log",
2585 .type = FIO_OPT_STR_STORE,
2586 .off1 = td_var_offset(read_iolog_file),
2587 .help = "Playback IO pattern from file",
2588 .category = FIO_OPT_C_IO,
2589 .group = FIO_OPT_G_IOLOG,
2592 .name = "replay_no_stall",
2593 .lname = "Don't stall on replay",
2594 .type = FIO_OPT_BOOL,
2595 .off1 = td_var_offset(no_stall),
2597 .parent = "read_iolog",
2599 .help = "Playback IO pattern file as fast as possible without stalls",
2600 .category = FIO_OPT_C_IO,
2601 .group = FIO_OPT_G_IOLOG,
2604 .name = "replay_redirect",
2605 .lname = "Redirect device for replay",
2606 .type = FIO_OPT_STR_STORE,
2607 .off1 = td_var_offset(replay_redirect),
2608 .parent = "read_iolog",
2610 .help = "Replay all I/O onto this device, regardless of trace device",
2611 .category = FIO_OPT_C_IO,
2612 .group = FIO_OPT_G_IOLOG,
2615 .name = "exec_prerun",
2616 .lname = "Pre-execute runnable",
2617 .type = FIO_OPT_STR_STORE,
2618 .off1 = td_var_offset(exec_prerun),
2619 .help = "Execute this file prior to running job",
2620 .category = FIO_OPT_C_GENERAL,
2621 .group = FIO_OPT_G_INVALID,
2624 .name = "exec_postrun",
2625 .lname = "Post-execute runnable",
2626 .type = FIO_OPT_STR_STORE,
2627 .off1 = td_var_offset(exec_postrun),
2628 .help = "Execute this file after running job",
2629 .category = FIO_OPT_C_GENERAL,
2630 .group = FIO_OPT_G_INVALID,
2632 #ifdef FIO_HAVE_IOSCHED_SWITCH
2634 .name = "ioscheduler",
2635 .lname = "I/O scheduler",
2636 .type = FIO_OPT_STR_STORE,
2637 .off1 = td_var_offset(ioscheduler),
2638 .help = "Use this IO scheduler on the backing device",
2639 .category = FIO_OPT_C_FILE,
2640 .group = FIO_OPT_G_INVALID,
2645 .lname = "Zone size",
2646 .type = FIO_OPT_STR_VAL,
2647 .off1 = td_var_offset(zone_size),
2648 .help = "Amount of data to read per zone",
2650 .interval = 1024 * 1024,
2651 .category = FIO_OPT_C_IO,
2652 .group = FIO_OPT_G_ZONE,
2655 .name = "zonerange",
2656 .lname = "Zone range",
2657 .type = FIO_OPT_STR_VAL,
2658 .off1 = td_var_offset(zone_range),
2659 .help = "Give size of an IO zone",
2661 .interval = 1024 * 1024,
2662 .category = FIO_OPT_C_IO,
2663 .group = FIO_OPT_G_ZONE,
2667 .lname = "Zone skip",
2668 .type = FIO_OPT_STR_VAL,
2669 .off1 = td_var_offset(zone_skip),
2670 .help = "Space between IO zones",
2672 .interval = 1024 * 1024,
2673 .category = FIO_OPT_C_IO,
2674 .group = FIO_OPT_G_ZONE,
2678 .lname = "Lock memory",
2679 .type = FIO_OPT_STR_VAL,
2680 .off1 = td_var_offset(lockmem),
2681 .help = "Lock down this amount of memory (per worker)",
2683 .interval = 1024 * 1024,
2684 .category = FIO_OPT_C_GENERAL,
2685 .group = FIO_OPT_G_INVALID,
2688 .name = "rwmixread",
2689 .lname = "Read/write mix read",
2690 .type = FIO_OPT_INT,
2691 .cb = str_rwmix_read_cb,
2693 .help = "Percentage of mixed workload that is reads",
2696 .inverse = "rwmixwrite",
2697 .category = FIO_OPT_C_IO,
2698 .group = FIO_OPT_G_RWMIX,
2701 .name = "rwmixwrite",
2702 .lname = "Read/write mix write",
2703 .type = FIO_OPT_INT,
2704 .cb = str_rwmix_write_cb,
2706 .help = "Percentage of mixed workload that is writes",
2709 .inverse = "rwmixread",
2710 .category = FIO_OPT_C_IO,
2711 .group = FIO_OPT_G_RWMIX,
2714 .name = "rwmixcycle",
2715 .lname = "Read/write mix cycle",
2716 .type = FIO_OPT_DEPRECATED,
2717 .category = FIO_OPT_C_IO,
2718 .group = FIO_OPT_G_RWMIX,
2723 .type = FIO_OPT_INT,
2724 .off1 = td_var_offset(nice),
2725 .help = "Set job CPU nice value",
2730 .category = FIO_OPT_C_GENERAL,
2731 .group = FIO_OPT_G_CRED,
2733 #ifdef FIO_HAVE_IOPRIO
2736 .lname = "I/O nice priority",
2737 .type = FIO_OPT_INT,
2738 .off1 = td_var_offset(ioprio),
2739 .help = "Set job IO priority value",
2743 .category = FIO_OPT_C_GENERAL,
2744 .group = FIO_OPT_G_CRED,
2747 .name = "prioclass",
2748 .lname = "I/O nice priority class",
2749 .type = FIO_OPT_INT,
2750 .off1 = td_var_offset(ioprio_class),
2751 .help = "Set job IO priority class",
2755 .category = FIO_OPT_C_GENERAL,
2756 .group = FIO_OPT_G_CRED,
2760 .name = "thinktime",
2761 .lname = "Thinktime",
2762 .type = FIO_OPT_INT,
2763 .off1 = td_var_offset(thinktime),
2764 .help = "Idle time between IO buffers (usec)",
2766 .category = FIO_OPT_C_IO,
2767 .group = FIO_OPT_G_THINKTIME,
2770 .name = "thinktime_spin",
2771 .lname = "Thinktime spin",
2772 .type = FIO_OPT_INT,
2773 .off1 = td_var_offset(thinktime_spin),
2774 .help = "Start think time by spinning this amount (usec)",
2776 .parent = "thinktime",
2778 .category = FIO_OPT_C_IO,
2779 .group = FIO_OPT_G_THINKTIME,
2782 .name = "thinktime_blocks",
2783 .lname = "Thinktime blocks",
2784 .type = FIO_OPT_INT,
2785 .off1 = td_var_offset(thinktime_blocks),
2786 .help = "IO buffer period between 'thinktime'",
2788 .parent = "thinktime",
2790 .category = FIO_OPT_C_IO,
2791 .group = FIO_OPT_G_THINKTIME,
2795 .lname = "I/O rate",
2796 .type = FIO_OPT_INT,
2797 .off1 = td_var_offset(rate[DDIR_READ]),
2798 .off2 = td_var_offset(rate[DDIR_WRITE]),
2799 .off3 = td_var_offset(rate[DDIR_TRIM]),
2800 .help = "Set bandwidth rate",
2801 .category = FIO_OPT_C_IO,
2802 .group = FIO_OPT_G_RATE,
2806 .lname = "I/O min rate",
2807 .type = FIO_OPT_INT,
2808 .off1 = td_var_offset(ratemin[DDIR_READ]),
2809 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2810 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2811 .help = "Job must meet this rate or it will be shutdown",
2814 .category = FIO_OPT_C_IO,
2815 .group = FIO_OPT_G_RATE,
2818 .name = "rate_iops",
2819 .lname = "I/O rate IOPS",
2820 .type = FIO_OPT_INT,
2821 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2822 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2823 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2824 .help = "Limit IO used to this number of IO operations/sec",
2826 .category = FIO_OPT_C_IO,
2827 .group = FIO_OPT_G_RATE,
2830 .name = "rate_iops_min",
2831 .lname = "I/O min rate IOPS",
2832 .type = FIO_OPT_INT,
2833 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2834 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2835 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2836 .help = "Job must meet this rate or it will be shut down",
2837 .parent = "rate_iops",
2839 .category = FIO_OPT_C_IO,
2840 .group = FIO_OPT_G_RATE,
2843 .name = "ratecycle",
2844 .lname = "I/O rate cycle",
2845 .type = FIO_OPT_INT,
2846 .off1 = td_var_offset(ratecycle),
2847 .help = "Window average for rate limits (msec)",
2851 .category = FIO_OPT_C_IO,
2852 .group = FIO_OPT_G_RATE,
2855 .name = "max_latency",
2856 .type = FIO_OPT_INT,
2857 .off1 = td_var_offset(max_latency),
2858 .help = "Maximum tolerated IO latency (usec)",
2859 .category = FIO_OPT_C_IO,
2860 .group = FIO_OPT_G_LATPROF,
2863 .name = "latency_target",
2864 .lname = "Latency Target (usec)",
2865 .type = FIO_OPT_STR_VAL_TIME,
2866 .off1 = td_var_offset(latency_target),
2867 .help = "Ramp to max queue depth supporting this latency",
2868 .category = FIO_OPT_C_IO,
2869 .group = FIO_OPT_G_LATPROF,
2872 .name = "latency_window",
2873 .lname = "Latency Window (usec)",
2874 .type = FIO_OPT_STR_VAL_TIME,
2875 .off1 = td_var_offset(latency_window),
2876 .help = "Time to sustain latency_target",
2877 .category = FIO_OPT_C_IO,
2878 .group = FIO_OPT_G_LATPROF,
2881 .name = "latency_percentile",
2882 .lname = "Latency Percentile",
2883 .type = FIO_OPT_FLOAT_LIST,
2884 .off1 = td_var_offset(latency_percentile),
2885 .help = "Percentile of IOs must be below latency_target",
2890 .category = FIO_OPT_C_IO,
2891 .group = FIO_OPT_G_LATPROF,
2894 .name = "invalidate",
2895 .lname = "Cache invalidate",
2896 .type = FIO_OPT_BOOL,
2897 .off1 = td_var_offset(invalidate_cache),
2898 .help = "Invalidate buffer/page cache prior to running job",
2900 .category = FIO_OPT_C_IO,
2901 .group = FIO_OPT_G_IO_TYPE,
2905 .lname = "Synchronous I/O",
2906 .type = FIO_OPT_BOOL,
2907 .off1 = td_var_offset(sync_io),
2908 .help = "Use O_SYNC for buffered writes",
2910 .parent = "buffered",
2912 .category = FIO_OPT_C_IO,
2913 .group = FIO_OPT_G_IO_TYPE,
2916 .name = "create_serialize",
2917 .lname = "Create serialize",
2918 .type = FIO_OPT_BOOL,
2919 .off1 = td_var_offset(create_serialize),
2920 .help = "Serialize creating of job files",
2922 .category = FIO_OPT_C_FILE,
2923 .group = FIO_OPT_G_INVALID,
2926 .name = "create_fsync",
2927 .lname = "Create fsync",
2928 .type = FIO_OPT_BOOL,
2929 .off1 = td_var_offset(create_fsync),
2930 .help = "fsync file after creation",
2932 .category = FIO_OPT_C_FILE,
2933 .group = FIO_OPT_G_INVALID,
2936 .name = "create_on_open",
2937 .lname = "Create on open",
2938 .type = FIO_OPT_BOOL,
2939 .off1 = td_var_offset(create_on_open),
2940 .help = "Create files when they are opened for IO",
2942 .category = FIO_OPT_C_FILE,
2943 .group = FIO_OPT_G_INVALID,
2946 .name = "create_only",
2947 .type = FIO_OPT_BOOL,
2948 .off1 = td_var_offset(create_only),
2949 .help = "Only perform file creation phase",
2950 .category = FIO_OPT_C_FILE,
2955 .lname = "Pre-read files",
2956 .type = FIO_OPT_BOOL,
2957 .off1 = td_var_offset(pre_read),
2958 .help = "Pre-read files before starting official testing",
2960 .category = FIO_OPT_C_FILE,
2961 .group = FIO_OPT_G_INVALID,
2963 #ifdef FIO_HAVE_CPU_AFFINITY
2966 .lname = "CPU mask",
2967 .type = FIO_OPT_INT,
2968 .cb = str_cpumask_cb,
2969 .help = "CPU affinity mask",
2970 .category = FIO_OPT_C_GENERAL,
2971 .group = FIO_OPT_G_CRED,
2974 .name = "cpus_allowed",
2975 .lname = "CPUs allowed",
2976 .type = FIO_OPT_STR,
2977 .cb = str_cpus_allowed_cb,
2978 .help = "Set CPUs allowed",
2979 .category = FIO_OPT_C_GENERAL,
2980 .group = FIO_OPT_G_CRED,
2983 .name = "cpus_allowed_policy",
2984 .lname = "CPUs allowed distribution policy",
2985 .type = FIO_OPT_STR,
2986 .off1 = td_var_offset(cpus_allowed_policy),
2987 .help = "Distribution policy for cpus_allowed",
2988 .parent = "cpus_allowed",
2992 .oval = FIO_CPUS_SHARED,
2993 .help = "Mask shared between threads",
2996 .oval = FIO_CPUS_SPLIT,
2997 .help = "Mask split between threads",
3000 .category = FIO_OPT_C_GENERAL,
3001 .group = FIO_OPT_G_CRED,
3004 #ifdef CONFIG_LIBNUMA
3006 .name = "numa_cpu_nodes",
3007 .type = FIO_OPT_STR,
3008 .cb = str_numa_cpunodes_cb,
3009 .help = "NUMA CPU nodes bind",
3010 .category = FIO_OPT_C_GENERAL,
3011 .group = FIO_OPT_G_INVALID,
3014 .name = "numa_mem_policy",
3015 .type = FIO_OPT_STR,
3016 .cb = str_numa_mpol_cb,
3017 .help = "NUMA memory policy setup",
3018 .category = FIO_OPT_C_GENERAL,
3019 .group = FIO_OPT_G_INVALID,
3023 .name = "end_fsync",
3024 .lname = "End fsync",
3025 .type = FIO_OPT_BOOL,
3026 .off1 = td_var_offset(end_fsync),
3027 .help = "Include fsync at the end of job",
3029 .category = FIO_OPT_C_FILE,
3030 .group = FIO_OPT_G_INVALID,
3033 .name = "fsync_on_close",
3034 .lname = "Fsync on close",
3035 .type = FIO_OPT_BOOL,
3036 .off1 = td_var_offset(fsync_on_close),
3037 .help = "fsync files on close",
3039 .category = FIO_OPT_C_FILE,
3040 .group = FIO_OPT_G_INVALID,
3044 .lname = "Unlink file",
3045 .type = FIO_OPT_BOOL,
3046 .off1 = td_var_offset(unlink),
3047 .help = "Unlink created files after job has completed",
3049 .category = FIO_OPT_C_FILE,
3050 .group = FIO_OPT_G_INVALID,
3054 .lname = "Exit-all on terminate",
3055 .type = FIO_OPT_STR_SET,
3056 .cb = str_exitall_cb,
3057 .help = "Terminate all jobs when one exits",
3058 .category = FIO_OPT_C_GENERAL,
3059 .group = FIO_OPT_G_PROCESS,
3062 .name = "stonewall",
3063 .lname = "Wait for previous",
3064 .alias = "wait_for_previous",
3065 .type = FIO_OPT_STR_SET,
3066 .off1 = td_var_offset(stonewall),
3067 .help = "Insert a hard barrier between this job and previous",
3068 .category = FIO_OPT_C_GENERAL,
3069 .group = FIO_OPT_G_PROCESS,
3072 .name = "new_group",
3073 .lname = "New group",
3074 .type = FIO_OPT_STR_SET,
3075 .off1 = td_var_offset(new_group),
3076 .help = "Mark the start of a new group (for reporting)",
3077 .category = FIO_OPT_C_GENERAL,
3078 .group = FIO_OPT_G_PROCESS,
3083 .type = FIO_OPT_STR_SET,
3084 .off1 = td_var_offset(use_thread),
3085 .help = "Use threads instead of processes",
3086 #ifdef CONFIG_NO_SHM
3090 .category = FIO_OPT_C_GENERAL,
3091 .group = FIO_OPT_G_PROCESS,
3094 .name = "write_bw_log",
3095 .lname = "Write bandwidth log",
3096 .type = FIO_OPT_STR_STORE,
3097 .off1 = td_var_offset(bw_log_file),
3098 .help = "Write log of bandwidth during run",
3099 .category = FIO_OPT_C_LOG,
3100 .group = FIO_OPT_G_INVALID,
3103 .name = "write_lat_log",
3104 .lname = "Write latency log",
3105 .type = FIO_OPT_STR_STORE,
3106 .off1 = td_var_offset(lat_log_file),
3107 .help = "Write log of latency during run",
3108 .category = FIO_OPT_C_LOG,
3109 .group = FIO_OPT_G_INVALID,
3112 .name = "write_iops_log",
3113 .lname = "Write IOPS log",
3114 .type = FIO_OPT_STR_STORE,
3115 .off1 = td_var_offset(iops_log_file),
3116 .help = "Write log of IOPS during run",
3117 .category = FIO_OPT_C_LOG,
3118 .group = FIO_OPT_G_INVALID,
3121 .name = "log_avg_msec",
3122 .lname = "Log averaging (msec)",
3123 .type = FIO_OPT_INT,
3124 .off1 = td_var_offset(log_avg_msec),
3125 .help = "Average bw/iops/lat logs over this period of time",
3127 .category = FIO_OPT_C_LOG,
3128 .group = FIO_OPT_G_INVALID,
3131 .name = "log_offset",
3132 .lname = "Log offset of IO",
3133 .type = FIO_OPT_BOOL,
3134 .off1 = td_var_offset(log_offset),
3135 .help = "Include offset of IO for each log entry",
3137 .category = FIO_OPT_C_LOG,
3138 .group = FIO_OPT_G_INVALID,
3142 .name = "log_compression",
3143 .lname = "Log compression",
3144 .type = FIO_OPT_INT,
3145 .off1 = td_var_offset(log_gz),
3146 .help = "Log in compressed chunks of this size",
3147 .minval = 32 * 1024 * 1024ULL,
3148 .maxval = 512 * 1024 * 1024ULL,
3149 .category = FIO_OPT_C_LOG,
3150 .group = FIO_OPT_G_INVALID,
3153 .name = "log_store_compressed",
3154 .lname = "Log store compressed",
3155 .type = FIO_OPT_BOOL,
3156 .off1 = td_var_offset(log_gz_store),
3157 .help = "Store logs in a compressed format",
3158 .category = FIO_OPT_C_LOG,
3159 .group = FIO_OPT_G_INVALID,
3163 .name = "bwavgtime",
3164 .lname = "Bandwidth average time",
3165 .type = FIO_OPT_INT,
3166 .off1 = td_var_offset(bw_avg_time),
3167 .help = "Time window over which to calculate bandwidth"
3170 .parent = "write_bw_log",
3173 .category = FIO_OPT_C_LOG,
3174 .group = FIO_OPT_G_INVALID,
3177 .name = "iopsavgtime",
3178 .lname = "IOPS average time",
3179 .type = FIO_OPT_INT,
3180 .off1 = td_var_offset(iops_avg_time),
3181 .help = "Time window over which to calculate IOPS (msec)",
3183 .parent = "write_iops_log",
3186 .category = FIO_OPT_C_LOG,
3187 .group = FIO_OPT_G_INVALID,
3190 .name = "group_reporting",
3191 .lname = "Group reporting",
3192 .type = FIO_OPT_STR_SET,
3193 .off1 = td_var_offset(group_reporting),
3194 .help = "Do reporting on a per-group basis",
3195 .category = FIO_OPT_C_STAT,
3196 .group = FIO_OPT_G_INVALID,
3199 .name = "zero_buffers",
3200 .lname = "Zero I/O buffers",
3201 .type = FIO_OPT_STR_SET,
3202 .off1 = td_var_offset(zero_buffers),
3203 .help = "Init IO buffers to all zeroes",
3204 .category = FIO_OPT_C_IO,
3205 .group = FIO_OPT_G_IO_BUF,
3208 .name = "refill_buffers",
3209 .lname = "Refill I/O buffers",
3210 .type = FIO_OPT_STR_SET,
3211 .off1 = td_var_offset(refill_buffers),
3212 .help = "Refill IO buffers on every IO submit",
3213 .category = FIO_OPT_C_IO,
3214 .group = FIO_OPT_G_IO_BUF,
3217 .name = "scramble_buffers",
3218 .lname = "Scramble I/O buffers",
3219 .type = FIO_OPT_BOOL,
3220 .off1 = td_var_offset(scramble_buffers),
3221 .help = "Slightly scramble buffers on every IO submit",
3223 .category = FIO_OPT_C_IO,
3224 .group = FIO_OPT_G_IO_BUF,
3227 .name = "buffer_pattern",
3228 .lname = "Buffer pattern",
3229 .type = FIO_OPT_STR,
3230 .cb = str_buffer_pattern_cb,
3231 .help = "Fill pattern for IO buffers",
3232 .category = FIO_OPT_C_IO,
3233 .group = FIO_OPT_G_IO_BUF,
3236 .name = "buffer_compress_percentage",
3237 .lname = "Buffer compression percentage",
3238 .type = FIO_OPT_INT,
3239 .cb = str_buffer_compress_cb,
3242 .help = "How compressible the buffer is (approximately)",
3244 .category = FIO_OPT_C_IO,
3245 .group = FIO_OPT_G_IO_BUF,
3248 .name = "buffer_compress_chunk",
3249 .lname = "Buffer compression chunk size",
3250 .type = FIO_OPT_INT,
3251 .off1 = td_var_offset(compress_chunk),
3252 .parent = "buffer_compress_percentage",
3254 .help = "Size of compressible region in buffer",
3256 .category = FIO_OPT_C_IO,
3257 .group = FIO_OPT_G_IO_BUF,
3260 .name = "clat_percentiles",
3261 .lname = "Completion latency percentiles",
3262 .type = FIO_OPT_BOOL,
3263 .off1 = td_var_offset(clat_percentiles),
3264 .help = "Enable the reporting of completion latency percentiles",
3266 .category = FIO_OPT_C_STAT,
3267 .group = FIO_OPT_G_INVALID,
3270 .name = "percentile_list",
3271 .lname = "Completion latency percentile list",
3272 .type = FIO_OPT_FLOAT_LIST,
3273 .off1 = td_var_offset(percentile_list),
3274 .off2 = td_var_offset(percentile_precision),
3275 .help = "Specify a custom list of percentiles to report",
3276 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3277 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3280 .category = FIO_OPT_C_STAT,
3281 .group = FIO_OPT_G_INVALID,
3284 #ifdef FIO_HAVE_DISK_UTIL
3286 .name = "disk_util",
3287 .lname = "Disk utilization",
3288 .type = FIO_OPT_BOOL,
3289 .off1 = td_var_offset(do_disk_util),
3290 .help = "Log disk utilization statistics",
3292 .category = FIO_OPT_C_STAT,
3293 .group = FIO_OPT_G_INVALID,
3297 .name = "gtod_reduce",
3298 .lname = "Reduce gettimeofday() calls",
3299 .type = FIO_OPT_BOOL,
3300 .help = "Greatly reduce number of gettimeofday() calls",
3301 .cb = str_gtod_reduce_cb,
3304 .category = FIO_OPT_C_STAT,
3305 .group = FIO_OPT_G_INVALID,
3308 .name = "disable_lat",
3309 .lname = "Disable all latency stats",
3310 .type = FIO_OPT_BOOL,
3311 .off1 = td_var_offset(disable_lat),
3312 .help = "Disable latency numbers",
3313 .parent = "gtod_reduce",
3316 .category = FIO_OPT_C_STAT,
3317 .group = FIO_OPT_G_INVALID,
3320 .name = "disable_clat",
3321 .lname = "Disable completion latency stats",
3322 .type = FIO_OPT_BOOL,
3323 .off1 = td_var_offset(disable_clat),
3324 .help = "Disable completion latency numbers",
3325 .parent = "gtod_reduce",
3328 .category = FIO_OPT_C_STAT,
3329 .group = FIO_OPT_G_INVALID,
3332 .name = "disable_slat",
3333 .lname = "Disable submission latency stats",
3334 .type = FIO_OPT_BOOL,
3335 .off1 = td_var_offset(disable_slat),
3336 .help = "Disable submission latency numbers",
3337 .parent = "gtod_reduce",
3340 .category = FIO_OPT_C_STAT,
3341 .group = FIO_OPT_G_INVALID,
3344 .name = "disable_bw_measurement",
3345 .lname = "Disable bandwidth stats",
3346 .type = FIO_OPT_BOOL,
3347 .off1 = td_var_offset(disable_bw),
3348 .help = "Disable bandwidth logging",
3349 .parent = "gtod_reduce",
3352 .category = FIO_OPT_C_STAT,
3353 .group = FIO_OPT_G_INVALID,
3357 .lname = "Dedicated gettimeofday() CPU",
3358 .type = FIO_OPT_INT,
3359 .cb = str_gtod_cpu_cb,
3360 .help = "Set up dedicated gettimeofday() thread on this CPU",
3361 .verify = gtod_cpu_verify,
3362 .category = FIO_OPT_C_GENERAL,
3363 .group = FIO_OPT_G_CLOCK,
3366 .name = "unified_rw_reporting",
3367 .type = FIO_OPT_BOOL,
3368 .off1 = td_var_offset(unified_rw_rep),
3369 .help = "Unify reporting across data direction",
3371 .category = FIO_OPT_C_GENERAL,
3372 .group = FIO_OPT_G_INVALID,
3375 .name = "continue_on_error",
3376 .lname = "Continue on error",
3377 .type = FIO_OPT_STR,
3378 .off1 = td_var_offset(continue_on_error),
3379 .help = "Continue on non-fatal errors during IO",
3381 .category = FIO_OPT_C_GENERAL,
3382 .group = FIO_OPT_G_ERR,
3385 .oval = ERROR_TYPE_NONE,
3386 .help = "Exit when an error is encountered",
3389 .oval = ERROR_TYPE_READ,
3390 .help = "Continue on read errors only",
3393 .oval = ERROR_TYPE_WRITE,
3394 .help = "Continue on write errors only",
3397 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3398 .help = "Continue on any IO errors",
3401 .oval = ERROR_TYPE_VERIFY,
3402 .help = "Continue on verify errors only",
3405 .oval = ERROR_TYPE_ANY,
3406 .help = "Continue on all io and verify errors",
3409 .oval = ERROR_TYPE_NONE,
3410 .help = "Alias for 'none'",
3413 .oval = ERROR_TYPE_ANY,
3414 .help = "Alias for 'all'",
3419 .name = "ignore_error",
3420 .type = FIO_OPT_STR,
3421 .cb = str_ignore_error_cb,
3422 .help = "Set a specific list of errors to ignore",
3424 .category = FIO_OPT_C_GENERAL,
3425 .group = FIO_OPT_G_ERR,
3428 .name = "error_dump",
3429 .type = FIO_OPT_BOOL,
3430 .off1 = td_var_offset(error_dump),
3432 .help = "Dump info on each error",
3433 .category = FIO_OPT_C_GENERAL,
3434 .group = FIO_OPT_G_ERR,
3439 .type = FIO_OPT_STR_STORE,
3440 .off1 = td_var_offset(profile),
3441 .help = "Select a specific builtin performance test",
3442 .category = FIO_OPT_C_PROFILE,
3443 .group = FIO_OPT_G_INVALID,
3448 .type = FIO_OPT_STR_STORE,
3449 .off1 = td_var_offset(cgroup),
3450 .help = "Add job to cgroup of this name",
3451 .category = FIO_OPT_C_GENERAL,
3452 .group = FIO_OPT_G_CGROUP,
3455 .name = "cgroup_nodelete",
3456 .lname = "Cgroup no-delete",
3457 .type = FIO_OPT_BOOL,
3458 .off1 = td_var_offset(cgroup_nodelete),
3459 .help = "Do not delete cgroups after job completion",
3462 .category = FIO_OPT_C_GENERAL,
3463 .group = FIO_OPT_G_CGROUP,
3466 .name = "cgroup_weight",
3467 .lname = "Cgroup weight",
3468 .type = FIO_OPT_INT,
3469 .off1 = td_var_offset(cgroup_weight),
3470 .help = "Use given weight for cgroup",
3474 .category = FIO_OPT_C_GENERAL,
3475 .group = FIO_OPT_G_CGROUP,
3480 .type = FIO_OPT_INT,
3481 .off1 = td_var_offset(uid),
3482 .help = "Run job with this user ID",
3483 .category = FIO_OPT_C_GENERAL,
3484 .group = FIO_OPT_G_CRED,
3488 .lname = "Group ID",
3489 .type = FIO_OPT_INT,
3490 .off1 = td_var_offset(gid),
3491 .help = "Run job with this group ID",
3492 .category = FIO_OPT_C_GENERAL,
3493 .group = FIO_OPT_G_CRED,
3498 .type = FIO_OPT_INT,
3499 .off1 = td_var_offset(kb_base),
3505 .help = "Use 1024 as the K base",
3509 .help = "Use 1000 as the K base",
3512 .help = "How many bytes per KB for reporting (1000 or 1024)",
3513 .category = FIO_OPT_C_GENERAL,
3514 .group = FIO_OPT_G_INVALID,
3517 .name = "unit_base",
3518 .lname = "Base unit for reporting (Bits or Bytes)",
3519 .type = FIO_OPT_INT,
3520 .off1 = td_var_offset(unit_base),
3525 .help = "Auto-detect",
3529 .help = "Normal (byte based)",
3533 .help = "Bit based",
3536 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3537 .category = FIO_OPT_C_GENERAL,
3538 .group = FIO_OPT_G_INVALID,
3541 .name = "hugepage-size",
3542 .lname = "Hugepage size",
3543 .type = FIO_OPT_INT,
3544 .off1 = td_var_offset(hugepage_size),
3545 .help = "When using hugepages, specify size of each page",
3546 .def = __fio_stringify(FIO_HUGE_PAGE),
3547 .interval = 1024 * 1024,
3548 .category = FIO_OPT_C_GENERAL,
3549 .group = FIO_OPT_G_INVALID,
3553 .lname = "I/O flow ID",
3554 .type = FIO_OPT_INT,
3555 .off1 = td_var_offset(flow_id),
3556 .help = "The flow index ID to use",
3558 .category = FIO_OPT_C_IO,
3559 .group = FIO_OPT_G_IO_FLOW,
3563 .lname = "I/O flow weight",
3564 .type = FIO_OPT_INT,
3565 .off1 = td_var_offset(flow),
3566 .help = "Weight for flow control of this job",
3567 .parent = "flow_id",
3570 .category = FIO_OPT_C_IO,
3571 .group = FIO_OPT_G_IO_FLOW,
3574 .name = "flow_watermark",
3575 .lname = "I/O flow watermark",
3576 .type = FIO_OPT_INT,
3577 .off1 = td_var_offset(flow_watermark),
3578 .help = "High watermark for flow control. This option"
3579 " should be set to the same value for all threads"
3580 " with non-zero flow.",
3581 .parent = "flow_id",
3584 .category = FIO_OPT_C_IO,
3585 .group = FIO_OPT_G_IO_FLOW,
3588 .name = "flow_sleep",
3589 .lname = "I/O flow sleep",
3590 .type = FIO_OPT_INT,
3591 .off1 = td_var_offset(flow_sleep),
3592 .help = "How many microseconds to sleep after being held"
3593 " back by the flow control mechanism",
3594 .parent = "flow_id",
3597 .category = FIO_OPT_C_IO,
3598 .group = FIO_OPT_G_IO_FLOW,
3605 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3606 const char *name, int val)
3608 lopt->name = (char *) name;
3610 if (o->type == FIO_OPT_STR_SET)
3611 lopt->has_arg = optional_argument;
3613 lopt->has_arg = required_argument;
3616 static void options_to_lopts(struct fio_option *opts,
3617 struct option *long_options,
3618 int i, int option_type)
3620 struct fio_option *o = &opts[0];
3622 add_to_lopt(&long_options[i], o, o->name, option_type);
3625 add_to_lopt(&long_options[i], o, o->alias, option_type);
3630 assert(i < FIO_NR_OPTIONS);
3634 void fio_options_set_ioengine_opts(struct option *long_options,
3635 struct thread_data *td)
3640 while (long_options[i].name) {
3641 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3642 memset(&long_options[i], 0, sizeof(*long_options));
3649 * Just clear out the prior ioengine options.
3654 options_to_lopts(td->io_ops->options, long_options, i,
3655 FIO_GETOPT_IOENGINE);
3658 void fio_options_dup_and_init(struct option *long_options)
3662 options_init(fio_options);
3665 while (long_options[i].name)
3668 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3671 struct fio_keyword {
3677 static struct fio_keyword fio_keywords[] = {
3679 .word = "$pagesize",
3680 .desc = "Page size in the system",
3683 .word = "$mb_memory",
3684 .desc = "Megabytes of memory online",
3688 .desc = "Number of CPUs online in the system",
3695 void fio_keywords_init(void)
3697 unsigned long long mb_memory;
3701 sprintf(buf, "%lu", (unsigned long) page_size);
3702 fio_keywords[0].replace = strdup(buf);
3704 mb_memory = os_phys_mem() / (1024 * 1024);
3705 sprintf(buf, "%llu", mb_memory);
3706 fio_keywords[1].replace = strdup(buf);
3709 sprintf(buf, "%lu", l);
3710 fio_keywords[2].replace = strdup(buf);
3715 static char *bc_calc(char *str)
3717 char buf[128], *tmp;
3722 * No math, just return string
3724 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3725 !strchr(str, '/')) || strchr(str, '\''))
3729 * Split option from value, we only need to calculate the value
3731 tmp = strchr(str, '=');
3738 * Prevent buffer overflows; such a case isn't reasonable anyway
3740 if (strlen(str) >= 128 || strlen(tmp) > 100)
3743 sprintf(buf, "which %s > /dev/null", BC_APP);
3745 log_err("fio: bc is needed for performing math\n");
3749 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3750 f = popen(buf, "r");
3754 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3761 buf[(tmp - str) + ret - 1] = '\0';
3762 memcpy(buf, str, tmp - str);
3768 * Return a copy of the input string with substrings of the form ${VARNAME}
3769 * substituted with the value of the environment variable VARNAME. The
3770 * substitution always occurs, even if VARNAME is empty or the corresponding
3771 * environment variable undefined.
3773 static char *option_dup_subs(const char *opt)
3775 char out[OPT_LEN_MAX+1];
3776 char in[OPT_LEN_MAX+1];
3779 char *ch1, *ch2, *env;
3780 ssize_t nchr = OPT_LEN_MAX;
3783 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3784 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3788 in[OPT_LEN_MAX] = '\0';
3789 strncpy(in, opt, OPT_LEN_MAX);
3791 while (*inptr && nchr > 0) {
3792 if (inptr[0] == '$' && inptr[1] == '{') {
3793 ch2 = strchr(inptr, '}');
3794 if (ch2 && inptr+1 < ch2) {
3801 envlen = strlen(env);
3802 if (envlen <= nchr) {
3803 memcpy(outptr, env, envlen);
3813 *outptr++ = *inptr++;
3822 * Look for reserved variable names and replace them with real values
3824 static char *fio_keyword_replace(char *opt)
3830 for (i = 0; fio_keywords[i].word != NULL; i++) {
3831 struct fio_keyword *kw = &fio_keywords[i];
3833 while ((s = strstr(opt, kw->word)) != NULL) {
3834 char *new = malloc(strlen(opt) + 1);
3840 * Copy part of the string before the keyword and
3841 * sprintf() the replacement after it.
3843 memcpy(new, opt, olen);
3844 len = sprintf(new + olen, "%s", kw->replace);
3847 * If there's more in the original string, copy that
3850 opt += strlen(kw->word) + olen;
3852 memcpy(new + olen + len, opt, opt - o_org - 1);
3855 * replace opt and free the old opt
3865 * Check for potential math and invoke bc, if possible
3873 static char **dup_and_sub_options(char **opts, int num_opts)
3876 char **opts_copy = malloc(num_opts * sizeof(*opts));
3877 for (i = 0; i < num_opts; i++) {
3878 opts_copy[i] = option_dup_subs(opts[i]);
3881 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3886 int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3889 int i, ret, unknown;
3892 sort_options(opts, fio_options, num_opts);
3893 opts_copy = dup_and_sub_options(opts, num_opts);
3895 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3896 struct fio_option *o;
3897 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3898 &o, td, dump_cmdline);
3906 opts_copy[i] = NULL;
3913 ret |= ioengine_load(td);
3915 sort_options(opts_copy, td->io_ops->options, num_opts);
3918 for (i = 0; i < num_opts; i++) {
3919 struct fio_option *o = NULL;
3925 newret = parse_option(opts_copy[i], opts[i],
3926 td->io_ops->options, &o,
3927 td->eo, dump_cmdline);
3931 log_err("Bad option <%s>\n", opts[i]);
3934 opts_copy[i] = NULL;
3942 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3944 return parse_cmd_option(opt, val, fio_options, td);
3947 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3950 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
3953 void fio_fill_default_options(struct thread_data *td)
3955 td->o.magic = OPT_MAGIC;
3956 fill_default_options(td, fio_options);
3959 int fio_show_option_help(const char *opt)
3961 return show_cmd_help(fio_options, opt);
3964 void options_mem_dupe(void *data, struct fio_option *options)
3966 struct fio_option *o;
3969 for (o = &options[0]; o->name; o++) {
3970 if (o->type != FIO_OPT_STR_STORE)
3973 ptr = td_var(data, o, o->off1);
3975 *ptr = strdup(*ptr);
3980 * dupe FIO_OPT_STR_STORE options
3982 void fio_options_mem_dupe(struct thread_data *td)
3984 options_mem_dupe(&td->o, fio_options);
3986 if (td->eo && td->io_ops) {
3987 void *oldeo = td->eo;
3989 td->eo = malloc(td->io_ops->option_struct_size);
3990 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3991 options_mem_dupe(td->eo, td->io_ops->options);
3995 unsigned int fio_get_kb_base(void *data)
3997 struct thread_options *o = data;
3998 unsigned int kb_base = 0;
4001 * This is a hack... For private options, *data is not holding
4002 * a pointer to the thread_options, but to private data. This means
4003 * we can't safely dereference it, but magic is first so mem wise
4004 * it is valid. But this also means that if the job first sets
4005 * kb_base and expects that to be honored by private options,
4006 * it will be disappointed. We will return the global default
4009 if (o && o->magic == OPT_MAGIC)
4010 kb_base = o->kb_base;
4017 int add_option(struct fio_option *o)
4019 struct fio_option *__o;
4028 if (opt_index + 1 == FIO_MAX_OPTS) {
4029 log_err("fio: FIO_MAX_OPTS is too small\n");
4033 memcpy(&fio_options[opt_index], o, sizeof(*o));
4034 fio_options[opt_index + 1].name = NULL;
4038 void invalidate_profile_options(const char *prof_name)
4040 struct fio_option *o;
4044 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
4045 o->type = FIO_OPT_INVALID;
4046 o->prof_name = NULL;
4052 void add_opt_posval(const char *optname, const char *ival, const char *help)
4054 struct fio_option *o;
4057 o = find_option(fio_options, optname);
4061 for (i = 0; i < PARSE_MAX_VP; i++) {
4062 if (o->posval[i].ival)
4065 o->posval[i].ival = ival;
4066 o->posval[i].help = help;
4071 void del_opt_posval(const char *optname, const char *ival)
4073 struct fio_option *o;
4076 o = find_option(fio_options, optname);
4080 for (i = 0; i < PARSE_MAX_VP; i++) {
4081 if (!o->posval[i].ival)
4083 if (strcmp(o->posval[i].ival, ival))
4086 o->posval[i].ival = NULL;
4087 o->posval[i].help = NULL;
4091 void fio_options_free(struct thread_data *td)
4093 options_free(fio_options, td);
4094 if (td->eo && td->io_ops && td->io_ops->options) {
4095 options_free(td->io_ops->options, td->eo);
4101 struct fio_option *fio_option_find(const char *name)
4103 return find_option(fio_options, name);